nexusLIMS.extractors.plugins.fei_emi#
FEI TIA (.ser/.emi) extractor plugin.
Module Contents#
Classes#
Extractor for FEI TIA series files (.ser with accompanying .emi). |
Functions#
Parse basic metadata from file. |
|
Parse experimental conditions. |
|
Parse acquisition conditions. |
|
Parse experimental description. |
|
Get the accompanying |
|
Convert FEI unit string to Pint unit name. |
|
Split metadata into value and units. |
|
Map keys into NexusLIMS metadata structure with unit support. |
|
Parse the data type from the signal’s metadata. |
|
Get metadata from a .ser file and its accompanying .emi file. |
API#
- class nexusLIMS.extractors.plugins.fei_emi.SerEmiExtractor[source]#
Extractor for FEI TIA series files (.ser with accompanying .emi).
This extractor handles metadata extraction from files saved by FEI’s (now Thermo Fisher Scientific) TIA (Tecnai Imaging and Analysis) software. The .ser files contain the actual data, while .emi files contain metadata.
- name#
‘ser_emi_extractor’
- priority#
100
- supported_extensions#
Type: typing.ClassVar
- supports(context: ExtractionContext) bool[source]#
Check if this extractor supports the given file.
- Parameters:
context – The extraction context containing file information
- Returns:
True if file extension is .ser
- Return type:
- nexusLIMS.extractors.plugins.fei_emi.parse_basic_info(metadata, shape, instrument: Instrument)[source]#
Parse basic metadata from file.
Parse the metadata that is saved at specific places within the .emi tag structure into a consistent place in the metadata dictionary returned by
get_ser_metadata(). Specifically, this method handles the creation date, equipment manufacturer, and data shape/type.- Parameters:
metadata (dict) – A metadata dictionary as returned by
get_ser_metadata()shape – The shape of the dataset
instrument (Instrument) – The instrument this file was collected on
- Returns:
metadata – The same metadata dictionary with some values added under the root-level
nx_metakey- Return type:
- nexusLIMS.extractors.plugins.fei_emi.parse_experimental_conditions(metadata)[source]#
Parse experimental conditions.
Parse the metadata that is saved at specific places within the .emi tag structure into a consistent place in the metadata dictionary returned by
get_ser_metadata(). Specifically looks at the “ExperimentalConditions” node of the metadata structure.- Parameters:
metadata (dict) – A metadata dictionary as returned by
get_ser_metadata()- Returns:
metadata – The same metadata dictionary with some values added under the root-level
nx_metakey- Return type:
- nexusLIMS.extractors.plugins.fei_emi.parse_acquire_info(metadata)[source]#
Parse acquisition conditions.
Parse the metadata that is saved at specific places within the .emi tag structure into a consistent place in the metadata dictionary returned by
get_ser_metadata(). Specifically looks at the “AcquireInfo” node of the metadata structure.- Parameters:
metadata (dict) – A metadata dictionary as returned by
get_ser_metadata()- Returns:
metadata – The same metadata dictionary with some values added under the root-level
nx_metakey- Return type:
- nexusLIMS.extractors.plugins.fei_emi.parse_experimental_description(metadata)[source]#
Parse experimental description.
Parse the metadata that is saved at specific places within the .emi tag structure into a consistent place in the metadata dictionary returned by
get_ser_metadata(). Specifically looks at the “ExperimentalDescription” node of the metadata structure.- Parameters:
metadata (dict) – A metadata dictionary as returned by
get_ser_metadata()- Returns:
metadata – The same metadata dictionary with some values added under the root-level
nx_metakey- Return type:
Notes:
The terms to extract in this section were
- nexusLIMS.extractors.plugins.fei_emi.get_emi_from_ser(ser_fname: Path) Path[source]#
Get the accompanying
.emifilename from an ser filename.This method assumes that the
.serfile will be the same name as the.emifile, but with an underscore and a digit appended. i.e.file.emiwould result in.serfiles namedfile_1.ser,file_2.ser, etc.- Parameters:
ser_fname – The absolute path of an FEI TIA
.serdata file- Returns:
emi_fname – The absolute path of the accompanying
.emimetadata fileindex (int) – The number of this .ser file (i.e. 1, 2, 3, etc.)
- Raises:
FileNotFoundError – If the accompanying .emi file cannot be resolved to be a file
- nexusLIMS.extractors.plugins.fei_emi.fei_unit_to_pint(fei_unit)[source]#
Convert FEI unit string to Pint unit name.
- nexusLIMS.extractors.plugins.fei_emi.split_fei_metadata_units(metadata_term)[source]#
Split metadata into value and units.
If present, separate a metadata term into its value and units. In the FEI metadata structure, units are indicated separated by an underscore at the end of the term. i.e.
High tension_kVindicates that theHigh tensionmetadata value has units ofkV.
- nexusLIMS.extractors.plugins.fei_emi.map_keys_with_units(term_mapping, base, metadata)[source]#
Map keys into NexusLIMS metadata structure with unit support.
Maps input metadata terms to NexusLIMS metadata structure, with support for (output_name, unit) tuples in the term_mapping values to create Pint Quantities.
- Parameters:
term_mapping (dict) – Dictionary where keys are tuples of strings (the input terms), and values are tuples of (output_name, unit) where output_name is either a string or list of strings, and unit is either a string (Pint unit name) or None
base (list) – The ‘root’ path within the metadata dictionary
metadata (dict) – A metadata dictionary
- Returns:
metadata – The same metadata dictionary with values added to nx_meta
- Return type:
- nexusLIMS.extractors.plugins.fei_emi.parse_data_type(s, metadata)[source]#
Parse the data type from the signal’s metadata.
Determine
"Data Type"and"DatasetType"for the given .ser file based off of metadata and signal characteristics. This method is used to determine whether the image is TEM or STEM, Image or Diffraction, Spectrum or Spectrum Image, etc.Due to lack of appropriate metadata written by the FEI software, a heuristic of axis limits and size is used to determine whether a spectrum’s data type is EELS or EDS. This may not be a perfect determination.
- Parameters:
s (
hyperspy.signal.BaseSignal(or subclass)) – The HyperSpy signal that contains the data of interestmetadata (dict) – A metadata dictionary as returned by
get_ser_metadata()
- Returns:
data_type (str) – The string that should be stored at metadata[‘nx_meta’][‘Data Type’]
dataset_type (str) – The string that should be stored at metadata[‘nx_meta’][‘DatasetType’]