spectrochempy.nmr.Experiment๏ƒ

class Experiment(dataset)[source]๏ƒ

NMR-specific scientific interpretation of an NDDataset.

Wraps an existing dataset and provides NMR-specific classification, validation, and state-aware processing orchestration. Does not copy, subclass, or mutate the underlying dataset.

Parameters:

dataset (NDDataset or list of NDDataset) โ€“ The NMR dataset (or list of datasets for pseudo-2D experiments) to interpret.

Examples

>>> import spectrochempy as scp
>>> fid = scp.nmr.read(path)
>>> experiment = scp.nmr.Experiment(fid)
>>> experiment.summary()
>>> spectrum = experiment.process(lb=10.0, phase="manual", phc0=45.0)

Attributes Summary

dataset

The primary source dataset (first dataset for lists).

datasets

All datasets (useful for pseudo-2D series).

datatype

Reader-reported datatype ('FID', 'SER', '1D', '2D').

domain

'time', 'frequency', 'mixed', or 'unknown'.

domains

'time' or 'frequency'.

encoding

Per-dimension quadrature encoding.

experiment_type

Best-guess experiment type from pulse program (may be None).

is_frequency_domain

True if all dimensions are in frequency domain.

is_mixed_domain

True if dimensions span both time and frequency domains.

is_multi_dataset

Whether this Experiment wraps multiple datasets.

is_processable

True if the data can be meaningfully processed further.

is_processed

True if the data appears to be fully processed frequency-domain.

is_raw

True if the data appears to be raw (unprocessed) time-domain.

is_time_domain

True if all dimensions are in time domain.

ndim

Number of data dimensions.

nuclei

Observed nucleus per dimension.

source_kind

Source data classification.

Methods Summary

process(*[,ย apodization,ย lb,ย size,ย phase,ย ...])

State-aware NMR processing.

summary()

Return a concise human-readable summary of the experiment.

validate()

Validate NMR-specific requirements of the dataset.

Attributes Documentation

dataset๏ƒ

The primary source dataset (first dataset for lists).

datasets๏ƒ

All datasets (useful for pseudo-2D series).

datatype๏ƒ

Reader-reported datatype ('FID', 'SER', '1D', '2D').

domain๏ƒ

'time', 'frequency', 'mixed', or 'unknown'.

Type:

Summarized domain

domains๏ƒ

'time' or 'frequency'.

Type:

Per-dimension domain

encoding๏ƒ

Per-dimension quadrature encoding.

experiment_type๏ƒ

Best-guess experiment type from pulse program (may be None).

is_frequency_domain๏ƒ

True if all dimensions are in frequency domain.

is_mixed_domain๏ƒ

True if dimensions span both time and frequency domains.

is_multi_dataset๏ƒ

Whether this Experiment wraps multiple datasets.

is_processable๏ƒ

True if the data can be meaningfully processed further.

Time-domain data is processable (FFT, apodization, etc.). Frequency-domain data is processable (phasing, baseline, etc.). Mixed-domain and unknown data are not processable in this PR.

is_processed๏ƒ

True if the data appears to be fully processed frequency-domain.

is_raw๏ƒ

True if the data appears to be raw (unprocessed) time-domain.

is_time_domain๏ƒ

True if all dimensions are in time domain.

ndim๏ƒ

Number of data dimensions.

nuclei๏ƒ

Observed nucleus per dimension.

source_kind๏ƒ

Source data classification.

One of: 'fid', 'ser', 'processed_1d', 'processed_2d', 'partially_processed', 'unknown'.

Methods Documentation

process(*, apodization=None, lb=1.0, size=None, phase=None, phc0=0.0, phc1=0.0)[source]๏ƒ

State-aware NMR processing.

Applies only operations that are scientifically appropriate for the current data domain. Never modifies the source dataset.

Parameters:
  • apodization (str, optional) โ€“ Apodization function name ('em', 'gm', 'sp'). Only applied to time-domain data. Ignored for frequency-domain.

  • lb (float) โ€“ Line broadening in Hz (for apodization='em'). Default 1.0.

  • size (int, optional) โ€“ Zero-fill target size. Only applied to time-domain data.

  • phase (str, optional) โ€“ 'manual' to apply phc0/'phc1, 'metadata' to use stored phase values, or None for no phasing.

  • phc0 (float) โ€“ Zero-order phase correction in degrees (manual mode).

  • phc1 (float) โ€“ First-order phase correction in degrees (manual mode).

Returns:

NDDataset โ€“ Processed dataset (copy of the source).

Raises:

RuntimeError โ€“ If the data domain does not support the requested operations, or if 2D processing is requested (not yet implemented).

summary()[source]๏ƒ

Return a concise human-readable summary of the experiment.

validate() -> ExperimentValidation: """ Validate NMR-specific requirements of the dataset. Uses canonical :class:`~spectrochempy_nmr.nmr_metadata.NMRMetadata` fields โ€” no Bruker-specific field names are referenced. Returns ------- ExperimentValidation Report with ``errors``, ``warnings``, and ``info`` lists. """ report = ExperimentValidation() if not self._has_meta()[source]๏ƒ

Validate NMR-specific requirements of the dataset.

Uses canonical NMRMetadata fields โ€” no Bruker-specific field names are referenced.

Returns:

ExperimentValidation โ€“ Report with errors, warnings, and info lists.

Examples using spectrochempy.nmr.Experiment