Class ArffUtils


  • public class ArffUtils
    extends adams.data.weka.ArffUtils
    A helper class for turning spectrum data into ARFF files and vice versa.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • ArffUtils

        public ArffUtils()
    • Method Detail

      • getSampleIDName

        public static String getSampleIDName()
        Returns the name of the attribute containing the sample ID of the spectrum.
        Returns:
        the attribute name
      • getWaveNumberName

        public static String getWaveNumberName​(int index)
        Returns the name of an attribute for a wave number. Gets prefixed with "wave-number-".
        Parameters:
        index - the 0-based index
        Returns:
        the attribute name
        See Also:
        PREFIX_WAVE_NUMBER
      • getWaveNumberName

        public static String getWaveNumberName​(String prefix,
                                               int index)
        Returns the name of an attribute for a wave number. Gets prefixed with the specified prefix.
        Parameters:
        prefix - the prefix string to use
        index - the 0-based index
        Returns:
        the attribute name
      • getWaveNumberName

        public static String getWaveNumberName​(float waveno)
        Returns the name of an attribute for a wave number. Gets prefixed with "wave-number-".
        Parameters:
        waveno - the wave number
        Returns:
        the attribute name
        See Also:
        PREFIX_WAVE_NUMBER
      • getWaveNumberName

        public static String getWaveNumberName​(String prefix,
                                               float waveno)
        Returns the name of an attribute for a wave number. Gets prefixed with the specified prefix.
        Parameters:
        prefix - the prefix string to use
        waveno - the wave number
        Returns:
        the attribute name
      • getAmplitudeName

        public static String getAmplitudeName​(int index)
        Returns the name of an attribute for an amplitude. Gets prefixed with "amplitude-".
        Parameters:
        index - the 0-based index
        Returns:
        the attribute name
        See Also:
        PREFIX_AMPLITUDE
      • getAmplitudeName

        public static String getAmplitudeName​(String prefix,
                                              int index)
        Returns the name of an attribute for an amplitude. Gets prefixed with the specified prefix.
        Parameters:
        prefix - the prefix string to use
        index - the 0-based index
        Returns:
        the attribute name
      • getAmplitudeName

        public static String getAmplitudeName​(float waveno)
        Returns the name of an attribute for an amplitude. Gets prefixed with "amplitude-".
        Parameters:
        waveno - the wave number
        Returns:
        the attribute name
      • getAmplitudeName

        public static String getAmplitudeName​(String prefix,
                                              float waveno)
        Returns the name of an attribute for an amplitude. Gets prefixed with the specified prefix.
        Parameters:
        prefix - the prefix string to use
        waveno - the wave number
        Returns:
        the attribute name
      • amplitudes

        public static int[] amplitudes​(weka.core.Instances data,
                                       boolean oneBased)
        Returns the indices of the amplitudes in the dataset.
        Parameters:
        data - the dataset to analyze
        oneBased - whether to return 1-based or 0-based indices
        Returns:
        the indices
      • toRemove

        public static int[] toRemove​(weka.core.Instances data,
                                     boolean oneBased)
        Returns the indices of the attributes to remove, i.e., ID attributes and string attributes. Class attribute is never listed.
        Parameters:
        data - the data to analyze
        oneBased - whether to return 1-based or 0-based indices
        Returns:
        the indices to remove
      • getRemoveFilter

        public static weka.filters.unsupervised.attribute.Remove getRemoveFilter​(weka.core.Instances data)
        Initializes the Remove filter for removing all IDs (and string attributes) from the dataset.
        Parameters:
        data - the data to use for the analysis
        Returns:
        the configured filter, null if no filtering required