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

Function trim_escape_peak

pyxrf/model/parameters.py:1337–1369  ·  view source on GitHub ↗

Calculate escape peak within required range. Parameters ---------- data : array raw spectrum param_dict : dict parameters for fitting y_size : int the size of trimmed spectrum Returns ------- array : trimmed escape peak spectrum

(data, param_dict, y_size)

Source from the content-addressed store, hash-verified

1335
1336
1337def trim_escape_peak(data, param_dict, y_size):
1338 """
1339 Calculate escape peak within required range.
1340
1341 Parameters
1342 ----------
1343 data : array
1344 raw spectrum
1345 param_dict : dict
1346 parameters for fitting
1347 y_size : int
1348 the size of trimmed spectrum
1349
1350 Returns
1351 -------
1352 array :
1353 trimmed escape peak spectrum
1354 """
1355 ratio = param_dict["non_fitting_values"]["escape_ratio"]
1356 xe, ye = compute_escape_peak(data, ratio, param_dict)
1357 lowv = param_dict["non_fitting_values"]["energy_bound_low"]["value"]
1358 highv = param_dict["non_fitting_values"]["energy_bound_high"]["value"]
1359 xe, es_peak = trim(xe, ye, lowv, highv)
1360 logger.info("Escape peak is considered with ratio {}".format(ratio))
1361
1362 # align to the same length
1363 if y_size > es_peak.size:
1364 temp = es_peak
1365 es_peak = np.zeros(y_size)
1366 es_peak[: temp.size] = temp
1367 else:
1368 es_peak = es_peak[:y_size]
1369 return es_peak
1370
1371
1372def create_full_dict(param, name_list, fixed_list=["adjust_element2", "adjust_element3"]):

Callers 3

get_profileMethod · 0.85
fit_multipleMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected