Commit d0d3f945 authored by Brandon Piotrzkowski's avatar Brandon Piotrzkowski

Ensure external sky maps are normalized

parent 657c93b3
......@@ -50,6 +50,8 @@ Changelog
- Add platform and hostname information to the Flask dashboard.
- Ensure external sky maps are normalized.
0.12.3 (2020-03-24)
......@@ -285,7 +285,8 @@ def create_external_skymap(ra, dec, error, pipeline, notice_type=111):
weight * hp.sphtfunc.smoothing(skymap, sigma=np.radians(scale))
for weight, scale in zip(weights, scales))
return skymap
# Renormalize due to possible lack of precision
return skymap / skymap.sum()
def write_to_fits(skymap, event, notice_type, notice_date):
from importlib import resources
from unittest.mock import patch
import numpy as np
import pytest
from . import data
......@@ -150,7 +151,9 @@ def test_create_swift_skymap(ra, dec, error, pix):
def test_create_fermi_skymap():
"""Test created single pixel sky maps for Swift localization."""
ra, dec, error = 0, 90, 10
external_skymaps.create_external_skymap(ra, dec, error, 'Fermi')
assert (np.sum(external_skymaps.create_external_skymap(
ra, dec, error, 'Fermi')) ==
pytest.approx(1.0, 1.e-9))
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