Class SpreadSheetColumnsToSpectra

  • All Implemented Interfaces:
    adams.core.AdditionalInformationHandler, adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.LenientModeSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.ShallowCopySupporter<adams.data.conversion.AbstractConversion>, adams.core.SizeOfHandler, adams.core.Stoppable, adams.data.conversion.Conversion, Serializable

    public class SpreadSheetColumnsToSpectra
    extends adams.data.conversion.AbstractConversion
    implements adams.core.LenientModeSupporter
    Turns spreadsheet columns into spectra.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -col-wave-number <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: columnWaveNumber)
        The (optional) column in the spreadsheet that contains the wavenumber information.
        default:
        example: An index is a number starting with 1; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
     
    -wave-number-regexp <adams.core.base.BaseRegExp> (property: waveNumberRegExp)
        The regular expression to identify the wave number (1st group is used).
        default: (.*)
        more: https://docs.oracle.com/javase/tutorial/essential/regex/
        https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html
     
    -cols-amplitude <adams.data.spreadsheet.SpreadSheetColumnRange> (property: columnsAmplitude)
        The columns in the spreadsheet that contain the amplitude information.
        default:
        example: A range is a comma-separated list of single 1-based indices or sub-ranges of indices ('start-end'); 'inv(...)' inverts the range '...'; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
     
    -rows-amplitude <adams.data.spreadsheet.SpreadSheetRowRange> (property: rowsAmplitude)
        The rows that contain amplitude information.
        default:
        example: A range is a comma-separated list of single 1-based indices or sub-ranges of indices ('start-end'); 'inv(...)' inverts the range '...'; the following placeholders can be used as well: first, second, third, last_2, last_1, last
     
    -col-sampledata-names <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: colSampleDataNames)
        The (optional) column that contains the sample data names.
        default:
        example: An index is a number starting with 1; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
     
    -rows-sampledata <adams.data.spreadsheet.SpreadSheetRowRange> (property: rowsSampleData)
        The rows that contain sampledata.
        default:
        example: A range is a comma-separated list of single 1-based indices or sub-ranges of indices ('start-end'); 'inv(...)' inverts the range '...'; the following placeholders can be used as well: first, second, third, last_2, last_1, last
     
    -row-id <adams.data.spreadsheet.SpreadSheetRowIndex> (property: rowID)
        The (optional) row that contains the sample ID.
        default:
        example: An index is a number starting with 1; the following placeholders can be used as well: first, second, third, last_2, last_1, last
     
    -format <java.lang.String> (property: format)
        The format for the spectrum.
        default: NIR
     
    -instrument <java.lang.String> (property: instrument)
        The instrument for the spectrum.
        default: unknown
     
    -lenient <boolean> (property: lenient)
        If enabled, then errors (e.g., due to corrupt data) will not cause exceptions.
        default: false
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String DEFAULT_WAVENO_REGEXP  
      protected adams.data.spreadsheet.SpreadSheetColumnIndex m_ColSampleDataNames
      the column with the sample data names.
      protected adams.data.spreadsheet.SpreadSheetColumnRange m_ColumnsAmplitude
      the column with amplitudes.
      protected adams.data.spreadsheet.SpreadSheetColumnIndex m_ColumnWaveNumber
      the (optional) wavenumber column.
      protected String m_Format
      the format to use for the spectrum.
      protected String m_Instrument
      the instrument to use for the spectrum.
      protected boolean m_Lenient
      whether to skip over errors.
      protected adams.data.spreadsheet.SpreadSheetRowIndex m_RowID
      the (optional) row with the sample ID.
      protected adams.data.spreadsheet.SpreadSheetRowRange m_RowsAmplitude
      the rows to get the amplitudes from.
      protected adams.data.spreadsheet.SpreadSheetRowRange m_RowsSampleData
      the rows to get the sample data from.
      protected adams.core.base.BaseRegExp m_WaveNumberRegExp
      the regular expression to extract the wave number from the header (first group is used).
      • Fields inherited from class adams.data.conversion.AbstractConversion

        m_Input, m_Output, m_Owner, m_Stopped
      • Fields inherited from class adams.core.option.AbstractOptionHandler

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

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Class accepts()
      Returns the class that is accepted as input.
      String colSampleDataNamesTipText()
      Returns the tip text for this property.
      String columnsAmplitudeTipText()
      Returns the tip text for this property.
      String columnWaveNumberTipText()
      Returns the tip text for this property.
      void defineOptions()
      Adds options to the internal list of options.
      protected Object doConvert()
      Performs the actual conversion.
      String formatTipText()
      Returns the tip text for this property.
      Class generates()
      Returns the class that is generated as output.
      adams.data.spreadsheet.SpreadSheetColumnIndex getColSampleDataNames()
      Returns the column that contains the sample data names.
      adams.data.spreadsheet.SpreadSheetColumnRange getColumnsAmplitude()
      Returns the columns with the amplitude information.
      adams.data.spreadsheet.SpreadSheetColumnIndex getColumnWaveNumber()
      Returns the column with the wavenumber information.
      String getFormat()
      Returns the format to use for the spectrum.
      String getInstrument()
      Returns the instrument to use for the spectrum.
      boolean getLenient()
      Returns whether whether to skip over errors.
      String getQuickInfo()
      Returns a quick info about the object, which can be displayed in the GUI.
      adams.data.spreadsheet.SpreadSheetRowIndex getRowID()
      Returns the (optional) row that contains the sample ID.
      adams.data.spreadsheet.SpreadSheetRowRange getRowsAmplitude()
      Returns the rows with amplitude information.
      adams.data.spreadsheet.SpreadSheetRowRange getRowsSampleData()
      Returns the rows with sampledata.
      adams.core.base.BaseRegExp getWaveNumberRegExp()
      Returns the regular expression to identify the wave number (1st group is used).
      String globalInfo()
      Returns a string describing the object.
      String instrumentTipText()
      Returns the tip text for this property.
      String lenientTipText()
      Returns the tip text for this property.
      String rowIDTipText()
      Returns the tip text for this property.
      String rowsAmplitudeTipText()
      Returns the tip text for this property.
      String rowsSampleDataTipText()
      Returns the tip text for this property.
      void setColSampleDataNames​(adams.data.spreadsheet.SpreadSheetColumnIndex value)
      Sets the column that contains the sample data names.
      void setColumnsAmplitude​(adams.data.spreadsheet.SpreadSheetColumnRange value)
      Sets the columns with the amplitude information.
      void setColumnWaveNumber​(adams.data.spreadsheet.SpreadSheetColumnIndex value)
      Sets the column with the wavenumber information.
      void setFormat​(String value)
      Sets the format to use for the spectrum.
      void setInstrument​(String value)
      Sets the instrument to use for the spectrum.
      void setLenient​(boolean value)
      Sets whether to skip over errors.
      void setRowID​(adams.data.spreadsheet.SpreadSheetRowIndex value)
      Sets the (optional) row that contains the sample ID.
      void setRowsAmplitude​(adams.data.spreadsheet.SpreadSheetRowRange value)
      Sets the rows with amplitude information.
      void setRowsSampleData​(adams.data.spreadsheet.SpreadSheetRowRange value)
      Sets the rows with sampledata.
      void setWaveNumberRegExp​(adams.core.base.BaseRegExp value)
      Sets the regular expression to identify the wave number (1st group is used).
      String waveNumberRegExpTipText()
      Returns the tip text for this property.
      • Methods inherited from class adams.data.conversion.AbstractConversion

        checkData, cleanUp, convert, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, reset, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, destroy, 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.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_ColumnWaveNumber

        protected adams.data.spreadsheet.SpreadSheetColumnIndex m_ColumnWaveNumber
        the (optional) wavenumber column.
      • m_WaveNumberRegExp

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

        protected adams.data.spreadsheet.SpreadSheetColumnRange m_ColumnsAmplitude
        the column with amplitudes.
      • m_RowsAmplitude

        protected adams.data.spreadsheet.SpreadSheetRowRange m_RowsAmplitude
        the rows to get the amplitudes from.
      • m_ColSampleDataNames

        protected adams.data.spreadsheet.SpreadSheetColumnIndex m_ColSampleDataNames
        the column with the sample data names.
      • m_RowsSampleData

        protected adams.data.spreadsheet.SpreadSheetRowRange m_RowsSampleData
        the rows to get the sample data from.
      • m_RowID

        protected adams.data.spreadsheet.SpreadSheetRowIndex m_RowID
        the (optional) row with the sample ID.
      • m_Format

        protected String m_Format
        the format to use for the spectrum.
      • m_Instrument

        protected String m_Instrument
        the instrument to use for the spectrum.
      • m_Lenient

        protected boolean m_Lenient
        whether to skip over errors.
    • Constructor Detail

      • SpreadSheetColumnsToSpectra

        public SpreadSheetColumnsToSpectra()
    • 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 adams.core.option.AbstractOptionHandler
      • setColumnWaveNumber

        public void setColumnWaveNumber​(adams.data.spreadsheet.SpreadSheetColumnIndex value)
        Sets the column with the wavenumber information.
        Parameters:
        value - the column
      • getColumnWaveNumber

        public adams.data.spreadsheet.SpreadSheetColumnIndex getColumnWaveNumber()
        Returns the column with the wavenumber information.
        Returns:
        the column
      • columnWaveNumberTipText

        public String columnWaveNumberTipText()
        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.
      • setColumnsAmplitude

        public void setColumnsAmplitude​(adams.data.spreadsheet.SpreadSheetColumnRange value)
        Sets the columns with the amplitude information.
        Parameters:
        value - the columns
      • getColumnsAmplitude

        public adams.data.spreadsheet.SpreadSheetColumnRange getColumnsAmplitude()
        Returns the columns with the amplitude information.
        Returns:
        the columns
      • columnsAmplitudeTipText

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

        public void setRowID​(adams.data.spreadsheet.SpreadSheetRowIndex value)
        Sets the (optional) row that contains the sample ID.
        Parameters:
        value - the row
      • getRowID

        public adams.data.spreadsheet.SpreadSheetRowIndex getRowID()
        Returns the (optional) row that contains the sample ID.
        Returns:
        the row
      • rowIDTipText

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

        public void setRowsAmplitude​(adams.data.spreadsheet.SpreadSheetRowRange value)
        Sets the rows with amplitude information.
        Parameters:
        value - the rows
      • getRowsAmplitude

        public adams.data.spreadsheet.SpreadSheetRowRange getRowsAmplitude()
        Returns the rows with amplitude information.
        Returns:
        the rows
      • rowsAmplitudeTipText

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

        public void setColSampleDataNames​(adams.data.spreadsheet.SpreadSheetColumnIndex value)
        Sets the column that contains the sample data names.
        Parameters:
        value - the column
      • getColSampleDataNames

        public adams.data.spreadsheet.SpreadSheetColumnIndex getColSampleDataNames()
        Returns the column that contains the sample data names.
        Returns:
        the column
      • colSampleDataNamesTipText

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

        public void setRowsSampleData​(adams.data.spreadsheet.SpreadSheetRowRange value)
        Sets the rows with sampledata.
        Parameters:
        value - the rows
      • getRowsSampleData

        public adams.data.spreadsheet.SpreadSheetRowRange getRowsSampleData()
        Returns the rows with sampledata.
        Returns:
        the rows
      • rowsSampleDataTipText

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

        public void setFormat​(String value)
        Sets the format to use for the spectrum.
        Parameters:
        value - the format
      • getFormat

        public String getFormat()
        Returns the format to use for the spectrum.
        Returns:
        the format
      • formatTipText

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

        public void setInstrument​(String value)
        Sets the instrument to use for the spectrum.
        Parameters:
        value - the instrument
      • getInstrument

        public String getInstrument()
        Returns the instrument to use for the spectrum.
        Returns:
        the instrument
      • instrumentTipText

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

        public void setLenient​(boolean value)
        Sets whether to skip over errors.
        Specified by:
        setLenient in interface adams.core.LenientModeSupporter
        Parameters:
        value - true if to skip
      • getLenient

        public boolean getLenient()
        Returns whether whether to skip over errors.
        Specified by:
        getLenient in interface adams.core.LenientModeSupporter
        Returns:
        true if to skip
      • lenientTipText

        public String lenientTipText()
        Returns the tip text for this property.
        Specified by:
        lenientTipText in interface adams.core.LenientModeSupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • accepts

        public Class accepts()
        Returns the class that is accepted as input.
        Specified by:
        accepts in interface adams.data.conversion.Conversion
        Specified by:
        accepts in class adams.data.conversion.AbstractConversion
        Returns:
        the class
      • generates

        public Class generates()
        Returns the class that is generated as output.
        Specified by:
        generates in interface adams.data.conversion.Conversion
        Specified by:
        generates in class adams.data.conversion.AbstractConversion
        Returns:
        the class
      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the object, which can be displayed in the GUI.
        Specified by:
        getQuickInfo in interface adams.core.QuickInfoSupporter
        Overrides:
        getQuickInfo in class adams.data.conversion.AbstractConversion
        Returns:
        null if no info available, otherwise short string
      • doConvert

        protected Object doConvert()
                            throws Exception
        Performs the actual conversion.
        Specified by:
        doConvert in class adams.data.conversion.AbstractConversion
        Returns:
        the converted data
        Throws:
        Exception - if something goes wrong with the conversion