SciFiReaders.readers.microscopy.spm.afm.pifm.PiFMTranslator

class SciFiReaders.readers.microscopy.spm.afm.pifm.PiFMTranslator(file_path, *args, **kwargs)[source]

Bases: sidpy.sid.reader.Reader

Class that writes images, spectrograms, point spectra and associated ancillary data sets to h5 file in pyUSID data structure.

Parameters

file_path (str) – Path to the file that needs to be read

self._input_file_path

Path to the file that will be read

Type

str

Notes

  • This method will check to make sure that the provided file_path is indeed a string and a valid file path.

  • Consider calling can_read() within __init__() for validating the provided file

Raises

FileNotFoundError

Methods

can_read

Checks whether the provided file can be read by this reader.

create_h5

Writes a new HDF5 file with the translated data

create_hdf5_file

Sets up the HDF5 file for writing

get_path

writes full path, directory, and file name as attributes to class

make_datasets

make_dimensions

read

param file_path

Absolute path of the .ibw file

read_anfatec_params

reads the scan parameters and writes them to a dictionary

read_file_desc

reads spectrogram, image, and spectra file descriptions and stores all to dictionary where the key:value pairs are filename:[all descriptors]

read_imgs

reads images and saves to dictionary

read_spectra

reads all point spectra and saves to dictionary

read_spectrograms

reads spectrograms, associated spectral values, and saves them in two dictionaries

write_datasets_hdf5

Writes the datasets as pyNSID datasets to the HDF5 file

can_read(*args, **kwargs)

Checks whether the provided file can be read by this reader.

This basic function compares the file extension against the extension keyword argument. If the extension matches, this function returns True

Parameters

extension (str or iterable of str, Optional. Default = None) – File extension for the input file.

Returns

file_path – Path to the file that needs to be provided to read() if the provided file was indeed a valid file Else, None

Return type

str

:raises NotImplementedError : if this function is called for this or a child: :raises class that does not provide the extension keyword argument:

Notes

It is recommended to add additional checks as necessary to ensure that the translator can indeed read the given file such as by validating the headers or similar metadata.

create_h5(append_path='', overwrite=False)[source]

Writes a new HDF5 file with the translated data

append_pathstring (Optional)

h5_file to add these data to, must be a path to the h5_file on disk

overwritebool (optional, default=False)

If True, will overwrite an existing .h5 file of the same name

create_hdf5_file(append_path='', overwrite=False)[source]

Sets up the HDF5 file for writing

append_pathstring (Optional)

h5_file to add these data to, must be a path to the h5_file on disk

overwritebool (optional, default=False)

If True, will overwrite an existing .h5 file of the same name

get_path()[source]

writes full path, directory, and file name as attributes to class

read()[source]
Parameters
  • file_path (String / unicode) – Absolute path of the .ibw file

  • verbose (Boolean (Optional)) – Whether or not to show print statements for debugging

Returns

sidpy.Dataset – Image layers are saved as separate Dataset objects

Return type

List of sidpy.Dataset objects.

read_anfatec_params()[source]

reads the scan parameters and writes them to a dictionary

read_file_desc()[source]

reads spectrogram, image, and spectra file descriptions and stores all to dictionary where the key:value pairs are filename:[all descriptors]

read_imgs()[source]

reads images and saves to dictionary

read_spectra()[source]

reads all point spectra and saves to dictionary

read_spectrograms()[source]

reads spectrograms, associated spectral values, and saves them in two dictionaries

write_datasets_hdf5()[source]

Writes the datasets as pyNSID datasets to the HDF5 file