Skip to content
Snippets Groups Projects
Commit a66aae03 authored by Brandon Piotrzkowski's avatar Brandon Piotrzkowski
Browse files

Plot external sky maps with same method as GWs; fixes #897

parent 8ac14a6a
No related branches found
No related tags found
No related merge requests found
......@@ -60,6 +60,9 @@ Changelog
- Fixed the broken link at the combined sky map png which was pointing to a
wrong URL.
- Plot external sky maps with contour lines and annotate with contained
areas; remove central RA/dec position.
2.5.2 "Cactus cat" (2024-11-18)
-------------------------------
......
......@@ -450,8 +450,6 @@ def read_upload_skymap_from_base64(event, skymap_str):
"""
graceid = event['graceid']
ra = event['extra_attributes']['GRB']['ra']
dec = event['extra_attributes']['GRB']['dec']
# Decode base64 encoded string to bytes string
skymap_data = b64decode(skymap_str)
......@@ -476,7 +474,7 @@ def read_upload_skymap_from_base64(event, skymap_str):
event['pipeline']),
['sky_loc']),
skymaps.plot_allsky.si(skymap_data, ra=ra, dec=dec)
skymaps.plot_allsky.si(skymap_data)
|
gracedb.upload.s(event['pipeline'].lower() + '_skymap.png',
graceid,
......@@ -776,7 +774,7 @@ def create_upload_external_skymap(event, notice_type, notice_date):
extra_sentence),
['sky_loc'])
|
skymaps.plot_allsky.si(skymap_data, ra=ra, dec=dec)
skymaps.plot_allsky.si(skymap_data)
|
gracedb.upload.s(event['pipeline'].lower() + '_skymap.png',
graceid,
......
......@@ -115,7 +115,7 @@ def fits_header(filecontents, filename):
@app.task(shared=False)
@closing_figures()
def plot_allsky(filecontents, ra=None, dec=None):
def plot_allsky(filecontents):
"""Plot a Mollweide projection of a sky map using the command-line tool
:doc:`ligo-skymap-plot <ligo.skymap:tool/ligo_skymap_plot>`.
"""
......@@ -125,12 +125,8 @@ def plot_allsky(filecontents, ra=None, dec=None):
with NamedTemporaryFile(mode='rb', suffix='.png') as pngfile, \
NamedTemporaryFile(content=filecontents) as fitsfile, \
handling_system_exit():
if ra is not None and dec is not None:
ligo_skymap_plot.main([fitsfile.name, '-o', pngfile.name,
'--annotate', '--radec', str(ra), str(dec)])
else:
ligo_skymap_plot.main([fitsfile.name, '-o', pngfile.name,
'--annotate', '--contour', '50', '90'])
ligo_skymap_plot.main([fitsfile.name, '-o', pngfile.name,
'--annotate', '--contour', '50', '90'])
return pngfile.read()
......
......@@ -89,18 +89,6 @@ def test_plot_allsky(mock_plot):
assert cmdline[2].endswith('.png')
@patch('ligo.skymap.tool.ligo_skymap_plot.main')
def test_plot_allsky_swift(mock_plot):
# Run function under test
skymaps.plot_allsky('', ra=0, dec=0)
# Check that the script would have been run once
# with the correct arguments
mock_plot.assert_called_once()
cmdline, = mock_plot.call_args[0]
assert cmdline[2].endswith('.png')
def test_is_3d_fits_file(toy_fits_filecontents, toy_3d_fits_filecontents):
# This is not a 3D FITS file.
assert not skymaps.is_3d_fits_file(toy_fits_filecontents)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment