LCOV - code coverage report
Current view: top level - hdf5libs/pybindsrc - hdf5rawdatafile.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 107 0
Test Date: 2026-10-11 15:05:20 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /**
       2              :  * @file wib.cpp
       3              :  *
       4              :  * This is part of the DUNE DAQ Software Suite, copyright 2020.
       5              :  * Licensing/copyright details are in the COPYING file that you should have
       6              :  * received with this code.
       7              :  */
       8              : 
       9              : #include "hdf5libs/HDF5RawDataFile.hpp"
      10              : 
      11              : #include <pybind11/pybind11.h>
      12              : #include <pybind11/stl.h>
      13              : #include <pybind11/stl/filesystem.h>
      14              : #include <pybind11/stl_bind.h>
      15              : 
      16              : #include <string>
      17              : 
      18              : namespace py = pybind11;
      19              : 
      20              : namespace dunedaq {
      21              : namespace hdf5libs {
      22              : namespace python {
      23              : 
      24              : void
      25            0 : register_hdf5rawdatafile(py::module& m)
      26              : {
      27              : 
      28            0 :   py::class_<HDF5RawDataFile>(m, "_HDF5RawDataFile")
      29            0 :     .def(py::init<std::filesystem::path>())
      30              : 
      31            0 :     .def("get_attribute_names", &HDF5RawDataFile::get_attribute_names, "Get a list of attribute names")
      32              : 
      33            0 :     .def("get_attribute",
      34            0 :          py::overload_cast<const std::string&>(&HDF5RawDataFile::get_attribute<std::string>),
      35              :          "Get attribute")
      36              : 
      37            0 :     .def("get_int_attribute",
      38            0 :          py::overload_cast<const std::string&>(&HDF5RawDataFile::get_attribute<size_t>),
      39              :          "Get integer attribute")
      40              : 
      41            0 :     .def("get_file_name", &HDF5RawDataFile::get_file_name, "Get file name")
      42            0 :     .def("get_recorded_size", &HDF5RawDataFile::get_recorded_size, "Get recorded size")
      43            0 :     .def("get_record_type", &HDF5RawDataFile::get_record_type, "Get record type")
      44            0 :     .def("is_trigger_record_type", &HDF5RawDataFile::is_trigger_record_type, "Is record type TriggerRecord")
      45            0 :     .def("is_timeslice_type", &HDF5RawDataFile::is_timeslice_type, "Is record type TimeSlice")
      46            0 :     .def("get_version", &HDF5RawDataFile::get_version, "FileLayout version number")
      47              : 
      48            0 :     .def("get_dataset_paths",
      49            0 :          &HDF5RawDataFile::get_dataset_paths,
      50              :          "Get all dataset paths under specified top group in file",
      51            0 :          py::arg("top_level_group_name") = "")
      52              : 
      53            0 :     .def("get_all_record_ids", &HDF5RawDataFile::get_all_record_ids, "Get all record/sequence number pairs.")
      54            0 :     .def("get_all_trigger_record_ids",
      55            0 :          &HDF5RawDataFile::get_all_trigger_record_ids,
      56              :          "Get all trigger record/sequence number pairs.")
      57            0 :     .def("get_all_timeslice_ids", &HDF5RawDataFile::get_all_timeslice_ids, "Get all timeslice/sequence number pairs.")
      58              : 
      59            0 :     .def("get_record_header_dataset_paths",
      60            0 :          &HDF5RawDataFile::get_record_header_dataset_paths,
      61              :          "Get all paths to record header datasets")
      62            0 :     .def("get_trigger_record_header_dataset_paths",
      63            0 :          &HDF5RawDataFile::get_trigger_record_header_dataset_paths,
      64              :          "Get all paths to TriggerRecordHeader datasets")
      65            0 :     .def("get_timeslice_header_dataset_paths",
      66            0 :          &HDF5RawDataFile::get_timeslice_header_dataset_paths,
      67              :          "Get all paths to TimeSliceHeader datasets")
      68              : 
      69            0 :     .def("get_record_header_dataset_path",
      70            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_record_header_dataset_path),
      71              :          "Get record header path for record id")
      72            0 :     .def("get_record_header_dataset_path",
      73              :          py::overload_cast<const uint64_t, const daqdataformats::sequence_number_t> // NOLINT(build/unsigned)
      74            0 :          (&HDF5RawDataFile::get_record_header_dataset_path),
      75              :          "Get record header path for record number and sequence number",
      76            0 :          py::arg("rec_num"),
      77            0 :          py::arg("seq_num") = 0)
      78              : 
      79            0 :     .def(
      80              :       "get_trigger_record_header_dataset_path",
      81            0 :       py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_trigger_record_header_dataset_path),
      82              :       "Get record header path for trigger record id")
      83            0 :     .def("get_trigger_record_header_dataset_path",
      84            0 :          py::overload_cast<const daqdataformats::trigger_number_t, const daqdataformats::sequence_number_t>(
      85              :            &HDF5RawDataFile::get_trigger_record_header_dataset_path),
      86              :          "Get record header path for trigger record number and sequence number",
      87            0 :          py::arg("trig_num"),
      88            0 :          py::arg("seq_num") = 0)
      89              : 
      90            0 :     .def("get_timeslice_header_dataset_path",
      91            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_timeslice_header_dataset_path),
      92              :          "Get record header path for timeslice record id")
      93            0 :     .def(
      94              :       "get_timeslice_header_dataset_path",
      95            0 :       py::overload_cast<const daqdataformats::timeslice_number_t>(&HDF5RawDataFile::get_timeslice_header_dataset_path),
      96              :       "Get record header path for timeslice number")
      97              : 
      98            0 :     .def("get_all_fragment_dataset_paths",
      99            0 :          &HDF5RawDataFile::get_all_fragment_dataset_paths,
     100              :          "Get all paths to Fragment datasets")
     101            0 :     .def("get_fragment_dataset_paths",
     102            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_fragment_dataset_paths),
     103              :          "Get fragment datasets for record ID")
     104            0 :     .def("get_fragment_dataset_paths",
     105              :          py::overload_cast<const uint64_t, const daqdataformats::sequence_number_t> // NOLINT(build/unsigned)
     106            0 :          (&HDF5RawDataFile::get_fragment_dataset_paths),
     107              :          "Get fragment datasets for record number and sequence number",
     108            0 :          py::arg("rec_num"),
     109            0 :          py::arg("seq_num") = 0)
     110            0 :     .def("get_fragment_dataset_paths",
     111            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&, const daqdataformats::SourceID::Subsystem>(
     112              :            &HDF5RawDataFile::get_fragment_dataset_paths),
     113              :          "Get fragment datasets for record ID and SourceID Subsystem")
     114            0 :     .def("get_fragment_dataset_paths",
     115            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&, const std::string&>(
     116              :            &HDF5RawDataFile::get_fragment_dataset_paths),
     117              :          "Get fragment datasets for record ID and SourceID Subsystem string")
     118              : #if 0
     119              :     .def("get_fragment_dataset_paths",
     120              :          py::overload_cast<const daqdataformats::SourceID::Subsystem>(&HDF5RawDataFile::get_fragment_dataset_paths),
     121              :          "Get fragment datasets for SourceID Subsystem")
     122              :     .def("get_fragment_dataset_paths",
     123              :          py::overload_cast<const std::string&>(&HDF5RawDataFile::get_fragment_dataset_paths),
     124              :          "Get fragment datasets for SourceID Subsystem string")
     125              :     .def("get_fragment_dataset_paths",
     126              :          py::overload_cast<const daqdataformats::SourceID>(&HDF5RawDataFile::get_fragment_dataset_paths),
     127              :          "Get fragment datasets for SourceID")
     128              :     .def("get_fragment_dataset_paths",
     129              :          py::overload_cast<const daqdataformats::SourceID::Subsystem,const uint32_t> //NOLINT(build/unsigned)
     130              :          (&HDF5RawDataFile::get_fragment_dataset_paths),
     131              :          "Get fragment datasets for SourceID Subsystem")
     132              :     .def("get_fragment_dataset_paths",
     133              :          py::overload_cast<const std::string&,const uint32_t> //NOLINT(build/unsigned)
     134              :          (&HDF5RawDataFile::get_fragment_dataset_paths),
     135              :          "Get fragment datasets for SourceID Subsystem string")
     136              : #endif
     137            0 :     .def("get_geo_ids",
     138            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_geo_ids),
     139              :          "Get all GeoIDs in a record id")
     140            0 :     .def("get_geo_ids",
     141              :          py::overload_cast<const uint64_t, const daqdataformats::sequence_number_t> // NOLINT(build/unsigned)
     142            0 :          (&HDF5RawDataFile::get_geo_ids),
     143              :          "Get all GeoIDs in a record/sequence number")
     144            0 :     .def("get_geo_ids_for_subdetector",
     145            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&, const detdataformats::DetID::Subdetector>(
     146              :            &HDF5RawDataFile::get_geo_ids_for_subdetector),
     147              :          "Get all GeoIDs in a record id with the specified Subdetector type")
     148            0 :     .def("get_source_ids",
     149            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_source_ids),
     150              :          "Get all source IDs in a record id")
     151            0 :     .def("get_source_ids",
     152              :          py::overload_cast<const uint64_t, const daqdataformats::sequence_number_t> // NOLINT(build/unsigned)
     153            0 :          (&HDF5RawDataFile::get_source_ids),
     154              :          "Get all source IDs in a record/sequence number")
     155            0 :     .def("get_source_ids_for_fragment_type",
     156            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&, const std::string&>(
     157              :            &HDF5RawDataFile::get_source_ids_for_fragment_type),
     158              :          "Get all source IDs in a record id with a given fragment type")
     159            0 :     .def("get_source_ids_for_fragtype_and_subdetector",
     160            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&, const std::string&, const std::string&>(
     161              :            &HDF5RawDataFile::get_source_ids_for_fragtype_and_subdetector),
     162              :          "Get all source IDs in a record id matching the specified fragment and subdetector types")
     163              : #if 0
     164              :     .def("get_source_ids",
     165              :          py::overload_cast<const HDF5RawDataFile::record_id_t&,const daqdataformats::SourceID::Subsystem>
     166              :          (&HDF5RawDataFile::get_source_ids),
     167              :          "Get all source IDs in a record id with a given SourceID Subsystem")
     168              :     .def("get_source_ids",
     169              :          py::overload_cast<const uint64_t,const daqdataformats::sequence_number_t, //NOLINT(build/unsigned)
     170              :                            const daqdataformats::SourceID::Subsystem>
     171              :          (&HDF5RawDataFile::get_source_ids),
     172              :          "Get all source IDs in a record/sequence number with a given SourceID Subsystem")
     173              :     .def("get_source_ids",
     174              :          py::overload_cast<const HDF5RawDataFile::record_id_t&,const std::string&>
     175              :          (&HDF5RawDataFile::get_source_ids),
     176              :          "Get all source IDs in a record id with a given SourceID Subsystem string")
     177              :     .def("get_source_ids",
     178              :          py::overload_cast<const uint64_t,const daqdataformats::sequence_number_t, //NOLINT(build/unsigned)
     179              :                            const std::string&>
     180              :          (&HDF5RawDataFile::get_source_ids),
     181              :          "Get all source IDs in a record/sequence number with a given SourceID Subsystem string")
     182              :     .def("get_source_ids",
     183              :          py::overload_cast<const daqdataformats::SourceID::Subsystem>
     184              :          (&HDF5RawDataFile::get_source_ids),
     185              :          "Get all source IDs with a given SourceID Subsystem")
     186              :     .def("get_source_ids",
     187              :          py::overload_cast<const std::string&>
     188              :          (&HDF5RawDataFile::get_source_ids),
     189              :          "Get all source IDs with a given SourceID Subsystem string")
     190              : #endif
     191              : 
     192              :     //    .def("get_frag_ptr", py::overload_cast<const std::string & >
     193              :     //         (&HDF5RawDataFile::get_frag_ptr),
     194              :     //         "Get Fragment from dataset")
     195            0 :     .def("get_frag", py::overload_cast<const std::string&>(&HDF5RawDataFile::get_frag_ptr), "Get Fragment from dataset")
     196            0 :     .def("get_frag",
     197              :          py::overload_cast<const uint64_t, // NOLINT(build/unsigned)
     198              :                            const daqdataformats::sequence_number_t,
     199            0 :                            const daqdataformats::SourceID&>(&HDF5RawDataFile::get_frag_ptr),
     200              :          "Get Fragment from record/sequence number and SourceID")
     201            0 :     .def("get_frag",
     202            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&, const daqdataformats::SourceID&>(
     203              :            &HDF5RawDataFile::get_frag_ptr),
     204              :          "Get Fragment from record id and SourceID")
     205              : 
     206            0 :     .def("get_frag",
     207              :          py::overload_cast<const uint64_t, // NOLINT(build/unsigned)
     208              :                            const daqdataformats::sequence_number_t,
     209              :                            const daqdataformats::SourceID::Subsystem,
     210              :                            const uint32_t> // NOLINT(build/unsigned)
     211            0 :          (&HDF5RawDataFile::get_frag_ptr),
     212              :          "Get Fragment from record/sequence number and SourceID elements")
     213            0 :     .def("get_frag",
     214              :          py::overload_cast<const HDF5RawDataFile::record_id_t&,
     215              :                            const daqdataformats::SourceID::Subsystem,
     216              :                            const uint32_t> // NOLINT(build/unsigned)
     217            0 :          (&HDF5RawDataFile::get_frag_ptr),
     218              :          "Get Fragment from record id and SourceID elements")
     219              : 
     220            0 :     .def("get_frag",
     221              :          py::overload_cast<const uint64_t, // NOLINT(build/unsigned)
     222              :                            const daqdataformats::sequence_number_t,
     223              :                            const std::string&,
     224              :                            const uint32_t> // NOLINT(build/unsigned)
     225            0 :          (&HDF5RawDataFile::get_frag_ptr),
     226              :          "Get Fragment from record/sequence number and SourceID elements")
     227            0 :     .def("get_frag",
     228              :          py::overload_cast<const HDF5RawDataFile::record_id_t&,
     229              :                            const std::string&,
     230              :                            const uint32_t> // NOLINT(build/unsigned)
     231            0 :          (&HDF5RawDataFile::get_frag_ptr),
     232              :          "Get Fragment from record id and SourceID elements")
     233              : 
     234            0 :     .def("get_frag",
     235              :          py::overload_cast<const HDF5RawDataFile::record_id_t&,
     236              :                            const uint64_t> // NOLINT(build/unsigned)
     237            0 :          (&HDF5RawDataFile::get_frag_ptr),
     238              :          "Get Fragment from record id and GeoID")
     239            0 :     .def("get_frag",
     240              :          py::overload_cast<const uint64_t, // NOLINT(build/unsigned)
     241              :                            const daqdataformats::sequence_number_t,
     242              :                            const uint64_t> // NOLINT(build/unsigned)
     243            0 :          (&HDF5RawDataFile::get_frag_ptr),
     244              :          "Get Fragment from record/sequence number and GeoID")
     245              : 
     246              :     //    .def("get_trh_ptr",
     247              :     //         py::overload_cast<const std::string & >(&HDF5RawDataFile::get_trh_ptr),
     248              :     //         "Get TriggerRecordHeader from datset")
     249            0 :     .def("get_trh",
     250            0 :          py::overload_cast<const std::string&>(&HDF5RawDataFile::get_trh_ptr),
     251              :          "Get TriggerRecordHeader from dataset")
     252            0 :     .def("get_trh",
     253            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_trh_ptr),
     254              :          "Get TriggerRecordHeader from record id")
     255            0 :     .def("get_trh",
     256            0 :          py::overload_cast<const daqdataformats::trigger_number_t, daqdataformats::sequence_number_t>(
     257              :            &HDF5RawDataFile::get_trh_ptr),
     258              :          "Get TriggerRecordHeader from record/sequence number")
     259              :     //    .def("get_tsh_ptr", py::overload_cast<const std::string & >(&HDF5RawDataFile::get_tsh_ptr),
     260              :     //   "Get TimeSliceHeader from datset")
     261            0 :     .def("get_tsh",
     262            0 :          py::overload_cast<const std::string&>(&HDF5RawDataFile::get_tsh_ptr),
     263              :          "Get TimeSliceHeader from datset")
     264            0 :     .def("get_tsh",
     265            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_tsh_ptr),
     266              :          "Get TimeSliceHeader from record id")
     267            0 :     .def("get_tsh",
     268              :          py::overload_cast<const daqdataformats::timeslice_number_t> // NOLINT(build/unsigned)
     269            0 :          (&HDF5RawDataFile::get_tsh_ptr),
     270              :          "Get TimeSliceHeader from timeslince number")
     271              : 
     272            0 :     .def("get_trigger_record",
     273            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_trigger_record),
     274              :          "Get TriggerRecord object from record id")
     275            0 :     .def("get_trigger_record",
     276            0 :          py::overload_cast<const daqdataformats::trigger_number_t, const daqdataformats::sequence_number_t>(
     277              :            &HDF5RawDataFile::get_trigger_record),
     278              :          "Get TriggerRecord object from record/sequence number")
     279            0 :     .def("get_timeslice",
     280            0 :          py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_timeslice),
     281              :          "Get TimeSlice object from record id")
     282            0 :     .def("get_timeslice",
     283            0 :          py::overload_cast<const daqdataformats::timeslice_number_t>(&HDF5RawDataFile::get_timeslice),
     284              :          "Get TimeSlice object from timeslice number");
     285              : 
     286            0 : } // NOLINT
     287              : 
     288              : } // namespace python
     289              : } // namespace hdf5libs
     290              : } // namespace dunedaq
        

Generated by: LCOV version 2.0-1