API Reference
AtmosphericTurbulenceSimulator.DoubleSystemAtmosphericTurbulenceSimulator.FilterSpecAtmosphericTurbulenceSimulator.FilterSpecAtmosphericTurbulenceSimulator.ImagingSpecAtmosphericTurbulenceSimulator.ImagingSpecAtmosphericTurbulenceSimulator.PhotonCountAtmosphericTurbulenceSimulator.PointSourceAtmosphericTurbulenceSimulator.SingleLayerAtmosphericTurbulenceSimulator.TrueSkyImageAtmosphericTurbulenceSimulator.CircularApertureAtmosphericTurbulenceSimulator.kolmogorov_covmatAtmosphericTurbulenceSimulator.simulate_imagesAtmosphericTurbulenceSimulator.simulate_phases
Setting up the atmosphere model
AtmosphericTurbulenceSimulator.SingleLayer — Type
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 (defaultFloat64).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 mostsize_heuristicstotal pixels.interpolate_from: alternatively, specify the low-res grid size directly. This must be greater than(11, 11)in each dimension.size_heuristics: wheninterpolate=:auto, the maximum allowed number of pixels in the low-res grid. Tweak this based on the capability of your hardware to computeeigenof aN×Nmatrix, whereNis 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
AtmosphericTurbulenceSimulator.kolmogorov_covmat — Method
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 matchesWif provided, otherwiseFloat64).W: the aperture function as a 2D array of weights. Normalized tosum(W) == 1internally.size: a tuple(nx, ny)specifying the size of the aperture function.
Imaging specifications
AtmosphericTurbulenceSimulator.DoubleSystem — Type
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.
AtmosphericTurbulenceSimulator.FilterSpec — Type
FilterSpecRepresentation 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.
AtmosphericTurbulenceSimulator.FilterSpec — Method
FilterSpec(base_wavelength; bandwidth[, tcenter=1, tedge=1, npts=7])Arguments
base_wavelength: central wavelength for the filter (same units aswavelengths).
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).
AtmosphericTurbulenceSimulator.ImagingSpec — Type
ImagingSpecContainer 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.
AtmosphericTurbulenceSimulator.ImagingSpec — Method
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 fromapertureif not provided.aperture: 2D aperture (pupil) array describing the telescope pupil.photon_count:PhotonCountinstance describing the photon budget and background.
Keyword Arguments
filter_spec:FilterSpecdescribing 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 ifimg_sizeis provided.img_size: explicit output image size(nx, ny). If not provided, computed from aperture size andnyquist_oversample.nphotonsandbackground: alternative way to specify photon budget and background whenphoton_countis not provided.
AtmosphericTurbulenceSimulator.PhotonCount — Type
PhotonCount(nphotons[, background])Specifies the photon budget for imaging simulations. Set nphotons to Inf for continuous flux (background can be omitted in this case).
AtmosphericTurbulenceSimulator.PointSource — Type
PointSource()Simple true-sky brightness model. The photon budget and background are configured via the ImagingSpec.photon_count field. See ImagingSpec for details on configuring photon budget and background.
AtmosphericTurbulenceSimulator.TrueSkyImage — Type
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.
AtmosphericTurbulenceSimulator.CircularAperture — Method
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,Float64by 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.
Running simulations
AtmosphericTurbulenceSimulator.simulate_images — Method
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 toIntfor finite-photon simulations (determined byimg_spec.photon_count.nphotons) andFloat64for infinite-photon models.img_spec: anImagingSpecdescribing the aperture, image size, photon budget and filter.atm_spec: anAtmosphereSpecused to produce phase screens.true_sky: aTrueSkymodel (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 tonothing(default), no file is written and the images and phases are returned as aNamedTupleof 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 toArray). To use GPU arrays, pass e.g.CUDA.CuArrayhere (requires CUDA.jl).
AtmosphericTurbulenceSimulator.simulate_phases — Method
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: anAtmosphereSpecused 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 tonothing(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 toArray). To use GPU arrays, pass e.g.CUDA.CuArrayhere (requires CUDA.jl).