Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packs/proc/processing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def process_event_lazy_WD1(file_object : BinaryIO):

def process_bin_WD1(file_path : str,
save_path : str,
sample_size : int,
sample_size : float,
overwrite : Optional[bool] = False,
print_mod : Optional[int] = -1):

Expand All @@ -467,7 +467,7 @@ def process_bin_WD1(file_path : str,
----------
file_path (str) : Path to binary file
save_path (str) : Path to saved file
sample_size (int) : Size of each sample in an event (default 2 ns in the case of V1730B digitiser)
sample_size (float) : Size of each sample in an event (default 2 ns in the case of V1730B digitiser)
overwrite (bool) : Boolean for overwriting pre-existing files
print_mod (int) : Readout frequency for number of events, -1 implies no readout
Returns
Expand All @@ -478,6 +478,7 @@ def process_bin_WD1(file_path : str,

# lets build it here first and break it up later
# destroy the group within the file if you're overwriting
save_path = os.path.abspath(save_path)
save_path = check_save_path(save_path, overwrite)
print(save_path)

Expand Down
Binary file modified packs/tests/data/one_channel_LECROYWS4054HD.h5
Binary file not shown.
Binary file modified packs/tests/data/one_channel_WD1.h5
Binary file not shown.
Binary file modified packs/tests/data/one_channel_WD2.h5
Binary file not shown.
Binary file modified packs/tests/data/three_channels_WD2.h5
Binary file not shown.
15 changes: 13 additions & 2 deletions packs/tests/processing_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,19 @@ def test_WD1_Lecroy_decode_produces_expected_output(config, inpt, output, compar
run_pack = [sys.executable, MULE_dir + "/bin/mule", "proc", temp_config]
subprocess.run(run_pack)

# the event info can be read out like a normal h5, the RWF cannot due to how they're structured
assert pd.read_hdf(save_path, 'RAW/event_info').equals(pd.read_hdf(comparison_path, 'RAW/event_info'))
# load event info from both files for comparison
saved_event_info = pd.read_hdf(save_path, 'RAW/event_info')
comparison_event_info = pd.read_hdf(comparison_path, 'RAW/event_info')

# compare integer columns exactly
exact_cols = ['event_number', 'timestamp', 'samples', 'channels']
assert saved_event_info[exact_cols].equals(comparison_event_info[exact_cols])

# compare float columns with tolerance to account for floating point precision differences
np.testing.assert_allclose(saved_event_info['sampling_period'].values,
comparison_event_info['sampling_period'].values,
rtol=1e-10)

assert [x for x in reader(save_path, 'RAW', 'rwf')] == [x for x in reader(comparison_path, 'RAW', 'rwf')]


Expand Down
2 changes: 1 addition & 1 deletion packs/types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
('event_number', np.uint32),
('timestamp', np.uint64),
('samples', np.uint32),
('sampling_period', np.uint64),
('sampling_period', np.float64),
('channels', np.int32),
])

Expand Down
Loading