Class KennardStone

  • All Implemented Interfaces:
    adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.ShallowCopySupporter, adams.core.SizeOfHandler, adams.data.filter.BatchFilter, adams.data.filter.Filter, Serializable, Comparable

    public class KennardStone
    extends adams.data.filter.AbstractBatchFilter
    Batch filter that applies the Kennard-stone algorithm to select a subset of spectra Created by Michael on 5/19/2016.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class adams.data.filter.AbstractFilter

        adams.data.filter.AbstractFilter.FilterJob<T extends adams.data.container.DataContainer>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected adams.data.filter.BatchFilter m_BatchFilter
      Batch filter to apply before selection
      protected boolean m_Invert
      whether to invert the selection.
      protected int m_NumberInSubset
      Number of spectra to select in subset
      protected adams.data.filter.Filter m_PreFilter
      Pre filter to apply before selection
      • Fields inherited from class adams.data.filter.AbstractFilter

        m_DontUpdateID
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Constructor Summary

      Constructors 
      Constructor Description
      KennardStone()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String batchFilterTipText()
      Description for this property
      protected double calculateDistance​(Spectrum spec1, Spectrum spec2)
      Calculate the distance between any two spectra.
      void defineOptions()  
      adams.data.filter.BatchFilter getBatchFilter()
      Get the batch filter to apply before selection
      boolean getInvert()
      Get whether to return the remaining spectra are returned rather than the chosen ones.
      int getNumberInSubset()
      get the number of spectra to select in subset
      adams.data.filter.Filter getPreFilter()
      Get the filter to apply before selection
      String globalInfo()  
      String invertTipText()
      Description for this property.
      String numberInSubsetTipText()
      Tip text for this property
      String preFilterTipText()
      Tip text for this property
      protected adams.data.container.DataContainer[] processBatchData​(adams.data.container.DataContainer[] data)  
      protected adams.data.container.DataContainer processData​(adams.data.container.DataContainer data)  
      void setBatchFilter​(adams.data.filter.BatchFilter value)
      Set the batch filter to apply before selection
      void setInvert​(boolean value)
      Set whether to return the remaining spectra are returned rather than the chosen ones.
      void setNumberInSubset​(int value)
      Set the number of spectra to select in subset
      void setPreFilter​(adams.data.filter.Filter value)
      Set the filter to apply before selection
      • Methods inherited from class adams.data.filter.AbstractBatchFilter

        batchFilter, checkBatchData
      • Methods inherited from class adams.data.filter.AbstractFilter

        checkData, cleanUp, compareTo, destroy, dontUpdateIDTipText, equals, filter, forCommandLine, getDontUpdateID, reset, setDontUpdateID, shallowCopy, shallowCopy
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.data.filter.Filter

        cleanUp, compareTo, destroy, dontUpdateIDTipText, equals, filter, getDontUpdateID, reset, setDontUpdateID, shallowCopy, shallowCopy
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel, setLoggingLevel
      • Methods inherited from interface adams.core.logging.LoggingSupporter

        getLogger, isLoggingEnabled
      • Methods inherited from interface adams.core.option.OptionHandler

        cleanUpOptions, getOptionManager, toCommandLine
    • Field Detail

      • m_NumberInSubset

        protected int m_NumberInSubset
        Number of spectra to select in subset
      • m_PreFilter

        protected adams.data.filter.Filter m_PreFilter
        Pre filter to apply before selection
      • m_BatchFilter

        protected adams.data.filter.BatchFilter m_BatchFilter
        Batch filter to apply before selection
      • m_Invert

        protected boolean m_Invert
        whether to invert the selection.
    • Constructor Detail

      • KennardStone

        public KennardStone()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
      • defineOptions

        public void defineOptions()
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.data.filter.AbstractFilter
      • setNumberInSubset

        public void setNumberInSubset​(int value)
        Set the number of spectra to select in subset
        Parameters:
        value - Size of subset
      • getNumberInSubset

        public int getNumberInSubset()
        get the number of spectra to select in subset
        Returns:
        Size of subset
      • numberInSubsetTipText

        public String numberInSubsetTipText()
        Tip text for this property
        Returns:
        Description for displaying in the GUI
      • setPreFilter

        public void setPreFilter​(adams.data.filter.Filter value)
        Set the filter to apply before selection
        Parameters:
        value - Filter to apply
      • getPreFilter

        public adams.data.filter.Filter getPreFilter()
        Get the filter to apply before selection
        Returns:
        Filter to apply
      • preFilterTipText

        public String preFilterTipText()
        Tip text for this property
        Returns:
        Description for displaying in the GUI
      • setBatchFilter

        public void setBatchFilter​(adams.data.filter.BatchFilter value)
        Set the batch filter to apply before selection
        Parameters:
        value - Batch filter
      • getBatchFilter

        public adams.data.filter.BatchFilter getBatchFilter()
        Get the batch filter to apply before selection
        Returns:
        Batch filter
      • batchFilterTipText

        public String batchFilterTipText()
        Description for this property
        Returns:
        Description for displaying in the GUI
      • setInvert

        public void setInvert​(boolean value)
        Set whether to return the remaining spectra are returned rather than the chosen ones.
        Parameters:
        value - true if to invert
      • getInvert

        public boolean getInvert()
        Get whether to return the remaining spectra are returned rather than the chosen ones.
        Returns:
        true if to invert
      • invertTipText

        public String invertTipText()
        Description for this property.
        Returns:
        Description for displaying in the GUI
      • processBatchData

        protected adams.data.container.DataContainer[] processBatchData​(adams.data.container.DataContainer[] data)
        Specified by:
        processBatchData in class adams.data.filter.AbstractBatchFilter
      • calculateDistance

        protected double calculateDistance​(Spectrum spec1,
                                           Spectrum spec2)
        Calculate the distance between any two spectra. Currently just uses euclidean distance
        Parameters:
        spec1 - Spectrum1
        spec2 - Spectrum2
        Returns:
        the distance
      • processData

        protected adams.data.container.DataContainer processData​(adams.data.container.DataContainer data)
        Specified by:
        processData in class adams.data.filter.AbstractFilter