Commit f1a23df6 authored by Brandon Piotrzkowski's avatar Brandon Piotrzkowski
Browse files

Get p_astro and em_bright from superevent instead of preferred event

parent 29be9a54
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
- Change EM_Bright section to simply state the probability of HasNS - Change EM_Bright section to simply state the probability of HasNS
and HasRemnant instate of relative amount of evidence. and HasRemnant instate of relative amount of evidence.
- Get p_astro and em_bright files from the superevent instead of the
preferred event in order to accomodate PE-based results.
## 1.1.2 (2019-09-25) ## 1.1.2 (2019-09-25)
- Remove check that sky map has `public` and `sky_loc` tags in order to - Remove check that sky map has `public` and `sky_loc` tags in order to
......
...@@ -76,23 +76,31 @@ def main_dict(gracedb_id, client): ...@@ -76,23 +76,31 @@ def main_dict(gracedb_id, client):
filename=filename, filename=filename,
latency=issued_time-event_time.datetime) latency=issued_time-event_time.datetime)
skymaps = list(skymaps.values()) skymaps = list(skymaps.values())
preferred_event_files = client.files(preferred_event_id).json()
em_brightfile = 'em_bright.json' # Grab latest p_astro and em_bright files
if em_brightfile in preferred_event_files: superevent_files = client.files(gracedb_id).json()
em_brightfilename = 'em_bright'
p_astrofilename = 'p_astro'
em_brightfiles = []
p_astrofiles = []
for file in superevent_files:
if em_brightfilename in file:
em_brightfiles.append(file)
elif p_astrofilename in file:
p_astrofiles.append(file)
if em_brightfiles:
source_classification = client.files( source_classification = client.files(
preferred_event_id, em_brightfile).json() gracedb_id, em_brightfiles[-1]).json()
source_classification = { source_classification = {
key: 100 * value for key, value in source_classification.items()} key: 100 * value for key, value in source_classification.items()}
else: else:
source_classification = {} source_classification = {}
# adding the p_atro informations if available if p_astrofiles:
p_astro_file = 'p_astro.json' classifications = client.files(
if p_astro_file in preferred_event_files: gracedb_id, p_astrofiles[-1]).json()
classifications = client.files(preferred_event_id, p_astro_file).json()
# Convert to percent for consistency with em_bright
classifications = { classifications = {
key: 100 * value for key, value in classifications.items()} key: 100 * value for key, value in classifications.items()}
else: else:
......
...@@ -15,5 +15,7 @@ ...@@ -15,5 +15,7 @@
"S1234-1-Initial.xml": "https://gracedb-dev1.ligo.org/api/events/S1234/files/S1234-1-Initial.xml", "S1234-1-Initial.xml": "https://gracedb-dev1.ligo.org/api/events/S1234/files/S1234-1-Initial.xml",
"S1234-2-Update.xml": "https://gracedb-dev1.ligo.org/api/events/S1234/files/S1234-2-Update.xml", "S1234-2-Update.xml": "https://gracedb-dev1.ligo.org/api/events/S1234/files/S1234-2-Update.xml",
"coincidence_far.json": "https://gracedb-dev1.ligo.org/api/events/S1234/files/coincidence_far.json", "coincidence_far.json": "https://gracedb-dev1.ligo.org/api/events/S1234/files/coincidence_far.json",
"bayestar-gbm.fits.gz": "https://gracedb-dev1.ligo.org/api/events/S1234/files/bayestar-gbm.fits.gz" "bayestar-gbm.fits.gz": "https://gracedb-dev1.ligo.org/api/events/S1234/files/bayestar-gbm.fits.gz",
"p_astro.json": "https://gracedb-dev1.ligo.org/api/events/S1234/files/p_astro.json",
"em_bright.json": "https://gracedb-dev1.ligo.org/api/events/S1234/files/em_bright.json"
} }
...@@ -14,5 +14,9 @@ ...@@ -14,5 +14,9 @@
"S5678-1-Initial.xml": "https://gracedb-dev1.ligo.org/api/events/S5678/files/S5678-1-Initial.xml", "S5678-1-Initial.xml": "https://gracedb-dev1.ligo.org/api/events/S5678/files/S5678-1-Initial.xml",
"S5678-2-Update.xml": "https://gracedb-dev1.ligo.org/api/events/S5678/files/S5678-2-Update.xml", "S5678-2-Update.xml": "https://gracedb-dev1.ligo.org/api/events/S5678/files/S5678-2-Update.xml",
"coincidence_far.json": "https://gracedb-dev1.ligo.org/api/events/S5678/files/coincidence_far.json", "coincidence_far.json": "https://gracedb-dev1.ligo.org/api/events/S5678/files/coincidence_far.json",
"bayestar-gbm.fits.gz": "https://gracedb-dev1.ligo.org/api/events/S1234/files/bayestar-gbm.fits.gz" "bayestar-gbm.fits.gz": "https://gracedb-dev1.ligo.org/api/events/S1234/files/bayestar-gbm.fits.gz",
"p_astro.json": "https://gracedb-dev1.ligo.org/api/events/S5678/files/p_astro.json",
"em_bright.json": "https://gracedb-dev1.ligo.org/api/events/S5678/files/em_bright.json",
"p_astro.json,0": "https://gracedb-dev1.ligo.org/api/events/S5678/files/p_astro.json,0",
"em_bright.json,0": "https://gracedb-dev1.ligo.org/api/events/S5678/files/em_bright.json,0"
} }
{"HasNS": 1.0, "HasRemnant": 0.0}
\ No newline at end of file
{"BNS": 0.0, "NSBH": 0.6778160323909137, "BBH": 0.0, "MassGap": 0.0, "Terrestrial": 0.32218396760908624}
\ No newline at end of file
...@@ -42,7 +42,7 @@ console_scripts = ...@@ -42,7 +42,7 @@ console_scripts =
[options.package_data] [options.package_data]
ligo.followup_advocate.templates = *.jinja2 ligo.followup_advocate.templates = *.jinja2
ligo.followup_advocate.test = data/*/*.json, data/*/files/*.json, data/*/files/*.xml, data/*/files/*.fits, data/*/files/*.fits.gz, data/*/files/*.data, data/*/files/*.fits.gz* ligo.followup_advocate.test = data/*/*.json, data/*/files/*.json, data/*/files/*.xml, data/*/files/*.fits, data/*/files/*.fits.gz, data/*/files/*.data, data/*/files/*.fits.gz*, data/*/files/*.json*
[versioneer] [versioneer]
VCS = git VCS = git
......
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