nectarchain.data.container.core.merge_map_ArrayDataContainer#
- merge_map_ArrayDataContainer(triggerMapContainer)[source]#
Merge and map ArrayDataContainer.
This function takes a TriggerMapContainer as input and merges the array fields of the containers mapped within the TriggerMapContainer. The merged array fields are concatenated along the 0th axis. The function also updates the ‘nevents’ field of the output container by summing the ‘nevents’ field of all the mapped containers.
- Parameters:
triggerMapContainer (TriggerMapContainer): The TriggerMapContainer object containing the containers to be merged and mapped.
- Returns:
ArrayDataContainer: The merged and mapped ArrayDataContainer object.
- Example:
>>> triggerMapContainer = TriggerMapContainer() >>> container1 = ArrayDataContainer() >>> container1.field1 = np.array([1, 2, 3]) >>> container1.field2 = np.array([4, 5, 6]) >>> container1.nevents 3 >>> container2 = ArrayDataContainer() >>> container2.field1 = np.array([7, 8, 9]) >>> container2.field2 = np.array([10, 11, 12]) >>> container2.nevents 3 >>> triggerMapContainer.containers['container1'] = container1 >>> triggerMapContainer.containers['container2'] = container2 >>> merged_container = merge_map_ArrayDataContainer(triggerMapContainer) >>> merged_container.field1 array([1, 2, 3, 7, 8, 9]) >>> merged_container.field2 array([ 4, 5, 6, 10, 11, 12]) >>> merged_container.nevents 6