Changeset d2ee6f6 in sasview for prview/perspectives
- Timestamp:
- May 26, 2009 8:46:49 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:
- 1c8015f
- Parents:
- ee6f84c
- Location:
- prview/perspectives/pr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
prview/perspectives/pr/inversion_panel.py
r5d98370 rd2ee6f6 207 207 if self.standalone==False: 208 208 self.plot_data.SetValue(str(value)) 209 self.plot_radio.SetValue(True)210 209 self._on_pars_changed(None) 211 210 elif name=='datafile': 212 211 self.data_file.SetValue(str(value)) 213 self.file_radio.SetValue(True)214 212 self._on_pars_changed(None) 215 213 else: … … 433 431 434 432 iy = 0 435 if self.standalone==False: 436 self.file_radio = wx.RadioButton(self, -1, "File data:") 433 self.file_radio = wx.StaticText(self, -1, "Data:") 434 pars_sizer.Add(self.file_radio, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 435 436 if self.standalone==True: 437 self.data_file = wx.TextCtrl(self, -1, size=(220,20)) 438 self.data_file.SetEditable(False) 439 self.data_file.SetValue("") 440 pars_sizer.Add(self.data_file, (iy,1), (1,1), wx.ADJUST_MINSIZE, 15) 437 441 else: 438 self.file_radio = wx.StaticText(self, -1, "Data file:") 439 self.data_file = wx.TextCtrl(self, -1, size=(220,20)) 440 self.data_file.SetEditable(False) 441 self.data_file.SetValue("") 442 id = wx.NewId() 443 pars_sizer.Add(self.file_radio, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 444 pars_sizer.Add(self.data_file, (iy,1), (1,1), wx.ADJUST_MINSIZE, 15) 445 446 if self.standalone==False: 447 iy += 1 448 self.plot_radio = wx.RadioButton(self, -1, "Plot data:") 449 self.plot_data = wx.TextCtrl(self, -1, size=(100,20)) 442 self.plot_data = wx.TextCtrl(self, -1, size=(220,20)) 450 443 self.plot_data.SetEditable(False) 451 pars_sizer.Add(self.plot_radio, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)452 444 pars_sizer.Add(self.plot_data, (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 15) 453 445 … … 788 780 self.alpha_estimate_ctl.Enable(False) 789 781 790 if self.standalone==False and self.plot_radio.GetValue():782 if self.standalone==False: 791 783 dataset = self.plot_data.GetValue() 792 784 self.manager.estimate_plot_inversion(alpha=alpha, nfunc=nfunc, … … 923 915 924 916 if flag: 925 if self.standalone==False and self.plot_radio.GetValue():917 if self.standalone==False: 926 918 dataset = self.plot_data.GetValue() 927 919 if len(dataset.strip())==0: … … 962 954 if path and os.path.isfile(path): 963 955 self.data_file.SetValue(str(path)) 964 if self.standalone==False:965 self.file_radio.SetValue(True)966 956 self.manager.show_data(path, reset=True) 967 957 self._on_pars_changed(None) -
prview/perspectives/pr/pr.py
r6f1f129 rd2ee6f6 29 29 DEFAULT_DMAX = 140.0 30 30 31 def __init__(self ):31 def __init__(self, standalone=True): 32 32 ## Plug-in name 33 33 self.sub_menu = "Pr inversion" … … 77 77 self._pr_npts = 51 78 78 ## Flag to let the plug-in know that it is running standalone 79 self.standalone = True79 self.standalone = standalone 80 80 self._normalize_output = False 81 81 self._scale_output_unity = False … … 257 257 new_plot.xaxis("\\rm{Q}", 'A^{-1}') 258 258 new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 259 #new_plot.group_id = "test group" 260 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title="I(q)")) 259 260 title = "I(q)" 261 # If we have a group ID, use it 262 if pr.info.has_key("plot_group_id"): 263 new_plot.group_id = pr.info["plot_group_id"] 264 title = pr.info["plot_group_id"] 265 266 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title=title)) 261 267 262 268 # If we have used slit smearing, plot the smeared I(q) too … … 342 348 new_plot.xaxis("\\rm{r}", 'A') 343 349 new_plot.yaxis("\\rm{P(r)} ","cm^{-3}") 344 350 # Make sure that the plot is linear 351 new_plot.xtransform="x" 352 new_plot.ytransform="y" 345 353 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title="P(r) fit")) 346 354 … … 538 546 539 547 elif item.name==graph.selected_plottable: 548 #TODO: we might want to check that the units are consistent with I(q) 549 # before allowing this menu item 540 550 return [["Compute P(r)", "Compute P(r) from distribution", self._on_context_inversion]] 541 551 … … 876 886 pr.slit_width = self.slit_width 877 887 888 # Keep track of the plot window title to ensure that 889 # we can overlay the plots 890 if hasattr(self.current_plottable, "group_id"): 891 pr.info["plot_group_id"] = self.current_plottable.group_id 892 878 893 # Fill in errors if none were provided 879 if self.current_plottable.dy == None: 880 print "no error", self.current_plottable.name 881 y = numpy.zeros(len(pr.y)) 894 err = self.current_plottable.dy 895 all_zeros = True 896 if err == None: 897 err = numpy.zeros(len(y)) 898 else: 899 for i in range(len(err)): 900 if err[i]>0: 901 all_zeros = False 902 903 if all_zeros: 904 scale = None 905 min_err = 0.0 882 906 for i in range(len(pr.y)): 883 y[i] = math.sqrt(pr.y[i]) 884 pr.err = y 885 else: 886 pr.err = self.current_plottable.dy 887 888 #self.pr = pr 907 # Scale the error so that we can fit over several decades of Q 908 if scale==None: 909 scale = 0.05*math.sqrt(pr.y[i]) 910 min_err = 0.01*pr.y[i] 911 err[i] = scale*math.sqrt( math.fabs(pr.y[i]) ) + min_err 912 message = "The loaded file had no error bars, statistical errors are assumed." 913 wx.PostEvent(self.parent, StatusEvent(status=message)) 914 915 pr.err = err 916 889 917 return pr 890 918 … … 1160 1188 [Somehow openGL needs this call] 1161 1189 """ 1162 self.parent.set_perspective(self.perspective) 1190 if self.standalone==True: 1191 self.parent.set_perspective(self.perspective) 1163 1192 1164 1193 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.