Changeset 1898
- Timestamp:
- Jun 19, 2015 3:59:22 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r1831 r1898 676 676 legend = "Select variables to make equivalent (only one of the variables will be varied when all are set to be varied)" 677 677 GetAddVars(page,title1,title2,varList,constrDictEnt,'equivalence') 678 679 def OnAddAtomEquiv(event): 680 ''' Add equivalences between all parameters on atoms ''' 681 page = G2frame.Page 682 vartype,varList,constrDictEnt = PageSelection(page) 683 title1 = "Setup equivalent atom variables" 684 title2 = "Select additional atoms(s) to be equivalent with " 685 if not varList: 686 G2frame.ErrorDialog('No variables','There are no variables of type '+vartype, 687 parent=G2frame.dataFrame) 688 return 689 legend = "Select atoms to make equivalent (only one of the atom variables will be varied when all are set to be varied)" 690 GetAddAtomVars(page,title1,title2,varList,constrDictEnt,'equivalence') 678 691 679 692 def OnAddFunction(event): … … 729 742 data[constrDictEnt] += newcons 730 743 dlg.Destroy() 744 OnPageChanged(None) 745 746 def GetAddAtomVars(page,title1,title2,varList,constrDictEnt,constType): 747 '''Get the atom variables to be added for OnAddAtomEquiv. Then create and 748 check the constraints. 749 ''' 750 Atoms = {G2obj.VarDescr(i)[0]:[] for i in varList if 'Atom' in G2obj.VarDescr(i)[0]} 751 for item in varList: 752 atName = G2obj.VarDescr(item)[0] 753 if atName in Atoms: 754 Atoms[atName].append(item) 755 AtNames = Atoms.keys() 756 AtNames.sort() 757 dlg = G2G.G2SingleChoiceDialog(G2frame.dataFrame,'Select 1st atom:', 758 title1,AtNames, 759 monoFont=True,size=(625,400)) 760 dlg.CenterOnParent() 761 FrstAtom = '' 762 if dlg.ShowModal() == wx.ID_OK: 763 sel = dlg.GetSelection() 764 FrstAtom = AtNames[sel] 765 AtNames.remove(FrstAtom) 766 dlg.Destroy() 767 if FrstAtom == '': 768 print 'no atom selected' 769 return 770 dlg = G2G.G2MultiChoiceDialog( 771 G2frame.dataFrame,title2+FrstAtom, 772 'Constrain '+str(FrstAtom)+' with...',AtNames, 773 toggle=False,size=(625,400),monoFont=True) 774 if dlg.ShowModal() == wx.ID_OK: 775 Selections = dlg.GetSelections()[:] 776 dlg.Destroy() 777 for name in Atoms[FrstAtom]: 778 newcons = [] 779 constr = [[1.0,G2obj.G2VarObj(name)]] 780 pref = name.rsplit(':',1)[0] 781 for sel in Selections: 782 id = Atoms[AtNames[sel]][0].rsplit(':',1)[-1] 783 constr += [[1.0,G2obj.G2VarObj('%s:%s'%(pref,id))]] 784 if 'frac' in pref: 785 newcons = [constr+[1.0,None,'c']] 786 else: 787 newcons = [constr+[None,None,'e']] 788 if len(newcons) > 0: 789 if CheckAddedConstraint(newcons): 790 data[constrDictEnt] += newcons 731 791 OnPageChanged(None) 732 792 … … 950 1010 oldPage = G2frame.dataDisplay.ChangeSelection(page) 951 1011 text = G2frame.dataDisplay.GetPageText(page) 1012 G2frame.dataFrame.ConstraintEdit.Enable(G2gd.wxID_EQUIVALANCEATOMS,False) 952 1013 if text == 'Histogram/Phase constraints': 953 1014 G2frame.Page = [page,'hap'] … … 958 1019 elif text == 'Phase constraints': 959 1020 G2frame.Page = [page,'phs'] 1021 G2frame.dataFrame.ConstraintEdit.Enable(G2gd.wxID_EQUIVALANCEATOMS,True) 960 1022 UpdateConstraintPanel(PhaseConstr,'Phase') 961 1023 elif text == 'Global constraints': … … 991 1053 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddEquivalence, id=G2gd.wxID_EQUIVADD) 992 1054 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddHold, id=G2gd.wxID_HOLDADD) 1055 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddAtomEquiv, id=G2gd.wxID_EQUIVALANCEATOMS) 993 1056 # tab commands 994 1057 for id in (G2gd.wxID_CONSPHASE, -
trunk/GSASIIgrid.py
r1894 r1898 117 117 118 118 [ wxID_CONSTRAINTADD,wxID_EQUIVADD,wxID_HOLDADD,wxID_FUNCTADD, 119 wxID_CONSPHASE, wxID_CONSHIST, wxID_CONSHAP, wxID_CONSGLOBAL, 120 ] = [wx.NewId() for item in range( 8)]119 wxID_CONSPHASE, wxID_CONSHIST, wxID_CONSHAP, wxID_CONSGLOBAL,wxID_EQUIVALANCEATOMS, 120 ] = [wx.NewId() for item in range(9)] 121 121 122 122 [ wxID_RESTRAINTADD, wxID_RESTSELPHASE,wxID_RESTDELETE, wxID_RESRCHANGEVAL, … … 619 619 self.ConstraintEdit.Append(id=wxID_FUNCTADD, kind=wx.ITEM_NORMAL,text='Add New Var', 620 620 help='Add variable composed of existing parameter') 621 self.ConstraintEdit.Append(id=wxID_EQUIVALANCEATOMS, kind=wx.ITEM_NORMAL,text='Add atom equivalence', 622 help='Add equivalences between atom parameter values') 623 self.ConstraintEdit.Enable(wxID_EQUIVALANCEATOMS,False) 621 624 self.PostfillDataMenu() 622 625 -
trunk/GSASIIplot.py
r1894 r1898 2485 2485 # sig = lambda Th,U,V,W: 1.17741*math.sqrt(U*tand(Th)**2+V*tand(Th)+W)*math.pi/18000. 2486 2486 # gam = lambda Th,X,Y: (X/cosd(Th)+Y*tand(Th))*math.pi/18000. 2487 gamFW = lambda s,g: np.exp(np.log(s**5+2.69269*s**4*g+2.42843*s**3*g**2+4.47163*s**2*g**3+0.07842*s*g**4+g**5)/5.)2487 # gamFW = lambda s,g: np.exp(np.log(s**5+2.69269*s**4*g+2.42843*s**3*g**2+4.47163*s**2*g**3+0.07842*s*g**4+g**5)/5.) 2488 2488 # gamFW2 = lambda s,g: math.sqrt(s**2+(0.4654996*g)**2)+.5345004*g #Ubaldo Bafile - private communication 2489 2489 PatternId = G2frame.PatternId -
trunk/GSASIIpwd.py
r1893 r1898 479 479 480 480 def getFWHM(pos,Inst): 481 ' needs a doc string'482 sig = lambda Th,U,V,W: 1.17741* math.sqrt(max(0.001,U*tand(Th)**2+V*tand(Th)+W))*math.pi/180.481 '1.17741*pi/180 = sqrt(8ln2)/(2pi/180)' 482 sig = lambda Th,U,V,W: 1.17741*np.sqrt(max(0.001,U*tand(Th)**2+V*tand(Th)+W))*np.pi/180. 483 483 sigTOF = lambda dsp,S0,S1,S2,Sq: S0+S1*dsp**2+S2*dsp**4+Sq/dsp**2 484 484 gam = lambda Th,X,Y: (X/cosd(Th)+Y*tand(Th))*math.pi/180. -
trunk/GSASIIpwdGUI.py
r1895 r1898 1311 1311 return 1312 1312 keys = data.keys() 1313 try: 1314 keys.remove('Source') 1315 except ListError: 1316 pass 1313 1317 flags = dict(zip(keys,[data[key][2] for key in keys])) 1314 1318 instType = data['Type'][0] … … 1329 1333 if len(data) == len(instData) and instType == instData['Type'][0]: #don't mix data types or lam & lam1/lam2 parms! 1330 1334 for item in instData: 1331 instData[item][2] = copy.copy(flags[item]) 1335 if item not in ['Source',]: 1336 instData[item][2] = copy.copy(flags[item]) 1332 1337 else: 1333 1338 print item+' not copied - instrument parameters not commensurate'
Note: See TracChangeset
for help on using the changeset viewer.