Extras

Beyond the ports

Most of the repository is a port, checked stage by stage against the original. These are the parts that originated here: a module for coherence transfer pathway selection, the tooling that verifies both ports, and the ways the code reaches you without an installation.

Pathways

Coherence transfer pathway selection

ctps is a separate module (import ctps, no dependency on spynach) that ports the CCCP.m and CCCP++ programs: for a sequence of pulses and delays on one or several nuclei it enumerates every coherence transfer pathway the sequence allows, weights each by the phase cycle, the gradients, diffusion and the pulses, ranks them and draws them in an interactive explorer that steps through the pathways with their factors.

Phase cycles are given explicitly, by nested cycling, or as cogwheel cycles; gradients with their strengths, durations and the gyromagnetic ratios of the nuclei; diffusion by the Stejskal-Tanner attenuation. The worked examples go from a double-quantum filter and an imperfect spin echo to HSQC, MQMAS, multi-echo trains and MRS crusher schemes, and end with every check of the module's tests as a runnable example.

Pulses

Non-ideal pulses and cogwheel search

Each pulse is a perfect 180°, an imperfect 180° or a small-flip-angle pulse, with the leakage of every coherence transfer after J. Chem. Phys. 113, 979 (2000), so that the pathways an imperfect refocusing pulse lets through appear with their weights. Cogwheel cycles are found by exact integer arithmetic with all winding numbers tested at once, and crusher gradient schemes by the DOTCOPS objective.

Verification

Tooling behind both ports

  • Oracle harnesses. MATLAB dump scripts write the intermediate results of a Spinach calculation, or the inputs and outputs of an EasySpin call, to HDF5 fixtures with their provenance; the parity tests rebuild each case and compare normwise with stated tolerances. compare checks any result of your own against a saved run.
  • The parity page. Every fixture case, tolerance and measured difference of the Spinach suite, regenerated from a test run rather than typed (docs/parity.md); the EasySpin cases with their agreement in porting/EASYSPIN_FIXTURES.md.
  • Timed comparisons. A protocol that runs a full-size calculation on both sides under a profiler, on the same machine, into one HTML report per case, and a timing script for the EasySpin fixtures; the tables on the Spinach and EasySpin pages are generated from their output.
  • Interactive figures. Plotly figures from every plotting function, FID and time-series plots with no Spinach equivalent, and figure_png for static copies.
Documentation

Executable guides, Colab, contributed notebooks

Each guide is a Markdown document whose code blocks run in the test suite, and a notebook generated from it with its outputs and interactive figures; the Colab quick start installs Spynach in the browser and runs the two-spin example. Contributed notebooks, such as the triple-quantum build-up of a 23Na spin under quadrupolar relaxation, live in user_py/ beside the contributed Spinach scripts in user_ml/ and their translations. All guides are on the documentation page.

Browser

The playground

try.html runs spynach, epreasy and ctps in the browser through Pyodide (Python compiled to WebAssembly) with NumPy and SciPy in a web worker, fetching the sources from the repository: nothing to install, the first load takes a few seconds. The examples are grouped by product, NMR, EPR and pathways; each prints a few numbers and draws its spectrum, FID or 2D contour plot, and the editor is yours to change. Deep links such as try.html#ex-epr-hyscore open and run one example. The page was contributed by Moritz Zaiss (MRsources); it runs in a single thread, so it suits guide-sized examples rather than full-size calculations.