![]() |
Belle II Software development
|
Public Member Functions | |
def | __init__ (self, str listname, List[str] variables, str filename, Optional[str] hdf_table_name=None, int event_buffer_size=100, **writer_kwargs) |
def | initialize (self) |
def | buffer (self) |
def | event_buffer (self) |
def | clear_buffer (self) |
def | append_buffer (self) |
def | initialize_feather_writer (self) |
def | initialize_parquet_writer (self) |
def | initialize_csv_writer (self) |
def | initialize_hdf5_writer (self) |
def | fill_event_buffer (self) |
def | buffer_full (self) |
def | write_buffer (self) |
def | event (self) |
def | terminate (self) |
Protected Attributes | |
_filename | |
Output filename. | |
_listname | |
Particle list name. | |
_variables | |
List of variables. | |
_format | |
Output format. | |
_table_name | |
Table name in the hdf5 file. | |
_event_buffer_size | |
Event buffer size. | |
_event_buffer_counter | |
Event buffer counter. | |
_writer_kwargs | |
writer kwargs | |
_varnames | |
variable names | |
_std_varnames | |
std::vector of variable names | |
_evtmeta | |
Event metadata. | |
_plist | |
Pointer to the particle list. | |
_dtypes | |
The data type. | |
_buffer | |
event variables buffer (will be automatically grown if necessary) | |
_buffer_index | |
current start index in the event variables buffer | |
_schema | |
A list of tuples and py.DataTypes to define the pyarrow schema. | |
_feather_writer | |
a writer object to write data into a feather file | |
_parquet_writer | |
a writer object to write data into a parquet file | |
_csv_writer | |
a writer object to write data into a csv file | |
_hdf5_writer | |
The pytable file. | |
_table | |
The pytable. | |
Base class to dump ntuples into a non root format of your choosing
Definition at line 38 of file b2pandas_utils.py.
def __init__ | ( | self, | |
str | listname, | ||
List[str] | variables, | ||
str | filename, | ||
Optional[str] | hdf_table_name = None , |
||
int | event_buffer_size = 100 , |
||
** | writer_kwargs | ||
) |
Constructor to initialize the internal state Arguments: listname(str): name of the particle list variables(list(str)): list of variables to save for each particle filename(str): name of the output file to be created. Needs to end with `.csv` for csv output, `.parquet` or `.pq` for parquet output, `.h5`, `.hdf` or `.hdf5` for hdf5 output and `.feather` or `.arrow` for feather output hdf_table_name(str): name of the table in the hdf5 file. If not provided, it will be the same as the listname event_buffer_size(int): number of events to buffer before writing to disk, higher values will use more memory but write faster and result in smaller files **writer_kwargs: additional keyword arguments to pass to the writer. For details, see the documentation of the writer in the apache arrow documentation. Only use, if you know what you are doing!
Reimplemented in VariablesToHDF5.
Definition at line 43 of file b2pandas_utils.py.
def append_buffer | ( | self | ) |
"Append" a new event to the buffer by moving the buffer index forward by particle list size Automatically replaces the buffer by a larger one if necessary
Definition at line 178 of file b2pandas_utils.py.
def buffer | ( | self | ) |
The buffer slice across multiple entries
Definition at line 158 of file b2pandas_utils.py.
def buffer_full | ( | self | ) |
check if the buffer is full
Definition at line 275 of file b2pandas_utils.py.
def clear_buffer | ( | self | ) |
Reset the buffer event counter and index
Definition at line 171 of file b2pandas_utils.py.
def event | ( | self | ) |
Event processing function executes the fill_buffer function and writes the data to the output file in chunks of event_buffer_size
Definition at line 298 of file b2pandas_utils.py.
def event_buffer | ( | self | ) |
The buffer slice for the current event
Definition at line 165 of file b2pandas_utils.py.
def fill_event_buffer | ( | self | ) |
Assign values for all variables for all particles in the particle list to the current event buffer
Definition at line 254 of file b2pandas_utils.py.
def initialize | ( | self | ) |
Setup variable lists, pointers, buffers and file writers
Definition at line 101 of file b2pandas_utils.py.
def initialize_csv_writer | ( | self | ) |
Initialize the csv writer using pyarrow
Definition at line 224 of file b2pandas_utils.py.
def initialize_feather_writer | ( | self | ) |
Initialize the feather writer using pyarrow
Definition at line 196 of file b2pandas_utils.py.
def initialize_hdf5_writer | ( | self | ) |
Initialize the hdf5 writer using pytables
Definition at line 235 of file b2pandas_utils.py.
def initialize_parquet_writer | ( | self | ) |
Initialize the parquet writer using pyarrow
Definition at line 211 of file b2pandas_utils.py.
def terminate | ( | self | ) |
save and close the output
Definition at line 311 of file b2pandas_utils.py.
def write_buffer | ( | self | ) |
write the buffer to the output file
Definition at line 281 of file b2pandas_utils.py.
|
protected |
event variables buffer (will be automatically grown if necessary)
Definition at line 143 of file b2pandas_utils.py.
|
protected |
current start index in the event variables buffer
Definition at line 146 of file b2pandas_utils.py.
|
protected |
a writer object to write data into a csv file
Definition at line 233 of file b2pandas_utils.py.
|
protected |
The data type.
Definition at line 140 of file b2pandas_utils.py.
|
protected |
Event buffer counter.
Definition at line 97 of file b2pandas_utils.py.
|
protected |
Event buffer size.
Definition at line 95 of file b2pandas_utils.py.
|
protected |
Event metadata.
Definition at line 120 of file b2pandas_utils.py.
|
protected |
a writer object to write data into a feather file
Definition at line 205 of file b2pandas_utils.py.
|
protected |
Output filename.
Definition at line 70 of file b2pandas_utils.py.
|
protected |
Output format.
Definition at line 78 of file b2pandas_utils.py.
|
protected |
The pytable file.
Definition at line 240 of file b2pandas_utils.py.
|
protected |
Particle list name.
Definition at line 72 of file b2pandas_utils.py.
|
protected |
a writer object to write data into a parquet file
Definition at line 220 of file b2pandas_utils.py.
|
protected |
Pointer to the particle list.
Definition at line 124 of file b2pandas_utils.py.
|
protected |
A list of tuples and py.DataTypes to define the pyarrow schema.
Definition at line 201 of file b2pandas_utils.py.
|
protected |
std::vector of variable names
Definition at line 117 of file b2pandas_utils.py.
|
protected |
The pytable.
Definition at line 250 of file b2pandas_utils.py.
|
protected |
Table name in the hdf5 file.
Definition at line 91 of file b2pandas_utils.py.
|
protected |
List of variables.
Definition at line 74 of file b2pandas_utils.py.
|
protected |
variable names
Definition at line 109 of file b2pandas_utils.py.
|
protected |
writer kwargs
Definition at line 99 of file b2pandas_utils.py.