Skip to content

Commit

Permalink
fixed documentation for pypi release; v. 0.9.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ludwigc committed Sep 29, 2023
1 parent cf34193 commit 116b085
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 20 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.9'
__version__ = '0.9.11'
__license__ = 'GPLv3'
16 changes: 10 additions & 6 deletions metabolabpy/nmr/nmrData.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def autobaseline1d(self, lam=1e6, alg='rolling_ball', max_iter=50, alpha=0.1, be
if alg == 'irsqr':
baseline_fitter = Baseline(spc, check_finite=False)
baseline, params = baseline_fitter.irsqr(spc, lam=lam, quantile=quantile) # poly_order=poly_order, method='imodpoly')
if alg == 'airpls':
if alg == 'irsqr':
baseline_fitter = Baseline(spc, check_finite=False)
baseline, params = baseline_fitter.airpls(spc, 1e5) # poly_order=poly_order, method='imodpoly')
#baseline = airpls(spc, lam=lam, max_iter=max_iter)
Expand Down Expand Up @@ -386,11 +386,8 @@ def autobaseline1d(self, lam=1e6, alg='rolling_ball', max_iter=50, alpha=0.1, be
elif alg == 'noise_median':
baseline = noise_median(spc)
elif alg == 'snip':
print('111111')
baseline_fitter = Baseline(spc, check_finite=False)
print('222222')
baseline, params = baseline_fitter.snip(spc, 32, decreasing=True, extrapolating_window=34, smooth_window=8)
print(f'len(spc): {len(spc)}, len(baseline): {len(baseline)}')
elif alg == 'adaptive_minimax':
baseline_fitter = Baseline(spc, check_finite=False)
poly_order = 4
Expand Down Expand Up @@ -810,7 +807,7 @@ def conv(self, fid):
win[k] = math.cos((math.pi * (k - ws2)) / (2 * ws2 + 2))
s_win += win[k]

fid2 = np.convolve(win, fid) / s_win
fid2 = np.convolve(fid, win) / s_win
# Extrapolation of first sw2 data points
idx = np.linspace(2 * ws2 - 1, 0, 2 * ws2, dtype='int')
idx2 = np.linspace(0, 2 * ws2 - 1, 2 * ws2, dtype='int')
Expand Down Expand Up @@ -1279,6 +1276,12 @@ def proc_spc1d(self, reset_spline=False):

def proc_spc2d(self, test_quad_2d=False, no_abs=False):
fid = np.copy(self.fid)
if self.proc.n_points[0] < len(fid[0]):
self.proc.n_points[0] = len(fid[0])

if self.proc.n_points[1] < len(fid):
self.proc.n_points[1] = len(fid)

if self.proc.mult_factor[0] == 0:
self.proc.mult_factor[0] = self.proc.n_points[0] / len(self.fid[0])

Expand Down Expand Up @@ -2298,7 +2301,8 @@ def wavewat(self, fid):
fida = np.zeros(2*npts2, dtype='complex128')
fida[npts2:npts2 + npts - gd] = fid[gd:]
fida[npts2 - npts +gd:npts2] = np.flip(fid[gd:])
fid2 = pywt.mra(data=fida, wavelet=self.proc.ww_wavelet, transform='dwt')
ww_wavelet = self.proc.ww_wavelet_type + self.proc.ww_wavelet_type_number
fid2 = pywt.mra(data=fida, wavelet=ww_wavelet, transform='dwt')
fid3 = np.zeros(2*npts2, dtype='complex128')
n_mra = len(fid2)
for k in range(self.proc.ww_start, n_mra):
Expand Down
18 changes: 18 additions & 0 deletions metabolabpy/nmr/nmrDataSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,24 @@ def __init__(self):
self.hsqc_spin_sys_connected = True
self.data_set_name = ''
self.data_set_number = ''
self.baseline_algs = ['irsqr', 'arpls', 'asls', 'aspls', 'derpsalsa', 'drpls', 'iarpls', 'iasls', 'psalsa', 'mpls',
'mor', 'imor', 'mormol', 'amormol', 'rolling_ball', 'mwmv', 'tophat', 'mpspline', 'jbcd',
'noise_median', 'snip', 'adaptive_minimax', 'swima', 'ipsa', 'ria', 'dietrich',
'std_distribution', 'fastchrom', 'cwt_br', 'fabc', 'beads', 'poly', 'modpoly', 'imodpoly',
'penalized_poly', 'quant_reg', 'goldindec', ]
self.default_baseline_alg = 'rolling_ball'
self.default_lam = 1e5
self.default_max_iter = 50
self.default_alpha = 0.1
self.default_beta = 10
self.default_gamma = 15
self.default_beta_mult = 0.98
self.default_gamma_mult = 0.94
self.default_half_window = 4096
self.default_smooth_half_window = 16
self.default_quantile = 0.3
self.default_poly_order = 4
self.default_add_ext = 2
# end __init__

def add_peak(self, start_end=np.array([], dtype='float64'), peak_label=''):
Expand Down
31 changes: 25 additions & 6 deletions metabolabpy/nmr/procPars.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self):
self.ssb = np.array([0.0, 0.0, 0.0])
self.axis_nucleus = np.array([' ', ' ', ' '], dtype='str')
self.aunmp = str('')
self.poly_order = 4
self.poly_order = 24
self.water_suppression = 0
self.gibbs = np.array([True, True, False])
self.conv_extrapolation_size = np.array([32, 0, 0])
Expand Down Expand Up @@ -92,22 +92,41 @@ def __init__(self):
"Wavewat": 3
}
self.data_type = ''
self.autobaseline_alg = 'jbcd'
self.autobaseline_lam = 1e6
self.autobaseline_alg = 'rolling_ball'
self.autobaseline_lam = 1e5
self.autobaseline_max_iter = 50
self.autobaseline_alpha = 0.1
self.autobaseline_beta = 10
self.autobaseline_gamma = 15
self.autobaseline_beta_mult = 0.98
self.autobaseline_gamma_mult = 0.94
self.autobaseline_half_window = None
self.autobaseline_half_window = 4096
self.autobaseline_quantile = 0.3
self.autobaseline_poly_order = 4
self.autobaseline_smooth_half_window = 32
self.autobaseline_smooth_half_window = 16
self.autobaseline_add_ext = 2
self.ww_start = 9
self.ww_zf = 16
self.ww_wavelet = 'rbio6.8'
self.ww_wavelet_type = 'db'
self.ww_wavelet_type_number = '10'
self.ww_wavelet_number = 11
self.wavelet_names = ['bior', 'coif', 'db', 'dmey', 'haar', 'rbio', 'sym']
self.wavelet_numbers = {
'bior': ['1.1', '1.3', '1.5', '2.2', '2.4', '2.6', '2.8', '3.1', '3.3', '3.5', '3.7', '3.9', '4.4', '5.5',
'6.8'], 'cgau': ['1', '2', '3', '4', '5', '6', '7', '8'],
'coif': ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17'],
'db': ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18',
'19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35',
'36', '37', '38'], 'dmey': [''], 'haar': [''],
'rbio': ['1.1', '1.3', '1.5', '2.2', '2.4', '2.6', '2.8', '3.1', '3.3', '3.5', '3.7', '3.9', '4.4', '5.5',
'6.8'],
'sym': ['2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19',
'20']}
self.wavelet_default = {'bior': 11, 'coif': 11, 'db': 9, 'dmey': 0,
'haar': 0, 'rbio': 11, 'sym': 7}
self.wavelet_start_default = {'bior': 9, 'coif': 7, 'db': 9, 'dmey': 7,
'haar': 7, 'rbio': 9, 'sym': 9}

# end __init__

def __str__(self): # pragma: no cover
Expand Down
8 changes: 1 addition & 7 deletions upload_pypi.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#!/bin/bash

conda activate pypi
python setup.py sdist

twine upload --repository-url https://test.pypi.org/legacy/ dist/*
#pip install --index-url https://test.pypi.org/simple --extra-index-url https://pypi.org/simple metabolabpy==0.6.1

conda deactivate
#comment
twine upload -u __token__ -p $ml_token $1

0 comments on commit 116b085

Please sign in to comment.