Patch
Patch(
data: ndarray = None,
coords: CoordManager = None,
dims: tuple[str, …] = None,
attrs: dascore.core.attrs.PatchAttrs | collections.abc.Mapping[PatchAttrs, Mapping] = None,
)
A Class for managing data and metadata.
See the patch tutorial for examples.
Parameters
Parameter | Description |
---|---|
data | The array data representing fiber optic measurements. |
coords |
The coordinates, or dimensional labels for the data. A few types of input are permitted. If a mapping (eg dict) the value should conform to one of the following three forms: {coord_name: coord} {coord_name: ((dimensions,), coord)} {coord_name: (dimensions, coord)} Where coord can be a numpy array or a BaseCoord object.A CoordManager is also acceptable.
|
dims |
A sequence of dimension strings. The first entry corresponds to the first axis of data, the second to the second dimension, and so on. |
attrs |
Optional attributes (non-coordinate metadata) passed as a dict or PatchAttrs |
Note
If coordinates and dims are not provided, they will be extracted from attrs, if possible.
If coords and attrs are provided, attrs will have priority. This means if there is a conflict between information contained in both, the coords will be recalculated.
Methods
Name | Description |
---|---|
abs | Take the absolute value of the patch data. |
aggregate | Aggregate values along a specified dimension. |
angle | Return a new patch with the phase angles from the data array. |
assert_has_coords | Raise an error if patch doesn’t have required coordinates. |
assign_coords | Deprecated method for update_coords. |
convert_units | Convert the patch data or coordinate units. |
coords_from_df | Update non-dimensional coordinate of a patch using a dataframe. |
correlate | Correlate a single row/column in a 2D patch with every other row/column. |
decimate | Decimate a patch along a dimension. |
detrend | Perform detrending along a given dimension (distance or time) of a patch. |
dft | Perform the discrete Fourier transform (dft) on specified dimension(s). |
differentiate | Calculate first derivative along dimension(s) using centeral diferences. |
dispersion_phase_shift | Compute dispersion images using the phase-shift method. |
drop_coords | Update the coordiantes of a patch. |
dropna | Return a patch with nullish values dropped along dimension. |
equals | Determine if the current patch equals another. |
gaussian_filter | Applies a Gaussian filter along specified dimensions. |
get_coord | Get a managed coordinate, raising if it doesn’t meet requirements. |
idft | Perform the inverse discrete Fourier transform (idft) on specified dimension(s). |
imag | Return a new patch with the imaginary part of the data array. |
integrate | Integrate along a specified dimension using composite trapezoidal rule. |
interpolate | Set coordinates of patch along a dimension using interpolation. |
iresample | Deprecated method. |
iselect | Deprecated form of select. |
median_filter | Apply 2-D median filter. |
update | Return a copy of the Patch with updated data, coords, dims, or attrs. |
normalize | Normalize a patch along a specified dimension. |
pass_filter | Apply a Butterworth pass filter (bandpass, highpass, or lowpass). |
pipe | Pipe the patch to a function. |
real | Return a new patch with the real part of the data array. |
rename_coords | Rename coordinate of Patch. |
resample | Resample along a single dimension using Fourier Method and interpolation. |
rfft | Perform a real fourier transform along the specified dimension. |
rolling | Apply a rolling function along a specified dimension. |
savgol_filter | Applies Savgol filter along spenfied dimensions. |
select | Return a subset of the patch. |
set_dims | Set dimension to non-dimensional coordinate. |
set_units | Set the units of a patch’s data or coordinates. |
simplify_units | Simplify the units contained by the patch to base metric units. |
snap_coords | Snap coordinates to evenly spaced samples. |
sobel_filter | Apply a Sobel filter. |
sort_coords | Sort one or more coordinates. |
spectrogram | Calculate a spectrogram from the patch data. |
squeeze | Return a new object with len one dimensions flattened. |
standardize | Standardize data by removing the mean and scaling to unit variance. |
taper | Taper the ends of the signal. |
transpose | Transpose the data array to any dimension order desired. |
update_attrs | Update attrs and return a new Patch. |
update_coords | Update the coordiantes of a patch. |
velocity_to_strain_rate | Convert velocity das data to strain rate. |
whiten | Band-limited signal whitening. |