[c77d859] | 1 | import sys |
---|
| 2 | import wx |
---|
| 3 | import wx.lib.newevent |
---|
| 4 | import numpy |
---|
| 5 | import copy |
---|
| 6 | import math |
---|
| 7 | from sans.models.dispersion_models import ArrayDispersion, GaussianDispersion |
---|
| 8 | |
---|
| 9 | from sans.guicomm.events import StatusEvent |
---|
| 10 | from sans.guiframe.utils import format_number |
---|
[77e23a2] | 11 | |
---|
[b787e68c] | 12 | ## event to post model to fit to fitting plugins |
---|
[c77d859] | 13 | (ModelEventbox, EVT_MODEL_BOX) = wx.lib.newevent.NewEvent() |
---|
[b787e68c] | 14 | |
---|
| 15 | ## event to know the selected fit engine |
---|
[77e23a2] | 16 | (FitterTypeEvent, EVT_FITTER_TYPE) = wx.lib.newevent.NewEvent() |
---|
[c77d859] | 17 | _BOX_WIDTH = 80 |
---|
| 18 | |
---|
| 19 | import basepage |
---|
| 20 | from basepage import BasicPage |
---|
[b787e68c] | 21 | from basepage import PageInfoEvent |
---|
[c77d859] | 22 | |
---|
| 23 | |
---|
| 24 | class FitPage(BasicPage): |
---|
| 25 | """ |
---|
| 26 | FitPanel class contains fields allowing to display results when |
---|
| 27 | fitting a model and one data |
---|
| 28 | @note: For Fit to be performed the user should check at least one parameter |
---|
| 29 | on fit Panel window. |
---|
| 30 | |
---|
| 31 | """ |
---|
[cfc0913] | 32 | def __init__(self,parent, page_info): |
---|
| 33 | BasicPage.__init__(self, parent, page_info) |
---|
[c77d859] | 34 | """ |
---|
| 35 | Initialization of the Panel |
---|
| 36 | """ |
---|
| 37 | ## fit page does not content npts txtcrtl |
---|
| 38 | self.npts=None |
---|
| 39 | ## if no dispersity parameters is avaible |
---|
| 40 | self.text_disp_1=None |
---|
[dcf29d7] | 41 | ## default fitengine type |
---|
| 42 | self.engine_type = "scipy" |
---|
[b787e68c] | 43 | ## draw sizer |
---|
[c77d859] | 44 | self._fill_datainfo_sizer() |
---|
| 45 | self._fill_model_sizer( self.sizer1) |
---|
[59a7f2d] | 46 | self._on_select_model(event=None) |
---|
[cfc0913] | 47 | self._fill_range_sizer() |
---|
[b787e68c] | 48 | |
---|
[cfc0913] | 49 | ## to update the panel according to the fit engine type selected |
---|
[77e23a2] | 50 | self.Bind(EVT_FITTER_TYPE,self._on_engine_change) |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | def _on_engine_change(self, event): |
---|
| 54 | """ |
---|
| 55 | get an event containing the current name of the fit engine type |
---|
| 56 | @param event: FitterTypeEvent containing the name of the current engine |
---|
| 57 | """ |
---|
[dcf29d7] | 58 | self.engine_type = event.type |
---|
| 59 | |
---|
[77e23a2] | 60 | if len(self.parameters)==0: |
---|
| 61 | return |
---|
| 62 | for item in self.parameters: |
---|
| 63 | if event.type =="scipy": |
---|
| 64 | item[5].SetValue(format_number("")) |
---|
| 65 | item[5].Hide() |
---|
| 66 | item[6].SetValue(format_number("")) |
---|
| 67 | item[6].Hide() |
---|
| 68 | self.text2_min.Hide() |
---|
| 69 | self.text2_max.Hide() |
---|
| 70 | else: |
---|
| 71 | item[5].Show(True) |
---|
| 72 | item[6].Show(True) |
---|
| 73 | self.text2_min.Show(True) |
---|
| 74 | self.text2_max.Show(True) |
---|
| 75 | |
---|
| 76 | self.sizer3.Layout() |
---|
| 77 | self.SetScrollbars(20,20,200,100) |
---|
[c77d859] | 78 | |
---|
| 79 | |
---|
| 80 | def _fill_range_sizer(self): |
---|
| 81 | """ |
---|
| 82 | Fill the sizer containing the plotting range |
---|
| 83 | add access to npts |
---|
| 84 | """ |
---|
[1ae3fe1] | 85 | sizer_fit = wx.GridSizer(1, 1,0, 0) |
---|
[c77d859] | 86 | |
---|
| 87 | self.btFit = wx.Button(self,wx.NewId(),'Fit') |
---|
| 88 | self.btFit.Bind(wx.EVT_BUTTON, self._onFit,id= self.btFit.GetId()) |
---|
| 89 | self.btFit.SetToolTipString("Perform fit.") |
---|
[2d5f7a1] | 90 | |
---|
[c77d859] | 91 | |
---|
| 92 | sizer_fit.Add((5,5),1, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5) |
---|
[1ae3fe1] | 93 | sizer_fit.Add(self.btFit,0, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5) |
---|
[c77d859] | 94 | |
---|
| 95 | sizer_smearer = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 96 | #Filling the sizer containing instruments smearing info. |
---|
| 97 | self.disable_smearer = wx.RadioButton(self, -1, 'No', style=wx.RB_GROUP) |
---|
| 98 | self.enable_smearer = wx.RadioButton(self, -1, 'Yes') |
---|
| 99 | self.Bind(wx.EVT_RADIOBUTTON, self.onSmear, id=self.disable_smearer.GetId()) |
---|
| 100 | self.Bind(wx.EVT_RADIOBUTTON, self.onSmear, id=self.enable_smearer.GetId()) |
---|
| 101 | |
---|
| 102 | sizer_smearer.Add(wx.StaticText(self,-1,'Instrument Smearing? ')) |
---|
| 103 | sizer_smearer.Add((10, 10)) |
---|
| 104 | sizer_smearer.Add( self.enable_smearer ) |
---|
| 105 | sizer_smearer.Add((10,10)) |
---|
| 106 | sizer_smearer.Add( self.disable_smearer ) |
---|
| 107 | |
---|
| 108 | self._set_range_sizer( title="Fitted Q Range", |
---|
| 109 | object1=sizer_smearer, object= sizer_fit) |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | def _fill_datainfo_sizer(self): |
---|
| 113 | """ |
---|
| 114 | fill sizer 0 with data info |
---|
| 115 | """ |
---|
| 116 | self.sizer0.Clear(True) |
---|
| 117 | ## no loaded data , don't fill the sizer |
---|
| 118 | if self.data== None: |
---|
| 119 | self.sizer0.Layout() |
---|
| 120 | return |
---|
| 121 | |
---|
| 122 | box_description= wx.StaticBox(self, -1, 'Loaded Data') |
---|
| 123 | boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) |
---|
| 124 | #---------------------------------------------------------- |
---|
| 125 | sizer_data = wx.GridSizer(3, 3,5, 5) |
---|
| 126 | #Filling the sizer containing data related fields |
---|
| 127 | DataSource =wx.StaticText(self, -1,str(self.data.name)) |
---|
| 128 | |
---|
| 129 | sizer_data.Add(wx.StaticText(self, -1, 'Data Source Name : ')) |
---|
| 130 | sizer_data.Add(DataSource ) |
---|
| 131 | sizer_data.Add( (5,5) ) |
---|
| 132 | |
---|
| 133 | #---------sizer 2 draw-------------------------------- |
---|
| 134 | #set maximum range for x in linear scale |
---|
| 135 | if not hasattr(self.data,"data"): #Display only for 1D data fit |
---|
| 136 | # Minimum value of data |
---|
| 137 | data_min = str(format_number(numpy.min(self.data.x))) |
---|
| 138 | # Maximum value of data |
---|
| 139 | data_max = str(format_number(numpy.max(self.data.x))) |
---|
| 140 | text4_3 = wx.StaticText(self, -1, 'Maximum Q Range(Linear)', |
---|
| 141 | style=wx.ALIGN_LEFT) |
---|
| 142 | sizer_data.Add( text4_3 ) |
---|
| 143 | sizer_data.Add(wx.StaticText(self, -1, "Min : %s"%data_min)) |
---|
| 144 | sizer_data.Add(wx.StaticText(self, -1, "Max : %s"%data_max)) |
---|
| 145 | |
---|
| 146 | else: |
---|
| 147 | radius_min= 0 |
---|
| 148 | x= numpy.max(self.data.xmin, self.data.xmax) |
---|
| 149 | y= numpy.max(self.data.ymin, self.data.ymax) |
---|
| 150 | radius_max = math.sqrt(x*x + y*y) |
---|
| 151 | # Minimum value of data |
---|
| 152 | data_min = str(format_number(radius_min)) |
---|
| 153 | # Maximum value of data |
---|
| 154 | data_max = str(format_number(radius_max)) |
---|
| 155 | text4_3 = wx.StaticText(self, -1, 'Maximum Q Range', |
---|
| 156 | style=wx.ALIGN_LEFT) |
---|
| 157 | sizer_data.Add( text4_3 ) |
---|
| 158 | sizer_data.Add(wx.StaticText(self, -1, "Min : %s"%data_min)) |
---|
| 159 | sizer_data.Add(wx.StaticText(self, -1, "Max : %s"%data_max)) |
---|
| 160 | |
---|
| 161 | boxsizer1.Add(sizer_data) |
---|
| 162 | #------------------------------------------------------------ |
---|
| 163 | self.sizer0.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) |
---|
| 164 | self.sizer0.Layout() |
---|
| 165 | |
---|
| 166 | self.qmin_x= data_min |
---|
| 167 | self.qmax_x= data_max |
---|
| 168 | |
---|
[376916c] | 169 | |
---|
[c77d859] | 170 | def _fill_model_sizer(self, sizer): |
---|
| 171 | """ |
---|
| 172 | fill sizer containing model info |
---|
| 173 | """ |
---|
| 174 | sizer_tcChi = wx.GridSizer(2, 2,5, 5) |
---|
[6355f4d] | 175 | self.tcChi = wx.StaticText(self, -1, "-", style=wx.ALIGN_LEFT) |
---|
| 176 | |
---|
[c77d859] | 177 | |
---|
| 178 | self.text1_1 = wx.StaticText(self, -1, 'Chi2/dof', style=wx.ALIGN_LEFT) |
---|
[6355f4d] | 179 | |
---|
[c77d859] | 180 | |
---|
| 181 | self.btChi = wx.Button(self,wx.NewId(),'View Chi') |
---|
| 182 | self.btChi.Bind(wx.EVT_BUTTON, self._onFit,id= self.btChi.GetId()) |
---|
| 183 | self.btChi.SetToolTipString("View data - model.") |
---|
| 184 | |
---|
| 185 | sizer_tcChi.Add(self.text1_1,1, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5) |
---|
| 186 | sizer_tcChi.Add(self.btChi,1, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5) |
---|
| 187 | sizer_tcChi.Add(self.tcChi,1, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5) |
---|
| 188 | sizer_tcChi.Add((5,5),1, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5) |
---|
| 189 | |
---|
| 190 | ## class base method to add view 2d button |
---|
| 191 | self._set_model_sizer(sizer=sizer, title="Model",object= sizer_tcChi ) |
---|
| 192 | |
---|
| 193 | |
---|
| 194 | def _set_sizer_gaussian(self): |
---|
| 195 | """ |
---|
| 196 | draw sizer with gaussian dispersity parameters |
---|
| 197 | """ |
---|
| 198 | self.fittable_param=[] |
---|
| 199 | self.fixed_param=[] |
---|
[376916c] | 200 | |
---|
[c77d859] | 201 | self.sizer4_4.Clear(True) |
---|
| 202 | |
---|
| 203 | if self.model==None: |
---|
| 204 | ##no model is selected |
---|
| 205 | return |
---|
| 206 | if not self.enable_disp.GetValue(): |
---|
| 207 | ## the user didn't select dispersity display |
---|
| 208 | return |
---|
[376916c] | 209 | |
---|
| 210 | self._reset_dispersity() |
---|
| 211 | # Create the dispersion objects |
---|
| 212 | for item in self.model.dispersion.keys(): |
---|
| 213 | disp_model = GaussianDispersion() |
---|
| 214 | self._disp_obj_dict[item] = disp_model |
---|
| 215 | self.model.set_dispersion(item, disp_model) |
---|
| 216 | |
---|
[c77d859] | 217 | ix=0 |
---|
| 218 | iy=1 |
---|
| 219 | disp = wx.StaticText(self, -1, 'Names') |
---|
| 220 | self.sizer4_4.Add(disp,( iy, ix),(1,1), |
---|
| 221 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 222 | ix += 1 |
---|
| 223 | values = wx.StaticText(self, -1, 'Values') |
---|
| 224 | self.sizer4_4.Add(values,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 225 | ix +=2 |
---|
| 226 | self.text_disp_1 = wx.StaticText(self, -1, 'Errors') |
---|
| 227 | self.sizer4_4.Add( self.text_disp_1,(iy, ix),(1,1),\ |
---|
| 228 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 229 | self.text_disp_1.Hide() |
---|
| 230 | ix += 1 |
---|
| 231 | npts = wx.StaticText(self, -1, 'Npts') |
---|
| 232 | self.sizer4_4.Add(npts,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 233 | ix += 1 |
---|
| 234 | nsigmas = wx.StaticText(self, -1, 'Nsigmas') |
---|
| 235 | self.sizer4_4.Add(nsigmas,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 236 | |
---|
| 237 | for item in self.model.dispersion.keys(): |
---|
[376916c] | 238 | self.disp_cb_dict[item]= None |
---|
[c77d859] | 239 | name1=item+".width" |
---|
| 240 | name2=item+".npts" |
---|
| 241 | name3=item+".nsigmas" |
---|
| 242 | iy += 1 |
---|
| 243 | for p in self.model.dispersion[item].keys(): |
---|
| 244 | |
---|
| 245 | if p=="width": |
---|
| 246 | ix = 0 |
---|
| 247 | cb = wx.CheckBox(self, -1, name1, (10, 10)) |
---|
| 248 | wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) |
---|
| 249 | |
---|
| 250 | self.sizer4_4.Add( cb,( iy, ix),(1,1), |
---|
| 251 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 252 | ix = 1 |
---|
| 253 | value= self.model.getParam(name1) |
---|
| 254 | ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), |
---|
| 255 | style=wx.TE_PROCESS_ENTER) |
---|
| 256 | |
---|
| 257 | ctl1.SetValue(str (format_number(value))) |
---|
[1328e03] | 258 | ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) |
---|
[77e23a2] | 259 | ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) |
---|
[c77d859] | 260 | ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 261 | self.sizer4_4.Add(ctl1, (iy,ix),(1,1),wx.EXPAND) |
---|
| 262 | |
---|
| 263 | ## text to show error sign |
---|
| 264 | ix = 2 |
---|
| 265 | text2=wx.StaticText(self, -1, '+/-') |
---|
| 266 | self.sizer4_4.Add(text2,(iy, ix),(1,1), |
---|
| 267 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 268 | text2.Hide() |
---|
| 269 | ## txtcrtl to add error from fit |
---|
| 270 | ix = 3 |
---|
| 271 | ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) |
---|
| 272 | self.sizer4_4.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 273 | ctl2.Hide() |
---|
| 274 | |
---|
| 275 | self.fittable_param.append([cb,name1,ctl1,text2, |
---|
| 276 | ctl2, None, None,None]) |
---|
| 277 | elif p=="npts": |
---|
| 278 | ix = 4 |
---|
| 279 | value= self.model.getParam(name2) |
---|
| 280 | Tctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), |
---|
| 281 | style=wx.TE_PROCESS_ENTER) |
---|
| 282 | |
---|
| 283 | Tctl.SetValue(str (format_number(value))) |
---|
[1328e03] | 284 | Tctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) |
---|
[77e23a2] | 285 | Tctl.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) |
---|
[c77d859] | 286 | Tctl.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 287 | self.sizer4_4.Add(Tctl, (iy,ix),(1,1), |
---|
| 288 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 289 | |
---|
| 290 | self.fixed_param.append([None,name2, Tctl,None,None, |
---|
| 291 | None, None,None]) |
---|
| 292 | |
---|
| 293 | elif p=="nsigmas": |
---|
| 294 | ix = 5 |
---|
| 295 | value= self.model.getParam(name3) |
---|
| 296 | Tctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), |
---|
| 297 | style=wx.TE_PROCESS_ENTER) |
---|
| 298 | Tctl.SetValue(str (format_number(value))) |
---|
[1328e03] | 299 | Tctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) |
---|
[77e23a2] | 300 | Tctl.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) |
---|
[c77d859] | 301 | Tctl.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 302 | self.sizer4_4.Add(Tctl, (iy,ix),(1,1), |
---|
| 303 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 304 | ix +=1 |
---|
| 305 | self.sizer4_4.Add((20,20), (iy,ix),(1,1), |
---|
| 306 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 307 | |
---|
| 308 | self.fixed_param.append([None,name3, Tctl |
---|
| 309 | ,None,None, None, None,None]) |
---|
| 310 | |
---|
| 311 | wx.PostEvent(self.parent, StatusEvent(status=\ |
---|
| 312 | " Selected Distribution: Gaussian")) |
---|
| 313 | ix =0 |
---|
| 314 | iy +=1 |
---|
| 315 | self.sizer4_4.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 316 | self.sizer4_4.Layout() |
---|
| 317 | self.sizer4.Layout() |
---|
| 318 | self.SetScrollbars(20,20,200,100) |
---|
[0a518e4c] | 319 | |
---|
[c77d859] | 320 | |
---|
| 321 | def _onFit(self, event): |
---|
| 322 | """ |
---|
| 323 | Allow to fit |
---|
| 324 | """ |
---|
[1ae3fe1] | 325 | #self.btFit.SetLabel("Stop") |
---|
[c77d859] | 326 | from sans.guiframe.utils import check_value |
---|
| 327 | flag = check_value( self.qmin, self.qmax) |
---|
| 328 | |
---|
| 329 | if not flag: |
---|
| 330 | msg= "Fitting range invalid" |
---|
| 331 | wx.PostEvent(self.parent.parent, StatusEvent(status= msg )) |
---|
| 332 | return |
---|
| 333 | |
---|
| 334 | if len(self.param_toFit) <= 0: |
---|
| 335 | msg= "Select at least one parameter to fit" |
---|
| 336 | wx.PostEvent(self.parent.parent, StatusEvent(status= msg )) |
---|
| 337 | return |
---|
| 338 | |
---|
| 339 | self.qmin_x=float(self.qmin.GetValue()) |
---|
| 340 | self.qmax_x =float( self.qmax.GetValue()) |
---|
[6f023e8] | 341 | self.manager._reset_schedule_problem( value=0) |
---|
[ca7a626] | 342 | self.manager.schedule_for_fit( value=1,page=self,fitproblem =None) |
---|
| 343 | self.manager.set_fit_range(page= self,qmin= self.qmin_x, qmax= self.qmax_x) |
---|
[c77d859] | 344 | #single fit |
---|
[ca7a626] | 345 | self.manager.onFit() |
---|
[c77d859] | 346 | |
---|
| 347 | self.sizer5.Layout() |
---|
| 348 | self.SetScrollbars(20,20,55,40) |
---|
| 349 | |
---|
| 350 | |
---|
| 351 | def _on_select_model(self, event): |
---|
| 352 | """ |
---|
| 353 | call back for model selection |
---|
| 354 | """ |
---|
[59a7f2d] | 355 | self._on_select_model_helper() |
---|
[c77d859] | 356 | self.set_model_param_sizer(self.model) |
---|
| 357 | try: |
---|
| 358 | self.compute_chisqr() |
---|
| 359 | except: |
---|
| 360 | ## error occured on chisqr computation |
---|
| 361 | pass |
---|
[3b605bb] | 362 | self.enable_disp.SetValue(False) |
---|
| 363 | self.disable_disp.SetValue(True) |
---|
| 364 | self._set_dipers_Param(event=None) |
---|
| 365 | |
---|
| 366 | evt = ModelEventbox(model=self.model) |
---|
| 367 | wx.PostEvent(self.event_owner, evt) |
---|
| 368 | |
---|
[a074145] | 369 | |
---|
[dd5949d] | 370 | def _onparamEnter(self,event): |
---|
| 371 | """ |
---|
| 372 | when enter value on panel redraw model according to changed |
---|
| 373 | """ |
---|
| 374 | self._onparamEnter_helper() |
---|
| 375 | self.compute_chisqr() |
---|
| 376 | |
---|
[cfc0913] | 377 | |
---|
[a074145] | 378 | def reset_page(self, state): |
---|
| 379 | """ |
---|
| 380 | reset the state |
---|
| 381 | """ |
---|
| 382 | self.reset_page_helper(state) |
---|
| 383 | evt = ModelEventbox(model=self.model) |
---|
| 384 | wx.PostEvent(self.event_owner, evt) |
---|
| 385 | |
---|
| 386 | |
---|
[2140e68] | 387 | def get_range(self): |
---|
| 388 | """ |
---|
| 389 | return the fitting range |
---|
| 390 | """ |
---|
[c9a4377] | 391 | return float(self.qmin_x) , float(self.qmax_x) |
---|
[c77d859] | 392 | |
---|
| 393 | def get_param_list(self): |
---|
| 394 | """ |
---|
| 395 | @return self.param_toFit: list containing references to TextCtrl |
---|
| 396 | checked.Theses TextCtrl will allow reference to parameters to fit. |
---|
| 397 | @raise: if return an empty list of parameter fit will nnote work |
---|
| 398 | properly so raise ValueError,"missing parameter to fit" |
---|
| 399 | """ |
---|
| 400 | if self.param_toFit !=[]: |
---|
| 401 | return self.param_toFit |
---|
| 402 | else: |
---|
| 403 | raise ValueError,"missing parameter to fit" |
---|
| 404 | |
---|
| 405 | def onsetValues(self,chisqr, out,cov): |
---|
| 406 | """ |
---|
| 407 | Build the panel from the fit result |
---|
| 408 | @param chisqr:Value of the goodness of fit metric |
---|
| 409 | @param out:list of parameter with the best value found during fitting |
---|
| 410 | @param cov:Covariance matrix |
---|
| 411 | |
---|
| 412 | """ |
---|
| 413 | self.tcChi.SetLabel(format_number(chisqr)) |
---|
| 414 | params = {} |
---|
| 415 | is_modified = False |
---|
| 416 | has_error = False |
---|
[0a518e4c] | 417 | self.text2_3.Hide() |
---|
| 418 | if self.text_disp_1 !=None: |
---|
| 419 | self.text_disp_1.Hide() |
---|
[c77d859] | 420 | #set the panel when fit result are float not list |
---|
| 421 | if out.__class__==numpy.float64: |
---|
| 422 | self.param_toFit[0][2].SetValue(format_number(out)) |
---|
| 423 | self.param_toFit[0][2].Refresh() |
---|
[0a518e4c] | 424 | |
---|
| 425 | self.param_toFit[0][4].Clear() |
---|
| 426 | self.param_toFit[0][4].Hide() |
---|
[c77d859] | 427 | if cov !=None : |
---|
| 428 | self.text2_3.Show(True) |
---|
[0a518e4c] | 429 | if self.text_disp_1 !=None: |
---|
[c77d859] | 430 | self.text_disp_1.Show(True) |
---|
| 431 | |
---|
| 432 | self.param_toFit[0][3].Show(True) |
---|
| 433 | self.param_toFit[0][4].Clear() |
---|
| 434 | self.param_toFit[0][4].SetValue(format_number(cov[0])) |
---|
| 435 | self.param_toFit[0][4].Show(True) |
---|
| 436 | else: |
---|
| 437 | i=0 |
---|
| 438 | j=0 |
---|
| 439 | #Set the panel when fit result are list |
---|
| 440 | for item in self.param_toFit: |
---|
[0a518e4c] | 441 | ## reset error value to initial state |
---|
| 442 | item[4].Clear() |
---|
| 443 | item[4].Hide() |
---|
| 444 | item[4].Refresh() |
---|
[c77d859] | 445 | if( out != None ) and len(out)<=len(self.param_toFit)and i < len(out): |
---|
| 446 | item[2].SetValue(format_number(self.model.getParam(item[1]))) |
---|
| 447 | item[2].Refresh() |
---|
| 448 | if(cov !=None)and len(cov)<=len(self.param_toFit)and i < len(cov): |
---|
| 449 | self.text2_3.Show(True) |
---|
| 450 | if self.text_disp_1!=None: |
---|
| 451 | self.text_disp_1.Show(True) |
---|
| 452 | item[3].Show(True) |
---|
| 453 | item[4].Clear() |
---|
| 454 | for j in range(len(out)): |
---|
| 455 | if out[j]==self.model.getParam(item[1]): |
---|
| 456 | break |
---|
| 457 | item[4].SetValue(format_number(cov[j])) |
---|
| 458 | item[4].Refresh() |
---|
| 459 | item[4].Show(True) |
---|
| 460 | i+=1 |
---|
| 461 | |
---|
| 462 | self.sizer3.Layout() |
---|
| 463 | self.sizer4.Layout() |
---|
| 464 | self.SetScrollbars(20,20,200,100) |
---|
| 465 | |
---|
| 466 | |
---|
| 467 | |
---|
| 468 | def onSmear(self, event): |
---|
| 469 | """ |
---|
| 470 | Create a smear object that will change the way residuals |
---|
| 471 | are compute when fitting |
---|
| 472 | """ |
---|
| 473 | smear =None |
---|
| 474 | msg="" |
---|
| 475 | if self.enable_smearer.GetValue(): |
---|
| 476 | from DataLoader.qsmearing import smear_selection |
---|
[2140e68] | 477 | smear = smear_selection( self.data ) |
---|
[c77d859] | 478 | if hasattr(self.data,"dxl"): |
---|
| 479 | msg= ": Resolution smearing parameters" |
---|
| 480 | if hasattr(self.data,"dxw"): |
---|
| 481 | msg= ": Slit smearing parameters" |
---|
| 482 | if smear ==None: |
---|
| 483 | wx.PostEvent(self.manager.parent, StatusEvent(status=\ |
---|
| 484 | "Data contains no smearing information")) |
---|
| 485 | else: |
---|
| 486 | wx.PostEvent(self.manager.parent, StatusEvent(status=\ |
---|
| 487 | "Data contains smearing information %s"%msg)) |
---|
[b787e68c] | 488 | self.manager.set_smearer(smear, qmin= float(self.qmin_x), |
---|
| 489 | qmax= float(self.qmax_x)) |
---|
[cfc0913] | 490 | ## save the state enable smearing |
---|
| 491 | self.save_current_state() |
---|
[b787e68c] | 492 | |
---|
[dd5949d] | 493 | |
---|
[c77d859] | 494 | def compute_chisqr2D(self): |
---|
| 495 | """ |
---|
| 496 | compute chi square given a model and data 2D and set the value |
---|
| 497 | to the tcChi txtcrl |
---|
| 498 | """ |
---|
| 499 | from sans.guiframe.utils import check_value |
---|
| 500 | flag = check_value( self.qmin, self.qmax) |
---|
| 501 | |
---|
| 502 | res=[] |
---|
| 503 | if flag== True: |
---|
| 504 | try: |
---|
| 505 | self.qmin_x = float(self.qmin.GetValue()) |
---|
| 506 | self.qmax_x = float(self.qmax.GetValue()) |
---|
| 507 | for i in range(len(self.data.x_bins)): |
---|
| 508 | for j in range(len(self.data.y_bins)): |
---|
| 509 | #Check the range containing data between self.qmin_x and self.qmax_x |
---|
| 510 | if math.pow(self.data.x_bins[i],2)+math.pow(self.data.y_bins[j],2)>=math.pow(self.qmin_x,2): |
---|
| 511 | if math.pow(self.data.x_bins[i],2)+math.pow(self.data.y_bins[j],2)<=math.pow(self.qmax_x,2): |
---|
| 512 | chisqrji=(self.data.data[j][i]- self.model.runXY(\ |
---|
[9619367] | 513 | [self.data.x_bins[i],self.data.y_bins[j]]))\ |
---|
[c77d859] | 514 | /self.data.err_data[j][i] |
---|
| 515 | #Vector containing residuals |
---|
| 516 | res.append( math.pow(chisqrji,2) ) |
---|
| 517 | # compute sum of residual |
---|
| 518 | sum=0 |
---|
| 519 | for item in res: |
---|
| 520 | if numpy.isfinite(item): |
---|
| 521 | sum +=item |
---|
| 522 | self.tcChi.SetLabel(format_number(math.fabs(sum/ len(res)))) |
---|
| 523 | except: |
---|
| 524 | wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ |
---|
| 525 | "Chisqr cannot be compute: %s"% sys.exc_value)) |
---|
| 526 | return |
---|
| 527 | |
---|
| 528 | |
---|
| 529 | def compute_chisqr(self): |
---|
| 530 | """ |
---|
| 531 | compute chi square given a model and data 1D and set the value |
---|
| 532 | to the tcChi txtcrl |
---|
| 533 | """ |
---|
| 534 | from sans.guiframe.utils import check_value |
---|
| 535 | flag = check_value( self.qmin, self.qmax) |
---|
| 536 | |
---|
| 537 | if flag== True: |
---|
| 538 | try: |
---|
| 539 | if hasattr(self.data,"data"): |
---|
| 540 | self.compute_chisqr2D() |
---|
| 541 | return |
---|
| 542 | else: |
---|
| 543 | self.qmin_x = float(self.qmin.GetValue()) |
---|
| 544 | self.qmax_x = float(self.qmax.GetValue()) |
---|
| 545 | # return residuals within self.qmin_x and self.qmax_x |
---|
| 546 | x,y,dy = [numpy.asarray(v) for v in (self.data.x,self.data.y,self.data.dy)] |
---|
| 547 | if self.qmin_x==None and self.qmax_x==None: |
---|
| 548 | fx =numpy.asarray([self.model.run(v) for v in x]) |
---|
| 549 | temp=(y - fx)/dy |
---|
| 550 | res= temp*temp |
---|
| 551 | else: |
---|
| 552 | idx = (x>= self.qmin_x) & (x <=self.qmax_x) |
---|
| 553 | fx = numpy.asarray([self.model.run(item)for item in x[idx ]]) |
---|
| 554 | temp=(y[idx] - fx)/dy[idx] |
---|
| 555 | res= temp*temp |
---|
| 556 | #sum of residuals |
---|
| 557 | sum=0 |
---|
| 558 | for item in res: |
---|
| 559 | if numpy.isfinite(item): |
---|
| 560 | sum +=item |
---|
| 561 | self.tcChi.SetLabel(format_number(math.fabs(sum/ len(res)))) |
---|
| 562 | except: |
---|
| 563 | wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ |
---|
| 564 | "Chisqr cannot be compute: %s"% sys.exc_value)) |
---|
| 565 | return |
---|
| 566 | |
---|
| 567 | |
---|
| 568 | def select_all_param(self,event): |
---|
| 569 | """ |
---|
| 570 | set to true or false all checkBox given the main checkbox value cb1 |
---|
| 571 | """ |
---|
| 572 | self.param_toFit=[] |
---|
[cfc0913] | 573 | |
---|
[c77d859] | 574 | if self.parameters !=[]: |
---|
| 575 | if self.cb1.GetValue()==True: |
---|
| 576 | for item in self.parameters: |
---|
| 577 | item[0].SetValue(True) |
---|
| 578 | self.param_toFit.append(item ) |
---|
| 579 | if len(self.fittable_param)>0: |
---|
| 580 | for item in self.fittable_param: |
---|
| 581 | item[0].SetValue(True) |
---|
| 582 | self.param_toFit.append(item ) |
---|
| 583 | else: |
---|
| 584 | for item in self.parameters: |
---|
| 585 | item[0].SetValue(False) |
---|
| 586 | for item in self.fittable_param: |
---|
| 587 | item[0].SetValue(False) |
---|
| 588 | self.param_toFit=[] |
---|
[cfc0913] | 589 | self.save_current_state() |
---|
| 590 | |
---|
[c77d859] | 591 | |
---|
| 592 | |
---|
| 593 | def select_param(self,event): |
---|
| 594 | """ |
---|
| 595 | Select TextCtrl checked for fitting purpose and stores them |
---|
| 596 | in self.param_toFit=[] list |
---|
| 597 | """ |
---|
| 598 | self.param_toFit=[] |
---|
| 599 | for item in self.parameters: |
---|
| 600 | #Select parameters to fit for list of primary parameters |
---|
| 601 | if item[0].GetValue()==True: |
---|
| 602 | if not (item in self.param_toFit): |
---|
| 603 | self.param_toFit.append(item ) |
---|
| 604 | else: |
---|
| 605 | #remove parameters from the fitting list |
---|
| 606 | if item in self.param_toFit: |
---|
| 607 | self.param_toFit.remove(item) |
---|
| 608 | #Select parameters to fit for list of fittable parameters with dispersion |
---|
| 609 | for item in self.fittable_param: |
---|
| 610 | if item[0].GetValue()==True: |
---|
| 611 | if not (item in self.param_toFit): |
---|
| 612 | self.param_toFit.append(item) |
---|
| 613 | else: |
---|
| 614 | #remove parameters from the fitting list |
---|
| 615 | if item in self.param_toFit: |
---|
| 616 | self.param_toFit.remove(item) |
---|
| 617 | #Set the value of checkbox that selected every checkbox or not |
---|
| 618 | if len(self.parameters)+len(self.fittable_param) ==len(self.param_toFit): |
---|
| 619 | self.cb1.SetValue(True) |
---|
| 620 | else: |
---|
| 621 | self.cb1.SetValue(False) |
---|
[cfc0913] | 622 | ## save current state of the page |
---|
| 623 | self.save_current_state() |
---|
| 624 | |
---|
[c77d859] | 625 | |
---|
| 626 | |
---|
[77e23a2] | 627 | def set_model_param_sizer(self, model): |
---|
[c77d859] | 628 | """ |
---|
| 629 | Build the panel from the model content |
---|
| 630 | @param model: the model selected in combo box for fitting purpose |
---|
| 631 | """ |
---|
| 632 | self.sizer3.Clear(True) |
---|
| 633 | self.parameters = [] |
---|
[cfc0913] | 634 | #self.page_info.parameters=[] |
---|
[c77d859] | 635 | self.param_toFit=[] |
---|
| 636 | self.fittable_param=[] |
---|
| 637 | self.fixed_param=[] |
---|
| 638 | |
---|
| 639 | if model ==None: |
---|
| 640 | self.sizer3.Layout() |
---|
| 641 | self.SetScrollbars(20,20,200,100) |
---|
| 642 | return |
---|
| 643 | box_description= wx.StaticBox(self, -1,str("Model Parameters")) |
---|
| 644 | boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) |
---|
| 645 | sizer = wx.GridBagSizer(5,5) |
---|
| 646 | ## save the current model |
---|
| 647 | self.model = model |
---|
| 648 | |
---|
| 649 | keys = self.model.getParamList() |
---|
| 650 | #list of dispersion paramaters |
---|
| 651 | self.disp_list=self.model.getDispParamList() |
---|
| 652 | |
---|
| 653 | keys.sort() |
---|
| 654 | |
---|
| 655 | iy = 1 |
---|
| 656 | ix = 0 |
---|
| 657 | self.cb1 = wx.CheckBox(self, -1,"Select all", (10, 10)) |
---|
| 658 | wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_param) |
---|
| 659 | self.cb1.SetValue(False) |
---|
| 660 | |
---|
| 661 | sizer.Add(self.cb1,(iy, ix),(1,1),\ |
---|
| 662 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 663 | ix +=1 |
---|
| 664 | self.text2_2 = wx.StaticText(self, -1, 'Values') |
---|
| 665 | sizer.Add(self.text2_2,(iy, ix),(1,1),\ |
---|
| 666 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 667 | ix +=2 |
---|
| 668 | self.text2_3 = wx.StaticText(self, -1, 'Errors') |
---|
| 669 | sizer.Add(self.text2_3,(iy, ix),(1,1),\ |
---|
| 670 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 671 | self.text2_3.Hide() |
---|
| 672 | ix +=1 |
---|
| 673 | self.text2_min = wx.StaticText(self, -1, 'Min') |
---|
| 674 | sizer.Add(self.text2_min,(iy, ix),(1,1),\ |
---|
| 675 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 676 | self.text2_min.Hide() |
---|
| 677 | ix +=1 |
---|
| 678 | self.text2_max = wx.StaticText(self, -1, 'Max') |
---|
| 679 | sizer.Add(self.text2_max,(iy, ix),(1,1),\ |
---|
| 680 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 681 | self.text2_max.Hide() |
---|
| 682 | ix += 1 |
---|
| 683 | self.text2_4 = wx.StaticText(self, -1, 'Units') |
---|
| 684 | sizer.Add(self.text2_4,(iy, ix),(1,1),\ |
---|
| 685 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 686 | self.text2_4.Hide() |
---|
[dcf29d7] | 687 | if self.engine_type=="park": |
---|
| 688 | self.text2_max.Show(True) |
---|
| 689 | self.text2_min.Show(True) |
---|
[c77d859] | 690 | |
---|
| 691 | for item in keys: |
---|
| 692 | if not item in self.disp_list: |
---|
| 693 | iy += 1 |
---|
| 694 | ix = 0 |
---|
| 695 | ## add parameters name with checkbox for selecting to fit |
---|
| 696 | cb = wx.CheckBox(self, -1, item ) |
---|
| 697 | cb.SetValue(False) |
---|
| 698 | wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) |
---|
| 699 | sizer.Add( cb,( iy, ix),(1,1), |
---|
| 700 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 701 | ## add parameter value |
---|
| 702 | ix += 1 |
---|
| 703 | value= self.model.getParam(item) |
---|
| 704 | ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), |
---|
| 705 | style=wx.TE_PROCESS_ENTER) |
---|
| 706 | |
---|
[77e23a2] | 707 | ctl1.SetValue(format_number(value)) |
---|
| 708 | ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) |
---|
[c77d859] | 709 | ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) |
---|
| 710 | ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 711 | sizer.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) |
---|
| 712 | ## text to show error sign |
---|
| 713 | ix += 1 |
---|
| 714 | text2=wx.StaticText(self, -1, '+/-') |
---|
| 715 | sizer.Add(text2,(iy, ix),(1,1),\ |
---|
| 716 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 717 | text2.Hide() |
---|
| 718 | ## txtcrtl to add error from fit |
---|
| 719 | ix += 1 |
---|
| 720 | ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) |
---|
| 721 | sizer.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 722 | ctl2.Hide() |
---|
| 723 | |
---|
[77e23a2] | 724 | param_min, param_max= self.model.details[item][1:] |
---|
[c77d859] | 725 | ix += 1 |
---|
| 726 | ctl3 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER) |
---|
[77e23a2] | 727 | ctl3.SetValue(format_number(param_min)) |
---|
| 728 | ctl3.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) |
---|
[c77d859] | 729 | ctl3.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) |
---|
| 730 | ctl3.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 731 | sizer.Add(ctl3, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 732 | ctl3.Hide() |
---|
[77e23a2] | 733 | |
---|
[c77d859] | 734 | ix += 1 |
---|
| 735 | ctl4 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER) |
---|
[77e23a2] | 736 | ctl4.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) |
---|
[c77d859] | 737 | ctl4.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) |
---|
| 738 | ctl4.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 739 | sizer.Add(ctl4, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
[77e23a2] | 740 | ctl4.SetValue(format_number(param_max)) |
---|
[c77d859] | 741 | ctl4.Hide() |
---|
[dcf29d7] | 742 | |
---|
| 743 | if self.engine_type=="park": |
---|
| 744 | ctl3.Show(True) |
---|
| 745 | ctl4.Show(True) |
---|
| 746 | |
---|
[c77d859] | 747 | ix +=1 |
---|
| 748 | # Units |
---|
| 749 | try: |
---|
| 750 | units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT) |
---|
| 751 | except: |
---|
| 752 | units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) |
---|
| 753 | sizer.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 754 | |
---|
| 755 | ##[cb state, name, value, "+/-", error of fit, min, max , units] |
---|
| 756 | self.parameters.append([cb,item, ctl1, |
---|
| 757 | text2,ctl2, ctl3, ctl4,None]) |
---|
[2d5f7a1] | 758 | |
---|
[c77d859] | 759 | iy+=1 |
---|
| 760 | sizer.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 761 | |
---|
| 762 | #Display units text on panel |
---|
| 763 | for item in keys: |
---|
| 764 | if self.model.details[item][0]!='': |
---|
| 765 | self.text2_4.Show() |
---|
| 766 | break |
---|
| 767 | else: |
---|
| 768 | self.text2_4.Hide() |
---|
| 769 | |
---|
| 770 | boxsizer1.Add(sizer) |
---|
| 771 | |
---|
| 772 | self.sizer3.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) |
---|
| 773 | self.sizer3.Layout() |
---|
| 774 | self.SetScrollbars(20,20,200,100) |
---|
| 775 | |
---|
| 776 | |
---|
| 777 | |
---|
| 778 | |
---|
| 779 | class HelpWindow(wx.Frame): |
---|
| 780 | def __init__(self, parent, id, title): |
---|
| 781 | wx.Frame.__init__(self, parent, id, title, size=(570, 400)) |
---|
| 782 | |
---|
| 783 | from sans.models.CylinderModel import CylinderModel |
---|
| 784 | model = CylinderModel() |
---|
[2d5f7a1] | 785 | |
---|
[c77d859] | 786 | from danse.common.plottools.plottables import Data1D |
---|
| 787 | data= Data1D(x=[1,2], y=[3,4], dy=[0.1, 0,1]) |
---|
| 788 | |
---|
[cfc0913] | 789 | from fitpanel import PageInfo |
---|
[c77d859] | 790 | myinfo = PageInfo(self, model, data=data ) |
---|
| 791 | |
---|
| 792 | ## add data |
---|
| 793 | |
---|
| 794 | from models import ModelList |
---|
| 795 | mylist= ModelList() |
---|
| 796 | |
---|
| 797 | from sans.models.SphereModel import SphereModel |
---|
| 798 | from sans.models.SquareWellStructure import SquareWellStructure |
---|
| 799 | from sans.models.DebyeModel import DebyeModel |
---|
| 800 | from sans.models.LineModel import LineModel |
---|
| 801 | name= "shapes" |
---|
| 802 | list1= [SphereModel] |
---|
| 803 | mylist.set_list( name, list1) |
---|
| 804 | |
---|
| 805 | name= "Shape-independent" |
---|
| 806 | list1= [DebyeModel] |
---|
| 807 | mylist.set_list( name, list1) |
---|
| 808 | |
---|
| 809 | name= "Structure Factors" |
---|
| 810 | list1= [SquareWellStructure] |
---|
| 811 | mylist.set_list( name, list1) |
---|
| 812 | |
---|
| 813 | name= "Added models" |
---|
| 814 | list1= [LineModel] |
---|
| 815 | mylist.set_list( name, list1) |
---|
| 816 | |
---|
| 817 | myinfo.model_list_box = mylist.get_list() |
---|
| 818 | |
---|
| 819 | self.page = FitPage(self, myinfo) |
---|
| 820 | |
---|
| 821 | |
---|
| 822 | |
---|
| 823 | self.Centre() |
---|
| 824 | self.Show(True) |
---|
| 825 | |
---|
| 826 | |
---|
| 827 | |
---|
| 828 | if __name__=="__main__": |
---|
| 829 | app = wx.App() |
---|
| 830 | HelpWindow(None, -1, 'HelpWindow') |
---|
| 831 | app.MainLoop() |
---|
| 832 | |
---|