Skip to content

Commit

Permalink
Merge branch 'master' into bayesian-wip
Browse files Browse the repository at this point in the history
  • Loading branch information
abhisrkckl committed Aug 17, 2023
2 parents 4e091aa + c6b2c82 commit 48a3d13
Show file tree
Hide file tree
Showing 257 changed files with 9,659 additions and 3,895 deletions.
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@
ef448d5271e7ce4a2de912dd2a76a629e7a569cb
# blacken with black version 22
b1d93c708b314444fecd1722438cec6f91f028d6
# blacken with black version 23
84af0c2b4c1f6912450b62f11b9065051ece4763
1a5d1ca0be3938eb46975d97325bd25883370523
fd7c998dfd0889aba3bf0c6ef93964d514404e15
e2d5e28404e7ae218040cf0004992a125fb6bd65
60d03fe82f6a4f3ff0a8c70fac150d1325d91b86
3 changes: 2 additions & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ Active developers are indicated by (*). Authors of the PINT paper are indicated
* Anne Archibald (#*)
* Matteo Bachetti (#)
* Bastian Beischer
* Deven Bhakta
* Deven Bhakta (*)
* Chloe Champagne (#)
* Jonathan Colen (#)
* Thankful Cromartie
* Christoph Deil
* Paul Demorest (#)
* Julia Deneva
* Justin Ellis
* William Fiore (*)
* Fabian Jankowski
* Rick Jenet (#)
* Ross Jennings (#*)
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG-unreleased.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project, at least loosely, adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

This file contains the unreleased changes to the codebase. See CHANGELOG.md for
the released changes.

## Unreleased
### Changed
- Third-order Roemer delay terms to ELL1 model
- Made the addition of a TZR TOA (`AbsPhase`) in the `TimingModel` explicit in `Residuals` class.
- Updated `CONTRIBUTING.rst` with the latest information.
- Made `TimingModel.params` and `TimingModel.ordered_params` identical. Deprecated `TimingModel.ordered_params`.
### Added
- Third-order Roemer delay terms to ELL1 model
- Options to add a TZR TOA (`AbsPhase`) during the creation of a `TimingModel` using `ModelBuilder.__call__`, `get_model`, and `get_model_and_toas`
- `pint.print_info()` function for bug reporting
- Added an autocorrelation function to check for chain convergence in `event_optimize`
### Fixed
- Deleting JUMP1 from flag tables will not prevent fitting
- Simulating TOAs from tim file when PLANET_SHAPIRO is true now works
- Docstrings for `get_toas()` and `get_model_and_toas()`
- Set `DelayComponent_list` and `NoiseComponent_list` to empty list if such components are absent
- Fix invalid access of `PLANET_SHAPIRO` in models without `Astrometry`
### Removed
52 changes: 49 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,56 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project, at least loosely, adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
This file contains the released changes to the codebase. See CHANGELOG-unreleased.md for
the unreleased changes. This file should only be changed while tagging a new version.

## [0.9.6] 2023-06-22
### Changed
- Applied `sourcery` refactors to the entire codebase
- Changed threshold for `test_model_derivatives` test to avoid CI failures
- Unreleased CHANGELOG entries should now be entered in `CHANGELOG-unreleased.md` instead of `CHANGELOG.md`. Updated documentation accordingly.
- Changed tests to remove `unittest` and use pure pytest format
- Changed deprecated `sampler.chain` usage
- Download data automatically in the profiling script `high_level_benchmark.py` instead of silently giving wrong results.
### Added
- `SpindownBase` as the abstract base class for `Spindown` and `PeriodSpindown` in the `How_to_build_a_timing_model_component.py` example.
- `SolarWindDispersionBase` as the abstract base class for solar wind dispersion components.
- `validate_component_types` method for more rigorous validation of timing model components.
- roundtrip test to make sure clock corrections are not written to tim files
- `calc_phase_mean` and `calc_time_mean` methods in `Residuals` class to compute the residual mean.
- `PhaseOffset` component (overall phase offset between physical and TZR toas)
- `tzr` attribute in `TOAs` class to identify TZR TOAs
- Documentation: Explanation for offsets
- Example: `phase_offset_example.py`
- method `AllComponents.param_to_unit` to get units for any parameter, and then made function `utils.get_unit`
- can override/add parameter values when reading models
- docs now include list of observatories along with google maps links and clock files
### Fixed
- fixed docstring for `add_param_from_top`
- Gridded calculations now respect logger settings
- Event TOAs now have default error that is non-zero, and can set as desired
- Model conversion ICRS <-> ECL works if PM uncertainties are not set
- Fix `merge_TOAs()` to allow lists of length 1
### Removed

## [0.9.5] 2023-05-01
### Changed
- Changed minimum supported version of `scipy` to 1.4.1
- Moved `DMconst` from `pint.models.dispersion_model` to `pint` to avoid circular imports
- Removed references to `astropy._erfa` (removed since `astropy` 4.2)
- Refactor `Dre` method, fix expressions for Einstein delay and post-Keplerian parameters in DD model
- Updated contributor list (AUTHORS.rst)
- Emit an informative warning for "MODE" statement in TOA file; Ignore "MODE 1" silently
- Version of `sphinx-rtd-theme` updated in `requirements_dev.txt`
- Version of `sphinx-rtd-theme` updated in `requirements_dev.txt`
- Updated `black` version to 23.x
- Older event loading functions now use newer functions to create TOAs and then convert to list of TOA objects
- Limited hypothesis to <= 6.72.0 to avoid numpy problems in oldestdeps
### Added
- Documentation: Explanation for DM
- Methods to compute dispersion slope and to convert DM using the CODATA value of DMconst
- `TimingModel.total_dispersion_slope` method
- Explicit discussion of DT92 convention to DDK model
- HESS and ORT telescopes to the list of known observatories
- HAWC, HESS and ORT telescopes to the list of known observatories
- Documentation: making TOAs from array of times added to HowTo
- Method to make TOAs from an array of times
- Clock correction for LEAP
Expand All @@ -31,13 +65,25 @@ and this project, at least loosely, adheres to [Semantic Versioning](https://sem
- `funcParameters` defined as functions operating on other parameters
- Option to save `emcee` backend chains in `event_optimize`
- Documentation on how to extract a covariance matrix
- DDS and DDGR models
- Second-order corrections included in ELL1
- Module for converting between binary models also included in `convert_parfile`
- Method to get a parameter as a `uncertainties.ufloat` for doing math
- Method to get current binary period and uncertainty at a given time regardless of binary model
- TCB to TDB conversion on read, and conversion script (`tcb2tdb`)
- Functions to get TOAs objects from satellite data (Fermi and otherwise)
- Methods to convert a TOAs object into a list of TOA objects
### Fixed
- Syntax error in README.rst
- Broken notebooks CI test
- BIPM correction for simulated TOAs
- Added try/except to `test_pldmnoise.py`/`test_PLRedNoise_recovery` to avoid exceptions during CI
- Import for `longdouble2str` in `get_tempo_result`
- Plotting orbital phase in `pintk` when FB0 is used instead of PB
- Selection of BIPM for random models
- Added 1 sigma errors to update the postfit parfile errors in `event_optimize`
- Fixed DDS CI testing failures
- Add SolarSystemShapiro to the timing model only if an Astrometry component is present.
### Removed

## [0.9.3] 2022-12-16
Expand Down
61 changes: 43 additions & 18 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ Report bugs at https://github.com/nanograv/pint/issues.

If you are reporting a bug, please include:

* Your operating system name and version.
* The output of ``pint.__version__`` and ``pint.__file__``
* The output of ``pint.print_info()``. This command provides the version information of
the OS, Python, PINT, and the various dependencies along with other information about
your system.
* Any details about your local setup that might be helpful in troubleshooting,
such as the command used to install PINT and whether you are using a virtualenv.
* Detailed steps to reproduce the bug, as simply as possible.
such as the command used to install PINT and whether you are using a virtualenv,
conda environment, etc.
* Detailed steps to reproduce the bug, as simply as possible. A self-contained
code snippet that triggers the issue will be most helpful.

Submit Feedback
~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -74,22 +77,37 @@ to write good documentation, you come to understand the code very well.
Get Started!
------------

Ready to contribute? Here's how to set up PINT for local development.
Ready to contribute? Here's how to set up `PINT` for local development.

1. Fork_ the ``pint`` repo on GitHub.
1. Fork_ the `PINT` repo on GitHub.
2. Clone your fork locally::

$ git clone [email protected]:your_name_here/pint.git

3. Install your local copy into a virtualenv. Assuming you have
virtualenvwrapper installed, this is how you set up your fork for local
3. Install your local copy into a `conda`_ environment. Assuming you have
`conda` installed, this is how you set up your fork for local
development::

$ mkvirtualenv pint
$ conda create -n pint-devel python=3.10
$ conda activate pint-devel
$ cd PINT/
$ conda install -c conda-forge --file requirements_dev.txt
$ conda install -c conda-forge --file requirements.txt
$ pip install -e .
$ pre-commit install
The last command installs pre-commit hooks which will squawk at you while trying
to commit changes that don't adhere to our `Coding Style`_.

Alternatively, this can also be done using `virtualenv`. Assuming you have
`virtualenvwrapper` installed, this is how you set up your fork for local
development::

$ mkvirtualenv pint-devel
$ cd PINT/
$ pip install -r requirements_dev.txt
$ pip install -r requirements.txt
$ pip install -e .
$ pre-commit install

4. Create a branch for local development::

Expand All @@ -107,13 +125,13 @@ Ready to contribute? Here's how to set up PINT for local development.
6. Commit your changes and push your branch to GitHub::

$ git add .
$ git commit -m "Your detailed description of your changes."
$ git commit -m "Detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature

7. Submit a pull request through the GitHub website.

8. Check that our automatic testing "Travis CI" passes your code. If
problems crop up, fix them, commit the changes, and push a new version,
8. Check that our automatic testing in "GitHub Actions" passes for your code.
If problems crop up, fix them, commit the changes, and push a new version,
which will automatically update the pull request::

$ git add pint/file-i-just-fixed.py
Expand All @@ -125,21 +143,28 @@ Ready to contribute? Here's how to set up PINT for local development.
functional changes. If accepted, it will be merged into the master branch.

.. _Fork: https://help.github.com/en/articles/fork-a-repo
.. _`conda`: https://docs.conda.io/

Pull Request Guidelines
-----------------------

Before you submit a pull request, check that it meets these guidelines:

1. Try to write clear :ref:`pythonic` code, follow our :ref:`CodingStyle`, and think
1. Try to write clear `Pythonic`_ code, follow our `Coding Style`_, and think
about how others might use your new code.
2. The pull request should include tests that cover both the expected
behavior and sensible error reporting when given bad input.
3. If the pull request adds or changes functionality, the docs should
be updated. Put your new functionality into a function with a
docstring. Check the HTML documentation produced by ``make docs``
to make sure your new documentation appears and looks reasonable.
4. The pull request should work for Python 2.7 and 3.6+. Check
https://travis-ci.org/nanograv/pint/pull_requests
and make sure that the tests pass for all supported Python versions.

If the new functionality needs a more detailed explanation than can be
put in a docstring, add it to ``docs/explanation.rst``. Make sure that
the docstring contains a brief description as well.
4. The pull request should work for and 3.8+. Make sure that all the
CI tests for the pull request pass.
5. Update ``CHANGELOG-unreleased.md`` with an appropriate entry. Please note
that ``CHANGELOG.md`` should not be updated for pull requests.

.. _`Pythonic`: https://peps.python.org/pep-0008/
.. _`Coding Style`: https://nanograv-pint.readthedocs.io/en/latest/coding-style.html
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2014-2017, PINT developers
Copyright 2014-2023, PINT developers

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
Expand Down
32 changes: 20 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ PINT
PINT is not TEMPO3
------------------

PINT is a project to develop a new pulsar timing solution based on
PINT is a project to develop a pulsar timing solution based on
python and modern libraries. It is still in active development,
but it can already produce residuals from most "normal"
but it is in production use by the NANOGrav collaboration and
it has been demonstrated produce residuals from most "normal"
timing models that agree with Tempo and Tempo2 to within ~10
nanoseconds. It can be used within python scripts or notebooks,
and there are several command line tools that come with it.

The primary reasons we are developing PINT are:
The primary reasons PINT was developed are:

* To have a robust system to check high-precision timing results that is
* To have a robust system to produce high-precision timing results that is
completely independent of TEMPO and Tempo2

* To make a system that is easy to extend and modify due to a good design
Expand All @@ -57,7 +58,13 @@ IMPORTANT Notes!
PINT has a naming conflict with the `pint <https://pypi.org/project/Pint/>`_ units package available from PyPI (i.e. using pip) and conda.
Do **NOT** ``pip install pint`` or ``conda install pint``! See below!

PINT requires `longdouble` arithmetic within `numpy`, which is currently not supported natively on M1 Macs (e.g., with the `ARM64 conda build <https://conda-forge.org/blog/posts/2020-10-29-macos-arm64/>`_). So it may be better to install the standard `osx-64` build and rely on Rosetta.
PINT requires ``longdouble`` (80- or 128-bit floating point) arithmetic within ``numpy``, which is currently not supported natively on M1/M2 Macs.
However, you can use an x86 version of ``conda`` even on an M1/M2 Mac (which will run under Rosetta emulation):
see `instructions for using Apple Intel packages on Apple
silicon <https://conda-forge.org/docs/user/tipsandtricks.html#installing-apple-intel-packages-on-apple-silicon>`_.
It's possible to have `parallel versions of conda for x86 and
ARM <https://towardsdatascience.com/python-conda-environments-for-both-arm64-and-x86-64-on-m1-apple-silicon-147b943ffa55>`_.


Installing
----------
Expand Down Expand Up @@ -96,19 +103,17 @@ it, ensuring that all dependencies needed to run PINT are available::
$ cd PINT
$ pip install .

Complete installation instructions are available here_.

.. _here: https://nanograv-pint.readthedocs.io/en/latest/installation.html
Complete installation instructions are available on `readthedocs <https://nanograv-pint.readthedocs.io/en/latest/installation.html>`_.


Using
-----

See the online documentation_. Specifically:
See the online documentation_. Specifically:

* `tutorials <https://nanograv-pint.readthedocs.io/en/latest/tutorials.html>`_
* `Tutorials <https://nanograv-pint.readthedocs.io/en/latest/tutorials.html>`_
* `API reference <https://nanograv-pint.readthedocs.io/en/latest/reference.html>`_
* `How to's for common tasks <https://github.com/nanograv/PINT/wiki/How-To>`_
* `How-Tos for common tasks <https://github.com/nanograv/PINT/wiki/How-To>`_

Are you a NANOGrav member? Then join the #pint channel in the NANOGrav slack.

Expand All @@ -119,10 +124,13 @@ email [email protected] or one of the people below:
* Paul Ray ([email protected])
* David Kaplan ([email protected])

Want to do something new? Submit a github `issue <https://github.com/nanograv/PINT/issues>`_.
Want to do something new? Submit a github `issue <https://github.com/nanograv/PINT/issues>`_.

.. _documentation: http://nanograv-pint.readthedocs.io/en/latest/

And for more details, please read and cite(!) the PINT paper_.

.. _paper: https://ui.adsabs.harvard.edu/abs/2021ApJ...911...45L/abstract

Articles that cite the PINT paper can be found in an ADS `Library <https://ui.adsabs.harvard.edu/search/q=citations(bibcode%3A2021ApJ...911...45L)&sort=date%20desc%2C%20bibcode%20desc&p_=0>`_.
A list of software packages that use PINT can be found `here <https://nanograv-pint.readthedocs.io/en/latest/dependent-packages.html>`_.
3 changes: 0 additions & 3 deletions docs/_ext/componentlist.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst.directives.tables import Table
from docutils.parsers.rst.directives import unchanged_required
from docutils.statemachine import ViewList
import pint.utils


class ComponentList(Directive):
Expand Down
8 changes: 2 additions & 6 deletions docs/_ext/paramtable.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst.directives.tables import Table
from docutils.parsers.rst.directives import unchanged_required
from docutils.statemachine import ViewList
Expand Down Expand Up @@ -55,17 +54,14 @@ def run(self):
entry += para
elif c == "name":
text = d[c]
alias_list = d.get("aliases", [])
if alias_list:
if alias_list := d.get("aliases", []):
text += " / " + ", ".join(d["aliases"])
entry += nodes.paragraph(text=text)
elif isinstance(d[c], str):
entry += nodes.paragraph(text=d[c])
elif isinstance(d[c], list):
entry += nodes.paragraph(text=", ".join(d[c]))
elif d[c] is None:
pass
else:
elif d[c] is not None:
entry += nodes.paragraph(text=str(d[c]))
tbody += row
tgroup += tbody
Expand Down
Loading

0 comments on commit 48a3d13

Please sign in to comment.