SdtDataIo

class glotaran.builtin.io.sdt.sdt_file_reader.SdtDataIo(format_name: str)[source]

Bases: glotaran.io.interface.DataIoInterface

Initialize a Data IO plugin with the name of the format.

Parameters

format_name (str) – Name of the supported format an instance uses.

Methods Summary

load_dataset

Reads a *.sdt file and returns a pd.DataFrame (return_dataframe==True), a SpectralTemporalDataset (type_of_data=='st') or a FLIMDataset (type_of_data=='flim').

save_dataset

Save data from xarray.Dataset to a file (NOT IMPLEMENTED).

Methods Documentation

load_dataset(file_name: str, *, index: np.ndarray | None = None, flim: bool = False, dataset_index: int | None = None, swap_axis: bool = False, orig_time_axis_index: int = 2) xr.Dataset[source]

Reads a *.sdt file and returns a pd.DataFrame (return_dataframe==True), a SpectralTemporalDataset (type_of_data==’st’) or a FLIMDataset (type_of_data==’flim’).

Parameters
  • file_name (str) – Path to the sdt file which should be read.

  • index (list, np.ndarray) – This is only needed if type_of_data==”st”, since *.sdt files, which only contain spectral temporal data, lack the spectral information. Thus for the spectral axis data need to be given by the user.

  • flim – Set true if reading a result from a FLIM measurement.

  • dataset_index (int: default 0) – If the *.sdt file contains multiple datasets the index will used to select the wanted one

  • swap_axis (bool, default False) – Flag to switch a wavelength explicit input_df to time explicit input_df, before generating the SpectralTemporalDataset.

  • orig_time_axis_index (int) – Index of the axis which corresponds to the time axis. I.e. for data of shape (64, 64, 256), which are a 64x64 pixel map with 256 time steps, orig_time_axis_index=2.

Raises

IndexError: – If the length of the index array is incompatible with the data.

save_dataset(dataset: xr.Dataset | xr.DataArray, file_name: str)

Save data from xarray.Dataset to a file (NOT IMPLEMENTED).

Parameters
  • dataset (xr.Dataset) – Dataset to be saved to file.

  • file_name (str) – File to write the data to.