Changeset 547


Ignore:
Timestamp:
Apr 16, 2012 4:06:27 PM (12 years ago)
Author:
toby
Message:

redo constraints input & editing; change file overdef in G2struct

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/G2importphase_CIF.py

    r525 r547  
    1818    def __init__(self):
    1919        super(self.__class__,self).__init__( # fancy way to say ImportPhase.__init__
    20             #extensionlist=('.CIF','.cif'),
    21             extensionlist=('.CIF','.cif','.pdb'), # just for test!
     20            extensionlist=('.CIF','.cif'),
    2221            strictExtension=False,
    2322            formatName = 'CIF',
  • trunk/GSASII.py

    r541 r547  
    1414import sys
    1515import math
    16 import cPickle
     16#import cPickle
    1717import time
    1818import copy
     
    841841            panel.Fit()
    842842            self.Fit()
     843
     844    class ConstraintDialog(wx.Dialog):
     845        '''Window to edit Constraint values
     846        '''
     847        def __init__(self,parent,title,text,data):
     848            wx.Dialog.__init__(self,parent,-1,title,
     849                pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE)
     850            self.data = data
     851            panel = wx.Panel(self)
     852            mainSizer = wx.BoxSizer(wx.VERTICAL)
     853            topLabl = wx.StaticText(panel,-1,text)
     854            mainSizer.Add((10,10),1)
     855            mainSizer.Add(topLabl,0,wx.ALIGN_CENTER_VERTICAL|wx.LEFT,10)
     856            mainSizer.Add((10,10),1)
     857            dataGridSizer = wx.FlexGridSizer(rows=len(data),cols=2,hgap=2,vgap=2)
     858            for id,item in enumerate(self.data[:-1]):
     859                #name = wx.TextCtrl(panel,-1,item[1],size=wx.Size(200,20))
     860                name = wx.StaticText(panel,-1,item[1],size=wx.Size(200,20))
     861                #name.SetEditable(False)
     862                scale = wx.TextCtrl(panel,id,'%.3f'%(item[0]),style=wx.TE_PROCESS_ENTER)
     863                scale.Bind(wx.EVT_TEXT_ENTER,self.OnScaleChange)
     864                scale.Bind(wx.EVT_KILL_FOCUS,self.OnScaleChange)
     865                dataGridSizer.Add(scale,0,wx.LEFT,10)
     866                dataGridSizer.Add(name,0,wx.RIGHT,10)
     867            mainSizer.Add(dataGridSizer,0,wx.EXPAND)
     868            OkBtn = wx.Button(panel,-1,"Ok")
     869            OkBtn.Bind(wx.EVT_BUTTON, self.OnOk)
     870            cancelBtn = wx.Button(panel,-1,"Cancel")
     871            cancelBtn.Bind(wx.EVT_BUTTON, self.OnCancel)
     872            btnSizer = wx.BoxSizer(wx.HORIZONTAL)
     873            btnSizer.Add((20,20),1)
     874            btnSizer.Add(OkBtn)
     875            btnSizer.Add((20,20),1)
     876            btnSizer.Add(cancelBtn)
     877            btnSizer.Add((20,20),1)
     878           
     879            mainSizer.Add(btnSizer,0,wx.EXPAND|wx.BOTTOM|wx.TOP, 10)
     880            panel.SetSizer(mainSizer)
     881            panel.Fit()
     882            self.Fit()
    843883           
    844884        def OnNameChange(self,event):
     
    866906            parent.Raise()
    867907            self.EndModal(wx.ID_CANCEL)             
    868             self.Destroy()
     908            #self.Destroy()
    869909           
    870910        def GetData(self):
  • trunk/GSASIIgrid.py

    r537 r547  
    258258        self.ConstraintEdit.Append(id=wxID_CONSTRAINTADD, kind=wx.ITEM_NORMAL,text='Add constraint',
    259259            help='Add constraint on parameter values')
    260         self.ConstraintEdit.Append(id=wxID_FUNCTADD, kind=wx.ITEM_NORMAL,text='Add function',
    261             help='Add function of parameter values')
     260        self.ConstraintEdit.Append(id=wxID_FUNCTADD, kind=wx.ITEM_NORMAL,text='Add New Var',
     261            help='Add variable composed of existing parameter')
    262262           
    263263# Restraints
     
    10321032    G2frame.dataFrame.setSizePosLeft([700,350])
    10331033   
    1034 def UpdateConstraints(G2frame,data):             
    1035 #    data.update({'Hist':[],'HAP':[],'Phase':[]})       #empty dict - fill it
     1034def UpdateConstraints(G2frame,data):
     1035    '''Called when Constraints tree item is selected.
     1036    Displays the constraints in the data window
     1037    '''
    10361038    if not data:
    10371039        data.update({'Hist':[],'HAP':[],'Phase':[]})       #empty dict - fill it
     
    11031105       
    11041106    def SelectVarbs(page,FrstVarb,varList,legend,constType):
     1107        '''Select variables used in Constraints after one variable has
     1108        been selected which determines the appropriate variables to be
     1109        used here. Then creates the constraint and adds it to the
     1110        constraints list.
     1111        Called from OnAddEquivalence, OnAddFunction & OnAddConstraint
     1112        '''
    11051113        #future -  add 'all:all:name', '0:all:name', etc. to the varList
    11061114        if page[1] == 'phs':
    11071115            atchoice = [item+' for '+phaseAtNames[item] for item in varList]
    1108             dlg = wx.MultiChoiceDialog(G2frame,'Select more variables:'+legend,FrstVarb+' and:',atchoice)
     1116            dlg = wx.MultiChoiceDialog(G2frame,
     1117                                       'Select more variables:'+legend,
     1118                                       'Constrain '+FrstVarb+' and...',
     1119                                       atchoice)
    11091120        else:
    1110             dlg = wx.MultiChoiceDialog(G2frame,'Select more variables:'+legend,FrstVarb+' and:',varList)
     1121            dlg = wx.MultiChoiceDialog(G2frame,
     1122                                       'Select more variables:'+legend,
     1123                                       'Constrain '+FrstVarb+' and...',
     1124                                       varList)
    11111125        varbs = [FrstVarb,]
    11121126        if dlg.ShowModal() == wx.ID_OK:
     
    11171131        if len(varbs) > 1:
    11181132            if 'equivalence' in constType:
    1119                 constr = []
     1133                constr = [[1.0,FrstVarb]]
    11201134                for item in varbs[1:]:
    1121                     constr += [[[1.0,FrstVarb],[-1.0,item],None,None],]
    1122                 return constr           #multiple constraints
     1135                    constr += [[1.0,item]]
     1136                return [constr+[None,None,'e']]      # list of equivalent variables & mults
    11231137            elif 'function' in constType:
    11241138                constr = map(list,zip([1.0 for i in range(len(varbs))],varbs))
    1125                 return [constr+[0.0,False]]         #just one constraint
     1139                return [constr+[None,False,'f']]         #just one constraint
    11261140            else:       #'constraint'
    11271141                constr = map(list,zip([1.0 for i in range(len(varbs))],varbs))
    1128                 return [constr+[1.0,None]]          #just one constraint - default sum to one
     1142                return [constr+[1.0,None,'c']]          #just one constraint - default sum to one
    11291143        return []
    11301144             
    11311145    def OnAddHold(event):
     1146        '''add a Hold constraint'''
    11321147        for phase in Phases:
    11331148            Phase = Phases[phase]
     
    11441159            sel = dlg.GetSelection()
    11451160            FrstVarb = choice[2][sel]
    1146             data[choice[3]] += [[[0.0,FrstVarb],None,None],]
     1161            data[choice[3]] += [[[0.0,FrstVarb],None,None,'h'],]
    11471162        dlg.Destroy()
    11481163        choice[4]()
    11491164       
    11501165    def OnAddEquivalence(event):
     1166        '''add an Equivalence constraint'''
    11511167        constr = []
    11521168        page = G2frame.Page
     
    11681184   
    11691185    def OnAddFunction(event):
     1186        '''add a Function (new variable) constraint'''
    11701187        constr = []
    11711188        page = G2frame.Page
     
    11871204                       
    11881205    def OnAddConstraint(event):
     1206        '''add a constraint equation to the constraints list'''
    11891207        constr = []
    11901208        page = G2frame.Page
     
    12061224                       
    12071225    def ConstSizer(name,pageDisplay):
    1208         constSizer = wx.FlexGridSizer(1,4,0,0)
     1226        '''This creates a sizer displaying all of the constraints entered
     1227        '''
     1228        constSizer = wx.FlexGridSizer(1,5,0,0)
    12091229        for Id,item in enumerate(data[name]):
     1230            eqString = ['',]
     1231            if item[-1] == 'h':
     1232                constSizer.Add((5,5),0)              # blank space for edit button
     1233                typeString = ' FIXED   '
     1234                eqString[-1] = item[0][1]+'   '
     1235            elif isinstance(item[-1],str):
     1236                constEdit = wx.Button(pageDisplay,-1,'Edit',style=wx.BU_EXACTFIT)
     1237                constEdit.Bind(wx.EVT_BUTTON,OnConstEdit)
     1238                constSizer.Add(constEdit)            # edit button
     1239                Indx[constEdit.GetId()] = [Id,name]
     1240                if item[-1] == 'f':
     1241                    for term in item[:-3]:
     1242                        if len(eqString[-1]) > 60:
     1243                            eqString.append(' ')
     1244                        if eqString[-1] != '':
     1245                            if term[0] > 0:
     1246                                eqString[-1] += ' + '
     1247                            else:
     1248                                eqString[-1] += ' - '
     1249                        eqString[-1] += '%.3f*%s '%(abs(term[0]),term[1])
     1250                    typeString = ' NEWVAR  '
     1251                    eqString[-1] += ' = New Variable   '
     1252                elif item[-1] == 'c':
     1253                    for term in item[:-3]:
     1254                        if len(eqString[-1]) > 60:
     1255                            eqString.append(' ')
     1256                        if eqString[-1] != '':
     1257                            if term[0] > 0:
     1258                                eqString[-1] += ' + '
     1259                            else:
     1260                                eqString[-1] += ' - '
     1261                        eqString[-1] += '%.3f*%s '%(abs(term[0]),term[1])
     1262                    typeString = ' CONSTR  '
     1263                    eqString[-1] += ' = %.3f'%(item[-3])+'  '
     1264                elif item[-1] == 'e':
     1265                    first = 1.0
     1266                    for term in item[:-3]:
     1267                        if len(eqString[-1]) > 60:
     1268                            eqString.append(' ')
     1269                        if eqString[-1] == '':
     1270                            eqString[-1] += '%s '%(term[1])
     1271                            if term[0] != 0: first = term[0]
     1272                        else:
     1273                            eqString[-1] += ' = %.3f*%s '%(term[0]/first,term[1])
     1274                    typeString = ' EQUIV   '
     1275                else:
     1276                    print 'Unexpected constraint',item
     1277            else:
     1278                print 'Removing old-style constraints'
     1279                data[name] = []
     1280                return constSizer
    12101281            constDel = wx.Button(pageDisplay,-1,'Delete',style=wx.BU_EXACTFIT)
    12111282            constDel.Bind(wx.EVT_BUTTON,OnConstDel)
    12121283            Indx[constDel.GetId()] = [Id,name]
    1213             if len(item) < 4:
    1214                 constSizer.Add((5,5),0)
    1215                 constSizer.Add(constDel)
    1216                 eqString = ' FIXED   '+item[0][1]+'   '
    1217             else:
    1218                 constEdit = wx.Button(pageDisplay,-1,'Edit',style=wx.BU_EXACTFIT)
    1219                 constEdit.Bind(wx.EVT_BUTTON,OnConstEdit)
    1220                 Indx[constEdit.GetId()] = [Id,name]
    1221                 constSizer.Add(constEdit)           
    1222                 constSizer.Add(constDel)
    1223                 if isinstance(item[-1],bool):
    1224                     eqString = ' FUNCT   '
    1225                 elif isinstance(item[-2],float):
    1226                     eqString = ' CONSTR  '
    1227                 else:
    1228                     eqString = ' EQUIV   '
    1229                 for term in item[:-2]:
    1230                     eqString += '%+.3f*%s '%(term[0],term[1])
    1231                 if isinstance(item[-2],float):
    1232                     eqString += ' = %.3f'%(item[-2])+'  '
    1233                 else:
    1234                     eqString += ' = 0   '
    1235             constSizer.Add(wx.StaticText(pageDisplay,-1,eqString),0,wx.ALIGN_CENTER_VERTICAL)
    1236             if isinstance(item[-1],bool):
    1237                 constRef = wx.CheckBox(pageDisplay,-1,label=' Refine?')                   
    1238                 constRef.SetValue(item[-1])
     1284            constSizer.Add(constDel)             # delete button
     1285            constSizer.Add(wx.StaticText(pageDisplay,-1,typeString))
     1286            EqSizer = wx.BoxSizer(wx.VERTICAL)
     1287            for s in eqString:
     1288                EqSizer.Add(wx.StaticText(pageDisplay,-1,s),0,wx.ALIGN_CENTER_VERTICAL)
     1289            constSizer.Add(EqSizer,0,wx.ALIGN_CENTER_VERTICAL)
     1290            if item[-1] == 'f':
     1291                constRef = wx.CheckBox(pageDisplay,-1,label=' Refine?')
     1292                constRef.SetValue(item[-2])
    12391293                constRef.Bind(wx.EVT_CHECKBOX,OnConstRef)
    12401294                Indx[constRef.GetId()] = item
    1241                 constSizer.Add(constRef,0,wx.ALIGN_CENTER_VERTICAL)
     1295                constSizer.Add(constRef)
    12421296            else:
    12431297                constSizer.Add((5,5),0)
     
    12461300    def OnConstRef(event):
    12471301        Obj = event.GetEventObject()
    1248         Indx[Obj.GetId()][-1] = Obj.GetValue()
     1302        Indx[Obj.GetId()][-2] = Obj.GetValue()
    12491303       
    12501304    def OnConstDel(event):
     
    12551309       
    12561310    def OnConstEdit(event):
     1311        '''Called to edit an individual contraint by the Edit button'''
    12571312        Obj = event.GetEventObject()
    12581313        Id,name = Indx[Obj.GetId()]
    1259         const = data[name][Id][-2]       
    1260         if isinstance(data[name][Id][-1],bool):
    1261             items = data[name][Id][:-2]+[[],]
    1262             constType = 'Function'
    1263             extra = '; sum = new variable'
    1264         elif isinstance(data[name][Id][-2],float):
    1265             items = data[name][Id][:-2]+[[const,'= fixed value'],[]]
     1314        if data[name][Id][-1] == 'f':
     1315            items = data[name][Id][:-3]+[[],]
     1316            constType = 'New Variable'
     1317            lbl = 'Enter value for each term in constraint; sum = new variable'
     1318        elif data[name][Id][-1] == 'c':
     1319            items = data[name][Id][:-3]+[
     1320                [data[name][Id][-3],'= fixed value'],[]]
    12661321            constType = 'Constraint'
    1267             extra = ' sum = constant'
     1322            lbl = 'Edit value for each term in constant constraint sum'
     1323        elif data[name][Id][-1] == 'e':
     1324            items = data[name][Id][:-3]+[[],]
     1325            constType = 'Equivalence'
     1326            lbl = 'Variable ' + items[0][1] + ' is equal to: '
    12681327        else:
    1269             items = data[name][Id][:-2]+[[],]
    1270             constType = 'Equivalence'
    1271             extra = '; sum = 0'
    1272         dlg = G2frame.SumDialog(G2frame,constType,'Enter value for each term in constraint'+extra,'',items)
     1328            return
     1329        dlg = G2frame.ConstraintDialog(G2frame,constType,lbl,items)
    12731330        try:
    12741331            if dlg.ShowModal() == wx.ID_OK:
    12751332                result = dlg.GetData()
    1276                 if isinstance(data[name][Id][-2],float):
    1277                     data[name][Id][:-2] = result[:-2]
    1278                     data[name][Id][-2] = result[-2][0]
     1333                if data[name][Id][-1] == 'c':
     1334                    data[name][Id][:-3] = result[:-2]
     1335                    data[name][Id][-3] = result[-2][0]
    12791336                else:
    1280                     data[name][Id][:-2] = result[:-1]
     1337                    data[name][Id][:-3] = result[:-1]
    12811338        except:
    12821339            import traceback
     
    12871344   
    12881345    def UpdateHAPConstr():
     1346        '''Responds to press on Histogram/Phase Constraints tab,
     1347        shows constraints in data window'''
    12891348        HAPConstr.DestroyChildren()
    12901349        HAPDisplay = wx.Panel(HAPConstr)
     
    12971356        Size[1] = max(Size[1],250) + 20
    12981357        HAPDisplay.SetSize(Size)
     1358        # scroll bar not working, at least not on Mac
    12991359        HAPConstr.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1)
    13001360        Size[1] = min(Size[1],250)
     
    13021362       
    13031363    def UpdateHistConstr():
     1364        '''Responds to press on Histogram Constraints tab,
     1365        shows constraints in data window'''
    13041366        HistConstr.DestroyChildren()
    13051367        HistDisplay = wx.Panel(HistConstr)
     
    13171379       
    13181380    def UpdatePhaseConstr():
     1381        '''Responds to press on Phase Constraint tab,
     1382        shows constraints in data window'''
    13191383        PhaseConstr.DestroyChildren()
    13201384        PhaseDisplay = wx.Panel(PhaseConstr)
     
    13521416       
    13531417    plegend,hlegend,phlegend = GetPHlegends(Phases,Histograms)
    1354     scope = {'hst':['Histogram variables:',hlegend,histList,'Hist',UpdateHistConstr],
    1355         'hap':['HAP variables:',phlegend,hapList,'HAP',UpdateHAPConstr],
    1356         'phs':['Phase variables:',plegend,phaseList,'Phase',UpdatePhaseConstr]}
     1418    scope = {'hst':['Histogram contraints:',hlegend,histList,'Hist',UpdateHistConstr],
     1419        'hap':['Histogram * Phase contraints:',phlegend,hapList,'HAP',UpdateHAPConstr],
     1420        'phs':['Phase contraints:',plegend,phaseList,'Phase',UpdatePhaseConstr]}
    13571421    if G2frame.dataDisplay:
    13581422        G2frame.dataDisplay.Destroy()
  • trunk/GSASIIstruct.py

    r529 r547  
    4343    Controls = {'deriv type':'analytic Hessian','max cyc':3,'max Hprocess':1,
    4444        'max Rprocess':1,'min dM/M':0.0001,'shift factor':1.}
    45     file = open(GPXfile,'rb')
     45    fl = open(GPXfile,'rb')
    4646    while True:
    4747        try:
    48             data = cPickle.load(file)
     48            data = cPickle.load(fl)
    4949        except EOFError:
    5050            break
     
    5252        if datum[0] == 'Controls':
    5353            Controls.update(datum[1])
    54     file.close()
     54    fl.close()
    5555    return Controls
    5656   
    57 def GetConstraints(GPXfile):
     57def GetConstraints(GPXfile,varyList,parmDict):
     58    '''Read the constraints from the GPX file and interpret them
     59    Note that this needs an update to match the new-style constraints
     60    '''
    5861    constList = []
    59     file = open(GPXfile,'rb')
     62    fl = open(GPXfile,'rb')
    6063    while True:
    6164        try:
    62             data = cPickle.load(file)
     65            data = cPickle.load(fl)
    6366        except EOFError:
    6467            break
     
    6871            for item in constDict:
    6972                constList += constDict[item]
    70     file.close()
     73    fl.close()
    7174    constDict = []
    7275    constFlag = []
    7376    fixedList = []
    7477    for item in constList:
    75         if item[-2]:
    76             fixedList.append(str(item[-2]))
     78        if item[-1] == 'h':
     79            # process a hold
     80            fixedList.append('0')
     81            constFlag.append([])
     82            constDict.append({item[0][1]:0.0})
     83        elif item[-1] == 'f':
     84            # process a new variable
     85            fixedList.append(None)
     86            constFlag.append([])
     87            constDict.append({})
     88            for term in item[:-3]:
     89                constDict[-1][term[1]] = term[0]
     90            if item[-2]:
     91                constFlag[-1] = ['Vary']
     92        elif item[-1] == 'c':
     93            # process a contraint relationship
     94            const = item[-3]
     95            vars = 0
     96            used = {}
     97            for term in item[:-3]:
     98                if term[1] in varyList:
     99                    used[term[1]] = term[0]
     100                    vars += 1
     101                else:
     102                    const -= parmDict[term[1]]*term[0]
     103            if vars == 0:
     104                print 'Contraint is not used',item[:-3],'=',item[-3]
     105                print 'no refined variables'
     106                continue
     107            fixedList.append(str(const))
     108            constFlag.append(['VaryFree'])
     109            constDict.append(used)
     110        elif item[-1] == 'e':
     111            # process an equivalence
     112            first = None
     113            eqlist = []
     114            for term in item[:-3]:
     115                if first is None:
     116                    first = term[0]
     117                    if first == 0: first = 1.0
     118                    firstvar = term[1]
     119                else:
     120                    eqlist.append([term[1],term[0]/first])
     121            G2mv.StoreEquivalence(firstvar,eqlist)               
    77122        else:
    78             fixedList.append('0')
    79         if item[-1]:
    80             constFlag.append(['VARY'])
    81         else:
    82             constFlag.append([])
    83         itemDict = {}
    84         for term in item[:-2]:
    85             itemDict[term[1]] = term[0]
    86         constDict.append(itemDict)
     123            pass
    87124    return constDict,constFlag,fixedList
    88125   
     
    94131        PhaseNames = list of phase names
    95132    '''
    96     file = open(GPXfile,'rb')
     133    fl = open(GPXfile,'rb')
    97134    PhaseNames = []
    98135    while True:
    99136        try:
    100             data = cPickle.load(file)
     137            data = cPickle.load(fl)
    101138        except EOFError:
    102139            break
     
    105142            for datus in data[1:]:
    106143                PhaseNames.append(datus[0])
    107     file.close()
     144    fl.close()
    108145    return PhaseNames
    109146
     
    116153        phase dictionary
    117154    '''       
    118     file = open(GPXfile,'rb')
     155    fl = open(GPXfile,'rb')
    119156    General = {}
    120157    Atoms = []
    121158    while True:
    122159        try:
    123             data = cPickle.load(file)
     160            data = cPickle.load(fl)
    124161        except EOFError:
    125162            break
     
    129166                if datus[0] == PhaseName:
    130167                    break
    131     file.close()
     168    fl.close()
    132169    return datus[1]
    133170   
     
    140177        Histograms = dictionary of histograms (types = PWDR & HKLF)
    141178    """
    142     file = open(GPXfile,'rb')
     179    fl = open(GPXfile,'rb')
    143180    Histograms = {}
    144181    while True:
    145182        try:
    146             data = cPickle.load(file)
     183            data = cPickle.load(fl)
    147184        except EOFError:
    148185            break
     
    168205                HKLFdata = datum[1:][0]
    169206                Histograms[hist] = HKLFdata           
    170     file.close()
     207    fl.close()
    171208    return Histograms
    172209   
     
    179216        HistogramNames = list of histogram names (types = PWDR & HKLF)
    180217    """
    181     file = open(GPXfile,'rb')
     218    fl = open(GPXfile,'rb')
    182219    HistogramNames = []
    183220    while True:
    184221        try:
    185             data = cPickle.load(file)
     222            data = cPickle.load(fl)
    186223        except EOFError:
    187224            break
     
    189226        if datum[0][:4] in hType:
    190227            HistogramNames.append(datum[0])
    191     file.close()
     228    fl.close()
    192229    return HistogramNames
    193230   
     
    348385       
    349386    '''
    350     file = open(GPXfile,'rb')
     387    fl = open(GPXfile,'rb')
    351388    PWDRdata = {}
    352389    while True:
    353390        try:
    354             data = cPickle.load(file)
     391            data = cPickle.load(fl)
    355392        except EOFError:
    356393            break
     
    366403            except IndexError:
    367404                PWDRdata['Reflection lists'] = {}
    368     file.close()
     405    fl.close()
    369406    return PWDRdata
    370407   
     
    378415            HKLF = [np.array([h,k,l]),FoSq,sigFoSq,FcSq,Fcp,Fcpp,phase]
    379416    '''
    380     file = open(GPXfile,'rb')
     417    fl = open(GPXfile,'rb')
    381418    HKLFdata = []
    382419    while True:
    383420        try:
    384             data = cPickle.load(file)
     421            data = cPickle.load(fl)
    385422        except EOFError:
    386423            break
     
    388425        if datum[0] == HKLFname:
    389426            HKLFdata = datum[1:][0]
    390     file.close()
     427    fl.close()
    391428    return HKLFdata
    392429   
     
    28122849    calcControls = {}
    28132850    calcControls.update(Controls)           
    2814     constrDict,constrFlag,fixedList = GetConstraints(GPXfile)
    28152851    Histograms,Phases = GetUsedHistogramsAndPhases(GPXfile)
    28162852    if not Phases:
     
    28362872    GetFprime(calcControls,Histograms)
    28372873    # do constraint processing
     2874    constrDict,constrFlag,fixedList = GetConstraints(GPXfile,varyList,parmDict)
    28382875    try:
    28392876        groups,parmlist = G2mv.GroupConstraints(constrDict)
     
    28482885        print msg
    28492886        raise Exception(' *** Refine aborted ***')
     2887    print G2mv.VarRemapShow(varyList)
    28502888    G2mv.Map2Dict(parmDict,varyList)
    2851 #    print G2mv.VarRemapShow(varyList)
    28522889    Rvals = {}
    28532890    while True:
     
    29312968#for testing purposes!!!
    29322969#    import cPickle
    2933 #    file = open('structTestdata.dat','wb')
    2934 #    cPickle.dump(parmDict,file,1)
    2935 #    cPickle.dump(varyList,file,1)
     2970#    fl = open('structTestdata.dat','wb')
     2971#    cPickle.dump(parmDict,fl,1)
     2972#    cPickle.dump(varyList,fl,1)
    29362973#    for histogram in Histograms:
    29372974#        if 'PWDR' in histogram[:4]:
    29382975#            Histogram = Histograms[histogram]
    2939 #    cPickle.dump(Histogram,file,1)
    2940 #    cPickle.dump(Phases,file,1)
    2941 #    cPickle.dump(calcControls,file,1)
    2942 #    cPickle.dump(pawleyLookup,file,1)
    2943 #    file.close()
     2976#    cPickle.dump(Histogram,fl,1)
     2977#    cPickle.dump(Phases,fl,1)
     2978#    cPickle.dump(calcControls,fl,1)
     2979#    cPickle.dump(pawleyLookup,fl,1)
     2980#    fl.close()
    29442981
    29452982    if dlg:
     
    29552992    Controls = GetControls(GPXfile)
    29562993    ShowControls(Controls)           
    2957     constrDict,constrFlag,fixedList = GetConstraints(GPXfile)
    29582994    Histograms,Phases = GetUsedHistogramsAndPhases(GPXfile)
    29592995    if not Phases:
     
    30173053        parmDict.update(histDict)
    30183054        GetFprime(calcControls,Histo)
    3019         constrDict,constrFlag,fixedList = G2mv.InputParse([])        #constraints go here?
     3055        # do constraint processing
     3056        constrDict,constrFlag,fixedList = GetConstraints(GPXfile,varyList,parmDict)
    30203057        groups,parmlist = G2mv.GroupConstraints(constrDict)
    30213058        G2mv.GenerateConstraints(groups,parmlist,varyList,constrDict,constrFlag,fixedList)
Note: See TracChangeset for help on using the changeset viewer.