Package gda.scan
Class ScanDataPoint
java.lang.Object
gda.scan.ScanDataPoint
- All Implemented Interfaces:
IScanDataPoint,Serializable
This class holds information about the data collected at a single point on a scan. It is to be passed around between
objects for display \ recording of data.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDataFromDetector(Detector detector) Deprecated, for removal: This API element is subject to removal in a future version.voidaddDetector(Detector det) Add a detector to the list of detectors this object holds data from.voidaddDetectorData(Object data, String[] format) Add a piece of data to this object.voidaddPositionFromScannable(Scannable scannable) Deprecated, for removal: This API element is subject to removal in a future version.voidaddScannable(Scannable scannable) Add a scannable to the list of scannables this object holds data on.voidaddScannablePosition(Object data, String[] format) Add a position to the array of positions.voidaddScannablesAndDetectors(List<Scannable> allScannables, List<Detector> allDetectors) Deprecated, for removal: This API element is subject to removal in a future version.this method is not used.voidaddScannableWithPosition(Scannable scannable, Object position, String[] format) Adds a Scannable with its current data(/position/value) and the format that the data should be presented in.booleanDouble[]Returns the values held by this ScanDataPoint of Scannables, Monitors and Detectors.intgetDetector(String name) Searches the detectors for one of a given name.Return the vector of detector data which this object is a carrier of.Double[]Just returns array of detector data.String[][]returns a list of expanded detector header string for each data point.Return the list of names of detectors which this object holds data from.The list of detectors this object refers to.booleanReturns a string whose elements are separated by a mixture of tabs and spaces so that the columns are aligned with the output frominvalid reference
#toString()getHeaderString(ScanDataPointFormatter dataPointFormatter) getNames()intintDouble[]Just returns array of positions.String[]int[]intgetScannable(String name) Searches the scannables for one of a given name.String[][]String[]The list of scannables this object refers to.inthashCode()booleanisDetector(String name) Searches the detectors for one of a given name.booleanisScannable(String name) Searches the scannables for one of a given name.voidsetCommand(String command) voidsetCurrentFilename(String currentFilename) voidsetCurrentPointNumber(int currentPointNumber) voidsetDetectorData(List<Object> newData) protected voidsetDetectorData(List<Object> newData, String[][] format) Replaces the detector data held by the object.protected voidsetDetectorData(List<Object> newData, List<String[]> formats) voidsetDetectorFormats(String[][] detectorFormats) voidsetDetectorFormats(List<String[]> detectorFormats) voidsetDetectorHeader(String[] detectorHeader) voidsetDetectors(List<Detector> detectors) voidsetHasChild(boolean hasChild) voidsetInstrument(String instrument) voidsetNumberOfChildScans(int numberOfChildScans) voidsetNumberOfPoints(int numberOfPoints) voidsetScanDimensions(int[] scanDimensions) voidsetScanIdentifier(int scanIdentifier) voidsetScanInformation(ScanInformation newScanInfo) voidsetScannableFormats(String[][] scannableFormats) voidsetScannableFormats(List<String[]> scannableFormats) voidsetScannableHeader(String[] scannableHeader) voidsetScannablePositions(List<Object> scannablePositions) protected voidsetScannablePositions(List<Object> positions, String[][] formats) Replaces the scannable positions data held by the object.voidsetScannables(List<Scannable> scannables) voidsetScanObjects(List<IScanObject> scanObjects) voidsetScanPlotSettings(ScanPlotSettings scanPlotSettings) voidsetStepIds(List<IScanStepId> stepIds) voidsetUniqueName(String uniqueName) Returns a string of the information held by this object delimited by the static variable.Returns a string whose elements are separated by a mixture of tabs and spaces so that the columns are aligned with the output from getHeaderString().toFormattedString(ScanDataPointFormatter dataPointFormatter) toString()
-
Field Details
-
DELIMITER
The delimiter used by toString() method.- See Also:
-
-
Constructor Details
-
ScanDataPoint
public ScanDataPoint()
-
-
Method Details
-
addScannablesAndDetectors
@Deprecated(since="9.33", forRemoval=true) public void addScannablesAndDetectors(List<Scannable> allScannables, List<Detector> allDetectors) throws DeviceException Deprecated, for removal: This API element is subject to removal in a future version.this method is not used. It callsScannable.getPosition()on the scannables andDetector.readout()on the detectors, which arguably is not the job of a scan data point. Instead calladdScannable(Scannable)addScannablePosition(Object, String[]),addDetector(Detector)andaddDetectorData(Object, String[])(other methods are available.An alternative for populating this object. Can be used instead of repeated calls to addScannable,addScannablePosition,addDetector,addDetectorData.Note this makes calls to getPosition() in the scannables and readout() in the detectors.
- Specified by:
addScannablesAndDetectorsin interfaceIScanDataPoint- Parameters:
allScannables-allDetectors-- Throws:
DeviceException
-
addPositionFromScannable
@Deprecated(since="9.33", forRemoval=true) public void addPositionFromScannable(Scannable scannable) throws DeviceException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IScanDataPointGets a Scannables position and adds it to the data point. Does not add the Scannable itself.- Specified by:
addPositionFromScannablein interfaceIScanDataPoint- Parameters:
scannable-- Throws:
DeviceException
-
addDataFromDetector
@Deprecated(since="9.33", forRemoval=true) public void addDataFromDetector(Detector detector) throws DeviceException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IScanDataPointReads data from a detector and adds it to the point. Does not add the detector itself.- Specified by:
addDataFromDetectorin interfaceIScanDataPoint- Parameters:
detector-- Throws:
DeviceException
-
addScannableWithPosition
Description copied from interface:IScanDataPointAdds a Scannable with its current data(/position/value) and the format that the data should be presented in.- Specified by:
addScannableWithPositionin interfaceIScanDataPoint- Parameters:
scannable-position-format-
-
addDetectorData
Description copied from interface:IScanDataPointAdd a piece of data to this object. Calls to this method must be made in the same order as calls to addDetector to associate the data with the detector.- Specified by:
addDetectorDatain interfaceIScanDataPoint- Parameters:
data-
-
setDetectorData
Replaces the detector data held by the object. The replacement List must be the same length as the previous for this sdp to be self-consistent.- Parameters:
newData-
-
setDetectorData
-
setDetectorData
- Specified by:
setDetectorDatain interfaceIScanDataPoint
-
addScannablePosition
Description copied from interface:IScanDataPointAdd a position to the array of positions. Calls to this method must be made in the same order as calls to addScannable to associate the array of numbers with the scannable.It is recommended to call setScannables instead.
- Specified by:
addScannablePositionin interfaceIScanDataPoint- Parameters:
data-
-
setScannablePositions
Replaces the scannable positions data held by the object. The replacement array must be the same length as the previous for this sdp to be self-consistent.- Parameters:
positions-formats-
-
addDetector
Description copied from interface:IScanDataPointAdd a detector to the list of detectors this object holds data from. This stores the name in the detectorHeader array and detectorNames array. If it's a countertimer then it is stored in the boolean array. The contents of the detectorHeader and detectorNames arrays will be different if the detector is a countertimer.Note this does not readout the detector! Data must be added by using the addData method.
- Specified by:
addDetectorin interfaceIScanDataPoint- Parameters:
det-
-
addScannable
Description copied from interface:IScanDataPointAdd a scannable to the list of scannables this object holds data on.Note that this does not read the current position of the scannable.
- Specified by:
addScannablein interfaceIScanDataPoint- Parameters:
scannable-
-
getCommand
- Specified by:
getCommandin interfaceIScanDataPoint- Returns:
- the scan command entered to run the scan creating these ScanDataPoints
-
getCurrentFilename
- Specified by:
getCurrentFilenamein interfaceIScanDataPoint- Returns:
- the name of the data file being written
-
getCurrentPointNumber
public int getCurrentPointNumber()- Specified by:
getCurrentPointNumberin interfaceIScanDataPoint- Returns:
- the current point number in the scan
-
getDetectorData
Description copied from interface:IScanDataPointReturn the vector of detector data which this object is a carrier of.- Specified by:
getDetectorDatain interfaceIScanDataPoint- Returns:
- detector data
-
getAllValuesAsDoubles
Description copied from interface:IScanDataPointReturns the values held by this ScanDataPoint of Scannables, Monitors and Detectors.- Specified by:
getAllValuesAsDoublesin interfaceIScanDataPoint- Returns:
- an array of Double of length getMonitorHeader().size() + getPositionHeader().size() + getDetectorHeader().size() if the conversion of a field to Double is not possible then the element of the array will be null
- Throws:
IllegalArgumentException- if the fields convert to too few valuesIndexOutOfBoundsException- if the fields convert to too many values
-
getDetectorDataAsDoubles
Description copied from interface:IScanDataPointJust returns array of detector data.- Specified by:
getDetectorDataAsDoublesin interfaceIScanDataPoint- Returns:
- all detector data.
-
getDetectorHeader
Description copied from interface:IScanDataPointreturns a list of expanded detector header string for each data point.- Specified by:
getDetectorHeaderin interfaceIScanDataPoint- Returns:
- a list of expanded detector header string for each data point.
-
getDetectorNames
Description copied from interface:IScanDataPointReturn the list of names of detectors which this object holds data from.- Specified by:
getDetectorNamesin interfaceIScanDataPoint- Returns:
- list of detector names
-
getDetectors
Description copied from interface:IScanDataPointThe list of detectors this object refers to.- Specified by:
getDetectorsin interfaceIScanDataPoint- Returns:
- list of detectors this object refers to.
-
setDetectors
-
getHasChild
public boolean getHasChild()- Specified by:
getHasChildin interfaceIScanDataPoint- Returns:
trueif the current scan has a nested child scan,falseotherwise
-
getHeaderString
Description copied from interface:IScanDataPointReturns a string whose elements are separated by a mixture of tabs and spaces so that the columns are aligned with the output frominvalid reference
#toString()- Specified by:
getHeaderStringin interfaceIScanDataPoint- Returns:
- header string, which could be used in an ascii print out of all the scan points from the same scan
-
getHeaderString
- Specified by:
getHeaderStringin interfaceIScanDataPoint- Parameters:
dataPointFormatter-- Returns:
- String - the header String formatted used the given Formatter object
-
getDelimitedHeaderString
- Specified by:
getDelimitedHeaderStringin interfaceIScanDataPoint- Returns:
- the header with each element separated by a tab
-
getInstrument
- Specified by:
getInstrumentin interfaceIScanDataPoint- Returns:
- the beamline/instrument running the scan
-
getNames
- Specified by:
getNamesin interfaceIScanDataPoint- Returns:
- list of scannable names
-
getNumberOfChildScans
public int getNumberOfChildScans()- Specified by:
getNumberOfChildScansin interfaceIScanDataPoint- Returns:
- number of nested inner (child) scans
-
getNumberOfPoints
public int getNumberOfPoints()- Specified by:
getNumberOfPointsin interfaceIScanDataPoint- Returns:
- number of points in this scan
-
getPositionHeader
- Specified by:
getPositionHeaderin interfaceIScanDataPoint- Returns:
- the part of the header from the Scannables (not Detectors) as a list of strings
-
getPositions
- Specified by:
getPositionsin interfaceIScanDataPoint- Returns:
- the part of the data from the Scannables (not Detectors) as a list of objects
-
getScanIdentifier
public int getScanIdentifier()- Specified by:
getScanIdentifierin interfaceIScanDataPoint- Returns:
- unique ID of the scan
-
getScannableNames
- Specified by:
getScannableNamesin interfaceIScanDataPoint- Returns:
- list of the names of the Scannables in the scan
-
getPositionsAsDoubles
Description copied from interface:IScanDataPointJust returns array of positions. Strings will be an empty element.- Specified by:
getPositionsAsDoublesin interfaceIScanDataPoint- Returns:
- all scannable positions.
-
getPositionsAsFormattedStrings
- Specified by:
getPositionsAsFormattedStringsin interfaceIScanDataPoint- Returns:
- all Scannable positions as strings using the given format
-
getScannables
The list of scannables this object refers to.- Specified by:
getScannablesin interfaceIScanDataPoint- Returns:
- list of scannables this object refers to.
-
setScannables
-
getScanPlotSettings
- Specified by:
getScanPlotSettingsin interfaceIScanDataPoint
-
setScanPlotSettings
- Specified by:
setScanPlotSettingsin interfaceIScanDataPoint
-
getScanDimensions
public int[] getScanDimensions()- Specified by:
getScanDimensionsin interfaceIScanDataPoint- Returns:
- the dimensions of the nest of scans
-
setScanDimensions
public void setScanDimensions(int[] scanDimensions) - Specified by:
setScanDimensionsin interfaceIScanDataPoint
-
toString
-
toFormattedString
Description copied from interface:IScanDataPointReturns a string whose elements are separated by a mixture of tabs and spaces so that the columns are aligned with the output from getHeaderString().To be used to create an ascii version of the data held by this object for printing to terminals or to ascii files.
- Specified by:
toFormattedStringin interfaceIScanDataPoint
-
toFormattedString
- Specified by:
toFormattedStringin interfaceIScanDataPoint
-
toDelimitedString
Description copied from interface:IScanDataPointReturns a string of the information held by this object delimited by the static variable.- Specified by:
toDelimitedStringin interfaceIScanDataPoint- Returns:
- this point as a delimited string
-
hashCode
public int hashCode() -
equals
-
getStepIds
- Specified by:
getStepIdsin interfaceIScanDataPoint
-
setStepIds
- Specified by:
setStepIdsin interfaceIScanDataPoint
-
getUniqueName
- Specified by:
getUniqueNamein interfaceIScanDataPoint- Returns:
- the unique identifier for the scan.
-
setUniqueName
- Specified by:
setUniqueNamein interfaceIScanDataPoint
-
setCommand
- Specified by:
setCommandin interfaceIScanDataPoint
-
setCurrentFilename
- Specified by:
setCurrentFilenamein interfaceIScanDataPoint
-
setCurrentPointNumber
public void setCurrentPointNumber(int currentPointNumber) - Specified by:
setCurrentPointNumberin interfaceIScanDataPoint
-
setHasChild
public void setHasChild(boolean hasChild) - Specified by:
setHasChildin interfaceIScanDataPoint
-
setInstrument
- Specified by:
setInstrumentin interfaceIScanDataPoint
-
setNumberOfChildScans
public void setNumberOfChildScans(int numberOfChildScans) - Specified by:
setNumberOfChildScansin interfaceIScanDataPoint- Parameters:
numberOfChildScans- The numberOfChildScans to set.
-
setNumberOfPoints
public void setNumberOfPoints(int numberOfPoints) - Specified by:
setNumberOfPointsin interfaceIScanDataPoint
-
setScanIdentifier
public void setScanIdentifier(int scanIdentifier) - Specified by:
setScanIdentifierin interfaceIScanDataPoint
-
getScannableFormats
- Specified by:
getScannableFormatsin interfaceIScanDataPoint
-
setScannableFormats
- Specified by:
setScannableFormatsin interfaceIScanDataPoint
-
setScannableFormats
-
setDetectorHeader
- Specified by:
setDetectorHeaderin interfaceIScanDataPoint
-
getScannableHeader
- Specified by:
getScannableHeaderin interfaceIScanDataPoint
-
setScannableHeader
- Specified by:
setScannableHeaderin interfaceIScanDataPoint
-
getScannablePositions
- Specified by:
getScannablePositionsin interfaceIScanDataPoint
-
setScannablePositions
- Specified by:
setScannablePositionsin interfaceIScanDataPoint
-
getScanObjects
- Specified by:
getScanObjectsin interfaceIScanDataPoint
-
setScanObjects
- Specified by:
setScanObjectsin interfaceIScanDataPoint
-
getDetectorFormats
- Specified by:
getDetectorFormatsin interfaceIScanDataPoint
-
setDetectorFormats
- Specified by:
setDetectorFormatsin interfaceIScanDataPoint
-
setDetectorFormats
-
getScannable
Description copied from interface:IScanDataPointSearches the scannables for one of a given name. Used to avoid searches being in many places.- Specified by:
getScannablein interfaceIScanDataPoint- Parameters:
name-- Returns:
- the scannable with the given name in this point if it exists, otherwise
null
-
isScannable
Description copied from interface:IScanDataPointSearches the scannables for one of a given name. Works for scannables where name is declared and the actual scannable is not sent over.- Specified by:
isScannablein interfaceIScanDataPoint- Parameters:
name-- Returns:
trueif this point contains a scannable with this name,falseotherwise
-
getDetector
Description copied from interface:IScanDataPointSearches the detectors for one of a given name. Used to avoid searches being in many places.- Specified by:
getDetectorin interfaceIScanDataPoint- Parameters:
name-- Returns:
- the detector with the given name in this point if it exists, otherwise
null
-
isDetector
Description copied from interface:IScanDataPointSearches the detectors for one of a given name. Works for detectors where name is declared and the actual detector is not sent over.- Specified by:
isDetectorin interfaceIScanDataPoint- Parameters:
name-- Returns:
trueif this point contains a detector with the given name,falseotherwise
-
getScanInformation
- Specified by:
getScanInformationin interfaceIScanDataPoint
-
setScanInformation
-