# yt.analysis_modules.cosmological_observation.light_cone.light_cone module¶

LightCone class and member functions.

class yt.analysis_modules.cosmological_observation.light_cone.light_cone.LightCone(parameter_filename, simulation_type, near_redshift, far_redshift, observer_redshift=0.0, use_minimum_datasets=True, deltaz_min=0.0, minimum_coherent_box_fraction=0.0, time_data=True, redshift_data=True, find_outputs=False, set_parameters=None, output_dir='LC', output_prefix='LightCone')[source]

Initialize a LightCone object.

Parameters: near_redshift (float) – The near (lowest) redshift for the light cone. far_redshift (float) – The far (highest) redshift for the light cone. observer_redshift (float) – The redshift of the observer. Default: 0.0. use_minimum_datasets (bool) – If True, the minimum number of datasets is used to connect the initial and final redshift. If false, the light cone solution will contain as many entries as possible within the redshift interval. Default: True. deltaz_min (float) – Specifies the minimum $$\Delta z$$ between consecutive datasets in the returned list. Default: 0.0. minimum_coherent_box_fraction (float) – Used with use_minimum_datasets set to False, this parameter specifies the fraction of the total box size to be traversed before rerandomizing the projection axis and center. This was invented to allow light cones with thin slices to sample coherent large scale structure, but in practice does not work so well. Try setting this parameter to 1 and see what happens. Default: 0.0. time_data (bool) – Whether or not to include time outputs when gathering datasets for time series. Default: True. redshift_data (bool) – Whether or not to include redshift outputs when gathering datasets for time series. Default: True. find_outputs (bool) – Whether or not to search for datasets in the current directory. Default: False. set_parameters (dict) – Dictionary of parameters to attach to ds.parameters. Default: None. output_dir (string) – The directory in which images and data files will be written. Default: “LC”. output_prefix (string) – The prefix of all images and data files. Default: “LightCone”.
calculate_light_cone_solution(seed=None, filename=None)[source]

Create list of projections to be added together to make the light cone.

Several sentences providing an extended description. Refer to variables using back-ticks, e.g. var.

Parameters: seed (int) – The seed for the random number generator. Any light cone solution can be reproduced by giving the same random seed. Default: None (each solution will be distinct). filename (string) – If given, a text file detailing the solution will be written out. Default: None.
create_cosmology_splice(near_redshift, far_redshift, minimal=True, max_box_fraction=1.0, deltaz_min=0.0, time_data=True, redshift_data=True)

Create list of datasets capable of spanning a redshift interval.

For cosmological simulations, the physical width of the simulation box corresponds to some Delta z, which varies with redshift. Using this logic, one can stitch together a series of datasets to create a continuous volume or length element from one redshift to another. This method will return such a list

Parameters: near_redshift (float) – The nearest (lowest) redshift in the cosmology splice list. far_redshift (float) – The furthest (highest) redshift in the cosmology splice list. minimal (bool) – If True, the minimum number of datasets is used to connect the initial and final redshift. If false, the list will contain as many entries as possible within the redshift interval. Default: True. max_box_fraction (float) – In terms of the size of the domain, the maximum length a light ray segment can be in order to span the redshift interval from one dataset to another. If using a zoom-in simulation, this parameter can be set to the length of the high resolution region so as to limit ray segments to that size. If the high resolution region is not cubical, the smallest side should be used. Default: 1.0 (the size of the box) deltaz_min (float) – Specifies the minimum delta z between consecutive datasets in the returned list. Default: 0.0. time_data (bool) – Whether or not to include time outputs when gathering datasets for time series. Default: True. redshift_data (bool) – Whether or not to include redshift outputs when gathering datasets for time series. Default: True.

Examples

>>> co = CosmologySplice("enzo_tiny_cosmology/32Mpc_32.enzo", "Enzo")
>>> cosmo = co.create_cosmology_splice(1.0, 0.0)
plan_cosmology_splice(near_redshift, far_redshift, decimals=3, filename=None, start_index=0)

Create imaginary list of redshift outputs to maximally span a redshift interval.

If you want to run a cosmological simulation that will have just enough data outputs to create a cosmology splice, this method will calculate a list of redshifts outputs that will minimally connect a redshift interval.

Parameters: near_redshift (float) – The nearest (lowest) redshift in the cosmology splice list. far_redshift (float) – The furthest (highest) redshift in the cosmology splice list. decimals (int) – The decimal place to which the output redshift will be rounded. If the decimal place in question is nonzero, the redshift will be rounded up to ensure continuity of the splice. Default: 3. filename (string) – If provided, a file will be written with the redshift outputs in the form in which they should be given in the enzo dataset. Default: None. start_index (int) – The index of the first redshift output. Default: 0.

Examples

>>> from yt.analysis_modules.api import CosmologySplice
>>> my_splice = CosmologySplice('enzo_tiny_cosmology/32Mpc_32.enzo', 'Enzo')
>>> my_splice.plan_cosmology_splice(0.0, 0.1, filename='redshifts.out')
project_light_cone(field_of_view, image_resolution, field, weight_field=None, photon_field=False, save_stack=True, save_final_image=True, save_slice_images=False, cmap_name=None, njobs=1, dynamic=False)[source]

Create projections for light cone, then add them together.

Parameters: field_of_view (YTQuantity or tuple of (float, str)) – The field of view of the image and the units. image_resolution (YTQuantity or tuple of (float, str)) – The size of each image pixel and the units. field (string) – The projected field. weight_field (string) – the weight field of the projection. This has the same meaning as in standard projections. Default: None. photon_field (bool) – if True, the projection data for each slice is decremented by 4 Pi R^2`, where R is the luminosity distance between the observer and the slice redshift. Default: False. save_stack (bool) – if True, the light cone data including each individual slice is written to an hdf5 file. Default: True. save_final_image (bool) – if True, save an image of the final light cone projection. Default: True. save_slice_images (bool) – save images for each individual projection slice. Default: False. cmap_name (string) – color map for images. Default: your default colormap. njobs (int) – The number of parallel jobs over which the light cone projection will be split. Choose -1 for one processor per individual projection and 1 to have all processors work together on each projection. Default: 1. dynamic (bool) – If True, use dynamic load balancing to create the projections. Default: False.