correct baseline and slopes for calibration measurements at high DSC rates
This commit is contained in:
parent
a72e4ba833
commit
a964e02612
@ -5,6 +5,7 @@ import re
|
||||
from collections import namedtuple
|
||||
|
||||
import numpy as np
|
||||
|
||||
try:
|
||||
from scipy.integrate import simpson
|
||||
except ImportError:
|
||||
@ -193,19 +194,24 @@ class DSCCalibrator:
|
||||
|
||||
for trans_temp, enthalpy in ref_value.transitions:
|
||||
real_tm.append(trans_temp)
|
||||
t_low_lim, t_high_lim = trans_temp - 10, trans_temp + 20
|
||||
t_low_lim, t_high_lim = trans_temp - 10, trans_temp + np.clip(rate, 20, 35)
|
||||
|
||||
low_border = np.argmin(np.abs(measurement[0] - t_low_lim))
|
||||
high_border = np.argmin(np.abs(measurement[0] - t_high_lim))
|
||||
ref_zoom = measurement[:, low_border:high_border]
|
||||
|
||||
x_val = np.array([[ref_zoom[0, 0], 1], [ref_zoom[0, -1], 1]])
|
||||
y_val = np.array([ref_zoom[1, 0], ref_zoom[1, -1]])
|
||||
|
||||
sol = np.linalg.solve(x_val, y_val)
|
||||
ref_zoom[1] -= (ref_zoom[0] * sol[0] + sol[1])
|
||||
peak_max = ref_zoom[:, np.argmax(ref_zoom[1])]
|
||||
integ_limit = (np.argmin(np.abs(ref_zoom[0] - peak_max[0] + 3)),
|
||||
np.argmin(np.abs(ref_zoom[0] - peak_max[0] - 3)))
|
||||
|
||||
ref_grad = np.gradient(ref_zoom[1])
|
||||
crossing = np.where(np.diff(np.sign(np.abs(ref_grad)-0.001)))[0]
|
||||
|
||||
almost_flat = np.sort(crossing-np.argmax(ref_zoom[1]))
|
||||
integ_limit = (almost_flat[np.where((almost_flat < -20))[0][-1]]+np.argmax(ref_zoom[1]),
|
||||
almost_flat[np.where((almost_flat > 20))[0][0]]+np.argmax(ref_zoom[1]))
|
||||
|
||||
# subtract baseline around reference peak
|
||||
sol = self.solve_linear_eq(integ_limit, ref_zoom)
|
||||
@ -215,7 +221,7 @@ class DSCCalibrator:
|
||||
ref_grad = np.gradient(ref_zoom[1])
|
||||
max_grad = np.argmax(ref_grad)
|
||||
|
||||
grad_pos = max_grad-int(50 / rate), max_grad
|
||||
grad_pos = max_grad-max(1, int(160 / rate)), max_grad
|
||||
|
||||
sol = self.solve_linear_eq(grad_pos, ref_zoom)
|
||||
onset = sol[0] * ref_zoom[0] + sol[1]
|
||||
|
Loading…
Reference in New Issue
Block a user