open

baseband_tasks.io.psrfits.open(filename, mode='r', **kwargs)[source] [edit on github]

Function to open a PSRFITS file.

Parameters
filenamestr

Input PSRFITS file name.

mode{‘r’, ‘w’}, optional

Whether to open for reading (default) or writing.

**kwargs

Additional arguments for opening the fits file and creating the reader.

— For opening the fits file :
memmapbool, optional

Is memory mapping to be used? By default, this value is obtained from the configuration item astropy.io.fits.Conf.use_memmap (the default of which, in turn, is True).

— For creating the reader :
weightedbool, optional

Whether the data should be weighted along the frequency axis. Default is True.

verifybool, optional

Whether to do basic checks on the PSRFITS HDUs. Default is True.

— For creating the writer :
primary_hdu~baseband_tasks.io.psrfits.PSRFITSPrimaryHDU

Currently required to be constructed before opening the file. This limitation will be lifted in future.

**kwargs

Further arguments to set up the SUBINT HDU. These can include ‘start_time’, ‘sample_rate’, ‘sample_shape’, ‘shape’, ‘samples_per_frame’, ‘polarization’, ‘frequency’.

Returns
readerfile-handle like reader for the first SUBINT HDU
Raises
RuntimeError

If more than one SUBINT HDU is present.

Notes

The current version` only opens and reads one SUBINT HDU and ignores all other types of HDUs.