-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from OZGrav/new_models
Documentation upgrade
- Loading branch information
Showing
33 changed files
with
3,084 additions
and
1,999 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Pytest | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest | ||
pip install . | ||
- name: Test with pytest | ||
run: | | ||
pytest |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
Command Line Interface | ||
====================== | ||
|
||
|
||
|
||
|
||
Pulsar | ||
------ | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.pulsar | ||
:func: get_parsers | ||
:prog: psrdb pulsar | ||
:nodefault: | ||
|
||
Telescope | ||
--------- | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.telescope | ||
:func: get_parsers | ||
:prog: psrdb telescope | ||
:nodefault: | ||
|
||
MainProject | ||
----------- | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.main_project | ||
:func: get_parsers | ||
:prog: psrdb main_project | ||
:nodefault: | ||
|
||
Project | ||
------- | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.project | ||
:func: get_parsers | ||
:prog: psrdb project | ||
:nodefault: | ||
|
||
Ephemeris | ||
--------- | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.ephemeris | ||
:func: get_parsers | ||
:prog: psrdb ephemeris | ||
:nodefault: | ||
|
||
Template | ||
-------- | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.template | ||
:func: get_parsers | ||
:prog: psrdb template | ||
:nodefault: | ||
|
||
Calibration | ||
------------ | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.calibration | ||
:func: get_parsers | ||
:prog: psrdb calibration | ||
:nodefault: | ||
|
||
Observation | ||
----------- | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.observation | ||
:func: get_parsers | ||
:prog: psrdb observation | ||
:nodefault: | ||
|
||
PipelineRun | ||
----------- | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.pipeline_run | ||
:func: get_parsers | ||
:prog: psrdb pipeline_run | ||
:nodefault: | ||
|
||
PulsarFoldResult | ||
---------------- | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.pulsar_fold_result | ||
:func: get_parsers | ||
:prog: psrdb pulsar_fold_result | ||
:nodefault: | ||
|
||
PipelineImage | ||
------------- | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.pipeline_image | ||
:func: get_parsers | ||
:prog: psrdb pipeline_image | ||
:nodefault: | ||
|
||
ToA | ||
--- | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.toa | ||
:func: get_parsers | ||
:prog: psrdb toa | ||
:nodefault: | ||
|
||
Residual | ||
-------- | ||
|
||
.. argparse:: | ||
:module: psrdb.tables.residual | ||
:func: get_parsers | ||
:prog: psrdb residual | ||
:nodefault: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,85 @@ | ||
# How to use | ||
|
||
The command line interface can be used to list various tables in the database. | ||
The first arguments is the table name and the second is the action. | ||
The command line interface can be used to interact with the various database objects (also known as tables). | ||
The first arguments is the object name and the second is the action. | ||
For example if I wanted to list all observations of pulsar J1652-4838 I could use: | ||
|
||
``` | ||
psrdb observations list --pulsar J1652-4838 | ||
psrdb observation list --pulsar J1652-4838 | ||
``` | ||
|
||
If you're unsure which arguments you require you can use `-h` to list your options. | ||
If you're unsure which arguments you require you can use `-h` to list your options | ||
or look at the [Command Line Interface](cli) documentation page. | ||
|
||
Most database objects only have a `list` command but others (such as `toa` and `pulsar_fold_result`) also have a `download` command | ||
which will download data from the tables to a csv. | ||
|
||
|
||
## Pulsar Fold Result Download Example | ||
|
||
For example the `pulsar_fold_result` table contains the processing results such as the flux density, | ||
the dispersion measure, the rotation measure signal to noise of each observation. | ||
You can download the results for a given pulsar using: | ||
|
||
``` | ||
psrdb pulsar_fold_result download J1652-4838 | ||
``` | ||
|
||
Which will download the results to a csv file called `pulsar_fold_result_J1652-4838.csv` in the current directory that contains data that looks like: | ||
|
||
``` | ||
ID,UTC Start,Observing band,Duration (s),DM (pc cm^-3),DM error (pc cm^-3),DM epoch (MJD),DM chi2r,DM tres,SN,Flux (mJy),RM (rad m^-2),RM error (rad m^-2),RFI zapped (%) | ||
UHVsc2FyRm9sZFJlc3VsdE5vZGU6Mjkx,2023-06-16T17:12:10+00:00,LBAND,863.54886459813,188.17506533670348,0.0030674779606059722,59000.0,5.9886,5.9886,190.378768920898,1.151,-29.451,0.63,0.09469918224299065 | ||
UHVsc2FyRm9sZFJlc3VsdE5vZGU6NDI0,2021-01-19T06:13:30+00:00,LBAND,1135.5898640747655,188.16665101512618,0.0033251138173515647,59000.0,7.2091,7.2091,226.744201660156,1.131,-33.6916,0.15,0.10732491134751773 | ||
UHVsc2FyRm9sZFJlc3VsdE5vZGU6OTY0,2020-02-02T04:50:36+00:00,LBAND,1242.5246983177572,188.1714516981729,0.0030512582494712425,59000.0,5.6147,5.6147,224.331237792969,1.139,-42.526,0.34,0.06804886923421406 | ||
... | ||
``` | ||
|
||
[Pandas](https://pandas.pydata.org/docs/) is an excellent tool for filtering and analysising this data. | ||
For example, say you wanted to plot the flux density against the date for all bring observations in LBAND you could do the following: | ||
|
||
``` | ||
import pandas as pd | ||
import matplotlib.pyplot as plt | ||
# Read your data into a Pandas DataFrame | ||
df = pd.read_csv('pulsar_fold_result_J1652-4838.csv') | ||
# Filter the data to only include LBAND observations | ||
df = df[df['Observing band'] == 'LBAND'] | ||
# Filter the data to only include bright observations | ||
df = df[df['SN'] > 20] | ||
# Create a line plot | ||
x = pd.to_datetime(df['UTC Start']) | ||
y = df['Flux (mJy)'] | ||
plt.scatter(x, y) | ||
# Add labels and a title | ||
plt.xlabel('Date (UTC)') | ||
plt.ylabel('Flux (mJy)') | ||
plt.gcf().autofmt_xdate() | ||
plt.savefig('J1652-4838_flux.png') | ||
``` | ||
|
||
Which would make a plot like this: | ||
|
||
![J1652-4838_flux.png](figures/J1652-4838_flux.png) | ||
|
||
Which is not quite ready for publication but is a good starting point. | ||
|
||
|
||
## ToA Download Example | ||
|
||
The `toa` table contains the times of arrival for each observation. | ||
The ToAs can be generated a number of ways so to make sure you only download the ToAs you require, | ||
always use the `--nchan` option and either the `--minimum_nsubs` or `--maximum_nsubs` option. | ||
|
||
For example if I only wanted the minimum number of subbands (one) and a single frequency channel I could use: | ||
|
||
``` | ||
psrdb toa download J1652-4838 --nchan 1 --minimum_nsubs | ||
``` | ||
|
||
Which will download a `toa_J1652-4838_minimum_nsubs_nchan1.tim` file that is ready to be used by pulsar tools such as `tempo2`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.