Changeset 4598 for trunk


Ignore:
Timestamp:
Oct 16, 2020 12:00:27 PM (3 years ago)
Author:
vondreele
Message:

cosmetic changes

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r4595 r4598  
    5858
    5959def pinv(a, rcond=1e-15 ):
    60     """
     60    '''
    6161    Compute the (Moore-Penrose) pseudo-inverse of a matrix.
    6262    Modified from numpy.linalg.pinv; assumes a is Hessian & returns no. zeros found
     
    9696    .. [1] G. Strang, *Linear Algebra and Its Applications*, 2nd Ed., Orlando, FL, Academic Press, Inc., 1980, pp. 139-142.
    9797
    98     """
     98    '''
    9999    u, s, vt = nl.svd(a)
    100100    cutoff = rcond*np.maximum.reduce(s)
     
    106106
    107107def HessianLSQ(func,x0,Hess,args=(),ftol=1.49012e-8,xtol=1.e-6, maxcyc=0,lamda=-3,Print=False,refPlotUpdate=None):
    108     """
     108    '''
    109109    Minimize the sum of squares of a function (:math:`f`) evaluated on a series of
    110     values (y): :math:`\sum_{y=0}^{N_{obs}} f(y,{args})`   
    111     where :math:`x = arg min(\sum_{y=0}^{N_{obs}} (func(y)^2,axis=0))`
     110    values (y): :math:`\\sum_{y=0}^{N_{obs}} f(y,{args})`   
     111    where :math:`x = arg min(\\sum_{y=0}^{N_{obs}} (func(y)^2,axis=0))`
    112112
    113113    :param function func: callable method or function
     
    148148         * 'SVD0':
    149149           
    150     """
     150    '''
    151151               
    152152    ifConverged = False
     
    246246def HessianSVD(func,x0,Hess,args=(),ftol=1.49012e-8,xtol=1.e-6, maxcyc=0,lamda=-3,Print=False,refPlotUpdate=None):
    247247   
    248     """
     248    '''
    249249    Minimize the sum of squares of a function (:math:`f`) evaluated on a series of
    250     values (y): :math:`\sum_{y=0}^{N_{obs}} f(y,{args})`   
    251     where :math:`x = arg min(\sum_{y=0}^{N_{obs}} (func(y)^2,axis=0))`
     250    values (y): :math:`\\sum_{y=0}^{N_{obs}} f(y,{args})`   
     251    where :math:`x = arg min(\\sum_{y=0}^{N_{obs}} (func(y)^2,axis=0))`
    252252
    253253    :param function func: callable method or function
     
    287287         * 'SVD0':
    288288           
    289     """
     289    '''
    290290               
    291291    ifConverged = False
     
    42664266
    42674267    def getstart_temp(self, best_state):
    4268         """ Find a matching starting temperature and starting parameters vector
     4268        ''' Find a matching starting temperature and starting parameters vector
    42694269        i.e. find x0 such that func(x0) = T0.
    42704270
     
    42744274        :returns: x0 : array
    42754275            The starting parameters vector.
    4276         """
     4276        '''
    42774277
    42784278        assert(not self.dims is None)
     
    43814381           lower=-100, upper=100, dwell=50, slope=0.9,ranStart=False,
    43824382           ranRange=0.10,autoRan=False,dlg=None):
    4383     """Minimize a function using simulated annealing.
     4383    '''Minimize a function using simulated annealing.
    43844384
    43854385    Schedule is a schedule class implementing the annealing schedule.
    43864386    Available ones are 'fast', 'cauchy', 'boltzmann'
    43874387
    4388     :param callable func: f(x, \*args)
     4388    :param callable func: f(x, \\*args)
    43894389        Function to be optimized.
    43904390    :param ndarray x0:
     
    44724472        T_new = T0 * exp(-c * k**quench)
    44734473
    4474     """
     4474    '''
    44754475   
    44764476    ''' Scipy license:
     
    46424642   
    46434643    class RandomDisplacementBounds(object):
    4644         """random displacement with bounds"""
     4644        '''random displacement with bounds'''
    46454645        def __init__(self, xmin, xmax, stepsize=0.5):
    46464646            self.xmin = xmin
     
    46494649   
    46504650        def __call__(self, x):
    4651             """take a random step but ensure the new position is within the bounds"""
     4651            '''take a random step but ensure the new position is within the bounds'''
    46524652            while True:
    46534653                # this could be done in a much more clever way, but it will work for example purposes
     
    50755075   
    50765076def prodQVQ(Q,V):
    5077     """
     5077    '''
    50785078    compute the quaternion vector rotation qvq-1 = v'
    50795079    q=r+ai+bj+ck
    5080     """
     5080    '''
    50815081    T2 = Q[0]*Q[1]
    50825082    T3 = Q[0]*Q[2]
  • trunk/GSASIIphsGUI.py

    r4597 r4598  
    99609960            for ix in range(3):
    99619961                origX = G2G.ValidatedTxtCtrl(RigidBodies,RBObj['Orig'][0],ix,nDig=(8,5),
    9962                                     typeHint=float,OnLeave=OnOrigX,
    9963                                     xmin=-1,xmax=1.,size=(70,-1))
     9962                    typeHint=float,OnLeave=OnOrigX,xmin=-1,xmax=1.,size=(70,-1))
    99649963                topSizer.Add(origX,0,WACV)
    99659964            topSizer.Add((5,0),)
     
    99779976            for ix,x in enumerate(Orien):
    99789977                orien = G2G.ValidatedTxtCtrl(RigidBodies,Orien,ix,nDig=(8,dp),
    9979                                     typeHint=float,OnLeave=OnOrien,
    9980                                     xmin=xmin,xmax=xmax,size=(70,-1))
     9978                    typeHint=float,OnLeave=OnOrien,xmin=xmin,xmax=xmax,size=(70,-1))
    99819979                dp, xmin,xmax = 4,-1.,1.
    99829980                Indx['Orien'][ix] = orien
     
    1001910017            resrbSizer.Add(wx.StaticText(RigidBodies,-1,120*'-'))
    1002010018            topLine = wx.BoxSizer(wx.HORIZONTAL)
    10021             topLine.Add(wx.StaticText(RigidBodies,-1,
    10022                 'Name: '+RBObj['RBname']+RBObj['numChain']+'   '),0,WACV)
     10019            topLine.Add(wx.StaticText(RigidBodies,-1,'Name: '+RBObj['RBname']+RBObj['numChain']+'   '),0,WACV)
    1002310020            rbId = RBObj['RBId']
    1002410021            delRB = wx.Button(RigidBodies,wx.ID_ANY,'Delete',style=wx.BU_EXACTFIT)
     
    1003910036                    lbl = 'z'                   
    1004010037                topLine.Add(wx.StaticText(RigidBodies,-1,
    10041                     '   Rigid body {} axis is aligned along oriention vector'
    10042                         .format(lbl)),0,WACV)
     10038                    '   Rigid body {} axis is aligned along oriention vector'.format(lbl)),0,WACV)
    1004310039            resrbSizer.Add(topLine)
    1004410040            resrbSizer.Add(LocationSizer(RBObj,'Residue'))
     
    1067910675                xmin=0.,xmax=360.,typeHint=float,OnLeave=UpdateOrientation))
    1068010676            OriSizer.Add(OrientVecSiz[-1],0,WACV)
    10681             azSlide = wx.Slider(RigidBodies,style=wx.SL_HORIZONTAL)
     10677            azSlide = wx.Slider(RigidBodies,style=wx.SL_HORIZONTAL,value=int(rbObj['OrientVec'][0]*10.),size=(200,25))
    1068210678            azSlide.SetRange(0,3600)
    10683             azSlide.SetValue(int(rbObj['OrientVec'][0]*10.))
    1068410679            azSlide.Bind(wx.EVT_SLIDER, OnAzSlide)
    10685             OriSizer.Add(azSlide,1,WACV)
     10680            OriSizer.Add(azSlide,0,WACV)
    1068610681            mainSizer.Add(OriSizer)
    1068710682            OriSizer = wx.BoxSizer(wx.HORIZONTAL)
Note: See TracChangeset for help on using the changeset viewer.