Class EdeDummyDetector

All Implemented Interfaces:
Detector, EdeDetector, NexusDetector, Device, Scannable, Configurable, Findable, gda.observable.IObservable, Serializable

public class EdeDummyDetector extends EdeDetectorBase
This is a dummy implementation of an EdeDetector, similar to the XhDetector detector running with dummy da server. The readoutFrames(int, int) method of this detector returns either
  • Dummy values useful for debugging based on number of frames and MCA channels, generated by createDummyData(int, int)
  • Values from a dataset loaded from a file using loadDetectorDataFromNexusFile(java.lang.String)
  • Values from a dataset specified by setDetectorData(org.eclipse.january.dataset.Dataset)
  • This detector can be used in a TimeResolvedExperiment to replace real data with dummy values by using EdeExperiment.setDetectorForScanPart(gda.scan.ede.position.EdePositionType, gda.scan.ede.EdeScanType, EdeDetector)
    See Also:
    • Constructor Details

      • EdeDummyDetector

        public EdeDummyDetector()
    • Method Details

      • setName

        public void setName(String name)
        Set detector name : first call to this sets 'dummy detector' name. See atScanStart(), atScanEnd().
        Specified by:
        setName in interface Findable
        Overrides:
        setName in class DeviceBase
        Parameters:
        name - The name to set.
      • atScanStart

        public void atScanStart()
        Set detector name to match that of real detector. This is done so data produced by 'dummy detector' is added to same Nexus group as data from 'real' detector.
        Specified by:
        atScanStart in interface Scannable
        Overrides:
        atScanStart in class EdeDetectorBase
        See Also:
      • atScanEnd

        public void atScanEnd()
        Reset name back to original 'dummy detector' name.
        Specified by:
        atScanEnd in interface Scannable
        Overrides:
        atScanEnd in class ScannableBase
        See Also:
      • stop

        public void stop()
        Description copied from class: ScannableBase
        Stop 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:
        stop in interface Scannable
        Overrides:
        stop in class ScannableBase
        See Also:
      • getDummyDetectorName

        public String getDummyDetectorName()
      • setDummyDetectorName

        public void setDummyDetectorName(String dummyDetectorName)
      • getMainDetectorName

        public String getMainDetectorName()
      • setMainDetectorName

        public void setMainDetectorName(String mainDetectorName)
      • setMaxPixel

        public void setMaxPixel(int maxPixel)
      • getMaxPixel

        public int getMaxPixel()
        Description copied from class: EdeDetectorBase
        detector's maximum pixel size in energy direction.
        Specified by:
        getMaxPixel in interface EdeDetector
        Specified by:
        getMaxPixel in class EdeDetectorBase
        Returns:
        maximum pixels of camera in energy direction
      • setDetectorData

        public void setDetectorData(org.eclipse.january.dataset.Dataset data)
        Set dummy detector data directly from Dataset
        Parameters:
        data -
      • loadDetectorDataFromNexusFile

        public void loadDetectorDataFromNexusFile(String nexusFile)
        Set dummy detector data by loading a Dataset from a Nexus file
        Parameters:
        nexusFile -
      • loadDetectorDataFromNexusFile

        public void loadDetectorDataFromNexusFile(String nexusFile, String pathToDataSet)
      • loadDetectorDataFromNexusFile

        public void loadDetectorDataFromNexusFile(String nexusFile, String pathToDataSet, int rowToUse)
        Read one or multiple rows (frames) of data from specified dataset in Nexus file and use it to set the dummy detector data
        Parameters:
        nexusFile - Full path to Nexus file
        pathToDataSet - Path to Nexus dataset
        rowToUse - >=0 to select single row, -1 to use all
      • readoutFrames

        public int[] readoutFrames(int startFrame, int finalFrame) throws DeviceException
        Readout frames of detector data, filling in the values from detectorData (if present) or using createDummyData(int, int).

        If detectorData has fewer columns than required number of channels, zeros will be used to pad columns.

        If number of frames required > number of rows, row values will be cycled repeatedly as necessary.

        Specified by:
        readoutFrames in interface EdeDetector
        Specified by:
        readoutFrames in class EdeDetectorBase
        Parameters:
        startFrame -
        finalFrame -
        Returns:
        an 1D integer array containing all frames concatenated from start frame to the final frame inclusively.
        Throws:
        DeviceException
      • getNumberScansInFrame

        public int getNumberScansInFrame(double frameTime, double scanTime, int numberOfFrames) throws DeviceException
        Description copied from class: EdeDetectorBase
        calculate the number of scans (TFG2 term) or accumulations in a single frame based on detector clock rate.
        Specified by:
        getNumberScansInFrame in interface EdeDetector
        Specified by:
        getNumberScansInFrame in class EdeDetectorBase
        Parameters:
        frameTime -
        scanTime -
        numberOfFrames -
        Returns:
        number of accumulations.
        Throws:
        DeviceException
      • fetchStatus

        public DetectorStatus fetchStatus() throws DeviceException
        Description copied from class: EdeDetectorBase
        fetch detector status from hardware.
        Specified by:
        fetchStatus in interface EdeDetector
        Specified by:
        fetchStatus in class EdeDetectorBase
        Returns:
        DetectorStatus
        Throws:
        DeviceException
      • getNumberOfSpectra

        public int getNumberOfSpectra() throws DeviceException
        Throws:
        DeviceException
      • getTemperatures

        public HashMap<String,Double> getTemperatures() throws DeviceException
        Throws:
        DeviceException
      • fetchDetectorSettings

        public void fetchDetectorSettings()
        Description copied from interface: EdeDetector
        to pull detector setting from detector server to synchronise the DetectorData object
      • getNumberScansInFrame

        public int getNumberScansInFrame()
      • setNumberScansInFrame

        public void setNumberScansInFrame(int numScansInFrame)
      • configureDetectorForTimingGroup

        public void configureDetectorForTimingGroup(TimingGroup group) throws DeviceException
        Throws:
        DeviceException
      • configureDetectorForROI

        public void configureDetectorForROI(int verticalBinning, int ccdLineBegin) throws DeviceException
        Throws:
        DeviceException
      • collectData

        public void collectData() throws DeviceException
        Description copied from interface: Detector
        Tells 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.
        Throws:
        DeviceException
      • createsOwnFiles

        public boolean createsOwnFiles() throws DeviceException
        Description copied from interface: Detector
        Returns 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.
        Returns:
        true if readout() returns filenames
        Throws:
        DeviceException
      • configureDetectorForCollection

        protected void configureDetectorForCollection() throws DeviceException
        Specified by:
        configureDetectorForCollection in class EdeDetectorBase
        Throws:
        DeviceException
      • setSynchroniseToBeamOrbit

        public void setSynchroniseToBeamOrbit(boolean synchroniseToBeamOrbit)
        Specified by:
        setSynchroniseToBeamOrbit in interface EdeDetector
        Specified by:
        setSynchroniseToBeamOrbit in class EdeDetectorBase
      • getSynchroniseToBeamOrbit

        public boolean getSynchroniseToBeamOrbit()
        Specified by:
        getSynchroniseToBeamOrbit in interface EdeDetector
        Specified by:
        getSynchroniseToBeamOrbit in class EdeDetectorBase
      • setSynchroniseBeamOrbitDelay

        public void setSynchroniseBeamOrbitDelay(int synchroniseBeamOrbitDelay) throws DeviceException
        Specified by:
        setSynchroniseBeamOrbitDelay in interface EdeDetector
        Specified by:
        setSynchroniseBeamOrbitDelay in class EdeDetectorBase
        Throws:
        DeviceException
      • getSynchroniseBeamOrbitDelay

        public int getSynchroniseBeamOrbitDelay()
        Specified by:
        getSynchroniseBeamOrbitDelay in interface EdeDetector
        Specified by:
        getSynchroniseBeamOrbitDelay in class EdeDetectorBase
      • setOrbitWaitMethod

        public void setOrbitWaitMethod(String methodString)
        Specified by:
        setOrbitWaitMethod in interface EdeDetector
        Specified by:
        setOrbitWaitMethod in class EdeDetectorBase
      • getOrbitWaitMethod

        public String getOrbitWaitMethod()
        Specified by:
        getOrbitWaitMethod in interface EdeDetector
        Specified by:
        getOrbitWaitMethod in class EdeDetectorBase
      • getLastImageAvailable

        public int getLastImageAvailable() throws DeviceException
        Returns:
        Index of last image on the detector available for reading out using. (i.e. -1 = no image is ready, 0 = 1 image is ready)
        Throws:
        DeviceException
      • isAverageRows

        public boolean isAverageRows()
      • setAverageRows

        public void setAverageRows(boolean averageRows)