This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Writing config file

See your project in action!

Some of these examples may be updated without warning

Whether using a config file or passing the arguments directly to main(), we need to build the objects to be passed to the program. These pages are a quick description of each parameter and how to build them.

1 - OpticalChainList

Explanation

The first argument of main() is OpticalChainList, a complete description of the optical setup that needs to be simulated. This includes the absolute positions and orientations of all the optical elements apart from the detector.

Positionning these elements in 3D space by hand would be unnecessarily complicated. Instead, a utility function OEPlacement() has been written to allow you to automatically position these elements, provided you specify the distances between them and the incidence angle on each element.

To position these elements, a prealignment is performed, much like with an alignment laser in real life. A single ray (the central ray within the actual light source) is cast and the Optical Elements are successively positionned in the path of that ray at the specified distance and incidence angle. A reflected ray is then calculated and the algorithm uses it to add the next Optical Element.

It’s perfectly possible to modify the alignment after this prealignment procedure. See for instance here .

Using OEPlacement()

To use OEPlacement() we logically need:

  • A Python list of mirrors or masks to be positionned
  • A source of light to be used for prealignment (a virtual HeNe laser) described by a dict (see SourceProperties )
  • A list of distances between optics. The first value is the distance between source and first optic.
  • A list of incidence angles of the central ray on the optical elements.

2 - SourceProperties

Running the simulation requires describing the light source. The properties that need to be defined are the following:

  • "DeltaFT": This is not actually a property of the light source. Indeed, in the simulation, all photons are considered to be emitted simultaneously in an infinitely short burst. This parameter is actually an analysis parameter, used to check whether the light rays after the optical system have a short enough temporal spread.
  • "Wavelength": Similarly to DeltaFT, this is actually an analysis parameter that is used as a reference for the spatial spread of the light rays after the optical system. It can however be used in the future to make wavelength-dependent optics such as gratings.
  • "Divergence": This is an actual propertany of the light source: it’s the half-angle of the cone of light emitted by the source as illustrated below.
  • "SourceSize": Again, a property of the light source. It’s the diameter of the light source (considered to be a disc). If the light source is a point source, it should be set to 0.
  • "NumberRays": The number of rays that the light source will cast and that will be used for the simulation.

Illustration of divergence of light source

Below we provide an example of a 5mm wide source of 80nm light with a 50mrad total divergence, casting 1000 rays and compared in the end to an Airy cylinder of 0.5 femtoseconds.

SourceProperties = {
    'Divergence' : 50e-3/2,
    'SourceSize' : 5,
    'Wavelength' : 80e-6,
    'DeltaFT'    : 0.5,
    'NumberRays' : 1000
}

3 - DetectorOptions

The detector is a virtual plane of infinite size which plays the role of a CCD. It can be positionned manually by specifying the position of a point on the detector and its normal vector. However, in the case of ART it made sense to make the positionning of the detector part of the main functionality of the code. Thus, the main() function accepts the DetectorOptions argument. This object allows the code to automatically position the virtual detection plane in the optimal spot. It’s a Python dictionnary with the following possible attributes:

  • "ReflectionNumber": This is the number of the optic after the which the detector will be positionned. In most cases that would be the final optic in the setup and we commonly use the Python shorthand for the index of the last element: -1
  • "ManualDetector": Setting this to True would disable the automatic positionning of the detector and you would have to also specify "DetectorCentre" and "DetectorNormal" to position it.
  • "AutoDetectorDistance": If set to True, the algorithm will automatically optimize the detector position based on the "OptFor", "MaxRaystoConsider" and "IntensityWeighted" options.
  • "DistanceDetector": If "AutoDetectorDistance" is True, it will be the starting point for the optimisation. Otherwise, this will be the distance of the detector from the last optical element.
DetectorOptions = {
    'ReflectionNumber' : -1,
    'ManualDetector' : False,
    'DistanceDetector' : 76 ,
    'AutoDetectorDistance' : True,
    'OptFor' : "intensity"
}

4 - AnalysisOptions

DefaultAnalysisOptions = {
    "verbose": True,  # print intermediate results and info in the console?
    "plot_Render": False,  # render optical elements and rays, and how many rays to render?
    "maxRaysToRender": 150,
    "DrawAiryAndFourier": True,  # Draw Airy spot and Fourier-limited duration in the following plots?
    "plot_SpotDiagram": False,  # produce an interactive spot diagram without color coding the spots?
    "plot_DelaySpotDiagram": False,  # produce an interactive spot diagram with ray delays color coded?
    "plot_IntensitySpotDiagram": False,  # produce an interactive spot diagram with ray intensities color coded?
    "plot_IncidenceSpotDiagram": False,  # produce an interactive spot diagram with ray incidence angles color coded?
    "plot_DelayGraph": False,  # produce an interactive spot diagram with delays in 3rd dimension?
    "plot_IntensityGraph": False,  # produce an interactive spot diagram with delays in 3rd dimension and ray intensities color coded?
    "plot_IncidenceGraph": False,  # produce an interactive spot diagram with delays in 3rd dimension and ray incidence angles color coded?
    "plot_DelayMirrorProjection": False,  # produce a plot of the ray delays at the detector projected onto the mirror surface?
    "plot_IntensityMirrorProjection": False,  # produce a plot of the ray intensities at the detector projected onto the mirror surface?
    "plot_IncidenceMirrorProjection": False,  # produce a plot of the ray incidence angles at the detector projected onto the mirror surface?
    "save_results": True,  # save the simulation results to disk, to analyse later
    "OEPointsToRender": 2000,
    "OEPointsScale": 0.5,
}