Note
Go to the end to download the full example code.
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}")
Traceback (most recent call last):
File "/home/runner/work/spectrochempy/spectrochempy/build/~gallery_examples/processing/nmr/plot_read_nmr_topspin.py", line 33, in <module>
print(f"Shape: {ds.shape}")
^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'shape'
Plot the spectrum:
_ = ds.plot()
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.012 seconds)