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

1from dataclasses import dataclass 

2 

3 

4@dataclass 

5class SensorFlatConfig: 

6 """ 

7 DataItem for sensor flat extraction configuration. 

8 

9 This class holds all the tiny little configuration details 

10 used during the extraction of the sensor flat. 

11 """ 

12 

13 #: Degree of the polynomial fit in spectral direction (along y-axis) 

14 spacial_degree: int = 6 

15 

16 #: Sigma factor for outliers to mask (e.g. pixel that deviate more than `sigma_mask * std`). 

17 sigma_mask: float = 3.5 

18 

19 #: Flag to toggle if a column wise response map should be average 

20 average_column_response_map: bool = False 

21 

22 #: Number of pixels to ignore on the upper and lower border of the ROI 

23 fit_border: int = 25 

24 

25 # -- values below are detected by the algorithm 

26 

27 # roi 

28 roi: tuple = None 

29 

30 # Total rows 

31 total_rows: int = 2048 

32 # Total cols 

33 total_cols: int = 2048 

34 

35 @staticmethod 

36 def from_dict(data: dict): 

37 """ 

38 Create a sensor flat config from a dictionary. 

39 

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. 

42 

43 ### Params 

44 - data: the dictionary to parse 

45 

46 ### Returns 

47 The created SensorFlatConfig 

48 """ 

49 return SensorFlatConfig(**data)