Beispiel #1
0
    def __makeObjects(self):
        """Add interactors"""

        self.sz_titlebar = makeTitleBar(self, 'Indexing')
        self.hpage = callJoel(self)

        return
Beispiel #2
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'cakeCanvas')
        #
        #  see if we need cmPanel
        #
        #self.cmPanel = cmapPanel(self, wx.NewId())
        #self.cmPanel.Disable()
        #
        if   self.cakeType == prOpts.CAKE_IMG:
            # full image caking panel
            pass
        elif self.cakeType == prOpts.CAKE_RNG:
            # multiring panel
            self.opt_pan = rngOpts(self, wx.NewId())
            pass
        elif self.cakeType == prOpts.CAKE_SPH:
            # omega-eta panel
            pass
        
        self.__makeFigureCanvas()
        #

        return
Beispiel #3
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Options for Multiring Rebin')

        self.ring_pan = ringPanel(self, wx.NewId())

        self.emin_lab = wx.StaticText(self, wx.NewId(), 
                                      'Eta min', 
                                      style=wx.ALIGN_RIGHT)
        self.emax_lab = wx.StaticText(self, wx.NewId(), 
                                      'Eta max', 
                                      style=wx.ALIGN_RIGHT)
        self.emin_txt = wx.TextCtrl(self, wx.NewId(), 
                                    value='0', 
                                    style=wx.RAISED_BORDER | wx.TE_PROCESS_ENTER)
        self.emax_txt = wx.TextCtrl(self, wx.NewId(), 
                                    value='360', 
                                    style=wx.RAISED_BORDER | wx.TE_PROCESS_ENTER)        
        self.numEta_lab = wx.StaticText(self, wx.NewId(), 
                                        'Number of Eta Bins', 
                                         style=wx.ALIGN_RIGHT)
        self.numRho_lab = wx.StaticText(self, wx.NewId(), 
                                        'Rho Bins Per Ring', 
                                         style=wx.ALIGN_RIGHT)        
        self.numEta_spn = wx.SpinCtrl(self, wx.NewId(), min=1, value=str(36) )
        self.numRho_spn = wx.SpinCtrl(self, wx.NewId(), min=1, value=str(20) )

        return
Beispiel #4
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Log')
        #
        self.log_pan = logPanel(self, wx.NewId())
	#
        return
Beispiel #5
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Multiring Rebinning Results')
        #
        self.unit_cho = wx.Choice(self, wx.NewId(), choices=rngOpts.unitList)
        self.exp_but  = wx.Button(self, wx.NewId(), 'Export')
	#self.Bind(wx.EVT_CHOICE, self.OnChoice, self.choice)
        
        return
Beispiel #6
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, ' Reader Panel ')
        #
        #  Add detector choice
        #
        self.det_cho = wx.Choice(self, wx.NewId(), 
                                 choices=DET_CHOICES)
        self.rdr_pan = geReaderPanel(self, wx.NewId())

        return
Beispiel #7
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Options for Spherical Rebin')
        #
        #  Integer inputs
        #
        self.lump_lab = wx.StaticText(self, wx.NewId(), 'lump', style=wx.ALIGN_CENTER)
        self.lump_spn  = wx.SpinCtrl(self, wx.NewId(), min=1, max=1000, initial=1)

        self.bins_lab = wx.StaticText(self, wx.NewId(), 'bins', style=wx.ALIGN_CENTER)
        self.bins_spn  = wx.SpinCtrl(self, wx.NewId(), min=1, max=10000, initial=600)

        self.thresh_lab = wx.StaticText(self, wx.NewId(), 'threshold',
                                        style=wx.ALIGN_CENTER)
        self.thresh_spn  = wx.SpinCtrl(self, wx.NewId(), min=1, max=1000, initial=20)
        #
        #  Material and HKLs selector
        #
        exp = wx.GetApp().ws
        self.matl_cho = wx.Choice(self, wx.NewId(), choices=exp.matNames)
        self.matl_cho.SetSelection(0)
        self.read_cho = wx.Choice(self, wx.NewId(), choices=exp.readerNames)
        self.read_cho.SetSelection(0)
        self.hkls_but = wx.Button(self, wx.NewId(), 'Select HKL')
        #
        #  Angle/axis
        #
        name = 'angle'
        self.angle_lab = wx.StaticText(self, wx.NewId(), name, style=wx.ALIGN_CENTER)
        self.angle_flt = FloatControl(self, wx.NewId())
        self.angle_flt.SetValue(1.0)
        
        name = 'axis x'
        self.axis1_lab = wx.StaticText(self, wx.NewId(), name, style=wx.ALIGN_CENTER)
        self.axis1_flt = FloatControl(self, wx.NewId())
        self.axis1_flt.SetValue(1.0)
        
        name = 'axis y'
        self.axis2_lab = wx.StaticText(self, wx.NewId(), name, style=wx.ALIGN_CENTER)
        self.axis2_flt = FloatControl(self, wx.NewId())
        self.axis2_flt.SetValue(1.0)
        
        name = 'axis z'
        self.axis3_lab = wx.StaticText(self, wx.NewId(), name, style=wx.ALIGN_CENTER)
        self.axis3_flt = FloatControl(self, wx.NewId())
        self.axis3_flt.SetValue(1.0)
        

        return
Beispiel #8
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Rings',
                                      color=WP.TITLEBAR_BG_COLOR_PANEL1)
        #
        #  b.  Wavelength
        #
        self.dfwv_but  = wx.Button(self, wx.NewId(), 'Make Default')
        self.dfwv_but.SetToolTipString(dfltToolTip)

        self.wave_lab = wx.StaticText(self, wx.NewId(), 
                                        'Wavelength:', 
                                        style=wx.ALIGN_RIGHT)
        self.waveAng_txt = wx.TextCtrl(self, wx.NewId(), 
                                       value='0', 
                                       style=wx.RAISED_BORDER | wx.TE_PROCESS_ENTER)
        self.waveAng_lab = wx.StaticText(self, wx.NewId(), 
                                         WAVELENGTH_UNIT, 
                                         style=wx.ALIGN_RIGHT)
        self.waveKEV_txt = wx.TextCtrl(self, wx.NewId(), 
                                       value='0', 
                                       style=wx.RAISED_BORDER | wx.TE_PROCESS_ENTER)
        self.waveKEV_lab = wx.StaticText(self, wx.NewId(), 
                                         'keV', 
                                         style=wx.ALIGN_RIGHT)
        #
        #  c.  Edit HKLs
        #
        self.hkl_but  = wx.Button(self, wx.NewId(), 'Edit HKLs')
        #
        #  d.  Ring widths
        #
        self.dfwd_but  = wx.Button(self, wx.NewId(), 'Make Default')
        self.dfwd_but.SetToolTipString(dfltToolTip)

        self.width_lab = wx.StaticText(self, wx.NewId(), 
                                        'Ring Width:', 
                                        style=wx.ALIGN_RIGHT)
        self.width_cho = wx.Choice(self, wx.NewId(), choices=widChoices)

        self.width_txt = wx.TextCtrl(self, wx.NewId(), 
                                     value='1.0e-3', 
                                     style=wx.RAISED_BORDER | wx.TE_PROCESS_ENTER)
        #
        self.updateFromExp()

        return
Beispiel #9
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Spots')

        app = wx.GetApp(); exp = app.ws

        # Material Choice

	self.mat_lab = wx.StaticText(self, -1, 'material', 
                                     style=wx.ALIGN_CENTER|wx.SIMPLE_BORDER) 
        self.mat_cho = wx.Choice(self, wx.NewId(), choices=exp.matNames)
        
        # Beam Energy

        self.beam_lab = wx.StaticText(
            self, wx.NewId(), 
            'Beam Energy (keV)', style=wx.ALIGN_CENTER)
        self.beam_txt = wx.TextCtrl(
            self, wx.NewId(), value='', 
            style=wx.RAISED_BORDER)

        # Threshold

        self.thresh_lab = wx.StaticText(
            self, wx.NewId(), 
            'Threshold', style=wx.ALIGN_CENTER)
        self.thresh_txt = wx.TextCtrl(
            self, wx.NewId(), value='', 
            style=wx.RAISED_BORDER)

        # Min PX

        self.minpx_lab = wx.StaticText(
            self, wx.NewId(), 
            'Min PX', style=wx.ALIGN_CENTER)
        self.minpx_txt = wx.TextCtrl(
            self, wx.NewId(), value='', 
            style=wx.RAISED_BORDER)

        self.run  = wx.Button(self, wx.NewId(), 'Find Spots')        

        return
Beispiel #10
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Colormap',
                                      color=WP.BG_COLOR_TITLEBAR_PANEL1)
        #
        #  * choose colormap and vmin and vmax
        #
        self.cmap_lab = wx.StaticText(self, wx.NewId(), 
                                        'Colormap:  ', 
                                        style=wx.ALIGN_RIGHT)
        
        self.cmap_nameList = ['autumn', 'bone', 'bone_r', 'cool', 'copper', 
                              'flag', 'gray', 'gray_r', 'hot', 'hot_r',
                              'hsv', 'jet', 'pink', 'prism', 'spring',
                              'summer', 'winter', 'spectral']
        self.cmap_cho = wx.Choice(self, wx.NewId(), 
                                  choices=self.cmap_nameList)
        
        self.cmap_name = 'bone'
        self.cmap_cho.SetStringSelection(self.cmap_name)
        
        self.cmin_val = 0
        self.cmin_lab = wx.StaticText(self, wx.NewId(), 
                                        'Minimum:  ', 
                                        style=wx.ALIGN_RIGHT)
        self.cmin_txt = wx.TextCtrl(self, wx.NewId(), 
                                       value=str(self.cmin_val), 
                                       style=wx.RAISED_BORDER | wx.TE_PROCESS_ENTER)
        self.cmUnder_box = wx.CheckBox(self, wx.NewId(), 'show under')

        self.cmax_val = 2000
        self.cmax_lab = wx.StaticText(self, wx.NewId(), 
                                        'Maximum:  ', 
                                        style=wx.ALIGN_RIGHT)
        self.cmax_txt = wx.TextCtrl(self, wx.NewId(), 
                                       value=str(self.cmax_val), 
                                       style=wx.RAISED_BORDER | wx.TE_PROCESS_ENTER)
        self.cmOver_box = wx.CheckBox(self, wx.NewId(), 'show over')
        

        return
Beispiel #11
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Polar Rebinning')
        #
        self.std_pan = standardOptsPanel(self, wx.NewId())
        self.mrb_pan = multiringOptsPanel(self, wx.NewId())
        self.sph_pan = sphericalOptsPanel(self, wx.NewId())
        #
        #  Method
        #
        self.method_cho = wx.Choice(self, wx.NewId(), choices=prOpts.cakeMethods)
        self.method_cho.SetSelection(1)
        #
        #  Run
        #
        self.run_but   = wx.Button(self, wx.NewId(), 'Run Polar Rebin')
        #
        #  Canvas for figures moved to separate window:  see cakingCanvas.py
        #
        return
Beispiel #12
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Options for Standard Rebin',
                                      color=WP.BG_COLOR_TITLEBAR_PANEL1)
        #
        #  Labels
        #
        self.min_lab = wx.StaticText(self, wx.NewId(), 'min', style=wx.ALIGN_CENTER)
        self.max_lab = wx.StaticText(self, wx.NewId(), 'max', style=wx.ALIGN_CENTER)
        self.num_lab = wx.StaticText(self, wx.NewId(), 'num', style=wx.ALIGN_CENTER)
        self.rho_lab = wx.StaticText(self, wx.NewId(), 'rho', style=wx.ALIGN_CENTER)
        self.eta_lab = wx.StaticText(self, wx.NewId(), 'eta', style=wx.ALIGN_CENTER)
        #
        #  Rho
        #
        self.rmin_spn  = wx.SpinCtrl(self, wx.NewId(), min=1, max=10000, value=str(100))
        self.rmax_spn  = wx.SpinCtrl(self, wx.NewId(), min=1, max=10000, value=str(1000))
        self.rnum_spn  = wx.SpinCtrl(self, wx.NewId(), min=1, max=10000, value=str(500))
        #
        #  Eta
        #
        self.emin_spn  = wx.SpinCtrl(self, wx.NewId(), min=-360, max=360, value=str(0))
        self.emax_spn  = wx.SpinCtrl(self, wx.NewId(), min=-360, max=360, value=str(360))
        self.enum_spn  = wx.SpinCtrl(self, wx.NewId(), min=1,    max=360, value=str(36))
        #
        #  Other options
        #
        self.corr_cbox = wx.CheckBox(self, wx.NewId(), 'corrected')
        self.npdv_lab  = wx.StaticText(self, wx.NewId(), 'pixel divisions',
                                      style=wx.ALIGN_CENTER)
        self.npdv_spn  = wx.SpinCtrl(self, wx.NewId(), min=1, max=10, initial=1)
        self.frame_lab = wx.StaticText(self, wx.NewId(), 'frame',
                                       style=wx.ALIGN_CENTER)
        self.frame_cho = wx.Choice(self, wx.NewId(), choices=['frame 1'])
        
        return
Beispiel #13
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Rebin Canvas')
        #
        #  Add canvas panel
        #
        self.cpan = cakeCanvas(self, wx.NewId(),  self.cakeType, self.data)    
	#
        # A Statusbar in the bottom of the window
        #
        self.CreateStatusBar()
	#
        # Creating the menubar.
        #
        # menuBar = wx.MenuBar()
        # self.CreateFileMenu()
        # menuBar.Append(self.filemenu,  "&File") 
        # self.CreateTableMenu()
        # menuBar.Append(self.tablemenu, "&Table")
        # 
        # self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.

        return
Beispiel #14
0
    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 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.activeImage
            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
Beispiel #15
0
    def __makeObjects(self):
        """Add interactors"""
        #
        exp = wx.GetApp().ws
        #
        #  Titlebar
        #
        self.tbarSizer = makeTitleBar(self, 'Detector Calibration')
        #
        #  Material Selection
        #
        self.mats_lab = wx.StaticText(self, wx.NewId(), 
                                        'Active Material', style=wx.ALIGN_CENTER)
        self.mats_cho = wx.Choice(self, wx.NewId(), 
                                  choices=[m.name for m in exp.matList])
        #
        #  Rings panel
        #
        self.ring_pan = ringPanel(self, wx.NewId())
        #
        #  II.  Geometry
        #
        #  Will have a checkbox and a spin control for each parameter.
        #
        self.detLabSizer = makeTitleBar(self, 'Detector Parameters',
                                          color=WP.TITLEBAR_BG_COLOR_PANEL1)
        deltaBoxTip = "Use this box to set the increment for the spinner to the left"
        app = wx.GetApp()
        det = app.ws.detector

        name = 'x Center'
        self.cbox_xc  = wx.CheckBox(self, wx.NewId(), name)
        self.float_xc = FloatControl(self, wx.NewId())
        self.float_xc.SetValue(det.xc)
        self.float_xc.SetDelta(0.5*det.pixelPitch)
        
        name = 'y Center'
        self.cbox_yc  = wx.CheckBox(self, wx.NewId(), name)
        self.float_yc = FloatControl(self, wx.NewId())
        self.float_yc.SetValue(det.yc)
        self.float_yc.SetDelta(0.5*det.pixelPitch)

        name = 'Distance'
        self.cbox_D  = wx.CheckBox(self, wx.NewId(), name)
        self.float_D = FloatControl(self, wx.NewId())
        self.float_D.SetValue(det.workDist)
        self.float_D.SetDelta(10*det.pixelPitch)

        name = 'x Tilt'
        self.cbox_xt  = wx.CheckBox(self, wx.NewId(), name)
        self.float_xt = FloatControl(self, wx.NewId())
        self.float_xt.SetValue(det.xTilt)

        name = 'y Tilt'
        self.cbox_yt  = wx.CheckBox(self, wx.NewId(), name)
        self.float_yt = FloatControl(self, wx.NewId())
        self.float_yt.SetValue(det.yTilt)

        name = 'z Tilt'
        self.cbox_zt  = wx.CheckBox(self, wx.NewId(), name)
        self.float_zt = FloatControl(self, wx.NewId())
        self.float_zt.SetValue(det.yTilt)
        #
        #  Distortion parameters
        #
        #  *) NOTE THAT THESE ARE SPECIFIC FOR THE GE
        #  *) must break these out into a subpanel, as the 
        #     number (if any at all) will change for each
        #     detector type.
        name = 'p0'
        self.cbox_d1  = wx.CheckBox(self, wx.NewId(), name)
        self.float_d1 = FloatControl(self, wx.NewId())
        self.float_d1.SetValue(det.dparms[0])
        
        name = 'p1'
        self.cbox_d2  = wx.CheckBox(self, wx.NewId(), name)
        self.float_d2 = FloatControl(self, wx.NewId())
        self.float_d2.SetValue(det.dparms[1])
        
        name = 'p2'
        self.cbox_d3  = wx.CheckBox(self, wx.NewId(), name)
        self.float_d3 = FloatControl(self, wx.NewId())
        self.float_d3.SetValue(det.dparms[2])
        
        name = 'n0'
        self.cbox_d4  = wx.CheckBox(self, wx.NewId(), name)
        self.float_d4 = FloatControl(self, wx.NewId())
        self.float_d4.SetValue(det.dparms[3])
        
        name = 'n1'
        self.cbox_d5  = wx.CheckBox(self, wx.NewId(), name)
        self.float_d5 = FloatControl(self, wx.NewId())
        self.float_d5.SetValue(det.dparms[4])
        
        name = 'n2'
        self.cbox_d6  = wx.CheckBox(self, wx.NewId(), name)
        self.float_d6 = FloatControl(self, wx.NewId())
        self.float_d6.SetValue(det.dparms[5])
        #
        #  Fitting method
        # 
        self.fitLabelSizer = makeTitleBar(self, 'Fitting Method',
                                          color=WP.TITLEBAR_BG_COLOR_PANEL1)
        self.fitDir_rb = wx.RadioButton(self, wx.NewId(), 'Direct Fit',
                                       style=wx.RB_GROUP)
        self.fitBin_rb = wx.RadioButton(self, wx.NewId(), 'Binned Fit')
        #
        #  III. Caking
        #
        self.numEta_lab = wx.StaticText(self, wx.NewId(), 
                                        'Azimuthal bins', 
                                         style=wx.ALIGN_RIGHT)
        self.numRho_lab = wx.StaticText(self, wx.NewId(), 
                                        'Radial bins per ring', 
                                         style=wx.ALIGN_RIGHT)
        self.numEta_spn = wx.SpinCtrl(self, wx.NewId(), min=12, initial=36)
        self.numRho_spn = wx.SpinCtrl(self, wx.NewId(), min=10, initial=20)
        #
        #  Fit button with options (at some point)
        #
        self.runFit_but  = wx.Button(self, wx.NewId(), 'Run Fit')

        return