[GSAS-II] sequential refinement throws an exception if it hits a singular matrix

Wolfman, Mark wolfman at anl.gov
Thu May 7 16:13:36 CDT 2020


Hi, GSAS-II.

I'm not asking for help with the singular refinement error
itself. Instead, I wanted to share a small fix that allows sequential
refinement to exit gracefully instead of throwing an unhandled
exception. This is for version 4415 (reported as latest version by
help/check for updates).

If an error occurs during sequential refinement (in this case, a
singular matrix), the *SeqRefine* function still tries to read the
results but fails because some of the parameters are not set. This
happens on line 514::

  Refining with PWDR nmc811_350_nioh_bn_1_LH_00150.csv
  Warning: **** Refinement failed - singular matrix ****
  Bad parameter: 0:150:Size;i
  Traceback (most recent call last):
    File "/home/mwolf/miniconda3/envs/gsas/GSASII/GSASIIdataGUI.py", line 4957, in OnRefine
      self.OnSeqRefine(event)
    File "/home/mwolf/miniconda3/envs/gsas/GSASII/GSASIIdataGUI.py", line 5140, in OnSeqRefine
      OK,Msg = G2stMn.SeqRefine(self.GSASprojectfile,dlg,refPlotUpdate) #Msg is Rvals dict if Ok=True
    File "/home/mwolf/miniconda3/envs/gsas/GSASII/GSASIIstrMain.py", line 514, in SeqRefine
      Rvals['Rwp'],Rvals['chisq'],Rvals['GOF']**2,Rvals['DelChi2'],Rvals['Max shft/sig']))
  KeyError: 'Max shft/sig'
  
An easy fix is to replace the last ``Rvals['Max shft/sig']`` with a
``Rvals.get('Max shft/sig', np.nan)``. Not sure if *np.nan* is the
right choice, but at least the SeqRefine function can now stop
gracefully and load the partial results.

Cheers,
Mark

-- 

This message is signed with Pretty Good Privacy (PGP) key BE1E3158.

http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x457826FCBE1E3158
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mailman.aps.anl.gov/pipermail/gsas-ii/attachments/20200507/31003cb7/attachment.sig>


More information about the GSAS-II mailing list