Changeset 2179


Ignore:
Timestamp:
Mar 18, 2016 3:20:03 PM (7 years ago)
Author:
vondreele
Message:

fixes for IntegrateAll? & AutoIntegrate? - now properly steps to next image
fix some traps for old image projects

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r2125 r2179  
    867867    azmOff = data['azmthOff']
    868868    Dazm = (LRazm[1]-LRazm[0])/numAzms
    869     if 'log(q)' in data['binType']:
    870         lutth = np.log(4.*np.pi*npsind(LUtth/2.)/data['wavelength'])
     869    if '2-theta' in data.get('binType','2-theta'):
     870        lutth = LUtth               
    871871    elif 'Q' == data['binType']:
    872872        lutth = 4.*np.pi*npsind(LUtth/2.)/data['wavelength']
    873     elif '2-theta' in data['binType']:
    874         lutth = LUtth               
     873    elif 'log(q)' in data['binType']:
     874        lutth = np.log(4.*np.pi*npsind(LUtth/2.)/data['wavelength'])
    875875    dtth = (lutth[1]-lutth[0])/numChans
    876     muT = data['SampleAbs'][0]
     876    muT = data.get('SampleAbs',[0.0,''])[0]
    877877    if 'SASD' in data['type']:
    878878        muT = -np.log(muT)/2.       #Transmission to 1/2 thickness muT
     
    909909            tax = np.where(tax > LRazm[1],tax-360.,tax)                 #put azm inside limits if possible
    910910            tax = np.where(tax < LRazm[0],tax+360.,tax)
    911             if data['SampleAbs'][1]:
     911            if data.get('SampleAbs',[0.0,''])[1]:
    912912                if 'Cylind' in data['SampleShape']:
    913913                    muR = muT*(1.+npsind(tax)**2/2.)/(npcosd(tay))      #adjust for additional thickness off sample normal
     
    915915                elif 'Fixed' in data['SampleShape']:    #assumes flat plate sample normal to beam
    916916                    tabs = G2pwd.Absorb('Fixed',muT,tay)
    917             if 'log(q)' in data['binType']:
     917            if 'log(q)' in data.get('binType',''):
    918918                tay = np.log(4.*np.pi*npsind(tay/2.)/data['wavelength'])
    919             elif 'Q' == data['binType']:
     919            elif 'Q' == data.get('binType',''):
    920920                tay = 4.*np.pi*npsind(tay/2.)/data['wavelength']
    921921            t0 = time.time()
     
    932932    H0 = np.nan_to_num(H0)
    933933    H2 = np.array([tth for tth in np.linspace(lutth[0],lutth[1],numChans+1)])
    934     if 'log(q)' in data['binType']:
     934    if 'log(q)' in data.get('binType',''):
    935935        H2 = 2.*npasind(np.exp(H2)*data['wavelength']/(4.*np.pi))
    936     elif 'Q' == data['binType']:
     936    elif 'Q' == data.get('binType',''):
    937937        H2 = 2.*npasind(H2*data['wavelength']/(4.*np.pi))
    938938    if Dazm:       
  • trunk/GSASIIimgGUI.py

    r2178 r2179  
    5959    imagefile = G2IO.CheckImageFile(G2frame,imagefile)
    6060    sumImg = G2IO.GetImageData(G2frame,imagefile,True,ImageTag=imagetag)
     61    if not 'dark image' in data:
     62        return sumImg
    6163    darkImg,darkScale = data['dark image']
    62     backImg,backScale = data['background image']           
    6364    if darkImg:
    6465        Did = G2gd.GetPatternTreeItemId(G2frame, G2frame.root, darkImg)
     
    6768        darkImage = G2IO.GetImageData(G2frame,imagefile,True,ImageTag=imagetag)
    6869        sumImg += darkImage*darkScale
     70    if not 'background image' in data:
     71        return sumImg
     72    backImg,backScale = data['background image']           
    6973    if backImg:     #ignores any transmission effect in the background image
    7074        Bid = G2gd.GetPatternTreeItemId(G2frame, G2frame.root, backImg)
     
    215219                    for item in result:
    216220                        ifintegrate,name,id = item
     221                        G2frame.Image = id
    217222                        if ifintegrate:
    218223                            Id = G2gd.GetPatternTreeItemId(G2frame,id, 'Image Controls')
     
    226231                                style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE)
    227232                            try:
     233#                                GSASIIpath.IPyBreak()
    228234                                image = GetImageZ(G2frame,Data)
    229235                                Masks = G2frame.PatternTree.GetItemPyData(
     
    819825           
    820826        def OnFlatBkg(event):
     827            oldFlat = data.get('Flat Bkg',0.)
    821828            try:
    822829                value = float(flatbkg.GetValue())
     
    825832                pass
    826833            flatbkg.SetValue("%.0f"%(data['Flat Bkg']))   
    827             G2frame.ImageZ = GetImageZ(G2frame,data)
     834            G2frame.ImageZ += (oldFlat-data['Flat Bkg'])
    828835            G2plt.PlotExposedImage(G2frame,event=event)
    829836
     
    23102317        for Id in G2frame.IntgOutList: # loop over newly created PDWR entry(ies)
    23112318            # save the created PWDR tree names so that a reset can delete them
     2319            G2frame.Image = Id
    23122320            treename = G2frame.PatternTree.GetItemText(Id)
    23132321            G2frame.AutointPWDRnames.append(treename)
Note: See TracChangeset for help on using the changeset viewer.