ESBO-ETC/esbo_etc/classes/target/ATarget.py

48 lines
1.2 KiB
Python
Raw Normal View History

2020-04-08 09:56:04 +02:00
from abc import abstractmethod
2020-04-16 09:35:24 +02:00
from ..IRadiant import IRadiant
2020-04-08 09:56:04 +02:00
from ..SpectralQty import SpectralQty
2020-04-08 13:36:08 +02:00
import astropy.units as u
2020-04-16 09:35:24 +02:00
import numpy as np
2020-04-08 09:56:04 +02:00
2020-04-16 09:35:24 +02:00
class ATarget(IRadiant):
2020-04-08 09:56:04 +02:00
"""
Abstract super class for target models
"""
2020-04-08 18:16:12 +02:00
2020-04-08 09:56:04 +02:00
@abstractmethod
@u.quantity_input(wl_bins="length")
def __init__(self, sfd: SpectralQty, wl_bins: u.Quantity):
2020-04-08 09:56:04 +02:00
"""
Initialize a new target
Parameters
----------
sfd: SpectralQty
The spectral flux density of the target
"""
2020-04-16 13:04:21 +02:00
self.__sfd = sfd
self.__wl_bins = wl_bins
2020-04-08 09:56:04 +02:00
def calcNoise(self) -> SpectralQty:
"""
Calculate the spectral radiance of the target's noise
Returns
-------
noise : SpectralQty
The spectral radiance of the target's noise
"""
return SpectralQty(self.__wl_bins, np.repeat(0, len(self.__wl_bins)) << u.W / (u.m**2 * u.nm * u.sr))
2020-04-08 09:56:04 +02:00
def calcSignal(self) -> SpectralQty:
"""
Calculate the spectral flux density of the target's signal
Returns
-------
signal : SpectralQty
The spectral flux density of the target's signal
"""
2020-04-16 13:04:21 +02:00
return self.__sfd