Changeset 4832 for trunk/GSASIIimage.py


Ignore:
Timestamp:
Mar 1, 2021 8:31:47 AM (8 months ago)
Author:
vondreele
Message:

fix gaim map calc to include cylindrical sample absorption
fix phase cif importer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r4830 r4832  
    12621262    return useMask
    12631263
    1264 def MakeGainMap(image,Ix,Iy0,data,blkSize=128):
     1264def MakeGainMap(image,Ix,Iy,data,blkSize=128):
    12651265    import scipy.ndimage.filters as sdif
    1266     Iy = sdif.gaussian_filter1d(Iy0,3.)
    12671266    Iy *= npcosd(Ix[:-1])**3       #undo parallax
    12681267    Iy *= (1000./data['distance'])**2    #undo r^2 effect
     
    12711270        Iy *= G2pwd.Oblique(data['Oblique'][0],Ix[:-1])     #undo penetration
    12721271    IyInt = scint.interp1d(Ix[:-1],Iy[0],bounds_error=False)
    1273     muT = data.get('SampleAbs',[0.0,''])[0]
    12741272    GainMap = np.zeros_like(image,dtype=float)
    12751273    #do interpolation on all points - fills in the empty bins; leaves others the same
     
    12841282            jFin = min(jBeg+blkSize,Nx)
    12851283            TA = Make2ThetaAzimuthMap(data,(iBeg,iFin),(jBeg,jFin))           #2-theta & azimuth arrays & create position mask
    1286             tabs = np.ones_like(TA[3])
    1287             if data.get('SampleAbs',[0.0,False])[1]:
    1288                 if 'Cylind' in data['SampleShape']:
    1289                     if 'horiz' in data['orientation']:
    1290                         muR = muT*(1.+0.5*npsind(TA[0])*npsind(TA[1])**2)      #adjust for additional thickness off sample normal
    1291                     else:   #vertical
    1292                         muR = muT*(1.+0.5*npsind(TA[0])*npcosd(TA[1])**2)
    1293                     tabs = G2pwd.Absorb(data['SampleShape'],muR,TA[1])
    1294             elif 'Fixed' in data['SampleShape']:    #assumes flat plate sample normal to beam
    1295                 tabs = G2pwd.Absorb('Fixed',muT,TA[1])
    12961284            Ipix = IyInt(TA[0])
    1297             GainMap[iBeg:iFin,jBeg:jFin] = image[iBeg:iFin,jBeg:jFin]/(tabs*Ipix*TA[3])
     1285            GainMap[iBeg:iFin,jBeg:jFin] = image[iBeg:iFin,jBeg:jFin]/(Ipix*TA[3])
    12981286    GainMap = np.nan_to_num(GainMap,1.0)
    12991287    GainMap = sdif.gaussian_filter(GainMap,3.,order=0)
     
    13561344                tam = MakeMaskMap(data,Masks,(iBeg,iFin),(jBeg,jFin),tamp)
    13571345            times[0] += time.time()-t0      #apply masks
    1358 
    13591346            t0 = time.time()
    13601347            Block = image[iBeg:iFin,jBeg:jFin]          #apply image spotmask here
     
    13621349            tax = np.where(tax > LRazm[1],tax-360.,tax)                 #put azm inside limits if possible
    13631350            tax = np.where(tax < LRazm[0],tax+360.,tax)
    1364             if data.get('SampleAbs',[0.0,False])[1]:
     1351            if data.get('SampleAbs',[0.0,''])[1]:
    13651352                if 'Cylind' in data['SampleShape']:
    1366                     if 'horiz' in data['orientation']:
    1367                         muR = muT*(1.+0.5*npsind(tax)*npsind(tay)**2)      #adjust for additional thickness off sample normal
    1368                     else:   #vertical
    1369                         muR = muT*(1.+0.5*npsind(tax)*npcosd(tay)**2)
     1353                    muR = muT*(1.+npsind(tax)**2/2.)/(npcosd(tay))      #adjust for additional thickness off sample normal
    13701354                    tabs = G2pwd.Absorb(data['SampleShape'],muR,tay)
    13711355                elif 'Fixed' in data['SampleShape']:    #assumes flat plate sample normal to beam
Note: See TracChangeset for help on using the changeset viewer.