sigpyproc.FourierSeries

class sigpyproc.FourierSeries.FourierSeries(input_array, header)[source]

Bases: numpy.ndarray

Class to handle output of FFT’d time series.

Parameters
  • input_array (numpy.ndarray) – 1 dimensional array of shape (nsamples)

  • header (Header) – observational metadata

conjugate()[source]

Conjugate the Fourier series.

Returns

conjugated Fourier series.

Return type

sigpyproc.FourierSeries.FourierSeries

Note

Function assumes that the Fourier series is the non-conjugated product of a real to complex FFT.

formSpec(interpolated=True)[source]

Form power spectrum.

Parameters

interpolated (bool) – flag to set nearest bin interpolation (def=True)

Returns

a power spectrum

Return type

PowerSpectrum

iFFT()[source]

Perform 1-D complex to real inverse FFT using FFTW3.

Returns

a time series

Return type

TimeSeries

reconProf(freq, nharms=32)[source]

Reconstruct the time domain pulse profile from a signal and its harmonics.

Parameters
  • freq (float) – frequency of signal to reconstruct

  • nharms (int) – number of harmonics to use in reconstruction (def=32)

Returns

a pulse profile

Return type

sigpyproc.FoldedData.Profile

rednoise(startwidth=6, endwidth=100, endfreq=1.0)[source]

Perform rednoise removal via Presto style method.

Parameters
  • startwidth (int) – size of initial array for median calculation

  • endwidth (int) – size of largest array for median calculation

  • endfreq (float) – remove rednoise up to this frequency

Returns

whitened fourier series

Return type

FourierSeries

toFFTFile(basename=None)[source]

Write spectrum to file in sigpyproc format.

Parameters

basename – basename of .fft and .inf file to be written

Returns

name of files written to

Return type

tuple() of str()

toFile(filename=None)[source]

Write spectrum to file in sigpyproc format.

Parameters

filename (str) – name of file to write to (def=``basename.spec``)

Returns

name of file written to

Return type

str()

class sigpyproc.FourierSeries.PowerSpectrum(input_array, header)[source]

Bases: numpy.ndarray

Class to handle power spectra.

Parameters
  • input_array (numpy.ndarray) – 1 dimensional array of shape (nsamples)

  • header (Header) – observational metadata

bin2freq(bin_)[source]

Return centre frequency of a given bin.

Parameters

bin (int) – bin number

Returns

frequency of bin

Return type

float

bin2period(bin_)[source]

Return centre period of a given bin.

Parameters

bin (int) – bin number

Returns

period of bin

Return type

float

freq2bin(freq)[source]

Return nearest bin to a given frequency.

Parameters

freq (float) – frequency

Returns

nearest bin to frequency

Return type

float

harmonicFold(nfolds=1)[source]

Perform Lyne-Ashworth harmonic folding of the power spectrum.

Parameters

nfolds (int) – number of harmonic folds to perform (def=1)

Returns

A list of folded spectra where the i th element is the spectrum folded i times.

Return type

list() of PowerSpectrum

period2bin(period)[source]

Return nearest bin to a given periodicity.

Parameters

period (float) – periodicity

Returns

nearest bin to period

Return type

float