ncempy.io.dectris module

This module provides an interface to Dectris Arina data sets

ncempy.io.dectris.dectrisReader(file_name)[source]
class ncempy.io.dectris.fileDECTRIS(filename, bad_pixels=None, verbose=False)[source]

Bases: object

Class to represent Dectris Arina data sets

Variables:
  • raw_shape (list) – The shape of the raw data. This is three-dimensional: [num_frames, frameY, frameX].

  • data_shape (list) – The four-dimensional shape of the dataset. By default, the scanned region is square.

  • file_hdl (h5py.File) – The h5py file handle which provides direct access to the underlying hdf5 file structure.

  • data_type (numpy.dtype) – The data type of the values in the data set.

getDataset(remove_bad_pixels=False, assume_shape=None)[source]

Read the data from the HDF5 files

Parameters:
  • remove_bad_pixels (bool, default False) – If True, _remove_bad_pixels function is called after the data is loaded.

  • assume_shape (tuple, optional) – If this is set, then this tuple is used as the scanning shape overriding the assumption of a square real space scanning grid

getMetadata()[source]

The dectris Arina files sometimes output an extra file with metadata in it. This checks for that file and reads the meta data if if exists. The units are assumed to be nanometers.

Returns:

Meta data as a dictionary

Return type:

dict

remove_bad_pixels(data, value=0, bad_pixels=None)[source]

Some pixels are known to be very high or very low. This function will replace the pixel values.

Parameters:
  • data (numpy.ndarray) – The 4D-STEM data set

  • value (int or float) – The value to replace the bad pixels by.

  • bad_pixels (numpy.ndarray) – A m by 2 ndarray where m is the number of bad pixels and the locations are specified in order for frame axis 2 and 3.