From 4268bdc5aeccf48940065a81b85a38d3508d66d3 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Tue, 13 Jun 2023 19:08:24 +0200 Subject: [PATCH] #81 make t1 data real and catch more errors; --- src/nmreval/io/fcbatchreader.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/nmreval/io/fcbatchreader.py b/src/nmreval/io/fcbatchreader.py index f67a661..ea319b4 100644 --- a/src/nmreval/io/fcbatchreader.py +++ b/src/nmreval/io/fcbatchreader.py @@ -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)