evedata.measurement.entities.measurement module
Entities representing a measurement, typically read from an eveH5 file.
A measurement generally reflects all the data obtained during a
measurement. However, to plot data or to perform some analysis, usually we
need data together with an axis (or multiple axes for nD data),
where data (“intensity values”) and axis values come from different HDF5
datasets. Furthermore, there may generally be the need/interest to plot
arbitrary data against each other, i.e. channel data vs. channel data
and axis data vs. axis data, not only channel data vs. axis data. This
is the decisive difference between the Measurement entity
and the
Measurement facade
, with the latter
having the additional attributes for storing the data to work on.
Overview
A first overview of the classes implemented in this module and their
hierarchy is given in the UML diagram below. Key is the Measurement
entity
.
Data
and Axis
seem not to be used here, but become
essential in the corresponding Measurement facade
. See
Fig. 18 and
the measurement.boundaries.measurement
module for details.
Fig. 42 Class hierarchy of the measurement.entities.measurement
module. Currently, this
diagram just reflects first ideas for a more abstract representation of a
measurement as compared to the data model of the evefile subpackage.
Devices in the scan_modules are all the detector(channel)s and motor(axe)s
used in a scan. Distinguishing between detector(channel)s/motor(axe)s,
beamline, and machine can (at least partially) happen based on the data
type: detector(channel)s are ChannelData
, motor(axe)s are
AxisData
. Machine
and beamline parameters are more tricky, as they can be
DeviceData
(from
the “monitor” section) as well as ChannelData
(and AxisData
for shutters and alike?)
from the original “main” and “snapshot” sections. Scan
and
Setup
inherit directly from their counterparts in the
evefile.entities.file
module.
Data
and Axis
seem not to be used here, but become
essential in the corresponding Measurement
facade. See
Fig. 18
for details.
Key aspects
The
Measurement
class, although quite similar on first sight to theEveFile
class, does not inherit from there nor fromFile
. Nevertheless, the contents of the attributes are in many cases the same objects as those of these other two classes.
Module documentation
- class evedata.measurement.entities.measurement.Measurement
Bases:
object
Representation of all information available for a given measurement.
Individual measurements are saved in HDF5 files using a particular schema (eveH5). Besides file-level metadata, there are log messages, a scan description (originally an XML/SCML file), and the actual data.
The data are organised in three functionally different sections: scan_modules, machine, and beamline.
- scan_modules
Modules the scan consists of.
Each item is an instance of
evedata.evefile.entities.file.ScanModule
and contains the data recorded within the given scan module.In case of no scan description present, a “dummy” scan module will be created containing all data.
- Type:
- machine
Data recorded from the machine involved in a measurement.
Each item is an instance of
evedata.evefile.entities.data.Data
.- Type:
- beamline
Data recorded from the beamline involved in a measurement.
Each item is an instance of
evedata.evefile.entities.data.Data
.- Type:
- device_snapshots
Snapshot data recorded from the devices involved in a scan.
Each item is an instance of
evedata.evefile.entities.data.MeasureData
.Snapshots reflect, as their name says, the state of the devices at a given point in time. Snapshots of devices involved in a scan are used in
data joining
to get additional reference points.- Type:
- metadata
Measurement metadata
- log_messages
Log messages from an individual measurement
Each item in the list is an instance of
evedata.evefile.entities.file.LogMessage
.- Type:
- scan
Description of the actual scan.
- station
Description of the actual setup.
- Type:
Station
- Raises:
exception – Short description when and why raised
- class evedata.measurement.entities.measurement.Data(data=array([], dtype=float64), axes=None)
Bases:
object
Unit containing both, numeric data and corresponding axes.
The data class ensures consistency in terms of dimensions between numerical data and axes.
- Parameters:
data (
numpy.ndarray
) – Numerical dataaxes (
list
) –List of objects of type
aspecd.dataset.Axis
The number of axes needs to be consistent with the dimensions of data.
Axes will be set automatically when setting data. Hence, the easiest is to first set data and only afterwards set axis values.
- Raises:
IndexError – Raised if number of axes is inconsistent with data dimensions
IndexError – Raised if axes values are inconsistent with data
- property data
Get or set (numeric) data.
Note
If you set data that have different dimensions to the data previously stored in the dataset, the axes values will be set to an array with indices corresponding to the size of the respective data dimension. You will most probably assign proper axis values afterwards. On the other hand, all other information stored in the axis object will be retained, namely quantity, unit, and label.
- property axes
Get or set axes.
If you set axes, they will be checked for consistency with the data. Therefore, first set the data and only afterwards the axes, with values corresponding to the dimensions of the data.
- Raises:
IndexError – Raised if number of axes is inconsistent with data dimensions
IndexError – Raised if axes values are inconsistent with data dimensions
- class evedata.measurement.entities.measurement.Axis
Bases:
object
Axis for data.
An axis contains always both, numerical values as well as the metadata necessary to create axis labels and to make sense of the numerical information.
- quantity
quantity of the numerical data, usually used as first part of an automatically generated axis label
- Type:
- unit
unit of the numerical data, usually used as second part of an automatically generated axis label
- Type:
- symbol
symbol for the quantity of the numerical data, usually used as first part of an automatically generated axis label
- Type:
- label
manual label for the axis, particularly useful in cases where no quantity and unit are provided or should be overwritten.
- Type:
Note
There are three alternative ways of writing axis labels, one with using the quantity name and the unit, one with using the quantity symbol and the unit, and one using both, quantity name and symbol, usually separated by comma. Quantity and unit shall always be separated by a slash. Which way you prefer is a matter of personal taste and given context.
- Raises:
ValueError – Raised when trying to set axis values to another type than numpy array
IndexError – Raised when trying to set axis values to an array with more than one dimension. Raised if index does not have the same length as values.
- property values
Get or set the numerical axis values.
Values require to be a one-dimensional numpy array. Trying to set values to either a different type that cannot be converted to a numpy array or a numpy array with more than one dimension will raise a corresponding error.
- Raises:
ValueError – Raised if axis values are of wrong type
IndexError – Raised if axis values are of wrong dimension, i.e. not a vector
- property equidistant
Return whether the axes values are equidistant.
True if the axis values are equidistant, False otherwise. None in case of no axis values.
The property is set automatically if axis values are set and therefore read-only.
While simple plotting of data values against non-uniform axes with non-equidistant values is usually straightforward, many processing steps rely on equidistant axis values in their simplest possible implementation.