ESBO-ETC/esbo_etc/classes/optical_component/AHotOpticalComponent.py

52 lines
1.9 KiB
Python
Raw Normal View History

2020-04-14 15:53:15 +02:00
from esbo_etc.classes.optical_component.AOpticalComponent import AOpticalComponent
from esbo_etc.classes.ITransmissive import ITransmissive
from esbo_etc.classes.SpectralQty import SpectralQty
from abc import abstractmethod
import astropy.units as u
2020-04-14 19:58:23 +02:00
from esbo_etc.lib.helpers import gb_factory
from typing import Union, Callable
2020-04-14 15:53:15 +02:00
class AHotOpticalComponent(AOpticalComponent):
"""
Abstract super class for an optical component with thermal emission
"""
@abstractmethod
@u.quantity_input(wl_bins='length', temp=[u.Kelvin, u.Celsius])
2020-04-14 19:58:23 +02:00
def __init__(self, parent: ITransmissive, emissivity: SpectralQty, temp: u.Quantity):
2020-04-14 15:53:15 +02:00
"""
Initialize a new optical component with thermal emission
Parameters
----------
parent : ITransmissive
The parent element of the optical component from which the electromagnetic radiation is received.
emissivity : SpectralQty
The spectral emissivity coefficient for the optical surface.
temp: Quantity in Kelvin / Celsius
Temperature of the optical component
"""
# Initialize super class
super().__init__(parent)
if temp > 0 * u.K:
# Create noise from black body model
2020-04-14 19:58:23 +02:00
if isinstance(emissivity, SpectralQty):
bb = gb_factory(temp)
self._noise = SpectralQty(emissivity.wl, bb(emissivity.wl)) * emissivity
else:
bb = gb_factory(temp, emissivity)
self._noise = bb
2020-04-14 15:53:15 +02:00
else:
self._noise = 0
2020-04-14 15:53:15 +02:00
2020-04-14 19:58:23 +02:00
def ownNoise(self) -> Union[SpectralQty, Callable, int, float]:
2020-04-14 15:53:15 +02:00
"""
Calculate the noise created by the optical component
Returns
-------
2020-04-14 19:58:23 +02:00
noise : Union[SpectralQty, Callable, int, float]
2020-04-14 15:53:15 +02:00
The noise created by the optical component
"""
return self._noise