Belle II Software development
SaveClassificationAnalysisRefiner Class Reference
Inheritance diagram for SaveClassificationAnalysisRefiner:
Refiner

Public Member Functions

 __init__ (self, part_name=None, contact=None, estimate_name=None, truth_name=None, cut_direction=None, cut=None, lower_bound=None, upper_bound=None, outlier_z_score=None, allow_discrete=False, unit=None)
 
 refine (self, harvesting_module, crops, tdirectory=None, groupby_part_name=None, groupby_value=None, **kwds)
 
 __get__ (self, harvesting_module, cls=None)
 
 __call__ (self, harvesting_module, crops=None, *args, **kwds)
 

Public Attributes

 part_name = part_name
 cached part name for this truth-classification analysis
 
 contact = contact
 cached contact person for this truth-classification analysis
 
 estimate_name = estimate_name
 cached estimates-collection name for this truth-classification analysis
 
 truth_name = truth_name
 cached truth-values-collection name for this truth-classification analysis
 
 cut = cut
 cached threshold of estimates for this truth-classification analysis
 
 cut_direction = cut_direction
 cached cut direction (> or <) of estimates for this truth-classification analysis
 
 lower_bound = lower_bound
 cached lower bound of estimates for this truth-classification analysis
 
 upper_bound = upper_bound
 cached upper bound of estimates for this truth-classification analysis
 
 outlier_z_score = outlier_z_score
 cached Z-score (for outlier detection) of estimates for this truth-classification analysis
 
 allow_discrete = allow_discrete
 cached discrete-value flag of estimates for this truth-classification analysis
 
 unit = unit
 cached measurement unit of estimates for this truth-classification analysis
 
 refiner_function = refiner_function
 cached copy of the instance's refiner function
 

Static Public Attributes

str default_contact = "{module.contact}"
 default contact person for this truth-classification analysis
 
str default_truth_name = "{part_name}_truth"
 default name for the truth-classification analysis truth-values collection
 
str default_estimate_name = "{part_name}_estimate"
 default name for the truth-classification analysis estimates collection
 

Detailed Description

Refiner for truth-classification analyses

Definition at line 549 of file refiners.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
part_name = None,
contact = None,
estimate_name = None,
truth_name = None,
cut_direction = None,
cut = None,
lower_bound = None,
upper_bound = None,
outlier_z_score = None,
allow_discrete = False,
unit = None )
Constructor for this refiner

Definition at line 560 of file refiners.py.

571 unit=None):
572 """Constructor for this refiner"""
573
574 ## cached part name for this truth-classification analysis
575 self.part_name = part_name
576 ## cached contact person for this truth-classification analysis
577 self.contact = contact
578 ## cached estimates-collection name for this truth-classification analysis
579 self.estimate_name = estimate_name
580 ## cached truth-values-collection name for this truth-classification analysis
581 self.truth_name = truth_name
582
583 ## cached threshold of estimates for this truth-classification analysis
584 self.cut = cut
585 ## cached cut direction (> or <) of estimates for this truth-classification analysis
586 self.cut_direction = cut_direction
587
588 ## cached lower bound of estimates for this truth-classification analysis
589 self.lower_bound = lower_bound
590 ## cached upper bound of estimates for this truth-classification analysis
591 self.upper_bound = upper_bound
592 ## cached Z-score (for outlier detection) of estimates for this truth-classification analysis
593 self.outlier_z_score = outlier_z_score
594 ## cached discrete-value flag of estimates for this truth-classification analysis
595 self.allow_discrete = allow_discrete
596 ## cached measurement unit of estimates for this truth-classification analysis
597 self.unit = unit
598

Member Function Documentation

◆ __call__()

__call__ ( self,
harvesting_module,
crops = None,
* args,
** kwds )
inherited
implementation of the function-call of the Refiner instance
     r = Refiner()
     r(harvester) # decoration
     r(harvester, crops, args, keywords) # refinement

Definition at line 55 of file refiners.py.

55 def __call__(self, harvesting_module, crops=None, *args, **kwds):
56 """implementation of the function-call of the Refiner instance
57 r = Refiner()
58 r(harvester) # decoration
59 r(harvester, crops, args, keywords) # refinement
60 """
61 if crops is None:
62 # Decoration mode
63 harvesting_module.refiners.append(self)
64 return harvesting_module
65 else:
66 # Refining mode
67 return self.refine(harvesting_module, crops, *args, **kwds)
68

◆ __get__()

__get__ ( self,
harvesting_module,
cls = None )
inherited
Getter of the Refiner instance

Definition at line 42 of file refiners.py.

42 def __get__(self, harvesting_module, cls=None):
43 """Getter of the Refiner instance"""
44 if harvesting_module is None:
45 # Class access
46 return self
47 else:
48 # Instance access
49 refine = self.refine
50
51 def bound_call(*args, **kwds):
52 return refine(harvesting_module, *args, **kwds)
53 return bound_call
54

◆ refine()

refine ( self,
harvesting_module,
crops,
tdirectory = None,
groupby_part_name = None,
groupby_value = None,
** kwds )
Process the truth-classification analysis

Reimplemented from Refiner.

Definition at line 599 of file refiners.py.

605 **kwds):
606 """Process the truth-classification analysis"""
607
608 replacement_dict = dict(
609 refiner=self,
610 module=harvesting_module,
611 groupby_key='_' + groupby_part_name + groupby_value if groupby_part_name else "",
612 groupby=groupby_part_name, # deprecated
613 groupby_value=groupby_value, # deprecated
614 )
615
616 contact = self.contact or self.default_contact
617 contact = formatter.format(contact, **replacement_dict)
618
619 if self.truth_name is not None:
620 truth_name = self.truth_name
621 else:
622 truth_name = self.default_truth_name
623
624 truth_name = formatter.format(truth_name, part_name=self.part_name)
625 truths = crops[truth_name]
626
627 if self.estimate_name is not None:
628 estimate_name = self.estimate_name
629 else:
630 estimate_name = self.default_estimate_name
631
632 if isinstance(estimate_name, str):
633 estimate_names = [estimate_name, ]
634 else:
635 estimate_names = estimate_name
636
637 for estimate_name in estimate_names:
638 estimate_name = formatter.format(estimate_name, part_name=self.part_name)
639 estimates = crops[estimate_name]
640
641 classification_analysis = ClassificationAnalysis(quantity_name=estimate_name,
642 contact=contact,
643 cut_direction=self.cut_direction,
644 cut=self.cut,
645 lower_bound=self.lower_bound,
646 upper_bound=self.upper_bound,
647 outlier_z_score=self.outlier_z_score,
648 allow_discrete=self.allow_discrete,
649 unit=self.unit)
650
651 classification_analysis.analyse(estimates, truths)
652
653 if tdirectory:
654 classification_analysis.write(tdirectory)
655
656

Member Data Documentation

◆ allow_discrete

allow_discrete = allow_discrete

cached discrete-value flag of estimates for this truth-classification analysis

Definition at line 595 of file refiners.py.

◆ contact

contact = contact

cached contact person for this truth-classification analysis

Definition at line 577 of file refiners.py.

◆ cut

cut = cut

cached threshold of estimates for this truth-classification analysis

Definition at line 584 of file refiners.py.

◆ cut_direction

cut_direction = cut_direction

cached cut direction (> or <) of estimates for this truth-classification analysis

Definition at line 586 of file refiners.py.

◆ default_contact

str default_contact = "{module.contact}"
static

default contact person for this truth-classification analysis

Definition at line 553 of file refiners.py.

◆ default_estimate_name

str default_estimate_name = "{part_name}_estimate"
static

default name for the truth-classification analysis estimates collection

Definition at line 558 of file refiners.py.

◆ default_truth_name

str default_truth_name = "{part_name}_truth"
static

default name for the truth-classification analysis truth-values collection

Definition at line 556 of file refiners.py.

◆ estimate_name

estimate_name = estimate_name

cached estimates-collection name for this truth-classification analysis

Definition at line 579 of file refiners.py.

◆ lower_bound

lower_bound = lower_bound

cached lower bound of estimates for this truth-classification analysis

Definition at line 589 of file refiners.py.

◆ outlier_z_score

outlier_z_score = outlier_z_score

cached Z-score (for outlier detection) of estimates for this truth-classification analysis

Definition at line 593 of file refiners.py.

◆ part_name

part_name = part_name

cached part name for this truth-classification analysis

Definition at line 575 of file refiners.py.

◆ refiner_function

refiner_function = refiner_function
inherited

cached copy of the instance's refiner function

Definition at line 40 of file refiners.py.

◆ truth_name

truth_name = truth_name

cached truth-values-collection name for this truth-classification analysis

Definition at line 581 of file refiners.py.

◆ unit

unit = unit

cached measurement unit of estimates for this truth-classification analysis

Definition at line 597 of file refiners.py.

◆ upper_bound

upper_bound = upper_bound

cached upper bound of estimates for this truth-classification analysis

Definition at line 591 of file refiners.py.


The documentation for this class was generated from the following file: