Class SimpleArffSpectrumReader

  • All Implemented Interfaces:
    adams.core.AdditionalInformationHandler, adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.io.FileFormatHandler, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.ShallowCopySupporter<adams.data.io.input.DataContainerReader>, adams.core.SizeOfHandler, adams.core.Stoppable, adams.data.io.input.DataContainerReader<Spectrum>, Serializable, Comparable

    public class SimpleArffSpectrumReader
    extends AbstractSpectrumReader
    Reads spectra from ARFF files.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_SampleIDAttribute

        protected adams.data.weka.WekaAttributeIndex m_SampleIDAttribute
        the attribute containing the sample ID.
      • m_WaveAttributes

        protected adams.data.weka.WekaAttributeRange m_WaveAttributes
        the range of attributes containing wave amplitudes.
      • m_AttNameContainsWaveNumber

        protected boolean m_AttNameContainsWaveNumber
        whether the attribute name contains the wave number.
      • m_WaveNumberRegExp

        protected adams.core.base.BaseRegExp m_WaveNumberRegExp
        the regular expression to extract the wave number from the name (first group is used).
      • m_SampleDataAttributes

        protected adams.data.weka.WekaAttributeRange m_SampleDataAttributes
        the range of attributes containing sample data.
      • m_Loader

        protected transient weka.core.converters.SimpleArffLoader m_Loader
        the arff reader.
    • Constructor Detail

      • SimpleArffSpectrumReader

        public SimpleArffSpectrumReader()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class AbstractSpectrumReader
      • setSampleIDAttribute

        public void setSampleIDAttribute​(adams.data.weka.WekaAttributeIndex value)
        Sets the attribute containing the sample ID.
        Parameters:
        value - the attribute
      • getSampleIDAttribute

        public adams.data.weka.WekaAttributeIndex getSampleIDAttribute()
        Returns the attribute containing the sample ID.
        Returns:
        the attribute
      • sampleIDAttributeTipText

        public String sampleIDAttributeTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setWaveAttributes

        public void setWaveAttributes​(adams.data.weka.WekaAttributeRange value)
        Sets the attributes containing the wave amplitudes.
        Parameters:
        value - the attributes
      • getWaveAttributes

        public adams.data.weka.WekaAttributeRange getWaveAttributes()
        Returns the attributes containing the wave amplitudes.
        Returns:
        the attributes
      • waveAttributesTipText

        public String waveAttributesTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setAttNameContainsWaveNumber

        public void setAttNameContainsWaveNumber​(boolean value)
        Sets whether to extract the wave number from the attribute names.
        Parameters:
        value - true if to extract
      • getAttNameContainsWaveNumber

        public boolean getAttNameContainsWaveNumber()
        Returns whether to extract the wave number from the attribute names.
        Returns:
        true if to extract
      • attNameContainsWaveNumberTipText

        public String attNameContainsWaveNumberTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setWaveNumberRegExp

        public void setWaveNumberRegExp​(adams.core.base.BaseRegExp value)
        Sets the regular expression to identify the wave number (1st group is used).
        Parameters:
        value - the expression
      • getWaveNumberRegExp

        public adams.core.base.BaseRegExp getWaveNumberRegExp()
        Returns the regular expression to identify the wave number (1st group is used).
        Returns:
        the expression
      • waveNumberRegExpTipText

        public String waveNumberRegExpTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSampleDataAttributes

        public void setSampleDataAttributes​(adams.data.weka.WekaAttributeRange value)
        Sets the attributes containing the sample data.
        Parameters:
        value - the attributes
      • getSampleDataAttributes

        public adams.data.weka.WekaAttributeRange getSampleDataAttributes()
        Returns the attributes containing the sample data.
        Returns:
        the attributes
      • sampleDataAttributesTipText

        public String sampleDataAttributesTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getFormatDescription

        public String getFormatDescription()
        Returns a string describing the format (used in the file chooser).
        Specified by:
        getFormatDescription in interface adams.core.io.FileFormatHandler
        Specified by:
        getFormatDescription in class adams.data.io.input.AbstractDataContainerReader<Spectrum>
        Returns:
        a description suitable for displaying in the file chooser
      • getFormatExtensions

        public String[] getFormatExtensions()
        Returns the extension(s) of the format.
        Specified by:
        getFormatExtensions in interface adams.core.io.FileFormatHandler
        Specified by:
        getFormatExtensions in class adams.data.io.input.AbstractDataContainerReader<Spectrum>
        Returns:
        the extension (without the dot!)
      • identifyWaveNumbers

        protected gnu.trove.list.array.TFloatArrayList identifyWaveNumbers​(weka.core.Instances data,
                                                                           int[] cols)
        Identifies the wave numbers.
        Parameters:
        data - the data to analyze
        cols - the columns
        Returns:
        the wave numbers
      • identifySampleData

        protected List<adams.data.report.Field> identifySampleData​(weka.core.Instances data,
                                                                   int[] cols)
        Returns the sample data fields.
        Parameters:
        data - the sheet to analyze
        cols - the columns
        Returns:
        the fields
      • readData

        protected void readData()
        Performs the actual reading.
        Specified by:
        readData in class adams.data.io.input.AbstractDataContainerReader<Spectrum>
      • stopExecution

        public void stopExecution()
        Stops the execution.
        Specified by:
        stopExecution in interface adams.core.Stoppable
        Overrides:
        stopExecution in class AbstractSpectrumReader
      • main

        public static void main​(String[] args)
        Runs the reader from the command-line. If the option AbstractSpectrumReader.OPTION_OUTPUTDIR is specified then the read spectra get output as .spec files in that directory.
        Parameters:
        args - the command-line options to use