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

Public Member Functions

def __init__ (self, name=None, title=None, contact=None, description=None, check=None, key=None, aggregation=None)
 
def refine (self, harvesting_module, crops, tdirectory=None, groupby_part_name=None, groupby_value=None, **kwds)
 

Static Public Member Functions

def mean (xs)
 return the mean of the parts, ignoring NaNs
 

Public Attributes

 name
 cached name of the figure of merit
 
 title
 cached title of the figure of merit
 
 description
 cached description of the figure of merit
 
 check
 cached user-check action of the figure of merit
 
 contact
 cached contact person of the figure of merit
 
 key
 cached copy of the figures-of-merit key
 
 aggregation
 cached copy of the crops-aggregation method
 

Static Public Attributes

str default_name = "{module.id}_figures_of_merit{groupby_key}"
 default name for this refiner
 
str default_title = "Figures of merit in {module.title}"
 default title for this refiner
 
str default_contact = "{module.contact}"
 default contact person for this refiner
 
str default_description = "Figures of merit are the {aggregation.__name__} of {keys}"
 default description for this refiner
 
str default_check = "Check for reasonable values"
 default user-check action for this refiner
 
str default_key = "{aggregation.__name__}_{part_name}"
 default key name for this refiner
 
def default_aggregation = mean
 default aggregation is the mean of the parts
 

Detailed Description

Refiner for figures of merit

Definition at line 74 of file refiners.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name = None,
  title = None,
  contact = None,
  description = None,
  check = None,
  key = None,
  aggregation = None 
)
Constructor for this refiner

Reimplemented from Refiner.

Definition at line 97 of file refiners.py.

105 ):
106 """Constructor for this refiner"""
107
108 super().__init__()
109
110
111 self.name = name
112
113 self.title = title
114
115
116 self.description = description
117
118 self.check = check
119
120 self.contact = contact
121
122
123 self.key = key
124
125 self.aggregation = aggregation
126

Member Function Documentation

◆ mean()

def mean (   xs)
static

return the mean of the parts, ignoring NaNs

Definition at line 91 of file refiners.py.

91 def mean(xs):
92 return np.nanmean(xs)
93

◆ refine()

def refine (   self,
  harvesting_module,
  crops,
  tdirectory = None,
  groupby_part_name = None,
  groupby_value = None,
**  kwds 
)
Process the figures of merit

Reimplemented from Refiner.

Definition at line 127 of file refiners.py.

133 **kwds):
134 """Process the figures of merit"""
135
136 name = self.name or self.default_name
137 title = self.title or self.default_title
138 contact = self.contact or self.default_contact
139 description = self.description or self.default_description
140 check = self.check or self.default_check
141
142 aggregation = self.aggregation or self.default_aggregation
143
144 replacement_dict = dict(
145 refiner=self,
146 module=harvesting_module,
147 aggregation=aggregation,
148 groupby_key='_' + groupby_part_name + groupby_value if groupby_part_name else "",
149 groupby=groupby_part_name, # deprecated
150 groupby_value=groupby_value, # deprecated
151 )
152
153 name = formatter.format(name, **replacement_dict)
154 title = formatter.format(title, **replacement_dict)
155 contact = formatter.format(contact, **replacement_dict)
156
157 figures_of_merit = ValidationFiguresOfMerit(name,
158 contact=contact,
159 title=title)
160
161 for part_name, parts in iter_items_sorted_for_key(crops):
162 key = self.key or self.default_key
163 key = formatter.format(key, part_name=part_name, **replacement_dict)
164 figures_of_merit[key] = aggregation(parts)
165
166 keys = list(figures_of_merit.keys())
167
168 description = formatter.format(description, keys=keys, **replacement_dict)
169 check = formatter.format(check, keys=keys, **replacement_dict)
170
171 figures_of_merit.description = description
172 figures_of_merit.check = check
173
174 if tdirectory:
175 figures_of_merit.write(tdirectory)
176
177 print(figures_of_merit)
178
179

Member Data Documentation

◆ aggregation

aggregation

cached copy of the crops-aggregation method

Definition at line 125 of file refiners.py.

◆ check

check

cached user-check action of the figure of merit

Definition at line 118 of file refiners.py.

◆ contact

contact

cached contact person of the figure of merit

Definition at line 120 of file refiners.py.

◆ default_aggregation

def default_aggregation = mean
static

default aggregation is the mean of the parts

Definition at line 95 of file refiners.py.

◆ default_check

str default_check = "Check for reasonable values"
static

default user-check action for this refiner

Definition at line 85 of file refiners.py.

◆ default_contact

str default_contact = "{module.contact}"
static

default contact person for this refiner

Definition at line 81 of file refiners.py.

◆ default_description

str default_description = "Figures of merit are the {aggregation.__name__} of {keys}"
static

default description for this refiner

Definition at line 83 of file refiners.py.

◆ default_key

str default_key = "{aggregation.__name__}_{part_name}"
static

default key name for this refiner

Definition at line 87 of file refiners.py.

◆ default_name

str default_name = "{module.id}_figures_of_merit{groupby_key}"
static

default name for this refiner

Definition at line 77 of file refiners.py.

◆ default_title

str default_title = "Figures of merit in {module.title}"
static

default title for this refiner

Definition at line 79 of file refiners.py.

◆ description

description

cached description of the figure of merit

Definition at line 116 of file refiners.py.

◆ key

key

cached copy of the figures-of-merit key

Definition at line 123 of file refiners.py.

◆ name

name

cached name of the figure of merit

Definition at line 111 of file refiners.py.

◆ title

title

cached title of the figure of merit

Definition at line 113 of file refiners.py.


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