Developer documentation completed

This commit is contained in:
Lukas Klass 2020-07-07 15:57:27 +02:00
parent fb7ddafa14
commit c79d2bc867
2 changed files with 26 additions and 2 deletions

View File

@ -12,6 +12,7 @@ All spectral quantities used for calculations, e.g. spectral flux densities, spe
They can be set up either by providing the two arrays wavelength bins and the corresponding spectral quantity as parameters to the constructor or by reading them from a file using the class method ``fromFile()``.
In the latter case, the file must be readable by astropy and the units of the columns may be contained in the column header in square brackets.
``SpectralQty``-objects natively support mathematical operations like addition (``__add__()``), substraction (``__sub__()``), multiplication (``__mul__()``) as well as true division (``__truediv__()``) and comparison (``__eq__()``).
These operations are defined for several other objects like ``SpectralQty``, ``int``, ``float`` as well as Lambda-functions.
Additionally, the two methods ``rebin()`` and ``integrate()`` allow to change the spectral grid or integrate the quantity on the grid.
.. _configuration:

View File

@ -1,8 +1,20 @@
ESBO-ETC can be easily extended by adding new optical components or a new detector component.
ESBO-ETC can be easily extended by adding new targets, new optical components or a new detector component.
In the following, only the minimal required changes in the source code are described.
Of course, the documentation must be edited as well if new components are added.
Adding Targets
--------------
Adding a new target type to ESBO-ETC is the easiest extension.
In the first place, the new target component must be defined in a new file *classes*-folder.
Thereby, the new component must subclass ``ATarget`` in order to be decoratable by other optical components.
The class must provide a constructor which accepts all attributes of the configuration tag as parameters and initializes the superclass passing the emitted radiation as parameter.
Additionally, the class must implement the method ``checkConfig()`` in order to check the configuration.
In case of an configuration error, the method must return the corresponding error message.
Optionally, the factory method ``create()`` of the class ``RadiantFactory`` has to be modified, if the constructor of the new component requires more parameters than the configuration tag attributes.
Adding Optical Components
@ -21,7 +33,18 @@ In case of an configuration error, the method must return the corresponding erro
The method ``propagate()`` is used to model the propagation of incoming radiation through the optical component.
Therefore, this method receives as parameter the incoming radiation as ``SpectralQty``-object and must return the manipulated radiation as ``SpectralQty``-object.
The second task consists of
The optional second task consists of modifying the factory method ``create()`` of the class ``RadiantFactory`` in order to properly initialize the new optical component from the configuration.
This is only necessary if the new optical component needs additional parameters besides the attributes of the corresponding configuration tag of if the new component provides multiple constructors (see class ``Filter``).
Adding Detector Components
--------------------------
In order to add a new detector component, two tasks must be completed.
The new detector component must be implemented in a designated file in the *classes*-folder, subclassing ``ASensor``.
Thereby, the new class must implement the three methods ``calcSNR()``, ``calcExpTime()`` and ``calcSensitivity()``.
All three methods obtain the incoming background and signal radiation as well as the obstruction factor as parameters apart from some specific parameters and must return the corresponding calculated value.
Additionally, all three methods must be able to calculate multiple SNRs, exposure times or sensitivities at once if an array of specific parameters is provided.
Besides the implementation of the detector, the factory method ``create()`` of the class ``SensorFactory`` must be modified.
In detail, a new if-branch must be added which assembles all necessary parameters for the constructor of the new component and calls the constructor.