From 10d0c2f77c3902c8d78030497db6f50538426212 Mon Sep 17 00:00:00 2001 From: LukasK13 Date: Mon, 29 Jun 2020 10:41:26 +0200 Subject: [PATCH] Emissivity parameter added --- docs/source/configuration/optical_components.rst | 8 +++++--- esbo_etc/classes/optical_component/CosmicBackground.py | 10 ++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/source/configuration/optical_components.rst b/docs/source/configuration/optical_components.rst index ff9dcbb..66790e4 100644 --- a/docs/source/configuration/optical_components.rst +++ b/docs/source/configuration/optical_components.rst @@ -41,13 +41,15 @@ This component allows to model generic black body noise sources like the cosmic .. code-block:: xml - + Attributes: * | **temp:** float - | The temperature of the black body. + | The temperature of the black body. * | **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``. + * | **emissivity:** float, *optional* + | The emissivity of the cosmic background. Mirror ------ diff --git a/esbo_etc/classes/optical_component/CosmicBackground.py b/esbo_etc/classes/optical_component/CosmicBackground.py index 36b58df..b36a7e1 100644 --- a/esbo_etc/classes/optical_component/CosmicBackground.py +++ b/esbo_etc/classes/optical_component/CosmicBackground.py @@ -12,7 +12,7 @@ class CosmicBackground(AOpticalComponent): """ @u.quantity_input(temp=[u.Kelvin, u.Celsius]) - def __init__(self, parent: IRadiant, temp: u.Quantity = 2.725 * u.K): + def __init__(self, parent: IRadiant, temp: u.Quantity = 2.725 * u.K, emissivity: float = 1): """ Initialize a new black body point source @@ -22,6 +22,8 @@ class CosmicBackground(AOpticalComponent): The parent element of the optical component from which the electromagnetic radiation is received temp : Quantity in Kelvin / Celsius Temperature of the black body + emissivity : float + The spectral emissivity coefficient for the optical surface. Returns ------- @@ -29,7 +31,7 @@ class CosmicBackground(AOpticalComponent): # Create black body model with given temperature bb = BlackBody(temperature=temp, scale=1 * u.W / (u.m ** 2 * u.nm * u.sr)) # Initialize super class - super().__init__(parent, 1.0, lambda wl: bb(wl)) + super().__init__(parent, 1.0, lambda wl: bb(wl) * emissivity) @staticmethod def check_config(conf: Entry) -> Union[None, str]: @@ -49,3 +51,7 @@ class CosmicBackground(AOpticalComponent): mes = conf.check_quantity("temp", u.K) if mes is not None: return mes + if hasattr(conf, "emissivity"): + mes = conf.check_float("emissivity") + if mes is not None: + return mes