Skip to content

Commit

Permalink
Merge pull request #697 from paulray/master
Browse files Browse the repository at this point in the history
Fix units on DMEPOCH, POSEPOCH and some other updates
  • Loading branch information
paulray authored May 13, 2020
2 parents bf996a8 + 8699bb6 commit 5897381
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 50 deletions.
34 changes: 25 additions & 9 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,40 @@ Development of PINT is partially supported by the NANOGrav_ pulsar timing array

.. _NANOGrav: http://nanograv.org/

If you use PINT for your work, please cite the PINT paper and the ASCL entry_ .

.. _entry: http://ascl.net/1902.007

Development Leads
-----------------

In alphabetical order:
As listed in the PINT paper:

* Anne Archibald
* Matteo Bachetti
* Paul Demorest
* Justin A. Ellis
* Luo Jing
* Rick Jenet
* Scott Ransom
* Paul Demorest
* Paul Ray
* Chris Sheehy
* Michele Vallisneri
* Anne Archibald
* Matthew Kerr
* Ross Jennings
* Matteo Bachetti
* Rutger van Haasteren
* Jonathan Colen
* Camryn Phillips
* Kevin Stovall
* Michael Lam
* Rick Jenet

Other contributors
------------------

None yet. Why not be the first?
* Bastian Beischer
* Chris Deil
* Julia Deneva
* Justin A. Ellis
* Maarten van Kerkwijk
* Matt Pitkin
* Ben Shapiro-Albert
* Chris Sheehy
* Renee Spiewak
* Michele Vallisneri
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ If you want access to the source code, example notebooks, and tests, you can ins
cloning the source repository from GitHub, then install
it, ensuring that all dependencies needed to run PINT are available::

$ git checkout https://github.com/nanograv/PINT.git
$ cd PINT
$ pip install .

Complete installation instructions are availble here_.
Expand Down
7 changes: 7 additions & 0 deletions docs/basic-installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@ By default this will install in your system site-packages. Depending on your sy
to install it for just yourself (e.g. if you don't have permission to write in the system site-packages), or you may want to create a
virtualenv to work on PINT (using a virtualenv is highly recommended by the PINT developers).

If you want access to the source code, example notebooks, and tests, you can install from source, by
cloning the source repository from GitHub, then install it, ensuring that all dependencies needed to run PINT are available::

$ git checkout https://github.com/nanograv/PINT.git
$ cd PINT
$ pip install .

If this fails, or for more explicit installation and troubleshooting instructions see :ref:`Installation`.
6 changes: 3 additions & 3 deletions docs/examples/build_model_from_scratch.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ The prefix type of parameters have to use `prefixParameter` class from `pint.mod
```python
# Add prefix parameters
dmx_0003 = p.prefixParameter(
parameter_type="float", name="DMX_0003", value=None, unit=u.pc / u.cm ** 3
parameter_type="float", name="DMX_0003", value=None, units=u.pc / u.cm ** 3
)

tm.components["DispersionDMX"].add_param(dmx_0003, setup=True)
Expand All @@ -290,10 +290,10 @@ However only adding DMX_0003 is not enough, since one DMX parameter also need a

```python
dmxr1_0003 = p.prefixParameter(
parameter_type="mjd", name="DMXR1_0003", value=None, unit=u.day
parameter_type="mjd", name="DMXR1_0003", value=None, units=u.day
) # DMXR1 is a type of MJD parameter internally.
dmxr2_0003 = p.prefixParameter(
parameter_type="mjd", name="DMXR2_0003", value=None, unit=u.day
parameter_type="mjd", name="DMXR2_0003", value=None, units=u.day
) # DMXR1 is a type of MJD parameter internally.

tm.components["DispersionDMX"].add_param(dmxr1_0003, setup=True)
Expand Down
2 changes: 1 addition & 1 deletion src/pint/fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def get_summary(self, nodmx=False):
s = "Fitted model using {} method with {} free parameters to {} TOAs\n".format(
self.method, len(self.get_fitparams()), self.toas.ntoas
)
s += "Prefit residuals {}, Postfit residuals {}\n".format(
s += "Prefit residuals Wrms = {}, Postfit residuals Wrms = {}\n".format(
self.resids_init.rms_weighted(), self.resids.rms_weighted()
)
s += "Chisq = {:.3f} for {} d.o.f. for reduced Chisq of {:.3f}\n".format(
Expand Down
4 changes: 3 additions & 1 deletion src/pint/models/absolute_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class AbsPhase(PhaseComponent):
def __init__(self):
super(AbsPhase, self).__init__()
self.add_param(
MJDParameter(name="TZRMJD", description="Epoch of the zero phase.")
MJDParameter(
name="TZRMJD", description="Epoch of the zero phase.", time_scale="utc"
)
)
self.add_param(
strParameter(
Expand Down
6 changes: 5 additions & 1 deletion src/pint/models/astrometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ class Astrometry(DelayComponent):
def __init__(self):
super(Astrometry, self).__init__()
self.add_param(
MJDParameter(name="POSEPOCH", description="Reference epoch for position")
MJDParameter(
name="POSEPOCH",
description="Reference epoch for position",
time_scale="tdb",
)
)

self.add_param(
Expand Down
4 changes: 3 additions & 1 deletion src/pint/models/dispersion_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def __init__(self):
)
)
self.add_param(
MJDParameter(name="DMEPOCH", description="Epoch of DM measurement")
MJDParameter(
name="DMEPOCH", description="Epoch of DM measurement", time_scale="tdb"
)
)

self.dm_value_funcs += [self.base_dm]
Expand Down
4 changes: 2 additions & 2 deletions src/pint/models/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ class MJDParameter(Parameter):
aliases : list, optional
An optional list of strings specifying alternate names that can also
be accepted for this parameter.
time_scale : str, optional, default 'utc'
time_scale : str, optional, default 'tdb'
MJD parameter time scale.
Example::
Expand All @@ -772,7 +772,7 @@ def __init__(
frozen=True,
continuous=True,
aliases=None,
time_scale="utc",
time_scale="tdb",
**kwargs
):
self._time_scale = time_scale
Expand Down
7 changes: 3 additions & 4 deletions src/pint/toa.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,11 +971,10 @@ def select(self, selectarray):

def unselect(self):
"""Return to previous selected version of the TOA table (stored in stack)."""
if hasattr(self, "table_selects"):
# may raise an exception about an empty list
try:
self.table = self.table_selects.pop()
else:
raise ValueError("No previous TOA table found. No changes made.")
except (AttributeError, IndexError) as e:
log.error("No previous TOA table found. No changes made.")

def pickle(self, filename=None):
"""Write the TOAs to a .pickle file with optional filename."""
Expand Down
Loading

0 comments on commit 5897381

Please sign in to comment.