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, rpl_info=None, encoding='latin-1', mmap_mode='c', *args, **kwds)#

Parses 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:
  • filename (str, pathlib.Path) – Filename of the file to read or corresponding pathlib.Path.

  • lazy (bool, Default=False) – Whether to open the file lazily or not.

  • rpl_info (dict, 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.

  • encoding (str, 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 (str, optional) – Default is copy-on-write "c", but different modes can be set. However, note that lazy loading does not support in-place writing (i.e lazy loading and the "r+" mode are incompatible). The mode has no effect for pickled or zipped files. A memory-mapped array is stored on disk, and not directly loaded into memory. However, it can be accessed and sliced like any ndarray. Memory mapping is especially useful for accessing small fragments of large files without reading the entire file into memory.

Returns:

List of dictionaries containing 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 parsed metadata

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

Return type:

list of dicts

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

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

Parameters:
  • filename (str, pathlib.Path) – Filename of the file to write to or corresponding pathlib.Path.

  • signal (dict) –

    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

  • encoding (str, 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.