ui

This package defines the interface to the computational backend ComPWA. These bindings have been defined with pybind11.

Module contents

pycompwa module

class DataSet

Bases: pybind11_builtins.pybind11_object

property data
has_weights(self: DataSet) bool
property weights
class Estimator

Bases: pybind11_builtins.pybind11_object

class Event

Bases: pybind11_builtins.pybind11_object

property four_momenta
property weight
class EventCollection

Bases: pybind11_builtins.pybind11_object

property events
has_weights(self: EventCollection) bool
property pids
to_table(self: EventCollection) List[List[float]]
weights(self: EventCollection) List[float]
class EventList

Bases: pybind11_builtins.pybind11_object

append(self: EventList, x: Event) None

Add an item to the end of the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: pycompwa.ui.EventList, L: pycompwa.ui.EventList) -> None

Extend the list by appending all the items in the given list

  1. extend(self: pycompwa.ui.EventList, L: iterable) -> None

Extend the list by appending all the items in the given list

insert(self: EventList, i: int, x: Event) None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: pycompwa.ui.EventList) -> pycompwa.ui.Event

Remove and return the last item

  1. pop(self: pycompwa.ui.EventList, i: int) -> pycompwa.ui.Event

Remove and return the item at index i

class EvtGenGenerator

Bases: pycompwa.ui.PhaseSpaceEventGenerator

class FitFraction

Bases: pybind11_builtins.pybind11_object

property error
property name
property value
class FitParameter

Bases: pybind11_builtins.pybind11_object

property bounds
property error
property is_fixed
property name
property value
class FitParameterList

Bases: pybind11_builtins.pybind11_object

class FitResult

Bases: pybind11_builtins.pybind11_object

property covariance_matrix
property final_estimator_value
property final_parameters
property fit_duration_in_seconds
property initial_estimator_value
property initial_parameters
write(self: FitResult, filename: str) None

Write fit result to an xml file.

class FourMomentum

Bases: pybind11_builtins.pybind11_object

class FourMomentumList

Bases: pybind11_builtins.pybind11_object

__eq__(self: FourMomentumList, arg0: FourMomentumList) bool
append(self: FourMomentumList, x: FourMomentum) None

Add an item to the end of the list

count(self: FourMomentumList, x: FourMomentum) int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: pycompwa.ui.FourMomentumList, L: pycompwa.ui.FourMomentumList) -> None

Extend the list by appending all the items in the given list

  1. extend(self: pycompwa.ui.FourMomentumList, L: iterable) -> None

Extend the list by appending all the items in the given list

insert(self: FourMomentumList, i: int, x: FourMomentum) None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: pycompwa.ui.FourMomentumList) -> pycompwa.ui.FourMomentum

Remove and return the last item

  1. pop(self: pycompwa.ui.FourMomentumList, i: int) -> pycompwa.ui.FourMomentum

Remove and return the item at index i

remove(self: FourMomentumList, x: FourMomentum) None

Remove the first item from the list whose value is x. It is an error if there is no such item.

class FunctionTreeEstimator

Bases: pycompwa.ui.Estimator

print(self: FunctionTreeEstimator, arg0: int) str

print function tree

class FunctionTreeIntensity

Bases: pycompwa.ui.Intensity

evaluate(self: FunctionTreeIntensity, arg0: Dict[str, List[float]]) List[float]
print(self: FunctionTreeIntensity, arg0: int) str

print function tree

updateParametersFrom(self: FunctionTreeIntensity, arg0: List[FitParameter]) None
class HelicityKinematics

Bases: pycompwa.ui.Kinematics

convert(self: HelicityKinematics, Event: EventCollection) DataSet
create_all_subsystems(self: HelicityKinematics) None
get_particle_state_transition_kinematics_info(self: HelicityKinematics) ParticleStateTransitionKinematicsInfo
class Intensity

Bases: pybind11_builtins.pybind11_object

class IntensityBuilderXML

Bases: pybind11_builtins.pybind11_object

create_intensity(self: IntensityBuilderXML) FunctionTreeIntensity
create_intensity_components(self: IntensityBuilderXML, component_name_lists: List[List[str]]) List[Tuple[str, Intensity]]
get_all_component_names(self: IntensityBuilderXML) Dict[str, str]
class IntensityComponent

Bases: pybind11_builtins.pybind11_object

class Kinematics

Bases: pybind11_builtins.pybind11_object

convert(self: Kinematics, arg0: EventCollection) DataSet

Convert an EventCollection to a DataSet.

phsp_volume(self: Kinematics) float

Get phase space volume defined by the kinematics.

class Logging

Bases: pybind11_builtins.pybind11_object

property level
class MinuitIF

Bases: pycompwa.ui.Optimizer

optimize(self: MinuitIF, arg0: Estimator, arg1: List[FitParameter]) ComPWA::Optimizer::Minuit2::MinuitResult

Start minimization.

class MinuitResult

Bases: pycompwa.ui.FitResult

log(self: MinuitResult) None

Print fit result to the logging system.

write(self: MinuitResult, filename: str) None

Write Minuit2 fit result to an xml file.

class Optimizer

Bases: pybind11_builtins.pybind11_object

class ParticleList

Bases: pybind11_builtins.pybind11_object

name_to_pid(self: ParticleList, name: str) int

Convert a name to a PID as encoded in this ParticleList object

pid_to_name(self: ParticleList, pid: int) str

Convert a PID to a name as encoded in this ParticleList object

class ParticleStateTransitionKinematicsInfo

Bases: pybind11_builtins.pybind11_object

get_final_state_id_to_name_mapping(self: ParticleStateTransitionKinematicsInfo) Dict[int, str]

Get a dictionary for converting a final state ID to a name

class PhaseSpaceEventGenerator

Bases: pybind11_builtins.pybind11_object

class RootGenerator

Bases: pycompwa.ui.PhaseSpaceEventGenerator

class RootUniformRealGenerator

Bases: pycompwa.ui.UniformRealNumberGenerator

class StdUniformRealGenerator

Bases: pycompwa.ui.UniformRealNumberGenerator

class UniformRealNumberGenerator

Bases: pybind11_builtins.pybind11_object

add_intensity_weights(intensity: ComPWA::Function<std::vector<double, std::allocator<double> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<double, std::allocator<double> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<double, std::allocator<double> > > > > >, events: pycompwa.ui.EventCollection, kinematics: ComPWA::Kinematics) EventCollection

Add the intensity values as weights to this data sample.

compute_kinematic_variables(event_collection: EventCollection, xml_filename: str) DataSet

Directly convert an EventCollection to a DataSet using a model file. A Kinematics object is created from the XML file, so this is a façade to the HelicityKinematics class.

create_data_array(arg0: DataSet) Tuple[List[str], List[List[float]]]
create_fitresult_array(arg0: Intensity, arg1: DataSet) Tuple[List[str], List[List[float]]]
create_helicity_kinematics(*args, **kwargs)

Overloaded function.

  1. create_helicity_kinematics(xml_filename: str, particle_list: pycompwa.ui.ParticleList) -> pycompwa.ui.HelicityKinematics

Create a helicity kinematics object from an XML file. The file should contain a kinematics section.

  1. create_helicity_kinematics(xml_filename: str) -> pycompwa.ui.HelicityKinematics

Create a helicity kinematics object from an XML file. The file should contain a kinematics section and a particle section.

create_rootplotdata(filename: str, kinematics: pycompwa.ui.Kinematics, data_sample: pycompwa.ui.DataSet, phsp_sample: pycompwa.ui.DataSet = <pycompwa.ui.DataSet object at 0x7fa5f38111b0>, intensity: pycompwa.ui.Intensity = None, intensity_components: Dict[str, pycompwa.ui.Intensity] = {}, hit_and_miss_sample: pycompwa.ui.DataSet = <pycompwa.ui.DataSet object at 0x7fa5f3811170>, tfile_option: str = 'RECREATE') None
create_unbinned_log_likelihood_function_tree_estimator(intensity: FunctionTreeIntensity, datapoints: DataSet) Tuple[FunctionTreeEstimator, List[FitParameter]]
fit_fractions_with_propagated_errors(intensity_components: List[Tuple[Tuple[str, Intensity], Tuple[str, Intensity]]], sample: DataSet, fit_result: FitResult) List[FitFraction]

Calculates the fit fractions and errors for all given components.

fix_parameter(tree: boost::property_tree::basic_ptree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, parameter_name: str, value: float = -999) None

Fix parameters current value (to value) of a ptree by parameter name.

generate(*args, **kwargs)

Overloaded function.

  1. generate(size: int, kinematics: pycompwa.ui.Kinematics, phsp_generator: pycompwa.ui.PhaseSpaceEventGenerator, intensity: pycompwa.ui.Intensity, random_generator: pycompwa.ui.UniformRealNumberGenerator) -> pycompwa.ui.EventCollection

Generate sample from an Intensity

  1. generate(size: int, kinematics: pycompwa.ui.Kinematics, generator: pycompwa.ui.UniformRealNumberGenerator, intensity: pycompwa.ui.Intensity, phsp_sample: pycompwa.ui.EventCollection) -> pycompwa.ui.EventCollection

Generate sample from an Intensity, using a given phase space sample.

  1. generate(size: int, kinematics: pycompwa.ui.Kinematics, generator: pycompwa.ui.UniformRealNumberGenerator, intensity: pycompwa.ui.Intensity, phsp_sample: pycompwa.ui.EventCollection, toy_phsp_sample: pycompwa.ui.EventCollection = None) -> pycompwa.ui.EventCollection

Generate sample from an Intensity. In case that detector reconstruction and selection is considered in the phase space sample a second pure toy sample needs to be passed.

generate_importance_sampled_phsp(size: int, kinematics: Kinematics, generator: PhaseSpaceEventGenerator, intensity: Intensity, random_generator: UniformRealNumberGenerator) EventCollection

Generate an Intensity importance weighted phase space sample

generate_phsp(arg0: int, arg1: PhaseSpaceEventGenerator, arg2: UniformRealNumberGenerator) EventCollection

Generate phase space sample

get_final_state_id_to_name_mapping(xml_filename: str) Dict[int, str]

Directly get a final state ID to particle name mapping from an XML file.

initializeWithFitResult(intensity: Intensity, fit_result: FitResult) None

Initializes an Intensity with the parameters of a FitResult.

insert_particles(arg0: ParticleList, arg1: str) None

Insert particles to a list from a xml file. Already defined particles will be overwritten!

load(*args, **kwargs)

Overloaded function.

  1. load(filename: str) -> ComPWA::Optimizer::Minuit2::MinuitResult

Load a Minuit2 fit result from a file.

  1. load(filename: str) -> pycompwa.ui.FitResult

Load a fit result from a file.

log(*args, **kwargs)

Overloaded function.

  1. log(arg0: str) -> None

Write string to logging system.

  1. log(arg0: pycompwa.ui.FitParameter) -> None

  2. log(arg0: List[pycompwa.ui.FitParameter]) -> None

Print FitParameter list to logging system.

class log_redirect

Bases: pybind11_builtins.pybind11_object

read_ascii_data(input_file: str, number_of_events: int = - 1) EventCollection

Read ROOT tree from file to an EventList.

read_particles(xml_filename: str) ParticleList

Read particles from a xml file.

read_root_data(input_file: str, tree_name: str = 'events', number_of_events: int = - 1) EventCollection

Read ROOT tree from file to an EventList.

release_parameter(tree: boost::property_tree::basic_ptree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, parameter_name: str, value: float = -999) None

Release parameters’ value (to new value) of a ptree by parameter name.

update_parameter(*args, **kwargs)

Overloaded function.

  1. update_parameter(tree: boost::property_tree::basic_ptree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, key_type: str, key_value: str, value: float, fix: bool, min: float, max: float, update_value: bool, update_fix: bool, update_range: bool) -> None

Update parameters’ value, range, fix status, of a ptree.

  1. update_parameter(tree: boost::property_tree::basic_ptree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, fit_parameters: List[pycompwa.ui.FitParameter]) -> None

Update parameters according input FitParameters.

update_parameter_range_by_name(tree: boost::property_tree::basic_ptree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, parameter_name: str, min: float, max: float) None

Update parameters’ range of a ptree by parameter name.

update_parameter_range_by_type(tree: boost::property_tree::basic_ptree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, parameter_type: str, min: float, max: float) None

Update parameters’ range of a ptree by parameter type, e.g., Magnitude.

update_parameter_value(tree: boost::property_tree::basic_ptree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, parameter_name: str, value: float) None

Update parameters’ value of a ptree by parameter name.

write_ascii_data(event_list: EventCollection, output_file: str, overwrite: bool = True) None

Save data as ROOT tree to file.

write_root_data(event_list: EventCollection, output_file: str, tree_name: str = 'events', overwrite: bool = True) None

Save data as ROOT tree to file.