psrdb modules

Calibration

class psrdb.tables.calibration.Calibration(client)[source]

Class for interacting with the Calibration database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(schedule_block_id, type, location)[source]

Create a new Calibration database object.

Parameters:
schedule_block_idstr

The schedule block ID which this calibration is associated with.

typestr

The type of calibration (pre or post).

locationstr

The location of the calibration file on the filesystem (if a post type calibration).

Returns:
client_response:

A client response object.

delete(id)[source]

Delete a Calibration database object.

Parameters:
idint

The database ID

Returns:
client_response:

A client response object.

list(id=None, type=None)[source]

Return a list of Calibration information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None

typestr, optional

Filter by the observation type (pre or post), by default None

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

update(id, schedule_block_id, type, location)[source]

Update a Calibration database object.

Parameters:
idint

The database ID

schedule_block_idstr

The schedule block ID which this calibration is associated with.

typestr

The type of calibration (pre or post).

locationstr

The location of the calibration file on the filesystem (if a post type calibration).

Returns:
client_response:

A client response object.

Ephemeris

class psrdb.tables.ephemeris.Ephemeris(client)[source]

Class for interacting with the Ephemeris database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(pulsar, ephemeris, project_code=None, project_short=None, comment=None)[source]

Create a new Ephemeris database object.

Parameters:
pulsarstr

The pulsar name.

ephemerisstr

The ephemeris text as a single string (includes new line characters).

project_codestr, optional

The project code, by default None

project_shortstr, optional

The project short name (e.g PTA), by default None

commentstr, optional

A comment about the ephemeris, by default None

Returns:
client_response:

A client response object.

delete(id)[source]

Delete a Ephemeris database object.

Parameters:
idint

The database ID

Returns:
client_response:

A client response object.

list(id=None, pulsar_id=None, p0=None, dm=None, eph=None)[source]

Return a list of Ephemeris information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None.

pulsar_idint, optional

Filter by the pulsar ID, by default None.

p0float, optional

Filter by the pulsar period, by default None.

dmfloat, optional

Filter by the pulsar DM, by default None.

ephstr, optional

Filter by the ephemeris hash, by default None.

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

update(id, pulsar, created_at, created_by, ephemeris, p0, dm, rm, comment, valid_from, valid_to)[source]

Update a Ephemeris database object.

Parameters:
idint

The database ID

pulsarstr

The pulsar name.

ephemerisstr

The ephemeris text as a single string (includes new line characters).

project_codestr, optional

The project code, by default None

project_shortstr, optional

The project short name (e.g PTA), by default None

commentstr, optional

A comment about the ephemeris, by default None

Returns:
client_response:

A client response object.

MainProject

class psrdb.tables.main_project.MainProject(client)[source]

Class for interacting with the MainProject database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(telescope, name)[source]

Create a new MainProject database object.

Parameters:
telescopestr

The telescope name

namestr

The name of the MainProject

Returns:
client_response:

A client response object.

delete(id)[source]

Delete a MainProject database object.

Parameters:
idint

The database ID

Returns:
client_response:

A client response object.

list(id=None, telescope=None, name=None)[source]

Return a list of MainProject information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None

telescopestr, optional

Filter by the telescope name, by default None

namestr, optional

Filter by the name, by default None

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

update(id, telescope, name)[source]

Update a MainProject database object.

Parameters:
idint

The database ID

telescopestr

The telescope name

namestr

The name of the MainProject

Returns:
client_response:

A client response object.

Observation

class psrdb.tables.observation.Observation(client, logger=None)[source]

Class for interacting with the Observation database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(pulsarName, telescopeName, projectCode, calibrationId, ephemerisText, frequency, bandwidth, nchan, beam, nant, nantEff, npol, obsType, utcStart, raj, decj, duration, nbit, tsamp, foldNbin, foldNchan, foldTsubint, filterbankNbit, filterbankNpol, filterbankNchan, filterbankTsamp, filterbankDm)[source]

Create a new Observation database object.

Parameters:
pulsarNamestr

The pulsar name.

telescopeNamestr

The telescope name.

projectCodestr

The project code.

calibrationIdint

The ID of the Calibration database object.

ephemerisTextstr

The ephemeris text as a single string (includes new line characters).

frequencyfloat

The frequency of the observation in MHz.

bandwidthfloat

The bandwidth of the observation in MHz.

nchanint

The number of frequency channels.

beamint

The beam number.

nantint

The number of antennas used in the observation.

nantEffint

The effective number of antennas used in the observation.

npolint

The number of polarisations.

obsTypestr

The type of observation (fold, search or cal).

utcStartdatetime

The UTC start time of the observation as a datetime object.

rajstr

The right ascension of the observation in HH:MM:SS.SS format.

decjstr

The declination of the observation in DD:MM:SS.SS format.

durationfloat

The duration of the observation in seconds.

nbitint

The number of bits per sample.

tsampfloat

The sampling time in microseconds.

foldNbinint

The number of bins in the folded data (None for non fold observations).

foldNchanint

The number of frequency channels in the folded data (None for non fold observations).

foldTsubintint

The number of time samples in each sub-integration of the folded data (None for non fold observations).

filterbankNbitint

The number of bits per sample in the filterbank data (None for non search observations).

filterbankNpolint

The number of polarisations in the filterbank data (None for non search observations).

filterbankNchanint

The number of frequency channels in the filterbank data (None for non search observations).

filterbankTsampfloat

The sampling time in microseconds in the filterbank data (None for non search observations).

filterbankDmfloat

The dispersion measure in the filterbank data (None for non search observations).

Returns:
client_response:

A client response object.

delete(id)[source]

Delete a Observation database object.

Parameters:
idint

The database ID

Returns:
client_response:

A client response object.

list(id=None, pulsar_name=None, telescope_name=None, project_id=None, project_short=None, main_project='All', utcs=None, utce=None, obs_type='fold', unprocessed=None, incomplete=None)[source]

Return a list of Observation information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None

pulsar_namestr, optional

Filter by the pulsar name, by default None

telescope_namestr, optional

Filter by the telescope name, by default None

project_idint, optional

Filter by the project id, by default None

project_shortstr, optional

Filter by the project short name, by default None

utcsstr, optional

Filter by the utc start time greater than or equal to the timestamp in the format YYYY-MM-DDTHH:MM:SS+00:00, by default None

utcestr, optional

Filter by the utc start time less than or equal to the timestamp in the format YYYY-MM-DDTHH:MM:SS+00:00, by default None

obs_typestr, optional

Filter by the observation type (fold, search or cal), by default ‘fold’

unprocessedstr, optional

Filter to only returned unprocessed observations (no PulsarFoldResult)

incompletestr, optional

Filter to only return incomplete observations (most recent job run is not “Completed)

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

update(id, pulsarName, telescopeName, projectCode, calibrationId, ephemerisText, frequency, bandwidth, nchan, beam, nant, nantEff, npol, obsType, utcStart, raj, decj, duration, nbit, tsamp, foldNbin, foldNchan, foldTsubint, filterbankNbit, filterbankNpol, filterbankNchan, filterbankTsamp, filterbankDm)[source]

Update a Observation database object.

Parameters:
idint

The database ID

pulsarNamestr

The pulsar name.

telescopeNamestr

The telescope name.

projectCodestr

The project code.

calibrationIdint

The ID of the Calibration database object.

ephemerisTextstr

The ephemeris text as a single string (includes new line characters).

frequencyfloat

The frequency of the observation in MHz.

bandwidthfloat

The bandwidth of the observation in MHz.

nchanint

The number of frequency channels.

beamint

The beam number.

nantint

The number of antennas used in the observation.

nantEffint

The effective number of antennas used in the observation.

npolint

The number of polarisations.

obsTypestr

The type of observation (fold, search or cal).

utcStartdatetime

The UTC start time of the observation as a datetime object.

rajstr

The right ascension of the observation in HH:MM:SS.SS format.

decjstr

The declination of the observation in DD:MM:SS.SS format.

durationfloat

The duration of the observation in seconds.

nbitint

The number of bits per sample.

tsampfloat

The sampling time in microseconds.

foldNbinint

The number of bins in the folded data (None for non fold observations).

foldNchanint

The number of frequency channels in the folded data (None for non fold observations).

foldTsubintint

The number of time samples in each sub-integration of the folded data (None for non fold observations).

filterbankNbitint

The number of bits per sample in the filterbank data (None for non search observations).

filterbankNpolint

The number of polarisations in the filterbank data (None for non search observations).

filterbankNchanint

The number of frequency channels in the filterbank data (None for non search observations).

filterbankTsampfloat

The sampling time in microseconds in the filterbank data (None for non search observations).

filterbankDmfloat

The dispersion measure in the filterbank data (None for non search observations).

Returns:
client_response:

A client response object.

PipelineImage

class psrdb.tables.pipeline_image.PipelineImage(client)[source]

Class for interacting with the PipelineImage database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(pipeline_run_id, image_path, image_type, resolution, cleaned)[source]

Create a new PipelineImage database object.

Parameters:
pipeline_run_idint

The ID of the PipelineRun database object this image is associated with.

image_pathstr

The path to the image file.

image_typestr

The type of image (profile, profile-pol, phase-time, phase-freq, bandpass, snr-cumul, snr-single).

resolutionstr

The resolution of the image (high or low).

cleanedbool

Whether the image is from cleaned data (RFI removed).

Returns:
client_response:

A client response object.

list(id=None, pipeline_run_id=None)[source]

Return a list of PipelineImage information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None

pipeline_run_idint, optional

Filter by the pipeline run ID, by default None

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

PipelineRun

class psrdb.tables.pipeline_run.PipelineRun(client)[source]

Class for interacting with the PipelineRun database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(observationId, ephemerisId, templateId, pipelineName, pipelineDescription, pipelineVersion, jobState, location, configuration, results_dict=None)[source]

Create a new PipelineRun database object.

Parameters:
observationIdint

The ID of the Observation database object of this PipelineRun.

ephemerisIdint

The ID of the Ephemeris database object of this PipelineRun.

templateIdint

The ID of the Template database object of this PipelineRun.

pipelineNamestr

The name of the pipeline used for this PipelineRun.

pipelineDescriptionstr

The description of the pipeline used for this PipelineRun.

pipelineVersionstr

The version of the pipeline used for this PipelineRun.

jobStatestr

The state of the job from (“Pending”, “Running”, “Completed”, “Failed”, “Cancelled”).

locationstr

The location of the job outputs.

configurationdict

The input parameters of the pipeline used for this PipelineRun.

results_dictdict, optional

The results of the pipeline which is only uploaded when the run is completed, by default None

Returns:
client_response:

A client response object.

delete(id)[source]

Delete a PipelineRun database object.

Parameters:
idint

The database ID

Returns:
client_response:

A client response object.

list(id=None, observation_id=None, ephemeris_id=None, template_id=None, pipelineName=None, pipelineDescription=None, pipelineVersion=None, jobState=None, location=None, dm=None, dmErr=None, dmEpoch=None, dmChi2r=None, dmTres=None, sn=None, flux=None, rm=None, percentRfiZapped=None)[source]

Return a list of PipelineRun information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None

observation_idint, optional

Filter by the Observation database ID, by default None

ephemeris_idint, optional

Filter by the Ephemeris database ID, by default None

template_idint, optional

Filter by the Template database ID, by default None

pipelineNamestr, optional

Filter by the pipeline name, by default None

pipelineDescriptionstr, optional

Filter by the pipeline description, by default None

pipelineVersionstr, optional

Filter by the pipeline version, by default None

jobStatestr, optional

Filter by the job state, by default None

locationstr, optional

Filter by the location, by default None

dmfloat, optional

Filter by the dm, by default None

dmErrfloat, optional

Filter by the dmErr, by default None

dmEpochfloat, optional

Filter by the dmEpoch, by default None

dmChi2rfloat, optional

Filter by the dmChi2r, by default None

dmTresfloat, optional

Filter by the dmTres, by default None

snfloat, optional

Filter by the sn, by default None

fluxfloat, optional

Filter by the flux, by default None

rmfloat, optional

Filter by the rm, by default None

percentRfiZappedfloat, optional

Filter by the percentRfiZapped, by default None

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

update(id, jobState, results_dict=None)[source]

Update a PipelineRun database object.

Parameters:
idint

The database ID

jobStatestr

The state of the job from (“Pending”, “Running”, “Completed”, “Failed”, “Cancelled”).

results_dictdict, optional

The results of the pipeline which is only uploaded when the run is completed, by default None

Returns:
client_response:

A client response object.

Project

class psrdb.tables.project.Project(client)[source]

Class for interacting with the Project database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(main_project, code, short, embargo_period, description)[source]

Create a new Project database object.

Parameters:
main_projectstr

The name of the MainProject this project is under.

codestr

The code of the project.

shortstr

The short name of the project (e.g. PTA).

embargo_periodint

The embargo period in days.

descriptionstr

A description of the project.

Returns:
client_response:

A client response object.

delete(id)[source]

Delete a Project database object.

Parameters:
idint

The database ID

Returns:
client_response:

A client response object.

list(id=None, mainProject=None, code=None)[source]

Return a list of Project information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None

mainProjectstr, optional

Filter by the mainProject name, by default None

codestr, optional

Filter by the code, by default None

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

update(id, main_project, code, short, embargo_period, description)[source]

Update a Project database object.

Parameters:
idint

The database ID

main_projectstr

The name of the MainProject this project is under.

codestr

The code of the project.

shortstr

The short name of the project (e.g. PTA).

embargo_periodint

The embargo period in days.

descriptionstr

A description of the project.

Returns:
client_response:

A client response object.

PulsarFoldResult

class psrdb.tables.pulsar_fold_result.PulsarFoldResult(client)[source]

Class for interacting with the PulsarFoldResult database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

list(pulsar=None, mainProject=None, utcStart=None, beam=None, utcs=None, utce=None)[source]

Return a list of PulsarFoldResult information based on the self.field_names and filtered by the parameters.

Parameters:
pulsarstr, optional

Filter by the pulsar name, by default None

mainProjectstr, optional

Filter by the main project name, by default None

utcStartstr, optional

Filter by the utcStart, by default None

beamint, optional

Filter by the beam number, by default None

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

Pulsar

class psrdb.tables.pulsar.Pulsar(client)[source]

Class for interacting with the Pulsar database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(name, comment=None)[source]

Create a new Pulsar database object.

Parameters:
namestr

The name of the pulsar.

commentstr, optional

A description of the pulsar (normally produced by the pulsar_paragraph package), by default None

Returns:
client_response:

A client response object.

delete(id)[source]

Delete a Pulsar database object.

Parameters:
idint

The database ID

Returns:
client_response:

A client response object.

list(id=None, name=None)[source]

Return a list of Pulsar information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None

namestr, optional

Filter by the name, by default None

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

update(id, name, comment)[source]

Update a Pulsar database object.

Parameters:
idint

The database ID

namestr

The name of the pulsar.

commentstr, optional

A description of the pulsar (normally produced by the pulsar_paragraph package), by default None

Returns:
client_response:

A client response object.

Residual

class psrdb.tables.residual.Residual(client)[source]

Class for interacting with the Residual database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(residual_lines)[source]

Create a new Residual database object.

Parameters:
residual_lineslist of str

A list of strings containing the residual lines.

Returns:
client_response:

A client response object.

list(pulsar, project_short)[source]

Return a list of Residual information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None

pulsarstr, optional

Filter by the pulsar name, by default None

project_shortstr, optional

Filter by the project short code, by default None

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

Telescope

class psrdb.tables.telescope.Telescope(client)[source]

Class for interacting with the Telescope database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(name)[source]

Create a new Telescope database object.

Parameters:
namestr

The name of the Telescope.

Returns:
client_response:

A client response object.

list(id=None, name=None)[source]

Return a list of Telescope information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None

namestr, optional

Filter by the name, by default None

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

Template

class psrdb.tables.template.Template(client)[source]

Class for interacting with the Template database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(pulsar_name, band, template_path, project_code=None, project_short=None)[source]

Create a new Template database object.

Parameters:
pulsar_namestr

The name of the pulsar.

bandstr

The band of the template (e.g. SBAND).

template_pathstr

The path to the template file.

project_codestr, optional

The code of the project, by default None

project_shortstr, optional

The short name of the project (e.g. PTA), by default None

Returns:
client_response:

A client response object.

list(id=None, pulsar_name=None, band=None, project_short=None)[source]

Return a list of Template information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None

pulsar_namestr, optional

Filter by the pulsar name, by default None

bandstr, optional

Filter by the band, by default None

project_shortstr, optional

Filter by the project short name, by default None

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

Toa

class psrdb.tables.toa.Toa(client)[source]

Class for interacting with the Toa database object.

Parameters:
clientGraphQLClient

GraphQLClient class instance with the URL and Token already set.

create(pipeline_run_id, project_short, ephemeris, template_id, toa_lines, dmCorrected=False, nsub_type=None, npol=1, nchan=1)[source]

Create a new Toa database object.

Parameters:
pipeline_run_idint

The ID of the PipelineRun database object for this Toa.

project_shortstr

The project short name (e.g PTA).

ephemerisstr

The path to the ephemeris file used to create the residuals.

template_idint

The ID of the Template database object for this Toa.

toa_lineslist

A list containing the toa lines.

dmCorrectedbool

If the toa was DM corrected.

minimumNsubsbool

If the toa was generated with the minimum number of time subbands.

maximumNsubsbool

If the toa was generated with the maximum number of time subbands.

npolint

The number of Stokes polarisations.

nchanint

The number of frequency channels.

Returns:
client_response:

A client response object.

delete(id)[source]

Delete a Toa database object.

Parameters:
idint

The database ID

Returns:
client_response:

A client response object.

download(pulsar, id=None, pipeline_run_id=None, project_short=None, dm_corrected=None, nsub_type=None, obs_nchan=None, npol=None, exclude_badges=None, utcs=None, utce=None)[source]

Download a file containing ToAs based on the filters.

Parameters:
pulsarstr

Filter by the pulsar name

idint, optional

Filter by the database ID, by default None

pipeline_run_idint, optional

Filter by the pipeline run id, by default None

project_shortstr

The project short name (e.g PTA).

dm_correctedbool, optional

Filter by if the toa was DM corrected, by default None

nsub_typestr
The method used to calculate the number of subintegrations. The choices are:

“1”: a single nsub, “max” the maximum number of subints possible for the observation based on the S/N ratio, “mode” the length of each subintegration is equal to the most common observation duration, “all”: all available nsubs (no time scrunching).

obs_nchanint, optional

Filter by the number of channels, by default None

npolint

The number of Stokes polarisations.

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.

list(id=None, pulsar=None, pipeline_run_id=None, project_short=None, dm_corrected=None, minimum_nsubs=None, maximum_nsubs=None, obs_nchan=None)[source]

Return a list of Toa information based on the self.field_names and filtered by the parameters.

Parameters:
idint, optional

Filter by the database ID, by default None

pulsarstr, optional

Filter by the pulsar name, by default None

pipeline_run_idint, optional

Filter by the pipeline run id, by default None

project_shortstr

The project short name (e.g PTA).

dm_correctedbool, optional

Filter by if the toa was DM corrected, by default None

minimum_nsubsbool, optional

Filter by if the toa was generated with the minimum number of time subbands, by default None

maximum_nsubsbool, optional

Filter by if the toa was generated with the maximum number of time subbands, by default None

obs_nchanint, optional

Filter by the number of channels, by default None

Returns:
list of dicts

If self.get_dicts is True, a list of dictionaries containing the results.

client_response:

Else a client response object.