Skip to content

Commit 3757394

Browse files
committed
Add test
1 parent 2bd6c87 commit 3757394

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed
536 KB
Binary file not shown.

tests/test_io.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import tables.filters
21
import pandas as pd
32
import tempfile
43
import numpy as np
54
import h5py
65
import pytest
7-
from pandas.util.testing import assert_frame_equal
6+
87

98

109
def test_to_h5py():
@@ -335,3 +334,16 @@ def test_compression():
335334
assert all(df.dtypes == df2.dtypes)
336335
assert all(df['x'] == df2['x'])
337336
assert all(df['N'] == df2['N'])
337+
338+
339+
def test_read_simulated_spectrum():
340+
from fact.io import read_simulated_spectrum
341+
import astropy.units as u
342+
343+
s = read_simulated_spectrum('tests/resources/proton_header_test.hdf5')
344+
345+
assert s['n_showers'] == 20000
346+
assert s['n_reuse'] == 20
347+
assert s['energy_min'] == 100 * u.GeV
348+
assert s['energy_max'] == 200 * u.TeV
349+
assert s['energy_spectrum_slope'] == -2.0

0 commit comments

Comments
 (0)