spine.ana.manager

Manages the operation of analysis scripts.

Classes

AnaManager(cfg[, log_dir, prefix])

Manager class to initialize and execute analysis scripts.

class spine.ana.manager.AnaManager(cfg, log_dir=None, prefix=None)[source]

Manager class to initialize and execute analysis scripts.

Analysis scripts use the output of the reconstruction chain and the post-processors and produce simple CSV files.

It loads all the analysis scripts and feeds them data. It initializes CSV writers needed to store the output of the analysis scripts.

Methods

__call__(data)

Pass one batch of data through the analysis scripts

close()

Close all analysis script writers and flush remaining data.

flush()

Flush all analysis script writer buffers.

parse_config(log_dir, prefix[, overwrite, ...])

Parse the analysis tool configuration.

parse_config(log_dir, prefix, overwrite=None, prefix_output=False, buffer_size=1, **modules)[source]

Parse the analysis tool configuration.

Parameters:
  • log_dir (str) – Output CSV file directory (shared with driver log)

  • prefix (str) – Input file prefix. If requested, it will be used to prefix all the output CSV files.

  • overwrite (bool, optional) – If True, overwrite the CSV logs if they already exist

  • prefix_output (bool, optional) – If True, will prefix the output CSV names with the input file name

  • buffer_size (int, default 1) – CSV file buffer size. 1 is line buffered (default), -1 uses system default, 0 is unbuffered, >1 is buffer size in bytes

  • **modules (dict) – List of analysis script modules

close()[source]

Close all analysis script writers and flush remaining data.

This should be called when analysis is complete to ensure all CSV files are properly closed and data is written.

flush()[source]

Flush all analysis script writer buffers.

This forces any buffered data to be written to disk without closing the files.