Changeset 301


Ignore:
Timestamp:
Jun 11, 2011 12:40:30 AM (12 years ago)
Author:
vondreele
Message:

Add cancel to progress bar & associated things to make it work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r299 r301  
    459459    Result for fcj.pdf
    460460    -----------------------------------------
    461     if x < t & s = S/L+H/L:
    462         fcj.pdf = [1/sqrt({cos(x)**2/cos(t)**2}-1) - 1/s]/cos(x)   
    463     if x >= t:
     461    T = x*dx+t
     462    s = S/L+H/L
     463    if x < 0:
     464        fcj.pdf = [1/sqrt({cos(T)**2/cos(t)**2}-1) - 1/s]/|cos(T)|   
     465    if x >= 0:
    464466        fcj.pdf = 0   
    465467    """
    466468    def _pdf(self,x,t,s,dx):
    467 #        T = np.where(t<=90.,dx*x+t,180.-dx*x-t)
    468469        T = dx*x+t
    469470        ax = npcosd(T)**2
     
    729730        Rwp = min(100.,np.sqrt(np.sum(M**2)/np.sum(weights*ydata**2))*100.)
    730731        if dlg:
    731             dlg.Update(Rwp,newmsg='%s%8.3f%s'%('Peak fit Rwp =',Rwp,'%'))
     732            GoOn = dlg.Update(Rwp,newmsg='%s%8.3f%s'%('Peak fit Rwp =',Rwp,'%'))[0]
     733            if not GoOn:
     734                return -M           #abort!!
    732735        return M
    733736       
     
    748751        if FitPgm == 'LSQ':
    749752            dlg = wx.ProgressDialog('Residual','Peak fit Rwp = ',101.0,
    750             style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME)
     753            style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME|wx.PD_CAN_ABORT)
    751754            screenSize = wx.ClientDisplayRect()
    752755            Size = dlg.GetSize()
     
    767770            try:
    768771                sig = np.sqrt(np.diag(result[1])*chisq)
     772                if np.any(np.isnan(sig)):
     773                    print '*** Least squares aborted - some invalid esds possible ***'
    769774                break                   #refinement succeeded - finish up!
    770775            except ValueError:          #result[1] is None on singular matrix
Note: See TracChangeset for help on using the changeset viewer.