cddm.map¶
Data mapping and k-averaging functions.
Module Contents¶
-
cddm.map.sector_indexmap(kmap, anglemap, angle=0.0, sector=30.0, kstep=1.0)¶ Builds indexmap array of integers ranging from -1 (invalid data) and positive integers. Each non-negative integer is a valid k-index computed from sector parameters.
- Parameters
kmap (ndarray) – Size of wavevector at each (i,j) indices in the rfft2 ouptut data.
anglemap (ndarray) – Angle of the wavevector at each (i,j) indices in the rfft2 ouptut data.
angle (float) – Mean angle of the sector in degrees (-90 to 90).
sector (float) – Width of the sector in degrees (between 0 and 180)
kstep (float, optional) – k resolution in units of minimum step size.
- Returns
map – Ouput array of non-zero valued k-indices where data is valid, -1 elsewhere.
- Return type
ndarray
-
cddm.map.rfft2_kangle(kisize=None, kjsize=None, shape=None)¶ Build k,angle arrays based on the size of the fft.
- Parameters
kisize (int) – i-size of the cropped rfft2 data.
kjsize (int) – j-size of the cropped rfft2 data
shape ((int,int)) – Shape of the original data. This is used to calculate step size. If not given, rectangular data is assumed (equal steps).
- Returns
k, angle arrays
- Return type
k, angle, ndarray, ndarray
-
cddm.map.rfft2_grid(kisize=None, kjsize=None, shape=None)¶ Build ki,kj coordinate arrays based on the size of the fft.
- Parameters
kisize (int) – i-size of the cropped rfft2 data.
kjsize (int) – j-size of the cropped rfft2 data
shape ((int,int)) – Shape of the original data. This is used to calculate step size. If not given, rectangular data is assumed (equal steps).
- Returns
ki,kj coordinate arrays
- Return type
ki, kj, ndarray, ndarray
-
cddm.map.k_indexmap(kisize, kjsize, angle=0, sector=5, kstep=1.0, shape=None)¶ Builds indexmap array of integers ranging from -1 (invalid data) and positive integers. Each non-negative integer is a valid k-index computed from sector parameters.
- Parameters
kisize (int) – Height of the fft data
kjsize (int) – Width of the fft data
angle (float) – Mean angle of the sector in degrees (-90 to 90).
sector (float) – Width of the sector in degrees (between 0 and 180)
kstep (float, optional) – k resolution in units of minimum step size.
shape ((int,int), opyional) – Shape of the original data. This is used to calculate step size. If not given, rectangular data is assumed (equal steps).
- Returns
map – Ouput array of non-zero valued k-indices where data is valid, -1 elsewhere.
- Return type
ndarray
-
cddm.map.plot_indexmap(graph)¶ Plots indexmap array
-
cddm.map.k_select(data, angle, sector=5, kstep=1, k=None, shape=None, mask=None)¶ k-selection and k-averaging of normalized (and merged) correlation data.
This function takes (…,i,j,n) correlation data and performs k-based selection and averaging of the data. If you analyzed masked video, you must provide the mask.
- Parameters
deta (array_like) – Input correlation data of shape (…,i,j,n)
angle (float) – Angle between the j axis and the direction of k-vector
sector (float, optional) – Defines sector angle, k-data is avergaed between angle+sector and angle-sector angles
kstep (float, optional) – Defines an approximate k step in pixel units
k (float or list of floats, optional) – If provided, only return at a given k value (and not at all non-zero k values)
shape (tuple) – Shape of the original video frame. If shape is not rectangular, it must be provided.
mask (ndarray, optional) – A boolean array. This is the mask used in
video.mask().
- Returns
out – If k s not defined, this is an iterator that yields a tuple of (k_avg, data_avg) of actual (mean) k and averaged data. If k is a list of indices, it returns an iterator that yields a tuple of (k_avg, data_avg) for every non-zero data if k is an integer, it returns a tuple of (k_avg, data_avg) for a given k-index.
- Return type
iterator, or tuple