Changeset 1894
- Timestamp:
- Jun 17, 2015 1:12:45 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIddataGUI.py
r1891 r1894 1046 1046 bottomSizer.Add(ExtSizer('HKLF'),0,WACV|wx.BOTTOM,5) 1047 1047 bottomSizer.Add(BabSizer(),0,WACV|wx.BOTTOM,5) 1048 if not SGData['SGInv'] : #not operational yet - no test data1048 if not SGData['SGInv'] and len(UseList[G2frame.hist]['Twins']) < 2: 1049 1049 bottomSizer.Add(FlackSizer(),0,WACV|wx.BOTTOM,5) 1050 1050 bottomSizer.Add(twinSizer(),0,WACV|wx.BOTTOM,5) -
trunk/GSASIIgrid.py
r1889 r1894 102 102 [ wxID_BACKCOPY,wxID_LIMITCOPY, wxID_SAMPLECOPY, wxID_SAMPLECOPYSOME, wxID_BACKFLAGCOPY, wxID_SAMPLEFLAGCOPY, 103 103 wxID_SAMPLESAVE, wxID_SAMPLELOAD,wxID_ADDEXCLREGION,wxID_SETSCALE,wxID_SAMPLE1VAL,wxID_ALLSAMPLELOAD, 104 wxID_PEAKSMOVE, 105 ] = [wx.NewId() for item in range(13)] 104 ] = [wx.NewId() for item in range(12)] 106 105 107 106 [ wxID_INSTPRMRESET,wxID_CHANGEWAVETYPE,wxID_INSTCOPY, wxID_INSTFLAGCOPY, wxID_INSTLOAD, … … 793 792 self.BackFixed.Append(id=self.wxID_BackPts['Del'], kind=wx.ITEM_RADIO,text='Delete', 794 793 help='Delete fixed background points with mouse clicks') 794 self.wxID_BackPts['Clear'] = wx.NewId() 795 self.BackFixed.Append(id=self.wxID_BackPts['Clear'], kind=wx.ITEM_NORMAL,text='Clear', 796 help='Clear fixed background points') 795 797 self.wxID_BackPts['Fit'] = wx.NewId() 796 798 self.BackFixed.Append(id=self.wxID_BackPts['Fit'], kind=wx.ITEM_NORMAL,text='Fit background', -
trunk/GSASIIplot.py
r1889 r1894 224 224 self.plotCanvas = plotCanvas 225 225 POSITION_OF_CONFIGURE_SUBPLOTS_BTN = 6 # remove one button, nos. start at 1! 226 self.DeleteToolByPos(POSITION_OF_CONFIGURE_SUBPLOTS_BTN) 226 self.DeleteToolByPos(POSITION_OF_CONFIGURE_SUBPLOTS_BTN) #doesn't work in miniconda 227 227 self.parent = self.GetParent() 228 228 key = os.path.join(os.path.split(__file__)[0],'key.ico') … … 1268 1268 pick = str(pick) 1269 1269 elif G2frame.PatternTree.GetItemText(PickId) == 'Background': 1270 # selected a fixed background point. Can move it or delete it. 1270 # selected a fixed background point. Can move it or delete it. 1271 1271 for mode,id in G2frame.dataFrame.wxID_BackPts.iteritems(): # what menu is selected? 1272 1272 if G2frame.dataFrame.BackMenu.FindItemById(id).IsChecked(): … … 1300 1300 PickId = G2frame.PickId # points to item in tree 1301 1301 if G2frame.PatternTree.GetItemText(PickId) == 'Background' and event.xdata: 1302 if Page.toolbar._active: # prevent ops. if a toolbar zoom button pressed 1303 return 1302 1304 # Background page, deal with fixed background points 1303 1305 if G2frame.SubBack or G2frame.Weight or G2frame.Contour or not G2frame.SinglePlot: -
trunk/GSASIIpwdGUI.py
r1893 r1894 792 792 793 793 def OnBkgFit(event): 794 def SetInstParms(Inst):795 dataType = Inst['Type'][0]796 insVary = []797 insNames = []798 insVals = []799 for parm in Inst:800 insNames.append(parm)801 insVals.append(Inst[parm][1])802 if parm in ['U','V','W','X','Y','SH/L','I(L2)/I(L1)','alpha',803 'beta-0','beta-1','beta-q','sig-0','sig-1','sig-2','sig-q',] and Inst[parm][2]:804 insVary.append(parm)805 instDict = dict(zip(insNames,insVals))806 instDict['X'] = max(instDict['X'],0.01)807 instDict['Y'] = max(instDict['Y'],0.01)808 if 'SH/L' in instDict:809 instDict['SH/L'] = max(instDict['SH/L'],0.002)810 return dataType,instDict,insVary794 # def SetInstParms(Inst): 795 # dataType = Inst['Type'][0] 796 # insVary = [] 797 # insNames = [] 798 # insVals = [] 799 # for parm in Inst: 800 # insNames.append(parm) 801 # insVals.append(Inst[parm][1]) 802 # if parm in ['U','V','W','X','Y','SH/L','I(L2)/I(L1)','alpha', 803 # 'beta-0','beta-1','beta-q','sig-0','sig-1','sig-2','sig-q',] and Inst[parm][2]: 804 # insVary.append(parm) 805 # instDict = dict(zip(insNames,insVals)) 806 # instDict['X'] = max(instDict['X'],0.01) 807 # instDict['Y'] = max(instDict['Y'],0.01) 808 # if 'SH/L' in instDict: 809 # instDict['SH/L'] = max(instDict['SH/L'],0.002) 810 # return dataType,instDict,insVary 811 811 812 812 PatternId = G2frame.PatternId … … 836 836 837 837 # load instrument and background params 838 dataType,insDict,insVary = SetInstParms(inst)838 # dataType,insDict,insVary = SetInstParms(inst) 839 839 bakType,bakDict,bakVary = G2pwd.SetBackgroundParms(background) 840 840 # how many background parameters are refined? … … 865 865 # show the updated background values 866 866 wx.CallLater(100,UpdateBackground,G2frame,data) 867 868 def OnBkgClear(event): 869 if 'FixedPoints' not in data[1]: 870 return 871 else: 872 del data[1]['FixedPoints'] 873 G2plt.PlotPatterns(G2frame,plotType='PWDR') 867 874 868 875 def OnPeaksMove(event): … … 1069 1076 G2frame.Bind(wx.EVT_MENU,OnPeaksMove,id=G2gd.wxID_PEAKSMOVE) 1070 1077 G2frame.Bind(wx.EVT_MENU,OnBkgFit,id=G2frame.dataFrame.wxID_BackPts['Fit']) 1078 G2frame.Bind(wx.EVT_MENU,OnBkgClear,id=G2frame.dataFrame.wxID_BackPts['Clear']) 1071 1079 BackId = G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Background') 1072 1080 Choices = ['chebyschev','cosine','Q^2 power series','Q^-2 powder series','lin interpolate','inv interpolate','log interpolate'] -
trunk/GSASIIstrIO.py
r1891 r1894 2240 2240 if hapData['Babinet'][bab][1]: 2241 2241 hapVary.append(pfx+bab) 2242 hapDict[pfx+'Flack'] = hapData.get('Flack',[0.,False])[0]2243 if hapData.get('Flack',[0,False])[1]:2244 hapVary.append(pfx+'Flack')2245 2242 Twins = hapData.get('Twins',[[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]],]) 2243 if len(Twins) == 1: 2244 hapDict[pfx+'Flack'] = hapData.get('Flack',[0.,False])[0] 2245 if hapData.get('Flack',[0,False])[1]: 2246 hapVary.append(pfx+'Flack') 2246 2247 sumTwFr = 0. 2247 2248 controlDict[pfx+'TwinLaw'] = [] … … 2249 2250 controlDict[pfx+'TwinLaw'].append(twin[0]) 2250 2251 if it: 2251 hapDict[pfx+'TwinFr ;'+str(it)] = twin[1]2252 hapDict[pfx+'TwinFr:'+str(it)] = twin[1] 2252 2253 sumTwFr += twin[1] 2253 2254 else: 2254 hapDict[pfx+'TwinFr ;'+str(it)] = twin[1][0]2255 if Twins[0][1][1] and it:2256 hapVary.append(pfx+'TwinFr ;'+str(it))2255 hapDict[pfx+'TwinFr:'+str(it)] = twin[1][0] 2256 if Twins[0][1][1]: 2257 hapVary.append(pfx+'TwinFr:'+str(it)) 2257 2258 #need to make constraint on TwinFr 2258 2259 controlDict[pfx+'TwinLaw'] = np.array(controlDict[pfx+'TwinLaw']) 2259 2260 if len(Twins) > 1: #force sum to unity 2260 hapDict[pfx+'TwinFr ;0'] = 1.-sumTwFr2261 hapDict[pfx+'TwinFr:0'] = 1.-sumTwFr 2261 2262 if Print: 2262 2263 print >>pFile,'\n Phase: ',phase,' in histogram: ',histogram … … 2271 2272 if hapData['Babinet']['BabA'][0]: 2272 2273 PrintBabinet(hapData['Babinet']) 2273 if not SGData['SGInv'] :2274 if not SGData['SGInv'] and len(Twins) == 1: 2274 2275 print >>pFile,' Flack parameter: %10.3f'%(hapData['Flack'][0]),' Refine?',hapData['Flack'][1] 2275 2276 if len(Twins) > 1: 2276 2277 for it,twin in enumerate(Twins): 2277 print >>pFile,' Twin law: %s'%(str(twin[0]).replace('\n',',')),' Twin fr.: %5.3f Refine? '%(hapDict[pfx+'TwinFr ;'+str(it)]),Twins[0][1][1]2278 print >>pFile,' Twin law: %s'%(str(twin[0]).replace('\n',',')),' Twin fr.: %5.3f Refine? '%(hapDict[pfx+'TwinFr:'+str(it)]),Twins[0][1][1] 2278 2279 2279 2280 Histogram['Reflection Lists'] = phase … … 2441 2442 else: 2442 2443 ptstr += '%12.3f'%(item[1][0]) 2443 if pfx+'TwinFr ;'+str(it) in TwinSig:2444 sigstr += '%12.3f'%(TwinSig[pfx+'TwinFr ;'+str(it)])2444 if pfx+'TwinFr:'+str(it) in TwinSig: 2445 sigstr += '%12.3f'%(TwinSig[pfx+'TwinFr:'+str(it)]) 2445 2446 else: 2446 2447 sigstr += 12*' ' … … 2546 2547 while True: 2547 2548 try: 2548 hapData['Twins'][it][1] = parmDict[pfx+'TwinFr ;'+str(it)]2549 if pfx+'TwinFr ;'+str(it) in sigDict:2550 TwinFrSig[pfx+'TwinFr ;'+str(it)] = sigDict[pfx+'TwinFr;'+str(it)]2549 hapData['Twins'][it][1] = parmDict[pfx+'TwinFr:'+str(it)] 2550 if pfx+'TwinFr:'+str(it) in sigDict: 2551 TwinFrSig[pfx+'TwinFr:'+str(it)] = sigDict[pfx+'TwinFr:'+str(it)] 2551 2552 if it: 2552 2553 sumTwFr += hapData['Twins'][it][1] -
trunk/GSASIIstrMath.py
r1891 r1894 816 816 BLtables = calcControls['BLtables'] 817 817 Flack = 1.0 818 if not SGData['SGInv'] and 'S' in calcControls[hfx+'histType'] :818 if not SGData['SGInv'] and 'S' in calcControls[hfx+'histType'] and phfx+'Flack' in parmDict: 819 819 Flack = 1.-2.*parmDict[phfx+'Flack'] 820 820 TwinLaw = np.array([[[1,0,0],[0,1,0],[0,0,1]],]) 821 821 if 'S' in calcControls[hfx+'histType']: 822 822 TwinLaw = calcControls[phfx+'TwinLaw'] 823 TwinFr = np.array([parmDict[phfx+'TwinFr ;'+str(i)] for i in range(len(TwinLaw))])823 TwinFr = np.array([parmDict[phfx+'TwinFr:'+str(i)] for i in range(len(TwinLaw))]) 824 824 if len(TwinLaw) > 1: 825 825 TwinFr[0] = 1.-np.sum(TwinFr[1:]) … … 916 916 if 'S' in calcControls[hfx+'histType']: 917 917 TwinLaw = calcControls[phfx+'TwinLaw'] 918 TwinFr = np.array([parmDict[phfx+'TwinFr ;'+str(i)] for i in range(len(TwinLaw))])918 TwinFr = np.array([parmDict[phfx+'TwinFr:'+str(i)] for i in range(len(TwinLaw))]) 919 919 if len(TwinLaw) > 1: 920 920 TwinFr[0] = 1.-np.sum(TwinFr[1:]) … … 940 940 dFdtw = np.zeros((nRef,nTwin)) 941 941 Flack = 1.0 942 if not SGData['SGInv'] and 'S' in calcControls[hfx+'histType'] :942 if not SGData['SGInv'] and 'S' in calcControls[hfx+'histType'] and phfx+'Flack' in parmDict: 943 943 Flack = 1.-2.*parmDict[phfx+'Flack'] 944 944 for iref,refl in enumerate(refDict['RefList']): … … 987 987 dfbdfr = np.sum(fb/occ,axis=-2) #Fdata != 0 avoids /0. problem 988 988 dfbdba = np.sum(-sinp*Tcorr[:,np.newaxis],axis=1) 989 dfadfl = np.sum(-FPP*Tcorr*sinp)990 dfbdfl = np.sum(FPP*Tcorr*cosp)991 989 dfbdui = np.sum(-SQfactor*fb,axis=-2) 992 990 if len(TwinLaw) > 1: … … 994 992 dfbdua = np.array([np.sum(-Hij[it]*np.swapaxes(fb,-2,-1)[:,it,:,:,np.newaxis],axis=2) for it in range(nTwin)]) 995 993 else: 994 dfadfl = np.sum(-FPP*Tcorr*sinp) 995 dfbdfl = np.sum(FPP*Tcorr*cosp) 996 996 dfbdx = np.sum(twopi*Uniq*np.swapaxes(fbx,-2,-1)[:,:,:,np.newaxis],axis=2) 997 997 dfbdua = np.sum(-Hij*np.swapaxes(fb,-2,-1)[:,:,:,np.newaxis],axis=2) … … 1023 1023 dFdui[iref] = [SA[it]*(dfadui[0][it]+dfbdui[1][it])+SB[it]*(dfbdui[0][it]+dfadui[1][it]) for it in range(nTwin)] 1024 1024 dFdua[iref] = [SA[it]*(dfadua[it][0]+dfbdua[it][1])+SB[it]*(dfbdua[it][0]+dfadua[it][1]) for it in range(nTwin)] 1025 dFdfl[iref] = -SA*dfadfl-SB*dfbdfl1026 1025 dFdtw[iref] = 2.*SA+2.*SB 1027 1026 else: … … 1049 1048 dFdvDict[pfx+'AU13:'+str(i)] = np.sum(0.5*dFdua.T[4][i]*TwinFr[:,np.newaxis],axis=0)/2. 1050 1049 dFdvDict[pfx+'AU23:'+str(i)] = np.sum(0.5*dFdua.T[5][i]*TwinFr[:,np.newaxis],axis=0)/2. 1051 dFdvDict[phfx+'Flack'] = np.sum(dFdfl*TwinFr,axis=1) #?1052 1050 else: 1053 1051 for i in range(len(Mdata)): … … 1067 1065 dFdvDict[phfx+'BabU'] = dFdbab.T[1] 1068 1066 if nTwin > 1: 1069 for i in range(nTwin -1): #skip the base twin element1070 dFdvDict[phfx+'TwinFr ;'+str(i+1)] = dFdtw.T[i+1]1067 for i in range(nTwin): 1068 dFdvDict[phfx+'TwinFr:'+str(i)] = dFdtw.T[i] 1071 1069 return dFdvDict 1072 1070
Note: See TracChangeset
for help on using the changeset viewer.