naming

Deprecated since version 0.1.3: Use QRules, AmpForm, and TensorWaves instead.

import pycompwa.data.naming

Tools for naming and renaming column names of a pandas.DataFrame.

The DataFrame has to be formatted according to the conventions set by the PwaAccessor. Also contains tools for inverting dict objects.

flip_dict(mapping: dict) dict[source]

Flip a Python dict by collecting duplicate values in a list.

id_to_particle(frame: DataFrame, model: str, make_unique: bool = False) DataFrame[source]

Rename columns from final state IDs to particle names.

invert_dict(mapping: dict) dict[source]

Invert a dict by appending an index to duplicate values.

make_values_unique(values: list) list[source]

Append indices to duplicate entries in a list.

name_to_pid(frame: DataFrame, particle_list) DataFrame[source]

Rename PIDs to their corresponding particle names.

particle_to_id(frame: DataFrame, model: str) DataFrame[source]

Rename particles into their final state IDs.

pid_to_name(frame: DataFrame, particle_list) DataFrame[source]

Rename particle names to their corresponding PID.

replace_ids(string: str, model: str)[source]

Replace all IDs in a string by particle names.

Only whole words are replaced, so the final state IDs have to be separated by word boundaries or underscores.