py4sci

Table Of Contents

Previous topic

Tutorial - Basic Usage

This Page

Module-level Documentation

pulsar – Creates/stores a pulsar object

class pulsar.Pulsar
Pulsar.__init__([period, dm, gl, gb, galCoords, r0, dtrue, lum_1400, spindex, alpha, rho, width_degree, snr, beaming, scindex, gpsFlag, gpsA, brokenFlag, brokenSI])

Initialise the pulsar object

Pulsar.s_1400()

Returns the flux at 1400 MHz, calculated as

S_{\rm{1400}} = \frac{L_{\rm{1400}}}{D_{\rm{true}}^2}

Pulsar.width_ms()

Returns the pulse width in milliseconds, calculated as

W_{\rm{ms}} = P_{\rm{ms}} \times W_{\rm{degree}} / 360

population – Creates/stores a population

class population.Population
Population.__init__([pDistType, radialDistType, lumDistType, pmean, psigma, simean, sisigma, lummean, lumsigma, zscale, electronModel, gpsFrac, gpsA, brokenFrac, brokenSI, ref_freq])

Initialise the population object

Population.__str__()

Defines how the operation print Population is performed

Population.size()

Returns the number of pulsars in the population object

Population.join(poplist)

Joins each of the populations in list poplist to the current population

Population.write(outf)

Uses cPickle to dump the population to file outf

Population.write_asc(outf)

Writes the population to an ascii file in the old psrpop way

survey – Read a survey file into a survey object

class survey.Survey
Survey.__init__(surveyName)

Read in a (correctly formatted!) survey file

Survey.__str__()

Define how to perform print Survey

Survey.nchans()

Returns the number of channels, calculated as

n_{\rm{chans}} = \frac{ {\rm{BW}}_{\rm{total}} }{ {\rm{BM}}_{\rm{chan}} }

Survey.inRegion(pulsar)

Determines if Pulsar is inside survey region. Returns True or False accordingly

Survey.inPointing(pulsar)

Determines if Pulsar is inside one of the survey’s pointings. Returns the offset from beam centre to the pulsar.

Survey.SNRcalc(pulsar, pop)

Calculates the SNR of a Pulsar from Population pop in the survey. Returns -1 if pulse is smeared, and -2 if pulsar is outside survey region. SNR is calculated (with familiar terms) as

{\rm{SNR}} = \frac{S_{1400} G \sqrt{n_{\rm{pol}} BW \tau}}{\beta T_{\rm{tot}}} \sqrt{\frac{1-\delta}{\delta}} \eta

where

\eta = \exp(-2.7727 \times {\rm{offset}}^2 / {\rm{fwhm}}^2)

class survey.Pointing
Pointing.__init__(coord1, coord2, coordtype)

Converts (coord1, coord2) into correctly formatted (l, b). Coordtype must be either eq or gal. If eq, the RA and Dec are converted internally

populate – Create a population object

class populate.Populate
Populate.generate(ngen[, surveyList, pDistType, radialDistType, electronModel, pDistPars, siDistPars, lumDistType, lumDistPars, zscale, duty, scindex, gpsArgs, doubleSpec, nostdout])

The method called by the populate.py command-line-script

Populate.write(outf=populate.model)

Writes the Population model into file outf as a cPickle dump

radialmodels – Container for radial distn models

class radialmodels.RadialModels
radialmodels.seed()

Call the FORTRAN routine to make a seed

radialmodels.slabdist()

Pick a point from a “slab” distribution around the Galactic plane

radialmodels.diskdist()

Pick a point from a distribution purely along the Galactic plane

radialmodels.lfl06()

Pick a point from the Lorimer et al (2006) Galactic distribution

radialmodels.ykr()

Pick a point from the Yusifov & Kucuk Galactic distribution

galacticops – Container for functions relating to the Galaxy

class radialmodels.GalacticOps
radialmodels.calc_dtrue((x, y, z))

Calculate the distance from the Sun to Galactic coords (x, y, z) (NB. tuple)

radialmodels.calcXY(r0)

Given a Galactic radius r0, choose an (x, y) position at random \theta

radialmodels.ne2001_dist_to_dm(dist, gl, gb)

Given a distance and Galactic coordinates, calculate DM according to NE2001

radialmodels.lm98_dist_to_dm(dist, gl, gb)

Given a distance and Galactic coordinates, calculate DM according to lm98

radialmodels.lb_to_radec(gl, gb)

Convert Galactic coordinates to equatorial

radialmodels.ra_dec_to_lb(ra, dec)

Convert equatorial coordinates to Galactic

radialmodels.tsky(gl, gb, freq)

Calculate sky temperature at observing frequency freq and at Galactic coordinates gl, gb according to Haslam et al

radialmodels.xyz_to_lb((x, y, z))

Convert the tuple (x, y, z) to Galactic sky coordinates.

Returns l, b in degrees

radialmodels.lb_to_xyz(l, b, dist)

Convert Galactic sky coordinates at a distance dist to x,y,z coordinates.

Returns position as a tuple

radialmodels.scatter_bhat(dm, scatterindex, freq_mhz)

Calculate the scatter time according to Bhat et al at. Frequency in MHz, pulsar with dispersion measure dm, and using a scattering spectral index of scatterindex.

Calculated as

\tau = -6.46 + 0.154 \log_{10}({\rm{dm}}) + 1.07\log_{10}({\rm{dm}})^2 + {\rm{scatterindex}} \times \log_{10}(\frac{\rm{freq\_mhz}}{1000})

and typically {\rm{scatterindex}} = -3.86 (but there is an option to vary it!)