Skip to content

Latest commit

 

History

History
101 lines (70 loc) · 3.61 KB

dataset.rst

File metadata and controls

101 lines (70 loc) · 3.61 KB

Datasets in Iris

iris

The DiffractionDataset object

The DiffractionDataset object is the basis for iris's interaction with ultrafast electron diffraction data. DiffractionDataset objects are simply HDF5 files with a specific layout, and associated methods:

from iris import DiffractionDataset
import h5py

assert issubclass(DiffractionDataset, h5py.File)    # yep

You can take a look at h5py's documentation to familiarize yourself with h5py.File.

You can also use other HDF5 bindings to inspect DiffractionDataset instances.

Creating a DiffractionDataset

An easy way to create a DiffractionDataset is through the DiffractionDataset.from_collection method, which saves diffraction patterns and metadata:

DiffractionDataset.from_collection

The required metadata that must be passed to DiffractionDataset.from_collection is also listed in DiffractionDataset.valid_metadata. Metadata not listed in DiffractionDataset.valid_metadata will be ignored.

An other possibility is to create a DiffractionDataset from a AbstractRawDataset subclass using the DiffractionDataset.from_raw method :

DiffractionDataset.from_raw

Important Methods for the DiffractionDataset

The following three methods are the bread-and-butter of interacting with data. See the API section for a complete description.

DiffractionDataset.diff_data

DiffractionDataset.diff_eq

DiffractionDataset.time_series

DiffractionDataset.time_series_selection

The PowderDiffractionDataset object

For polycrystalline data, we can define more data structures and methods. A PowderDiffractionDataset is a strict subclass of a DiffractionDataset, and hence all methods previously described are also available.

Specializing a DiffractionDataset object into a PowderDiffractionDataset is done as follows:

from iris import PowderDiffractionDataset
dataset_path = 'C:\\path_do_dataset.hdf5'   # DiffractionDataset already exists

with PowderDiffractionDataset.from_dataset(dataset_path, center) as dset:
    # Do computation

Important Methods for the PowderDiffractionDataset

The following methods are specific to polycrystalline diffraction data. See the API section for a complete description.

PowderDiffractionDataset.powder_eq

PowderDiffractionDataset.powder_data

PowderDiffractionDataset.powder_calq

PowderDiffractionDataset.compute_baseline

HDF5 layout

DiffractionDataset instances (and by extension, PowderDiffractionDataset instances) are a specialization of HDF5 files. Therefore, it is possible to inspect and manipulate instances with any other tool that has bindings to the HDF5 libraries. The HDF5 layout is presented below.

To look at your own data, don't try to create such an HDF5 file by hand! Take a look at our plugin infrastructure (see plugins).

image