trepr.io module

General facilities for input (and output).

In order to work with TREPR data, these data need to be imported into the trepr package. Therefore, the module provides importers for specific file formats. In case of TREPR spectroscopy, the measurement control software is often lab-written and specific for a local setup. One exception is the Bruker BES3T file format written by Bruker Xepr and Xenon software that can be used to record TREPR data in combination with a pulsed EPR spectrometer.

Another class implemented in this module is the trepr.io.DatasetImporterFactory, a prerequisite for recipe-driven data analysis. This factory returns the correct dataset importer for a specific dataset depending on the information provided (usually, a filename).

Importers for specific file formats

Currently, two file formats are supported by specific importers:

  • SpeksimImporter

    The Speksim format was developed in Freiburg in the group of Prof. G. Kothe and used afterwards in the group of Prof. S. Weber. The spectrometer control software was developed by Prof. U. Heinen.

    One speciality of this file format is that each transient is stored in an individual file. For each of these transients, a timestamp as well as the microwave frequency are recorded as well, allowing to analyse frequency drifts and irregularities in the data acquisition.

  • TezImporter

    The tez file format is the internal format used by the MATLAB(r) trepr toolbox developed by T. Biskup. It vaguely resembles the OpenDocument format used, e.g., by OpenOffice and LibreOffice. In short, the metadata are contained in an XML file, while the numerical data are stored as IEEE 754 standard binaries in separate files. The ASpecD dataset format (adf) is similar in some respect.

Implementing importers for additional file formats is rather straight-forward. For details, see the documentation of the aspecd.io module.

Module documentation

class trepr.io.DatasetImporterFactory

Bases: aspecd.io.DatasetImporterFactory

Factory for creating importer objects based on the source provided.

Often, data are available in different formats, and deciding which importer is appropriate for a given format can be quite involved. To free other classes from having to contain the relevant code, a factory can be used.

Currently, the sole information provided to decide about the appropriate importer is the source (a string). A concrete importer object is returned by the method get_importer(). If no source is provided, an exception will be raised.

If the source string does not match any of the importers handled by this module, the standard importers from the ASpecD framework are checked. See the documentation of the aspecd.io.DatasetImporterFactory base class for details.

class trepr.io.SpeksimImporter(source='')

Bases: aspecd.io.DatasetImporter

Import trepr raw data in Freiburg Speksim format including its metadata.

Datasets in this format consist of several time traces, each of which is stored in a text file. In order to analyse the raw data, it is necessary to store the time traces all together in one dataset.

The corresponding metadata are read from an external file in infofile format. For further information about the infofile format see: https://www.till-biskup.de/en/software/info/format.

Parameters

source (str) – Path to the raw data.

dataset

Entity containing data and metadata.

Type

trepr.dataset.ExperimentalDataset

Raises

FileNotFoundError – Raised if no infofile could be found.

class trepr.io.TezImporter(source='')

Bases: aspecd.io.DatasetImporter

Importer for MATLAB(r) trepr toolbox format.

The MATLAB(r) trepr toolbox format is basically a ZIP archive consisting of a list of standard IEEE 754 binary files containing the data and an XML file containing the accompanying metadata in structured form, enriched with information necessary to directly convert them back into MATLAB structures (corresponding to a Python dict).

Parameters

source (str) – Path to the raw data.

dataset

Entity containing data and metadata.

Type

trepr.dataset.ExperimentalDataset