Skip to main content

CSP5: pip-installable NMR predictor for 13C and 1H.

Project description

CSP5

CSP5 is a pip-installable NMR predictor package with:

  • batched 13C and 1H prediction
  • prediction from precomputed geometries
  • shift matching utilities with dp (default), scipy, and murty (k-best)

Bundled defaults:

  • 13C model: CSP5-13C (model_id: csp5-13c)
  • 1H model: CSP5-1H (model_id: csp5-1h)

Install

Requires Python 3.9 or newer.

pip install CSP5

Prediction CLI

In interactive terminals, csp5 prints status lines to stderr before and after prediction. If a run is slow, it prints an additional note that first invocation can take longer while dependencies and model weights initialize, plus periodic "still working" updates during long runs. Use --no-status to silence them.

From SMILES

csp5 --smiles "CCO" --nucleus 1H
csp5 --smiles "CCO" --nucleus both
csp5 --smiles-file smiles.txt --nucleus 13C --batch-size 64
csp5 --smiles "CCO" --nucleus 13C --num-conformers 8
csp5 --smiles "CCO" --nucleus both --num-conformers 8 --output-conformers-json cco_conformers.json
csp5 --smiles "CCO" --nucleus 13C --output-svg cco_13c.svg
csp5 --smiles "CCO" --nucleus 13C --output-svg cco_13c.svg --svg-bond-length 72 --svg-shift-font-scale 1.1

From molecule files (molfile or SDF)

By default, molecule-file input uses the coordinates embedded in the file. Add --regenerate-geometry to keep the input atom order/numbering while generating fresh ETKDG + MMFF/UFF coordinates for prediction.

csp5 --molecule-file input.mol --nucleus 13C
csp5 --molecule-file input.sdf --nucleus 1H --regenerate-geometry

From precomputed geometries (parquet structures dataset)

Input dataset requirements:

  • required columns: smiles, molblock
  • optional columns: conformer_rank, conformer_id, energy, energy_method

Predict only rank-0 conformers:

csp5 \
  --structures-path /path/to/structures.parquet \
  --conformer-rank 0 \
  --nucleus 1H \
  --batch-size 64

Predict using all conformers in the dataset:

csp5 \
  --structures-path /path/to/structures.parquet \
  --use-all-conformers \
  --nucleus 13C

Prediction Python API

from csp5 import draw_prediction, predict_molecule_file, predict_smiles, predict_structures, predict_sdf

# Standard SMILES mode
res = predict_smiles(["CCO", "c1ccccc1"], nucleus="1H", batch_size=32)
print(res.predictions.head())
svg = draw_prediction(res)

# Precomputed-geometry parquet mode
res2 = predict_structures(
    "/path/to/structures.parquet",
    nucleus="1H",
    conformer_rank=0,
    use_all_conformers=False,
)

# Precomputed-geometry SDF mode
res3 = predict_sdf("/path/to/embedded.sdf", nucleus="13C")

# Molfile/SDF mode with fresh generated geometry while preserving atom order
res4 = predict_molecule_file("/path/to/input.mol", nucleus="13C", regenerate_geometry=True)

Matching CLI

csp5-match expects one shift per line in each file.

Default fast path (dp)

csp5-match \
  --predicted-file predicted.txt \
  --experimental-file experimental.txt \
  --solver dp

SciPy Hungarian option

csp5-match \
  --predicted-file predicted.txt \
  --experimental-file experimental.txt \
  --solver scipy

Murty k-best option

csp5-match \
  --predicted-file predicted.txt \
  --experimental-file experimental.txt \
  --solver murty \
  --k-best-policy clip \
  --k-best 25 \
  --temperature 0.5 \
  --mae-delta-threshold 0.2

Matching Python API

from csp5 import match_shifts

pred = [7.35, 7.30, 1.25]
exp = [7.34, 7.31, 1.20]

# DP (default)
r1 = match_shifts(pred, exp, solver="dp")

# SciPy Hungarian
r2 = match_shifts(pred, exp, solver="scipy")

# Murty k-best
r3 = match_shifts(pred, exp, solver="murty", k_best=10, k_best_policy="clip")
print(r3.assignment_entropy, r3.num_competing_assignments)

Solver Notes

  • dp is the default and is intended for the standard 1D shift objective.
  • scipy uses Hungarian assignment on the full padded cost matrix.
  • murty is the k-best solver; use this when you need assignment ambiguity analysis.
  • For murty, k_best_policy="clip" (default) returns all feasible unique assignments when k_best is larger than what exists. Use k_best_policy="strict" to fail instead.
  • dp and scipy are top-1 only (k_best must be 1).

Output Notes

  • Prediction failures are returned explicitly (failures) with reason tags.
  • Prediction output always includes nucleus, model_id, and model_name.
  • For structures-mode predictions, conformer metadata columns are propagated when available.
  • CLI JSON is molecule-oriented, with top-level model metadata, per-molecule prediction lists, and atom-map numbers matching mapped_smiles_explicit_h.
  • Use --nucleus both to write 13C and 1H predictions in one JSON, grouped by nucleus under each molecule's predictions.
  • In SMILES mode, --num-conformers N predicts generated conformers and returns Boltzmann-averaged shifts at 298.15 K (--boltzmann-temperature-k changes the temperature). The default remains one conformer.
  • In structures mode, --use-all-conformers also returns Boltzmann-averaged shifts. Use --output-conformers-json to save individual conformer predictions separately.
  • Use --molecule-file path.mol or --molecule-file path.sdf for molfile/SDF input. Add --regenerate-geometry to discard embedded coordinates and create fresh geometry without changing the input atom order used for atom maps.
  • Use --output-svg path.svg or draw_prediction(result) to create an RDKit-native SVG drawing with atom labels (C4, H9) and shift notes. SVGs auto-size by default. Use both --svg-width and --svg-height to force a fixed canvas; tune with --svg-bond-length, --svg-atom-font-size, --svg-shift-font-scale, and --svg-padding.

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

csp5-0.2.9.tar.gz (33.9 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

csp5-0.2.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

csp5-0.2.9-cp313-cp313-macosx_11_0_universal2.whl (34.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ universal2 (ARM64, x86-64)

csp5-0.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

csp5-0.2.9-cp312-cp312-macosx_11_0_universal2.whl (34.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ universal2 (ARM64, x86-64)

csp5-0.2.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

csp5-0.2.9-cp311-cp311-macosx_11_0_universal2.whl (34.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ universal2 (ARM64, x86-64)

csp5-0.2.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

csp5-0.2.9-cp310-cp310-macosx_11_0_universal2.whl (34.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ universal2 (ARM64, x86-64)

csp5-0.2.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

csp5-0.2.9-cp39-cp39-macosx_11_0_universal2.whl (34.0 MB view details)

Uploaded CPython 3.9macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file csp5-0.2.9.tar.gz.

File metadata

  • Download URL: csp5-0.2.9.tar.gz
  • Upload date:
  • Size: 33.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for csp5-0.2.9.tar.gz
Algorithm Hash digest
SHA256 1b0db894979232b3d511958a44c75a6740d112cf9081d6b627288d817cae2e8d
MD5 0d0c1c05d6120689e8d48128ff7f7b21
BLAKE2b-256 c93b998ac10e0c2ccc5f2b47beb6a2933d536dee755e003830b8ca8e334fdc2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for csp5-0.2.9.tar.gz:

Publisher: release-csp5.yml on jbr87002/csp5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file csp5-0.2.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp5-0.2.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d29747810400b98528c5507e0af8b9159439d99afbf8080be5716d5996482b5f
MD5 1919b2b2a2fd4dbb2f8d7eaeea35b124
BLAKE2b-256 6705277e85fcac26f0dd20e0d542310c96f546de07c7cb22a4aeba2aba3397fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for csp5-0.2.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-csp5.yml on jbr87002/csp5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file csp5-0.2.9-cp313-cp313-macosx_11_0_universal2.whl.

File metadata

  • Download URL: csp5-0.2.9-cp313-cp313-macosx_11_0_universal2.whl
  • Upload date:
  • Size: 34.0 MB
  • Tags: CPython 3.13, macOS 11.0+ universal2 (ARM64, x86-64)
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for csp5-0.2.9-cp313-cp313-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 92de3e6a833a0710a4a331acea31ecf5065fc1f59f6a48723d96ce4cf84fca6e
MD5 445445debcdb69488fd179fc75ed4524
BLAKE2b-256 d48d61f6ab09ce5801e73a42e86106f353693c917e7f58aa7f2cf7e8a1eae6ec

See more details on using hashes here.

File details

Details for the file csp5-0.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp5-0.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1ee9960abf8954a3d1a8836a3c436ccb88d580e965ba5cecb12e5bbc86163277
MD5 e82692103e46fb858de0065d25b450f9
BLAKE2b-256 9d232e285b469cae5129e585e5c9510fc6c034aa08dc81988ecf852919fe86ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for csp5-0.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-csp5.yml on jbr87002/csp5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file csp5-0.2.9-cp312-cp312-macosx_11_0_universal2.whl.

File metadata

  • Download URL: csp5-0.2.9-cp312-cp312-macosx_11_0_universal2.whl
  • Upload date:
  • Size: 34.0 MB
  • Tags: CPython 3.12, macOS 11.0+ universal2 (ARM64, x86-64)
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for csp5-0.2.9-cp312-cp312-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 1170e26aad01f1a8ab94bfc0efb4708616e560bdb60fd4b15e07af5879db4144
MD5 5e4b0f2f8c4d9a2fc54ed10c0d677542
BLAKE2b-256 45b3afcf617ac86ef302586c12cdcbbe51553b78c280ac0a2a86f193dca8c3ef

See more details on using hashes here.

File details

Details for the file csp5-0.2.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp5-0.2.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 99355c662610c6bce74bb79e1ebc801721a6fbb7ced7fe5a8660fa32cbb84630
MD5 9e07654f1ed04f22d96bb349062252d6
BLAKE2b-256 e52c4ca677e7eef5c9e4fe5026578b2073e5390ee5969801b39d61c77e67ea82

See more details on using hashes here.

Provenance

The following attestation bundles were made for csp5-0.2.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-csp5.yml on jbr87002/csp5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file csp5-0.2.9-cp311-cp311-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for csp5-0.2.9-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 f0b564e2c6263a83f8815fffb2c38744b77a14cf95dc8347640aea86fba38234
MD5 f63db522e1597f4b33df09c4b289e79a
BLAKE2b-256 13a3a4e49bbd4ae0aedc959a00474588cb3e46ef0acc3c378bfa833031996159

See more details on using hashes here.

File details

Details for the file csp5-0.2.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp5-0.2.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4c2e957ea83ee149711c54f276ff5e319b4f298b4728a703e3e5e03278bf2620
MD5 773ca70d425ccb7a9f30ee5d27cf3f54
BLAKE2b-256 ac1188b7fba026d37bc2f4d2f9b6e63908659314fbb8eae6d5efd860a4caec99

See more details on using hashes here.

Provenance

The following attestation bundles were made for csp5-0.2.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-csp5.yml on jbr87002/csp5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file csp5-0.2.9-cp310-cp310-macosx_11_0_universal2.whl.

File metadata

  • Download URL: csp5-0.2.9-cp310-cp310-macosx_11_0_universal2.whl
  • Upload date:
  • Size: 34.0 MB
  • Tags: CPython 3.10, macOS 11.0+ universal2 (ARM64, x86-64)
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for csp5-0.2.9-cp310-cp310-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 73703ed0d5439abb0d754ea3c71022d2d9fac243c9d8d651c398caf512e3cf52
MD5 a3b5701e795a39b55fdaa5ba399437c9
BLAKE2b-256 dfdc129951833c4bfcac391fdfeb3c231546330961bb64df1926982a6e5eab70

See more details on using hashes here.

File details

Details for the file csp5-0.2.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp5-0.2.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6b3846757fa967acaa88b9f44096f09a070633081926f32ca6f3ea482a02c120
MD5 3460560b23023fbfebeb71905e58b39d
BLAKE2b-256 e9884140c55c4c45aa4a1d98d95b30934f55e5cb03899d5986b444efa66b0be9

See more details on using hashes here.

Provenance

The following attestation bundles were made for csp5-0.2.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-csp5.yml on jbr87002/csp5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file csp5-0.2.9-cp39-cp39-macosx_11_0_universal2.whl.

File metadata

  • Download URL: csp5-0.2.9-cp39-cp39-macosx_11_0_universal2.whl
  • Upload date:
  • Size: 34.0 MB
  • Tags: CPython 3.9, macOS 11.0+ universal2 (ARM64, x86-64)
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for csp5-0.2.9-cp39-cp39-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 440f4ed063305fb3aed4f7cb78d102f18cd7be2b2162553c0c96c7e8821c171a
MD5 975eb7f67c495847a4e041a4376fd5c1
BLAKE2b-256 64dcbb47efe2db16ec7be317e00372d208037b8e157f3de96ea10ea817f4ba0a

See more details on using hashes here.

Supported by

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