Class EdeDetectorBase

All Implemented Interfaces:
Detector, EdeDetector, NexusDetector, Device, Scannable, Configurable, Findable, gda.observable.IObservable, Serializable
Direct Known Subclasses:
EdeDummyDetector, EdeFrelon, XhDetector

public abstract class EdeDetectorBase extends DetectorBase implements EdeDetector
See Also:
  • Field Details

    • detectorData

      protected DetectorData detectorData
    • currentScanParameter

      protected EdeScanParameters currentScanParameter
    • currentDetector

      protected EdeDetector currentDetector
    • dropFirstFrame

      protected boolean dropFirstFrame
  • Constructor Details

    • EdeDetectorBase

      protected EdeDetectorBase()
  • Method Details

    • configure

      public void configure() throws FactoryException
      Description copied from class: ConfigurableBase
      Default 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:
      configure in interface Configurable
      Overrides:
      configure in class ConfigurableBase
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
    • atScanStart

      public void atScanStart() throws DeviceException
      Description copied from class: ScannableBase
      Called 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:
      atScanStart in interface Scannable
      Overrides:
      atScanStart in class ScannableBase
      Throws:
      DeviceException
      See Also:
    • prepareDetectorwithScanParameters

      public void prepareDetectorwithScanParameters(EdeScanParameters newParameters) throws DeviceException
      Specified by:
      prepareDetectorwithScanParameters in interface EdeDetector
      Throws:
      DeviceException
    • configureDetectorForCollection

      protected abstract void configureDetectorForCollection() throws DeviceException
      Throws:
      DeviceException
    • getMaxPixel

      public abstract int getMaxPixel()
      detector's maximum pixel size in energy direction.
      Specified by:
      getMaxPixel in interface EdeDetector
      Returns:
      maximum pixels of camera in energy direction
    • getNumberScansInFrame

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

      public abstract DetectorStatus fetchStatus() throws DeviceException
      fetch detector status from hardware.
      Specified by:
      fetchStatus in interface EdeDetector
      Returns:
      DetectorStatus
      Throws:
      DeviceException
    • getDetectorData

      public DetectorData getDetectorData()
      Specified by:
      getDetectorData in interface EdeDetector
    • getPixels

      public Integer[] getPixels()
      Specified by:
      getPixels in interface EdeDetector
    • getEnergyForChannels

      public double[] getEnergyForChannels()
      Specified by:
      getEnergyForChannels in interface EdeDetector
    • writeLiveDataFile

      public void writeLiveDataFile() throws DeviceException
      Specified by:
      writeLiveDataFile in interface EdeDetector
      Throws:
      DeviceException
    • createDatasetForPixel

      public org.eclipse.january.dataset.DoubleDataset createDatasetForPixel()
      Specified by:
      createDatasetForPixel in interface EdeDetector
    • getStatus

      public int getStatus() throws DeviceException
      Description copied from interface: Detector
      Returns the current collecting state of the device.
      Specified by:
      getStatus in interface Detector
      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
    • readout

      public NexusTreeProvider readout() throws DeviceException
      Reads the first frame only.
      Specified by:
      readout in interface Detector
      Specified by:
      readout in interface NexusDetector
      Returns:
      the data collected
      Throws:
      DeviceException
    • readFrames

      public NexusTreeProvider[] readFrames(int startFrame, int finalFrame) throws DeviceException
      returns a list of NexusTreeProvider, one for each frame in the specified range.
      Specified by:
      readFrames in interface EdeDetector
      Parameters:
      startFrame -
      finalFrame -
      Returns:
      list of NexusTreeProvider
      Throws:
      DeviceException
    • readoutFrames

      public abstract int[] readoutFrames(int startFrame, int finalFrame) throws DeviceException
      implements the read out of frames from the actual detector used.
      Specified by:
      readoutFrames in interface EdeDetector
      Parameters:
      startFrame -
      finalFrame -
      Returns:
      an 1D integer array containing all frames concatenated from start frame to the final frame inclusively.
      Throws:
      DeviceException
    • unpackRawDataToFrames

      protected int[][] unpackRawDataToFrames(int[] scalerData, int numFrames)
    • setDetectorData

      public void setDetectorData(DetectorData detectorData)
    • isDropFirstFrame

      public boolean isDropFirstFrame()
      Specified by:
      isDropFirstFrame in interface EdeDetector
    • setDropFirstFrame

      public void setDropFirstFrame(boolean dropFirstFrame)
    • getEnergyCalibration

      public CalibrationDetails getEnergyCalibration()
      Description copied from interface: EdeDetector
      Returns the function used to convert channel number to energy. If not calibrated it should return a simple y = x function.
      Specified by:
      getEnergyCalibration in interface EdeDetector
      Returns:
      PolynomialFunction
    • setEnergyCalibration

      public void setEnergyCalibration(CalibrationDetails energyCalibration)
      Description copied from interface: EdeDetector
      Set the energy calibration. The detector object should persist this between GDA server restarts.
      Specified by:
      setEnergyCalibration in interface EdeDetector
      Parameters:
      energyCalibration -
    • isEnergyCalibrationSet

      public boolean isEnergyCalibrationSet()
      Specified by:
      isEnergyCalibrationSet in interface EdeDetector
    • setEnergyCalibrationSet

      public void setEnergyCalibrationSet(boolean energyCalibrationSet)
    • getRois

      public Roi[] getRois()
      Description copied from interface: EdeDetector
      Returns the regions in use, as defined by calls to setRois or setNumberRois
      Specified by:
      getRois in interface EdeDetector
      Returns:
      the array of regions
    • setRois

      public void setRois(Roi[] rois)
      Description copied from interface: EdeDetector
      Ignoring the lower and upper channel properties, explicitly set the regions in use.
      Specified by:
      setRois in interface EdeDetector
      Parameters:
      rois -
    • getNumberOfRois

      public int getNumberOfRois()
      Specified by:
      getNumberOfRois in interface EdeDetector
    • setNumberRois

      public void setNumberRois(int numberOfRois)
      Description copied from interface: EdeDetector
      Set evenly sized regions of interest, ignoring channels outside of the lower and upper channel limits.
      Specified by:
      setNumberRois in interface EdeDetector
      Parameters:
      numberOfRois -
    • getLowerChannel

      public int getLowerChannel()
      Specified by:
      getLowerChannel in interface EdeDetector
    • setLowerChannel

      public void setLowerChannel(int lowerChannel)
      Specified by:
      setLowerChannel in interface EdeDetector
    • getUpperChannel

      public int getUpperChannel()
      Specified by:
      getUpperChannel in interface EdeDetector
    • setUpperChannel

      public void setUpperChannel(int upperChannel)
      Specified by:
      setUpperChannel in interface EdeDetector
    • getExcludedPixels

      public Integer[] getExcludedPixels()
      Return array of 'dead pixel' locations.
      Specified by:
      getExcludedPixels in interface EdeDetector
    • setExcludedPixels

      public void setExcludedPixels(Integer[] excludedPixels)
      Set array of dead pixel locations
      Specified by:
      setExcludedPixels in interface EdeDetector
      Parameters:
      excludedPixels -
    • getRoiFor

      public int getRoiFor(int elementIndex)
      Specified by:
      getRoiFor in interface EdeDetector
    • setSynchroniseToBeamOrbit

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

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

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

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

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

      public abstract String getOrbitWaitMethod()
      Specified by:
      getOrbitWaitMethod in interface EdeDetector
    • setDetectorSetupType

      public void setDetectorSetupType(DetectorSetupType detectorSetupType)
      Specified by:
      setDetectorSetupType in interface EdeDetector
    • getDetectorSetupType

      public DetectorSetupType getDetectorSetupType()
      Specified by:
      getDetectorSetupType in interface EdeDetector
    • isCheckForExcludedStrips

      public boolean isCheckForExcludedStrips()
      Returns:
      true if excluded pixels are set to zero in the detector data.
    • setCheckForExcludedStrips

      public void setCheckForExcludedStrips(boolean checkForExcludedStrips)
      If set to true, detector data will have counts for 'excluded' pixels set to zero. Excluded pixels are those defined by setExcludedPixels(Integer[]) or outside of lower and upper channels.

      Note that pixels outside of ROI range are only excluded if currentScanParameter.getIncludeCountsOutsideROIs() also returns true.

      Parameters:
      checkForExcludedStrips -
    • setAccumulationReadoutTime

      public void setAccumulationReadoutTime(double timeSec)
      Description copied from interface: EdeDetector
      Set the accumulation readout time
      Specified by:
      setAccumulationReadoutTime in interface EdeDetector
    • getAccumulationReadoutTime

      public double getAccumulationReadoutTime()
      Specified by:
      getAccumulationReadoutTime in interface EdeDetector
      Returns:
      Accumulation readout time (in seconds)
    • getMaxNumFramesToRead

      public int getMaxNumFramesToRead()
      Specified by:
      getMaxNumFramesToRead in interface EdeDetector
    • setMaxNumFramesToRead

      public void setMaxNumFramesToRead(int maxNumberOfFramesToRead)
    • getCompressionLevel

      public int getCompressionLevel()
    • setCompressionLevel

      public void setCompressionLevel(int compressionLevel)
      Compression level to use for datasets in the Nexus file :
    • 0 -> no compression
    • 1 -> LZW compression
    • Parameters:
      compressionLevel -