yt.data_objects.selection_data_containers.YTRayBase

class yt.data_objects.selection_data_containers.YTRayBase(start_point, end_point, ds=None, field_parameters=None, data_source=None)[source]

This is an arbitrarily-aligned ray cast through the entire domain, at a specific coordinate.

This object is typically accessed through the ray object that hangs off of index objects. The resulting arrays have their dimensionality reduced to one, and an ordered list of points at an (x,y) tuple along axis are available, as is the t field, which corresponds to a unitless measurement along the ray from start to end.

Parameters:

start_point : array-like set of 3 floats

The place where the ray starts.

end_point : array-like set of 3 floats

The place where the ray ends.

ds: Dataset, optional :

An optional dataset to use rather than self.ds

field_parameters : dictionary

A dictionary of field parameters than can be accessed by derived fields.

data_source: optional :

Draw the selection from the provided data source rather than all data associated with the data_set

Examples

>>> import yt
>>> ds = yt.load("RedshiftOutput0005")
>>> ray = ds.ray((0.2, 0.74, 0.11), (0.4, 0.91, 0.31))
>>> print ray["Density"], ray["t"], ray["dts"]

Note: The low-level data representation for rays are not guaranteed to be spatially ordered. In particular, with AMR datasets, higher resolution data is tagged on to the end of the ray. If you want this data represented in a spatially ordered manner, manually sort it by the “t” field, which is the value of the parametric variable that goes from 0 at the start of the ray to 1 at the end:

>>> my_ray = ds.ray(...)
>>> ray_sort = np.argsort(my_ray["t"])
>>> density = my_ray["density"][ray_sort]

Attributes

Methods