Coverage for src/spectroflat/base/sensor_flat_config.py: 92%
13 statements
« prev ^ index » next coverage.py v7.3.2, created at 2024-03-28 07:59 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2024-03-28 07:59 +0000
1from dataclasses import dataclass
4@dataclass
5class SensorFlatConfig:
6 """
7 DataItem for sensor flat extraction configuration.
9 This class holds all the tiny little configuration details
10 used during the extraction of the sensor flat.
11 """
13 #: Degree of the polynomial fit in spectral direction (along y-axis)
14 spacial_degree: int = 6
16 #: Sigma factor for outliers to mask (e.g. pixel that deviate more than `sigma_mask * std`).
17 sigma_mask: float = 3.5
19 #: Flag to toggle if a column wise response map should be average
20 average_column_response_map: bool = False
22 #: Number of pixels to ignore on the upper and lower border of the ROI
23 fit_border: int = 25
25 # -- values below are detected by the algorithm
27 # roi
28 roi: tuple = None
30 # Total rows
31 total_rows: int = 2048
32 # Total cols
33 total_cols: int = 2048
35 @staticmethod
36 def from_dict(data: dict):
37 """
38 Create a sensor flat config from a dictionary.
40 All instance variable names are supported as keywords.
41 All keywords are optional, if the keyword is not present the default will be used.
43 ### Params
44 - data: the dictionary to parse
46 ### Returns
47 The created SensorFlatConfig
48 """
49 return SensorFlatConfig(**data)