hyperspy.misc.io.fei_stream_readers module

class hyperspy.misc.io.fei_stream_readers.DenseSliceCOO(coords, data=None, shape=None, has_duplicates=True, sorted=False, prune=False, cache=False, fill_value=None, idx_dtype=None)

Bases: sparse._coo.core.COO

Just like sparse.COO, but returning a dense array on indexing/slicing

hyperspy.misc.io.fei_stream_readers.array_to_stream(array)

Convert an array to a FEI stream

Parameters

array (array) –

hyperspy.misc.io.fei_stream_readers.stream_to_array(stream, spatial_shape, channels, last_frame, first_frame=0, rebin_energy=1, sum_frames=True, dtype='uint16', spectrum_image=None)

Returns data stored in a FEI stream as a nd COO array

Parameters
  • stream (numpy array) –

  • spatial_shape (tuple of ints) – (ysize, xsize)

  • channels (ints) – Number of channels in the spectrum

  • rebin_energy (int) – Rebin the spectra. The default is 1 (no rebinning applied)

  • sum_frames (bool) – If True, sum all the frames

  • dtype (numpy dtype) – dtype of the array where to store the data

  • number_of_frame (int or None) –

  • spectrum_image (numpy array or None) – If not None, the array provided will be filled with the data in the stream.

hyperspy.misc.io.fei_stream_readers.stream_to_sparse_COO_array(stream_data, spatial_shape, channels, last_frame, rebin_energy=1, sum_frames=True, first_frame=0)

Returns data stored in a FEI stream as a nd COO array

Parameters
  • stream_data (numpy array) –

  • spatial_shape (tuple of ints) – (ysize, xsize)

  • channels (ints) – Number of channels in the spectrum

  • rebin_energy (int) – Rebin the spectra. The default is 1 (no rebinning applied)

  • sum_frames (bool) – If True, sum all the frames