#81 make t1 data real and catch more errors;

This commit is contained in:
Dominik Demuth 2023-06-13 19:08:24 +02:00
parent 775b5e7e8a
commit 4268bdc5ae

View File

@ -133,7 +133,7 @@ class FCReader:
no_bevo = True
break
if str(k.parent) != 'ACC_ABS_FID_sig (group)':
if str(k.parent) != 'ABS_ACC_FID_sig (group)':
continue
tevo = k.parameter['tevo']
@ -144,14 +144,14 @@ class FCReader:
if bevo not in _temp:
_temp[bevo] = []
_temp[bevo].append((tevo, *[pp[1] for pp in pts]))
_temp[bevo].append((tevo, *[np.real(pp[1]) for pp in pts]))
if no_bevo:
break
if no_bevo:
# hopefully only for old scripts
sig = reader.get_selected('/data/B=*/ACC_ABS_FID*', dtype='signal')
sig = reader.get_selected('/data/B=*/ABS_ACC_FID*', dtype='signal')
_temp = {}
for s in sig:
pts = s.points([region])
@ -159,7 +159,7 @@ class FCReader:
if b not in _temp:
_temp[b] = []
_temp[b].append([s.value, *[pp[1] for pp in pts]])
_temp[b].append([s.value, *[np.real(pp[1]) for pp in pts]])
for b, m in sorted(_temp.items()):
m = np.array(m)
@ -192,15 +192,16 @@ class FCReader:
freqs = []
for k, v in sorted(self.data[temperature].items()):
freqs.append(k)
# fit
p0 = [v.y[0], v.y[-1]-v.y[0], v.x[int(0.5*len(v.x) - 0.5)], 1]
try:
p0, pcov = curve_fit(FCReader.kww, v.x, v.y, p0=p0, bounds=bounds, max_nfev=500*len(v))
except RuntimeError:
except Exception as e:
logger.error(f'Fit of field {k} failed with exception', exc_info=e)
continue
freqs.append(k)
perr = np.sqrt(np.diag(pcov))
params.append(p0)
errors.append(perr)