Ray Sources

Ray sources generate the input rays for the model. The Ray-source objects also hold the results of the trace, in the traced_rays attribute, as a list of RayCollection objects. Each item in this list represents one “generation” of rays.

Ray source classes are subclasses of raypier.sources.BaseRaySource. Besides generating the input_rays (a RayCollection instance) attribute as the input to the model, and holding the trace results in the traced_rays member, the source objects also control the visualisation of the rays. The following visualisation-related attributes are available.

class raypier.sources.BaseRaySource
display: enum(“pipes”, “wires”, “none”)

Indicates how the rays should be drawn.

opacity: float

Sets the opacity for the rays where 0.0 is fully transparent and 1.0 is fully opaque.

wavelength_list

An numpy.ndarray listing all the wavelengths used generated by this ray source.

max_ray_len: float

Sets the maximum length of the rays.

scale_factor: float

Adjusts the scaling for the rays and related glyphs such as normals-arrows.

show_start: bool

If True, a sphere glyph is displayed at the source origin.

show_normals: bool

If True, the normal-vectors at each ray intersection will be drawn.

class raypier.sources.SingleRaySource(raypier.sources.BaseRaySource)

Ray Field Sources

A further sub-catagory of ray-sources are Ray Field Sources, being subclasses of RayFieldSource. In addition to generating the input_rays, Ray Field Source objects also generate the neighbours attribute. This is a (N,6) shaped array of ints which gives the index of each rays immediate neighbour.

The neighbours data for each RayCollection object is derived from it’s parent RayCollection. They are evaluated lazily so if neighbours are not required they don’t incure any penatly. Having neighbours present means that a RayCollection object can be summed as a set of Gaussian modes to generate the E-field.

Ray Field Sources were a precursor to the Gausslets implementation and are now somewhat redundant. If you want to include diffraction-effects, your starting point should be a Gausslet Source (see below). Ray Field Sources do not include the effects of diffraction in the propagation of their parent rays. Ray Fields can thus give you the point-spread function. One benefit of Ray Fields over Gausslet Sources would be that performance: without the need to trace parabasal rays, we expect ray-tracing RayFields to be faster than the full Gausslet implementation.