Using Curl with GraceDB [public]

How to fetch a Skymap using Python

Suppose you know the graceid of an event and you want to upload coordinates of an observation you have performed to follow it up. This program shows an example using the GraceDB Python client. (The results is the same does as in the corresponding example using curl: CurlUploadFootprints.)

# Upload observation footprints to GraceDB
# Include a line similar to this in your .netrc file:
#    machine login albert.einstein@LIGO.ORG password JKJKJKJkjkjkjkj1223
# You can get the password from 
# Also, first install the GraceDB REST client package:
#   pip install ligo-gracedb

from import GraceDbBasic, HTTPError

if __name__ == '__main__':

    # Define the parameters of the observation to be reported
    grace_id      = 'M158044'           # identifier for the event this report concerns
    group         = 'CRTS'              # the MOU group responsible 
    comment       = 'hello my friend'   # the human-made part of the report
    raList        = [123.0,124.0,125.0] # a list of RA of centers of footprints (degrees)
    decList       = [10.0,11.0,13.0]    # a list of Dec of centers of footprints (degrees)
    startTimeList = [                   # list of beginnings of exposures (UTC)
    raWidthList   = 10.0       # list (or one for all) of footprint widths in RA (degrees)
    decWidthList  = 10.0       # list (or one for all) of footprint widths in Dec (degrees)
    durationList  = 20.0       # list (or one for all) of exposure times in sec

    # Instantiate the GraceDB client
    client = GraceDbBasic()

    # Write the EMObservation record to GraceDB
    r = client.writeEMObservation(grace_id, group, raList, raWidthList,
        decList, decWidthList, startTimeList, durationList, comment)

    if r.status == 201:       # 201 means 'Created'
        print 'Success!'

-- BransonStephens - 11 Jun 2015
Topic revision: r4 - 2018-05-29, adminuser
Warning: Can't find topic LV_EM.WebLeftBarExample

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GW-Astronomy wiki? Send feedback