### Installation from source Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Installs the psrqpy package from its source code. ```bash pip install . ``` -------------------------------- ### Installation from PyPI Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Installs the psrqpy package from the Python Package Index. ```bash pip install psrqpy ``` -------------------------------- ### Retrieving the full ephemeris for a pulsar Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Example of how to get the complete ephemeris data for a specific pulsar. ```python >>> print(query.get_ephemeris('J0534+2200')) NAME J0534+2200 JNAME J0534+2200 BNAME B0531+21 PSRJ J0534+2200 PSRB B0531+21 RAJ 05:34:31.973 0.005000000000000 DECJ +22:00:52.06 0.060000000000000 PMRA -14.699999999999999 0.800000000000000 PMDEC 2 0.800000000000000 POSEPOCH 40706 ELONG 84.097631599851169 ELAT -1.294467050350203 PMELONG -14.597441126565251 PMELAT 2.646641750683564 GL 184.557559483180171 GB -5.784269849609095 RAJD 83.633220833333311 DECJD 22.014461111111110 TYPE HE[cdt69,fhm+69,hjm+70] PML -9.558486649099681 PMB -11.345718707027030 DIST 2 DIST_DM 1.310000000000000 ... ``` -------------------------------- ### Installation using Conda Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Installs the psrqpy package in a Conda environment. ```bash conda install -c conda-forge psrqpy ``` -------------------------------- ### Limited Query Example Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Query for a specific parameter (F0) and its error. ```python >>> from psrqpy import QueryATNF >>> query = QueryATNF(params=['F0']) where the parameter names are case insensitive. This will also automatically include the database uncertainty on 'F0', stored as a variable called 'F0_ERR' (parameter uncertainties will always be stored using the uppercase version of the parameter name, with _ERR appended). Again, the table, now only containing 'F0' and 'F0_ERR', can be accessed with >>> table = query.table ``` -------------------------------- ### Setting conditions for queries Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Example of how to set logical conditions on parameters when querying the ATNF Pulsar Catalogue. ```python >>> from psrqpy import QueryATNF >>> query = QueryATNF(condition='F0 > 100 && F0 < 200') >>> print(query.num_pulsars) 82 ``` ```python >>> query = QueryATNF(condition='F0 > 100 && F0 < 200', assoc='GC') >>> print(len(query)) 33 ``` -------------------------------- ### Querying specific pulsars by name Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Example of how to retrieve specific parameters for a list of named pulsars. ```python >>> from psrqpy import QueryATNF >>> query = QueryATNF(params=['JNAME', 'RAJ', 'DECJ'], psrs=['J0534+2200', 'J0537-6910']) >>> print(query.table) RAJ_ERR RAJ DECJ DECJ_ERR JNAME ------- 0.005 05:34:31.973 +22:00:52.06 0.06 J0534+2200 0.11 05:37:47.416 -69:10:19.88 0.6 J0537-6910 ``` -------------------------------- ### Accessing the MSP table Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Example of using the `get_msp_catalogue()` function to retrieve the table of galactic millisecond pulsars. ```python >>> from psrqpy.utils import get_msp_catalogue >>> msps = get_msp_catalogue() ``` -------------------------------- ### Make a P-Pdot diagram Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Example of generating a period vs. period derivative (P-Pdot) diagram using the `ppdot()` function. ```python >>> from psrqpy import QueryATNF >>> query = QueryATNF() >>> query.ppdot(showSNRs=True, showtypes='all') ``` -------------------------------- ### Get Pulsar Count and Version Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Get the version of the ATNF catalogue and the number of pulsars it contains. ```python >>> numstring = 'Version {} of the ATNF catalogue contains {} pulsars' >>> print(numstring.format(query.get_version, query.num_pulsars)) ``` -------------------------------- ### Get Glitch Catalogue for Crab Pulsar Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/utils.md Example of using get_glitch_catalogue to retrieve and count glitches for the Crab pulsar. ```python >>> import psrqpy >>> gtable = psrqpy.get_glitch_catalogue(psr='J0534+2200') >>> print("There have been {} glitches observed from the Crab pulsar".format(len(gtable))) 27 ``` -------------------------------- ### Accessing the glitch table Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Example of using the `get_glitch_catalogue()` function to retrieve the Jodrell Bank pulsar glitch table. ```python >>> from psrqpy.utils import get_glitch_catalogue >>> glitches = get_glitch_catalogue() ``` ```python >>> crabglitches = get_glitch_catalogue(psr="J0534+2200") ``` -------------------------------- ### Example usage of the condition function Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/utils.md Demonstrates how to use the condition function to filter a table of pulsar data based on various criteria, including frequency, period derivative, and binary system status. It also shows how to use a boolean array for filtering. ```pycon >>> newtable = condition(psrtable, 'F0 > 100') ``` ```pycon >>> newtable = condition(psrtable, '(F0 > 50) & (P1 < 1e-15)') ``` ```pycon >>> newtable = condition(psrtable, 'TYPE(BINARY)') ``` ```pycon >>> newtable = condition(psrtable, psrtable['F0'] > 100) ``` -------------------------------- ### Accessing the globular cluster table Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Example of using the `get_gc_catalogue()` function to retrieve the table of pulsars in globular clusters. ```python >>> from psrqpy.utils import get_gc_catalogue >>> gctable = get_gc_catalogue() ``` ```python >>> tucpulsars = gctable.cluster_pulsars("47 Tuc") ``` -------------------------------- ### Return a reference for a pulsar parameter Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Example of using the ADS module to retrieve references for pulsar parameters, specifically the orbital period of J0737-3039A. ```python >>> from psrqpy import QueryATNF >>> query = QueryATNF(params='PB', psrs='J0737-3039A', include_refs=True, adsref=True) >>> print(query.parse_ref(query.table['PB_REF'])[0]) (" Kramer, M., Stairs, I. H., Manchester, R. N., McLaughlin, M. A., Lyne, A. G., Ferdman, R. D., Burgay, M., Lorimer, D. R., Possenti, A., D'Amico, N., Sarkissian, J. M., Hobbs, G. B., Reynolds, J. E., Freire, P. C. C. & Camilo, F., 2006. Tests of General Relativity from Timing the Double Pulsar. Science, 314, 97-102. ", 'https://ui.adsabs.harvard.edu/#abs/2006Sci...314...97K/') ``` -------------------------------- ### Update Reference Cache Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/utils.md Example of updating the reference cache for the ATNF catalogue. ```python >>> import psrqpy >>> psrqpy.QueryATNF(checkupdate=True) ``` -------------------------------- ### Accessing pulsar data via Pulsars class Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Shows how to get a dictionary of Pulsar objects from a query and access their attributes. ```python >>> psrs = query.get_pulsars() >>> for psr in psrs: ... print(psr) J0534+2200 J0537-6910 ``` ```python >>> print(psrs['J0534+2200'].keys()) # show attributes of the psr class ['DECJ', 'RAJ', 'DECJ_ERR', 'RAJ_ERR', 'JNAME'] ``` ```python >>> crab = psrs['J0534+2200'] >>> print(crab.F0) 29.946923 ``` -------------------------------- ### Query pulsars within a circular boundary Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Example of querying the ATNF Pulsar Catalogue for pulsars within a specified circular boundary defined by right ascension, declination, and radius. ```python >>> from psrqpy import QueryATNF >>> # set the boundary circle centre (RAJ then DECJ) and radius >>> c = ['12:34:56.7', '-02:54:12.3', 10.] >>> query = QueryATNF(params=['JNAME', 'RAJ', 'DECJ'], circular_boundary=c) >>> print(query.table) JNAME RAJ DECJ_ERR DECJ RAJ_ERR ---------- ------------- -------- -------------- ------- J1257-1027 12:57:04.7686 -- -10:27:05.7817 -- J1312+0051 13:12 -- +00:51 -- ``` ```python >>> c = ['12h34m56.7s', '-02d54m12.3s', 10.] ``` -------------------------------- ### Initialize QueryATNF Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Download the full database by initializing QueryATNF. ```python >>> from psrqpy import QueryATNF >>> query = QueryATNF() ``` -------------------------------- ### Saving and loading queries Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Demonstrates how to save a query object as a pickled file and then reload it later. ```python >>> query.save('atnfquery.pkl') ``` ```python >>> oldquery = QueryATNF(loadquery='atnfquery.pkl') ``` -------------------------------- ### Import psrqpy Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/images/PvsPdot.ipynb Imports the psrqpy library and sets up matplotlib for inline plotting. ```python %matplotlib inline import psrqpy ``` -------------------------------- ### Run tests Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Runs the test suite for PSRQpy from the base directory of the repository. ```bash pytest ``` -------------------------------- ### Query ATNF catalog Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/images/PvsPdot.ipynb Creates a QueryATNF object to access the ATNF pulsar catalog. ```python q = psrqpy.QueryATNF() ``` -------------------------------- ### Access as pandas DataFrame Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Access the database as a pandas.DataFrame. ```python >>> df = query.pandas ``` -------------------------------- ### Access as astropy Table Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Access the database as an astropy.table.Table. ```python >>> table = query.table ``` -------------------------------- ### Query with Updated Parameters Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Update query parameters and print the resulting table. ```python >>> query.query_params = ['F1', 'RAJ'] >>> print(query.table) ``` -------------------------------- ### Save plot Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/images/PvsPdot.ipynb Saves the generated plot to a PNG file named 'ppdot.png'. ```python fig.savefig('ppdot.png') ``` -------------------------------- ### Query multiple parameters Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Queries the catalogue for multiple parameters (F0, F1, RAJ, DecJ) and prints the F0 values. ```python import psrqpy q = psrqpy.QueryATNF(params=['F0', 'F1', 'RAJ', 'DecJ']) # get values as an astropy table t = q.table print(t['F0']) ``` -------------------------------- ### Simple query for frequencies Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Queries the catalogue for all pulsar frequencies (F0) and prints them. ```python import psrqpy q = psrqpy.QueryATNF(params='F0') # get frequencies as an astropy table t = q.table print(t['F0']) ``` -------------------------------- ### Generate P vs Pdot plot Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/images/PvsPdot.ipynb Generates a plot of pulsar period vs period derivative, including SNR and type information. ```python fig = q.ppdot(showSNRs=True, showtypes='all') ``` -------------------------------- ### Generate period vs. period derivative plot Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Generates a period vs. period derivative plot with signal-to-noise ratios and all pulsar types shown. ```python from psrqpy import QueryATNF query = QueryATNF() query.ppdot(showSNRs=True, showtypes='all') ``` -------------------------------- ### Query by Pulsar Name Source: https://github.com/mattpitkin/psrqpy/blob/main/docs/source/index.md Access a table row for a specific pulsar by its name. ```python >>> from psrqpy import QueryATNF >>> query = QueryATNF() >>> print(query["J0534+2200"]) ``` -------------------------------- ### Access the full catalogue DataFrame Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Accesses the entire catalogue stored as a pandas DataFrame within the QueryATNF object. ```python catalogue = q.catalogue ``` -------------------------------- ### JOSS Paper Citation Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md BibTeX entry for citing the psrqpy software in the Journal of Open Source Software. ```tex @article{psrqpy, author = {{Pitkin}, M.}, title = "{psrqpy: a python interface for querying the ATNF pulsar catalogue}", volume = 3, number = 22, pages = 538, month = feb, year = 2018, journal = "{Journal of Open Source Software}", doi = {10.21105/joss.00538}, url = {https://doi.org/10.21105/joss.00538} } ``` -------------------------------- ### Modify query conditions and parameters Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Modifies an existing QueryATNF object to query for frequency derivatives (F1) for pulsars with frequencies less than 10 Hz. ```python q.condition = 'F0 < 10' q.query_params = 'F1' fdot = q.table['F1'] ``` -------------------------------- ### Query with frequency condition and retrieve frequencies Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Queries for pulsars with frequencies greater than 10 Hz and retrieves the frequencies. ```python import psrqpy q = psrqpy.QueryATNF(params=['F0'], condition='F0 > 10') freqs = q.table['F0'] ``` -------------------------------- ### Query with conditions and association Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Queries for pulsars with frequencies between 100 and 200 Hz and associated with Globular Clusters (GC). ```python import psrqpy q = psrqpy.QueryATNF(params=['Jname', 'f0'], condition='f0 > 100 && f0 < 200', assoc='GC') ``` -------------------------------- ### Query specific pulsars Source: https://github.com/mattpitkin/psrqpy/blob/main/README.md Queries the catalogue for specific pulsars (J0534+2200, J0537-6910) and prints the resulting table. ```python import psrqpy q = psrqpy.QueryATNF(params=['F0', 'F1', 'RAJ', 'DecJ'], psrs=['J0534+2200', 'J0537-6910']) # get values as an astropy table t = q.table # print the table print(t) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.