gradoptics.optics.window

class gradoptics.optics.window.Window(left_interface_x_position, right_interface_x_position, n_ext=1.000293, n_glass=1.494, diameter=0.137, eps=1e-15)

Bases: gradoptics.optics.base_optics.BaseOptics

Models a medium with a refractive index between two parallel surfaces. Refraction is modelled using Snell’s law.

__init__(left_interface_x_position, right_interface_x_position, n_ext=1.000293, n_glass=1.494, diameter=0.137, eps=1e-15)
Parameters
  • left_interface_x_position – Position of the left interface along the x axis (float)

  • right_interface_x_position – Position of the right interface along the x axis (float)

  • n_ext – Refractive index of the external medium (float)

  • n_glass – Refractive index of the medium (float)

  • diameter – Diameter of the interfaces (float)

  • eps – Parameter used for numerical stability in the different class methods (float). Default is '1e-15'

get_ray_intersection(incident_rays)

Computes the times t at which the incident rays will intersect the object.

Parameters

incident_rays – The incident rays (Rays)

Returns

Times t (torch.tensor)

intersect(incident_rays, t)

Returns the rays reflected or refracted by the optical element.

Parameters
  • incident_rays – The incident rays (Rays)

  • t – The times at which the incident rays will intersect the optical element (torch.tensor)

Returns

(tuple) - Reflected or refracted rays (Rays) - A boolean mask that indicates which incident rays were reflected or refracted ― some rays may not be

reflected or refracted for example, due to total internal reflection, which is not modelled at this point (torch.tensor)

plot(ax, s=0.1, color='lightblue', resolution=100)

Plots the optical element on the provided axes.

Parameters

ax – 3d axes (mpl_toolkits.mplot3d.axes3d.Axes3D)