Changeset 3586


Ignore:
Timestamp:
Sep 5, 2018 3:31:33 PM (3 years ago)
Author:
vondreele
Message:

rename MiltiFloatDialog? to MultiDataDialog? - better now that it does more than floats
add choice as an option to MultiDataDialog? - makes a ComboBox? for selection of an item
add optional choice of magnetic atom to test for possible moment as part of making table of mag space groups

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrlGUI.py

    r3585 r3586  
    4343:class:`SingleFloatDialog`         Dialog to obtain a single float value from user, with
    4444                                   optional range validation.
    45 :class:`MultiFloatDialog`          Dialog to obtain multiple float values from user,
    46                                    with optional range validation.
     45:class:`MultiDataDialog`           Dialog to obtain multiple data values from user,
     46                                   with optional range validation; items can be float, str or bool
    4747:class:`SingleStringDialog`        Dialog to obtain a single string value from user,
    4848                                   with optional an optional default value.
     
    22512251
    22522252################################################################################
    2253 class MultiFloatDialog(wx.Dialog):
     2253class MultiDataDialog(wx.Dialog):
    22542254    'Dialog to obtain multiple values from user'
    22552255    def __init__(self,parent,title,prompts,values,limits=[[0.,1.],],formats=['%.5g',]):
     
    22802280                self.values[id] = val
    22812281                Obj.SetValue('%s'%(val))
     2282            elif 'choice' in format:
     2283                self.values[id] = Obj.GetValue()
    22822284            else:
    22832285                try:
     
    23062308                valItem.Bind(wx.EVT_KILL_FOCUS,OnValItem)
    23072309                valItem.SetValue('%s'%value)
     2310            elif 'choice' in format:
     2311                valItem = wx.ComboBox(self.panel,value=limits[0],choices=limits,style=wx.CB_READONLY|wx.CB_DROPDOWN)
     2312                valItem.Bind(wx.EVT_COMBOBOX,OnValItem)
    23082313            else:
    23092314                valItem = wx.TextCtrl(self.panel,value=format%(value),style=wx.TE_PROCESS_ENTER)
  • trunk/GSASIIdataGUI.py

    r3577 r3586  
    14071407                        'DisplaceY':[0.,False]})
    14081408                if 'Generic' in choices[res]:
    1409                     dlg = G2G.MultiFloatDialog(self,title='Generic TOF detector bank',
     1409                    dlg = G2G.MultiDataDialog(self,title='Generic TOF detector bank',
    14101410                        prompts=['Total FP','2-theta',],values=[25.0,150.,],
    14111411                            limits=[[6.,200.],[5.,175.],],formats=['%6.2f','%6.1f',])
  • trunk/GSASIIlattice.py

    r3585 r3586  
    367367           'S':{'abc':'S','cab':'S','bca':'S','acb':'S','bac':'S','cba':'S'},
    368368           }
    369     Fives = {'ababc':'abc','bcbca':'cba'}
     369    Fives = {'ababc':'abc','bcbca':'cba','acacb':'acb'}
    370370    Trans = Phase['Trans']
    371371    Uvec = Phase['Uvec']
     
    393393        NTrans = np.inner(Mats[lattSym],Trans.T)
    394394        spn[1:4] = np.inner(Mats[lattSym],spn[1:4])
    395         if SpGrp in G2spc.altSettingOrtho:
     395        if lattSym != 'abc' and SpGrp in G2spc.altSettingOrtho:
    396396            NSG = G2spc.altSettingOrtho[SpGrp].get(lattSym,SpGrp).replace("'",'').split(' ')
    397397            Bns = ''
     
    417417    phase['Keep'] = False
    418418    phase['Use'] = False
     419    phase['aType'] = ''
    419420    SpGp = result[0].replace("'",'')
    420421    SpGrp = G2spc.StandardizeSpcName(SpGp)
     
    425426        phase['SGData']['GenSym'],phase['SGData']['GenFlg'],BNSsym = G2spc.GetGenSym(phase['SGData'])
    426427        phase['SGData']['BNSlattsym'] = [BNSlatt,BNSsym[BNSlatt]]
    427         G2spc.ApplyBNSlatt(phase['SGData'],phase['SGData']['BNSlattsym']) 
     428        G2spc.ApplyBNSlatt(phase['SGData'],phase['SGData']['BNSlattsym'])
     429    else:
     430        phase['SGData']['GenSym'],phase['SGData']['GenFlg'],BNSsym = G2spc.GetGenSym(phase['SGData'])
    428431    phase['SGData']['MagSpGrp'] = G2spc.MagSGSym(phase['SGData'])
    429432    phase['SGData']['SpnFlp'] = G2spc.GenMagOps(phase['SGData'])[1]
  • trunk/GSASIIphsGUI.py

    r3585 r3586  
    24642464            newPhase,atCodes = G2lat.TransformPhase(data,newPhase,magchoice['Trans'].T,magchoice['Uvec'],vvec,True)
    24652465            Atoms = newPhase['Atoms']
     2466            aType = magchoice['aType']
     2467            Atms = []
     2468            AtCods = []
    24662469            atMxyz = []
    24672470            for ia,atom in enumerate(Atoms):
     2471                if aType and aType not in atom[1]:
     2472                    continue
    24682473                atom[0] += '_%d'%ia
    24692474                SytSym,Mul,Nop,dupDir = G2spc.SytSym(atom[3:6],SGData)
    24702475                CSI = G2spc.GetCSpqinel(SGData['SpnFlp'],dupDir)
     2476                Atms.append(atom)
     2477                AtCods.append(atCodes[ia])
    24712478                atMxyz.append(CSI[0])
    2472                
    2473             dlg = UseMagAtomDialog(G2frame,Atoms,atCodes,atMxyz)
     2479            dlg = UseMagAtomDialog(G2frame,Atms,AtCods,atMxyz)
    24742480            try:
    24752481                if dlg.ShowModal() == wx.ID_OK:
  • trunk/GSASIIpwdGUI.py

    r3585 r3586  
    2727    pass
    2828import numpy as np
     29import numpy.linalg as nl
    2930import numpy.ma as ma
    3031import math
     
    30823083        if 'R' in controls[5]: controls[5] = 'R3-H'
    30833084        controls[6:13] = Cell[1:8]
    3084        
    30853085        if 'N' in Inst['Type'][0]:
     3086            testAtoms = []
     3087            cx,ct,cs,cia = Phase['General']['AtomPtrs']
     3088            Atoms = Phase['Atoms']
     3089            for atom in Atoms:
     3090                if len(G2elem.GetMFtable([atom[ct],],[2.0,])):
     3091                    testAtoms.append(atom[:cx+3])
     3092            controls.append(testAtoms)
    30863093            G2frame.dataWindow.RunSubGroupsMag.Enable(True)
    30873094        G2frame.dataWindow.RefineCell.Enable(True)
     
    34273434        controls,bravais,cells,dminx,ssopt,magcells = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Unit Cells List'))
    34283435        E,SGData = G2spc.SpcGroup(controls[13])
     3436        if len(controls) > 14:
     3437            testAtoms = ['',]+list(set([atom[1] for atom in controls[14]]))
    34293438        kvec = ['0','0','0']
    3430         dlg = G2G.MultiFloatDialog(G2frame,title='k-SUBGROUPSMAG options',
    3431             prompts=[' kx as fr.',' ky as fr.',' kz as fr.',' Use whole star',' Landau transition',' Give intermediate cells','preserve axes'],
    3432             values=kvec+[False,False,False,True],
    3433             limits=[['0','1/2','1/3','1/4'],['0','1/2','1/3','1/4'],['0','1/2','1/3','1/4'],[True,False],[True,False],[True,False],[True,False]],
    3434             formats=['str','str','str','bool','bool','bool','bool'])
     3439        dlg = G2G.MultiDataDialog(G2frame,title='k-SUBGROUPSMAG options',
     3440            prompts=[' kx as fr.',' ky as fr.',' kz as fr.',' Use whole star',' Landau transition',' Give intermediate cells','preserve axes','test for mag. atoms'],
     3441            values=kvec+[False,False,False,True,''],
     3442            limits=[['0','1/2','1/3','1/4'],['0','1/2','1/3','1/4'],['0','1/2','1/3','1/4'],[True,False],[True,False],[True,False],[True,False],testAtoms],
     3443            formats=['str','str','str','bool','bool','bool','bool','choice'])
    34353444        if dlg.ShowModal() == wx.ID_OK:
    34363445            magcells = []
     
    34413450            intermed = newVals[5]
    34423451            keepaxes = newVals[6]
     3452            atype = newVals[7]
     3453            magAtms = [atom for atom in controls[14] if atom[1] == atype]
    34433454            wx.BeginBusyCursor()
    34443455            MAXMAGN = kMAG.GetNonStdSubgroupsmag(SGData,kvec,star,Landau,intermed)
     
    34503461                Uvec = np.array(numbs[3::4])
    34513462                Trans = np.array([numbs[:3],numbs[4:7],numbs[8:11]]).T         #Bilbao gives transpose
     3463                invTrans = nl.inv(Trans)
    34523464                phase = G2lat.makeBilbaoPhase(result[:2],Uvec,Trans)
    34533465                phase['Cell'] = G2lat.TransformCell(controls[6:12],Trans)
     3466                phase['aType'] = atype
     3467                for matm in magAtms:    #TODO: this is a shortcut - atoms don't include all possible after transformation
     3468                    xyz = G2lat.TransformXYZ(matm[3:6]-Uvec,invTrans.T,np.zeros(3))%1.
     3469                    SytSym,Mul,Nop,dupDir = G2spc.SytSym(xyz,phase['SGData'])
     3470                    CSI = G2spc.GetCSpqinel(phase['SGData']['SpnFlp'],dupDir)
     3471                    if any(CSI[0]): phase['Keep'] = True
    34543472                RVT = None
    34553473                if keepaxes:
     
    34583476                    magcells.append(phase)
    34593477                else:
    3460                     magcells.append(phase)          #temporary??
    34613478                    Nresult,NUvec,NTrans = RVT
    34623479                    newphase = G2lat.makeBilbaoPhase(Nresult,NUvec,NTrans)
Note: See TracChangeset for help on using the changeset viewer.