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")correlate_shift
correlate_shift(
self ,
dim: str ,
undo_weighting: bool = True,
)-> ‘Self’
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, and the data units by the coordinate’s units. 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.