isochrones/starmodel_old.py
def maxlike(self,nseeds=50):
        """Returns the best-fit parameters, choosing the best of multiple starting guesses

        :param nseeds: (optional)
            Number of starting guesses, uniformly distributed throughout
            allowed ranges.  Default=50.

        :return:
            list of best-fit parameters: ``[mA,mB,age,feh,[distance,A_V]]``.
            Note that distance and A_V values will be meaningless unless
            magnitudes are present in ``self.properties``.
        
        """
        mA_0,age0,feh0 = self.ic.random_points(nseeds)
        mB_0,foo1,foo2 = self.ic.random_points(nseeds)
        mA_fixed = np.maximum(mA_0,mB_0)
        mB_fixed = np.minimum(mA_0,mB_0)
        mA_0, mB_0 = (mA_fixed, mB_fixed)

        d0 = 10**(rand.uniform(0,np.log10(self.max_distance),size=nseeds))
        AV0 = rand.uniform(0,self.maxAV,size=nseeds)

        

        costs = np.zeros(nseeds)

        if self.fit_for_distance:
            pfits = np.zeros((nseeds,6))
        else:
            pfits = np.zeros((nseeds,4))
            
        def fn(p): #fmin is a function *minimizer*
            return -1*self.lnpost(p)
        
        for i,mA,mB,age,feh,d,AV in zip(range(nseeds),
                                    mA_0,mB_0,age0,feh0,d0,AV0):
                if self.fit_for_distance:
                    pfit = scipy.optimize.fmin(fn,[mA,mB,age,feh,d,AV],disp=False)
                else:
                    pfit = scipy.optimize.fmin(fn,[mA,mB,age,feh],disp=False)
                pfits[i,:] = pfit
                costs[i] = self.lnpost(pfit)

        return pfits[np.argmax(costs),:]
Returns the best-fit parameters, choosing the best of multiple starting guesses

        :param nseeds: (optional)
            Number of starting guesses, uniformly distributed throughout
            allowed ranges.  Default=50.

        :return:
            list of best-fit parameters: ``[mA,mB,age,feh,[distance,A_V]]``.
            Note that distance and A_V values will be meaningless unless
            magnitudes are present in ``self.properties``.
        
        
Returns the best-fit parameters, choosing the best of multiple starting guesses
Returns the best - fit parameters choosing the best of multiple starting guesses
def maxlike(self,nseeds=50):
        mA_0,age0,feh0 = self.ic.random_points(nseeds)
        mB_0,foo1,foo2 = self.ic.random_points(nseeds)
        mA_fixed = np.maximum(mA_0,mB_0)
        mB_fixed = np.minimum(mA_0,mB_0)
        mA_0, mB_0 = (mA_fixed, mB_fixed)
        d0 = 10**(rand.uniform(0,np.log10(self.max_distance),size=nseeds))
        AV0 = rand.uniform(0,self.maxAV,size=nseeds)
        costs = np.zeros(nseeds)
        if self.fit_for_distance:
            pfits = np.zeros((nseeds,6))
        else:
            pfits = np.zeros((nseeds,4))
        def fn(p): 
            return -1*self.lnpost(p)
        for i,mA,mB,age,feh,d,AV in zip(range(nseeds),
                                    mA_0,mB_0,age0,feh0,d0,AV0):
                if self.fit_for_distance:
                    pfit = scipy.optimize.fmin(fn,[mA,mB,age,feh,d,AV],disp=False)
                else:
                    pfit = scipy.optimize.fmin(fn,[mA,mB,age,feh],disp=False)
                pfits[i,:] = pfit
                costs[i] = self.lnpost(pfit)
        return pfits[np.argmax(costs),:]
def maxlike ( self , nseeds = 50 ) : mA_0 , age0 , feh0 = self . ic . random_points ( nseeds ) mB_0 , foo1 , foo2 = self . ic . random_points ( nseeds ) mA_fixed = np . maximum ( mA_0 , mB_0 ) mB_fixed = np . minimum ( mA_0 , mB_0 ) mA_0 , mB_0 = ( mA_fixed , mB_fixed ) d0 = 10 ** ( rand . uniform ( 0 , np . log10 ( self . max_distance ) , size = nseeds ) ) AV0 = rand . uniform ( 0 , self . maxAV , size = nseeds ) costs = np . zeros ( nseeds ) if self . fit_for_distance : pfits = np . zeros ( ( nseeds , 6 ) ) else : pfits = np . zeros ( ( nseeds , 4 ) ) def fn ( p ) : return - 1 * self . lnpost ( p ) for i , mA , mB , age , feh , d , AV in zip ( range ( nseeds ) , mA_0 , mB_0 , age0 , feh0 , d0 , AV0 ) : if self . fit_for_distance : pfit = scipy . optimize . fmin ( fn , [ mA , mB , age , feh , d , AV ] , disp = False ) else : pfit = scipy . optimize . fmin ( fn , [ mA , mB , age , feh ] , disp = False ) pfits [ i , : ] = pfit costs [ i ] = self . lnpost ( pfit ) return pfits [ np . argmax ( costs ) , : ]
Returns the best-fit parameters, choosing the best of multiple starting guesses
Returns the best - fit parameters choosing the best of multiple starting guesses
"""Returns the best-fit parameters, choosing the best of multiple starting guesses

        :param nseeds: (optional)
            Number of starting guesses, uniformly distributed throughout
            allowed ranges.  Default=50.

        :return:
            list of best-fit parameters: ``[mA,mB,age,feh,[distance,A_V]]``.
            Note that distance and A_V values will be meaningless unless
            magnitudes are present in ``self.properties``.
        
        """ #fmin is a function *minimizer*
list of best-fit parameters: ``[mA,mB,age,feh,[distance,A_V]]``.
Note that distance and A_V values will be meaningless unless
magnitudes are present in ``self.properties``.
list of best - fit parameters : ` ` [ mA mB age feh [ distance A_V ]] ` ` . Note that distance and A_V values will be meaningless unless magnitudes are present in ` ` self . properties ` ` .
self
nseeds
(optional)
Number of starting guesses, uniformly distributed throughout
allowed ranges.
( optional ) Number of starting guesses uniformly distributed throughout allowed ranges .