Ignore:
Timestamp:
Jan 17, 2021 3:12:29 PM (10 months ago)
Author:
toby
Message:

separate hard & SVD singularities, new code in GSASIImath_new.py not GSASIImath.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMain.py

    r4761 r4780  
    5555    #report on SVD 0's and highly correlated variables
    5656    msg = ''
    57     SVD0 = result[2].get('SVD0')
    58     if SVD0 > 0:
    59         msg += 'Warning: There were {} singularities in the Hessian'.format(SVD0)
    60     # process singular variables
     57    # process singular variables; all vars go to console, first 10 to
     58    # dialog window
    6159    psing = result[2].get('psing',[])
    6260    if len(psing):
    6361        if msg: msg += '\n'
    64         m = '{} Parameters dropped due to singularities:'.format(len(psing))
     62        m = 'Error: {} Parameter(s) dropped:'.format(len(psing))
    6563        msg += m
    6664        G2fil.G2Print(m, mode='warn')
    6765        m = ''
    6866        for i,val in enumerate(psing):
     67            if i == 0:
     68                msg += '\n{}'.format(varyList[val])
     69                m = '  {}'.format(varyList[val])
     70            else:
     71                if len(m) > 70:
     72                    G2fil.G2Print(m, mode='warn')
     73                    m = '  '
     74                else:
     75                    m += ', '
     76                m += '{}'.format(varyList[val])
     77                if i == 10:
     78                    msg += ', {}... see console for full list'.format(varyList[val])
     79                elif i > 10:
     80                    pass
     81                else:
     82                    msg += ', {}'.format(varyList[val])
     83        if m: G2fil.G2Print(m, mode='warn')
     84    SVD0 = result[2].get('SVD0')
     85    if SVD0 == 1:
     86        msg += 'Warning: Soft (SVD) singularity in the Hessian'
     87    elif SVD0 > 0:
     88        msg += 'Warning: {} soft (SVD) Hessian singularities'.format(SVD0)
     89    SVDsing = result[2].get('SVDsing',[])
     90    if len(SVDsing):
     91        if msg: msg += '\n'
     92        m = 'SVD problem(s) likely from:'
     93        msg += m
     94        G2fil.G2Print(m, mode='warn')
     95        m = ''
     96        for i,val in enumerate(SVDsing):
    6997            if i == 0:
    7098                msg += '\n{}'.format(varyList[val])
     
    209237            if 'Hessian' in Controls['deriv type']:
    210238                num = len(varyList)-1
     239                # BHT -- I am not sure if this works correctly:
    211240                for i,val in enumerate(np.flipud(result[2]['psing'])):
    212241                    if val:
     
    260289                if dlg: break # refining interactively
    261290                # non-interactive refinement
    262                 for val in sorted(psing,reverse=True):
    263                     G2fil.G2Print ('Removing parameter: '+varyList[val])
    264                     del(varyList[val])
    265                 if not psing: break    # removed variable(s), try again
     291                #for val in sorted(psing,reverse=True):
     292                #    G2fil.G2Print ('Removing parameter: '+varyList[val])
     293                #    del(varyList[val])
     294                #if not psing: break    # removed variable(s), try again
    266295            else:
    267296                G2fil.G2Print ('**** Refinement failed - singular matrix ****',mode='error')
Note: See TracChangeset for help on using the changeset viewer.