import dascore as dc
patch = dc.get_example_patch()
# Example 1
# An auto-correlation of the example patch
dft = patch.dft("time", real=True, pad=False)
dft_sq = dft * dft.conj()
idft = dft_sq.idft()
auto_patch = idft.correlate_shift(dim="time")CorrelateShift
CorrelateShift(
*args ,
dim: Any ,
undo_weighting: Any = True,
)-> None
Apply a shift to the patch data to undo correlation in frequency domain.
Also adds the appropriate coordinate prefixed with “lag” and has a datatype of float.
Parameters
| Parameter | Description |
|---|---|
| patch | The input patch |
| dim | The dimension name that was correlated in the freq. domain. |
| undo_weighting |
If True, also undo the weighting artifact caused by DASCore’s dft weighting. This is done by simply dividing by the coordinate step. See dft note for more details. |
Note
A product of transforms is a correlation circular over the transformed length, but idft trims a padded transform back to the original length, which drops the most negative lags. Transform with pad=False, or pad first with patch.pad(time="correlate"), as below.
Examples
Methods
| Name | Description |
|---|---|
| check | Refuse a patch which does not carry what the operation needs. |
| get_metadata | Return metadata with the lag coordinate, and the axis and step. |
| kernel | Return the data shifted so zero lag is central, divided by the step. |
| model_copy | Copy the model, dropping cached values the update invalidates. |
| new | Create new instance with some attributed updated. |
| correlate_shift | Apply a shift to the patch data to undo correlation in frequency domain. |
| reconcile | Return metadata or a patch holding the final data; default as is. |
| run | Run the operation: check, get_metadata, kernel, reconcile, record. |