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
refs

The references for the bandpass data

Type:list, str
rsr

The wavelength and relative spectral response (RSR) arrays

Type:np.ndarray
Band

The band name

Type:str
CalibrationReference

The paper detailing the calibration

Type:str
FWHM

The FWHM for the filter

Type:float
Facility

The telescope facility

Type:str
FilterProfileService

The SVO source

Type:str
MagSys

The magnitude system

Type:str
PhotCalID

The calibration standard

Type:str
PhotSystem

The photometric system

Type:str
ProfileReference

The SVO reference

Type:str
WavelengthCen

The center wavelength

Type:float
WavelengthEff

The effective wavelength

Type:float
WavelengthMax

The maximum wavelength

Type:float
WavelengthMean

The mean wavelength

Type:float
WavelengthMin

The minimum wavelength

Type:float
WavelengthPeak

The peak wavelength

Type:float
WavelengthPhot

The photon distribution based effective wavelength

Type:float
WavelengthPivot

The wavelength pivot

Type:float
WavelengthUCD

The SVO wavelength unit

Type:str
WavelengthUnit

The wavelength unit

Type:str
WidthEff

The effective width

Type:float
ZeroPoint

The value of the zero point flux

Type:float
ZeroPointType

The system of the zero point

Type:str
ZeroPointUnit

The units of the zero point

Type:str
filterID

The SVO filter ID

Type:str
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

info(fetch=False)[source]

Print a table of info about the current filter

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_txt(filepath)[source]

Load the filter from a txt file

Parameters:file (str) – The filepath
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’}
plot(fig=None)[source]

Plot the filter

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:
  • filter_directory (str) – The directory containing the filter relative spectral response curves
  • update (bool) – Check the filter directory for new filters and generate pickle of table
  • fmt (str) – The format for the returned table
Returns:

The list of band names

Return type:

list

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