diff --git a/metabolabpy/__init__.py b/metabolabpy/__init__.py index a2687a9..3ff4c66 100644 --- a/metabolabpy/__init__.py +++ b/metabolabpy/__init__.py @@ -1,4 +1,4 @@ __author__ = 'Christian Ludwig (C.Ludwig@bham.ac.uk)' __credits__ = 'Christian Ludwig (C.Ludwig@bham.ac.uk)' -__version__ = '0.9.11' +__version__ = '0.9.12' __license__ = 'GPLv3' diff --git a/metabolabpy/exampleScripts/example1DScript.py b/metabolabpy/exampleScripts/example1DScript.py index a6065f9..0f5ccb8 100644 --- a/metabolabpy/exampleScripts/example1DScript.py +++ b/metabolabpy/exampleScripts/example1DScript.py @@ -4,7 +4,9 @@ self.read_spcs([data_path],data_sets) # reading Bruker spectra msg = self.nd.set_zero_fill([131072]) # zero fill to 131072 data points msg = self.nd.set_lb([0.3]) # 0.3 Hz line broadening -msg = self.nd.set_window_type([1]) # exponential window function +msg = self.nd.set_window_type(['Exponential']) # window function ('None', 'Exponential', 'Gaussian', 'Sine', 'QSine', 'SEM') +msg = self.nd.set_water_suppression('None') # set water suppression ('None', 'Conv', 'Poly', 'WaveWat') +msg = self.nd.set_autobaseline(False) # perform automatic baseline correction (False, True) msg = self.nd.ft_all() # Fourier Transform all NMR spectra msg = self.nd.auto_ref_all() # automatically reference to TMSP self.nd.e = 0 # make first spectrum the current experiment diff --git a/metabolabpy/nmr/nmrDataSet.py b/metabolabpy/nmr/nmrDataSet.py index 900950f..7b20acf 100644 --- a/metabolabpy/nmr/nmrDataSet.py +++ b/metabolabpy/nmr/nmrDataSet.py @@ -237,8 +237,7 @@ def baseline1d_all(self): def bucket_spectra(self): self.pp.bucket_points = np.diff(self.nmrdat[self.s][self.e].ppm2points([0.0, self.pp.bucket_ppm])) idx1 = np.arange(len(self.nmrdat[self.s][0].ppm1)) - print(f'self.pp.bucket_points: {self.pp.bucket_points}') - idx2 = idx1[::int(self.pp.bucket_points)] + idx2 = idx1[::int(self.pp.bucket_points[0])] idx2 = np.append(idx2, len(idx1)) ppm = np.array([]) for k in range(len(idx2) - 1): @@ -1572,6 +1571,15 @@ def select_plot_clear(self): # pragma: no cover self.plot_spc() # end select_plot_clear + def set_autobaseline(self, autobaseline=False): + n_exp = len(self.nmrdat[self.s]) + for k in range(n_exp): + self.nmrdat[self.s][k].proc.autobaseline = autobaseline + + return "set_autobaseline" + + # set_autobaseline + def set_loadings_from_excel(self, file_name='', worksheet='', columns=['']): # pragma: no cover if len(file_name) == 0: return @@ -1728,9 +1736,16 @@ def set_water_suppression(self, ws='None'): def set_window_type(self, wt): n_exp = len(self.nmrdat[self.s]) + wt2 = [] + for k in range(len(wt)): + if isinstance(wt[0], int): + wt2.append(wt[k]) + else: + wt2.append(self.nmrdat[self.s][self.e].proc.window_functions[wt[k]]) + for k in range(n_exp): - for l in range(len(wt)): - self.nmrdat[self.s][k].proc.window_type[l] = wt[l] + for l in range(len(wt2)): + self.nmrdat[self.s][k].proc.window_type[l] = wt2[l] return "set_window_type" diff --git a/metabolabpy/nmr/procPars.py b/metabolabpy/nmr/procPars.py index 69f3dbb..21b9f08 100644 --- a/metabolabpy/nmr/procPars.py +++ b/metabolabpy/nmr/procPars.py @@ -85,11 +85,11 @@ def __init__(self): 0: "None", 1: "Conv", 2: "Poly", - 3: "Wavewat", + 3: "WaveWat", "None": 0, "Conv": 1, "Poly": 2, - "Wavewat": 3 + "WaveWat": 3 } self.data_type = '' self.autobaseline_alg = 'rolling_ball'