Commit 5deb90b8 authored by Tri V Nguyen's avatar Tri V Nguyen Committed by Tri Nguyen

update to take multiorder.fits

parent 3fdd1d6a
Pipeline #67577 passed with stages
in 4 minutes and 14 seconds
......@@ -6,6 +6,8 @@
## 1.0.2 (2019-06-06)
- Changed to use multiorder.fits sky map first when calculating uncertainty ellipses.
- Removed far threshold criteria for pipelines to be included in circular.
## 1.0.1 (2019-05-30)
......
......@@ -10,6 +10,7 @@ import astropy.units as u
import healpy as hp
import lxml.etree
import numpy as np
from astropy.io.fits import getheader
from ligo.gracedb import rest
from ligo.skymap.io.fits import read_sky_map
from ligo.skymap.postprocess.ellipse import find_ellipse
......@@ -385,14 +386,10 @@ def read_map_gracedb(graceid, filename, client):
def get_distances_skymap_gracedb(graceid, filename, client):
with tempfile.NamedTemporaryFile(mode='w+b') as localfile:
base_filename, extension = os.path.splitext(filename)
try:
remotefile = client.files(graceid, filename, raw=True)
except (IOError, rest.HTTPError):
remotefile = client.files(graceid, base_filename, raw=True)
remotefile = client.files(graceid, filename, raw=True)
shutil.copyfileobj(remotefile, localfile)
localfile.flush()
data, header = read_sky_map(localfile.name, moc=False)
header = getheader(localfile.name, 1)
try:
return header['distmean'], header['diststd']
except KeyError:
......@@ -435,11 +432,11 @@ def compare_skymaps(paths, service=rest.DEFAULT_SERVICE_URL, client=None):
def uncertainty_ellipse(graceid, filename, client, cl=90):
"""Compute uncertainty ellipses for a given sky map"""
base_filename, extension = os.path.splitext(filename)
if extension == '.gz':
if filename.endswith('.gz'):
# Try using the multi-res sky map if it exists
try:
skymap = read_map_gracedb(graceid, base_filename, client)
new_filename = filename.replace('.fits.gz', '.multiorder.fits')
skymap = read_map_gracedb(graceid, new_filename, client)
except (IOError, rest.HTTPError):
skymap = read_map_gracedb(graceid, filename, client)
else:
......
......@@ -8,8 +8,8 @@
"bayestar.fits.gz,0": "https://gracedb-dev1.ligo.org/api/events/S1234/files/bayestar.fits.gz,0",
"psd.xml.gz": "https://gracedb-dev1.ligo.org/api/events/S1234/files/psd.xml.gz",
"coinc.xml,0": "https://gracedb-dev1.ligo.org/api/events/S1234/files/coinc.xml,0",
"bayestar.fits": "https://gracedb-dev1.ligo.org/api/events/S1234/files/bayestar.fits",
"bayestar.fits,0": "https://gracedb-dev1.ligo.org/api/events/S1234/files/bayestar.fits,0",
"bayestar.multiorder.fits": "https://gracedb-dev1.ligo.org/api/events/S1234/files/bayestar.multiorder.fits",
"bayestar.multiorder.fits,0": "https://gracedb-dev1.ligo.org/api/events/S1234/files/bayestar.multiorder.fits,0",
"bayestar.fits.gz": "https://gracedb-dev1.ligo.org/api/events/S1234/files/bayestar.fits.gz",
"bayestar.fits.gz,0": "https://gracedb-dev1.ligo.org/api/events/S1234/files/bayestar.fits.gz,0",
"S1234-1-Initial.xml": "https://gracedb-dev1.ligo.org/api/events/S1234/files/S1234-1-Initial.xml",
......
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