Package gda.device.detector.mythen
Class MythenDetectorImpl
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.scannable.ScannableBase
gda.device.detector.DetectorBase
gda.device.detector.mythen.MythenDetectorImpl
- All Implemented Interfaces:
Detector,Mythen,Device,Scannable,Configurable,Findable,gda.observable.IObservable,Serializable,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
MythenDetector,MythenNexusImpl,ShutterControlledMythenDetectorImpl,SummingMythenDetector
@ServiceInterface(Mythen.class)
public class MythenDetectorImpl
extends DetectorBase
implements Mythen, org.springframework.beans.factory.InitializingBean
Implementation of the GDA Mythen interface.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<AtPointEndTask> protected Stringprotected longprotected DataConverterThe converter that converts raw Mythen data (channel and count) to processed data (angle and count).protected doubleprotected Scannableprotected Stringprotected BigDecimalExposure time in seconds.protected MythenClientThe Mythen client that actually interacts with the Mythen controller hardware.protected intprotected MythenProcessedDatasetThe most recently collected processed dataset.protected FileFile containing the most recently collected processed dataset.protected MythenRawDatasetThe most recently collected raw dataset.protected FileFile containing the most recently collected raw dataset.Map containing scannables to record position of in the header.protected longprotected NumTrackerprotected intprotected StringThe directory below the main data collection directory in which Mythen data files are saved.Fields 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
ConstructorsConstructorDescriptionCreates a new Mythen detector with a default collection time of 1s. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddScannableForHeader(Scannable scn, String userLabel) protected voidprotected voidafterCollectData(File rawFile, int num) protected voidafterCollectData(File rawFile, String collectionFilename) this method is developed for external scripting use in which the collection file name is settableprotected voidafterCollectData(String collectionFilenameRoot, int numFiles) post processes of multiple frames collection and plotting them.voidvoidCalled on every Scannable at the end of every data point, for scans which are broken down into individual points (i.e.voidatPointEnd(String filename, MythenProcessedDataset processedData) voidatPointEnd(String filename, MythenProcessedDataset processedData, boolean clearFirst) plotting processed data.voidCalled for every Scannable at the end of a group of nested scans (or a single scan if that is the case).voidCalled for every Scannable at the start of a group of nested scans (or a single scan if that is the case)protected voidprotected voidbeforeCollectData(long collectionNumber) this method is developed for external scripting where the script control collection number.protected StringbuildFilename(int number, MythenDataFileUtils.FileType type) protected Stringprotected StringbuildFilenameWithoutSuffix(int number) protected StringbuildRawFilename(int number) rebuild Raw data file name added for Jython use as Jython does not support enum Java type yet.voidvoidcmulti(int numFrames, double delayBeforeFrames, double exposureTime) Captures multiple frames using one trigger per frame.voidTells the detector to begin to collect a set of data, then returns immediately.voidDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.booleanReturns a value which indicates whether the detector creates its own files.voidgated(int numGates) voidgated(int numFrames, int numGates) voidgated(int numFrames, int numGates, long scanNumber) gated multiple frames collection - one frame per file - where Mythen detector controls the frame number increment starting from 0.voidgated(int numFrames, int numGates, long scanNumber, int collectionNumber) gated multiple or single frame collection - one or more frames per file - where GDA controls the collection number increment.voidReturns the data directory into which Mythen data files will be written.Make list of additional header strings from positions of scannables.intReturns the current collecting state of the device.booleanbooleanvoidmulti(int numFrames, double delayBeforeFrames, double exposureTime, double delayAfterFrames) Captures multiple frames using a software trigger.voidplot(String filename, MythenProcessedDataset processedData, int num) readout()Returns the latest data collected.Reads out the processed data.voidsetAtPointEndTasks(List<AtPointEndTask> tasks) Sets the list of tasks that will be executed after each point in the scan.voidsetAtScanEndTasks(List<ScanTask> tasks) Sets the list of tasks that will be executed at the end of the scan.voidsetAtScanStartTasks(List<ScanTask> tasks) Sets the list of tasks that will be executed at the start of the scan.voidsetCollectionTime(double collectionTime) Sets the collection time, in seconds, to be used during the next call of collectData.voidsetDataConverter(DataConverter dataConverter) Sets the Mythen data converter used by this Mythen detector object.voidsetDeltaScannable(Scannable deltaScannable) Sets theScannablerepresenting the delta circle.voidsetDetectorID(String detectorID) Sets the detector ID.voidsetHasChannelInfo(boolean hasChannelInfo) voidsetIncludeHeaders(boolean includeHeaders) voidsetMythenClient(MythenClient mythenClient) Sets the Mythen client used by this Mythen detector object.voidsetNumberOfModules(int numberOfModules) Sets the number of modules in the detector.voidsetScannablesForHeader(Map<Scannable, String> scannablesForHeader) voidsetSubDirectory(String subDirectory) voidsmulti(int numFrames, double exposureTime, double delayAfterFrames) Captures multiple frames using a single trigger to start acquisition of all frames.voidstop()Stop the current move/operation.protected voidMethods inherited from class gda.device.detector.DetectorBase
asynchronousMoveTo, checkPositionValid, endCollection, getCollectionTime, getDataDimensions, getPosition, isBusy, prepareForCollection, toFormattedStringMethods inherited from class gda.device.scannable.ScannableBase
__call__, __call__, __doc__, __getitem__, __len__, __repr__, __str__, atCommandFailure, atLevelEnd, atLevelMoveStart, atLevelStart, atPointStart, atScanLineEnd, atScanLineStart, externalToInternal, getExtraNames, getInputNames, 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, getAttribute, getName, getProtectionLevel, isBeingObserved, isConfigureAtStartup, notifyIObservers, setAttribute, 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
isConfigureAtStartup, isConfigured, reconfigureMethods inherited from interface gda.device.Detector
endCollection, getCollectionTime, getDataDimensions, getFileStructure, prepareForCollection, 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, atPointStart, atScanLineEnd, atScanLineStart, checkPositionValid, getExtraNames, getInputNames, getLevel, getOutputFormat, getPosition, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, isAt, isBusy, moveTo, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, toFormattedString
-
Field Details
-
exposureTime
Exposure time in seconds. -
status
protected volatile int status -
detectorID
-
scanNumTracker
-
collectionNumber
protected volatile long collectionNumber -
mythenClient
The Mythen client that actually interacts with the Mythen controller hardware. -
deltaScannable
-
scannablesForHeader
Map containing scannables to record position of in the header. key=scannable, value=label to use to annotate the value (optional, can be null) -
dataConverter
The converter that converts raw Mythen data (channel and count) to processed data (angle and count). -
subDirectory
The directory below the main data collection directory in which Mythen data files are saved. -
numberOfModules
protected int numberOfModules -
atScanStartTasks
-
atPointEndTasks
-
atScanEndTasks
-
rawData
The most recently collected raw dataset. -
rawFile
File containing the most recently collected raw dataset. -
processedData
The most recently collected processed dataset. -
processedFile
File containing the most recently collected processed dataset. -
scanNumber
protected volatile long scanNumber -
collectionFilename
-
delta
protected double delta
-
-
Constructor Details
-
MythenDetectorImpl
public MythenDetectorImpl()Creates a new Mythen detector with a default collection time of 1s.
-
-
Method Details
-
configure
Description copied from class:ConfigurableBaseDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classConfigurableBase- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
addScannableForHeader
-
addScannableForHeader
-
clearScannablesForHeader
public void clearScannablesForHeader() -
getScannablesForHeader
-
setScannablesForHeader
-
setDetectorID
Sets the detector ID.- Parameters:
detectorID- the detector ID
-
setMythenClient
Sets the Mythen client used by this Mythen detector object.- Parameters:
mythenClient- the Mythen client
-
setDeltaScannable
Sets theScannablerepresenting the delta circle.- Parameters:
deltaScannable- the delta scannable
-
setDataConverter
Sets the Mythen data converter used by this Mythen detector object.- Parameters:
dataConverter- the data converter
-
getDataConverter
-
setSubDirectory
-
getSubDirectory
-
getDataDirectory
Returns the data directory into which Mythen data files will be written.- Returns:
- the data directory
-
setNumberOfModules
public void setNumberOfModules(int numberOfModules) Sets the number of modules in the detector. -
setAtScanStartTasks
Sets the list of tasks that will be executed at the start of the scan. -
setAtPointEndTasks
Sets the list of tasks that will be executed after each point in the scan. -
setAtScanEndTasks
Sets the list of tasks that will be executed at the end of the scan. -
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
getStatus
Description copied from interface:DetectorReturns the current collecting state of the device.- Specified by:
getStatusin interfaceDetector- Returns:
- BUSY if the detector has not finished the requested operation(s), IDLE if in an completely idle state and STANDBY if temporarily suspended.
- Throws:
DeviceException
-
atScanStart
Description copied from class:ScannableBaseCalled for every Scannable at the start of a group of nested scans (or a single scan if that is the case) Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atScanStartin interfaceScannable- Overrides:
atScanStartin classScannableBase- Throws:
DeviceException- See Also:
-
getCurrentFilename
-
buildFilenameWithoutSuffix
-
buildFilenameWithoutSuffix
-
buildFilename
-
buildRawFilename
rebuild Raw data file name added for Jython use as Jython does not support enum Java type yet.- Parameters:
number-- Returns:
- filename
-
buildFilename
-
beforeCollectData
- Throws:
DeviceException
-
beforeCollectData
this method is developed for external scripting where the script control collection number.- Parameters:
collectionNumber-- Throws:
DeviceException
-
getHeaderStrings
Make list of additional header strings from positions of scannables. -
updateDeltaPosition
- Throws:
DeviceException
-
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- Throws:
DeviceException
-
afterCollectData
protected void afterCollectData() -
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- Returns:
- the data collected
- Throws:
DeviceException
-
readoutProcessedData
Description copied from interface:MythenReads out the processed data.- Specified by:
readoutProcessedDatain interfaceMythen- Returns:
- the processed data
-
atPointEnd
Description copied from class:ScannableBaseCalled on every Scannable at the end of every data point, for scans which are broken down into individual points (i.e. non-continous scans) Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atPointEndin interfaceScannable- Overrides:
atPointEndin classScannableBase- Throws:
DeviceException- See Also:
-
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 classScannableBase- 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 classScannableBase- Throws:
DeviceException- See Also:
-
createsOwnFiles
Description copied from interface:DetectorReturns a value which indicates whether the detector creates its own files. If it does (return true) the readout() method returns the name of the latest file created as a string. If it does not (return false) the readout() method will return the data directly.- Specified by:
createsOwnFilesin interfaceDetector- Returns:
- true if readout() returns filenames
- Throws:
DeviceException
-
getDescription
- Specified by:
getDescriptionin interfaceDetector- Overrides:
getDescriptionin classDetectorBase- Returns:
- A description of the detector.
- Throws:
DeviceException
-
getDetectorID
- Specified by:
getDetectorIDin interfaceDetector- Overrides:
getDetectorIDin classDetectorBase- Returns:
- A identifier for this detector.
- Throws:
DeviceException
-
getDetectorType
- Specified by:
getDetectorTypein interfaceDetector- Overrides:
getDetectorTypein classDetectorBase- Returns:
- The type of detector.
- Throws:
DeviceException
-
setCollectionTime
Description copied from interface:DetectorSets the collection time, in seconds, to be used during the next call of collectData.- Specified by:
setCollectionTimein interfaceDetector- Overrides:
setCollectionTimein classDetectorBase- Parameters:
collectionTime- the collection time in seconds- Throws:
DeviceException
-
multi
public void multi(int numFrames, double delayBeforeFrames, double exposureTime, double delayAfterFrames) throws DeviceException Captures multiple frames using a software trigger.- Throws:
DeviceException
-
smulti
public void smulti(int numFrames, double exposureTime, double delayAfterFrames) throws DeviceException Captures multiple frames using a single trigger to start acquisition of all frames.- Throws:
DeviceException
-
cmulti
public void cmulti(int numFrames, double delayBeforeFrames, double exposureTime) throws DeviceException Captures multiple frames using one trigger per frame.- Throws:
DeviceException
-
gated
- Throws:
DeviceException
-
gated
- Throws:
DeviceException
-
gated
public void gated(int numFrames, int numGates, long scanNumber, File dataDirectory, int collectionNumber) throws DeviceException - Throws:
DeviceException
-
gated
gated multiple frames collection - one frame per file - where Mythen detector controls the frame number increment starting from 0. It launches only single textclient to collect multiple frames- Parameters:
numFrames-numGates-scanNumber-- Throws:
DeviceException
-
afterCollectData
post processes of multiple frames collection and plotting them. this method is developed for external scripting use in which the collection file name is settable- Parameters:
collectionFilenameRoot-
-
atPointEnd
plotting processed data.- Parameters:
filename-processedData-clearFirst-
-
gated
public void gated(int numFrames, int numGates, long scanNumber, int collectionNumber) throws DeviceException gated multiple or single frame collection - one or more frames per file - where GDA controls the collection number increment.- Parameters:
numFrames-numGates-scanNumber-collectionNumber-- Throws:
DeviceException
-
afterCollectData
-
isIncludeHeaders
public boolean isIncludeHeaders() -
setIncludeHeaders
public void setIncludeHeaders(boolean includeHeaders) -
plot
-
afterCollectData
this method is developed for external scripting use in which the collection file name is settable- Parameters:
collectionFilename-
-
atPointEnd
public void atPointEnd(String filename, MythenProcessedDataset processedData) throws DeviceException - Throws:
DeviceException
-
isHasChannelInfo
public boolean isHasChannelInfo() -
setHasChannelInfo
public void setHasChannelInfo(boolean hasChannelInfo)
-