File Conversion

Hystorian provides utilities to convert raw data files from common SPM instruments into HDF5 format.

HyConvertedData

class hystorian.io.utils.HyConvertedData(data: dict[str, Any], metadata: dict[str, Any], attributes: dict[str, dict[str, Any]])

Dataclass containing the converted data from proprietary files. It contains:

  • data: a dict containing all the raw experimental datas.

  • metadata: all the extra informations extracted from the file, usually in a raw form.

  • Some default attributes (like the size of the data), and when convenient some extra attributes (usually extracted from the metadata) for ease of use.

Conversion Functions

These functions convert standard raw data files from SPM labs into HDF5 files.

Supported formats:

  • GSF files

  • IBW files

  • ARDF files

  • Nanoscope files

hystorian.io.extractors.gsf_files.extract(filename: Path) HyConvertedData

extract Read a Gwyddion Simple Field 1.0 file format http://gwyddion.net/documentation/user-guide-en/gsf.html

Parameters:

filename (Path) – The name of the input file to be converted

Return type:

HyConvertedData

Raises:

ValueError – Returned if the header of the file is not “Gwyddion Simple Field 1.0”, thus indicating that the gwyddion version used to generated the file is not supported.

hystorian.io.extractors.ibw_files.extract(filename: Path) HyConvertedData

extract_ibw uses igor2 (https://github.com/AFM-analysis/igor2/) to convert ibw files from Asylum AFM.

Parameters:

filename (Path) – The name of the input file to be converted

Returns:

The extra saved attributes are: the scale (in m/px), the image offset and the units of each channel.

Return type:

HyConvertedData

hystorian.io.extractors.ardf_files.extract(filename: Path) HyConvertedData

Extract datas based on original Matlab source code written by Matthew Poss available here: https://ch.mathworks.com/matlabcentral/fileexchange/80212-ardf-to-matlab/?s_tid=LandingPageTabfx

Parameters:

filename (Path) – The name of the input file to be converted

Return type:

HyConvertedData

hystorian.io.extractors.nanoscope_files.extract(path: Path) HyConvertedData

extract_nanoscope to convert Nanonis files to hdf5

Parameters:

filename (Path) – The name of the input file to be converted

Returns:

The metadata contains the scan_info from the orignal file, where the image_info are saved as attribute for each channel respectively

Return type:

HyConvertedData

Example: Convert a raw file

from hystorian.io.hyFile import HyFile
with HyFile('output.hdf5', 'r+') as f:
    f.extract_data('/path/to/raw_file.ibw')