![]() |
FairShip
|
Functions | |
| parse_arguments () | |
| load_pickled_data (input_file, verbose=False) | |
| load_custom_config (config_path) | |
| parse_custom_config_units (custom_config) | |
| print_default_config () | |
| get_column_config (custom_config_path=None) | |
| apply_column_transformation (data_column, config) | |
| create_root_dataframe (data, verbose=False, custom_config_path=None) | |
| save_root_file (df, output_file, tree_name, output_format, verbose=False) | |
| main () | |
Convert pickled muon data to ROOT format (TTree or RNTuple).
This script converts pickled muon data to ROOT format, supporting both TTree and RNTuple output formats.
The input data should be a NumPy array with columns: px, py, pz, x, y, z, id, w.
Usage:
python eminem_importer.py input_file.pkl [options]
Example:
python eminem_importer.py muons_FullMC.pkl --output converted_data.root --format rntuple
| experimental.eminem_importer.apply_column_transformation | ( | data_column, | |
| config ) |
Apply transformations to a data column based on its configuration.
Args:
data_column (numpy.ndarray): Raw data column
config (dict): Column configuration
Returns:
numpy.ndarray or shipunit quantity: Transformed data column
Definition at line 333 of file eminem_importer.py.
| experimental.eminem_importer.create_root_dataframe | ( | data, | |
| verbose = False, | |||
| custom_config_path = None ) |
Create ROOT RDataFrame from numpy data using configuration-driven approach.
Args:
data (numpy.ndarray): Input data array with columns [px, py, pz, x, y, z, id, w]
verbose (bool): Enable verbose output
custom_config_path (str, optional): Path to custom configuration file
Returns:
ROOT.RDataFrame: ROOT dataframe with the converted data
Definition at line 378 of file eminem_importer.py.
| experimental.eminem_importer.get_column_config | ( | custom_config_path = None | ) |
Define column configuration with transformations and units.
Args:
custom_config_path (str, optional): Path to custom configuration file
Returns:
dict: Column configuration dictionary
Definition at line 257 of file eminem_importer.py.
| experimental.eminem_importer.load_custom_config | ( | config_path | ) |
Load custom column configuration from JSON file.
Args:
config_path (str): Path to the configuration file
Returns:
dict: Custom configuration dictionary
Definition at line 158 of file eminem_importer.py.
| experimental.eminem_importer.load_pickled_data | ( | input_file, | |
| verbose = False ) |
Load pickled data from file, handling both compressed and uncompressed files.
Args:
input_file (str): Path to the input pickled file
verbose (bool): Enable verbose output
Returns:
numpy.ndarray: Loaded data array
Raises:
FileNotFoundError: If input file doesn't exist
Exception: If file cannot be loaded or has wrong format
Definition at line 86 of file eminem_importer.py.
| experimental.eminem_importer.main | ( | ) |
Convert pickled muon data to ROOT format (TTree or RNTuple).
Definition at line 460 of file eminem_importer.py.
| experimental.eminem_importer.parse_arguments | ( | ) |
Parse command line arguments.
Returns:
argparse.Namespace: Parsed command line arguments
Definition at line 28 of file eminem_importer.py.
| experimental.eminem_importer.parse_custom_config_units | ( | custom_config | ) |
Parse custom configuration and convert string unit representations to shipunit objects.
Args:
custom_config (dict): Custom configuration dictionary
Returns:
dict: Configuration with parsed units
Definition at line 176 of file eminem_importer.py.
| experimental.eminem_importer.print_default_config | ( | ) |
Print the default configuration in JSON format.
Definition at line 230 of file eminem_importer.py.
| experimental.eminem_importer.save_root_file | ( | df, | |
| output_file, | |||
| tree_name, | |||
| output_format, | |||
| verbose = False ) |
Save ROOT dataframe to file in specified format.
Args:
df (ROOT.RDataFrame): Input dataframe
output_file (str): Output file path
tree_name (str): Name of the tree/ntuple
output_format (str): Output format ('ttree' or 'rntuple')
verbose (bool): Enable verbose output
Definition at line 427 of file eminem_importer.py.