mag parameter optional
This commit is contained in:
parent
6ab69f5c2b
commit
3d1a430ca4
@ -28,8 +28,8 @@ Attributes:
|
|||||||
| The temperature of the black body.
|
| The temperature of the black body.
|
||||||
* | **temp_unit:** str, *optional* = "K"
|
* | **temp_unit:** str, *optional* = "K"
|
||||||
| The unit of the black body's temperature. This has to be one of [``K``, ``Celsius``]. The default is ``K``.
|
| The unit of the black body's temperature. This has to be one of [``K``, ``Celsius``]. The default is ``K``.
|
||||||
* | **mag:** float
|
* | **mag:** float, *optional* = None
|
||||||
| The apparent magnitude of the black body in magnitudes. In case of a magnitude per solid angle, an extended target is assumed.
|
| The apparent magnitude of the black body in magnitudes. In case of None or magnitude per solid angle, an extended target is assumed.
|
||||||
* | **mag_unit:** str, *optional* = "mag"
|
* | **mag_unit:** str, *optional* = "mag"
|
||||||
| The unit of the black body's magnitude. This has to be [``mag``, ``mag / arcsec**2``, ``mag / sr``]. The default is ``mag``.
|
| The unit of the black body's magnitude. This has to be [``mag``, ``mag / arcsec**2``, ``mag / sr``]. The default is ``mag``.
|
||||||
* | **band:** str
|
* | **band:** str
|
||||||
|
@ -25,7 +25,7 @@ class BlackBodyTarget(ATarget):
|
|||||||
N=dict(wl=10200 * u.nm, sfd=1.23e-15 * u.W / (u.m ** 2 * u.nm)))
|
N=dict(wl=10200 * u.nm, sfd=1.23e-15 * u.W / (u.m ** 2 * u.nm)))
|
||||||
|
|
||||||
@u.quantity_input(wl_bins='length', temp=[u.Kelvin, u.Celsius], mag=[u.mag, u.mag / u.sr])
|
@u.quantity_input(wl_bins='length', temp=[u.Kelvin, u.Celsius], mag=[u.mag, u.mag / u.sr])
|
||||||
def __init__(self, wl_bins: u.Quantity, temp: u.Quantity = 5778 * u.K, mag: u.Quantity = 0 * u.mag,
|
def __init__(self, wl_bins: u.Quantity, temp: u.Quantity = 5778 * u.K, mag: u.Quantity = None,
|
||||||
band: str = "V"):
|
band: str = "V"):
|
||||||
"""
|
"""
|
||||||
Initialize a new black body point source
|
Initialize a new black body point source
|
||||||
@ -50,6 +50,7 @@ class BlackBodyTarget(ATarget):
|
|||||||
# Create blackbody model with given temperature
|
# Create blackbody model with given temperature
|
||||||
bb = BlackBody(temperature=temp, scale=1 * u.W / (u.m ** 2 * u.nm * u.sr))
|
bb = BlackBody(temperature=temp, scale=1 * u.W / (u.m ** 2 * u.nm * u.sr))
|
||||||
|
|
||||||
|
if mag is not None:
|
||||||
# Calculate the correction factor for a star of 0th magnitude using the spectral flux density
|
# Calculate the correction factor for a star of 0th magnitude using the spectral flux density
|
||||||
# for the central wavelength of the given band
|
# for the central wavelength of the given band
|
||||||
if mag.unit.is_equivalent(u.mag / u.sr):
|
if mag.unit.is_equivalent(u.mag / u.sr):
|
||||||
@ -61,7 +62,8 @@ class BlackBodyTarget(ATarget):
|
|||||||
factor = self._band[band.upper()]["sfd"] / (bb(self._band[band.upper()]["wl"]) * u.sr) * u.sr
|
factor = self._band[band.upper()]["sfd"] / (bb(self._band[band.upper()]["wl"]) * u.sr) * u.sr
|
||||||
# Calculate spectral flux density for the given wavelengths and scale it for a star of the given magnitude
|
# Calculate spectral flux density for the given wavelengths and scale it for a star of the given magnitude
|
||||||
sfd = bb(wl_bins) * factor * 10 ** (- 2 / 5 * mag / u.mag) # / 1.195 * 1.16 # scaling for AETC validation
|
sfd = bb(wl_bins) * factor * 10 ** (- 2 / 5 * mag / u.mag) # / 1.195 * 1.16 # scaling for AETC validation
|
||||||
|
else:
|
||||||
|
sfd = bb(wl_bins)
|
||||||
# Initialize super class
|
# Initialize super class
|
||||||
super().__init__(SpectralQty(wl_bins, sfd), wl_bins)
|
super().__init__(SpectralQty(wl_bins, sfd), wl_bins)
|
||||||
|
|
||||||
@ -83,6 +85,7 @@ class BlackBodyTarget(ATarget):
|
|||||||
mes = conf.check_quantity("temp", u.K)
|
mes = conf.check_quantity("temp", u.K)
|
||||||
if mes is not None:
|
if mes is not None:
|
||||||
return mes
|
return mes
|
||||||
|
if hasattr(conf, "mag"):
|
||||||
mes = conf.check_quantity("mag", u.mag)
|
mes = conf.check_quantity("mag", u.mag)
|
||||||
if mes is not None:
|
if mes is not None:
|
||||||
mes = conf.check_quantity("mag", u.mag / u.sr)
|
mes = conf.check_quantity("mag", u.mag / u.sr)
|
||||||
|
Loading…
Reference in New Issue
Block a user