Skip to content

Commit

Permalink
Merge branch 'main' into bhat_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NickSwainston committed Apr 19, 2023
2 parents 7d33b42 + f323b2f commit 2e4d31a
Show file tree
Hide file tree
Showing 55 changed files with 13,416 additions and 37 deletions.
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.9

LABEL maintainer="Nick Swainston <nickswainston@gmail.com>"

# Work in a temp build directory
WORKDIR /tmp/build
ADD . /tmp/build

# Install using pip
RUN pip install . && \
rm -rf /tmp/build
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ You can install via pip using

Or you can clone or download the repository and then use `python setup.py install` or `pip install .`

There is also a docker container that you can install with `docker pull nickswainston/pulsar_spectra`.


Help
=====
The documentation can be found [here](https://pulsar-spectra.readthedocs.io/en/latest/)

Credit
=====
If you use pulsar_spectra for your research please give credit by citing [Swainston et al 2012, PASA, 39, e056](https://ui.adsabs.harvard.edu/abs/2022arXiv220913324S/abstract) and the [publications of the data](https://pulsar-spectra.readthedocs.io/en/latest/catalogue.html#papers-included-in-our-catalogue) used in your spectral fits.
If you use pulsar_spectra for your research please give credit by citing [Swainston et al 2022, PASA, 39, e056](https://ui.adsabs.harvard.edu/abs/2022arXiv220913324S/abstract) and the [publications of the data](https://pulsar-spectra.readthedocs.io/en/latest/catalogue.html#papers-included-in-our-catalogue) used in your spectral fits.

Until there is a more appropriate method for crediting software development and maintainance, please also consider including me as a co-author on publications which rely on pulsar_spectra.

Expand Down
95 changes: 88 additions & 7 deletions docs/catalogue.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,97 @@ Then move to the scripts subdirectory of the repository and run the command:
python csv_to_yaml.py --csv your_paper.csv --ref author_year
This will put a YAML file of the paper in pulsar_spectra/catalogue_papers/.
You should then reinstall the software (`python setup.py install`) then run a spectral fit to confirm it worked.
You should then reinstall the software (:code:`python setup.py install`) then run a spectral fit to confirm it worked.

So others can use this paper's data, you should

1. Make a fork of the pulsar_spectra repository
Catalogue standards for new paper
---------------------------------
For flux density measurements to be uploaded to the catalogue, they must meet the following criteria and standards:

1. Published
The paper must be peer-reviewed and published.
We are considering altering this to accept regular measurement programs with an established and reliable method.

2. New results
If the paper includes flux density measurements from previous publications, do not include them.

3. Include bandwidth
A bandwidth value is required for each flux density measurement.
If there is no mention of the bandwidth in the paper, investigate previous publications that use the telescope to determine what bandwidth was likely used.
If there is no way to determine the bandwidth used, do not use the paper.

4. Flux density uncertainties
If the paper does not supply a flux density uncertainty, assume a relative uncertainty of 50 %.

5. Do not include upper limits
The catalogue does not currently have a way of handling upper limits, so do not include them.
If you have a suggestion for handling upper limits, please make an issue or start a discussion on the GitHub page.


Uploading the new catalogue to GitHub
-------------------------------------
So others can use this paper's data, you should create `a fork <https://docs.github.com/en/get-started/quickstart/fork-a-repo>`_ of the pulsar_spectra,
and the new catalogue files and make a `pull request <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork>`_.
The following are the steps this will require and what you should include in your pull request.

1. Make a fork of pulsar spectra
Go to the `pulsar_spectra <https://github.com/NickSwainston/pulsar_spectra>`_ repository and fork it by clicking the fork button in the top right.
Follow the steps until you are on the webpage with your fork (the URL should look like https://github.com/yourusername/pulsar_spectra).

2. Clone your fork
3. Add the new paper YAML file and make a commit
4. Git push to your fork and then make a pull request on GitHub
5. Wait for your pull request to be approved and merged
6. Pat yourself on the back for contributing to open-source software!
From your fork webpage, click the code button and copy the clone URL.
In your terminal, go to a directory where you would like to put the code and run the command

:code:`git clone <copied url here>`

The :code:`pulsar_spectra` directory it creates is where you should be working on your changes.

3. Add each paper
For each paper, perform the following sub-steps

a. Create the YAML paper file
Follow the steps in the :ref:`added to the catalogue <adding_papers>` section,
will make a YAML file in the directory :code:`pulsar_spectra/catalogue_papers/`.

b. Update ADS links
In the :code:`pulsar_spectra/catalogue.py`, there is a dictionary called :code:`ADS_REF` (currently on line 25).
Add a new line to this dictionary by making the key "Author_year" and the link to the ADS abstract page for the paper.
So the format is:

:code:`"Author_year": "adslink",`

c. Commit the changed files
First, you must add the new YAML file and the updated ADS ref like so (changing the command for your file):

:code:`git add pulsar_spectra/catalogue_papers/<AUTHOR_YEAR>.yaml pulsar_spectra/catalogue.py`

Then make a commit describing your changes:

:code:`git commit -m "Added <AUTHOR_YEAR> to the catalogue.`

Feel free to add a brief description of the paper if you'd like.

4. Create a pull request
Once you have finished adding to the repo, you can push your changes to your GitHub fork using:

:code:`git push`

Then go to your GitHub pulsar_spectra fork webpage and click on "Pull requests", and then "Create pull request"
(It may have prompted you to make a pull request already).

What we want (and what should happen by default) is the pull request will say something like this:

:code:`base respository:NickSwainston/pulsar_spectra base:main <- head respository:YOURUSERNAME/pulsar_spectra base:main`

Write a description of the changes you have made and click submit.

5. Wait for approval
The maintainers will review your changes, run some of the tests and either help you fix any errors or fix them on your behalf.
Once the pull request is fixed and tested, it will be merged into the main branch so everyone can use it.

6. Celebrate!
Pat yourself on the back for contributing to open-source software!
You should now see yourself listed under the contributors to the repository.


Catalogue format
Expand Down
8 changes: 7 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ or

.. code-block:: bash
pip install .
pip install .
There is also a docker container that you can install with

.. code-block:: bash
docker pull nickswainston/pulsar_spectra
1 change: 1 addition & 0 deletions pulsar_spectra/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._version import __version__
1 change: 1 addition & 0 deletions pulsar_spectra/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '2.0.1'
55 changes: 50 additions & 5 deletions pulsar_spectra/catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,51 @@
"Frail_2016": "https://ui.adsabs.harvard.edu/abs/2016ApJ...829..119F/abstract",
"Lee_2022": "https://ui.adsabs.harvard.edu/abs/2022PASA...39...42L/abstract",
"Bhat_2023": "https://ui.adsabs.harvard.edu/abs/2023arXiv230211920B/abstract",
"Aloisi_2019":"https://ui.adsabs.harvard.edu/abs/2019ApJ...875...19A/abstract",
"Bailes_1997":"https://ui.adsabs.harvard.edu/abs/1997ApJ...481..386B/abstract",
"Basu_2018":"https://ui.adsabs.harvard.edu/abs/2018MNRAS.475.1469B/abstract",
"Biggs_1996":"https://ui.adsabs.harvard.edu/abs/1996MNRAS.282..691B/abstract",
"Boyles_2012":"https://arxiv.org/abs/1209.4293",
"Brinkman_2018":"https://ui.adsabs.harvard.edu/abs/2018MNRAS.474.2012B",
"Champion_2005a":"https://ui.adsabs.harvard.edu/abs/2005MNRAS.363..929C",
"Champion_2005b":"https://ui.adsabs.harvard.edu/abs/2005PhDT.......282C",
"Crawford_2001":"https://ui.adsabs.harvard.edu/abs/2001AJ....122.2001C/abstract",
"Crawford_2007":"https://ui.adsabs.harvard.edu/abs/2007AJ....134.1231C/abstract",
"Deller_2009":"https://ui.adsabs.harvard.edu/abs/2009ApJ...701.1243D/abstract",
"Dembska_2015":"https://ui.adsabs.harvard.edu/abs/2015MNRAS.449.1869D",
"Demorest_2013":"https://ui.adsabs.harvard.edu/abs/2013ApJ...762...94D",
"Esamdin_2004":"https://ui.adsabs.harvard.edu/abs/2004A&A...425..949E",
"Freire_2007":"https://ui.adsabs.harvard.edu/abs/2007ApJ...662.1177F",
"Gentile_2018":"https://ui.adsabs.harvard.edu/abs/2018ApJ...868..122B",
"Giacani_2001":"https://ui.adsabs.harvard.edu/abs/2001AJ....121.3133G",
"Han_1999":"https://ui.adsabs.harvard.edu/abs/1999A&AS..136..571H",
"Hoensbroech_1997":"https://ui.adsabs.harvard.edu/abs/1997A%26AS..126..121V/abstract",
"Joshi_2009":"https://ui.adsabs.harvard.edu/abs/2009MNRAS.398..943J/abstract",
"Kaspi_1997":"https://ui.adsabs.harvard.edu/abs/1997ApJ...485..820K",
"Kijak_1998":"https://ui.adsabs.harvard.edu/abs/1998A%26AS..127..153K/abstract",
"Kramer_1997":"https://ui.adsabs.harvard.edu/abs/1997ApJ...488..364K",
"Kuniyoshi_2015":"https://ui.adsabs.harvard.edu/abs/2015MNRAS.453..828K/abstract",
"Lewandowski_2004":"https://ui.adsabs.harvard.edu/abs/2004ApJ...600..905L",
"Lorimer_1995":"https://ui.adsabs.harvard.edu/abs/1995ApJ...439..933L",
"Lorimer_1996":"https://ui.adsabs.harvard.edu/abs/1996MNRAS.283.1383L",
"Lorimer_2005":"https://ui.adsabs.harvard.edu/abs/2005MNRAS.359.1524L",
"Lorimer_2007":"https://ui.adsabs.harvard.edu/abs/2007MNRAS.379..282L",
"Lynch_2012":"https://ui.adsabs.harvard.edu/abs/2012ApJ...745..109L",
"Lynch_2013":"https://arxiv.org/abs/1209.4296",
"Manchester_1995":"https://ui.adsabs.harvard.edu/abs/1995ApJ...441L..65M/abstract",
"Manchester_2013":"https://ui.adsabs.harvard.edu/abs/2013PASA...30...17M/abstract",
"Michilli_2020":"https://ui.adsabs.harvard.edu/abs/2020MNRAS.491..725M/abstract",
"Mickaliger_2012":"https://ui.adsabs.harvard.edu/abs/2012ApJ...759..127M",
"Mikhailov_2016":"https://ui.adsabs.harvard.edu/abs/2016A%26A...593A..21M/abstract",
"Ng_2015":"https://ui.adsabs.harvard.edu/abs/2015MNRAS.450.2922N",
"RoZko_2018":"https://ui.adsabs.harvard.edu/abs/2018MNRAS.479.2193R",
"Sayer_1997":"https://ui.adsabs.harvard.edu/abs/1997ApJ...474..426S",
"Seiradakis_1995":"https://ui.adsabs.harvard.edu/abs/1995A%26AS..111..205S/abstract",
"Shapiro_Albert_2021":"{https://ui.adsabs.harvard.edu/abs/2021ApJ...909..219S",
"Stovall_2014":"https://ui.adsabs.harvard.edu/abs/2014ApJ...791...67S/abstract",
"Surnis_2019":"https://ui.adsabs.harvard.edu/abs/2019ApJ...870....8S/abstract",
"Titus_2019":"https://ui.adsabs.harvard.edu/abs/2019MNRAS.487.4332T",
"Zhao_2017":"https://ui.adsabs.harvard.edu/abs/2017ApJ...845..156Z/abstract",
}


Expand Down Expand Up @@ -341,13 +386,13 @@ def collect_catalogue_fluxes(only_use=None, exclude=None, query=None, use_atnf=T
yamls_to_check = yamls_to_use
yamls_to_use = []
for y_dir in yamls_to_check:
yaml_label = y_dir.split("/")[-1].split(".")[0]
yaml_label = os.path.basename(y_dir).split(".")[0]
if yaml_label not in exclude:
yamls_to_use.append(y_dir)

# Loop over catalogues and put them into a dictionary
for cat_file in yamls_to_use:
cat_label = cat_file.split("/")[-1].split(".")[0]
cat_label = os.path.basename(cat_file).split(".")[0]

# Load in the dict
with open(cat_file, "r") as stream:
Expand All @@ -371,12 +416,12 @@ def collect_catalogue_fluxes(only_use=None, exclude=None, query=None, use_atnf=T

# Add the antf to the cataogues
antf_dict = all_flux_from_atnf(query=query)
# refs that have errors that we plan to inform ANTF about
antf_incorrect_refs = ["Zhao_2019", "Mignani_2017", "Bell_2016", "Robinson_1995", "Johnston_1994", "Manchester_1996", "Xie_2019", "Han_2016", "Kramer_1999", "Kondratiev_2015"]
# refs that have errors that we plan to inform ATNF about
antf_incorrect_refs = ["Zhao_2019", "Mignani_2017", "Bell_2016", "Robinson_1995", "Johnston_1994", "Manchester_1996", "Xie_2019", "Han_2016", "Kramer_1999", "Kondratiev_2015", "Crawford_2001", "Michilli_2020", "Manchester_2013", "Brinkman_2018"]
# refs that are correct but where scaled to by their spectral index for the ATNF frequencies
antf_adjusted_refs = ["Lorimer_1995b", "Stovall_2015", "Sanidas_2019", "Wolszczan_1992", "Dembska_2014", "Kaur_2019", "Alam_2021"]
# refs that were rounded to different decimal places than the publications
antf_rounded_refs = ["Johnston_2018", "Dai_2015", "McEwen_2020", "McConnell_1991", "Bondonneau_2020", "Johnston_2021", "Bates_2011", "Han_2021"]
antf_rounded_refs = ["Johnston_2018", "Dai_2015", "McEwen_2020", "McConnell_1991", "Bondonneau_2020", "Johnston_2021", "Bates_2011", "Han_2021", "Sayer_1997", "Lynch_2012", "Stovall_2014"]
# refs that have different uncertainties than published
antf_uncert_refs = ["Stairs_1999", "Kuzmin_2001", "Jankowski_2019", "Jankowski_2018", "Kramer_2003a", "Manchester_2001", "Morris_2002", "Zhang_2019"]
for jname in jnames:
Expand Down
58 changes: 58 additions & 0 deletions pulsar_spectra/catalogue_papers/Aloisi_2019.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"J0038-2501": {
"Frequency MHz": [
350.0
],
"Bandwidth MHz": [
100.0
],
"Flux Density mJy": [
3.7
],
"Flux Density error mJy": [
1.85
]
},
"J1916-2939": {
"Frequency MHz": [
350.0
],
"Bandwidth MHz": [
100.0
],
"Flux Density mJy": [
2.2
],
"Flux Density error mJy": [
1.1
]
},
"J1949+3426": {
"Frequency MHz": [
350.0
],
"Bandwidth MHz": [
100.0
],
"Flux Density mJy": [
3.7
],
"Flux Density error mJy": [
1.85
]
},
"J2355+2246": {
"Frequency MHz": [
350.0
],
"Bandwidth MHz": [
100.0
],
"Flux Density mJy": [
0.9
],
"Flux Density error mJy": [
0.45
]
}
}
90 changes: 90 additions & 0 deletions pulsar_spectra/catalogue_papers/Bailes_1997.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"J0711-6830": {
"Frequency MHz": [
400.0,
600.0,
1400.0
],
"Bandwidth MHz": [
64.0,
64.0,
64.0
],
"Flux Density mJy": [
10.0,
10.0,
1.6
],
"Flux Density error mJy": [
1.0,
3.0,
0.3
]
},
"J1024-0719": {
"Frequency MHz": [
400.0,
600.0,
1400.0
],
"Bandwidth MHz": [
64.0,
64.0,
64.0
],
"Flux Density mJy": [
4.6,
2.1,
0.5
],
"Flux Density error mJy": [
1.2,
0.4,
0.3
]
},
"J1744-1134": {
"Frequency MHz": [
400.0,
600.0,
1400.0
],
"Bandwidth MHz": [
64.0,
64.0,
64.0
],
"Flux Density mJy": [
13.0,
7.0,
1.0
],
"Flux Density error mJy": [
3.0,
2.0,
0.2
]
},
"J2124-3358": {
"Frequency MHz": [
400.0,
600.0,
1400.0
],
"Bandwidth MHz": [
64.0,
64.0,
64.0
],
"Flux Density mJy": [
6.0,
6.0,
1.6
],
"Flux Density error mJy": [
2.0,
1.0,
0.4
]
}
}
Loading

0 comments on commit 2e4d31a

Please sign in to comment.