Changeset 732c548 in sasview for fittingview
- Timestamp:
- Jul 2, 2012 12:21:55 PM (12 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- e0405592
- Parents:
- 7d89e50
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/batchfitpage.py
r940aca7 r732c548 1 2 3 import sys 1 """ 2 Batch panel 3 """ 4 4 import wx 5 5 import wx.lib.newevent 6 import numpy7 import copy8 6 import math 9 import time10 from sans.models.dispersion_models import ArrayDispersion, GaussianDispersion11 from sans.dataloader.data_info import Data1D12 7 from sans.guiframe.events import StatusEvent 13 8 from sans.guiframe.events import NewPlotEvent 14 from sans.guiframe.utils import format_number,check_float15 9 16 10 (Chi2UpdateEvent, EVT_CHI2_UPDATE) = wx.lib.newevent.NewEvent() … … 20 14 SMEAR_SIZE_H = 0.00 21 15 22 import basepage 23 from basepage import BasicPage 24 from basepage import PageInfoEvent 16 from sans.perspectives.fitting.basepage import PageInfoEvent 25 17 from sans.models.qsmearing import smear_selection 26 from fitpage import FitPage18 from sans.perspectives.fitting.fitpage import FitPage 27 19 28 20 class BatchFitPage(FitPage): 21 """ 22 Batch Page 23 """ 29 24 window_name = "BatchFit" 30 25 window_caption = "BatchFit" 31 26 32 def __init__(self, parent, color='rand'):27 def __init__(self, parent, color='rand'): 33 28 """ 34 29 Initialization of the Panel … … 52 47 is_2Ddata = True 53 48 54 title = "Fitting" 55 #smear messages & titles 56 smear_message_none = "No smearing is selected..." 57 smear_message_dqdata = "The dQ data is being used for smearing..." 58 smear_message_2d = "Higher accuracy is very time-expensive. Use it with care..." 59 smear_message_new_ssmear = "Please enter only the value of interest to customize smearing..." 60 smear_message_new_psmear = "Please enter both; the dQ will be generated by interpolation..." 61 smear_message_2d_x_title = "<dQp>[1/A]:" 62 smear_message_2d_y_title = "<dQs>[1/A]:" 63 smear_message_pinhole_min_title = "dQ_low[1/A]:" 64 smear_message_pinhole_max_title = "dQ_high[1/A]:" 65 smear_message_slit_height_title = "Slit height[1/A]:" 66 smear_message_slit_width_title = "Slit width[1/A]:" 67 49 title = "Fitting" 68 50 self._get_smear_info() 69 51 70 52 #Sizers 71 box_description_range = wx.StaticBox(self, -1, str(title))53 box_description_range = wx.StaticBox(self, -1, str(title)) 72 54 boxsizer_range = wx.StaticBoxSizer(box_description_range, wx.VERTICAL) 73 55 self.sizer_set_smearer = wx.BoxSizer(wx.VERTICAL) 74 sizer_smearer = wx.BoxSizer(wx.HORIZONTAL)75 self.sizer_new_smear = wx.BoxSizer(wx.HORIZONTAL)56 #sizer_smearer = wx.BoxSizer(wx.HORIZONTAL) 57 self.sizer_new_smear = wx.BoxSizer(wx.HORIZONTAL) 76 58 self.sizer_set_masking = wx.BoxSizer(wx.HORIZONTAL) 77 59 sizer_chi2 = wx.BoxSizer(wx.VERTICAL) 78 """ 79 smear_set_box= wx.StaticBox(self, -1,'Set Instrumental Smearing') 80 sizer_smearer_box = wx.StaticBoxSizer(smear_set_box, wx.HORIZONTAL) 81 sizer_smearer_box.SetMinSize((_DATA_BOX_WIDTH,85)) 82 """ 60 83 61 sizer_fit = wx.GridSizer(2, 4, 2, 6) 84 """85 # combobox for smear2d accuracy selection86 self.smear_accuracy = wx.ComboBox(self, -1,size=(50,-1),style=wx.CB_READONLY)87 self._set_accuracy_list()88 self.smear_accuracy.SetValue(self.smear2d_accuracy)89 self.smear_accuracy.SetSelection(0)90 self.smear_accuracy.SetToolTipString("'Higher' uses more Gaussian points for smearing computation.")91 92 wx.EVT_COMBOBOX(self.smear_accuracy,-1, self._on_select_accuracy)93 """94 62 #Fit button 95 self.btFit = wx.Button(self, wx.NewId(),'Fit', size=(88,25))63 self.btFit = wx.Button(self, wx.NewId(), 'Fit', size=(88, 25)) 96 64 self.default_bt_colour = self.btFit.GetDefaultAttributes() 97 self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id= self.btFit.GetId())65 self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id= self.btFit.GetId()) 98 66 self.btFit.SetToolTipString("Start fitting.") 99 """ 100 #textcntrl for custom resolution 101 self.smear_pinhole_max = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH-25,20),style=wx.TE_PROCESS_ENTER, 102 text_enter_callback = self.onPinholeSmear) 103 self.smear_pinhole_min = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH-25,20),style=wx.TE_PROCESS_ENTER, 104 text_enter_callback = self.onPinholeSmear) 105 self.smear_slit_height= self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH-25,20),style=wx.TE_PROCESS_ENTER, 106 text_enter_callback = self.onSlitSmear) 107 self.smear_slit_width = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH-25,20),style=wx.TE_PROCESS_ENTER, 108 text_enter_callback = self.onSlitSmear) 109 110 ## smear 111 self.smear_data_left= BGTextCtrl(self, -1, size=(_BOX_WIDTH-25,20), style=0) 112 self.smear_data_left.SetValue(str(self.dq_l)) 113 self.smear_data_right = BGTextCtrl(self, -1, size=(_BOX_WIDTH-25,20), style=0) 114 self.smear_data_right.SetValue(str(self.dq_r)) 115 116 #set default values for smear 117 self.smear_pinhole_max.SetValue(str(self.dx_max)) 118 self.smear_pinhole_min.SetValue(str(self.dx_min)) 119 self.smear_slit_height.SetValue(str(self.dxl)) 120 self.smear_slit_width.SetValue(str(self.dxw)) 121 122 #Filling the sizer containing instruments smearing info. 123 self.disable_smearer = wx.RadioButton(self, -1, 'None', style=wx.RB_GROUP) 124 self.enable_smearer = wx.RadioButton(self, -1, 'Use dQ Data') 125 #self.enable_smearer.SetToolTipString("Click to use the loaded dQ data for smearing.") 126 self.pinhole_smearer = wx.RadioButton(self, -1, 'Custom Pinhole Smear') 127 #self.pinhole_smearer.SetToolTipString("Click to input custom resolution for pinhole smearing.") 128 self.slit_smearer = wx.RadioButton(self, -1, 'Custom Slit Smear') 129 #self.slit_smearer.SetToolTipString("Click to input custom resolution for slit smearing.") 130 self.Bind(wx.EVT_RADIOBUTTON, self.onSmear, id=self.disable_smearer.GetId()) 131 self.Bind(wx.EVT_RADIOBUTTON, self.onSmear, id=self.enable_smearer.GetId()) 132 self.Bind(wx.EVT_RADIOBUTTON, self.onPinholeSmear, id=self.pinhole_smearer.GetId()) 133 self.Bind(wx.EVT_RADIOBUTTON, self.onSlitSmear, id=self.slit_smearer.GetId()) 134 self.disable_smearer.SetValue(True) 135 136 # add 4 types of smearing to the sizer 137 sizer_smearer.Add( self.disable_smearer,0, wx.LEFT, 10) 138 sizer_smearer.Add((10,10)) 139 sizer_smearer.Add( self.enable_smearer) 140 sizer_smearer.Add((10,10)) 141 sizer_smearer.Add( self.pinhole_smearer ) 142 sizer_smearer.Add((10,10)) 143 sizer_smearer.Add( self.slit_smearer ) 144 sizer_smearer.Add((10,10)) 145 """ 146 """ 147 # StaticText for chi2, N(for fitting), Npts 148 self.tcChi = BGTextCtrl(self, -1, "-", size=(75,20), style=0) 149 self.tcChi.SetToolTipString("Chi2/Npts(Fit)") 150 self.Npts_fit = BGTextCtrl(self, -1, "-", size=(75,20), style=0) 151 self.Npts_fit.SetToolTipString(\ 152 " Npts : number of points selected for fitting") 153 self.Npts_total = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 154 style=wx.TE_PROCESS_ENTER, 155 text_enter_callback=self._onQrangeEnter) 156 self.Npts_total.SetValue(format_number(self.npts_x)) 157 self.Npts_total.SetToolTipString(\ 158 " Total Npts : total number of data points") 159 """ 67 160 68 # Update and Draw button 161 self.draw_button = wx.Button(self, wx.NewId(),'Compute', size=(88,24))69 self.draw_button = wx.Button(self, wx.NewId(), 'Compute', size=(88, 24)) 162 70 self.draw_button.Bind(wx.EVT_BUTTON, \ 163 self._onDraw,id= self.draw_button.GetId()) 164 self.draw_button.SetToolTipString("Compute and Draw.") 165 """ 166 box_description_1= wx.StaticText(self, -1,' Chi2/Npts') 167 box_description_2= wx.StaticText(self, -1,'Npts(Fit)') 168 box_description_3= wx.StaticText(self, -1,'Total Npts') 169 box_description_3.SetToolTipString( \ 170 " Total Npts : total number of data points") 171 #box_description_4= wx.StaticText(self, -1,' ') 172 """ 173 174 """ 175 sizer_fit.Add(box_description_1,0,0) 176 sizer_fit.Add(box_description_2,0,0) 177 sizer_fit.Add(box_description_3,0,0) 178 """ 179 sizer_fit.Add(self.draw_button,0,0) 180 """ 181 sizer_fit.Add(self.tcChi,0,0) 182 sizer_fit.Add(self.Npts_fit ,0,0) 183 sizer_fit.Add(self.Npts_total,0,0) 184 """ 185 sizer_fit.Add(self.btFit,0,0) 186 """ 187 self.smear_description_none = wx.StaticText(self, -1, smear_message_none , style=wx.ALIGN_LEFT) 188 self.smear_description_dqdata = wx.StaticText(self, -1, smear_message_dqdata , style=wx.ALIGN_LEFT) 189 self.smear_description_type = wx.StaticText(self, -1, "Type:" , style=wx.ALIGN_LEFT) 190 self.smear_description_accuracy_type = wx.StaticText(self, -1, "Accuracy:" , style=wx.ALIGN_LEFT) 191 self.smear_description_smear_type = BGTextCtrl(self, -1, size=(57,20), style=0) 192 self.smear_description_smear_type.SetValue(str(self.dq_l)) 193 self.SetBackgroundColour(self.GetParent().GetBackgroundColour()) 194 self.smear_description_2d = wx.StaticText(self, -1, smear_message_2d , style=wx.ALIGN_LEFT) 195 self.smear_message_new_s = wx.StaticText(self, -1, smear_message_new_ssmear , style=wx.ALIGN_LEFT) 196 self.smear_message_new_p = wx.StaticText(self, -1, smear_message_new_psmear , style=wx.ALIGN_LEFT) 197 self.smear_description_2d_x = wx.StaticText(self, -1, smear_message_2d_x_title , style=wx.ALIGN_LEFT) 198 self.smear_description_2d_x.SetToolTipString(" dQp(parallel) in q_r direction.") 199 self.smear_description_2d_y = wx.StaticText(self, -1, smear_message_2d_y_title , style=wx.ALIGN_LEFT) 200 self.smear_description_2d_y.SetToolTipString(" dQs(perpendicular) in q_phi direction.") 201 self.smear_description_pin_min = wx.StaticText(self, -1, smear_message_pinhole_min_title , style=wx.ALIGN_LEFT) 202 self.smear_description_pin_max = wx.StaticText(self, -1, smear_message_pinhole_max_title , style=wx.ALIGN_LEFT) 203 self.smear_description_slit_height = wx.StaticText(self, -1, smear_message_slit_height_title , style=wx.ALIGN_LEFT) 204 self.smear_description_slit_width = wx.StaticText(self, -1, smear_message_slit_width_title , style=wx.ALIGN_LEFT) 205 """ 206 #arrange sizers 207 #boxsizer1.Add( self.tcChi ) 208 """ 209 self.sizer_set_smearer.Add(sizer_smearer ) 210 self.sizer_set_smearer.Add((10,10)) 211 self.sizer_set_smearer.Add( self.smear_description_none,0, wx.CENTER, 10 ) 212 self.sizer_set_smearer.Add( self.smear_description_dqdata,0, wx.CENTER, 10 ) 213 self.sizer_set_smearer.Add( self.smear_description_2d,0, wx.CENTER, 10 ) 214 self.sizer_new_smear.Add( self.smear_description_type,0, wx.CENTER, 10 ) 215 self.sizer_new_smear.Add( self.smear_description_accuracy_type,0, wx.CENTER, 10 ) 216 self.sizer_new_smear.Add( self.smear_accuracy ) 217 self.sizer_new_smear.Add( self.smear_description_smear_type,0, wx.CENTER, 10 ) 218 self.sizer_new_smear.Add((15,-1)) 219 self.sizer_new_smear.Add( self.smear_description_2d_x,0, wx.CENTER, 10 ) 220 self.sizer_new_smear.Add( self.smear_description_pin_min,0, wx.CENTER, 10 ) 221 self.sizer_new_smear.Add( self.smear_description_slit_height,0, wx.CENTER, 10 ) 222 223 self.sizer_new_smear.Add( self.smear_pinhole_min,0, wx.CENTER, 10 ) 224 self.sizer_new_smear.Add( self.smear_slit_height,0, wx.CENTER, 10 ) 225 self.sizer_new_smear.Add( self.smear_data_left,0, wx.CENTER, 10 ) 226 self.sizer_new_smear.Add((20,-1)) 227 self.sizer_new_smear.Add( self.smear_description_2d_y,0, wx.CENTER, 10 ) 228 self.sizer_new_smear.Add( self.smear_description_pin_max,0, wx.CENTER, 10 ) 229 self.sizer_new_smear.Add( self.smear_description_slit_width,0, wx.CENTER, 10 ) 230 231 self.sizer_new_smear.Add( self.smear_pinhole_max,0, wx.CENTER, 10 ) 232 self.sizer_new_smear.Add( self.smear_slit_width,0, wx.CENTER, 10 ) 233 self.sizer_new_smear.Add( self.smear_data_right,0, wx.CENTER, 10 ) 234 235 self.sizer_set_smearer.Add( self.smear_message_new_s,0, wx.CENTER, 10) 236 self.sizer_set_smearer.Add( self.smear_message_new_p,0, wx.CENTER, 10) 237 self.sizer_set_smearer.Add((5,2)) 238 self.sizer_set_smearer.Add( self.sizer_new_smear,0, wx.CENTER, 10 ) 239 240 # add all to chi2 sizer 241 sizer_smearer_box.Add(self.sizer_set_smearer) 242 243 sizer_chi2.Add(sizer_smearer_box) 244 """ 245 sizer_chi2.Add((-1,5)) 246 """ 247 # hide all smear messages and textctrl 248 self._hide_all_smear_info() 249 """ 71 self._onDraw,id=self.draw_button.GetId()) 72 self.draw_button.SetToolTipString("Compute and Draw.") 73 sizer_fit.Add(self.draw_button, 0, 0) 74 sizer_fit.Add(self.btFit, 0, 0) 75 sizer_chi2.Add((-1, 5)) 250 76 # get smear_selection 251 self.current_smearer= smear_selection( self.data, self.model ) 252 """ 253 # Show only the relevant smear messages, etc 254 if self.current_smearer == None: 255 if not is_2Ddata: 256 self.smear_description_none.Show(True) 257 self.enable_smearer.Disable() 258 else: 259 self.smear_description_none.Show(True) 260 #self.smear_description_2d.Show(True) 261 #self.pinhole_smearer.Disable() 262 self.slit_smearer.Disable() 263 #self.enable_smearer.Disable() 264 if self.data == None: 265 self.slit_smearer.Disable() 266 self.pinhole_smearer.Disable() 267 self.enable_smearer.Disable() 268 else: self._show_smear_sizer() 269 """ 77 self.current_smearer = smear_selection( self.data, self.model ) 270 78 boxsizer_range.Add(self.sizer_set_masking) 271 79 #2D data? default … … 279 87 self.sizer5.Clear(True) 280 88 281 self.qmin = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),282 style=wx.TE_PROCESS_ENTER, 89 self.qmin = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 90 style=wx.TE_PROCESS_ENTER, 283 91 text_enter_callback = self._onQrangeEnter) 284 92 self.qmin.SetValue(str(self.qmin_x)) 285 93 self.qmin.SetToolTipString("Minimun value of Q in linear scale.") 286 94 287 self.qmax = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),288 style=wx.TE_PROCESS_ENTER, 95 self.qmax = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 96 style=wx.TE_PROCESS_ENTER, 289 97 text_enter_callback=self._onQrangeEnter) 290 98 self.qmax.SetValue(str(self.qmax_x)) … … 292 100 293 101 id = wx.NewId() 294 self.reset_qrange =wx.Button(self, id,'Reset',size=(77,20))102 self.reset_qrange =wx.Button(self, id, 'Reset', size=(77, 20)) 295 103 296 self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked,id=id) 297 self.reset_qrange.SetToolTipString("Reset Q range to the default values") 104 self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked, id=id) 105 self.reset_qrange.SetToolTipString(\ 106 "Reset Q range to the default values") 298 107 299 sizer_horizontal=wx.BoxSizer(wx.HORIZONTAL) 300 sizer= wx.GridSizer(2, 4, 2, 6) 301 302 self.btEditMask = wx.Button(self,wx.NewId(),'Editor', size=(88,23)) 303 self.btEditMask.Bind(wx.EVT_BUTTON, self._onMask,id= self.btEditMask.GetId()) 108 sizer_horizontal = wx.BoxSizer(wx.HORIZONTAL) 109 sizer = wx.GridSizer(2, 4, 2, 6) 110 111 self.btEditMask = wx.Button(self, wx.NewId(),'Editor', size=(88, 23)) 112 self.btEditMask.Bind(wx.EVT_BUTTON, 113 self._onMask,id=self.btEditMask.GetId()) 304 114 self.btEditMask.SetToolTipString("Edit Mask.") 305 115 self.EditMask_title = wx.StaticText(self, -1, ' Masking(2D)') … … 309 119 sizer.Add(wx.StaticText(self, -1, ' Max[1/A]')) 310 120 sizer.Add(self.EditMask_title) 311 #sizer.Add(wx.StaticText(self, -1, ''))121 312 122 sizer.Add(self.reset_qrange) 313 123 sizer.Add(self.qmin) 314 124 sizer.Add(self.qmax) 315 #sizer.Add(self.theory_npts_tcrtl) 125 316 126 sizer.Add(self.btEditMask) 317 127 boxsizer_range.Add(sizer_chi2) 318 boxsizer_range.Add((10, 10))128 boxsizer_range.Add((10, 10)) 319 129 boxsizer_range.Add(sizer) 320 130 321 boxsizer_range.Add((10, 15))131 boxsizer_range.Add((10, 15)) 322 132 boxsizer_range.Add(sizer_fit) 323 133 if is_2Ddata: … … 327 137 self.btEditMask.Disable() 328 138 self.EditMask_title.Disable() 329 """ 139 330 140 ## save state 331 self.save_current_state()332 """ 333 self.sizer5.Add(boxsizer_range, 0, wx.EXPAND | wx.ALL, 10)141 #self.save_current_state() 142 143 self.sizer5.Add(boxsizer_range, 0, wx.EXPAND | wx.ALL, 10) 334 144 self.sizer5.Layout() 335 145 … … 352 162 except: 353 163 pass 354 """355 #self.btFit.SetFocus()356 self.state.enable_disp = self.enable_disp.GetValue()357 self.state.disable_disp = self.disable_disp.GetValue()358 self.state.pinhole_smearer = self.pinhole_smearer.GetValue()359 self.state.slit_smearer = self.slit_smearer.GetValue()360 """361 164 self.state.structurecombobox = self.structurebox.GetCurrentSelection() 362 165 self.state.formfactorcombobox = self.formfactorbox.GetCurrentSelection() … … 370 173 371 174 temp_smear = None 372 """373 #self._set_save_flag(True)374 # Reset smearer, model and data375 self._set_smear(self.data)376 try:377 # update smearer sizer378 self.onSmear(None)379 temp_smear = None380 if self.enable_smearer.GetValue():381 # Set the smearer environments382 temp_smear = self.smearer383 except:384 raise385 ## error occured on chisqr computation386 #pass387 """388 175 ## event to post model to fit to fitting plugins 389 (ModelEventbox, EVT_MODEL_BOX) = wx.lib.newevent.NewEvent()176 (ModelEventbox, _) = wx.lib.newevent.NewEvent() 390 177 391 178 ## set smearing value whether or not … … 432 219 is_modified = False 433 220 434 #wx.PostEvent(self._manager.parent, StatusEvent(status=" \ 435 #updating ... ",type="update")) 436 437 ##So make sure that update param values on_Fit. 438 #self._undo.Enable(True) 439 if self.model !=None: 221 if self.model != None: 440 222 ##Check the values 441 self._check_value_enter( self.fittable_param ,is_modified)442 self._check_value_enter( self.fixed_param ,is_modified)443 self._check_value_enter( self.parameters ,is_modified)223 self._check_value_enter( self.fittable_param, is_modified) 224 self._check_value_enter( self.fixed_param, is_modified) 225 self._check_value_enter( self.parameters, is_modified) 444 226 445 227 # If qmin and qmax have been modified, update qmin and qmax and … … 457 239 if tempmax == tempmin: 458 240 flag = False 459 temp_smearer = None 460 """ 461 if not self.disable_smearer.GetValue(): 462 temp_smearer= self.current_smearer 463 if self.slit_smearer.GetValue(): 464 flag = self.update_slit_smear() 465 elif self.pinhole_smearer.GetValue(): 466 flag = self.update_pinhole_smear() 467 else: 468 self._manager.set_smearer(smearer=temp_smearer, 469 uid=self.uid, 470 qmin=float(self.qmin_x), 471 qmax=float(self.qmax_x), 472 draw=False) 473 elif not self._is_2D(): 474 self._manager.set_smearer(smearer=temp_smearer, 475 qmin=float(self.qmin_x), 476 uid=self.uid, 477 qmax= float(self.qmax_x), 478 draw=False) 479 480 if self.data != None: 481 index_data = ((self.qmin_x <= self.data.x)&\ 482 (self.data.x <= self.qmax_x)) 483 val = str(len(self.data.x[index_data==True])) 484 self.Npts_fit.SetValue(val) 485 else: 486 # No data in the panel 487 try: 488 self.npts_x = float(self.Npts_total.GetValue()) 489 except: 490 flag = False 491 return flag 492 flag = True 493 """ 241 #temp_smearer = None 494 242 if self._is_2D(): 495 243 # only 2D case set mask … … 533 281 reset the current data 534 282 """ 535 id = None283 #id = None 536 284 group_id = None 537 285 flag = False … … 539 287 flag = True 540 288 if data is not None: 541 id = data.id289 #id = data.id 542 290 group_id = data.group_id 543 291 if self.data is not None: … … 557 305 self._set_save_flag(False) 558 306 self._set_preview_flag(True) 559 """ 560 self._set_smear(data) 561 # more disables for 2D 562 if self.data.__class__.__name__ == "Data2D" or \ 563 self.enable2D: 564 self.slit_smearer.Disable() 565 self.pinhole_smearer.Enable(True) 566 self.default_mask = copy.deepcopy(self.data.mask) 567 else: 568 self.slit_smearer.Enable(True) 569 self.pinhole_smearer.Enable(True) 570 """ 307 571 308 self.formfactorbox.Enable() 572 309 self.structurebox.Enable() … … 578 315 # Maximum value of data 579 316 data_max = max(self.data.x) 580 """581 #number of total data points582 self.Npts_total.SetValue(str(len(self.data.x)))583 #default:number of data points selected to fit584 self.Npts_fit.SetValue(str(len(self.data.x)))585 """586 317 self.btEditMask.Disable() 587 318 self.EditMask_title.Disable() … … 594 325 ## Maximum value of data 595 326 data_max = math.sqrt(x*x + y*y) 596 """597 #number of total data points598 self.Npts_total.SetValue(str(len(self.data.data)))599 #default:number of data points selected to fit600 self.Npts_fit.SetValue(str(len(self.data.data)))601 """602 327 self.btEditMask.Enable() 603 328 self.EditMask_title.Enable() 604 """ 605 self.Npts_total.SetEditable(False) 606 self.Npts_total.SetBackgroundColour(\ 607 self.GetParent().GetBackgroundColour()) 608 609 self.Npts_total.Bind(wx.EVT_MOUSE_EVENTS, self._npts_click) 610 #self.Npts_total.Disable() 611 """ 329 612 330 self.dataSource.SetValue(data_name) 613 331 self.qmin_x = data_min … … 635 353 self.model_view.Disable() 636 354 637 #replace data plot on combo box selection638 #by removing the previous selected data639 #wx.PostEvent(self._manager.parent, NewPlotEvent(action="remove",640 # group_id=group_id, id=id))641 355 wx.PostEvent(self._manager.parent, 642 356 NewPlotEvent(group_id=group_id, … … 644 358 #plot the current selected data 645 359 wx.PostEvent(self._manager.parent, NewPlotEvent(plot=self.data, 646 360 title=str(self.data.title))) 647 361 self._manager.store_data(uid=self.uid, data=data, 648 362 data_list=self.data_list,
Note: See TracChangeset
for help on using the changeset viewer.