Changeset 507


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

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

Location:
MPbranch
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • MPbranch/GSASII.py

    r497 r507  
    99# $Id$
    1010########### SVN repository information ###################
    11 import GSASIImain as G2
    12 def main():
     11if __name__ == '__main__':
     12    '''Running interactively, get the whole shebang and start it'''
     13    import GSASIImain as G2
    1314    application = G2.GSASIImain(0)
     15    application.MainLoop()
     16else:
     17    '''running as import (e.g. multiprocessing module) only need the
     18    computation modules'''
     19    import GSASIIstruct
    1420
    15     #application.main.OnRefine(None)
    16     application.MainLoop()
    17    
    18 if __name__ == '__main__':
    19     main()
  • MPbranch/GSASIImain.py

    r499 r507  
    442442            self.GSASprojectfile = arg[1]
    443443            self.dirname = ospath.dirname(arg[1])
    444             os.chdir(self.dirname)
     444            if self.dirname != '': os.chdir(self.dirname)
    445445            G2IO.ProjFileOpen(self)
    446446            self.PatternTree.Expand(self.root)
  • MPbranch/GSASIIpwd.py

    r482 r507  
    2424import GSASIIlattice as G2lat
    2525import GSASIIElem as G2elem
    26 import GSASIIgrid as G2gd
    27 import GSASIIIO as G2IO
    2826import pypowder as pyd
    2927
     
    11541152                ptstr += ptfmt[name] % (parmDict[parName])
    11551153                if parName in varyList:
    1156 #                    ptstr += G2IO.ValEsd(parmDict[parName],sigDict[parName])
    11571154                    ptstr += ptfmt[name] % (sigDict[parName])
    11581155                else:
    1159 #                    ptstr += G2IO.ValEsd(parmDict[parName],0.0)
    11601156                    ptstr += 12*' '
    11611157            print '%s'%(('Peak'+str(i+1)).center(8)),ptstr
  • 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.