# Emitters

Warning

The old emitter implementation is deprecated as of v0.5! See below for the new API.

Emitters create rays in a certain pattern, usually controlled by some parameters. Emitters are defined by Pixels and Spatial Layouts, and have a spectrum and an optical power distribution over the hemisphere. These are intrinsic physical properties of the emitter.

The basic emitter (Source) is constructed as a combination of 4 basic elements and a 3D Transform. The basic elements include:

The OpticSim package comes with various implementations of each of these basic elements:

## Examples of Basic Emitters

Note: All of the examples on this page assume that the following statement was executed:

using OpticSim, OpticSim.Geometry, OpticSim.Emitters

### Simple functions for creating commonly used emitters

Many optical systems by convention have their optical axis parallel to the z axis. These utility functions provide a simple interface to the Emitters package to create emitters that direct their rays in the negative z direction, toward the entrance of the optical system.

OpticSim.Emitters.pointemitterFunction
pointemitter(origin::AbstractVector{T}, coneangle; λ::Length = 500nm, numrays = 100) where {T<:Real}

Creates a point source with Lambertian emission power and cone distribution of rays, emitting in the -z direction. λ is a unitful Length quantity, e.g., 550nm.

source
pt = Emitters.pointemitter([0.0,0.0,.5],.3)
Vis.draw(pt, debug=true, resolution = (800, 600))
OpticSim.Emitters.collimatedemitterFunction
collimatedemitter(origin::AbstractVector{T}, halfsquaresize; λ::Length = 500nm, numrays = 100) where {T<:Real}

Creates a square collimated emitter, emitting rays in the -z direction. Rays are emitted on a square grid with sqrt(numrays) on a side. λ can be a unitful quantity, e.g., 550nm, or a number. In the latter case the units are implicitly microns.

source
pt = Emitters.collimatedemitter([0.0,0.0,1.0],.5)
Vis.draw(pt, debug=true, resolution = (800, 600))

### Point origin with various Direction distributions

src = Sources.Source(origins=Origins.Point(), directions=Directions.RectGrid(π/4, π/4, 15, 15))
Vis.draw(src, debug=true, resolution = (800, 600))
src = Sources.Source(origins=Origins.Point(), directions=Directions.UniformCone(π/6, 1000))
Vis.draw(src, debug=true, resolution = (800, 600))
src = Sources.Source(origins=Origins.Point(), directions=Directions.HexapolarCone(π/6, 10))
Vis.draw(src, debug=true, resolution = (800, 600))

### Various origins distributions

src = Sources.Source(origins=Origins.RectGrid(1.0, 1.0, 10, 10), directions=Directions.Constant())
Vis.draw(src, debug=true, resolution = (800, 600))
src = Sources.Source(origins=Origins.Hexapolar(5, 1.0, 2.0), directions=Directions.Constant())
Vis.draw(src, debug=true, resolution = (800, 600))

### Examples of Angular Power Distribution

In these example, the arrow width is proportional to the ray power.

src = Sources.Source(
origins=Origins.Hexapolar(1, 8.0, 8.0),             # Hexapolar Origins
directions=Directions.RectGrid(π/6, π/6, 15, 15),   # RectGrid Directions
power=AngularPower.Cosine(10.0)                     # Cosine Angular Power
)
Vis.draw(src, debug=true, resolution = (800, 600))