isochrones/starmodel_old.py
def fit_multinest(self, n_live_points=1000, basename='chains/single-',
                      verbose=True, refit=False, overwrite=False,
                      **kwargs):
        """
        Fits model using MultiNest, via pymultinest.  

        :param n_live_points:
            Number of live points to use for MultiNest fit.

        :param basename:
            Where the MulitNest-generated files will live.  
            By default this will be in a folder named `chains`
            in the current working directory.  Calling this 
            will define a `_mnest_basename` attribute for 
            this object.

        :param verbose:
            Whether you want MultiNest to talk to you.

        :param refit, overwrite:
            Set either of these to true if you want to 
            delete the MultiNest files associated with the
            given basename and start over.

        :param **kwargs:
            Additional keyword arguments will be passed to 
            :func:`pymultinest.run`.

        """
        folder = os.path.abspath(os.path.dirname(basename))
        if not os.path.exists(folder):
            os.makedirs(folder)

        #If previous fit exists, see if it's using the same
        # observed properties
        prop_nomatch = False
        propfile = '{}properties.json'.format(basename)
        if os.path.exists(propfile):
            with open(propfile) as f:
                props = json.load(f)
            if set(props.keys()) != set(self.properties.keys()):
                prop_nomatch = True
            else:
                for k,v in props.items():
                    if np.size(v)==2:
                        if not self.properties[k][0] == v[0] and \
                                self.properties[k][1] == v[1]:
                            props_nomatch = True
                    else:
                        if not self.properties[k] == v:
                            props_nomatch = True

        if prop_nomatch and not overwrite:
            raise ValueError('Properties not same as saved chains ' +
                            '(basename {}*). '.format(basename) +
                            'Use overwrite=True to fit.')


        if refit or overwrite:
            files = glob.glob('{}*'.format(basename))
            [os.remove(f) for f in files]

        self._mnest_basename = basename

        pymultinest.run(self.mnest_loglike, self.mnest_prior, self.n_params,
                        n_live_points=n_live_points, outputfiles_basename=basename,
                        verbose=verbose,
                        **kwargs)

        with open(propfile, 'w') as f:
            json.dump(self.properties, f, indent=2)

        self._make_samples()

        Fits model using MultiNest, via pymultinest.  

        :param n_live_points:
            Number of live points to use for MultiNest fit.

        :param basename:
            Where the MulitNest-generated files will live.  
            By default this will be in a folder named `chains`
            in the current working directory.  Calling this 
            will define a `_mnest_basename` attribute for 
            this object.

        :param verbose:
            Whether you want MultiNest to talk to you.

        :param refit, overwrite:
            Set either of these to true if you want to 
            delete the MultiNest files associated with the
            given basename and start over.

        :param **kwargs:
            Additional keyword arguments will be passed to 
            :func:`pymultinest.run`.

        
Fits model using MultiNest, via pymultinest.
Fits model using MultiNest via pymultinest .
def fit_multinest(self, n_live_points=1000, basename='chains/single-',
                      verbose=True, refit=False, overwrite=False,
                      **kwargs):
        folder = os.path.abspath(os.path.dirname(basename))
        if not os.path.exists(folder):
            os.makedirs(folder)
        prop_nomatch = False
        propfile = '{}properties.json'.format(basename)
        if os.path.exists(propfile):
            with open(propfile) as f:
                props = json.load(f)
            if set(props.keys()) != set(self.properties.keys()):
                prop_nomatch = True
            else:
                for k,v in props.items():
                    if np.size(v)==2:
                        if not self.properties[k][0] == v[0] and \
                                self.properties[k][1] == v[1]:
                            props_nomatch = True
                    else:
                        if not self.properties[k] == v:
                            props_nomatch = True
        if prop_nomatch and not overwrite:
            raise ValueError('Properties not same as saved chains ' +
                            '(basename {}*). '.format(basename) +
                            'Use overwrite=True to fit.')
        if refit or overwrite:
            files = glob.glob('{}*'.format(basename))
            [os.remove(f) for f in files]
        self._mnest_basename = basename
        pymultinest.run(self.mnest_loglike, self.mnest_prior, self.n_params,
                        n_live_points=n_live_points, outputfiles_basename=basename,
                        verbose=verbose,
                        **kwargs)
        with open(propfile, 'w') as f:
            json.dump(self.properties, f, indent=2)
        self._make_samples()
def fit_multinest ( self , n_live_points = 1000 , basename = 'chains/single-' , verbose = True , refit = False , overwrite = False , ** kwargs ) : folder = os . path . abspath ( os . path . dirname ( basename ) ) if not os . path . exists ( folder ) : os . makedirs ( folder ) prop_nomatch = False propfile = '{}properties.json' . format ( basename ) if os . path . exists ( propfile ) : with open ( propfile ) as f : props = json . load ( f ) if set ( props . keys ( ) ) != set ( self . properties . keys ( ) ) : prop_nomatch = True else : for k , v in props . items ( ) : if np . size ( v ) == 2 : if not self . properties [ k ] [ 0 ] == v [ 0 ] and self . properties [ k ] [ 1 ] == v [ 1 ] : props_nomatch = True else : if not self . properties [ k ] == v : props_nomatch = True if prop_nomatch and not overwrite : raise ValueError ( 'Properties not same as saved chains ' + '(basename {}*). ' . format ( basename ) + 'Use overwrite=True to fit.' ) if refit or overwrite : files = glob . glob ( '{}*' . format ( basename ) ) [ os . remove ( f ) for f in files ] self . _mnest_basename = basename pymultinest . run ( self . mnest_loglike , self . mnest_prior , self . n_params , n_live_points = n_live_points , outputfiles_basename = basename , verbose = verbose , ** kwargs ) with open ( propfile , 'w' ) as f : json . dump ( self . properties , f , indent = 2 ) self . _make_samples ( )
Fits model using MultiNest, via pymultinest.
Fits model using MultiNest via pymultinest .
"""
        Fits model using MultiNest, via pymultinest.  

        :param n_live_points:
            Number of live points to use for MultiNest fit.

        :param basename:
            Where the MulitNest-generated files will live.  
            By default this will be in a folder named `chains`
            in the current working directory.  Calling this 
            will define a `_mnest_basename` attribute for 
            this object.

        :param verbose:
            Whether you want MultiNest to talk to you.

        :param refit, overwrite:
            Set either of these to true if you want to 
            delete the MultiNest files associated with the
            given basename and start over.

        :param **kwargs:
            Additional keyword arguments will be passed to 
            :func:`pymultinest.run`.

        """ #If previous fit exists, see if it's using the same # observed properties
self
n_live_points
Number of live points to use for MultiNest fit.
Number of live points to use for MultiNest fit .
basename
None
verbose
Whether you want MultiNest to talk to you.
Whether you want MultiNest to talk to you .
refit
overwrite
Set either of these to true if you want to
delete the MultiNest files associated with the
given basename and start over.
Set either of these to true if you want to delete the MultiNest files associated with the given basename and start over .
**kwargs
Additional keyword arguments will be passed to
:func:`pymultinest.run`.
Additional keyword arguments will be passed to : func : ` pymultinest . run ` .