yt.raven Plotting and Plot Interfaces

yt.raven.PlotCollection Plot Collection

PlotCollection is the basic means by which most of your backend-plotting will take place, and it contains a number of convenience functions for generating images and manipulating existing plots.

class yt.raven.PlotCollection(pf, center=None, deliverator_id=-1)

Generate a collection of linked plots using pf as a source, optionally submitting to the deliverator with deliverator_id and with center, which will otherwise be taken to be the point of maximum density.

add_cutting_plane(field, normal, center=None, use_colorbar=True, figure=None, axes=None, fig_size=None, obj=None, **kwargs)
Generate a cutting plane of field with normal, centered at center (defaults to PlotCollection center) with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches). If so desired, obj is a pre-existing cutting plane object.
add_fixed_res_cutting_plane(field, normal, width, res=512, center=None, use_colorbar=True, figure=None, axes=None, fig_size=None, obj=None, **kwargs)
Generate a fixed resolution, interpolated cutting plane of field with normal, centered at center (defaults to PlotCollection center) with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches). If so desired, obj is a pre-existing cutting plane object.
add_particles(axis, width, p_size=1.0, col='k', stride=1.0, data_source=None, figure=None, axes=None)
Create a particle plot, where particle positions have been projected along axis from a slab of width (in code units). p_size is the point size, col is color, stride is the stride of concatenated particle lists to plot.
add_phase_object(data_source, fields, cmap=None, weight='CellMassMsun', accumulation=False, x_bins=64, x_log=True, x_bounds=None, y_bins=64, y_log=True, y_bounds=None, lazy_reader=True, id=None, axes=None, figure=None, fractional=False)
Given a data_source, and fields, automatically generate a 2D profile and plot it. id is used internally to add onto the prefix, and will be automatically generated if not given. Remainder of arguments are identical to add_profile_object().
add_phase_sphere(radius, unit, fields, **kwargs)
Given a radius and unit, generate a 2D profile from a sphere, with fields as the x,y,z. Automatically weights z by CellMassMsun. kwargs get passed onto add_phase_object().
add_profile_object(data_source, fields, weight='CellMassMsun', accumulation=False, x_bins=64, x_log=True, x_bounds=None, lazy_reader=True, id=None, axes=None, figure=None)
Use an existing data object, data_source, to be the source of a one-dimensional profile. fields will define the x and y bin-by fields, weight is used to weight the y value, accumulation determines if y is summed along x, x_bins, x_log and x_bounds define the means of choosing the bins. id is used internally to differentiate between multiple plots in a single collection. lazy_reader determines the memory-conservative status.
add_profile_sphere(radius, unit, fields, **kwargs)
Generate a spherical 1D profile, given only a radius, a unit, and at least two fields. Any remaining kwargs will be passed onto add_profile_object().
add_projection(*args, **kwargs)
Generate a projection of field along axis, optionally giving a weight_field-weighted average with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches)
add_projection_interpolated(*args, **kwargs)

Generate a projection of field along axis, optionally giving a weight_field-weighted average with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches)

The projection will be interpolated using the delaunay module, with natural neighbor interpolation.

add_slice(*args, **kwargs)
Generate a slice through field along axis, optionally at [axis]=*coord*, with the center attribute given (some degeneracy with coord, but not complete), with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches)
add_slice_interpolated(*args, **kwargs)

Generate a slice through field along axis, optionally at [axis]=*coord*, with the center attribute given (some degeneracy with coord, but not complete), with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches)

The slice will be interpolated using the delaunay module, with natural neighbor interpolation.

autoscale()
Turn back on autoscaling.
clear_plots()
Delete all plots and their attendant data.
save(basename=None, format='png', override=False, force_save=False)
Same plots with automatically generated names, prefixed with basename (including directory path) unless override is specified, and in format.
set_cmap(cmap)
Change the colormap of all plots to cmap.
set_lim(lim)
Shorthand for setting x,y at same time. lim should be formatted as (xmin,xmax,ymin,ymax)
set_width(width, unit)
Set the witdh of the slices, cutting planes and projections to be width units
set_xlim(xmin, xmax)
Set the x boundaries of all plots.
set_ylim(ymin, ymax)
Set the y boundaries of all plots.
set_zlim(zmin, zmax, **kwargs)

Set the limits of the colorbar. ‘min’ or ‘max’ are possible inputs when combined with dex=value, where value gives the maximum number of dex to go above/below the min/max. If value is larger than the true range of values, min/max are limited to true range.

Only ONE of the following options can be specified. If all 3 are specified, they will be used in the following precedence order:

ticks - a list of floating point numbers at which to put ticks minmaxtick - display DEFAULT ticks with min & max also displayed nticks - if ticks not specified, can automatically determine a

number of ticks to be evenly spaced in log space
switch_field(field)
Change all the fields displayed to be field
switch_z(field)
Change all the fields displayed to be field
class yt.raven.PlotCollectionInteractive(*args, **kwargs)
add_cutting_plane(*args, **kwargs)
Generate a cutting plane of field with normal, centered at center (defaults to PlotCollection center) with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches). If so desired, obj is a pre-existing cutting plane object.
add_fixed_res_cutting_plane(*args, **kwargs)
Generate a fixed resolution, interpolated cutting plane of field with normal, centered at center (defaults to PlotCollection center) with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches). If so desired, obj is a pre-existing cutting plane object.
add_particles(*args, **kwargs)
Create a particle plot, where particle positions have been projected along axis from a slab of width (in code units). p_size is the point size, col is color, stride is the stride of concatenated particle lists to plot.
add_phase_object(*args, **kwargs)
Given a data_source, and fields, automatically generate a 2D profile and plot it. id is used internally to add onto the prefix, and will be automatically generated if not given. Remainder of arguments are identical to add_profile_object().
add_phase_sphere(*args, **kwargs)
Given a radius and unit, generate a 2D profile from a sphere, with fields as the x,y,z. Automatically weights z by CellMassMsun. kwargs get passed onto add_phase_object().
add_profile_object(*args, **kwargs)
Use an existing data object, data_source, to be the source of a one-dimensional profile. fields will define the x and y bin-by fields, weight is used to weight the y value, accumulation determines if y is summed along x, x_bins, x_log and x_bounds define the means of choosing the bins. id is used internally to differentiate between multiple plots in a single collection. lazy_reader determines the memory-conservative status.
add_profile_sphere(*args, **kwargs)
Generate a spherical 1D profile, given only a radius, a unit, and at least two fields. Any remaining kwargs will be passed onto add_profile_object().
add_projection(*args, **kwargs)
Generate a projection of field along axis, optionally giving a weight_field-weighted average with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches)
add_projection_interpolated(*args, **kwargs)

Generate a projection of field along axis, optionally giving a weight_field-weighted average with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches)

The projection will be interpolated using the delaunay module, with natural neighbor interpolation.

add_slice(*args, **kwargs)
Generate a slice through field along axis, optionally at [axis]=*coord*, with the center attribute given (some degeneracy with coord, but not complete), with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches)
add_slice_interpolated(*args, **kwargs)

Generate a slice through field along axis, optionally at [axis]=*coord*, with the center attribute given (some degeneracy with coord, but not complete), with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches)

The slice will be interpolated using the delaunay module, with natural neighbor interpolation.

autoscale(*args, **kwargs)
Turn back on autoscaling.
set_cmap(*args, **kwargs)
Change the colormap of all plots to cmap.
set_lim(*args, **kwargs)
Shorthand for setting x,y at same time. lim should be formatted as (xmin,xmax,ymin,ymax)
set_width(*args, **kwargs)
Set the witdh of the slices, cutting planes and projections to be width units
set_xlim(*args, **kwargs)
Set the x boundaries of all plots.
set_ylim(*args, **kwargs)
Set the y boundaries of all plots.
set_zlim(*args, **kwargs)

Set the limits of the colorbar. ‘min’ or ‘max’ are possible inputs when combined with dex=value, where value gives the maximum number of dex to go above/below the min/max. If value is larger than the true range of values, min/max are limited to true range.

Only ONE of the following options can be specified. If all 3 are specified, they will be used in the following precedence order:

ticks - a list of floating point numbers at which to put ticks minmaxtick - display DEFAULT ticks with min & max also displayed nticks - if ticks not specified, can automatically determine a

number of ticks to be evenly spaced in log space
switch_field(*args, **kwargs)
Change all the fields displayed to be field
yt.raven.get_multi_plot(nx, ny, colorbar='vertical', bw=4, dpi=300)
This returns nx and ny axes on a single figure, set up so that the colorbar can be placed either vertically or horizontally in a bonus column or row, respectively. The axes all have base width of bw inches.

yt.raven.PlotInterface Raw Plot Interface

yt.raven.PlotInterface.get_slice(pf, *args, **kwargs)
Get a single slice plot, with standard field, axis and center arguments.
yt.raven.PlotInterface.get_projection(pf, *args, **kwargs)
Get a single projection plot, with standard field, axis and center arguments.

yt.raven.FixedResolution Pixelization Interface

class yt.raven.FixedResolution.FixedResolutionBuffer(data_source, bounds, buff_size, antialias=True)

Accepts a 2D data object, such as a Projection or Slice, and implements a protocol for generating a pixelized, fixed-resolution buffer. bounds is (px_min,px_max,py_min,py_max), buff_size is (width, height), and antialias is a boolean referring to whether or not the buffer should have pixel boundary antialiasing.

convert_distance_x(distance)
This converts a real distance to a pixel distance in x.
convert_distance_y(distance)
This converts a real distance to a pixel distance in y.
convert_to_pixel(coords)
This converts a code-location to an image-location
export_fits(filename_prefix, fields=None, clobber=False)

This will export a set of FITS images of either the fields specified or all the fields already in the object. The output filenames are filename_prefix plus an underscore plus the name of the field. If clobber is set to True, this will overwrite any existing FITS file.

This requires the pyfits module, which is a standalone module provided by STSci to interface with FITS-format files.

export_hdf5(filename, fields=None)
This function opens (append-mode) an HDF5 file and adds all of the requested fields (default: All) to the top level of the data file.
open_in_ds9(field, take_log=True)
This will open a given field in DS9. This requires the numdisplay package, which is a simple download from STSci. Furthermore, it presupposed that it can connect to DS9 – that is, that DS9 is already open.
class yt.raven.FixedResolution.ObliqueFixedResolutionBuffer(data_source, bounds, buff_size, antialias=True)

This object is a subclass of yt.raven.FixedResolution.FixedResolutionBuffer that supports non-aligned input data objects, primarily cutting planes.

Accepts a 2D data object, such as a Projection or Slice, and implements a protocol for generating a pixelized, fixed-resolution buffer. bounds is (px_min,px_max,py_min,py_max), buff_size is (width, height), and antialias is a boolean referring to whether or not the buffer should have pixel boundary antialiasing.

convert_distance_x(distance)
This converts a real distance to a pixel distance in x.
convert_distance_y(distance)
This converts a real distance to a pixel distance in y.
convert_to_pixel(coords)
This converts a code-location to an image-location
export_fits(filename_prefix, fields=None, clobber=False)

This will export a set of FITS images of either the fields specified or all the fields already in the object. The output filenames are filename_prefix plus an underscore plus the name of the field. If clobber is set to True, this will overwrite any existing FITS file.

This requires the pyfits module, which is a standalone module provided by STSci to interface with FITS-format files.

export_hdf5(filename, fields=None)
This function opens (append-mode) an HDF5 file and adds all of the requested fields (default: All) to the top level of the data file.
open_in_ds9(field, take_log=True)
This will open a given field in DS9. This requires the numdisplay package, which is a simple download from STSci. Furthermore, it presupposed that it can connect to DS9 – that is, that DS9 is already open.
class yt.raven.FixedResolution.AnnuliProfiler(fixed_buffer, center, num_bins, min_radius, max_radius)

This is a very simple class, principally used to sum up total values inside annuli in a fixed resolution buffer. It accepts fixed_buffer, which should be a FixedResolutionBuffer, center, which is in pixel coordinates. num_bins, min_radius and max_radius all refer to the binning properties for the annuli. Note that these are all in pixel values.

sum(item)
Returns the sum of a given field.

yt.raven.Callbacks Plot Modification Callbacks

These are all meant to be instantiated and fed into yt.raven.RavenPlot.add_callback(). For a more narrative discussion see Plot Modification Mechanisms.

class yt.raven.Callbacks.ArrowCallback(pos, code_size, plot_args=None)
This adds an arrow pointing at pos with size code_size in code units. plot_args is a dict fed to matplotlib with arrow properties.
class yt.raven.Callbacks.ClumpContourCallback(clumps, plot_args=None)
Take a list of clumps and plot them as a set of contours.
class yt.raven.Callbacks.ContourCallback(field, ncont=5, factor=4, take_log=False, clim=None, plot_args=None)
Add contours in field to the plot. ncont governs the number of contours generated, factor governs the number of points used in the interpolation, take_log governs how it is contoured and clim gives the (upper, lower) limits for contouring.
class yt.raven.Callbacks.CoordAxesCallback(unit=None, coords=False)
Creates x and y axes for a VMPlot. In the future, it will attempt to guess the proper units to use.
class yt.raven.Callbacks.CuttingQuiverCallback(field_x, field_y, factor)
Get a quiver plot on top of a cutting plane, using field_x and field_y, skipping every factor datapoint in the discretization.
class yt.raven.Callbacks.GridBoundaryCallback(alpha=1.0, min_pix=1, annotate=False, periodic=True)
Adds grid boundaries to a plot, optionally with alpha-blending. Cuttoff for display is at min_pix wide. annotate puts the grid id in the corner of the grid. (Not so great in projections...)
class yt.raven.Callbacks.HopCircleCallback(hop_output, max_number=None, annotate=False, min_size=20, max_size=10000000, font_size=8, print_halo_size=False, print_halo_mass=False, width=None)
Accepts a yt.lagos.HopList hop_output and plots up to max_number (None for unlimited) halos as circles.
class yt.raven.Callbacks.HopParticleCallback(hop_output, p_size=1.0, max_number=None, min_size=20, alpha=0.20000000000000001)
Adds particle positions for the members of each halo as identified by HOP. Along axis up to max_number groups in hop_output that are larger than min_size are plotted with p_size pixels per particle; alpha determines the opacity of each particle.
class yt.raven.Callbacks.LabelCallback(label)
This adds a label to the plot.
class yt.raven.Callbacks.LinePlotCallback(x, y, plot_args=None)
Over plot x and y with plot_args fed into the plot.
class yt.raven.Callbacks.MarkerAnnotateCallback(pos, marker='x', plot_args=None)
Adds text marker at pos in code-arguments. plot_args is a dict that will be forwarded to the plot command.
class yt.raven.Callbacks.ParticleCallback(width, p_size=1.0, col='k', stride=1.0, ptype=None, stars_only=False, dm_only=False)
Adds particle positions, based on a thick slab along axis with a width along the line of sight. p_size controls the number of pixels per particle, and col governs the color. ptype will restrict plotted particles to only those that are of a given type.
class yt.raven.Callbacks.PlotCallback(*args, **kwargs)
class yt.raven.Callbacks.PointAnnotateCallback(pos, text, text_args=None)
This adds text at position pos, where pos is in code-space. text_args is a dict fed to the text placement code.
class yt.raven.Callbacks.QuiverCallback(field_x, field_y, factor)
Adds a ‘quiver’ plot to any plot, using the field_x and field_y from the associated data, skipping every factor datapoints.
class yt.raven.Callbacks.SphereCallback(center, radius, circle_args=None, text=None, text_args=None)
A sphere centered at center in code units with radius radius in code units will be created, with optional circle_args, text, and text_args.
class yt.raven.Callbacks.TextLabelCallback(pos, text, text_args=None)
Accepts a position in (0..1, 0..1) of the image, some text and optionally some text arguments.
class yt.raven.Callbacks.TitleCallback(title='Plot')
Accepts a title and adds it to the plot
class yt.raven.Callbacks.UnitBoundaryCallback(unit='au', factor=4, text_annotate=True, text_which=-2)
Add on a plot indicating where factor*s of *unit are shown. Optionally text_annotate on the text_which-indexed box on display.
class yt.raven.Callbacks.VelocityCallback(factor=16)
Adds a ‘quiver’ plot of velocity to the plot, skipping all but every factor datapoint
class yt.raven.Callbacks.VobozCircleCallback(voboz_output, max_number=None, annotate=False, min_size=20, font_size=8, print_halo_size=False)

Comments

Feel free to leave comments! If you've got a GMail account, you can use https://www.google.com/accounts/o8/id as your OpenID URL.
comments powered by Disqus