llama.files.gracedb module

FileHandlers for uploading and downloading files from GraceDB plus utilities for interacting with GraceDB.

class llama.files.gracedb.GraceDBPollingFileHandler

Bases: llama.filehandler.FileHandler, llama.filehandler.mixins.OnlineVetoMixin

A data file that can be downloaded from GraceDB as soon as it is ready. SkymapInfo is necessarily a dependency for all subclasses (since we need to extract the GraceID from it). In most cases, this should be the only dependency.

DEPENDENCIES = (<class 'llama.files.skymap_info.SkymapInfo'>,)
abstract property remote_filename

The name of the required data in a format recognizable by the remote resource’s API. This is quite possibly dynamically generated, and so it must be considered separate from the file handler’s name for this file.

class llama.files.gracedb.GraceDBReceipt

Bases: llama.com.utils.UploadReceipt

A log file created when a file is uploaded to GraceDB.

CLASSNAME_FMT = 'RctGdb{}'
FILENAME_FMT = 'rct_gdb_{}.log'
classmethod decorator_dict(upload, log_message='Upload from LLAMA pipeline.')

See UploadReceipt.upload_this and UploadReceipt.decorator_dict.

Parameters
  • upload – The decorated FileHandler class that is being registered for upload.

  • log_message (function or str, optional) – Either a string whose format function will be called with the new GraceDBReceipt subclass as its self keyword argument or a function taking the new GraceDBReceipt as its only argument (will become the log_message property for the new GraceDBReceipt).

Returns

newclassdict – A dictionary that can be passed to type to specify the attributes of a new class.

Return type

dict

Raises

TypeError – If log_message is not a formattable string or callable object.

property gracedb_tags

Specify tags (which affect display and access permissions) for the uploaded GraceDB file. Can be overridden for files that don’t fit the default topics:

[u’lvem’, u’em_follow’, u’sky_loc’]

abstract property log_message

A message to accompany this file on the GraceDB log entry for this event. The last line of this log file is a JSON object describing the result of the upload operation.

classmethod set_class_attributes(subclass)

See UploadReceipt.set_class_attributes; this method additionally adds SkymapInfo to the DEPENDENCIES list for subclass (if it is not implicitly there by virtue of being the uploaded file).

property upload_dict

When uploading to GraceDB via the REST API, the GraceDB client produces a dict with useful information about the uploaded file. This method returns that dict. An example instance of this dict:

{u’N’: 46,

u’comment’: u’Testing json upload ONE MORE TIME!’, u’created’: u’2017-03-19T04:49:43.515566+00:00’, u’file’: (u’https://gracedb.ligo.org/api/events/M278200/

u’files/icecube_neutrino_list.json,4’),

u’file_version’: 4, u’filename’: u’icecube_neutrino_list.json’, u’issuer’: {u’display_name’: u’Stefan Countryman’,

u’username’: u’stefan.countryman@LIGO.ORG’},

u’self’: u’https://gracedb.ligo.org/api/events/M278200/log/46’, u’tag_names’: [u’em_follow’], u’tags’: u’https://gracedb.ligo.org/api/events/M278200/log/46/tag/’}

If the log file doesn’t exist or the upload dict cannot be read, this function returns None.

class llama.files.gracedb.LVCGraceDbEventData

Bases: llama.filehandler.JSONFile, llama.filehandler.mixins.OnlineVetoMixin

digraph "llama.files.gracedb.LVCGraceDbEventData" { charset="utf-8" splines=ortho bgcolor=none margin=0 rankdir=LR "llama.files.gracedb.LVCGraceDbEventData" [label=<{{<B>LVCGraceDbEventData</B>|<I>lvc_gracedb_event_data.json</I>|JSONFile<BR/>OnlineVetoMixin}}>, shape="record", style=filled, target=_top, URL="/llama.files.gracedb.html#llama.files.gracedb.LVCGraceDbEventData", fillcolor="#cccccc"]; "llama.files.skymap_info.SkymapInfo" [label=<{{<B>SkymapInfo</B>|<I>skymap_info.json</I>|EventTriggeredFileHandler<BR/>JSONFile}}>, shape="record", style=filled, target=_top, URL="/llama.files.skymap_info.html#llama.files.skymap_info.SkymapInfo", fillcolor="#cccccc"]; "llama.files.skymap_info.SkymapInfo" -> "llama.files.gracedb.LVCGraceDbEventData" [arrowtail="none", color="red", ]; }

Required input files for llama.files.gracedb.LVCGraceDbEventData (located on the far right of the graph). For a typical trigger, the leftmost files will be generated as triggers become available. They will be used as input for files to their right, eventually allowing llama.files.gracedb.LVCGraceDbEventData to be generated.

The event dictionary as returned by the GraceDb API. Includes richer information on the single-detector and multi-detector inspiral parameters than is provided in LVAlerts or GCN Notices. Convenience methods are provided for certain commonly-used reconstructed parameters, but full data can always be accessed by running read_json.

DEPENDENCIES = (<class 'llama.files.skymap_info.SkymapInfo'>,)
FILENAME = 'lvc_gracedb_event_data.json'
GW_DETECTORS = {'H1', 'L1', 'V1'}
MANIFEST_TYPES = (<class 'llama.files.gracedb.LVCGraceDbEventData'>,)
UR_DEPENDENCIES = (<class 'llama.files.skymap_info.SkymapInfo'>,)
UR_DEPENDENCY_TREE = frozenset({<class 'llama.files.skymap_info.SkymapInfo'>})
property chirp_mass

The chirp mass. Raises a KeyError if it is not defined.

property instruments

A sorted list of the interferometers that participated in creating this trigger, e.g. ['H1', 'L1']. Raises a ValueError if unexpected instruments are found. Raises a KeyError if it is not defined.

property offline

Whether this trigger was generated offline.

property snr

The coincident signal-to-noise ratio (SNR). Raises a KeyError if it is not defined.

property total_mass

The total binary mass. Raises a KeyError if it is not defined.

class llama.files.gracedb.PAstro

Bases: llama.files.gracedb.GraceDBPollingFileHandler, llama.filehandler.JSONFile

digraph "llama.files.gracedb.PAstro" { charset="utf-8" splines=ortho bgcolor=none margin=0 rankdir=LR "llama.files.gracedb.PAstro" [label=<{{<B>PAstro</B>|<I>p_astro.json</I>|GraceDBPollingFileHandler<BR/>JSONFile}}>, shape="record", style=filled, target=_top, URL="/llama.files.gracedb.html#llama.files.gracedb.PAstro", fillcolor="#cccccc"]; "llama.files.skymap_info.SkymapInfo" [label=<{{<B>SkymapInfo</B>|<I>skymap_info.json</I>|EventTriggeredFileHandler<BR/>JSONFile}}>, shape="record", style=filled, target=_top, URL="/llama.files.skymap_info.html#llama.files.skymap_info.SkymapInfo", fillcolor="#cccccc"]; "llama.files.skymap_info.SkymapInfo" -> "llama.files.gracedb.PAstro" [arrowtail="none", color="red", ]; }

Required input files for llama.files.gracedb.PAstro (located on the far right of the graph). For a typical trigger, the leftmost files will be generated as triggers become available. They will be used as input for files to their right, eventually allowing llama.files.gracedb.PAstro to be generated.

A classification of an event’s possible sources by probability.

FILENAME = 'p_astro.json'
MANIFEST_TYPES = (<class 'llama.files.gracedb.PAstro'>,)
UR_DEPENDENCIES = (<class 'llama.files.skymap_info.SkymapInfo'>,)
UR_DEPENDENCY_TREE = frozenset({<class 'llama.files.skymap_info.SkymapInfo'>})
property most_likely_population

Get the population that this event most likely belongs too by seeing whether it is more likely than not to contain NS matter. More precisely, compares p_bbh to p_bns + p_nsbh + p_mass_gap, returning 'bbh' if the former is larger and 'bns' if the latter is larger. p_terr is ignored in this calculation.

property p_bbh

The probability that this was a BBH (binary black hole) merger.

property p_bns

The probability that this was a BNS (binary neutron star) merger.

property p_mass_gap

The probability that at least one of the compact objects in the merger was in the ambiguous mass gap between definite BH and definite NS.

property p_nsbh

The probability that this was a NSBH (neutron star/black hole) merger.

property p_terr

The probability that this event was terrestrial noise.

property remote_filename

The name of the required data in a format recognizable by the remote resource’s API. This is quite possibly dynamically generated, and so it must be considered separate from the file handler’s name for this file.

class llama.files.gracedb.RctSlkLmaLVCGraceDbEventData

Bases: llama.files.slack.SlackReceiptLlama

digraph "llama.files.gracedb.RctSlkLmaLVCGraceDbEventData" { charset="utf-8" splines=ortho bgcolor=none margin=0 rankdir=LR "llama.files.gracedb.LVCGraceDbEventData" [label=<{{<B>LVCGraceDbEventData</B>|<I>lvc_gracedb_event_data.json</I>|JSONFile<BR/>OnlineVetoMixin}}>, shape="record", style=filled, target=_top, URL="/llama.files.gracedb.html#llama.files.gracedb.LVCGraceDbEventData", fillcolor="#cccccc"]; "llama.files.gracedb.RctSlkLmaLVCGraceDbEventData" [label=<{{<B>RctSlkLmaLVCGraceDbEventData</B>|<I>rct_slk_lma_lvc_gracedb_event_data.json.json</I>|SlackReceiptLlama}}>, shape="record", style=filled, target=_top, URL="/llama.files.gracedb.html#llama.files.gracedb.RctSlkLmaLVCGraceDbEventData", fillcolor="#cccccc"]; "llama.files.skymap_info.SkymapInfo" [label=<{{<B>SkymapInfo</B>|<I>skymap_info.json</I>|EventTriggeredFileHandler<BR/>JSONFile}}>, shape="record", style=filled, target=_top, URL="/llama.files.skymap_info.html#llama.files.skymap_info.SkymapInfo", fillcolor="#cccccc"]; "llama.files.gracedb.LVCGraceDbEventData" -> "llama.files.gracedb.RctSlkLmaLVCGraceDbEventData" [arrowtail="none", color="red", ]; "llama.files.skymap_info.SkymapInfo" -> "llama.files.gracedb.LVCGraceDbEventData" [arrowtail="none", color="red", ]; "llama.files.skymap_info.SkymapInfo" -> "llama.files.gracedb.RctSlkLmaLVCGraceDbEventData" [arrowtail="none", color="red", ]; }

Required input files for llama.files.gracedb.RctSlkLmaLVCGraceDbEventData (located on the far right of the graph). For a typical trigger, the leftmost files will be generated as triggers become available. They will be used as input for files to their right, eventually allowing llama.files.gracedb.RctSlkLmaLVCGraceDbEventData to be generated.

DEPENDENCIES = (<class 'llama.files.gracedb.LVCGraceDbEventData'>, <class 'llama.files.skymap_info.SkymapInfo'>)
FILENAME = 'rct_slk_lma_lvc_gracedb_event_data.json.json'
FILENAME_FMT = 'rct_slk_lma_{}.json'
MANIFEST_TYPES = (<class 'llama.files.gracedb.RctSlkLmaLVCGraceDbEventData'>,)
UPLOAD

alias of LVCGraceDbEventData

UR_DEPENDENCIES = (<class 'llama.files.skymap_info.SkymapInfo'>, <class 'llama.files.gracedb.LVCGraceDbEventData'>)
UR_DEPENDENCY_TREE = frozenset({<class 'llama.files.gracedb.LVCGraceDbEventData'>})
class_vetoes = ()