Changeset 1644 for trunk/GSASIIimage.py


Ignore:
Timestamp:
Feb 10, 2015 1:24:18 PM (7 years ago)
Author:
vondreele
Message:

setting up image calibration to allow more control over refined parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r1489 r1644  
    154154       
    155155    def ellipseCalcD(B,xyd,varyList,parmDict):
     156       
    156157        x,y,dsp = xyd
    157         wave = parmDict['wave']
    158         if 'dep' in varyList:
    159             dist,x0,y0,tilt,chi,dep = B[:6]
    160         else:
    161             dist,x0,y0,tilt,chi = B[:5]
    162             dep = parmDict['dep']
    163         if 'wave' in varyList:
    164             wave = B[-1]
    165         phi = chi-90.               #get rotation of major axis from tilt axis
    166         tth = 2.0*npasind(wave/(2.*dsp))
    167         phi0 = npatan2d(y-y0,x-x0)
    168         dxy = peneCorr(tth,dep,tilt,phi0)
     158        varyDict = dict(zip(varyList,B))
     159        parms = {}
     160        for parm in parmDict:
     161            if parm in varyList:
     162                parms[parm] = varyDict[parm]
     163            else:
     164                parms[parm] = parmDict[parm]
     165        phi = parms['phi']-90.               #get rotation of major axis from tilt axis
     166        tth = 2.0*npasind(parms['wave']/(2.*dsp))
     167        phi0 = npatan2d(y-parms['det-Y'],x-parms['det-X'])
     168        dxy = peneCorr(tth,parms['dep'],parms['tilt'],phi0)
    169169        ttth = nptand(tth)
    170170        stth = npsind(tth)
    171         cosb = npcosd(tilt)
    172         tanb = nptand(tilt)       
    173         tbm = nptand((tth-tilt)/2.)
    174         tbp = nptand((tth+tilt)/2.)
    175         sinb = npsind(tilt)
    176         d = dist+dxy
     171        cosb = npcosd(parms['tilt'])
     172        tanb = nptand(parms['tilt'])       
     173        tbm = nptand((tth-parms['tilt'])/2.)
     174        tbp = nptand((tth+parms['tilt'])/2.)
     175        sinb = npsind(parms['tilt'])
     176        d = parms['dist']+dxy
    177177        fplus = d*tanb*stth/(cosb+stth)
    178178        fminus = d*tanb*stth/(cosb-stth)
     
    182182        R1 = (vplus+vminus)/2.                                    #major axis
    183183        zdis = (fplus-fminus)/2.
    184         Robs = np.sqrt((x-x0)**2+(y-y0)**2)
     184        Robs = np.sqrt((x-parms['det-X'])**2+(y-parms['det-Y'])**2)
    185185        rsqplus = R0**2+R1**2
    186186        rsqminus = R0**2-R1**2
     
    201201    sig = list(np.sqrt(chisq*np.diag(result[1])))
    202202    sigList = np.zeros(7)
    203     for i,name in enumerate(names):
    204         if name in varyList:
    205             sigList[i] = sig[varyList.index(name)]
    206     ValSig = zip(names,fmt,vals,sig)
     203    for i,name in enumerate(varyList):
     204        sigList[i] = sig[varyList.index(name)]
     205    ValSig = zip(varyList,fmt,vals,sig)
    207206    if Print:
    208207        CalibPrint(ValSig,chisq,rings.shape[0])
     
    517516            HKL += hkl
    518517    HKL = G2lat.sortHKLd(HKL,True,False)
    519     varyList = ['dist','det-X','det-Y','tilt','phi']
     518    varyList = [item for item in data['varyList'] if data['varyList'][item]]
    520519    parmDict = {'dist':data['distance'],'det-X':data['center'][0],'det-Y':data['center'][1],
    521520        'tilt':data['tilt'],'phi':data['rotation'],'wave':data['wavelength'],'dep':data['DetDepth']}
     
    547546#            break
    548547    rings = np.concatenate((data['rings']),axis=0)
    549     if data['DetDepthRef']:
    550         varyList.append('dep')
    551548    chisq = FitDetector(rings,varyList,parmDict)
    552549    data['distance'] = parmDict['dist']
     
    667664        Ringp = makeRing(dsp,ellipsep,3,cutoff,scalex,scaley,self.ImageZ)
    668665        parmDict = {'dist':dist,'det-X':centp[0],'det-Y':centp[1],
    669             'tilt':tilt,'phi':phi,'wave':wave,'dep':0.0}
    670         varyList = ['dist','det-X','det-Y','tilt','phi']
     666            'tilt':tilt,'phi':phi,'wave':wave,'dep':0.0}       
     667        varyList = [item for item in data['varyList'] if data['varyList'][item]]
    671668        if len(Ringp) > 10:
    672669            chip = FitDetector(np.array(Ring0+Ringp),varyList,parmDict,True)
     
    706703    parmDict = {'dist':data['distance'],'det-X':data['center'][0],'det-Y':data['center'][1],
    707704        'tilt':data['tilt'],'phi':data['rotation'],'wave':data['wavelength'],'dep':data['DetDepth']}
    708     varyList = ['dist','det-X','det-Y','tilt','phi']
    709     if data['DetDepthRef']:
    710         varyList.append('dep')
     705    varyList = [item for item in data['varyList'] if data['varyList'][item]]
    711706    data['rings'] = []
    712707    data['ellipses'] = []
Note: See TracChangeset for help on using the changeset viewer.