Changeset 526


Ignore:
Timestamp:
Apr 2, 2012 2:30:28 PM (11 years ago)
Author:
vondreele
Message:

make SetNewPhase? routine in GSASIIIO.py to initialize phase info
begin Fourier map search routine
fix atom plotting if no map

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r524 r526  
    10641064        sub = self.PatternTree.AppendItem(parent=sub,text=PhaseName)
    10651065        E,SGData = G2spc.SpcGroup('P 1')
    1066         self.PatternTree.SetItemPyData(sub, {
    1067             'General':{
    1068                 'Name':PhaseName,
    1069                 'Type':'nuclear',
    1070                 'SGData':SGData,
    1071                 'Cell':[False,10.,10.,10.,90.,90.,90,1000.],
    1072                 'Pawley dmin':1.0,
    1073                 'Data plot type':'Mustrain',
    1074                 'SH Texture':{
    1075                     'Order':0,
    1076                     'Model':'cylindrical',
    1077                     'Sample omega':[False,0.0],
    1078                     'Sample chi':[False,0.0],
    1079                     'Sample phi':[False,0.0],
    1080                     'SH Coeff':[False,{}],
    1081                     'SHShow':False,
    1082                     'PFhkl':[0,0,1],
    1083                     'PFxyz':[0,0,1],
    1084                     'PlotType':'Pole figure'}},
    1085             'Atoms':[],
    1086             'Drawing':{},
    1087             'Histograms':{},
    1088             'Pawley ref':[],
    1089             'Models':{},
    1090             })
     1066        self.PatternTree.SetItemPyData(sub,G2IO.SetNewPhase(Name=PhaseName,SGData=SGData))
    10911067       
    10921068    def OnDeletePhase(self,event):
  • trunk/GSASIIIO.py

    r502 r526  
    10351035    print 'index peak list saved'
    10361036   
     1037def SetNewPhase(Name='New Phase',SGData=G2spc.SpcGroup('P 1')[1],cell=[1.0,1.0,1.0,90.,90,90.,1.]):
     1038    phaseData = {
     1039        'General':{
     1040            'Name':Name,
     1041            'Type':'nuclear',
     1042            'SGData':SGData,
     1043            'Cell':[False,]+cell,
     1044            'Pawley dmin':1.0,
     1045            'Data plot type':'Mustrain',
     1046            'SH Texture':{
     1047                'Order':0,
     1048                'Model':'cylindrical',
     1049                'Sample omega':[False,0.0],
     1050                'Sample chi':[False,0.0],
     1051                'Sample phi':[False,0.0],
     1052                'SH Coeff':[False,{}],
     1053                'SHShow':False,
     1054                'PFhkl':[0,0,1],
     1055                'PFxyz':[0,0,1],
     1056                'PlotType':'Pole figure'}},
     1057        'Atoms':[],
     1058        'Drawing':{},
     1059        'Histograms':{},
     1060        'Pawley ref':[],
     1061        'Models':{},
     1062        }
     1063    return phaseData
     1064   
    10371065def ReadEXPPhase(G2frame,filename):
    10381066    shModels = ['cylindrical','none','shear - 2/m','rolling - mmm']
     
    11501178        textureData['SH Coeff'] = [False,shCoef]
    11511179       
    1152     Phase = {
    1153             'General':{
    1154                 'Name':PhaseName,
    1155                 'Type':Ptype,
    1156                 'SGData':SGData,
    1157                 'Cell':[False,]+abc+angles+[Volume,],
    1158                 'Pawley dmin':1.0,
    1159                 'SH Texture':textureData},
    1160             'Atoms':Atoms,
    1161             'Drawing':{},
    1162             'Histograms':{},
    1163             'Pawley ref':[],
    1164             'Models':{},
    1165             }
     1180    Phase = SetNewPhase(Name=PhaseName,SGData=SGData,cell=abc+angles+[Volume,])
     1181    general = Phase['General']
     1182    general['Type'] = Ptype
     1183    general['SH Texture'] = textureData
     1184    Phase['Atoms'] = Atoms
    11661185    return Phase
    11671186       
     
    12411260    else:
    12421261        PhaseName = 'None'
    1243     Phase['General'] = {'Name':PhaseName,'Type':'macromolecular','SGData':SGData,
    1244         'Cell':[False,]+cell+[Volume,]}
     1262    Phase = SetNewPhase(Name=PhaseName,SGData=SGData,cell=cell+[Volume,])
     1263    Phase['General']['Type'] = 'macromolecular'
    12451264    Phase['Atoms'] = Atoms
    1246     Phase['Drawing'] = {}
    1247     Phase['Histograms'] = {}
    12481265   
    12491266    return Phase
     
    12771294        self.strictExtension = strictExtension
    12781295        # define a default Phase structure
    1279         self.Phase = {}
    1280         for i in 'General', 'Atoms', 'Drawing', 'Histograms':
    1281             self.Phase[i] = {}
    1282         self.Phase['General']['Name'] = 'default'
    1283         self.Phase['General']['Type'] = 'nuclear'
    1284         self.Phase['General']['SGData'] = SGData
    1285         self.Phase['General']['Cell'] = [
    1286             False, # refinement flag
    1287             1.,1.,1.,    # a,b,c
    1288             90.,90.,90., # alpha, beta, gamma
    1289             1.           # volume
    1290             ]
     1296        self.Phase = SetNewPhase(Name='new phase',SGData=SGData)
    12911297        self.warnings = ''
    12921298        self.errors = ''
  • trunk/GSASIIphsGUI.py

    r522 r526  
    34693469        try:
    34703470            mapData = generalData['Map']
    3471             contLevel = drawingData['contourLevel']*mapData['rhoMax']
    3472             rho = ma.array(mapData['rho'],mask=(mapData['rho']<contLevel))
     3471            contLevel = mapData['cutOff']*mapData['rhoMax']/100.
     3472            rho = copy.copy(mapData['rho'])     #don't mess up original
    34733473        except KeyError:
    34743474            print '**** ERROR - Fourier map not defined'
    34753475            return
    3476         indx = np.array(ma.nonzero(rho)).T
    3477         steps = 1./np.array(rho.shape)
    3478         rhoXYZ = indx*steps
    3479         print rhoXYZ
     3476        peaks = []
     3477        while True:
     3478            rhoMask = ma.array(rho,mask=(mapData['rho']<contLevel))
     3479            indx = np.array(ma.nonzero(rhoMask)).T
     3480            rhoList = np.array([rho[i,j,k] for i,j,k in indx])
     3481            rhoMax = np.max(rhoList)
     3482            rMI = indx[np.argmax(rhoList)]
     3483            print rMI,rhoMax
     3484            break
     3485#            steps = 1./np.array(rho.shape)
     3486#            rhoXYZ = indx*steps
    34803487        print 'search Fourier map'
    34813488       
  • trunk/GSASIIplot.py

    r523 r526  
    753753                else:
    754754                    Plot.plot(peak.T[1],pos,colors[pId%6]+'|',mew=1,ms=8,picker=3.,label=phase)
    755             handles,legends = Plot.get_legend_handles_labels()  #got double entries in the legends for some reason
    756             Plot.legend(handles[::2],legends[::2],title='Phases',loc='best')    #skip every other one
     755            if len(Phases):
     756                handles,legends = Plot.get_legend_handles_labels()  #got double entries in the legends for some reason
     757                Plot.legend(handles[::2],legends[::2],title='Phases',loc='best')    #skip every other one
    757758           
    758759    if G2frame.Contour:
     
    27312732                           
    27322733    def Draw():
    2733         if 'Map' in generalData:
     2734        mapData = generalData['Map']
     2735        rhoXYZ = []
     2736        if len(mapData['rho']):
    27342737            VP = np.array(drawingData['viewPoint'][0])-np.array([.5,.5,.5])
    2735             mapData = generalData['Map']
    27362738            contLevel = drawingData['contourLevel']*mapData['rhoMax']
    27372739            if 'delt-F' in mapData['MapType']:
     
    27392741            else:
    27402742                rho = ma.array(mapData['rho'],mask=(mapData['rho']<contLevel))
    2741             if rho.size > 0:
    2742                 steps = 1./np.array(rho.shape)
    2743                 incre = np.where(VP>0,VP%steps,VP%steps-steps)
    2744                 Vsteps = -np.array(VP/steps,dtype='i')
    2745                 rho = np.roll(np.roll(np.roll(rho,Vsteps[0],axis=0),Vsteps[1],axis=1),Vsteps[2],axis=2)
    2746                 indx = np.array(ma.nonzero(rho)).T
    2747                 rhoXYZ = indx*steps+VP-incre
    2748                 Nc = len(rhoXYZ)
    2749                 rcube = 2000.*Vol/(ForthirdPI*Nc)
    2750                 rmax = math.exp(math.log(rcube)/3.)**2
    2751                 radius = min(drawingData['mapSize']**2,rmax)
    2752                 view = np.array(drawingData['viewPoint'][0])
    2753                 Rok = np.sum(np.inner(Amat,rhoXYZ-view).T**2,axis=1)>radius
    2754             else:
    2755                 rhoXYZ = []
     2743            steps = 1./np.array(rho.shape)
     2744            incre = np.where(VP>0,VP%steps,VP%steps-steps)
     2745            Vsteps = -np.array(VP/steps,dtype='i')
     2746            rho = np.roll(np.roll(np.roll(rho,Vsteps[0],axis=0),Vsteps[1],axis=1),Vsteps[2],axis=2)
     2747            indx = np.array(ma.nonzero(rho)).T
     2748            rhoXYZ = indx*steps+VP-incre
     2749            Nc = len(rhoXYZ)
     2750            rcube = 2000.*Vol/(ForthirdPI*Nc)
     2751            rmax = math.exp(math.log(rcube)/3.)**2
     2752            radius = min(drawingData['mapSize']**2,rmax)
     2753            view = np.array(drawingData['viewPoint'][0])
     2754            Rok = np.sum(np.inner(Amat,rhoXYZ-view).T**2,axis=1)>radius
    27562755        Ind = GetSelectedAtoms()
    27572756        VS = np.array(Page.canvas.GetSize())
  • trunk/GSASIIpwdGUI.py

    r519 r526  
    1616import GSASIIpath
    1717import GSASIIpwd as G2pwd
     18import GSASIIIO as G2IO
    1819import GSASIIlattice as G2lat
    1920import GSASIIspc as G2spc
     
    14951496                E,SGData = G2spc.SpcGroup(spaceGroups[cell[0]])
    14961497                G2frame.PatternTree.SetItemPyData(sub, \
    1497                     {'General':{'Name':PhaseName,'Type':'nuclear','SGData':SGData,
    1498                     'Cell':[False,]+cell[1:],
    1499                     'Pawley dmin':1.00},'Atoms':[],'Drawing':{},'Histograms':{}})
     1498                    G2IO.SetNewPhase(Name=PhaseName,SGData=SGData,cell=cell[1:]))
    15001499                Status.SetStatusText('Change space group if needed')
    15011500        finally:
Note: See TracChangeset for help on using the changeset viewer.