ska offers simple methods to compute the color of a spectrum or
a reflectance spectrum between two filters, in the three photometric
systems (Vega, AB, ST). See How does it work for more details.
ska provides a simple way to access to the colors of the Sun, directly from the
solar flux computed by the SVO Filter Service.
As ska also includes a spectrum of the Sun from CalSpec [1], you can also compute
its colors from the spectrum itself (located at ska.PATH_SUN).
The $skasolarcolor[filter1][filter2] command will compute the color of the Sun
between filter1 and filter2. The default
photometric system is
Vega.
ska can compute the color of any spectrum between two filters.
The $skacolor[file][filter1][filter2] command will compute the color of
the provided spectrum (in file)
between filter1 and filter2.
The spectrum must be provided as a CSV file with two columns: Wavelength and Flux.
The default
photometric system is
Vega.
The method compute_color computes the color of the Spectrum object
between two filters, specified by their names or provided as Filter objects.
>>> fromskaimportSpectrum# Class for spectra>>> sun=Spectrum("sun.csv")# Load a spectrum>>> sun.compute_color("Generic/Johnson.V","2MASS/2MASS.J")1.15# or>>> fromskaimportFilter# Class for filters>>> V=Filter("Generic/Johnson.V")# Retrieve Johnson V filter>>> J=Filter("2MASS/2MASS.J")# Retrieve 2MASS J filter>>> sun.solar_color(V,J)1.15
ska can compute the color of any reflectance spectrum between two filters,
as for spectra, but will automatically convert the reflectance
into flux using the spectrum of the Sun.
NB To compute the color between two filters, in the reflectance space,
simply use the color computation above.
The $skacolor[file][filter1][filter2]--reflectance
command will compute the color of
the provided reflectance spectrum (in file)
between filter1 and filter2.
The spectrum must be provided as a CSV file with two columns:
Wavelength and Reflectance.
The default
photometric system is
Vega.
The method reflectance_to_color computes the color of the Spectrum object
between two filters, specified by their names or provided as Filter objects.
>>> fromskaimportSpectrum# Class for spectra>>> vesta=Spectrum("vesta.csv")# Load a reference spectrum>>> vesta.reflectance_to_color("Generic/Johnson.V","2MASS/2MASS.J")1.15# or>>> fromskaimportFilter# Class for filters>>> V=Filter("Generic/Johnson.V")# Retrieve Johnson V filter>>> J=Filter("2MASS/2MASS.J")# Retrieve 2MASS J filter>>> vesta.reflectance_to_color(V,J)1.15
Colors are intrinscally linked to a photometric system, that defines
the reference spectral energy distribution
(see How does it work)
ska offers an easy possibility to switch between the three photometric systems:
Vega, AB and ST.
Simple uses the --phot_sys[Vega|AB|ST] option to switch photometric
system when computing colors.
$skacolorsun.csvGeneric/Johnson.V2MASS/2MASS.J--phot_sysVega
1.15# This is the default. No need to specify Vega
$skacolorsun.csvGeneric/Johnson.V2MASS/2MASS.J--phot_sysAB
0.24
$skacolorsun.csvGeneric/Johnson.V2MASS/2MASS.J--phot_sysST
-1.51
The methods compute_color and reflectance_to_color accept
a phot_sys keyword. Simply set it to Vega (default),
AB or ST.
>>> fromskaimportSpectrum# Class for spectra>>> sun=Spectrum("sun.csv")# Load a spectrum>>> sun.compute_color("Generic/Johnson.V","2MASS/2MASS.J",phot_sys="Vega")1.15 # This is the default behavior>>> sun.compute_color("Generic/Johnson.V","2MASS/2MASS.J",phot_sys="AB")0.24>>> sun.compute_color("Generic/Johnson.V","2MASS/2MASS.J",phot_sys="ST")-1.51