Changeset 3042 for trunk/GSASIImath.py


Ignore:
Timestamp:
Sep 3, 2017 1:17:19 PM (4 years ago)
Author:
vondreele
Message:

add scipy license to basinhopping
MCSA plot bug fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r3033 r3042  
    27122712                prob = np.inner(np.inner(mtrx,b1),mtrx)
    27132713            Probs.append(prob)
     2714            print i,prob
    27142715        Probs += 4*[0.,]
    27152716        chainProb += Probs
     
    40624063           lower=-100, upper=100, dwell=50, slope=0.9,ranStart=False,
    40634064           ranRange=0.10,autoRan=False,dlg=None):
     4065''' Scipy license:
     4066    Copyright (c) 2001, 2002 Enthought, Inc.
     4067All rights reserved.
     4068
     4069Copyright (c) 2003-2016 SciPy Developers.
     4070All rights reserved.
     4071
     4072Redistribution and use in source and binary forms, with or without
     4073modification, are permitted provided that the following conditions are met:
     4074
     4075  a. Redistributions of source code must retain the above copyright notice,
     4076     this list of conditions and the following disclaimer.
     4077  b. Redistributions in binary form must reproduce the above copyright
     4078     notice, this list of conditions and the following disclaimer in the
     4079     documentation and/or other materials provided with the distribution.
     4080  c. Neither the name of Enthought nor the names of the SciPy Developers
     4081     may be used to endorse or promote products derived from this software
     4082     without specific prior written permission.
     4083'''
    40644084    """Minimize a function using simulated annealing.
    40654085
     
    45404560        return np.sqrt(M/np.sum(refList[4]**2))
    45414561   
    4542     def MCSAcallback(x, f, fmin,accept):
     4562    def MCSAcallback(x, f,accept):
     4563        fmin = min(f)
    45434564        return not pgbar.Update(min(100.,fmin*100),
    45444565            newmsg='%s%8.4f%s'%('MC/SA Residual:',fmin*100,'%'))[0]
     
    46794700    bounds = np.array(zip(lower,upper))
    46804701    if MCSA['Algorithm'] == 'Basin Hopping':
    4681         import basinhopping as bs
     4702#        import basinhopping as bs
    46824703        take_step = RandomDisplacementBounds(np.array(lower), np.array(upper))
    4683         results = bs.basinhopping(mcsaCalc,x0,take_step=take_step,disp=True,T=MCSA['Annealing'][0],
     4704        results = so.basinhopping(mcsaCalc,x0,take_step=take_step,disp=True,T=MCSA['Annealing'][0],
    46844705                interval=MCSA['Annealing'][2]/10,niter=MCSA['Annealing'][2],minimizer_kwargs={'method':'L-BFGS-B','bounds':bounds,
    46854706                'args':(refs,rcov,cosTable,ifInv,allFF,RBdata,varyList,parmDict)},callback=MCSAcallback)
Note: See TracChangeset for help on using the changeset viewer.