Skip to main content

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

Project description

GitHub Actions Build Status CodeCov coverage PyPI version License

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

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

Install

python -m pip install penguins

(It's a good idea to use a virtual environment.)

Example

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("penguins-testdata", expno)
                           for expno in range(22001, 22005))

fig, axs = pg.subplots2d(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=1e5)

titles = [r"$^{15}$N HMQC", r"$^{13}$C HSQC", "COSY", "NOESY"]
for ax, title in zip(axs.flat, titles):
    pg.mkplot(ax, title=title)
    pg.ymove(ax, pos="topright")

pg.label_axes(axs, fstr="({})", fontweight="semibold", fontsize=12)
pg.cleanup_axes()
pg.show()

Get started

Documentation can be found at https://yongrenjie.github.io/penguins. There are tutorial-type articles intended for entirely new users; I'm working on documentation beyond that, but it's not my main job, so it's a little slow.

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.


(The 'NPE' in the name stands for the "billion-dollar mistake", i.e. the NullPointerException familiar to TopSpin users.)

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.4.2.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

penguins-0.4.2-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: penguins-0.4.2.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.2

File hashes

Hashes for penguins-0.4.2.tar.gz
Algorithm Hash digest
SHA256 02748a129619d2d28f41090fb398cf6eeee3e6250efd444572e1f309bd080468
MD5 9c592cd661f6ec6db393183ec2412b5f
BLAKE2b-256 054a815ce48fcb77e6d52d113f62ad7519c19c6c6aee305976b471d1dcbfbe4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: penguins-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 58.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.2

File hashes

Hashes for penguins-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7e7f4cfd717be7908e45d79b41f6a93d1e3c8eb4e484528aa6a4e2b8c68b1813
MD5 354010253a8b3e6d8bc8c4799cf2ed48
BLAKE2b-256 8ff07d66e82c840faaad4cb466c6dea7918041526b9dff5ca4c587bb5429208e

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