astrohack.core.cassegrain_ray_tracing

Attributes

nanvec3d

Functions

open_rt_zarr(zarr_filename)

Open a Zarr file containing the results of a run of the Ray Tracing pipeline

write_rt_xds_to_zarr(rt_xds, zarr_filename, overwrite)

Write a Xarray dataset containing the results of a run of the Ray Tracing pipeline to disk

make_gridded_cassegrain_primary(grid_size, resolution, ...)

Create a 1D representation of the primary and the normals to its surface based on a radial mask

reflect_off_primary(rt_xds, incident_light)

Reflect incident light onto primary surface

reflect_off_analytical_secondary(rt_xds[, offset])

Compute reflections off of the secundary using an analutical description of the secondary

detect_light(rt_xds)

Determines which rays touch the mouth of the horn

compute_phase(rt_xds, wavelength, phase_offset)

Uses the distances along the ray from the rim of the primary all the way to the horn to compute the phase of

title_from_input_parameters(inpt_dict)

Create a string with all the descriptive user inputs for the results of the ray tracing.

plot_2d_map(gridded_array, axis, telescope_parameters, ...)

Receive 2D gridded scalar or Vectorial data and plot accordingly

add_rz_ray_to_plot(ax, origin, destiny, color, ls, ...)

Adds a finite ray to a radial projection plot

compare_ray_tracing_to_phase_fit_results(rt_xds, ...)

Compare phase fitting results to ray tracing simulation inputs

Module Contents

nanvec3d[source]
open_rt_zarr(zarr_filename)[source]

Open a Zarr file containing the results of a run of the Ray Tracing pipeline :param zarr_filename: Name of the Zarr file containing the RT data

Returns:

The Xarray dataset containing the results of a run of the Ray Tracing pipeline

write_rt_xds_to_zarr(rt_xds, zarr_filename, overwrite)[source]

Write a Xarray dataset containing the results of a run of the Ray Tracing pipeline to disk :param rt_xds: Xarray dataset containing the results of a run of the Ray Tracing pipeline :param zarr_filename: Name of the Zarr file containing the RT data :param overwrite: Overwrite file if it already exists?

make_gridded_cassegrain_primary(grid_size, resolution, telescope_pars)[source]

Create a 1D representation of the primary and the normals to its surface based on a radial mask :param grid_size: The span of the grid to used :param resolution: The spacing between points in the grid :param telescope_pars: The optical parameters of the telescope in question

Returns:

An Xarray dataset containing the basics for regridding the 1D data, the primary points and normals plus the x and y axes

reflect_off_primary(rt_xds, incident_light)[source]

Reflect incident light onto primary surface :param rt_xds: Ray tracing Xarray dataset with primary normals and points :param incident_light: 3D vector with the direction of incident light

Returns:

Ray tracing XDS enriched with the incident light and the reflections of the primary mirror

reflect_off_analytical_secondary(rt_xds, offset=np.array((0, 0, 0)))[source]

Compute reflections off of the secundary using an analutical description of the secondary :param rt_xds: Ray tracing XDS containing primary points and their reflections :param offset: An offset in meters to be applied to the position of the secondary mirror

Returns:

Ray tracing XDS enriched with the distance along the rays to the secondary, the points touched in the secondary,

the normals at these points and the reflections at each of these points.

detect_light(rt_xds)[source]

Determines which rays touch the mouth of the horn :param rt_xds: The ray tracing XDS containing the description of the rays from the primary up to their reflection

from the secondary

Returns:

Ray tracing XDS enriched with the distance along the rays to the horn and the point at which they intercept the horn mouth

compute_phase(rt_xds, wavelength, phase_offset)[source]

Uses the distances along the ray from the rim of the primary all the way to the horn to compute the phase of each ray :param rt_xds: Ray tracing XDS with the distances from the primary to the esconday and secondary to horn. :param wavelength: The light wavelength :param phase_offset: A phase offset to be added to the phases (i.e. light may not arrive with phase=0)

Returns:

RT XDS enriched with the rays’ total_path and their phases

title_from_input_parameters(inpt_dict)[source]

Create a string with all the descriptive user inputs for the results of the ray tracing. :param inpt_dict: Dinctionary of user inputs given by the user to the RT pipeline

Returns:

A string formatted to display the information in a matplotlib plot.

plot_2d_map(gridded_array, axis, telescope_parameters, suptitle, filename, zlabel, colormap, zlim, display, dpi)[source]

Receive 2D gridded scalar or Vectorial data and plot accordingly :param gridded_array: 2D gridded scalar or vectorial data :param axis: An axis that represents both X and Y axes :param telescope_parameters: Optical parameters of the telescope used in the Ray tracing :param suptitle: Overhanging title to be shown on top of figure :param filename: Name for the file containing the plot(s) :param zlabel: Label to be attached to the colorbar :param colormap: The colormap to be used in the plot :param zlim: Limits of the colorbar :param display: Display plots? :param dpi: Plot resolution on png file

Returns:

None

add_rz_ray_to_plot(ax, origin, destiny, color, ls, label, sign)[source]

Adds a finite ray to a radial projection plot :param ax: Axes object onto which to plot :param origin: Ray origin :param destiny: Ray destiny :param color: Ray color to be plotted :param ls: Ray line style :param label: Ray’s label :param sign: is the ray to be shown on the negative or positive side?

Returns:

None

compare_ray_tracing_to_phase_fit_results(rt_xds, phase_fit_results, phase_5d, phase_corrected_angle, filename, phase_unit='deg', colormap='viridis', display=False, dpi=300)[source]

Compare phase fitting results to ray tracing simulation inputs :param rt_xds: ray tracing XDS object :param phase_fit_results: Phase fitting array results. :param phase_5d: RT phase simulation inbedded in a 5D array for phase fitting comparison :param phase_corrected_angle: The 5D residuals of the phase fitting :param filename: Name of the png file onto which to save phase comparison plots. :param phase_unit: Unit to use for phase displays :param colormap: The colormap to be used in the plot :param display: Display plots? :param dpi: Plot resolution on png file

Returns:

None