km3pipe.io.evt

Pumps for the EVT simulation dataformat.

Module Contents

Classes

EvtPump

Provides a pump for EVT-files.

Parser

Standard parser to create numpy times from EVT raw data.

Functions

try_decode_string(text)

Decode string to ASCII if possible

parse_corant(blob)

Creates new blob entries for the given blob keys

parse_propa(blob)

Creates new blob entries for the given blob keys

Attributes

log

KM3SIM_TAGS

GSEAGEN_TAGS

KM3_TAGS

EVT_PARSERS

km3pipe.io.evt.log[source]
km3pipe.io.evt.try_decode_string(text)[source]

Decode string to ASCII if possible

class km3pipe.io.evt.EvtPump(name=None, **parameters)[source]

Provides a pump for EVT-files.

Parameters:
filename: str

The file to read the events from.

parsers: list of str or callables

The parsers to apply for each blob (e.g. parsers=[‘km3sim’, a_parser]) You can also pass your own function, which takes a single argument blob and mutates it. str values will be looked up in the kp.io.evt.EVT_PARSERS dictionary and ignored if not found. If parsers=’auto’, the EvtPump will try to find the appropriate parsers, which is the default behaviour. [default: ‘auto’]

cache_enabled: bool

If enabled, a cache of the event indices is created when loading the file. Enable it if you want to jump around and inspect the events non-consecutively. [default: False]

basename: str

The common part of the filenames if you want to process multiple files e.g. file1.evt, file2.evt and file3.evt. During processing, the files will be concatenated behind the scenes. You need to specify the index_stop and index_start (1 and 3 for the example).

suffix: str

A string to append to each filename (before “.evt”), when basename is given. [default: ‘’]

index_start: int

The starting index if you process multiple files at once. [default: 1]

index_stop: int

The last index if you process multiple files at once. [default: 1]

n_digits: int or None

The number of digits for indexing multiple files. [default: None] None means no leading zeros.

exclude_tags: list of strings

The tags in the EVT file, which should be ignored (e.g. if they cause parse errors)

configure()[source]

Configure module, like instance variables etc.

prepare_blobs()[source]

Populate the blobs

extract_header()[source]

Create a dictionary with the EVT header information

get_blob(index)[source]

Return a blob with the event at the given index

process(blob=None)[source]

Pump the next blob to the modules

finish()[source]

Clean everything up.

class km3pipe.io.evt.Parser(tag_description)[source]

Standard parser to create numpy times from EVT raw data.

The tag_description is a dict of tuples. The key is the target blob-key, the value is tuple of “target blob-key” and “numpy dtype”.

km3pipe.io.evt.KM3SIM_TAGS[source]
km3pipe.io.evt.GSEAGEN_TAGS[source]
km3pipe.io.evt.KM3_TAGS[source]
km3pipe.io.evt.parse_corant(blob)[source]

Creates new blob entries for the given blob keys

km3pipe.io.evt.parse_propa(blob)[source]

Creates new blob entries for the given blob keys

km3pipe.io.evt.EVT_PARSERS[source]