Changeset 3136


Ignore:
Timestamp:
Oct 23, 2017 11:39:16 AM (4 years ago)
Author:
vondreele
Message:

make GSAS-II python 3.6 compliant & preserve python 2.7 use;changes:
do from future import division, print_function for all GSAS-II py sources
all menu items revised to be py 2.7/3.6 compliant
all wx.OPEN --> wx.FD_OPEN in file dialogs
all integer divides (typically for image pixel math) made explicit with ; ambiguous ones made floats as appropriate
all print "stuff" --> print (stuff)
all print >> pFile,'stuff' --> pFile.writeCIFtemplate('stuff')
all read file opens made explicit 'r' or 'rb'
all cPickle imports made for py2.7 or 3.6 as cPickle or _pickle; test for '2' platform.version_tuple[0] for py 2.7
define cPickleload to select load(fp) or load(fp,encoding='latin-1') for loading gpx files; provides cross compatibility between py 2.7/3.6 gpx files
make dict.keys() as explicit list(dict.keys()) as needed (NB: possible source of remaining py3.6 bugs)
make zip(a,b) as explicit list(zip(a,b)) as needed (NB: possible source of remaining py3.6 bugs)
select unichr/chr according test for '2' platform.version_tuple[0] for py 2.7 (G2pwdGUI * G2plot) for special characters
select wg.EVT_GRID_CELL_CHANGE (classic) or wg.EVT_GRID_CELL_CHANGED (phoenix) in grid Bind
maxint --> maxsize; used in random number stuff
raise Exception,"stuff" --> raise Exception("stuff")
wx 'classic' sizer.DeleteWindows?() or 'phoenix' sizer.Clear(True)
wx 'classic' SetToolTipString?(text) or 'phoenix' SetToolTip?(wx.ToolTip?(text)); define SetToolTipString?(self,text) to handle the choice in plots
status.SetFields? --> status.SetStatusText?
'classic' AddSimpleTool? or 'phoenix' self.AddTool? for plot toolbar; Bind different as well
define GetItemPydata? as it doesn't exist in wx 'phoenix'
allow python versions 2.7 & 3.6 to run GSAS-II
Bind override commented out - no logging capability (NB: remove all logging code?)
all import ContentsValidator? open filename & test if valid then close; filepointer removed from Reader
binary importers (mostly images) test for 'byte' type & convert as needed to satisfy py 3.6 str/byte rules

Location:
trunk
Files:
73 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIElem.py

    r2563 r3136  
    263263        xsec = open(filename,'Ur')
    264264    except:
    265         print '**** ERROR - File Xsect.dat not found in directory %s' % os.path.split(filename)[0]
     265        print ('**** ERROR - File Xsect.dat not found in directory %s'%os.path.split(filename)[0])
    266266        sys.exit()
    267267    S = '1'
  • trunk/GSASIIElemGUI.py

    r2680 r3136  
    1414to delete an element from a list of selected elements.
    1515'''
    16 """ElementGUI: class defn. for element GUIs
    17    Copyright: 2008, Robert B. Von Dreele & Brian H. Toby (Argonne National Laboratory)
    18 """
    19 
     16from __future__ import division, print_function
    2017import GSASIIpath
    2118GSASIIpath.SetVersionNumber("$Revision$")
    2219import wx
    2320import os
    24 import sys
    2521import wx.lib.colourselect as wscs
    2622class PickElement(wx.Dialog):
     
    350346    PE = PickElement(G2frame)
    351347    if PE.ShowModal() == wx.ID_OK:
    352         print PE.Elem
     348        print (PE.Elem)
    353349    PE.Destroy()
    354350
  • trunk/GSASIIIO.py

    r3023 r3136  
    2020This module needs some work to separate wx from non-wx routines
    2121'''
    22 """GSASIIIO: functions for IO of data
    23    Copyright: 2008, Robert B. Von Dreele (Argonne National Laboratory)
    24 """
    2522# If this is being used for GSASIIscriptable, don't depend on wx
     23from __future__ import division, print_function
    2624try:
    2725    import wx
     
    3432import numpy as np
    3533import copy
    36 import cPickle
     34import platform
     35if '2' in platform.python_version_tuple()[0]:
     36    import cPickle
     37else:
     38    import _pickle as cPickle
    3739import sys
    3840import re
     
    124126    File.close()
    125127    if Comments:
    126        print 'Comments on file:'
     128       print ('Comments on file:')
    127129       for Comment in Comments:
    128             print Comment
     130            print (Comment)
    129131            if 'wavelength' in Comment:
    130132                wave = float(Comment.split('=')[1])
     
    170172        imagefile = Imagefile
    171173    if not os.path.exists(imagefile):
    172         print 'Image file '+imagefile+' not found'
     174        print ('Image file '+imagefile+' not found')
    173175        fil = imagefile.replace('\\','/') # windows?!
    174176        # see if we can find a file with same name or in a similarly named sub-dir
     
    178180            prevpth = pth
    179181            if os.path.exists(os.path.join(G2frame.dirname,fil)):
    180                 print 'found image file '+os.path.join(G2frame.dirname,fil)
     182                print ('found image file '+os.path.join(G2frame.dirname,fil))
    181183                imagefile = os.path.join(G2frame.dirname,fil)
    182184                G2frame.GPXtree.UpdateImageLoc(treeId,imagefile)
     
    202204            prevpth = pth
    203205            if os.path.exists(os.path.join(pth,fil)):
    204                 print 'found image file '+os.path.join(pth,fil)
     206                print ('found image file '+os.path.join(pth,fil))
    205207                imagefile = os.path.join(pth,fil)
    206208                G2frame.GPXtree.UpdateImageLoc(treeId,imagefile)
     
    214216        wildcard = 'Image format (*'+prevext+')|*'+prevext
    215217        dlg = wx.FileDialog(G2frame, 'Previous image file ('+prevnam+') not found; open here', '.', prevnam,
    216                             wildcard,wx.OPEN)
     218                            wildcard,wx.FD_OPEN)
    217219        try:
    218220            dlg.SetFilename(''+ospath.split(imagefile)[1])
     
    390392        print('Error: No matching format for file '+imagefile)
    391393        raise Exception('No image read')
    392     fp = None
    393394    errorReport = ''
    394395    if not imagefile:
    395396        return
    396     fp = open(imagefile,'Ur')
    397397    for rd in primaryReaders+secondaryReaders:
    398398        rd.ReInitialize() # purge anything from a previous read
    399         fp.seek(0)  # rewind
    400399        rd.errors = "" # clear out any old errors
    401         if not rd.ContentsValidator(fp): # rejected on cursory check
     400        if not rd.ContentsValidator(imagefile): # rejected on cursory check
    402401            errorReport += "\n  "+rd.formatName + ' validator error'
    403402            if rd.errors:
     
    409408            ParentFrame = G2frame
    410409        if GSASIIpath.GetConfigValue('debug'):
    411             flag = rd.Reader(imagefile,fp,ParentFrame,blocknum=ImageTag)
     410            flag = rd.Reader(imagefile,ParentFrame,blocknum=ImageTag)
    412411        else:
    413412            flag = False
    414413            try:
    415                 flag = rd.Reader(imagefile,fp,ParentFrame,blocknum=ImageTag)
     414                flag = rd.Reader(imagefile,ParentFrame,blocknum=ImageTag)
    416415            except rd.ImportException as detail:
    417416                rd.errors += "\n  Read exception: "+str(detail)
     
    424423                raise Exception('No image read. Strange!')
    425424            if GSASIIpath.GetConfigValue('Transpose'):
    426                 print 'Transposing Image!'
     425                print ('Transposing Image!')
    427426                rd.Image = rd.Image.T
    428427            #rd.readfilename = imagefile
     
    458457        raise Exception('No image read')
    459458    errorReport = ''
    460     fp = open(imagefile,'Ur')
    461459    rdbuffer = {} # create temporary storage for file reader
    462460    for rd in primaryReaders+secondaryReaders:
    463461        rd.ReInitialize() # purge anything from a previous read
    464         fp.seek(0)  # rewind
    465462        rd.errors = "" # clear out any old errors
    466         if not rd.ContentsValidator(fp): # rejected on cursory check
     463        if not rd.ContentsValidator(imagefile): # rejected on cursory check
    467464            errorReport += "\n  "+rd.formatName + ' validator error'
    468465            if rd.errors:
     
    477474            repeat = False
    478475            if GSASIIpath.GetConfigValue('debug'):
    479                 flag = rd.Reader(imagefile,fp,ParentFrame,blocknum=block,Buffer=rdbuffer)
     476                flag = rd.Reader(imagefile,ParentFrame,blocknum=block,Buffer=rdbuffer)
    480477            else:
    481478                flag = False
    482479                try:
    483                     flag = rd.Reader(imagefile,fp,ParentFrame,blocknum=block,Buffer=rdbuffer)
     480                    flag = rd.Reader(imagefile,ParentFrame,blocknum=block,Buffer=rdbuffer)
    484481                except rd.ImportException as detail:
    485482                    rd.errors += "\n  Read exception: "+str(detail)
     
    492489                    raise Exception('No image read. Strange!')
    493490                if GSASIIpath.GetConfigValue('Transpose'):
    494                     print 'Transposing Image!'
     491                    print ('Transposing Image!')
    495492                    rd.Image = rd.Image.T
    496493                rd.Data['ImageTag'] = rd.repeatcount
     
    507504def SaveMultipleImg(G2frame):
    508505    if not G2frame.GPXtree.GetCount():
    509         print 'no images!'
     506        print ('no images!')
    510507        return
    511508    choices = G2gd.GetGPXtreeDataNames(G2frame,['IMG ',])
     
    549546    'Write an image as a python pickle - might be better as an .edf file?'
    550547    File = open(filename,'wb')
    551     cPickle.dump([Comments,Data,Npix,image],File,1)
     548    cPickle.dump([Comments,Data,Npix,image],File,2)
    552549    File.close()
    553550    return
     
    561558    LastSavedUsing = None
    562559    file = open(G2frame.GSASprojectfile,'rb')
    563     if showProvenance: print 'loading from file: ',G2frame.GSASprojectfile
     560    if showProvenance: print ('loading from file: '+G2frame.GSASprojectfile)
    564561    #G2frame.SetTitle("GSAS-II data tree: "+
    565562    #                 os.path.split(G2frame.GSASprojectfile)[1])
    566563    G2frame.SetTitle("GSAS-II data tree: "+
    567                      os.path.split(G2frame.GSASprojectfile)[1],1)
     564        os.path.split(G2frame.GSASprojectfile)[1],1)
    568565    wx.BeginBusyCursor()
    569566    try:
    570567        while True:
    571568            try:
    572                 data = cPickle.load(file)
     569                if '2' in platform.python_version_tuple()[0]:
     570                    data = cPickle.load(file)
     571                else:
     572                    data = cPickle.load(file,encoding='latin-1')
    573573            except EOFError:
    574574                break
     
    578578            if datum[0].startswith('PWDR'):               
    579579                if 'ranId' not in datum[1][0]: # patch: add random Id if not present
    580                     datum[1][0]['ranId'] = ran.randint(0,sys.maxint)
     580                    datum[1][0]['ranId'] = ran.randint(0,sys.maxsize)
    581581                G2frame.GPXtree.SetItemPyData(Id,datum[1][:3])  #temp. trim off junk (patch?)
    582582            elif datum[0].startswith('HKLF'):
    583583                if 'ranId' not in datum[1][0]: # patch: add random Id if not present
    584                     datum[1][0]['ranId'] = ran.randint(0,sys.maxint)
     584                    datum[1][0]['ranId'] = ran.randint(0,sys.maxsize)
    585585                G2frame.GPXtree.SetItemPyData(Id,datum[1])
    586586            else:
     
    641641    if not G2frame.GPXtree.IsEmpty():
    642642        file = open(G2frame.GSASprojectfile,'wb')
    643         print 'save to file: ',G2frame.GSASprojectfile
     643        print ('save to file: '+G2frame.GSASprojectfile)
    644644        # stick the file name into the tree and version info into tree so they are saved.
    645645        # (Controls should always be created at this point)
     
    665665                    item2, cookie2 = G2frame.GPXtree.GetNextChild(item, cookie2)                           
    666666                item, cookie = G2frame.GPXtree.GetNextChild(G2frame.root, cookie)                           
    667                 cPickle.dump(data,file,1)
     667                cPickle.dump(data,file,2)
    668668            file.close()
    669669            pth = os.path.split(os.path.abspath(G2frame.GSASprojectfile))[0]
     
    766766            'wtFactor':1.0,
    767767            'Dummy':False,
    768             'ranId':ran.randint(0,sys.maxint),
     768            'ranId':ran.randint(0,sys.maxsize),
    769769            'Offset':[0.0,0.0],'delOffset':0.02*Ymax,'refOffset':-0.1*Ymax,'refDelt':0.1*Ymax,
    770770            'qPlot':False,'dPlot':False,'sqrtPlot':False,'Yminmax':[Ymin,Ymax]
     
    801801            File.write('%.3f,%.3f\n'%(x,y))   
    802802    File.close()
    803     print ' XY data saved to: ',filename
     803    print (' XY data saved to: '+filename)
    804804           
    805805def PDFSave(G2frame,exports,PDFsaves):
     
    821821                iqfile.write("%15.6g %15.6g\n" % (q,iq))
    822822            iqfile.close()
    823             print ' I(Q) saved to: ',iqfilename
     823            print (' I(Q) saved to: '+iqfilename)
    824824           
    825825        if PDFsaves[1]:     #S(Q)
     
    835835                sqfile.write("%15.6g %15.6g\n" % (q,sq))
    836836            sqfile.close()
    837             print ' S(Q) saved to: ',sqfilename
     837            print (' S(Q) saved to: '+sqfilename)
    838838           
    839839        if PDFsaves[2]:     #F(Q)
     
    849849                fqfile.write("%15.6g %15.6g\n" % (q,fq))
    850850            fqfile.close()
    851             print ' F(Q) saved to: ',fqfilename
     851            print (' F(Q) saved to: '+fqfilename)
    852852           
    853853        if PDFsaves[3]:     #G(R)
     
    863863                grfile.write("%15.6g %15.6g\n" % (r,gr))
    864864            grfile.close()
    865             print ' G(R) saved to: ',grfilename
     865            print (' G(R) saved to: '+grfilename)
    866866       
    867867        if PDFsaves[4]: #pdfGUI file for G(R)
     
    922922                grfile.write("%15.2F %15.6F\n" % (r,gr))
    923923            grfile.close()
    924             print ' G(R) saved to: ',grfilename
     924            print (' G(R) saved to: '+grfilename)
    925925   
    926926def PeakListSave(G2frame,file,peaks):
    927927    'Save powder peaks to a data file'
    928     print 'save peak list to file: ',G2frame.peaklistfile
     928    print ('save peak list to file: '+G2frame.peaklistfile)
    929929    if not peaks:
    930930        dlg = wx.MessageDialog(G2frame, 'No peaks!', 'Nothing to save!', wx.OK)
     
    937937        file.write("%10.4f %12.2f %10.3f %10.3f \n" % \
    938938            (peak[0],peak[2],peak[4],peak[6]))
    939     print 'peak list saved'
     939    print ('peak list saved')
    940940             
    941941def IndexPeakListSave(G2frame,peaks):
    942942    'Save powder peaks from the indexing list'
    943943    file = open(G2frame.peaklistfile,'wa')
    944     print 'save index peak list to file: ',G2frame.peaklistfile
     944    print ('save index peak list to file: '+G2frame.peaklistfile)
    945945    wx.BeginBusyCursor()
    946946    try:
     
    957957    finally:
    958958        wx.EndBusyCursor()
    959     print 'index peak list saved'
     959    print ('index peak list saved')
    960960   
    961961class MultipleChoicesDialog(wx.Dialog):
     
    13161316            *or* a complete file name is requested when a single file
    13171317            name is selected. self.dirname is always set and self.filename used
    1318             only when a single file is selected.
     1318            only when a single file is selected. 
    13191319          * if AskFile is 'default', creates a name of the file to be used from
    13201320            the name of the project (.gpx) file. If the project has not been saved,
     
    15181518        elif varyList is None:
    15191519            # old GPX file from before pre-constraint varyList is saved
    1520             print ' *** Old refinement: Please use Calculate/Refine to redo  ***'
     1520            print (' *** Old refinement: Please use Calculate/Refine to redo  ***')
    15211521            raise Exception(' *** Export aborted ***')
    15221522        else:
     
    15271527        except:
    15281528            # this really should not happen
    1529             print ' *** ERROR - constraints are internally inconsistent ***'
     1529            print (' *** ERROR - constraints are internally inconsistent ***')
    15301530            errmsg, warnmsg = G2mv.CheckConstraints(varyList,constDict,fixedList)
    1531             print 'Errors',errmsg
    1532             if warnmsg: print 'Warnings',warnmsg
     1531            print ('Errors'+errmsg)
     1532            if warnmsg: print ('Warnings'+warnmsg)
    15331533            raise Exception(' *** CIF creation aborted ***')
    15341534        # add the constrained values to the parameter dictionary
     
    15621562            sub = G2gd.GetGPXtreeItemId(self.G2frame,self.G2frame.root,'Phases')
    15631563            if not sub:
    1564                 print 'no phases found'
     1564                print ('no phases found')
    15651565                return True
    15661566            item, cookie = self.G2frame.GPXtree.GetFirstChild(sub)
     
    16401640        if self.SeqRefdata and self.SeqRefhist:
    16411641            print('Note that dumpTree does not show sequential results')
    1642         print '\nOverall'
     1642        print ('\nOverall')
    16431643        if mode == 'type':
    16441644            def Show(arg): return type(arg)
     
    16461646            def Show(arg): return arg
    16471647        for key in self.OverallParms:
    1648             print '  ',key,Show(self.OverallParms[key])
    1649         print 'Phases'
     1648            print ('  '+key+Show(self.OverallParms[key]))
     1649        print ('Phases')
    16501650        for key1 in self.Phases:
    1651             print '    ',key1,Show(self.Phases[key1])
    1652         print 'Histogram'
     1651            print ('    '+key1+Show(self.Phases[key1]))
     1652        print ('Histogram')
    16531653        for key1 in self.Histograms:
    1654             print '    ',key1,Show(self.Histograms[key1])
     1654            print ('    '+key1+Show(self.Histograms[key1]))
    16551655            for key2 in self.Histograms[key1]:
    1656                 print '      ',key2,Show(self.Histograms[key1][key2])
     1656                print ('      '+key2+Show(self.Histograms[key1][key2]))
    16571657
    16581658    def defaultSaveFile(self):
     
    19281928                obj.Writer(TreeName,filename)
    19291929                return
    1930             except Exception,err:
     1930            except Exception:
    19311931                print('Export Routine for '+extension+' failed.')
    1932                 print err
    19331932    else:
    19341933        print('No Export routine supports extension '+extension)
     
    19611960            return
    19621961    if exporttype == 'Phase':
    1963         phaselist = obj.Phases.keys()
     1962        phaselist = list(obj.Phases.keys())
    19641963        if len(obj.Phases) == 0:
    19651964            G2G.G2MessageBox(G2frame,'There are no phases in sequential ref.','Warning')
     
    20122011
    20132012def ReadDIFFaX(DIFFaXfile):
    2014     print 'read ',DIFFaXfile
     2013    print ('read '+DIFFaXfile)
    20152014    Layer = {'Laue':'-1','Cell':[False,1.,1.,1.,90.,90.,90,1.],'Width':[[10.,10.],[False,False]],
    20162015        'Layers':[],'Stacking':[],'Transitions':[],'Toler':0.01,'AtInfo':{}}
  • trunk/GSASIIconstrGUI.py

    r3079 r3136  
    1515
    1616'''
     17from __future__ import division, print_function
    1718import sys
    1819import wx
     
    158159                    j += 1
    159160        if j:
    160             print str(key) + ': '+str(j)+' variable(s) as strings converted to objects'
     161            print (str(key) + ': '+str(j)+' variable(s) as strings converted to objects')
    161162    ##################################################################################
    162163    rigidbodyDict = G2frame.GPXtree.GetItemPyData(
     
    165166    rbVary,rbDict = G2stIO.GetRigidBodyModels(rigidbodyDict,Print=False)
    166167    badPhaseParms = ['Ax','Ay','Az','Amul','AI/A','Atype','SHorder','mV0','mV1','mV2','waveType','Vol','isMag',]
    167     globalList = rbDict.keys()
     168    globalList = list(rbDict.keys())
    168169    globalList.sort()
    169170    try:
     
    385386            pass
    386387        else:
    387             raise Exception, 'Unknown constraint page '+ page[1]                   
     388            raise Exception('Unknown constraint page '+ page[1])                   
    388389        if len(choices):
    389390            l1 = l2 = 1
     
    487488                return [constr+[1.0,None,'c']]
    488489            else:
    489                 raise Exception,'Unknown constraint type: '+str(constType)
     490                raise Exception('Unknown constraint type: '+str(constType))
    490491        else:
    491492            dlg = wx.MessageDialog(
     
    537538            errmsg,warnmsg = CheckConstraints(allcons1)
    538539            if errmsg:
    539                 print errmsg
    540                 print G2mv.VarRemapShow([],True)
     540                print (errmsg)
     541                print (G2mv.VarRemapShow([],True))
    541542            return False
    542543        elif warnmsg:
    543             print 'Unexpected contraint warning:\n',warnmsg
     544            print ('Unexpected contraint warning:\n'+warnmsg)
    544545        return True
    545546
     
    566567            errmsg,warnmsg = CheckConstraints(allcons1)
    567568            if errmsg:
    568                 print errmsg
    569                 print G2mv.VarRemapShow([],True)
     569                print (errmsg)
     570                print (G2mv.VarRemapShow([],True))
    570571            return False
    571572        elif warnmsg:
    572             print 'Unexpected contraint warning:\n',warnmsg
     573            print ('Unexpected contraint warning:\n'+warnmsg)
    573574        return True
    574575             
     
    594595            return None,None,None
    595596        else:
    596             raise Exception,'Should not happen!'
     597            raise Exception('Should not happen!')
    597598        return vartype,varList,constrDictEnt
    598599
     
    771772            if atName in Atoms:
    772773                Atoms[atName].append(item)
    773         AtNames = Atoms.keys()
     774        AtNames = list(Atoms.keys())
    774775        AtNames.sort()
    775776        dlg = G2G.G2SingleChoiceDialog(G2frame,'Select 1st atom:',
     
    788789        dlg.Destroy()
    789790        if FrstAtom == '':
    790             print 'no atom selected'
     791            print ('no atom selected')
    791792            return
    792793        dlg = G2G.G2MultiChoiceDialog(
     
    797798            Selections = dlg.GetSelections()[:]
    798799        else:
    799             print 'no target atom selected'
     800            print ('no target atom selected')
    800801            dlg.Destroy()
    801802            return
     
    949950                    typeString = 'EQUIV'
    950951                else:
    951                     print 'Unexpected constraint',item
     952                    print ('Unexpected constraint'+item)
    952953               
    953954            else:
    954                 print 'Removing old-style constraints'
     955                print ('Removing old-style constraints')
    955956                data[name] = []
    956957                return constSizer
     
    10461047        except:
    10471048            import traceback
    1048             print traceback.format_exc()
     1049            print (traceback.format_exc())
    10491050        finally:
    10501051            dlg.Destroy()
     
    10921093            if 'DELETED' in str(PhaseConstr):   #seems to be no other way to do this (wx bug)
    10931094                if GSASIIpath.GetConfigValue('debug'):
    1094                     print 'wx error: PhaseConstr not cleanly deleted after Refine'
     1095                    print ('wx error: PhaseConstr not cleanly deleted after Refine')
    10951096                return
    10961097            UpdateConstraintPanel(PhaseConstr,'Phase')
     
    11671168                            'Error in constraints:\n'+errmsg+'\nCheck console output for more information',
    11681169                            parent=G2frame)
    1169         print errmsg
    1170         print G2mv.VarRemapShow([],True)
     1170        print (errmsg)
     1171        print (G2mv.VarRemapShow([],True))
    11711172    elif warnmsg:
    1172         print 'Unexpected contraint warning:\n',warnmsg
     1173        print ('Unexpected contraint warning:\n'+warnmsg)
    11731174
    11741175################################################################################
     
    13521353        dlg = wx.FileDialog(G2frame,message='Choose '+macName+' rigid body macro file',
    13531354            defaultDir=defDir,defaultFile="",wildcard="GSAS-II macro file (*.mac)|*.mac",
    1354             style=wx.OPEN | wx.CHANGE_DIR)
     1355            style=wx.FD_OPEN | wx.CHANGE_DIR)
    13551356        try:
    13561357            if dlg.ShowModal() == wx.ID_OK:
     
    13591360                head = macro.readline()
    13601361                if macName not in head:
    1361                     print head
    1362                     print '**** ERROR - wrong restraint macro file selected, try again ****'
     1362                    print (head)
     1363                    print ('**** ERROR - wrong restraint macro file selected, try again ****')
    13631364                    macro = []
    13641365            else: # cancel was pressed
     
    13721373            "GSAS-II text file (*.txt)|*.txt|XYZ file (*.xyz)|*.xyz|"
    13731374            "Sybyl mol2 file (*.mol2)|*.mol2|PDB file (*.pdb;*.ent)|*.pdb;*.ent",
    1374             wx.OPEN | wx.CHANGE_DIR)
     1375            wx.FD_OPEN | wx.CHANGE_DIR)
    13751376        try:
    13761377            if dlg.ShowModal() == wx.ID_OK:
     
    13991400        if dlg.ShowModal() == wx.ID_OK:
    14001401            nAtoms,nTrans = dlg.GetValues()
    1401             rbId = ran.randint(0,sys.maxint)
     1402            rbId = ran.randint(0,sys.maxsize)
    14021403            vecMag = [1.0 for i in range(nTrans)]
    14031404            vecRef = [False for i in range(nTrans)]
     
    14211422            items = macStr.split()
    14221423            if 'I' == items[0]:
    1423                 rbId = ran.randint(0,sys.maxint)
     1424                rbId = ran.randint(0,sys.maxsize)
    14241425                rbName = items[1]
    14251426                rbTypes = []
     
    14541455                    'SelSeq':[0,0],'useCount':0}
    14551456                data['RBIds']['Residue'].append(rbId)
    1456                 print 'Rigid body '+rbName+' added'
     1457                print ('Rigid body '+rbName+' added')
    14571458            macStr = macro.readline()
    14581459        macro.close()
     
    14641465        if not text:
    14651466            return
    1466         rbId = ran.randint(0,sys.maxint)
     1467        rbId = ran.randint(0,sys.maxsize)
    14671468        rbTypes = []
    14681469        rbXYZ = []
     
    15231524                'atNames':atNames,'rbRef':[0,1,2,False],'rbSeq':[],'SelSeq':[0,0],'useCount':0}
    15241525            data['RBIds']['Residue'].append(rbId)
    1525             print 'Rigid body UNKRB added'
     1526            print ('Rigid body UNKRB added')
    15261527        text.close()
    15271528        UpdateResidueRB()
     
    15651566                       
    15661567    def OnDefineTorsSeq(event):
    1567         rbKeys = data['Residue'].keys()
     1568        rbKeys = list(data['Residue'].keys())
    15681569        rbKeys.remove('AtInfo')
    15691570        rbNames = [data['Residue'][k]['RBname'] for k in rbKeys]
     
    15721573        rbId = 0
    15731574        if len(rbNames) == 0:
    1574             print 'There are no rigid bodies defined'
     1575            print ('There are no rigid bodies defined')
    15751576            G2frame.ErrorDialog('No rigid bodies','There are no rigid bodies defined',
    15761577                                parent=G2frame)
     
    16171618        if 'DELETED' in str(G2frame.GetStatusBar()):   #seems to be no other way to do this (wx bug)
    16181619            if GSASIIpath.GetConfigValue('debug'):
    1619                 print 'wx error: Rigid Body/Status not cleanly deleted after Refine'
     1620                print ('wx error: Rigid Body/Status not cleanly deleted after Refine')
    16201621            return
    16211622        SetStatusLine(' You may use e.g. "c60" or "s60" for a vector entry')
     
    17701771            vecGrid = G2G.GSGrid(VectorRBDisplay)
    17711772            vecGrid.SetTable(vecTable, True)
    1772             vecGrid.Bind(wg.EVT_GRID_CELL_CHANGE, ChangeCell)
     1773            if 'phoenix' in wx.version():
     1774                vecGrid.Bind(wg.EVT_GRID_CELL_CHANGED, ChangeCell)
     1775            else:
     1776                vecGrid.Bind(wg.EVT_GRID_CELL_CHANGE, ChangeCell)
    17731777            if not imag:
    17741778                vecGrid.Bind(wg.EVT_GRID_CELL_LEFT_DCLICK, TypeSelect)
     
    19681972            resList.append(vecGrid)
    19691973            vecGrid.SetTable(vecTable, True)
    1970             vecGrid.Bind(wg.EVT_GRID_CELL_CHANGE, ChangeCell)
     1974            if 'phoenix' in wx.version():
     1975                vecGrid.Bind(wg.EVT_GRID_CELL_CHANGED, ChangeCell)
     1976            else:
     1977                vecGrid.Bind(wg.EVT_GRID_CELL_CHANGE, ChangeCell)
    19711978            vecGrid.Bind(wg.EVT_GRID_CELL_LEFT_DCLICK, TypeSelect)
    19721979            vecGrid.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK, RowSelect)
  • trunk/GSASIIctrlGUI.py

    r3135 r3136  
    1515
    1616'''
     17from __future__ import division, print_function
    1718import os
    1819import sys
     
    4041    wx = Placeholder(vals)
    4142    wxscroll = Placeholder(['ScrolledPanel'])
    42     wg = Placeholder('Grid PyGridTableBase PyGridCellEditor'.split())
     43    if 'phoenix' in wx.version():
     44        wg = Placeholder('Grid GridTableBase GridCellEditor'.split())
     45    else:
     46        wg = Placeholder('Grid PyGridTableBase PyGridCellEditor'.split())
    4347import time
    4448import copy
     
    7276    for arg in args:
    7377        if GSASIIpath.GetConfigValue('debug') and not arg.startswith('wxID_'):
    74             print 'Problem in name',arg
     78            print ('Problem in name'+arg)
    7579        if arg in globals():
    76             if GSASIIpath.GetConfigValue('debug'): print arg,'already defined'
     80            if GSASIIpath.GetConfigValue('debug'): print (arg+'already defined')
    7781            continue
    7882        exec('global '+arg+';'+arg+' = wx.NewId()')
     
    116120            parent = self.GetItemParent(parent)
    117121        return textlist
     122   
     123    def GetItemPyData(self,id):
     124        if 'phoenix' in wx.version():
     125            return wx.TreeCtrl.GetItemData(self,id)
     126        else:
     127            return wx.TreeCtrl.GetItemPyData(self,id)
     128
     129    def SetItemPyData(self,id,data):
     130        if 'phoenix' in wx.version():
     131            return wx.TreeCtrl.SetItemData(self,id,data)
     132        else:
     133            return wx.TreeCtrl.SetItemPyData(self,id,data)
    118134
    119135    def onSelectionChanged(self,event):
     
    442458                self.Bind(wx.EVT_CHAR,self._GetStringValue)
    443459        elif val is None:
    444             raise Exception,("ValidatedTxtCtrl error: value of "+str(key)+
     460            raise Exception("ValidatedTxtCtrl error: value of "+str(key)+
    445461                             " element is None and typeHint not defined as int or float")
    446462        else:
    447             raise Exception,("ValidatedTxtCtrl error: Unknown element ("+str(key)+
     463            raise Exception("ValidatedTxtCtrl error: Unknown element ("+str(key)+
    448464                             ") type: "+str(type(val)))
    449465        # When the mouse is moved away or the widget loses focus,
     
    540556            self.SetInsertionPoint(ins) # put insertion point back
    541557        else: # valid input
    542             self.SetBackgroundColour(
    543                 wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
     558            self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))
    544559            self.SetForegroundColour("black")
    545560            self.Refresh()
     
    666681        result=None, key=None, OKcontrol=None, CIFinput=False):
    667682        'Create the validator'
    668         wx.PyValidator.__init__(self)
     683        if 'phoenix' in wx.version():
     684            wx.Validator.__init__(self)
     685        else:
     686            wx.PyValidator.__init__(self)
    669687        # save passed parameters
    670688        self.typ = typ
     
    769787            return False
    770788        else: # valid input
    771             tc.SetBackgroundColour(
    772                 wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
     789            tc.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))
    773790            tc.SetForegroundColour("black")
    774791            tc.Refresh()
     
    11941211                 checkdictlst=[], checkelemlst=[], checklabel=""):
    11951212        if len(dictlst) != len(elemlst):
    1196             raise Exception,"ScrolledMultiEditor error: len(dictlst) != len(elemlst) "+str(len(dictlst))+" != "+str(len(elemlst))
     1213            raise Exception("ScrolledMultiEditor error: len(dictlst) != len(elemlst) "+str(len(dictlst))+" != "+str(len(elemlst)))
    11971214        if len(checkdictlst) != len(checkelemlst):
    1198             raise Exception,"ScrolledMultiEditor error: len(checkdictlst) != len(checkelemlst) "+str(len(checkdictlst))+" != "+str(len(checkelemlst))
     1215            raise Exception("ScrolledMultiEditor error: len(checkdictlst) != len(checkelemlst) "+str(len(checkdictlst))+" != "+str(len(checkelemlst)))
    11991216        wx.Dialog.__init__( # create dialog & sizer
    12001217            self,parent,wx.ID_ANY,title,
     
    16101627    def OnChoice(event):
    16111628        'Respond when a parameter is selected in the Choice box'
    1612         valSizer.DeleteWindows()
     1629        if 'phoenix' in wx.version():
     1630            valSizer.Clear(True)
     1631        else:
     1632            valSizer.DeleteWindows()
    16131633        lbl = event.GetString()
    16141634        copyopts['currentsel'] = lbl
     
    17171737        instData = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,Id,'Instrument Parameters'))[0]
    17181738        if len(hstData) != len(instData) or hstData['Type'][0] != instData['Type'][0]:  #don't mix data types or lam & lam1/lam2 parms!
    1719             print h+' not copied - instrument parameters not commensurate'
     1739            print (h+' not copied - instrument parameters not commensurate')
    17201740            continue
    17211741        hData = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,Id,TreeItemType))
     
    27592779       
    27602780################################################################################
    2761 def GetImportFile(G2frame, message, defaultDir="", defaultFile="", style=wx.OPEN,
     2781def GetImportFile(G2frame, message, defaultDir="", defaultFile="", style=wx.FD_OPEN,
    27622782                  *args, **kwargs):
    27632783    '''Uses a customized dialog that gets files from the appropriate import directory.
    27642784    Arguments are used the same as in :func:`wx.FileDialog`. Selection of
    2765     multiple files is allowed if argument style includes wx.MULTIPLE.
     2785    multiple files is allowed if argument style includes wx.FD_MULTIPLE.
    27662786
    27672787    The default initial directory (unless overridden with argument defaultDir)
     
    27802800    try:
    27812801        if dlg.ShowModal() == wx.ID_OK:
    2782             if style & wx.MULTIPLE:
     2802            if style & wx.FD_MULTIPLE:
    27832803                filelist = dlg.GetPaths()
    27842804                if len(filelist) == 0: return []
     
    27862806                filelist = [dlg.GetPath(),]
    27872807            # not sure if we want to do this (why use wx.CHANGE_DIR?)
    2788             if style & wx.CHANGE_DIR: # to get Mac/Linux to change directory like windows!
     2808            if style & wx.FD_CHANGE_DIR: # to get Mac/Linux to change directory like windows!
    27892809                os.chdir(dlg.GetDirectory())
    27902810        else: # cancel was pressed
     
    30213041        self.fullVaryList = fullVaryList
    30223042
    3023         self.parmNames = parmDict.keys()
     3043        self.parmNames = list(parmDict.keys())
    30243044        self.parmNames.sort()
    30253045        splitNames = [item.split(':') for item in self.parmNames if len(item) > 3 and not isinstance(self.parmDict[item],basestring)]
     
    32763296    '''
    32773297    def __init__(self, data=[], rowLabels=None, colLabels=None, types = None):
    3278         wg.PyGridTableBase.__init__(self)
     3298        if 'phoenix' in wx.version():
     3299            wg.GridTableBase.__init__(self)
     3300        else:
     3301            wg.PyGridTableBase.__init__(self)
    32793302        self.colLabels = colLabels
    32803303        self.rowLabels = rowLabels
     
    33043327        new = []
    33053328        for irow,row in enumerate(data):
    3306             if irow <> pos:
     3329            if irow != pos:
    33073330                new.append(row)
    33083331        self.SetData(new)
     
    34153438    '''
    34163439    def __init__(self,grid):
    3417         wg.PyGridCellEditor.__init__(self)
     3440        if 'phoenix' in wx.version():
     3441            wg.GridCellEditor.__init__(self)
     3442        else:
     3443            wg.PyGridCellEditor.__init__(self)
    34183444
    34193445    def Create(self, parent, id, evtHandler):
     
    35883614        self.HelpById = {}
    35893615        self.frame = frame
    3590         self.Append(help='', id=wx.ID_ABOUT, kind=wx.ITEM_NORMAL,
    3591             text='&About GSAS-II')
     3616        self.Append(wx.ID_ABOUT,'&About GSAS-II','')
    35923617        frame.Bind(wx.EVT_MENU, self.OnHelpAbout, id=wx.ID_ABOUT)
    35933618        if GSASIIpath.whichsvn():
    3594             helpobj = self.Append(
    3595                 help='', id=wx.ID_ANY, kind=wx.ITEM_NORMAL,
    3596                 text='&Check for updates')
     3619            helpobj = self.Append(wx.ID_ANY,'&Check for updates','')
    35973620            frame.Bind(wx.EVT_MENU, self.OnCheckUpdates, helpobj)
    3598             helpobj = self.Append(
    3599                 help='', id=wx.ID_ANY, kind=wx.ITEM_NORMAL,
    3600                 text='&Regress to an old GSAS-II version')
     3621            helpobj = self.Append(wx.ID_ANY,'&Regress to an old GSAS-II version','')
    36013622            frame.Bind(wx.EVT_MENU, self.OnSelectVersion, helpobj)
    36023623            # if GSASIIpath.svnTestBranch():
     
    36093630        # provide special help topic names for extra items in help menu
    36103631        for lbl,indx in morehelpitems:
    3611             helpobj = self.Append(text=lbl,
    3612                 id=wx.ID_ANY, kind=wx.ITEM_NORMAL)
     3632            helpobj = self.Append(wx.ID_ANY,lbl,'')
    36133633            frame.Bind(wx.EVT_MENU, self.OnHelpById, helpobj)
    36143634            self.HelpById[helpobj.GetId()] = indx
     
    36163636        self.AppendSeparator()
    36173637        if includeTree:
    3618             helpobj = self.Append(text='Help on Data tree',
    3619                                   id=wx.ID_ANY, kind=wx.ITEM_NORMAL)
     3638            helpobj = self.Append(wx.ID_ANY,'Help on Data tree','')
    36203639            frame.Bind(wx.EVT_MENU, self.OnHelpById, id=helpobj.GetId())
    36213640            self.HelpById[helpobj.GetId()] = 'Data tree'
    3622         helpobj = self.Append(text='Help on current data tree item',id=wx.ID_ANY, kind=wx.ITEM_NORMAL)
     3641        helpobj = self.Append(wx.ID_ANY,'Help on current data tree item','')
    36233642        frame.Bind(wx.EVT_MENU, self.OnHelpById, id=helpobj.GetId())
    36243643       
     
    36363655        else:
    36373656            print('help error: not called from standard menu?')
    3638             print self
     3657            print (self)
    36393658            return           
    36403659        try:
     
    37063725            dlg.Destroy()
    37073726            return
    3708         print 'Installed GSAS-II version: '+local
     3727        print ('Installed GSAS-II version: '+local)
    37093728        repos = GSASIIpath.svnGetRev(local=False)
    37103729        wx.EndBusyCursor()
     
    37233742            dlg.Destroy()
    37243743            return
    3725         print 'GSAS-II version on server: '+repos
     3744        print ('GSAS-II version on server: '+repos)
    37263745        if local == repos:
    37273746            dlg = wx.MessageDialog(self.frame,
     
    37633782                return
    37643783            dlg.Destroy()
    3765         print 'start updates'
     3784        print ('start updates')
    37663785        dlg = wx.MessageDialog(self.frame,
    37673786                               'Your project will now be saved, GSAS-II will exit and an update '
     
    42304249            self.OnChange(event)
    42314250
    4232         self.varsizer.DeleteWindows()
     4251        if 'phoenix' in wx.version():
     4252            self.varsizer.Clear(True)
     4253        else:
     4254            self.varsizer.DeleteWindows()
    42334255        var = self.choice[0]
    42344256        showdef = True
    42354257        if var not in self.vars:
    4236             raise Exception,"How did this happen?"
     4258            raise Exception("How did this happen?")
    42374259        if type(self.vars[var][0]) is int:
    42384260            ed = ValidatedTxtCtrl(self,self.vars[var],1,typeHint=int,OKcontrol=self.OnChange)
     
    49274949    if dlg.ShowModal() == wx.ID_OK:
    49284950        for sel in dlg.GetSelections():
    4929             print sel,choices[sel]
    4930     print od
     4951            print (sel,choices[sel])
     4952    print (od)
    49314953    od = {}
    49324954    dlg = G2MultiChoiceDialog(frm, 'Sequential refinement',
  • trunk/GSASIIdataGUI.py

    r3122 r3136  
    1616data editing panel.
    1717'''
     18from __future__ import division, print_function
     19import platform
    1820import time
    1921import math
     
    2527import imp
    2628import inspect
     29if '2' in platform.python_version_tuple()[0]:
     30    import cPickle
     31else:
     32    import _pickle as cPickle
    2733import numpy as np
    2834import numpy.ma as ma
     
    281287        def install_with_easyinstall(package):
    282288            try:
    283                 print "trying a system-wide PyOpenGl install"
     289                print ("trying a system-wide PyOpenGl install")
    284290                easy_install.main(['-f',os.path.split(__file__)[0],package])
    285291                return
     
    287293                pass
    288294            try:
    289                 print "trying a user level PyOpenGl install"
     295                print ("trying a user level PyOpenGl install")
    290296                easy_install.main(['-f',os.path.split(__file__)[0],'--user',package])
    291297                return
    292298            except:
    293                 print u"Install of '+package+u' failed. Please report this information:"
     299                print (u"Install of '+package+u' failed. Please report this information:")
    294300                import traceback
    295                 print traceback.format_exc()
     301                print (traceback.format_exc())
    296302                sys.exit()
    297303        from setuptools.command import easy_install
     
    318324    import OpenGL as ogl
    319325    import GSASIIpath
    320     # print versions
    321     print "Python module versions loaded:"
    322     print "  Python:     ",sys.version.split()[0]
    323     print "  wx:         ",wx.__version__
    324     print "  matplotlib: ",mpl.__version__
    325     print "  numpy:      ",np.__version__
    326     print "  scipy:      ",sp.__version__
    327     print "  OpenGL:     ",ogl.__version__
     326    # print (versions)
     327    print ("Python module versions loaded:")
     328    print ("  Python:     %s"%sys.version.split()[0])
     329    print ("  wx:         %s"%wx.__version__)
     330    print ("  matplotlib: %s"%mpl.__version__)
     331    print ("  numpy:      %s"%np.__version__)
     332    print ("  scipy:      %s"%sp.__version__)
     333    print ("  OpenGL:     %s"%ogl.__version__)
    328334    # TODO: not sure this prints the right message with pillow
    329335    try:
     
    334340        except:
    335341            version = Image.VERSION
    336         print "  PIL.Image:  ",version
     342        print ("  PIL.Image:  %s"%version)
    337343    except ImportError:
    338344        try:
    339345            import Image
    340             print "Image (PIL):",Image.VERSION
     346            print ("Image (PIL):%s"%Image.VERSION)
    341347        except ImportError:
    342             print "Image module not present; Note that PIL (Python Imaging Library) or pillow is needed for some image operations"
    343     import platform
    344     print "  Platform:   ",sys.platform,platform.architecture()[0],platform.machine()
     348            print ("Image module not present; Note that PIL (Python Imaging Library) or pillow is needed for some image operations")
     349    print ("  Platform:   %s%s%s"%(sys.platform,platform.architecture()[0],platform.machine()))
    345350    try:
    346351        import mkl
    347         print "  Max threads:",mkl.get_max_threads()
     352        print ("  Max threads:%s"%mkl.get_max_threads())
    348353    except:
    349354        pass
    350     #print "wxPython description",wx.PlatformInfo
    351     print "This is GSAS-II revision "+str(GSASIIpath.GetVersionNumber())+'\n'
     355    print ("This is GSAS-II revision %s"%str(GSASIIpath.GetVersionNumber())+'\n')
    352356   
    353357###############################################################################
     
    385389    def OnInit(self):
    386390        '''Called automatically when the app is created.'''
    387         import platform
    388         if '2.7' not in sys.version[:5]:
     391        knownVersions = ['2.7','3.6']
     392        if platform.python_version()[:3] not in knownVersions:
    389393            dlg = wx.MessageDialog(None,
    390                 'GSAS-II requires Python 2.7.x\n Yours is '+sys.version.split()[0],
     394                'GSAS-II requires Python 2.7.x or 3.6.x\n Yours is '+sys.version.split()[0],
    391395                'Python version error',  wx.OK)
    392396            try:
     
    424428        log.InvokeMenuCommand(event.GetId(),self,event)
    425429           
    426     def Bind(self,eventtype,handler,*args,**kwargs):
    427         '''Override the Bind function so that we can wrap calls that will be logged.
    428        
    429         N.B. This is a bit kludgy. Menu bindings with an id are wrapped and
    430         menu bindings with an object and no id are not.
    431         '''
    432         if eventtype == wx.EVT_MENU and 'id' in kwargs:
    433             menulabels = log.SaveMenuCommand(kwargs['id'],self,handler)
    434             if menulabels:
    435                 wx.Frame.Bind(self,eventtype,self.MenuBinding,*args,**kwargs)
    436                 return
    437         wx.Frame.Bind(self,eventtype,handler,*args,**kwargs)     
     430#    def Bind(self,eventtype,handler,*args,**kwargs):
     431#        '''Override the Bind function so that we can wrap calls that will be logged.
     432#       
     433#        N.B. This is a bit kludgy. Menu bindings with an id are wrapped and
     434#        menu bindings with an object and no id are not.
     435#        '''
     436#        if eventtype == wx.EVT_MENU and 'id' in kwargs:
     437#            menulabels = log.SaveMenuCommand(kwargs['id'],self,handler)
     438#            if menulabels:
     439#                wx.Frame.Bind(self,eventtype,self.MenuBinding,*args,**kwargs)
     440#                return
     441#        wx.Frame.Bind(self,eventtype,handler,*args,**kwargs)     
    438442   
    439443    def _Add_FileMenuItems(self, parent):
    440         item = parent.Append(
    441             help='Open a GSAS-II project file (*.gpx)', id=wx.ID_ANY,
    442             kind=wx.ITEM_NORMAL,text='&Open project...')
     444        item = parent.Append(wx.ID_ANY,'&Open project...','Open a GSAS-II project file (*.gpx)')           
    443445        self.Bind(wx.EVT_MENU, self.OnFileOpen, id=item.GetId())
    444         item = parent.Append(
    445             help='Save project under current name', id=wx.ID_ANY,
    446             kind=wx.ITEM_NORMAL,text='&Save project')
     446        item = parent.Append(wx.ID_ANY,'&Save project','Save project under current name')
    447447        self.Bind(wx.EVT_MENU, self.OnFileSave, id=item.GetId())
    448         item = parent.Append(
    449             help='Save current project to new file', id=wx.ID_ANY,
    450             kind=wx.ITEM_NORMAL,text='Save project as...')
     448        item = parent.Append(wx.ID_ANY,'Save project as...','Save current project to new file')
    451449        self.Bind(wx.EVT_MENU, self.OnFileSaveas, id=item.GetId())
    452         item = parent.Append(
    453             help='Create empty new project, saving current is optional', id=wx.ID_ANY,
    454             kind=wx.ITEM_NORMAL,text='&New project')
     450        item = parent.Append(wx.ID_ANY,'&New project','Create empty new project, saving current is optional')
    455451        self.Bind(wx.EVT_MENU, self.OnFileClose, id=item.GetId())
    456         item = parent.Append(wx.ID_PREFERENCES, text = "&Preferences")
     452        item = parent.Append(wx.ID_PREFERENCES,"&Preferences",'')
    457453        self.Bind(wx.EVT_MENU, self.OnPreferences, item)
    458454        if GSASIIpath.whichsvn():
    459             item = parent.Append(
    460                 help='Edit proxy internet information (used for updates)', id=wx.ID_ANY,
    461                 kind=wx.ITEM_NORMAL,text='Edit proxy...')
     455            item = parent.Append(wx.ID_ANY,'Edit proxy...','Edit proxy internet information (used for updates)')
    462456            self.Bind(wx.EVT_MENU, self.EditProxyInfo, id=item.GetId())
    463457        if GSASIIpath.GetConfigValue('debug'):
    464458            def OnIPython(event):
    465459                GSASIIpath.IPyBreak()
    466             item = parent.Append(wx.ID_ANY, text = "IPython Console")
     460            item = parent.Append(wx.ID_ANY,"IPython Console",'')
    467461            self.Bind(wx.EVT_MENU, OnIPython, item)
    468462            def OnwxInspect(event):
    469463                import wx.lib.inspection as wxeye
    470464                wxeye.InspectionTool().Show()
    471             item = parent.Append(wx.ID_ANY, text = "wx inspection tool")
     465            item = parent.Append(wx.ID_ANY,"wx inspection tool",'')
    472466            self.Bind(wx.EVT_MENU, OnwxInspect, item)
    473467           
    474         item = parent.Append(
    475             help='Exit from GSAS-II', id=wx.ID_ANY,
    476             kind=wx.ITEM_NORMAL,text='&Exit')
     468        item = parent.Append(wx.ID_ANY,'&Exit','Exit from GSAS-II')
    477469        self.Bind(wx.EVT_MENU, self.ExitMain, id=item.GetId())
    478470       
     
    483475        #     text='Read image data...')
    484476        # self.Bind(wx.EVT_MENU, self.OnImageRead, id=item.GetId())
    485         item = parent.Append(
    486             help='',id=wx.ID_ANY,
    487             kind=wx.ITEM_NORMAL,
    488             text='Read Powder Pattern Peaks...')
     477        item = parent.Append(wx.ID_ANY,'Read Powder Pattern Peaks...','')
    489478        self.Bind(wx.EVT_MENU, self.OnReadPowderPeaks, id=item.GetId())
    490         item = parent.Append(
    491             help='',id=wx.ID_ANY,
    492             kind=wx.ITEM_NORMAL,
    493             text='Sum powder data')
     479        item = parent.Append(wx.ID_ANY,'Sum powder data','')
    494480        self.Bind(wx.EVT_MENU, self.OnPwdrSum, id=item.GetId())
    495         item = parent.Append(
    496             help='',id=wx.ID_ANY,
    497             kind=wx.ITEM_NORMAL,
    498             text='Sum image data')
     481        item = parent.Append(wx.ID_ANY,'Sum image data','')
    499482        self.Bind(wx.EVT_MENU, self.OnImageSum, id=item.GetId())
    500         item = parent.Append(
    501             help='',id=wx.ID_ANY,
    502             kind=wx.ITEM_NORMAL,
    503             text='Add new phase')
     483        item = parent.Append(wx.ID_ANY,'Add new phase','')
    504484        self.Bind(wx.EVT_MENU, self.OnAddPhase, id=item.GetId())
    505         item = parent.Append(
    506             help='',id=wx.ID_ANY,
    507             kind=wx.ITEM_NORMAL,
    508             text='Delete phase')
     485        item = parent.Append(wx.ID_ANY,'Delete phase','')
    509486        self.Bind(wx.EVT_MENU, self.OnDeletePhase, id=item.GetId())
    510         item = parent.Append(
    511             help='Rename the selected data tree item (PWDR, HKLF or IMG)',id=wx.ID_ANY,
    512             kind=wx.ITEM_NORMAL,
    513             text='Rename tree item')
     487        item = parent.Append(wx.ID_ANY,'Rename tree item','Rename the selected data tree item (PWDR, HKLF or IMG)')
    514488        self.Bind(wx.EVT_MENU, self.OnRenameData, id=item.GetId())
    515         item = parent.Append(
    516             help='Delete selected data items from data tree',id=wx.ID_ANY,
    517             kind=wx.ITEM_NORMAL,
    518             text='Delete tree items')
     489        item = parent.Append(wx.ID_ANY,'Delete tree items','Delete selected data items from data tree')
    519490        self.Bind(wx.EVT_MENU, self.OnDataDelete, id=item.GetId())
    520491        expandmenu = wx.Menu()
    521         item = parent.AppendMenu(
    522             wx.ID_ANY, 'Expand tree items', expandmenu,
    523             help='Expand items of type in GSAS-II data tree')
     492        item = parent.AppendSubMenu(expandmenu,'Expand tree items', 
     493            'Expand items of type in GSAS-II data tree')
    524494        for s in 'all','IMG','PWDR','PDF','HKLF','SASD','REFD':
    525495            if s == 'all':
     
    527497            else:
    528498                help = 'Expand '+s+' type items in GSAS-II data tree'
    529             item = expandmenu.Append(wx.ID_ANY,kind=wx.ITEM_NORMAL,text=s,help=help)
     499            item = expandmenu.Append(wx.ID_ANY,s,help)
    530500            self.Bind(wx.EVT_MENU,self.ExpandAll,id=item.GetId())
    531501        movemenu = wx.Menu()
    532         item = parent.AppendMenu(
    533             wx.ID_ANY, 'Move tree items', movemenu,
    534             help='Move items of type items to end of GSAS-II data tree')
     502        item = parent.AppendSubMenu(movemenu,'Move tree items', 
     503            'Move items of type items to end of GSAS-II data tree')
    535504        for s in 'IMG','PWDR','PDF','HKLF','SASD','REFD','Phase':
    536505            help = 'Move '+s+' type items to end of GSAS-II data tree'
    537             item = movemenu.Append(wx.ID_ANY,kind=wx.ITEM_NORMAL,text=s,help=help)
     506            item = movemenu.Append(wx.ID_ANY,s,help)
    538507            self.Bind(wx.EVT_MENU,self.MoveTreeItems,id=item.GetId())
    539508
    540509    def _Add_CalculateMenuItems(self,parent):
    541         item = parent.Append(help='Create PDF tree entries for selected powder patterns',
    542             id=wx.ID_ANY, kind=wx.ITEM_NORMAL,text='Setup PDFs')
     510        item = parent.Append(wx.ID_ANY,'Setup PDFs','Create PDF tree entries for selected powder patterns')
    543511        self.MakePDF.append(item)
    544512        self.Bind(wx.EVT_MENU, self.OnMakePDFs, id=item.GetId())
    545513       
    546         item = parent.Append(help='View least squares parameters',
    547             id=wx.ID_ANY, kind=wx.ITEM_NORMAL,text='&View LS parms')
     514        item = parent.Append(wx.ID_ANY,'&View LS parms','View least squares parameters')
    548515        self.Bind(wx.EVT_MENU, self.OnShowLSParms, id=item.GetId())
    549516       
    550         item = parent.Append(help='', id=wx.ID_ANY, kind=wx.ITEM_NORMAL,
    551             text='&Refine')
     517        item = parent.Append(wx.ID_ANY,'&Refine','')
    552518        if len(self.Refine): # extend state for new menus to match main (on mac)
    553519            state = self.Refine[0].IsEnabled()
     
    558524        self.Bind(wx.EVT_MENU, self.OnRefine, id=item.GetId())
    559525       
    560         item = parent.Append(help='', id=wx.ID_ANY, kind=wx.ITEM_NORMAL,
    561             text='Sequential refine')
     526        item = parent.Append(wx.ID_ANY,'Sequential refine','')
    562527        self.Bind(wx.EVT_MENU, self.OnSeqRefine, id=item.GetId())
    563528        if len(self.SeqRefine): # extend state for new menus to match main (on mac)
     
    596561            for i in self.SeqRefine: i.Enable(False)
    597562
    598     def PreviewFile(self,filename,fp):
     563    def PreviewFile(self,filename):
    599564        'confirm we have the right file'
     565        fp = open(filename,'r')
    600566        rdmsg = u'File '+ filename +u' begins:\n\n'
    601567        try:
     
    712678        # get the file(s)
    713679        if multiple:
    714             mode = wx.OPEN|wx.MULTIPLE
     680            mode = wx.FD_OPEN|wx.FD_MULTIPLE
    715681        else:
    716             mode = wx.OPEN
     682            mode = wx.FD_OPEN
    717683        filelist = G2G.GetImportFile(self,message="Choose "+label+" input file",
    718684                    defaultFile="",wildcard=choices,style=mode)
     
    758724            fp = None
    759725            msg = ''
    760             fp = open(filename,'Ur')
    761726            if len(filelist) == 1 and Preview:
    762                 if self.PreviewFile(filename,fp): return []
     727                if self.PreviewFile(filename): return []
    763728            self.lastimport = filename # this is probably not what I want to do -- it saves only the
    764729            # last name in a series. See rd.readfilename for a better name.
     
    772737                    rd.dnames = []
    773738                rd.ReInitialize() # purge anything from a previous read
    774                 fp.seek(0)  # rewind
    775739                rd.errors = "" # clear out any old errors
    776                 if not rd.ContentsValidator(fp): # rejected on cursory check
     740                if not rd.ContentsValidator(filename): # rejected on cursory check
    777741                    errorReport += "\n  "+rd.formatName + ' validator error'
    778742                    if rd.errors:
     
    788752                rdbuffer = {} # create temporary storage for file reader
    789753                block = 0
    790                 fp.seek(0)  # rewind
    791754                while repeat: # loop if the reader asks for another pass on the file
    792755                    block += 1
     
    795758                    flag = False
    796759                    if GSASIIpath.GetConfigValue('debug'): # allow exceptions for debugging
    797                         flag = rd.Reader(filename,fp,self,buffer=rdbuffer,blocknum=block,
     760                        flag = rd.Reader(filename,self,buffer=rdbuffer,blocknum=block,
    798761                            usedRanIdList=usedRanIdList,)
    799762                    else:
    800763                        try:
    801                             flag = rd.Reader(filename,fp,self,buffer=rdbuffer,
     764                            flag = rd.Reader(filename,self,buffer=rdbuffer,
    802765                                blocknum=block,usedRanIdList=usedRanIdList,)
    803766                        except rd.ImportException as detail:
     
    859822        '''
    860823        submenu = wx.Menu()
    861         item = parent.AppendMenu(wx.ID_ANY, 'Phase',
    862             submenu, help='Import phase data')
     824        item = parent.AppendSubMenu(submenu,'Phase','Import phase data')
    863825        for reader in self.ImportPhaseReaderlist:
    864             item = submenu.Append(wx.ID_ANY,help=reader.longFormatName,
    865                 kind=wx.ITEM_NORMAL,text=u'from '+reader.formatName+u' file')
     826            item = submenu.Append(wx.ID_ANY,u'from '+reader.formatName+u' file',reader.longFormatName)
    866827            self.ImportMenuId[item.GetId()] = reader
    867828            self.Bind(wx.EVT_MENU, self.OnImportPhase, id=item.GetId())
    868         item = submenu.Append(wx.ID_ANY,help='Import phase data, use file to try to determine format',
    869             kind=wx.ITEM_NORMAL,text='guess format from file')
     829        item = submenu.Append(wx.ID_ANY,'guess format from file','Import phase data, use file to try to determine format')
    870830        self.Bind(wx.EVT_MENU, self.OnImportPhase, id=item.GetId())
    871831       
     
    883843        # make a list of phase names, ranId's and the histograms used in those phases
    884844        phaseRIdList,usedHistograms = self.GetPhaseInfofromTree()
    885         phaseNameList = usedHistograms.keys() # phase names in use
     845        phaseNameList = list(usedHistograms.keys()) # phase names in use
    886846        usedHKLFhists = [] # used single-crystal histograms
    887847        for p in usedHistograms:
     
    1038998        '''
    1039999        submenu = wx.Menu()
    1040         item = parent.AppendMenu(wx.ID_ANY, 'Image',
    1041             submenu, help='Import image file')
     1000        item = parent.AppendSubMenu(submenu, 'Image','Import image file')
    10421001        for reader in self.ImportImageReaderlist:
    1043             item = submenu.Append(wx.ID_ANY,help=reader.longFormatName,
    1044                 kind=wx.ITEM_NORMAL,text=u'from '+reader.formatName+u' file')
     1002            item = submenu.Append(wx.ID_ANY,u'from '+reader.formatName+u' file',reader.longFormatName)
    10451003            self.ImportMenuId[item.GetId()] = reader
    10461004            self.Bind(wx.EVT_MENU, self.OnImportImage, id=item.GetId())
    1047         item = submenu.Append(wx.ID_ANY,help='Import image data, use file to try to determine format',
    1048             kind=wx.ITEM_NORMAL,text='guess format from file')
     1005        item = submenu.Append(wx.ID_ANY,'guess format from file','Import image data, use file to try to determine format')
    10491006        self.Bind(wx.EVT_MENU, self.OnImportImage, id=item.GetId())
    10501007       
     
    10711028        '''
    10721029        submenu = wx.Menu()
    1073         item = parent.AppendMenu(wx.ID_ANY, 'Structure Factor',
    1074             submenu, help='Import Structure Factor data')
     1030        item = parent.AppendSubMenu(submenu,'Structure Factor','Import Structure Factor data')
    10751031        for reader in self.ImportSfactReaderlist:
    1076             item = submenu.Append(wx.ID_ANY,help=reader.longFormatName,               
    1077                 kind=wx.ITEM_NORMAL,text=u'from '+reader.formatName+u' file')
     1032            item = submenu.Append(wx.ID_ANY,u'from '+reader.formatName+u' file',reader.longFormatName)               
    10781033            self.ImportMenuId[item.GetId()] = reader
    10791034            self.Bind(wx.EVT_MENU, self.OnImportSfact, id=item.GetId())
    1080         item = submenu.Append(wx.ID_ANY,
    1081             help='Import Structure Factor, use file to try to determine format',
    1082             kind=wx.ITEM_NORMAL,
    1083             text='guess format from file')
     1035        item = submenu.Append(wx.ID_ANY,'guess format from file','Import Structure Factor, use file to try to determine format')
    10841036        self.Bind(wx.EVT_MENU, self.OnImportSfact, id=item.GetId())
    10851037
     
    11231075            if len(rd.Banks):
    11241076                for Bank in rd.Banks:
    1125                     valuesdict = {'wtFactor':1.0,'Dummy':False,'ranId':ran.randint(0,sys.maxint),}
     1077                    valuesdict = {'wtFactor':1.0,'Dummy':False,'ranId':ran.randint(0,sys.maxsize),}
    11261078                    HistName = G2obj.MakeUniqueLabel(HistName,HKLFlist)
    1127                     print u'Read structure factor table '+HistName+u' from file '+self.lastimport
     1079                    print (u'Read structure factor table '+HistName+u' from file '+self.lastimport)
    11281080                    Id = self.GPXtree.AppendItem(parent=self.root,text=HistName)
    11291081                    if not Bank['RefDict'].get('FF'):
     
    11361088                    newHistList.append(HistName)
    11371089            else:
    1138                 valuesdict = {'wtFactor':1.0,'Dummy':False,'ranId':ran.randint(0,sys.maxint),}
     1090                valuesdict = {'wtFactor':1.0,'Dummy':False,'ranId':ran.randint(0,sys.maxsize),}
    11391091                HistName = G2obj.MakeUniqueLabel(HistName,HKLFlist)
    1140                 print u'Read structure factor table '+HistName+u' from file '+self.lastimport
     1092                print (u'Read structure factor table '+HistName+u' from file '+self.lastimport)
    11411093                if not rd.RefDict.get('FF'):
    11421094                    rd.RefDict['FF'] = {}
     
    11561108        # make a list of phase names
    11571109        phaseRIdList,usedHistograms = self.GetPhaseInfofromTree()
    1158         phaseNameList = usedHistograms.keys() # phase names in use
     1110        phaseNameList = list(usedHistograms.keys()) # phase names in use
    11591111        if not phaseNameList: return # no phases yet, nothing to do
    11601112        header = 'Select phase(s) to add the new\nsingle crystal dataset(s) to:'
     
    12211173        '''
    12221174        submenu = wx.Menu()
    1223         item = parent.AppendMenu(wx.ID_ANY, 'Powder Data',
    1224             submenu, help='Import Powder data')
     1175        item = parent.AppendSubMenu(submenu,'Powder Data','Import Powder data')
    12251176        for reader in self.ImportPowderReaderlist:
    1226             item = submenu.Append(wx.ID_ANY,help=reader.longFormatName,
    1227                 kind=wx.ITEM_NORMAL,text=u'from '+reader.formatName+u' file')
     1177            item = submenu.Append(wx.ID_ANY,u'from '+reader.formatName+u' file',reader.longFormatName)
    12281178            self.ImportMenuId[item.GetId()] = reader
    12291179            self.Bind(wx.EVT_MENU, self.OnImportPowder, id=item.GetId())
    1230         item = submenu.Append(wx.ID_ANY,
    1231             help='Import powder data, use file to try to determine format',
    1232             kind=wx.ITEM_NORMAL,text='guess format from file')
     1180        item = submenu.Append(wx.ID_ANY,'guess format from file','Import powder data, use file to try to determine format')
    12331181        self.Bind(wx.EVT_MENU, self.OnImportPowder, id=item.GetId())
    12341182        submenu.AppendSeparator()
    1235         item = submenu.Append(wx.ID_ANY,
    1236             help='Create a powder data set entry that will be simulated',
    1237             kind=wx.ITEM_NORMAL,text='Simulate a dataset')
     1183        item = submenu.Append(wx.ID_ANY,'Simulate a dataset','Create a powder data set entry that will be simulated')
    12381184        self.Bind(wx.EVT_MENU, self.OnDummyPowder, id=item.GetId())
    12391185       
     
    15431489                'GSAS iparm file (*.prm,*.inst,*.ins)|*.prm;*.inst;*.ins|'
    15441490                'GSAS-II iparm file (*.instprm)|*.instprm|'
    1545                 'All files (*.*)|*.*', wx.OPEN)
     1491                'All files (*.*)|*.*', wx.FD_OPEN)
    15461492            if os.path.exists(lastIparmfile):
    15471493                dlg.SetFilename(lastIparmfile)
     
    16481594                        Iparm1[key] = rd.instdict[key]
    16491595            lastdatafile = rd.powderentry[0]
    1650             HistName = 'PWDR '+G2obj.StripUnicode(rd.idstring,'_')
     1596            if 'phoenix' in wx.version():
     1597                HistName = 'PWDR '+rd.idstring
     1598            else:
     1599                HistName = 'PWDR '+G2obj.StripUnicode(rd.idstring,'_')
    16511600            # make new histogram names unique
    16521601            if HistName in PWDRlist:
     
    16951644                'wtFactor':1.0,
    16961645                'Dummy':False,
    1697                 'ranId':ran.randint(0,sys.maxint),
     1646                'ranId':ran.randint(0,sys.maxsize),
    16981647                'Offset':[0.0,0.0],'delOffset':0.02*Ymax,'refOffset':-.1*Ymax,'refDelt':0.1*Ymax,
    16991648                'qPlot':False,'dPlot':False,'sqrtPlot':False,'Yminmax':[Ymin,Ymax]
     
    17651714        # make a list of phase names
    17661715        phaseRIdList,usedHistograms = self.GetPhaseInfofromTree()
    1767         phaseNameList = usedHistograms.keys() # phase names in use
     1716        phaseNameList = list(usedHistograms.keys()) # phase names in use
    17681717        if not phaseNameList: return # no phases yet, nothing to do
    17691718        header = 'Select phase(s) to link\nto the newly-read data:'
     
    18961845            'wtFactor':1.0,
    18971846            'Dummy':True,
    1898             'ranId':ran.randint(0,sys.maxint),
     1847            'ranId':ran.randint(0,sys.maxsize),
    18991848            'Offset':[0.0,0.0],'delOffset':0.02*Ymax,'refOffset':-.1*Ymax,'refDelt':0.1*Ymax,
    19001849            'qPlot':False,'dPlot':False,'sqrtPlot':False,'Yminmax':[Ymin,Ymax]
     
    19371886        # make a list of phase names
    19381887        phaseRIdList,usedHistograms = self.GetPhaseInfofromTree()
    1939         phaseNameList = usedHistograms.keys() # phase names in use
     1888        phaseNameList = list(usedHistograms.keys()) # phase names in use
    19401889        if not phaseNameList: return # no phases yet, nothing to do
    19411890        header = 'Select phase(s) to add the new\npowder simulation (dummy) dataset to:'
     
    20001949        '''
    20011950        submenu = wx.Menu()
    2002         item = parent.AppendMenu(wx.ID_ANY, 'Small Angle Data',
    2003             submenu, help='Import small angle data')
     1951        item = parent.AppendSubMenu(submenu,'Small Angle Data','Import small angle data')
    20041952        for reader in self.ImportSmallAngleReaderlist:
    2005             item = submenu.Append(wx.ID_ANY,help=reader.longFormatName,
    2006                 kind=wx.ITEM_NORMAL,text=u'from '+reader.formatName+u' file')
     1953            item = submenu.Append(wx.ID_ANY,u'from '+reader.formatName+u' file',reader.longFormatName)
    20071954            self.ImportMenuId[item.GetId()] = reader
    20081955            self.Bind(wx.EVT_MENU, self.OnImportSmallAngle, id=item.GetId())
     
    20501997            # make new histogram names unique
    20511998            HistName = G2obj.MakeUniqueLabel(HistName,SASDlist)
    2052             print 'Read small angle data '+HistName+ \
    2053                 ' from file '+self.lastimport
     1999            print ('Read small angle data '+HistName+ \
     2000                ' from file '+self.lastimport)
    20542001            # data are read, now store them in the tree
    20552002            Id = self.GPXtree.AppendItem(parent=self.root,text=HistName)
     
    20802027                'wtFactor':1.0,
    20812028                'Dummy':False,
    2082                 'ranId':ran.randint(0,sys.maxint),
     2029                'ranId':ran.randint(0,sys.maxsize),
    20832030                'Offset':[0.0,0.0],
    20842031                }
     
    21152062        '''
    21162063        submenu = wx.Menu()
    2117         item = parent.AppendMenu(wx.ID_ANY, 'Reflectometry Data',
    2118             submenu, help='Import reflectometry data')
     2064        item = parent.AppendSubMenu(submenu,'Reflectometry Data','Import reflectometry data')
    21192065        for reader in self.ImportReflectometryReaderlist:
    2120             item = submenu.Append(wx.ID_ANY,help=reader.longFormatName,
    2121                 kind=wx.ITEM_NORMAL,text=u'from '+reader.formatName+u' file')
     2066            item = submenu.Append(wx.ID_ANY,u'from '+reader.formatName+u' file',reader.longFormatName)
    21222067            self.ImportMenuId[item.GetId()] = reader
    21232068            self.Bind(wx.EVT_MENU, self.OnImportReflectometry, id=item.GetId())
     
    21652110            # make new histogram names unique
    21662111            HistName = G2obj.MakeUniqueLabel(HistName,REFDlist)
    2167             print 'Read reflectometry data '+HistName+ \
    2168                 ' from file '+self.lastimport
     2112            print ('Read reflectometry data '+HistName+ \
     2113                ' from file '+self.lastimport)
    21692114            # data are read, now store them in the tree
    21702115            Id = self.GPXtree.AppendItem(parent=self.root,text=HistName)
     
    21962141                'wtFactor':1.0,
    21972142                'Dummy':False,
    2198                 'ranId':ran.randint(0,sys.maxint),
     2143                'ranId':ran.randint(0,sys.maxsize),
    21992144                'Offset':[0.0,0.0],
    22002145                'ifDQ':ifDQ
     
    22322177        '''
    22332178        submenu = wx.Menu()
    2234         item = parent.AppendMenu(wx.ID_ANY, 'PDF G(R) Data',
    2235             submenu, help='Import PDF G(R) data')
     2179        item = parent.AppendSubMenu(submenu,'PDF G(R) Data','Import PDF G(R) data')
    22362180        for reader in self.ImportPDFReaderlist:
    2237             item = submenu.Append(wx.ID_ANY,help=reader.longFormatName,
    2238                 kind=wx.ITEM_NORMAL,text=u'from '+reader.formatName+u' file')
     2181            item = submenu.Append(wx.ID_ANY,u'from '+reader.formatName+u' file',reader.longFormatName)
    22392182            self.ImportMenuId[item.GetId()] = reader
    22402183            self.Bind(wx.EVT_MENU, self.OnImportPDF, id=item.GetId())
     
    22762219            # make new histogram names unique
    22772220            HistName = G2obj.MakeUniqueLabel(HistName,PDFlist)
    2278             print 'Read PDF G(R) data '+HistName+ \
    2279                 ' from file '+self.lastimport
     2221            print ('Read PDF G(R) data '+HistName+ \
     2222                ' from file '+self.lastimport)
    22802223            # data are read, now store them in the tree
    22812224            Id = self.GPXtree.AppendItem(self.root,text=HistName)
     
    22832226            Ymax = np.max(rd.pdfdata[1])                 
    22842227            valuesdict = {
    2285                 'wtFactor':1.0,'Dummy':False,'ranId':ran.randint(0,sys.maxint),
     2228                'wtFactor':1.0,'Dummy':False,'ranId':ran.randint(0,sys.maxsize),
    22862229                'Offset':[0.0,0.0],'delOffset':0.02*Ymax,
    22872230                'qPlot':False,'dPlot':False,'sqrtPlot':False,'Yminmax':[Ymin,Ymax]
     
    23382281            kind=wx.ITEM_NORMAL,text='Show log')
    23392282        def OnShowLog(event):
    2340             print 70*'='
    2341             print 'List of logged actions'
     2283            print (70*'=')
     2284            print ('List of logged actions')
    23422285            for i,line in enumerate(log.G2logList):
    2343                 if line: print i,line
    2344             print 70*'='
     2286                if line: print ('%d %s'%(i,line))
     2287            print (70*'=')
    23452288        self.Bind(wx.EVT_MENU, OnShowLog, item)
    23462289
     
    23552298            kind=wx.ITEM_NORMAL,text='Save log')
    23562299        def OnSaveLog(event):
    2357             import cPickle
    23582300            defnam = os.path.splitext(os.path.split(self.GSASprojectfile)[1])[0]+'.gcmd'
    23592301            dlg = wx.FileDialog(self,
     
    23842326        def OnLoadLog(event):
    23852327            # this appends. Perhaps we should ask to clear?
    2386             import cPickle
    23872328            defnam = os.path.splitext(
    23882329                os.path.split(self.GSASprojectfile)[1])[0]+'.gcmd'
     
    23902331                'Choose an file to read saved actions', '.', defnam,
    23912332                'GSAS-II cmd output (*.gcmd)|*.gcmd',
    2392                 wx.OPEN)
     2333                wx.FD_OPEN)
    23932334            dlg.CenterOnParent()
    23942335            try:
     
    24192360        # set up the top-level menus
    24202361        projectmenu = wx.Menu()
    2421         item = menu.AppendMenu(
    2422             wx.ID_ANY, 'Entire project as',
    2423             projectmenu, help='Export entire project')
     2362        item = menu.AppendSubMenu(projectmenu,'Entire project as','Export entire project')
    24242363
    24252364        phasemenu = wx.Menu()
    2426         item = menu.AppendMenu(
    2427             wx.ID_ANY, 'Phase as',
    2428             phasemenu, help='Export phase or sometimes phases')
     2365        item = menu.AppendSubMenu(phasemenu,'Phase as','Export phase or sometimes phases')
    24292366
    24302367        powdermenu = wx.Menu()
    2431         item = menu.AppendMenu(
    2432             wx.ID_ANY, 'Powder data as',
    2433             powdermenu, help='Export powder diffraction histogram(s)')
     2368        item = menu.AppendSubMenu(powdermenu,'Powder data as','Export powder diffraction histogram(s)')
    24342369
    24352370        singlemenu = wx.Menu()
    2436         item = menu.AppendMenu(
    2437             wx.ID_ANY, 'Single crystal data as',
    2438             singlemenu, help='Export single crystal histogram(s)')
     2371        item = menu.AppendSubMenu(singlemenu,'Single crystal data as','Export single crystal histogram(s)')
    24392372
    24402373        imagemenu = wx.Menu()
    2441         item = menu.AppendMenu(
    2442             wx.ID_ANY, 'Image data as',
    2443             imagemenu, help='Export powder image(s) data')
     2374        item = menu.AppendSubMenu(imagemenu,'Image data as','Export powder image(s) data')
    24442375
    24452376        mapmenu = wx.Menu()
    2446         item = menu.AppendMenu(
    2447             wx.ID_ANY, 'Maps as',
    2448             mapmenu, help='Export density map(s)')
    2449 
    2450         # pdfmenu = wx.Menu()
    2451         # item = menu.AppendMenu(
    2452         #     wx.ID_ANY, 'PDFs as',
    2453         #     pdfmenu, help='Export pair distribution function(s)')
     2377        item = menu.AppendSubMenu(mapmenu,'Maps as','Export density map(s)')
    24542378
    24552379        # find all the exporter files
     
    25082432                    print("Error, unknown type in "+str(obj))
    25092433                    break
    2510                 item = submenu.Append(
    2511                     wx.ID_ANY,
    2512                     help=obj.longFormatName,
    2513                     kind=wx.ITEM_NORMAL,
    2514                     text=obj.formatName)
     2434                item = submenu.Append(wx.ID_ANY,obj.formatName,obj.longFormatName)
    25152435                self.Bind(wx.EVT_MENU, obj.Exporter, id=item.GetId())
    25162436                self.ExportLookup[item.GetId()] = typ # lookup table for submenu item
    2517         item = imagemenu.Append(wx.ID_ANY,
    2518                         help='Export image controls and masks for multiple images',
    2519                         kind=wx.ITEM_NORMAL,
    2520                         text='Multiple image controls and masks')
     2437        item = imagemenu.Append(wx.ID_ANY,'Multiple image controls and masks',
     2438            'Export image controls and masks for multiple images')
    25212439        self.Bind(wx.EVT_MENU, self.OnSaveMultipleImg, id=item.GetId())
    25222440        #code to debug an Exporter. hard-code the routine below, to allow a reload before use
     
    25472465        # self.Bind(wx.EVT_MENU, self.OnExportPatterns, id=item.GetId())
    25482466
    2549         item = parent.Append(
    2550             help='',id=wx.ID_ANY,
    2551             kind=wx.ITEM_NORMAL,
    2552             text='Export All Peak Lists...')
     2467        item = parent.Append(wx.ID_ANY,'Export All Peak Lists...','')
    25532468        self.ExportPeakList.append(item)
    25542469        item.Enable(True)
    25552470        self.Bind(wx.EVT_MENU, self.OnExportPeakList, id=item.GetId())
    25562471
    2557         item = parent.Append(
    2558             help='',id=wx.ID_ANY,
    2559             kind=wx.ITEM_NORMAL,
    2560             text='Export HKLs...')
     2472        item = parent.Append(wx.ID_ANY,'Export HKLs...','')
    25612473        self.ExportHKL.append(item)
    25622474        self.Bind(wx.EVT_MENU, self.OnExportHKL, id=item.GetId())
    25632475
    2564         item = parent.Append(
    2565             help='Select PDF item to enable',
    2566             id=wx.ID_ANY,
    2567             kind=wx.ITEM_NORMAL,
    2568             text='Export PDF...')
     2476        item = parent.Append(wx.ID_ANY,'Export PDF...','Select PDF item to enable')
    25692477        self.ExportPDF.append(item)
    25702478        item.Enable(False)
     
    26102518            # or ----------------------------------------------------------------------
    26112519            # filename = '/Users/toby/projects/branton/subgroup_cif.txt'
    2612             # fp = open(filename,'Ur')
    2613             # if not rd.ContentsValidator(fp):
     2520            # if not rd.ContentsValidator(filename):
    26142521            #     print 'not validated'
    26152522            #     # make a list of used phase ranId's
     
    26232530            #         if ranId: phaseRIdList.append(ranId)
    26242531            #         item, cookie = self.GPXtree.GetNextChild(sub, cookie)
    2625             # if rd.Reader(filename,fp,usedRanIdList=phaseRIdList):
     2532            # if rd.Reader(filename,usedRanIdList=phaseRIdList):
    26262533            #     print 'read OK'
    26272534        # item = Import.Append(
     
    27292636        else:
    27302637            img = self.Image.ConvertToBitmap()
    2731         self.SetIcon(wx.IconFromBitmap(img))
     2638        if 'phoenix' in wx.version():
     2639            self.SetIcon(wx.Icon(img))
     2640        else:
     2641            self.SetIcon(wx.IconFromBitmap(img))
    27322642        self.Bind(wx.EVT_CLOSE, self.ExitMain)
    27332643        # various defaults
     
    28092719                return
    28102720            except Exception:
    2811                 print 'Error opening or reading file',arg[1]
     2721                print ('Error opening or reading file'+arg[1])
    28122722                import traceback
    2813                 print traceback.format_exc()
     2723                print (traceback.format_exc())
    28142724               
    28152725        if GSASIIpath.GetConfigValue('Starting_directory'):
     
    28422752        '''
    28432753        # TOTO: diagnostic patch
    2844         print 'G2frame.SetDataSize called rather than dataWindow.SetDataSize'
     2754        print ('G2frame.SetDataSize called rather than dataWindow.SetDataSize')
    28452755        G2obj.HowDidIgetHere(True)
    28462756        self.dataWindow.SetDataSize()
     
    29842894        if not pth: pth = '.'
    29852895        dlg = wx.FileDialog(self, 'Choose file with peak list', pth, '',
    2986             'peak files (*.txt)|*.txt|All files (*.*)|*.*',wx.OPEN)
     2896            'peak files (*.txt)|*.txt|All files (*.*)|*.*',wx.FD_OPEN)
    29872897        try:
    29882898            if dlg.ShowModal() == wx.ID_OK:
     
    31573067            except ValueError:
    31583068                if value and '-' not in value[0]:
    3159                     print 'bad input - numbers only'
     3069                    print ('bad input - numbers only')
    31603070                    self.FindWindowById(id).SetValue('0.000')
    31613071                   
     
    31723082                 
    31733083            except ValueError:
    3174                 print 'bad input - numbers only'
     3084                print ('bad input - numbers only')
    31753085                self.FindWindowById(id).SetValue('')
    31763086                   
     
    32943204                            'wtFactor':1.0,
    32953205                            'Dummy':False,
    3296                             'ranId':ran.randint(0,sys.maxint),
     3206                            'ranId':ran.randint(0,sys.maxsize),
    32973207                            'Offset':[0.0,0.0],'delOffset':0.02*Ymax,'refOffset':-.1*Ymax,'refDelt':0.1*Ymax,
    32983208                            'qPlot':False,'dPlot':False,'sqrtPlot':False,'Yminmax':[Ymin,Ymax]
     
    35593469                    TextList.remove('PWDR'+pdfName[4:])
    35603470                except ValueError:
    3561                     print u'PWDR'+pdfName[4:]+u' for '+pdfName+u' not found'
     3471                    print (u'PWDR'+pdfName[4:]+u' for '+pdfName+u' not found')
    35623472            dlg = G2G.G2MultiChoiceDialog(self, 'Which data to delete?', 'Delete data', TextList, wx.CHOICEDLG_STYLE)
    35633473            try:
     
    36263536                pth = '.'
    36273537            dlg = wx.FileDialog(self, 'Choose GSAS-II project file', pth,
    3628                 wildcard='GSAS-II project file (*.gpx)|*.gpx',style=wx.OPEN)
     3538                wildcard='GSAS-II project file (*.gpx)|*.gpx',style=wx.FD_OPEN)
    36293539            try:
    36303540                if dlg.ShowModal() != wx.ID_OK: return
     
    36533563            self.StartProject()         #open the file if possible
    36543564        except:
    3655             print '\nError opening file ',filename
     3565            print ('\nError opening file '+filename)
    36563566            import traceback
    3657             print traceback.format_exc()
     3567            print (traceback.format_exc())
    36583568
    36593569    def StartProject(self):
     
    38583768                            if 'T' in Type:  #TOF - more cols
    38593769                                esds = {'pos':0.,'int':0.,'alp':0.,'bet':0.,'sig':0.,'gam':0.}
    3860                                 for name in esds.keys():
     3770                                for name in list(esds.keys()):
    38613771                                    esds[name] = sigDict.get('%s%d'%(name,ip),0.)
    38623772                                sig = np.sqrt(peak[8])
     
    38693779                                #get esds from sigDict for each peak & put in output - esds for sig & gam from UVWXY?
    38703780                                esds = {'pos':0.,'int':0.,'sig':0.,'gam':0.}
    3871                                 for name in esds.keys():
     3781                                for name in list(esds.keys()):
    38723782                                    esds[name] = sigDict.get('%s%d'%(name,ip),0.)
    38733783                                sig = np.sqrt(peak[4]) #var -> sig
     
    40373947        PWDRdata['Reflection Lists'] = self.GPXtree.GetItemPyData(GetGPXtreeItemId(self,PWDRname,'Reflection Lists'))
    40383948        if 'ranId' not in PWDRdata:  # patch, add a random Id
    4039             PWDRdata['ranId'] = ran.randint(0,sys.maxint)
     3949            PWDRdata['ranId'] = ran.randint(0,sys.maxsize)
    40403950        if 'ranId' not in PWDRdata['Sample Parameters']:  # I hope this becomes obsolete at some point
    40413951            PWDRdata['Sample Parameters']['ranId'] = PWDRdata['ranId']
     
    40793989                phaseData[phaseName] =  self.GPXtree.GetItemPyData(item)
    40803990                if 'ranId' not in phaseData[phaseName]:
    4081                     phaseData[phaseName]['ranId'] = ran.randint(0,sys.maxint)         
     3991                    phaseData[phaseName]['ranId'] = ran.randint(0,sys.maxsize)         
    40823992                item, cookie = self.GPXtree.GetNextChild(sub, cookie)
    40833993        return phaseData
     
    41054015                data = self.GPXtree.GetItemPyData(item)
    41064016                UseList = data['Histograms']
    4107                 usedHistograms[phaseName] = UseList.keys()
     4017                usedHistograms[phaseName] = list(UseList.keys())
    41084018                item, cookie = self.GPXtree.GetNextChild(sub, cookie)
    41094019        return phaseRIdList,usedHistograms
     
    42154125            if 'pId' not in Phases[phase]:
    42164126                self.ErrorDialog('View parameter error','You must run least squares at least once')
    4217                 raise Exception,'No pId for phase '+phase
     4127                raise Exception('No pId for phase '+phase)
    42184128        rigidbodyDict = self.GPXtree.GetItemPyData(   
    42194129            GetGPXtreeItemId(self,self.root,'Rigid bodies'))
     
    42404150        # for i in parmDict: print i,'\t',parmDict[i]
    42414151        # fl = open('parmDict.dat','wb')
    4242         # import cPickle
    42434152        # cPickle.dump(parmDict,fl,1)
    42444153        # fl.close()
     
    45884497            Sizer.Clear(True)
    45894498        else:
    4590             print 'No sizer in dataWindow'
     4499            print ('No sizer in dataWindow')
    45914500            if GSASIIpath.GetConfigValue('debug'): raise Exception
    45924501
     
    46064515        Sizer = self.GetSizer()
    46074516        if not Sizer:
    4608             print 'No sizer in dataWindow'
     4517            print ('No sizer in dataWindow')
    46094518            if GSASIIpath.GetConfigValue('debug'): raise Exception
    46104519            return
     
    46874596                (G2G.wxID_CONSSYM,'Sym-Generated'),
    46884597                ):
    4689             self.ConstraintTab.Append(id=id, kind=wx.ITEM_NORMAL,text=txt,
    4690                 help='Select '+txt+' constraint editing tab')
     4598            self.ConstraintTab.Append(id,txt,'Select '+txt+' constraint editing tab')
    46914599        self.ConstraintEdit = wx.Menu(title='')
    46924600        self.ConstraintMenu.Append(menu=self.ConstraintEdit, title='Edit Constr.') # renamed from Edit due to Mac adding extra items to menu
    4693         self.ConstraintEdit.Append(id=G2G.wxID_HOLDADD, kind=wx.ITEM_NORMAL,text='Add hold',
    4694             help='Prevent refinement of parameter values')
    4695         self.ConstraintEdit.Append(id=G2G.wxID_EQUIVADD, kind=wx.ITEM_NORMAL,text='Add equivalence',
    4696             help='Force parameter values to be equivalent')
    4697         self.ConstraintEdit.Append(id=G2G.wxID_CONSTRAINTADD, kind=wx.ITEM_NORMAL,text='Add constraint equation',
    4698             help='Add a constraint equation to apply to parameter values')
    4699         self.ConstraintEdit.Append(id=G2G.wxID_FUNCTADD, kind=wx.ITEM_NORMAL,text='Add New Var',
    4700             help='Create a variable composed of existing parameters')
    4701         self.ConstraintEdit.Append(id=G2G.wxID_EQUIVALANCEATOMS, kind=wx.ITEM_NORMAL,text='Make atoms equivalent',
    4702             help='Force atom parameter values to be equivalent')
     4601        self.ConstraintEdit.Append(G2G.wxID_HOLDADD,'Add hold','Prevent refinement of parameter values')
     4602        self.ConstraintEdit.Append(G2G.wxID_EQUIVADD,'Add equivalence','Force parameter values to be equivalent')
     4603        self.ConstraintEdit.Append(G2G.wxID_CONSTRAINTADD,'Add constraint equation',
     4604            'Add a constraint equation to apply to parameter values')
     4605        self.ConstraintEdit.Append(G2G.wxID_FUNCTADD,'Add New Var',
     4606            'Create a variable composed of existing parameters')
     4607        self.ConstraintEdit.Append(G2G.wxID_EQUIVALANCEATOMS,'Make atoms equivalent',
     4608            'Force atom parameter values to be equivalent')
    47034609        self.ConstraintEdit.Enable(G2G.wxID_EQUIVALANCEATOMS,False)
    47044610#        self.ConstraintEdit.Append(id=G2G.wxID_ADDRIDING, kind=wx.ITEM_NORMAL,text='Add H riding constraints',
     
    47134619        self.PrefillDataMenu(self.RigidBodyMenu)
    47144620        self.ResidueRBMenu = wx.Menu(title='')
    4715         self.ResidueRBMenu.Append(id=G2G.wxID_RIGIDBODYIMPORT, kind=wx.ITEM_NORMAL,text='Import XYZ',
    4716             help='Import rigid body XYZ from file')
    4717         self.ResidueRBMenu.Append(id=G2G.wxID_RESIDUETORSSEQ, kind=wx.ITEM_NORMAL,text='Define sequence',
    4718             help='Define torsion sequence')
    4719         self.ResidueRBMenu.Append(id=G2G.wxID_RIGIDBODYADD, kind=wx.ITEM_NORMAL,text='Import residues',
    4720             help='Import residue rigid bodies from macro file')
     4621        self.ResidueRBMenu.Append(G2G.wxID_RIGIDBODYIMPORT,'Import XYZ','Import rigid body XYZ from file')
     4622        self.ResidueRBMenu.Append(G2G.wxID_RESIDUETORSSEQ,'Define sequence','Define torsion sequence')
     4623        self.ResidueRBMenu.Append(G2G.wxID_RIGIDBODYADD,'Import residues','Import residue rigid bodies from macro file')
    47214624        self.RigidBodyMenu.Append(menu=self.ResidueRBMenu, title='Edit Body')
    47224625        self.PostfillDataMenu()
     
    47254628        self.PrefillDataMenu(self.VectorBodyMenu)
    47264629        self.VectorRBEdit = wx.Menu(title='')
    4727         self.VectorRBEdit.Append(id=G2G.wxID_VECTORBODYADD, kind=wx.ITEM_NORMAL,text='Add rigid body',
    4728             help='Add vector rigid body')
     4630        self.VectorRBEdit.Append(G2G.wxID_VECTORBODYADD,'Add rigid body','Add vector rigid body')
    47294631        self.VectorBodyMenu.Append(menu=self.VectorRBEdit, title='Edit Vector Body')
    47304632        self.PostfillDataMenu()
     
    47354637        self.RestraintTab = wx.Menu(title='')
    47364638        self.RestraintEdit = wx.Menu(title='')
    4737         self.RestraintEdit.Append(id=G2G.wxID_RESTSELPHASE, kind=wx.ITEM_NORMAL,text='Select phase',
    4738             help='Select phase')
    4739         self.RestraintEdit.Append(id=G2G.wxID_RESTRAINTADD, kind=wx.ITEM_NORMAL,text='Add restraints',
    4740             help='Add restraints')
     4639        self.RestraintEdit.Append(G2G.wxID_RESTSELPHASE,'Select phase','Select phase')
     4640        self.RestraintEdit.Append(G2G.wxID_RESTRAINTADD,'Add restraints','Add restraints')
    47414641        self.RestraintEdit.Enable(G2G.wxID_RESTRAINTADD,True)    #gets disabled if macromolecule phase
    4742         self.RestraintEdit.Append(id=G2G.wxID_AARESTRAINTADD, kind=wx.ITEM_NORMAL,text='Add residue restraints',
    4743             help='Add residue based restraints for macromolecules from macro file')
     4642        self.RestraintEdit.Append(G2G.wxID_AARESTRAINTADD,'Add residue restraints',
     4643            'Add residue based restraints for macromolecules from macro file')
    47444644        self.RestraintEdit.Enable(G2G.wxID_AARESTRAINTADD,False)    #gets enabled if macromolecule phase
    4745         self.RestraintEdit.Append(id=G2G.wxID_AARESTRAINTPLOT, kind=wx.ITEM_NORMAL,text='Plot residue restraints',
    4746             help='Plot selected residue based restraints for macromolecules from macro file')
     4645        self.RestraintEdit.Append(G2G.wxID_AARESTRAINTPLOT,'Plot residue restraints',
     4646            'Plot selected residue based restraints for macromolecules from macro file')
    47474647        self.RestraintEdit.Enable(G2G.wxID_AARESTRAINTPLOT,False)    #gets enabled if macromolecule phase
    4748         self.RestraintEdit.Append(id=G2G.wxID_RESRCHANGEVAL, kind=wx.ITEM_NORMAL,text='Change value',
    4749             help='Change observed value')
    4750         self.RestraintEdit.Append(id=G2G.wxID_RESTCHANGEESD, kind=wx.ITEM_NORMAL,text='Change esd',
    4751             help='Change esd in observed value')
    4752         self.RestraintEdit.Append(id=G2G.wxID_RESTDELETE, kind=wx.ITEM_NORMAL,text='Delete restraints',
    4753             help='Delete selected restraints')
     4648        self.RestraintEdit.Append(G2G.wxID_RESRCHANGEVAL,'Change value','Change observed value')
     4649        self.RestraintEdit.Append(G2G.wxID_RESTCHANGEESD,'Change esd','Change esd in observed value')
     4650        self.RestraintEdit.Append(G2G.wxID_RESTDELETE,'Delete restraints','Delete selected restraints')
    47544651
    47554652        self.RestraintMenu = wx.MenuBar()
     
    47674664        self.SequentialFile = wx.Menu(title='')
    47684665        self.SequentialMenu.Append(menu=self.SequentialFile, title='Columns')
    4769         self.SequentialFile.Append(id=G2G.wxID_SELECTUSE, kind=wx.ITEM_NORMAL,text='Select used',
    4770             help='Select rows to be used in plots/equation fitting')
    4771         self.SequentialFile.Append(id=G2G.wxID_RENAMESEQSEL, kind=wx.ITEM_NORMAL,text='Rename selected',
    4772             help='Rename selected sequential refinement columns')
    4773         self.SequentialFile.Append(id=G2G.wxID_SAVESEQSEL, kind=wx.ITEM_NORMAL,text='Save selected as text',
    4774             help='Save selected sequential refinement results as a text file')
    4775         self.SequentialFile.Append(id=G2G.wxID_SAVESEQCSV, kind=wx.ITEM_NORMAL,text='Save all as CSV',
    4776             help='Save all sequential refinement results as a CSV spreadsheet file')
    4777         self.SequentialFile.Append(id=G2G.wxID_SAVESEQSELCSV, kind=wx.ITEM_NORMAL,text='Save selected as CSV',
    4778             help='Save selected sequential refinement results as a CSV spreadsheet file')
    4779         self.SequentialFile.Append(id=G2G.wxID_PLOTSEQSEL, kind=wx.ITEM_NORMAL,text='Plot selected',
    4780             help='Plot selected sequential refinement results')
    4781         self.SequentialFile.Append(id=G2G.wxID_AVESEQSEL, kind=wx.ITEM_NORMAL,text='Compute average',
    4782             help='Compute average for selected parameter')           
     4666        self.SequentialFile.Append(G2G.wxID_SELECTUSE,'Select used''Select rows to be used in plots/equation fitting')
     4667        self.SequentialFile.Append(G2G.wxID_RENAMESEQSEL,'Rename selected',
     4668            'Rename selected sequential refinement columns')
     4669        self.SequentialFile.Append(G2G.wxID_SAVESEQSEL,'Save selected as text',
     4670            'Save selected sequential refinement results as a text file')
     4671        self.SequentialFile.Append(G2G.wxID_SAVESEQCSV,'Save all as CSV',
     4672            'Save all sequential refinement results as a CSV spreadsheet file')
     4673        self.SequentialFile.Append(G2G.wxID_SAVESEQSELCSV,'Save selected as CSV',
     4674            'Save selected sequential refinement results as a CSV spreadsheet file')
     4675        self.SequentialFile.Append(G2G.wxID_PLOTSEQSEL,'Plot selected',
     4676            'Plot selected sequential refinement results')
     4677        self.SequentialFile.Append(G2G.wxID_AVESEQSEL,'Compute average','Compute average for selected parameter')           
    47834678#        self.SequentialFile.Append(id=G2G.wxID_ORGSEQSEL, kind=wx.ITEM_NORMAL,text='Reorganize',
    47844679#            help='Reorganize variables where variables change')
    4785         self.SequentialFile.Append(id=G2G.wxID_ORGSEQINC, kind=wx.ITEM_NORMAL,text='Hide columns...',
    4786             help='Select columns to remove from displayed table')
     4680        self.SequentialFile.Append(G2G.wxID_ORGSEQINC,'Hide columns...','Select columns to remove from displayed table')
    47874681        self.SequentialPvars = wx.Menu(title='')
    47884682        self.SequentialMenu.Append(menu=self.SequentialPvars, title='Pseudo Vars')
    4789         self.SequentialPvars.Append(
    4790             id=G2G.wxID_ADDSEQVAR, kind=wx.ITEM_NORMAL,text='Add Formula',
    4791             help='Add a new custom pseudo-variable')
    4792         self.SequentialPvars.Append(
    4793             id=G2G.wxID_ADDSEQDIST, kind=wx.ITEM_NORMAL,text='Add Distance',
    4794             help='Add a new bond distance pseudo-variable')
    4795         self.SequentialPvars.Append(
    4796             id=G2G.wxID_ADDSEQANGLE, kind=wx.ITEM_NORMAL,text='Add Angle',
    4797             help='Add a new bond angle pseudo-variable')
    4798         self.SequentialPvars.Append(
    4799             id=G2G.wxID_DELSEQVAR, kind=wx.ITEM_NORMAL,text='Delete',
    4800             help='Delete an existing pseudo-variable')
    4801         self.SequentialPvars.Append(
    4802             id=G2G.wxID_EDITSEQVAR, kind=wx.ITEM_NORMAL,text='Edit',
    4803             help='Edit an existing pseudo-variable')
     4683        self.SequentialPvars.Append(G2G.wxID_ADDSEQVAR,'Add Formula','Add a new custom pseudo-variable')
     4684        self.SequentialPvars.Append(G2G.wxID_ADDSEQDIST,'Add Distance','Add a new bond distance pseudo-variable')
     4685        self.SequentialPvars.Append(G2G.wxID_ADDSEQANGLE,'Add Angle','Add a new bond angle pseudo-variable')
     4686        self.SequentialPvars.Append(G2G.wxID_DELSEQVAR,'Delete','Delete an existing pseudo-variable')
     4687        self.SequentialPvars.Append(G2G.wxID_EDITSEQVAR,'Edit','Edit an existing pseudo-variable')
    48044688
    48054689        self.SequentialPfit = wx.Menu(title='')
    48064690        self.SequentialMenu.Append(menu=self.SequentialPfit, title='Parametric Fit')
    4807         self.SequentialPfit.Append(
    4808             id=G2G.wxID_ADDPARFIT, kind=wx.ITEM_NORMAL,text='Add equation',
    4809             help='Add a new equation to minimize')
    4810         self.SequentialPfit.Append(
    4811             id=G2G.wxID_COPYPARFIT, kind=wx.ITEM_NORMAL,text='Copy equation',
    4812             help='Copy an equation to minimize - edit it next')
    4813         self.SequentialPfit.Append(
    4814             id=G2G.wxID_DELPARFIT, kind=wx.ITEM_NORMAL,text='Delete equation',
    4815             help='Delete an equation for parametric minimization')
    4816         self.SequentialPfit.Append(
    4817             id=G2G.wxID_EDITPARFIT, kind=wx.ITEM_NORMAL,text='Edit equation',
    4818             help='Edit an existing parametric minimization equation')
    4819         self.SequentialPfit.Append(
    4820             id=G2G.wxID_DOPARFIT, kind=wx.ITEM_NORMAL,text='Fit to equation(s)',
    4821             help='Perform a parametric minimization')
     4691        self.SequentialPfit.Append(G2G.wxID_ADDPARFIT,'Add equation','Add a new equation to minimize')
     4692        self.SequentialPfit.Append(G2G.wxID_COPYPARFIT,'Copy equation','Copy an equation to minimize - edit it next')
     4693        self.SequentialPfit.Append(G2G.wxID_DELPARFIT,'Delete equation','Delete an equation for parametric minimization')
     4694        self.SequentialPfit.Append(G2G.wxID_EDITPARFIT,'Edit equation','Edit an existing parametric minimization equation')
     4695        self.SequentialPfit.Append(G2G.wxID_DOPARFIT,'Fit to equation(s)','Perform a parametric minimization')
    48224696        # fill sequential Export menu
    48234697        # for an exporter to be used for sequential exports, it must have a Writer method and
     
    48424716            if objlist:
    48434717                submenu = wx.Menu()
    4844                 item = self.SequentialEx.AppendMenu(wx.ID_ANY, lbl+' as',submenu, help=txt)
     4718                item = self.SequentialEx.AppendSubMenu(submenu,lbl+' as',txt)
    48454719                for obj in objlist:
    4846                     item = submenu.Append(wx.ID_ANY,help=obj.longFormatName,
    4847                         kind=wx.ITEM_NORMAL,text=obj.formatName)
     4720                    item = submenu.Append(wx.ID_ANY,obj.formatName,obj.longFormatName)
    48484721                    self.SeqExportLookup[item.GetId()] = (obj,lbl) # lookup table for submenu item
    48494722       
     
    48574730        self.ErrorAnal = wx.Menu(title='')
    48584731        self.PWDRMenu.Append(menu=self.ErrorAnal,title='Commands')
    4859         self.ErrorAnal.Append(id=G2G.wxID_PWDANALYSIS,kind=wx.ITEM_NORMAL,text='Error Analysis',
    4860             help='Error analysis on powder pattern')
    4861         self.ErrorAnal.Append(id=G2G.wxID_PWDCOPY,kind=wx.ITEM_NORMAL,text='Copy params',
    4862             help='Copy of PWDR parameters')
    4863         self.ErrorAnal.Append(id=G2G.wxID_PLOTCTRLCOPY,kind=wx.ITEM_NORMAL,text='Copy plot controls',
    4864             help='Copy of PWDR plot controls')
    4865         self.moveDiffCurve = self.ErrorAnal.Append(id=wx.ID_ANY,kind=wx.ITEM_NORMAL,text='Move diff. curve',
    4866             help='Click on position where difference curve is placed')
    4867         self.moveTickLoc = self.ErrorAnal.Append(id=wx.ID_ANY,kind=wx.ITEM_NORMAL,text='Move ticks',
    4868             help='Move mouse to where tick marks should be positioned')
    4869         self.moveTickSpc = self.ErrorAnal.Append(id=wx.ID_ANY,kind=wx.ITEM_NORMAL,text='Set tick space',
    4870             help='Click to set spacing between phase tick marks')
     4732        self.ErrorAnal.Append(G2G.wxID_PWDANALYSIS,'Error Analysis','Error analysis on powder pattern')
     4733        self.ErrorAnal.Append(G2G.wxID_PWDCOPY,'Copy params','Copy of PWDR parameters')
     4734        self.ErrorAnal.Append(G2G.wxID_PLOTCTRLCOPY,'Copy plot controls','Copy of PWDR plot controls')
     4735        self.moveDiffCurve = self.ErrorAnal.Append(wx.ID_ANY,'Move diff. curve',
     4736            'Click on position where difference curve is placed')
     4737        self.moveTickLoc = self.ErrorAnal.Append(wx.ID_ANY,'Move ticks','Move mouse to where tick marks should be positioned')
     4738        self.moveTickSpc = self.ErrorAnal.Append(wx.ID_ANY,'Set tick space','Click to set spacing between phase tick marks')
    48714739        self.PostfillDataMenu()
    48724740           
     
    48764744        self.ErrorAnal = wx.Menu(title='')
    48774745        self.HKLFMenu.Append(menu=self.ErrorAnal,title='Commands')
    4878         self.ErrorAnal.Append(id=G2G.wxID_PWDANALYSIS,kind=wx.ITEM_NORMAL,text='Error Analysis',
    4879             help='Error analysis on single crystal data')
    4880         self.ErrorAnal.Append(id=G2G.wxID_MERGEHKL,kind=wx.ITEM_NORMAL,text='Merge HKLs',
    4881             help='Transform & merge HKLF data to new histogram')
    4882         self.ErrorAnal.Append(id=G2G.wxID_PWD3DHKLPLOT,kind=wx.ITEM_NORMAL,text='Plot 3D HKLs',
    4883             help='Plot HKLs from single crystal data in 3D')
    4884         self.ErrorAnal.Append(id=G2G.wxID_3DALLHKLPLOT,kind=wx.ITEM_NORMAL,text='Plot all 3D HKLs',
    4885             help='Plot HKLs from all single crystal data in 3D')
    4886         self.ErrorAnal.Append(id=G2G.wxID_PWDCOPY,kind=wx.ITEM_NORMAL,text='Copy params',
    4887             help='Copy of HKLF parameters')
     4746        self.ErrorAnal.Append(G2G.wxID_PWDANALYSIS,'Error Analysis','Error analysis on single crystal data')
     4747        self.ErrorAnal.Append(G2G.wxID_MERGEHKL,'Merge HKLs','Transform & merge HKLF data to new histogram')
     4748        self.ErrorAnal.Append(G2G.wxID_PWD3DHKLPLOT,'Plot 3D HKLs','Plot HKLs from single crystal data in 3D')
     4749        self.ErrorAnal.Append(G2G.wxID_3DALLHKLPLOT,'Plot all 3D HKLs','Plot HKLs from all single crystal data in 3D')
     4750        self.ErrorAnal.Append(G2G.wxID_PWDCOPY,'Copy params','Copy of HKLF parameters')
    48884751        self.PostfillDataMenu()
    48894752           
     
    48944757        self.LimitEdit = wx.Menu(title='')
    48954758        self.LimitMenu.Append(menu=self.LimitEdit, title='Edit Limits')
    4896         self.LimitEdit.Append(id=G2G.wxID_LIMITCOPY, kind=wx.ITEM_NORMAL,text='Copy',
    4897             help='Copy limits to other histograms')
    4898         self.LimitEdit.Append(id=G2G.wxID_ADDEXCLREGION, kind=wx.ITEM_NORMAL,text='Add exclude',
    4899             help='Add excluded region - select a point on plot; drag to adjust')           
     4759        self.LimitEdit.Append(G2G.wxID_LIMITCOPY,'Copy','Copy limits to other histograms')
     4760        self.LimitEdit.Append(G2G.wxID_ADDEXCLREGION,'Add exclude',
     4761            'Add excluded region - select a point on plot; drag to adjust')           
    49004762        self.PostfillDataMenu()
    49014763           
     
    49074769        self.BackEdit = wx.Menu(title='')
    49084770        self.BackMenu.Append(menu=self.BackEdit, title='File')
    4909         self.BackEdit.Append(id=G2G.wxID_BACKCOPY, kind=wx.ITEM_NORMAL,text='Copy',
    4910             help='Copy background parameters to other histograms')
    4911         self.BackEdit.Append(id=G2G.wxID_BACKFLAGCOPY, kind=wx.ITEM_NORMAL,text='Copy flags',
    4912             help='Copy background refinement flags to other histograms')
    4913         self.BackEdit.Append(id=G2G.wxID_BACKPEAKSMOVE, kind=wx.ITEM_NORMAL,text='Move peaks',
    4914             help='Move background peaks to Peak List')
    4915         self.BackEdit.Append(id=G2G.wxID_MAKEBACKRDF, kind=wx.ITEM_NORMAL,text='Plot RDF',
    4916             help='Plot radial distribution from differences')
     4771        self.BackEdit.Append(G2G.wxID_BACKCOPY,'Copy','Copy background parameters to other histograms')
     4772        self.BackEdit.Append(G2G.wxID_BACKFLAGCOPY,'Copy flags',
     4773            'Copy background refinement flags to other histograms')
     4774        self.BackEdit.Append(G2G.wxID_BACKPEAKSMOVE,'Move peaks','Move background peaks to Peak List')
     4775        self.BackEdit.Append(G2G.wxID_MAKEBACKRDF,'Plot RDF','Plot radial distribution from differences')
    49174776        self.BackFixed = wx.Menu(title='') # fixed background point menu
    49184777        self.BackMenu.Append(menu=self.BackFixed, title='Fixed Points')
    49194778        self.wxID_BackPts = {}
    49204779        self.wxID_BackPts['Add'] = wx.NewId() # N.B. not using wxID_ global as for other menu items
    4921         self.BackFixed.Append(id=self.wxID_BackPts['Add'], kind=wx.ITEM_RADIO,text='Add',
    4922             help='Add fixed background points with mouse clicks')
     4780        self.BackFixed.AppendRadioItem(self.wxID_BackPts['Add'],'Add','Add fixed background points with mouse clicks')
    49234781        self.wxID_BackPts['Move'] = wx.NewId()
    4924         item = self.BackFixed.Append(id=self.wxID_BackPts['Move'], kind=wx.ITEM_RADIO,text='Move',
    4925             help='Move selected fixed background points with mouse drags')
     4782        item = self.BackFixed.AppendRadioItem(self.wxID_BackPts['Move'],'Move','Move selected fixed background points with mouse drags')
    49264783        item.Check(True)
    49274784        self.wxID_BackPts['Del'] = wx.NewId()
    4928         self.BackFixed.Append(id=self.wxID_BackPts['Del'], kind=wx.ITEM_RADIO,text='Delete',
    4929             help='Delete fixed background points with mouse clicks')
     4785        self.BackFixed.AppendRadioItem(self.wxID_BackPts['Del'],'Delete','Delete fixed background points with mouse clicks')
    49304786        self.wxID_BackPts['Clear'] = wx.NewId()
    4931         self.BackFixed.Append(id=self.wxID_BackPts['Clear'], kind=wx.ITEM_NORMAL,text='Clear',
    4932             help='Clear fixed background points')
     4787        self.BackFixed.Append(self.wxID_BackPts['Clear'],'Clear','Clear fixed background points')
    49334788        self.wxID_BackPts['Fit'] = wx.NewId()
    4934         self.BackFixed.Append(id=self.wxID_BackPts['Fit'], kind=wx.ITEM_NORMAL,text='Fit background',
    4935             help='Fit background function to fixed background points')
     4789        self.BackFixed.Append(self.wxID_BackPts['Fit'],'Fit background',
     4790            'Fit background function to fixed background points')
    49364791        self.PostfillDataMenu()
    49374792           
     
    49434798        self.InstEdit = wx.Menu(title='')
    49444799        self.InstMenu.Append(menu=self.InstEdit, title='Operations')
    4945         self.InstEdit.Append(help='Calibrate from indexed peaks',
    4946             id=G2G.wxID_INSTCALIB, kind=wx.ITEM_NORMAL,text='Calibrate')           
    4947         self.InstEdit.Append(help='Reset instrument profile parameters to default',
    4948             id=G2G.wxID_INSTPRMRESET, kind=wx.ITEM_NORMAL,text='Reset profile')           
    4949         self.InstEdit.Append(help='Load instrument profile parameters from file',
    4950             id=G2G.wxID_INSTLOAD, kind=wx.ITEM_NORMAL,text='Load profile...')           
    4951         self.InstEdit.Append(help='Save instrument profile parameters to file',
    4952             id=G2G.wxID_INSTSAVE, kind=wx.ITEM_NORMAL,text='Save profile...')
    4953         self.InstEdit.Append(help='Save all instrument profile parameters to one file',
    4954             id=G2G.wxID_INSTSAVEALL, kind=wx.ITEM_NORMAL,text='Save all profile...')           
    4955         self.InstEdit.Append(help='Copy instrument profile parameters to other histograms',
    4956             id=G2G.wxID_INSTCOPY, kind=wx.ITEM_NORMAL,text='Copy')
    4957         self.InstEdit.Append(id=G2G.wxID_INSTFLAGCOPY, kind=wx.ITEM_NORMAL,text='Copy flags',
    4958             help='Copy instrument parameter refinement flags to other histograms')
    4959         self.InstEdit.Append(id=G2G.wxID_INST1VAL, kind=wx.ITEM_NORMAL,text='Set one value',
    4960             help='Set one instrument parameter value across multiple histograms')
     4800        self.InstEdit.Append(G2G.wxID_INSTCALIB,'Calibrate','Calibrate from indexed peaks')
     4801        self.InstEdit.Append(G2G.wxID_INSTPRMRESET,'Reset profile','Reset instrument profile parameters to default')
     4802        self.InstEdit.Append(G2G.wxID_INSTLOAD,'Load profile...','Load instrument profile parameters from file')
     4803        self.InstEdit.Append(G2G.wxID_INSTSAVE,'Save profile...','Save instrument profile parameters to file')
     4804        self.InstEdit.Append(G2G.wxID_INSTSAVEALL,'Save all profile...','Save all instrument profile parameters to one file')
     4805        self.InstEdit.Append(G2G.wxID_INSTCOPY,'Copy','Copy instrument profile parameters to other histograms')
     4806        self.InstEdit.Append(G2G.wxID_INSTFLAGCOPY,'Copy flags','Copy instrument parameter refinement flags to other histograms')
     4807        self.InstEdit.Append(G2G.wxID_INST1VAL,'Set one value','Set one instrument parameter value across multiple histograms')
    49614808        self.PostfillDataMenu()
    49624809       
     
    49684815        self.SampleEdit = wx.Menu(title='')
    49694816        self.SampleMenu.Append(menu=self.SampleEdit, title='Command')
    4970         self.SetScale = self.SampleEdit.Append(id=G2G.wxID_SETSCALE, kind=wx.ITEM_NORMAL,text='Set scale',
    4971             help='Set scale by matching to another histogram')
    4972         self.SampleEdit.Append(id=G2G.wxID_SAMPLELOAD, kind=wx.ITEM_NORMAL,text='Load',
    4973             help='Load sample parameters from file')
    4974         self.SampleEdit.Append(id=G2G.wxID_SAMPLESAVE, kind=wx.ITEM_NORMAL,text='Save',
    4975             help='Save sample parameters to file')
    4976         self.SampleEdit.Append(id=G2G.wxID_SAMPLECOPY, kind=wx.ITEM_NORMAL,text='Copy',
    4977             help='Copy refinable and most other sample parameters to other histograms')
    4978         self.SampleEdit.Append(id=G2G.wxID_SAMPLECOPYSOME, kind=wx.ITEM_NORMAL,text='Copy selected...',
    4979             help='Copy selected sample parameters to other histograms')
    4980         self.SampleEdit.Append(id=G2G.wxID_SAMPLEFLAGCOPY, kind=wx.ITEM_NORMAL,text='Copy flags',
    4981             help='Copy sample parameter refinement flags to other histograms')
    4982         self.SampleEdit.Append(id=G2G.wxID_SAMPLE1VAL, kind=wx.ITEM_NORMAL,text='Set one value',
    4983             help='Set one sample parameter value across multiple histograms')
    4984         self.SampleEdit.Append(id=G2G.wxID_ALLSAMPLELOAD, kind=wx.ITEM_NORMAL,text='Load all',
    4985             help='Load sample parmameters over multiple histograms')
    4986         self.SampleEdit.Append(id=G2G.wxID_RESCALEALL, kind=wx.ITEM_NORMAL,text='Rescale all',
    4987             help='Rescale all data with selected range')
     4817        self.SetScale = self.SampleEdit.Append(G2G.wxID_SETSCALE,'Set scale','Set scale by matching to another histogram')
     4818        self.SampleEdit.Append(G2G.wxID_SAMPLELOAD,'Load','Load sample parameters from file')
     4819        self.SampleEdit.Append(G2G.wxID_SAMPLESAVE,'Save','Save sample parameters to file')
     4820        self.SampleEdit.Append(G2G.wxID_SAMPLECOPY,'Copy','Copy refinable and most other sample parameters to other histograms')
     4821        self.SampleEdit.Append(G2G.wxID_SAMPLECOPYSOME,'Copy selected...','Copy selected sample parameters to other histograms')
     4822        self.SampleEdit.Append(G2G.wxID_SAMPLEFLAGCOPY,'Copy flags','Copy sample parameter refinement flags to other histograms')
     4823        self.SampleEdit.Append(G2G.wxID_SAMPLE1VAL,'Set one value','Set one sample parameter value across multiple histograms')
     4824        self.SampleEdit.Append(G2G.wxID_ALLSAMPLELOAD,'Load all','Load sample parmameters over multiple histograms')
     4825        self.SampleEdit.Append(G2G.wxID_RESCALEALL,'Rescale all','Rescale all data with selected range')
    49884826        self.PostfillDataMenu()
    49894827        self.SetScale.Enable(False)
     
    49964834        self.PeakEdit = wx.Menu(title='')
    49974835        self.PeakMenu.Append(menu=self.PeakEdit, title='Peak Fitting')
    4998         self.peaksSel = self.PeakEdit.Append(wx.ID_ANY,help='Set refinement flags for selected peaks',
    4999             kind=wx.ITEM_NORMAL,text='Set sel. ref flags...')
    5000         self.peaksAll = self.PeakEdit.Append(wx.ID_ANY,help='Set refinement flags for all peaks',
    5001             kind=wx.ITEM_NORMAL,text='Set all ref flags...')
    5002         self.AutoSearch = self.PeakEdit.Append(help='Automatic peak search',
    5003             id=G2G.wxID_AUTOSEARCH, kind=wx.ITEM_NORMAL,text='Auto search')
    5004         self.UnDo = self.PeakEdit.Append(help='Undo last least squares refinement',
    5005             id=G2G.wxID_UNDO, kind=wx.ITEM_NORMAL,text='UnDo')
    5006         self.PeakFit = self.PeakEdit.Append(id=G2G.wxID_LSQPEAKFIT, kind=wx.ITEM_NORMAL,text='Peakfit',
    5007             help='Peak fitting' )
    5008         self.PFOneCycle = self.PeakEdit.Append(id=G2G.wxID_LSQONECYCLE, kind=wx.ITEM_NORMAL,text='Peakfit one cycle',
    5009             help='One cycle of Peak fitting' )
    5010         self.PeakEdit.Append(id=G2G.wxID_RESETSIGGAM, kind=wx.ITEM_NORMAL,
    5011             text='Reset sig and gam',help='Reset sigma and gamma to global fit' )
    5012         self.PeakCopy = self.PeakEdit.Append(help='Copy peaks to other histograms',
    5013             id=G2G.wxID_PEAKSCOPY, kind=wx.ITEM_NORMAL,text='Peak copy')
    5014         self.SeqPeakFit = self.PeakEdit.Append(id=G2G.wxID_SEQPEAKFIT, kind=wx.ITEM_NORMAL,text='Seq PeakFit',
    5015             help='Sequential Peak fitting for all histograms' )
    5016         self.PeakEdit.Append(id=G2G.wxID_CLEARPEAKS, kind=wx.ITEM_NORMAL,text='Clear peaks',
    5017             help='Clear the peak list' )
    5018         self.movePeak = self.PeakEdit.Append(id=wx.ID_ANY,kind=wx.ITEM_NORMAL,text='Move selected peak',
    5019             help='Select a peak in the table, then use this to move it with the mouse.')
     4836        self.peaksSel = self.PeakEdit.Append(wx.ID_ANY,'Set sel. ref flags...','Set refinement flags for selected peaks')
     4837        self.peaksAll = self.PeakEdit.Append(wx.ID_ANY,'Set all ref flags...','Set refinement flags for all peaks')
     4838        self.AutoSearch = self.PeakEdit.Append(G2G.wxID_AUTOSEARCH,'Auto search','Automatic peak search')
     4839        self.UnDo = self.PeakEdit.Append(G2G.wxID_UNDO,'UnDo','Undo last least squares refinement')
     4840        self.PeakFit = self.PeakEdit.Append(G2G.wxID_LSQPEAKFIT,'Peakfit','Peak fitting' )
     4841        self.PFOneCycle = self.PeakEdit.Append(G2G.wxID_LSQONECYCLE,'Peakfit one cycle','One cycle of Peak fitting' )
     4842        self.PeakEdit.Append(G2G.wxID_RESETSIGGAM,'Reset sig and gam','Reset sigma and gamma to global fit' )
     4843        self.PeakCopy = self.PeakEdit.Append(G2G.wxID_PEAKSCOPY,'Peak copy','Copy peaks to other histograms')
     4844        self.SeqPeakFit = self.PeakEdit.Append(G2G.wxID_SEQPEAKFIT,'Seq PeakFit',
     4845            'Sequential Peak fitting for all histograms' )
     4846        self.PeakEdit.Append(G2G.wxID_CLEARPEAKS,'Clear peaks','Clear the peak list' )
     4847        self.movePeak = self.PeakEdit.Append(wx.ID_ANY,'Move selected peak',
     4848            'Select a peak in the table, then use this to move it with the mouse.')
    50204849        self.PostfillDataMenu()
    50214850        self.UnDo.Enable(False)
     
    50304859        self.IndPeaksEdit = wx.Menu(title='')
    50314860        self.IndPeaksMenu.Append(menu=self.IndPeaksEdit,title='Operations')
    5032         self.IndPeaksEdit.Append(help='Load/Reload index peaks from peak list',id=G2G.wxID_INDXRELOAD,
    5033             kind=wx.ITEM_NORMAL,text='Load/Reload')
     4861        self.IndPeaksEdit.Append(G2G.wxID_INDXRELOAD,'Load/Reload','Load/Reload index peaks from peak list')
    50344862        self.PostfillDataMenu()
    50354863       
     
    50414869        self.IndexEdit = wx.Menu(title='')
    50424870        self.IndexMenu.Append(menu=self.IndexEdit, title='Cell Index/Refine')
    5043         self.IndexPeaks = self.IndexEdit.Append(help='', id=G2G.wxID_INDEXPEAKS, kind=wx.ITEM_NORMAL,
    5044             text='Index Cell')
    5045         self.CopyCell = self.IndexEdit.Append( id=G2G.wxID_COPYCELL, kind=wx.ITEM_NORMAL,text='Copy Cell',
    5046             help='Copy selected unit cell from indexing to cell refinement fields')
    5047         self.RefineCell = self.IndexEdit.Append( id=G2G.wxID_REFINECELL, kind=wx.ITEM_NORMAL,
    5048             text='Refine Cell',help='Refine unit cell parameters from indexed peaks')
    5049         self.MakeNewPhase = self.IndexEdit.Append( id=G2G.wxID_MAKENEWPHASE, kind=wx.ITEM_NORMAL,
    5050             text='Make new phase',help='Make new phase from selected unit cell')
    5051         self.ExportCells = self.IndexEdit.Append( id=G2G.wxID_EXPORTCELLS, kind=wx.ITEM_NORMAL,
    5052             text='Export cell list',help='Export cell list to csv file')
     4871        self.IndexPeaks = self.IndexEdit.Append(G2G.wxID_INDEXPEAKS,'Index Cell','')
     4872        self.CopyCell = self.IndexEdit.Append(G2G.wxID_COPYCELL,'Copy Cell',
     4873            'Copy selected unit cell from indexing to cell refinement fields')
     4874        self.RefineCell = self.IndexEdit.Append(G2G.wxID_REFINECELL,'Refine Cell',
     4875            'Refine unit cell parameters from indexed peaks')
     4876        self.MakeNewPhase = self.IndexEdit.Append(G2G.wxID_MAKENEWPHASE,'Make new phase',
     4877            'Make new phase from selected unit cell')
     4878        self.ExportCells = self.IndexEdit.Append(G2G.wxID_EXPORTCELLS,'Export cell list','Export cell list to csv file')
    50534879        self.PostfillDataMenu()
    50544880        self.IndexPeaks.Enable(False)
     
    50634889        self.ReflEdit = wx.Menu(title='')
    50644890        self.ReflMenu.Append(menu=self.ReflEdit, title='Reflection List')
    5065         self.SelectPhase = self.ReflEdit.Append(help='Select phase for reflection list',id=G2G.wxID_SELECTPHASE,
    5066             kind=wx.ITEM_NORMAL,text='Select phase')
    5067         self.ReflEdit.Append(id=G2G.wxID_PWDHKLPLOT,kind=wx.ITEM_NORMAL,text='Plot HKLs',
    5068             help='Plot HKLs from powder pattern')
    5069         self.ReflEdit.Append(id=G2G.wxID_PWD3DHKLPLOT,kind=wx.ITEM_NORMAL,text='Plot 3D HKLs',
    5070             help='Plot HKLs from powder pattern in 3D')
     4891        self.SelectPhase = self.ReflEdit.Append(G2G.wxID_SELECTPHASE,'Select phase','Select phase for reflection list')
     4892        self.ReflEdit.Append(G2G.wxID_PWDHKLPLOT,'Plot HKLs','Plot HKLs from powder pattern')
     4893        self.ReflEdit.Append(G2G.wxID_PWD3DHKLPLOT,'Plot 3D HKLs','Plot HKLs from powder pattern in 3D')
    50714894        self.PostfillDataMenu()
    50724895       
     
    50774900        self.SASDInstEdit = wx.Menu(title='')
    50784901        self.SASDInstMenu.Append(menu=self.SASDInstEdit, title='Operations')
    5079         self.SASDInstEdit.Append(help='Copy instrument profile parameters to other histograms',
    5080             id=G2G.wxID_SASDINSTCOPY, kind=wx.ITEM_NORMAL,text='Copy')
     4902        self.SASDInstEdit.Append(G2G.wxID_SASDINSTCOPY,'Copy','Copy instrument profile parameters to other histograms')
    50814903        self.PostfillDataMenu()
    50824904       
     
    50884910        self.SubstanceEdit = wx.Menu(title='')
    50894911        self.SubstanceMenu.Append(menu=self.SubstanceEdit, title='Edit substance')
    5090         self.SubstanceEdit.Append(id=G2G.wxID_LOADSUBSTANCE, kind=wx.ITEM_NORMAL,text='Load substance',
    5091             help='Load substance from file')
    5092         self.SubstanceEdit.Append(id=G2G.wxID_RELOADSUBSTANCES, kind=wx.ITEM_NORMAL,text='Reload substances',
    5093             help='Reload all substances from file')
    5094         self.SubstanceEdit.Append(id=G2G.wxID_ADDSUBSTANCE, kind=wx.ITEM_NORMAL,text='Add substance',
    5095             help='Add new substance to list')
    5096         self.SubstanceEdit.Append(id=G2G.wxID_COPYSUBSTANCE, kind=wx.ITEM_NORMAL,text='Copy substances',
    5097             help='Copy substances')
    5098         self.SubstanceEdit.Append(id=G2G.wxID_DELETESUBSTANCE, kind=wx.ITEM_NORMAL,text='Delete substance',
    5099             help='Delete substance from list')           
    5100         self.SubstanceEdit.Append(id=G2G.wxID_ELEMENTADD, kind=wx.ITEM_NORMAL,text='Add elements',
    5101             help='Add elements to substance')
    5102         self.SubstanceEdit.Append(id=G2G.wxID_ELEMENTDELETE, kind=wx.ITEM_NORMAL,text='Delete elements',
    5103             help='Delete elements from substance')
     4912        self.SubstanceEdit.Append(G2G.wxID_LOADSUBSTANCE,'Load substance','Load substance from file')
     4913        self.SubstanceEdit.Append(G2G.wxID_RELOADSUBSTANCES,'Reload substances','Reload all substances from file')
     4914        self.SubstanceEdit.Append(G2G.wxID_ADDSUBSTANCE,'Add substance','Add new substance to list')
     4915        self.SubstanceEdit.Append(G2G.wxID_COPYSUBSTANCE,'Copy substances','Copy substances')
     4916        self.SubstanceEdit.Append(G2G.wxID_DELETESUBSTANCE,'Delete substance','Delete substance from list')           
     4917        self.SubstanceEdit.Append(G2G.wxID_ELEMENTADD,'Add elements','Add elements to substance')
     4918        self.SubstanceEdit.Append(G2G.wxID_ELEMENTDELETE,'Delete elements','Delete elements from substance')
    51044919        self.PostfillDataMenu()
    51054920       
     
    51114926        self.ModelEdit = wx.Menu(title='')
    51124927        self.ModelMenu.Append(menu=self.ModelEdit, title='Models')
    5113         self.ModelEdit.Append(id=G2G.wxID_MODELADD,kind=wx.ITEM_NORMAL,text='Add',
    5114             help='Add new term to model')
    5115         self.ModelEdit.Append(id=G2G.wxID_MODELFIT, kind=wx.ITEM_NORMAL,text='Fit',
    5116             help='Fit model parameters to data')
    5117         self.SasdUndo = self.ModelEdit.Append(id=G2G.wxID_MODELUNDO, kind=wx.ITEM_NORMAL,text='Undo',
    5118             help='Undo model fit')
     4928        self.ModelEdit.Append(G2G.wxID_MODELADD,'Add','Add new term to model')
     4929        self.ModelEdit.Append(G2G.wxID_MODELFIT,'Fit','Fit model parameters to data')
     4930        self.SasdUndo = self.ModelEdit.Append(G2G.wxID_MODELUNDO,'Undo','Undo model fit')
    51194931        self.SasdUndo.Enable(False)           
    5120         self.ModelEdit.Append(id=G2G.wxID_MODELFITALL, kind=wx.ITEM_NORMAL,text='Sequential fit',
    5121             help='Sequential fit of model parameters to all SASD data')
    5122         self.ModelEdit.Append(id=G2G.wxID_MODELCOPY, kind=wx.ITEM_NORMAL,text='Copy',
    5123             help='Copy model parameters to other histograms')
    5124         self.ModelEdit.Append(id=G2G.wxID_MODELCOPYFLAGS, kind=wx.ITEM_NORMAL,text='Copy flags',
    5125             help='Copy model refinement flags to other histograms')
     4932        self.ModelEdit.Append(G2G.wxID_MODELFITALL,'Sequential fit','Sequential fit of model parameters to all SASD data')
     4933        self.ModelEdit.Append(G2G.wxID_MODELCOPY,'Copy','Copy model parameters to other histograms')
     4934        self.ModelEdit.Append(G2G.wxID_MODELCOPYFLAGS,'Copy flags','Copy model refinement flags to other histograms')
    51264935        self.PostfillDataMenu()
    51274936       
     
    51314940        self.REFDModelEdit = wx.Menu(title='')
    51324941        self.REFDModelMenu.Append(menu=self.REFDModelEdit, title='Models')
    5133         self.REFDModelEdit.Append(id=G2G.wxID_MODELFIT, kind=wx.ITEM_NORMAL,text='Fit',
    5134             help='Fit model parameters to data')
    5135         self.REFDUndo = self.REFDModelEdit.Append(id=G2G.wxID_MODELUNDO, kind=wx.ITEM_NORMAL,text='Undo',
    5136             help='Undo model fit')
     4942        self.REFDModelEdit.Append(G2G.wxID_MODELFIT,'Fit','Fit model parameters to data')
     4943        self.REFDUndo = self.REFDModelEdit.Append(G2G.wxID_MODELUNDO,'Undo','Undo model fit')
    51374944        self.REFDUndo.Enable(False)           
    5138         self.REFDModelEdit.Append(id=G2G.wxID_MODELFITALL, kind=wx.ITEM_NORMAL,text='Sequential fit',
    5139             help='Sequential fit of model parameters to all REFD data')
    5140         self.REFDModelEdit.Append(id=G2G.wxID_MODELCOPY, kind=wx.ITEM_NORMAL,text='Copy',
    5141             help='Copy model parameters to other histograms')
    5142         self.REFDModelEdit.Append(id=G2G.wxID_MODELPLOT, kind=wx.ITEM_NORMAL,text='Plot',
    5143             help='Plot model SDL for selected histograms')
     4945        self.REFDModelEdit.Append(G2G.wxID_MODELFITALL,'Sequential fit','Sequential fit of model parameters to all REFD data')
     4946        self.REFDModelEdit.Append(G2G.wxID_MODELCOPY,'Copy','Copy model parameters to other histograms')
     4947        self.REFDModelEdit.Append(G2G.wxID_MODELPLOT,'Plot','Plot model SDL for selected histograms')
    51444948        self.PostfillDataMenu()
    51454949
     
    51524956        self.ImageEdit = wx.Menu(title='')
    51534957        self.ImageMenu.Append(menu=self.ImageEdit, title='Calibration')
    5154         self.ImageEdit.Append(help='Calibrate detector by fitting to calibrant lines',
    5155             id=G2G.wxID_IMCALIBRATE, kind=wx.ITEM_NORMAL,text='Calibrate')
    5156         self.ImageEdit.Append(help='Recalibrate detector by fitting to calibrant lines',
    5157             id=G2G.wxID_IMRECALIBRATE, kind=wx.ITEM_NORMAL,text='Recalibrate')
    5158         self.ImageEdit.Append(help='Recalibrate all images by fitting to calibrant lines',
    5159             id=G2G.wxID_IMRECALIBALL, kind=wx.ITEM_NORMAL,text='Recalibrate all')           
    5160         self.ImageEdit.Append(help='Clear calibration data points and rings',
    5161             id=G2G.wxID_IMCLEARCALIB, kind=wx.ITEM_NORMAL,text='Clear calibration')
     4958        self.ImageEdit.Append(G2G.wxID_IMCALIBRATE,'Calibrate','Calibrate detector by fitting to calibrant lines')
     4959        self.ImageEdit.Append(G2G.wxID_IMRECALIBRATE,'Recalibrate','Recalibrate detector by fitting to calibrant lines')
     4960        self.ImageEdit.Append(G2G.wxID_IMRECALIBALL,'Recalibrate all','Recalibrate all images by fitting to calibrant lines')
     4961        self.ImageEdit.Append(G2G.wxID_IMCLEARCALIB,'Clear calibration','Clear calibration data points and rings')
    51624962       
    51634963        ImageIntegrate = wx.Menu(title='')
    51644964        self.ImageMenu.Append(menu=ImageIntegrate, title='Integration')
    5165         ImageIntegrate.Append(help='Integrate selected image',id=G2G.wxID_IMINTEGRATE,
    5166             kind=wx.ITEM_NORMAL,text='Integrate')
    5167         ImageIntegrate.Append(help='Integrate all images selected from list',id=G2G.wxID_INTEGRATEALL,
    5168             kind=wx.ITEM_NORMAL,text='Integrate all')
    5169         ImageIntegrate.Append(help='Open Auto-integration window to integrate a series of images',
    5170             id=G2G.wxID_IMAUTOINTEG, kind=wx.ITEM_NORMAL,text='Auto Integrate')
     4965        ImageIntegrate.Append(G2G.wxID_IMINTEGRATE,'Integrate','Integrate selected image')
     4966        ImageIntegrate.Append(G2G.wxID_INTEGRATEALL,'Integrate all','Integrate all images selected from list')
     4967        ImageIntegrate.Append(G2G.wxID_IMAUTOINTEG,'Auto Integrate','Open Auto-integration window to integrate a series of images')
    51714968
    51724969        ImageParams = wx.Menu(title='')
    51734970        self.ImageMenu.Append(menu=ImageParams, title='Parms')
    5174         ImageParams.Append(help='Copy image controls to other images',
    5175             id=G2G.wxID_IMCOPYCONTROLS, kind=wx.ITEM_NORMAL,text='Copy Controls')
    5176         ImageParams.Append(help='Copy selected image controls to other images',
    5177             id=G2G.wxID_IMCOPYSELECTED, kind=wx.ITEM_NORMAL,text='Copy Selected')
    5178         ImageParams.Append(help='Save image controls to file',
    5179             id=G2G.wxID_IMSAVECONTROLS, kind=wx.ITEM_NORMAL,text='Save Controls')
    5180         ImageParams.Append(help='Save controls from selected images to file',
    5181             id=G2G.wxID_SAVESELECTEDCONTROLS, kind=wx.ITEM_NORMAL,text='Save Multiple Controls')
    5182         ImageParams.Append(help='Load image controls from file',
    5183             id=G2G.wxID_IMLOADCONTROLS, kind=wx.ITEM_NORMAL,text='Load Controls')
    5184         ImageParams.Append(help='Transfer integration range for other detector distances',
    5185             id=G2G.wxID_IMXFERCONTROLS, kind=wx.ITEM_NORMAL,text='Xfer angles')
    5186         ImageParams.Append(help='Reset all detector dist to set dist',
    5187             id=G2G.wxID_IMRESETDIST, kind=wx.ITEM_NORMAL,text='Reset dist')
     4971        ImageParams.Append(G2G.wxID_IMCOPYCONTROLS,'Copy Controls','Copy image controls to other images')
     4972        ImageParams.Append(G2G.wxID_IMCOPYSELECTED,'Copy Selected','Copy selected image controls to other images')
     4973        ImageParams.Append(G2G.wxID_IMSAVECONTROLS,'Save Controls','Save image controls to file')
     4974        ImageParams.Append(G2G.wxID_SAVESELECTEDCONTROLS,'Save Multiple Controls','Save controls from selected images to file')
     4975        ImageParams.Append(G2G.wxID_IMLOADCONTROLS,'Load Controls','Load image controls from file')
     4976        ImageParams.Append(G2G.wxID_IMXFERCONTROLS,'Xfer angles','Transfer integration range for other detector distances')
     4977        ImageParams.Append(G2G.wxID_IMRESETDIST,'Reset dist','Reset all detector dist to set dist')
    51884978        self.PostfillDataMenu()
    51894979           
     
    51964986        self.MaskMenu.Append(menu=self.MaskEdit, title='Operations')
    51974987        submenu = wx.Menu()
    5198         self.MaskEdit.AppendMenu(wx.ID_ANY,'Create new', submenu,help='')
    5199         self.MaskEdit.Append(help='Copy mask to other images',
    5200             id=G2G.wxID_MASKCOPY, kind=wx.ITEM_NORMAL,text='Copy mask')
    5201         self.MaskEdit.Append(help='Save mask to file',
    5202             id=G2G.wxID_MASKSAVE, kind=wx.ITEM_NORMAL,text='Save mask')
    5203         self.MaskEdit.Append(help='Load mask from file; ignoring threshold',
    5204             id=G2G.wxID_MASKLOADNOT, kind=wx.ITEM_NORMAL,text='Load mask')
    5205         self.MaskEdit.Append(help='Load mask from file keeping the threshold value',
    5206             id=G2G.wxID_MASKLOAD, kind=wx.ITEM_NORMAL,text='Load mask w/threshold')
    5207         self.MaskEdit.Append(help='Auto search for spot masks; NB: will clear old spot masks',
    5208             id=G2G.wxID_FINDSPOTS, kind=wx.ITEM_NORMAL,text='Auto spot masks')
    5209         self.MaskEdit.Append(help='Delete all spot masks',
    5210             id=G2G.wxID_DELETESPOTS, kind=wx.ITEM_NORMAL,text='Delete spot masks')       
    5211         submenu.Append(help='Create an arc mask with mouse input',
    5212             id=G2G.wxID_NEWMASKARC, kind=wx.ITEM_NORMAL,text='Arc mask')
    5213         submenu.Append(help='Create a frame mask with mouse input',
    5214             id=G2G.wxID_NEWMASKFRAME, kind=wx.ITEM_NORMAL,text='Frame mask')
    5215         submenu.Append(help='Create a polygon mask with mouse input',
    5216             id=G2G.wxID_NEWMASKPOLY, kind=wx.ITEM_NORMAL,text='Polygon mask')
    5217         submenu.Append(help='Create a ring mask with mouse input',
    5218             id=G2G.wxID_NEWMASKRING, kind=wx.ITEM_NORMAL,text='Ring mask')
    5219         submenu.Append(help='Create spot masks with mouse input',
    5220             id=G2G.wxID_NEWMASKSPOT, kind=wx.ITEM_NORMAL,text='Spot mask')
     4988        self.MaskEdit.AppendSubMenu( submenu,'Create new','')
     4989        self.MaskEdit.Append(G2G.wxID_MASKCOPY,'Copy mask','Copy mask to other images')
     4990        self.MaskEdit.Append(G2G.wxID_MASKSAVE,'Save mask','Save mask to file')
     4991        self.MaskEdit.Append(G2G.wxID_MASKLOADNOT,'Load mask','Load mask from file; ignoring threshold')
     4992        self.MaskEdit.Append(G2G.wxID_MASKLOAD,'Load mask w/threshold','Load mask from file keeping the threshold value')
     4993        self.MaskEdit.Append(G2G.wxID_FINDSPOTS,'Auto spot masks','Auto search for spot masks; NB: will clear old spot masks')
     4994        self.MaskEdit.Append(G2G.wxID_DELETESPOTS,'Delete spot masks','Delete all spot masks')
     4995        submenu.Append(G2G.wxID_NEWMASKARC,'Arc mask','Create an arc mask with mouse input')
     4996        submenu.Append(G2G.wxID_NEWMASKFRAME,'Frame mask','Create a frame mask with mouse input')
     4997        submenu.Append(G2G.wxID_NEWMASKPOLY,'Polygon mask','Create a polygon mask with mouse input')
     4998        submenu.Append(G2G.wxID_NEWMASKRING,'Ring mask','Create a ring mask with mouse input')
     4999        submenu.Append(G2G.wxID_NEWMASKSPOT,'Spot mask','Create spot masks with mouse input')
    52215000        self.PostfillDataMenu()
    52225001           
     
    52285007        self.StrStaEdit = wx.Menu(title='')
    52295008        self.StrStaMenu.Append(menu=self.StrStaEdit, title='Operations')
    5230         self.StrStaEdit.Append(help='Append d-zero for one ring',
    5231             id=G2G.wxID_APPENDDZERO, kind=wx.ITEM_NORMAL,text='Append d-zero')
    5232         self.StrStaEdit.Append(help='Fit stress/strain data',
    5233             id=G2G.wxID_STRSTAFIT, kind=wx.ITEM_NORMAL,text='Fit stress/strain')
    5234         self.StrStaEdit.Append(help='Plot intensity distribution',
    5235             id=G2G.wxID_STRSTAPLOT, kind=wx.ITEM_NORMAL,text='Plot intensity distribution')
    5236         self.StrStaEdit.Append(help='Save intensity distribution',
    5237             id=G2G.wxID_STRRINGSAVE, kind=wx.ITEM_NORMAL,text='Save intensity distribution')
    5238         self.StrStaEdit.Append(help='Update d-zero from ave d-zero',
    5239             id=G2G.wxID_UPDATEDZERO, kind=wx.ITEM_NORMAL,text='Update d-zero')       
    5240         self.StrStaEdit.Append(help='Fit stress/strain data for all images',
    5241             id=G2G.wxID_STRSTAALLFIT, kind=wx.ITEM_NORMAL,text='All image fit')
    5242         self.StrStaEdit.Append(help='Copy stress/strain data to other images',
    5243             id=G2G.wxID_STRSTACOPY, kind=wx.ITEM_NORMAL,text='Copy stress/strain')
    5244         self.StrStaEdit.Append(help='Save stress/strain data to file',
    5245             id=G2G.wxID_STRSTASAVE, kind=wx.ITEM_NORMAL,text='Save stress/strain')
    5246         self.StrStaEdit.Append(help='Load stress/strain data from file',
    5247             id=G2G.wxID_STRSTALOAD, kind=wx.ITEM_NORMAL,text='Load stress/strain')
    5248         self.StrStaEdit.Append(help='Load sample data from file',
    5249             id=G2G.wxID_STRSTSAMPLE, kind=wx.ITEM_NORMAL,text='Load sample data')
     5009        self.StrStaEdit.Append(G2G.wxID_APPENDDZERO,'Append d-zero','Append d-zero for one ring')
     5010        self.StrStaEdit.Append(G2G.wxID_STRSTAFIT,'Fit stress/strain','Fit stress/strain data')
     5011        self.StrStaEdit.Append(G2G.wxID_STRSTAPLOT,'Plot intensity distribution','Plot intensity distribution')
     5012        self.StrStaEdit.Append(G2G.wxID_STRRINGSAVE,'Save intensity distribution','Save intensity distribution')
     5013        self.StrStaEdit.Append(G2G.wxID_UPDATEDZERO,'Update d-zero','Update d-zero from ave d-zero')       
     5014        self.StrStaEdit.Append(G2G.wxID_STRSTAALLFIT,'All image fit','Fit stress/strain data for all images')
     5015        self.StrStaEdit.Append(G2G.wxID_STRSTACOPY,'Copy stress/strain','Copy stress/strain data to other images')
     5016        self.StrStaEdit.Append(G2G.wxID_STRSTASAVE,'Save stress/strain','Save stress/strain data to file')
     5017        self.StrStaEdit.Append(G2G.wxID_STRSTALOAD,'Load stress/strain','Load stress/strain data from file')
     5018        self.StrStaEdit.Append(G2G.wxID_STRSTSAMPLE,'Load sample data','Load sample data from file')
    52505019        self.PostfillDataMenu()
    52515020           
     
    52575026        self.PDFEdit = wx.Menu(title='')
    52585027        self.PDFMenu.Append(menu=self.PDFEdit, title='PDF Controls')
    5259         self.PDFEdit.Append(help='Add one or more elements to sample composition',id=G2G.wxID_PDFADDELEMENT, kind=wx.ITEM_NORMAL,
    5260             text='Add elements')
    5261         self.PDFEdit.Append(help='Delete element from sample composition',id=G2G.wxID_PDFDELELEMENT, kind=wx.ITEM_NORMAL,
    5262             text='Delete element')
    5263         self.PDFEdit.Append(help='Copy PDF controls', id=G2G.wxID_PDFCOPYCONTROLS, kind=wx.ITEM_NORMAL,
    5264             text='Copy controls')
    5265         self.PDFEdit.Append(help='Load PDF controls from file',id=G2G.wxID_PDFLOADCONTROLS, kind=wx.ITEM_NORMAL,
    5266             text='Load Controls')
    5267         self.PDFEdit.Append(help='Save PDF controls to file', id=G2G.wxID_PDFSAVECONTROLS, kind=wx.ITEM_NORMAL,
    5268             text='Save controls')
    5269         self.PDFEdit.Append(help='Compute PDF', id=G2G.wxID_PDFCOMPUTE, kind=wx.ITEM_NORMAL,
    5270             text='Compute PDF')
    5271         self.PDFEdit.Append(help='Compute all PDFs with or w/o optimization',
    5272             id=G2G.wxID_PDFCOMPUTEALL, kind=wx.ITEM_NORMAL,
    5273             text='Compute all PDFs')
     5028        self.PDFEdit.Append(G2G.wxID_PDFADDELEMENT,'Add elements','Add one or more elements to sample composition')
     5029        self.PDFEdit.Append(G2G.wxID_PDFDELELEMENT,'Delete element','Delete element from sample composition')
     5030        self.PDFEdit.Append(G2G.wxID_PDFCOPYCONTROLS,'Copy controls','Copy PDF controls')
     5031        self.PDFEdit.Append(G2G.wxID_PDFLOADCONTROLS,'Load Controls','Load PDF controls from file')
     5032        self.PDFEdit.Append(G2G.wxID_PDFSAVECONTROLS,'Save controls','Save PDF controls to file')
     5033        self.PDFEdit.Append(G2G.wxID_PDFCOMPUTE,'Compute PDF','Compute PDF')
     5034        self.PDFEdit.Append(G2G.wxID_PDFCOMPUTEALL,'Compute all PDFs','Compute all PDFs with or w/o optimization')
    52745035        self.PostfillDataMenu()
    52755036       
     
    52805041        self.PDFPksEdit = wx.Menu(title='')
    52815042        self.PDFPksMenu.Append(menu=self.PDFPksEdit, title='PDF Peaks')
    5282         self.PDFPksEdit.Append(help='Fit PDF peaks', id=G2G.wxID_PDFPKSFIT, kind=wx.ITEM_NORMAL,
    5283             text='PDF peak fit')
    5284         self.PDFPksEdit.Append(help='Sequential Peak fitting for all PDFs', id=G2G.wxID_PDFPKSFITALL, kind=wx.ITEM_NORMAL,
    5285             text='Seq PDF peak fit')
    5286         self.PDFPksEdit.Append(help='Copy PDF peaks', id=G2G.wxID_PDFCOPYPEAKS, kind=wx.ITEM_NORMAL,
    5287             text='Copy peaks')
    5288         self.PDFPksEdit.Append(help='Clear PDF peaks', id=G2G.wxID_CLEARPDFPEAKS, kind=wx.ITEM_NORMAL,
    5289             text='Clear peaks')       
     5043        self.PDFPksEdit.Append(G2G.wxID_PDFPKSFIT,'PDF peak fit','Fit PDF peaks')
     5044        self.PDFPksEdit.Append(G2G.wxID_PDFPKSFITALL,'Seq PDF peak fit','Sequential Peak fitting for all PDFs')
     5045        self.PDFPksEdit.Append(G2G.wxID_PDFCOPYPEAKS,'Copy peaks','Copy PDF peaks')
     5046        self.PDFPksEdit.Append(G2G.wxID_CLEARPDFPEAKS,'Clear peaks','Clear PDF peaks')       
    52905047        self.PostfillDataMenu()
    52915048
     
    52985055        self.GeneralCalc = wx.Menu(title='')
    52995056        self.DataGeneral.Append(menu=self.GeneralCalc,title='Compute')
    5300         self.GeneralCalc.Append(help='Compute Fourier map',id=G2G.wxID_FOURCALC, kind=wx.ITEM_NORMAL,
    5301             text='Fourier map')
    5302         self.GeneralCalc.Append(help='Search Fourier map',id=G2G.wxID_FOURSEARCH, kind=wx.ITEM_NORMAL,
    5303             text='Search map')
    5304         self.GeneralCalc.Append(help='Run charge flipping',id=G2G.wxID_CHARGEFLIP, kind=wx.ITEM_NORMAL,
    5305             text='Charge flipping')
    5306         self.GeneralCalc.Append(help='Run 4D charge flipping',id=G2G.wxID_4DCHARGEFLIP, kind=wx.ITEM_NORMAL,
    5307             text='4D Charge flipping')
     5057        self.GeneralCalc.Append(G2G.wxID_FOURCALC,'Fourier map','Compute Fourier map',)
     5058        self.GeneralCalc.Append(G2G.wxID_FOURSEARCH,'Search map','Search Fourier map')
     5059        self.GeneralCalc.Append(G2G.wxID_CHARGEFLIP,'Charge flipping','Run charge flipping')
     5060        self.GeneralCalc.Append(G2G.wxID_4DCHARGEFLIP,'4D Charge flipping','Run 4D charge flipping')
    53085061        self.GeneralCalc.Enable(G2G.wxID_4DCHARGEFLIP,False)   
    5309         self.GeneralCalc.Append(help='Clear map',id=G2G.wxID_FOURCLEAR, kind=wx.ITEM_NORMAL,
    5310             text='Clear map')
    5311         self.GeneralCalc.Append(help='Run Monte Carlo - Simulated Annealing',id=G2G.wxID_SINGLEMCSA, kind=wx.ITEM_NORMAL,
    5312             text='MC/SA')
    5313         self.GeneralCalc.Append(help='Run Monte Carlo - Simulated Annealing on multiprocessors',id=G2G.wxID_MULTIMCSA, kind=wx.ITEM_NORMAL,
    5314             text='Multi MC/SA')            #currently not useful
    5315         self.GeneralCalc.Append(help='Transform crystal structure',id=G2G.wxID_TRANSFORMSTRUCTURE, kind=wx.ITEM_NORMAL,
    5316             text='Transform')
     5062        self.GeneralCalc.Append(G2G.wxID_FOURCLEAR,'Clear map','Clear map')
     5063        self.GeneralCalc.Append(G2G.wxID_SINGLEMCSA,'MC/SA','Run Monte Carlo - Simulated Annealing')
     5064        self.GeneralCalc.Append(G2G.wxID_MULTIMCSA,'Multi MC/SA','Run Monte Carlo - Simulated Annealing on multiprocessors')
     5065        self.GeneralCalc.Append(G2G.wxID_TRANSFORMSTRUCTURE,'Transform','Transform crystal structure')
    53175066        self.PostfillDataMenu()
    53185067       
     
    53255074        self.DataEdit = wx.Menu(title='')
    53265075        self.DataMenu.Append(menu=self.DataEdit, title='Edit Phase')
    5327         self.DataEdit.Append(id=G2G.wxID_DATACOPY, kind=wx.ITEM_NORMAL,text='Copy data',
    5328             help='Copy phase data to other histograms')
    5329         self.DataEdit.Append(id=G2G.wxID_DATACOPYFLAGS, kind=wx.ITEM_NORMAL,text='Copy flags',
    5330             help='Copy phase data flags to other histograms')
    5331         self.DataEdit.Append(id=G2G.wxID_DATASELCOPY, kind=wx.ITEM_NORMAL,text='Copy selected data',
    5332             help='Copy selected phase data to other histograms')
    5333         self.DataEdit.Append(id=G2G.wxID_DATAUSE, kind=wx.ITEM_NORMAL,text='Select used data',
    5334             help='Select all histograms to use')
    5335         self.DataEdit.Append(id=G2G.wxID_PWDRADD, kind=wx.ITEM_NORMAL,text='Add powder histograms',
    5336             help='Select new powder histograms to be used for this phase')
    5337         self.DataEdit.Append(id=G2G.wxID_HKLFADD, kind=wx.ITEM_NORMAL,text='Add single crystal histograms',
    5338             help='Select new single crystal histograms to be used for this phase')
    5339         self.DataEdit.Append(id=G2G.wxID_DATADELETE, kind=wx.ITEM_NORMAL,text='Remove histograms',
    5340             help='Remove histograms from use for this phase')
     5076        self.DataEdit.Append(G2G.wxID_DATACOPY,'Copy data','Copy phase data to other histograms')
     5077        self.DataEdit.Append(G2G.wxID_DATACOPYFLAGS,'Copy flags','Copy phase data flags to other histograms')
     5078        self.DataEdit.Append(G2G.wxID_DATASELCOPY,'Copy selected data','Copy selected phase data to other histograms')
     5079        self.DataEdit.Append(G2G.wxID_DATAUSE,'Select used data','Select all histograms to use')
     5080        self.DataEdit.Append(G2G.wxID_PWDRADD,'Add powder histograms','Select new powder histograms to be used for this phase')
     5081        self.DataEdit.Append(G2G.wxID_HKLFADD,'Add single crystal histograms','Select new single crystal histograms to be used for this phase')
     5082        self.DataEdit.Append(G2G.wxID_DATADELETE,'Remove histograms','Remove histograms from use for this phase')
    53415083        self.PostfillDataMenu()
    53425084           
     
    53565098        self.AtomsMenu.Append(menu=self.AtomCompute, title='Compute')
    53575099        submenu = wx.Menu()
    5358         self.AtomEdit.AppendMenu(wx.ID_ANY, 'On selected atoms...', submenu,
    5359             help='Set/Act on selected atoms')
    5360         submenu.Append(G2G.wxID_ATOMSSETSEL,help='Set refinement flags for selected atoms',
    5361             kind=wx.ITEM_NORMAL,text='Refine selected')
    5362         submenu.Append(id=G2G.wxID_ATOMSMODIFY, kind=wx.ITEM_NORMAL,text='Modify parameters',
    5363             help='Modify parameters values for all selected atoms')
    5364         submenu.Append(id=G2G.wxID_ATOMSEDITINSERT, kind=wx.ITEM_NORMAL,text='Insert atom',
    5365             help='Inserts an H atom before all selected atoms')
    5366         submenu.Append(id=G2G.wxID_ADDHATOM, kind=wx.ITEM_NORMAL,text='Calc H atoms',
    5367             help='Insert H atoms in expected bonding positions for selected atoms')
    5368         submenu.Append(id=G2G.wxID_ATOMSEDITDELETE, kind=wx.ITEM_NORMAL,text='Delete atom',
    5369             help='Delete selected atoms')
    5370         submenu.Append(id=G2G.wxID_ATOMSTRANSFORM, kind=wx.ITEM_NORMAL,text='Transform atoms',
    5371             help='Symmetry transform selected atoms')
    5372 #        self.AtomEdit.Append(id=G2G.wxID_ATOMSROTATE, kind=wx.ITEM_NORMAL,text='Rotate atoms',
    5373 #            help='Select atoms to rotate first')
    5374         submenu.Append(G2G.wxID_ATOMSSETALL,help='Set refinement flags for all atoms',
    5375             kind=wx.ITEM_NORMAL,text='Select All')
    5376        
    5377         self.AtomEdit.Append(id=G2G.wxID_ATOMSEDITADD, kind=wx.ITEM_NORMAL,text='Append atom',
    5378             help='Appended as an H atom')
    5379         self.AtomEdit.Append(id=G2G.wxID_ATOMSVIEWADD, kind=wx.ITEM_NORMAL,text='Append view point',
    5380             help='Appended as an H atom')
    5381         self.AtomEdit.Append(id=G2G.wxID_ATOMVIEWINSERT, kind=wx.ITEM_NORMAL,text='Insert view point',
    5382             help='Select atom row to insert before; inserted as an H atom')
    5383         self.AtomEdit.Append(id=G2G.wxID_UPDATEHATOM, kind=wx.ITEM_NORMAL,text='Update H atoms',
    5384             help='Update H atoms in standard positions')
    5385         self.AtomEdit.Append(id=G2G.wxID_ATOMMOVE, kind=wx.ITEM_NORMAL,text='Move selected atom to view point',
    5386             help='Select a single atom to be moved to view point in plot')
    5387         self.AtomEdit.Append(id=G2G.wxID_MAKEMOLECULE, kind=wx.ITEM_NORMAL,text='Assemble molecule',
    5388             help='Select a single atom to assemble as a molecule from scattered atom positions')
    5389         self.AtomEdit.Append(id=G2G.wxID_RELOADDRAWATOMS, kind=wx.ITEM_NORMAL,text='Reload draw atoms',
    5390             help='Reload atom drawing list')
     5100        self.AtomEdit.AppendSubMenu(submenu,'On selected atoms...','Set/Act on selected atoms')
     5101        submenu.Append(G2G.wxID_ATOMSSETSEL,'Refine selected','Set refinement flags for selected atoms')
     5102        submenu.Append(G2G.wxID_ATOMSMODIFY,'Modify parameters','Modify parameters values for all selected atoms')
     5103        submenu.Append(G2G.wxID_ATOMSEDITINSERT,'Insert atom','Inserts an H atom before all selected atoms')
     5104        submenu.Append(G2G.wxID_ADDHATOM,'Calc H atoms','Insert H atoms in expected bonding positions for selected atoms')
     5105        submenu.Append(G2G.wxID_ATOMSEDITDELETE,'Delete atom','Delete selected atoms')
     5106        submenu.Append(G2G.wxID_ATOMSTRANSFORM,'Transform atoms','Symmetry transform selected atoms')
     5107        submenu.Append(G2G.wxID_ATOMSSETALL,'Select All','Set refinement flags for all atoms')
     5108       
     5109        self.AtomEdit.Append(G2G.wxID_ATOMSEDITADD,'Append atom','Appended as an H atom')
     5110        self.AtomEdit.Append(G2G.wxID_ATOMSVIEWADD,'Append view point','Appended as an H atom')
     5111        self.AtomEdit.Append(G2G.wxID_ATOMVIEWINSERT,'Insert view point','Select atom row to insert before; inserted as an H atom')
     5112        self.AtomEdit.Append(G2G.wxID_UPDATEHATOM,'Update H atoms','Update H atoms in standard positions')
     5113        self.AtomEdit.Append(G2G.wxID_ATOMMOVE,'Move selected atom to view point','Select a single atom to be moved to view point in plot')
     5114        self.AtomEdit.Append(G2G.wxID_MAKEMOLECULE,'Assemble molecule','Select a single atom to assemble as a molecule from scattered atom positions')
     5115        self.AtomEdit.Append(G2G.wxID_RELOADDRAWATOMS,'Reload draw atoms','Reload atom drawing list')
    53915116        submenu = wx.Menu()
    5392         self.AtomEdit.AppendMenu(wx.ID_ANY, 'Reimport atoms', submenu,
    5393             help='Reimport atoms from file; sequence must match')
     5117        self.AtomEdit.AppendSubMenu(submenu,'Reimport atoms','Reimport atoms from file; sequence must match')
    53945118        # setup a cascade menu for the formats that have been defined
    53955119        self.ReImportMenuId = {}  # points to readers for each menu entry
    53965120        for reader in self.parent.GetTopLevelParent().ImportPhaseReaderlist:
    5397             item = submenu.Append(wx.ID_ANY,help=reader.longFormatName,
    5398                 kind=wx.ITEM_NORMAL,text='reimport coordinates from '+reader.formatName+' file')
     5121            item = submenu.Append(wx.ID_ANY,'reimport coordinates from '+reader.formatName+' file',reader.longFormatName)
    53995122            self.ReImportMenuId[item.GetId()] = reader
    5400         item = submenu.Append(wx.ID_ANY,help='Reimport coordinates, try to determine format from file',
    5401             kind=wx.ITEM_NORMAL,text='guess format from file')
     5123        item = submenu.Append(wx.ID_ANY,'guess format from file','Reimport coordinates, try to determine format from file')
    54025124        self.ReImportMenuId[item.GetId()] = None # try all readers
    5403         self.AtomCompute.Append(id=G2G.wxID_ATOMSDISAGL, kind=wx.ITEM_NORMAL,text='Show Distances && Angles',
    5404             help='Compute distances & angles for selected atoms')
    5405         self.AtomCompute.Append(id=G2G.wxID_ATOMSPDISAGL, kind=wx.ITEM_NORMAL,text='Save Distances && Angles',
    5406             help='Compute distances & angles for selected atoms')
    5407         self.AtomCompute.Append(id=G2G.wxID_ATOMSDENSITY, kind=wx.ITEM_NORMAL,
    5408             text='Density',help='Compute density for current phase')
    5409         self.AtomCompute.Append(id=G2G.wxID_VALIDPROTEIN, kind=wx.ITEM_NORMAL,
    5410             text='Protein quality',help='Protein quality analysis')
    5411         self.AtomCompute.ISOcalc = self.AtomCompute.Append(id=G2G.wxID_ISODISP, kind=wx.ITEM_NORMAL,
    5412             text='ISODISTORT mode values',help='Compute values of ISODISTORT modes from atom parameters')
     5125        self.AtomCompute.Append(G2G.wxID_ATOMSDISAGL,'Show Distances && Angles','Compute distances & angles for selected atoms')
     5126        self.AtomCompute.Append(G2G.wxID_ATOMSPDISAGL,'Save Distances && Angles','Compute distances & angles for selected atoms')
     5127        self.AtomCompute.Append(G2G.wxID_ATOMSDENSITY,'Density','Compute density for current phase')
     5128        self.AtomCompute.Append(G2G.wxID_VALIDPROTEIN,'Protein quality','Protein quality analysis')
     5129        self.AtomCompute.ISOcalc = self.AtomCompute.Append(G2G.wxID_ISODISP,'ISODISTORT mode values',
     5130            'Compute values of ISODISTORT modes from atom parameters')
    54135131       
    54145132        self.PostfillDataMenu()
     
    54215139        self.WavesDataEdit = wx.Menu(title='')
    54225140        self.WavesData.Append(menu=self.WavesDataEdit, title='Edit Wave')
    5423         self.WavesDataEdit.Append(id=G2G.wxID_WAVEVARY, kind=wx.ITEM_NORMAL,text='Global wave vary',
    5424             help='Global setting of wave vary flags')
     5141        self.WavesDataEdit.Append(G2G.wxID_WAVEVARY,'Global wave vary','Global setting of wave vary flags')
    54255142        self.PostfillDataMenu()
    54265143       
     
    54325149        self.LayerDataEdit = wx.Menu(title='')
    54335150        self.LayerData.Append(menu=self.LayerDataEdit, title='Operations')
    5434         self.LayerDataEdit.Append(id=G2G.wxID_LOADDIFFAX, kind=wx.ITEM_NORMAL,text='Load from DIFFaX file',
    5435             help='Load layer info from DIFFaX file')
    5436         self.LayerDataEdit.Append(id=G2G.wxID_COPYPHASE, kind=wx.ITEM_NORMAL,text='Copy phase cell',
    5437             help='Copy phase cell from another project')
    5438         self.LayerDataEdit.Append(id=G2G.wxID_LAYERSIMULATE, kind=wx.ITEM_NORMAL,text='Simulate pattern',
    5439             help='Simulate diffraction pattern from layer stacking')
    5440         self.LayerDataEdit.Append(id=G2G.wxID_LAYERSFIT, kind=wx.ITEM_NORMAL,text='Fit pattern',
    5441             help='Fit diffraction pattern with layer stacking model')
    5442         self.LayerDataEdit.Append(id=G2G.wxID_SEQUENCESIMULATE, kind=wx.ITEM_NORMAL,text='Sequence simulations',
    5443             help='Sequence simulation changing one parameter')
     5151        self.LayerDataEdit.Append(G2G.wxID_LOADDIFFAX,'Load from DIFFaX file','Load layer info from DIFFaX file')
     5152        self.LayerDataEdit.Append(G2G.wxID_COPYPHASE,'Copy phase cell','Copy phase cell from another project')
     5153        self.LayerDataEdit.Append(G2G.wxID_LAYERSIMULATE,'Simulate pattern','Simulate diffraction pattern from layer stacking')
     5154        self.LayerDataEdit.Append(G2G.wxID_LAYERSFIT,'Fit pattern','Fit diffraction pattern with layer stacking model')
     5155        self.LayerDataEdit.Append(G2G.wxID_SEQUENCESIMULATE,'Sequence simulations','Sequence simulation changing one parameter')
    54445156        self.PostfillDataMenu()
    54455157                 
     
    54675179        self.DrawAtomsMenu.Append(menu=self.DrawAtomRestraint, title='Restraints')
    54685180        self.DrawAtomsMenu.Append(menu=self.DrawAtomRigidBody, title='Rigid body')
    5469         self.DrawAtomEdit.Append(id=G2G.wxID_DRAWATOMSTYLE, kind=wx.ITEM_NORMAL,text='Atom style',
    5470             help='Select atoms first')
    5471         self.DrawAtomEdit.Append(id=G2G.wxID_DRAWATOMLABEL, kind=wx.ITEM_NORMAL,text='Atom label',
    5472             help='Select atoms first')
    5473         self.DrawAtomEdit.Append(id=G2G.wxID_DRAWATOMCOLOR, kind=wx.ITEM_NORMAL,text='Atom color',
    5474             help='Select atoms first')
    5475         self.DrawAtomEdit.Append(id=G2G.wxID_DRAWATOMRESETCOLOR, kind=wx.ITEM_NORMAL,text='Reset atom colors',
    5476             help='Resets all atom colors to defaults')
    5477         self.DrawAtomEdit.Append(id=G2G.wxID_DRWAEDITRADII, kind=wx.ITEM_NORMAL,text='Edit atom radii',
    5478             help='Edit drawing atom radii')
    5479         self.DrawAtomEdit.Append(id=G2G.wxID_DRAWVIEWPOINT, kind=wx.ITEM_NORMAL,text='View point',
    5480             help='View point is 1st atom selected')
    5481         self.DrawAtomEdit.Append(id=G2G.wxID_DRAWADDEQUIV, kind=wx.ITEM_NORMAL,text='Add atoms',
    5482             help='Add symmetry & cell equivalents to drawing set from selected atoms')
    5483         self.DrawAtomEdit.Append(id=G2G.wxID_DRAWADDSPHERE, kind=wx.ITEM_NORMAL,text='Add sphere of atoms',
    5484             help='Add atoms within sphere of enclosure')
    5485         self.DrawAtomEdit.Append(id=G2G.wxID_DRAWTRANSFORM, kind=wx.ITEM_NORMAL,text='Transform draw atoms',
    5486             help='Transform selected atoms by symmetry & cell translations')
    5487         self.DrawAtomEdit.Append(id=G2G.wxID_DRAWFILLCOORD, kind=wx.ITEM_NORMAL,text='Fill CN-sphere',
    5488             help='Fill coordination sphere for selected atoms')           
    5489         self.DrawAtomEdit.Append(id=G2G.wxID_DRAWFILLCELL, kind=wx.ITEM_NORMAL,text='Fill unit cell',
    5490             help='Fill unit cell with selected atoms')
    5491         self.DrawAtomEdit.Append(id=G2G.wxID_DRAWDELETE, kind=wx.ITEM_NORMAL,text='Delete atoms',
    5492             help='Delete atoms from drawing set')
    5493         self.DrawAtomCompute.Append(id=G2G.wxID_DRAWDISTVP, kind=wx.ITEM_NORMAL,text='View pt. dist.',
    5494             help='Compute distance of selected atoms from view point')   
    5495         self.DrawAtomCompute.Append(id=G2G.wxID_DRAWDISAGLTOR, kind=wx.ITEM_NORMAL,text='Dist. Ang. Tors.',
    5496             help='Compute distance, angle or torsion for 2-4 selected atoms')   
    5497         self.DrawAtomCompute.Append(id=G2G.wxID_DRAWPLANE, kind=wx.ITEM_NORMAL,text='Best plane',
    5498             help='Compute best plane for 4+ selected atoms')   
    5499         self.DrawAtomRestraint.Append(id=G2G.wxID_DRAWRESTRBOND, kind=wx.ITEM_NORMAL,text='Add bond restraint',
    5500             help='Add bond restraint for selected atoms (2)')
    5501         self.DrawAtomRestraint.Append(id=G2G.wxID_DRAWRESTRANGLE, kind=wx.ITEM_NORMAL,text='Add angle restraint',
    5502             help='Add angle restraint for selected atoms (3: one end 1st)')
    5503         self.DrawAtomRestraint.Append(id=G2G.wxID_DRAWRESTRPLANE, kind=wx.ITEM_NORMAL,text='Add plane restraint',
    5504             help='Add plane restraint for selected atoms (4+)')
    5505         self.DrawAtomRestraint.Append(id=G2G.wxID_DRAWRESTRCHIRAL, kind=wx.ITEM_NORMAL,text='Add chiral restraint',
    5506             help='Add chiral restraint for selected atoms (4: center atom 1st)')
    5507         self.DrawAtomRigidBody.Append(id=G2G.wxID_DRAWDEFINERB, kind=wx.ITEM_NORMAL,text='Define rigid body',
    5508             help='Define rigid body with selected atoms')
     5181        self.DrawAtomEdit.Append(G2G.wxID_DRAWATOMSTYLE,'Atom style','Select atoms first')
     5182        self.DrawAtomEdit.Append(G2G.wxID_DRAWATOMLABEL,'Atom label','Select atoms first')
     5183        self.DrawAtomEdit.Append(G2G.wxID_DRAWATOMCOLOR,'Atom color','Select atoms first')
     5184        self.DrawAtomEdit.Append(G2G.wxID_DRAWATOMRESETCOLOR,'Reset atom colors','Resets all atom colors to defaults')
     5185        self.DrawAtomEdit.Append(G2G.wxID_DRWAEDITRADII,'Edit atom radii','Edit drawing atom radii')
     5186        self.DrawAtomEdit.Append(G2G.wxID_DRAWVIEWPOINT,'View point','View point is 1st atom selected')
     5187        self.DrawAtomEdit.Append(G2G.wxID_DRAWADDEQUIV,'Add atoms','Add symmetry & cell equivalents to drawing set from selected atoms')
     5188        self.DrawAtomEdit.Append(G2G.wxID_DRAWADDSPHERE,'Add sphere of atoms','Add atoms within sphere of enclosure')
     5189        self.DrawAtomEdit.Append(G2G.wxID_DRAWTRANSFORM,'Transform draw atoms','Transform selected atoms by symmetry & cell translations')
     5190        self.DrawAtomEdit.Append(G2G.wxID_DRAWFILLCOORD,'Fill CN-sphere','Fill coordination sphere for selected atoms')           
     5191        self.DrawAtomEdit.Append(G2G.wxID_DRAWFILLCELL,'Fill unit cell','Fill unit cell with selected atoms')
     5192        self.DrawAtomEdit.Append(G2G.wxID_DRAWDELETE,'Delete atoms','Delete atoms from drawing set')
     5193        self.DrawAtomCompute.Append(G2G.wxID_DRAWDISTVP,'View pt. dist.','Compute distance of selected atoms from view point')   
     5194        self.DrawAtomCompute.Append(G2G.wxID_DRAWDISAGLTOR,'Dist. Ang. Tors.',
     5195            'Compute distance, angle or torsion for 2-4 selected atoms')   
     5196        self.DrawAtomCompute.Append(G2G.wxID_DRAWPLANE,'Best plane','Compute best plane for 4+ selected atoms')   
     5197        self.DrawAtomRestraint.Append(G2G.wxID_DRAWRESTRBOND,'Add bond restraint','Add bond restraint for selected atoms (2)')
     5198        self.DrawAtomRestraint.Append(G2G.wxID_DRAWRESTRANGLE,'Add angle restraint',
     5199            'Add angle restraint for selected atoms (3: one end 1st)')
     5200        self.DrawAtomRestraint.Append(G2G.wxID_DRAWRESTRPLANE,'Add plane restraint',
     5201            'Add plane restraint for selected atoms (4+)')
     5202        self.DrawAtomRestraint.Append(G2G.wxID_DRAWRESTRCHIRAL,'Add chiral restraint',
     5203            'Add chiral restraint for selected atoms (4: center atom 1st)')
     5204        self.DrawAtomRigidBody.Append(G2G.wxID_DRAWDEFINERB,'Define rigid body','Define rigid body with selected atoms')
    55095205        self.PostfillDataMenu()
    55105206
     
    55165212        self.MCSAEdit = wx.Menu(title='')
    55175213        self.MCSAMenu.Append(menu=self.MCSAEdit, title='MC/SA')
    5518         self.MCSAEdit.Append(id=G2G.wxID_ADDMCSAATOM, kind=wx.ITEM_NORMAL,text='Add atom',
    5519             help='Add single atom to MC/SA model')
    5520         self.MCSAEdit.Append(id=G2G.wxID_ADDMCSARB, kind=wx.ITEM_NORMAL,text='Add rigid body',
    5521             help='Add rigid body to MC/SA model' )
    5522         self.MCSAEdit.Append(id=G2G.wxID_CLEARMCSARB, kind=wx.ITEM_NORMAL,text='Clear rigid bodies',
    5523             help='Clear all atoms & rigid bodies from MC/SA model' )
    5524         self.MCSAEdit.Append(id=G2G.wxID_MOVEMCSA, kind=wx.ITEM_NORMAL,text='Move MC/SA solution',
    5525             help='Move MC/SA solution to atom list' )
    5526         self.MCSAEdit.Append(id=G2G.wxID_MCSACLEARRESULTS, kind=wx.ITEM_NORMAL,text='Clear results',
    5527             help='Clear table of MC/SA results' )
     5214        self.MCSAEdit.Append(G2G.wxID_ADDMCSAATOM,'Add atom','Add single atom to MC/SA model')
     5215        self.MCSAEdit.Append(G2G.wxID_ADDMCSARB,'Add rigid body','Add rigid body to MC/SA model' )
     5216        self.MCSAEdit.Append(G2G.wxID_CLEARMCSARB,'Clear rigid bodies','Clear all atoms & rigid bodies from MC/SA model' )
     5217        self.MCSAEdit.Append(G2G.wxID_MOVEMCSA,'Move MC/SA solution','Move MC/SA solution to atom list' )
     5218        self.MCSAEdit.Append(G2G.wxID_MCSACLEARRESULTS,'Clear results','Clear table of MC/SA results' )
    55285219        self.PostfillDataMenu()
    55295220           
     
    55355226        self.TextureEdit = wx.Menu(title='')
    55365227        self.TextureMenu.Append(menu=self.TextureEdit, title='Texture')
    5537         self.TextureEdit.Append(id=G2G.wxID_REFINETEXTURE, kind=wx.ITEM_NORMAL,text='Refine texture',
    5538             help='Refine the texture coefficients from sequential results')
    5539 #        self.TextureEdit.Append(id=G2G.wxID_CLEARTEXTURE, kind=wx.ITEM_NORMAL,text='Clear texture',
    5540 #            help='Clear the texture coefficients' )
     5228        self.TextureEdit.Append(G2G.wxID_REFINETEXTURE,'Refine texture','Refine the texture coefficients from sequential results')
    55415229        self.PostfillDataMenu()
    55425230           
     
    55495237        self.PawleyEdit = wx.Menu(title='')
    55505238        self.PawleyMenu.Append(menu=self.PawleyEdit,title='Operations')
    5551         self.PawleyEdit.Append(id=G2G.wxID_PAWLEYSET, kind=wx.ITEM_NORMAL,text='Pawley settings',
    5552             help='Change Pawley refinement settings')
    5553         self.PawleyEdit.Append(id=G2G.wxID_PAWLEYLOAD, kind=wx.ITEM_NORMAL,text='Pawley create',
    5554             help='Initialize Pawley reflection list')
    5555         self.PawleyEdit.Append(id=G2G.wxID_PAWLEYESTIMATE, kind=wx.ITEM_NORMAL,text='Pawley estimate',
    5556             help='Estimate initial Pawley intensities')
    5557         self.PawleyEdit.Append(id=G2G.wxID_PAWLEYUPDATE, kind=wx.ITEM_NORMAL,text='Pawley update',
    5558             help='Update negative Pawley intensities with -0.5*Fobs and turn off refinement')
    5559         self.PawleyEdit.Append(id=G2G.wxID_PAWLEYSELALL, kind=wx.ITEM_NORMAL,text='Select all',
    5560             help='Select all reflections to be refined')
    5561         self.PawleyEdit.Append(id=G2G.wxID_PAWLEYSELNONE, kind=wx.ITEM_NORMAL,text='Select none',
    5562             help='Set flag for all reflections for no refinement')
    5563         self.PawleyEdit.Append(id=G2G.wxID_PAWLEYSELTOGGLE, kind=wx.ITEM_NORMAL,text='Toggle Selection',
    5564             help='Toggle Selection flag for all reflections to opposite setting')
     5239        self.PawleyEdit.Append(G2G.wxID_PAWLEYSET,'Pawley settings','Change Pawley refinement settings')
     5240        self.PawleyEdit.Append(G2G.wxID_PAWLEYLOAD,'Pawley create','Initialize Pawley reflection list')
     5241        self.PawleyEdit.Append(G2G.wxID_PAWLEYESTIMATE,'Pawley estimate','Estimate initial Pawley intensities')
     5242        self.PawleyEdit.Append(G2G.wxID_PAWLEYUPDATE,'Pawley update','Update negative Pawley intensities with -0.5*Fobs and turn off refinement')
     5243        self.PawleyEdit.Append(G2G.wxID_PAWLEYSELALL,'Select all','Select all reflections to be refined')
     5244        self.PawleyEdit.Append(G2G.wxID_PAWLEYSELNONE,'Select none','Set flag for all reflections for no refinement')
     5245        self.PawleyEdit.Append(G2G.wxID_PAWLEYSELTOGGLE,'Toggle Selection','Toggle Selection flag for all reflections to opposite setting')
    55655246        self.PostfillDataMenu()
    55665247           
     
    55735254        self.MapPeaksEdit = wx.Menu(title='')
    55745255        self.MapPeaksMenu.Append(menu=self.MapPeaksEdit, title='Map peaks')
    5575         self.MapPeaksEdit.Append(id=G2G.wxID_PEAKSMOVE, kind=wx.ITEM_NORMAL,text='Move peaks',
    5576             help='Move selected peaks to atom list')
    5577         self.MapPeaksEdit.Append(id=G2G.wxID_PEAKSVIEWPT, kind=wx.ITEM_NORMAL,text='View point',
    5578             help='View point is 1st peak selected')
    5579         self.MapPeaksEdit.Append(id=G2G.wxID_PEAKSDISTVP, kind=wx.ITEM_NORMAL,text='View pt. dist.',
    5580             help='Compute distance of selected peaks from view point')   
    5581         self.MapPeaksEdit.Append(id=G2G.wxID_SHOWBONDS, kind=wx.ITEM_NORMAL,text='Hide bonds',
    5582             help='Hide or show bonds between peak positions')   
    5583         self.MapPeaksEdit.Append(id=G2G.wxID_PEAKSDA, kind=wx.ITEM_NORMAL,text='Calc dist/ang',
    5584             help='Calculate distance or angle for selection')
    5585         self.MapPeaksEdit.Append(id=G2G.wxID_FINDEQVPEAKS, kind=wx.ITEM_NORMAL,text='Equivalent peaks',
    5586             help='Find equivalent peaks')
    5587         self.MapPeaksEdit.Append(id=G2G.wxID_PEAKSUNIQUE, kind=wx.ITEM_NORMAL,text='Unique peaks',
    5588             help='Select unique set')
    5589         self.MapPeaksEdit.Append(id=G2G.wxID_PEAKSDELETE, kind=wx.ITEM_NORMAL,text='Delete peaks',
    5590             help='Delete selected peaks')
    5591         self.MapPeaksEdit.Append(id=G2G.wxID_PEAKSCLEAR, kind=wx.ITEM_NORMAL,text='Clear peaks',
    5592             help='Clear the map peak list')
     5256        self.MapPeaksEdit.Append(G2G.wxID_PEAKSMOVE,'Move peaks','Move selected peaks to atom list')
     5257        self.MapPeaksEdit.Append(G2G.wxID_PEAKSVIEWPT,'View point','View point is 1st peak selected')
     5258        self.MapPeaksEdit.Append(G2G.wxID_PEAKSDISTVP,'View pt. dist.','Compute distance of selected peaks from view point')   
     5259        self.MapPeaksEdit.Append(G2G.wxID_SHOWBONDS,'Hide bonds','Hide or show bonds between peak positions')   
     5260        self.MapPeaksEdit.Append(G2G.wxID_PEAKSDA,'Calc dist/ang','Calculate distance or angle for selection')
     5261        self.MapPeaksEdit.Append(G2G.wxID_FINDEQVPEAKS,'Equivalent peaks','Find equivalent peaks')
     5262        self.MapPeaksEdit.Append(G2G.wxID_PEAKSUNIQUE,'Unique peaks','Select unique set')
     5263        self.MapPeaksEdit.Append(G2G.wxID_PEAKSDELETE,'Delete peaks','Delete selected peaks')
     5264        self.MapPeaksEdit.Append(G2G.wxID_PEAKSCLEAR,'Clear peaks','Clear the map peak list')
    55935265        self.PostfillDataMenu()
    55945266
     
    56025274        self.RigidBodiesEdit = wx.Menu(title='')
    56035275        self.RigidBodiesMenu.Append(menu=self.RigidBodiesEdit, title='Edit Body')
    5604         self.RigidBodiesEdit.Append(id=G2G.wxID_ASSIGNATMS2RB, kind=wx.ITEM_NORMAL,text='Assign atoms to rigid body',
    5605             help='Select & position rigid body in structure of existing atoms')
    5606         self.RigidBodiesEdit.Append(id=G2G.wxID_AUTOFINDRESRB, kind=wx.ITEM_NORMAL,text='Auto find residues',
    5607             help='Auto find of residue RBs in macromolecule')
    5608         self.RigidBodiesEdit.Append(id=G2G.wxID_COPYRBPARMS, kind=wx.ITEM_NORMAL,text='Copy rigid body parms',
    5609             help='Copy rigid body location & TLS parameters')
    5610         self.RigidBodiesEdit.Append(id=G2G.wxID_GLOBALTHERM, kind=wx.ITEM_NORMAL,text='Global thermal motion',
    5611             help='Global setting of residue thermal motion models')
    5612         self.RigidBodiesEdit.Append(id=G2G.wxID_GLOBALRESREFINE, kind=wx.ITEM_NORMAL,text='Global residue refine',
    5613             help='Global setting of residue RB refinement flags')
    5614         self.RigidBodiesEdit.Append(id=G2G.wxID_RBREMOVEALL, kind=wx.ITEM_NORMAL,text='Remove all rigid bodies',
    5615             help='Remove all rigid body assignment for atoms')
     5276        self.RigidBodiesEdit.Append(G2G.wxID_ASSIGNATMS2RB,'Assign atoms to rigid body',
     5277            'Select & position rigid body in structure of existing atoms')
     5278        self.RigidBodiesEdit.Append(G2G.wxID_AUTOFINDRESRB,'Auto find residues',
     5279            'Auto find of residue RBs in macromolecule')
     5280        self.RigidBodiesEdit.Append(G2G.wxID_COPYRBPARMS,'Copy rigid body parms',
     5281            'Copy rigid body location & TLS parameters')
     5282        self.RigidBodiesEdit.Append(G2G.wxID_GLOBALTHERM,'Global thermal motion',
     5283            'Global setting of residue thermal motion models')
     5284        self.RigidBodiesEdit.Append(G2G.wxID_GLOBALRESREFINE,'Global residue refine',
     5285            'Global setting of residue RB refinement flags')
     5286        self.RigidBodiesEdit.Append(G2G.wxID_RBREMOVEALL,'Remove all rigid bodies',
     5287            'Remove all rigid body assignment for atoms')
    56165288        self.PostfillDataMenu()
    56175289    # end of GSAS-II menu definitions
    56185290   
    56195291       
    5620 #TODO - remove         
    5621 #    def _init_ctrls(self, parent,name=None,size=None,pos=None):
    5622 #        wx.Frame.__init__(
    5623 #            self,parent=parent,
    5624 #            #style=wx.DEFAULT_FRAME_STYLE ^ wx.CLOSE_BOX | wx.FRAME_FLOAT_ON_PARENT ,
    5625 #            style=wx.DEFAULT_FRAME_STYLE ^ wx.CLOSE_BOX,
    5626 #            size=size,pos=pos,title='GSAS-II data display')
    5627 #        self._init_menus()
    5628 #        if name:
    5629 #            self.SetLabel(name)
    5630 #        self.Show()
    5631 #
    5632 #    def __init__(self,parent,frame,data=None,name=None, size=None,pos=None):
    5633 #        self.G2frame = frame
    5634 #        self._init_ctrls(parent,name,size,pos)
    5635 #        self.data = data
    5636 #        clientSize = wx.ClientDisplayRect()
    5637 #        Size = self.GetSize()
    5638 #        xPos = clientSize[2]-Size[0]
    5639 #        self.SetPosition(wx.Point(xPos,clientSize[1]+250))
    5640 #        self.AtomGrid = []
    5641 #        self.selectedRow = 0
    5642 #        self.lastSize = Size       
    5643 #        self.manualPhaseSize = None
    5644 #        self.userReSize = False
    5645 #        wx.Frame.Bind(self,wx.EVT_SIZE,self.OnReSize)
    5646 #           
    5647 #    def OnReSize(self,event):
    5648 #        '''Keep track of size changes for Phase windows
    5649 #        '''
    5650 #        id = self.G2frame.GPXtree.GetSelection()
    5651 #        try:
    5652 #            parent = self.G2frame.GPXtree.GetItemParent(id)
    5653 #        except:         #avoid bad tree item on start via gpx file selection
    5654 #            parent = 0
    5655 #        if self.userReSize and parent and self.G2frame.GPXtree.GetItemText(parent) == "Phases":
    5656 #            newSize = event.EventObject.GetSize()
    5657 #            if newSize[1] < 200: return             #avois spurious small window after Refine
    5658 #            if self.lastSize == newSize:
    5659 ##                if GSASIIpath.GetConfigValue('debug'):
    5660 ##                    print 'no save size=',self.lastSize
    5661 #                return
    5662 #            self.manualPhaseSize = newSize
    5663 #            self.lastSize = event.EventObject.GetSize()
    5664 ##            if GSASIIpath.GetConfigValue('debug'):
    5665 ##                print 'Saving Phase size=',self.manualPhaseSize
    5666 #                #HowDidIgetHere()
    5667 #        event.Skip()
    5668 #
    5669 #    def SendSizeEvent(self):
    5670 #        '''Prevent SendSizeEvent from overriding the saved size
    5671 #        '''
    5672 #        self.userReSize = False
    5673 #        wx.Frame.SendSizeEvent(self)
    5674 #        self.userReSize = True
    5675 #               
    5676 #    def Clear(self):
    5677 #        self.ClearBackground()
    5678 #        self.DestroyChildren()
    56795292                   
    56805293################################################################################
     
    60705683                ave = ma.mean(ma.compressed(info))
    60715684                sig = ma.std(ma.compressed(info))
    6072                 print u' Average for '+G2frame.SeqTable.GetColLabelValue(col)+u': '+'%.6g'%(ave)+u' +/- '+u'%.6g'%(sig)
     5685                print (u' Average for '+G2frame.SeqTable.GetColLabelValue(col)+u': '+'%.6g'%(ave)+u' +/- '+u'%.6g'%(sig))
    60735686        else:
    60745687            G2frame.ErrorDialog('Select columns',
     
    62595872    def DelPseudoVar(event):
    62605873        'Ask the user to select a pseudo var expression to delete'
    6261         choices = data['SeqPseudoVars'].keys()
     5874        choices = list(data['SeqPseudoVars'].keys())
    62625875        selected = G2G.ItemSelector(
    62635876            choices,G2frame,
     
    62735886    def EditPseudoVar(event):
    62745887        'Edit an existing pseudo var expression'
    6275         choices = data['SeqPseudoVars'].keys()
     5888        choices = list(data['SeqPseudoVars'].keys())
    62765889        if len(choices) == 1:
    62775890            selected = 0
     
    65556168        values = varyValues = [varyValueDict[key] for key in varyList]
    65566169        if not varyList:
    6557             print 'no variables to refine!'
     6170            print ('no variables to refine!')
    65586171            return
    65596172        try:
     
    65736186            return
    65746187        print('==== Fit Results ====')
    6575         print '  chisq =  %.2f, GOF = %.2f'%(chisq,GOF)
     6188        print ('  chisq =  %.2f, GOF = %.2f'%(chisq,GOF))
    65766189        for obj in eqObjList:
    65776190            obj.UpdateVariedVars(varyList,values)
     
    67016314        '''
    67026315        if col < 0 or col > len(colLabels):
    6703             print 'Illegal column #',col
     6316            print ('Illegal column #%d'%col)
    67046317            return
    67056318        var = colLabels[col]
     
    67476360        r = event.GetRow()
    67486361        val = G2frame.SeqTable.GetValue(r,0)
    6749         print r,val
     6362#        print (r,val)
    67506363        G2frame.SeqTable.SetValue(r,0, val)
    67516364   
     
    67686381    #======================================================================
    67696382    if not data:
    6770         print 'No sequential refinement results'
     6383        print ('No sequential refinement results')
    67716384        return
    67726385    variableLabels = data.get('variableLabels',{})
     
    68806493                print(" Warning: "+name+" not found")
    68816494            elif missing == 5:
    6882                 print ' Warning: more are missing'
     6495                print (' Warning: more are missing')
    68836496            missing += 1
    68846497            continue
     
    69066519            VaryListChanges.append(name)
    69076520    if missing:
    6908         print ' Warning: Total of %d data sets missing from sequential results'%(missing)
     6521        print (' Warning: Total of %d data sets missing from sequential results'%(missing))
    69096522    #if len(VaryListChanges) > 1:
    69106523    #    G2frame.dataWindow.SequentialFile.Enable(G2G.wxID_ORGSEQSEL,True)
     
    70726685
    70736686    # add atom parameters to table
    7074     colLabels += atomLookup.keys()
     6687    colLabels += list(atomLookup.keys())
    70756688    for parm in sorted(atomLookup):
    70766689        G2frame.colList += [[data[name]['newAtomDict'][atomLookup[parm]][1] for name in histNames]]
     
    72006813            else:
    72016814                G2frame.dataDisplay.SetReadOnly(r,c,isReadOnly=False)
    7202     G2frame.dataDisplay.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange)
     6815    if 'phoenix' in wx.version():
     6816        G2frame.dataDisplay.Bind(wg.EVT_GRID_CELL_CHANGED, OnCellChange)
     6817    else:
     6818        G2frame.dataDisplay.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange)
    72036819    G2frame.dataDisplay.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK, PlotSSelect)
    72046820    G2frame.dataDisplay.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK, PlotSelect)
     
    73756991        if sumFo:
    73766992            mtext = ' merge R = %6.2f%s for %d reflections in %s'%(100.*sumDf/sumFo,'%',mergeRef.shape[0],Laue)
    7377             print mtext
     6993            print (mtext)
    73786994            Comments.append(mtext)
    73796995        else:
    7380             print 'nothing to merge for %s reflections'%(mergeRef.shape[0])
     6996            print( 'nothing to merge for %s reflections'%(mergeRef.shape[0]))
    73816997        HKLFlist = []
    73826998        newName = Name+u' '+Laue
     
    73907006        newName = G2obj.MakeUniqueLabel(newName,HKLFlist)
    73917007        newData = copy.deepcopy(data)
    7392         newData[0]['ranId'] = ran.randint(0,sys.maxint)
     7008        newData[0]['ranId'] = ran.randint(0,sys.maxsize)
    73937009        newData[1]['RefList'] = mergeRef
    73947010        Id = G2frame.GPXtree.AppendItem(parent=G2frame.root,text=newName)
     
    75957211        try:
    75967212            if grid.IsCellEditControlEnabled(): # complete any grid edits in progress
    7597                 if GSASIIpath.GetConfigValue('debug'): print 'Completing grid edit in',grid
     7213                if GSASIIpath.GetConfigValue('debug'): print ('Completing grid edit in%s'%str(grid))
    75987214                grid.HideCellEditControl()
    75997215                grid.DisableCellEditControl()
     
    76547270            G2frame.dataWindow.helpKey = ''
    76557271            if GSASIIpath.GetConfigValue('debug'):
    7656                 print 'bug: why here?'
     7272                print ('bug: why here?')
    76577273                G2obj.HowDidIgetHere()
    76587274       
     
    77077323            phaseName = ''
    77087324            if Phases:
    7709                 phaseName = Phases.keys()[0]
     7325                phaseName = list(Phases.keys())[0]
    77107326            G2restG.UpdateRestraints(G2frame,data,Phases,phaseName)
    77117327        elif G2frame.GPXtree.GetItemText(item).startswith('IMG '):
     
    78997515        G2frame.RefList = ''
    79007516        if len(data):
    7901             G2frame.RefList = data.keys()[0]
     7517            G2frame.RefList = list(data.keys())[0]
    79027518        G2pdG.UpdateReflectionGrid(G2frame,data)
    79037519        wx.CallAfter(G2plt.PlotPatterns,G2frame)
  • trunk/GSASIIddataGUI.py

    r3100 r3136  
    1717
    1818'''
     19from __future__ import division, print_function
    1920import wx
    2021import GSASIIpath
     
    493494   
    494495        ODFSizer = wx.FlexGridSizer(0,8,2,2)
    495         ODFkeys = POData[5].keys()
     496        ODFkeys = list(POData[5].keys())
    496497        ODFkeys.sort()
    497498        for odf in ODFkeys:
     
    776777       
    777778    def RepaintHistogramInfo(Scroll=0):
    778         G2frame.bottomSizer.DeleteWindows()
    779         Indx.clear()
    780         G2frame.bottomSizer = ShowHistogramInfo()
    781         mainSizer.Add(G2frame.bottomSizer)
    782         mainSizer.Layout()
    783         G2frame.dataWindow.Refresh()
    784         DData.SetVirtualSize(mainSizer.GetMinSize())
    785         DData.Scroll(0,Scroll)
    786         G2frame.dataWindow.SendSizeEvent()
     779        if 'phoenix' in wx.version():
     780            G2frame.bottomSizer.Clear(True)
     781        else:
     782            G2frame.bottomSizer.DeleteWindows()
     783            Indx.clear()
     784            G2frame.bottomSizer = ShowHistogramInfo()
     785            mainSizer.Add(G2frame.bottomSizer)
     786            mainSizer.Layout()
     787            G2frame.dataWindow.Refresh()
     788            DData.SetVirtualSize(mainSizer.GetMinSize())
     789            DData.Scroll(0,Scroll)
     790            G2frame.dataWindow.SendSizeEvent()
    787791       
    788792    def ShowHistogramInfo():
     
    869873        fixVals = wx.ComboBox(DData,value=UseList[G2frame.hist]['Fix FXU'],choices=parmChoice,
    870874            style=wx.CB_DROPDOWN)
    871         fixVals.Bind(wx.wx.EVT_COMBOBOX,OnFixVals)
     875        fixVals.Bind(wx.EVT_COMBOBOX,OnFixVals)
    872876        fixBox.Add(fixVals,0,WACV)
    873877        bottomSizer.Add(fixBox)
  • trunk/GSASIIexprGUI.py

    r3000 r3136  
    2323
    2424'''
     25from __future__ import division, print_function
    2526import re
    2627import wx
    27 import math
    2828import wx.lib.scrolledpanel as wxscroll
    2929import numpy as np
    3030import GSASIIpath
    3131GSASIIpath.SetVersionNumber("$Revision$")
    32 import GSASIIdataGUI as G2gd
    3332import GSASIIctrlGUI as G2G
    3433import GSASIIpy3 as G2py3
     
    383382            elif self.varSelect.get(v) > 0:
    384383               if '*' in varname:
    385                    l = G2obj.LookupWildCard(varname,self.parmDict.keys())
     384                   l = G2obj.LookupWildCard(varname,list(self.parmDict.keys()))
    386385                   if len(l) == 0:
    387386                       invalid += 1
     
    610609                var = self.varName[v]
    611610                if '*' in var:
    612                     #[self.parmDict[v] for v in LookupWildCard(var,self.parmDict.keys())]
    613                     #print self.varValue[v]
    614611                    vs = G2obj.LookupWildCard(var,self.parmDict.keys())
    615612                    s = '('+str(len(vs))+' values)'
     
    700697        self.parmDict = parmDict
    701698        self.header = header
    702         self.pName = Phases.keys()[0]
     699        self.pName = list(Phases.keys())[0]
    703700        DisAglCtls = {}
    704701        dlg = G2G.DisAglDialog(self.panel,DisAglCtls,self.Phases[self.pName]['General'],Reset=False)
     
    737734        mainSizer = wx.BoxSizer(wx.VERTICAL)
    738735        mainSizer.Add(wx.StaticText(self.panel,label=self.header),0,WACV)
    739         pNames = self.Phases.keys()
     736        pNames = list(self.Phases.keys())
    740737        phaseSizer = wx.BoxSizer(wx.HORIZONTAL)
    741738        phaseSizer.Add(wx.StaticText(self.panel,label=' Select phase: '),0,WACV)
     
    821818        self.parmDict = parmDict
    822819        self.header = header
    823         self.pName = Phases.keys()[0]
     820        self.pName = list(Phases.keys())[0]
    824821        DisAglCtls = {}
    825822        dlg = G2G.DisAglDialog(self.panel,DisAglCtls,self.Phases[self.pName]['General'],Reset=False)
     
    858855        mainSizer = wx.BoxSizer(wx.VERTICAL)
    859856        mainSizer.Add(wx.StaticText(self.panel,label=self.header),0,WACV)
    860         pNames = self.Phases.keys()
     857        pNames = list(self.Phases.keys())
    861858        phaseSizer = wx.BoxSizer(wx.HORIZONTAL)
    862859        phaseSizer.Add(wx.StaticText(self.panel,label=' Select phase: '),0,WACV)
     
    945942                           )
    946943    newobj = dlg.Show(True)
    947     print dlg.GetDepVar()
     944    print (dlg.GetDepVar())
    948945    dlg = ExpressionDialog(frm,PSvarDict,
    949946                           header="Edit the PseudoVar expression",
    950947                           fit=True)
    951948    newobj = dlg.Show(True)
    952     print dlg.GetDepVar()
     949    print (dlg.GetDepVar())
    953950
    954951    #app.MainLoop()
    955952
    956 
    957     import cPickle
     953    import platform
     954    if '2' in platform.python_version_tuple()[0]:
     955        import cPickle
     956    else:
     957        import pickle as cPickle
    958958    def showEQ(calcobj):
    959959        print
    960         print calcobj.eObj.expression
     960        print (calcobj.eObj.expression)
    961961        for v in sorted(calcobj.eObj.freeVars.keys()+calcobj.eObj.assgnVars.keys()):
    962             print "  ",v,'=',calcobj.exprDict[v]
    963         print calcobj.EvalExpression()
    964     print "starting test"
     962            print ("  ",v,'=',calcobj.exprDict[v])
     963        print (calcobj.EvalExpression())
     964    print ("starting test")
    965965    obj = G2obj.ExpressionObj()
    966966    obj.expression = "A*np.exp(B)"
  • trunk/GSASIIfiles.py

    r3012 r3136  
    2121at that point.
    2222'''
    23 
     23from __future__ import division, print_function
    2424import os
    2525import sys
     
    2727import imp
    2828import inspect
    29 import traceback
    3029import platform
     30import numpy as np
    3131
    3232import GSASIIpath
     
    355355                            readerlist.append(reader)
    356356        except AttributeError:
    357             print 'Import_' + errprefix + ': Attribute Error ' + filename
     357            print ('Import_' + errprefix + ': Attribute Error ' + filename)
    358358            if traceback:
    359359                traceback.print_exc(file=sys.stdout)
    360360        except Exception as exc:
    361             print '\nImport_' + errprefix + ': Error importing file ' + filename
    362             print u'Error message: {}\n'.format(exc)
     361            print ('\nImport_' + errprefix + ': Error importing file ' + filename)
     362            print (u'Error message: {}\n'.format(exc))
    363363            if traceback:
    364364                traceback.print_exc(file=sys.stdout)
  • trunk/GSASIIimage.py

    r3106 r3136  
    1515
    1616'''
    17 
     17from __future__ import division, print_function
    1818import math
    1919import time
     
    9191        ''' gives ellipse center coordinates
    9292        '''
    93         b,c,d,f,a = p[1]/2, p[2], p[3]/2, p[4]/2, p[0]
     93        b,c,d,f,a = p[1]/2., p[2], p[3]/2., p[4]/2., p[0]
    9494        num = b*b-a*c
    9595        x0=(c*d-b*f)/num
     
    101101        range will be -90 to 90 deg
    102102        '''
    103         b,c,a = p[1]/2, p[2], p[0]
     103        b,c,a = p[1]/2., p[2], p[0]
    104104        return 0.5*npatand(2*b/(a-c))
    105105   
     
    107107        ''' gives ellipse radii in [minor,major] order
    108108        '''
    109         b,c,d,f,g,a = p[1]/2, p[2], p[3]/2, p[4]/2, p[5], p[0]
     109        b,c,d,f,g,a = p[1]/2., p[2], p[3]/2., p[4]/2, p[5], p[0]
    110110        up = 2*(a*f*f+c*d*d+g*b*b-2*b*d*f-a*c*g)
    111111        down1=(b*b-a*c)*( (c-a)*np.sqrt(1+4*b*b/((a-c)*(a-c)))-(c+a))
     
    138138       
    139139    def CalibPrint(ValSig,chisq,Npts):
    140         print 'Image Parameters: chi**2: %12.3g, Np: %d'%(chisq,Npts)
     140        print ('Image Parameters: chi**2: %12.3g, Np: %d'%(chisq,Npts))
    141141        ptlbls = 'names :'
    142142        ptstr =  'values:'
     
    152152            else:
    153153                sigstr += 12*' '
    154         print ptlbls
    155         print ptstr
    156         print sigstr       
     154        print (ptlbls)
     155        print (ptstr)
     156        print (sigstr)       
    157157       
    158158    def ellipseCalcD(B,xyd,varyList,parmDict):
     
    225225        Zmin = np.argmin(ZMin)
    226226        xpix += Zmax%w2-w
    227         ypix += Zmax/w2-w
     227        ypix += Zmax//w2-w
    228228        return xpix,ypix,np.ravel(ZMax)[Zmax],max(0.0001,np.ravel(ZMin)[Zmin])   #avoid neg/zero minimum
    229229    else:
     
    236236        if radii[0] < 0:        #hyperbola
    237237            theta = npacosd(1./np.sqrt(1.+(radii[0]/radii[1])**2))
    238             print theta
     238#            print (theta)
    239239            return 0
    240240        apb = radii[1]+radii[0]
     
    492492    blkSize = 512
    493493    Nx,Ny = data['size']
    494     nXBlks = (Nx-1)/blkSize+1
    495     nYBlks = (Ny-1)/blkSize+1
     494    nXBlks = (Nx-1)//blkSize+1
     495    nYBlks = (Ny-1)//blkSize+1
    496496    tam = ma.make_mask_none(data['size'])
    497497    for iBlk in range(nXBlks):
     
    521521    '''
    522522    import ImageCalibrants as calFile
    523     print 'Image recalibration:'
     523    print ('Image recalibration:')
    524524    time0 = time.time()
    525525    pixelSize = data['pixelSize']
     
    533533        data['DetDepth'] /= data['distance']
    534534    if not data['calibrant']:
    535         print 'no calibration material selected'
     535        print ('no calibration material selected')
    536536        return []   
    537537    skip = data['calibskip']
     
    560560        tam = ma.mask_or(tam,MakeFrameMask(data,frame))
    561561    for iH,H in enumerate(HKL):
    562         if debug:   print H
     562        if debug:   print (H)
    563563        dsp = H[3]
    564564        tth = 2.0*asind(wave/(2.*dsp))
    565565        if tth+abs(data['tilt']) > 90.:
    566             print 'next line is a hyperbola - search stopped'
     566            print ('next line is a hyperbola - search stopped')
    567567            break
    568568        ellipse = GetEllipse(dsp,data)
     
    579579            continue
    580580    if not data['rings']:
    581         print 'no rings found; try lower Min ring I/Ib'
     581        print ('no rings found; try lower Min ring I/Ib')
    582582        return []   
    583583       
     
    596596        ellipse = GetEllipse(H[3],data)
    597597        data['ellipses'].append(copy.deepcopy(ellipse+('b',)))   
    598     print 'calibration time = %.3f'%(time.time()-time0)
     598    print ('calibration time = %.3f'%(time.time()-time0))
    599599    G2plt.PlotImage(G2frame,newImage=True)       
    600600    return [vals,varyList,sigList,parmDict]
     
    606606    import copy
    607607    import ImageCalibrants as calFile
    608     print 'Image calibration:'
     608    print ('Image calibration:')
    609609    time0 = time.time()
    610610    ring = data['ring']
     
    616616    varyDict = data['varyList']
    617617    if varyDict['dist'] and varyDict['wave']:
    618         print 'ERROR - you can not simultaneously calibrate distance and wavelength'
     618        print ('ERROR - you can not simultaneously calibrate distance and wavelength')
    619619        return False
    620620    if len(ring) < 5:
    621         print 'ERROR - not enough inner ring points for ellipse'
     621        print ('ERROR - not enough inner ring points for ellipse')
    622622        return False
    623623       
     
    629629    fmt2 = '%s X: %.3f, Y: %.3f, phi: %.3f, R1: %.3f, R2: %.3f, chi**2: %.3f, Np: %d'
    630630    if outE:
    631         print fmt%('start ellipse: ',outE[0][0],outE[0][1],outE[1],outE[2][0],outE[2][1])
     631        print (fmt%('start ellipse: ',outE[0][0],outE[0][1],outE[1],outE[2][0],outE[2][1]))
    632632        ellipse = outE
    633633    else:
     
    642642        ellipse = FitEllipse(Ring)
    643643    else:
    644         print '1st ring not sufficiently complete to proceed'
     644        print ('1st ring not sufficiently complete to proceed')
    645645        return False
    646646    if debug:
    647         print fmt2%('inner ring:    ',ellipse[0][0],ellipse[0][1],ellipse[1],
    648             ellipse[2][0],ellipse[2][1],0.,len(Ring))     #cent,phi,radii
     647        print (fmt2%('inner ring:    ',ellipse[0][0],ellipse[0][1],ellipse[1],
     648            ellipse[2][0],ellipse[2][1],0.,len(Ring)))     #cent,phi,radii
    649649    data['ellipses'].append(ellipse[:]+('r',))
    650650    data['rings'].append(np.array(Ring))
     
    654654    data['rings'] = []
    655655    if not data['calibrant']:
    656         print 'no calibration material selected'
     656        print ('no calibration material selected')
    657657        return True
    658658   
     
    675675    elcent,phi,radii = ellipse              #from fit of 1st ring
    676676    dsp = HKL[0][3]
    677     print '1st ring: try %.4f'%(dsp)
     677    print ('1st ring: try %.4f'%(dsp))
    678678    if varyDict['dist']:
    679679        wave = data['wavelength']
     
    690690        tilt = npasind(np.sqrt(max(0.,1.-(radii[0]/radii[1])**2))*ctth)
    691691        if not tilt:
    692             print 'WARNING - selected ring was fitted as a circle'
    693             print ' - if detector was tilted we suggest you skip this ring - WARNING'
     692            print ('WARNING - selected ring was fitted as a circle')
     693            print (' - if detector was tilted we suggest you skip this ring - WARNING')
    694694    else:
    695695        tilt = data['tilt']
     
    714714        while fail:
    715715            dsp = HKL[i2][3]
    716             print '2nd ring: try %.4f'%(dsp)
     716            print ('2nd ring: try %.4f'%(dsp))
    717717            tth = 2.0*asind(wave/(2.*dsp))
    718718            ellipsep = GetEllipse2(tth,0.,dist,centp,tilt,phi)
    719             print fmt%('plus ellipse :',ellipsep[0][0],ellipsep[0][1],ellipsep[1],ellipsep[2][0],ellipsep[2][1])
     719            print (fmt%('plus ellipse :',ellipsep[0][0],ellipsep[0][1],ellipsep[1],ellipsep[2][0],ellipsep[2][1]))
    720720            Ringp = makeRing(dsp,ellipsep,3,cutoff,scalex,scaley,G2frame.ImageZ)[0]
    721721            parmDict = {'dist':dist,'det-X':centp[0],'det-Y':centp[1],
     
    731731                chip = 1e6
    732732            ellipsem = GetEllipse2(tth,0.,dist,centm,-tilt,phi)
    733             print fmt%('minus ellipse:',ellipsem[0][0],ellipsem[0][1],ellipsem[1],ellipsem[2][0],ellipsem[2][1])
     733            print (fmt%('minus ellipse:',ellipsem[0][0],ellipsem[0][1],ellipsem[1],ellipsem[2][0],ellipsem[2][1]))
    734734            Ringm = makeRing(dsp,ellipsem,3,cutoff,scalex,scaley,G2frame.ImageZ)[0]
    735735            if len(Ringm) > 10:
     
    768768        tth = 2.0*asind(wave/(2.*dsp))
    769769        if tth+abs(data['tilt']) > 90.:
    770             print 'next line is a hyperbola - search stopped'
     770            print ('next line is a hyperbola - search stopped')
    771771            break
    772         if debug:   print 'HKLD:',H[:4],'2-theta: %.4f'%(tth)
     772        if debug:   print ('HKLD:'+str(H[:4])+'2-theta: %.4f'%(tth))
    773773        elcent,phi,radii = ellipse = GetEllipse(dsp,data)
    774774        data['ellipses'].append(copy.deepcopy(ellipse+('g',)))
    775         if debug:   print fmt%('predicted ellipse:',elcent[0],elcent[1],phi,radii[0],radii[1])
     775        if debug:   print (fmt%('predicted ellipse:',elcent[0],elcent[1],phi,radii[0],radii[1]))
    776776        Ring = makeRing(dsp,ellipse,pixLimit,cutoff,scalex,scaley,G2frame.ImageZ)[0]
    777777        if Ring:
     
    787787                data['chisq'] = chisq
    788788                elcent,phi,radii = ellipse = GetEllipse(dsp,data)
    789                 if debug:   print fmt2%('fitted ellipse:   ',elcent[0],elcent[1],phi,radii[0],radii[1],chisq,len(rings))
     789                if debug:   print (fmt2%('fitted ellipse:   ',elcent[0],elcent[1],phi,radii[0],radii[1],chisq,len(rings)))
    790790            data['ellipses'].append(copy.deepcopy(ellipse+('r',)))
    791791#            G2plt.PlotImage(G2frame,newImage=True)
    792792        else:
    793             if debug:   print 'insufficient number of points in this ellipse to fit'
     793            if debug:   print ('insufficient number of points in this ellipse to fit')
    794794#            break
    795795    G2plt.PlotImage(G2frame,newImage=True)
    796796    fullSize = len(G2frame.ImageZ)/scalex
    797797    if 2*radii[1] < .9*fullSize:
    798         print 'Are all usable rings (>25% visible) used? Try reducing Min ring I/Ib'
     798        print ('Are all usable rings (>25% visible) used? Try reducing Min ring I/Ib')
    799799    N = len(data['ellipses'])
    800800    if N > 2:
     
    809809        ellipse = GetEllipse(H[3],data)
    810810        data['ellipses'].append(copy.deepcopy(ellipse+('b',)))
    811     print 'calibration time = %.3f'%(time.time()-time0)
     811    print ('calibration time = %.3f'%(time.time()-time0))
    812812    G2plt.PlotImage(G2frame,newImage=True)       
    813813    return True
     
    880880    'Integrate an image; called from OnIntegrateAll and OnIntegrate in G2imgGUI'    #for q, log(q) bins need data['binType']
    881881    import histogram2d as h2d
    882     print 'Begin image integration'
     882    print ('Begin image integration')
    883883    CancelPressed = False
    884884    LUtth = np.array(data['IOtth'])
     
    906906    H0 = np.zeros(shape=(numAzms,numChans),order='F',dtype=np.float32)
    907907    Nx,Ny = data['size']
    908     nXBlks = (Nx-1)/blkSize+1
    909     nYBlks = (Ny-1)/blkSize+1
     908    nXBlks = (Nx-1)//blkSize+1
     909    nYBlks = (Ny-1)//blkSize+1
    910910    tbeg = time.time()
    911911    times = [0,0,0,0,0]
     
    965965        H0 /= np.array([G2pwd.Polarization(data['PolaVal'][0],H2[:-1],Azm=azm-90.)[0] for azm in (H1[:-1]+np.diff(H1)/2.)])
    966966    times[4] += time.time()-t0
    967     print 'Step times: \n apply masks  %8.3fs xy->th,azm   %8.3fs fill map     %8.3fs \
    968         \n binning      %8.3fs cleanup      %8.3fs'%(times[0],times[1],times[2],times[3],times[4])
    969     print "Elapsed time:","%8.3fs"%(time.time()-tbeg)
    970     print 'Integration complete'
     967    print ('Step times: \n apply masks  %8.3fs xy->th,azm   %8.3fs fill map     %8.3fs \
     968        \n binning      %8.3fs cleanup      %8.3fs'%(times[0],times[1],times[2],times[3],times[4]))
     969    print ("Elapsed time:","%8.3fs"%(time.time()-tbeg))
     970    print ('Integration complete')
    971971    if returnN:     #As requested by Steven Weigand
    972972        return H0,H1,H2,NST,CancelPressed
     
    10231023            ring['Ivar'] = np.var(ringint)
    10241024            ring['covMat'] = covMat
    1025             print 'Variance in normalized ring intensity: %.3f'%(ring['Ivar'])
     1025            print ('Variance in normalized ring intensity: %.3f'%(ring['Ivar']))
    10261026    CalcStrSta(StrSta,Controls)
    10271027   
     
    10421042            ringint = np.array([float(Image[int(x*scalex),int(y*scaley)]) for y,x in np.array(ringxy)[:,:2]])
    10431043            ringint /= np.mean(ringint)
    1044             print ' %s %.3f %s %.3f'%('d-spacing',ring['Dcalc'],'sig(MRD):',np.sqrt(np.var(ringint)))
     1044            print (' %s %.3f %s %.3f'%('d-spacing',ring['Dcalc'],'sig(MRD):',np.sqrt(np.var(ringint))))
    10451045            RingsAI.append(np.array(zip(ringazm,ringint)).T)
    10461046    return RingsAI
     
    10941094    'Needs a doc string'
    10951095    def StrainPrint(ValSig,dset):
    1096         print 'Strain tensor for Dset: %.6f'%(dset)
     1096        print ('Strain tensor for Dset: %.6f'%(dset))
    10971097        ptlbls = 'names :'
    10981098        ptstr =  'values:'
     
    11051105            else:
    11061106                sigstr += 12*' '
    1107         print ptlbls
    1108         print ptstr
    1109         print sigstr
     1107        print (ptlbls)
     1108        print (ptstr)
     1109        print (sigstr)
    11101110       
    11111111    def strainCalc(p,xyd,dset,wave,phi,StaType):
     
    11331133   
    11341134def AutoSpotMasks(Image,Masks,Controls):
    1135     print 'auto spot search'
     1135    print ('auto spot search')
    11361136    maxPks = 500
    11371137    dmax = 1.5         #just beyond diamond 111 @ 2.0596
     
    11561156        MX = ma.array(M,mask=(M<10.))
    11571157        Indx = ma.nonzero(ma.getmask(MX))
    1158         print 'Spots found: ',mul,len(pts),distort,len(Indx[0])
     1158        print ('Spots found: %d %d %.2f %d'%(mul,len(pts),distort,len(Indx[0])))
    11591159        if distort < .3:
    11601160            break
    11611161    if not len(Indx[0]):
    1162         print 'no auto search spots found'
     1162        print ('no auto search spots found')
    11631163        return None
    11641164    if distort > 2.:
    1165         print 'no big spots found'
     1165        print ('no big spots found')
    11661166        return None
    11671167    #use clustered points to get position & spread
  • trunk/GSASIIimgGUI.py

    r3124 r3136  
    1515
    1616'''
     17from __future__ import division, print_function
    1718import os
    1819import copy
     
    187188                for item in items:
    188189                    name = Names[item]
    189                     print 'calibrating',name
     190                    print ('calibrating'+name)
    190191                    G2frame.Image = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,name)
    191192                    Data = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.Image,'Image Controls'))
     
    209210        finally:
    210211            dlg.Destroy()
    211         print 'All selected images recalibrated - results in Sequential image calibration results'
     212        print ('All selected images recalibrated - results in Sequential image calibration results')
    212213        G2frame.G2plotNB.Delete('Sequential refinement')    #clear away probably invalid plot
    213214        G2plt.PlotExposedImage(G2frame,event=None)
     
    438439        if not pth: pth = '.'
    439440        dlg = wx.FileDialog(G2frame, 'Choose image controls file', pth, '',
    440             'image control files (*.imctrl)|*.imctrl',wx.OPEN)
     441            'image control files (*.imctrl)|*.imctrl',wx.FD_OPEN)
    441442        try:
    442443            if dlg.ShowModal() == wx.ID_OK:
     
    12431244        l2 = len(data[key])
    12441245        if GSASIIpath.GetConfigValue('debug') and l1 != l2:
    1245             print 'Mask Cleanup:',key,'was',l1,'entries','now',l2
     1246            print ('Mask Cleanup: %s was %d entries, now %d'%(key,l1,l2))
    12461247   
    12471248def UpdateMasks(G2frame,data):
     
    13331334        if not pth: pth = '.'
    13341335        dlg = wx.FileDialog(G2frame, 'Choose image mask file', pth, '',
    1335             'image mask files (*.immask)|*.immask',wx.OPEN)
     1336            'image mask files (*.immask)|*.immask',wx.FD_OPEN)
    13361337        try:
    13371338            if dlg.ShowModal() == wx.ID_OK:
     
    16371638        for r in range(len(Spots)):
    16381639            SpotGrid.SetCellStyle(r,0,VERY_LIGHT_GREY,True)
    1639         SpotGrid.Bind(wg.EVT_GRID_CELL_CHANGE, OnSpotChange)
     1640        if 'phoenix' in wx.version():
     1641            SpotGrid.Bind(wg.EVT_GRID_CELL_CHANGED, OnSpotChange)
     1642        else:
     1643            SpotGrid.Bind(wg.EVT_GRID_CELL_CHANGE, OnSpotChange)
    16401644        mainSizer.Add(SpotGrid,0,)
    16411645    if Rings:
     
    17751779        if not pth: pth = '.'
    17761780        dlg = wx.FileDialog(G2frame, 'Choose stress/strain file', pth, '',
    1777             'image control files (*.strsta)|*.strsta',wx.OPEN)
     1781            'image control files (*.strsta)|*.strsta',wx.FD_OPEN)
    17781782        try:
    17791783            if dlg.ShowModal() == wx.ID_OK:
     
    18241828        if not pth: pth = '.'
    18251829        dlg = wx.FileDialog(G2frame, 'Choose multihistogram metadata text file', pth, '',
    1826             'metadata file (*.*)|*.*',wx.OPEN)
     1830            'metadata file (*.*)|*.*',wx.FD_OPEN)
    18271831        try:
    18281832            if dlg.ShowModal() == wx.ID_OK:
     
    19261930            G2gd.GetGPXtreeItemId(G2frame,G2frame.Image, 'Image Controls'))
    19271931        G2img.FitStrSta(G2frame.ImageZ,data,Controls)
    1928         print 'Strain fitting finished'
     1932        print ('Strain fitting finished')
    19291933        UpdateStressStrain(G2frame,data)
    19301934        G2plt.PlotExposedImage(G2frame,event=event)
     
    19621966            variables = []
    19631967            for i,name in enumerate(names):
    1964                 print ' Sequential strain fit for ',name
     1968                print (' Sequential strain fit for '+name)
    19651969                GoOn = dlg.Update(i,newmsg='Data set name = '+name)[0]
    19661970                if not GoOn:
     
    20092013                SeqResult['histNames'] = goodnames
    20102014                dlg.Destroy()
    2011                 print ' ***** Sequential strain refinement successful *****'
     2015                print (' ***** Sequential strain refinement successful *****')
    20122016        finally:
    20132017            wx.EndBusyCursor()   
     
    20152019        G2frame.GPXtree.SetItemPyData(Id,SeqResult)
    20162020        G2frame.GPXtree.SelectItem(Id)
    2017         print 'All images fitted'
     2021        print ('All images fitted')
    20182022       
    20192023    def SamSizer():
     
    20452049               
    20462050        def OnStrainChange(event):
    2047             print event
     2051#            print (event)
    20482052            r,c = event.GetRow(),event.GetCol()
    20492053            if c == 0:
     
    20962100            StrainGrid.SetCellStyle(r,9,VERY_LIGHT_GREY,True)
    20972101            StrainGrid.SetCellStyle(r,10,VERY_LIGHT_GREY,True)
    2098         StrainGrid.Bind(wg.EVT_GRID_CELL_CHANGE, OnStrainChange)
     2102        if 'phoenix' in wx.version():
     2103            StrainGrid.Bind(wg.EVT_GRID_CELL_CHANGED, OnStrainChange)
     2104        else:
     2105            StrainGrid.Bind(wg.EVT_GRID_CELL_CHANGE, OnStrainChange)
    20992106        StrainGrid.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnSetCol)
    21002107        return StrainGrid
     
    25332540            autoscale.Bind(wx.EVT_CHECKBOX,OnAutoScale)
    25342541            sizer.Add(autoscale,0,WACV)
    2535             scalename = wx.ComboBox(mnpnl,value=self.AutoScaleName,choices=self.AutoScales.keys(),
     2542            scalename = wx.ComboBox(mnpnl,value=self.AutoScaleName,choices=list(self.AutoScales.keys()),
    25362543                style=wx.CB_READONLY|wx.CB_DROPDOWN)
    25372544            scalename.Bind(wx.EVT_COMBOBOX,OnAutoScaleName)
     
    27342741            Sdata = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,Id, 'Sample Parameters'))
    27352742            if self.AutoScale:
    2736                 print 'Rescale by %.4f'%(Scale)
     2743                print ('Rescale by %.4f'%(Scale))
    27372744                y,w = G2frame.GPXtree.GetItemPyData(Id)[1][1:3]
    27382745                y *= Scale
     
    27742781        interpDict,imgctrl,immask = self.Evaluator(dist) # interpolated calibration values
    27752782        if GSASIIpath.GetConfigValue('debug'):
    2776             print 'interpolated values: ',interpDict
     2783            print ('interpolated values: ',interpDict)
    27772784        self.ImageControls = ReadControls(imgctrl)
    27782785        self.ImageControls.update(interpDict)
     
    31193126                if not pth: pth = '.'
    31203127                dlg = wx.FileDialog(parent, 'Read previous table or build new table by selecting image control files', pth,
    3121                     style=wx.OPEN| wx.MULTIPLE,
     3128                    style=wx.FD_OPEN| wx.MULTIPLE,
    31223129                    wildcard='Integration table (*.imtbl)|*.imtbl|image control files (.imctrl)|*.imctrl')
    31233130                dlg.CenterOnParent()
     
    32833290            if d == 'None': continue
    32843291            if float(d) < 0: continue
    3285             index = self.InsertStringItem(sys.maxint, d)
     3292            index = self.InsertStringItem(sys.maxsize, d)
    32863293            for j in range(1,len(parms)):
    32873294                self.SetStringItem(index, j, parms[j][r])
     
    32973304        try:
    32983305            dlg = wx.FileDialog(self, 'Select mask or control file to add (Press cancel if none)', pth,
    3299                 style=wx.OPEN,wildcard='Add GSAS-II mask file (.immask)|*.immask|add image control file (.imctrl)|*.imctrl')
     3306                style=wx.FD_OPEN,wildcard='Add GSAS-II mask file (.immask)|*.immask|add image control file (.imctrl)|*.imctrl')
    33003307            dlg.CenterOnParent()
    33013308            if dlg.ShowModal() == wx.ID_OK:
  • trunk/GSASIIindex.py

    r2650 r3136  
    1717'''
    1818
     19from __future__ import division, print_function
    1920import math
    2021import time
     
    385386            if dp > dm: pos += 1                            # closer to upper than lower
    386387            if pos >= N:
    387                 print pos,N
     388                print ('%.4f %d'%(pos,N))
    388389                break
    389390            hkl = HKL[pos]                                 # put in hkl
     
    931932    zero,ncno = controls[1:3]
    932933    ncMax = Nobs*ncno
    933     print "%s %8.3f %8.3f" % ('lattice parameter range = ',amin,amax)
    934     print "%s %.4f %s %d %s %d" % ('Zero =',zero,'Nc/No max =',ncno,' Max Nc =',ncno*Nobs)
     934    print ("%s %8.3f %8.3f" % ('lattice parameter range = ',amin,amax))
     935    print ("%s %.4f %s %d %s %d" % ('Zero =',zero,'Nc/No max =',ncno,' Max Nc =',ncno*Nobs))
    935936    cells = []
    936937    lastcell = np.zeros(7)
     
    938939        begin = time.time()
    939940        if bravais[ibrav]:
    940             print 'cell search for ',bravaisNames[ibrav]
    941             print '      M20  X20  Nc       a          b          c        alpha       beta      gamma     volume      V-test'
     941            print ('cell search for ',bravaisNames[ibrav])
     942            print ('      M20  X20  Nc       a          b          c        alpha       beta      gamma     volume      V-test')
    942943            V1 = controls[3]
    943944            bestM20 = 0
     
    986987                                        newcell = np.array(cell[3:10])
    987988                                        if not np.allclose(newcell,lastcell):
    988                                             print "%10.3f %3d %3d %10.5f %10.5f %10.5f %10.3f %10.3f %10.3f %10.2f %10.2f"  \
    989                                                 %(M20,X20,Nc,a,b,c,alp,bet,gam,V,V1)
     989                                            print ("%10.3f %3d %3d %10.5f %10.5f %10.5f %10.3f %10.3f %10.3f %10.2f %10.2f"  \
     990                                                %(M20,X20,Nc,a,b,c,alp,bet,gam,V,V1))
    990991                                            cells.append(cell)
    991992                                        lastcell = np.array(cell[3:10])
     
    10101011                                ncMax += Nobs
    10111012                                cycle += 1
    1012                                 print 'Restart search, new Max Nc = ',ncMax
     1013                                print ('Restart search, new Max Nc = %d'%ncMax)
    10131014                            else:
    10141015                                cycle = 10
     
    10161017                    pass
    10171018#                dlg.Destroy()
    1018             print '%s%s%s%s'%('finished cell search for ',bravaisNames[ibrav], \
    1019                 ', elapsed time = ',G2lat.sec2HMS(time.time()-begin))
     1019            print ('%s%s%s%s'%('finished cell search for ',bravaisNames[ibrav], \
     1020                ', elapsed time = ',G2lat.sec2HMS(time.time()-begin)))
    10201021           
    10211022    if cells:
     
    10961097    if NeedTestData: TestData()
    10971098    ibrav,cell,bestcell,Pwr,peaks = TestData
    1098     print 'best cell:',bestcell
    1099     print 'old cell:',cell
     1099    print ('best cell:',bestcell)
     1100    print ('old cell:',cell)
    11001101    Peaks = np.array(peaks)
    11011102    HKL = Peaks[4:7]
    1102     print calc_M20(peaks,HKL)
     1103    print (calc_M20(peaks,HKL))
    11031104    A = G2lat.cell2A(cell)
    11041105    OK,smin,A,result = FitHKL(ibrav,peaks,A,Pwr)
    1105     print 'new cell:',G2lat.A2cell(A)   
    1106     print 'x:',result[0]
    1107     print 'cov_x:',result[1]
    1108     print 'infodict:'
     1106    print ('new cell:',G2lat.A2cell(A))   
     1107    print ('x:',result[0])
     1108    print ('cov_x:',result[1])
     1109    print ('infodict:')
    11091110    for item in result[2]:
    1110         print item,result[2][item]
    1111     print 'msg:',result[3]
    1112     print 'ier:',result[4]
     1111        print (item,result[2][item])
     1112    print ('msg:',result[3])
     1113    print ('ier:',result[4])
    11131114    result = refinePeaks(peaks,ibrav,A)
    11141115    N,M20,X20,A = result
    1115     print 'refinePeaks:',N,M20,X20,G2lat.A2cell(A)
    1116     print 'compare bestcell:',bestcell
     1116    print ('refinePeaks:',N,M20,X20,G2lat.A2cell(A))
     1117    print ('compare bestcell:',bestcell)
    11171118#
    11181119def test1():
    11191120    if NeedTestData: TestData()
    11201121    ibrav,A,Pwr,peaks = TestData2
    1121     print 'bad cell:',G2lat.A2cell(A)
    1122     print 'FitHKL'
     1122    print ('bad cell:',G2lat.A2cell(A))
     1123    print ('FitHKL')
    11231124    OK,smin,A,result = FitHKL(ibrav,peaks,A,Pwr)
    11241125    result = refinePeaks(peaks,ibrav,A)
    11251126    N,M20,X20,A = result
    1126     print 'refinePeaks:',N,M20,X20,A
     1127    print ('refinePeaks:',N,M20,X20,A)
    11271128#    Peaks = np.array(peaks)
    11281129#    HKL = Peaks[4:7]
     
    11491150#    test7()
    11501151#    test8()
    1151     print "OK"
     1152    print ("OK")
  • trunk/GSASIIlattice.py

    r3103 r3136  
    3030# $Id$
    3131########### SVN repository information ###################
     32from __future__ import division, print_function
    3233import math
    3334import copy
     
    6465   
    6566    """
    66     H = int(sec/3600)
    67     M = int(sec/60-H*60)
     67    H = int(sec//3600)
     68    M = int(sec//60-H*60)
    6869    S = sec-3600*H-60*M
    6970    return '%d:%2d:%.2f'%(H,M,S)
     
    334335            atom[cia+2:cia+8] = TransformU6(atom[cia+2:cia+8],invTrans)
    335336        atom[cs:cs+2] = G2spc.SytSym(atom[cx:cx+3],SGData)[:2]
    336         atom[cia+8] = ran.randint(0,sys.maxint)
     337        atom[cia+8] = ran.randint(0,sys.maxsize)
    337338        if cm:
    338339            mag = np.sqrt(np.sum(np.array(atom[cm:cm+3])**2))
     
    346347    newPhase['Atoms'],atCodes = GetUnique(newPhase,atCodes)
    347348    newPhase['Drawing'] = []
    348     newPhase['ranId'] = ran.randint(0,sys.maxint)
     349    newPhase['ranId'] = ran.randint(0,sys.maxsize)
    349350    return newPhase,atCodes
    350351   
     
    476477    A[1][1] = cell[1]*sind(cell[5])  # b sin(gamma)
    477478    A[1][2] = -cell[2]*cosd(cellstar[3])*sind(cell[4]) # - c cos(alpha*) sin(beta)
    478     A[2][2] = 1/cellstar[2]         # 1/c*
     479    A[2][2] = 1./cellstar[2]         # 1/c*
    479480    B = nl.inv(A)
    480481    return A,B
     
    497498    A[1][1] = cell[1]*sind(cell[5])  # b sin(gamma)
    498499    A[1][2] = -cell[2]*cosd(cellstar[3])*sind(cell[4]) # - c cos(alpha*) sin(beta)
    499     A[2][2] = 1/cellstar[2]         # 1/c*
     500    A[2][2] = 1./cellstar[2]         # 1/c*
    500501    B = nl.inv(A)
    501502    return A,B
     
    630631        cellArray = []
    631632        A = np.array(range(N3))
    632         cellGen = np.array([A/N2-1,A/N%N-1,A%N-1]).T
     633        cellGen = np.array([A//N2-1,A//N%N-1,A%N-1]).T
    633634        for cell in cellGen:
    634635            cellArray.append(cell)
     
    883884        return 0        #error - not rhombohedral reflection
    884885    else:
    885         Rh[1] = itk/3
     886        Rh[1] = itk//3
    886887        Rh[0] = Rh[1]+Hx[0]
    887888        Rh[2] = Rh[1]-Hx[1]
     
    947948    elif center.upper() == 'P' and system.lower() == 'triclinic':
    948949        return 13
    949     raise ValueError,'non-standard Bravais lattice center=%s, cell=%s' % (center,system)
     950    raise ValueError('non-standard Bravais lattice center=%s, cell=%s' % (center,system))
    950951
    951952def GenHBravais(dmin,Bravais,A):
     
    11111112                        rdsq = calc_rDsq(H,A)
    11121113                        if 0 < rdsq <= dminsq:
    1113                             HKL.append([h,k,l,1/math.sqrt(rdsq)])
     1114                            HKL.append([h,k,l,1./math.sqrt(rdsq)])
    11141115    elif SGLaue == '2/m':                #monoclinic
    11151116        axisnum = 1 + ['a','b','c'].index(SGUniq)
     
    11261127                        rdsq = calc_rDsq(H,A)
    11271128                        if 0 < rdsq <= dminsq:
    1128                             HKL.append([h,k,l,1/math.sqrt(rdsq)])
     1129                            HKL.append([h,k,l,1./math.sqrt(rdsq)])
    11291130                    [h,k,l] = SwapIndx(axisnum,[h,k,l])
    11301131    elif SGLaue in ['mmm','4/m','6/m']:            #orthorhombic
     
    11391140                        rdsq = calc_rDsq(H,A)
    11401141                        if 0 < rdsq <= dminsq:
    1141                             HKL.append([h,k,l,1/math.sqrt(rdsq)])
     1142                            HKL.append([h,k,l,1./math.sqrt(rdsq)])
    11421143    elif SGLaue in ['4/mmm','6/mmm']:                  #tetragonal & hexagonal
    11431144        for l in range(Hmax[2]+1):
     
    11491150                        rdsq = calc_rDsq(H,A)
    11501151                        if 0 < rdsq <= dminsq:
    1151                             HKL.append([h,k,l,1/math.sqrt(rdsq)])
     1152                            HKL.append([h,k,l,1./math.sqrt(rdsq)])
    11521153    elif SGLaue in ['3m1','31m','3','3R','3mR']:                  #trigonals
    11531154        for l in range(-Hmax[2],Hmax[2]+1):
     
    11711172                        rdsq = calc_rDsq(H,A)
    11721173                        if 0 < rdsq <= dminsq:
    1173                             HKL.append([H[0],H[1],H[2],1/math.sqrt(rdsq)])
     1174                            HKL.append([H[0],H[1],H[2],1./math.sqrt(rdsq)])
    11741175    else:                                   #cubic
    11751176        for h in range(Hmax[0]+1):
     
    11861187                        rdsq = calc_rDsq(H,A)
    11871188                        if 0 < rdsq <= dminsq:
    1188                             HKL.append([h,k,l,1/math.sqrt(rdsq)])
     1189                            HKL.append([h,k,l,1./math.sqrt(rdsq)])
    11891190    return sortHKLd(HKL,True,True)
    11901191   
     
    12251226                DH = SSdH[dH]
    12261227                H = [h+DH[0],k+DH[1],l+DH[2]]
    1227                 d = 1/np.sqrt(calc_rDsq(H,A))
     1228                d = 1./np.sqrt(calc_rDsq(H,A))
    12281229                if d >= dmin:
    12291230                    HKLM = np.array([h,k,l,dH])
     
    15761577            if M > 0:
    15771578                if L%12 == 2:
    1578                     if M <= L/12: return True
     1579                    if M <= L//12: return True
    15791580                else:
    1580                     if M <= L/12+1: return True
     1581                    if M <= L//12+1: return True
    15811582        elif SGLaue == 'm3m':
    15821583            if M > 0:
    15831584                if L%12 == 2:
    1584                     if M <= L/12: return True
     1585                    if M <= L//12: return True
    15851586                else:
    1586                     if M <= L/12+1: return True
     1587                    if M <= L//12+1: return True
    15871588    return False
    15881589       
     
    15901591    'needs doc string'
    15911592    coeffNames = []
    1592     for iord in [2*i+2 for i in range(L/2)]:
     1593    for iord in [2*i+2 for i in range(L//2)]:
    15931594        for m in [i-iord for i in range(2*iord+1)]:
    15941595            if OdfChk(SamSym,iord,m):
     
    17761777            Kcl = 0.
    17771778        for j in range(0,L+1,4):
    1778             im = j/4
     1779            im = j//4
    17791780            if 'array' in str(type(phi)) and np.any(phi.shape):
    17801781                pcrs = ptx.pyplmpsi(L,j,len(phi),phi)[0]
     
    18371838        Kcl = 0.0
    18381839        for j in range(0,L+1,4):
    1839             im = j/4
     1840            im = j//4
    18401841            pcrs,dum = ptx.pyplmpsi(L,j,1,phi)
    18411842            Kcl += BOH['L=%d'%(L)][N-1][im]*pcrs*cosd(j*beta)       
     
    18921893            Kcl = 0.0
    18931894            for j in range(0,l+1,4):
    1894                 im = j/4
     1895                im = j//4
    18951896                pcrs,dum = ptx.pyplmpsi(l,j,1,phi)
    18961897                Kcl += BOH['L='+str(l)][n-1][im]*pcrs*cosd(j*beta)       
     
    19491950                Kcl = 0.0
    19501951                for j in range(0,l+1,4):
    1951                     im = j/4
     1952                    im = j//4
    19521953                    pcrs,dum = ptx.pyplmpsi(l,j,len(beta),phi)
    19531954                    Kcl += BOH['L=%d'%(l)][n-1][im]*pcrs*cosd(j*beta)       
     
    23202321        for H in hklO:
    23212322            if H not in hklN:
    2322                 print H,' missing from hkl from GSASII'
     2323                print ('%d %s'%(H,' missing from hkl from GSASII'))
    23232324                err = False
    23242325        assert(err)
     
    23332334    for test in selftestlist:
    23342335        test()
    2335     print "OK"
     2336    print ("OK")
  • trunk/GSASIIlog.py

    r3023 r3136  
    1515such as menu item, tree item, button press, value change and so on.
    1616'''
     17from __future__ import division, print_function
    1718try:
    1819    import wx
     
    8990        self.indexRefs = indexRefs
    9091        self.value = value
    91         if debug: print 'Logging var change: w/treeRefs',treeRefs,'indexRefs',indexRefs,'new value=',value
     92        if debug: print ('Logging var change: w/treeRefs',treeRefs,'indexRefs',indexRefs,'new value=',value)
    9293    def __str__(self):
    9394        treeList = self.treeRefs[:]
     
    130131                if l: l += ' -> '
    131132                l += item
    132             print 'Logging menu command: '+l
     133            print ('Logging menu command: '+l)
    133134    def __str__(self):
    134135        return 'Menu press: From '+_l2s(self.menulabellist,'/')
     
    152153        self.wintitle = title
    153154        self.tablabel = tabname
    154         if debug: print 'Logging tab: "'+tabname+'" on window titled '+title
     155        if debug: print ('Logging tab: "'+tabname+'" on window titled '+title)
    155156    def __str__(self):
    156157        return 'Tab press: Tab='+_l2s([self.tablabel])+' on window labeled '+str(self.wintitle)
    157158    def Repaint(self):
    158159        'Used to redraw a window created in response to a Tab press'
    159         if debug: print 'Repaint'
     160        if debug: print ('Repaint')
    160161        saveval = LogInfo['LastPaintAction']
    161162        self.Replay()
     
    167168        LogInfo['LastPaintAction'] = self
    168169        if LogInfo['Tree'].G2frame.GetTitle() != wintitle:
    169             print LogInfo['Tree'].G2frame.GetTitle(),' != ',wintitle
     170            print (LogInfo['Tree'].G2frame.GetTitle()+' != '+wintitle)
    170171            raise Exception('tab in wrong window')
    171172        for PageNum in range(LogInfo['Tree'].G2frame.dataDisplay.GetPageCount()):
     
    174175                return
    175176        else:
    176             print tabname,'not in',[
     177            print (tabname+'not in'+[
    177178                LogInfo['Tree'].G2frame.dataDisplay.GetPageText(PageNum) for
    178                 PageNum in range(LogInfo['Tree'].G2frame.dataDisplay.GetPageCount())]
     179                PageNum in range(LogInfo['Tree'].G2frame.dataDisplay.GetPageCount())])
    179180            raise Exception('tab not found')
    180181def MakeTabLog(title,tabname):
     
    186187    def __init__(self,itemlist):
    187188        self.treeItemList = itemlist
    188         if debug: print 'Logging press on tree: ',itemlist
     189        if debug: print ('Logging press on tree: '+itemlist)
    189190    def __str__(self):
    190191        treeList = self.treeItemList[:]
     
    196197    def Repaint(self):
    197198        'Used to redraw a window created in response to a click on a data tree item'
    198         if debug: print 'Repaint'
     199        if debug: print ('Repaint')
    199200        saveval = LogInfo['LastPaintAction']
    200201        LogInfo['Tree'].SelectItem(LogInfo['Tree'].root) # need to select something else
     
    213214            item = G2gd.GetGPXtreeItemId(LogInfo['Tree'].G2frame,parent,txt)
    214215            if not item:
    215                 print 'Not found',txt
     216                print ('Not found',+txt)
    216217                return
    217218            else:
     
    228229        self.locationcode = locationcode
    229230        self.label = label
    230         if debug: print 'Logging '+label+' button press in '+locationcode
     231        if debug: print ('Logging '+label+' button press in '+locationcode)
    231232    def __str__(self):
    232233        return 'Press of '+self.label+' button in '+self.locationcode
     
    354355            if lastLog.treeRefs == treevars and lastLog.indexRefs == fullrefs:
    355356                lastLog.value = result[key]
    356                 if debug: print 'update last log to ',result[key]
     357                if debug: print ('update last log to '+result[key])
    357358                return
    358359        G2logList.append(VarLogEntry(treevars,fullrefs,result[key]))
    359360    else:
    360         print key,'Error: var change has no provenance info'
     361        print (key+' Error: var change has no provenance info')
    361362
    362363#===========================================================================
     
    410411        else:
    411412            # menu not found in menu, something is wrong
    412             print 'error tracing menuitem to parent menu',menuLabelList
     413            print ('error tracing menuitem to parent menu'+menuLabelList)
    413414            #raise Exception('debug1: error tracing menuitem')
    414415            return
     
    428429
    429430    # menu not found in menubar, something is wrong
    430     print 'error tracing menuitem to menubar',menuLabelList
     431    print ('error tracing menuitem to menubar'+menuLabelList)
    431432    #raise Exception('debug2: error tracing menuitem')
    432433    return
     
    461462        handler(event)
    462463    else:
    463         print 'Error no binding for menu command',menuLabelList,'id=',id
     464        print ('Error no binding for menu command'+menuLabelList+'id=%d'%id)
    464465        return
    465466
     
    468469def LogOn():
    469470    'Turn On logging of actions'
    470     if debug: print 'LogOn'
     471    if debug: print ('LogOn')
    471472    LogInfo['Logging'] = True
    472473
    473474def LogOff():
    474475    'Turn Off logging of actions'
    475     if debug: print 'LogOff'
     476    if debug: print ('LogOff')
    476477    LogInfo['Logging'] = False
    477478   
     
    496497    logstat = ShowLogStatus()
    497498    if logstat: LogOff()
    498     if debug: print 70*'='
     499    if debug: print (70*'=')
    499500    for i in sels:
    500501        i += 1
    501502        item = G2logList[i]
    502         if debug: print 'replaying',item
     503        if debug: print ('replaying'+item)
    503504        item.Replay()
    504505        wx.Yield()
     
    508509        clb.DeselectAll()
    509510        clb.SetSelection(i)
    510     if debug: print 70*'='
     511    if debug: print (70*'=')
    511512    # if the last command did not display a window, repaint it in
    512513    # case something on that window changed.
  • trunk/GSASIImapvars.py

    r3057 r3136  
    217217"""
    218218
     219from __future__ import division, print_function
    219220import numpy as np
    220221import sys
     
    346347        # N.B. No "_" names in holds
    347348        if len(cdict) == 1:
    348             fixVlist.append(cdict.keys()[0])
     349            fixVlist.append(list(cdict.keys())[0])
    349350   
    350351    # process equivalences: make a list of dependent and independent vars
     
    407408        errmsg += '\t'+ s + '\n'
    408409    equivVarList = list(set(indepVarList).union(set(depVarList)))
    409     if debug: print 'equivVarList',equivVarList
     410    if debug: print ('equivVarList',equivVarList)
    410411    inboth = set(fixVlist).intersection(set(equivVarList))
    411412    if len(inboth) > 0:
     
    563564    for cdict in constrDict:
    564565        if len(cdict) == 1:
    565             fixedVarList.append(cdict.keys()[0])
     566            fixedVarList.append(list(cdict.keys())[0])
    566567   
    567568    # process equivalences: make a list of dependent and independent vars
     
    584585                    notvaried += mv
    585586                if parmDict is not None and mv not in parmDict:
    586                     print "Dropping equivalence for variable "+str(mv)+". Not defined in this refinement"
     587                    print ("Dropping equivalence for variable "+str(mv)+". Not defined in this refinement")
    587588                    if mv not in dropVarList: dropVarList.append(mv)
    588589                    #msg += "\nCannot equivalence to variable "+str(mv)+". Not defined in this refinement"
     
    590591            for v,m in zip(varlist,invmultarr):
    591592                if parmDict is not None and v not in parmDict:
    592                     print "Dropping equivalence for dep. variable "+str(v)+". Not defined in this refinement"
     593                    print ("Dropping equivalence for dep. variable "+str(v)+". Not defined in this refinement")
    593594                    if v not in dropVarList: dropVarList.append(v)
    594595                    continue
     
    658659    if shortmsg and SeqHist is not None:
    659660        if msg:
    660             print ' *** ERROR in constraint definitions! ***'
    661             print msg
     661            print (' *** ERROR in constraint definitions! ***')
     662            print (msg)
    662663            raise Exception
    663         print '*** Sequential refinement: ignoring constraint definition(s): ***'
    664         print shortmsg
     664        print ('*** Sequential refinement: ignoring constraint definition(s): ***')
     665        print (shortmsg)
    665666        msg = ''
    666667    elif shortmsg:
    667668        msg += shortmsg
    668669    if msg:
    669         print ' *** ERROR in constraint definitions! ***'
    670         print msg
     670        print (' *** ERROR in constraint definitions! ***')
     671        print (msg)
    671672        raise Exception
    672673               
     
    758759        symGenList.append(False)
    759760    if msg:
    760         print ' *** ERROR in constraint definitions! ***'
    761         print msg
    762         print VarRemapShow(varyList)
     761        print (' *** ERROR in constraint definitions! ***')
     762        print (msg)
     763        print (VarRemapShow(varyList))
    763764        raise Exception
    764765    # setup dictionary containing the fixed values
     
    786787            if mv not in dependentVars: dependentVars.append(mv)
    787788    if debug: # on debug, show what is parsed & generated, semi-readable
    788         print 50*'-'
    789         print VarRemapShow(varyList)
    790         print 'Varied: ',varyList
    791         print 'Not Varied: ',fixedVarList
     789        print (50*'-')
     790        print (VarRemapShow(varyList))
     791        print ('Varied: ',varyList)
     792        print ('Not Varied: ',fixedVarList)
    792793
    793794def StoreEquivalence(independentVar,dependentList,symGen=True):
     
    809810    multlist = []
    810811    for var in dependentList:
    811         if isinstance(var, basestring):
     812        if isinstance(var, str):
    812813            mult = 1.0
    813814        elif len(var) == 2:
     
    859860    s2 = ''
    860861    s3 = ''
    861     print >>pFile,130*'-'
    862     print >>pFile,"Variables generated by constraints"
     862    pFile.write(130*'-'+'\n')
     863    pFile.write("Variables generated by constraints\n")
    863864    printlist.append(3*[None])
    864865    for name,val,esd in printlist:
    865866        if len(s1) > 120 or name is None:
    866             print >>pFile,''
    867             print >>pFile,s1
    868             print >>pFile,s2
    869             print >>pFile,s3
     867            pFile.write(''+'\n')
     868            pFile.write(s1+'\n')
     869            pFile.write(s2+'\n')
     870            pFile.write(s3+'\n')
    870871            s1 = ''
    871872            if name is None: break
     
    957958                j = 0
    958959                for v,m in zip(varlist,invmultarr):
    959                     if debug: print 'v,m[0]: ',v,m[0]
     960                    if debug: print ('v,m[0]: ',v,m[0])
    960961                    if len(s1.split('\n')[-1]) > 75: s1 += '\n        '
    961962                    if j > 0: s1 += ' & '
     
    10101011                j = 0
    10111012                for v,m in zip(varlist,invmultarr):
    1012                     if debug: print 'v,m[0]: ',v,m[0]
     1013                    if debug: print ('v,m[0]: ',v,m[0])
    10131014                    if len(s1.split('\n')[-1]) > 75: s1 += '\n        '
    10141015                    if j > 0: s1 += ' =  '
     
    10271028                    j += 1
    10281029                    s += '(%s * %s)' % (m,v)
    1029                 print 'unexpected sym op=',s
     1030                print ('unexpected sym op='+s)
    10301031    return symout
    10311032
     
    10511052            if multarr is None:
    10521053                for v,m in zip(varlist,invmultarr):
    1053                     if debug: print 'start dMdv',dMdv[varyList.index(name)]
    1054                     if debug: print 'add derv',v,'/',m[0],'to derv',name,'add=',derivDict[v] / m[0]
     1054                    if debug: print ('start dMdv',dMdv[varyList.index(name)])
     1055                    if debug: print ('add derv',v,'/',m[0],'to derv',name,'add=',derivDict[v] / m[0])
    10551056                    if m == 0: continue
    10561057                    dMdv[varyList.index(name)] += derivDict[v] / m[0]
    10571058            else:
    10581059                for v,m in zip(varlist,multarr[i,:]):
    1059                     if debug: print 'start dMdv',dMdv[varyList.index(name)]
    1060                     if debug: print 'add derv',v,'*',m,'to derv',name,'add=',m * derivDict[v]
     1060                    if debug: print ('start dMdv',dMdv[varyList.index(name)])
     1061                    if debug: print ('add derv',v,'*',m,'to derv',name,'add=',m * derivDict[v])
    10611062                    if m == 0: continue
    10621063                    dMdv[varyList.index(name)] += m * derivDict[v]
     
    11611162            a[j] -= proj(a[i],a[j])
    11621163        if np.allclose(np.linalg.norm(a[j]),0.0):
    1163             raise Exception,"Singular input to GramSchmidtOrtho"
     1164            raise Exception("Singular input to GramSchmidtOrtho")
    11641165        a[j] /= np.linalg.norm(a[j])
    11651166    return a
     
    11961197            return
    11971198    else:
    1198         raise Exception,'Singular input'
     1199        raise Exception('Singular input')
    11991200
    12001201def _RowEchelon(m,arr,collist):
     
    12481249    errmsg, warnmsg = CheckConstraints(varylist,constrDict,fixedList)
    12491250    if errmsg:
    1250         print "*** Error ********************"
    1251         print errmsg
     1251        print ("*** Error ********************")
     1252        print (errmsg)
    12521253    if warnmsg:
    1253         print "*** Warning ********************"
    1254         print warnmsg
     1254        print ("*** Warning ********************")
     1255        print (warnmsg)
    12551256    if errmsg or warnmsg:
    12561257        sys.exit()
    12571258    groups,parmlist = GroupConstraints(constrDict)
    12581259    GenerateConstraints(groups,parmlist,varylist,constrDict,fixedList)
    1259     print VarRemapShow(varylist)
     1260    print (VarRemapShow(varylist))
    12601261    parmdict.update( {
    12611262        '0:12:Scale': 1.0, '0:11:Scale': 1.0, '0:14:Scale': 1.0, '0:13:Scale': 1.0, '0:0:Scale': 2.0,
     
    12671268        '2::atomx:3':0.23,'2::atomy:3':-.23, '2::atomz:3':-0.11,
    12681269        })
    1269     print 'parmdict start',parmdict
    1270     print 'varylist start',varylist
     1270    print ('parmdict start',parmdict)
     1271    print ('varylist start',varylist)
    12711272    before = parmdict.copy()
    12721273    Map2Dict(parmdict,varylist)
    1273     print 'parmdict before and after Map2Dict'
    1274     print '  key / before / after'
    1275     for key in sorted(parmdict.keys()):
    1276         print '  '+key,'\t',before.get(key),'\t',parmdict[key]
    1277     print 'varylist after',varylist
     1274    print ('parmdict before and after Map2Dict')
     1275    print ('  key / before / after')
     1276    for key in sorted(list(parmdict.keys())):
     1277        print ('  '+key,'\t',before.get(key),'\t',parmdict[key])
     1278    print ('varylist after',varylist)
    12781279    before = parmdict.copy()
    12791280    Dict2Map(parmdict,varylist)
    1280     print 'after Dict2Map'
    1281     print '  key / before / after'
    1282     for key in sorted(parmdict.keys()):
    1283         print '  '+key,'\t',before.get(key),'\t',parmdict[key]
     1281    print ('after Dict2Map')
     1282    print ('  key / before / after')
     1283    for key in sorted(list(parmdict.keys())):
     1284        print ('  '+key,'\t',before.get(key),'\t',parmdict[key])
    12841285#    dMdv = len(varylist)*[0]
    12851286#    deriv = {}
  • trunk/GSASIImath.py

    r3103 r3136  
    1515
    1616'''
     17from __future__ import division, print_function
    1718import random as rn
    1819import numpy as np
     
    155156    nfev = 0
    156157    if Print:
    157         print ' Hessian Levenburg-Marquardt SVD refinement on %d variables:'%(n)
     158        print (' Hessian Levenburg-Marquardt SVD refinement on %d variables:'%(n))
    158159    Lam = np.zeros((n,n))
    159160    while icycle < maxcyc:
     
    171172        Amat /= Anorm
    172173        if Print:
    173             print 'initial chi^2 %.5g'%(chisq0)
     174            print ('initial chi^2 %.5g'%(chisq0))
    174175        chitol = ftol
    175176        while True:
     
    179180                Ainv,Nzeros = pinv(Amatlam,xtol)    #do Moore-Penrose inversion (via SVD)
    180181            except nl.LinAlgError:
    181                 print 'ouch #1 bad SVD inversion; change parameterization'
     182                print ('ouch #1 bad SVD inversion; change parameterization')
    182183                psing = list(np.where(np.diag(nl.qr(Amatlam)[1]) < 1.e-14)[0])
    183184                return [x0,None,{'num cyc':icycle,'fvec':M,'nfev':nfev,'lamMax':lamMax,'psing':psing,'SVD0':-1}]
     
    190191                lam *= 10.
    191192                if Print:
    192                     print 'new chi^2 %.5g, %d SVD zeros ; matrix modification needed; lambda now %.1e'%(chisq1,Nzeros,lam)
     193                    print ('new chi^2 %.5g, %d SVD zeros ; matrix modification needed; lambda now %.1e'%(chisq1,Nzeros,lam))
    193194            else:
    194195                x0 += Xvec
     
    196197                break
    197198            if lam > 10.e3:
    198                 print 'ouch #3 chisq1 ',chisq1,' stuck > chisq0 ',chisq0
     199                print ('ouch #3 chisq1 %g.4 stuck > chisq0 %g.4'%(chisq1,chisq0))
    199200                break
    200201            chitol *= 2
     
    202203        deltaChi2 = (chisq0-chisq1)/chisq0
    203204        if Print:
    204             print ' Cycle: %d, Time: %.2fs, Chi**2: %.5g, Lambda: %.3g,  Delta: %.3g'%(
    205                 icycle,time.time()-time0,chisq1,lamMax,deltaChi2)
     205            print (' Cycle: %d, Time: %.2fs, Chi**2: %.5g, Lambda: %.3g,  Delta: %.3g'%(
     206                icycle,time.time()-time0,chisq1,lamMax,deltaChi2))
    206207        if deltaChi2 < ftol:
    207208            ifConverged = True
    208             if Print: print "converged"
     209            if Print: print ("converged")
    209210            break
    210211        icycle += 1
     
    219220        Bmat,Nzero = pinv(Amatlam,xtol)    #Moore-Penrose inversion (via SVD) & count of zeros
    220221#        if Print:
    221         print 'Found %d SVD zeros'%(Nzero)
     222        if Print: print ('Found %d SVD zeros'%(Nzero))
    222223#        Bmat = nl.inv(Amatlam); Nzeros = 0
    223224        Bmat = Bmat/Anorm
    224225        return [x0,Bmat,{'num cyc':icycle,'fvec':M,'nfev':nfev,'lamMax':lamMax,'psing':[],'SVD0':Nzero,'Converged': ifConverged, 'DelChi2':deltaChi2}]
    225226    except nl.LinAlgError:
    226         print 'ouch #2 linear algebra error in making v-cov matrix'
     227        print ('ouch #2 linear algebra error in making v-cov matrix')
    227228        psing = []
    228229        if maxcyc:
     
    285286    nfev = 0
    286287    if Print:
    287         print ' Hessian SVD refinement on %d variables:'%(n)
     288        print (' Hessian SVD refinement on %d variables:'%(n))
    288289    while icycle < maxcyc:
    289290        time0 = time.time()
     
    300301        Amat /= Anorm
    301302        if Print:
    302             print 'initial chi^2 %.5g'%(chisq0)
     303            print ('initial chi^2 %.5g'%(chisq0))
    303304        try:
    304305            Ainv,Nzeros = pinv(Amat,xtol)    #do Moore-Penrose inversion (via SVD)
    305306        except nl.LinAlgError:
    306             print 'ouch #1 bad SVD inversion; change parameterization'
     307            print ('ouch #1 bad SVD inversion; change parameterization')
    307308            psing = list(np.where(np.diag(nl.qr(Amat)[1]) < 1.e-14)[0])
    308309            return [x0,None,{'num cyc':icycle,'fvec':M,'nfev':nfev,'lamMax':0.,'psing':psing,'SVD0':-1}]
     
    314315        deltaChi2 = (chisq0-chisq1)/chisq0
    315316        if Print:
    316             print ' Cycle: %d, Time: %.2fs, Chi**2: %.5g, Delta: %.3g'%(
    317                 icycle,time.time()-time0,chisq1,deltaChi2)
     317            print (' Cycle: %d, Time: %.2fs, Chi**2: %.5g, Delta: %.3g'%(
     318                icycle,time.time()-time0,chisq1,deltaChi2))
    318319        if deltaChi2 < ftol:
    319320            ifConverged = True
    320             if Print: print "converged"
     321            if Print: print ("converged")
    321322            break
    322323        icycle += 1
     
    32933