MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / update_peak_ratio

Method update_peak_ratio

pyxrf/model/parameters.py:158–172  ·  view source on GitHub ↗

If 'maxv' is modified, then the values of 'area' and 'spectrum' are adjusted accordingly: (1) maximum of spectrum is set equal to 'maxv'; (2) 'area' is scaled proportionally. It is important that only 'maxv' is changed before this function is called.

(self)

Source from the content-addressed store, hash-verified

156 return current_elements
157
158 def update_peak_ratio(self):
159 """
160 If 'maxv' is modified, then the values of 'area' and 'spectrum' are adjusted accordingly:
161 (1) maximum of spectrum is set equal to 'maxv'; (2) 'area' is scaled proportionally.
162 It is important that only 'maxv' is changed before this function is called.
163 """
164 for v in self.element_dict.values():
165 max_spectrum = np.max(v.spectrum)
166 if not math.isclose(max_spectrum, 0.0, abs_tol=1e-20):
167 factor = v.maxv / max_spectrum
168 else:
169 factor = 0.0
170 v.spectrum *= factor
171 v.area *= factor
172 self.update_norm()
173
174 def turn_on_all(self, option=True):
175 """

Callers 6

remove_peak_manualMethod · 0.80
_manual_inputMethod · 0.80
modify_peak_heightMethod · 0.80
apply_to_fitMethod · 0.80

Calls 2

update_normMethod · 0.95
valuesMethod · 0.80

Tested by

no test coverage detected