gradoptics.light_sources.base_light_source

class gradoptics.light_sources.base_light_source.BaseLightSource(bounding_shape=None)

Bases: abc.ABC

Base class for light sources.

__init__(bounding_shape=None)
Parameters

bounding_shape – A bounding shape that bounds the light source (BoundingShape). Default is None

Note

A bounding shape is required if this light source is used with backward ray tracing

abstract sample_rays(nb_rays, device='cpu')

Samples rays from the light source

Parameters
  • nb_rays – Number of rays to sample (int)

  • device – The desired device of returned tensor (str). Default is 'cpu'

Returns

Sampled rays (Rays)

abstract plot(ax)

Plots the position of the light source on the provided axes.

Parameters

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