sigpyproc.timeseries
sigpyproc.timeseries¶
- class sigpyproc.timeseries.TimeSeries(input_array, header)¶
Bases:
numpy.ndarrayAn array class to handle pulsar/FRB data in time series.
- Parameters
- Returns
1 dimensional time series array with header metadata
- Return type
Notes
Data is converted to 32-bit floats regardless of original type.
- fold(period, accel=0, nbins=50, nints=32)¶
Fold time series into discrete phase and subintegration bins.
- Parameters
- Returns
data cube containing the folded data
- Return type
- Raises
ValueError – If
nbins * nintsis too large for length of the data.
- rfft()¶
Perform 1-D real to complex forward FFT.
- Returns
output of One-Dimensional DFTs of Real Data
- Return type
- running_mean(window=10001)¶
Filter time series with a running mean.
- Parameters
window (
int, optional) – width in bins of running mean filter, by default 10001- Returns
filtered time series
- Return type
- Raises
ValueError – If window size < 1
Notes
Window edges is dealt by reflecting about the edges of the time series.
- running_median(window=10001)¶
Filter time series with a running median.
- Parameters
window (
int, optional) – width in bins of running median filter, by default 10001- Returns
filtered time series
- Return type
Notes
Window edges is dealt by reflecting about the edges of the time series.
- apply_boxcar(width)¶
Apply a square-normalized boxcar filter to the time series.
- Parameters
width (
int) – width of boxcar to apply in bins- Returns
filtered time series
- Return type
- Raises
ValueError – If boxcar width < 1
Notes
Time series returned is normalized in units of S/N.
- downsample(factor)¶
Downsample the time series.
- Parameters
factor (
int) – factor by which time series will be downsampled- Returns
downsampled time series
- Return type
Notes
Returned time series is of size nsamples // factor
- pad(npad, mode='mean', **pad_kwargs)¶
Pad a time series with mean valued data.
- Parameters
npad (
int) – number of padding points (bins) to add at the end of the time seriesmode (
str, optional) – mode of padding (as used bynumpy.pad()), by default ‘mean’**pad_kwargs (
dict) – Keyword arguments fornumpy.pad()
- Returns
padded time series
- Return type
- resample(accel, jerk=0)¶
Perform time domain resampling to remove acceleration and jerk.
- Parameters
- Returns
resampled time series
- Return type
- correlate(other)¶
Cross correlate with another time series of the same length.
- Parameters
other (
TimeSeriesorArrayLike) – array to correlate with- Returns
time series containing the correlation
- Return type
- Raises
IOError – if input array
otheris not array like
- to_dat(basename)¶
Write time series in presto
.datformat.- Parameters
basename (
str) – file basename for output.datand.inffiles- Returns
.datfile name and.inffile name- Return type
Notes
Method also writes a corresponding .inf file from the header data
- to_file(filename=None)¶
Write time series in sigproc format.
- classmethod read_dat(datfile, inffile=None)¶
Read a presto format
.datfile.- Parameters
- Returns
a new TimeSeries object
- Return type
- Raises
IOError – If no
.inffile found in the same directory of.datfile.
Notes
If inf is None, then the associated .inf file must be in the same directory.