filtools.inject_pulsar package¶
This package contains classes designed to aid injection of pulsar and other similar signals into filterbank data
Submodules¶
filtools.inject_pulsar.ism_models module¶
-
class
filtools.inject_pulsar.ism_models.
simple_propagation_model
(freq, input, dm, intra_chan=True, dm_const=0.000241)[source]¶ Bases:
object
Models simple cold-plasma dispersion delays.
Optionally includes smearing due to intra-channel delay. Disable to model coherent dedispersion.
The DM delay is modeled as
\[t_\mathrm{DM} = \frac{\nu^{-2}\mathrm{DM}}{k_\mathrm{DM}}\]Parameters: - freq – array of centre frequency for each channel in MHz. The algorithm assumes equally spaced channels.
- input – Callable or function.
- dm – the simulated DM in cm$^-3$pc.
- intra_chan – if True, will model the smearing in the pulse due to the intra-channel delays
- dm_const – override to change the DM constant (\(k_\mathrm{DM}\)) used to compute the DM delays.
-
class
filtools.inject_pulsar.ism_models.
simple_scattering_model
(freq, input, t_scatt, dx, scatt_idx=-4.0, ref_freq=1400.0)[source]¶ Bases:
object
Approximates thin-screen scattering in the ionised interstellar medium.
Effectively convolves the incoming signal with an exponential of the form
\[\exp{\left(-\frac{t}{t_\mathrm{scatt}}\left(\frac{\nu_\mathrm{ref}}{\nu}\right)^\alpha\right)}\]Warning
The simple scattering model assumes that each sample to be generated is called in sequence. I.e. no calls to get_spectrum occur out of sequence. This will prevent multi-threaded operation of codes using this module.
Parameters: - input – the input signal generator
- freq – array of frequency channels in MHz.
- t_scatt – the scattering timescale.
- dx – the sampling interval in the data file.
- scatt_idx – the spectral index of the scattering timescale (\(\alpha\))
-
__call__
(t1, t2, mjdref)[source]¶ Compute average flux density between t1 and t2 in each frequency channel.
Output is in flux density units.
Warning
The simple scattering model assumes that each sample to be generated is called in sequence. I.e. no calls to get_spectrum occur out of sequence. This will prevent multi-threaded operation of codes using this module.
Parameters: - t1 – Start time in seconds, relative to mjdref
- t2 – End time in seconds, relative to mjdref
Returns: Average flux density between t1 and t2.
filtools.inject_pulsar.phase_models module¶
-
class
filtools.inject_pulsar.phase_models.
precision_predictor_phase_model
(predictor)[source]¶ Bases:
object
A phase model that uses a phase predictor (or polyco) from tempo or tempo2. It uses the t2pred library to convert between time and phase, so can model a wide range of pulsar behaviour. This model calls t2pred on every request so is slow, but very accurate.
Parameters: predictor (A t2pred.phase_predictor object) – The phase predictor to use Note
This module will only function if you have installed the t2pred python library in tempo2. This can be installed using setup.py in the python/t2pred directory in the tempo2 source code.
-
class
filtools.inject_pulsar.phase_models.
predictor_phase_model
(predictor, dt=0.1)[source]¶ Bases:
object
A phase model that uses a phase predictor (or polyco) from tempo or tempo2. It uses the t2pred library to convert between time and phase, so can model a wide range of pulsar behaviour. This version keeps its own polynomial interpolation of the predictor over short spans to reduce the number of calls to t2pred and greatly increase the performance for a very minor precision reduction.
Parameters: - predictor (t2pred.phase_predictor) – The phase predictor to use
- dt – The interpolation window size in seconds
Note
This module will only function if you have installed the t2pred python library in tempo2. This can be installed using setup.py in the python/t2pred directory in the tempo2 source code.
-
class
filtools.inject_pulsar.phase_models.
simple_phase_model
(epoch, f0, f1=0.0, f2=0.0, accn=None)[source]¶ Bases:
object
A very simple model of the rotational phase of a pulsar
This model is that the pulsar is in the rest frame of the observer and follows a polynomial spin where the phase is given by:
\[\phi(t) = f_0*t + (f_1*t^2)/2.0 + (f_2*t^3)/6.0$\]phase is therefore defined as being from 0 to 1, rather than as an angle.
Parameters: - epoch – The reference epoch (\(t=0\))
- f0 – Frequency at t=0
- f1 – Frequency derivative at t=0
- f2 – Frequency second derivative at t=0
- accn – Doppler acceleration at t=0 (overrides choice of f1).
filtools.inject_pulsar.pulse_models module¶
-
class
filtools.inject_pulsar.pulse_models.
delta_pulse_model
(phase_model, freq)[source]¶ Bases:
object
Models a pulsar as a delta function.
Only has flux at phase zero. Phase average flux density is 1 unit.
Parameters: - phase_model – Object that implements the get_phase method.
- freq – An array of observing frequnecies (ignored)
-
class
filtools.inject_pulsar.pulse_models.
piecewise_pulse_model
(phase_model, freq, profile)[source]¶ Bases:
object
Models a pulsar as an arbitrary piecewise pulse shape
Parameters: - phase_model – Object that implements the get_phase method.
- freq – An array of observing frequnecies (ignored)
- profile – An array of pulse intensity as a function of time
-
class
filtools.inject_pulsar.pulse_models.
sinusoid_pulse_model
(phase_model, freq)[source]¶ Bases:
object
Models a pulsar as a sinusoid function.
\[I(\phi) = \cos{(2\pi\phi)+1}\]Where \(\phi\) is the phase in turns (i.e. between 0 and 1).
Parameters: - phase_model – Object that implements the get_phase method.
- freq – An array of observing frequnecies (ignored)