Ignore:
Timestamp:
Mar 1, 2012 3:21:29 PM (11 years ago)
Author:
toby
Message:

fix function calc to allow for out of sequence finish of 'threads'; other minor fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • MPbranch/GSASIIstruct.py

    r496 r507  
    4040        Controls = dictionary of control items
    4141    '''
    42     Controls = {'deriv type':'analytic Hessian','max cyc':3,'max Hprocess':1,
    43         'max Rprocess':1,'min dM/M':0.0001,'shift factor':1.}
     42    Controls = {'deriv type':'analytic Hessian','max cyc':3,
     43                'max Hprocess':2,
     44                'max Rprocess':1,
     45                'min dM/M':0.0001,'shift factor':1.}
    4446    file = open(GPXfile,'rb')
    4547    while True:
     
    26882690
    26892691def ComputePowderProfile(args):
    2690     Histogram,parmdict,varylist,Phases,calcControls,pawleyLookup = args
     2692    Histogram,parmdict,varylist,Phases,calcControls,pawleyLookup,histkey = args
    26912693    hId = Histogram['hId']
    26922694    hfx = ':%d:'%(hId)
     
    26982700                            varylist,Histogram,Phases,calcControls,
    26992701                            pawleyLookup)
    2700     return xB,xF,yc,yb,Histogram['Reflection Lists']
     2702    return xB,xF,yc,yb,Histogram['Reflection Lists'],histkey
    27012703
    27022704#def errRefine(values,HistoPhases,parmdict,varylist,calcControls,pawleyLookup,dlg):       
     
    27622764            Histogram = Histograms[histogram]
    27632765            argList.append(
    2764                 [Histogram,parmdict,varylist,Phases,calcControls,pawleyLookup]
     2766                [Histogram,parmdict,varylist,Phases,calcControls,pawleyLookup,histogram]
    27652767                )
    27662768    if MaxProcess > 1:
    27672769        mpPool = mp.Pool(processes=MaxProcess)
    2768         #results = mpPool.map(ComputePowderProfile,argList)
    2769         #for arg,res in zip(argList,results):
    2770         #results = mpPool.map(ComputePowderProfile,argList)
    2771         #for i,res in enumerate(results):
    2772         for i,res in enumerate(
    2773             mpPool.imap_unordered(ComputePowderProfile,argList)
    2774             ):
    2775             print 'process',i
    2776             xB,xF,ycSect,ybSect,RL = res
    2777             Histogram = argList[i][0]
     2770        for (xB,xF,ycSect,ybSect,RL,histkey
     2771             ) in mpPool.imap_unordered(ComputePowderProfile,argList):
     2772            Histogram = Histograms[histkey]
    27782773            Histogram['Reflection Lists'] = RL
    27792774            x,y,w,yc,yb,yd = Histogram['Data']
     
    27962791    else:
    27972792        for arg in argList:
    2798             xB,xF,ycSect,ybSect,RL = ComputePowderProfile(arg)
     2793            xB,xF,ycSect,ybSect,RL,histkey = ComputePowderProfile(arg)
    27992794            Histogram = arg[0]
    28002795            hId = Histogram['hId']
     
    29702965#    file.close()
    29712966
     2967    ShowControls(Controls)
     2968    print 'Last Refinement time = %8.3fs'%(runtime)
    29722969    if dlg:
    29732970        return Rwp
Note: See TracChangeset for help on using the changeset viewer.