Attributes
Every SpinData object carries two attribute dictionaries that travel with the data through the entire processing workflow:
``attrs`` — the raw experimental parameters read directly from the spectrometer file. Keys and values are instrument-specific (e.g. Bruker BES3T uses
"MF"for microwave frequency, TopSpin uses"SFO1").``spinlab_attrs`` — a normalized layer that SpinLab populates automatically on import. It maps the instrument-specific keys to a common, format-independent set of names so that the same code works regardless of which instrument produced the data.
Both dictionaries are plain Python dict objects and can be read, updated, or extended at any time:
# Read a raw attribute
print(data.attrs["MF"]) # Bruker WinEPR microwave frequency
# Read a normalized SpinLab attribute
print(data.spinlab_attrs["frequency"]) # same value, any format
# Print all raw attributes in a formatted table
data.exp_info()
# Print all SpinLab attributes
data.spinlab_info()
SpinLab Attributes (spinlab_attrs)
The following attributes are automatically extracted and normalized on import. A value of None means the attribute is not available for a particular format.
Attribute |
Unit |
Available for |
Description |
|---|---|---|---|
|
— |
All formats |
String identifying the experiment type. Set automatically on import and used by |
|
— |
All formats |
Name of the file format that was imported (e.g. |
|
— |
All formats |
Technique: |
|
— |
All formats |
Number of scans or averages accumulated. |
|
Hz |
All formats |
Microwave frequency (EPR) or NMR Larmor frequency. Stored in Hz after unit conversion. |
|
W |
EPR, RS2D |
Microwave or RF power. |
|
dB |
EPR (Xepr, Xenon, WinEPR, ESP, RS2D) |
Attenuator setting. |
|
dB |
EPR (Xepr, Xenon) |
Pulse attenuator setting (pulsed EPR). |
|
mT |
EPR |
Center magnetic field of the sweep. |
|
mT |
EPR, VnmrJ, TNMR, SpecMan |
Total field sweep width (EPR) or spectral width (NMR). |
|
s |
NMR (Prospa, Delta, VnmrJ, TNMR), SpecMan |
Repetition time between successive scans. |
|
— |
EPR (WinEPR, ESP), NMR (Delta, TNMR), RS2D |
Receiver gain setting. |
|
dB |
(reserved, currently None for all formats) |
Receiver attenuation. |
|
ms |
EPR (Xepr, Xenon, WinEPR, ESP) |
ADC conversion time per point (CW EPR). |
|
ms |
EPR (Xepr, Xenon, WinEPR, ESP) |
Filter time constant (CW EPR). |
|
mT |
EPR (Xepr, Xenon, WinEPR, ESP) |
Field modulation amplitude (CW EPR). |
|
kHz |
EPR (Xepr, Xenon, WinEPR, ESP) |
Field modulation frequency (CW EPR). |
|
K |
EPR (Xepr, Xenon, WinEPR, ESP), NMR (Delta, VnmrJ, TNMR) |
Sample temperature. |
|
s |
RS2D |
Dwell time between digitizer samples. |
The experiment_type Attribute
experiment_type is the most important attribute in SpinLab. It is stored in attrs (not spinlab_attrs) and controls how sl.fancy_plot() formats the figure — which axis labels, title, and marker style are applied.
SpinLab sets it automatically on import based on the file format. You can inspect or change it at any time:
print(data.attrs["experiment_type"]) # e.g. 'epr_spectrum'
# Override to use a different plot style
data.attrs["experiment_type"] = "inversion_recovery"
The following values are currently defined:
|
Technique |
Description |
|---|---|---|
|
EPR |
Continuous-wave EPR spectrum. Default when a CW EPR file is loaded. X-axis: magnetic field (mT). |
|
EPR |
EPR transient from a transient recorder. X-axis: time (µs). |
|
EPR |
EPR transient specific to the Bruker E580 spectrometer. X-axis: time (ns). |
|
EPR |
Echo intensity as a function of pulse separation. X-axis: time (s). |
|
EPR |
ELDOR profile. X-axis: pump frequency (GHz). |
|
EPR |
Saturation recovery experiment. X-axis: evolution time (s). |
|
NMR |
Inversion recovery experiment. X-axis: evolution time T1 (s). |
|
DNP |
DNP polarization build-up. X-axis: contact time (s). |
|
DNP |
DNP enhancement factor vs. microwave power. X-axis: power (dBm). |
|
DNP |
DNP enhancement factor vs. microwave power in dBm. X-axis: power (dBm). |
|
DNP |
DNP enhancement factor vs. microwave power in Watts. X-axis: power (W). |
|
DNP |
Spin enhancement profile vs. frequency. X-axis: frequency (GHz). |
Accessing Attributes
import spinlab as sl
data = sl.load("spectrum.DTA")
# --- Raw attrs ---
print(data.attrs) # full dictionary
data.exp_info() # formatted table printout
print(data.attrs["experiment_type"]) # 'epr_spectrum'
print(data.attrs["frequency"]) # microwave frequency (raw)
print(data.attrs["nscans"]) # number of scans (Xepr raw key)
# --- SpinLab attrs ---
print(data.spinlab_attrs) # full dictionary
data.spinlab_info() # formatted table printout
print(data.spinlab_attrs["frequency"]) # same frequency value, normalized
print(data.spinlab_attrs["scans"]) # number of scans, any format
print(data.spinlab_attrs["temperature"]) # temperature in K
# --- Both together ---
data.show_attrs() # prints spinlab_attrs + proc_attrs
Modifying Attributes
Attributes can be added or changed freely. A common use case is correcting the experiment_type or adding custom metadata before saving:
# Change experiment type for fancy_plot formatting
data.attrs["experiment_type"] = "echo_decay"
# Add a custom annotation
data.attrs["sample_name"] = "TEMPO in toluene"
data.attrs["concentration_mM"] = 0.5
# Save with the updated attributes — all attrs are preserved in HDF5
sl.save(data, "annotated_data.h5")
Further Reading
The SpinData Object — full description of the
SpinDataobject and its attributesLoading Data — how attributes are populated for each file format
Plotting Data — how
experiment_typecontrolsfancy_plotoutput