sigpyproc.Header

class sigpyproc.Header.Header(info)[source]

Bases: dict

Container object to handle observation metadata.

Note

Attributes are mirrored as items and vice versa to facilitate cleaner code.

SPPHeader(back_compatible=True)[source]

Get Sigproc/sigpyproc format binary header.

Parameters

back_compatible (bool) – Flag for returning Sigproc compatible header (legacy code)

Returns

header in binary format

Return type

str()

dedispersedHeader(dm)[source]

Get a dedispersed version of the current header.

Parameters

dm (float) – dispersion measure we are dedispersing to

Returns

A dedispersed version of the header

Return type

Header

getDMdelays(dm, in_samples=True)[source]

For a given dispersion measure get the dispersive ISM delay for each frequency channel.

Parameters
  • dm (float) – dispersion measure to calculate delays for

  • in_samples (bool) – flag to return delays as numbers of samples (def=True)

Returns

delays for each channel (highest frequency first)

Return type

numpy.ndarray

makeInf(outfile=None)[source]

Make a presto format .inf file.

Parameters

outfile (string) – a filename to write to.

Returns

if outfile is unspecified .inf data is returned as string

Return type

str()

mjdAfterNsamps(nsamps)[source]

Find the Modified Julian Date after nsamps have elapsed.

Parameters

nsamps (int) – number of samples elapsed since start of observation.

Returns

Modified Julian Date

Return type

newHeader(update_dict=None)[source]

Create a new instance of Header from the current instance.

Parameters

update_dict (dict()) – values to overide existing header values

Returns

new header information

Return type

Header

prepOutfile(filename, updates=None, nbits=None, back_compatible=True)[source]

Prepare a file to have sigproc format data written to it.

Parameters
  • filename (string) – filename of new file

  • updates (dict) – values to overide existing header values

  • nbits (int) – the bitsize of data points that will written to this file (1,2,4,8,32)

  • back_compatible (bool) – flag for making file Sigproc compatible

Returns

a prepared file

Return type

File

updateHeader()[source]

Check for changes in header and recalculate all derived quantaties.

sigpyproc.Header.MJD_to_Gregorian(mjd)[source]

Convert Modified Julian Date to the Gregorian calender.

Parameters

mjd – Modified Julian Date

Returns

date and time

Return type

tuple() of str()

sigpyproc.Header.dec_to_rad(dec_string)[source]

Convert declination string to radians.

sigpyproc.Header.dms_to_deg(deg, min_, sec)[source]

Convert (degrees, arcminutes, arcseconds) to degrees.

sigpyproc.Header.dms_to_rad(deg, min_, sec)[source]

Convert (degrees, arcminutes, arcseconds) to radians.

sigpyproc.Header.hms_to_hrs(hour, min_, sec)[source]

Convert (hours, minutes, seconds) to hours.

sigpyproc.Header.hms_to_rad(hour, min_, sec)[source]

Convert (hours, minutes, seconds) to radians.

sigpyproc.Header.ra_to_rad(ra_string)[source]

Convert right ascension string to radians.

sigpyproc.Header.rad_to_dms(rad)[source]

Convert radians to (degrees, arcminutes, arcseconds).

sigpyproc.Header.rad_to_hms(rad)[source]

Convert radians to (hours, minutes, seconds).

sigpyproc.Header.radec_to_str(val)[source]

Convert Sigproc format RADEC float to a string.

Parameters

val (float) – Sigproc style RADEC float (eg. 124532.123)

Returns

‘xx:yy:zz.zzz’ format string

Return type

str()