NMR: reading TopSpin files (plugin)

This example shows how to read Bruker TopSpin NMR files using the optional spectrochempy-nmr plugin.

Requires the official spectrochempy-nmr plugin. Install with: pip install spectrochempy[nmr].


import spectrochempy as scp

read_topspin is registered under the scp.nmr plugin namespace. The top-level scp.read_topspin alias is kept for compatibility.

ds = scp.nmr.read_topspin(
    scp.preferences.datadir / "nmrdata" / "bruker" / "tests" / "nmr" / "topspin_1d",
    expno=1,
    remove_digital_filter=True,
)
print(f"Loaded dataset: {ds}")
print(f"Shape: {ds.shape}")
Loaded dataset: NDDataset: [complex128] pp (size: 12411)
Shape: (12411,)

Plot the spectrum:

_ = ds.plot()
plot spectrochempy nmr  processing  nmr  plot read nmr topspin

If the plugin is not installed, the function or method raises a MissingPluginError with installation instructions.

# scp.show()

Total running time of the script: (0 minutes 0.125 seconds)