pyrats/halos.py
def plot_halo(self, hid, rvir_factor=5, field=('deposit', 'all_density'), folder='./',
                  weight_field=('index', 'ones'), cmap='viridis', slice=False,
                  axis='z', **kwargs):
        '''Plot a given halo.

        Parameters
        ----------
        * hid, integer
            The halo id to plot
        * rvir_factor, float, default=5
            Size of the region to plot in unit of Rvir

        * field, tuple
            The yt field to plot
        * folder, string
            The folder where to save the data
        * weight_field, tuple
            The field to weight the projection by.
        * cmap, string
            The colormap to use
        * slice, boolean
            If true, do a slice plot instead of a projection plot
        * axis, 'x', 'y' or 'z'
            The axis to project onto
        '''
        for k, v in kwargs.items():
            print('%s: %s not supported' % (k, v))

        if hid not in self.halos.index:
            mylog.error('%s not found.' % hid)
            return

        # Get position
        tmp = np.array(self.halos.loc[hid, ['x', 'y', 'z', 'rvir']])
        center = self.ds.arr(tmp[:3], 'code_length')
        radius = self.ds.arr(tmp[3] * rvir_factor, 'Mpc')

        # Get a sphere centered on the halo
        sphere = self.ds.sphere(center, radius)

        # Make a projection plot
        p = yt.ProjectionPlot(self.ds, axis, field, data_source=sphere,
                              weight_field=weight_field)

        p.set_cmap(field=field, cmap=cmap)
        p.annotate_timestamp(corner='upper_left', time=True, redshift=True)
        p.annotate_scale(corner='upper_right')

        # TODO: annotate halos
        # TODO: better name
        p.save(folder)
Plot a given halo.

        Parameters
        ----------
        * hid, integer
            The halo id to plot
        * rvir_factor, float, default=5
            Size of the region to plot in unit of Rvir

        * field, tuple
            The yt field to plot
        * folder, string
            The folder where to save the data
        * weight_field, tuple
            The field to weight the projection by.
        * cmap, string
            The colormap to use
        * slice, boolean
            If true, do a slice plot instead of a projection plot
        * axis, 'x', 'y' or 'z'
            The axis to project onto
        
Plot a given halo.
Parameters

hid, integer
The halo id to plot
rvir_factor, float, default=5
Size of the region to plot in unit of Rvir

field, tuple
The yt field to plot
folder, string
The folder where to save the data
weight_field, tuple
The field to weight the projection by.
Plot a given halo . Parameters hid integer The halo id to plot rvir_factor float default = 5 Size of the region to plot in unit of Rvir field tuple The yt field to plot folder string The folder where to save the data weight_field tuple The field to weight the projection by .
def plot_halo(self, hid, rvir_factor=5, field=('deposit', 'all_density'), folder='./',
                  weight_field=('index', 'ones'), cmap='viridis', slice=False,
                  axis='z', **kwargs):
        for k, v in kwargs.items():
            print('%s: %s not supported' % (k, v))
        if hid not in self.halos.index:
            mylog.error('%s not found.' % hid)
            return
        tmp = np.array(self.halos.loc[hid, ['x', 'y', 'z', 'rvir']])
        center = self.ds.arr(tmp[:3], 'code_length')
        radius = self.ds.arr(tmp[3] * rvir_factor, 'Mpc')
        sphere = self.ds.sphere(center, radius)
        p = yt.ProjectionPlot(self.ds, axis, field, data_source=sphere,
                              weight_field=weight_field)
        p.set_cmap(field=field, cmap=cmap)
        p.annotate_timestamp(corner='upper_left', time=True, redshift=True)
        p.annotate_scale(corner='upper_right')
        p.save(folder)
def plot_halo ( self , hid , rvir_factor = 5 , field = ( 'deposit' , 'all_density' ) , folder = './' , weight_field = ( 'index' , 'ones' ) , cmap = 'viridis' , slice = False , axis = 'z' , ** kwargs ) : for k , v in kwargs . items ( ) : print ( '%s: %s not supported' % ( k , v ) ) if hid not in self . halos . index : mylog . error ( '%s not found.' % hid ) return tmp = np . array ( self . halos . loc [ hid , [ 'x' , 'y' , 'z' , 'rvir' ] ] ) center = self . ds . arr ( tmp [ : 3 ] , 'code_length' ) radius = self . ds . arr ( tmp [ 3 ] * rvir_factor , 'Mpc' ) sphere = self . ds . sphere ( center , radius ) p = yt . ProjectionPlot ( self . ds , axis , field , data_source = sphere , weight_field = weight_field ) p . set_cmap ( field = field , cmap = cmap ) p . annotate_timestamp ( corner = 'upper_left' , time = True , redshift = True ) p . annotate_scale ( corner = 'upper_right' ) p . save ( folder )
Plot a given halo.
Plot a given halo .
'''Plot a given halo.

        Parameters
        ----------
        * hid, integer
            The halo id to plot
        * rvir_factor, float, default=5
            Size of the region to plot in unit of Rvir

        * field, tuple
            The yt field to plot
        * folder, string
            The folder where to save the data
        * weight_field, tuple
            The field to weight the projection by.
        * cmap, string
            The colormap to use
        * slice, boolean
            If true, do a slice plot instead of a projection plot
        * axis, 'x', 'y' or 'z'
            The axis to project onto
        ''' # Get position # Get a sphere centered on the halo # Make a projection plot # TODO: annotate halos # TODO: better name
self
hid
rvir_factor
field
folder
weight_field
cmap
slice
axis