Changeset 264 for trunk/GSASIIElem.py


Ignore:
Timestamp:
Mar 31, 2011 4:41:13 PM (11 years ago)
Author:
vondreele
Message:

begin implementation of pdf generation - work in progress
modify image to have azimuth=0 as vertical "up"
add textctrls for max and min image intensity
fix to some lattice parameter defaults for some Laue groups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIElem.py

    r230 r264  
    1414import sys
    1515import os.path
    16 import  wx.lib.colourselect as wscs
     16import wx.lib.colourselect as wscs
    1717import GSASIIpath
    1818import numpy as np
     
    224224    t = -fb*SQ
    225225    return np.sum(fa*np.exp(t))+FormFac['fc']
     226   
     227def ComptonFac(ComptonCoeff,SQ):
     228    """compute Compton scattering factor
     229    @param ComptonCoeff: list [Z, a1:a5, b1:b5]
     230    @param SQ: (sin-theta/lambda)**2
     231    @return: comp: compton scattering factor
     232    """   
     233    ca = np.array(ComptonCoeff[1:6])
     234    cb = np.array(ComptonCoeff[6:11])
     235    t = -cb*SQ
     236    return ComptonCoeff[0]-np.sum(ca*np.exp(t))
    226237           
    227238def FPcalc(Orbs, KEv):
     
    314325    "Makes periodic table widget for picking element - caller maintains element list"
    315326    Elem=None
    316     def _init_ctrls(self, prnt):
     327    def _init_ctrls(self, prnt,oneOnly):
    317328        wx.Dialog.__init__(self, id=-1, name='PickElement',
    318329              parent=prnt, pos=wx.DefaultPosition,
     
    323334        i=0
    324335        for E in ET.ElTable:
     336            if oneOnly:
     337                color=E[4]
     338            else:
     339                color=E[6]
    325340            PickElement.ElButton(self,name=E[0],
    326 #            pos=wx.Point(E[1]*40+25,E[2]*24+24),tip=E[3],color=E[4])
    327             pos=wx.Point(E[1]*40+25,E[2]*24+24),tip=E[3],color=E[6])
     341               pos=wx.Point(E[1]*40+25,E[2]*24+24),tip=E[3],color=color,oneOnly=oneOnly)
    328342            i+=1
    329343
    330     def __init__(self, parent):
    331         self._init_ctrls(parent)
    332        
    333     def ElButton(self, name, pos, tip, color):
     344    def __init__(self, parent,oneOnly=False):
     345        self._init_ctrls(parent,oneOnly)
     346       
     347    def ElButton(self, name, pos, tip, color, oneOnly):
    334348        Black = wx.Colour(0,0,0)
    335         El = wx.ComboBox(choices=name, parent=self, pos=pos, size=wx.Size(40,23),
    336             style=wx.CB_READONLY, value=name[0])
     349        if oneOnly:
     350            El = wscs.ColourSelect(label=name[0], parent=self,colour=color,
     351                pos=pos, size=wx.Size(40,23), style=wx.RAISED_BORDER)
     352#            El.SetLabel(name)
     353            El.Bind(wx.EVT_BUTTON, self.OnElButton)
     354        else:
     355            El = wx.ComboBox(choices=name, parent=self, pos=pos, size=wx.Size(40,23),
     356                style=wx.CB_READONLY, value=name[0])
     357            El.Bind(wx.EVT_COMBOBOX,self.OnElButton)
     358       
    337359        El.SetBackgroundColour(color)
    338360        El.SetToolTipString(tip)
    339         El.Bind(wx.EVT_COMBOBOX, self.OnElButton)
    340361
    341362    def OnElButton(self, event):
    342363        El = event.GetEventObject().GetLabel()
    343         self.Elem = (El)
     364        self.Elem = El
    344365        self.EndModal(wx.ID_OK)       
    345366       
Note: See TracChangeset for help on using the changeset viewer.