Total Complexity | 3 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """ |
||
2 | Base Classes for creating the intermediate High-level Analysis Steps |
||
3 | """ |
||
4 | |||
5 | import abc |
||
6 | import logging |
||
7 | from enum import Enum |
||
8 | |||
9 | __all__ = [ |
||
10 | "AnalysisStepBase", |
||
11 | "AnalysisStepEnum", |
||
12 | ] |
||
13 | |||
14 | |||
15 | class AnalysisStepBase(abc.ABC): |
||
16 | """Config section for creating a basic AsgardpyAnalysis Step.""" |
||
17 | |||
18 | tag = "analysis-step" |
||
19 | |||
20 | def __init__(self, config, log=None, overwrite=True): |
||
21 | self.config = config |
||
22 | self.overwrite = overwrite |
||
23 | |||
24 | self.datasets = None |
||
25 | self.instrument_spectral_info = None |
||
26 | |||
27 | if log is None: |
||
28 | log = logging.getLogger(__name__) |
||
29 | self.log = log |
||
30 | |||
31 | def run(self, datasets=None, instrument_spectral_info=None): |
||
32 | """ |
||
33 | One can provide datasets and instrument_spectral_info to be used, |
||
34 | especially for the High-level Analysis steps. |
||
35 | """ |
||
36 | self.datasets = datasets |
||
37 | self.instrument_spectral_info = instrument_spectral_info |
||
38 | |||
39 | final_product = self._run() |
||
40 | self.log.info("Analysis Step %s completed", self.tag) |
||
41 | |||
42 | return final_product |
||
43 | |||
44 | |||
45 | class AnalysisStepEnum(str, Enum): |
||
46 | """Config section for list of Analysis Steps.""" |
||
47 | |||
48 | datasets_1d = "datasets-1d" |
||
49 | datasets_3d = "datasets-3d" |
||
50 | fit = "fit" |
||
51 | flux_points = "flux-points" |
||
52 |