Class BufferedScaler
- All Implemented Interfaces:
CounterTimer,Detector,BufferedDetector,DarkCurrentDetector,Device,Scannable,Configurable,Findable,gda.observable.IObservable,Serializable
Assumes that the TTL signal driving the TFG time-frames is connected to TFG socket TTL INPUT 0.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class gda.device.detector.countertimer.TfgScalerWithDarkCurrent
TfgScalerWithDarkCurrent.DarkCurrentBean -
Field Summary
Fields inherited from class gda.device.detector.countertimer.TfgScalerWithLogValues
LNI0IT_LABEL, LNITIREF_LABELFields inherited from class gda.device.detector.countertimer.TfgScaler
numChannelsToRead, scaler, timeChannelRequiredFields inherited from class gda.device.detector.countertimer.TFGCounterTimer
isTFGv2Fields inherited from class gda.device.detector.countertimer.CounterTimerBase
slave, timerFields inherited from class gda.device.detector.DetectorBase
collectionTimeFields inherited from class gda.device.scannable.ScannableBase
__doc__, DEFAULT_INPUT_NAME, DEFAULT_OUTPUT_FORMAT, extraNames, inputNames, level, outputFormatFields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTYFields inherited from interface gda.device.Scannable
ATTR_NEXUS_CATEGORY, ATTR_NX_CLASS, DEFAULT_INPUT_NAME, VALUE_UNAVAILABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled for every Scannable at the end of a group of nested scans (or a single scan if that is the case).voidvoidClears the detector memoryvoidclearMemoryFrames(int startFrame, int finalFrame) Clear specified block of scaler memory.voidTells the detector to begin to collect a set of data, then returns immediately.intReturn cycle currently being executed by Tfg by parsing the value of the Cycle field from the Tfg 'progress' string.intprotected StringgetFrameDaServerCommand(int numFrames, double totalTime, boolean externalTriggerFrames) doubledoubledouble[][]protected StringgetInitialDaServerCommand(boolean externalTriggerStart) intintdoubleThe excess time to collect data for above the movement time.intbooleanbooleanbooleanbooleanbooleanbooleanintAs certain detectors may cause memory issues if too many frames are attempted to be read in one go, this is the maximum for this detector based on its current configuration (i.e.Object[]An array of the data from the detector.Object[]readFrames(int startFrame, int finalFrame) An array of the data from the detector.double[]readout()Returns the latest data collected.voidsetContinuousMode(boolean on) When in slave mode the detector will be triggered by an external signal to collect each frame of data.voidsetContinuousParameters(ContinuousParameters parameters) Sets the parameters which define the continuous movement to usevoidsetDaserver(DAServer daserver) voidsetDeadPause(int deadPause) Set the dead pause value - used when using externally triggered frames (e.g.voidsetExternalTriggeredFrames(boolean externalTriggeredFrames) Set to true to have each time frame triggered by external source (Controls the dead pause and live pause values -voidsetExternalTriggerStart(boolean externalTriggerStart) Set to true to have the Tfg start when external TTL trigger signal is received.voidsetFrameCountDuringCycles(boolean frameCountDuringCycles) If set to false,getNumberFrames()will return zero while the Tfg is collecting frames across multiple cycles.voidsetFrameDeadTime(double frameDeadTime) Set the dead frame time.voidsetFrameLiveTime(double frameLiveTime) voidsetGroupInitialCommand(String groupInitialCommand) voidsetManualStart(boolean manualStart) voidsetNumCycles(int numCycles) voidsetOverrunTime(double overrunTime) voidsetReturnCountRates(Boolean returnCountRates) voidsetTtlSocket(Integer ttlSocket) Set the TTL trigger input to use for external start and for live pause (value = 0...3).protected voidsetupTimeFrames(boolean externalTriggerStart, boolean externalTriggerFrames) Setup and send the time frame commands to the Tfg.voidsetUseExternalTriggers(boolean tf) voidstartTfg(boolean externalTrigger) voidstop()Stop the current move/operation.Methods inherited from class gda.device.detector.countertimer.TfgScalerWithLogValues
addScalerOutputConfig, appendLogValues, clearScalerOutputConfig, configureScalerOutputProcessor, getI0ScalerChannel, getiRefScalerChannel, getItScalerChannel, getScalerOutputConfig, getScalerOutputProcessor, getTimeChannelName, getTotalChans, getUseCustomisedOutput, isOutputLogValues, performCorrections, readFrame, restoreExtraNamesFormats, saveExtraNamesFormats, setI0ScalerChannel, setiRefScalerChannel, setItScalerChannel, setOutputLogValues, setScalerOutputConfig, setTimeChannelName, setUseCustomisedOutputMethods inherited from class gda.device.detector.countertimer.TfgScalerWithDarkCurrent
acquireDarkCurrent, adjustChannelForDarkCurrent, adjustForDarkCurrent, atScanStart, getDarkCurrent, getDarkCurrentCollectionTime, getDarkCurrentResults, isDarkCurrentRequired, isUseReset, setDarkCurrent, setDarkCurrentCollectionTime, setDarkCurrentRequired, setUseResetMethods inherited from class gda.device.detector.countertimer.TfgScaler
addFrameSet, addFrameSet, atCommandFailure, atScanLineStart, clearFrameSets, configure, countAsync, createsOwnFiles, getAttribute, getDescription, getDetectorID, getDetectorType, getFirstDataChannel, getInputNames, getMinimumReadoutDelay, getNumChannelsToRead, getScaler, getScalerName, isTimeChannelRequired, readChannel, readChans, readFrame, readoutCurrentFrame, readoutFrames, setAttribute, setFirstDataChannel, setMinimumReadoutDelay, setNumChannelsToRead, setScaler, setScalerName, setTimeChannelRequired, startMethods inherited from class gda.device.detector.countertimer.TFGCounterTimer
isTFGv2, setTFGv2Methods inherited from class gda.device.detector.countertimer.CounterTimerBase
getCurrentFrame, getMaximumFrames, getStatus, getTimer, getTimerName, isSlave, loadFrameSets, restart, setCycles, setSlave, setTimer, setTimerNameMethods inherited from class gda.device.detector.DetectorBase
asynchronousMoveTo, checkPositionValid, endCollection, getCollectionTime, getDataDimensions, getPosition, isBusy, prepareForCollection, setCollectionTime, toFormattedStringMethods inherited from class gda.device.scannable.ScannableBase
__call__, __call__, __doc__, __getitem__, __len__, __repr__, __str__, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanLineEnd, externalToInternal, getExtraNames, getLevel, getOutputFormat, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, internalToExternal, isAt, moveTo, rawAsynchronousMoveTo, rawGetPosition, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, throwExceptionIfInvalidTarget, toString, validateScannable, valueUnavailableString, waitWhileBusy, waitWhileBusyMethods inherited from class gda.device.DeviceBase
addIObserver, close, deleteIObserver, deleteIObservers, getName, getProtectionLevel, isBeingObserved, isConfigureAtStartup, notifyIObservers, setConfigureAtStartup, setName, setProtectionLevelMethods inherited from class gda.factory.ConfigurableBase
isConfigured, reconfigure, setConfiguredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gda.factory.Configurable
configure, isConfigureAtStartup, isConfigured, reconfigureMethods inherited from interface gda.device.Detector
createsOwnFiles, endCollection, getCollectionTime, getDataDimensions, getDescription, getDetectorID, getDetectorType, getFileStructure, getStatus, prepareForCollection, setCollectionTime, waitWhileBusyMethods inherited from interface gda.device.Device
close, getAttribute, getProtectionLevel, setAttribute, setProtectionLevelMethods inherited from interface gda.observable.IObservable
addIObserver, deleteIObserver, deleteIObserversMethods inherited from interface gda.device.Scannable
asynchronousMoveTo, atCommandFailure, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanLineEnd, atScanLineStart, atScanStart, checkPositionValid, getExtraNames, getInputNames, getLevel, getOutputFormat, getPosition, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, isAt, isBusy, moveTo, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, toFormattedString
-
Constructor Details
-
BufferedScaler
public BufferedScaler()
-
-
Method Details
-
getFramesRead
public double[][] getFramesRead() -
clearFramesRead
public void clearFramesRead() -
collectData
Description copied from interface:DetectorTells the detector to begin to collect a set of data, then returns immediately. Should cause the hardware to start collecting immediately: if there is any delay then detectors used in the same scan would collect over different times when beam conditions may differ.- Specified by:
collectDatain interfaceDetector- Overrides:
collectDatain classTfgScaler- Throws:
DeviceException
-
readAllFrames
Description copied from interface:BufferedDetectorAn array of the data from the detector. Each element is one frame of data.- Specified by:
readAllFramesin interfaceBufferedDetector- Returns:
- Object
- Throws:
DeviceException
-
readFrames
Description copied from interface:BufferedDetectorAn array of the data from the detector. Each element is one frame of data. The first frame is 0.- Specified by:
readFramesin interfaceBufferedDetector- Parameters:
startFrame-finalFrame-- Returns:
- Object
- Throws:
DeviceException
-
readout
Description copied from interface:DetectorReturns the latest data collected. The size of the Object returned must be consistent with the values returned by getDataDimensions and getExtraNames.If
LocalProperties.GDA_SCAN_CONCURRENTSCAN_READOUT_CONCURRENTLYis true then motors may be moved while the detector readouts. The value returned must not be effected by any concurrent motor or shutter movements. SeeDetector.waitWhileBusy()andConcurrentScan. Readout must block until the detector is ready to respond quickly toDetector.collectData()again.- Specified by:
readoutin interfaceDetector- Overrides:
readoutin classTfgScalerWithLogValues- Returns:
- the data collected
- Throws:
DeviceException- See Also:
-
setContinuousMode
Description copied from interface:BufferedDetectorWhen in slave mode the detector will be triggered by an external signal to collect each frame of data.- Specified by:
setContinuousModein interfaceBufferedDetector- Parameters:
on-- Throws:
DeviceException
-
atScanEnd
Description copied from class:ScannableBaseCalled for every Scannable at the end of a group of nested scans (or a single scan if that is the case).Note that this is only called if the Scan finishes normally, or has been requested to finish early. This will not be called if the scan finishes due to an exception of any kind. See
Scannable.atCommandFailure()Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atScanEndin interfaceScannable- Overrides:
atScanEndin classTfgScalerWithDarkCurrent- Throws:
DeviceException- See Also:
-
stop
Description copied from class:ScannableBaseStop the current move/operation. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
stopin interfaceScannable- Overrides:
stopin classTfgScaler- Throws:
DeviceException- See Also:
-
setupTimeFrames
protected void setupTimeFrames(boolean externalTriggerStart, boolean externalTriggerFrames) throws DeviceException Setup and send the time frame commands to the Tfg. If externalTriggerFrames = true :- each time frame is externally triggered
- the dead and live time of each frame is set from user specified values of frameLiveTime and frameDeadTime.
- Trigger options (dead and live pause) are from user specified deadPause value, and value of ttlSocket respectively (0 if ttlSocket is null)
- Parameters:
externalTriggerStart- - set to true to use external trigger can be used to start the TfgexternalTriggerFrames- - set to true to use external trigger to trigger each time frame within the group- Throws:
DeviceException
-
getInitialDaServerCommand
-
getFrameDaServerCommand
protected String getFrameDaServerCommand(int numFrames, double totalTime, boolean externalTriggerFrames) -
startTfg
- Throws:
DeviceException
-
isManualStart
public boolean isManualStart() -
setManualStart
public void setManualStart(boolean manualStart) -
isContinuousMode
public boolean isContinuousMode()- Specified by:
isContinuousModein interfaceBufferedDetector- Returns:
- true if the detector is ready to accept trigger pulses
-
getContinuousParameters
- Specified by:
getContinuousParametersin interfaceBufferedDetector- Returns:
- ContinuousParameters
-
setContinuousParameters
Description copied from interface:BufferedDetectorSets the parameters which define the continuous movement to use- Specified by:
setContinuousParametersin interfaceBufferedDetector- Parameters:
parameters-
-
clearMemory
Description copied from interface:BufferedDetectorClears the detector memory- Specified by:
clearMemoryin interfaceBufferedDetector- Throws:
DeviceException
-
isWaitingForTrigger
- Returns:
- Return true if tfg is armed and waiting for an external trigger
- Throws:
DeviceException
-
getNumberFrames
- Specified by:
getNumberFramesin interfaceBufferedDetector- Returns:
- number of frames of data in memory which have been collected
- Throws:
DeviceException
-
setOverrunTime
public void setOverrunTime(double overrunTime) -
getOverrunTime
public double getOverrunTime()The excess time to collect data for above the movement time. This ensures all motor encoder data has been read.Default is 0.1;
- Returns:
- double time in seconds
-
getDaserver
-
setDaserver
-
setReturnCountRates
-
getReturnCountRates
-
maximumReadFrames
Description copied from interface:BufferedDetectorAs certain detectors may cause memory issues if too many frames are attempted to be read in one go, this is the maximum for this detector based on its current configuration (i.e. after setContinuousMode(True) has been called.The lowest value returned from any of the detectors in a continuous scan will be the limit set.
If there is no limit then this method should return Integer.MAX_VALUE.
- Specified by:
maximumReadFramesin interfaceBufferedDetector- Returns:
- int - the maximum number of frames which should be read at any one time from this detector
- Throws:
DeviceException
-
getTtlSocket
public int getTtlSocket() -
setTtlSocket
Set the TTL trigger input to use for external start and for live pause (value = 0...3).- Parameters:
ttlSocket-
-
getNumCycles
public int getNumCycles() -
setNumCycles
public void setNumCycles(int numCycles) -
getCurrentCycle
Return cycle currently being executed by Tfg by parsing the value of the Cycle field from the Tfg 'progress' string. (Note: Parent class implementation returns current lap which is different to current cycle). return- Specified by:
getCurrentCyclein interfaceCounterTimer- Overrides:
getCurrentCyclein classCounterTimerBase- Returns:
- the current cycle number
- Throws:
DeviceException
-
clearMemoryFrames
Clear specified block of scaler memory. Intended to be used with multiple cycles, so that frames of scaler memory used for a cycle can be cleared once they have been read, ready to be re-used on subsequent cycles.- Parameters:
startFrame-finalFrame-- Throws:
DeviceException- Since:
- 25/1/2017
-
getFrameLiveTime
public double getFrameLiveTime() -
setFrameLiveTime
public void setFrameLiveTime(double frameLiveTime) -
getFrameDeadTime
public double getFrameDeadTime() -
setFrameDeadTime
public void setFrameDeadTime(double frameDeadTime) Set the dead frame time. This is the gap to use between adjacent timeframes in sequence of externally or internally triggered frames.- Parameters:
frameDeadTime-
-
getDeadPause
public int getDeadPause() -
setDeadPause
public void setDeadPause(int deadPause) Set the dead pause value - used when using externally triggered frames (e.g. 8 to continue on rising edge of TTL0, 9 for TTL1 etc).- Parameters:
deadPause-
-
isExternalTriggeredFrames
public boolean isExternalTriggeredFrames() -
setExternalTriggeredFrames
public void setExternalTriggeredFrames(boolean externalTriggeredFrames) Set to true to have each time frame triggered by external source (Controls the dead pause and live pause values -- Parameters:
externalTriggeredFrames-
-
isExternalTriggerStart
public boolean isExternalTriggerStart() -
setExternalTriggerStart
public void setExternalTriggerStart(boolean externalTriggerStart) Set to true to have the Tfg start when external TTL trigger signal is received. (TTL input port to use is set withsetTtlSocket(Integer)).- Parameters:
externalTriggerStart-
-
setUseExternalTriggers
public void setUseExternalTriggers(boolean tf) -
isFrameCountDuringCycles
public boolean isFrameCountDuringCycles() -
setFrameCountDuringCycles
public void setFrameCountDuringCycles(boolean frameCountDuringCycles) If set to false,getNumberFrames()will return zero while the Tfg is collecting frames across multiple cycles.- Parameters:
frameCountDuringCycles-
-
getGroupInitialCommand
-
setGroupInitialCommand
-