ncempy.io.ser module

This module provides an interface to the SER file format written by TIA.

Following the information provided by Dr Chris Boothroyd (http://www.er-c.org/cbb/info/TIAformat/).

exception ncempy.io.ser.NotSERError[source]

Bases: Exception

Exception if a file is not in SER file format.

class ncempy.io.ser.fileSER(filename, emifile=None, verbose=False)[source]

Bases: object

Class to represent SER files (read only).

Parameters:
  • filename (str) – Name of the SER file.
  • emifile (str) – Name of an optional _emi file to read metadata.
  • verbose (bool) – True to get extensive output while reading the file.
getDataset(index, verbose=False)[source]

Retrieve dataset from data file.

Parameters:
  • index (int) – Index of dataset.
  • verbose (bool) – True to get extensive output while reading the file.
Returns:

Tuple containing:

np.ndarray: Dataset as array.

dict: Metadata as dict.

Return type:

(tuple)

readHeader(verbose=False)[source]

Read and return the SER files header.

Parameters:verbose (bool) – True to get extensive output while reading the file.
Returns:The header of the SER file as dict.
Return type:(dict)
read_emi(filename)[source]

Read the meta data from an _emi file.

Parameters:filename (str) – Name of the _emi file.
Returns:Dict of metadata.
Return type:(dict)
writeEMD(filename)[source]

Write SER data to an EMD file.

Parameters:filename (str) – Name of the EMD file.
ncempy.io.ser.serReader(fName)[source]

Simple function to parse the file and read all datasets. This is a one function implementation to load all data in a ser file.