Skip to content

Commit ae98449

Browse files
committed
Ask about LeBail reset only once
1 parent 956a870 commit ae98449

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

GSASII/GSASIIdataGUI.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5514,8 +5514,6 @@ def OnRefine(self,event):
55145514
dlg.Destroy()
55155515
else:
55165516
self.ErrorDialog('Refinement error',Rvals['msg'])
5517-
# if a LeBail fit has been done, no need to ask about reseting intensities again
5518-
Controls['newLeBail'] = False
55195517

55205518
def OnLeBail(self,event):
55215519
'''Do a 1 cycle LeBail refinement with no other variables; usually done upon initialization of a LeBail refinement
@@ -7648,7 +7646,6 @@ def UpdateControls(G2frame,data):
76487646
data['Marquardt'] = -3
76497647
if 'newLeBail' not in data:
76507648
data['newLeBail'] = False
7651-
76527649
#end patch
76537650

76547651
def SeqSizer():

GSASII/GSASIIstrIO.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ def GPXBackup(GPXfile,makeBack=True):
641641
time.sleep(1) #just wait a second!
642642
return GPXback
643643

644-
def SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,RigidBodies,CovData,parmFrozenList,makeBack=True):
644+
def SaveUsedHistogramsAndPhases(GPXfile,Histograms,Phases,RigidBodies,CovData,parmFrozenList,makeBack=True):
645645
''' Updates gpxfile from all histograms that are found in any phase
646646
and any phase that used a histogram. Also updates rigid body definitions.
647647
This is used for non-sequential fits, but not for sequential fitting.
@@ -658,8 +658,8 @@ def SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,RigidBodies,CovData,par
658658
'''
659659

660660
GPXback = GPXBackup(GPXfile,makeBack)
661-
G2fil.G2Print ('Read from file:'+GPXback)
662-
G2fil.G2Print ('Save to file :'+GPXfile)
661+
G2fil.G2Print (f'Read from file: {GPXback}')
662+
G2fil.G2Print (f'Save to file: {GPXfile}')
663663
infile = open(GPXback,'rb')
664664
outfile = open(GPXfile,'wb')
665665
while True:
@@ -680,6 +680,9 @@ def SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,RigidBodies,CovData,par
680680
data[0][1] = RigidBodies
681681
elif datum[0] == 'Controls':
682682
Controls = data[0][1]
683+
# if a LeBail fit has been done, no need to ask again about
684+
# resetting intensities
685+
Controls['newLeBail'] = False
683686
if 'parmFrozen' not in Controls:
684687
Controls['parmFrozen'] = {}
685688
Controls['parmFrozen']['FrozenList'] = [i if type(i) is G2obj.G2VarObj
@@ -836,8 +839,8 @@ def SetSeqResult(GPXfile,Histograms,SeqResult):
836839
:param str GPXfile: full .gpx file name
837840
'''
838841
GPXback = GPXBackup(GPXfile)
839-
G2fil.G2Print ('Read from file:'+GPXback)
840-
G2fil.G2Print ('Save to file :'+GPXfile)
842+
G2fil.G2Print (f'Read from file: {GPXback}')
843+
G2fil.G2Print (f'Save to file: {GPXfile}')
841844
GPXphase = os.path.splitext(GPXfile)[0]+'.seqPhase'
842845
fp = open(GPXphase,'rb')
843846
data = pickleLoad(fp) # first block in file should be Phases

GSASII/GSASIIstrMain.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,8 @@ def Refine(GPXfile,dlg=None,makeBack=True,refPlotUpdate=None,newLeBail=False,all
595595
)
596596
G2fil.G2Print('Note: ',msg)
597597
Rvals['msg'] += msg
598-
G2stIO.SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,rigidbodyDict,covData,parmFrozenList,makeBack)
598+
# save refinement results into .gpx file
599+
G2stIO.SaveUsedHistogramsAndPhases(GPXfile,Histograms,Phases,rigidbodyDict,covData,parmFrozenList,makeBack)
599600
printFile.close()
600601
G2fil.G2Print (' Refinement results are in file: '+ospath.splitext(GPXfile)[0]+'.lst')
601602
G2fil.G2Print (' ***** Refinement successful *****')
@@ -827,7 +828,7 @@ def DoLeBail(GPXfile,dlg=None,cycles=10,refPlotUpdate=None,seqList=None):
827828
'covMatrix':None,'title':GPXfile,'freshCOV':True} #np.zeros([0,0])?
828829
# ?? 'newAtomDict':newAtomDict,'newCellDict':newCellDict,
829830

830-
G2stIO.SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,rigidbodyDict,covData,[],True)
831+
G2stIO.SaveUsedHistogramsAndPhases(GPXfile,Histograms,Phases,rigidbodyDict,covData,[],True)
831832
G2fil.G2Print (' ***** LeBail fit completed *****')
832833
return True,Rvals
833834
except Exception as Msg:

docs/source/objvarorg.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@ be done with the Calculate/"View LS parms" menu window or
14771477
:func:`prmLookup`
14781478
:class:`GSASIIctrlGUI.ShowLSParms`
14791479
:class:`GSASIIctrlGUI.VirtualVarBox`
1480-
:func:`GSASIIstrIO.SetUsedHistogramsAndPhases`
1480+
:func:`GSASIIstrIO.SaveUsedHistogramsAndPhases`
14811481
:func:`GSASIIstrIO.SaveUpdatedHistogramsAndPhases`
14821482
:func:`GSASIIstrIO.SetSeqResult`
14831483
:func:`GSASIIstrMain.dropOOBvars`

0 commit comments

Comments
 (0)