sigpyproc.io.sigproc#
Sigproc-style header parsing and editing.
This module contains functions for parsing and editing Sigproc-style headers.
Classes
Class to handle individual file information. |
|
Class to handle sigproc header schema fields. |
|
Class to handle stream information as a list of FileInfo objects. |
Functions
Edit a sigproc style header directly in place for the given file. |
|
Encode sigproc header dict in binary format. |
|
Encode single SIGPROC header key to a bytes string. |
|
Match header keywords between two parsed sigproc headers. |
|
Parse the metadata from a single Sigproc-style filterbank file. |
|
Parse the metadata from Sigproc-style file/sequential files. |
|
Parse Sigproc format RADEC float as Astropy SkyCoord. |
Module Attributes
Header keys recognised by the sigproc package. |
|
Telescope IDs recognised by the sigproc package. |
|
Machine IDs recognised by the sigproc package. |
- sigpyproc.io.sigproc.SIGPROC_SCHEMA#
Header keys recognised by the sigproc package.
SIGPROC Header Schema# Key
Binary format
Description
az_start<d(8 bytes)Telescope azimuth at start of scan (degrees)
barycentric<I(4 bytes)Whether the data are barycentric (1) or otherwise (0)
data_type<I(4 bytes)Numeric data type identifier
fch1<d(8 bytes)Centre frequency (MHz) of first filterbank channel
foff<d(8 bytes)Filterbank channel bandwidth (MHz)
ibeam<I(4 bytes)Beam number of the observation
machine_id<I(4 bytes)Numeric machine identifier
nbeams<I(4 bytes)Number of beams in the observation
nbits<I(4 bytes)Number of bits per time sample
nchans<I(4 bytes)Number of frequency channels
nifs<I(4 bytes)Number of seperate IF channels
nsamples<I(4 bytes)Number of time samples in the data file (rarely used)
period<d(8 bytes)Pulsar folding period (s)
pulsarcentric<I(4 bytes)Whether the data are pulsarcentric (1) or otherwise (0)
rawdatafilestring
Name of the original data file
refdm<d(8 bytes)Reference Dispersion Measure (pc/cm^3)
signedb(1 bytes)Sign convention of 8-bit data samples
source_namestring
Name of the observed source
src_dej<d(8 bytes)Declination of source (DDMMSS.S)
src_raj<d(8 bytes)Right ascension (J2000) of source (HHMMSS.S)
telescope_id<I(4 bytes)Numeric telescope identifier
tsamp<d(8 bytes)Time interval between samples (s)
tstart<d(8 bytes)Time stamp (MJD) of first sample
za_start<d(8 bytes)Telescope zenith angle at start of scan (degrees)
- sigpyproc.io.sigproc.telescope_ids#
Telescope IDs recognised by the sigproc package.
Radio Telescope IDs# Radio Telescope
SIGPROC ID
Fake
0
Arecibo
1
Ooty
2
Nancay
3
Parkes
4
Jodrell
5
GBT
6
GMRT
7
Effelsberg
8
Effelsberg LOFAR
9
SRT
10
LOFAR
11
VLA
12
CHIME
20
MWA
30
NC
40
NGNC
41
MeerKAT
64
- sigpyproc.io.sigproc.machine_ids#
Machine IDs recognised by the sigproc package.
Telescope Backend IDs# Radio Telescope Backend
SIGPROC ID
FAKE
0
PSPM
1
WAPP
2
AOFTM
3
BPP
4
OOTY
5
SCAMP
6
GMRTFB
7
PULSAR2000
8
PARSPEC
9
BPSR
10
COBALT
11
GMRTNEW
14
CHIME
20
MWA-VCS
30
MWAX-VCS
31
MWAX-RTB
32
ADU
40
iTPM
41
- class sigpyproc.io.sigproc.FileInfo(*, filename, hdrlen, datalen, nsamples, tstart, tsamp)[source]#
Bases:
objectClass to handle individual file information.
- Attributes:
- datalen
- filename
- hdrlen
- nsamples
tendGet the end time of the file.
- tsamp
- tstart
Methods
from_dict
- filename#
- hdrlen#
- datalen#
- nsamples#
- tstart#
- tsamp#
- property tend#
Get the end time of the file.
- class sigpyproc.io.sigproc.HeaderField(*, fmt, doc)[source]#
Bases:
objectClass to handle sigproc header schema fields.
- Attributes:
- fmt
struct.StructorNone Format struct; None for string fields.
- doc
str Human-readable description of the field.
- fmt
- fmt#
- doc#
- class sigpyproc.io.sigproc.StreamInfo(entries=<factory>)[source]#
Bases:
objectClass to handle stream information as a list of FileInfo objects.
- Attributes:
cumsum_datalensGet the cumulative sum of datalen for all entries.
- entries
time_gapsGet the time gaps between files.
Methods
add_entry(finfo)Add a FileInfo entry to the StreamInfo object.
Check if the files in the stream are contiguous/sequential.
get_combined(key)Get the combined value of a key for all entries.
get_info_list(key)Get list of values for a given key for all entries.
- entries#
- property cumsum_datalens#
Get the cumulative sum of datalen for all entries.
- property time_gaps#
Get the time gaps between files.
- sigpyproc.io.sigproc.edit_header(filename, key, value)[source]#
Edit a sigproc style header directly in place for the given file.
- Parameters:
- Raises:
ValueErrorif the new header to be written to file is longer or shorter than the header that was previously in the file.
Notes
It is up to the user to be responsible with this function, as it will directly change the file on which it is being operated.
- sigpyproc.io.sigproc.encode_header(header, *, allow_nsamples_overwrite=False)[source]#
Encode sigproc header dict in binary format.
- Returns:
bytesheader in binary format
- sigpyproc.io.sigproc.encode_key(key, value=None)[source]#
Encode single SIGPROC header key to a bytes string.
- sigpyproc.io.sigproc.match_header(header1, header2)[source]#
Match header keywords between two parsed sigproc headers.
- Parameters:
- Raises:
ValueErrorif key values do not match.
- sigpyproc.io.sigproc.parse_header(filename)[source]#
Parse the metadata from a single Sigproc-style filterbank file.
- Parameters:
- Returns:
- Raises:
OSErrorIf the file header is not in sigproc format, is empty, or is truncated mid-header.
ValueErrorIf required keys (nbits, nchans) are missing or nsamples is zero.