There will be maintenance performed on,,, and starting at 9am PDT on Tuesday 18th August 2020. There will be an extremely small period of downtime at the start of the maintenance window as various services are restarted. Please address any comments, questions, or concerns to

Add update_grbevent method

Add update_grbevent method to Used for
updating parameters of GRB events.
parent 2cf6f664
......@@ -1012,6 +1012,66 @@ class GraceDb(GsiRest):
files=[('eventFile', filename, filecontents)]
def update_grbevent(self, graceid, ra=None, dec=None, error_radius=None,
t90=None, redshift=None, designation=None):
"""Update a GRB event's parameters.
This method only works on GRB events; i.e., External or Test events
whose search is specified as 'GRB'.
Only LIGO/Virgo users with permission to update GRB events will be
able to utilize this method.
graceid (str): GraceDB ID of the existing event
ra (:obj:`float`, optional): right ascension (degrees)
dec (:obj:`float`, optional): declination (degrees)
error_radius (:obj:`float`, optional): uncertainty in position
as statistical ~1-sigma error radius from the reported right
ascension and declination (degrees)
t90 (:obj:`float`, optional): duration of the event in which 90%
of the gamma-ray burst fluence was accumulated (seconds)
redshift (:obj:`float`, optional): redshift
designation (:obj:`str`, optional): name of the event, typically
reported in GRByymmddx (where x is null, 'A', or 'B') or
GRByymmddfff format, where fff is the three-digit fraction
of the day
ligo.gracedb.exceptions.HTTPError: if the response has a status
code >= 400.
>>> g = GraceDb()
>>> r = g.update_grbevent('E274955', redshift=2.33, ra=135.91)
>>> r.status
""" # noqa: W605
# Make sure that at least one parameter is provided
if not (ra or dec or error_radius or t90 or redshift or designation):
raise ValueError('Provide at least one of ra, dec, error_radius, '
't90, redshift, or designation')
request_body = {}
if ra is not None:
request_body['ra'] = ra
if dec is not None:
request_body['dec'] = dec
if error_radius is not None:
request_body['error_radius'] = error_radius
if t90 is not None:
request_body['t90'] = t90
if redshift is not None:
request_body['redshift'] = redshift
if designation is not None:
request_body['designation'] = designation
template = self.templates['update-grbevent-template']
uri = template.format(graceid=graceid)
return self.patch(uri, body=request_body)
def event(self, graceid):
"""Get information about an individual event.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment