isochrones/starmodel_old.py
def triangle(self, params=None, query=None, extent=0.999,
                 **kwargs):
        """
        Makes a nifty corner plot.

        Uses :func:`triangle.corner`.

        :param params: (optional)
            Names of columns (from :attr:`StarModel.samples`)
            to plot.  If ``None``, then it will plot samples
            of the parameters used in the MCMC fit-- that is,
            mass, age, [Fe/H], and optionally distance and A_V.

        :param query: (optional)
            Optional query on samples.

        :param extent: (optional)
            Will be appropriately passed to :func:`triangle.corner`.

        :param **kwargs:
            Additional keyword arguments passed to :func:`triangle.corner`.

        :return:
            Figure oject containing corner plot.
            
        """
        if triangle is None:
            raise ImportError('please run "pip install triangle_plot".')
        
        if params is None:
            if self.fit_for_distance:
                params = ['mass', 'age', 'feh', 'distance', 'AV']
            else:
                params = ['mass', 'age', 'feh']

        df = self.samples

        if query is not None:
            df = df.query(query)

        #convert extent to ranges, but making sure
        # that truths are in range.
        extents = []
        remove = []
        for i,par in enumerate(params):
            m = re.search('delta_(\w+)$',par)
            if m:
                if type(self) == BinaryStarModel:
                    b = m.group(1)
                    values = (df['{}_mag_B'.format(b)] - 
                              df['{}_mag_A'.format(b)])
                    df[par] = values
                else:
                    remove.append(i)
                    continue
                    
            else:
                values = df[par]
            qs = np.array([0.5 - 0.5*extent, 0.5 + 0.5*extent])
            minval, maxval = values.quantile(qs)
            if 'truths' in kwargs:
                datarange = maxval - minval
                if kwargs['truths'][i] < minval:
                    minval = kwargs['truths'][i] - 0.05*datarange
                if kwargs['truths'][i] > maxval:
                    maxval = kwargs['truths'][i] + 0.05*datarange
            extents.append((minval,maxval))
            
        [params.pop(i) for i in remove]

        fig = triangle.corner(df[params], labels=params, 
                               extents=extents, **kwargs)

        fig.suptitle(self.name, fontsize=22)
        return fig

        Makes a nifty corner plot.

        Uses :func:`triangle.corner`.

        :param params: (optional)
            Names of columns (from :attr:`StarModel.samples`)
            to plot.  If ``None``, then it will plot samples
            of the parameters used in the MCMC fit-- that is,
            mass, age, [Fe/H], and optionally distance and A_V.

        :param query: (optional)
            Optional query on samples.

        :param extent: (optional)
            Will be appropriately passed to :func:`triangle.corner`.

        :param **kwargs:
            Additional keyword arguments passed to :func:`triangle.corner`.

        :return:
            Figure oject containing corner plot.
            
        
Makes a nifty corner plot.
Makes a nifty corner plot .
def triangle(self, params=None, query=None, extent=0.999,
                 **kwargs):
        if triangle is None:
            raise ImportError('please run "pip install triangle_plot".')
        if params is None:
            if self.fit_for_distance:
                params = ['mass', 'age', 'feh', 'distance', 'AV']
            else:
                params = ['mass', 'age', 'feh']
        df = self.samples
        if query is not None:
            df = df.query(query)
        extents = []
        remove = []
        for i,par in enumerate(params):
            m = re.search('delta_(\w+)$',par)
            if m:
                if type(self) == BinaryStarModel:
                    b = m.group(1)
                    values = (df['{}_mag_B'.format(b)] - 
                              df['{}_mag_A'.format(b)])
                    df[par] = values
                else:
                    remove.append(i)
                    continue
            else:
                values = df[par]
            qs = np.array([0.5 - 0.5*extent, 0.5 + 0.5*extent])
            minval, maxval = values.quantile(qs)
            if 'truths' in kwargs:
                datarange = maxval - minval
                if kwargs['truths'][i] < minval:
                    minval = kwargs['truths'][i] - 0.05*datarange
                if kwargs['truths'][i] > maxval:
                    maxval = kwargs['truths'][i] + 0.05*datarange
            extents.append((minval,maxval))
        [params.pop(i) for i in remove]
        fig = triangle.corner(df[params], labels=params, 
                               extents=extents, **kwargs)
        fig.suptitle(self.name, fontsize=22)
        return fig
def triangle ( self , params = None , query = None , extent = 0.999 , ** kwargs ) : if triangle is None : raise ImportError ( 'please run "pip install triangle_plot".' ) if params is None : if self . fit_for_distance : params = [ 'mass' , 'age' , 'feh' , 'distance' , 'AV' ] else : params = [ 'mass' , 'age' , 'feh' ] df = self . samples if query is not None : df = df . query ( query ) extents = [ ] remove = [ ] for i , par in enumerate ( params ) : m = re . search ( 'delta_(\w+)$' , par ) if m : if type ( self ) == BinaryStarModel : b = m . group ( 1 ) values = ( df [ '{}_mag_B' . format ( b ) ] - df [ '{}_mag_A' . format ( b ) ] ) df [ par ] = values else : remove . append ( i ) continue else : values = df [ par ] qs = np . array ( [ 0.5 - 0.5 * extent , 0.5 + 0.5 * extent ] ) minval , maxval = values . quantile ( qs ) if 'truths' in kwargs : datarange = maxval - minval if kwargs [ 'truths' ] [ i ] < minval : minval = kwargs [ 'truths' ] [ i ] - 0.05 * datarange if kwargs [ 'truths' ] [ i ] > maxval : maxval = kwargs [ 'truths' ] [ i ] + 0.05 * datarange extents . append ( ( minval , maxval ) ) [ params . pop ( i ) for i in remove ] fig = triangle . corner ( df [ params ] , labels = params , extents = extents , ** kwargs ) fig . suptitle ( self . name , fontsize = 22 ) return fig
Makes a nifty corner plot.
Makes a nifty corner plot .
"""
        Makes a nifty corner plot.

        Uses :func:`triangle.corner`.

        :param params: (optional)
            Names of columns (from :attr:`StarModel.samples`)
            to plot.  If ``None``, then it will plot samples
            of the parameters used in the MCMC fit-- that is,
            mass, age, [Fe/H], and optionally distance and A_V.

        :param query: (optional)
            Optional query on samples.

        :param extent: (optional)
            Will be appropriately passed to :func:`triangle.corner`.

        :param **kwargs:
            Additional keyword arguments passed to :func:`triangle.corner`.

        :return:
            Figure oject containing corner plot.
            
        """ #convert extent to ranges, but making sure # that truths are in range.
Figure oject containing corner plot.
Figure oject containing corner plot .
self
params
(optional)
Names of columns (from :attr:`StarModel.samples`)
to plot.  If ``None``, then it will plot samples
of the parameters used in the MCMC fit-- that is,
mass, age, [Fe/H], and optionally distance and A_V.
( optional ) Names of columns ( from : attr : ` StarModel . samples ` ) to plot . If ` ` None ` ` then it will plot samples of the parameters used in the MCMC fit -- that is mass age [ Fe / H ] and optionally distance and A_V .
query
(optional)
Optional query on samples.
( optional ) Optional query on samples .
extent
(optional)
Will be appropriately passed to :func:`triangle.corner`.
( optional ) Will be appropriately passed to : func : ` triangle . corner ` .
**kwargs
Additional keyword arguments passed to :func:`triangle.corner`.
Additional keyword arguments passed to : func : ` triangle . corner ` .