Changeset 4299 for trunk/GSASIIimage.py


Ignore:
Timestamp:
Feb 13, 2020 9:56:45 AM (21 months ago)
Author:
vondreele
Message:

new spot mask algorithm - it is slow but works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r4181 r4299  
    11881188
    11891189            t0 = time.time()
    1190             Block = image[iBeg:iFin,jBeg:jFin]
     1190            Block = image[iBeg:iFin,jBeg:jFin]          #apply image spotmask here
    11911191            tax,tay,taz,tad,tabs = Fill2ThetaAzimuthMap(Masks,TA,tam,Block)    #and apply masks
    11921192            tax = np.where(tax > LRazm[1],tax-360.,tax)                 #put azm inside limits if possible
     
    15181518    Masks['Points'] = Peaks
    15191519    return None
     1520
     1521def AutoSpotMasks2(Image,Masks,Controls,dlg=None):
     1522   
     1523    LUtth = np.array(Controls['IOtth'])
     1524    numChans = Controls['outChannels']
     1525    dtth = (LUtth[1]-LUtth[0])/numChans
     1526    esdMul = Masks['SpotMask']['esdMul']
     1527    mask = ma.make_mask_none(Image.shape)   
     1528    TA = Make2ThetaAzimuthMap(Controls,(0,Image.shape[0]),(0,Image.shape[1]))[0]    #2-theta array
     1529    TThs = np.linspace(LUtth[0],LUtth[1],numChans,False)
     1530    for it,TTh in enumerate(TThs):
     1531        band = ma.array(Image,mask=ma.getmask(ma.masked_outside(TA,TTh,TTh+dtth)))
     1532        std = ma.std(band)
     1533        anom = band.anom()/std
     1534        anom = ma.masked_greater(anom,esdMul,copy=False)
     1535        mask ^= (ma.getmask(anom)^ma.getmask(band))
     1536        if not dlg is None:
     1537            GoOn = dlg.Update(it,newmsg='Processed 2-theta rings = %d'%(it))
     1538            if not GoOn[0]:
     1539                break
     1540    Masks['SpotMask']['spotMask'] = mask
     1541    return None
Note: See TracChangeset for help on using the changeset viewer.