source: trunk/AllBinaries/binwin64-2.7/ycalc.py @ 3108

Last change on this file since 3108 was 3108, checked in by vondreele, 4 years ago

update AllBinaries? to have win_64_p2.7_n1.13 including spotmask.pyd

File size: 1.5 KB
Line 
1import os
2import numpy as np
3import numpy.ma as ma
4#import GSASIIpath # needed if pypowder is in a ./bin... directory
5#import GSASIIpwd as G2pwd
6import cPickle
7import pypowder as pyd
8
9#def getFCJVoigt3(pos,sig,gam,shl,xdata):
10#    'needs a doc string'
11#    Df = pyd.pypsvfcj(len(xdata),xdata-pos,pos,sig,gam,shl)
12#    Df /= np.sum(Df)
13#    return Df
14loc = os.path.split(os.path.abspath(__file__))[0]
15fp = open(os.path.join(loc,'yc_info.CPickle'),'r')
16x = cPickle.load(fp)
17yc = np.zeros_like(x)
18while(True): # loop on phases
19    l = cPickle.load(fp)
20    if len(l) != 2:
21        yc_orig = l
22        break
23    else:
24        im,shl = l
25    while(True): # loop on reflections
26        l = cPickle.load(fp)
27        if l is None: break
28        refl,iBeg,iFin = l
29        print iBeg,iFin
30        #yc[iBeg:iFin] += refl[11+im]*refl[9+im]*getFCJVoigt3(refl[5+im],refl[6+im],refl[7+im],shl,ma.getdata(x[iBeg:iFin]))    #>90% of time spent here
31        xdata = ma.getdata(x[iBeg:iFin])-refl[5+im]
32        #def getFCJVoigt3(pos,sig,gam,shl,xdata):
33        Df = pyd.pypsvfcj(len(xdata),xdata,refl[5+im],refl[6+im],refl[7+im],shl)
34        yc[iBeg:iFin] += refl[11+im]*refl[9+im]* Df / np.sum(Df)
35        print np.sum(Df)
36
37fp.close()
38import pylab
39pl = pylab.figure(facecolor='white')
40ax = pl.add_subplot(111)
41ax.set_xlabel(r'$\mathsf{2\theta}$')
42ax.set_ylabel('Intensity')
43#ax.set_title(Title)
44ax.plot(x,yc,label='calc')
45ax.plot(x,yc_orig,label='pickle')
46ax.plot(x,yc-yc_orig,label='diff')
47ax.legend()
48pylab.show()
Note: See TracBrowser for help on using the repository browser.