Skip to content

Commit e83ca9b

Browse files
committed
add scriptng routine for testing shifts
1 parent b258b2f commit e83ca9b

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

GSASII/GSASIIscriptable.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3215,6 +3215,25 @@ def get_ParmList(self):
32153215
except:
32163216
return
32173217

3218+
def get_LastFitResults(self):
3219+
'''Returns the shifts on refined variables and their uncertainties in the last refinement cycle
3220+
3221+
:returns: a dict with the last least-squares shifts and a dict of sigma values.
3222+
'''
3223+
if 'Lastshft' not in self['Covariance']['data']:
3224+
raise G2ScriptException('No shift values found in project, has a refinement been run?')
3225+
if 'varyList' not in self['Covariance']['data']:
3226+
raise G2ScriptException('No varyList found in project, has a refinement been run?')
3227+
if 'sig' not in self['Covariance']['data']:
3228+
raise G2ScriptException('No sigma values found in project, has a refinement been run?')
3229+
try:
3230+
return (
3231+
dict(zip(self['Covariance']['data']['varyList'],self['Covariance']['data']['Lastshft'].tolist())),
3232+
dict(zip(self['Covariance']['data']['varyList'],self['Covariance']['data']['sig'].tolist()))
3233+
)
3234+
except:
3235+
return None,None
3236+
32183237
def get_Variable(self,var):
32193238
'''Returns the value and standard uncertainty (esd) for a variable
32203239
parameters, as defined in the last refinement cycle

docs/source/GSASIIscriptable.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ method Use
307307
:meth:`~GSASIIscriptable.G2Project.set_Controls` Set overall GSAS-II control settings such as number of cycles and to set parameter limits.
308308
This is also used to set up a sequential
309309
fit. (Also see :meth:`~GSASIIscriptable.G2Project.get_Controls` to read values.)
310+
:meth:`~GSASIIscriptable.G2Project.get_LastFitResults` Retrieves the shifts and sigma values from the last least-squares cycle
310311
:meth:`~GSASIIscriptable.G2Project.imageMultiDistCalib` Performs a global calibration fit with images at multiple distance settings.
311312
:meth:`~GSASIIscriptable.G2Project.get_Constraints` Retrieves :ref:`constraint definition <Constraint_definitions_table>` entries.
312313
:meth:`~GSASIIscriptable.G2Project.add_HoldConstr` Adds a hold constraint on one or more variables

0 commit comments

Comments
 (0)