Changeset 245


Ignore:
Timestamp:
Feb 13, 2011 4:57:10 PM (11 years ago)
Author:
vondreele
Message:
 
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r239 r245  
    120120def FitDetector(rings,p0,wave):
    121121    from scipy.optimize import leastsq
    122     def ellipseCalc(B,xyd,wave):
     122       
     123    def ellipseCalcD(B,xyd,wave):
    123124        x = xyd[0]
    124125        y = xyd[1]
     
    138139        YR = X*npsind(phi)+Y*npcosd(phi)
    139140        return (XR/R0)**2+(YR/R1)**2-1
    140     result = leastsq(ellipseCalc,p0,args=(rings.T,wave))
    141     return result[0]
     141    def ellipseCalcW(C,xyd):
     142        dist,x0,y0,phi,tilt,wave = C
     143        B = dist,x0,y0,phi,tilt
     144        return ellipseCalcD(B,xyd,wave)
     145    result = leastsq(ellipseCalcD,p0,args=(rings.T,wave))
     146    if len(rings) > 1:
     147        p0 = result[0]
     148        p0 = np.append(p0,wave)
     149        resultW = leastsq(ellipseCalcW,p0,args=(rings.T,))
     150        return result[0],resultW[0][-1]
     151    else:
     152        return result[0],wave
    142153           
    143154def ImageLocalMax(image,w,Xpix,Ypix):
     
    173184            Y /= scaley
    174185            ring.append([X,Y,dsp])
    175     if len(ring) < 20:             #want more than 1/4 of a circle
     186    if len(ring) < 10:             #want more than 20deg
    176187        return []
    177188    return ring
     
    460471    rings = np.concatenate((data['rings']),axis=0)
    461472    p0 = [dist,cent[0],cent[1],phi,tilt]
    462     result = FitDetector(rings,p0,wave)
     473    result,newWave = FitDetector(rings,p0,wave)
     474    print 'Suggested new wavelength = ',('%.5f')%(newWave),' (not reliable if distance > 2m)'
    463475    data['distance'] = result[0]
    464476    data['center'] = result[1:3]
     
    537549    H0 = np.zeros(shape=(numAzms,numChans),order='F',dtype=np.float32)
    538550    imageN = len(image)
    539     nBlks = (imageN-1)/1024+1
    540     dlg = wx.ProgressDialog("Elapsed time","2D image integration",nBlks*nBlks*3+3,
     551    Nx,Ny = data['size']
     552    nXBlks = (Nx-1)/1024+1
     553    nYBlks = (Ny-1)/1024+1
     554    print Nx,Ny,nXBlks,nYBlks
     555    dlg = wx.ProgressDialog("Elapsed time","2D image integration",nXBlks*nYBlks*3+3,
    541556        style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE)
    542557    try:
     
    544559        Nup = 0
    545560        dlg.Update(Nup)
    546         for iBlk in range(nBlks):
     561        for iBlk in range(nYBlks):
    547562            iBeg = iBlk*1024
    548             iFin = min(iBeg+1024,imageN)
    549             for jBlk in range(nBlks):
     563            iFin = min(iBeg+1024,Ny)
     564            for jBlk in range(nXBlks):
    550565                jBeg = jBlk*1024
    551                 jFin = min(jBeg+1024,imageN)               
     566                jFin = min(jBeg+1024,Nx)               
    552567                print 'Process map block',iBlk,jBlk,iBeg,iFin,jBeg,jFin
    553568                TA,tam = Make2ThetaAzimuthMap(data,masks,(iBeg,iFin),(jBeg,jFin))           #2-theta & azimuth arrays & create position mask
  • trunk/GSASIIimgGUI.py

    r243 r245  
    150150           
    151151    def OnIOtth(event):
    152         Ltth = float(self.InnerTth.GetValue())
     152        Ltth = max(float(self.InnerTth.GetValue()),0.001)
    153153        Utth = float(self.OuterTth.GetValue())
    154154        if Ltth > Utth:
  • trunk/GSASIIplot.py

    r244 r245  
    973973                    if 'Line2D' in itemPicked and PickName == 'Image Controls':
    974974                        if 'line1' in itemPicked:
    975                             Data['IOtth'][0] = tth
     975                            Data['IOtth'][0] = max(tth,0.001)
    976976                        elif 'line2' in itemPicked:
    977977                            Data['IOtth'][1] = tth
  • trunk/ImageCalibrants.py

    r240 r245  
    77'LaB6  SRM660a':(2,(4.1569162,4.1569162,4.1569162,90,90,90),0,(0.5,20,10)),
    88'LaB6  SRM660a skip 1':(2,(4.1569162,4.1569162,4.1569162,90,90,90),1,(0.5,20,10)),
    9 'LaB6  SRM660a ID-1 hydra skip 6':(2,(4.1569162,4.1569162,4.1569162,90,90,90),6,(0.7,5,0.5)),
    109'LaB6  SRM660': (2,(4.15695,4.15695,4.15695,90,90,90),0,(0.5,20,10)),
    1110'Si    SRM640c':(0,(5.4311946,5.4311946,5.4311946,90,90,90),0,(0.5,20,10)),
     
    1413'Ni   @ 298K':(0,(3.52475,3.52475,3.52475,90,90,90),0,(0.5,20,10)),
    1514'NaCl @ 298K':(0,(5.6402,5.6402,5.6402,90,90,90),0,(0.5,20,10)),
    16 'CeO2  SRM674b skip 8':(0,(5.411651,5.411651,5.411651,90,90,90),8,(0.5,2,1)),
    1715'Ag behenate':(6,(1.0,1.0,58.380,90,90,90),0,(7.0,5,1)),
    1816'Spun Si grating':(6,(1.0,1.0,2777.78,90,90,90),2,(200.,5,1))
Note: See TracChangeset for help on using the changeset viewer.