Changeset 599
- Timestamp:
- May 7, 2012 2:59:54 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r584 r599 126 126 parent.Append(menu=self.Import, title='Import') 127 127 parent.Append(menu=self.Export, title='Export') 128 parent.Append(menu=G2gd.MyHelp(self,helpType='Tutorials'),title='&Tutorials' ) 128 129 parent.Append(menu=G2gd.MyHelp(self,helpType='Data tree'),title='&Help' ) 129 130 -
trunk/GSASIIgrid.py
r584 r599 33 33 htmlFrame = None 34 34 if sys.platform.lower().startswith('win'): 35 #helpMode = 'browser' # need a global control to set this36 helpMode = 'internal' # need a global control to set this35 helpMode = 'browser' # need a global control to set this 36 # helpMode = 'internal' # need a global control to set this 37 37 else: 38 38 helpMode = 'browser' # need a global control to set this -
trunk/GSASIIstruct.py
r584 r599 33 33 34 34 ateln2 = 8.0*math.log(2.0) 35 DEBUG = False 35 36 36 37 … … 967 968 for i,refl in enumerate(pawleyRef): 968 969 key = pfx+'PWLref:'+str(i) 969 refl[6] = abs(parmDict[key]) #suppress negative Fsq970 refl[6] = parmDict[key] 970 971 if key in sigDict: 971 972 refl[7] = sigDict[key] … … 1740 1741 PrintInstParmsSig(Inst,instSig) 1741 1742 PrintBackgroundSig(Background,backSig) 1743 1744 ################################################################################ 1745 ##### Penalty & restraint functions 1746 ################################################################################ 1747 1748 def getPenalties(): 1749 return [] 1750 1751 def penaltyFxn(penalties): 1752 return [] 1753 1754 def penaltyDeriv(penalties): 1755 return [] 1742 1756 1743 1757 ################################################################################ … … 2463 2477 if Phase['General'].get('doPawley'): 2464 2478 try: 2465 refl[9] = abs(parmDict[pfx+'PWLref:%d'%(pawleyLookup[pfx+'%d,%d,%d'%(h,k,l)])])2479 refl[9] = parmDict[pfx+'PWLref:%d'%(pawleyLookup[pfx+'%d,%d,%d'%(h,k,l)])] 2466 2480 except KeyError: 2467 2481 # print ' ***Error %d,%d,%d missing from Pawley reflection list ***'%(h,k,l) … … 2570 2584 if Phase['General'].get('doPawley'): 2571 2585 try: 2572 refl[9] = abs(parmDict[pfx+'PWLref:%d'%(pawleyLookup[pfx+'%d,%d,%d'%(h,k,l)])])2586 refl[9] = parmDict[pfx+'PWLref:%d'%(pawleyLookup[pfx+'%d,%d,%d'%(h,k,l)])] 2573 2587 except KeyError: 2574 2588 # print ' ***Error %d,%d,%d missing from Pawley reflection list ***'%(h,k,l) … … 2724 2738 return dMdv 2725 2739 2726 def dervRefine(values,HistoPhases,p armdict,varylist,calcControls,pawleyLookup,dlg):2740 def dervRefine(values,HistoPhases,penalties,parmdict,varylist,calcControls,pawleyLookup,dlg): 2727 2741 parmdict.update(zip(varylist,values)) 2728 2742 G2mv.Dict2Map(parmdict,varylist) … … 2747 2761 else: 2748 2762 dMdv = dMdvh 2763 if penalties: 2764 dmdv = np.concatenate((dmdv.T,penaltyDeriv(penalties).T)).T 2749 2765 return dMdv 2750 2766 2751 def ComputePowderHessian(args):2752 Histogram,parmdict,varylist,Phases,calcControls,pawleyLookup = args2753 hId = Histogram['hId']2754 hfx = ':%d:'%(hId)2755 Limits = calcControls[hfx+'Limits']2756 x,y,w,yc,yb,yd = Histogram['Data']2757 dy = y-yc2758 xB = np.searchsorted(x,Limits[0])2759 xF = np.searchsorted(x,Limits[1])2760 dMdvh = np.sqrt(w[xB:xF])*getPowderProfileDerv(2761 parmdict,x[xB:xF],2762 varylist,Histogram,Phases,calcControls,pawleyLookup)2763 Vec = np.sum(dMdvh*np.sqrt(w[xB:xF])*dy[xB:xF],axis=1)2764 Hess = np.inner(dMdvh,dMdvh)2765 return Vec,Hess2766 2767 def HessRefine(values,HistoPhases,p armdict,varylist,calcControls,pawleyLookup,dlg):2767 #def ComputePowderHessian(args): 2768 # Histogram,parmdict,varylist,Phases,calcControls,pawleyLookup = args 2769 # hId = Histogram['hId'] 2770 # hfx = ':%d:'%(hId) 2771 # Limits = calcControls[hfx+'Limits'] 2772 # x,y,w,yc,yb,yd = Histogram['Data'] 2773 # dy = y-yc 2774 # xB = np.searchsorted(x,Limits[0]) 2775 # xF = np.searchsorted(x,Limits[1]) 2776 # dMdvh = np.sqrt(w[xB:xF])*getPowderProfileDerv( 2777 # parmdict,x[xB:xF], 2778 # varylist,Histogram,Phases,calcControls,pawleyLookup) 2779 # Vec = np.sum(dMdvh*np.sqrt(w[xB:xF])*dy[xB:xF],axis=1) 2780 # Hess = np.inner(dMdvh,dMdvh) 2781 # return Vec,Hess 2782 # 2783 def HessRefine(values,HistoPhases,penalties,parmdict,varylist,calcControls,pawleyLookup,dlg): 2768 2784 parmdict.update(zip(varylist,values)) 2769 2785 G2mv.Dict2Map(parmdict,varylist) … … 2795 2811 return Vec,Hess 2796 2812 2797 def ComputePowderProfile(args):2798 Histogram,parmdict,varylist,Phases,calcControls,pawleyLookup = args2799 hId = Histogram['hId']2800 hfx = ':%d:'%(hId)2801 x,y,w,yc,yb,yd = Histogram['Data']2802 Limits = calcControls[hfx+'Limits']2803 xB = np.searchsorted(x,Limits[0])2804 xF = np.searchsorted(x,Limits[1])2805 yc,yb = getPowderProfile(parmdict,x[xB:xF],varylist,Histogram,Phases,2806 calcControls,pawleyLookup)2807 return xB,xF,yc,yb,Histogram['Reflection Lists']2808 2809 def errRefine(values,HistoPhases,p armdict,varylist,calcControls,pawleyLookup,dlg):2813 #def ComputePowderProfile(args): 2814 # Histogram,parmdict,varylist,Phases,calcControls,pawleyLookup = args 2815 # hId = Histogram['hId'] 2816 # hfx = ':%d:'%(hId) 2817 # x,y,w,yc,yb,yd = Histogram['Data'] 2818 # Limits = calcControls[hfx+'Limits'] 2819 # xB = np.searchsorted(x,Limits[0]) 2820 # xF = np.searchsorted(x,Limits[1]) 2821 # yc,yb = getPowderProfile(parmdict,x[xB:xF],varylist,Histogram,Phases, 2822 # calcControls,pawleyLookup) 2823 # return xB,xF,yc,yb,Histogram['Reflection Lists'] 2824 # 2825 def errRefine(values,HistoPhases,penalties,parmdict,varylist,calcControls,pawleyLookup,dlg): 2810 2826 parmdict.update(zip(varylist,values)) 2811 2827 Values2Dict(parmdict, varylist, values) … … 2851 2867 parmDict['saved values'] = values 2852 2868 raise Exception #Abort!! 2869 if penalties: 2870 M = np.concatenate((M,penaltyFxn(penalties))) 2853 2871 return M 2854 2872 … … 2913 2931 begin = time.time() 2914 2932 values = np.array(Dict2Values(parmDict, varyList)) 2933 penalties = getPenalties() 2915 2934 Ftol = Controls['min dM/M'] 2916 2935 Factor = Controls['shift factor'] … … 2919 2938 result = so.leastsq(errRefine,values,Dfun=dervRefine,full_output=True, 2920 2939 ftol=Ftol,col_deriv=True,factor=Factor, 2921 args=([Histograms,Phases],p armDict,varyList,calcControls,pawleyLookup,dlg))2940 args=([Histograms,Phases],penalties,parmDict,varyList,calcControls,pawleyLookup,dlg)) 2922 2941 ncyc = int(result[2]['nfev']/2) 2923 2942 elif 'Hessian' in Controls['deriv type']: 2924 2943 result = G2mth.HessianLSQ(errRefine,values,Hess=HessRefine,ftol=Ftol,maxcyc=maxCyc, 2925 args=([Histograms,Phases],p armDict,varyList,calcControls,pawleyLookup,dlg))2944 args=([Histograms,Phases],penalties,parmDict,varyList,calcControls,pawleyLookup,dlg)) 2926 2945 ncyc = result[2]['num cyc']+1 2927 2946 Rvals['lamMax'] = result[2]['lamMax'] 2928 2947 else: #'numeric' 2929 2948 result = so.leastsq(errRefine,values,full_output=True,ftol=Ftol,epsfcn=1.e-8,factor=Factor, 2930 args=([Histograms,Phases],p armDict,varyList,calcControls,pawleyLookup,dlg))2949 args=([Histograms,Phases],penalties,parmDict,varyList,calcControls,pawleyLookup,dlg)) 2931 2950 ncyc = int(result[2]['nfev']/len(varyList)) 2932 2951 # table = dict(zip(varyList,zip(values,result[0],(result[0]-values)))) … … 2991 3010 2992 3011 #for testing purposes!!! 2993 # import cPickle 2994 # fl = open('structTestdata.dat','wb') 2995 # cPickle.dump(parmDict,fl,1) 2996 # cPickle.dump(varyList,fl,1) 2997 # for histogram in Histograms: 2998 # if 'PWDR' in histogram[:4]: 2999 # Histogram = Histograms[histogram] 3000 # cPickle.dump(Histogram,fl,1) 3001 # cPickle.dump(Phases,fl,1) 3002 # cPickle.dump(calcControls,fl,1) 3003 # cPickle.dump(pawleyLookup,fl,1) 3004 # fl.close() 3012 if DEBUG: 3013 import cPickle 3014 fl = open('structTestdata.dat','wb') 3015 cPickle.dump(parmDict,fl,1) 3016 cPickle.dump(varyList,fl,1) 3017 for histogram in Histograms: 3018 if 'PWDR' in histogram[:4]: 3019 Histogram = Histograms[histogram] 3020 cPickle.dump(Histogram,fl,1) 3021 cPickle.dump(Phases,fl,1) 3022 cPickle.dump(calcControls,fl,1) 3023 cPickle.dump(pawleyLookup,fl,1) 3024 fl.close() 3005 3025 3006 3026 if dlg: … … 3096 3116 while True: 3097 3117 begin = time.time() 3098 values = np.array(Dict2Values(parmDict, varyList)) 3118 values = np.array(Dict2Values(parmDict,varyList)) 3119 penalties = getPenalties() 3099 3120 Ftol = Controls['min dM/M'] 3100 3121 Factor = Controls['shift factor'] … … 3104 3125 result = so.leastsq(errRefine,values,Dfun=dervRefine,full_output=True, 3105 3126 ftol=Ftol,col_deriv=True,factor=Factor, 3106 args=([Histo,Phases],p armDict,varyList,calcControls,pawleyLookup,dlg))3127 args=([Histo,Phases],penalties,parmDict,varyList,calcControls,pawleyLookup,dlg)) 3107 3128 ncyc = int(result[2]['nfev']/2) 3108 3129 elif 'Hessian' in Controls['deriv type']: 3109 3130 result = G2mth.HessianLSQ(errRefine,values,Hess=HessRefine,ftol=Ftol,maxcyc=maxCyc, 3110 args=([Histo,Phases],p armDict,varyList,calcControls,pawleyLookup,dlg))3131 args=([Histo,Phases],penalties,parmDict,varyList,calcControls,pawleyLookup,dlg)) 3111 3132 ncyc = result[2]['num cyc']+1 3112 3133 else: #'numeric' 3113 3134 result = so.leastsq(errRefine,values,full_output=True,ftol=Ftol,epsfcn=1.e-8,factor=Factor, 3114 args=([Histo,Phases],p armDict,varyList,calcControls,pawleyLookup,dlg))3135 args=([Histo,Phases],penalties,parmDict,varyList,calcControls,pawleyLookup,dlg)) 3115 3136 ncyc = int(result[2]['nfev']/len(varyList)) 3116 3137 -
trunk/help/gsasII.html
r592 r599 25 25 <o:Author>Von Dreele</o:Author> 26 26 <o:LastAuthor>Von Dreele</o:LastAuthor> 27 <o:Revision>8 4</o:Revision>27 <o:Revision>86</o:Revision> 28 28 <o:TotalTime>2820</o:TotalTime> 29 29 <o:Created>2011-11-28T16:49:00Z</o:Created> 30 <o:LastSaved>2012-05-07T 03:17:00Z</o:LastSaved>31 <o:Pages> 9</o:Pages>30 <o:LastSaved>2012-05-07T19:57:00Z</o:LastSaved> 31 <o:Pages>8</o:Pages> 32 32 <o:Words>7204</o:Words> 33 <o:Characters>4106 6</o:Characters>33 <o:Characters>41065</o:Characters> 34 34 <o:Company>Argonne National Laboratory</o:Company> 35 35 <o:Lines>342</o:Lines> 36 36 <o:Paragraphs>96</o:Paragraphs> 37 <o:CharactersWithSpaces>4817 4</o:CharactersWithSpaces>37 <o:CharactersWithSpaces>48173</o:CharactersWithSpaces> 38 38 <o:Version>14.00</o:Version> 39 39 </o:DocumentProperties> … … 605 605 mso-font-kerning:14.0pt;} 606 606 a:link, span.MsoHyperlink 607 {mso-style-priority:99; 607 {mso-style-noshow:yes; 608 mso-style-priority:99; 608 609 color:blue; 609 610 text-decoration:underline; … … 1963 1964 <o:lock v:ext="edit" aspectratio="t"/> 1964 1965 </v:shapetype><v:shape id="Picture_x0020_2" o:spid="_x0000_s1026" type="#_x0000_t75" 1965 alt="Description: Description: Description: Description: Description: GSAS-II logo"1966 alt="Description: Description: Description: Description: Description: Description: Description: GSAS-II logo" 1966 1967 style='position:absolute;margin-left:44.8pt;margin-top:0;width:96pt;height:96pt; 1967 1968 z-index:251657728;visibility:visible;mso-wrap-style:square; … … 1976 1977 </v:shape><![endif]--><![if !vml]><img width=128 height=128 src=gsas2logo.png 1977 1978 align=right 1978 alt="Description: Description: Description: Description: Description: GSAS-II logo"1979 alt="Description: Description: Description: Description: Description: Description: Description: GSAS-II logo" 1979 1980 v:shapes="Picture_x0020_2"><![endif]><span style='mso-fareast-font-family:"Times New Roman"'>Help 1980 1981 for GSAS-II<o:p></o:p></span></h1> … … 1992 1993 <p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"'><o:p> </o:p></span></p> 1993 1994 1994 <h2>< strong>GSAS-II tutorials:<o:p></o:p></strong></h2>1995 <h2><a name=Tutorials><strong>GSAS-II tutorials</strong></a><strong>:<o:p></o:p></strong></h2> 1995 1996 1996 1997 <p class=MsoNormal><strong><a href="Starting%20GSAS.htm"><span … … 2012 2013 2013 2014 <p class=MsoNormal><strong><a href="Neutron%20CW%20Powder%20Data.htm"><span 2014 style='font-weight:normal'>CW Neutron powder pattern Rietveld refi </span><span2015 style='font-weight:normal'>nement withconstraints</span></a><o:p></o:p></strong></p>2015 style='font-weight:normal'>CW Neutron powder pattern Rietveld refinement with 2016 constraints</span></a><o:p></o:p></strong></p> 2016 2017 2017 2018 <p class=MsoNormal><strong>Synchrotron X-ray powder pattern Rietveld refinement … … 2228 2229 pair distribution function (PDF) controls for each powder pattern selected in 2229 2230 the dialog box. See <b style='mso-bidi-font-weight:normal'><span 2230 style='color:#4F81BD;mso-themecolor:accent1'><a href="#PDF_Controls">PDF Controls</a></span></b>2231 for further directions.</p>2231 style='color:#4F81BD;mso-themecolor:accent1'><a href="#PDF_Controls">PDF 2232 Controls</a></span></b> for further directions.</p> 2232 2233 2233 2234 <p class=MsoListParagraphCxSpMiddle style='margin-left:1.0in;mso-add-space: … … 3871 3872 mso-no-proof:yes'><img border=0 width=225 height=31 id="_x0000_i1032" 3872 3873 src=graphbar.jpg 3873 alt="Description: Description: Description: Description: Description: D :\pyGSAS\help\graphbar.jpg"></span><span3874 alt="Description: Description: Description: Description: Description: Description: Description: D:\pyGSAS\help\graphbar.jpg"></span><span 3874 3875 style='mso-fareast-font-family:"Times New Roman"'><o:p></o:p></span></p> 3875 3876 -
trunk/help/gsasII_files/props011.xml
r592 r599 1 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 <ds:datastoreItem ds:itemID="{ 2F27EE4F-99E9-45F4-AE92-593783FDEC2E}" xmlns:ds="http://schemas.openxmlformats.org/officeDocument/2006/customXml"><ds:schemaRefs><ds:schemaRef ds:uri="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"/></ds:schemaRefs></ds:datastoreItem>2 <ds:datastoreItem ds:itemID="{FB1632E6-7E53-4F7F-9F33-A4BD693EF3DE}" xmlns:ds="http://schemas.openxmlformats.org/officeDocument/2006/customXml"><ds:schemaRefs><ds:schemaRef ds:uri="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"/></ds:schemaRefs></ds:datastoreItem>
Note: See TracChangeset
for help on using the changeset viewer.