pisa.stages.discr_sys package

Submodules

pisa.stages.discr_sys.hypersurfaces module

PISA pi stage to apply hypersurface fits from discrete systematics parameterizations

class pisa.stages.discr_sys.hypersurfaces.hypersurfaces(fit_results_file, propagate_uncertainty=False, interpolated=False, links=None, fluctuate=False, fluctuate_seed=12345, **std_kwargs)[source]

Bases: Stage

Service to apply hypersurface parameterisation produced by scripts.fit_discrete_sys_nd

Parameters:
  • fit_results_file (str) – Path to hypersurface fit results file, i.e. the JSON file produced by the pisa.scripts.fit_discrete_sys_nd.py script

  • propagate_uncertainty (bool, optional) – Propagate the uncertainties from the hypersurface to the uncertainty of the output

  • params (ParamSet) – Note that the params required to be in params are determined from those listed in the fit_results_file.

  • interpolated (bool) – If True, indicates that the hypersurfaces to be loaded are interpolated.

  • links (dict) – A dictionary defining how containers should be linked. Keys are the names of the merged containers, values are lists of containers being linked together. Keys must be a sub-set of the loaded hypersurfaces.

apply_function()[source]

Implement in services (subclasses of Stage)

compute_function()[source]

Implement in services (subclasses of Stage)

setup_function()[source]

Load the fit results from the file and make some check compatibility

pisa.stages.discr_sys.ultrasurfaces module

PISA stage to apply ultrasurface fits from discrete systematics parameterizations

pisa.stages.discr_sys.ultrasurfaces.get_us_grouping_from_container_name(name, groupings_set)[source]

Find the event grouping to which a given event type (of a container) belonged during the ultrasurface classification/fitting procedure. This function therefore connects this stage with those separate scripts. It assumes that groups of CC events have the naming format “numu_numubar_cc”, and that there is one grouping of all NC events (e.g. “nu_nc”, fine as long as it ends with “nc”).

Parameters:
  • name (str) – name of a single event type

  • groupings_set (set of str) – set of grouping names (assumes e.g. “numu_numubar_cc”)

Returns:

associated_grouping – the grouping among groupings_set which is found to contain the input event type name

Return type:

str

pisa.stages.discr_sys.ultrasurfaces.init_test(**param_kwargs)[source]

Instantiation example

class pisa.stages.discr_sys.ultrasurfaces.ultrasurfaces(fit_results_file, nominal_points, varnames=['pid', 'true_coszen', 'reco_coszen', 'true_energy', 'reco_energy'], event_grouping_key='event_category', approx_exponential=False, support=None, extrapolation='continue', distance_tol=0, **std_kwargs)[source]

Bases: Stage

Service to apply ultrasurface parameterisation stored in a feather file.

Parameters:
  • fit_results_file (str) – Path to .feather file containing all nominal events with gradients.

  • nominal_points (str or dict) – Dictionary (or str that can be evaluated thereto) of the form {‘parameter_name’: <nominal value>} containing the nominal value for each parameter that was used to fit the gradients with.

  • varnames (list of str) – List of variables to match the pisa events to the pre-fitted events.

  • event_grouping_key (str) – The name of the variable under which the name of the grouping for each pre-fitted event is found. If None, will not restrict gradient lookups to event groupings (allows reproducing the service’s original behavior).

  • approx_exponential (bool) – Approximate the exponential using exp(x) = 1 + x. This is appropriate when gradients have been fit with the purely linear hardmax activation function. (If you don’t know what that is, just leave it at False.)

  • support (str or dict) – Dictionary (or str that can be evaluated thereto) of the form {‘parameter_name’: (lower bound, upper bound)} containing the bounds of the parameter space inside which the gradients are valid. If a value outside of these bounds is requested, we have to extrapolate using the strategy defined in the extrapolation parameter.

  • extrapolation (str) – Strategy to use for extrapolating beyond the bounds set by the bounds option. Options are continue, linear and constant. If continue, polynomial features are simply extended at the risk of weights getting out of control. If linear, second order features are extrapolated using their derivative at the closest bound. If constant, the value at the closest boundary is returned.

  • distance_tol (float) – Numerical tolerance for distances to nearest neighbors above which a warning will be issued. Default is 0.

  • params (ParamSet) – Note that the params required to be in params are determined from those listed in the systematics.

apply_function()[source]

Implement in services (subclasses of Stage)

compute_function()[source]

Implement in services (subclasses of Stage)

setup_function()[source]

Load the fit results from the file and make some compatibility checks

Module contents