erlab.io.plugins.maestro

Data loader for beamline 7.0.2 at ALS.

Note

This loader assumes vertical analyzer slit orientation and deflector mapping. For other configurations, the configuration attribute and coordinate names must be changed accordingly.

Classes

class erlab.io.plugins.maestro.MAESTROMicroLoader[source]

Bases: LoaderBase

name: str = 'maestro'

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 = 'ALS Beamline 7.0.2.1 MAESTRO'

A short description of the loader shown to users.

Added in version 3.3.0.

extensions: ClassVar[set[str]] = {'.h5'}

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.

aliases: Iterable[str] | None = ('ALS_BL7', 'als_bl7', 'BL702', 'bl702')

Alternative names for the loader.

Deprecated since version 3.3.0: Accessing loaders with aliases is deprecated and will be removed in a future version. Use the loader name instead.

name_map: ClassVar[dict] = {'beta': ('Slit Defl', 'Motors_Logical.Slit Defl'), 'chi': 'Motors_Logical.Theta', 'delta': 'Motors_Logical.Phi', 'hv': ('MONOEV', 'Beamline.Beamline Energy'), 'sample_temp': 'Cryostat_A', 'x': 'Motors_Logical.X', 'xi': 'Motors_Logical.Beta', 'y': 'Motors_Logical.Y', 'z': 'Motors_Logical.Z'}

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.

coordinate_attrs: tuple[str, ...] = ('beta', 'delta', 'hv', 'sample_temp', 'chi', 'xi', 'x', 'y', 'z')

Attribute names (after renaming) that should be treated as coordinates.

Put any attributes that should be propagated when concatenating data here.

Notes

  • If a listed attribute is not found, it is silently skipped.

  • The attributes given here, both before and after renaming, are removed from the attributes to avoid conflicting values.

  • If an existing coordinate with the same name is already present, the existing coordinate takes precedence and the attribute is silently dropped.

See also

process_keys

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.

skip_validate: bool = True

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

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.

formatters: ClassVar[dict[str, Callable]] = {'DAQ_Swept.lens mode name': <function MAESTROMicroLoader.<lambda>>, 'Main.START_T': <function MAESTROMicroLoader.<lambda>>, 'scan_type': <function MAESTROMicroLoader.<lambda>>}

Optional mapping from attr or coord names (after renaming) to custom formatters.

The formatters are callables that takes the attribute value and returns a value that can be converted to a string via value_to_string. The resulting string representations are used for human readable display in the summary table and the information accessor.

The values returned by the formatters will be further formatted by value_to_string before being displayed.

If the key is a coordinate, the function will automatically be vectorized over every value.

Note

The formatters are only used for display purposes and do not affect the stored data.

See also

get_formatted_attr_or_coord()

The method that uses this mapping to provide human-readable values.

summary_attrs: ClassVar[dict[str, str | Callable[[DataArray], Any]]] = {'analyzer slit': 'DAQ_Swept.Electron Spectrometer  Entrance Slit', 'azi': 'delta', 'deflector': 'beta', 'hv': 'hv', 'lens mode': 'DAQ_Swept.lens mode name', 'pass energy': 'DAQ_Swept.pass energy', 'pol': 'Beamline.EPU Polarization', 'polar': 'chi', 'post': 'post_scan', 'pre': 'pre_scan', 'region': 'DAQ_Swept.SS Region name', 'temperature': 'sample_temp', 'tilt': 'xi', 'time': 'Main.START_T', 'type': 'scan_type', 'x': 'x', 'y': 'y', 'z': 'z'}
property file_dialog_methods
identify(num, data_dir, **kwargs)[source]
load_single(file_path, **kwargs)[source]
files_for_summary(data_dir)[source]