Filter2D 2-dimensional spectral filtering.¶
This module defines the 2D filter methods.
class admit.util.filter.Filter2D.Filter2D[data, method, **keyval][source]¶This class defines and runs 2D spectral filters. The currently available filters are Gaussian, Hanning, Triangle, Welch, Boxcar, and Savitzky Golay. The output spectrum will be of the same length as the input spectrum, however some edge channels may be zeroed by some methods, depending on the input parameters.
spec : numpy array
method : str
keyval : various
|
Notes
Details of the different filter keywords and defaults:
boxcar | width | 3 | Number of channels to average together |
gaussian | width | 7 | Number of channels to span with the gaussian |
hanning | width | 5 | Number of channels to include in the cos |
triangle | width | 5 | Number of channels to span with the triangle |
welch | width | 5 | Number of channels to use in the function |
savgol | window_size | 7 | Number of channels to use in the calculation |
order | 3 | Order of the poynomial fit [must be odd] | |
deriv | 0 | The number of the derivative to compute [0 = just smooth] |
Attributes
spec | [numpy array] The spectrum. |
len | [int] The length of the spectrum. |
methods | [list] A list of the available filters. |
[method]_args | [dict] A dictionary for each method giving its keywords and defaults [e.g. boxcar_args]. |
method | [str] The method being used. |
Methods
boxcar[width] | Method to apply a boxcar filter to a spectrum. |
checkmethod[method] | Method to interpret the input method and determine the full method |
gaussian[width] | Method to apply a Gaussian filter to a spectrum. |
hanning[width] | Method to apply a Hanning filter to a spectrum. |
radius[x,y,width] | Method to calculate the radius of a point in the kernel |
run[] | Method to run the selected filter on the data |
savgol[window_size,order[,deriv]] | Method to apply a Savitzky-Golay filter to a 2D image. |
triangle[width] | Method to apply a Triangular filter to a spectrum. |
welch[width] | Method to apply a Welch filter to a spectrum. |
Method to apply a boxcar filter to a spectrum. The filter for point x[i] is defined as:
where N is the width of the filter.
width : int
|
numpy array
|
Method to interpret the input method and determine the full method name
method : str
|
None |
Method to apply a Gaussian filter to a spectrum. The filter for point x[i] is defined as:
where N is the width of the filter.
width : int
|
numpy array
|
Method to apply a Hanning filter to a spectrum. The filter for point x[i] is defined as:
where N is the width of the filter.
width : int
|
numpy array
|
Method to calculate the radius of a point in the kernel
x : float
y : float
width : int
|
Float containing the radius to the point |
Method to run the selected filter on the data
None |
The smoothed image |
Method to apply a Savitzky-Golay filter to a 2D image.
window_size : int
order : int
deriv: int
|
numpy array
|
Method to apply a Triangular filter to a spectrum. The filter for point x[i] is defined as:
where N is the width of the filter.
width : int
|
numpy array
|
Method to apply a Welch filter to a spectrum. The filter for point x[i] is defined as:
where N is the width of the filter.
width : int
|
numpy array
|