Changeset 3e41f43 in sasview for prview/perspectives/pr/explore_dialog.py
- Timestamp:
- Jan 10, 2011 10:42:27 AM (14 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:
- 3658abed
- Parents:
- d65a00a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
prview/perspectives/pr/explore_dialog.py
r7116b6e0 r3e41f43 68 68 69 69 # Plot area 70 self.plot = Model1D(self.x, y=y,dy=dy)70 self.plot = Model1D(self.x, y=y, dy=dy) 71 71 self.plot.name = DEFAULT_OUTPUT 72 72 … … 89 89 id = wx.NewId() 90 90 slicerpop = wx.Menu() 91 slicerpop.Append(id, '&Save image', 'Save image as PNG')91 slicerpop.Append(id, '&Save image', 'Save image as PNG') 92 92 wx.EVT_MENU(self, id, self.onSaveImage) 93 93 … … 126 126 self.outputs['Oscillation parameter'] = ["Osc", "a.u.", self.osc] 127 127 self.outputs['Positive fraction'] = ["P^+", "a.u.", self.pos] 128 self.outputs['1-sigma positive fraction'] = ["P^+_{1\ \sigma}", "a.u.", self.pos_err] 128 self.outputs['1-sigma positive fraction'] = ["P^+_{1\ \sigma}", 129 "a.u.", self.pos_err] 129 130 self.outputs['Rg'] = ["R_g", "A", self.rg] 130 131 self.outputs['I(q=0)'] = ["I(q=0)", "1/A", self.iq0] … … 157 158 158 159 # Control for number of points 159 self.npts_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20)) 160 self.npts_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, 161 size=(60,20)) 160 162 # Control for the minimum value of D_max 161 self.dmin_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20)) 163 self.dmin_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, 164 size=(60,20)) 162 165 # Control for the maximum value of D_max 163 self.dmax_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20)) 166 self.dmax_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, 167 size=(60,20)) 164 168 165 169 # Output selection box for the y axis … … 167 171 168 172 # Create the plot object 169 self.plotpanel = OutputPlot(self._default_min, self._default_max, self, -1, style=wx.RAISED_BORDER) 173 self.plotpanel = OutputPlot(self._default_min, self._default_max, 174 self, -1, style=wx.RAISED_BORDER) 170 175 171 176 # Create the layout of the dialog … … 258 263 self.plotpanel.plot.y = self.results.outputs[output_type][2] 259 264 self.plotpanel.plot.name = '_nolegend_' 260 self.plotpanel.graph.yaxis("\\rm{%s}" % self.results.outputs[output_type][0], self.results.outputs[output_type][1]) 265 y_label = "\\rm{%s}" % self.results.outputs[output_type][0] 266 self.plotpanel.graph.yaxis(y_label, 267 self.results.outputs[output_type][1]) 261 268 262 269 # Redraw … … 264 271 self.plotpanel.subplot.figure.canvas.draw_idle() 265 272 else: 266 msg = "ExploreDialog: the Results object's dictionary does not contain " 267 msg += "the [%s] output type. This must be indicative of a change in the " % str(output_type) 273 msg = "ExploreDialog: the Results object's dictionary " 274 msg += "does not contain " 275 msg += "the [%s] output type. This must be indicative of " 276 msg += "a change in the " % str(output_type) 268 277 msg += "ExploreDialog code." 269 278 logging.error(msg) … … 279 288 sizer_main = wx.BoxSizer(wx.VERTICAL) 280 289 sizer_button = wx.BoxSizer(wx.HORIZONTAL) 281 sizer_params = wx.GridBagSizer(5, 5)290 sizer_params = wx.GridBagSizer(5, 5) 282 291 283 292 iy = 0 284 293 ix = 0 285 294 label_npts = wx.StaticText(self, -1, "Npts") 286 sizer_params.Add(label_npts, (iy,ix), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 295 sizer_params.Add(label_npts, (iy, ix), (1, 1), 296 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 287 297 ix += 1 288 sizer_params.Add(self.npts_ctl, (iy,ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 298 sizer_params.Add(self.npts_ctl, (iy, ix), (1, 1), 299 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 289 300 self.npts_ctl.SetValue("%g" % DEFAULT_NPTS) 290 301 self.npts_ctl.Bind(wx.EVT_KILL_FOCUS, self._recalc) … … 292 303 ix += 1 293 304 label_dmin = wx.StaticText(self, -1, "Min Distance [A]") 294 sizer_params.Add(label_dmin, (iy,ix), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 305 sizer_params.Add(label_dmin, (iy, ix), (1, 1), 306 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 295 307 ix += 1 296 sizer_params.Add(self.dmin_ctl, (iy,ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 308 sizer_params.Add(self.dmin_ctl, (iy, ix), (1, 1), 309 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 297 310 self.dmin_ctl.SetValue(str(self._default_min)) 298 311 self.dmin_ctl.Bind(wx.EVT_KILL_FOCUS, self._recalc) … … 300 313 ix += 1 301 314 label_dmax = wx.StaticText(self, -1, "Max Distance [A]") 302 sizer_params.Add(label_dmax, (iy,ix), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 315 sizer_params.Add(label_dmax, (iy, ix), (1, 1), 316 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 303 317 ix += 1 304 sizer_params.Add(self.dmax_ctl, (iy,ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 318 sizer_params.Add(self.dmax_ctl, (iy, ix), (1, 1), 319 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 305 320 self.dmax_ctl.SetValue(str(self._default_max)) 306 321 self.dmax_ctl.Bind(wx.EVT_KILL_FOCUS, self._recalc) … … 314 329 self.output_box.SetStringSelection(DEFAULT_OUTPUT) 315 330 316 output_sizer = wx.GridBagSizer(5,5) 317 output_sizer.Add(selection_msg, (0,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 318 output_sizer.Add(self.output_box, (0,1), (1,2), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 319 320 wx.EVT_COMBOBOX(self.output_box,-1, self._plot_output) 331 output_sizer = wx.GridBagSizer(5, 5) 332 output_sizer.Add(selection_msg, (0, 0), (1, 1), 333 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 334 output_sizer.Add(self.output_box, (0, 1), (1, 2), 335 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 336 337 wx.EVT_COMBOBOX(self.output_box, -1, self._plot_output) 321 338 sizer_main.Add(output_sizer, 0, wx.EXPAND | wx.ALL, 10) 322 339 323 340 sizer_main.Add(self.plotpanel, 0, wx.EXPAND | wx.ALL, 10) 324 sizer_main.SetItemMinSize(self.plotpanel, 400, 400)341 sizer_main.SetItemMinSize(self.plotpanel, 400, 400) 325 342 326 343 sizer_main.Add(sizer_params, 0, wx.EXPAND|wx.ALL, 10) … … 357 374 358 375 # Loop over d_max values 359 for i in range(content.npts): 360 d = content.dmin + i * (content.dmax - content.dmin)/(content.npts-1.0) 376 for i in range(content.npts): 377 temp = (content.dmax - content.dmin)/(content.npts - 1.0) 378 d = content.dmin + i * temp 379 361 380 self.pr_state.d_max = d 362 381 try: … … 380 399 except: 381 400 # This inversion failed, skip this D_max value 382 logging.error("ExploreDialog: inversion failed for D_max=%s\n%s" % (str(d), sys.exc_value)) 401 msg = "ExploreDialog: inversion failed " 402 msg += "for D_max=%s\n%s" % (str(d), sys.exc_value) 403 logging.error(msg) 383 404 384 405 self.results = results
Note: See TracChangeset
for help on using the changeset viewer.