hyperspy.io_plugins.jeol module

hyperspy.io_plugins.jeol._read_pts(filename, scale=None, rebin_energy=1, sum_frames=True, SI_dtype=<class 'numpy.uint8'>, cutoff_at_kV=None, downsample=1, only_valid_data=True, read_em_image=False, frame_list=None, frame_start_index=None, frame_shifts=None, lazy=False, **kwargs)
Parameters:
  • rawdata (numpy.ndarray of uint16) – spectrum image part of pts file

  • scale (list of float) – -scale[2], scale[3] are the positional scale from asw data, default is None, calc from pts internal data

  • rebin_energy (int) – Binning parameter along energy axis. Must be 2^n.

  • sum_frames (bool) – If False, returns each frame.

  • SI_dtype (dtype) – data type for spectrum image. default is uint8

  • cutoff_at_kV (float) – The maximum energy. Useful to reduce memory size of spectrum image. Default is None (no cutoff)

  • downsample (int or (int, int)) – Downsample along spatial axes to reduce memory size of spectrum image. Value must be 2^n. Default is 1 (no downsampling).

  • only_valid_data (bool, default True) – Read incomplete frame if only_valid_data == False (usually interrupting mesurement makes incomplete frame)

  • read_em_image (bool, default False) – Read SEM/STEM image from pts file if read_em_image == True

  • frame_list (list of int, default None) – List of frame numbers to be read (None for all data)

  • frame_shifts (list of [int, int] or list of [int, int, int], default None) – Each frame will be loaded with offset of dy, dx, (and optional energy axis). Units are pixels/channels. This is useful for express drift correction. Not suitable for accurate analysis. Like the result of estimate_shift2D(), the first parameter is for y-axis

  • frame_start_index (list) – The list of offset pointers of each frame in the raw data. The pointer for frame0 is 0.

  • lazy (bool, default False) – Read spectrum image into sparse array if lazy == True SEM/STEM image is always read into dense array (numpy.ndarray)

Returns:

dictionary – The dictionary used to create the signals, list of dictionaries of spectrum image and SEM/STEM image if read_em_image == True

Return type:

dict or list of dict

hyperspy.io_plugins.jeol._readcube(rawdata, frame_start_index, frame_list, width, height, channel_number, width_norm, height_norm, rebin_energy, SI_dtype, sweep, frame_shifts, sum_frames, read_em_image, only_valid_data, lazy)

Read spectrum image (and SEM/STEM image) from pts file

rawdatanumpy.ndarray

Spectrum image part of pts file.

frame_start_indexnp.ndarray of shape (sweep+1, ) or (0, )

The indices of each frame start. If length is zero, the indices will be determined from rawdata.

frame_listlist

List of frames to be read.

width, heightint

The navigation dimension.

channel_numberint

The number of channels.

width_norm, height_normint

Rebin factor of the navigation dimension.

rebin_energyint

Rebin factor of the energy dimension.

sweepint

Number of sweep

frame_shiftslist

The list of image positions [[x0,y0,z0], …]. The x, y, z values can be negative. The data points outside data cube are ignored.

datanumpy.ndarray or dask.array

The spectrum image with shape (frame, x, y, energy) if sum_frames is False, otherwise (x, y, energy). If lazy is True, the dask array is a COO sparse array.

em_datanumpy.ndarray or dask.array

The SEM/STEM image with shape (frame, x, y) if sum_frames is False, otherwise (x, y).

has_em_imagebool

True if the stream contains SEM/STEM images.

sweepint

The number of loaded frames.

frame_start_indexlist

The indices of each frame start.

max_shiftnumpy.ndarray

The maximum shifts of the origin in the navigation dimension.

```
frame_shiftsnumpy.ndarray

The shifts of the origin in the navigation dimension for each frame.

hyperspy.io_plugins.jeol._readframe_dense(rawdata, countup, hypermap, em_image, width, height, channel_number, width_norm, height_norm, rebin_energy, dx, dy, dz, max_value)

Read one frame from pts file. Used in a inner loop of _readcube function. This function always read SEM/STEM image even if read_em_image == False hypermap and em_image array will be modified

Parameters:
  • rawdata (numpy.ndarray of uint16) – slice of one frame raw data from whole raw data

  • countup (1 for summing up the X-ray events, -1 to cancel selected frame) –

  • hypermap (numpy.ndarray(width, height, channel_number)) – numpy.ndarray to store decoded spectrum image.

  • em_image (numpy.ndarray(width, height), dtype = np.uint16 or np.uint32) – numpy.ndarray to store decoded SEM/TEM image.

  • width (int) –

  • height (int) –

  • channel_number (int) – Limit of channel to reduce data size

  • width_norm (int) – scanning step

  • height_norm (int) – scanning step

  • rebin_energy (int) – Binning parameter along energy axis. Must be 2^n.

  • dx (int) – information of frame shift for drift correction.

  • dy (int) – information of frame shift for drift correction.

  • dz (int) – information of frame shift for drift correction.

  • max_value (int) – limit of the data type used in hypermap array

Returns:

  • raw_length (int) – frame length based on raw data array

  • _ (int) – dummy value (used for lazy loading)

  • has_em_image (bool) – True if pts file have SEM/STEM image

  • valid (bool) – True if current frame is completely swept False for incomplete frame such as interrupt of measurement

  • max_valid (int) – maximum number of scan lines to be accepted as valid in case of incomplete frame

hyperspy.io_plugins.jeol._readframe_lazy(rawdata, _1, _2, em_image, width, height, channel_number, width_norm, height_norm, rebin_energy, dx, dy, dz, _3)

Read one frame from pts file. Used in a inner loop of _readcube function. This function always read SEM/STEM image even if read_em_image == False hypermap and em_image array will be modified

Parameters:
  • rawdata (numpy.ndarray of uint16) – slice of one frame raw data from whole raw data

  • _1 (dummy parameter, not used) –

  • _2 (dummy parameter, not used) –

  • em_image (numpy.ndarray(width, height), dtype = np.uint16 or np.uint32) – numpy.ndarray to store decoded SEM/TEM image.

  • width (int) –

  • height (int) –

  • channel_number (int) – Limit of channel to reduce data size

  • width_norm (int) – scanning step

  • height_norm (int) – scanning step

  • rebin_energy (int) – Binning parameter along energy axis. Must be 2^n.

  • dx (int) – information of frame shift for drift correction.

  • dy (int) – information of frame shift for drift correction.

  • dz (int) – information of frame shift for drift correction.

  • _3 (dummy parameter, not used) –

Returns:

  • raw_length (int) – frame length based on raw data array

  • data (list of [int, int, int]) – list of X-ray events as an array of [x, y, energy_ch]

  • has_em_image (bool) – True if pts file have SEM/STEM image

  • valid (bool) – True if current frame is completely swept False for incomplete frame such as interrupt of measurement

  • max_valid (int) – maximum number of scan lines to be accepted as valid in case of incomplete frame

hyperspy.io_plugins.jeol.file_reader(filename, **kwds)

File reader for JEOL format