System4f.traceManyThrough

raytracing.System4f.traceManyThrough(self, inputRays, progress=True, useOpenCL=True)

This function trace each ray from a list or a Rays() distribution from front edge of element to the back edge. Input can be either a list of Ray(), or a Rays() object: the Rays() object is an iterator and can be used like a list of rays. UniformRays, LambertianRays() etc… can be used.

Parameters:
  • inputRays (object of Ray class) – A group of rays

  • progress (bool) – if True, the progress of the raceTrough is shown (default=Trye)

Returns:

outputRays – List of Ray() (i,e. a raytrace), one for each input ray.

Return type:

object of Ray class

Examples

Since the input of this example is random, we should not expect to get the same results every time.

>>> from raytracing import *
>>> # M is an ABCD matrix of a lens (f=10)
>>> M= Matrix(A=1,B=0,C=-1/10,D=1,physicalLength=2,label='Lens')
>>> # inputRays is a group of random rays with uniform distribution at center
>>> nRays = 3
>>> inputRays = RandomUniformRays(yMax=5, yMin=0, maxCount=nRays)
>>> Tr=M.traceManyThrough(inputRays)
>>> print('heights of the output rays:', Tr.yValues)
heights of the output rays: [4.323870378874155, 2.794064779525441, 0.7087442942835853]
>>> print('angles of the output rays:', Tr.thetaValues)
angles of the output rays: [-1.499826089814585, 0.7506850963379516, -0.44348989046728904]

Notes

We assume that if the user will be happy to receive Rays() as an output even if they passed a list of rays as inputs.