gb_factory moved to AHotOpticalComponent
This commit is contained in:
parent
92fa74d7f2
commit
fa602c312d
@ -3,7 +3,7 @@ from esbo_etc.classes.ITransmissive import ITransmissive
|
|||||||
from esbo_etc.classes.SpectralQty import SpectralQty
|
from esbo_etc.classes.SpectralQty import SpectralQty
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
import astropy.units as u
|
import astropy.units as u
|
||||||
from esbo_etc.lib.helpers import gb_factory
|
from astropy.modeling.models import BlackBody
|
||||||
from typing import Union, Callable
|
from typing import Union, Callable
|
||||||
|
|
||||||
|
|
||||||
@ -12,8 +12,9 @@ class AHotOpticalComponent(AOpticalComponent):
|
|||||||
Abstract super class for an optical component with thermal emission
|
Abstract super class for an optical component with thermal emission
|
||||||
"""
|
"""
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
@u.quantity_input(wl_bins='length', temp=[u.Kelvin, u.Celsius])
|
@u.quantity_input(wl_bins='length', temp=[u.Kelvin, u.Celsius], obstruction_temp=[u.Kelvin, u.Celsius])
|
||||||
def __init__(self, parent: ITransmissive, emissivity: SpectralQty, temp: u.Quantity):
|
def __init__(self, parent: ITransmissive, emissivity: SpectralQty, temp: u.Quantity, obstruction: float = 0,
|
||||||
|
obstructor_temp: u.Quantity = 0 * u.K, obstructor_emissivity: float = 1):
|
||||||
"""
|
"""
|
||||||
Initialize a new optical component with thermal emission
|
Initialize a new optical component with thermal emission
|
||||||
|
|
||||||
@ -25,16 +26,26 @@ class AHotOpticalComponent(AOpticalComponent):
|
|||||||
The spectral emissivity coefficient for the optical surface.
|
The spectral emissivity coefficient for the optical surface.
|
||||||
temp: Quantity in Kelvin / Celsius
|
temp: Quantity in Kelvin / Celsius
|
||||||
Temperature of the optical component
|
Temperature of the optical component
|
||||||
|
obstruction : float
|
||||||
|
The additional obstruction factor of the optical component. 0 means the component is not obstructed, 1
|
||||||
|
denotes a completely obstructed component with therefore no incoming flux. It is important to note, that
|
||||||
|
the obstruction factor reflects the obstruction of the optical component additionally to the obstruction
|
||||||
|
factors of the prior elements in the beam.
|
||||||
|
obstructor_temp : Quantity in Kelvin / Celsius
|
||||||
|
Temperature of the obstructing component.
|
||||||
|
obstructor_emissivity : float
|
||||||
|
Emissivity of the obstructing component.
|
||||||
"""
|
"""
|
||||||
# Initialize super class
|
# Initialize super class
|
||||||
super().__init__(parent)
|
super().__init__(parent, obstruction=obstruction, obstructor_temp=obstructor_temp,
|
||||||
|
obstructor_emissivity=obstructor_emissivity)
|
||||||
if temp > 0 * u.K:
|
if temp > 0 * u.K:
|
||||||
# Create noise from black body model
|
# Create noise from black body model
|
||||||
if isinstance(emissivity, SpectralQty):
|
if isinstance(emissivity, SpectralQty):
|
||||||
bb = gb_factory(temp)
|
bb = self._gb_factory(temp)
|
||||||
self._noise = SpectralQty(emissivity.wl, bb(emissivity.wl)) * emissivity
|
self._noise = SpectralQty(emissivity.wl, bb(emissivity.wl)) * emissivity
|
||||||
else:
|
else:
|
||||||
bb = gb_factory(temp, emissivity)
|
bb = self._gb_factory(temp, emissivity)
|
||||||
self._noise = bb
|
self._noise = bb
|
||||||
else:
|
else:
|
||||||
self._noise = 0
|
self._noise = 0
|
||||||
@ -49,3 +60,24 @@ class AHotOpticalComponent(AOpticalComponent):
|
|||||||
The noise created by the optical component
|
The noise created by the optical component
|
||||||
"""
|
"""
|
||||||
return self._noise
|
return self._noise
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
@u.quantity_input(temp=[u.Kelvin, u.Celsius])
|
||||||
|
def _gb_factory(temp: u.Quantity, em: Union[int, float] = 1):
|
||||||
|
"""
|
||||||
|
Factory for a grey body lambda-function.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
temp : Quantity in Kelvin / Celsius
|
||||||
|
The temperature fo the grey body.
|
||||||
|
em : Union[int, float]
|
||||||
|
Emissivity of the the grey body
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
bb : Callable
|
||||||
|
The lambda function for the grey body.
|
||||||
|
"""
|
||||||
|
bb = BlackBody(temperature=temp, scale=em * u.W / (u.m ** 2 * u.nm * u.sr))
|
||||||
|
return lambda wl: bb(wl)
|
||||||
|
@ -27,27 +27,6 @@ def error(msg: str, exit_: bool = True):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
@u.quantity_input(temp=[u.Kelvin, u.Celsius])
|
|
||||||
def gb_factory(temp: u.Quantity, em: Union[int, float] = 1):
|
|
||||||
"""
|
|
||||||
Factory for a grey body lambda-function.
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
temp : Quantity in Kelvin / Celsius
|
|
||||||
The temperature fo the grey body.
|
|
||||||
em : Union[int, float]
|
|
||||||
Emissivity of the the grey body
|
|
||||||
|
|
||||||
Returns
|
|
||||||
-------
|
|
||||||
bb : Callable
|
|
||||||
The lambda function for the grey body.
|
|
||||||
"""
|
|
||||||
bb = BlackBody(temperature=temp * u.K, scale=em * u.W / (u.m ** 2 * u.nm * u.sr))
|
|
||||||
return lambda wl: bb(wl)
|
|
||||||
|
|
||||||
|
|
||||||
def isLambda(v: object):
|
def isLambda(v: object):
|
||||||
"""
|
"""
|
||||||
Check if a object is of type lambda
|
Check if a object is of type lambda
|
||||||
|
Loading…
x
Reference in New Issue
Block a user