h5hep package¶
Submodules¶
h5hep.read module¶
-
h5hep.read.load(filename=None, verbose=False, desired_datasets=None, subset=None)[source]¶ Reads all, or a subset of the data, from the HDF5 file to fill a data dictionary. Returns an empty dictionary to be filled later with select events.
- Args:
filename (string): Name of the input file
verbose (boolean): True if debug output is required
desired_datasets (list): Datasets to be read from input file
subset (int): Number of events to be read from input file
- Returns:
**ourdata (dict): Selected data from HDF5 file
event (dict): An empty event dictionary to be filled by individual events
h5hep.write module¶
-
h5hep.write.clear_event(data)[source]¶ Clears the data from the data dictionary - should the name of the function change?
- Args:
- data (dict): The dictionary to be cleared
-
h5hep.write.convert_dict_to_string_data(dictionary)[source]¶ Converts data dictionary to a string
- Args:
- dictionary (dict): Dictionary to be converted to a string
- Returns:
- mydataset (string): String representation of the dataset
-
h5hep.write.convert_list_and_key_to_string_data(datalist, key)[source]¶ Converts data dictionary to a string
- Args:
- datalist (list): A list to be saved as a string.
- Returns:
- key (string): We will assume that this will be unpacked as a dictionary,
- and this will be the key for the list in that dictionary.
-
h5hep.write.create_dataset(data, datasets, group=None, dtype=None)[source]¶ Adds a dataset to a group in a dictionary. If the group does not exist, it will be created.
- Args:
data (dict): Dictionary that contains the group
datasets (list): Dataset to be added to the group (This doesn’t have to be a list)
group (string): Name of group the dataset will be added to. None by default
dtype (type): The data type. None by default - I don’t think this is every used
- Returns:
- -1: If the group is None
-
h5hep.write.create_group(data, groupname, counter=None)[source]¶ Adds a group in the dictionary
- Args:
data (dict): Dictionary to which the group will be added
groupname (string): Name of the group to be added
counter (string): Name of the counter key. None by default
-
h5hep.write.create_single_event(data)[source]¶ Creates an event dictionary that will be used to collect data and then packed into the the master data dictionary.
- Args:
- data (dict): Data dictionary that will hold all the data from the events.
- Returns:
- event (dict): The new event dictionary with keys and no event information
-
h5hep.write.initialize()[source]¶ Creates an empty data dictionary
Returns:
data (dict): An empty data dictionary
-
h5hep.write.pack(data, event)[source]¶ Takes the data from an event and packs it into the data dictionary, intelligently, so that it can be stored and extracted efficiently. (This is analagous to the ROOT TTree::Fill() member function.
- Args:
data (dict): Data dictionary to hold the entire dataset.
event (dict): Event to be packed into data.
-
h5hep.write.write_to_file(filename, data, comp_type=None, comp_opts=None, force_single_precision=True)[source]¶ Writes the selected data to an h5hep file
- Args:
filename (string): Name of output file
data (dictionary): Data to be written into output file
comp_type (string): Type of compression
force_single_precision (boolean): True if data should be written in single precision
- Returns:
- hdoutfile (h5hep): File to which the data has been written