trident.light_ray.LightRay.make_light_ray
- LightRay.make_light_ray(seed=None, periodic=True, left_edge=None, right_edge=None, min_level=None, start_position=None, end_position=None, trajectory=None, fields=None, setup_function=None, solution_filename=None, data_filename=None, get_los_velocity=None, use_peculiar_velocity=True, redshift=None, field_parameters=None, njobs=- 1)[source]
Actually generate the LightRay by traversing the desired dataset.
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 must be written out to an hdf5 file.
Parameters
- Seed
optional, int
Seed for the random number generator. Default: None.
- Periodic
optional, bool
If True, ray trajectories will make use of periodic boundaries. If False, ray trajectories will not be periodic. Default : True.
- Left_edge
optional, iterable of floats or YTArray
The left corner of the region in which rays are to be generated. If None, the left edge will be that of the domain. If specified without units, it is assumed to be in code units. Default: None.
- Right_edge
optional, iterable of floats or YTArray
The right corner of the region in which rays are to be generated. If None, the right edge will be that of the domain. If specified without units, it is assumed to be in code units. Default: None.
- Min_level
optional, int
The minimum refinement level of the spatial region in which the ray passes. This can be used with zoom-in simulations where the high resolution region does not keep a constant geometry. Default: None.
- Start_position
optional, iterable of floats or YTArray.
Used only if creating a light ray from a single dataset. The coordinates of the starting position of the ray. If specified without units, it is assumed to be in code units. Default: None.
- End_position
optional, iterable of floats or YTArray.
Used only if creating a light ray from a single dataset. The coordinates of the ending position of the ray. If specified without units, it is assumed to be in code units. 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.
- Use_peculiar_velocity
optional, bool
If True, the peculiar velocity along the ray will be sampled for calculating the effective redshift combining the cosmological redshift and the doppler redshift. 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.
- Field_parameters
optional, dict Used to set field parameters in light rays. For example, if the ‘bulk_velocity’ field parameter is set, the relative velocities used to calculate peculiar velocity will be adjusted accordingly. 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 trident 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"], ... use_peculiar_velocity=True)
Make a light ray from a single dataset:
>>> import yt >>> from trident 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"], ... use_peculiar_velocity=True)