@@ -786,46 +786,48 @@ def update_figpanel(self, evt=None):
786
786
# Define a progress dialog
787
787
dlg = wx .ProgressDialog ('Generating figure...' , 'Fetching data ...' , 100 , parent = self ,
788
788
style = wx .PD_APP_MODAL | wx .PD_CAN_ABORT )
789
- # Reset selections
790
- self .figpanel .patches = []
791
- self .figpanel .selection = set ()
792
-
793
- if self .figpanel .data is None :
794
- dlg .Pulse ('Fetching object data from database' )
795
- try :
796
- # Fetch all data from database
797
- data = self .load_obj_measurements ()
798
- keys , values = np .split (data , [2 ], axis = 1 )
799
- self .figpanel .keys = keys .astype (int )
800
- # Remove zero variance features
801
- self .figpanel .data = values .loc [:, (values != values .iloc [0 ]).any ()]
802
- except Exception as e :
803
- self .figpanel .data = None
804
- self .figpanel .keys = None
805
- logging .error (f"Unable to load data: { e } " )
806
- dlg .Destroy ()
807
- return
808
-
809
- start = time ()
789
+ try :
790
+ # Reset selections
791
+ self .figpanel .patches = []
792
+ self .figpanel .selection = set ()
810
793
811
- dlg .Pulse ('Generating model and plot' )
812
- selected_method = self .method_choice .GetStringSelection ()
813
- selected_plot = self .plot_choice .GetStringSelection ()
794
+ if self .figpanel .data is None :
795
+ dlg .Pulse ('Fetching object data from database' )
796
+ try :
797
+ # Fetch all data from database
798
+ data = self .load_obj_measurements ()
799
+ keys , values = np .split (data , [2 ], axis = 1 )
800
+ self .figpanel .keys = keys .astype (int )
801
+ # Remove zero variance features
802
+ self .figpanel .data = values .loc [:, (values != values .iloc [0 ]).any ()]
803
+ except Exception as e :
804
+ self .figpanel .data = None
805
+ self .figpanel .keys = None
806
+ logging .error (f"Unable to load data: { e } " )
807
+ dlg .Destroy ()
808
+ return
809
+
810
+ start = time ()
811
+
812
+ dlg .Pulse ('Generating model and plot' )
813
+ selected_method = self .method_choice .GetStringSelection ()
814
+ selected_plot = self .plot_choice .GetStringSelection ()
814
815
815
- if self .figpanel .calculated != selected_method :
816
- self .figpanel .calculate (selected_method , dlg = dlg )
817
816
if self .figpanel .calculated != selected_method :
818
- # Calculation failed for whatever reason
819
- dlg .Destroy ()
820
- return
821
- self .update_col_choices ()
822
- self .figpanel .navtoolbar .update ()
823
-
824
- dlg .Pulse ("Plotting results" )
825
- self .figpanel .plot_redux (type = selected_plot , x = self .x_choice .Value , y = self .y_choice .Value ,
826
- legend = self .display_legend .Value )
827
- self .figpanel .displayed = selected_plot
828
- dlg .Destroy ()
817
+ self .figpanel .calculate (selected_method , dlg = dlg )
818
+ if self .figpanel .calculated != selected_method :
819
+ # Calculation failed for whatever reason
820
+ dlg .Destroy ()
821
+ return
822
+ self .update_col_choices ()
823
+ self .figpanel .navtoolbar .update ()
824
+
825
+ dlg .Pulse ("Plotting results" )
826
+ self .figpanel .plot_redux (type = selected_plot , x = self .x_choice .Value , y = self .y_choice .Value ,
827
+ legend = self .display_legend .Value )
828
+ self .figpanel .displayed = selected_plot
829
+ finally :
830
+ dlg .Destroy ()
829
831
830
832
print (f"Finished { selected_method } in { time () - start } " )
831
833
self .update_gate_helper ()
0 commit comments