v-morello / pyne2001

A python wrapper around the original FORTRAN implementation of the NE2001 Galactic free electron density model
MIT License
2 stars 6 forks source link

pyne2001

Build Status License Python versions

A python wrapper around the original FORTRAN implementation of the NE2001 Galactic free electron density model, published in the paper
NE2001.I. A New Model for the Galactic Distribution of Free Electrons and its Fluctuations, by J.M. Cordes and T.J.W. Lazio.

If using pyne2001 contributes to a project that leads to a scientific publication, please cite the article above.

The python functions implemented in pyne2001 simply call the NE2001 executable and parse the resulting text output. This module uses version 1.0 of the FORTRAN code available from http://hosting.astro.cornell.edu/~cordes/NE2001/, with a few minor changes documented below (c.f. section "FORTRAN code changes"). None of the changes affect the numerical results returned by the NE2001 program, they are just minor bugfixes and quality-of-life changes to make the parsing of the text output easier.

Dependencies and Python version

pyne2001 works with both python 2.7 and python 3+, and does not depend on any external python libraries. A FORTRAN compiler must be available on the system prior to installing the module.

Installation

pyne2001 can be installed easily with pip:

pip install pyne2001

To check that all went well, try importing the module and running the unit tests, you should see something like this:

In [1]: import pyne2001

In [2]: pyne2001.test()
..............
----------------------------------------------------------------------
Ran 14 tests in 0.599s

OK

Installation in development mode

If you want to be able to modify the code freely: clone the repository, then in its base folder type make install. This compiles the FORTRAN code and runs pip install in editable mode.

Usage

pyne2001 provides 6 functions, see their docstrings for the full details:

The output keys when returning the full output are:

Key       Unit                     Description
------------------------------------------------------------
DIST      (kpc)                    ModelDistance
DM        (pc-cm^{-3})             DispersionMeasure
DMz       (pc-cm^{-3})             DM_Zcomponent
SM        (kpc-m^{-20/3})          ScatteringMeasure
SMtau     (kpc-m^{-20/3})          SM_PulseBroadening
SMtheta   (kpc-m^{-20/3})          SM_GalAngularBroadening
SMiso     (kpc-m^{-20/3})          SM_IsoplanaticAngle
EM        (pc-cm^{-6})             EmissionMeasure_from_SM
TAU       (ms)                     PulseBroadening @1GHz
SBW       (MHz)                    ScintBW @1GHz
SCINTIME  (s)                      ScintTime @1GHz @100 km/s
THETA_G   (mas)                    AngBroadeningGal @1GHz
THETA_X   (mas)                    AngBroadeningXgal @1GHz
NU_T      (GHz)                    TransitionFrequency
LOWERLIM                           If True, ModelDistance is a lower limit only

FORTRAN code changes

Bugfixes:
Changes: