API Reference

Setting up the atmosphere model

AtmosphericTurbulenceSimulator.SingleLayerType
SingleLayer([T, ]size, r0[; interpolate, interpolate_from, size_heuristics=1024])

An AtmosphereSpec that produces independent (uncorrelated) phase frames for each timestep.

Arguments

  • T: the number type for phase screens (default Float64).
  • size: a tuple (nx, ny) specifying the phase screen shape in pixels (coarse sampler grid).
  • r0: Fried parameter (r₀) in pixels.

Keyword Arguments

  • interpolate: when specified, the phase screen is sampled at a lower resolution and then upsampled using specified number of Harding interpolation passes. If set to :auto, the number of passes is chosen such that the low-res grid has at most size_heuristics total pixels.
  • interpolate_from: alternatively, specify the low-res grid size directly. This must be greater than (11, 11) in each dimension.
  • size_heuristics: when interpolate=:auto, the maximum allowed number of pixels in the low-res grid. Tweak this based on the capability of your hardware to compute eigen of a N×N matrix, where N is the number of pixels in the low-res grid.

Notes

The Harding interpolation follows "Fast simulation of a Kolmogorov phase screen" Cressida M. Harding, Rachel A. Johnston, and Richard G. Lane, APPLIED OPTICS Vol. 38, No. 11, April 1999

source
AtmosphericTurbulenceSimulator.kolmogorov_covmatMethod
kolmogorov_covmat(W)
kolmogorov_covmat([T, ]size)

Compute the phase covariance matrix of a turbulent layer in the atmosphere, following the Kolmogorov model. The piston term is excluded in this model. This function assumes unit Fried parameter $r_0 = 1 px$.

Arguments

  • T: number type for the covariance matrix (default matches W if provided, otherwise Float64).
  • W: the aperture function as a 2D array of weights. Normalized to sum(W) == 1 internally.
  • size: a tuple (nx, ny) specifying the size of the aperture function.
source

Imaging specifications

AtmosphericTurbulenceSimulator.DoubleSystemType
DoubleSystem(rel_position, intensity)

Model for a two-component source (binary): primary plus a secondary offset by rel_position. The photon budget and background are configured via the ImagingSpec.photon_count field. See ImagingSpec for details.

Arguments

  • rel_position: (dx, dy) integer tuple specifying the secondary's pixel offset.
  • intensity: multiplicative intensity of the secondary relative to the primary.
source
AtmosphericTurbulenceSimulator.FilterSpecType
FilterSpec

Representation of a spectral filter used by the imaging pipeline.


FilterSpec(base_wavelength, wavelengths[, intensities])

Arguments

  • base_wavelength: central wavelength for the filter.
  • wavelengths: vector of sampled wavelengths within the filter bandpass.
  • intensities: vector of relative intensities at each sampled wavelength. If not provided, equal weights are assumed.
source
AtmosphericTurbulenceSimulator.FilterSpecMethod
FilterSpec(base_wavelength; bandwidth[, tcenter=1, tedge=1, npts=7])

Arguments

  • base_wavelength: central wavelength for the filter (same units as wavelengths).

Keyword Arguments

  • bandwidth: total width of the filter bandpass in wavelength units.
  • tcenter: relative intensity at the center wavelength (default 1).
  • tedge: relative intensity at the edges of the bandpass (default 1).
source
AtmosphericTurbulenceSimulator.ImagingSpecType
ImagingSpec

Container for the imaging system configuration. It is defined by the telescope aperture, the source brightness via photon_count, an optional spectral filter_spec, and the output img_size. If img_size does not match the aperture’s Nyquist grid, the aperture is zero-padded accordingly.

source
AtmosphericTurbulenceSimulator.ImagingSpecMethod
ImagingSpec([T, ]aperture, photon_count[; filter_spec, nyquist_oversample, img_size])
ImagingSpec([T, ]aperture; nphotons, [background, filter_spec, nyquist_oversample, img_size])

Create an imaging system specification.

Arguments

  • T: desired number type, inferred from aperture if not provided.
  • aperture: 2D aperture (pupil) array describing the telescope pupil.
  • photon_count: PhotonCount instance describing the photon budget and background.

Keyword Arguments

  • filter_spec: FilterSpec describing sampled wavelengths and their relative intensities. Defaults to a monochromatic filter.
  • nyquist_oversample: multiplicative factor applied to the default Nyquist image size (2 * size(aperture)). Defaults to 1. Ignored if img_size is provided.
  • img_size: explicit output image size (nx, ny). If not provided, computed from aperture size and nyquist_oversample.
  • nphotons and background: alternative way to specify photon budget and background when photon_count is not provided.
source
AtmosphericTurbulenceSimulator.TrueSkyImageType
TrueSkyImage(true_sky::AbstractMatrix{T})

Wrap a real-valued true-sky image for use with the imaging pipeline. The photon budget and background are configured via the ImagingSpec.photon_count field. See ImagingSpec for details.

Arguments

  • true_sky: real image array representing spatial sky brightness.
source
AtmosphericTurbulenceSimulator.CircularApertureMethod
CircularAperture([T, ]sz, radius[; aa_dist=1])

Create a circular (optionally anti-aliased) aperture array of shape sz. Returns a 2D numeric array suitable for use as an aperture in ImagingSpec.

Arguments

  • T: desired number type, Float64 by default.
  • sz: aperture size (nx, ny).
  • radius: radius of the circular aperture in pixels. Defaults to the largest that fits.
  • aa_dist: anti-aliasing transition width in pixels at the aperture edge.
source

Running simulations

AtmosphericTurbulenceSimulator.simulate_imagesMethod
simulate_images([T, ]img_spec::ImagingSpec, atm_spec::AtmosphereSpec[, true_sky::TrueSky]; n, [batch, filename, verbose, savephases, deviceadapter])

Simulate n images using the provided imaging and atmosphere specifications and write the results to an HDF5 file.

Arguments

  • T: output image numeric type; if not provided, defaults to Int for finite-photon simulations (determined by img_spec.photon_count.nphotons) and Float64 for infinite-photon models.
  • img_spec: an ImagingSpec describing the aperture, image size, photon budget and filter.
  • atm_spec: an AtmosphereSpec used to produce phase screens.
  • true_sky: a TrueSky model (e.g. PointSource, DoubleSystem, TrueSkyImage).

Keyword Arguments

  • n: number of images to simulate.
  • batch: batch size for buffered computations and HDF5 writes (default 128). - filename: output HDF5 filename. If set to nothing (default), no file is written and the images and phases are returned as a NamedTuple of arrays.
  • verbose: show progress meter (true by default).
  • savephases: when true, the sampled phase screens are saved in the HDF5 in dataset with key "phases", and the pupil function is saved under key "aperture" (true by default).
  • deviceadapter: adapter for device-backed arrays (defaults to Array). To use GPU arrays, pass e.g. CUDA.CuArray here (requires CUDA.jl).
source
AtmosphericTurbulenceSimulator.simulate_phasesMethod
simulate_phases(atm_spec::AtmosphereSpec; n, [batch, filename, verbose, deviceadapter])

Simulate n phase screens using the provided atmosphere specification and write the results to an HDF5 file.

Arguments

  • atm_spec: an AtmosphereSpec used to produce phase screens.

Keyword Arguments

  • n: number of phase screens to simulate.
  • batch: batch size for buffered computations and HDF5 writes (default 128).
  • filename: output HDF5 filename. If set to nothing (default), no file is written and the phases are returned as an array.
  • verbose: show progress meter (true by default).
  • deviceadapter: adapter for device-backed arrays (defaults to Array). To use GPU arrays, pass e.g. CUDA.CuArray here (requires CUDA.jl).
source