Changeset 2661d8b in sasview for invariantview/perspectives/invariant/invariant_panel.py
- Timestamp:
- Mar 5, 2010 10:06:23 PM (15 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:
- c75a8ed
- Parents:
- 2e94cbde
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/perspectives/invariant/invariant_panel.py
r53b6b74 r2661d8b 150 150 self.invariant_err_ctl.SetValue(format_number(qstar)) 151 151 except: 152 msg= "Error occur s forinvariant: %s"%sys.exc_value152 msg= "Error occurred computing invariant: %s"%sys.exc_value 153 153 wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 154 154 return … … 159 159 qstar_low, qstar_low_err = inv.get_qstar_low() 160 160 self.invariant_low_ctl.SetValue(format_number(qstar_low)) 161 #plot data 162 low_out_data, low_in_data = inv.get_extra_data_low() 163 self._manager._plot_theory(reel_data=self._data, 164 extra_data=low_out_data, 165 name=self._data.name+" Extra_low_Q") 166 self._manager._plot_data(reel_data=self._data, 167 extra_data=low_in_data, 168 name=self._data.name+"Fitted data for low_Q") 161 extrapolated_data = inv.get_extra_data_low(npts_in=npts_low) 162 self._manager.plot_theory(data=extrapolated_data, 163 name="Low-Q extrapolation") 169 164 except: 170 msg= "Error occur s for low qinvariant: %s"%sys.exc_value165 msg= "Error occurred computing low-Q invariant: %s"%sys.exc_value 171 166 wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 167 else: 168 self._manager.plot_theory(name="Low-Q extrapolation") 169 172 170 if high_q: 173 171 try: 174 172 qstar_high, qstar_high_err = inv.get_qstar_high() 175 173 self.invariant_high_ctl.SetValue(format_number(qstar_high)) 176 #plot data 177 high_out_data, high_in_data = inv.get_extra_data_high(q_end=Q_MAXIMUM_PLOT) 178 self._manager._plot_theory(reel_data=self._data, 179 extra_data=high_out_data, 180 name=self._data.name+" Extra_high_Q") 181 self._manager._plot_data(reel_data=self._data, 182 extra_data=high_in_data, 183 name=self._data.name+"Fitted data for high_Q") 174 high_out_data = inv.get_extra_data_high(q_end=Q_MAXIMUM_PLOT) 175 self._manager.plot_theory(data=high_out_data, 176 name="High-Q extrapolation") 184 177 except: 185 msg= "Error occur s for high qinvariant: %s"%sys.exc_value178 msg= "Error occurred computing high-Q invariant: %s"%sys.exc_value 186 179 wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 180 else: 181 self._manager.plot_theory(name="High-Q extrapolation") 182 187 183 try: 188 184 qstar_total, qstar_total_err = inv.get_qstar_with_error(extrapolation) … … 192 188 check_float(self.invariant_total_err_ctl) 193 189 except: 194 msg= "Error occur s for total invariant: %s"%sys.exc_value190 msg= "Error occurred computing invariant using extrapolation: %s"%sys.exc_value 195 191 wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 196 192 … … 212 208 self.volume_err_ctl.SetValue(format_number(dv)) 213 209 except: 214 msg= "Error occur s forvolume fraction: %s"%sys.exc_value210 msg= "Error occurred computing volume fraction: %s"%sys.exc_value 215 211 wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 216 212 … … 222 218 self.surface_err_ctl.SetValue(format_number(ds)) 223 219 except: 224 msg= "Error occur s forsurface: %s"%sys.exc_value220 msg= "Error occurred computing specific surface: %s"%sys.exc_value 225 221 wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 226 222 227 223 else: 228 msg= " invariant: Need floatfor background and scale"224 msg= "A float value is required for background and scale" 229 225 wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 230 226 return … … 291 287 self.data_range_value_txt = wx.StaticText(self, -1, str(data_range)) 292 288 293 background_txt = wx.StaticText(self, -1, 'Background (Optional)')289 background_txt = wx.StaticText(self, -1, 'Background') 294 290 self.background_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 295 291 self.background_ctl.SetValue(str(BACKGROUND)) 296 self.background_ctl.SetToolTipString("Background to subtract todata.")297 scale_txt = wx.StaticText(self, -1, 'Scale (Optional)')292 self.background_ctl.SetToolTipString("Background to be subtracted from data.") 293 scale_txt = wx.StaticText(self, -1, 'Scale') 298 294 self.scale_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 299 295 self.scale_ctl.SetValue(str(SCALE)) 300 self.scale_ctl.SetToolTipString("Scal e to applyto data.")296 self.scale_ctl.SetToolTipString("Scaling factor to be applied to data.") 301 297 contrast_txt = wx.StaticText(self, -1, 'Contrast (Optional)') 302 298 self.contrast_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 303 msg_hint = "Enter a value for the contrast to getthe volume fraction"299 msg_hint = "Enter a value for the contrast to compute the volume fraction" 304 300 self.contrast_ctl.SetToolTipString(str(msg_hint)) 305 porod_const_txt = wx.StaticText(self, -1, 'Porod Constant (Optional)')301 porod_const_txt = wx.StaticText(self, -1, 'Porod Constant (Optional)') 306 302 self.porod_const_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 307 msg_hint =" Need both the contrast and surface to get thesurface"303 msg_hint ="Enter a Porod constant value to compute the specific surface" 308 304 self.porod_const_ctl.SetToolTipString(str(msg_hint)) 309 305 … … 329 325 sizer_low_q = wx.GridBagSizer(5,5) 330 326 331 self.enable_low_cbox = wx.CheckBox(self, -1, "E nable lowQ")327 self.enable_low_cbox = wx.CheckBox(self, -1, "Extrapolate low-Q") 332 328 self.enable_low_cbox.SetValue(False) 333 self.enable_high_cbox = wx.CheckBox(self, -1, "E nable HighQ")329 self.enable_high_cbox = wx.CheckBox(self, -1, "Extrapolate high-Q") 334 330 self.enable_high_cbox.SetValue(False) 335 331 336 332 self.guinier = wx.RadioButton(self, -1, 'Guinier', 337 333 (10, 10),style=wx.RB_GROUP) 338 self.power_law_low = wx.RadioButton(self, -1, 'Power _law', (10, 10))334 self.power_law_low = wx.RadioButton(self, -1, 'Power Law', (10, 10)) 339 335 self.guinier.SetValue(True) 340 336 … … 342 338 self.npts_low_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/3, -1)) 343 339 self.npts_low_ctl.SetValue(str(NPTS)) 344 msg_hint = " the number of first qpoints to consider"345 msg_hint +=" during the fit for extrapolation at low Q"340 msg_hint = "Number of Q points to consider" 341 msg_hint +="while extrapolating the low-Q region" 346 342 self.npts_low_ctl.SetToolTipString(msg_hint) 343 npts_exp_txt = wx.StaticText(self, -1, 'Power') 347 344 self.power_low_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/3, -1)) 348 345 self.power_low_ctl.SetValue(str(self.power_law_exponant)) … … 350 347 iy = 0 351 348 ix = 0 352 sizer_low_q.Add(self.guinier,(iy, ix),(1, 1),349 sizer_low_q.Add(self.guinier,(iy, ix),(1,2), 353 350 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 354 351 iy += 1 355 352 ix = 0 356 sizer_low_q.Add(self.power_law_low,(iy, ix),(1,1), 357 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 353 354 sizer_low_q.Add(self.power_law_low,(iy, ix),(1,2), 355 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 356 357 # Parameter controls for power law 358 ix = 1 359 iy += 1 360 sizer_low_q.Add(npts_exp_txt,(iy, ix),(1,1), 361 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 362 358 363 ix += 1 359 364 sizer_low_q.Add(self.power_low_ctl, (iy, ix), (1,1), 360 365 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 361 366 iy += 1 362 ix = 0367 ix = 1 363 368 sizer_low_q.Add(npts_low_txt,(iy, ix),(1,1), 364 369 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) … … 368 373 iy += 1 369 374 ix = 0 370 sizer_low_q.Add(self.enable_low_cbox,(iy, ix),(1, 1),375 sizer_low_q.Add(self.enable_low_cbox,(iy, ix),(1,5), 371 376 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 372 377 sizer_high_q = wx.GridBagSizer(5,5) 373 self.power_law_high = wx.RadioButton(self, -1, 'Power _law',378 self.power_law_high = wx.RadioButton(self, -1, 'Power Law', 374 379 (10, 10), style=wx.RB_GROUP) 375 msg_hint ="Check it to extrapolate data to highQ"380 msg_hint ="Check to extrapolate data at high-Q" 376 381 self.power_law_high.SetToolTipString(msg_hint) 377 382 … … 379 384 self.power_law_high.SetValue(True) 380 385 npts_high_txt = wx.StaticText(self, -1, 'Npts') 386 npts_high_exp_txt = wx.StaticText(self, -1, 'Power') 381 387 self.npts_high_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/3, -1)) 382 msg_hint = " the number of last qpoints to consider"383 msg_hint += " during the fit for extrapolation high Q"388 msg_hint = "Number of Q points to consider" 389 msg_hint += "while extrapolating the high-Q region" 384 390 self.npts_high_ctl.SetToolTipString(msg_hint) 385 391 self.npts_high_ctl.SetValue(str(NPTS)) … … 390 396 iy = 1 391 397 ix = 0 392 sizer_high_q.Add(self.power_law_high,(iy, ix),(1,1), 393 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 398 sizer_high_q.Add(self.power_law_high,(iy, ix),(1,2), 399 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 400 ix = 1 401 iy += 1 402 sizer_high_q.Add(npts_high_exp_txt,(iy, ix),(1,1), 403 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 404 394 405 ix += 1 395 406 sizer_high_q.Add(self.power_high_ctl, (iy, ix), (1,1), 396 407 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 397 408 iy += 1 398 ix = 0409 ix = 1 399 410 sizer_high_q.Add(npts_high_txt,(iy, ix),(1,1), 400 411 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) … … 404 415 iy += 1 405 416 ix = 0 406 sizer_high_q.Add(self.enable_high_cbox,(iy, ix),(1, 1),417 sizer_high_q.Add(self.enable_high_cbox,(iy, ix),(1,5), 407 418 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 408 419 … … 452 463 self.invariant_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 453 464 self.invariant_ctl.SetEditable(False) 454 self.invariant_ctl.SetToolTipString("Invariant in qrange.")465 self.invariant_ctl.SetToolTipString("Invariant in the data set's Q range.") 455 466 self.invariant_err_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 456 467 self.invariant_err_ctl.SetEditable(False) 457 self.invariant_err_ctl.SetToolTipString("Uncertainty on invariant.")468 self.invariant_err_ctl.SetToolTipString("Uncertainty on the invariant.") 458 469 invariant_units_txt = wx.StaticText(self, -1, unit_invariant) 459 470 … … 461 472 self.invariant_total_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 462 473 self.invariant_total_ctl.SetEditable(False) 463 msg_hint = " Invariant in q range and extra polated range."474 msg_hint = "Total invariant, including extrapolated regions." 464 475 self.invariant_total_ctl.SetToolTipString(msg_hint) 465 476 self.invariant_total_err_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) … … 471 482 self.volume_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 472 483 self.volume_ctl.SetEditable(False) 473 self.volume_ctl.SetToolTipString(" volume fraction.")484 self.volume_ctl.SetToolTipString("Volume fraction.") 474 485 self.volume_err_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 475 486 self.volume_err_ctl.SetEditable(False) 476 self.volume_err_ctl.SetToolTipString("Uncertainty o fvolume fraction.")487 self.volume_err_ctl.SetToolTipString("Uncertainty on the volume fraction.") 477 488 volume_units_txt = wx.StaticText(self, -1, unit_volume) 478 489 479 surface_txt = wx.StaticText(self, -1, 'S urface')490 surface_txt = wx.StaticText(self, -1, 'Specific surface') 480 491 self.surface_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 481 492 self.surface_ctl.SetEditable(False) 482 self.surface_ctl.SetToolTipString("S urface.")493 self.surface_ctl.SetToolTipString("Specific surface value.") 483 494 self.surface_err_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 484 495 self.surface_err_ctl.SetEditable(False) 485 self.surface_err_ctl.SetToolTipString("Uncertainty o fsurface.")496 self.surface_err_ctl.SetToolTipString("Uncertainty on the specific surface.") 486 497 surface_units_txt = wx.StaticText(self, -1, unit_surface) 487 498 488 invariant_low_txt = wx.StaticText(self, -1, 'Invariant in low Q')499 invariant_low_txt = wx.StaticText(self, -1, 'Invariant in low-Q region') 489 500 self.invariant_low_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 490 501 self.invariant_low_ctl.SetEditable(False) 491 self.invariant_low_ctl.SetToolTipString("Invariant compute in low Q")502 self.invariant_low_ctl.SetToolTipString("Invariant computed with the extrapolated low-Q data.") 492 503 invariant_low_units_txt = wx.StaticText(self, -1, unit_invariant) 493 504 494 invariant_high_txt = wx.StaticText(self, -1, 'Invariant in high Q')505 invariant_high_txt = wx.StaticText(self, -1, 'Invariant in high-Q region') 495 506 self.invariant_high_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 496 507 self.invariant_high_ctl.SetEditable(False) 497 self.invariant_high_ctl.SetToolTipString("Invariant compute in high Q")508 self.invariant_high_ctl.SetToolTipString("Invariant computed with the extrapolated high-Q data") 498 509 invariant_high_units_txt = wx.StaticText(self, -1, unit_invariant) 499 510 … … 591 602 id = wx.NewId() 592 603 button_calculate = wx.Button(self, id, "Compute") 593 button_calculate.SetToolTipString("Compute SlD of neutrons.")604 button_calculate.SetToolTipString("Compute invariant") 594 605 self.Bind(wx.EVT_BUTTON, self.compute_invariant, id = id) 595 606
Note: See TracChangeset
for help on using the changeset viewer.