Ripple format#

The .rpl format (short for “Raw Parameter List”) is an open standard format developed at NIST as native format for Lispix and is widely used to exchange multidimensional data. However, it only supports data of up to three dimensions. See the file specifications for a description of the file format and the parameter keys (some of which are specific to HyperSpy). This format is often used in EDS/EDX experiments.

The .rpl file lists the characteristics of the corresponding .raw file so that it can be loaded without human intervention. Thus, the reader parses a .rpl file and reads the data from the corresponding .raw file, or directly from a .raw file if the dictionary rpl_info is provided.

It can also be used to exchange data with Bruker and used in combination with the ImportRPL Digital Micrograph plugin it is very useful for exporting data to Gatan’s Digital Micrograph.

Note

This format may not provide information on the calibration. If so, you should add that after loading the file.

API functions#

rsciio.ripple.file_reader(filename, lazy=False, rpl_info=None, encoding='latin-1', mmap_mode=None)#

Read a ripple/raw file. Parse a lispix (https://www.nist.gov/services-resources/software/lispix) ripple (.rpl) file and reads the data from the corresponding raw (.raw) file; or, read a raw file if the dictionary rpl_info is provided.

Parameters:
filenamestr, pathlib.Path

Filename of the file to read or corresponding pathlib.Path.

lazybool, default=False

Whether to open the file lazily or not.

rpl_infodict, Default=None

A dictionary containing the keywords in order to read a .raw file without corresponding .rpl file. If None, the keywords are parsed automatically from the .rpl file.

encodingstr, default=”latin-1”

The encoding used to read the content of the file. Different file encodings, such as "utf8" can be set via this argument.

mmap_mode{None, “r+”, “r”, “w+”, “c”}, default=None

Argument passed to numpy.memmap. A memory-mapped array is stored on disk, and not directly loaded into memory. However, it can be accessed and sliced like any ndarray. Lazy loading does not support in-place writing (i.e lazy loading and the "r+" mode are incompatible). If None (default), the value is "r" when lazy=True, otherwise it is "c".

Returns:
list of dict

List of dictionaries containing the following fields:

  • ‘data’ – multidimensional numpy.ndarray or dask.array.Array

  • ‘axes’ – list of dictionaries describing the axes containing the fields ‘name’, ‘units’, ‘index_in_array’, and either ‘size’, ‘offset’, and ‘scale’ or a numpy array ‘axis’ containing the full axes vector

  • ‘metadata’ – dictionary containing the parsed metadata

  • ‘original_metadata’ – dictionary containing the full metadata tree from the input file

When the file contains several datasets, each dataset will be loaded as separate dictionary.

rsciio.ripple.file_writer(filename, signal, encoding='latin-1')#

Write a ripple/raw file. Write a Lispix (https://www.nist.gov/services-resources/software/lispix) ripple (.rpl) file and saves the data in a corresponding raw (.raw) file.

Parameters:
filenamestr, pathlib.Path

Filename of the file to write to or corresponding pathlib.Path.

signaldict

Dictionary containing the signal object. Should contain the following fields:

  • ‘data’ – multidimensional numpy array

  • ‘axes’ – list of dictionaries describing the axes containing the fields ‘name’, ‘units’, ‘index_in_array’, and either ‘size’, ‘offset’, and ‘scale’ or a numpy array ‘axis’ containing the full axes vector

  • ‘metadata’ – dictionary containing the metadata tree

encodingstr, default=”latin-1”

The encoding used to write the content of the file. Different file encodings, such as "utf8" can be set via this argument.