-
Notifications
You must be signed in to change notification settings - Fork 0
/
Constants.py
78 lines (69 loc) · 3.28 KB
/
Constants.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
class Constants:
# Constants with weird arbitrary numeric values are being used to simulate "enum"s
# The actual enum class isn't working well in my current version of Python.
# The weird numbers are arbitrary, and are chosen to be weird to reduce the chance that
# a "legitimate" number in some other variable is accidentally cross-assigned and mistaken.
# What combination algorithm is used for combining multiple frames to a master?
COMBINE_MEAN = -6172 # Simple mean of all frames
COMBINE_MEDIAN = -6199 # Simple median of all frames
COMBINE_MINMAX = -6233 # Remove min and max values then mean
COMBINE_SIGMA_CLIP = -6345 # Remove values outside a given sigma then mean
# What do we do with the raw input files after files are combined to a master flat?
INPUT_DISPOSITION_NOTHING = -8357 # Do nothing to the files
INPUT_DISPOSITION_SUBFOLDER = -8361 # Move to a given named subfolder
# What kind of calibration preprocessing is applied to images before combining?
CALIBRATION_NONE = -9717 # Don't do any precalibration on the image files
CALIBRATION_PEDESTAL = -9715 # Subtract a fixed pedestal number from all files
CALIBRATION_FIXED_FILE = -9713 # Precalibration file path is permanently stored
CALIBRATION_AUTO_DIRECTORY = -9709 # Auto-select best file from a given directory
# CALIBRATION_PROMPT = -9711 # Prompt user for precalibration file
DEFAULT_CALIBRATION_PEDESTAL = 100
CONSOLE_INDENTATION_SIZE = 5
@classmethod
def combine_method_string(cls, method: int) -> str:
"""
Translate combination method code to meaningful string
:param method: Integer code specifying combination method
:return: String suitable for display on UI
"""
if method == cls.COMBINE_MEAN:
return "Mean"
elif method == cls.COMBINE_MEDIAN:
return "Median"
elif method == cls.COMBINE_MINMAX:
return "MinMaxClip"
elif method == cls.COMBINE_SIGMA_CLIP:
return "SigmaClip"
else:
print(f"combine_method_string({method}): Invalid method")
assert False
@classmethod
def disposition_string(cls, value: int) -> str:
"""
Translate file disposition code to a meaningful string for display
:param value: Code indicating file disposition
:return: String suitable for display on UI
"""
if value == cls.INPUT_DISPOSITION_NOTHING:
return "Nothing"
else:
assert value == cls.INPUT_DISPOSITION_SUBFOLDER
return "SubFolder"
@classmethod
def calibration_string(cls, value: int) -> str:
"""
Translate calibration type code to a human-readable string
:param value: Code for calibration type
:return: Human-readable string suitable for display
"""
# if value == cls.CALIBRATION_PROMPT:
# return "Prompt User"
if value == cls.CALIBRATION_AUTO_DIRECTORY:
return "Auto Directory"
elif value == cls.CALIBRATION_FIXED_FILE:
return "Fixed File"
elif value == cls.CALIBRATION_NONE:
return "None"
else:
assert value == cls.CALIBRATION_PEDESTAL
return "Pedestal"