A Python module for querying the ATNF pulsar catalogue
Project description
# PSRQpy
This module aims to provide a python interface for querying the [ATNF pulsar catalogue](http://www.atnf.csiro.au/people/pulsar/psrcat/).
It is inspired by, and has some minor similarities to, the [`ads`](https://ads.readthedocs.io) module for interfacing with the
[NASA ADS](https://ui.adsabs.harvard.edu/) [API](https://github.com/adsabs/adsabs-dev-api). It is an unofficial
package and is not endorsed by or affiliated with the ATNF.
Any comments or suggestions are welcome.
## Installation
To install the code from source clone the git repository and run either:
```
python setup.py install --user
```
to install as a user, or
```
sudo python setup.py install --user
```
to install as root.
The module can also be installed using `pip` with:
```
pip install psrqpy
```
### Requirements
The requirements for installing the code are:
* `six`
* `requests`
* `beautifulsoup4`
* `numpy`
* `astropy`
* `datetime`
The `ads` module is an optional requirement that is needed to get ADS URLs for references.
## Example
A simple query of the catalogue, e.g., to just return all pulsar frequencies, would be:
```
import psrqpy
q = psrqpy.QueryATNF(params='F0')
# get frequencies as an astropy table
t = q.table()
print t['F0']
```
You can query multiply parameters, e.g.:
```
import psrqpy
q = psrqpy.QueryATNF(params=['F0', 'F1', 'RAJ', 'DecJ'])
# get values as an astropy table
t = q.table()
print t['F0']
```
You can query specific pulsars, e.g.:
```
import psrqpy
q = psrqpy.QueryATNF(params=['JName', 'F0', 'F1', 'RAJ', 'DecJ'], psrs=['J0534+2200', 'J0537-6910'])
# get values as an astropy table
t = q.table()
```
You can set [conditions](http://www.atnf.csiro.au/research/pulsar/psrcat/psrcat_help.html?type=normal#condition) for the searches,
e.g.:
```
import psrqpy
q = psrqpy.QueryATNF(params=['Jname', 'f0'], condition='f0 > 100 && f0 < 200', assoc='GC')
```
where `assoc=GC` looks for all pulsars in globular clusters.
If you really want to query the catalogue many times in quick succession it is advisable not to use this module, as
it could result in too much load on the ATNF catalogue's server. Instead it is probably preferable to [download
the catalogue](http://www.atnf.csiro.au/research/pulsar/psrcat/download.html) and query it with the software
provided.
## Copyright and referencing for the catalogue
Regarding the use of the catalogue and software behind it, the [following statements](http://www.atnf.csiro.au/research/pulsar/psrcat/download.html) apply:
> PSRCAT is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PSRCAT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
>
> PSRCAT makes use of "evaluateExpression: A Simple Expression Evaluator". Copyright © 1996 - 1999 Parsifal Software, All Rights Reserved.
>
> The programs and databases remain the property of the Australia Telescope National Facility, CSIRO, and are covered by the [CSIRO Legal Notice and Disclaimer](http://www.csiro.au/en/About/Footer/Legal-notice).
>
> If you make use of information from the ATNF Pulsar Catalogue in a publication, we would appreciate acknowledgement by reference to the publication "[The ATNF Pulsar Catalogue](http://adsabs.harvard.edu/abs/2005AJ....129.1993M)", R. N. Manchester, G. B. Hobbs, A. Teoh & M. Hobbs, Astronomical Journal, 129, 1993-2006 (2005) and by quoting the web address http://www.atnf.csiro.au/research/pulsar/psrcat for updated versions.
## License
This code is licensed under the [MIT License](http://opensource.org/licenses/MIT).
© Matt Pitkin, 2017
[![PyPI version](https://badge.fury.io/py/psrqpy.svg)](https://badge.fury.io/py/psrqpy)
This module aims to provide a python interface for querying the [ATNF pulsar catalogue](http://www.atnf.csiro.au/people/pulsar/psrcat/).
It is inspired by, and has some minor similarities to, the [`ads`](https://ads.readthedocs.io) module for interfacing with the
[NASA ADS](https://ui.adsabs.harvard.edu/) [API](https://github.com/adsabs/adsabs-dev-api). It is an unofficial
package and is not endorsed by or affiliated with the ATNF.
Any comments or suggestions are welcome.
## Installation
To install the code from source clone the git repository and run either:
```
python setup.py install --user
```
to install as a user, or
```
sudo python setup.py install --user
```
to install as root.
The module can also be installed using `pip` with:
```
pip install psrqpy
```
### Requirements
The requirements for installing the code are:
* `six`
* `requests`
* `beautifulsoup4`
* `numpy`
* `astropy`
* `datetime`
The `ads` module is an optional requirement that is needed to get ADS URLs for references.
## Example
A simple query of the catalogue, e.g., to just return all pulsar frequencies, would be:
```
import psrqpy
q = psrqpy.QueryATNF(params='F0')
# get frequencies as an astropy table
t = q.table()
print t['F0']
```
You can query multiply parameters, e.g.:
```
import psrqpy
q = psrqpy.QueryATNF(params=['F0', 'F1', 'RAJ', 'DecJ'])
# get values as an astropy table
t = q.table()
print t['F0']
```
You can query specific pulsars, e.g.:
```
import psrqpy
q = psrqpy.QueryATNF(params=['JName', 'F0', 'F1', 'RAJ', 'DecJ'], psrs=['J0534+2200', 'J0537-6910'])
# get values as an astropy table
t = q.table()
```
You can set [conditions](http://www.atnf.csiro.au/research/pulsar/psrcat/psrcat_help.html?type=normal#condition) for the searches,
e.g.:
```
import psrqpy
q = psrqpy.QueryATNF(params=['Jname', 'f0'], condition='f0 > 100 && f0 < 200', assoc='GC')
```
where `assoc=GC` looks for all pulsars in globular clusters.
If you really want to query the catalogue many times in quick succession it is advisable not to use this module, as
it could result in too much load on the ATNF catalogue's server. Instead it is probably preferable to [download
the catalogue](http://www.atnf.csiro.au/research/pulsar/psrcat/download.html) and query it with the software
provided.
## Copyright and referencing for the catalogue
Regarding the use of the catalogue and software behind it, the [following statements](http://www.atnf.csiro.au/research/pulsar/psrcat/download.html) apply:
> PSRCAT is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PSRCAT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
>
> PSRCAT makes use of "evaluateExpression: A Simple Expression Evaluator". Copyright © 1996 - 1999 Parsifal Software, All Rights Reserved.
>
> The programs and databases remain the property of the Australia Telescope National Facility, CSIRO, and are covered by the [CSIRO Legal Notice and Disclaimer](http://www.csiro.au/en/About/Footer/Legal-notice).
>
> If you make use of information from the ATNF Pulsar Catalogue in a publication, we would appreciate acknowledgement by reference to the publication "[The ATNF Pulsar Catalogue](http://adsabs.harvard.edu/abs/2005AJ....129.1993M)", R. N. Manchester, G. B. Hobbs, A. Teoh & M. Hobbs, Astronomical Journal, 129, 1993-2006 (2005) and by quoting the web address http://www.atnf.csiro.au/research/pulsar/psrcat for updated versions.
## License
This code is licensed under the [MIT License](http://opensource.org/licenses/MIT).
© Matt Pitkin, 2017
[![PyPI version](https://badge.fury.io/py/psrqpy.svg)](https://badge.fury.io/py/psrqpy)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
psrqpy-0.2.1-py2.py3-none-any.whl
(22.1 kB
view hashes)
psrqpy-0.2.1-py2.7.egg
(37.1 kB
view hashes)
Close
Hashes for psrqpy-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e24e4d19831b3159c5e2918e8d938bcf5f4cdadba0f170a9395b791ba7d799e3 |
|
MD5 | 0cd218d570b56e94b0810240bad66d00 |
|
BLAKE2b-256 | 2a917e28213dca9defa166a186030128ece0a3e77cb09d38002da1af011cf87f |