class heparchy.write.HdfEventWriter(heparchy.write.base.EventWriterBase)[source]

Context manager interface to create and write events.

edges[source]

A structured array providing edges for a graph representation, with fields “in” and “out”.

Type

numpy.ndarray[int]

edge_weights[source]

Weights attributed to each edge.

Type

numpy.ndarray[double]

pmu[source]

A structured array providing particle 4-momenta, with fields “x”, “y”, “z”, “e”

Type

numpy.ndarray[double]

color[source]

A structured array with fields “color” and “anti-color”.

Type

numpy.ndarray[int]

pdg[source]

PDG codes providing the identity of every particle in the event.

Type

numpy.ndarray[int]

status[source]

Status codes, describing the reason for the generation of each particle in the event.

Type

numpy.ndarray[int]

helicity[source]

Spin polarisations of every particle in the event.

Type

numpy.ndarray[int]

masks[source]

Write-only dictionary-like interface to set boolean masks over the particle datasets.

Type

MapWriter[numpy.ndarray[bool]]

custom[source]

Write-only dictionary-like interface to set user-defined custom datasets.

Type

MapWriter[numpy.ndarray]

custom_meta[source]

Write-only dictionary-like interface to set user-defined metadata on the event.

Type

MapWriter

Examples

Store custom metadata to an event:

>>> import heparchy
>>>
>>> with heparchy.write.HdfWriter("showers.hdf5") as hep_file:
>>>     with hep_file.new_process("higgs") as proc:
>>>         with proc.new_event() as event:
>>>             event.custom_meta["num_jets"] = 4

Public members

HdfEventWriter(proc: HdfProcessWriter)[source]

Initialize self. See help(type(self)) for accurate signature.

property edges : ndarray[Any, dtype[Any]][source]
property edge_weights : ndarray[Any, dtype[float64]][source]
property pmu : ndarray[Any, dtype[Any]][source]
property color : ndarray[Any, dtype[Any]][source]
property pdg : ndarray[Any, dtype[int32]][source]
property status : ndarray[Any, dtype[int32]][source]
property helicity : ndarray[Any, dtype[int16]][source]
custom : MapWriter[ndarray[Any, dtype[Any]]][source]
custom_meta : MapWriter[Any][source]
masks : MapWriter[ndarray[Any, dtype[bool_]]][source]

hepwrite

set_edges(data: ndarray[Any, dtype[Any]], ...) None[source]

Write edge indices for event.

set_pmu(data: ndarray[Any, dtype[Any]]) None[source]

Write 4-momentum for all particles to event.

set_color(data: ndarray[Any, dtype[Any]]) None[source]

Write color / anticolor pairs for all particles to event.

set_pdg(data: ndarray[Any, dtype[int32]]) None[source]

Pdg codes for all particles in event.

set_status(data: ndarray[Any, dtype[int32]]) None[source]

Write status codes for all particles to event.

set_helicity(data: ndarray[Any, dtype[int16]]) None[source]

Write helicity values for all particles to event.

set_mask(name: str, data: ndarray[Any, dtype[bool_]]) None[source]

Write bool mask for all particles in event.

set_custom_dataset(name: str, data, ...) None[source]

Write a custom dataset to the event.

set_custom_meta(name: str, metadata: Any) None[source]

Store custom metadata to the event.


Last update: Nov 16, 2022