svo module¶
This is the main module for svo_filters.
A Python wrapper for the SVO Filter Profile Service
-
class
svo.
Filter
(band, filter_directory=None, wave_units=Unit("um"), flux_units=Unit("erg / (Angstrom cm2 s)"), **kwargs)[source]¶ Bases:
object
Creates a Filter object to store a photometric filter profile and metadata
-
path
¶ The absolute filepath for the bandpass data, an ASCII file with a wavelength column in Angstroms and a response column of values ranging from 0 to 1
Type: str
-
rsr
¶ The wavelength and relative spectral response (RSR) arrays
Type: np.ndarray
-
apply
(spectrum, plot=False)[source]¶ Apply the filter to the given spectrum
Parameters: - spectrum (array-like) – The wavelength [um] and flux of the spectrum to apply the filter to
- plot (bool) – Plot the original and filtered spectrum
Returns: The filtered spectrum
Return type: np.ndarray
-
bin
(n_bins=1, pixels_per_bin=None, wave_min=None, wave_max=None)[source]¶ Break the filter up into bins and apply a throughput to each bin, useful for G141, G102, and other grisms
Parameters: - n_bins (int) – The number of bins to dice the throughput curve into
- pixels_per_bin (int (optional)) – The number of channels per bin, which will be used to calculate n_bins
- wave_min (astropy.units.quantity (optional)) – The minimum wavelength to use
- wave_max (astropy.units.quantity (optional)) – The maximum wavelength to use
-
centers
¶ A getter for the wavelength bin centers and average fluxes
-
flux_units
¶ A getter for the flux units
-
load_TopHat
(wave_min, wave_max, pixels_per_bin=100)[source]¶ Loads a top hat filter given wavelength min and max values
Parameters: - wave_min (astropy.units.quantity (optional)) – The minimum wavelength to use
- wave_max (astropy.units.quantity (optional)) – The maximum wavelength to use
- n_pixels (int) – The number of pixels for the filter
-
load_xml
(filepath)[source]¶ Load the filter from a txt file
Parameters: filepath (str) – The filepath for the filter
-
overlap
(spectrum)[source]¶ Tests for overlap of this filter with a spectrum
Example of full overlap:
Examples of partial overlap: :
Examples of no overlap: :
Parameters: spectrum (sequence) – The [W, F] spectrum with astropy units Returns: ans – Overlap status. Return type: {‘full’, ‘partial’, ‘none’}
-
rsr
A getter for the relative spectral response (rsr) curve
-
throughput
¶ A getter for the throughput
-
wave
¶ A getter for the wavelength
-
wave_units
¶ A getter for the wavelength units
-
-
svo.
color_gen
(colormap='viridis', key=None, n=15)[source]¶ Color generator for Bokeh plots
Parameters: colormap (str, sequence) – The name of the color map Returns: A generator for the color palette Return type: generator
-
svo.
filters
(filter_directory=None, update=False, fmt='table', **kwargs)[source]¶ Get a list of the available filters
Parameters: Returns: The list of band names
Return type:
-
svo.
rebin_spec
(spec, wavnew, oversamp=100, plot=False)[source]¶ Rebin a spectrum to a new wavelength array while preserving the total flux
Parameters: - spec (array-like) – The wavelength and flux to be binned
- wavenew (array-like) – The new wavelength array
Returns: The rebinned flux
Return type: np.ndarray