From c04554673f30c34adcba7504dcfc19dc36359a35 Mon Sep 17 00:00:00 2001 From: Luigi Pertoldi Date: Thu, 16 Jan 2025 16:33:00 +0100 Subject: [PATCH] bug fixes --- src/daq2lh5/build_raw.py | 3 +-- tests/test_raw_buffer.py | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/daq2lh5/build_raw.py b/src/daq2lh5/build_raw.py index 7a084e2..4e789aa 100644 --- a/src/daq2lh5/build_raw.py +++ b/src/daq2lh5/build_raw.py @@ -126,8 +126,7 @@ def build_raw( if isinstance(out_spec, str) and any( [out_spec.endswith(ext) for ext in allowed_exts] ): - with open(out_spec) as f: - out_spec = utils.load_dict(f) + out_spec = utils.load_dict(out_spec) if isinstance(out_spec, dict): out_spec = RawBufferLibrary(config=out_spec, kw_dict=kwargs) if isinstance(out_spec, RawBufferLibrary): diff --git a/tests/test_raw_buffer.py b/tests/test_raw_buffer.py index 1c984ca..13f290a 100644 --- a/tests/test_raw_buffer.py +++ b/tests/test_raw_buffer.py @@ -5,7 +5,7 @@ def test_raw_buffer_list(): rbl = prb.RawBufferList() - rbl.set_from_json_dict( + rbl.set_from_dict( { "g{key:0>3d}": { "key_list": [[3, 6]], @@ -20,7 +20,7 @@ def test_raw_buffer_list(): assert rbl.get_list_of("key_list") == [[3], [4], [5], [6]] rbl.clear() - rbl.set_from_json_dict( + rbl.set_from_dict( { "spms": { "key_list": [[3, 6]], @@ -64,7 +64,7 @@ def test_raw_buffer_lib_json_load(): } """ json_dict = json.loads(rb_json) - rblib = prb.RawBufferLibrary(json_dict=json_dict, kw_dict={"file_key": "run0"}) + rblib = prb.RawBufferLibrary(config=json_dict, kw_dict={"file_key": "run0"}) rb_keyed = rblib["FCEventDecoder"].get_keyed_dict() name = rb_keyed[41].out_name assert name == "g041"