spine.construct.fragment.FragmentBuilder
- class spine.construct.fragment.FragmentBuilder(mode: Literal['reco', 'truth', 'both', 'all'], units: Literal['cm', 'px'])[source]
Builds reconstructed and truth fragments.
It takes the raw output of the reconstruction chain, extracts the necessary information and builds
RecoFragmentandTruthFragmentobjects from it.Methods
__call__(data)Build representations for a batch of data.
build_reco(data)Builds
RecoFragmentobjects from the full chain output.build_truth(data)Builds
TruthFragmentobjects from the full chain output.check_units(data, key[, entry])Checks that the objects in the list are expressed in the appropriate units.
construct(func, data[, entry])Prepares the input based on the required data and runs constructor.
load_reco(data)Load
RecoFragmentobjects from their stored versions.load_truth(data)Load
TruthFragmentobjects from their stored versions.process(data, mode[, entry])Build representations for a single entry.
- __init__(mode: Literal['reco', 'truth', 'both', 'all'], units: Literal['cm', 'px']) None
Initializes the builder.
- Parameters:
mode (str, default 'both') – Whether to construct reconstructed objects, true objects or both (one of ‘reco’, ‘truth’, ‘both’ or ‘all’)
units (str, default 'cm') – Units in which the position arguments of the constructed objects should be expressed (one of ‘cm’ or ‘px’)
Methods
__init__(mode, units)Initializes the builder.
build_reco(data)Builds
RecoFragmentobjects from the full chain output.build_truth(data)Builds
TruthFragmentobjects from the full chain output.check_units(data, key[, entry])Checks that the objects in the list are expressed in the appropriate units.
construct(func, data[, entry])Prepares the input based on the required data and runs constructor.
load_reco(data)Load
RecoFragmentobjects from their stored versions.load_truth(data)Load
TruthFragmentobjects from their stored versions.process(data, mode[, entry])Build representations for a single entry.
Attributes
- name: ClassVar[str | None] = 'fragment'
- build_reco(data: dict[str, Any]) list[RecoFragment][source]
Builds
RecoFragmentobjects from the full chain output.- Parameters:
data (dict) – Dictionary of data products
- Returns:
List of constructed reconstructed fragment instances
- Return type:
List[RecoFragment]
- build_truth(data: dict[str, Any]) list[TruthFragment][source]
Builds
TruthFragmentobjects from the full chain output.- Parameters:
data (dict) – Dictionary of data products
- Returns:
List of constructed true fragment instances
- Return type:
List[TruthFragment]
- load_reco(data: dict[str, Any]) list[RecoFragment][source]
Load
RecoFragmentobjects from their stored versions.- Parameters:
data (dict) – Dictionary of data products
- Returns:
List of restored reconstructed fragment instances
- Return type:
List[RecoFragment]
- load_truth(data: dict[str, Any]) list[TruthFragment][source]
Load
TruthFragmentobjects from their stored versions.- Parameters:
data (dict) – Dictionary of data products
- Returns:
List of restored true fragment instances
- Return type:
List[TruthFragment]