Package adams.data.io.input
Class SimpleArffSpectrumReader
- 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.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 Summary
Fields Modifier and Type Field Description protected booleanm_AttNameContainsWaveNumberwhether the attribute name contains the wave number.protected weka.core.converters.SimpleArffLoaderm_Loaderthe arff reader.protected adams.data.weka.WekaAttributeRangem_SampleDataAttributesthe range of attributes containing sample data.protected adams.data.weka.WekaAttributeIndexm_SampleIDAttributethe attribute containing the sample ID.protected adams.data.weka.WekaAttributeRangem_WaveAttributesthe range of attributes containing wave amplitudes.protected adams.core.base.BaseRegExpm_WaveNumberRegExpthe regular expression to extract the wave number from the name (first group is used).-
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 SimpleArffSpectrumReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringattNameContainsWaveNumberTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.booleangetAttNameContainsWaveNumber()Returns whether to extract the wave number from the attribute names.StringgetFormatDescription()Returns a string describing the format (used in the file chooser).String[]getFormatExtensions()Returns the extension(s) of the format.adams.data.weka.WekaAttributeRangegetSampleDataAttributes()Returns the attributes containing the sample data.adams.data.weka.WekaAttributeIndexgetSampleIDAttribute()Returns the attribute containing the sample ID.adams.data.weka.WekaAttributeRangegetWaveAttributes()Returns the attributes containing the wave amplitudes.adams.core.base.BaseRegExpgetWaveNumberRegExp()Returns the regular expression to identify the wave number (1st group is used).StringglobalInfo()Returns a string describing the object.protected List<adams.data.report.Field>identifySampleData(weka.core.Instances data, int[] cols)Returns the sample data fields.protected gnu.trove.list.array.TFloatArrayListidentifyWaveNumbers(weka.core.Instances data, int[] cols)Identifies the wave numbers.static voidmain(String[] args)Runs the reader from the command-line.protected voidreadData()Performs the actual reading.StringsampleDataAttributesTipText()Returns the tip text for this property.StringsampleIDAttributeTipText()Returns the tip text for this property.voidsetAttNameContainsWaveNumber(boolean value)Sets whether to extract the wave number from the attribute names.voidsetSampleDataAttributes(adams.data.weka.WekaAttributeRange value)Sets the attributes containing the sample data.voidsetSampleIDAttribute(adams.data.weka.WekaAttributeIndex value)Sets the attribute containing the sample ID.voidsetWaveAttributes(adams.data.weka.WekaAttributeRange value)Sets the attributes containing the wave amplitudes.voidsetWaveNumberRegExp(adams.core.base.BaseRegExp value)Sets the regular expression to identify the wave number (1st group is used).voidstopExecution()Stops the execution.StringwaveAttributesTipText()Returns the tip text for this property.StringwaveNumberRegExpTipText()Returns the tip text for this property.-
Methods inherited from class adams.data.io.input.AbstractSpectrumReader
checkData, 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, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
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.
-
-
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
-
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:
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!)
-
identifyWaveNumbers
protected gnu.trove.list.array.TFloatArrayList identifyWaveNumbers(weka.core.Instances data, int[] cols)Identifies the wave numbers.- Parameters:
data- the data to analyzecols- 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 analyzecols- the columns- Returns:
- the fields
-
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
-
-