nmraspecds.metadata module

metadata module of the nmraspecds package.

class nmraspecds.metadata.ExperimentalDatasetMetadata

Bases: ExperimentalDatasetMetadata

Set of all metadata for a dataset object.

Metadata as a unified structure of information coupled to the dataset are necessary for the understanding, analysis and processing of data, especially in NMR. Some parameters are written automatically by the spectrometer’s software, others, depending also on the actual setup (that may change over time!) are omitted. It is highly recommended those parameters should be noted by hand, for example in an .info-file.

..note

Not all parameters are yet taken into account, only the most
important ones, that are needed for processing and analysis that are
already implemented.
spectrometer

Hardware configuration and details of the setup.

Type:

Spectrometer

probehead

Details on the probehead used in the experiment

Type:

Probehead

experiment

Experimental details, such as MAS frequency and pulse sequence.

Type:

Experiment

sample

Details on the sample used for this experiment as well as its container.

Type:

Sample

from_dict(dict_=None)

Set properties from dictionary, e.g., from metadata.

Only parameters in the dictionary that are valid properties of the class are set accordingly.

Keys in the dictionary are converted to lower case and spaces converted to underscores to fit the naming scheme of attributes.

Parameters:

dict (dict) –

Dictionary with metadata.

Each key of this dictionary corresponds to a class attribute and is in itself a dictionary with the correct set of attributes for the particular class.

to_dict(remove_empty=False)

Create dictionary containing public attributes of an object.

Parameters:

remove_empty (bool) –

Whether to remove keys with empty values

Default: False

Returns:

public_attributes – Ordered dictionary containing the public attributes of the object

The order of attribute definition is preserved

Return type:

collections.OrderedDict

Changed in version 0.6: New parameter remove_empty

Changed in version 0.9: Settings for properties to exclude and include are not traversed

Changed in version 0.9.1: Dictionaries get copied before traversing, as otherwise, the special variables __dict__ and __0dict__ are modified, what may result in strange behaviour.

Changed in version 0.9.2: Dictionaries do not get copied by default, but there is a private method that can be overridden in derived classes to copy the dictionary.

class nmraspecds.metadata.Sample(dict_=None)

Bases: Sample

Metadata corresponding to the sample .

As this class inherits from aspecd.metadata.Sample, see the documentation of the parent class for details and the full list of inherited attributes.

Parameters:

dict (dict) – Dictionary containing fields corresponding to attributes of the class

description

Description of the measured sample.

Type:

str

solvent

Name of the solvent used.

Type:

str

preparation

Short details of the sample preparation.

Type:

str

container

Type and dimension of the sample container (tube or rotor) used.

Type:

SampleContainer

from_dict(dict_=None)

Set properties from dictionary, e.g., from metadata.

Only parameters in the dictionary that are valid properties of the class are set accordingly.

Keys in the dictionary are converted to lower case and spaces converted to underscores to fit the naming scheme of attributes.

If a property is of class aspecd.metadata.PhysicalQuantity, it is set accordingly.

Parameters:

dict (dict) – Dictionary containing properties to set

to_dict(remove_empty=False)

Create dictionary containing public attributes of an object.

Parameters:

remove_empty (bool) –

Whether to remove keys with empty values

Default: False

Returns:

public_attributes – Ordered dictionary containing the public attributes of the object

The order of attribute definition is preserved

Return type:

collections.OrderedDict

Changed in version 0.6: New parameter remove_empty

Changed in version 0.9: Settings for properties to exclude and include are not traversed

Changed in version 0.9.1: Dictionaries get copied before traversing, as otherwise, the special variables __dict__ and __0dict__ are modified, what may result in strange behaviour.

Changed in version 0.9.2: Dictionaries do not get copied by default, but there is a private method that can be overridden in derived classes to copy the dictionary.

class nmraspecds.metadata.SampleContainer(dict_=None)

Bases: Metadata

Details on the sample containing container.

from_dict(dict_=None)

Set properties from dictionary, e.g., from metadata.

Only parameters in the dictionary that are valid properties of the class are set accordingly.

Keys in the dictionary are converted to lower case and spaces converted to underscores to fit the naming scheme of attributes.

If a property is of class aspecd.metadata.PhysicalQuantity, it is set accordingly.

Parameters:

dict (dict) – Dictionary containing properties to set

to_dict(remove_empty=False)

Create dictionary containing public attributes of an object.

Parameters:

remove_empty (bool) –

Whether to remove keys with empty values

Default: False

Returns:

public_attributes – Ordered dictionary containing the public attributes of the object

The order of attribute definition is preserved

Return type:

collections.OrderedDict

Changed in version 0.6: New parameter remove_empty

Changed in version 0.9: Settings for properties to exclude and include are not traversed

Changed in version 0.9.1: Dictionaries get copied before traversing, as otherwise, the special variables __dict__ and __0dict__ are modified, what may result in strange behaviour.

Changed in version 0.9.2: Dictionaries do not get copied by default, but there is a private method that can be overridden in derived classes to copy the dictionary.

class nmraspecds.metadata.Spectrometer(dict_=None)

Bases: Metadata

Metadata information on what type of spectrometer was used.

Parameters:

dict (dict) – Dictionary containing properties to set.

model

Model of the spectrometer used.

Type:

str

software

Name and version of the measurement software.

Type:

str

from_dict(dict_=None)

Set properties from dictionary, e.g., from metadata.

Only parameters in the dictionary that are valid properties of the class are set accordingly.

Keys in the dictionary are converted to lower case and spaces converted to underscores to fit the naming scheme of attributes.

If a property is of class aspecd.metadata.PhysicalQuantity, it is set accordingly.

Parameters:

dict (dict) – Dictionary containing properties to set

to_dict(remove_empty=False)

Create dictionary containing public attributes of an object.

Parameters:

remove_empty (bool) –

Whether to remove keys with empty values

Default: False

Returns:

public_attributes – Ordered dictionary containing the public attributes of the object

The order of attribute definition is preserved

Return type:

collections.OrderedDict

Changed in version 0.6: New parameter remove_empty

Changed in version 0.9: Settings for properties to exclude and include are not traversed

Changed in version 0.9.1: Dictionaries get copied before traversing, as otherwise, the special variables __dict__ and __0dict__ are modified, what may result in strange behaviour.

Changed in version 0.9.2: Dictionaries do not get copied by default, but there is a private method that can be overridden in derived classes to copy the dictionary.

class nmraspecds.metadata.Probehead(dict_=None)

Bases: Metadata

Metadata corresponding to the probehead.

model

Model of the probehead used.

Commercial probeheads come with a distinct model that goes in here. In all other cases, use a short, memorisable, and unique name.

Type:

str

configuration

Listing of additional coils and capacitors to change the probes’ frequency.

Type:

str

from_dict(dict_=None)

Set properties from dictionary, e.g., from metadata.

Only parameters in the dictionary that are valid properties of the class are set accordingly.

Keys in the dictionary are converted to lower case and spaces converted to underscores to fit the naming scheme of attributes.

If a property is of class aspecd.metadata.PhysicalQuantity, it is set accordingly.

Parameters:

dict (dict) – Dictionary containing properties to set

to_dict(remove_empty=False)

Create dictionary containing public attributes of an object.

Parameters:

remove_empty (bool) –

Whether to remove keys with empty values

Default: False

Returns:

public_attributes – Ordered dictionary containing the public attributes of the object

The order of attribute definition is preserved

Return type:

collections.OrderedDict

Changed in version 0.6: New parameter remove_empty

Changed in version 0.9: Settings for properties to exclude and include are not traversed

Changed in version 0.9.1: Dictionaries get copied before traversing, as otherwise, the special variables __dict__ and __0dict__ are modified, what may result in strange behaviour.

Changed in version 0.9.2: Dictionaries do not get copied by default, but there is a private method that can be overridden in derived classes to copy the dictionary.

class nmraspecds.metadata.Experiment(dict_=None)

Bases: Metadata

Metadata corresponding to the experiment.

type
Type:

str

runs

Number of recorded runs.

Type:

int

nuclei

List of involved nuclei.

Each nucleus is an object of type Nucleus

Type:

list

mas_frequency

Magic Angle Spinning Frequency of the experiment, given in Hz.

Type:

int

spectrometer_frequency

Current spectrometer frequency of the dataset.

Current spectrometer frequency (“SF” in Bruker’s Topspin) of the dataset. Is different from the transmitter frequency (and independend of it) depending on the axis. The value is obtained after referencing the measurement.

Type:

aspecd.metadata.PhysicalQuantity

add_nucleus(nucleus)
property spectrum_reference
from_dict(dict_=None)

Set properties from dictionary, e.g., from metadata.

Only parameters in the dictionary that are valid properties of the class are set accordingly.

Keys in the dictionary are converted to lower case and spaces converted to underscores to fit the naming scheme of attributes.

If a property is of class aspecd.metadata.PhysicalQuantity, it is set accordingly.

Parameters:

dict (dict) – Dictionary containing properties to set

to_dict(remove_empty=False)

Create dictionary containing public attributes of an object.

Parameters:

remove_empty (bool) –

Whether to remove keys with empty values

Default: False

Returns:

public_attributes – Ordered dictionary containing the public attributes of the object

The order of attribute definition is preserved

Return type:

collections.OrderedDict

Changed in version 0.6: New parameter remove_empty

Changed in version 0.9: Settings for properties to exclude and include are not traversed

Changed in version 0.9.1: Dictionaries get copied before traversing, as otherwise, the special variables __dict__ and __0dict__ are modified, what may result in strange behaviour.

Changed in version 0.9.2: Dictionaries do not get copied by default, but there is a private method that can be overridden in derived classes to copy the dictionary.

class nmraspecds.metadata.Nucleus(dict_=None)

Bases: Metadata

Metadata to describe the observed nucleus.

The here mentioned frequencies are the settings given in the pulse program: The base frequency of the nucleus that corresponds to the current magnetic field (and that needs to get recalibrated from time to time) and the offset if one wants to excite the nucleus with a certain offset and not at 0 ppm.

type

Nucleus that is observed, such as 1H or 29Si or 195Pt.

Type:

str

base_frequency

Current base frequency of a given nucleus.

Type:

aspecd.metadata.PhysicalQuantity

offset_hz

Offset of the nucleus’ frequency, given in Hz. (O1 in Buker’s Topspin)

Type:

aspecd.metadata.PhysicalQuantity

property transmitter_frequency

Actual frequency of the pulses of the given nucleus.

Returns:

transmitter_frequency

Return type:

aspecd.metadata.PhysicalQuantity

property offset_ppm

Offset of the pulse in ppm (O1p in Bruker’s Topspin)

Returns:

offset_ppm

Return type:

aspecd.metadata.PhysicalQuantity

from_dict(dict_=None)

Set properties from dictionary, e.g., from metadata.

Only parameters in the dictionary that are valid properties of the class are set accordingly.

Keys in the dictionary are converted to lower case and spaces converted to underscores to fit the naming scheme of attributes.

If a property is of class aspecd.metadata.PhysicalQuantity, it is set accordingly.

Parameters:

dict (dict) – Dictionary containing properties to set

to_dict(remove_empty=False)

Create dictionary containing public attributes of an object.

Parameters:

remove_empty (bool) –

Whether to remove keys with empty values

Default: False

Returns:

public_attributes – Ordered dictionary containing the public attributes of the object

The order of attribute definition is preserved

Return type:

collections.OrderedDict

Changed in version 0.6: New parameter remove_empty

Changed in version 0.9: Settings for properties to exclude and include are not traversed

Changed in version 0.9.1: Dictionaries get copied before traversing, as otherwise, the special variables __dict__ and __0dict__ are modified, what may result in strange behaviour.

Changed in version 0.9.2: Dictionaries do not get copied by default, but there is a private method that can be overridden in derived classes to copy the dictionary.

class nmraspecds.metadata.Rotor(dict_=None)

Bases: SampleContainer

Details on the rotor used for the experiment.

manufacturer

Manufacturer of the rotor

Type:

str

material

material, e.g. ZrO2, sapphire, diamond

Type:

str

diameter

Outer diameter of the rotor in mm

Type:

aspecd:metadata:PhysicalQuantity

cap_material

Material of the sealing cap e.g. ZrO2, Kel-F, Vespel

Type:

str

plug

Declares if plug was used and if yes, which one.

Type:

str

insert

Describes insert if one was used,

Type:

str

from_dict(dict_=None)

Set properties from dictionary, e.g., from metadata.

Only parameters in the dictionary that are valid properties of the class are set accordingly.

Keys in the dictionary are converted to lower case and spaces converted to underscores to fit the naming scheme of attributes.

If a property is of class aspecd.metadata.PhysicalQuantity, it is set accordingly.

Parameters:

dict (dict) – Dictionary containing properties to set

to_dict(remove_empty=False)

Create dictionary containing public attributes of an object.

Parameters:

remove_empty (bool) –

Whether to remove keys with empty values

Default: False

Returns:

public_attributes – Ordered dictionary containing the public attributes of the object

The order of attribute definition is preserved

Return type:

collections.OrderedDict

Changed in version 0.6: New parameter remove_empty

Changed in version 0.9: Settings for properties to exclude and include are not traversed

Changed in version 0.9.1: Dictionaries get copied before traversing, as otherwise, the special variables __dict__ and __0dict__ are modified, what may result in strange behaviour.

Changed in version 0.9.2: Dictionaries do not get copied by default, but there is a private method that can be overridden in derived classes to copy the dictionary.