yt.analysis_modules.cosmological_observation.light_ray.light_ray.LightRay.make_light_ray

LightRay.make_light_ray(seed=None, start_position=None, end_position=None, trajectory=None, fields=None, setup_function=None, solution_filename=None, data_filename=None, get_los_velocity=True, redshift=None, njobs=-1)[source]

Create a light ray and get field values for each lixel. A light ray consists of a list of field values for cells intersected by the ray and the path length of the ray through those cells. Light ray data can be written out to an hdf5 file.

Parameters:

seed : optional, int

Seed for the random number generator. Default: None.

start_position : optional, list of floats

Used only if creating a light ray from a single dataset. The coordinates of the starting position of the ray. Default: None.

end_position : optional, list of floats

Used only if creating a light ray from a single dataset. The coordinates of the ending position of the ray. Default: None.

trajectory : optional, list of floats

Used only if creating a light ray from a single dataset. The (r, theta, phi) direction of the light ray. Use either end_position or trajectory, not both. Default: None.

fields : optional, list

A list of fields for which to get data. Default: None.

setup_function : optional, callable, accepts a ds

This function will be called on each dataset that is loaded to create the light ray. For, example, this can be used to add new derived fields. Default: None.

solution_filename : optional, string

Path to a text file where the trajectories of each subray is written out. Default: None.

data_filename : optional, string

Path to output file for ray data. Default: None.

get_los_velocity : optional, bool

If True, the line of sight velocity is calculated for each point in the ray. Default: True.

redshift : optional, float

Used with light rays made from single datasets to specify a starting redshift for the ray. If not used, the starting redshift will be 0 for a non-cosmological dataset and the dataset redshift for a cosmological dataset. Default: None.

njobs : optional, int

The number of parallel jobs over which the segments will be split. Choose -1 for one processor per segment. Default: -1.

Examples

Make a light ray from multiple datasets:

>>> import yt
>>> from yt.analysis_modules.cosmological_observation.light_ray.api import         ...     LightRay
>>> my_ray = LightRay("enzo_tiny_cosmology/32Mpc_32.enzo", "Enzo",
...                   0., 0.1, time_data=False)
...
>>> my_ray.make_light_ray(seed=12345,
...                       solution_filename="solution.txt",
...                       data_filename="my_ray.h5",
...                       fields=["temperature", "density"],
...                       get_los_velocity=True)

Make a light ray from a single dataset:

>>> import yt
>>> from yt.analysis_modules.cosmological_observation.light_ray.api import         ...     LightRay
>>> my_ray = LightRay("IsolatedGalaxy/galaxy0030/galaxy0030")
...
>>> my_ray.make_light_ray(start_position=[0., 0., 0.],
...                       end_position=[1., 1., 1.],
...                       solution_filename="solution.txt",
...                       data_filename="my_ray.h5",
...                       fields=["temperature", "density"],
...                       get_los_velocity=True)