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.DataContainerReader>,adams.core.SizeOfHandler,adams.core.Stoppable,adams.data.io.input.DataContainerReader<Spectrum>,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 classColumnWiseSpreadSheetSpectrumReader.SampleIDLocationDetermines whether the sample ID is located.
-
Field Summary
Fields Modifier and Type Field Description protected adams.core.Rangem_AmplitudeRowsthe range of rows containing the amplitudes.protected adams.data.io.input.SpreadSheetReaderm_Readerthe spreadsheet reader to use.protected adams.data.spreadsheet.SpreadSheetColumnIndexm_SampleDataLabelsColumnthe column containing the labels for the sample data values.protected adams.core.Rangem_SampleDataRowsthe range of rows containing the sample data.protected ColumnWiseSpreadSheetSpectrumReader.SampleIDLocationm_SampleIDLocationthe sample ID location.protected adams.core.Indexm_SampleIDRowthe row containing the sample ID.protected adams.data.spreadsheet.SpreadSheetColumnRangem_SpectrumColumnsthe range of columns to load spectra from.protected adams.data.spreadsheet.SpreadSheetColumnIndexm_WaveNumberColumnthe 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 StringamplitudeRowsTipText()Returns the tip text for this property.protected voidcheckData()Performs some checks on the provided cols/rows.voiddefineOptions()Adds options to the internal list of options.String[]getActualFormatExtensions()Returns the underlying format extensions.adams.core.RangegetAmplitudeRows()Returns the range of rows containing the amplitudes.StringgetFormatDescription()Returns a string describing the format (used in the file chooser).String[]getFormatExtensions()Returns the extension(s) of the format.adams.data.io.input.SpreadSheetReadergetReader()Returns the spreadsheet reader in use.adams.data.spreadsheet.SpreadSheetColumnIndexgetSampleDataLabelsColumn()Returns the column containing the labels for the sample data values.adams.core.RangegetSampleDataRows()Returns the range of rows containing the sample data.ColumnWiseSpreadSheetSpectrumReader.SampleIDLocationgetSampleIDLocation()Returns the where the sample ID is located.adams.core.IndexgetSampleIDRow()Returns the row that contains the sample ID.adams.data.spreadsheet.SpreadSheetColumnRangegetSpectrumColumns()Returns the coumns containing spectral data.adams.data.spreadsheet.SpreadSheetColumnIndexgetWaveNumberColumn()Returns the column containing the wave numbers.StringglobalInfo()Returns a string describing the object.static voidmain(String[] args)Runs the reader from the command-line.protected voidreadData()Performs the actual reading.StringreaderTipText()Returns the tip text for this property.StringsampleDataLabelsColumnTipText()Returns the tip text for this property.StringsampleDataRowsTipText()Returns the tip text for this property.StringsampleIDLocationTipText()Returns the tip text for this property.StringsampleIDRowTipText()Returns the tip text for this property.voidsetAmplitudeRows(adams.core.Range value)Sets the range of rows containing the amplitudes.voidsetReader(adams.data.io.input.SpreadSheetReader value)Sets the spreadsheet reader to use.voidsetSampleDataLabelsColumn(adams.data.spreadsheet.SpreadSheetColumnIndex value)Sets the column containing the labels for the sample data values.voidsetSampleDataRows(adams.core.Range value)Sets the range of rows containing the sample data.voidsetSampleIDLocation(ColumnWiseSpreadSheetSpectrumReader.SampleIDLocation value)Sets whether the sample ID is located.voidsetSampleIDRow(adams.core.Index value)Sets the row that contains the sample ID.voidsetSpectrumColumns(adams.data.spreadsheet.SpreadSheetColumnRange value)Sets the columns containing spectral data.voidsetWaveNumberColumn(adams.data.spreadsheet.SpreadSheetColumnIndex value)Sets the column containing the wave numbers.StringspectrumColumnsTipText()Returns the tip text for this property.voidstopExecution()Stops the execution.StringwaveNumberColumnTipText()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:
globalInfoin interfaceadams.core.GlobalInfoSupporter- Specified by:
globalInfoin 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:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classAbstractSpectrumReader
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescriptionin interfaceadams.core.io.FileFormatHandler- Specified by:
getFormatDescriptionin 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:
getFormatExtensionsin interfaceadams.core.io.FileFormatHandler- Specified by:
getFormatExtensionsin classadams.data.io.input.AbstractDataContainerReader<Spectrum>- Returns:
- the extension (without the dot!)
-
getActualFormatExtensions
public String[] getActualFormatExtensions()
Returns the underlying format extensions.- Specified by:
getActualFormatExtensionsin 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:
checkDatain classAbstractSpectrumReader
-
readData
protected void readData()
Performs the actual reading.- Specified by:
readDatain classadams.data.io.input.AbstractDataContainerReader<Spectrum>
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecutionin interfaceadams.core.Stoppable- Overrides:
stopExecutionin classAbstractSpectrumReader
-
main
public static void main(String[] args)
Runs the reader from the command-line. If the optionAbstractSpectrumReader.OPTION_OUTPUTDIRis specified then the read spectra get output as .spec files in that directory.- Parameters:
args- the command-line options to use
-
-