spine.post.base
Contains base class of all post-processors.
Classes
|
Base class of all post-processors. |
- class spine.post.base.PostBase(obj_type=None, run_mode=None, truth_point_mode=None, truth_dep_mode=None, pid_mode=None, parent_path=None)[source]
Base class of all post-processors.
- This base class performs the following functions:
Ensures that the necessary method exist
Checks that the post-processor is provided the necessary information to do its job
Fetches the appropriate coordinate attributes
Ensures that the appropriate units are provided
- name
Name of the post-processor as defined in the configuration file
- Type:
str
- aliases
Alternative acceptable names for a post-processor
- Type:
Tuple[str]
- Attributes:
dep_modesDictionary which makes the correspondance between the name of a true object deposition attribute with the underlying deposition array it points to.
keysDictionary of (key, necessity) pairs which determine which data keys are needed/optional for the post-processor to run.
- name
point_modesDictionary which makes the correspondance between the name of a true object point attribute with the underlying point tensor it points to.
source_modesDictionary which makes the correspondance between the name of a true object source attribute with the underlying source tensor it points to.
Methods
__call__(data[, entry])Calls the post processor on one entry.
check_units(obj)Check that the point coordinates of an object are as expected.
get_depositions(obj)Get a certain pre-defined deposition attribute of an object.
get_index(obj)Get a certain pre-defined index attribute of an object.
get_pid(obj)Get a certain pre-defined PID prediction of an object.
get_points(obj)Get a certain pre-defined point attribute of an object.
get_sources(obj)Get a certain pre-defined sources attribute of an object.
process(data)Place-holder method to be defined in each post-processor.
update_keys(update_dict)Update the underlying set of keys and their necessity in place.
update_upstream(key)Update the underlying set of required upstream modules in place.
- name = None
- aliases = ()
- units = 'cm'
- provide_parent_path = False
- property keys
Dictionary of (key, necessity) pairs which determine which data keys are needed/optional for the post-processor to run.
- Returns:
Dictionary of (key, necessity) pairs to be used
- Return type:
Dict[str, bool]
- property point_modes
Dictionary which makes the correspondance between the name of a true object point attribute with the underlying point tensor it points to.
- Returns:
Dictionary of (attribute, key) mapping for point coordinates
- Return type:
Dict[str, str]
- property source_modes
Dictionary which makes the correspondance between the name of a true object source attribute with the underlying source tensor it points to.
- Returns:
Dictionary of (attribute, key) mapping for point sources
- Return type:
Dict[str, str]
- property dep_modes
Dictionary which makes the correspondance between the name of a true object deposition attribute with the underlying deposition array it points to.
- Returns:
Dictionary of (attribute, key) mapping for point depositions
- Return type:
Dict[str, str]
- update_keys(update_dict)[source]
Update the underlying set of keys and their necessity in place.
- Parameters:
update_dict (Dict[str, bool]) – Dictionary of (key, necessity) pairs to update the keys with
- update_upstream(key)[source]
Update the underlying set of required upstream modules in place.
- Parameters:
key (str) – Post-processor module name to add to the list
- get_index(obj)[source]
Get a certain pre-defined index attribute of an object.
The
TruthFragment,TruthParticleandTruthInteractionobjects index are obtained using the truth_index_mode attribute of the class.- Parameters:
obj (Union[FragmentBase, ParticleBase, InteractionBase]) – Fragment, Particle or Interaction object
Results
-------
np.ndarray –
Object index
- get_points(obj)[source]
Get a certain pre-defined point attribute of an object.
The
TruthFragment,TruthParticleandTruthInteractionobjects points are obtained using the truth_point_mode attribute of the class.- Parameters:
obj (Union[FragmentBase, ParticleBase, InteractionBase]) – Fragment, Particle or Interaction object
Results
-------
np.ndarray – (N, 3) Point coordinates
- get_sources(obj)[source]
Get a certain pre-defined sources attribute of an object.
The
TruthFragment,TruthParticleandTruthInteractionobjects sources are obtained using the truth_source_mode attribute of the class.- Parameters:
obj (Union[FragmentBase, ParticleBase, InteractionBase]) – Fragment, Particle or Interaction object
Results
-------
np.ndarray – (N, 2) Object sources
- get_depositions(obj)[source]
Get a certain pre-defined deposition attribute of an object.
The
TruthFragment,TruthParticleandTruthInteractionobjects points are obtained using the truth_dep_mode attribute of the class.- Parameters:
obj (Union[FragmentBase, ParticleBase, InteractionBase]) – Fragment, Particle or Interaction object
Results
-------
np.ndarray –
Depositions
- get_pid(obj)[source]
Get a certain pre-defined PID prediction of an object.
The
TruthParticlePID predictions are obtained using the pid_mode attribute of the class.- Parameters:
obj (Union[ParticleBase]) – Particle object
Results
-------
int – Particle identification enumerator