Skip to main content

NOTE:

penguins is not under active development. I mostly used this as a tool for my own papers and my PhD thesis, and it served me admirably; however, I've since moved on to other stuff, and I don't have the time or motivation to work on new features.

If you are using it, and would like any help with using it to make plots / analyse data, I'm more than happy to help; just write to me at {myGithubUsername} at gmail dot com. Please put penguins in the subject title, or I will ignore it.


GitHub Actions Build Status CodeCov coverage PyPI version License

Penguins: an ENjoyable 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. It also performs a very small number of processing and analysis of NMR spectra, namely integration as well as generation of projections/slices.

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", 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.

NOTE: You may want to silence type checking. There are plenty of issues with this which I have yet to fix. I have chosen to design penguins to provide Pythonic, friendly syntax, which unfortunately makes it very difficult to correctly specify types.

Release files for penguins 0.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for penguins 0.5.2
File Size Uploaded
penguins-0.5.2.tar.gz 3.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for penguins 0.5.2
File Interpreter ABI Platform
penguins-0.5.2-py3-none-any.whl Python 3 none any Details

Total release size: 3.3 MB

Release files / penguins-0.5.2.tar.gz

Download URL penguins-0.5.2.tar.gz
Size 3.3 MB
Tags Source
SHA-256 checksum
How to use checksums
94c0ca2c3bee44e1920af2c65bdae4d0f98643995acf44894bff93fd889a5c0b
BLAKE2b-256 checksum
How to use checksums
60495f97a08ed2921808b78caadbd0e0243ca864227850420adb207a39b36508
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.7

Release files / penguins-0.5.2-py3-none-any.whl

Download URL penguins-0.5.2-py3-none-any.whl
Size 39.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f66a8ee942948da0d721eeda1ba933fcd9df09e8a898ccc3f40f2bc33337009c
BLAKE2b-256 checksum
How to use checksums
c8c0eec81bd93282f0540f2533378d0d84c2ac84593e785f4b22c847f2d6f792
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page