NuRadioReco.modules.base.module module

NuRadioReco.modules.base.module.setup_logger(name='NuRadioReco', level=None)[source]

Set up the parent logger which all module loggers should pass their logs on to. Any handler which was previously added to the logger is cleared, and a single new logging.StreamHandler() with a custom formatter is added. Next to this, an extra logging level STATUS is added with level=`LOGGING_STATUS`, which is defined in module.py (as of February 2024, its value is 25). Then STATUS is also set as the default logging level.

Deprecated since version 2.3.0: module.setup_logger() will be removed in v2.4.0 and replaced by logging.setup_logger() from the NuRadioReco utilities folder.

Parameters:
namestr, default=”NuRadioReco”

The name of the base logger

levelint, default=25

The logging level to use for the base logger

NuRadioReco.modules.base.module.register_run(level=None)[source]

Decorator for run methods. This decorator registers the run methods. It allows to keep track of which module is executed in which order and with what parameters. Also the execution time of each module is tracked.

NuRadioReco.modules.base.module.end_all_modules()[source]

Call end() of all module instances that have executed a decorated run(), in order of their first run() call.

Each instance is ended only once. Exceptions in an end() are logged and do not stop the remaining ones. Registered with atexit, so it runs automatically when the program exits.

Modules holding files (e.g. eventReader, eventWriter) provide a close() which their end() calls. Call close() yourself to release the file before exit, e.g. to read back a file you just wrote.

NuRadioReco.modules.base.module.print_timing_summary(min_percent=None)[source]

Print the accumulated run time per module (class) in order of first execution, followed by a total line.

Times are exclusive: time spent in nested module calls (e.g. a generator wrapping another one) is attributed to the nested module only.

For reader modules (generators), the time spent producing each item is counted, with one call per item. The “per call” entry of the total row is the total time divided by the number of distinct events (run number, event id) seen by event/station modules. It is printed automatically at exit if ENABLE_TIMING is set (see top of file).

Parameters:
min_percentfloat, optional

Modules contributing less than this share (in percent) of the total time are merged into a single “others” row, which states the number of merged modules. Default: TIMING_MIN_PERCENT (2). Use 0 to list all modules.