Changeset 1696 for trunk/GSASIIgrid.py


Ignore:
Timestamp:
Mar 11, 2015 11:30:57 PM (7 years ago)
Author:
toby
Message:

more work on seq. ref. with differing variables; rework svn interface; fix tutorial downloads

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r1688 r1696  
    35113511    VaryListChanges = [] # histograms where there is a change
    35123512    combinedVaryList = []
    3513     firstValueList = []
     3513    firstValueDict = {}
    35143514    vallookup = {}
    35153515    posdict = {}
     3516    prevVaryList = []
    35163517    for i,name in enumerate(histNames):
    3517         newval = False
    3518         for var,val in zip(data[name]['varyList'],data[name]['variables']):
    3519             svar = striphist(var,'*')
    3520             if svar in combinedVaryList: continue
    3521             # add variables to list as they appear
    3522             combinedVaryList.append(svar)
    3523             firstValueList.append(val)
    3524             newval = True
    3525         if newval:
     3518        for var,val,sig in zip(data[name]['varyList'],data[name]['variables'],data[name]['sig']):
     3519            svar = striphist(var,'*') # wild-carded
     3520            if svar not in combinedVaryList:
     3521                # add variables to list as they appear
     3522                combinedVaryList.append(svar)
     3523                firstValueDict[svar] = (val,sig)
     3524        if prevVaryList != data[name]['varyList']: # this refinement has a different refinement list from previous
     3525            prevVaryList = data[name]['varyList']
    35263526            vallookup[name] = dict(zip(data[name]['varyList'],data[name]['variables']))
    35273527            posdict[name] = {}
     
    36173617        if name in posdict:
    36183618            varsellist = [posdict[name].get(i) for i in range(varcols)]
    3619             #sellist = [data[name]['varyList'].index(v) if v is not None else None for v in varsellist]
    3620             sellist = [i if striphist(v,'*') in varsellist else None for i,v in enumerate(data[name]['varyList'])]
     3619            # translate variable names to how they will be used in the headings
     3620            vs = [striphist(v,'*') for v in data[name]['varyList']]
     3621            # determine the index for each column (or None) in the data[]['variables'] and ['sig'] lists
     3622            sellist = [vs.index(v) if v is not None else None for v in varsellist]
     3623            #sellist = [i if striphist(v,'*') in varsellist else None for i,v in enumerate(data[name]['varyList'])]
    36213624        if not varsellist: raise Exception()
    36223625        vals.append([data[name]['variables'][s] if s is not None else None for s in sellist])
    36233626        esds.append([data[name]['sig'][s] if s is not None else None for s in sellist])
     3627        #GSASIIpath.IPyBreak()
    36243628    colList += zip(*vals)
    36253629    colSigs += zip(*esds)
    3626     # add the variables that were refined; change from rows to columns
    3627     #colList += zip(*[data[name]['variables'] for name in histNames])
    3628     #colLabels += data[histNames[0]]['varyList']
    3629     #Types += len(data[histNames[0]]['varyList'])*[wg.GRID_VALUE_FLOAT]
    3630     #colSigs += zip(*[data[name]['sig'] for name in histNames])
    3631 
    3632     # for var in combinedVaryList:
    3633     #     colLabels += [var]
    3634     #     Types += [wg.GRID_VALUE_FLOAT]
    3635     #     vals = []
    3636     #     sigs = []
    3637     #     for name in histNames:
    3638     #         try:
    3639     #             i = data[name]['varyList'].index(var)
    3640     #             vals.append(data[name]['variables'][i])
    3641     #             sigs.append(data[name]['sig'][i])
    3642     #         except ValueError: # var not in list
    3643     #             vals.append(None)
    3644     #             sigs.append(None)
    3645     #     colList += [vals]
    3646     #     colSigs += [sigs]
    36473630               
    36483631    # tabulate constrained variables, removing histogram numbers if needed
     
    37293712
    37303713    #******************************************************************************
     3714    # create a set of values for example evaluation of pseudovars and
    37313715    # this does not work for refinements that have differing numbers of variables.
    37323716    #raise Exception
    3733     indepVarDict = {     #  values in table w/o ESDs
    3734         var:colList[i][0] for i,var in enumerate(colLabels) if colSigs[i] is None
    3735         }
    3736     # make dict of dependent vars (w/ESDs) that are not converted (Dij to Ak or dAx to Ax)
    3737     depVarDict = {
    3738         var:colList[i][0] for i,var in enumerate(colLabels)
    3739         if colSigs[i] is not None and striphist(var) not in Dlookup
    3740         }
     3717    indepVarDict = {}     #  values in table w/o ESDs
     3718    depVarDict = {}
     3719    for i,var in enumerate(colLabels):
     3720        if var == 'Use': continue
     3721        if colList[i][0] is None:
     3722            val,sig = firstValueDict.get(var,[None,None])
     3723        elif colSigs[i]:
     3724            val,sig = colList[i][0],colSigs[i][0]
     3725        else:
     3726            val,sig = colList[i][0],None
     3727        if val is None:
     3728            continue
     3729        elif sig is None:
     3730            indepVarDict[var] = val
     3731        elif striphist(var) not in Dlookup:
     3732            depVarDict[var] = val
    37413733    # add recip cell coeff. values
    37423734    depVarDict.update({var:val for var,val in data[name].get('newCellDict',{}).values()})
Note: See TracChangeset for help on using the changeset viewer.