Package adams.data.io.input
Class ColumnWiseSpreadSheetSpectrumReader
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.input.AbstractDataContainerReader<Spectrum>
-
- adams.data.io.input.AbstractSpectrumReader
-
- adams.data.io.input.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ColumnWiseSpreadSheetSpectrumReader.SampleIDLocation
Determines whether the sample ID is located.
-
Field Summary
Fields Modifier and Type Field Description protected adams.core.Range
m_AmplitudeRows
the range of rows containing the amplitudes.protected adams.data.io.input.SpreadSheetReader
m_Reader
the spreadsheet reader to use.protected adams.data.spreadsheet.SpreadSheetColumnIndex
m_SampleDataLabelsColumn
the column containing the labels for the sample data values.protected adams.core.Range
m_SampleDataRows
the range of rows containing the sample data.protected ColumnWiseSpreadSheetSpectrumReader.SampleIDLocation
m_SampleIDLocation
the sample ID location.protected adams.core.Index
m_SampleIDRow
the row containing the sample ID.protected adams.data.spreadsheet.SpreadSheetColumnRange
m_SpectrumColumns
the range of columns to load spectra from.protected adams.data.spreadsheet.SpreadSheetColumnIndex
m_WaveNumberColumn
the column with the wave numbers.-
Fields inherited from class adams.data.io.input.AbstractSpectrumReader
m_Format, m_Instrument, m_KeepFormat, m_Stopped, m_UseAbsoluteSource, OPTION_OUTPUTDIR
-
-
Constructor Summary
Constructors Constructor Description ColumnWiseSpreadSheetSpectrumReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
amplitudeRowsTipText()
Returns the tip text for this property.protected void
checkData()
Performs some checks on the provided cols/rows.void
defineOptions()
Adds options to the internal list of options.String[]
getActualFormatExtensions()
Returns the underlying format extensions.adams.core.Range
getAmplitudeRows()
Returns the range of rows containing the amplitudes.String
getFormatDescription()
Returns a string describing the format (used in the file chooser).String[]
getFormatExtensions()
Returns the extension(s) of the format.adams.data.io.input.SpreadSheetReader
getReader()
Returns the spreadsheet reader in use.adams.data.spreadsheet.SpreadSheetColumnIndex
getSampleDataLabelsColumn()
Returns the column containing the labels for the sample data values.adams.core.Range
getSampleDataRows()
Returns the range of rows containing the sample data.ColumnWiseSpreadSheetSpectrumReader.SampleIDLocation
getSampleIDLocation()
Returns the where the sample ID is located.adams.core.Index
getSampleIDRow()
Returns the row that contains the sample ID.adams.data.spreadsheet.SpreadSheetColumnRange
getSpectrumColumns()
Returns the coumns containing spectral data.adams.data.spreadsheet.SpreadSheetColumnIndex
getWaveNumberColumn()
Returns the column containing the wave numbers.String
globalInfo()
Returns a string describing the object.static void
main(String[] args)
Runs the reader from the command-line.protected void
readData()
Performs the actual reading.String
readerTipText()
Returns the tip text for this property.String
sampleDataLabelsColumnTipText()
Returns the tip text for this property.String
sampleDataRowsTipText()
Returns the tip text for this property.String
sampleIDLocationTipText()
Returns the tip text for this property.String
sampleIDRowTipText()
Returns the tip text for this property.void
setAmplitudeRows(adams.core.Range value)
Sets the range of rows containing the amplitudes.void
setReader(adams.data.io.input.SpreadSheetReader value)
Sets the spreadsheet reader to use.void
setSampleDataLabelsColumn(adams.data.spreadsheet.SpreadSheetColumnIndex value)
Sets the column containing the labels for the sample data values.void
setSampleDataRows(adams.core.Range value)
Sets the range of rows containing the sample data.void
setSampleIDLocation(ColumnWiseSpreadSheetSpectrumReader.SampleIDLocation value)
Sets whether the sample ID is located.void
setSampleIDRow(adams.core.Index value)
Sets the row that contains the sample ID.void
setSpectrumColumns(adams.data.spreadsheet.SpreadSheetColumnRange value)
Sets the columns containing spectral data.void
setWaveNumberColumn(adams.data.spreadsheet.SpreadSheetColumnIndex value)
Sets the column containing the wave numbers.String
spectrumColumnsTipText()
Returns the tip text for this property.void
stopExecution()
Stops the execution.String
waveNumberColumnTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.io.input.AbstractSpectrumReader
createDummyReport, formatTipText, getDefaultFormat, getDefaultInstrument, getDefaultKeepFormat, getDefaultUseAbsoluteSource, getFormat, getInstrument, getKeepFormat, getReaders, getUseAbsoluteSource, instrumentTipText, keepFormatTipText, postProcessData, runReader, setFormat, setInstrument, setKeepFormat, setUseAbsoluteSource, useAbsoluteSourceTipText
-
Methods inherited from class adams.data.io.input.AbstractDataContainerReader
cleanUp, compareTo, createDummyReportTipText, destroy, doRead, equals, getAdditionalInformation, getCreateDummyReport, getDefaultFormatExtension, getInput, initialize, inputTipText, isInputFile, read, reset, setCreateDummyReport, setInput, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
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_SampleIDLocation
protected ColumnWiseSpreadSheetSpectrumReader.SampleIDLocation m_SampleIDLocation
the sample ID location.
-
m_SampleIDRow
protected adams.core.Index m_SampleIDRow
the row containing the sample ID.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.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 interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classAbstractSpectrumReader
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescription
in interfaceadams.core.io.FileFormatHandler
- Specified by:
getFormatDescription
in classadams.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 interfaceadams.core.io.FileFormatHandler
- Specified by:
getFormatExtensions
in classadams.data.io.input.AbstractDataContainerReader<Spectrum>
- Returns:
- the extension (without the dot!)
-
getActualFormatExtensions
public String[] getActualFormatExtensions()
Returns the underlying format extensions.- Specified by:
getActualFormatExtensions
in interfaceadams.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.
-
setSampleIDLocation
public void setSampleIDLocation(ColumnWiseSpreadSheetSpectrumReader.SampleIDLocation value)
Sets whether the sample ID is located.- Parameters:
value
- the location
-
getSampleIDLocation
public ColumnWiseSpreadSheetSpectrumReader.SampleIDLocation getSampleIDLocation()
Returns the where the sample ID is located.- Returns:
- the location
-
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.
-
checkData
protected void checkData()
Performs some checks on the provided cols/rows.- Overrides:
checkData
in classAbstractSpectrumReader
-
readData
protected void readData()
Performs the actual reading.- Specified by:
readData
in classadams.data.io.input.AbstractDataContainerReader<Spectrum>
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceadams.core.Stoppable
- Overrides:
stopExecution
in classAbstractSpectrumReader
-
main
public static void main(String[] args)
Runs the reader from the command-line. If the optionAbstractSpectrumReader.OPTION_OUTPUTDIR
is specified then the read spectra get output as .spec files in that directory.- Parameters:
args
- the command-line options to use
-
-