Changeset 1813


Ignore:
Timestamp:
Apr 27, 2015 4:55:12 PM (7 years ago)
Author:
vondreele
Message:

revise GSAS-II exception handling - traps user aborts & I hope the bad metric tensor error

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIobj.py

    r1802 r1813  
    20072007            val = np.sum(val)
    20082008        return val
     2009       
     2010class G2Exception(Exception):
     2011    def __init__(self,msg):
     2012        self.msg = msg
     2013    def __str__(self):
     2014        return repr(self.msg)
    20092015
    20102016
  • trunk/GSASIIstrIO.py

    r1805 r1813  
    13181318    except KeyError:
    13191319        sigA = [0,0,0,0,0,0]
    1320 
     1320    if np.any(np.diag(G2lat.A2Gmat(A,False))) < 0.:
     1321        raise G2obj.G2Exception('Negative g-tensor')
    13211322    return A,sigA
    13221323       
  • trunk/GSASIIstrMain.py

    r1812 r1813  
    211211        print ' Refinement results are in file: '+ospath.splitext(GPXfile)[0]+'.lst'
    212212        print ' ***** Refinement successful *****'
    213     except G2stMth.UserAbort:
     213    except G2obj.G2Exception,Msg:
    214214        printFile.close()
    215         return False,'Refinement aborted by user'
     215        return False,Msg.msg
    216216   
    217217#for testing purposes!!!
     
    425425                        newparm = ':'.join(items)
    426426                        NewparmDict[newparm] = parmDict[parm]
    427         except G2stMth.UserAbort:
     427        except G2obj.G2Exception,Msg:
    428428            printFile.close()
    429429            print ' ***** Refinement aborted *****'
    430             return False,' Refinement aborted by user'
     430            return False,Msg.msg
    431431    G2stIO.SetSeqResult(GPXfile,Histograms,SeqResult)
    432432    printFile.close()
  • trunk/GSASIIstrMath.py

    r1812 r1813  
    2727import GSASIImapvars as G2mv
    2828import GSASIImath as G2mth
     29import GSASIIobj as G2obj
    2930
    3031sind = lambda x: np.sin(x*np.pi/180.)
     
    28012802            parmDict['saved values'] = values
    28022803            dlg.Destroy()
    2803             raise UserAbort('User abort')         #Abort!!
     2804            raise G2obj.G2Exception('User abort')         #Abort!!
    28042805    pDict,pVals,pWt,pWsum = penaltyFxn(HistoPhases,calcControls,parmDict,varylist)
    28052806    if len(pVals):
Note: See TracChangeset for help on using the changeset viewer.