33from dataclasses import dataclass , field
44
55OPTION_LIST = {
6+ "Select a template" : [],
67 "IMAGING TELESCOPE" : [
78 "Resolution (panchromatic)" ,
89 "Ground sampling distance (panchromatic)" ,
1718 "Pixel size (multispectral)" ,
1819 "Swath width" ,
1920 ],
20- "MITRE_Template" : [
21- "Object height" ,
22- "Image height" ,
23- "Wavelength" ,
21+ "PAYLOAD" : [
22+ "Resolution (panchromatic)" ,
23+ "Ground sampling distance (panchromatic)" ,
24+ "Resolution (multispectral)" ,
25+ "Ground sampling distance (multispectral)" ,
26+ "Altitude" ,
27+ "Half field of view" ,
28+ "Mirror aperture" ,
29+ "F-number" ,
30+ "Focal length" ,
31+ "Pixel size (panchromatic)" ,
32+ "Swath width" ,
2433 ],
2534}
2635
2736IMAGING_TELESCOPE = {
28- "Resolution (panchromatic)" : 1.8 ,
29- "Ground sampling distance (panchromatic)" : 0.6 ,
30- "Resolution (multispectral)" : 1.8 ,
31- "Ground sampling distance (multispectral)" : 0.9 ,
32- "Altitude" : 460000 ,
33- "Half field of view" : 0.02003638 ,
34- "Mirror aperture" : 0.60 ,
35- "F-number" : 5.53 ,
36- "Focal length" : 3.32 ,
37- "Pixel size (panchromatic)" : 8.75e -6 ,
38- "Pixel size (multispectral)" : 13e -6 ,
39- "Swath width" : 18400 ,
37+ "Resolution (panchromatic)" : 1.23529 ,
38+ "Ground sampling distance (panchromatic)" : 0.61765 ,
39+ "Resolution (multispectral)" : 1.81176 ,
40+ "Ground sampling distance (multispectral)" : 0.90588 ,
41+ "Altitude" : 420000 ,
42+ "Half field of view" : 0.017104227 ,
43+ "Mirror aperture" : 0.85 ,
44+ "F-number" : 6.0 ,
45+ "Focal length" : 5.1 ,
46+ "Pixel size (panchromatic)" : 7.5e -6 ,
47+ "Pixel size (multispectral)" : 11e -6 ,
48+ "Swath width" : 14368.95 ,
4049}
4150
42- MITRE_Template = {
43- "Object height" : 1.8 ,
44- "Image height" : 1.8 ,
45- "Wavelength" : 1.8 ,
51+ IMAGING_TELESCOPE_UNITS = {
52+ "Resolution (panchromatic)" : "m" ,
53+ "Ground sampling distance (panchromatic)" : "m" ,
54+ "Resolution (multispectral)" : "m" ,
55+ "Ground sampling distance (multispectral)" : "m" ,
56+ "Altitude" : "m" ,
57+ "Half field of view" : "rad" ,
58+ "Mirror aperture" : "m" ,
59+ "F-number" : "dimensionless" ,
60+ "Focal length" : "m" ,
61+ "Pixel size (panchromatic)" : "m" ,
62+ "Pixel size (multispectral)" : "m" ,
63+ "Swath width" : "m" ,
64+ }
65+
66+ PAYLOAD_1 = {
67+ "Resolution (panchromatic)" : 15.4 ,
68+ "Ground sampling distance (panchromatic)" : 7.7 ,
69+ "Resolution (multispectral)" : 0.0 ,
70+ "Ground sampling distance (multispectral)" : 0. ,
71+ "Altitude" : 420000 ,
72+ "Half field of view" : 0.005061455 ,
73+ "Mirror aperture" : 0.85 ,
74+ "F-number" : 1. ,
75+ "Focal length" : 0.3 ,
76+ "Pixel size (panchromatic)" : 5.5e-6 ,
77+ "Swath width" : 4251.66 ,
4678}
4779
4880
@@ -58,25 +90,10 @@ class Requirement:
5890 def __post_init__ (self ):
5991 self .sympy_symbol = self .latex_symbol .replace ("{" , "" ).replace ("}" , "" )
6092
61- # def getSympySymbol(self):
62- # return latex2sympy(self.latex_symbol)
63-
6493 @property
6594 def is_fixed (self ):
6695 return self .tolerance == 0.0
6796
68- # @property
69- # def equations(self, strict=False):
70- # if self.is_fixed:
71- # return [sympy.Eq(self.getSympySymbol(), self.value)]
72- # else:
73- # signs = [">=", "<="] if not strict else [">", "<"]
74- # bounds = [self.value - self.tolerance, self.value + self.tolerance]
75- # return [
76- # sympy.Rel(self.getSympySymbol(), bound, sign)
77- # for bound, sign in zip(bounds, signs)
78- # ]
79-
8097
8198def _find_symbol (name , variable_dict ):
8299
@@ -165,6 +182,46 @@ def display_table(change):
165182 # Update the name_label_width based on the longest row name
166183 name_label_width [0 ] = f"{ max_name_length + 2 } ch"
167184
185+ # Add Headers
186+ header_labels = [
187+ widgets .Label (
188+ value = "Name" ,
189+ layout = widgets .Layout (width = name_label_width [0 ]),
190+ style = {'font_weight' : 'bold' }
191+ ),
192+ widgets .Label (
193+ value = "Value" ,
194+ layout = widgets .Layout (width = "150px" ),
195+ style = {'font_weight' : 'bold' }
196+ ),
197+ widgets .Label (
198+ value = "Tolerance" ,
199+ layout = widgets .Layout (width = "150px" ),
200+ style = {'font_weight' : 'bold' }
201+ ),
202+ widgets .Label (
203+ value = "Accuracy" ,
204+ layout = widgets .Layout (width = "150px" ),
205+ style = {'font_weight' : 'bold' }
206+ ),
207+ widgets .Label (
208+ value = "Units" ,
209+ layout = widgets .Layout (width = "150px" ),
210+ style = {'font_weight' : 'bold' }
211+ ),
212+ ]
213+
214+ # Combine header labels into a horizontal box
215+ header = widgets .HBox (header_labels )
216+ header .layout = widgets .Layout (
217+ border = '1px solid black' ,
218+ padding = '5px' ,
219+ background_color = '#f0f0f0'
220+ )
221+
222+ # Add the header to the rows_output VBox
223+ rows_output .children += (header ,)
224+
168225 for row_name in rows :
169226 # Create name label with dynamic width
170227 name_label = widgets .Label (
@@ -175,10 +232,15 @@ def display_table(change):
175232 # Depending on the selected option, set default values
176233 if selected_option == "IMAGING TELESCOPE" :
177234 default_value = IMAGING_TELESCOPE .get (row_name , 0.0 )
235+ default_unit = IMAGING_TELESCOPE_UNITS .get (row_name , "" )
178236 # elif selected_option == "LIDAR":
179237 # default_value = LIDAR.get(row_name, 0.0)
180- elif selected_option == "MITRE_Template" :
181- default_value = MITRE_Template .get (row_name , 0.0 )
238+ elif selected_option == "PAYLOAD" :
239+ default_value = PAYLOAD_1 .get (row_name , 0.0 )
240+ default_unit = IMAGING_TELESCOPE_UNITS .get (row_name , "" )
241+ else :
242+ default_value = 0.0
243+ default_unit = ""
182244
183245 # Create input widgets
184246 value_text = widgets .FloatText (
@@ -193,7 +255,8 @@ def display_table(change):
193255 placeholder = "Accuracy" , layout = widgets .Layout (width = "150px" )
194256 )
195257 units_text = widgets .Text (
196- placeholder = "Units" , layout = widgets .Layout (width = "150px" )
258+ placeholder = "Units" , layout = widgets .Layout (width = "150px" ),
259+ value = default_unit
197260 )
198261
199262 # Combine widgets into a horizontal box
0 commit comments