"""
The following recipe will make a light cone projection (see :ref:`light-cone-generator`) 
of a single quantity over the redshift interval 0 to 0.4.
"""
import yt.extensions.lightcone as LC

# All of the light cone parameters are given as keyword arguments at instantiation.
lc = LC.LightCone("128Mpc256grid_SFFB.param", initial_redshift=0.4, 
                  final_redshift=0.0, observer_redshift=0.0,
                  field_of_view_in_arcminutes=450.0, 
                  image_resolution_in_arcseconds=60.0,
                  use_minimum_datasets=True, deltaz_min=0.0, 
                  minimum_coherent_box_fraction=0.0,
                  output_dir='LC', output_prefix='LightCone')

# Calculate a light cone solution and write out a text file with the details 
# of the solution.
lc.calculate_light_cone_solution(seed=123456789, filename='lightcone.dat')

# This will be the field to be projected.
field = 'SZY'

# Make the light cone projection, save individual images of each slice 
# and of the projection as well as an hdf5 file with the full data cube.
# Add a label of the slice redshift to each individual image.
# The return value is the PlotCollection that holds the image data for 
# the final projection, allowing for additional customization of the 
# final image.
pc = lc.project_light_cone(field ,save_stack=True, save_slice_images=True, use_colorbar=False, 
                           add_redshift_label=True)
