-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorkItem.py
54 lines (41 loc) · 2.11 KB
/
WorkItem.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# A work item is one set of flat frames with identical characteristics
# e.g. "16 flat frames with filter number 2, binned 1x1, target adu 25000 within 10%"
from FilterSpec import FilterSpec
from Preferences import Preferences
class WorkItem:
def __init__(self, number_of_frames: int, filter_spec: FilterSpec, binning: int,
target_adus: float, adu_tolerance: float, preferences: Preferences):
self._number_of_frames: int = number_of_frames
self._filter_spec: FilterSpec = filter_spec
self._binning: int = binning
self._target_adu: float = target_adus
self._adu_tolerance: float = adu_tolerance
self._num_completed: int = 0
self._preferences = preferences
def get_number_of_frames(self) -> int:
return self._number_of_frames
def get_filter_spec(self) -> FilterSpec:
return self._filter_spec
def get_binning(self) -> int:
return self._binning
def get_target_adu(self) -> float:
return self._target_adu
def get_adu_tolerance(self) -> float:
return self._adu_tolerance
def get_num_completed(self) -> int:
return self._num_completed
def set_num_completed(self, completed: int):
self._num_completed = completed
def hybrid_filter_name(self) -> str:
fs: FilterSpec = self._filter_spec
return f"{fs.get_slot_number()}: {fs.get_name()}"
def initial_exposure_estimate(self) -> float:
exposure = self._preferences.get_initial_exposure(filter_slot=self.get_filter_spec().get_slot_number(),
binning=self.get_binning())
return exposure
def update_initial_exposure_estimate(self, new_exposure: float):
self._preferences.update_initial_exposure(filter_slot=self.get_filter_spec().get_slot_number(),
binning=self.get_binning(),
new_exposure=new_exposure)
def __str__(self):
return f"{self._number_of_frames} with {self._filter_spec.get_name()} at {self._binning} to {self._target_adu}"