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
pisa.stages.data.csv_icc_hist module¶
A Stage to load data from a CSV datarelease format file into a ContainerSet
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:
StageCSV 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.
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:
StageCreate a grid of events
- Parameters:
grid_binning (
MultiDimBinning) – Binning object defining the grid to be generatedentity (str) – entity arg to be passed to
meshgrid()output_names (array_like) – List of output names (event types)
pisa.stages.data.licloader_weighter module¶
pisa.stages.data.meows_loader module¶
A class to load in the MEOWS hdf5 files
pisa.stages.data.simple_data_loader module¶
A Stage to load data from a PISA style hdf5 file into a ContainerSet
- 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:
StageHDF5 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.
pisa.stages.data.sqlite_loader module¶
A Stage to load data from an sqlite database
pisa.stages.data.toy_event_generator module¶
Stage to generate some random data
- class pisa.stages.data.toy_event_generator.toy_event_generator(output_names, **std_kwargs)[source]¶
Bases:
Stagerandom 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