pulsarbat.time_shift#
- pulsarbat.time_shift(z, /, shift, crop=False)[source]#
Shift signal data by given number of samples or time.
This function shifts the signal data in time via FFT by multiplying by a phase gradient in frequency domain. This usually only makes sense if
zis aBasebandSignal. For non-baseband signals, the output might not be meaningful.- Parameters
- z
Signal Input signal.
- shift
int,float, array-like orQuantity Shift amount. If a number (int or float), the signal is shifted by that number of samples. An astropy Quantity with units of time can also be passed, in which case the signal will be shifted by dt * z.sample_rate samples. If an array, must have shape such that axes with length more than 1 match
z.sample_shape.- cropbool, optional
Whether the returned signal is cropped to eliminate out-of-bounds data. Default is False.
- z
- Returns
- out
Signal Shifted signal. If the
cropparameter isFalse, will have the same shape andstart_timeas input signal. IfcropisTrue,start_timewill change bymax(0, shift.max()) * z.dt.
- out
Notes
Since an FFT is used, it is efficient to provide a signal with a fast FFT length via
pulsarbat.fast_len().