Changeset 3839


Ignore:
Timestamp:
Mar 6, 2019 3:56:01 PM (3 years ago)
Author:
vondreele
Message:

add some timing for plot patterns - controlled by showTiming
more inn. mag. st.fctr.stuff
fix timing prints

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r3836 r3839  
    109109from __future__ import division, print_function
    110110import platform
     111import time
    111112import copy
    112113import math
     
    193194nxs = np.newaxis
    194195plotDebug = False
     196timeDebug = GSASIIpath.GetConfigValue('Show_timing',False)
     197
    195198#matplotlib 2.0.x dumbed down Paired to 16 colors -
    196199#   this restores the pre 2.0 Paired color map found in matplotlib._cm.py
     
    26612664    else:     #G2frame.selection   
    26622665        Title = os.path.split(G2frame.GSASprojectfile)[1]
     2666        if G2frame.selections is None:
     2667            choices = G2gd.GetGPXtreeDataNames(G2frame,plotType)
     2668        else:
     2669            choices = G2frame.selections
    26632670        PlotList = []
    26642671        ParmList = []
    26652672        SampleList = []
    26662673        Temps = []
    2667         if G2frame.selections is None:
    2668             choices = G2gd.GetGPXtreeDataNames(G2frame,plotType)
    2669         else:
    2670             choices = G2frame.selections
     2674        time0 = time.time()
    26712675        for item in choices:
    26722676            id = G2gd.GetGPXtreeItemId(G2frame,G2frame.root, item)
    26732677            Pattern = G2frame.GPXtree.GetItemPyData(id)
    2674 #            Pattern = copy.deepcopy(G2frame.GPXtree.GetItemPyData(id))
    26752678            if len(Pattern) < 3:                    # put name on end if needed
    26762679                Pattern.append(G2frame.GPXtree.GetItemText(id))
     
    26882691                id, 'Sample Parameters')))
    26892692            Temps.append('%.1fK'%SampleList[-1]['Temperature'])
     2693        if timeDebug:
     2694            print('plot build time: %.3f for %dx%d patterns'%(time.time()-time0,len(PlotList[0][1][1]),len(PlotList)))
    26902695        if not G2frame.Contour:
    26912696            PlotList.reverse()
     
    27612766        Nseq = 0
    27622767    Nmax = len(PlotList)-1
     2768    time0 = time.time()
    27632769    for N,Pattern in enumerate(PlotList):
    27642770        Parms = ParmList[N]
     
    30403046#        axcb = mpl.colorbar.ColorbarBase(N)
    30413047#        axcb.set_label('PDF number')
     3048    if timeDebug:
     3049        print('plot fill time: %.3f'%(time.time()-time0))
    30423050    if not magLineList:
    30433051        Plot.set_title(Title)
     
    30983106           
    30993107    if G2frame.Contour:
     3108        time0 = time.time()
    31003109        acolor = mpl.cm.get_cmap(G2frame.ContourColor)
    31013110        Img = Plot.imshow(ContourZ,cmap=acolor,vmin=0,vmax=Ymax*G2frame.Cmax,interpolation=G2frame.Interpolate,
     
    31073116            imgAx.set_yticklabels(ylabs)
    31083117        Page.figure.colorbar(Img)
     3118        if timeDebug:
     3119            print('Contour display time: %.3f'%(time.time()-time0))
    31093120    else:
    31103121        G2frame.Lines = Lines
  • trunk/GSASIIstrMain.py

    r3838 r3839  
    4545
    4646ateln2 = 8.0*math.log(2.0)
     47DEBUG = True
    4748
    4849def RefineCore(Controls,Histograms,Phases,restraintDict,rigidbodyDict,parmDict,varyList,
  • trunk/GSASIIstrMath.py

    r3837 r3839  
    14321432        SA = fas[0]+fas[1]
    14331433        SB = fbs[0]+fbs[1]
    1434 #        GSASIIpath.IPyBreak()
    14351434        dFdfr[iBeg:iFin] = ((2.*TwMask*SA)[:,:,nxs]*dfadfr+(2.*TwMask*SB)[:,:,nxs]*dfbdfr)*Mdata[nxs,nxs,:]/len(SGMT)
    14361435        dFdx[iBeg:iFin] = (2.*TwMask*SA)[:,:,nxs,nxs]*dfadx+(2.*TwMask*SB)[:,:,nxs,nxs]*dfbdx
     
    14441443#            fbs[0,:,nxs]*np.array([np.sum(dfbdba*dBabdA),np.sum(-dfbdba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T
    14451444        iBeg += blkSize
    1446 #        GSASIIpath.IPyBreak()
    14471445    print (' %d derivative time %.4f\r'%(len(refDict['RefList']),time.time()-time0))
    14481446    #loop over atoms - each dict entry is list of derivatives for all the reflections
     
    15171515        GSdata = SGData['MagMom'][nxs,:,nxs]*GSdata   #flip vectors according to spin flip * det(opM)
    15181516        GSdata = np.swapaxes(GSdata,0,1)    #Nop,Natm,Mxyz
     1517        GSdata = np.inner(GSdata,uAmat.T)
    15191518       
    15201519        mXYZ = np.array([[xyz[0] for xyz in list(G2spc.GenAtom(xyz,SGData,All=True,Move=True))] for xyz in (Xdata+dXdata).T])%1. #Natn,Nop,xyz
     
    32953294        print ('ouch #4 bad profile coefficients yield negative peak width; some reflections skipped')
    32963295    if GSASIIpath.GetConfigValue('Show_timing',False):
    3297         print ('getPowderProfile t=%.3f'%time.time()-starttime)
     3296        print ('getPowderProfile t=%.3f'%(time.time()-starttime))
    32983297    return yc,yb
    32993298   
     
    38603859                #    varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars)
    38613860            G2mv.Dict2Deriv(varylist,depDerivDict,dMdvh)
    3862             if GSASIIpath.GetConfigValue('Show_timing',False): print ('getPowderProfileDerv t=%.3f'%time.time()-starttime)
     3861            if GSASIIpath.GetConfigValue('Show_timing',False): print ('getPowderProfileDerv t=%.3f'%(time.time()-starttime))
    38633862            Wt = ma.sqrt(W[xB:xF])[nxs,:]
    38643863            Dy = dy[xB:xF][nxs,:]
Note: See TracChangeset for help on using the changeset viewer.