Skip to content

Commit

Permalink
v. 0.9.12
Browse files Browse the repository at this point in the history
  • Loading branch information
ludwigc committed Oct 4, 2023
1 parent d8dc465 commit 62dd6ef
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion metabolabpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__author__ = 'Christian Ludwig ([email protected])'
__credits__ = 'Christian Ludwig ([email protected])'
__version__ = '0.9.11'
__version__ = '0.9.12'
__license__ = 'GPLv3'
4 changes: 3 additions & 1 deletion metabolabpy/exampleScripts/example1DScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 19 additions & 4 deletions metabolabpy/nmr/nmrDataSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions metabolabpy/nmr/procPars.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 62dd6ef

Please sign in to comment.