DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
file_quality_checker.py
Usage:
This script simply takes a list of HDF5 files produced by the DAQ (globs of course would work on the command line), loops over their records (whether trigger records or timeslices) and performs a few sanity checks. The output of the script when run on one file looks something like the following:
Concerning the progression of record ids and sequence ids: the script will look at the change in record id and sequence id between the first and second records in the file, and extrapolate that as the normal step size. If this step size is violated, then the full list of id values gets printed; otherwise simple one-sentence summaries such as you see above get printed.
Concerning the table: each row corresponds to a fragment type found in at least one record in the file. The first and second columns tell you the fewest instances of such a fragment found in a single record, and the most. Of course, these are typically the same value. The third and fourth columns tell you what the smallest and largest examples of this fragment were in the entire file. The fifth and sixth columns tell you the fewest instances of a fragment with a nonzero set of error bits, and the most, in a single record. Of course for these last two columns you'd ideally see all 0's.
wib2decoder.py
For example, for HD coldbox data from v2.11 onward, you can do:
to dump content of the headers, do some timestamp checks for the frames coming from the same WIB and across different WIBs, and to do some basic processing of the data.
There are fast unpackers of data for working in python. These unpackers will take a Fragment and put the resulting values (ADCs or timestamps) in a numpy array with shape (number of frames, number of channels)
at a similar speed compared to doing that in C++. This is much faster than doing a similar thing frame by frame in a loop in python.
To use it import the functions first:
where <format>
is one of the supported formats: wib
, wib2
or daphne
for the corresponding WIBFrame
, WIB2Frame
and DAPHNEFrame
frame formats. Then there are several functions available:
np_array_adc
and np_array_timestamp
will unpack the whole fragment. It is also possible to unpack only a part of it:
Warning: np_array_adc_data
and np_array_timestamp_data
do not make any checks on the number of frames so if passed a value larger than the actual number of frames in the fragment it will try to read out of bounds. np_array_adc
and np_array_timestamp
call np_array_adc_data
and np_array_timestamp_data
under the hood with the correct checks on the number of frames.
It's possible to transform binary files using the old WIBFrame
format to the newer WIB2Frame
or WIBEthFrame
format. That means that the ADC values will be preserved, as well as other values found in the header such as the crate, slot, fiber number. The timestamps will be overwritten to differ by 32 (by 32 * 64 for WIBEthFrame
) to avoid warnings and other issues when these files are being read by readout. In python:
For WIB -> WIB2
and for WIB -> WIBEth
When transforming WIB -> WIBEth it will create 4 files lblecause WIBFrames
have 256 channels and WIBEthFrames
have 64, so the first file has the first 64 channels, the second file has the next 64 channels and so on.