Skip to content

Commit

Permalink
Merge pull request #22 from nanograv/package-rename
Browse files Browse the repository at this point in the history
Package Rename to PINT Pal
  • Loading branch information
swiggumj authored Dec 6, 2022
2 parents a82cfaa + e6ac786 commit ae1ddc1
Show file tree
Hide file tree
Showing 38 changed files with 157 additions and 291 deletions.
36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,52 @@
# Timing analysis
# PINT Pal

[![Notebook Pipeline (Ubuntu)](https://github.com/nanograv/pint_pal/actions/workflows/test_notebook.yml/badge.svg)](https://github.com/nanograv/pint_pal/actions/workflows/test_notebook.yml)

A repository for standardizing timing analysis and data combination work with a Jupyter notebook framework and corresponding tools.

`timing_analysis` includes tools and notebook templates to facilitate transparency and reproducibility in timing pulsars using PINT. Configuration (`.yaml`) files contain relatively compact metadata to capture decisions made during the timing process so that such information can naturally be version controlled. Configuration files can be "plugged into" standardized notebook templates to asses and update results.
`pint_pal` includes tools and notebook templates to facilitate transparency and reproducibility in timing pulsars using PINT. Configuration (`.yaml`) files contain relatively compact metadata to capture decisions made during the timing process so that such information can naturally be version controlled. Configuration files can be "plugged into" standardized notebook templates to asses and update results.

More information about available tools and use cases coming soon!

Getting started
---------------

PINT is necessary for core functionality of timing_analysis, but the following packages are also required to do detailed outlier inspection and run noise analyses:
[PINT](https://github.com/nanograv/PINT) is necessary for core functionality of `pint_pal`, but the following packages are also required to do detailed outlier inspection and run noise analyses:

- [enterprise](https://github.com/nanograv/enterprise)
- [enterprise_extensions](https://github.com/nanograv/enterprise_extensions)
- [enterprise_outliers](https://github.com/nanograv/enterprise_outliers)
- [pypulse](https://github.com/mtlam/PyPulse)

- enterprise
- enterprise_extensions
- enterprise_outliers
- pypulse
There are instructions for installing these packages and setting up your environment here: https://github.com/ipta/pulsar-env. Please note that installing `mamba` must be done from a clean (base) `conda` environment; you can make and activate a fresh environment with, e.g.:

There are instructions for installing these packages and setting up your environment here: https://github.com/ipta/pulsar-env. Note that installing `mamba` must be done from a clean (base) conda environment; you can make a fresh environment with, e.g.: `conda create --name myenv`.
```
$ conda create --name installer && conda activate installer
```

Installation
------------

`timing_analysis` is now available on PyPI, so users who do not wish to develop code can grab the latest tagged version with:
`pint_pal` is now available on PyPI, so users who do not wish to develop code can grab the latest tagged version with:

```
$ pip install timing_analysis
$ pip install pint_pal
```

You may also access the latest development (not tagged) version of the repository by cloning it from GitHub, then installing:

```
$ git clone https://github.com/nanograv/timing_analysis.git
$ cd timing_analysis
$ git clone https://github.com/nanograv/pint_pal.git
$ cd pint_pal
$ pip install .
```

To further develop `timing_analysis` code, fork this repository, clone your fork, then:
To further develop `pint_pal` code, fork this repository, clone your fork, then:

```
$ cd timing_analysis
$ cd pint_pal
$ pip install -e .
$ git remote add upstream https://github.com/nanograv/timing_analysis
$ git remote add upstream https://github.com/nanograv/pint_pal
```

Before making changes, we highly recommend using `pulsar-env` (see above) to set up a consistent environment. Submit changes for review by opening a PR from your fork.
22 changes: 11 additions & 11 deletions nb_templates/excision_report.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"metadata": {},
"outputs": [],
"source": [
"from timing_analysis.lite_utils import *\n",
"from timing_analysis.noise_utils import *\n",
"from timing_analysis.par_checker import *\n",
"from timing_analysis.utils import *\n",
"from timing_analysis.dmx_utils import *\n",
"from timing_analysis.timingconfiguration import TimingConfiguration\n",
"from timing_analysis.outlier_utils import *\n",
"from timing_analysis.utils import apply_cut_flag, apply_cut_select\n",
"from timing_analysis.plot_utils import plot_residuals_time\n",
"import timing_analysis.report # For reporting functionality!\n",
"from pint_pal.lite_utils import *\n",
"from pint_pal.noise_utils import *\n",
"from pint_pal.par_checker import *\n",
"from pint_pal.utils import *\n",
"from pint_pal.dmx_utils import *\n",
"from pint_pal.timingconfiguration import TimingConfiguration\n",
"from pint_pal.outlier_utils import *\n",
"from pint_pal.utils import apply_cut_flag, apply_cut_select\n",
"from pint_pal.plot_utils import plot_residuals_time\n",
"import pint_pal.report # For reporting functionality!\n",
"import yaml\n",
"from astropy import log\n",
"import pint.fitter\n",
Expand Down Expand Up @@ -88,7 +88,7 @@
"metadata": {},
"outputs": [],
"source": [
"report = timing_analysis.report.Report(\n",
"report = pint_pal.report.Report(\n",
" title=f\"TOA Excision Report\", \n",
" sections=[\"Summary\",\"Outlier Analysis\",\"Reasons\",\"Warnings\"])\n",
" # maybe it would be useful to have \"procedure\" to show order of ops?\n",
Expand Down
152 changes: 6 additions & 146 deletions nb_templates/make_release_plots.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions nb_templates/nbwb_explore.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import timing_analysis.lite_utils as lu\n",
"from timing_analysis.utils import check_recentness_noise\n",
"from timing_analysis.timingconfiguration import TimingConfiguration\n",
"from timing_analysis.plot_utils import plot_dmxout, plot_dmx_diffs_nbwb\n",
"import timing_analysis.report\n",
"import pint_pal.lite_utils as lu\n",
"from pint_pal.utils import check_recentness_noise\n",
"from pint_pal.timingconfiguration import TimingConfiguration\n",
"from pint_pal.plot_utils import plot_dmxout, plot_dmx_diffs_nbwb\n",
"import pint_pal.report\n",
"from astropy import log\n",
"import glob\n",
"import os\n",
Expand All @@ -37,7 +37,7 @@
"nb_config = f\"configs/{source}.nb.yaml\"\n",
"wb_config = f\"configs/{source}.wb.yaml\"\n",
"nb_tc, wb_tc = TimingConfiguration(nb_config), TimingConfiguration(wb_config)\n",
"report = timing_analysis.report.Report(\n",
"report = pint_pal.report.Report(\n",
" title=f\"{source} NB-WB comparison\", \n",
" sections=[\"Summary\",\"DMX\",\"Comparison\",\"Warnings\"])\n",
"report.begin_capturing_log(\"Warnings\")\n",
Expand Down
8 changes: 4 additions & 4 deletions nb_templates/process_ipta_prenoise_v0.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"metadata": {},
"outputs": [],
"source": [
"#import timing_analysis.par_checker as pc\n",
"import timing_analysis.lite_utils as lu\n",
"import timing_analysis.plot_utils as pu\n",
"from timing_analysis.timingconfiguration import TimingConfiguration\n",
"#import pint_pal.par_checker as pc\n",
"import pint_pal.lite_utils as lu\n",
"import pint_pal.plot_utils as pu\n",
"from pint_pal.timingconfiguration import TimingConfiguration\n",
"from astropy import log\n",
"from pint.fitter import ConvergenceFailure\n",
"import pint.fitter\n",
Expand Down
20 changes: 10 additions & 10 deletions nb_templates/process_v1.1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"metadata": {},
"source": [
"# \\[set-up\\], imports\n",
"Reminder (if working on the notebook server): make sure your copy of `timing_analysis` is up to date and you're working on a development branch, e.g. `psr/J1234+5678/jks`. See README for more details. If not working on the notebook server, you may need to update required software packages (`pint`, `enterprise`, `enterprise_extensions`) according to requirements in `setup.py`."
"Reminder (if working on the notebook server): make sure your copy of `pint_pal` is up to date and you're working on a development branch, e.g. `psr/J1234+5678/jks`. See README for more details. If not working on the notebook server, you may need to update required software packages (`pint`, `enterprise`, `enterprise_extensions`) according to requirements in `setup.py`."
]
},
{
Expand All @@ -14,15 +14,15 @@
"metadata": {},
"outputs": [],
"source": [
"import timing_analysis.par_checker as pc\n",
"import timing_analysis.dmx_utils as du\n",
"import timing_analysis.lite_utils as lu\n",
"import timing_analysis.noise_utils as nu\n",
"import timing_analysis.plot_utils as pu\n",
"from timing_analysis.ftester import run_Ftests\n",
"from timing_analysis.utils import resid_stats, pdf_writer, apply_cut_select\n",
"from timing_analysis.utils import check_recentness_excision, check_recentness_noise\n",
"from timing_analysis.timingconfiguration import TimingConfiguration\n",
"import pint_pal.par_checker as pc\n",
"import pint_pal.dmx_utils as du\n",
"import pint_pal.lite_utils as lu\n",
"import pint_pal.noise_utils as nu\n",
"import pint_pal.plot_utils as pu\n",
"from pint_pal.ftester import run_Ftests\n",
"from pint_pal.utils import resid_stats, pdf_writer, apply_cut_select\n",
"from pint_pal.utils import check_recentness_excision, check_recentness_noise\n",
"from pint_pal.timingconfiguration import TimingConfiguration\n",
"from astropy import log\n",
"from pint.fitter import ConvergenceFailure\n",
"import pint.fitter\n",
Expand Down
20 changes: 10 additions & 10 deletions nb_templates/process_v1.2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"metadata": {},
"source": [
"# \\[set-up\\], imports\n",
"Reminder (if working on the notebook server): make sure your copy of `timing_analysis` is up to date and you're working on a development branch, e.g. `psr/J1234+5678/jks`. See README for more details. If not working on the notebook server, you may need to update required software packages (`pint`, `enterprise`, `enterprise_extensions`) according to requirements in `setup.py`."
"Reminder (if working on the notebook server): make sure your copy of `pint_pal` is up to date and you're working on a development branch, e.g. `psr/J1234+5678/jks`. See README for more details. If not working on the notebook server, you may need to update required software packages (`pint`, `enterprise`, `enterprise_extensions`) according to requirements in `setup.py`."
]
},
{
Expand All @@ -14,15 +14,15 @@
"metadata": {},
"outputs": [],
"source": [
"import timing_analysis.par_checker as pc\n",
"import timing_analysis.dmx_utils as du\n",
"import timing_analysis.lite_utils as lu\n",
"import timing_analysis.noise_utils as nu\n",
"import timing_analysis.plot_utils as pu\n",
"from timing_analysis.ftester import run_Ftests\n",
"from timing_analysis.utils import resid_stats, pdf_writer, apply_cut_select\n",
"from timing_analysis.utils import check_recentness_excision, check_recentness_noise\n",
"from timing_analysis.timingconfiguration import TimingConfiguration\n",
"import pint_pal.par_checker as pc\n",
"import pint_pal.dmx_utils as du\n",
"import pint_pal.lite_utils as lu\n",
"import pint_pal.noise_utils as nu\n",
"import pint_pal.plot_utils as pu\n",
"from pint_pal.ftester import run_Ftests\n",
"from pint_pal.utils import resid_stats, pdf_writer, apply_cut_select\n",
"from pint_pal.utils import check_recentness_excision, check_recentness_noise\n",
"from pint_pal.timingconfiguration import TimingConfiguration\n",
"from astropy import log\n",
"from pint.fitter import ConvergenceFailure\n",
"import pint.fitter\n",
Expand Down
20 changes: 10 additions & 10 deletions nb_templates/toa_excision.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
"metadata": {},
"outputs": [],
"source": [
"from timing_analysis.lite_utils import *\n",
"from timing_analysis.noise_utils import *\n",
"from timing_analysis.par_checker import *\n",
"from timing_analysis.utils import *\n",
"from timing_analysis.dmx_utils import *\n",
"from timing_analysis.timingconfiguration import TimingConfiguration\n",
"from timing_analysis.outlier_utils import *\n",
"from timing_analysis.utils import apply_cut_flag, apply_cut_select\n",
"from timing_analysis.plot_utils import plot_residuals_time\n",
"from pint_pal.lite_utils import *\n",
"from pint_pal.noise_utils import *\n",
"from pint_pal.par_checker import *\n",
"from pint_pal.utils import *\n",
"from pint_pal.dmx_utils import *\n",
"from pint_pal.timingconfiguration import TimingConfiguration\n",
"from pint_pal.outlier_utils import *\n",
"from pint_pal.utils import apply_cut_flag, apply_cut_select\n",
"from pint_pal.plot_utils import plot_residuals_time\n",
"import yaml\n",
"from astropy import log\n",
"import pint.fitter\n",
Expand Down Expand Up @@ -145,7 +145,7 @@
"outputs": [],
"source": [
"# Plot residuals vs. time after auto/manual cuts\n",
"from timing_analysis.plot_utils import plot_residuals_time\n",
"from pint_pal.plot_utils import plot_residuals_time\n",
"fo = tc.construct_fitter(to,mo)\n",
"plot_residuals_time(fo, restype='prefit')"
]
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "timing-analysis"
version = "1.2.1"
name = "pint_pal"
version = "0.1.0"
authors = [
{ name="Joe Glaser", email="[email protected]" },
{ name="Joe Swiggum", email="[email protected]" },
Expand All @@ -23,5 +23,5 @@ classifiers = [
]

[project.urls]
"Homepage" = "https://github.com/nanograv/timing_analysis"
"Bug Tracker" = "https://github.com/nanograv/timing_analysis/issues"
"Homepage" = "https://github.com/nanograv/pint_pal"
"Bug Tracker" = "https://github.com/nanograv/pint_pal/issues"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
name = timing-analysis
name = pint_pal

[options]
package_dir =
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
long_description = fh.read()

setup(
name="timing_analysis",
version="1.0.0",
description="NANOGrav Timimg Analysis",
name="pint_pal",
version="0.1.0",
description="Notebook/PINT-based Pulsar Timimg Analysis Software",
author="Joe Swiggum",
author_email="[email protected]",
url="",
Expand All @@ -29,5 +29,5 @@
"jupyter",
"seaborn"
],
python_requires=">=3.7",
python_requires=">=3.8",
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
from astropy import log
from timing_analysis.utils import apply_cut_flag, apply_cut_select
from pint_pal.utils import apply_cut_flag, apply_cut_select

class DMXParameter:
"""
Expand Down
2 changes: 1 addition & 1 deletion src/timing_analysis/ftester.py → src/pint_pal/ftester.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#from pint.models import (
# parameter as p,
#)
import timing_analysis.PINT_parameters as pparams
import pint_pal.PINT_parameters as pparams
from pint.models.timing_model import Component
import copy
import astropy.units as u
Expand Down
10 changes: 5 additions & 5 deletions src/timing_analysis/lite_utils.py → src/pint_pal/lite_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from datetime import date
import yaml
import os
import timing_analysis.par_checker as pc
import pint_pal.par_checker as pc
from ipywidgets import widgets
import pypulse
import glob
Expand Down Expand Up @@ -899,7 +899,7 @@ def cut_summary(toas, tc, print_summary=False, donut=True, legend=True, save=Fal
Parameters
==========
toas: `pint.toa.TOAs` object
tc: `timing_analysis.timingconfiguration.TimingConfiguration` object
tc: `pint_pal.timingconfiguration.TimingConfiguration` object
print_summary: bool, optional
Print reasons for cuts and respective nTOA/percentages
donut: bool, optional
Expand Down Expand Up @@ -1245,7 +1245,7 @@ def display_auto_ex(tc, mo, cutkeys=['epochdrop', 'outlier10'], plot_type='profi
Parameters
==========
tc: `timing_analysis.timingconfiguration.TimingConfiguration` object
tc: `pint_pal.timingconfiguration.TimingConfiguration` object
mo: `pint.model.TimingModel` object
cutkeys: any valid -cut keys (default = ['epochdrop', 'outlier10'])
plot_type: str specifying plot type (profile [default], GTpd, or YFp)
Expand Down Expand Up @@ -1303,7 +1303,7 @@ def highlight_cut_resids(toas,model,tc_object,cuts=['badtoa','badfile'],multi=Fa
==========
toas: `pint.toa.TOAs` object
model: `pint.model.TimingModel` object
tc_object: `timing_analysis.timingconfiguration` object
tc_object: `pint_pal.timingconfiguration` object
cuts: list, optional
cuts to highlight in residuals plot (default: manual cuts)
multi: bool, optional
Expand Down Expand Up @@ -1377,7 +1377,7 @@ def highlight_cut_resids(toas,model,tc_object,cuts=['badtoa','badfile'],multi=Fa
plt.savefig(f'{model.PSR.value}_manual_hl_nb.png', dpi=150)

# reset cuts for additional processing
from timing_analysis.utils import apply_cut_select
from pint_pal.utils import apply_cut_select
apply_cut_select(toas,reason='resumption after highlighting cuts')

def check_toa_version(toas):
Expand Down
Loading

0 comments on commit ae1ddc1

Please sign in to comment.