Changeset 3246


Ignore:
Timestamp:
Jan 28, 2018 8:56:19 PM (4 years ago)
Author:
toby
Message:

cif export: use sig for x,x,x positions etc; column order for seq table atom positions; misc Py3 fixes

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r3228 r3246  
    14201420                return True
    14211421            elif len(self.Phases) == 1:
    1422                 self.phasenam = self.Phases.keys()
     1422                self.phasenam = list(self.Phases.keys())
    14231423            elif self.multiple:
    14241424                choices = sorted(self.Phases.keys())
     
    14811481                return True
    14821482            elif len(self.Histograms) == 1:
    1483                 self.histnam = self.Histograms.keys()
     1483                self.histnam = list(self.Histograms.keys())
    14841484            else:
    14851485                choices = sorted(self.Histograms.keys())
     
    16041604        else:
    16051605            varyList = list(varyList)
     1606        # add symmetry-generated constraints
     1607        rigidbodyDict = self.G2frame.GPXtree.GetItemPyData(   
     1608            G2gd.GetGPXtreeItemId(self.G2frame,self.G2frame.root,'Rigid bodies'))
     1609        rbIds = rigidbodyDict.get('RBIds',{'Vector':[],'Residue':[]})
     1610        rbVary,rbDict = G2stIO.GetRigidBodyModels(rigidbodyDict,Print=False)
     1611        Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables,MFtables,maxSSwave = G2stIO.GetPhaseData(
     1612            Phases,RestraintDict=None,rbIds=rbIds,Print=False) # generates atom symmetry constraints
    16061613        try:
    16071614            groups,parmlist = G2mv.GroupConstraints(constDict)
    16081615            G2mv.GenerateConstraints(groups,parmlist,varyList,constDict,fixedList,self.parmDict)
     1616            #print(G2mv.VarRemapShow(varyList))
    16091617        except:
    16101618            # this really should not happen
     
    26602668            l[-1] += j
    26612669    t += n + l + ['','Unused columns:']
    2662     usedCols = lbldict.keys()
     2670    usedCols = list(lbldict.keys())
    26632671    for i in keyCols.values(): usedCols += i
    26642672    for i in range(len(items)):
  • trunk/GSASIIdataGUI.py

    r3245 r3246  
    2424import sys
    2525import os
    26 import glob
    27 import imp
     26#import glob
     27#import imp
    2828import inspect
    2929if '2' in platform.python_version_tuple()[0]:
     
    66756675    # sort out the variables in their selected order
    66766676    varcols = 0
    6677     for d in posdict.itervalues():
     6677    for d in posdict.values():
    66786678        varcols = max(varcols,max(d.keys())+1)
    66796679    # get labels for each column
     
    67566756
    67576757    # add atom parameters to table
    6758     colLabels += list(atomLookup.keys())
     6758    colLabels += sorted(atomLookup.keys())
    67596759    for parm in sorted(atomLookup):
    67606760        G2frame.colList += [[data[name]['newAtomDict'][atomLookup[parm]][1] for name in histNames]]
     
    68306830    # Also dicts of variables
    68316831    # for Parametric fitting from the data table
    6832     parmDict = dict(zip(colLabels,zip(*G2frame.colList)[0])) # scratch dict w/all values in table
     6832    parmDict = dict(zip(colLabels,list(zip(*G2frame.colList))[0])) # scratch dict w/all values in table
    68336833    parmDict.update({var:val for var,val in newCellDict.values()}) #  add varied reciprocal cell terms
    68346834    del parmDict['Use']
  • trunk/GSASIIpath.py

    r3179 r3246  
    630630    '''
    631631    from IPython.core import ultratb
     632    # IPyBreak_base() # need fix below for Python3
    632633    if 'win' in sys.platform:
    633634        ultratb.FormattedTB(call_pdb=False,color_scheme='NoColor')(*args)
  • trunk/exports/G2export_CIF.py

    r3216 r3246  
    5656import GSASIIspc as G2spc
    5757import GSASIIstrMain as G2stMn
     58import GSASIImapvars as G2mv
    5859
    5960DEBUG = False    #True to skip printing of reflection/powder profile lists
     
    166167                    val = parmDict.get(var,at[j])
    167168                    sig = sigDict.get(dvar,sigdig)
     169                    if dvar in G2mv.GetDependentVars(): # do not include an esd for dependent vars
     170                        sig = -abs(sig)
    168171                s += PutInCol(G2mth.ValEsd(val,sig),dig)
    169172        s += PutInCol(at[cs+1],3)
  • trunk/makeTutorial.py

    r3236 r3246  
    1919from __future__ import print_function
    2020import os
     21import GSASIIpath
    2122
    22 import GSASIIpath
    23 GSASIIpath.SetBinaryPath()
    24 import GSASIIctrlGUI as G2G
    25 G2BaseURL = G2G.G2BaseURL
    26 tutorialIndex = G2G.tutorialIndex
    27 tutURL = G2BaseURL +'/Tutorials'
    28 outname = os.path.join(GSASIIpath.path2GSAS2,'help','Tutorials.html')
     23if __name__ == '__main__':
     24    GSASIIpath.SetBinaryPath()
     25    import GSASIIctrlGUI as G2G
     26    G2BaseURL = G2G.G2BaseURL
     27    tutorialIndex = G2G.tutorialIndex
     28    tutURL = G2BaseURL +'/Tutorials'
     29    outname = os.path.join(GSASIIpath.path2GSAS2,'help','Tutorials.html')
    2930
    30 dirList = [l[0] for l in tutorialIndex if len(l) == 3]
     31    dirList = [l[0] for l in tutorialIndex if len(l) == 3]
    3132
    32 # loop through directories in Tutorials repository
    33 dirs = [d[:-1] for d in GSASIIpath.svnList(tutURL,False).split('\n') if d and d[-1] == '/']   
    34 for d in dirs:
    35     if d not in dirList: print(u"makeTutorial: Listed tutorial is missing: "+d)
     33    # loop through directories in Tutorials repository
     34    dirs = [d[:-1] for d in GSASIIpath.svnList(tutURL,False).split('\n') if d and d[-1] == '/']   
     35    for d in dirs:
     36        if d not in dirList: print(u"makeTutorial: Listed tutorial is missing: "+d)
    3637
    37 #import sys
    38 #out = sys.stdout
    39 out = open(outname,'w')
    40 print('<!-- Do not edit this file. It is created by makeTutorial.py from info in GSASIIctrlGUI.py --!>',file=out)
    41 print('<h2>List of GSAS-II tutorials</H2><UL>',file=out)
    42 print('''
    43 <p> A list of available tutorials appears below. Each tutorial is a
    44 web page that can be opened using the link below, but most tutorials also need
    45 to have example data files downloaded. This can also be done with links included below,
    46 but it can be easier to access tutorials using
    47 <b>Help/Tutorials</b> menu item.
    48 When this menu entry is used from inside GSAS-II (unless "browse tutorial on web" is selected),
    49 the data files are downloaded to a local directory and GSAS-II will start from that directory
    50 for most file open commands.
    51 </p>''',file=out)
     38    #import sys
     39    #out = sys.stdout
     40    out = open(outname,'w')
     41    print('<!-- Do not edit this file. It is created by makeTutorial.py from info in GSASIIctrlGUI.py --!>',file=out)
     42    print('<h2>List of GSAS-II tutorials</H2><UL>',file=out)
     43    print('''
     44    <p> A list of available tutorials appears below. Each tutorial is a
     45    web page that can be opened using the link below, but most tutorials also need
     46    to have example data files downloaded. This can also be done with links included below,
     47    but it can be easier to access tutorials using
     48    <b>Help/Tutorials</b> menu item.
     49    When this menu entry is used from inside GSAS-II (unless "browse tutorial on web" is selected),
     50    the data files are downloaded to a local directory and GSAS-II will start from that directory
     51    for most file open commands.
     52    </p>''',file=out)
    5253
    53 for l in tutorialIndex:
    54     if len(l) == 1:
    55         print("</UL><h4>{}</H4><UL>".format(l[0]),file=out)
    56     else:
    57         pageURL = tutURL+'/'+l[0]+'/'+l[1]
    58         dataURL = tutURL+'/'+l[0]+'/data'
    59         suffix = ''
    60         if l[2][0] == ' ':
    61             suffix = ' <A href="#prereq">*</A>'
    62         if suffix:
    63             print('<UL><LI><A href="{}">{}</A>{}'.format(pageURL,l[2].strip(),suffix),file=out)
     54    for l in tutorialIndex:
     55        if len(l) == 1:
     56            print("</UL><h4>{}</H4><UL>".format(l[0]),file=out)
    6457        else:
    65             print('<LI><A href="{}">{}</A>'.format(pageURL,l[2].strip()),file=out)
    66            
    67         if GSASIIpath.svnList(dataURL,False):
    68             print(' [link: <A href="{}">Exercise files</A>].'.format(dataURL),file=out)
    69         else:
    70             print(' [No exercise files].',file=out)
    71         if suffix: print('</UL>',file=out)
    72 #        if l[2][0] == ' ':
    73 #            print(' (Note that this tutorial requires previous as prerequisite)',file=out)
     58            pageURL = tutURL+'/'+l[0]+'/'+l[1]
     59            dataURL = tutURL+'/'+l[0]+'/data'
     60            suffix = ''
     61            if l[2][0] == ' ':
     62                suffix = ' <A href="#prereq">*</A>'
     63            if suffix:
     64                print('<UL><LI><A href="{}">{}</A>{}'.format(pageURL,l[2].strip(),suffix),file=out)
     65            else:
     66                print('<LI><A href="{}">{}</A>'.format(pageURL,l[2].strip()),file=out)
    7467
    75 print('</UL>\n<A name=prereq>* Indented tutorials require the previous unindented tutorial as a prerequisite',file=out)
    76 out.close()
     68            if GSASIIpath.svnList(dataURL,False):
     69                print(' [link: <A href="{}">Exercise files</A>].'.format(dataURL),file=out)
     70            else:
     71                print(' [No exercise files].',file=out)
     72            if suffix: print('</UL>',file=out)
     73    #        if l[2][0] == ' ':
     74    #            print(' (Note that this tutorial requires previous as prerequisite)',file=out)
     75
     76    print('</UL>\n<A name=prereq>* Indented tutorials require the previous unindented tutorial as a prerequisite',file=out)
     77    out.close()
Note: See TracChangeset for help on using the changeset viewer.