Web API¶
Blast also provides an application programming interface, which you can use to fetch Blast data programmatically. The API allows queries on individual database tables (below), as well as an API endpoint for getting all data for a given transient (Downloading all Blast data for a given transient).
Downloading Blast data for individual tables via Python¶
The url endpoint to grab the data for a particular transient is
/api/transient/?name=transient_name&format=json
.
Here is an example Python snippet to load data as a Python dictionary for the transient
2010H
from urllib.request import urlopen
import json
response = urlopen('<base_blast_url>/api/transient/?name=2010H&format=json')
data = json.loads(response.read())
Here data is a Python dictionary that contains the Blast science payload data m model. We describe this model below.
Blast API data model¶
The data model for different tables within Blast are described below. Foreign key-linked fields are also displayed to simplify API calls; for example, the attributes of the associated Host are returned in addition to the Transient fields when a given transient is queried.
Transient fields¶
API link: /api/transient/
name
- name of the transient e.g., 2022abcra_deg
- transient Right Ascension in decimal degrees e.g., 132.34564dec_deg
- transient declination in decimal degrees e.g., 60.123424redshift
- transient redshift e.g., 0.01milkyway_dust_reddening
- transient E(B-V) e.g, 0.2processing_status
- Blast processing status of the transient.“processed” - transient has been complement processed by Blast and all data should be present in the science payload. “processing” - Blast is still processing this transient and some parts of the science payload may not be populated at the current time. “blocked” - this transient has not been successfully fully processed by Blast and some parts of the science payload will not be populated.
spectroscopic_class
- spectroscopic classification, if anyhost
- foreign key link to theHost
object, described below.
Transient filtering options¶
name=
- search on transient nameredshift_gte=
- filter on redshifts greater than or equal to the value providedredshift_lte=
- filter on redshifts less than or equal to the value providedhost_redshift_gte=
- filter on host redshifts greater than or equal to the value providedhost_redshift_lte=
- filter on host redshifts less than or equal to the value providedhost_photometric_redshift_gte=
- filter on host photometric redshifts greater than or equal to the value providedhost_photometric_redshift_lte=
- filter on host photometric redshifts less than or equal to the value provided
Example:
<blast_base_url>/api/transient/?redshift_gte=0.02
Host fields¶
API link: /api/host/
name
- name of the host e.g., NGC123ra_deg
- host Right Ascension in decimal degrees e.g., 132.34564dec_deg
- host declination in decimal degrees e.g., 60.123424redshift
- host redshift e.g., 0.01milkyway_dust_reddening
- host E(B-V) e.g, 0.2
Host filtering options¶
name=
- search on host nameredshift_gte=
- filter on redshifts greater than or equal to the value providedredshift_lte=
- filter on redshifts less than or equal to the value providedphotometric_redshift_gte=
- filter on photometric redshifts greater than or equal to the value providedphotometric_redshift_lte=
- filter on photometric redshifts less than or equal to the value provided
Example:
<blast_base_url>/api/host/?photometric_redshift_lte=0.02
Aperture fields¶
API link: /api/aperture/
ra_deg
- aperture Right Ascension in decimal degrees e.g., 132.3456dec_deg
- aperture declination in decimal degrees e.g., 60.123424orientation_deg
- orientation angle of the aperture in decimal degrees e.g., 30.123semi_major_axis_arcsec
- semi major axis of the aperture in arcsecondssemi_minor_axis_arcsec
- semi minor axis of the aperture in arcsecondscutout
- link to theCutout
object used to create aperture, described belowtype
- “local” or “global” aperture
Aperture filtering options¶
transient=
- select apertures associated with a given transient name
Example:
<blast_base_url>/api/aperture/?transient=2010H
AperturePhotometry fields¶
API link: /api/photometry/
flux
- Aperture photometry flux in mJyflux_error
- Aperture photometry flux error in mJymagnitude
- Aperture photometry magnitudemagnitude_error
- Aperture photometry magnitude erroraperture
- link toAperture
object, described abovefilter
- link to photometricFilter
objecttransient
- link toTransient
objectis_validated
- checks on contaminating objects in the aperture (global apertures only) or ability to resolve 2 kpc in physical scale (local apertures only)
Photometry filtering options¶
transient=
- select aperture photometry associated with a given transientfilter=
- select aperture photometry associated with a given photometric filter name
Example:
<blast_base_url>/api/aperturephotometry/?filter=H
SEDFittingResult fit fields¶
API link: /api/sedfittingresult/
<aperture_type> can either be “local” or “global”. <parameter> can be either,
“log_mass” (log base 10 of the surviving host stellar mass [solar masses])
“log_sfr” (log base 10 of the host star formation rate [solar masses / year])
“log_ssfr” (log base 10 of the host specific star formation rate [/ year])
“log_age” (log base 10 of the host stellar age [year])
<posterior_percentile> is the percentile value from the posterior distribution which can either be “16”, “50” ot “84”
mass_surviving_ratio
- ratio of the surviving stellar mass to the total formed stellar mass<aperture_type>_aperture_host_<parameter>_<posterior_percentile>
transient
- link toTransient
objectaperture
- link toAperture
objectchains_file
- MCMC chains for each parameter; files can be downloaded with the URL path<base_blast_url>/download_chains/<transient_name>/<aperture_type>
percentiles_file
- 16,50,84th percentiles for all parameters in the prospector-alpha model; files can be downloaded with the URL path<base_blast_url>/download_percentiles/<transient_name>/<aperture_type>
model_file
- best-fit spectrum, photometry, and uncertainties; files can be downloaded with the URL path<base_blast_url>/download_modelfit/<transient_name>/<aperture_type>
SED filtering options¶
transient=
- select SED fitting results associated with a given transientaperture_type=
- select “global” or “local” SED fitting results
Example:
<blast_base_url>/api/sedfittingresult/?transient=2010H
<blast_base_url>/api/sedfittingresult/?aperture_type=local
Cutout fields¶
API link: /api/cutout/
name
- the name of the cutout object
transient
- link to Transient
object
filter
- link to photometric Filter
object
Cutout filtering options¶
transient
- select cutout images associated with a given transientfilter
- select cutout images in a given photometric filter
Example:
<blast_base_url>/api/cutout/?transient=2010H
Task fields¶
API link: /api/task/
name
- name of each task
TaskRegister fields¶
API link: /api/taskregister/
task
- link toTask
objectstatus
- link toStatus
object, which contains messages like “processed” or “failed”transient
- link toTransient
objectuser_warning
- see if user has flagged a given stage as problematic (true/false)
TaskRegister filtering options¶
transient
- check the status of tasks for a given transientstatus
- search for all tasks with status “failed”, for exampletask
- look for all instances of a given task
Example:
<blast_base_url>/api/taskregister/?status=failed
Downloading all Blast data for a given transient¶
The url endpoint to grab the data for a particular transient is
/api/transient/get/<transient_name>
. Here is an example Python snippet to load data as a Python dictionary for the transient 2018gv.
from urllib.request import urlopen
import json
response = urlopen('<base_blast_url>/api/transient/get/2018gv?format=json')
data = json.loads(response.read())
Here data is a Python dictionary that contains the Blast science payload data model. We describe this model below; for clarity, field names are slightly different than in the base data model above.
Science payload data model¶
The data model for a single transient contains the following components. Foreign key-linked fields are also displayed to simplify API calls; for example, the attributes of the associated Host are returned in addition to the Transient fields.
Transient fields¶
transient_name
- name of the transient e.g., 2022abctransient_ra_deg
- transient Right Ascension in decimal degrees e.g., 132.34564transient_dec_deg
- transient declination in decimal degrees e.g., 60.123424transient_redshift
- transient redshift e.g., 0.01transient_milkyway_dust_reddening
- transient E(B-V) e.g, 0.2transient_processing_status
- Blast processing status of the transient.“processed” - transient has been complement processed by Blast and all data should be present in the science payload. “processing” - Blast is still processing this transient and some parts of the science payload may not be populated at the current time. “blocked” - this transient has not been successfully fully processed by Blast and some parts of the science payload will not be populated.
Host fields¶
host_name
- name of the host e.g., NGC123host_ra_deg
- host Right Ascension in decimal degrees e.g., 132.34564host_dec_deg
- host declination in decimal degrees e.g., 60.123424host_redshift
- transient redshift e.g., 0.01host_milkyway_dust_reddening
- host E(B-V) e.g, 0.2
Aperture fields¶
<aperture_type> can either be “local” or “global”.
<aperture_type>_aperture_ra_deg
- aperture Right Ascension in decimal degrees e.g., 132.3456<aperture_type>_aperture_dec_deg
- aperture declination in decimal degrees e.g., 60.123424<aperture_type>_orientation_deg
- orientation angle of the aperture in decimal degrees e.g., 30.123<aperture_type>_semi_major_axis_arcsec
- semi major axis of the aperture in arcseconds<aperture_type>_semi_minor_axis_arcsec
- semi minor axis of the aperture in arcseconds<aperture_type>_cutout
- name of the cutout used to create aperture e.g, 2MASS_H, None if not cutout was used
Photometry fields¶
<aperture_type> can either be “local” or “global”. <filter> can be any of the filters Blast downloads cutouts for e.g., 2MASS_H, 2MASS_J, SDSS_g … . If the data for a particular filter and transient does not exist the values will be None.
<aperture_type>_aperture_<filter>_flux
- Aperture photometry flux in mJy<aperture_type>_aperture_<filter>_flux_error
- Aperture photometry flux error in mJy<aperture_type>_aperture_<filter>_magnitude
- Aperture photometry magnitude<aperture_type>_aperture_<filter>_magnitude_error
- Aperture photometry magnitude error
SED fit fields¶
<aperture_type> can either be “local” or “global”. <parameter> can be either,
“log_mass” (log base 10 of the host stellar mass [solar masses])
“log_sfr” (log base 10 of the host star formation rate [solar masses / year])
“log_ssfr” (log base 10 of the host specific star formation rate [/ year])
“log_age” (log base 10 of the host stellar age [year])
“log_tau” (log base 10 of the host star formation rate decline exponent [year])
<posterior_percentile> is the percentile value from the posterior distribution which can either be “16”, “50” ot “84”
<aperture_type>_aperture_host_<parameter>_<posterior_percentile>