SpectralGradient¶
- class sbpy.spectroscopy.SpectralGradient(value, unit=None, wave=None, wave0=None, dtype=None, copy=True)[source]¶
Bases:
SpecificTypeQuantity
Convert between magnitude and spectral gradient.
SpectralGradient
is aQuantity
object with units of percent change per wavelength.Spectral gradient is with respect to the flux density at a particular wavelength. By convention this is the mean flux between the two filters, assuming the reflectance spectrum is linear with wavelength. Eq. 1 of A’Hearn et al. [ADT84]:
\[S = \frac{R(λ1) - R(λ0)}{R(λ1) + R(λ0)} \frac{2}{Δλ}\]Δλ is typically measured in units of 100 nm.
- Parameters:
- valuenumber,
Quantity
The value(s).
- unitstring,
Unit
, optional The unit of the input value. Strings must be parseable by
units
package.- wave
Quantity
, optional Effective wavelengths of the measurement for a solar spectral energy distribution. Required for conversion to other wavelengths.
- wave0
Quantity
, optional Normalization point. If
None
, the mean ofwave
will be assumed.- dtype
dtype
, optional See
Quantity
.- copybool, optional
See
Quantity
.
- valuenumber,
References
[ADT84]A’Hearn, Dwek & Tokunaga 1984. Infrared Photometry of Comet Bowell and Other Comets. ApJ 282, 803-806.
Examples
>>> import astropy.units as u >>> from sbpy.units import hundred_nm >>> S = SpectralGradient(10 * u.percent / hundred_nm, wave0=5500 * u.AA) >>> print(S) 10.0 % / (100 nm)
>>> from sbpy.units import VEGAmag >>> from sbpy.photometry import bandpass >>> V = bandpass('Johnson V') >>> R = bandpass('Cousins R') >>> VmR = 15.8 * VEGAmag - 15.3 * VEGAmag >>> VmR_sun = 0.37 * u.mag >>> S = SpectralGradient.from_color((V, R), VmR - VmR_sun) >>> print(S) 12.29185986266534 % / (100 nm)
Methods Summary
from_color
(wfb, color)Initialize from observed color.
renormalize
(wave0)Re-normalize to another wavelength.
to_color
(wfb)Express as a color index.
Methods Documentation
- classmethod from_color(wfb, color)[source]¶
Initialize from observed color.
- Parameters:
- wfbtwo-element
Quantity
or tuple Wavelengths, frequencies, or bandpasses of the measurement. If a bandpass, the effective wavelength of a solar spectrum will be used. Bandpasses may be a string (name) or
SpectralElement
(seefilt()
).- color
Quantity
, optional Observed color,
blue - red
for magnitudes,red / blue
for linear units. Must be dimensionless and have the solar color removed.
- wfbtwo-element
Notes
Computes spectral gradient from
color_index
.wfb[0]
is the blue-ward of the two measurements\[\begin{split}S &= \frac{R(λ1) - R(λ0)}{R(λ1) + R(λ0)} \frac{2}{Δλ} \\ &= \frac{α - 1}{α + 1} \frac{2}{Δλ}\end{split}\]where R(λ) is the reflectivity, and:
\[ \begin{align}\begin{aligned}α = R(λ1) / R(λ0) = 10^{0.4 color_index}\\color_index = Δm - C_{sun}\end{aligned}\end{align} \]Δλ is typically expressed in units of 100 nm.
Examples
>>> import astropy.units as u >>> w = [0.4719, 0.6185] * u.um >>> S = SpectralGradient.from_color(w, 0.10 * u.mag) >>> print(S) 6.27819572 % / (100 nm)
- renormalize(wave0)[source]¶
Re-normalize to another wavelength.
The slope is linearly extrapolated to the new normalization point. Requires the
wave0
attribute to be defined, seeSpectralGradient
.- Parameters:
- wave0
Quantity
Wavelength.
- wave0
- Returns:
- S
SpectralGradient
Renormalized gradient.
- S
Examples
>>> import astropy.units as u >>> from sbpy.spectroscopy import SpectralGradient >>> from sbpy.units import hundred_nm >>> S1 = SpectralGradient(10 * u.percent / hundred_nm, ... wave0=0.55 * u.um) >>> S2 = S1.renormalize(3.6 * u.um) >>> print(S2.renormalize(3.6 * u.um)) 2.469135802469136 % / (100 nm) >>> print(S2.wave0) 3.6 um
- to_color(wfb)[source]¶
Express as a color index.
- Parameters:
- wfbtwo-element
Quantity
or tuple Wavelengths, frequencies, or bandpasses of the measurement. If a bandpass, the effective wavelength of a solar spectrum will be used. Bandpasses may be a string (name) or
SpectralElement
(seefilt()
).
- wfbtwo-element
- Returns:
- color
Quantity
blue - red
color in magnitudes, dimensionless and excludes the solar color.
- color
Notes
Color index is computed from:
\[α = \frac{1 + S Δλ / 2}{1 - S * Δλ / 2}\]where S is the spectral gradient at the mean of λ0 and λ1, and:
\[ \begin{align}\begin{aligned}α = R(λ1) / R(λ0) = 10^{0.4 color_index}\\color_index = Δm - C_{sun}\end{aligned}\end{align} \]Δλ is typically expressed in units of 100 nm.
Examples
>>> import astropy.units as u >>> from sbpy.units import hundred_nm >>> S = SpectralGradient(10 * u.percent / hundred_nm, ... wave0=0.55 * u.um) >>> C = S.to_color((525, 575) * u.nm) >>> print(C) 0.05429812423309064 mag