Cut x range according to values define in param_dict. Parameters ---------- data : array raw spectrum low : float low bound in KeV high : float high bound in KeV a0 : float offset term of energy calibration a1 : float linear t
(data, low, high, a0, a1)
| 1245 | |
| 1246 | |
| 1247 | def define_range(data, low, high, a0, a1): |
| 1248 | """ |
| 1249 | Cut x range according to values define in param_dict. |
| 1250 | |
| 1251 | Parameters |
| 1252 | ---------- |
| 1253 | data : array |
| 1254 | raw spectrum |
| 1255 | low : float |
| 1256 | low bound in KeV |
| 1257 | high : float |
| 1258 | high bound in KeV |
| 1259 | a0 : float |
| 1260 | offset term of energy calibration |
| 1261 | a1 : float |
| 1262 | linear term of energy calibration |
| 1263 | |
| 1264 | Returns |
| 1265 | ------- |
| 1266 | x : array |
| 1267 | trimmed channel number |
| 1268 | y : array |
| 1269 | trimmed spectrum according to x |
| 1270 | """ |
| 1271 | x = np.arange(data.size) |
| 1272 | |
| 1273 | # ratio to transfer energy value back to channel value |
| 1274 | # approx_ratio = 100 |
| 1275 | |
| 1276 | low_new = int(np.around((low - a0) / a1)) |
| 1277 | high_new = int(np.around((high - a0) / a1)) |
| 1278 | x0, y0 = trim(x, data, low_new, high_new) |
| 1279 | return x0, y0 |
| 1280 | |
| 1281 | |
| 1282 | def calculate_profile(x, y, param, elemental_lines, default_area=1e5): |
no outgoing calls
no test coverage detected