Skip to content

Commit

Permalink
Add some more asserts for event lists tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cdeil committed Jan 25, 2015
1 parent 0bbad17 commit 3efda8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions gammapy/data/tests/test_event_list.py
@@ -1,6 +1,7 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from numpy.testing import assert_allclose
from ...data import EventList, EventListDataset, EventListDatasetChecker
from ...datasets import get_path

Expand All @@ -23,9 +24,9 @@ def test_EventList():
assert '{:1.5f}'.format(lat) == '-23.27178 deg'
assert '{:1.5f}'.format(height) == '1835.00000 m'

# event_list.observation_time_duration
# event_list.observation_live_time_duration
# event_list.observation_dead_time_fraction
assert '{:1.5f}'.format(event_list.observation_time_duration) == '1577.00000 s'
assert '{:1.5f}'.format(event_list.observation_live_time_duration) == '1510.95911 s'
assert_allclose(event_list.observation_dead_time_fraction, 0.03576320037245795)


def test_EventListDataset():
Expand Down
4 changes: 2 additions & 2 deletions gammapy/data/tests/test_telarray.py
@@ -1,7 +1,7 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from numpy.testing import assert_allclose
from astropy.units import Quantity
from ...datasets import get_path
from ...data import TelescopeArray
Expand All @@ -16,4 +16,4 @@ def test_TelescopeArray():
location = telescope_array.observatory_earth_location.geocentric
hess_location = observatory_locations.HESS.geocentric
offset = Quantity(location) - Quantity(hess_location)
assert np.linalg.norm(offset) < 1e-3 # meter
assert_allclose(offset, 0, atol=1e-3) # meter

0 comments on commit 3efda8e

Please sign in to comment.