sigpyproc.readers
sigpyproc.readers¶
- class sigpyproc.readers.FilReader(filenames, check_contiguity=True)¶
Bases:
sigpyproc.base.FilterbankA class to handle the reading of sigproc format filterbank files.
- Parameters
- Returns
Base container of filterbank data with observational metadata
- Return type
Notes
To be considered as a Sigproc format filterbank file the header must only contain keywords found in the
header_keysdictionary.- read_block(start, nsamps)¶
Read a block of filterbank data.
- Parameters
- Returns
2-D array of filterbank data with observational metadata
- Return type
- Raises
ValueError – if requested samples are out of range
- read_dedisp_block(start, nsamps, dm)¶
Read a block of dedispersed filterbank data.
Best used in cases where I/O time dominates reading a block of data.
- Parameters
- Returns
2-D array of filterbank data with observational metadata
- Return type
- Raises
ValueError – if requested dedispersed samples are out of range
- read_plan(gulp=16384, start=0, nsamps=None, skipback=0, description=None, verbose=False)¶
A generator used to perform filterbank reading.
- Parameters
gulp (
int, optional) – number of samples in each read, by default 16384start (
int, optional) – first sample to read from filterbank, by default 0 (start of file)nsamps (
int, optional) – total number of samples to read, by default None (end of the file)skipback (
int, optional) – number of samples to skip back after each read, by default 0description (
str, optional) – description of task show next to progress bar (rich), by default Calling Stackverbose (
bool, optional) – whether to display progress bar, by default False
- Yields
Iterator(tuple(int,int,ndarray)) – An iterable of the values in the sequence.- Raises
ValueError – If read samples <
skipback.
Notes
For each read, the generator yields a tuple
x, where:x[0]is the number of samples readx[1]is the index of the read (i.e.x[1]=0is the first read)x[2]is a 1-D numpy array containing the data that was read
Examples
The normal calling syntax for this is function is:
>>> for nsamps, ii, data in self.read_plan(**plan_kwargs): # do something where data always has contains ``nchans*nsamps`` points.