PyDDM.ddm_analysis_and_fitting.recalculate_ISF_with_new_background#
- recalculate_ISF_with_new_background(ddm_dataset, background_method=None, background_val=None, amplitude_method=None, lowq_edge=2, highq_edge=5)#
The intermediate scattering function (ISF) is re-calculated from the DDM matrix, with the given background value.
Recall the relationship between the DDM matrix (\(D(q,\Delta t)\)) and the ISF (\(f(q, \Delta t)\)):
\[D(q, \Delta t) = A(q) \left[ 1 - f(q, \Delta t) \right] + B(q)\]We can estimate the amplitude,:math:A(q), and background, \(B(q)\), terms by first calculating the Fourier transforms of all images and averaging those together. See the function
PyDDM.ddm_calc.determining_A_and_B()
. With that function and by assuming that the background is a constant with wavevector (i.e., independent of \(q\)) we can determine \(A(q)\) and \(B\). With \(D(q,\Delta t)\), \(A(q)\), and \(B\), we can then find the ISF \(f(q, \Delta t)\). This is done automatically when calculating the DDM matrix from the time series of images.There are multiple methods for estimating the background. You may select one of four methods available by setting the paramter background_method to 0, 1, 2 or 3. Alternatively, you may set the parameter background_val to the value of the background that you want to use.
- Parameters:
ddm_dataset (xarray Dataset) – Dataset calculated with
PyDDM.ddm_analysis_and_fitting.DDM_Analysis.calculate_DDM_matrix()
background_method ({0,1,2,3}, optional) – Method for calculating the background. If 0, then we look at \(\left< | \tilde{I}(q, t) |^2 \right>_t\) and assume that \(A(q)\) goes to zero by the last 10% of q values. If 1, then we estimate the background to be the minimum of the DDM matrix. If 2, then we estimate the background to be \(\left< DDM\_Matrix(q_{max}, \Delta t) \right>_{\Delta t}\) If 3, then we estimate the background to be zero. If 4, then we do something similar to option ‘0’, but we instead of \(\left< | \tilde{I}(q, t) |^2 \right>_t\), we use \(\left< | \tilde{I}(q, t) |^2 \right>_t - \left< | \tilde{I_{0}}(q) |^2 \right>\) where \(I_0\) is the mean image. If 5, for each q, we fit the first 5 pts of D(q,dt) to a 2nd order polynomial and find the
background_val (float, optional) – Default is None. If not None, then will use this value for \(B\).
amplitude_method ({0,1,2}, optional) – Method for calculating the amplitude.
- Returns:
ddm_dataset – New Dataset with the variables Amplitude and ISF adjusted.
- Return type:
xarray Dataset