pisa.stages.data package

Submodules

pisa.stages.data.csv_data_hist module

A Stage to load data from a CSV datarelease format file into a ContainerSet

class pisa.stages.data.csv_data_hist.csv_data_hist(events_file, **std_kwargs)[source]

Bases: Stage

CSV file loader class

Parameters:

events_file (str) – csv file path

Notes

Implements no apply.

setup_function()[source]

Implement in services (subclasses of Stage)

pisa.stages.data.csv_data_hist.init_test(**param_kwargs)[source]

Instantiation example

pisa.stages.data.csv_icc_hist module

A Stage to load data from a CSV datarelease format file into a ContainerSet

class pisa.stages.data.csv_icc_hist.csv_icc_hist(events_file, **std_kwargs)[source]

Bases: Stage

CSV file loader class

Parameters:
  • events_file (str) – csv file path

  • params (ParamSet) –

    Must have parameters:

    atm_muon_scale : quantity (dimensionless)
    

apply_function()[source]

Implement in services (subclasses of Stage)

setup_function()[source]

Implement in services (subclasses of Stage)

pisa.stages.data.csv_icc_hist.init_test(**param_kwargs)[source]

Instantiation example

pisa.stages.data.csv_loader module

A Stage to load data from a CSV datarelease format file into a ContainerSet

class pisa.stages.data.csv_loader.csv_loader(events_file, data_dict, output_names, neutrinos=True, dis_idx=None, scale_aeff=False, **std_kwargs)[source]

Bases: Stage

CSV file loader class

Parameters:
  • events_file (str or sequence of str) – csv file path(s)

  • data_dict ((str of a) dict) – Dictionary to specify what keys from the csv files to be loaded under what name. Entries can be strings that point to the right key in the csv file or lists of keys, and the data will be stacked into a 2d array.

  • output_names (sequence of str) – Event categories to be recorded, needs to be a subset of names in events_file.

  • neutrinos (bool, default: True) – Flag indicating whether data events represent neutrinos In this case, special handling for e.g. nu/nubar, CC vs NC, …

  • dis_idx (int, default: None) – The deep inelastic scattering (DIS) systematic stage in PISA expects a key identifiying if an event is a dis event. This key should be 1 for all dis events and 0 otherwise. However, your csv file might only contain an interaction key that assings integers to different interaction types (e.g. dis=1, qel=2, res=3, …). In that case you need to specify which integer corresponds to dis. It is preferred to specify a dedicated dis key in the data_dict.

  • scale_aeff (bool, default: False) – Convert effective area from cm^2 to m^2 (PISA flux tables are stored in m^2) if given in cm^2.

apply_function()[source]

Implement in services (subclasses of Stage)

setup_function()[source]

Implement in services (subclasses of Stage)

pisa.stages.data.csv_loader.init_test(**param_kwargs)[source]

Initialisation example

pisa.stages.data.grid module

Stage to create a grid of data

class pisa.stages.data.grid.grid(grid_binning, entity='midpoints', output_names=None, **std_kwargs)[source]

Bases: Stage

Create a grid of events

Parameters:
  • grid_binning (MultiDimBinning) – Binning object defining the grid to be generated

  • entity (str) – entity arg to be passed to meshgrid()

  • output_names (array_like) – List of output names (event types)

apply_function()[source]

Implement in services (subclasses of Stage)

setup_function()[source]

Implement in services (subclasses of Stage)

pisa.stages.data.grid.init_test(**param_kwargs)[source]

Instantiation example

pisa.stages.data.licloader_weighter module

pisa.stages.data.meows_loader module

A class to load in the MEOWS hdf5 files

pisa.stages.data.meows_loader.init_test(**param_kwargs)[source]

Instantiation example

class pisa.stages.data.meows_loader.meows_loader(events_file: str, n_files: int, output_names, **std_kwargs)[source]

Bases: Stage

Docstring incoming… (FIXME)

apply_function()[source]

Resets all the weights to the initial weights

setup_function()[source]

Go over all those input files and load them in.

We load the first data in specifically to setup the containers, and afterwards go through appending to the end of those arrays

pisa.stages.data.simple_data_loader module

A Stage to load data from a PISA style hdf5 file into a ContainerSet

pisa.stages.data.simple_data_loader.init_test(**param_kwargs)[source]

Initialisation example

class pisa.stages.data.simple_data_loader.simple_data_loader(events_file, mc_cuts, data_dict, neutrinos=True, required_metadata=None, fraction_events_to_keep=None, events_subsample_index=0, seed=123456, output_names=None, **std_kwargs)[source]

Bases: Stage

HDF5 file loader class

Parameters:
  • events_file (hdf5 file path) – output from make_events, including flux weights and Genie systematics coefficients

  • mc_cuts (cut expr) – e.g. ‘(true_coszen <= 0.5) & (true_energy <= 70)’

  • data_dict (str of a dict) – Dictionary to specify what keys from the hdf5 files to be loaded under what name. Entries can be strings that point to the right key in the hdf5 file or lists of keys, and the data will be stacked into a 2d array.

  • neutrinos (bool) – Flag indicating whether data events represent neutrinos In this case, special handling for e.g. nu/nubar, CC vs NC, …

  • required_metadata (sequence of str, default: None) – Optionally specify metadata keys to parse from the events_file metadata.

  • fraction_events_to_keep (float, default: None) – Fraction of loaded events to use (use to downsample). Must be in range [0.,1.]. Disabled by setting to None.

  • events_subsample_index (int >= 0, default: 0) – If fraction_events_to_keep is not None, determines which of the statistically independent sub-samples (uniquely determined by the seed below) to select.

  • seed (int, default: 123456) – If fraction_events_to_keep is not None, serves as random seed for generating reproducible sub-samples.

  • output_names (sequence of str, default: None) – Event categories to be recorded. If specified, needs to be a subset of names in events_file.

Notes

Looks for initial_weights fields in events file, which will serve as nominal weights for all events included. No fields named weights may already be present. Setting of calc_mode is not accepted.

apply_cuts_to_events()[source]

Just apply any cuts that the user defined

apply_function()[source]

Implement in services (subclasses of Stage)

load_events()[source]

Loads events from events file

record_event_properties()[source]

Adds fields present in events file and selected in self.data_dict into containers for the specified output names. Also ensures the presence of a set of nominal weights.

setup_function()[source]

Store event properties from events file at service initialisation. Cf. Stage docs.

pisa.stages.data.sqlite_loader module

A Stage to load data from an sqlite database

pisa.stages.data.sqlite_loader.init_test(**param_kwargs)[source]

Instantiation example

class pisa.stages.data.sqlite_loader.sqlite_loader(database, output_names, post_fix='_pred', **std_kwargs)[source]

Bases: Stage

SQLite loader class

Parameters:
  • database (path to sqlite database)

  • output_names (array_like) – List of output names (event types)

  • post_fix (str)

add_aeff_weight(container, truth, n_files)[source]
add_reco(container, reco)[source]

Adds reconstructed quantities to container

add_truth(container, truth, nubar, flavor)[source]

Adds truth to container

apply_function()[source]

Implement in services (subclasses of Stage)

get_pid_and_interaction_type(name)[source]

Sorry

initialize_weights(container)[source]
query_database(interaction_type, pid)[source]
setup_function()[source]

Implement in services (subclasses of Stage)

pisa.stages.data.toy_event_generator module

Stage to generate some random data

pisa.stages.data.toy_event_generator.init_test(**param_kwargs)[source]

Initialisation example

class pisa.stages.data.toy_event_generator.toy_event_generator(output_names, **std_kwargs)[source]

Bases: Stage

random toy event generator class

Parameters:
  • output_names (array_like) – List of output names (event types)

  • params (ParamSet) –

    Must have parameters:

    n_events : int
        Number of events to be generated per output name
    random
    seed : int
        Seed to be used for random
    

apply_function()[source]

Implement in services (subclasses of Stage)

setup_function()[source]

Implement in services (subclasses of Stage)

Module contents