snpy.filters package

Module contents

This module provices two classes: spectrum and filter (filter is a sub-class of spectrum. These classes are designed to make certain tasks more convenient, especially for filters. Aside from being containers of the spectrum/filter data, they provide the following funcionality:

spectrum:
  • read a wavelength-flux two-column file.

  • make safe copies of the data

  • several member variables for bookkeeping:

    o max/min wavelenghts o name, coment

filter:
  • everthing in spectrum, plus:
  • computation of effective wavelength for a given spectrum
  • compute zero-point of a filter based on reference spectrum and supplied magnitude of the reference
  • compute the convolution of the filter with a spectrum.
  • compute a synthetic magnitude based on a supplied filter.

This module also supplies a dictionary called filters with some common filters and zero-points built in.

class snpy.filters.filter(name, file=None, zp=None, comment=None)

Bases: snpy.filters.spectrum

This class defines a filter. It contains the response as Numeric arrays. It has the following member data:

name: string describing the filter (eg. ‘B’) file: where to find the filter response zp: the photometric zero point (in vega only for now) wave: Numeric array of wavelengths (Angstroms) resp: Numeric array of response ave_wave: The effective wavelength for a flat spectrum min: minimum wavelength defined max: maximum wavelength defined comment: They’re useful, you know!
There are also some useful functions:

read(): Read in the data and compute member data compute_zpt(spec, mag): Compute zero point based on spectrum instance spec

and standard magnitude mag.
response(wave, flux): Compute the convolution with spectrum given by
wave,flux

eff_wave(wave, flux): Compute the effective wavelength given a spectrum synth_mag(wave, flux): Compute a synthetic magnitude, given a spectrum. R(Rv, z=0, strict_ccm=0): Compute the filters’ Reddening coefficient for

assumed value of Rv and redshift z.
R(Rv=3.1, wave=None, flux=None, z=0.0, EBV=0.001, redlaw='ccm', strict_ccm=False)

For a given reddening law Rv (default 3.1), find the ratio of total to selective absorption for this filter: R = A/E(B-V). You can specify a specific spectrum by supplying a wave and flux and redshift (default is defined by filters.reference_wave and filters.refernce_flux at z=0). You can also specify E(B-V) (EBV) which can change the value of R if the spectrum is significantly non-stellar. You can specify redlaw=’fm’ if you prefer a Fitzpatric (1999) reddening law.

compute_zpt(spectrum, mag, zeropad=0)

Compute the photometric zero point. If spectrum is a list of spectra, then a zero point is computed for each and returned as a Numeric array (which you can then average, median, whatever.

copy()

Return a copy of this instance.

eff_wave(specwave, flux=None, z=0, zeropad=0)

Compute the effective wavelength for this filter, given the spectrum defined by (specwave) or (specwave, flux). If z is non-zero, first redfhift the spectrum by this amount.

read()

Reads in the response for file and updates several member functions.

response(specwave, flux=None, z=0, zeropad=0, photons=1)

Get the response of this filter over the specified spectrum. This spectrum can be defined as a spectrum instance, in which case you simply need to specify [specwave] Or, you can specify a wavelength and flux vector, in which case, you need to specify both [specwave] (which is now taken to be the wavelength vector) and the flux as [flux]. If z is supplied, first redshift the spectrum by this amount. If zeropad is true, then the spectrum is assumed to be zero where the filter extends beyond its definition, otherwise -1 is returned if the filter extends beyond the spectrum’s definition. If photons=1, the integrand is multiplied by the wavelength vector and divided by c*h, i.e., the photon flux is computed..

synth_abmag(specwave, flux=None, z=0, zeropad=0)

Compute the synthetic AB magnitude of the input spectrum defined by (specwave) or (specwave, flux). If z is supplied, first blueshift the filter by this amount (ie, you are observing a redshifed spectrum).

synth_mag(specwave, flux=None, z=0, zeropad=0)

Compute the synthetic magnitude based on the input spectrum defined by (specwave) or (specwave,flux). If z is supplied, first redshift the input spectrum by this amount.

class snpy.filters.filter_set

An object that will contain all the filter instances. The filter set contains a dictionary of observatory objects. Each observatory object contains a dictionary of telescope objects. And each telescope object contains a dictionary of filter objects. So filters.LCO.Swope.B would refer to the B filter on the Swope telescope at the LCO observatory. You can also refer to a filter with a unique ID as, e.g., filters[‘Bswo’].

add_observatory(name)
cache_filters()
list_filters()
list_observatories()
list_telescopes()
class snpy.filters.observatory(name)

An object that contains telescope objects. We could also add other info like Lat, long, altitude, etc...

add_telescope(name)
list_filters()
list_telescopes()
class snpy.filters.spectrum(name=None, file=None, comment=None, load=1)

This class defines a spectrum. It contains the response as Numeric arrays. It has the following member data:

name: string describing the filter (eg. ‘B’) file: where to find the filter response wave: Numeric array of wavelengths (Angstroms) resp: Numeric array of response min: minimum wavelength defined max: maximum wavelength defined comment: They’re useful, you know!
There are also some useful functions:
read(): Read in the data and compute member data
copy()
read()

Reads in the response for file and updates several member functions.

waverange()
class snpy.filters.standard_set

An object that will contain all the standard SEDs. The standard set contains a dictionary of system objects. Each system object contains a dictionary of spectrum objects. So standards.Vega.Bohlin04 would refer to the Bohlin & Gllliand 2004 SED. You can also refer to the spectrum with a unique ID as, e.g., standards[‘VegaB’].

add_system(name)
cache_spectra()
list_SEDS()
list_systems()
class snpy.filters.system(name)

An object that contains a photometric system of standards.

add_SED(SED)
keys()
list_SEDs()
values()
class snpy.filters.telescope(name)

An object that contains filter objects. It is a child to the observatory class, which is a child to the filter_set.

add_filter(filter_object)
list_filters()