Skip to content

Commit

Permalink
Merge pull request #20 from cremerlab/18-param-bounds-large-time-dime…
Browse files Browse the repository at this point in the history
…nsion

18 param bounds large time dimension
  • Loading branch information
gchure authored Aug 14, 2024
2 parents dd5cf37 + bf28235 commit ce44dac
Show file tree
Hide file tree
Showing 11 changed files with 910 additions and 706 deletions.
4 changes: 2 additions & 2 deletions docs/source/methodology/baseline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,13 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Performing baseline correction: 100%|██████████| 187/187 [00:00<00:00, 406.72it/s]\n"
"Performing baseline correction: 100%|██████████| 187/187 [00:00<00:00, 477.28it/s]\n"
]
},
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x171398b80>"
"<matplotlib.legend.Legend at 0x16ac59ba0>"
]
},
"execution_count": 5,
Expand Down
10 changes: 5 additions & 5 deletions docs/source/methodology/fitting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x303a12a70>"
"<matplotlib.legend.Legend at 0x16b72b940>"
]
},
"execution_count": 1,
Expand Down Expand Up @@ -154,13 +154,13 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Performing baseline correction: 100%|██████████| 299/299 [00:00<00:00, 3910.85it/s]\n"
"Performing baseline correction: 100%|██████████| 299/299 [00:00<00:00, 2725.64it/s]\n"
]
},
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x30408a500>"
"<matplotlib.legend.Legend at 0x16b8d2380>"
]
},
"execution_count": 2,
Expand Down Expand Up @@ -260,7 +260,7 @@
"By default, `hplc-py` applies broad, permissive bounds on these parameters given \n",
"information of the chromatogram. The default bounds given to each parameter are \n",
"\n",
"* $A \\in [0.1 \\times A_0, 10 \\times A_0]$ where $A_0$ is the initial guess for the amplitude.\n",
"* $A \\in [0.01 \\times A_0, 100 \\times A_0]$ where $A_0$ is the initial guess for the amplitude.\n",
"* $\\tau \\in [t_{min}, t_{max}]$ where $t_{min}$ and $t_{max}$ correspond to the minimum and maximum times in the peak window.\n",
"* $\\sigma_{bounds} \\in [dt, \\frac{t_{max} - t_{min}}{2}]$ where $dt$ corresponds to the time sampling interval of the chromatogram.\n",
"* $\\alpha \\in (-\\inf, +\\inf)$.\n",
Expand Down Expand Up @@ -330,7 +330,7 @@
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x303c21630>"
"<matplotlib.legend.Legend at 0x1739eab90>"
]
},
"execution_count": 6,
Expand Down
12 changes: 6 additions & 6 deletions docs/source/methodology/peak_detection.ipynb

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions docs/source/methodology/problem.ipynb

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions docs/source/methodology/scoring.ipynb

Large diffs are not rendered by default.

96 changes: 48 additions & 48 deletions docs/source/tutorials/calibration_curve.ipynb

Large diffs are not rendered by default.

193 changes: 95 additions & 98 deletions docs/source/tutorials/quickstart.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hplc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from . import io
__author__ = """Griffin Chure and Jonas Cremer"""
__email__ = """griffinchure@gmail.com"""
__version__ = "0.2.6"
__version__ = "0.2.7"
1,162 changes: 675 additions & 487 deletions hplc/quant.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import pathlib

__version__ = "0.2.6"
__version__ = "0.2.7"

# The directory containing this file
HERE = pathlib.Path(__file__).parent
Expand Down
19 changes: 19 additions & 0 deletions tests/test_chromatogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ def test_bg_estimation():
with pytest.warns():
chrom.correct_baseline(window=0.75)

# Test that the correct exception is thrown if the window is too small.
try:
with pytest.warns():
chrom.correct_baseline(window=np.diff(_df['x'].values)[0])
assert False
except ValueError:
assert True


def test_shouldered_peaks():
"""
Expand Down Expand Up @@ -479,6 +487,7 @@ def test_generic_param_bounding():
"""
df = pd.read_csv('./tests/test_data/test_integration_window_chrom.csv')
chrom = hplc.quant.Chromatogram(df)

# Adjust the parameters
adjustments = {'amplitude': [0.9, 1.1],
'location': [-1, 1],
Expand All @@ -496,3 +505,13 @@ def test_generic_param_bounding():
'skew': [-10, 10]}
for k, v in adj_pars.items():
assert np.array(truth[k] == v).all()

# Make sure that incorrect bounds throw a value error.
adjustments = {'scale': [10, 11]}
try:
_ = chrom.fit_peaks(param_bounds=adjustments,
correct_baseline=False,
verbose=False)
assert False
except ValueError:
assert True

0 comments on commit ce44dac

Please sign in to comment.