sigpyproc.fourierseries#
Classes for handling 1D Fourier series data.
This module contains the PowerSpectrum and FourierSeries classes for handling Fourier transformed data.
Classes
An array class to handle complex Fourier series. |
|
An array class to handle Fourier Power spectrum. |
- class sigpyproc.fourierseries.FourierSeries(data, header)[source]#
Bases:
objectAn array class to handle complex Fourier series.
- Parameters:
- Attributes:
Methods
deredden([start_width, end_width, end_freq])Perform rednoise removal via Presto-style method.
form_spec(*[, interpolate])Form the power spectrum.
from_fft(fftfile[, inffile])Read a Presto format
.fftfile.from_spec(filename)Read a sigpyproc format
.specfile.ifft([ifftn])Perform 1-D complex to real inverse FFT.
multiply(other)Multiply two Fourier series together.
recon_prof(freq[, nharms])Reconstruct the time-domain pulse profile.
to_fft([basename])Write Fourier series to file in presto
.fftformat.to_spec([filename])Write Fourier series in sigproc format.
- ifft(ifftn=None)[source]#
Perform 1-D complex to real inverse FFT.
- Parameters:
- ifftn
Callable[[np.ndarray,int],np.ndarray], optional The ifft function to use. Own ifft implementation can be used, e.g.
pyfftw.interfaces.numpy_fft.irfft, by default None.
- ifftn
- Returns:
TimeSeriesThe real-valued time series.
- form_spec(*, interpolate=False)[source]#
Form the power spectrum.
- Parameters:
- interpolate
bool, optional Interpolate using nearest bins, by default False.
- interpolate
- Returns:
PowerSpectrumThe power spectrum.
- deredden(start_width=6, end_width=100, end_freq=6.0)[source]#
Perform rednoise removal via Presto-style method.
- Parameters:
- Returns:
FourierSeriesWhitened fourier series.
- multiply(other)[source]#
Multiply two Fourier series together.
- Parameters:
- other
FourierSeries|ArrayLike Fourier series to multiply with.
- other
- Returns:
FourierSeriesThe product of the two Fourier series.
- to_fft(basename=None)[source]#
Write Fourier series to file in presto
.fftformat.- Parameters:
- basename
str, optional File basename for output
.fftand.inffile, by default None.
- basename
- Returns:
strOutput
.fftfile name.
Notes
Method also writes a corresponding .inf file from the header data.
- classmethod from_fft(fftfile, inffile=None)[source]#
Read a Presto format
.fftfile.- Parameters:
- Returns:
FourierSeriesFourier series object.
Notes
If
inffileis None, then the associated .inf file must be in the same directory.
- classmethod from_spec(filename)[source]#
Read a sigpyproc format
.specfile.- Parameters:
- Returns:
FourierSeriesFourier series object.
Notes
This is not setup to handle
.specfiles such as are created by Sigproc seek module. To do this would require a new header parser for that file format.
- class sigpyproc.fourierseries.PowerSpectrum(data, header)[source]#
Bases:
objectAn array class to handle Fourier Power spectrum.
- Parameters:
- Attributes:
Methods
bin2freq(r)Compute centre frequency of a given bin.
bin2period(r)Compute centre period of a given bin.
freq2bin(freq)Compute nearest bin to a given frequency.
harmonic_fold([nfolds])Perform Lyne-Ashworth harmonic folding of the power spectrum.
period2bin(period)Compute nearest bin to a given periodicity.
- harmonic_fold(nfolds=1)[source]#
Perform Lyne-Ashworth harmonic folding of the power spectrum.
- Parameters:
- nfolds
int, optional Number of harmonic folds to perform, by default 1.
- nfolds
- Returns:
list[PowerSpectrum]List of folded spectra where the i th element is the spectrum folded i times.