Allow int and float es transreflectivity and noise
This commit is contained in:
parent
6f984f7730
commit
998ae066af
@ -34,8 +34,7 @@ class AHotOpticalComponent(AOpticalComponent):
|
|||||||
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))
|
||||||
self._noise = SpectralQty(wl_bins, bb(wl_bins)) * emissivity
|
self._noise = SpectralQty(wl_bins, bb(wl_bins)) * emissivity
|
||||||
else:
|
else:
|
||||||
# Create zero dummy noise
|
self._noise = 0
|
||||||
self._noise = SpectralQty(wl_bins, [0] * len(wl_bins) << u.W / (u.m ** 2 * u.nm * u.sr))
|
|
||||||
|
|
||||||
def ownNoise(self) -> SpectralQty:
|
def ownNoise(self) -> SpectralQty:
|
||||||
"""
|
"""
|
||||||
|
@ -4,6 +4,7 @@ from ..SpectralQty import SpectralQty
|
|||||||
from esbo_etc.lib.helpers import error
|
from esbo_etc.lib.helpers import error
|
||||||
import astropy.units as u
|
import astropy.units as u
|
||||||
from astropy.modeling.models import BlackBody
|
from astropy.modeling.models import BlackBody
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
class AOpticalComponent(ITransmissive):
|
class AOpticalComponent(ITransmissive):
|
||||||
@ -13,9 +14,9 @@ class AOpticalComponent(ITransmissive):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
@u.quantity_input(obstructor_temp=[u.K, u.Celsius])
|
@u.quantity_input(obstructor_temp=[u.K, u.Celsius])
|
||||||
def __init__(self, parent: ITransmissive, transreflectivity: SpectralQty = None,
|
def __init__(self, parent: ITransmissive, transreflectivity: Union[SpectralQty, int, float, u.Quantity] = None,
|
||||||
noise: SpectralQty = None, obstruction: float = 0, obstructor_temp: u.Quantity = 0 * u.K,
|
noise: Union[SpectralQty, int, float, u.Quantity] = None, obstruction: float = 0,
|
||||||
obstructor_emissivity: float = 0):
|
obstructor_temp: u.Quantity = 0 * u.K, obstructor_emissivity: float = 0):
|
||||||
"""
|
"""
|
||||||
Initialize a new optical component
|
Initialize a new optical component
|
||||||
|
|
||||||
|
@ -24,7 +24,5 @@ class StrayLight(AOpticalComponent):
|
|||||||
# Read the emission
|
# Read the emission
|
||||||
emission_sqty = SpectralQty.fromFile(emission, wl_unit_default=u.nm,
|
emission_sqty = SpectralQty.fromFile(emission, wl_unit_default=u.nm,
|
||||||
qty_unit_default=u.W / (u.m**2 * u.nm * u.sr))
|
qty_unit_default=u.W / (u.m**2 * u.nm * u.sr))
|
||||||
# Create dummy transmittance
|
|
||||||
transmittance_sqty = SpectralQty(emission_sqty.wl, [1] * len(emission_sqty.wl) * u.dimensionless_unscaled)
|
|
||||||
# Initialize the super class
|
# Initialize the super class
|
||||||
super().__init__(parent, transmittance_sqty, emission_sqty)
|
super().__init__(parent, 1.0, emission_sqty)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user