io

This module contains:

Parsing functions used to extract information from experimental files.

Classes used to help make parsing more modular. These include the NexusBase class and its children.

Module Contents

Functions

i07_dat_to_dict_dataframe

Parses a .dat file recorded by I07, returning a [now mostly obsolete] tuple containing a metadata dictionary and a pandas dataframe of the data.

load_ind_image_from_h5

check_total_images_in_h5

load_images_from_h5

Loads images from a .h5 file.

parse_adjustments

make_data

i07_nxs_parser_noload

copy of i07_nxs_parser that doesnt load all images at the start - only loads images when needed Parses a .nxs file acquired from the I07 beamline at diamond, returning an instance of Scan2D. This process involves loading the images contained in the .h5 file pointed at by the .nxs file, as well as retrieving the metadata from the .nxs file that is relevant for XRR reduction.

i07_nxs_parser_noload_diff

copy of i07_nxs_parser that doesnt load all images at the start - only loads images when needed Parses a .nxs file acquired from the I07 beamline at diamond, returning an instance of Scan2D. This process involves loading the images contained in the .h5 file pointed at by the .nxs file, as well as retrieving the metadata from the .nxs file that is relevant for XRR reduction.

i07_nxs_parser

Parses a .nxs file acquired from the I07 beamline at diamond, returning an instance of Scan2D. This process involves loading the images contained in the .h5 file pointed at by the .nxs file, as well as retrieving the metadata from the .nxs file that is relevant for XRR reduction.

_try_to_find_files

Check that data files exist if the file parsed by parser pointed to a separate file containing intensity information. If the intensity data file could not be found in its original location, check a series of probable locations for the data file. If the data file is found in one of these locations, update file’s entry in self.data.

API

io.i07_dat_to_dict_dataframe(file_path)

Parses a .dat file recorded by I07, returning a [now mostly obsolete] tuple containing a metadata dictionary and a pandas dataframe of the data.

Though outdated, this is still a handy way to parse the DCD normalization .dat file.

Args:

(str): The .dat file to be read.

Returns:
tuple: Containing:
  • dict: The metadata from the .dat file.

  • pandas.DataFrame: The data from the .dat file.

io.load_ind_image_from_h5(h5_file_path, datanxfilepath, ind, transpose=False)
io.check_total_images_in_h5(h5_file_path, datanxfilepath)
io.load_images_from_h5(h5_file_path, datanxfilepath, transpose=False)

Loads images from a .h5 file.

Args:
h5_file_path:

Path to the h5 file from which we’re loading images.

transpose:

Should we take the transpose of these images? Defaults to True.

io.parse_adjustments(i07_nxs, adjustments)
io.make_data(axis, axis_name, axis_type, shared_vals, q_offset, theta_offset)
io.i07_nxs_parser_noload(file_path: str, remove_indices=None, adjustments=None)

copy of i07_nxs_parser that doesnt load all images at the start - only loads images when needed Parses a .nxs file acquired from the I07 beamline at diamond, returning an instance of Scan2D. This process involves loading the images contained in the .h5 file pointed at by the .nxs file, as well as retrieving the metadata from the .nxs file that is relevant for XRR reduction.

Args:
file_path:

Path to the .nxs file.

Returns:

An initialized Scan2D object containing all loaded detector frames, as well as the relevant metadata from the .nxs file.

io.i07_nxs_parser_noload_diff(file_path: str, remove_indices=None, adjustments=None)

copy of i07_nxs_parser that doesnt load all images at the start - only loads images when needed Parses a .nxs file acquired from the I07 beamline at diamond, returning an instance of Scan2D. This process involves loading the images contained in the .h5 file pointed at by the .nxs file, as well as retrieving the metadata from the .nxs file that is relevant for XRR reduction.

Args:
file_path:

Path to the .nxs file.

Returns:

An initialized Scan2D object containing all loaded detector frames, as well as the relevant metadata from the .nxs file.

io.i07_nxs_parser(file_path: str, remove_indices=None, adjustments=None)

Parses a .nxs file acquired from the I07 beamline at diamond, returning an instance of Scan2D. This process involves loading the images contained in the .h5 file pointed at by the .nxs file, as well as retrieving the metadata from the .nxs file that is relevant for XRR reduction.

Args:
file_path:

Path to the .nxs file.

Returns:

An initialized Scan2D object containing all loaded detector frames, as well as the relevant metadata from the .nxs file.

io._try_to_find_files(filenames: List[str], additional_search_paths: List[str])

Check that data files exist if the file parsed by parser pointed to a separate file containing intensity information. If the intensity data file could not be found in its original location, check a series of probable locations for the data file. If the data file is found in one of these locations, update file’s entry in self.data.

Returns:
list of str:

List of the corrected, actual paths to the files.