Class ColumnWiseSpreadSheetSpectrumReader

  • 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.AbstractDataContainerReader>, adams.core.SizeOfHandler, adams.core.Stoppable, adams.data.io.input.MetaFileReader, Serializable, Comparable

    public class ColumnWiseSpreadSheetSpectrumReader
    extends AbstractSpectrumReader
    implements adams.data.io.input.MetaFileReader
    Reads spectra from columns in a spreadsheet obtained with the specified spreadsheet reader.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -input <adams.core.io.PlaceholderFile> (property: input)
        The file to read and turn into a container.
        default: ${CWD}
     
    -create-dummy-report <boolean> (property: createDummyReport)
        If true, then a dummy report is created if none present.
        default: false
     
    -instrument <java.lang.String> (property: instrument)
        The name of the instrument that generated the spectra (if not already present
        in data).
        default: unknown
     
    -format <java.lang.String> (property: format)
        The data format string.
        default: NIR
     
    -keep-format <boolean> (property: keepFormat)
        If enabled the format obtained from the file is not replaced by the format
        defined here.
        default: false
     
    -reader <adams.data.io.input.SpreadSheetReader> (property: reader)
        The spreadsheet reader to use for reading the raw data.
        default: adams.data.io.input.CsvSpreadSheetReader -data-row-type adams.data.spreadsheet.DenseDataRow -spreadsheet-type adams.data.spreadsheet.SpreadSheet
     
    -spectrum-columns <adams.data.spreadsheet.SpreadSheetColumnRange> (property: spectrumColumns)
        The columns containing the spectral data
        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
     
    -amplitude-rows <adams.core.Range> (property: amplitudeRows)
        The rows containing the data with the amplitudes
        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
     
    -wave-number-column <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: waveNumberColumn)
        The column containing the wave number.
        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
     
    -sample-data-labels-column <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: sampleDataLabelsColumn)
        The column containing the labels for the sample data values
        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
     
    -sample-data-rows <adams.core.Range> (property: sampleDataRows)
        The rows containing the data with the sample data
        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
     
    -sample-id-location <HEADER|ROW> (property: sampleIDLocation)
        Where the sample ID is located; if ROW is selected the 'sampleIDRow' option
        must be filled in as well.
        default: ROW
     
    -sample-id-row <adams.core.Index> (property: sampleIDRow)
        The row containing 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
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Reader

        protected adams.data.io.input.SpreadSheetReader m_Reader
        the spreadsheet reader to use.
      • m_SpectrumColumns

        protected adams.data.spreadsheet.SpreadSheetColumnRange m_SpectrumColumns
        the range of columns to load spectra from.
      • m_AmplitudeRows

        protected adams.core.Range m_AmplitudeRows
        the range of rows containing the amplitudes.
      • m_WaveNumberColumn

        protected adams.data.spreadsheet.SpreadSheetColumnIndex m_WaveNumberColumn
        the column with the wave numbers.
      • m_SampleDataLabelsColumn

        protected adams.data.spreadsheet.SpreadSheetColumnIndex m_SampleDataLabelsColumn
        the column containing the labels for the sample data values.
      • m_SampleDataRows

        protected adams.core.Range m_SampleDataRows
        the range of rows containing the sample data.
      • m_SampleIDRow

        protected adams.core.Index m_SampleIDRow
        the row containing the sample ID.
    • Constructor Detail

      • ColumnWiseSpreadSheetSpectrumReader

        public ColumnWiseSpreadSheetSpectrumReader()
    • 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
      • 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!)
      • getActualFormatExtensions

        public String[] getActualFormatExtensions()
        Returns the underlying format extensions.
        Specified by:
        getActualFormatExtensions in interface adams.data.io.input.MetaFileReader
        Returns:
        the format extensions (excluding dot)
      • setReader

        public void setReader​(adams.data.io.input.SpreadSheetReader value)
        Sets the spreadsheet reader to use.
        Parameters:
        value - the reader
      • getReader

        public adams.data.io.input.SpreadSheetReader getReader()
        Returns the spreadsheet reader in use.
        Returns:
        the reader
      • readerTipText

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

        public void setSpectrumColumns​(adams.data.spreadsheet.SpreadSheetColumnRange value)
        Sets the columns containing spectral data.
        Parameters:
        value - the range
      • getSpectrumColumns

        public adams.data.spreadsheet.SpreadSheetColumnRange getSpectrumColumns()
        Returns the coumns containing spectral data.
        Returns:
        the range
      • spectrumColumnsTipText

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

        public void setAmplitudeRows​(adams.core.Range value)
        Sets the range of rows containing the amplitudes.
        Parameters:
        value - the range
      • getAmplitudeRows

        public adams.core.Range getAmplitudeRows()
        Returns the range of rows containing the amplitudes.
        Returns:
        the range
      • amplitudeRowsTipText

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

        public void setWaveNumberColumn​(adams.data.spreadsheet.SpreadSheetColumnIndex value)
        Sets the column containing the wave numbers.
        Parameters:
        value - the column
      • getWaveNumberColumn

        public adams.data.spreadsheet.SpreadSheetColumnIndex getWaveNumberColumn()
        Returns the column containing the wave numbers.
        Returns:
        the column
      • waveNumberColumnTipText

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

        public void setSampleDataLabelsColumn​(adams.data.spreadsheet.SpreadSheetColumnIndex value)
        Sets the column containing the labels for the sample data values.
        Parameters:
        value - the column
      • getSampleDataLabelsColumn

        public adams.data.spreadsheet.SpreadSheetColumnIndex getSampleDataLabelsColumn()
        Returns the column containing the labels for the sample data values.
        Returns:
        the column
      • sampleDataLabelsColumnTipText

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

        public void setSampleDataRows​(adams.core.Range value)
        Sets the range of rows containing the sample data.
        Parameters:
        value - the range
      • getSampleDataRows

        public adams.core.Range getSampleDataRows()
        Returns the range of rows containing the sample data.
        Returns:
        the range
      • sampleDataRowsTipText

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

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

        public void setSampleIDRow​(adams.core.Index value)
        Sets the row that contains the sample ID.
        Parameters:
        value - the row index
      • getSampleIDRow

        public adams.core.Index getSampleIDRow()
        Returns the row that contains the sample ID.
        Returns:
        the row index
      • sampleIDRowTipText

        public String sampleIDRowTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • 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