Changeset 780d095 in sasview for sansview/perspectives
- Timestamp:
- Apr 14, 2009 6:27:50 PM (16 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:
- ac166e9c
- Parents:
- fff74cb
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
rf6b65b8 r780d095 55 55 ##list of dispersion parameters 56 56 self.disp_list=[] 57 ## list of orientation parameters 58 self.orientation_params=[] 57 59 if self.model !=None: 58 60 self.disp_list= self.model.getDispParamList() -
sansview/perspectives/fitting/fitpage.py
r2a5bba7 r780d095 194 194 self.fittable_param=[] 195 195 self.fixed_param=[] 196 196 self.orientation_params=[] 197 197 self.sizer4_4.Clear(True) 198 198 … … 232 232 233 233 for item in self.model.dispersion.keys(): 234 self.disp_cb_dict[item]= None 235 name1=item+".width" 236 name2=item+".npts" 237 name3=item+".nsigmas" 238 iy += 1 239 for p in self.model.dispersion[item].keys(): 240 241 if p=="width": 242 ix = 0 243 cb = wx.CheckBox(self, -1, name1, (10, 10)) 244 wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) 245 246 self.sizer4_4.Add( cb,( iy, ix),(1,1), 247 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 248 ix = 1 249 value= self.model.getParam(name1) 250 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), 251 style=wx.TE_PROCESS_ENTER) 252 253 ctl1.SetValue(str (format_number(value))) 254 ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 255 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 256 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 257 self.sizer4_4.Add(ctl1, (iy,ix),(1,1),wx.EXPAND) 258 259 ## text to show error sign 260 ix = 2 261 text2=wx.StaticText(self, -1, '+/-') 262 self.sizer4_4.Add(text2,(iy, ix),(1,1), 263 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 264 text2.Hide() 265 ## txtcrtl to add error from fit 266 ix = 3 267 ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 268 self.sizer4_4.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 269 ctl2.Hide() 270 271 self.fittable_param.append([cb,name1,ctl1,text2, 272 ctl2, None, None,None]) 273 elif p=="npts": 274 ix = 4 275 value= self.model.getParam(name2) 276 Tctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 234 if not item in self.model.orientation_params: 235 self.disp_cb_dict[item]= None 236 name1=item+".width" 237 name2=item+".npts" 238 name3=item+".nsigmas" 239 iy += 1 240 for p in self.model.dispersion[item].keys(): 241 242 if p=="width": 243 ix = 0 244 cb = wx.CheckBox(self, -1, name1, (10, 10)) 245 wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) 246 self.sizer4_4.Add( cb,( iy, ix),(1,1), 247 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 248 ix = 1 249 value= self.model.getParam(name1) 250 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), 277 251 style=wx.TE_PROCESS_ENTER) 278 279 Tctl.SetValue(str (format_number(value))) 280 Tctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 281 Tctl.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 282 Tctl.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 283 self.sizer4_4.Add(Tctl, (iy,ix),(1,1), 284 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 285 286 self.fixed_param.append([None,name2, Tctl,None,None, 287 None, None,None]) 288 289 elif p=="nsigmas": 290 ix = 5 291 value= self.model.getParam(name3) 292 Tctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 252 ctl1.SetValue(str (format_number(value))) 253 ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 254 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 255 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 256 self.sizer4_4.Add(ctl1, (iy,ix),(1,1),wx.EXPAND) 257 ## text to show error sign 258 ix = 2 259 text2=wx.StaticText(self, -1, '+/-') 260 self.sizer4_4.Add(text2,(iy, ix),(1,1), 261 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 262 text2.Hide() 263 ## txtcrtl to add error from fit 264 ix = 3 265 ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 266 self.sizer4_4.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 267 ctl2.Hide() 268 self.fittable_param.append([cb,name1,ctl1,text2, 269 ctl2, None, None,None]) 270 elif p=="npts": 271 ix = 4 272 value= self.model.getParam(name2) 273 Tctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 274 style=wx.TE_PROCESS_ENTER) 275 276 Tctl.SetValue(str (format_number(value))) 277 Tctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 278 Tctl.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 279 Tctl.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 280 self.sizer4_4.Add(Tctl, (iy,ix),(1,1), 281 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 282 self.fixed_param.append([None,name2, Tctl,None,None, 283 None, None,None]) 284 elif p=="nsigmas": 285 ix = 5 286 value= self.model.getParam(name3) 287 Tctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 288 style=wx.TE_PROCESS_ENTER) 289 Tctl.SetValue(str (format_number(value))) 290 Tctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 291 Tctl.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 292 Tctl.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 293 self.sizer4_4.Add(Tctl, (iy,ix),(1,1), 294 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 295 ix +=1 296 self.sizer4_4.Add((20,20), (iy,ix),(1,1), 297 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 298 299 self.fixed_param.append([None,name3, Tctl 300 ,None,None, None, None,None]) 301 ix =0 302 iy +=1 303 self.sizer4_4.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 304 for item in self.model.dispersion.keys(): 305 if item in self.model.orientation_params: 306 self.disp_cb_dict[item]= None 307 name1=item+".width" 308 name2=item+".npts" 309 name3=item+".nsigmas" 310 iy += 1 311 for p in self.model.dispersion[item].keys(): 312 313 if p=="width": 314 ix = 0 315 cb = wx.CheckBox(self, -1, name1, (10, 10)) 316 wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) 317 self.sizer4_4.Add( cb,( iy, ix),(1,1), 318 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 319 if self.data.__class__.__name__ =="Data2D": 320 cb.Enable() 321 else: 322 cb.Disable() 323 ix = 1 324 value= self.model.getParam(name1) 325 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), 293 326 style=wx.TE_PROCESS_ENTER) 294 Tctl.SetValue(str (format_number(value))) 295 Tctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 296 Tctl.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 297 Tctl.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 298 self.sizer4_4.Add(Tctl, (iy,ix),(1,1), 299 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 300 ix +=1 301 self.sizer4_4.Add((20,20), (iy,ix),(1,1), 302 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 303 304 self.fixed_param.append([None,name3, Tctl 305 ,None,None, None, None,None]) 306 327 ctl1.SetValue(str (format_number(value))) 328 if self.data.__class__.__name__ =="Data2D": 329 ctl1.Enable() 330 else: 331 ctl1.Disable() 332 ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 333 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 334 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 335 self.sizer4_4.Add(ctl1, (iy,ix),(1,1),wx.EXPAND) 336 ## text to show error sign 337 ix = 2 338 text2=wx.StaticText(self, -1, '+/-') 339 self.sizer4_4.Add(text2,(iy, ix),(1,1), 340 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 341 text2.Hide() 342 ## txtcrtl to add error from fit 343 ix = 3 344 ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 345 self.sizer4_4.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 346 ctl2.Hide() 347 if self.data.__class__.__name__ =="Data2D": 348 ctl2.Enable() 349 else: 350 ctl2.Disable() 351 self.fittable_param.append([cb,name1,ctl1,text2, 352 ctl2, None, None,None]) 353 self.orientation_params.append([cb,name1,ctl1,text2, 354 ctl2, None, None,None]) 355 elif p=="npts": 356 ix = 4 357 value= self.model.getParam(name2) 358 Tctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 359 style=wx.TE_PROCESS_ENTER) 360 361 Tctl.SetValue(str (format_number(value))) 362 if self.data.__class__.__name__ =="Data2D": 363 Tctl.Enable() 364 else: 365 Tctl.Disable() 366 Tctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 367 Tctl.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 368 Tctl.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 369 self.sizer4_4.Add(Tctl, (iy,ix),(1,1), 370 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 371 self.fixed_param.append([None,name2, Tctl,None,None, 372 None, None,None]) 373 self.orientation_params.append([None,name2, Tctl,None,None, 374 None, None,None]) 375 elif p=="nsigmas": 376 ix = 5 377 value= self.model.getParam(name3) 378 Tctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 379 style=wx.TE_PROCESS_ENTER) 380 Tctl.SetValue(str (format_number(value))) 381 if self.data.__class__.__name__ =="Data2D": 382 Tctl.Enable() 383 else: 384 Tctl.Disable() 385 Tctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 386 Tctl.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 387 Tctl.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 388 self.sizer4_4.Add(Tctl, (iy,ix),(1,1), 389 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 390 ix +=1 391 self.sizer4_4.Add((20,20), (iy,ix),(1,1), 392 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 393 self.fixed_param.append([None,name3, Tctl 394 ,None,None, None, None,None]) 395 self.orientation_params.append([None,name3, Tctl 396 ,None,None, None, None,None]) 397 307 398 wx.PostEvent(self.parent, StatusEvent(status=\ 308 399 " Selected Distribution: Gaussian")) … … 644 735 self.fittable_param=[] 645 736 self.fixed_param=[] 737 self.orientation_params=[] 646 738 647 739 if model ==None: … … 702 794 703 795 for item in keys: 704 if not item in self.disp_list :796 if not item in self.disp_list and not item in self.model.orientation_params: 705 797 iy += 1 706 798 ix = 0 … … 771 863 iy+=1 772 864 sizer.Add((10,10),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 865 for item in self.model.orientation_params: 866 if not item in self.disp_list : 867 iy += 1 868 ix = 0 869 ## add parameters name with checkbox for selecting to fit 870 cb = wx.CheckBox(self, -1, item ) 871 cb.SetValue(False) 872 wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) 873 if self.data.__class__.__name__ =="Data2D": 874 cb.Enable() 875 else: 876 cb.Disable() 877 sizer.Add( cb,( iy, ix),(1,1), 878 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 879 ## add parameter value 880 ix += 1 881 value= self.model.getParam(item) 882 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), 883 style=wx.TE_PROCESS_ENTER) 884 885 ctl1.SetValue(format_number(value)) 886 if self.data.__class__.__name__ =="Data2D": 887 ctl1.Enable() 888 else: 889 ctl1.Disable() 890 ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 891 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 892 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 893 sizer.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) 894 ## text to show error sign 895 ix += 1 896 text2=wx.StaticText(self, -1, '+/-') 897 sizer.Add(text2,(iy, ix),(1,1),\ 898 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 899 text2.Hide() 900 ## txtcrtl to add error from fit 901 ix += 1 902 ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 903 sizer.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 904 ctl2.Hide() 905 if self.data.__class__.__name__ =="Data2D": 906 ctl1.Enable() 907 else: 908 ctl1.Disable() 909 param_min, param_max= self.model.details[item][1:] 910 ix += 1 911 ctl3 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER) 912 ctl3.SetValue(format_number(param_min)) 913 ctl3.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 914 ctl3.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 915 ctl3.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 916 sizer.Add(ctl3, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 917 ctl3.Hide() 918 if self.data.__class__.__name__ =="Data2D": 919 ctl3.Enable() 920 else: 921 ctl3.Disable() 922 923 ix += 1 924 ctl4 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER) 925 ctl4.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 926 ctl4.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 927 ctl4.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 928 sizer.Add(ctl4, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 929 ctl4.SetValue(format_number(param_max)) 930 ctl4.Hide() 931 if self.data.__class__.__name__ =="Data2D": 932 ctl4.Enable() 933 else: 934 ctl4.Disable() 935 if self.engine_type=="park": 936 ctl3.Show(True) 937 ctl4.Show(True) 938 939 ix +=1 940 # Units 941 try: 942 units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT) 943 except: 944 units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) 945 sizer.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 946 947 ##[cb state, name, value, "+/-", error of fit, min, max , units] 948 self.parameters.append([cb,item, ctl1, 949 text2,ctl2, ctl3, ctl4,None]) 950 self.orientation_params.append([cb,item, ctl1, 951 text2,ctl2, ctl3, ctl4,None]) 952 953 iy+=1 954 sizer.Add((10,10),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 773 955 774 956 #Display units text on panel -
sansview/perspectives/fitting/modelpage.py
r2a5bba7 r780d095 122 122 self.fittable_param=[] 123 123 self.fixed_param=[] 124 self.orientation_params=[] 124 125 125 126 self.sizer4_4.Clear(True) … … 136 137 self._disp_obj_dict[item] = disp_model 137 138 self.model.set_dispersion(item, disp_model) 138 139 140 139 ix=0 141 140 iy=1 … … 154 153 self.sizer4_4.Add(nsigmas,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 155 154 156 157 155 for item in self.model.dispersion.keys(): 158 159 self.disp_cb_dict[item]= None 160 name1=item+".width" 161 name2=item+".npts" 162 name3=item+".nsigmas" 163 iy += 1 164 for p in self.model.dispersion[item].keys(): 165 if p=="width": 166 ix = 0 167 name = wx.StaticText(self, -1, name1) 168 self.sizer4_4.Add( name,( iy, ix),(1,1), 169 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 170 ix = 1 171 value= self.model.getParam(name1) 172 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), 173 style=wx.TE_PROCESS_ENTER) 174 175 ctl1.SetValue(str (format_number(value))) 176 ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 177 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 178 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 179 self.sizer4_4.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) 180 181 self.fittable_param.append([None,name1,ctl1,None, 182 None, None, None,None]) 183 184 elif p=="npts": 185 ix =2 186 value= self.model.getParam(name2) 187 Tctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 156 if not item in self.model.orientation_params: 157 self.disp_cb_dict[item]= None 158 name1=item+".width" 159 name2=item+".npts" 160 name3=item+".nsigmas" 161 iy += 1 162 for p in self.model.dispersion[item].keys(): 163 if p=="width": 164 ix = 0 165 name = wx.StaticText(self, -1, name1) 166 self.sizer4_4.Add( name,( iy, ix),(1,1), 167 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 168 ix = 1 169 value= self.model.getParam(name1) 170 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), 188 171 style=wx.TE_PROCESS_ENTER) 189 190 Tctl1.SetValue(str (format_number(value))) 191 Tctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 192 Tctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 193 Tctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 194 self.sizer4_4.Add(Tctl1, (iy,ix),(1,1), 195 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 196 197 self.fixed_param.append([None,name2, Tctl1,None,None, 198 None, None,None]) 199 200 elif p=="nsigmas": 201 202 ix =3 203 value= self.model.getParam(name3) 204 Tctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 172 ctl1.SetValue(str (format_number(value))) 173 ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 174 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 175 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 176 self.sizer4_4.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) 177 self.fittable_param.append([None,name1,ctl1,None, 178 None, None, None,None]) 179 elif p=="npts": 180 ix =2 181 value= self.model.getParam(name2) 182 Tctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 183 style=wx.TE_PROCESS_ENTER) 184 Tctl1.SetValue(str (format_number(value))) 185 Tctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 186 Tctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 187 Tctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 188 self.sizer4_4.Add(Tctl1, (iy,ix),(1,1), 189 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 190 self.fixed_param.append([None,name2, Tctl1,None,None, 191 None, None,None]) 192 elif p=="nsigmas": 193 ix =3 194 value= self.model.getParam(name3) 195 Tctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 196 style=wx.TE_PROCESS_ENTER) 197 Tctl2.SetValue(str (format_number(value))) 198 Tctl2.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 199 Tctl2.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 200 Tctl2.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 201 self.sizer4_4.Add(Tctl2, (iy,ix),(1,1), 202 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 203 ix +=1 204 self.sizer4_4.Add((20,20), (iy,ix),(1,1), 205 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 206 self.fixed_param.append([None,name3, Tctl2, 207 None,None, None, None,None]) 208 for item in self.model.dispersion.keys(): 209 if item in self.model.orientation_params: 210 self.disp_cb_dict[item]= None 211 name1=item+".width" 212 name2=item+".npts" 213 name3=item+".nsigmas" 214 iy += 1 215 for p in self.model.dispersion[item].keys(): 216 if p=="width": 217 ix = 0 218 name = wx.StaticText(self, -1, name1) 219 self.sizer4_4.Add( name,( iy, ix),(1,1), 220 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 221 ix = 1 222 value= self.model.getParam(name1) 223 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), 205 224 style=wx.TE_PROCESS_ENTER) 206 Tctl2.SetValue(str (format_number(value))) 207 Tctl2.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 208 Tctl2.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 209 Tctl2.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 210 self.sizer4_4.Add(Tctl2, (iy,ix),(1,1), 211 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 212 ix +=1 213 self.sizer4_4.Add((20,20), (iy,ix),(1,1), 214 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 215 216 self.fixed_param.append([None,name3, Tctl2, 217 None,None, None, None,None]) 218 225 ctl1.SetValue(str (format_number(value))) 226 ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 227 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 228 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 229 ctl1.Disable() 230 self.sizer4_4.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) 231 self.fittable_param.append([None,name1,ctl1,None, 232 None, None, None,None]) 233 self.orientation_params.append([None,name1,ctl1,None, 234 None, None, None,None]) 235 elif p=="npts": 236 ix =2 237 value= self.model.getParam(name2) 238 Tctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 239 style=wx.TE_PROCESS_ENTER) 240 Tctl1.SetValue(str (format_number(value))) 241 Tctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 242 Tctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 243 Tctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 244 Tctl1.Disable() 245 self.sizer4_4.Add(Tctl1, (iy,ix),(1,1), 246 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 247 self.fixed_param.append([None,name2, Tctl1,None,None, 248 None, None,None]) 249 self.orientation_params.append([None,name2, Tctl1,None,None, 250 None, None,None]) 251 elif p=="nsigmas": 252 ix =3 253 value= self.model.getParam(name3) 254 Tctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), 255 style=wx.TE_PROCESS_ENTER) 256 Tctl2.SetValue(str (format_number(value))) 257 Tctl2.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 258 Tctl2.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 259 Tctl2.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 260 Tctl2.Disable() 261 self.sizer4_4.Add(Tctl2, (iy,ix),(1,1), 262 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 263 ix +=1 264 self.sizer4_4.Add((20,20), (iy,ix),(1,1), 265 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 266 self.fixed_param.append([None,name3, Tctl2, 267 None,None, None, None,None]) 268 self.orientation_params.append([None,name3, Tctl2, 269 None,None, None, None,None]) 270 219 271 msg = " Selected Distribution: Gaussian" 220 272 wx.PostEvent(self.parent.parent, StatusEvent( status= msg )) … … 239 291 self._draw_model() 240 292 self.model_view.Disable() 241 293 for item in self.orientation_params: 294 if item[2]!=None: 295 item[2].Enable() 296 297 242 298 243 299 def reset_page(self, state): … … 354 410 self.param_toFit=[] 355 411 self.fixed_param=[] 412 self.orientation_params=[] 356 413 357 414 if model ==None: … … 366 423 367 424 keys = self.model.getParamList() 368 # list of dispersion paramaters425 ##list of dispersion parameters 369 426 self.disp_list=self.model.getDispParamList() 370 427 … … 386 443 self.text2_4.Hide() 387 444 388 389 445 for item in keys: 390 if not item in self.disp_list :446 if not item in self.disp_list and not item in self.model.orientation_params: 391 447 iy += 1 392 448 ix = 0 393 394 449 name = wx.StaticText(self, -1,item) 395 450 sizer.Add( name,( iy, ix),(1,1), 396 451 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 397 398 452 ix += 1 399 453 value= self.model.getParam(item) … … 407 461 408 462 sizer.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) 409 410 463 ix +=1 411 464 # Units … … 415 468 units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) 416 469 sizer.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 417 418 470 ##[cb state, name, value, "+/-", error of fit, min, max , units] 419 471 self.parameters.append([None,item, ctl1, 472 None,None, None, None,None]) 473 iy+=1 474 sizer.Add((10,10),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 475 for item in self.model.orientation_params: 476 if not item in self.disp_list : 477 iy += 1 478 ix = 0 479 name = wx.StaticText(self, -1,item) 480 sizer.Add( name,( iy, ix),(1,1), 481 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 482 ix += 1 483 value= self.model.getParam(item) 484 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), 485 style=wx.TE_PROCESS_ENTER) 486 487 ctl1.SetValue(str (format_number(value))) 488 ctl1.Disable() 489 ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 490 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 491 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 492 493 sizer.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) 494 ix +=1 495 # Units 496 try: 497 units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT) 498 except: 499 units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) 500 sizer.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 501 ##[cb state, name, value, "+/-", error of fit, min, max , units] 502 self.parameters.append([None,item, ctl1, 503 None,None, None, None,None]) 504 self.orientation_params.append([None,item, ctl1, 420 505 None,None, None, None,None]) 421 506 … … 430 515 else: 431 516 self.text2_4.Hide() 432 517 433 518 boxsizer1.Add(sizer) 434 435 519 self.sizer3.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) 436 520 self.sizer3.Layout()
Note: See TracChangeset
for help on using the changeset viewer.