Changeset 357b79b in sasview for prview/perspectives/pr
- Timestamp:
- Jul 3, 2008 3:35:59 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:
- 9362f85
- Parents:
- 7578961
- Location:
- prview/perspectives/pr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
prview/perspectives/pr/inversion_panel.py
r2a92852 r357b79b 348 348 sizer_slit = wx.GridBagSizer(5,5) 349 349 350 label_sheight = wx.StaticText(self, -1, "Height" )351 label_swidth = wx.StaticText(self, -1, "Width" )350 label_sheight = wx.StaticText(self, -1, "Height", size=(35,20)) 351 label_swidth = wx.StaticText(self, -1, "Width", size=(35,20)) 352 352 #label_sunits1 = wx.StaticText(self, -1, "[A^(-1)]") 353 label_sunits2 = wx.StaticText(self, -1, "[A^(-1)]" )353 label_sunits2 = wx.StaticText(self, -1, "[A^(-1)]", size=(40,20)) 354 354 self.sheight_ctl = wx.TextCtrl(self, -1, size=(60,20)) 355 355 self.swidth_ctl = wx.TextCtrl(self, -1, size=(60,20)) … … 360 360 361 361 iy = 0 362 sizer_slit.Add(label_sheight, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)363 sizer_slit.Add(self.sheight_ctl, (iy,1), (1,1), wx.LEFT|wx.EXPAND, 10)362 sizer_slit.Add(label_sheight, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 5) 363 sizer_slit.Add(self.sheight_ctl, (iy,1), (1,1), wx.LEFT|wx.EXPAND, 5) 364 364 #sizer_slit.Add(label_sunits1, (iy,2), (1,1), wx.LEFT|wx.EXPAND, 10) 365 sizer_slit.Add(label_swidth, (iy,2), (1,1), wx.LEFT|wx.EXPAND, 15)366 sizer_slit.Add(self.swidth_ctl, (iy,3), (1,1), wx.LEFT|wx.EXPAND, 10)367 sizer_slit.Add(label_sunits2, (iy,4), (1,1), wx.LEFT|wx.EXPAND, 10)365 sizer_slit.Add(label_swidth, (iy,2), (1,1), wx.LEFT|wx.EXPAND, 5) 366 sizer_slit.Add(self.swidth_ctl, (iy,3), (1,1), wx.LEFT|wx.EXPAND, 5) 367 sizer_slit.Add(label_sunits2, (iy,4), (1,1), wx.LEFT|wx.EXPAND, 5) 368 368 369 369 sboxsizer.Add(sizer_slit, wx.TOP, 15) 370 370 vbox.Add(sboxsizer) 371 372 373 # ----- Q range ----- 374 qbox = wx.StaticBox(self, -1, "Q range") 375 qboxsizer = wx.StaticBoxSizer(qbox, wx.VERTICAL) 376 qboxsizer.SetMinSize((320,20)) 377 378 sizer_q = wx.GridBagSizer(5,5) 379 380 label_qmin = wx.StaticText(self, -1, "Q min", size=(35,20)) 381 label_qmax = wx.StaticText(self, -1, "Q max", size=(35,20)) 382 #label_qunits1 = wx.StaticText(self, -1, "[A^(-1)]") 383 label_qunits2 = wx.StaticText(self, -1, "[A^(-1)]", size=(40,20)) 384 self.qmin_ctl = wx.TextCtrl(self, -1, size=(60,20)) 385 self.qmax_ctl = wx.TextCtrl(self, -1, size=(60,20)) 386 self.qmin_ctl.SetToolTipString("Select a lower bound for Q or leave blank.") 387 self.qmax_ctl.SetToolTipString("Select an upper bound for Q or leave blank.") 388 self.qmin_ctl.Bind(wx.EVT_TEXT, self._on_pars_changed) 389 self.qmax_ctl.Bind(wx.EVT_TEXT, self._on_pars_changed) 390 391 iy = 0 392 sizer_q.Add(label_qmin, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 5) 393 sizer_q.Add(self.qmin_ctl, (iy,1), (1,1), wx.LEFT|wx.EXPAND, 5) 394 #sizer_q.Add(label_qunits1, (iy,2), (1,1), wx.LEFT|wx.EXPAND, 15) 395 sizer_q.Add(label_qmax, (iy,2), (1,1), wx.LEFT|wx.EXPAND, 5) 396 sizer_q.Add(self.qmax_ctl, (iy,3), (1,1), wx.LEFT|wx.EXPAND, 5) 397 sizer_q.Add(label_qunits2, (iy,4), (1,1), wx.LEFT|wx.EXPAND, 5) 398 qboxsizer.Add(sizer_q, wx.TOP, 15) 399 vbox.Add(qboxsizer) 400 401 371 402 372 403 … … 443 474 vbox.Add(boxsizer2) 444 475 445 # ----- Q range -----446 qbox = wx.StaticBox(self, -1, "Q range")447 qboxsizer = wx.StaticBoxSizer(qbox, wx.VERTICAL)448 qboxsizer.SetMinSize((320,20))449 450 sizer_q = wx.GridBagSizer(5,5)451 452 label_qmin = wx.StaticText(self, -1, "Q min")453 label_qmax = wx.StaticText(self, -1, "Q max")454 #label_qunits1 = wx.StaticText(self, -1, "[A^(-1)]")455 label_qunits2 = wx.StaticText(self, -1, "[A^(-1)]")456 self.qmin_ctl = wx.TextCtrl(self, -1, size=(60,20))457 self.qmax_ctl = wx.TextCtrl(self, -1, size=(60,20))458 self.qmin_ctl.SetToolTipString("Select a lower bound for Q or leave blank.")459 self.qmax_ctl.SetToolTipString("Select an upper bound for Q or leave blank.")460 self.qmin_ctl.Bind(wx.EVT_TEXT, self._on_pars_changed)461 self.qmax_ctl.Bind(wx.EVT_TEXT, self._on_pars_changed)462 463 iy = 0464 sizer_q.Add(label_qmin, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)465 sizer_q.Add(self.qmin_ctl, (iy,1), (1,1), wx.LEFT|wx.EXPAND, 10)466 #sizer_q.Add(label_qunits1, (iy,2), (1,1), wx.LEFT|wx.EXPAND, 15)467 sizer_q.Add(label_qmax, (iy,2), (1,1), wx.LEFT|wx.EXPAND, 15)468 sizer_q.Add(self.qmax_ctl, (iy,3), (1,1), wx.LEFT|wx.EXPAND, 10)469 sizer_q.Add(label_qunits2, (iy,4), (1,1), wx.LEFT|wx.EXPAND, 15)470 qboxsizer.Add(sizer_q, wx.TOP, 15)471 vbox.Add(qboxsizer)472 473 474 476 475 477 # ----- Results ----- -
prview/perspectives/pr/pr.py
r2a92852 r357b79b 351 351 pass 352 352 353 if not scale==None: 354 message = "The loaded file had no error bars, statistical errors are assumed." 355 wx.PostEvent(self.parent, StatusEvent(status=message)) 356 else: 357 wx.PostEvent(self.parent, StatusEvent(status='')) 358 353 359 return data_x, data_y, data_err 354 360 … … 519 525 520 526 # Make a plot of I(q) data 521 new_plot = Data1D(self.pr.x, self.pr.y, dy=self.pr.err) 527 if self.pr.err==None: 528 new_plot = Theory1D(self.pr.x, self.pr.y) 529 else: 530 new_plot = Data1D(self.pr.x, self.pr.y, dy=self.pr.err) 522 531 new_plot.name = "I_{obs}(q)" 523 532 new_plot.xaxis("\\rm{Q}", 'A^{-1}') … … 648 657 @param path: path of the file to read in 649 658 """ 659 from sans.guiframe.data_loader import load_ascii_1D 660 import numpy 650 661 # Load data 651 662 if os.path.isfile(path): 663 652 664 x, y, err = self.load(path) 665 #x, y, err = load_ascii_1D(path) 666 667 # If we have not errors, add statistical errors 668 if err==None: 669 err = numpy.zeros(len(y)) 670 for i in range(len(y)): 671 err[i] = math.sqrt( math.fabs(y[i]) ) 672 message = "The loaded file had no error bars, statistical errors are assumed." 673 wx.PostEvent(self.parent, StatusEvent(status=message)) 674 else: 675 wx.PostEvent(self.parent, StatusEvent(status='')) 653 676 654 677 # Get the data from the chosen data set and perform inversion … … 674 697 from copy import deepcopy 675 698 676 wx.PostEvent(self.parent, StatusEvent(status=''))677 699 # If a thread is already started, stop it 678 700 if self.estimation_thread != None and self.estimation_thread.isrunning(): … … 690 712 from copy import deepcopy 691 713 692 wx.PostEvent(self.parent, StatusEvent(status=''))693 714 # If a thread is already started, stop it 694 715 if self.estimation_thread != None and self.estimation_thread.isrunning(): -
prview/perspectives/pr/pr_thread.py
r2a92852 r357b79b 105 105 self.error_func = error_func 106 106 self.starttime = 0 107 107 self._time_for_sleep = 0 108 self._sleep_delay = 1.0 109 110 111 def isquit(self): 112 CalcThread.isquit(self) 113 if time.time()>self._time_for_sleep+self._sleep_delay: 114 time.sleep(.2) 115 self._time_for_sleep = time.time() 116 108 117 def compute(self): 109 118 """ … … 113 122 try: 114 123 t_0 = time.time() 124 self._time_for_sleep = t_0 115 125 nterms, alpha, message = self.pr.estimate_numterms(self.isquit) 116 126 t_1 = time.time()-t_0
Note: See TracChangeset
for help on using the changeset viewer.