Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ docs/build
docs/source/_build/
.tox
.DS_Store
.coverage*
.coverage*
*.ini
*.bak
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"sphinx.ext.coverage",
"sphinx.ext.mathjax", # imgmath requires some helpers to be installed
"sphinx.ext.viewcode",
"sphinxcontrib.napoleon",
"sphinx.ext.napoleon",
"nbsphinx",
]

Expand Down
4 changes: 2 additions & 2 deletions docs/source/jupyter/qm_explanation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"metadata": {},
"outputs": [],
"source": [
"from IPython.core.display import display, HTML\n",
"from IPython.display import display, HTML\n",
"display(HTML(\"<style>.container { width:100% !important; }</style>\"))"
]
},
Expand Down Expand Up @@ -489,7 +489,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.16"
"version": "3.13.2"
}
},
"nbformat": 4,
Expand Down
144 changes: 116 additions & 28 deletions jupyter/qm_explanation.ipynb

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ exclude =
jupyter,
tests/dnmr_standards.py,
build,
dist
dist,
.ipynb_checkpoints
ignore =
# allowing I for Intensity/Integration *for now*
E741
Expand Down
21 changes: 10 additions & 11 deletions src/nmrsim/plt.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,12 @@ def mplplot(peaklist, w=1, y_min=-0.01, y_max=1, points=800, limits=None, hidden
l_limit = peaklist[0][0] - 50
r_limit = peaklist[-1][0] + 50
x = np.linspace(l_limit, r_limit, points)
plt.ylim(y_min, y_max)
plt.gca().invert_xaxis() # reverses the x axis
y = add_lorentzians(x, peaklist, w)
# noinspection PyTypeChecker
lines = plt.plot(x, y)
print(lines)
if not hidden:
plt.plot(x, y)
plt.ylim(y_min, y_max)
plt.gca().invert_xaxis() # reverses the x axis
plt.show()
return x, y

Expand All @@ -102,7 +101,6 @@ def mplplot_stick(peaklist, y_min=-0.01, y_max=1, limits=None, hidden=False):
numpy.array, numpy.array
The arrays of x and y coordinates used for the plot.
"""
fig, ax = plt.subplots()
if limits:
l_limit, r_limit = low_high(limits)
else:
Expand All @@ -115,10 +113,11 @@ def mplplot_stick(peaklist, y_min=-0.01, y_max=1, limits=None, hidden=False):
# baseline.
x = np.append(x, [l_limit, r_limit])
y = np.append(y, [0.001, 0.001])
plt.xlim(r_limit, l_limit)
plt.ylim(y_min, y_max)
ax.stem(x, y, markerfmt=" ", basefmt="C0-", use_line_collection=True) # suppress warning until mpl 3.3
if not hidden:
fig, ax = plt.subplots()
plt.xlim(r_limit, l_limit)
plt.ylim(y_min, y_max)
ax.stem(x, y, markerfmt=" ", basefmt="C0-")
plt.show()
return x, y
# TODO: or return plt object? Decide behavior.
Expand Down Expand Up @@ -159,9 +158,9 @@ def mplplot_lineshape(x, y, y_min=None, y_max=None, limits=None, hidden=False):
y_min = min(y) - margin
if y_max is None:
y_max = max(y) + margin
plt.xlim(r_limit, l_limit) # should invert x axis
plt.ylim(y_min, y_max)
plt.plot(x, y)
if not hidden:
plt.xlim(r_limit, l_limit) # should invert x axis
plt.ylim(y_min, y_max)
plt.plot(x, y)
plt.show()
return x, y