Package adams.flow.transformer
Class InstanceToSpectrum
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.transformer.AbstractTransformer
-
- adams.flow.transformer.InstanceToSpectrum
-
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler,adams.core.CleanUpHandler,adams.core.Destroyable,adams.core.GlobalInfoSupporter,adams.core.logging.LoggingLevelHandler,adams.core.logging.LoggingSupporter,adams.core.option.OptionHandler,adams.core.QuickInfoSupporter,adams.core.ShallowCopySupporter<adams.flow.core.Actor>,adams.core.SizeOfHandler,adams.core.Stoppable,adams.core.StoppableWithFeedback,adams.core.VariablesInspectionHandler,adams.event.VariableChangeListener,adams.flow.core.Actor,adams.flow.core.ErrorHandler,adams.flow.core.InputConsumer,adams.flow.core.OutputProducer,Serializable,Comparable
public class InstanceToSpectrum extends adams.flow.transformer.AbstractTransformerConverts a weka.core.Instance to a Spectrum.
By default, the wave numbers start at 0 and use an increment of 1.
If 'first' and 'last' wave number are supplied, the step size is calculated based on the number of amplitudes present in the Instance.
If only 'first' wave number is supplied, then the supplied wave step size is used.
'first' and 'last' get ignored if a value of less than 0 is supplied.
Input/output:
- accepts:
weka.core.Instance
- generates:
knir.data.spectrum.Spectrum
Valid options are:
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The name of the actor. default: InstanceToSpectrum
-annotation <adams.core.base.BaseText> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors. default: false
-productCode <java.lang.String> (property: productCode) Either the attribute name with the product code in it, or the actual product code to be used. default: 01
-sampleID <java.lang.String> (property: sampleID) Regex to find sample id. e.g 'sample_id' default: sample_id
-getProductCodeFromAttribute <java.lang.Boolean> (property: getProductCodeFromAttribute) Regex to find sample id. e.g 'sample_id' default: false
-spectralDataAttributes <java.lang.String> (property: spectralDataAttributes) Regex to choose attributes to use as spectum amplitudes' default: amplitude.*
-first-wave <float> (property: firstWave) The starting point for the wave numbers, ignored if less than 0. default: -1.0
-last-wave <float> (property: lastWave) The end point for the wave numbers, ignored if less than 0. default: -1.0
-wave-step <float> (property: waveStep) The step size for the wave numbers to use, if 'lastWave' is not defined. default: 1.0 minimum: 0.0
- Version:
- $Revision: 2242 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected floatm_FirstWavethe first wave number.protected floatm_LastWavethe last wave number.protected Stringm_ProductCodeEither the attribute name with the product code in it, or the actual product code.protected Booleanm_ProductCodeFromAttributeGet the product code from the attribute named ProductCode in the Instance?protected Stringm_SampleIDregexRegex to find sample id. e.g "sampleID"protected Stringm_SpectralDataRegex to find spectral data. e.g "amplitudeprotected floatm_WaveStepthe wave number step.-
Fields inherited from class adams.flow.transformer.AbstractTransformer
BACKUP_INPUT, BACKUP_OUTPUT, m_InputToken, m_OutputToken
-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
-
Constructor Summary
Constructors Constructor Description InstanceToSpectrum()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]accepts()Returns the class that the consumer accepts.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecute()Executes the flow item.StringfirstWaveTipText()Returns the tip text for this property.Class[]generates()Returns the class of objects that it generates.floatgetFirstWave()Returns the starting point for the wave numbers.BooleangetGetProductCodeFromAttribute()Get product code from instance attribute?floatgetLastWave()Returns the end point for the wave numbers.StringgetProductCode()Get Product Code.StringgetProductCodeFromAttributeTipText()Returns the tip text for this property.StringgetSampleID()Get sample id regex.StringgetSpectralDataAttributes()Get which attributes to use for spectral data.floatgetWaveStep()Returns the step size for the wave numbers, if lastWave is not defined.StringglobalInfo()Returns a string describing the object.StringlastWaveTipText()Returns the tip text for this property.StringproductCodeTipText()Returns the tip text for this property.StringsampleIDTipText()Returns the tip text for this property.voidsetFirstWave(float value)Sets the starting point for the wave numbers.voidsetGetProductCodeFromAttribute(Boolean mGetProductCodeFromAttribute)Set product code from instance attribute?voidsetLastWave(float value)Sets the end point for the wave numbers.voidsetProductCode(String productCode)Set product code.voidsetSampleID(String mSampleIDregex)Get sample id regex.voidsetSpectralDataAttributes(String mSpectralData)Set which attributes to use for spectral data.voidsetWaveStep(float value)Sets the step size for the wave numbers, if lastWave is not defined.StringspectralDataAttributesTipText()Returns the tip text for this property.StringwaveStepTipText()Returns the tip text for this property.-
Methods inherited from class adams.flow.transformer.AbstractTransformer
backupState, currentInput, execute, hasInput, hasPendingOutput, input, output, postExecute, restoreState, wrapUp
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getQuickInfo, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, preExecute, pruneBackup, pruneBackup, reset, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
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
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
cleanUp, compareTo, destroy, equals, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getQuickInfo, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, stopExecution, toCommandLine, variableChanged
-
-
-
-
Field Detail
-
m_ProductCode
protected String m_ProductCode
Either the attribute name with the product code in it, or the actual product code. Decided by m_GetProductCodeFromAttribute.
-
m_ProductCodeFromAttribute
protected Boolean m_ProductCodeFromAttribute
Get the product code from the attribute named ProductCode in the Instance? Otherwise use the ProductCode string directly.
-
m_SampleIDregex
protected String m_SampleIDregex
Regex to find sample id. e.g "sampleID"
-
m_SpectralData
protected String m_SpectralData
Regex to find spectral data. e.g "amplitude.*"
-
m_FirstWave
protected float m_FirstWave
the first wave number.
-
m_LastWave
protected float m_LastWave
the last wave number.
-
m_WaveStep
protected float m_WaveStep
the wave number step.
-
-
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 classadams.flow.core.AbstractActor
-
getSampleID
public String getSampleID()
Get sample id regex.- Returns:
- sample id regex
-
setSampleID
public void setSampleID(String mSampleIDregex)
Get sample id regex.- Parameters:
mSampleIDregex- sample id regex
-
sampleIDTipText
public String sampleIDTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getGetProductCodeFromAttribute
public Boolean getGetProductCodeFromAttribute()
Get product code from instance attribute? Or use as string.- Returns:
- Get product code from instance attribute?
-
setGetProductCodeFromAttribute
public void setGetProductCodeFromAttribute(Boolean mGetProductCodeFromAttribute)
Set product code from instance attribute? Or use as string.- Parameters:
mGetProductCodeFromAttribute- Set product code from instance attribute?
-
getProductCodeFromAttributeTipText
public String getProductCodeFromAttributeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getSpectralDataAttributes
public String getSpectralDataAttributes()
Get which attributes to use for spectral data.- Returns:
- regex attribute name.
-
setSpectralDataAttributes
public void setSpectralDataAttributes(String mSpectralData)
Set which attributes to use for spectral data.- Parameters:
mSpectralData- regex attribute name.
-
spectralDataAttributesTipText
public String spectralDataAttributesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getProductCode
public String getProductCode()
Get Product Code.- Returns:
- product code
-
setProductCode
public void setProductCode(String productCode)
Set product code.- Parameters:
productCode- product code.
-
productCodeTipText
public String productCodeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFirstWave
public void setFirstWave(float value)
Sets the starting point for the wave numbers. Ignored if less than zero.- Parameters:
value- the first wave number
-
getFirstWave
public float getFirstWave()
Returns the starting point for the wave numbers. Ignored if less than zero.- Returns:
- the first wave number
-
firstWaveTipText
public String firstWaveTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLastWave
public void setLastWave(float value)
Sets the end point for the wave numbers. Ignored if less than zero.- Parameters:
value- the last wave number
-
getLastWave
public float getLastWave()
Returns the end point for the wave numbers. Ignored if less than zero.- Returns:
- the last wave number
-
lastWaveTipText
public String lastWaveTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setWaveStep
public void setWaveStep(float value)
Sets the step size for the wave numbers, if lastWave is not defined.- Parameters:
value- the step size
-
getWaveStep
public float getWaveStep()
Returns the step size for the wave numbers, if lastWave is not defined.- Returns:
- the step size
-
waveStepTipText
public String waveStepTipText()
Returns the tip text for this property.- 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 the consumer accepts.- Returns:
- weka.core.Instance.class
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Returns:
- knir.data.spectrum.Spectrum.class
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecutein classadams.flow.core.AbstractActor- Returns:
- null if everything is fine, otherwise error message
-
-