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 plotting mechanism based around the concept of a window into a data source.

plot_2d(ds, fields[, center, width, …])

Creates a plot of a 2D dataset

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.

OffAxisProjectionFixedResolutionBuffer(…)

This object is a subclass of yt.visualization.fixed_resolution.FixedResolutionBuffer that supports off axis projections.

Writing FITS images

FITSImageData(data[, fields, length_unit, …])

FITSSlice(ds, axis, fields[, image_res, …])

Generate a FITSImageData of an on-axis slice.

FITSProjection(ds, axis, fields[, …])

Generate a FITSImageData of an on-axis projection.

FITSOffAxisSlice(ds, normal, fields[, …])

Generate a FITSImageData of an off-axis slice.

FITSOffAxisProjection(ds, normal, fields[, …])

Generate a FITSImageData of an off-axis projection.

FITSParticleProjection(ds, axis, fields[, …])

Generate a FITSImageData of an on-axis projection of a particle field.

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])

OctreeSubset(base_region, domain, ds[, …])

ParticleContainer(base_region, …[, …])

UnstructuredMesh(mesh_id, filename, …)

SemiStructuredMesh(mesh_id, filename, …)

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(*args, **kwargs)

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, *args, **kwargs)

The DatasetSeries object is a container of multiple datasets, allowing easy iteration and computation on them.

DatasetSeriesObject(time_series, …)

SimulationTimeSeries(outputs, *args, **kwargs)

TimeSeriesQuantitiesContainer(data_object, …)

AnalysisTaskProxy(time_series)

ParticleTrajectories(outputs, indices[, …])

A collection of particle trajectories in time over a series of datasets.

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.

Units

yt’s symbolic unit handling system is now based on the external library unyt. In complement, Dataset objects support the following methods to build arrays and scalars with physical dimensions.

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

Frontends

AMRVAC

AMRVACGrid(id, index, level)

A class to populate AMRVACHierarchy.grids, setting parent/children relations.

AMRVACHierarchy(ds[, dataset_type])

AMRVACDataset([filename])

AMRVACFieldInfo(ds, field_list[, slice_info])

AMRVACIOHandler(ds)

read_amrvac_namelist(parfiles)

Read one or more parfiles, and return a unified f90nml.Namelist object.

ARTIO

ARTIOIndex(ds[, dataset_type])

ARTIOOctreeSubset(base_region, sfc_start, …)

ARTIORootMeshSubset(base_region, sfc_start, …)

ARTIODataset([filename])

ARTIOconstants()

ARTIOFieldInfo(ds, field_list[, slice_info])

IOHandlerARTIO(ds)

Athena

AthenaGrid(id, index, level, start, …)

AthenaHierarchy(ds[, dataset_type])

AthenaDataset([filename])

AthenaFieldInfo(ds, field_list[, slice_info])

IOHandlerAthena(ds)

AMReX/Boxlib

BoxlibGrid(grid_id, offset[, filename, index])

BoxlibHierarchy(ds[, dataset_type])

BoxlibDataset([filename])

This class is a stripped down class that simply reads and parses filename, without looking at the Boxlib index.

CastroDataset([filename])

MaestroDataset([filename])

NyxHierarchy(ds[, dataset_type])

NyxDataset([filename])

OrionHierarchy(ds[, dataset_type])

OrionDataset([filename])

BoxlibFieldInfo(ds, field_list[, slice_info])

IOHandlerBoxlib(ds, *args, **kwargs)

IOHandlerOrion(ds, *args, **kwargs)

Chombo

ChomboGrid(id, index, level, start, stop)

ChomboHierarchy(ds[, dataset_type])

ChomboDataset([filename])

Orion2Hierarchy(ds[, dataset_type])

Orion2Dataset([filename])

IOHandlerChomboHDF5(ds, *args, **kwargs)

IOHandlerOrion2HDF5(ds, *args, **kwargs)

Enzo

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(*args, **kwargs)

EnzoDataset([filename])

Enzo-specific output, set at a fixed time.

EnzoFieldInfo(ds, field_list)

IOHandlerInMemory(ds[, ghost_zones])

IOHandlerPacked1D(ds)

IOHandlerPacked2D(ds)

IOHandlerPackedHDF5(ds)

IOHandlerPackedHDF5GhostZones(*args, **kwargs)

EnzoCosmology(hubble_constant, omega_matter, …)

EnzoSimulation(outputs, *args, **kwargs)

Initialize an Enzo Simulation object.

FITS

FITSGrid(id, index, level)

FITSHierarchy(ds[, dataset_type])

FITSDataset([filename])

FITSFieldInfo(ds, field_list[, slice_info])

IOHandlerFITS(ds)

FLASH

FLASHGrid(id, index, level)

FLASHHierarchy(ds[, dataset_type])

FLASHDataset([filename])

FLASHFieldInfo(ds, field_list[, slice_info])

IOHandlerFLASH(ds)

GDF

GDFGrid(id, index, level, start, dimensions)

GDFHierarchy(ds[, dataset_type])

GDFDataset([filename])

IOHandlerGDFHDF5(ds)

Halo Catalogs

AHFHalosDataset([filename])

AHFHalosFieldInfo(ds, field_list[, slice_info])

IOHandlerAHFHalos(ds)

GadgetFOFDataset([filename])

GadgetFOFHDF5File(ds, io, filename, file_id, …)

GadgetFOFHaloDataset([filename])

IOHandlerGadgetFOFHDF5(ds)

IOHandlerGadgetFOFHaloHDF5(ds)

GadgetFOFFieldInfo(ds, field_list[, slice_info])

GadgetFOFHaloFieldInfo(ds, field_list[, …])

YTHaloCatalogFile(ds, io, filename, file_id, …)

Data file class for the YTHaloCatalogDataset.

YTHaloCatalogDataset([filename])

Dataset class for halo catalogs made with yt.

YTHaloCatalogFieldInfo(ds, field_list[, …])

IOHandlerYTHaloCatalog(ds)

OWLSSubfindParticleIndex(ds, dataset_type)

OWLSSubfindHDF5File(ds, io, filename, …)

OWLSSubfindDataset([filename])

OWLSSubfindFieldInfo(ds, field_list[, …])

IOHandlerOWLSSubfindHDF5(ds)

RockstarBinaryFile(ds, io, filename, …)

RockstarDataset([filename])

RockstarFieldInfo(ds, field_list[, slice_info])

IOHandlerRockstarBinary(*args, **kwargs)

MOAB

MoabHex8Hierarchy(ds[, dataset_type])

MoabHex8Mesh(mesh_id, filename, …)

MoabHex8Dataset([filename])

PyneHex8Mesh(mesh_id, filename, …)

PyneMeshHex8Hierarchy(ds[, dataset_type])

PyneMoabHex8Dataset([filename])

IOHandlerMoabH5MHex8(ds)

IOHandlerMoabPyneHex8(ds)

OpenPMD

OpenPMDGrid(gid, index[, level, fi, fo, pi, …])

Represents chunk of data on-disk.

OpenPMDHierarchy(ds[, dataset_type])

Defines which fields and particles are created and read from disk.

OpenPMDDataset([filename])

Contains all the required information of a single iteration of the simulation.

OpenPMDFieldInfo(ds, field_list)

Specifies which fields from the dataset yt should know about.

IOHandlerOpenPMDHDF5(ds, *args, **kwargs)

parse_unit_dimension(unit_dimension)

Transforms an openPMD unitDimension into a string.

is_const_component(record_component)

Determines whether a group or dataset in the HDF5 file is constant.

get_component(group, component_name[, …])

Grabs a dataset component from a group as a whole or sliced.

RAMSES

RAMSESDomainFile(ds, domain_id)

RAMSESDomainSubset(base_region, domain, ds)

RAMSESIndex(ds[, dataset_type])

RAMSESDataset([filename])

RAMSESFieldInfo(ds, field_list[, slice_info])

IOHandlerRAMSES(ds)

SPH and Particle Codes

GadgetBinaryFile(ds, io, filename, file_id)

GadgetHDF5Dataset([filename])

GadgetDataset([filename])

HTTPParticleFile(ds, io, filename, file_id)

HTTPStreamDataset([filename])

OWLSDataset([filename])

ParticleDataset([filename])

TipsyFile(ds, io, filename, file_id[, range])

TipsyDataset([filename])

SPHFieldInfo(ds, field_list[, slice_info])

IOHandlerGadgetBinary(ds, *args, **kwargs)

IOHandlerGadgetHDF5(ds)

IOHandlerHTTPStream(ds)

IOHandlerOWLS(ds)

IOHandlerTipsyBinary(*args, **kwargs)

Stream

StreamDictFieldHandler

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([filename])

StreamHierarchy(ds[, dataset_type])

StreamOctreeHandler(ds[, dataset_type])

StreamOctreeDataset([filename])

StreamOctreeSubset(base_region, ds, oct_handler)

StreamParticleFile(ds, io, filename, file_id)

StreamParticleIndex(ds[, dataset_type])

StreamParticlesDataset([filename])

StreamDataset([filename])

StreamFieldInfo(ds, field_list[, slice_info])

IOHandlerStream(ds)

IOHandlerStreamHexahedral(ds)

IOHandlerStreamOctree(ds)

StreamParticleIOHandler(ds)

ytdata

YTDataContainerDataset([filename])

Dataset for saved geometric data containers.

YTSpatialPlotDataset([filename])

Dataset for saved slices and projections.

YTGridDataset([filename])

Dataset for saved covering grids, arbitrary grids, and FRBs.

YTGridHierarchy(ds[, dataset_type])

YTGrid(gid, index[, filename])

YTNonspatialDataset([filename])

Dataset for general array data.

YTNonspatialHierarchy(ds[, dataset_type])

YTNonspatialGrid(gid, index[, filename])

YTProfileDataset([filename])

Dataset for saved profile objects.

YTClumpTreeDataset([filename])

Dataset for saved clump-finder data.

YTClumpContainer(clump_id, global_id, …[, ds])

YTDataContainerFieldInfo(ds, field_list)

YTGridFieldInfo(ds, field_list[, slice_info])

IOHandlerYTDataContainerHDF5(ds)

IOHandlerYTGridHDF5(ds)

IOHandlerYTSpatialPlotHDF5(ds)

IOHandlerYTNonspatialhdf5(ds)

Loading Data

load(fn, *args, **kwargs)

Load a Dataset or DatasetSeries object.

simulation(fn, simulation_type[, find_outputs])

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_octree(octree_mask, data[, bbox, …])

Load an octree mask into yt.

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.

load_sample([fn, progressbar, timeout])

Load sample data with yt.

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.

Clump Finding

The Clump object and associated functions can be used for identification of topologically disconnected structures, i.e., clump finding.

Clump(data, field[, parent, clump_info, …])

add_info_item(info_item, *args, **kwargs)

Adds an entry to clump_info list and tells children to do the same.

add_validator(validator, *args, **kwargs)

Add a validating function to determine whether the clump should be kept.

save_as_dataset([filename, fields])

Export clump tree to a reloadable yt dataset.

find_clumps(clump, min_val, max_val, d_clump)

add_clump_info(name, function)

add_validator(name, function)

X-ray Emission Fields

This can be used to create derived fields of X-ray emission in different energy bands.

XrayEmissivityIntegrator(table_type[, …])

Class for making X-ray emissivity fields.

add_xray_emissivity_field(ds, e_min, e_max)

Create X-ray emissivity fields for a given energy range.

Field Types

FieldInfoContainer(ds, field_list[, slice_info])

This is a generic field container.

DerivedField(name, sampling_type, function)

This is the base class used to describe a cell-by-cell derived field.

ValidateDataField(field)

ValidateGridType()

ValidateParameter(parameters[, parameter_values])

ValidateProperty(prop)

ValidateSpatial([ghost_zones, fields])

Field Functions

add_field(name, function, sampling_type, …)

Add a new field, along with supplemental metadata, to the list of available fields.

add_field(name, function, sampling_type, …)

Dataset-specific call to add_field

add_deposited_particle_field(deposit_field, …)

Add a new deposited particle field

add_mesh_sampling_particle_field(sample_field)

Add a new mesh sampling particle field

add_smoothed_particle_field(smooth_field[, …])

Add a new smoothed particle field

add_gradient_fields([fields, input_field])

Add gradient fields.

add_sph_fields([n_neighbors, kernel, sph_ptype])

Add SPH fields for the specified particle type.

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(input_array[, units, registry, …])

A custom Numpy ndarray used for images.

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, …])

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.

Streamlining

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.

DualEPS([figsize])

single_plot(plot[, field, figsize, …])

Wrapper for DualEPS routines to create a figure directly 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])

return_colormap([cmap, label, range, log])

Returns a dict that describes a colorbar.

Derived Quantities

See Processing Objects: Derived Quantities.

DerivedQuantity(data_source)

DerivedQuantityCollection(data_source, …)

WeightedAverageQuantity(data_source)

Calculates the weight average of a field or fields.

AngularMomentumVector(data_source)

Calculates the angular momentum vector, using gas (grid-based) 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)

Callback List

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

annotate_clear([index])

Clear callbacks from the plot.

clear_annotations([index])

Clear callbacks from the plot.

ArrowCallback(pos[, code_size, length, …])

Overplot arrow(s) pointing at position(s) for highlighting specific features.

CellEdgesCallback([line_width, alpha, color])

Annotate cell edges.

ClumpContourCallback(clumps[, plot_args])

Take a list of clumps and plot them as a set of contours.

ContourCallback(field[, ncont, factor, …])

Add contours in field to the plot.

CuttingQuiverCallback(field_x, field_y[, …])

Get a quiver plot on top of a cutting plane, using field_x and field_y, skipping every factor datapoint in the discretization.

GridBoundaryCallback([alpha, min_pix, …])

Draws grids on an existing PlotWindow object.

HaloCatalogCallback(halo_catalog[, …])

Plots circles at the locations of all the halos in a halo catalog with radii corresponding to the virial radius of each halo.

ImageLineCallback(p1, p2[, data_coords, …])

This callback is deprecated, as it is simply a wrapper around the LinePlotCallback (ie annotate_image()).

LinePlotCallback(p1, p2[, data_coords, …])

Overplot a line with endpoints at p1 and p2.

MagFieldCallback([factor, scale, …])

Adds a ‘quiver’ plot of magnetic field to the plot, skipping all but every factor datapoint.

MarkerAnnotateCallback(pos[, marker, …])

Overplot marker(s) at a position(s) for highlighting specific features.

ParticleCallback(width[, p_size, col, …])

Adds particle positions, based on a thick slab along axis with a width along the line of sight.

PointAnnotateCallback(pos, text[, …])

This callback is deprecated, as it is simply a wrapper around the TextLabelCallback (ie annotate_text()).

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.

RayCallback(ray[, arrow, plot_args])

Adds a line representing the projected path of a ray across the plot.

ScaleCallback([corner, coeff, unit, pos, …])

Annotates the scale of the plot at a specified location in the image (either in a preset corner, or by specifying (x,y) image coordinates with the pos argument.

SphereCallback(center, radius[, …])

Overplot a circle with designated center and radius with optional text.

StreamlineCallback(field_x, field_y[, …])

Add streamlines to any plot, using the field_x and field_y from the associated data, skipping every factor datapoints like ‘quiver’.

TextLabelCallback(pos, text[, data_coords, …])

Overplot text on the plot at a specified position.

TimestampCallback([x_pos, y_pos, corner, …])

Annotates the timestamp and/or redshift of the data output at a specified location in the image (either in a present corner, or by specifying (x,y) image coordinates with the x_pos, y_pos arguments.

TitleCallback(title)

Accepts a title and adds it to the plot

TriangleFacetsCallback(triangle_vertices[, …])

Intended for representing a slice of a triangular faceted geometry in a slice plot.

VelocityCallback([factor, scale, …])

Adds a ‘quiver’ plot of velocity to the plot, skipping all but every factor datapoint.

Colormap Functions

See also Colormaps.

add_cmap(name, cdict)

Deprecated alias, kept for backwards compatibility.

add_colormap(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

save_as_dataset(ds, filename, data[, …])

Export a set of field arrays to a reloadable yt dataset.

save_as_dataset([filename, fields])

Export a data object to a reloadable yt dataset.

all_data([find_max])

all_data is a wrapper to the Region object for creating a region which covers the entire simulation domain.

box(left_edge, right_edge, **kwargs)

box is a wrapper to the Region object for creating a region without having to specify a center value.

enable_plugins([plugin_filename])

Forces a plugin file to be parsed.

get_pbar(title, maxval)

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.

is_sequence(obj)

Grabbed from Python Cookbook / matplotlib.cbook.

iter_fields(field_or_fields)

Create an iterator for field names, specified as single strings or tuples(fname, ftype) alike.

just_one(obj)

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.time_functions’ 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.

get_sph_r(coords)

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

YTConfig([defaults])

ParameterFileStore(*p, **k)

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.

ParallelAnalysisInterface([comm])

ParallelObjectIterator(pobj[, just_list, …])

This takes an object, pobj, that implements ParallelAnalysisInterface, and then does its thing, calling initialize 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 of non-evolving objects locked into Hubble flow are constant with redshift.” – Hogg (1999)

angular_diameter_distance(z_i, z_f)

Following Hogg (1999), the angular diameter distance is ‘the ratio of an object’s physical transverse size to its angular size in radians.’

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.

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(t)

Compute the redshift for a given age of the Universe.

t_from_z(z)

Compute the age of the Universe for a given redshift.

get_dark_factor(z)

This function computes the additional term that enters the expansion factor when using non-standard dark energy.

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, …)

assert_raises(exception_class)

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 arguments in the nosetests.

These are for the pytest infrastructure:

hashing(request)

Handles initialization, generation, and saving of answer test result hashes.

grid_hierarchy(ds)

parentage_relationships(ds)

grid_values(ds, field)

projection_values(ds, axis, field, …)

field_values(ds, field[, obj_type, …])

pixelized_projection_values(ds, axis, field)

small_patch_amr(ds, field, weight, axis, ds_obj)

big_patch_amr(ds, field, weight, axis, ds_obj)

generic_array(func[, args, kwargs])

sph_answer(ds, ds_str_repr, ds_nparticles, …)

get_field_size_and_mean(ds, field, geometric)

plot_window_attribute(ds, plot_field, …[, …])

phase_plot_attribute(ds_fn, x_field, …[, …])

generic_image(img_fname)

axial_pixelization(ds)

This test is typically used once per geometry or coordinates type.

extract_connected_sets(ds_fn, data_source, …)

VR_image_comparison(scene)