pygedm.ymw16_wrapper

Python/C++ port of YMW16 C code

References

[1] Yao, J. M., Manchester, R. N., & Wang, N. (2017), A New Electron-density Model for Estimation of Pulsar and FRB Distances, ApJ, 835, 29.

pygedm.ymw16_wrapper.calculate_electron_density_lbr(gl, gb, dist)
Calculate electron density at a point with Galactic coords (ga, gl)

at a given distance in pc

Parameters:
  • gl (float, Angle, or Quantity) – Galatic longitude in degrees (or astropy Angle)

  • gb (float, Angle, or Quantity) – Galactic latitude in degrees (or astropy Angle)

  • dist (float or Quantity) – Distance in pc

Returns:

electron density in cm^-3

Return type:

N_e (astropy.Quantity)

pygedm.ymw16_wrapper.calculate_electron_density_xyz(x, y, z)

Calculate electron density at a point with galactocentric coords (x, y, z)

Parameters:
  • x (float or Quantity) – galactocentric X coordinate in pc

  • y (float or Quantity) – galactocentric Y coordinate in pc

  • z (float or Quantity) – galactocentric Z coordinate in pc

Returns:

electron density in cm^-3

Return type:

N_e (astropy.quantity)

pygedm.ymw16_wrapper.dist_to_dm(gl, gb, dist, mode='gal', nu=1.0)

Convert a distance to a DM

Parameters:
  • gl (float in deg or astropy.Angle) – galactic longitude

  • gb (float in deg or astropy.Angle) – galactic latitude

  • dist (float or astropy.Quantity) – distance to source (pc) or if in mode IGM use (Mpc)

  • mode (str) – Gal, MC, or IGM (for YMW16 only)

  • nu (float in GHz or astropy.Quantity) – observing frequency (GHz)

Returns:

dispersion measure (pc/cm3) and scattering time scale (s)

Return type:

dm (astropy.Quantity), tau_sc (astropy.Quantity)

pygedm.ymw16_wrapper.dm_to_dist(gl, gb, dm, dm_host=0, mode='gal', nu=1.0)

Convert a DM to a distance

Parameters:
  • gl (float in deg or astropy.Angle) – galactic longitude

  • gb (float in deg or astropy.Angle) – galactic latitude

  • dm (float in pc/cm3 or astropy.Quantity) – dispersion measure (pc cm^-3)

  • mode (str) – Gal, MC, or IGM (for YMW16 only)

  • nu (float in GHz or astropy.Quantity) – observing frequency (GHz)

Returns:

distance (pc) and scattering time scale (s)

Return type:

dist (astropy.Quantity), tau_sc (astropy.Quantity)