refraction_render.calcs.UniformFermatEquationsEuclid

class refraction_render.calcs.UniformFermatEquationsEuclid(f, args=())[source]

Bases: refraction_render.calcs.euler_equations.FermatEquations

Solver for light ray in a 2D Euclidian geometry with \(n=n(y)\).

This object takes in three user defined functions: \(n(y), \frac{\partial n(y)}{\partial y}\) and uses these functions to solve Fermat’s equations for the path of a light ray.

__init__(f, args=())[source]

Intializes the FermatEquationsEuclid object.

Parameters
fcallable

function which returns the index of refraction and its gradient as a tuple: \(n(x,y),\frac{\partial n(x,y)}{\partial y}\).

argsarray_like, optional

optional arguments which go into the functions.

Methods

__init__(f[, args])

Intializes the FermatEquationsEuclid object.

solve_ivp(a, b, y0, dy0, **kwargs)

Solve initial value problem for light rays.

solve_ivp(a, b, y0, dy0, **kwargs)

Solve initial value problem for light rays.

Parameters
ascalar

initial position for the solution of the ray’s path.

bscalar

final position for the solution of the ray’s path.

y0array_like of shape (n,)

initial position of the ray’s.

dy0array_like of shape (n,)

initial derivative (with respect to the independent variable) of the ray’s trajectory.

kwargsoptional

additional arguments to pass into solver, see scipy.integrate.solve_ivp for more details.

Returns
Bunch object with the following fields defined:
tndarray, shape (n_points,)

Time points.

yndarray, shape (n, n_points)

Values of the solution at t.

solOdeSolution or None

Found solution as OdeSolution instance; None if dense_output was set to False.

t_eventslist of ndarray or None

Contains for each event type a list of arrays at which an event of that type event was detected. None if events was None.

nfevint

Number of evaluations of the right-hand side.

njevint

Number of evaluations of the Jacobian.

nluint

Number of LU decompositions.

statusint
Reason for algorithm termination:
  • -1: Integration step failed.

  • 0: The solver successfully reached the end of tspan.

  • 1: A termination event occurred.

messagestring

Human-readable description of the termination reason.

successbool

True if the solver reached the interval end or a termination event occurred (status >= 0).

Notes

The solver can solve the path of an arbitrary number of light rays in one function call however the format of the solutions has the y(x) positions stacked on top of the derivatives.