def __makeObjects(self): """Add interactors""" exp = wx.GetApp().ws self.cmPanel = cmapPanel(self, wx.NewIdRef()) self.tbarSizer = makeTitleBar(self, 'Omega-Eta Plots', color=WP.BG_COLOR_TITLEBAR_PANEL1) # choice interactor for HKL hkls = exp.activeMaterial.planeData.getHKLs(asStr=True) self.hkl_cho = wx.Choice(self, wx.NewIdRef(), choices=hkls) self.hkl_cho.SetSelection(0) self.disp_cho = wx.Choice(self, wx.NewIdRef(), choices=self.DISP_METHODS) self.disp_cho.SetSelection(0) self.idata = 0 self.dispm = self.DISP_RAW self.coms = None # centers of mass from optional labeling self.exp_but = wx.Button(self, wx.NewIdRef(), 'Export') self.lab_but = wx.Button(self, wx.NewIdRef(), 'Label Spots') return
def __makeObjects(self): """Add interactors""" self.tbarSizer = makeTitleBar(self, 'Full Image Rebinning Results') self.cmPanel = cmapPanel(self, wx.NewIdRef()) self.exp_but = wx.Button(self, wx.NewIdRef(), 'Export') # return
def __makeObjects(self): """Add interactors""" self.tbarSizer = makeTitleBar(self, 'Full Image Rebinning Results') self.cmPanel = cmapPanel(self, wx.NewId()) self.exp_but = wx.Button(self, wx.NewId(), 'Export') # return
def __makeObjects(self): """Add interactors""" exp = wx.GetApp().ws self.cmPanel = cmapPanel(self, wx.NewId()) self.tbarSizer = makeTitleBar(self, 'Omega-Eta Plots', color=WP.BG_COLOR_TITLEBAR_PANEL1) # choice interactor for HKL hkls = exp.activeMaterial.planeData.getHKLs(asStr=True) self.hkl_cho = wx.Choice(self, wx.NewId(), choices=hkls) self.hkl_cho.SetSelection(0) self.disp_cho = wx.Choice(self, wx.NewId(), choices=self.DISP_METHODS) self.disp_cho.SetSelection(0) self.idata = 0 self.dispm = self.DISP_RAW self.coms = None # centers of mass from optional labeling self.exp_but = wx.Button(self, wx.NewId(), 'Export') self.lab_but = wx.Button(self, wx.NewId(), 'Label Spots') return
def __makeObjects(self): """Add interactors""" self.tbarSizer = makeTitleBar(self, "Graphics Canvas") self.SetBackgroundColour(WP.CANVAS_BG_COLOR) # # Make options sizer # nrow = 0 ncol = 2 padx = 5 pady = 5 self.optSizer = wx.FlexGridSizer(nrow, ncol, padx, pady) # self.optSizer.AddGrowableCol(num, proportion) # self.optSizer.AddGrowableRow(num, proportion) # # ===== OPTIONS # # * show image # self.showImage_box = wx.CheckBox(self, wx.NewId(), "Show Image") self.showImage_box.SetValue(True) self.optSizer.Add(self.showImage_box, 0, wx.LEFT | wx.EXPAND) self.optSizer.AddSpacer(1) # # * show rings # self.showCalRings_box = wx.CheckBox(self, wx.NewId(), "Show Rings") self.showCalRings_box.SetValue(False) # default self.optSizer.Add(self.showCalRings_box, 0, wx.LEFT | wx.EXPAND) self.optSizer.AddSpacer(1) # # * show ranges # self.showCalRanges_box = wx.CheckBox(self, wx.NewId(), "Show Ranges") self.showCalRanges_box.SetValue(False) # default self.optSizer.Add(self.showCalRanges_box, 0, wx.LEFT | wx.EXPAND) self.optSizer.AddSpacer(1) # # Add image list management # self.ail_lab = wx.StaticText(self, wx.NewId(), "Load Image", style=wx.ALIGN_CENTER) self.ail_cho = wx.Choice(self, wx.NewId(), choices=[]) self.nam_lab = wx.StaticText(self, wx.NewId(), "Name Image", style=wx.ALIGN_CENTER) self.nam_txt = wx.TextCtrl(self, wx.NewId(), value="<none>", style=wx.RAISED_BORDER | wx.TE_PROCESS_ENTER) self.eil_but = wx.Button(self, wx.NewId(), "Edit List") # # Add colormap panel # self.cmPanel = cmapPanel(self, wx.NewId()) # # ===== FIGURE CANVAS # self.figure = Figure() self.axes = self.figure.gca() self.axes.set_aspect("equal") self.canvas = FigureCanvas(self, wx.NewId(), self.figure) self.__add_toolbar() # comment this out for no toolbar def on_press(event): exp = wx.GetApp().ws det = exp.detector pd = exp.activeMaterial.planeData img = exp.active_img if img is None: return mainFrame = wx.GetApp().GetTopWindow() if hasattr(event, "xdata") and event.xdata: x = event.xdata xadj = x + 0.5 xint = numpy.floor(xadj) y = event.ydata yadj = y + 0.5 yint = numpy.floor(yadj) tth, eta = numpy.array(det.xyoToAng_V(y, x)) cartx, carty = det.cartesianCoordsOfPixelIndices(y, x) cx = (cartx - det.xc) / det.pixelPitch cy = (carty - det.yc) / det.pixelPitch rho = numpy.sqrt(cx * cx + cy * cy) dsp = 0.5 * pd.wavelength / numpy.sin(0.5 * tth) intens = img[yadj, xadj] hkls = str(pd.getHKLs(asStr=True, allHKLs=True, thisTTh=tth)) statText = "px=%g, py=%g, x=%g, y=%g, rho=%g, d=%g, " "tth=%g, eta=%g, int=%g, HKLs=%s" % ( x, y, cartx, carty, rho, dsp, r2d * tth, r2d * eta, intens, hkls, ) mainFrame.SetStatusText(statText) pass pass # cid = self.canvas.mpl_connect('button_press_event', on_press) cid = self.canvas.mpl_connect("motion_notify_event", on_press) return
def __makeObjects(self): """Add interactors""" self.tbarSizer = makeTitleBar(self, 'Graphics Canvas') self.SetBackgroundColour(WP.CANVAS_BG_COLOR) # # Make options sizer # nrow = 0 ncol = 2 padx = 5 pady = 5 self.optSizer = wx.FlexGridSizer(nrow, ncol, padx, pady) #self.optSizer.AddGrowableCol(num, proportion) #self.optSizer.AddGrowableRow(num, proportion) # # ===== OPTIONS # # * show image # self.showImage_box = wx.CheckBox(self, wx.NewId(), 'Show Image') self.showImage_box.SetValue(True) self.optSizer.Add(self.showImage_box, 0, wx.LEFT | wx.EXPAND) self.optSizer.AddSpacer(1) # # * show rings # self.showCalRings_box = wx.CheckBox(self, wx.NewId(), 'Show Rings') self.showCalRings_box.SetValue(False) # default self.optSizer.Add(self.showCalRings_box, 0, wx.LEFT | wx.EXPAND) self.optSizer.AddSpacer(1) # # * show ranges # self.showCalRanges_box = wx.CheckBox(self, wx.NewId(), 'Show Ranges') self.showCalRanges_box.SetValue(False) # default self.optSizer.Add(self.showCalRanges_box, 0, wx.LEFT | wx.EXPAND) self.optSizer.AddSpacer(1) # # Add image list management # self.ail_lab = wx.StaticText(self, wx.NewId(), 'Load Image', style=wx.ALIGN_CENTER) self.ail_cho = wx.Choice(self, wx.NewId(), choices=[]) self.nam_lab = wx.StaticText(self, wx.NewId(), 'Name Image', style=wx.ALIGN_CENTER) self.nam_txt = wx.TextCtrl(self, wx.NewId(), value='<none>', style=wx.RAISED_BORDER | wx.TE_PROCESS_ENTER) self.eil_but = wx.Button(self, wx.NewId(), 'Edit List') # # Add colormap panel # self.cmPanel = cmapPanel(self, wx.NewId()) # # ===== FIGURE CANVAS # self.figure = Figure() self.axes = self.figure.gca() self.axes.set_aspect('equal') self.canvas = FigureCanvas(self, wx.NewId(), self.figure) self.__add_toolbar() # comment this out for no toolbar def on_press(event): exp = wx.GetApp().ws det = exp.detector pd = exp.activeMaterial.planeData img = exp.active_img if img is None: return mainFrame = wx.GetApp().GetTopWindow() if hasattr(event, 'xdata') and event.xdata: x = event.xdata xadj = x + 0.5 xint = numpy.floor(xadj) y = event.ydata yadj = y + 0.5 yint = numpy.floor(yadj) tth, eta = numpy.array(det.xyoToAng(y, x)) cartx, carty = det.cartesianCoordsOfPixelIndices(y, x) cx = (cartx - det.xc) / det.pixelPitch cy = (carty - det.yc) / det.pixelPitch rho = numpy.sqrt(cx * cx + cy * cy) dsp = 0.5 * pd.wavelength / numpy.sin(0.5 * tth) intens = img[yint, xint] hkls = str(pd.getHKLs(asStr=True, allHKLs=True, thisTTh=tth)) statText = "px=%g, py=%g, x=%g, y=%g, rho=%g, d=%g, "\ "tth=%g, eta=%g, int=%g, HKLs=%s" %\ (x, y, cartx, carty, rho, dsp, r2d*tth, r2d*eta, intens, hkls) mainFrame.SetStatusText(statText) pass pass #cid = self.canvas.mpl_connect('button_press_event', on_press) cid = self.canvas.mpl_connect('motion_notify_event', on_press) return