# 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. This object is a subclass of yt.visualization.fixed_resolution.FixedResolutionBuffer that supports non-aligned input data objects, primarily cutting planes. This object is a subclass of yt.visualization.fixed_resolution.FixedResolutionBuffer that supports off axis projections.

### Writing FITS images¶

 FITSImageData(data[, fields, units, width, wcs]) FITSSlice(ds, axis, fields[, center, width, …]) Generate a FITSImageData of an on-axis slice. FITSProjection(ds, axis, fields[, center, …]) 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.

## 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(*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, …) 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¶

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 define_unit(symbol, value[, tex_repr, …]) Define a new unit and add it to the default unit registry. Unit([unit_expr, base_value, base_offset, …]) A symbolic unit, using sympy functionality. UnitRegistry([add_default_symbols, lut]) A registry for unit symbols UnitSystem(name, length_unit, mass_unit, …) Create a UnitSystem for facilitating conversions to a default set of units. YTArray(input_array[, input_units, …]) An ndarray subclass that attaches a symbolic unit object to the array data. YTQuantity(input_scalar[, input_units, …]) A scalar associated with a unit. uconcatenate(arrs[, axis]) Concatenate a sequence of arrays. uintersect1d(arr1, arr2[, assume_unique]) Find the sorted unique elements of the two input arrays. uunion1d(arr1, arr2) Find the union of two arrays. unorm(data[, ord, axis, keepdims]) Matrix or vector norm that preserves units udot(op1, op2) Matrix or vector dot product that preserves units uvstack(arrs) Stack arrays in sequence vertically (row wise) while preserving units uhstack(arrs) Stack arrays in sequence horizontally (column wise) while preserving units ustack(arrs[, axis]) Join a sequence of arrays along a new axis while preserving units Display a YTArray in a Jupyter widget that enables unit switching.

## 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]) 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]) ARTIOFieldInfo(ds, field_list[, slice_info])

### Athena¶

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

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

### FLASH¶

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

### GDF¶

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

### Halo Catalogs¶

 AHFHalosDataset([filename]) AHFHalosFieldInfo(ds, field_list[, slice_info]) GadgetFOFDataset([filename]) GadgetFOFHDF5File(ds, io, filename, file_id) GadgetFOFHaloDataset([filename]) GadgetFOFFieldInfo(ds, field_list[, slice_info]) GadgetFOFHaloFieldInfo(ds, field_list[, …]) HaloCatalogHDF5File(ds, io, filename, file_id) HaloCatalogDataset([filename]) HaloCatalogFieldInfo(ds, field_list[, …]) OWLSSubfindParticleIndex(ds, dataset_type) OWLSSubfindHDF5File(ds, io, filename, file_id) OWLSSubfindDataset([filename]) OWLSSubfindFieldInfo(ds, field_list[, …]) RockstarBinaryFile(ds, io, filename, file_id) 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])

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

### 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) TipsyDataset([filename]) SPHFieldInfo(ds, field_list[, slice_info]) IOHandlerGadgetBinary(ds, *args, **kwargs) 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])

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

 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.static_output.Dataset._is_valid() until it finds a match, at which point it returns an instance of the appropriate yt.data_objects.static_output.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_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.

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

### 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. 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. bulk_velocity(halo) center_of_mass(halo) 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, sampling_type, function) This is the base class used to describe a cell-by-cell derived field. ValidateDataField(field) ValidateParameter(parameters[, parameter_values]) ValidateSpatial([ghost_zones, fields])

## Field Functions¶

 add_field(name, sampling_type[, function]) 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

## 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[, input_units, …]) A custom Numpy ndarray used for images.

## Extension Types¶

### Cosmology, Star Particle Analysis, and Simulated Observations¶

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

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

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.

 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¶

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. 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:

 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. A transfer function helper.

The different kinds of lenses:

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

### Streamlining¶

 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.

## 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) Calculates the weighted variance and weighted mean for a field or list of fields.

## Callback List¶

 annotate_clear([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¶

 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¶

 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.static_output.Dataset._is_valid() until it finds a match, at which point it returns an instance of the appropriate yt.data_objects.static_output.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 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. deprecate(replacement) This function ensures that obj is a list. 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. This function returns True if it is on the root processor of the topcomm and False otherwise. iterable(obj) Grabbed from Python Cookbook / matplotlib.cbook. 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.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. 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. If we are not run in parallel, this function passes the input back as output; otherwise, the function gets called. This decorator blocks and calls the function on the root processor, but does not broadcast results to the other processors. 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¶

 YTConfigParser([defaults, dict_type, …]) 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. 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. 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. hubble_time(z[, z_inf]) The inverse of the Hubble parameter. The density required for closure of the Universe at a given redshift in the proper frame. The value of the Hubble parameter at a given redshift. The ratio between the Hubble parameter at a given redshift and redshift zero. Compute the redshift for a given age of the Universe. Compute the age of the Universe for a given redshift. 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:

 answer_file(request) Assigns the name of the appropriate answer file as an attribute of the calling answer test class. hashing(request) Handles initialization, generation, and saving of answer test result hashes. grid_values(ds, field) projection_values(ds, axis, field, …) field_values(ds, field[, obj_type, …]) pixelized_projection_values(ds, axis, field) simulated_halo_mass_function(ds, finder) 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) This test is typically used once per geometry or coordinates type. light_cone_projection(parameter_file, …) extract_connected_sets(ds_fn, data_source, …)