erlab.io.plugins.mbs

Data loader for MB Scientific analyzers.

Provides a base class for implementing loaders that can load .txt and .krax filew acquired with MB Scientific analyzers. Subclass to implement the actual loading.

Functions

load_krax(filename, *[, without_values])

Load MBS deflector maps in .krx format.

load_text(filename)

Load data from MB Scientific analyzers in .txt format.

Classes

class erlab.io.plugins.mbs.MBSLoader[source]

Bases: LoaderBase

name: str = 'mbs'

Name of the loader. Using a unique and descriptive name is recommended. For easy access, it is recommended to use a name that passes str.isidentifier().

Notes

  • Changing the name of a loader is not recommended as it may break existing code. Pick a simple, descriptive name that is unlikely to change.

  • Loaders with the name prefixed with an underscore are not registered.

description: str = 'MB Scientific .txt and .krx files'

A short description of the loader shown to users.

Added in version 3.3.0.

extensions: ClassVar[set[str]] = {'.krx', '.txt'}

File extensions supported by the loader in lowercase with the leading dot.

An UnsupportedFileError is raised if a file with an unsupported extension is passed to the loader. If None, the loader will attempt to load any file passed to it.

If the loader supports directories, the extension should be an empty string.

Added in version 3.5.1.

name_map: ClassVar[dict] = {'alpha': 'angles', 'beta': 'defl_angles', 'eV': 'energies'}

Dictionary that maps new coordinate or attribute names to original coordinate or attribute names. If there are multiple possible names for a single attribute, the value can be passed as an iterable.

Note

  • Non-dimension coordinates in the resulting data will try to follow the order of the keys in this mapping.

  • Original coordinate names included in this mapping will be replaced by the new names. However, original attribute names will be duplicated with the new names so that both the original and new names are present in the data after loading. This is to keep track of the original names for reference.

additional_attrs: ClassVar[dict] = {}

Additional attributes to be added to the data after loading.

If a callable is provided, it will be called with the data as the only argument.

Notes

  • The attributes are added after renaming with process_keys, so keys will appear in the data as provided.

  • If an attribute with the same name is already present in the data, it is skipped unless the key is listed in overridden_attrs.

always_single: bool = True

Setting this to True disables implicit loading of multiple files for a single scan. This is useful for setups where each scan is always stored in a single file.

skip_validate: bool = True

If True, validation checks will be skipped. If False, data will be checked with validate.

property file_dialog_methods
load_single(file_path, **kwargs)[source]
identify(num, data_dir, **kwargs)[source]
erlab.io.plugins.mbs.load_krax(filename, *, without_values=False)[source]

Load MBS deflector maps in .krx format.

Adapted to Python from the load_krax_FS.ipf Igor procedure by Felix Baumberger, University of Geneva.

erlab.io.plugins.mbs.load_text(filename)[source]

Load data from MB Scientific analyzers in .txt format.

Adapted to Python from the MBS_FileLoader_v4.ipf Igor procedure with some code from mueslo/mbs.