API Reference

Plots and the Plotting Interface

SlicePlot and ProjectionPlot

SlicePlot(ds[, normal, fields, axis]) A factory function for yt.visualization.plot_window.AxisAlignedSlicePlot and yt.visualization.plot_window.OffAxisSlicePlot objects.
AxisAlignedSlicePlot(ds, axis, fields[, ...]) Creates a slice plot from a dataset
OffAxisSlicePlot(ds, normal, fields[, ...]) Creates an off axis slice plot from a dataset
ProjectionPlot(ds, axis, fields[, center, ...]) Creates a projection plot from a dataset
OffAxisProjectionPlot(ds, normal, fields[, ...]) Creates an off axis projection plot from a dataset
WindowPlotMPL(data, cbname, cblinthresh, ...) A container for a single PlotWindow matplotlib figure and axes
PlotWindow(data_source, bounds[, buff_size, ...]) A ploting mechanism based around the concept of a window into a data source.

ProfilePlot and PhasePlot

ProfilePlot(data_source, x_field, y_fields) Create a 1d profile plot from a data source or from a list of profile objects.
PhasePlot(data_source, x_field, y_field, ...) Create a 2d profile (phase) plot from a data source or from profile object created with yt.data_objects.profiles.create_profile.
PhasePlotMPL(x_data, y_data, data, x_scale, ...) A container for a single matplotlib figure and axes for a PhasePlot

Particle Plots

ParticleProjectionPlot(ds, axis[, fields, ...]) Creates a particle plot from a dataset
ParticlePhasePlot(data_source, x_field, y_field) Create a 2d particle phase plot from a data source or from a yt.data_objects.profiles.ParticleProfile object.
ParticlePlot(ds, x_field, y_field[, ...]) A factory function for yt.visualization.particle_plots.ParticleProjectionPlot and yt.visualization.profile_plotter.ParticlePhasePlot objects.

Fixed Resolution Pixelization

FixedResolutionBuffer(data_source, bounds, ...) This accepts a 2D data object, such as a Projection or Slice, and implements a protocol for generating a pixelized, fixed-resolution image buffer.
ParticleImageBuffer(data_source, bounds, ...) This object is a subclass of yt.visualization.fixed_resolution.FixedResolutionBuffer that supports particle plots.
CylindricalFixedResolutionBuffer(...[, ...]) This object is a subclass of yt.visualization.fixed_resolution.FixedResolutionBuffer that supports non-aligned input data objects, primarily cutting planes.
ObliqueFixedResolutionBuffer(data_source, ...) This object is a subclass of yt.visualization.fixed_resolution.FixedResolutionBuffer that supports non-aligned input data objects, primarily cutting planes.
OffAxisProjectionFixedResolutionBuffer(...) This object is a subclass of yt.visualization.fixed_resolution.FixedResolutionBuffer that supports off axis projections.

Data Sources

Physical Objects

These are the objects that act as physical selections of data, describing a region in space. These are not typically addressed directly; see Available Objects for more information.

Base Classes

These will almost never need to be instantiated on their own.

YTDataContainer(ds, field_parameters) Generic YTDataContainer container.
YTSelectionContainer(ds, field_parameters[, ...])
YTSelectionContainer0D(ds[, ...])
YTSelectionContainer1D(ds[, ...])
YTSelectionContainer2D(axis, ds[, ...])
YTSelectionContainer3D(center, ds[, ...]) Returns an instance of YTSelectionContainer3D, or prepares one.

Selection Objects

These objects are defined by some selection method or mechanism. Most are geometric.

YTPoint(p[, ds, field_parameters, data_source]) A 0-dimensional object defined by a single point
YTOrthoRay(axis, coords[, ds, ...]) This is an orthogonal ray cast through the entire domain, at a specific coordinate.
YTRay(start_point, end_point[, ds, ...]) This is an arbitrarily-aligned ray cast through the entire domain, at a specific coordinate.
YTSlice(axis, coord[, center, ds, ...]) This is a data object corresponding to a slice through the simulation domain.
YTCuttingPlane(normal, center[, ...]) This is a data object corresponding to an oblique slice through the simulation domain.
YTDisk(center, normal, radius, height[, ...]) By providing a center, a normal, a radius and a height we can define a cylinder of any proportion.
YTRegion(center, left_edge, right_edge[, ...]) A 3D region of data with an arbitrary center.
YTDataCollection(obj_list[, ds, ...]) By selecting an arbitrary object_list, we can act on those grids.
YTSphere(center, radius[, ds, ...]) A sphere of points defined by a center and a radius.
YTEllipsoid(center, A, B, C, e0, tilt[, ...]) By providing a center,*A*,*B*,*C*,*e0*,*tilt* we can define a ellipsoid of any proportion.
YTCutRegion(data_source, conditionals[, ds, ...]) This is a data object designed to allow individuals to apply logical operations to fields and filter as a result of those cuts.
AMRGridPatch(id[, filename, index])

Construction Objects

These objects typically require some effort to build. Often this means integrating through the simulation in some way, or creating some large or expensive set of intermediate data.

YTStreamline(positions[, length, fields, ds]) This is a streamline, which is a set of points defined as being parallel to some vector field.
YTQuadTreeProj(field, axis[, weight_field, ...]) This is a data object corresponding to a line integral through the simulation domain.
YTCoveringGrid(level, left_edge, dims[, ...]) A 3D region with all data extracted to a single, specified resolution.
YTArbitraryGrid(left_edge, right_edge, dims) A 3D region with arbitrary bounds and dimensions.
YTSmoothedCoveringGrid(level, left_edge, dims) A 3D region with all data extracted and interpolated to a single, specified resolution.
YTSurface(data_source, surface_field, ...[, ds]) This surface object identifies isocontours on a cell-by-cell basis, with no consideration of global connectedness, and returns the vertices of the Triangles in that isocontour.

Time Series Objects

These are objects that either contain and represent or operate on series of datasets.

DatasetSeries(outputs[, parallel, ...]) The DatasetSeries object is a container of multiple datasets, allowing easy iteration and computation on them.
DatasetSeriesObject(time_series, ...)
TimeSeriesQuantitiesContainer(data_object, ...)

Geometry Handlers

These objects generate an “index” into multiresolution data.

Index(ds, dataset_type) The base index class
GridIndex(ds, dataset_type) The index class for patch and block AMR datasets.
OctreeIndex(ds, dataset_type) The Index subclass for oct AMR datasets
ParticleIndex(ds, dataset_type) The Index subclass for particle datasets
UnstructuredIndex(ds, dataset_type) The Index subclass for unstructured and hexahedral mesh datasets.


These classes and functions enable yt’s symbolic unit handling system.

yt.data_objects.static_output.Dataset.arr Converts an array into a yt.units.yt_array.YTArray
yt.data_objects.static_output.Dataset.quan Converts an scalar into a yt.units.yt_array.YTQuantity
Unit A symbolic unit, using sympy functionality.
UnitRegistry([add_default_symbols, lut]) A registry for unit symbols
YTArray An ndarray subclass that attaches a symbolic unit object to the array data.
YTQuantity A scalar associated with a unit.



ARTIOIndex(ds[, dataset_type])
ARTIOOctreeSubset(base_region, sfc_start, ...)
ARTIORootMeshSubset(base_region, sfc_start, ...)
ARTIODataset(filename[, dataset_type, ...])
ARTIOFieldInfo(ds, field_list[, slice_info])


AthenaGrid(id, index, level, start, ...)
AthenaHierarchy(ds[, dataset_type])
AthenaDataset(filename[, dataset_type, ...])
AthenaFieldInfo(ds, field_list[, slice_info])


BoxlibGrid(grid_id, offset[, filename, index])
BoxlibHierarchy(ds[, dataset_type])
BoxlibDataset(output_dir[, cparam_filename, ...]) This class is a stripped down class that simply reads and parses filename, without looking at the Boxlib index.
CastroDataset(output_dir[, cparam_filename, ...])
MaestroDataset(output_dir[, ...])
NyxHierarchy(ds[, dataset_type])
NyxDataset(output_dir[, cparam_filename, ...])
OrionHierarchy(ds[, dataset_type])
OrionDataset(output_dir[, cparam_filename, ...])
BoxlibFieldInfo(ds, field_list[, slice_info])
IOHandlerBoxlib(ds, *args, **kwargs)
IOHandlerOrion(ds, *args, **kwargs)


ChomboGrid(id, index, level, start, stop)
ChomboHierarchy(ds[, dataset_type])
ChomboDataset(filename[, dataset_type, ...])
Orion2Hierarchy(ds[, dataset_type])
Orion2Dataset(filename[, dataset_type, ...])
IOHandlerChomboHDF5(ds, *args, **kwargs)
IOHandlerOrion2HDF5(ds, *args, **kwargs)


ShockTubeTest(data_file, solution_file, ...)
EnzoGrid(id, index) Class representing a single Enzo Grid instance.
EnzoGridGZ(id, index)
EnzoGridInMemory(id, index)
EnzoHierarchy1D(ds, dataset_type)
EnzoHierarchy2D(ds, dataset_type)
EnzoHierarchy(ds, dataset_type)
EnzoHierarchyInMemory(ds[, dataset_type])
EnzoDatasetInMemory([parameter_override, ...])
EnzoDataset(filename[, dataset_type, ...]) Enzo-specific output, set at a fixed time.
EnzoFieldInfo(ds, field_list)
IOHandlerInMemory(ds[, ghost_zones])
IOHandlerPackedHDF5GhostZones(*args, **kwargs)
EnzoCosmology(hubble_constant, omega_matter, ...)
EnzoSimulation(parameter_filename[, ...]) Initialize an Enzo Simulation object.


FITSGrid(id, index, level)
FITSHierarchy(ds[, dataset_type])
FITSDataset(filename[, dataset_type, ...])
FITSFieldInfo(ds, field_list[, slice_info])


FLASHGrid(id, index, level)
FLASHHierarchy(ds[, dataset_type])
FLASHDataset(filename[, dataset_type, ...])
FLASHFieldInfo(ds, field_list[, slice_info])


GDFGrid(id, index, level, start, dimensions)
GDFHierarchy(ds[, dataset_type])
GDFDataset(filename[, dataset_type, ...])

Halo Catalogs

HaloCatalogHDF5File(ds, io, filename, file_id)
HaloCatalogDataset(filename[, dataset_type, ...])
HaloCatalogFieldInfo(ds, field_list[, ...])
OWLSSubfindParticleIndex(ds, dataset_type)
OWLSSubfindHDF5File(ds, io, filename, file_id)
OWLSSubfindDataset(filename[, dataset_type, ...])
OWLSSubfindFieldInfo(ds, field_list[, ...])
RockstarBinaryFile(ds, io, filename, file_id)
RockstarDataset(filename[, dataset_type, ...])
RockstarFieldInfo(ds, field_list[, slice_info])
IOHandlerRockstarBinary(*args, **kwargs)


MoabHex8Hierarchy(ds[, dataset_type])
MoabHex8Mesh(mesh_id, filename, ...)
MoabHex8Dataset(filename[, dataset_type, ...])
PyneHex8Mesh(mesh_id, filename, ...)
PyneMeshHex8Hierarchy(ds[, dataset_type])
PyneMoabHex8Dataset(pyne_mesh[, ...])


RAMSESDomainFile(ds, domain_id)
RAMSESDomainSubset(base_region, domain, ds)
RAMSESIndex(ds[, dataset_type])
RAMSESDataset(filename[, dataset_type, ...])
RAMSESFieldInfo(ds, field_list[, slice_info])

SPH and Particle Codes

GadgetBinaryFile(ds, io, filename, file_id)
GadgetHDF5Dataset(filename[, dataset_type, ...])
GadgetDataset(filename[, dataset_type, ...])
HTTPParticleFile(ds, io, filename, file_id)
HTTPStreamDataset(base_url[, dataset_type, ...])
OWLSDataset(filename[, dataset_type, ...])
ParticleDataset(filename[, dataset_type, ...])
TipsyFile(ds, io, filename, file_id)
TipsyDataset(filename[, dataset_type, ...])
SPHFieldInfo(ds, field_list[, slice_info])
IOHandlerGadgetBinary(ds, *args, **kwargs)
IOHandlerTipsyBinary(*args, **kwargs)


StreamGrid(id, index) Class representing a single In-memory Grid instance.
StreamHandler(left_edges, right_edges, ...)
StreamHexahedralHierarchy(ds[, dataset_type])
StreamHexahedralMesh(mesh_id, filename, ...)
StreamHexahedralDataset(stream_handler[, ...])
StreamHierarchy(ds[, dataset_type])
StreamOctreeHandler(ds[, dataset_type])
StreamOctreeDataset(stream_handler[, ...])
StreamOctreeSubset(base_region, ds, oct_handler)
StreamParticleFile(ds, io, filename, file_id)
StreamParticleIndex(ds[, dataset_type])
StreamParticlesDataset(stream_handler[, ...])
StreamDataset(stream_handler[, ...])
StreamFieldInfo(ds, field_list[, slice_info])


YTDataContainerDataset(filename[, ...]) Dataset for saved geometric data containers.
YTSpatialPlotDataset(*args, **kwargs) Dataset for saved slices and projections.
YTGridDataset(filename[, unit_system]) Dataset for saved covering grids, arbitrary grids, and FRBs.
YTGridHierarchy(ds[, dataset_type])
YTGrid(gid, index[, filename])
YTNonspatialDataset(filename[, unit_system]) Dataset for general array data.
YTNonspatialHierarchy(ds[, dataset_type])
YTNonspatialGrid(gid, index[, filename])
YTProfileDataset(filename[, unit_system]) Dataset for saved profile objects.
YTDataContainerFieldInfo(ds, field_list)
YTGridFieldInfo(ds, field_list[, slice_info])

Loading Data

load(*args, **kwargs) This function attempts to determine the base data type of a filename or other set of arguments by calling yt.data_objects.api.Dataset._is_valid() until it finds a match, at which point it returns an instance of the appropriate yt.data_objects.api.Dataset subclass.
simulation(parameter_filename, simulation_type) Loads a simulation time series object of the specified simulation type.
load_uniform_grid(data, domain_dimensions[, ...]) Load a uniform grid of data into yt as a StreamHandler.
load_amr_grids(grid_data, domain_dimensions) Load a set of grids of data into yt as a StreamHandler.
load_particles(data[, length_unit, bbox, ...]) Load a set of particles into yt as a StreamParticleHandler.
load_hexahedral_mesh(data, connectivity, ...) Load a hexahedral mesh of data into yt as a StreamHandler.
load_unstructured_mesh(connectivity, coordinates) Load an unstructured mesh of data into yt as a StreamHandler.

Derived Datatypes

Profiles and Histograms

These types are used to sum data up and either return that sum or return an average. Typically they are more easily used through the ProfilePlot PhasePlot interface. We also provide the create_profile function to create these objects in a uniform manner.

ProfileND(data_source[, weight_field]) The profile object class
Profile1D(data_source, x_field, x_n, x_min, ...) An object that represents a 1D profile.
Profile2D(data_source, x_field, x_n, x_min, ...) An object that represents a 2D profile.
Profile3D(data_source, x_field, x_n, x_min, ...) An object that represents a 2D profile.
ParticleProfile(data_source, x_field, x_n, ...) An object that represents a deposited 2D profile.
create_profile(data_source, bin_fields, fields) Create a 1, 2, or 3D profile object.

Halo Analysis

The HaloCatalog object is the primary means for performing custom analysis on cosmological halos. It is also the primary interface for halo finding.

HaloCatalog([halos_ds, data_ds, ...]) Create a HaloCatalog: an object that allows for the creation and association of data with a set of halo objects.
HaloFindingMethod(function[, args, kwargs]) A halo finding method is a callback that performs halo finding on a dataset and returns a new dataset that is the loaded halo finder output.
HaloCallback(function[, args, kwargs]) A HaloCallback is a function that minimally takes in a Halo object and performs some analysis on it.
delete_attribute(halo, attribute) Delete attribute from halo object.
halo_sphere(halo[, radius_field, factor, ...]) Create a sphere data container to associate with a halo.
iterative_center_of_mass(halo[, ...]) Adjust halo position by iteratively recalculating the center of mass while decreasing the radius.
load_profiles(halo[, storage, fields, ...]) Load profile data from disk.
phase_plot(halo[, output_dir, phase_args, ...]) Make a phase plot for the halo object.
profile(halo, bin_fields, profile_fields[, ...]) Create 1, 2, or 3D profiles of a halo.
save_profiles(halo[, storage, filename, ...]) Save profile data to disk.
sphere_bulk_velocity(halo) Set the bulk velocity for the sphere.
sphere_field_max_recenter(halo, field) Recenter the halo sphere on the location of the maximum of the given field.
virial_quantities(halo, fields[, ...]) Calculate the value of the given fields at the virial radius defined at the given critical density by interpolating from radial profiles.
HaloFilter(function, *args, **kwargs) A HaloFilter is a function that minimally takes a Halo object, performs some analysis, and returns either True or False.
not_subhalo(halo[, field_type]) Only return true if this halo is not a subhalo.
quantity_value(halo, field, operator, value, ...) Filter based on a value in the halo quantities dictionary.
HaloQuantity(function, *args, **kwargs) A HaloQuantity is a function that takes minimally a Halo object, performs some analysis, and then returns a value that is assigned to an entry in the Halo.quantities dictionary.
HaloRecipe(function[, args, kwargs]) A HaloRecipe is a function that minimally takes in a Halo object and performs some analysis on it.
calculate_virial_quantities(hc, fields[, ...]) Calculate virial quantities with the following procedure: 1.

Halo Finding

These provide direct access to the halo finders. However, it is strongly recommended to use the HaloCatalog.

FOFHaloFinder(ds[, subvolume, link, ...]) Friends-of-friends halo finder.
HOPHaloFinder(ds[, subvolume, threshold, ...]) HOP halo finder.
RockstarHaloFinder(ts[, num_readers, ...]) Spawns the Rockstar Halo finder, distributes dark matter particles and finds halos.

Two Point Functions

These functions are designed to create correlations or other results of operations acting on two spatially-distinct points in a data source. See also Two Point Functions.

TwoPointFunctions(ds, fields[, left_edge, ...]) Initialize a two point functions object.
FcnSet(tpf, function, min_edge, out_labels, ...)

Field Types

FieldInfoContainer(ds, field_list[, slice_info]) This is a generic field container.
DerivedField(name, function[, units, ...]) This is the base class used to describe a cell-by-cell derived field.
ValidateParameter(parameters[, parameter_values])
ValidateSpatial([ghost_zones, fields])

Field Functions

add_field(name[, function]) Add a new field, along with supplemental metadata, to the list of available fields.
add_field(name[, function]) Dataset-specific call to add_field

Particle Filters

add_particle_filter(name, function[, ...]) Create a new particle filter in the global namespace of filters
particle_filter([name, requires, filtered_type]) A decorator that adds a new particle filter

Image Handling

For volume renderings and fixed resolution buffers the image object returned is an ImageArray object, which has useful functions for image saving and writing to bitmaps.

ImageArray A custom Numpy ndarray used for images.

Extension Types

Cosmology, Star Particle Analysis, and Simulated Observations

For the generation of stellar SEDs. (See also Star Particle Analysis.)

StarFormationRate(ds[, data_source, ...]) Calculates the star formation rate for a given population of star particles.
SpectrumBuilder(ds[, bcdir, model, ...]) Initialize the data to build a summed flux spectrum for a collection of stars using the models of Bruzual & Charlot (2003).

Light cone generation and simulation analysis. (See also Light Cone Generator.)

LightCone(parameter_filename, ...[, ...]) Initialize a LightCone object.
LightRay(parameter_filename[, ...]) A 1D object representing the path of a light ray passing through a simulation.

Absorption and X-ray spectra and spectral lines:

AbsorptionSpectrum(lambda_min, lambda_max, ...) Create an absorption spectrum object.
EmissivityIntegrator([filename]) Class for making X-ray emissivity fields with hdf5 data tables from Cloudy.
add_xray_emissivity_field(ds, e_min, e_max) Create X-ray emissivity fields for a given energy range.

Absorption spectra fitting:

generate_total_fit(x, fluxData, orderFits, ...) This function is designed to fit an absorption spectrum by breaking the spectrum up into absorption complexes, and iteratively adding and optimizing voigt profiles to each complex.

Sunrise exporting:

export_to_sunrise(ds, fn, ...[, ...]) Convert the contents of a dataset to a FITS file format that Sunrise understands.
export_to_sunrise_from_halolist(ds, fni, ...) Using the center of mass and the virial radius for a halo, calculate the regions to extract for sunrise.

RADMC-3D exporting:

RadMC3DLayer(level, parent, unique_id, LE, ...) This class represents an AMR “layer” of the style described in the radmc3d manual.
RadMC3DWriter(ds[, max_level]) This class provides a mechanism for writing out data files in a format readable by radmc3d.

Volume Rendering

See also 3D Visualization and Volume Rendering.

Here are the primary entry points and the main classes involved in the Scene infrastructure:

volume_render(data_source[, field, fname, ...]) Create a simple volume rendering of a data source.
create_scene(data_source[, field, lens_type]) Set up a scene object with sensible defaults for use in volume rendering.
off_axis_projection(data_source, center, ...) Project through a dataset, off-axis, and return the image plane.
Scene() A virtual landscape for a volume rendering.
Camera(scene[, data_source, lens_type, auto]) A representation of a point of view into a Scene.
AMRKDTree(ds[, min_level, max_level, ...]) A KDTree for AMR data.

The different kinds of sources:

RenderSource() Base Class for Render Sources.
VolumeSource(data_source, field) A class for rendering data from a volumetric data source
PointSource(positions[, colors, color_stride]) A rendering source of opaque points in the scene.
LineSource(positions[, colors, color_stride]) A render source for a sequence of opaque line segments.
BoxSource(left_edge, right_edge[, color]) A render source for a box drawn with line segments.
GridSource(data_source[, alpha, cmap, ...]) A render source for drawing grids in a scene.
CoordinateVectorSource([colors, alpha]) Draw coordinate vectors on the scene.
MeshSource(data_source, field) A source for unstructured mesh data.

The different kinds of transfer functions:

TransferFunction(x_bounds[, nbins]) A transfer function governs the transmission of emission and absorption through a volume.
ColorTransferFunction(x_bounds[, nbins, ...]) A complete set of transfer functions for standard color-mapping.
ProjectionTransferFunction([x_bounds, n_fields]) A transfer function that defines a simple projection.
PlanckTransferFunction(T_bounds, rho_bounds) This sets up a planck function for multivariate emission and absorption.
MultiVariateTransferFunction([grey_opacity]) This object constructs a set of field tables that allow for multiple field variables to control the integration through a volume.
TransferFunctionHelper(ds) A transfer function helper.

The different kinds of lenses:

Lens() A Lens is used to define the set of rays for rendering.
PlaneParallelLens() The lens for orthographic projections.
PerspectiveLens() A lens for viewing a scene with a set of rays within an opening angle.
StereoPerspectiveLens() A lens that includes two sources for perspective rays, for 3D viewing
FisheyeLens() A lens for dome-based renderings
SphericalLens() A lens for cylindrical-spherical projection.
StereoSphericalLens() A lens for a stereo cylindrical-spherical projection.


See also Streamlines: Tracking the Trajectories of Tracers in your Data.

Streamlines(ds, positions[, xfield, yfield, ...]) A collection of streamlines that flow through the volume

Image Writing

These functions are all used for fast writing of images directly to disk, without calling matplotlib. This can be very useful for high-cadence outputs where colorbars are unnecessary or for volume rendering.

multi_image_composite(fn, red_channel, ...) Write an image with different color channels corresponding to different quantities.
write_bitmap(bitmap_array, filename[, ...]) Write out a bitmapped image directly to a PNG file.
write_projection(data, filename[, colorbar, ...]) Write a projection or volume rendering to disk with a variety of pretty parameters such as limits, title, colorbar, etc.
write_image(image, filename[, color_bounds, ...]) Write out a floating point array directly to a PNG file, scaling it and applying a colormap.
map_to_colors(buff, cmap_name)
strip_colormap_data([fn, cmaps])
splat_points(image, points_x, points_y[, ...])
scale_image(image[, mi, ma]) Scale an image ([NxNxM] where M = 1-4) to be uint8 and values scaled from [0,255].

We also provide a module that is very good for generating EPS figures, particularly with complicated layouts.

single_plot(plot[, field, figsize, ...]) Wrapper for DualEPS routines to create a figure directy from a yt plot.
multiplot(ncol, nrow[, yt_plots, fields, ...]) Convenience routine to create a multi-panel figure from yt plots or JPEGs.
multiplot_yt(ncol, nrow, plots[, fields]) Wrapper for multiplot that takes a yt PlotWindow
return_cmap([cmap, label, range, log]) Returns a dict that describes a colorbar.

Derived Quantities

See Processing Objects: Derived Quantities.

WeightedAverageQuantity(data_source) Calculates the weight average of a field or fields.
AngularMomentumVector(data_source) Calculates the angular momentum vector, using gas and/or particles.
BulkVelocity(data_source) Calculates the bulk velocity, using gas and/or particles.
CenterOfMass(data_source) Calculates the center of mass, using gas and/or particles.
Extrema(data_source) Calculates the min and max value of a field or list of fields.
MaxLocation(data_source) Calculates the maximum value plus the x, y, and z position of the maximum.
MinLocation(data_source) Calculates the minimum value plus the x, y, and z position of the minimum.
SpinParameter(data_source) Calculates the dimensionless spin parameter.
TotalMass(data_source) Calculates the total mass of the object.
TotalQuantity(data_source) Calculates the sum of the field or fields.
WeightedAverageQuantity(data_source) Calculates the weight average of a field or fields.
WeightedVariance(data_source) Calculates the weighted variance and weighted mean for a field or list of fields.

Callback List

See also Plot Modifications: Overplotting Contours, Velocities, Particles, and More.

annotate_clear([index]) Clear callbacks from the plot.
ArrowCallback(pos[, code_size, length, ...]) annotate_arrow(pos, length=0.03, width=0.003, head_length=None,
CellEdgesCallback([line_width, alpha, color]) annotate_cell_edges(line_width=0.002, alpha = 1.0, color = ‘black’)
ClumpContourCallback(clumps[, plot_args]) annotate_clumps(clumps, plot_args=None)
ContourCallback(field[, ncont, factor, ...]) annotate_contour(field, ncont=5, factor=4, take_log=None, clim=None,
CuttingQuiverCallback(field_x, field_y[, ...]) annotate_cquiver(field_x, field_y, factor)
GridBoundaryCallback([alpha, min_pix, ...]) annotate_grids(alpha=0.7, min_pix=1, min_pix_ids=20, draw_ids=False,
HaloCatalogCallback(halo_catalog[, ...]) annotate_halos(halo_catalog, circle_args=None,
ImageLineCallback(p1, p2[, data_coords, ...]) annotate_image_line(p1, p2, coord_system=”axis”, plot_args=None):
LinePlotCallback(p1, p2[, data_coords, ...]) annotate_line(p1, p2, coord_system=”data”, plot_args=None):
MagFieldCallback([factor, scale, ...]) annotate_magnetic_field(factor=16, scale=None, scale_units=None, normalize=False):
MarkerAnnotateCallback(pos[, marker, ...]) annotate_marker(pos, marker=’x’, coord_system=”data”, plot_args=None):
ParticleCallback(width[, p_size, col, ...]) annotate_particles(width, p_size=1.0, col=’k’, marker=’o’, stride=1.0,
PointAnnotateCallback(pos, text[, ...]) annotate_point(pos, text, coord_system=’data’, text_args=None,
QuiverCallback(field_x, field_y[, factor, ...]) annotate_quiver(field_x, field_y, factor=16, scale=None, scale_units=None,
RayCallback(ray[, arrow, plot_args]) annotate_ray(ray, plot_args=None)
ScaleCallback([corner, coeff, unit, pos, ...]) annotate_scale(corner=’lower_right’, coeff=None, unit=None, pos=None,
SphereCallback(center, radius[, ...]) annotate_sphere(center, radius, circle_args=None,
StreamlineCallback(field_x, field_y[, ...]) annotate_streamlines(field_x, field_y, factor=16,
TextLabelCallback(pos, text[, data_coords, ...]) annotate_text(pos, text, coord_system=’data’, text_args=None,
TimestampCallback([x_pos, y_pos, corner, ...]) annotate_timestamp(x_pos=None, y_pos=None, corner=’lower_left’, time=True,
TitleCallback(title) annotate_title(title)
TriangleFacetsCallback(triangle_vertices[, ...]) annotate_triangle_facets(triangle_vertices, plot_args=None )
VelocityCallback([factor, scale, ...]) annotate_velocity(factor=16, scale=None, scale_units=None, normalize=False):

Colormap Functions

See also Colormaps.

add_cmap(name, cdict) Adds a colormap to the colormaps available in yt for this session
make_colormap(ctuple_list[, name, interpolate]) This generates a custom colormap based on the colors and spacings you provide.
show_colormaps([subset, filename]) Displays the colormaps available to yt.

Function List

load(*args, **kwargs) This function attempts to determine the base data type of a filename or other set of arguments by calling yt.data_objects.api.Dataset._is_valid() until it finds a match, at which point it returns an instance of the appropriate yt.data_objects.api.Dataset subclass.
save_as_dataset(ds, filename, data[, ...]) Export a set of field arrays to a reloadable yt dataset.
all_data([find_max]) all_data is a wrapper to the Region object for creating a region
box(left_edge, right_edge, **kwargs) box is a wrapper to the Region object for creating a region
ensure_list(obj) This function ensures that obj is a list.
enable_plugins() Forces the plugins file to be parsed.
get_pbar(title, maxval[, parallel]) This returns a progressbar of the most appropriate type, given a title and a maxval.
humanize_time(secs) Takes secs and returns a nicely formatted string
insert_ipython([num_up]) Placed inside a function, this will insert an IPython interpreter at that current location.
is_root() This function returns True if it is on the root processor of the topcomm and False otherwise.
iterable(obj) Grabbed from Python Cookbook / matploblib.cbook.
only_on_root(func, *args, **kwargs) This function accepts a func, a set of args and kwargs and then only on the root processor calls the function.
paste_traceback(exc_type, exc, tb) This is a traceback handler that knows how to paste to the pastebin.
pdb_run(func) This decorator inserts a pdb session on top of the call-stack into a function.
print_tb(func) This function is used as a decorate on a function to have the calling stack printed whenever that function is entered.
rootonly(func) This is a decorator that, when used, will only call the function on the root processor and then broadcast the results of the function to all other processors.
time_execution(func) Decorator for seeing how long a given function takes, depending on whether or not the global ‘yt.timefunctions’ config parameter is set.
identify_contours(data_source, field, ...[, ...])
enable_parallelism([suppress_logging, ...]) This method is used inside a script to turn on MPI parallelism, via mpi4py.
parallel_blocking_call(func) This decorator blocks on entry and exit of a function.
parallel_objects(objects[, njobs, storage, ...]) This function dispatches components of an iterable to different processors.
parallel_passthrough(func) If we are not run in parallel, this function passes the input back as output; otherwise, the function gets called.
parallel_root_only(func) This decorator blocks and calls the function on the root processor, but does not broadcast results to the other processors.
parallel_simple_proxy(func) This is a decorator that broadcasts the result of computation on a single processor to all other processors.
get_field_parameter(name[, default]) This is typically only used by derived field functions, but it returns parameters used to generate fields.
set_field_parameter(name, val) Here we set up dictionaries that get passed up and down and ultimately to derived fields.

Math Utilities

periodic_position(pos, ds) Assuming periodicity, find the periodic position within the domain.
periodic_dist(a, b, period[, periodicity]) Find the Euclidean periodic distance between two sets of points.
euclidean_dist(a, b) Find the Euclidean distance between two points.
rotate_vector_3D(a, dim, angle) Rotates the elements of an array around an axis by some angle.
modify_reference_frame(CoM, L[, P, V]) Rotates and translates data into a new reference frame to make calculations easier.
compute_rotational_velocity(CoM, L, P, V) Computes the rotational velocity for some data around an axis.
compute_parallel_velocity(CoM, L, P, V) Computes the parallel velocity for some data around an axis.
compute_radial_velocity(CoM, L, P, V) Computes the radial velocity for some data around an axis.
compute_cylindrical_radius(CoM, L, P, V) Compute the radius for some data around an axis in cylindrical coordinates.
ortho_find(vec1) Find two complementary orthonormal vectors to a given vector.
quartiles(a[, axis, out, overwrite_input]) Compute the quartile values (25% and 75%) along the specified axis in the same way that the numpy.median calculates the median (50%) value alone a specified axis.
get_rotation_matrix(theta, rot_vector) Given an angle theta and a 3D vector rot_vector, this routine computes the rotation matrix corresponding to rotating theta radians about rot_vector.
resize_vector(vector, vector_array)
get_sph_theta(coords, normal)
get_sph_phi(coords, normal)
get_cyl_r(coords, normal)
get_cyl_z(coords, normal)
get_cyl_theta(coords, normal)
get_cyl_r_component(vectors, theta, normal)
get_cyl_theta_component(vectors, theta, normal)
get_cyl_z_component(vectors, normal)
get_sph_r_component(vectors, theta, phi, normal)
get_sph_phi_component(vectors, phi, normal)
get_sph_theta_component(vectors, theta, phi, ...)

Miscellaneous Types

YTConfigParser([defaults, dict_type, ...])
ParameterFileStore([in_memory]) This class is designed to be a semi-persistent storage for parameter files.
ObjectIterator(pobj[, just_list, attr]) This is a generalized class that accepts a list of objects and then attempts to intelligently iterate over them.
ParallelObjectIterator(pobj[, just_list, ...]) This takes an object, pobj, that implements ParallelAnalysisInterface, and then does its thing, calling initliaze and finalize on the object.

Cosmology Calculator

Cosmology([hubble_constant, omega_matter, ...]) Create a cosmology calculator to compute cosmological distances and times.
hubble_distance() The distance corresponding to c / h, where c is the speed of light and h is the Hubble parameter in units of 1 / time.
comoving_radial_distance(z_i, z_f) The comoving distance along the line of sight to on object at redshift, z_f, viewed at a redshift, z_i.
comoving_transverse_distance(z_i, z_f) When multiplied by some angle, the distance between two objects observed at redshift, z_f, with an angular separation given by that angle, viewed by an observer at redshift, z_i (Hogg 1999).
comoving_volume(z_i, z_f) “The comoving volume is the volume measure in which number densities
angular_diameter_distance(z_i, z_f) Following Hogg (1999), the angular diameter distance is ‘the ratio of
angular_scale(z_i, z_f) The proper transverse distance between two points at redshift z_f observed at redshift z_i per unit of angular separation.
luminosity_distance(z_i, z_f) The distance that would be inferred from the inverse-square law of light and the measured flux and luminosity of the observed object.
lookback_time(z_i, z_f) The difference in the age of the Universe between the redshift interval z_i to z_f.
hubble_time(z[, z_inf]) The age of the Universe at a given redshift.
critical_density(z) The density required for closure of the Universe at a given redshift in the proper frame.
hubble_parameter(z) The value of the Hubble parameter at a given redshift.
expansion_factor(z) The ratio between the Hubble parameter at a given redshift and redshift zero.
z_from_t(my_time) Compute the redshift from time after the big bang.
t_from_z(z) Compute the age of the Universe from redshift.

Testing Infrastructure

The first set of functions are all provided by NumPy.

assert_array_equal(x, y[, err_msg, verbose]) Raises an AssertionError if two array_like objects are not equal.
assert_almost_equal(actual, desired[, ...]) Raises an AssertionError if two items are not equal up to desired precision.
assert_approx_equal(actual, desired[, ...]) Raises an AssertionError if two items are not equal up to significant digits.
assert_array_almost_equal(x, y[, decimal, ...]) Raises an AssertionError if two objects are not equal up to desired precision.
assert_equal(actual, desired[, err_msg, verbose]) Raises an AssertionError if two objects are not equal.
assert_array_less(x, y[, err_msg, verbose]) Raises an AssertionError if two array_like objects are not ordered by less than.
assert_string_equal(actual, desired) Test if two strings are equal.
assert_array_almost_equal_nulp(x, y[, nulp]) Compare two arrays relatively to their spacing.
assert_allclose(actual, desired[, rtol, ...]) Raises an AssertionError if two objects are not equal up to desired tolerance.
assert_raises(exception_class, callable, ...) Fail unless an exception of class exception_class is thrown by callable when invoked with arguments args and keyword arguments kwargs.

These are yt-provided functions:

assert_rel_equal(a1, a2, decimals[, ...])
amrspace(extent[, levels, cells]) Creates two numpy arrays representing the left and right bounds of an AMR grid as well as an array for the AMR level of each cell.
fake_random_ds(ndims[, peak_value, fields, ...])
expand_keywords(keywords[, full]) expand_keywords is a means for testing all possible keyword