pwassist.core.result.Results#

class pwassist.core.result.Results(fit, data, correlation=None, covariance=None, norm_int=None, bootstrap=None, randomized=None, kinematic_bins=<factory>, reports=<factory>, final_state_parity=None, git_commit_hash=<factory>, are_reactions_constrained=False, are_sums_constrained=False, _naming_scheme=None)[source]#

Bases: object

Assembled, preprocessed, analysis-ready results from a collection of PWA bins.

Todo

  • Add examples and lots of documentation, as this is the main user-facing class

Parameters:
  • fit (DataFrame)

  • data (DataFrame)

  • correlation (DataFrame | None)

  • covariance (DataFrame | None)

  • norm_int (DataFrame | None)

  • bootstrap (DataFrame | None)

  • randomized (DataFrame | None)

  • kinematic_bins (list[KinematicBin])

  • reports (list[PreprocessReport])

  • final_state_parity (int | None)

  • git_commit_hash (str | None)

  • are_reactions_constrained (bool)

  • are_sums_constrained (bool)

  • _naming_scheme (str | None | NamingScheme)

amplitudes: tuple[str, ...]#
are_reactions_constrained: bool = False#
are_sums_constrained: bool = False#
bootstrap: DataFrame | None = None#
coherent_sums: dict[str, tuple[str, ...]]#
correlation: DataFrame | None = None#
covariance: DataFrame | None = None#
data: DataFrame#
energy_kinematic_bins(t_bin, mass_bin)[source]#

List of energy bins, optionally filtered by t and/or mass bins.

Parameters:
  • t_bin (tuple[float, float] | TBin | None) – Low and high edges of the t bin to select, or a TBin instance. Only needs specification if the results span multiple t bins. If None, the sole available t bin will be used.

  • mass_bin (tuple[float, float] | MassBin | None) – Low and high edges of the mass bin to select, or a MassBin instance. Only needs specification if the results span multiple mass bins. If None, the sole available mass bin will be used.

Returns:

List of energy bins that match the specified t and mass

bins.

Return type:

list[KinematicBin]

Raises:
  • KeyError – If no kinematic bins match the specified t and mass bins, or if the results are ambiguous.

  • ValueError – If multiple t or mass bins are present and none is specified, making the energy bin selection ambiguous.

filter_by_kinematic_bins(kinematic_bins=None, t_bins=None, energy_bins=None, mass_bins=None)[source]#

Return a new Results instance filtered by the specified kinematic bins.

Parameters:
  • kinematic_bins (KinematicBin | list[KinematicBin] | None) – List of KinematicBin instances to filter by. If specified, t_bins, energy_bins, and mass_bins will be ignored.

  • ( (mass_bins) – tuple[float, float] | TBin | list[tuple[float, float]] | list[TBin] | None): List of requested t bins, either as (low, high) tuples or TBin instances.

  • ( – tuple[float, float] | EnergyBin | list[tuple[float, float]] | list[EnergyBin] | None): List of requested energy bins, either as (low, high) tuples or EnergyBin instances.

  • ( – tuple[float, float] | MassBin | list[tuple[float, float]] | list[MassBin] | None): List of requested mass bins, either as (low, high) tuples or MassBin instances.

  • t_bins (tuple[float, float] | TBin | list[tuple[float, float]] | list[TBin] | None)

  • energy_bins (tuple[float, float] | EnergyBin | list[tuple[float, float]] | list[EnergyBin] | None)

  • mass_bins (tuple[float, float] | MassBin | list[tuple[float, float]] | list[MassBin] | None)

Return type:

Results

final_state_parity: int | None = None#
find_phase(amp1, amp2)[source]#

Find the phase difference column name for a given pair of amplitudes.

Parameters:
  • amp1 (str) – Name of the first amplitude.

  • amp2 (str) – Name of the second amplitude.

Returns:

The name of the phase difference column, or None if not found.

Return type:

str | None

fit: DataFrame#
classmethod from_processed_bins(processed_bins, naming_scheme=None, final_state_parity=None)[source]#

Construct a Results instance from a list of ProcessedBin objects.

Return type:

Results

Parameters:
static get_plot_style_name()[source]#

Get the current global matplotlib style name used by all plotters.

Return type:

str

static get_plot_style_path()[source]#

Get the current global matplotlib style path used by all plotters.

Return type:

Path

get_uncertainty(label, kinematic_bins=None)[source]#

Get the uncertainty for a given label

Parameters:
  • label (str) – column in fit result get calculate uncertainty for.

  • kinematic_bins (list[KinematicBin] | None) – Optional list of kinematic bins to narrow down to. Defaults to None.

Raises:

KeyError – If ‘label’ is found in neither the bootstrap dataframe or as a ‘<label>_err’ column in the fit dataframe.

Returns:

Standard deviations of bootstrap samples (if exists), or

’<label>_err’ column.

Return type:

Series

git_commit_hash: str | None#
is_acc_corrected: bool#
kinematic_bins: list[KinematicBin]#
classmethod load(filepath)[source]#

Load a Results instance from a pickle file.

Return type:

Results

Parameters:

filepath (str | Path)

mass_kinematic_bins(t_bin, energy_bin)[source]#

List of mass bins, optionally filtered by t and/or energy bins.

Parameters:
  • t_bin (tuple[float, float] | TBin | None) – Low and high edges of the t bin to select, or a TBin instance. Only needs specification if the results span multiple t bins. If None, the sole available t bin will be used.

  • energy_bin (tuple[float, float] | EnergyBin | None) – Low and high edges of the energy bin to select, or an EnergyBin instance. Only needs specification if the results span multiple energy bins. If None, the sole available energy bin will be used.

Returns:

List of mass bins that match the specified t and energy

bins.

Return type:

list[KinematicBin]

Raises:
  • KeyError – If no kinematic bins match the specified t and energy bins, or if the results are ambiguous.

  • ValueError – If multiple t or energy bins are present and none is specified, making the mass bin selection ambiguous.

norm_int: DataFrame | None = None#
parser: AmplitudeParser#
phase_differences: tuple[str, ...]#
property plot: FactoryPlotter#

Return a FactoryPlotter instance for plotting the results.

preprocess_summary()[source]#

Print a summary of the preprocessing reports.

Return type:

None

randomized: DataFrame | None = None#
reports: list[PreprocessReport]#
save(filepath)[source]#

Save the Results instance to a pickle file.

Return type:

None

Parameters:

filepath (str | Path)

static set_plot_style(style)[source]#

Set the global matplotlib style used by all plotters.

Return type:

None

Parameters:

style (str | Path)

summary()[source]#

Print a summary of the Results instance and its preprocessor warnings.

Return type:

None

t_kinematic_bins(energy_bin=None, mass_bin=None)[source]#

List of t bins, optionally filtered by mass and/or energy bins.

Parameters:
  • mass_bin (tuple[float, float] | MassBin | None) – Low and high edges of the mass bin to select, or a MassBin instance. Only needs specification if the results span multiple mass bins. If None, the sole available mass bin will be used.

  • energy_bin (tuple[float, float] | EnergyBin | None) – Low and high edges of the energy bin to select, or an EnergyBin instance. Only needs specification if the results span multiple energy bins. If None, the sole available energy bin will be used.

Returns:

List of t bins that match the specified mass and energy

bins.

Return type:

list[KinematicBin]

Raises:
  • KeyError – If no kinematic bins match the specified mass and energy bins, or

  • if the results are ambiguous. –

  • ValueError – If multiple mass or energy bins are present and none is specified, making the mass bin selection ambiguous.

unique_energy_bins: frozenset[EnergyBin]#
unique_mass_bins: frozenset[MassBin]#
unique_t_bins: frozenset[TBin]#
warnings()[source]#

Print a summary of all warnings from the preprocessing reports.

Return type:

None