Skip to main content

Penguins: an Easy, NPE-free Gateway to Unpacking and Illustrating NMR Spectra

Project description

Travis CI Build Status Code Coverage PyPI version

Penguins: an Easy, NPE-free Gateway to Unpacking and Illustrating NMR Spectra

pip install penguins

penguins is a Python 3 package intended mainly for generating publication-quality plots of NMR spectra in a programmatic, reproducible fashion.

Documentation can be found at https://yongrenjie.github.io/penguins. Everything is documented in one form or another, although I'm still working on tutorial-type pages which are easier to read than the docstrings.

Note that penguins is still in development, so the interface should not be assumed to be (too) stable. For now, I am working directly on the master branch, and rebasing/force pushing may occur without warning.


As an example of the output, here's Figure 2 from Angew. Chem. Int. Ed. 2017, 56 (39), 11779–11783:

And here's a similar plot that can be done in under 20 lines of PEP8-compliant code using penguins (it's the same compound, but not the same data):

import penguins as pg
hmqc, hsqc, cosy, noesy = (pg.read("tests/data/noah", i, 1)
                           for i in range(1, 5))

fig, axs = pg.subplots(2, 2)
hmqc.stage(axs[0, 0], levels=7e3, f1_bounds="110..130", f2_bounds="7..9.5")
hsqc.stage(axs[0, 1], levels=4e4, f1_bounds="12..65", f2_bounds="0.5..5")
cosy.stage(axs[1, 0], levels=8e5)
noesy.stage(axs[1, 1], levels=9e4)

titles = [r"$^{15}$N HMQC", r"$^{13}$C HSQC", "COSY", "NOESY"]
for ax, title, char in zip(axs.flat, titles, "abcd"):
    pg.mkplot(ax, title=title, autolabel="nucl")
    ax.text(x=0.02, y=0.98, s=f"({char})", transform=ax.transAxes,
            fontweight="semibold", verticalalignment="top")
    pg.move_ylabel(ax, pos="topright")

pg.cleanup_axes()
pg.show()

[Regarding the 'NPE' in the name: I made this package after getting fed up of getting java.lang.NullPointerException in TopSpin's Plot tab. It's especially bad on OS X Catalina, but even on Windows it's rather buggy. Also, penguins are cute. 🐧]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

penguins-0.1.1.tar.gz (35.2 kB view details)

Uploaded Source

Built Distribution

penguins-0.1.1-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

Details for the file penguins-0.1.1.tar.gz.

File metadata

  • Download URL: penguins-0.1.1.tar.gz
  • Upload date:
  • Size: 35.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for penguins-0.1.1.tar.gz
Algorithm Hash digest
SHA256 63c8af2dafe15d870097ed5e469a35f64f058824bfed45ea1e9a0a21ae027774
MD5 2e147567289c0eb8d617d631b33524ee
BLAKE2b-256 3f1d360f2ca4fa551f76b26a63b3b6ed456d7aea4749d2b863ffeb4e1d5dd6d4

See more details on using hashes here.

File details

Details for the file penguins-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: penguins-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 37.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for penguins-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42e6abac42d1e3bd095b9cda4db9cdad59c1885a7a2c207f3c34f1d77480fa2d
MD5 f2897efed4cf41fb6d3a0bb8e8fd104e
BLAKE2b-256 5aefa423030ac9aadc2a9c2f9c65d1b4d3f88e19f8a101132c23a3f260ddb1a6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page