The Measurement Object
#32
Locked
damskii9992
announced in
ADRs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
General
The
Measurementobject is usually the firsteasyimagingobject that a user creates. It is responsible for loading in the measured data, inspecting the data in various ways, perform simple edits on the data, like re-binning of it, and to create and hold Regions Of Interest (ROIs).The data is held in the
Measurementobject as a ScippDataArraywith strictly defined coordinates and dimensions. TheMeasurementobject is responsible for converting calls to Scipp syntax in order to interface with the Scipp DataArray.API Reference for the
Measurementclass is found here: https://easyscience.github.io/imaging-lib/0.0.2/api-reference/measurement/measurement/Creating the
MeasurementobjectThe
Measurementobject can be instantiated in 3 different ways, directly in a notebook from a pre-existing ScippDataArray, requiring no file-loading, from a SciTiff (the reduced data-format of choice) and from a regular tiff stack.Directly from a Scipp DataArray
To make smoother notebooks combining
essimagingfor the reduction andEasyImagingfor the analysis, it is possible to instantiate theMeasurementclass directly from a Scipp DataArray:Note
This has very strict requirements on the contents of the given Scipp
DataArray. Namely the array must have the dimensionsx,y, andtand the coordinatetofin the dimension oftwith a unit of time. If theDataArraydoes not fulfill this requirement, the constructor fails and theMeasurementisn't created.The
DataArraycan optionally havexandycoordinates, representing the physical positions of the pixels in space, if these exists in theDataArraythey must be in the dimensions ofxandyrespectively and have a unit of length.The
DataArraycan have masks, which will be respected, but any other coordinates of theDataArraywill be ignored.Tip
Here is an example of a valid Scipp
DataArray:Implementation details
The
Measurementclass implements a "rebin" method, which is technically not rebinning, since the data has already been histogrammed and we no longer have access to the neutron count data. Instead it is using theresizemethod fromessimagingto merge existing bins.Hence it only accepts whole integers for rebinning, reflecting how many bins to merge in each direction.
It is named "rebin" in
easyimagingbecause that is how it is understood in the imaging community.Any subsequent rebinning will rebin the already rebined image again, because this seemed the most natural behaviour, to recover the original image, the "revert_rebin" method exists.
Internally, when rebinning/resizing is done, a new array is created under
_rebinned_data_arrayand the original array is kept under_full_data_array. The internal property_data_arrayreturns the rebinned data array if it exists, otherwise it returns the full data array. Using the internal property thus ensures methods acts on whatever is the "current" image for the user.Link to the ADR suggestion:
#1
All reactions