ESBO-ETC/esbo_etc/classes/sensor/ASensor.py

74 lines
1.8 KiB
Python
Raw Normal View History

2020-04-21 10:39:55 +02:00
from ..IRadiant import IRadiant
import astropy.units as u
from abc import abstractmethod
2020-05-08 15:06:13 +02:00
from ..Entry import Entry
from typing import Union
2020-04-21 10:39:55 +02:00
2020-04-21 14:46:40 +02:00
class ASensor:
2020-04-21 10:39:55 +02:00
"""
Abstract super class for sensor models
"""
def __init__(self, parent: IRadiant):
"""
Initialize a new sensor
Parameters
----------
parent : IRadiant
The parent element of the optical component from which the electromagnetic radiation is received
"""
self._parent = parent
@abstractmethod
@u.quantity_input(exp_time="time")
def getSNR(self, exp_time: u.Quantity):
"""
Calculate the signal to noise ratio (SNR) for the given exposure time.
Parameters
----------
exp_time : time-Quantity
The exposure time to calculate the SNR for.
Returns
-------
snr : float
The calculated SNR
"""
pass
@abstractmethod
def getExpTime(self, snr: float):
"""
Calculate the necessary exposure time in order to achieve the given SNR.
Parameters
----------
snr : float
The SNR for which the necessary exposure time shall be calculated.
Returns
-------
exp_time : Quantity
The necessary exposure time in seconds.
"""
pass
2020-05-08 15:06:13 +02:00
@staticmethod
def check_config(conf: Entry) -> Union[None, str]:
"""
Check the configuration for this class
Parameters
----------
conf : Entry
The configuration entry to be checked.
Returns
-------
mes : Union[None, str]
2020-05-08 16:45:39 +02:00
The error message of the check. This will be None if the check was successful.
2020-05-08 15:06:13 +02:00
"""
pass