Interface IPosition
- All Known Implementing Classes:
AbstractPosition,MapPosition,Point,Scalar,StaticPosition
For instance a group of scannables which need to be at a certain location. For example at the start of a scan or for a scan datapoint.
NOTE: An object is available using IDeviceService.createPositioner() called IPositioner which can move scannables to a given position by level.
Implementations of this class should be immutable where possible. Where this is not possible they should not be modified once they have been fully initialized.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final uk.ac.diamond.daq.util.logging.deprecation.DeprecationLoggerDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionCreates a composite position with the values of this position and the values of the passed in position.The value of a named position.This method makes dimensionNames if they are null.default doubleReturns the value as a double, equivalent to((Number)get(name)).doubleValue()Available for convenience.doubleGet the exposure time to be used for the detector, in seconds.intgetIndex(int dimension) Get the data index of this point for a given scan dimension.intGet the index of the data for instance in a scan of temperature from 290 to 300 step 1, the indices will be 0-10.It is not required of an IPosition to provide getIndices() but it may do so to avoid a new map being built up.getNames()The names of all the scalars set for this position.intMost scans have rank 1 event though they move more motors line a line scan or a spiral scan.default intThe step where the position was in a scan, if it is a position being generated from a scan.default doubleDeprecated, for removal: This API element is subject to removal in a future version.It is not required of an IPosition to provide getValues() but it may do so to avoid a new map being built up.voidsetDimensionNames(List<List<String>> dimensionNames) voidsetExposureTime(double time) Call to set the exposure time for the position Exposure time is normally set before a 2D scan however for energy scans bands of different energies can be created each with a different step increment and potentially different exposure time.default voidsetStepIndex(int step) The step where the position was in a scan, if it is a position being generated from a scan.intsize()The number of named scalars in this position
-
Field Details
-
logger
@Deprecated(since="GDA 9.28", forRemoval=true) static final uk.ac.diamond.daq.util.logging.deprecation.DeprecationLogger loggerDeprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
size
int size()The number of named scalars in this position- Returns:
- number of scalars
-
getNames
The names of all the scalars set for this position. For instance 'x' and 'y' for a map or 'Temperature' Note to implementers: should never returnnull- Returns:
- name of scalars
-
getIndex
int getIndex(int dimension) Get the data index of this point for a given scan dimension. For instance- Parameters:
dimension-- Returns:
- data index for the given dimension index
-
getIndex
Get the index of the data for instance in a scan of temperature from 290 to 300 step 1, the indices will be 0-10. If one dimension has more than one motor with it, for instance x and y in a line scan, both getIndex("x") and getIndex("y") return the same value.- Returns:
- data index for given axis name
-
get
The value of a named position. For instanceget("X")to return the value of the X IScannable double.- Parameters:
name-- Returns:
- value for the given axis name
-
getValue
Deprecated, for removal: This API element is subject to removal in a future version.this method has a misleading name, usegetDouble(String)instead if you know you want a double, orget(String)if you want to get the value whatever its type.Returns the value as a double, equivalent to((Number)get(name)).doubleValue()Available for convenience. If the value is not aNumber, aClassCastExceptionis thrown.- Parameters:
name-- Returns:
- value for the given axis name as a double
- Throws:
ClassCastException- if the value is not aNumber
-
getDouble
Returns the value as a double, equivalent to((Number)get(name)).doubleValue()Available for convenience. If the value is not aNumber, aClassCastExceptionis thrown.- Parameters:
name-- Returns:
- value for the given axis name as a double
- Throws:
ClassCastException- if the value is not aNumber
-
compound
Creates a composite position with the values of this position and the values of the passed in position. The passed in position is assumed to be the parent in the scan.NOTE The scan names are not calculated on the call to compound because maintaining the list of names in each dimension is inefficient to calculate for each point (they do not change). Instead the names are created once and set into the position using setDimensionNames(...) available on abstract position.
- Parameters:
parent-- Returns:
- the compounded position
-
getStepIndex
default int getStepIndex()The step where the position was in a scan, if it is a position being generated from a scan. If not the value will be -1- Returns:
- position in a scan or -1
-
setStepIndex
default void setStepIndex(int step) The step where the position was in a scan, if it is a position being generated from a scan. If not the value will be -1- Parameters:
step-
-
getScanRank
int getScanRank()Most scans have rank 1 event though they move more motors line a line scan or a spiral scan. As scans are aggregated these scan dimensions sum together. Some scans start out as having two dimensions like a grid or raster scan.- Returns:
- scan rank
-
getValues
It is not required of an IPosition to provide getValues() but it may do so to avoid a new map being built up. Implement this method to ensure that your position runs faster. The default implementation works.- Returns:
- values as a String to Object Map
- See Also:
-
getIndices
It is not required of an IPosition to provide getIndices() but it may do so to avoid a new map being built up. Implement this method to ensure that your position runs faster. The default implementation works.- Returns:
- map of indices for axis name
- See Also:
-
getExposureTime
double getExposureTime()Get the exposure time to be used for the detector, in seconds. Exposure time is normally set before a 2D scan however for energy scans bands of different energies can be created each with a different step increment and potentially different exposure time. It is not possible to set different detectors with different exposure times during the scan; that would require a map here. Anthony Hull and I decided this should be part of a future change, when required.- Returns:
- the exposure time in seconds. Can be zero but not negative. If zero then no change is made to the detector's exposure time setting.
-
setExposureTime
void setExposureTime(double time) Call to set the exposure time for the position Exposure time is normally set before a 2D scan however for energy scans bands of different energies can be created each with a different step increment and potentially different exposure time. It is not possible to set different detectors with different exposure times during the scan with the mechanism. This can achieved in a malcolm scan by settingIDetectorModel.setExposureTime(double)for each detector in theIMalcolmModel.- Parameters:
time- exposure time.
-
getDimensionNames
This method makes dimensionNames if they are null. Dimensions may contain 1-N axes, e.g. when a Mapping scan is bounded by a 2d region of interest.- Returns:
- axis names for each dimension
-
setDimensionNames
-
getDouble(String)instead if you know you want a double, orget(String)if you want to get the value whatever its type.