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.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:From a SciTiff
A
Measurementobject can also be instantiated by a class method which loads a SciTiffs using theSciTiffpackages loader:Which will call
scitiff.load_scitiff(file_path=filename') to construct the ScippDataArrayused to then construct theMeasurement`.From a Tiff stack
For loading data which was not saved as a scitiff, such as data from other facilities, a loader is also
we need a loader which construct the Scipp Data Group from multiple tiff files. The loader should load all tiff files in a folder matching the user-given pattern, and construct the time-dimension by a user-given array or step-size.
The time_of_flights will take either a step-size or a list or numpy array of times for each image loaded which is located in the folder_path and matches the pattern.
The
RegionOfInterestlistThe
Measurementobject will have a list ofRegionOfInterestobjects which is initially empty. ARegionOfInterestobject defines a region in 4-dimensional space (x,y,z,t) of the full image. When passing aMeasurementobject to anAnalysisobject, an optional "region_of_interests" keyword can be used to only fit the given region of interests. Similarly thespectrummethod of theMeasurementobject takes the "region_of_interests" keyword to return the spectrum for a region rather than the entire sample:The keyword can be the name of a single
RegionOfInterestobject in theMeasurementor a list of names, in which case their spectra will be summed up.Creating a
RegionOfInterestInitially only square regions will be allowed, but it is planned to extend this in the future. As such each
RegionOfInterestobject is defined by the 2 points defining the square, the start and end points of the square. These points can be given manually to thecreate_region_of_interestmethod:Or by using the interactive widget from
essimaging:In which case their names will simply me: 'RegionOfInterest_0' etc.
Utility methods
The
Measurementobject will additionally provide a number of utility methods for user usage:.plot_spectrumwill plot the spectrum. Uses '.spectrum' to get the spectrum and thus also accepts theregion_of_interestskeyword..viewwill show the time-averaged image if no time is defined, otherwise will show image at that time frame.All reactions