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
The primary source dataset (first dataset for lists).
All datasets (useful for pseudo-2D series).
Reader-reported datatype (
'FID','SER','1D','2D').'time','frequency','mixed', or'unknown'.'time'or'frequency'.Per-dimension quadrature encoding.
Best-guess experiment type from pulse program (may be
None).True if all dimensions are in frequency domain.
True if dimensions span both time and frequency domains.
Whether this Experiment wraps multiple datasets.
True if the data can be meaningfully processed further.
True if the data appears to be fully processed frequency-domain.
True if the data appears to be raw (unprocessed) time-domain.
True if all dimensions are in time domain.
Number of data dimensions.
Observed nucleus per dimension.
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 applyphc0/'phc1,'metadata'to use stored phase values, orNonefor 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).
- 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
NMRMetadatafields โ no Bruker-specific field names are referenced.- Returns:
ExperimentValidation โ Report with
errors,warnings, andinfolists.
Examples using spectrochempy.nmr.Experiment