Skip to content
Snippets Groups Projects
Commit 4f47c057 authored by Daniel Guderian's avatar Daniel Guderian
Browse files

added test for the padding incl files

parent 56c8557d
Branches 21-error-when-using-new-extractor
No related tags found
1 merge request!19Resolve "error when using new extractor"
20 v2
-1 v2
0.0 999999999999.9
UTM WGS84 33N 587600.0 4016800.0 -3450.0
2070
File added
......@@ -14,12 +14,15 @@ test_dir = os.path.dirname(os.path.realpath(__file__))
NEUTRINO_FILE = os.path.join(test_dir, "data", "mcv6_ORCA_test_rc.gsg_tauCClowE-CC_3-50GeV.km3sim.jterbr00008155.jorcarec.jsh.aanet.760.h5")
DET_FILE_NEUTRINO = os.path.join(test_dir, "data", "KM3NeT_00000049_20200707.detx")
NO_COMPLE_RECO_FILE = os.path.join(test_dir, "data", "arca_test_without_some_jmuon_recos.h5")
ARCA_DETX = os.path.join(test_dir, "data", "KM3NeT_-00000001_20171212.detx")
class TestStdRecoExtractor(TestCase):
""" Assert that the neutrino info is extracted correctly. File has 18 events. """
@classmethod
def setUpClass(cls):
#normal case, with complete recos
cls.proc = orcasong.core.FileGraph(
max_n_hits=3,
time_window=[0, 50],
......@@ -38,6 +41,20 @@ class TestStdRecoExtractor(TestCase):
cls.quantities_to_test = ["dir_z","dir_x","pos_x"]
cls.mc_quantities_to_test = ["dir_z","dir_x","vertex_pos_x"]
#case where a few recos from jmuon are missing
cls.proc = orcasong.core.FileGraph(
max_n_hits=3,
time_window=[0, 50],
hit_infos=["pos_z", "time", "channel_id"],
extractor=extractors.get_neutrino_mc_info_extr(NO_COMPLE_RECO_FILE),
det_file=ARCA_DETX,
add_t0=True,
keep_event_info=True,
)
cls.outfile_arca = os.path.join(cls.tmpdir.name, "binned_arca.h5")
cls.proc.run(infile=NO_COMPLE_RECO_FILE, outfile=cls.outfile_arca)
cls.f_arca = h5py.File(cls.outfile_arca, "r")
@classmethod
def tearDownClass(cls):
cls.f.close()
......@@ -81,4 +98,18 @@ class TestStdRecoExtractor(TestCase):
orig_mc_values = orig_mc_info[self.quantities_to_test[j]][0] #only take fist, the primary
assert np.allclose(orig_mc_values,y[self.mc_quantities_to_test[j]][0])
\ No newline at end of file
def test_incomplete_reco_padding(self):
#make sure the x and y even in this case have the same length
x = self.f_arca["x"]
y = self.f_arca["y"]
assert len(x) == len(y)
\ No newline at end of file
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