Changeset 3371
- Timestamp:
- May 4, 2018 5:57:13 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r3356 r3371 453 453 elif l[3] == "all": 454 454 for ph in phlist: 455 key = G2obj.LookupPhaseName( l[0])[0]455 key = G2obj.LookupPhaseName(ph)[0] 456 456 for hst in hstlist: # should be blank 457 457 for iatm,at in enumerate(Phases[key]['Atoms']): … … 461 461 elif '=' in l[3]: 462 462 for ph in phlist: 463 key = G2obj.LookupPhaseName( l[0])[0]463 key = G2obj.LookupPhaseName(ph)[0] 464 464 cx,ct,cs,cia = Phases[key]['General']['AtomPtrs'] 465 465 for hst in hstlist: # should be blank … … 472 472 else: 473 473 for ph in phlist: 474 key = G2obj.LookupPhaseName( l[0])[0]474 key = G2obj.LookupPhaseName(ph)[0] 475 475 for hst in hstlist: # should be blank 476 476 var = ph + ":" + hst + ":" + l[2] + ":" + l[3] … … 606 606 page = G2frame.Page 607 607 vartype,varList,constrDictEnt = PageSelection(page) 608 if vartype is None: return 608 609 varList = G2obj.SortVariables(varList) 609 if vartype is None: return610 610 title1 = "Hold "+vartype+" variable" 611 611 if not varList: … … 1081 1081 G2frame.dataWindow.ConstraintEdit.Enable(G2G.wxID_EQUIVALANCEATOMS,False) 1082 1082 # G2frame.dataWindow.ConstraintEdit.Enable(G2G.wxID_ADDRIDING,False) 1083 enableEditCons = True 1083 1084 if text == 'Histogram/Phase': 1084 1085 G2frame.Page = [page,'hap'] … … 1100 1101 UpdateConstraintPanel(GlobalConstr,'Global') 1101 1102 else: 1103 enableEditCons = False 1102 1104 G2frame.Page = [page,'sym'] 1103 UpdateConstraintPanel(SymConstr,'Sym-Generated') 1105 UpdateConstraintPanel(SymConstr,'Sym-Generated') 1106 # remove menu items when not allowed 1107 for i in G2frame.dataWindow.ConstraintEdit.GetMenuItems(): 1108 i.Enable(enableEditCons) 1104 1109 G2frame.dataWindow.SetDataSize() 1105 1110 -
trunk/GSASIIdataGUI.py
r3367 r3371 4271 4271 G2mv.GenerateConstraints(groups,parmlist,varyList,constrDict,fixedList,parmValDict) 4272 4272 G2mv.Map2Dict(parmValDict,varyList) 4273 except :4273 except G2mv.ConstraintException: 4274 4274 pass 4275 4275 wx.EndBusyCursor() -
trunk/GSASIImapvars.py
r3136 r3371 242 242 paramPrefix = "::constr" 243 243 consNum = 0 # number of the next constraint to be created 244 245 class ConstraintException(Exception): 246 '''Defines an Exception that is used when an exception is raised processing constraints 247 ''' 248 pass 244 249 245 250 def InitVars(): … … 575 580 if multarr is None: # true only if an equivalence 576 581 zeromult = False 577 for mv in mapvars: 582 for i,mv in enumerate(mapvars): 583 if mv.split(':')[1] == '*' and SeqHist is not None: 584 # convert wildcard var to reference current histogram; save translation in table 585 sv = mv.split(':') 586 sv[1] = str(SeqHist) 587 mv = translateTable[mv] = ':'.join(sv) 588 mapvars[i] = mv 578 589 #s = '' 579 590 varied = 0 … … 589 600 #msg += "\nCannot equivalence to variable "+str(mv)+". Not defined in this refinement" 590 601 #continue 591 for v,m in zip(varlist,invmultarr): 602 for i,(v,m) in enumerate(zip(varlist,invmultarr)): 603 if v.split(':')[1] == '*' and SeqHist is not None: 604 # convert wildcard var to reference current histogram; save translation in table 605 sv = v.split(':') 606 sv[1] = str(SeqHist) 607 varlist[i] = v = translateTable[v] = ':'.join(sv) 592 608 if parmDict is not None and v not in parmDict: 593 609 print ("Dropping equivalence for dep. variable "+str(v)+". Not defined in this refinement") … … 661 677 print (' *** ERROR in constraint definitions! ***') 662 678 print (msg) 663 raise Exception679 raise ConstraintException 664 680 print ('*** Sequential refinement: ignoring constraint definition(s): ***') 665 681 print (shortmsg) … … 670 686 print (' *** ERROR in constraint definitions! ***') 671 687 print (msg) 672 raise Exception688 raise ConstraintException 673 689 674 690 # now process each group and create the relations that are needed to form … … 762 778 print (msg) 763 779 print (VarRemapShow(varyList)) 764 raise Exception780 raise ConstraintException 765 781 # setup dictionary containing the fixed values 766 782 global fixedDict … … 821 837 arrayList.append(None) 822 838 invarrayList.append(np.array(multlist)) 823 indParmList.append( tuple((independentVar,)))839 indParmList.append(list((independentVar,))) 824 840 dependentParmList.append(mapList) 825 841 symGenList.append(symGen) … … 1162 1178 a[j] -= proj(a[i],a[j]) 1163 1179 if np.allclose(np.linalg.norm(a[j]),0.0): 1164 raise Exception("Singular input to GramSchmidtOrtho")1180 raise ConstraintException("Singular input to GramSchmidtOrtho") 1165 1181 a[j] /= np.linalg.norm(a[j]) 1166 1182 return a … … 1197 1213 return 1198 1214 else: 1199 raise Exception('Singular input')1215 raise ConstraintException('Singular input') 1200 1216 1201 1217 def _RowEchelon(m,arr,collist): -
trunk/GSASIIstrMain.py
r3369 r3371 204 204 #print 'DependentVars',G2mv.GetDependentVars() 205 205 #print 'IndependentVars',G2mv.GetIndependentVars() 206 except :206 except G2mv.ConstraintException: 207 207 print (' *** ERROR - your constraints are internally inconsistent ***') 208 208 #errmsg, warnmsg = G2mv.CheckConstraints(varyList,constrDict,fixedList) … … 388 388 groups,parmlist = G2mv.GroupConstraints(constrDict) 389 389 G2mv.GenerateConstraints(groups,parmlist,varyList,constrDict,fixedList,parmDict,SeqHist=ihst) 390 #print (G2mv.VarRemapShow(varyList,True)) 390 391 constraintInfo = (groups,parmlist,constrDict,fixedList,ihst) 391 except :392 except G2mv.ConstraintException: 392 393 print (' *** ERROR - your constraints are internally inconsistent ***') 393 394 #errmsg, warnmsg = G2mv.CheckConstraints(varyList,constrDict,fixedList)
Note: See TracChangeset
for help on using the changeset viewer.