sigpyproc.io.pfits#

PSRFITS header and data reading.

This module contains classes for reading PSRFITS headers and data.

Classes

Backend

Backend information.

PFITSFile

Handle a PSRFITS file.

PrimaryHdr

Primary header information.

Receiver

Receiver information.

SubintHdr

Sub-integration header information.

class sigpyproc.io.pfits.Backend(*, name, phase, dcc, delay, tcycle, configfile)[source]#

Bases: object

Backend information.

Attributes:
namestr

Name of the backend instrument.

phase: float

Phase convention of backend.

dcc: float

Downconversion conjugation corrected.

delay: float

Backend propn delay from digi. input.

tcycle: float

Native cycle time of correlation system.

configfile: str

Name of a configuration file used to set up the backend system.

name#
phase#
dcc#
delay#
tcycle#
configfile#
class sigpyproc.io.pfits.PFITSFile(filename)[source]#

Bases: object

Handle a PSRFITS file.

Parameters:
filenamestr

Filename of the PSRFITS file.

Attributes:
filename

Name of file.

pri_hdr

Primary header object.

sub_hdr

Sub-integration header object.

bitsinfo

Bits information object.

Methods

read_freqs(isub)

Read the Channel centre frequency from the PSRFITS SUBINT table.

read_offsets(isub)

Read channel data offset (DAT_OFFS) column from the SUBINT table.

read_scales(isub)

Read channel data scale factor (DAT_SCL) column from the SUBINT table.

read_subint(isub, *[, scloffs, weights])

Read the digitised data from the PSRFITS SUBINT table.

read_subint_pol(isub, *[, poln_select, ...])

Read the given polarization format from the PSRFITS SUBINT table.

read_subints(startsub, nsubs, *[, ...])

Read the given polarization format from a range of PSRFITS SUBINT table.

read_weights(isub)

Read channel weight (DAT_WTS) column from the SUBINT table.

property filename#

Name of file.

Returns:
str

Filename of the PSRFITS file.

property pri_hdr#

Primary header object.

Returns:
PrimaryHdr

Primary header.

property sub_hdr#

Sub-integration header object.

Returns:
SubintHdr

Subint header.

property bitsinfo#

Bits information object.

Returns:
BitsInfo

Bits information.

read_subints(startsub, nsubs, *, poln_select=1, scloffs=True, weights=True)[source]#

Read the given polarization format from a range of PSRFITS SUBINT table.

Parameters:
startsubint

Index of start row (subint) to read from the SUBINT table.

nsubsint

Number of subints to read from the SUBINT table.

poln_selectint, optional

1=PP+QQ, 2=PP,QQ, 3=(PP+QQ)^2 4=PP,QQ,PQ,QP, by default 1.

scloffsbool, optional

Apply scales and offsets when unpacking data, by default False.

weightsbool, optional

Apply weights when unpacking data, by default False.

Returns:
ndarray

Subint (row) data in float32 if scloffs or weights applied, otherwise in uint8 with shape (nsamps, nchan).

read_subint_pol(isub, *, poln_select=1, scloffs=True, weights=True)[source]#

Read the given polarization format from the PSRFITS SUBINT table.

Parameters:
isubint

Index of row (subint) to read from the SUBINT table.

poln_selectint, optional

Polarization index to select, by default 1.

Available options:

  • 1=PP+QQ

  • 2=PP,QQ

  • 3=(PP+QQ)^2

  • 4=PP,QQ,PQ,QP

scloffsbool, optional

Apply scales and offsets when unpacking data, by default True

weightsbool, optional

Apply weights when unpacking data, by default True

Returns:
ndarray

Subint (row) data in float32 if scloffs or weights applied, otherwise in uint8 with shape (nsamps, nchan).

read_subint(isub, *, scloffs=True, weights=True)[source]#

Read the digitised data from the PSRFITS SUBINT table.

Parameters:
isubint

Index of row (subint) to read from the SUBINT table.

scloffsbool, optional

Apply scales and offsets when unpacking data, by default True.

weightsbool, optional

Apply weights when unpacking data, by default True.

Returns:
ndarray

Subint (row) data in float32 if scale_and_offset or weights applied, otherwise in uint8 with shape (nsamps, npol, nchan).

read_freqs(isub)[source]#

Read the Channel centre frequency from the PSRFITS SUBINT table.

Parameters:
isubint

Index of row (subint) to read from the SUBINT table.

Returns:
FrequencyChannels

Centre frequency for each channel in MHz (NCHAN).

read_weights(isub)[source]#

Read channel weight (DAT_WTS) column from the SUBINT table.

Parameters:
isubint

Index of row (subint) to read from the SUBINT table,

Returns:
ndarray

Weights for each channel in the range 0-1 (NCHAN).

read_scales(isub)[source]#

Read channel data scale factor (DAT_SCL) column from the SUBINT table.

Parameters:
isubint

Index of row (subint) to read from the SUBINT table.

Returns:
ndarray

Data scale factor for each channel (NCHAN * NPOL).

read_offsets(isub)[source]#

Read channel data offset (DAT_OFFS) column from the SUBINT table.

Parameters:
isubint

Index of row (subint) to read from the SUBINT table.

Returns:
ndarray

Data offset for each channel (NCHAN * NPOL).

class sigpyproc.io.pfits.PrimaryHdr(filename)[source]#

Bases: object

Primary header information.

Parameters:
filenamestr

Filename of the PSRFITS file.

Attributes:
header

astropy.io.fits.Header: Primary header.

observer

str: Observer name(s).

project_id

str: Project name.

telescope

str: Telescope name.

location

astropy.coordinates.EarthLocation: Antenna location.

receiver

Receiver: Receiver information.

backend

Backend: Backend information.

ibeam

int: Beam number.

obs_mode

str: Observation mode.

date_obs

astropy.time.Time: Observation start date.

freqs

FrequencyChannels: Frequency channels.

chan_dm

float: On-line (normally coherent) dedispersion measure.

source

str: Source name or label for an observation.

coord

astropy.coordinates.SkyCoord: Source coordinates.

tstart

astropy.time.Time: Observation start time.

property header#

astropy.io.fits.Header: Primary header.

property observer#

str: Observer name(s).

property project_id#

str: Project name.

property telescope#

str: Telescope name.

property location#

astropy.coordinates.EarthLocation: Antenna location.

property receiver#

Receiver: Receiver information.

property backend#

Backend: Backend information.

property ibeam#

int: Beam number.

property obs_mode#

str: Observation mode.

property date_obs#

astropy.time.Time: Observation start date.

property freqs#

FrequencyChannels: Frequency channels.

property chan_dm#

float: On-line (normally coherent) dedispersion measure.

property source#

str: Source name or label for an observation.

property coord#

astropy.coordinates.SkyCoord: Source coordinates.

property tstart#

astropy.time.Time: Observation start time.

class sigpyproc.io.pfits.Receiver(*, name, nrcvr, basis, hand, sa, rph, tracking_mode, tracking_angle)[source]#

Bases: object

Receiver information.

Attributes:
namestr

Name of the receiver.

nrcvrint

Number of receptors.

basisstr

Basis of receptors.

hand: int

Hand of receptor basis.

sa: float

Symmetry angle of receptor basis.

rph: float

Reference source phase.

tracking_mode: str

Tracking mode of the receiver platform.

tracking_angle: float

Position angle tracked by the receiver.

name#
nrcvr#
basis#
hand#
sa#
rph#
tracking_mode#
tracking_angle#
class sigpyproc.io.pfits.SubintHdr(filename)[source]#

Bases: object

Sub-integration header information.

Parameters:
filenamestr

Filename of the PSRFITS file.

Attributes:
header

astropy.io.fits.Header: SUBINT header.

subint_width

int: Width of subint table in bytes.

nsubint

int: Number of rows (subints) in subint table.

poln_type

str: Polarisation identifier (e.g., AABBCRCI, AA+BB).

poln_state

str: Polarisation state (e.g., Coherence).

npol

int: Number of polarisation products in the DATA table.

tsamp

float: Time per bin or sample (seconds).

nbits

int: Number of bits per sample.

zero_off

float: Zero offset for data (the nominal data zero in digitiser units).

signint

int: Flag to indicate that the data values are signed integers.

subint_offset

int: Subint offset for contiguous SEARCH-mode files.

nchans

int: Number of frequency channels for each polarisation in the DATA table.

chan_bw

float: Channel bandwidth in MHz.

channel_offset

int: Channel offset for contiguous SEARCH-mode files.

subint_samples

int: Number of samples per subint or table row.

nsamples

int: Total number of valid samples in a search-mode file.

subint_shape
sub_hdr
tsubint

float: Time per subint or table row (seconds).

offs_sub

float: Time since the observation start at the centre of first subint (s).

azimuth

astropy.coordinates.Angle: Azimuth (degrees).

zenith

astropy.coordinates.Angle: Zenith (degrees).

freqs

sigpyproc.utils.FrequencyChannels: Frequency channels for first subint.

property header#

astropy.io.fits.Header: SUBINT header.

property subint_width#

int: Width of subint table in bytes.

property nsubint#

int: Number of rows (subints) in subint table.

property poln_type#

str: Polarisation identifier (e.g., AABBCRCI, AA+BB).

property poln_state#

str: Polarisation state (e.g., Coherence).

property npol#

int: Number of polarisation products in the DATA table.

property tsamp#

float: Time per bin or sample (seconds).

property nbits#

int: Number of bits per sample.

property zero_off#

float: Zero offset for data (the nominal data zero in digitiser units).

property signint#

int: Flag to indicate that the data values are signed integers.

property subint_offset#

int: Subint offset for contiguous SEARCH-mode files.

property nchans#

int: Number of frequency channels for each polarisation in the DATA table.

property chan_bw#

float: Channel bandwidth in MHz.

property channel_offset#

int: Channel offset for contiguous SEARCH-mode files.

property subint_samples#

int: Number of samples per subint or table row.

property nsamples#

int: Total number of valid samples in a search-mode file.

property subint_shape#
property sub_hdr#
property tsubint#

float: Time per subint or table row (seconds).

property offs_sub#

float: Time since the observation start at the centre of first subint (s).

property azimuth#

astropy.coordinates.Angle: Azimuth (degrees).

property zenith#

astropy.coordinates.Angle: Zenith (degrees).

property freqs#

sigpyproc.utils.FrequencyChannels: Frequency channels for first subint.