Package de.gsi.math.spectra
Enum Apodization
- java.lang.Object
-
- java.lang.Enum<Apodization>
-
- de.gsi.math.spectra.Apodization
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<Apodization>
public enum Apodization extends java.lang.Enum<Apodization>
implementation of frequenty used apodization (aka. windowing) functions reference: http://en.wikipedia.org/wiki/Apodization_function - feel free to populate this with the other (however also less frequently used) windows The array for the windows are cached. By default a WeakHashMap is used, but the cache can be replaced e.g byCacheif different caching behaviour is wanted.- Author:
- rstein, akrimm
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classApodization.ApodizationArrayDescriptionprivate class identifying a specific buffer array, used as a key for the array cache
-
Enum Constant Summary
Enum Constants Enum Constant Description BlackmanBlackmanHarrisBlackmanNuttallExponentialFlatTopHammingHannHannExpNuttallRectangular
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapodize(double[] data)Applies the given apodization window to the given array (in-place)static voidapodize(double[] data, Apodization function)Applies the given apodization window to the given array (in-place)doublegetIndex(int i, int n)computes and returns the value of the apodization function for a given window indexdoublegetIndex(int i, int n, double m)computes and returns the value of the apodization function for a given window indexdoublegetIndexUncached(int i, int n)Directly computes a single window value.java.lang.StringgetName()double[]getWindow(int n)Returns the window for astatic java.util.Map<Apodization.ApodizationArrayDescription,double[]>getWindowCache()static voidsetWindowCache(java.util.Map<Apodization.ApodizationArrayDescription,double[]> windowCache)Changes the map used to cache the apodization windows.static ApodizationvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static Apodization[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
Rectangular
public static final Apodization Rectangular
-
Hamming
public static final Apodization Hamming
-
Hann
public static final Apodization Hann
-
HannExp
public static final Apodization HannExp
-
Blackman
public static final Apodization Blackman
-
Nuttall
public static final Apodization Nuttall
-
BlackmanHarris
public static final Apodization BlackmanHarris
-
BlackmanNuttall
public static final Apodization BlackmanNuttall
-
FlatTop
public static final Apodization FlatTop
-
Exponential
public static final Apodization Exponential
-
-
Method Detail
-
values
public static Apodization[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Apodization c : Apodization.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Apodization valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
apodize
public void apodize(double[] data)
Applies the given apodization window to the given array (in-place)- Parameters:
data- input data
-
getIndex
public double getIndex(int i, int n)computes and returns the value of the apodization function for a given window index- Parameters:
i- index within windown- length of window- Returns:
- value of the apodization function
-
getIndex
public double getIndex(int i, int n, double m)computes and returns the value of the apodization function for a given window index- Parameters:
i- index within windown- length of windowm- additional window (typ. bandwidth, power, etc)- Returns:
- value of the apodization function
-
getIndexUncached
public double getIndexUncached(int i, int n)Directly computes a single window value. If the whole window is required multiple times it will be faster to use the cached versiongetIndex(int, int)provides.- Parameters:
i- index within the windown- length of the window- Returns:
- value of the apodization function
-
getName
public java.lang.String getName()
-
getWindow
public double[] getWindow(int n)
Returns the window for a- Parameters:
n- window size- Returns:
- a cached array containing the requested window
-
apodize
public static void apodize(double[] data, Apodization function)Applies the given apodization window to the given array (in-place)- Parameters:
data- input datafunction- the apodization function to use
-
getWindowCache
public static java.util.Map<Apodization.ApodizationArrayDescription,double[]> getWindowCache()
- Returns:
- the global cache for the apodization windows
-
setWindowCache
public static void setWindowCache(java.util.Map<Apodization.ApodizationArrayDescription,double[]> windowCache)
Changes the map used to cache the apodization windows. The map should implement some sort of caching behaviour e.gWeakHashMap<ApodizationArrayDescription, double[]>invalidates under memory pressure (The default)Cachelimits retention time and number of cached entries- custom implementation
- Parameters:
windowCache- A map to use as a cache for the apodization windows
-
-