Package adams.data.cleaner.spectrum
Class InterPercentileRangeCleaner
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.cleaner.spectrum.AbstractCleaner
-
- adams.data.cleaner.spectrum.AbstractSerializableCleaner
-
- adams.data.cleaner.spectrum.InterPercentileRangeCleaner
-
- All Implemented Interfaces:
adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.SerializableObject
,adams.core.ShallowCopySupporter<AbstractCleaner>
,adams.core.SizeOfHandler
,adams.db.DatabaseConnectionHandler
,adams.db.DatabaseConnectionProvider
,adams.db.DatabaseConnectionUser
,Serializable
,Comparable
public class InterPercentileRangeCleaner extends AbstractSerializableCleaner implements adams.db.DatabaseConnectionHandler
- 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
InterPercentileRangeCleaner.DataCollector
A helper class for collecting the data from the database and computing the inter-percentile ranges (IPRs).static class
InterPercentileRangeCleaner.InterPercentileRange
Container class for storing the lower and upper percentile, as well as the wave number.
-
Field Summary
Fields Modifier and Type Field Description protected Hashtable<Float,InterPercentileRangeCleaner.InterPercentileRange>
m_AmplitudeIPRs
the interpercentiles to use for the amplitudes.protected int
m_ChunkSize
the chunk size when retrieving spectra from the database.protected AbstractSpectrumConditions
m_Conditions
the spectrum retrieval conditions.protected adams.db.AbstractDatabaseConnection
m_DatabaseConnection
the database connection.protected double
m_Factor
the maximum factor a value can be above the upper percentile or below the lower percentile before considered "un-clean".protected Hashtable<adams.data.report.Field,InterPercentileRangeCleaner.InterPercentileRange>
m_FieldIPRs
the interpercentiles to use for the fields.protected double
m_LowerPercentile
the lower percentile.protected String
m_SampleType
the sample type regular expression.protected double
m_UpperPercentile
the upper percentile.-
Fields inherited from class adams.data.cleaner.spectrum.AbstractSerializableCleaner
m_OverrideSerializationFile, m_SerializableObjectHelper, m_SerializationFile
-
Fields inherited from class adams.data.cleaner.spectrum.AbstractCleaner
m_ActualPreFilter, m_FlowContext, m_PreFilter
-
-
Constructor Summary
Constructors Constructor Description InterPercentileRangeCleaner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
checkSpectrum(Spectrum data)
Checks the spectrum, whether all of its values (amplitudes + fields) are within the boundaries.protected String
checkValue(InterPercentileRangeCleaner.InterPercentileRange ipr, double value)
Checks the specified value against the inter-percentile setup whether it is valid or not.String
chunkSizeTipText()
Returns the tip text for this property.String
conditionsTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.String
factorTipText()
Returns the tip text for this property.int
getChunkSize()
Returns the chunk size to use for loading data from the database.adams.db.AbstractConditions
getConditions()
Returns the conditions container to use for retrieving the spectra.adams.db.AbstractDatabaseConnection
getDatabaseConnection()
Returns the currently used database connection object, can be null.double
getFactor()
Returns the factor to multiply the inter-percentile range with.double
getLowerPercentile()
Returns the lower percentile.protected SampleDataF
getSampleDataF()
Returns the SampleDataT singleton to use.protected SpectrumF
getSpectrumF()
Returns the SpectrumT singleton to use.double
getUpperPercentile()
Returns the upper percentile.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.void
initSerializationSetup()
Regenerates all the objects that are necessary for serialization.String
lowerPercentileTipText()
Returns the tip text for this property.protected String
performCheck(Spectrum data)
Performs the check.Object[]
retrieveSerializationSetup()
Returns the member variables to serialize to a file.void
setChunkSize(int value)
Sets the chunk size to use for loading data from the database.void
setConditions(adams.db.AbstractConditions value)
Sets the conditions container to use for retrieving the spectra.void
setDatabaseConnection(adams.db.AbstractDatabaseConnection value)
Sets the database connection object to use.void
setFactor(double value)
Sets the factor to multiply the inter-percentile range with.void
setLowerPercentile(double value)
Sets the lower percentile.void
setSerializationSetup(Object[] value)
Updates the member variables with the provided objects obtained from deserialization.void
setUpperPercentile(double value)
Sets the upper percentile.String
upperPercentileTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.cleaner.spectrum.AbstractSerializableCleaner
destroy, getOverrideSerializedFile, getSerializationFile, isSetupLoadedOrGenerated, overrideSerializedFileTipText, preCheck, reset, serializationFileTipText, setOverrideSerializedFile, setSerializationFile, setSetupLoadedOrGenerated
-
Methods inherited from class adams.data.cleaner.spectrum.AbstractCleaner
check, compareTo, equals, forCommandLine, forName, getCleaners, getFlowContext, getPreFilter, preFilter, preFilterTipText, setFlowContent, setPreFilter, 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_ChunkSize
protected int m_ChunkSize
the chunk size when retrieving spectra from the database.
-
m_Conditions
protected AbstractSpectrumConditions m_Conditions
the spectrum retrieval conditions.
-
m_Factor
protected double m_Factor
the maximum factor a value can be above the upper percentile or below the lower percentile before considered "un-clean".
-
m_LowerPercentile
protected double m_LowerPercentile
the lower percentile.
-
m_UpperPercentile
protected double m_UpperPercentile
the upper percentile.
-
m_AmplitudeIPRs
protected Hashtable<Float,InterPercentileRangeCleaner.InterPercentileRange> m_AmplitudeIPRs
the interpercentiles to use for the amplitudes.
-
m_FieldIPRs
protected Hashtable<adams.data.report.Field,InterPercentileRangeCleaner.InterPercentileRange> m_FieldIPRs
the interpercentiles to use for the fields.
-
m_SampleType
protected String m_SampleType
the sample type regular expression.
-
m_DatabaseConnection
protected adams.db.AbstractDatabaseConnection m_DatabaseConnection
the database connection.
-
-
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 classAbstractSerializableCleaner
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractSerializableCleaner
-
initSerializationSetup
public void initSerializationSetup()
Regenerates all the objects that are necessary for serialization.- Specified by:
initSerializationSetup
in interfaceadams.core.SerializableObject
-
retrieveSerializationSetup
public Object[] retrieveSerializationSetup()
Returns the member variables to serialize to a file.- Specified by:
retrieveSerializationSetup
in interfaceadams.core.SerializableObject
- Returns:
- the objects to serialize
-
setSerializationSetup
public void setSerializationSetup(Object[] value)
Updates the member variables with the provided objects obtained from deserialization.- Specified by:
setSerializationSetup
in interfaceadams.core.SerializableObject
- Parameters:
value
- the deserialized objects
-
setChunkSize
public void setChunkSize(int value)
Sets the chunk size to use for loading data from the database.- Parameters:
value
- the chunk size
-
getChunkSize
public int getChunkSize()
Returns the chunk size to use for loading data from the database.- Returns:
- the chunk size
-
chunkSizeTipText
public String chunkSizeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setConditions
public void setConditions(adams.db.AbstractConditions value)
Sets the conditions container to use for retrieving the spectra.- Parameters:
value
- the conditions
-
getConditions
public adams.db.AbstractConditions getConditions()
Returns the conditions container to use for retrieving the spectra.- Returns:
- the conditions
-
conditionsTipText
public String conditionsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFactor
public void setFactor(double value)
Sets the factor to multiply the inter-percentile range with.- Parameters:
value
- the factor
-
getFactor
public double getFactor()
Returns the factor to multiply the inter-percentile range with.- Returns:
- the factor
-
factorTipText
public String factorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLowerPercentile
public void setLowerPercentile(double value)
Sets the lower percentile.- Parameters:
value
- the percentile
-
getLowerPercentile
public double getLowerPercentile()
Returns the lower percentile.- Returns:
- the percentile
-
lowerPercentileTipText
public String lowerPercentileTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUpperPercentile
public void setUpperPercentile(double value)
Sets the upper percentile.- Parameters:
value
- the percentile
-
getUpperPercentile
public double getUpperPercentile()
Returns the upper percentile.- Returns:
- the percentile
-
upperPercentileTipText
public String upperPercentileTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDatabaseConnection
public adams.db.AbstractDatabaseConnection getDatabaseConnection()
Returns the currently used database connection object, can be null.- Specified by:
getDatabaseConnection
in interfaceadams.db.DatabaseConnectionProvider
- Returns:
- the current object
-
setDatabaseConnection
public void setDatabaseConnection(adams.db.AbstractDatabaseConnection value)
Sets the database connection object to use.- Specified by:
setDatabaseConnection
in interfaceadams.db.DatabaseConnectionHandler
- Parameters:
value
- the object to use
-
getSampleDataF
protected SampleDataF getSampleDataF()
Returns the SampleDataT singleton to use.- Returns:
- the table singleton to use
-
getSpectrumF
protected SpectrumF getSpectrumF()
Returns the SpectrumT singleton to use.- Returns:
- the table singleton to use
-
checkValue
protected String checkValue(InterPercentileRangeCleaner.InterPercentileRange ipr, double value)
Checks the specified value against the inter-percentile setup whether it is valid or not.- Parameters:
ipr
- the inter-percentile range setup for the valuevalue
- the value to check- Returns:
- null if OK, otherwise error message
-
checkSpectrum
protected String checkSpectrum(Spectrum data)
Checks the spectrum, whether all of its values (amplitudes + fields) are within the boundaries.- Parameters:
data
- the spectrum to check- Returns:
- null if OK, otherwise the error message
-
performCheck
protected String performCheck(Spectrum data)
Performs the check.- Specified by:
performCheck
in classAbstractCleaner
- Parameters:
data
- the spectrum to check- Returns:
- null if ok, otherwise error message
-
-