Exemplo n.º 1
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Grain Spotter Options',
                                      color=WP.BG_COLOR_PANEL1_TITLEBAR)

        self.pfit_cbox = wx.CheckBox(self, wx.NewId(), 'Position Fit')

        label = 'Minimum Completeness'
        self.comp_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_CENTER)
        self.comp_txt = wx.TextCtrl(self, wx.NewId(), value='0.5',
                                    style=wx.RAISED_BORDER)

        label = 'Minimum Fraction of G-Vectors'
        self.fracG_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_CENTER)
        self.fracG_txt = wx.TextCtrl(self, wx.NewId(), value='0.5',
                                    style=wx.RAISED_BORDER)

        label = 'Sigmas'
        self.sigmas_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_CENTER)
        self.sigmas_txt = wx.TextCtrl(self, wx.NewId(), value='2.0',
                                    style=wx.RAISED_BORDER)

        self.trials_lab = wx.StaticText(self, wx.NewId(), 'Number of Trials',
                                      style=wx.ALIGN_CENTER)
        self.trials_spn = wx.SpinCtrl(self, wx.NewId(),
                                     min=1000, max=1000000, initial=100000)


        return
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
    def __makeObjects(self):
        """Add interactors"""

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

        return
Exemplo n.º 4
0
    def __makeObjects(self):
        """Add interactors"""

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

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

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

        return
Exemplo n.º 5
0
    def __makeObjects(self):
        """Add interactors"""

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

        return
Exemplo n.º 6
0
    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
Exemplo n.º 7
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
Exemplo n.º 8
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
Exemplo n.º 9
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Grain Spotter Options',
                                      color=WP.BG_COLOR_PANEL1_TITLEBAR)

        self.pfit_cbox = wx.CheckBox(self, wx.NewId(), 'Position Fit')

        label = 'Minimum Completeness'
        self.comp_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_CENTER)
        self.comp_txt = wx.TextCtrl(self, wx.NewId(), value='0.5',
                                    style=wx.RAISED_BORDER)

        label = 'Minimum Fraction of G-Vectors'
        self.fracG_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_CENTER)
        self.fracG_txt = wx.TextCtrl(self, wx.NewId(), value='0.5',
                                    style=wx.RAISED_BORDER)

        label = 'Sigmas'
        self.sigmas_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_CENTER)
        self.sigmas_txt = wx.TextCtrl(self, wx.NewId(), value='2.0',
                                    style=wx.RAISED_BORDER)

        self.trials_lab = wx.StaticText(self, wx.NewId(), 'Number of Trials',
                                      style=wx.ALIGN_CENTER)
        self.trials_spn = wx.SpinCtrl(self, wx.NewId(),
                                     min=1000, max=1000000, initial=100000)


        return
Exemplo n.º 10
0
 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
Exemplo n.º 11
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.NewIdRef(), 'Make Default')
        self.dfwv_but.SetToolTip(dfltToolTip)

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

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

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

        return
Exemplo n.º 12
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Log')
        #
        self.log_pan = logPanel(self, wx.NewId())
	#
        return
Exemplo n.º 13
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Log')
        #
        self.log_pan = logPanel(self, wx.NewId())
        #
        return
Exemplo n.º 14
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self,
                                      ' Single Frame Options ',
                                      color=WP.TITLEBAR_BG_COLOR_PANEL1)

        self.file_lctrl = self.__makeListCtrl()

        return
Exemplo n.º 15
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
Exemplo n.º 16
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, ' Single Frame Options ',
                                      color=WP.TITLEBAR_BG_COLOR_PANEL1)


        self.file_lctrl = self.__makeListCtrl()

        return
Exemplo n.º 17
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
Exemplo n.º 18
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
Exemplo n.º 19
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
Exemplo n.º 20
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', 'bwr', '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')

        self.apply_filter = False
        self.filter_val = 0.8
        self.applyFilter_txt = wx.TextCtrl(self, wx.NewId(),
                                           value=str(self.filter_val),
                                           style=wx.RAISED_BORDER | wx.TE_PROCESS_ENTER)
        self.applyFilter_lab =  wx.StaticText(self, wx.NewId(),
                                              'Apply filter:  ',
                                              style=wx.ALIGN_RIGHT)
        self.applyFilter_box = wx.CheckBox(self, wx.NewId(), 'apply filter')

        return
Exemplo n.º 21
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Options for Spherical Rebin',
                                      color=WP.BG_COLOR_TITLEBAR_PANEL1)
        #
        #  Integer inputs
        #
        self.lump_lab = wx.StaticText(self, wx.NewId(), '# lumped frames (omega)', 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(), 'azimuthal bins (eta)', 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
Exemplo n.º 22
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Options for Spherical Rebin',
                                      color=WP.BG_COLOR_TITLEBAR_PANEL1)
        #
        #  Integer inputs
        #
        self.lump_lab = wx.StaticText(self, wx.NewIdRef(), '# lumped frames (omega)', style=wx.ALIGN_CENTER)
        self.lump_spn  = wx.SpinCtrl(self, wx.NewIdRef(), min=1, max=1000, initial=1)

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

        self.thresh_lab = wx.StaticText(self, wx.NewIdRef(), 'threshold',
                                        style=wx.ALIGN_CENTER)
        self.thresh_spn  = wx.SpinCtrl(self, wx.NewIdRef(), min=0, max=10000, initial=20)
        #
        #  Material and HKLs selector
        #
        exp = wx.GetApp().ws
        self.matl_cho = wx.Choice(self, wx.NewIdRef(), choices=exp.matNames)
        self.matl_cho.SetSelection(0)
        self.read_cho = wx.Choice(self, wx.NewIdRef(), choices=exp.readerNames)
        self.read_cho.SetSelection(0)
        self.hkls_but = wx.Button(self, wx.NewIdRef(), 'Select HKL')
        #
        #  Angle/axis
        #
        name = 'angle'
        self.angle_lab = wx.StaticText(self, wx.NewIdRef(), name, style=wx.ALIGN_CENTER)
        self.angle_flt = FloatControl(self, wx.NewIdRef())
        self.angle_flt.SetValue(1.0)

        name = 'axis x'
        self.axis1_lab = wx.StaticText(self, wx.NewIdRef(), name, style=wx.ALIGN_CENTER)
        self.axis1_flt = FloatControl(self, wx.NewIdRef())
        self.axis1_flt.SetValue(1.0)

        name = 'axis y'
        self.axis2_lab = wx.StaticText(self, wx.NewIdRef(), name, style=wx.ALIGN_CENTER)
        self.axis2_flt = FloatControl(self, wx.NewIdRef())
        self.axis2_flt.SetValue(1.0)

        name = 'axis z'
        self.axis3_lab = wx.StaticText(self, wx.NewIdRef(), name, style=wx.ALIGN_CENTER)
        self.axis3_flt = FloatControl(self, wx.NewIdRef())
        self.axis3_flt.SetValue(1.0)


        return
Exemplo n.º 23
0
    def __makeObjects(self):
        """Add interactors"""
        exp = wx.GetApp().ws
        ind_opts = exp.index_opts

        self.sz_titlebar = makeTitleBar(self, 'Indexing')
        self.method_cho = wx.Choice(self, wx.NewId(),
                                    choices=ind_opts.INDEX_CHOICES)
        self.method_cho.SetSelection(ind_opts.IND_FIBER)
        self.run_but  = wx.Button(self, wx.NewId(), 'Run Indexer')

        self.fiber_pan = FiberSearchPanel(self, wx.NewId())
        self.gspot_pan = GrainSpotterPanel(self, wx.NewId())

        return
Exemplo n.º 24
0
    def __makeObjects(self):
        """Add interactors"""
        exp = wx.GetApp().ws
        ind_opts = exp.index_opts

        self.sz_titlebar = makeTitleBar(self, 'Indexing')
        self.method_cho = wx.Choice(self, wx.NewId(),
                                    choices=ind_opts.INDEX_CHOICES)
        self.method_cho.SetSelection(ind_opts.IND_FIBER)
        self.run_but  = wx.Button(self, wx.NewId(), 'Run Indexer')

        self.fiber_pan = FiberSearchPanel(self, wx.NewId())
        self.gspot_pan = GrainSpotterPanel(self, wx.NewId())

        return
Exemplo n.º 25
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
Exemplo n.º 26
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, ' Information ',
                                      color=WP.TITLEBAR_BG_COLOR_PANEL1)

        #
        #  File lists for display.
        #

        self.img_txt_lab = wx.StaticText(self, wx.NewId(), 'Image Directory',
                                         style=wx.ALIGN_CENTER)
        self.img_txt = wx.TextCtrl(self, wx.NewId(), value='<no images loaded>',
                                   style=wx.RAISED_BORDER)

        return
Exemplo n.º 27
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, ' Information ',
                                      color=WP.TITLEBAR_BG_COLOR_PANEL1)

        #
        #  File lists for display.
        #

        self.img_txt_lab = wx.StaticText(self, wx.NewId(), 'Image Directory',
                                         style=wx.ALIGN_CENTER)
        self.img_txt = wx.TextCtrl(self, wx.NewId(), value='<no images loaded>',
                                   style=wx.RAISED_BORDER)

        return
Exemplo n.º 28
0
    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

        return
Exemplo n.º 29
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
Exemplo n.º 30
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Polar Rebinning')
        #
        self.std_pan = standardOptsPanel(self, wx.NewIdRef())
        self.mrb_pan = multiringOptsPanel(self, wx.NewIdRef())
        self.sph_pan = sphericalOptsPanel(self, wx.NewIdRef())
        #
        #  Method
        #
        self.method_cho = wx.Choice(self, wx.NewIdRef(), choices=prOpts.cakeMethods)
        self.method_cho.SetSelection(2)
        #
        #  Run
        #
        self.run_but   = wx.Button(self, wx.NewIdRef(), 'Run Polar Rebin')
        #
        #  Canvas for figures moved to separate window:  see cakingCanvas.py
        #
        return
Exemplo n.º 31
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(2)
        #
        #  Run
        #
        self.run_but   = wx.Button(self, wx.NewId(), 'Run Polar Rebin')
        #
        #  Canvas for figures moved to separate window:  see cakingCanvas.py
        #
        return
Exemplo n.º 32
0
    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
Exemplo n.º 33
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'cakeCanvas')
        #
        if   self.cakeType == prOpts.CAKE_IMG:
            self.opt_pan = imgOpts(self, wx.NewId())
            # 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
            self.opt_pan = sphOpts(self, wx.NewId())
            pass

        self._makeFigureCanvas()
        #

        return
Exemplo n.º 34
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'cakeCanvas')
        #
        if self.cakeType == prOpts.CAKE_IMG:
            self.opt_pan = imgOpts(self, wx.NewIdRef())
            # full image caking panel
            pass
        elif self.cakeType == prOpts.CAKE_RNG:
            # multiring panel
            self.opt_pan = rngOpts(self, wx.NewIdRef())
            pass
        elif self.cakeType == prOpts.CAKE_SPH:
            # omega-eta panel
            self.opt_pan = sphOpts(self, wx.NewIdRef())
            pass

        self._makeFigureCanvas()
        #

        return
Exemplo n.º 35
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.NewIdRef(), 'min', style=wx.ALIGN_CENTER)
        self.max_lab = wx.StaticText(self, wx.NewIdRef(), 'max', style=wx.ALIGN_CENTER)
        self.num_lab = wx.StaticText(self, wx.NewIdRef(), 'num', style=wx.ALIGN_CENTER)
        self.rho_lab = wx.StaticText(self, wx.NewIdRef(), 'rho', style=wx.ALIGN_CENTER)
        self.eta_lab = wx.StaticText(self, wx.NewIdRef(), 'eta', style=wx.ALIGN_CENTER)
        #
        #  Rho
        #
        self.rmin_spn  = wx.SpinCtrl(self, wx.NewIdRef(), min=1, max=10000, value=str(100))
        self.rmax_spn  = wx.SpinCtrl(self, wx.NewIdRef(), min=1, max=10000, value=str(1000))
        self.rnum_spn  = wx.SpinCtrl(self, wx.NewIdRef(), min=1, max=10000, value=str(500))
        #
        #  Eta
        #
        self.emin_spn  = wx.SpinCtrl(self, wx.NewIdRef(), min=-360, max=360, value=str(0))
        self.emax_spn  = wx.SpinCtrl(self, wx.NewIdRef(), min=-360, max=360, value=str(360))
        self.enum_spn  = wx.SpinCtrl(self, wx.NewIdRef(), min=1,    max=360, value=str(36))
        #
        #  Other options
        #
        self.corr_cbox = wx.CheckBox(self, wx.NewIdRef(), 'corrected')
        self.npdv_lab  = wx.StaticText(self, wx.NewIdRef(), 'pixel divisions',
                                      style=wx.ALIGN_CENTER)
        self.npdv_spn  = wx.SpinCtrl(self, wx.NewIdRef(), min=1, max=10, initial=1)
        self.frame_lab = wx.StaticText(self, wx.NewIdRef(), 'frame',
                                       style=wx.ALIGN_CENTER)
        self.frame_cho = wx.Choice(self, wx.NewIdRef(), choices=['frame 1'])

        return
Exemplo n.º 36
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
Exemplo n.º 37
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
Exemplo n.º 38
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Rebin Canvas')
        #
        #  Add canvas panel
        #
        self.cpan = cakeCanvas(self, wx.NewIdRef(), 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
Exemplo n.º 39
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 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
Exemplo n.º 40
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)

        # list of sequential colormap names
        self.cmap_nameList = [
            'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r',
            'bone', 'bone_r', 'cool', 'cool_r', 'copper', 'copper_r',
            'cubehelix', 'cubehelix_r', 'gist_earth', 'gist_earth_r',
            'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r',
            'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot_r', 'gnuplot2',
            'gnuplot2_r', 'gray', 'gray_r', 'hot', 'hot_r', 'inferno',
            'inferno_r', 'magma', 'magma_r', 'pink', 'pink_r', 'plasma',
            'plasma_r', 'spring', 'spring_r', 'summer', 'summer_r', 'terrain',
            'terrain_r', 'viridis', 'viridis_r', 'winter', 'winter_r'
        ]

        self.cmap_cho = wx.Choice(self, wx.NewId(), choices=self.cmap_nameList)

        self.cmap_name = 'inferno'
        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')

        self.apply_filter = False
        self.filter_val = 0.8
        self.applyFilter_txt = wx.TextCtrl(self,
                                           wx.NewId(),
                                           value=str(self.filter_val),
                                           style=wx.RAISED_BORDER
                                           | wx.TE_PROCESS_ENTER)
        self.applyFilter_lab = wx.StaticText(self,
                                             wx.NewId(),
                                             'Apply filter:  ',
                                             style=wx.ALIGN_RIGHT)
        self.applyFilter_box = wx.CheckBox(self, wx.NewId(), 'apply filter')

        return
Exemplo n.º 41
0
    def __makeObjects(self):
        """Add interactors"""
        exp = wx.GetApp().ws
        iopts = exp.index_opts

        self.tbarSizer = makeTitleBar(self, 'Fiber Search Options',
                                      color=WP.BG_COLOR_PANEL1_TITLEBAR)

        # checkboxes

        self.friedel_cbox = wx.CheckBox(self, wx.NewId(), 'Friedel Only')
        self.friedel_cbox.SetValue(iopts.friedelOnly)
        self.claims_cbox = wx.CheckBox(self, wx.NewId(), 'Preserve Claims')
        self.claims_cbox.SetValue(iopts.preserveClaims)
        self.refine_cbox  = wx.CheckBox(self, wx.NewId(), 'Do Refinement')
        self.refine_cbox.SetValue(iopts.doRefinement)
        self.multi_cbox  = wx.CheckBox(self, wx.NewId(), 'Use Multiprocessing')
        self.multi_cbox.SetValue(iopts.doMultiProc)

        # value boxes

        self.etol_lab = wx.StaticText(self, wx.NewId(), 'Eta Tolerance',
                                      style=wx.ALIGN_RIGHT)
        self.etol_txt = wx.TextCtrl(self, wx.NewId(), value=str(iopts.etaTol),
                                    style=wx.RAISED_BORDER)

        self.otol_lab = wx.StaticText(self, wx.NewId(), 'Omega Tolerance',
                                      style=wx.ALIGN_RIGHT)
        self.otol_txt = wx.TextCtrl(self, wx.NewId(), value=str(iopts.omeTol),
                                    style=wx.RAISED_BORDER)

        self.steps_lab = wx.StaticText(self, wx.NewId(), 'Number of Steps',
                                      style=wx.ALIGN_RIGHT)
        self.steps_spn = wx.SpinCtrl(self, wx.NewId(),
                                     min=36, max=36000, initial=iopts.nsteps)

        label = 'Minimum Completeness'
        self.comp_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_RIGHT)
        self.comp_txt = wx.TextCtrl(self, wx.NewId(),
                                    value=str(iopts.minCompleteness),
                                    style=wx.RAISED_BORDER)

        label = 'Minimum Fraction Claimed'
        self.claim_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_RIGHT)
        self.claim_txt = wx.TextCtrl(self, wx.NewId(),
                                     value=str(iopts.minPctClaimed),
                                     style=wx.RAISED_BORDER)

        label = 'Number of CPUs'
        self.ncpus_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_RIGHT)
        self.ncpus_spn = wx.SpinCtrl(self, wx.NewId(),
                                     min=1, max=ncpus_DFLT, initial=ncpus_DFLT)

        label = 'Quit After This Many'
        self.qafter_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_RIGHT)
        self.qafter_spn = wx.SpinCtrl(self, wx.NewId(),
                                     min=0, max=100000, initial=0)

        self.hkls_but = wx.Button(self, wx.NewId(), 'HKLs')

        return
Exemplo n.º 42
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 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
Exemplo n.º 43
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

        self.nrows_txt = wx.TextCtrl(self, wx.NewId(), value=str(det.nrows), style=wx.RAISED_BORDER)
        self.ncols_txt = wx.TextCtrl(self, wx.NewId(), value=str(det.ncols), style=wx.RAISED_BORDER)
        self.pixel_txt = wx.TextCtrl(self, wx.NewId(), value=str(det.pixelPitch), style=wx.RAISED_BORDER)
        self.pixel_txt_s = wx.TextCtrl(self, wx.NewId(), value=str(det.pixelPitch), style=wx.RAISED_BORDER|wx.TE_READONLY)
        
        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.zTilt)

        name = 'chi Tilt'
        self.cbox_ct  = wx.CheckBox(self, wx.NewId(), name)
        self.float_ct = FloatControl(self, wx.NewId())
        self.float_ct.SetValue(det.chiTilt)

        #
        #  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
Exemplo n.º 44
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Spots')
        self.tbar_raw = makeTitleBar(self, 'Raw Spots',
                                     color=WP.BG_COLOR_TITLEBAR_PANEL1)
        self.tbar_ind = makeTitleBar(self, 'Spots for Indexing',
                                     color=WP.BG_COLOR_TITLEBAR_PANEL1)

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

        # Booleans

        self.disc_box  = wx.CheckBox(self, wx.NewId(), 'Discard at bounds')
        self.bbox_box  = wx.CheckBox(self, wx.NewId(), 'Keep in bounding box')
        self.pado_box  = wx.CheckBox(self, wx.NewId(), 'Pad Omega')
        self.pads_box  = wx.CheckBox(self, wx.NewId(), 'Pad Spots')

        # Threshold

        self.thresh_lab = wx.StaticText(
            self, wx.NewId(),
            'Threshold', style=wx.ALIGN_CENTER)
        self.thresh_txt = wx.TextCtrl(
            self, wx.NewId(), value='500',
            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='4',
            style=wx.RAISED_BORDER)

        # Spots info

        self.aread_lab = wx.StaticText(
            self, wx.NewId(),
            'Active Reader', style=wx.ALIGN_RIGHT)
        self.aread_cho = wx.Choice(self, wx.NewId(), choices=['reader list'])

        self.rdr_lab = wx.StaticText(
            self, wx.NewId(),
            'Used Readers', style=wx.ALIGN_RIGHT)
        self.rdr_lbx =  wx.ListBox(self, wx.NewId(), choices = ['r1', 'r2'])

        self.nspot_lab = wx.StaticText(
            self, wx.NewId(),
            'Number of Spots', style=wx.ALIGN_RIGHT)
        self.nspot_txt = wx.TextCtrl(
            self, wx.NewId(), value='0',
            style=wx.RAISED_BORDER)


        # Run button

        self.run  = wx.Button(self, wx.NewId(), 'Add Spots')
        self.clear_but  = wx.Button(self, wx.NewId(), 'Clear Spots')

        # Spots for Indexing info

        self.amat_lab = wx.StaticText(
            self, wx.NewId(),
            'Active Material', style=wx.ALIGN_RIGHT)
        self.amat_cho = wx.Choice(self, wx.NewId(), choices=['mat list'])
        self.Bind(wx.EVT_CHOICE, self.OnMatChoice, self.aread_cho)


        self.hkls_lab = wx.StaticText(
            self, wx.NewId(),
            '', style=wx.ALIGN_RIGHT)
        self.hkls_but = wx.Button(self, wx.NewId(), 'HKLs')

        self.nspotind_lab = wx.StaticText(
            self, wx.NewId(),
            'Number of Spots', style=wx.ALIGN_RIGHT)
        self.nspotind_txt = wx.TextCtrl(
            self, wx.NewId(), value='0',
            style=wx.RAISED_BORDER)

        # Run button for indexing spots

        self.run_ind  = wx.Button(self, wx.NewId(), 'Process Spots\nfor Indexing')

        return
Exemplo n.º 45
0
    def __makeObjects(self):
        """Add interactors"""

        self.tbarSizer = makeTitleBar(self, 'Spots')
        self.tbar_raw = makeTitleBar(self,
                                     'Raw Spots',
                                     color=WP.BG_COLOR_TITLEBAR_PANEL1)
        self.tbar_ind = makeTitleBar(self,
                                     'Spots for Indexing',
                                     color=WP.BG_COLOR_TITLEBAR_PANEL1)

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

        # Booleans

        self.disc_box = wx.CheckBox(self, wx.NewId(), 'Discard at bounds')
        self.bbox_box = wx.CheckBox(self, wx.NewId(), 'Keep in bounding box')
        self.pado_box = wx.CheckBox(self, wx.NewId(), 'Pad Omega')
        self.pads_box = wx.CheckBox(self, wx.NewId(), 'Pad Spots')

        # Threshold

        self.thresh_lab = wx.StaticText(self,
                                        wx.NewId(),
                                        'Threshold',
                                        style=wx.ALIGN_CENTER)
        self.thresh_txt = wx.TextCtrl(self,
                                      wx.NewId(),
                                      value='500',
                                      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='4',
                                     style=wx.RAISED_BORDER)

        # Spots info

        self.aread_lab = wx.StaticText(self,
                                       wx.NewId(),
                                       'Active Reader',
                                       style=wx.ALIGN_RIGHT)
        self.aread_cho = wx.Choice(self, wx.NewId(), choices=['reader list'])

        self.rdr_lab = wx.StaticText(self,
                                     wx.NewId(),
                                     'Used Readers',
                                     style=wx.ALIGN_RIGHT)
        self.rdr_lbx = wx.ListBox(self, wx.NewId(), choices=['r1', 'r2'])

        self.nspot_lab = wx.StaticText(self,
                                       wx.NewId(),
                                       'Number of Spots',
                                       style=wx.ALIGN_RIGHT)
        self.nspot_txt = wx.TextCtrl(self,
                                     wx.NewId(),
                                     value='0',
                                     style=wx.RAISED_BORDER)

        # Run button

        self.run = wx.Button(self, wx.NewId(), 'Add Spots')
        self.clear_but = wx.Button(self, wx.NewId(), 'Clear Spots')

        # Spots for Indexing info

        self.amat_lab = wx.StaticText(self,
                                      wx.NewId(),
                                      'Active Material',
                                      style=wx.ALIGN_RIGHT)
        self.amat_cho = wx.Choice(self, wx.NewId(), choices=['mat list'])
        self.Bind(wx.EVT_CHOICE, self.OnMatChoice, self.aread_cho)

        self.hkls_lab = wx.StaticText(self,
                                      wx.NewId(),
                                      '',
                                      style=wx.ALIGN_RIGHT)
        self.hkls_but = wx.Button(self, wx.NewId(), 'HKLs')

        self.nspotind_lab = wx.StaticText(self,
                                          wx.NewId(),
                                          'Number of Spots',
                                          style=wx.ALIGN_RIGHT)
        self.nspotind_txt = wx.TextCtrl(self,
                                        wx.NewId(),
                                        value='0',
                                        style=wx.RAISED_BORDER)

        # Run button for indexing spots

        self.run_ind = wx.Button(self, wx.NewId(),
                                 'Process Spots\nfor Indexing')

        return
Exemplo n.º 46
0
    def __makeObjects(self):
        """Add interactors"""
        exp = wx.GetApp().ws

        self.tbarSizer = makeTitleBar(self,
                                      'GE Reader Panel',
                                      color=WP.TITLEBAR_BG_COLOR_PANEL1)
        #
        #  Reader List
        #
        self.curr_lab = wx.StaticText(self,
                                      wx.NewIdRef(),
                                      'Current Reader',
                                      style=wx.ALIGN_CENTER)
        self.rdrs_cho = wx.Choice(self,
                                  wx.NewIdRef(),
                                  choices=[r.name for r in exp.savedReaders])
        self.new_but = wx.Button(self, wx.NewIdRef(), 'New Reader')
        #
        #  Reader Name
        #
        self.name_lab = wx.StaticText(self,
                                      wx.NewIdRef(),
                                      'READER NAME',
                                      style=wx.ALIGN_CENTER)
        self.name_txt = wx.TextCtrl(self,
                                    wx.NewIdRef(),
                                    value=ReaderInput.DFLT_NAME,
                                    style=wx.RAISED_BORDER
                                    | wx.TE_PROCESS_ENTER)
        #
        #  Mode interactors
        #
        self.mode_lab = wx.StaticText(self,
                                      wx.NewIdRef(),
                                      'Image Mode',
                                      style=wx.ALIGN_RIGHT)
        self.mode_cho = wx.Choice(self, wx.NewIdRef(), choices=MODE_CHOICES)
        #
        #  Aggregation
        #
        self.agg_lab = wx.StaticText(self,
                                     wx.NewIdRef(),
                                     'Frame Aggregation',
                                     style=wx.ALIGN_RIGHT)
        self.agg_cho = wx.Choice(self, wx.NewIdRef(), choices=AGG_CHOICES)
        #
        #
        #  Image and dark file names
        #
        self.img_but = wx.Button(self, wx.NewIdRef(),
                                 'Select Imageseries File')
        self.dir_but = wx.Button(self, wx.NewIdRef(), 'Change Image Folder')

        #
        #  Action buttons
        #
        self.files_lab = wx.StaticText(self,
                                       wx.NewIdRef(),
                                       'Image Files',
                                       style=wx.ALIGN_RIGHT)
        self.read_lab = wx.StaticText(self,
                                      wx.NewIdRef(),
                                      'Read',
                                      style=wx.ALIGN_RIGHT)

        self.read_but = wx.Button(self, wx.NewIdRef(), 'Load')
        self.browse_lab = wx.StaticText(self,
                                        wx.NewIdRef(),
                                        'Browse Frames',
                                        style=wx.ALIGN_RIGHT)
        self.browse_spn = wx.SpinCtrl(self, wx.NewIdRef(), min=0, initial=0)
        self.browse_inf = wx.TextCtrl(self,
                                      wx.NewIdRef(),
                                      value='',
                                      style=wx.RAISED_BORDER | wx.TE_READONLY)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        #
        #  Subpanels
        #
        self.sp_single = SF_Subpanel(self, wx.NewIdRef())
        self.sp_multi = MF_Subpanel(self, wx.NewIdRef())
        self.sp_info = infoPanel(self, wx.NewIdRef())

        return
Exemplo n.º 47
0
    def __makeObjects(self):
        """Add interactors"""
        exp = wx.GetApp().ws

        self.tbarSizer = makeTitleBar(self, 'GE Reader Panel',
                                      color=WP.TITLEBAR_BG_COLOR_PANEL1)
        #
        #  Reader List
        #
        self.curr_lab = wx.StaticText(self, wx.NewId(),
                                        'Current Reader', style=wx.ALIGN_CENTER)
        self.rdrs_cho = wx.Choice(self, wx.NewId(),
                                  choices=[r.name for r in exp.savedReaders])
        self.new_but  = wx.Button(self, wx.NewId(), 'New Reader')
        #
        #  Reader Name
        #
        self.name_lab = wx.StaticText(self, wx.NewId(),
                                        'READER NAME', style=wx.ALIGN_CENTER)
        self.name_txt = wx.TextCtrl(self, wx.NewId(), value=ReaderInput.DFLT_NAME,
                                      style=wx.RAISED_BORDER|wx.TE_PROCESS_ENTER)
        #
        #  Mode interactors
        #
        self.mode_lab = wx.StaticText(self, wx.NewId(), 'Image Mode',
                                      style=wx.ALIGN_RIGHT)
        self.mode_cho = wx.Choice(self, wx.NewId(), choices=MODE_CHOICES)
        #
        #  Aggregation
        #
        self.agg_lab = wx.StaticText(self, wx.NewId(), 'Frame Aggregation',
                                      style=wx.ALIGN_RIGHT)
        self.agg_cho = wx.Choice(self, wx.NewId(), choices=AGG_CHOICES)
        #
        #
        #  Image and dark file names
        #
        self.img_but    = wx.Button(self, wx.NewId(), 'Select Imageseries File')
        self.dir_but    = wx.Button(self, wx.NewId(), 'Change Image Folder')

        #
        #  Action buttons
        #
        self.files_lab = wx.StaticText(self, wx.NewId(), 'Image Files',
                                      style=wx.ALIGN_RIGHT)
        self.read_lab = wx.StaticText(self, wx.NewId(), 'Read',
                                      style=wx.ALIGN_RIGHT)

        self.read_but   = wx.Button(self, wx.NewId(), 'Load')
        self.browse_lab = wx.StaticText(self, wx.NewId(), 'Browse Frames',
                                      style=wx.ALIGN_RIGHT)
        self.browse_spn = wx.SpinCtrl(self, wx.NewId(), min=0, initial=0)
        self.browse_inf = wx.TextCtrl(self, wx.NewId(), value='',
                                      style=wx.RAISED_BORDER|wx.TE_READONLY)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        #
        #  Subpanels
        #
        self.sp_single = SF_Subpanel(self, wx.NewId())
        self.sp_multi  = MF_Subpanel(self, wx.NewId())
        self.sp_info   = infoPanel(self, wx.NewId())

        return
Exemplo n.º 48
0
    def __makeObjects(self):
        """Add interactors"""
        exp = wx.GetApp().ws
        iopts = exp.index_opts

        self.tbarSizer = makeTitleBar(self, 'Fiber Search Options',
                                      color=WP.BG_COLOR_PANEL1_TITLEBAR)

        # checkboxes

        self.friedel_cbox = wx.CheckBox(self, wx.NewId(), 'Friedel Only')
        self.friedel_cbox.SetValue(iopts.friedelOnly)
        self.claims_cbox = wx.CheckBox(self, wx.NewId(), 'Preserve Claiims')
        self.claims_cbox.SetValue(iopts.preserveClaims)
        self.refine_cbox  = wx.CheckBox(self, wx.NewId(), 'Do Refinement')
        self.refine_cbox.SetValue(iopts.doRefinement)
        self.multi_cbox  = wx.CheckBox(self, wx.NewId(), 'Use Multiprocessing')
        self.multi_cbox.SetValue(iopts.doMultiProc)

        # value boxes

        self.etol_lab = wx.StaticText(self, wx.NewId(), 'Eta Tolerance',
                                      style=wx.ALIGN_RIGHT)
        self.etol_txt = wx.TextCtrl(self, wx.NewId(), value=str(iopts.etaTol),
                                    style=wx.RAISED_BORDER)

        self.otol_lab = wx.StaticText(self, wx.NewId(), 'Omega Tolerance',
                                      style=wx.ALIGN_RIGHT)
        self.otol_txt = wx.TextCtrl(self, wx.NewId(), value=str(iopts.omeTol),
                                    style=wx.RAISED_BORDER)

        self.steps_lab = wx.StaticText(self, wx.NewId(), 'Number of Steps',
                                      style=wx.ALIGN_RIGHT)
        self.steps_spn = wx.SpinCtrl(self, wx.NewId(),
                                     min=36, max=36000, initial=iopts.nsteps)

        label = 'Minimum Completeness'
        self.comp_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_RIGHT)
        self.comp_txt = wx.TextCtrl(self, wx.NewId(),
                                    value=str(iopts.minCompleteness),
                                    style=wx.RAISED_BORDER)

        label = 'Minimum Fraction Claimed'
        self.claim_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_RIGHT)
        self.claim_txt = wx.TextCtrl(self, wx.NewId(),
                                     value=str(iopts.minPctClaimed),
                                     style=wx.RAISED_BORDER)

        label = 'Number of CPUs'
        self.ncpus_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_RIGHT)
        self.ncpus_spn = wx.SpinCtrl(self, wx.NewId(),
                                     min=1, max=ncpus_DFLT, initial=ncpus_DFLT)

        label = 'Quit After This Many'
        self.qafter_lab = wx.StaticText(self, wx.NewId(), label,
                                      style=wx.ALIGN_RIGHT)
        self.qafter_spn = wx.SpinCtrl(self, wx.NewId(),
                                     min=0, initial=0)

        self.hkls_but = wx.Button(self, wx.NewId(), 'HKLs')

        return
Exemplo n.º 49
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