Commit 5841c58d authored by Éric Thiébaut's avatar Éric Thiébaut
Browse files

Fix imports/exports and update doc.

parent 04ee4b94
......@@ -14,10 +14,29 @@
module Tao
export
DeformableMirror,
# Cameras.
AbstractCamera,
CameraOutput,
SingleImage,
TimeoutError,
WeightedImage,
# Deformable mirrors.
AbstractDeformableMirror,
# Wavefront sensors.
AbstractWavefrontSensor,
AbstractWavefrontSensorAlgorithm,
AbstractWavefrontMeasure,
ShackHartmannGeometry,
ShackHartmannSensor,
WavefrontSlope,
WeightedWavefrontSlope,
# Methods for remote objects.
abort, configure, kill, reset, send, start, stop,
# Miscellaneous.
TimeoutError,
readfits,
writefits,
writefits!
......@@ -36,10 +55,14 @@ import Sockets: send
import Statistics: mean
# Undocumented methods that can be imported by sub-packages.
# Undocumented methods that can be imported by sub-packages, notably
# TaoBindings.
function start end
function stop end
function abort end
function configure end
# FIXME: Remove the following.
function device end
function reference end
function set_reference! end
......
......@@ -8,7 +8,7 @@
# This file is part of TAO software (https://git-cral.univ-lyon1.fr/tao)
# licensed under the MIT license.
#
# Copyright (C) 2018-2021, Éric Thiébaut.
# Copyright (C) 2018-2022, Éric Thiébaut.
#
module DeformableMirrors
......@@ -36,13 +36,13 @@ import Sockets: send
using Statistics
"""
Tao.AbstractDeformableMirror{T}
`Tao.AbstractDeformableMirror{T}` is the abstract super-type of deformable
mirror concrete types, parameter `T` is the element type of the actuator
commands.
is the abstract super-type of deformable mirror types, parameter `T` is the
element type of the actuator commands.
"""
abstract type AbstractDeformableMirror{T} <: AbstractVector{T} end
abstract type AbstractDeformableMirror{T} end
# Fake deformable mirror for testing.
struct FakeDeformableMirrorDevice{T<:AbstractFloat}
......
......@@ -142,7 +142,7 @@ end
function default_reference(T::Type{<:Point{<:AbstractFloat}},
boxes::AbstractVector{<:BoundingBox{<:Integer}})
ref = Vector{T}(undef, length(boxes))
for i in eachindex(ref, boxes)
@inbounds for i in eachindex(ref, boxes)
ref[i] = center(boxes[i])
end
return ref
......
......@@ -27,7 +27,9 @@ have finite values (to avoid numerical issues in computations) and that weights
are nonnegative (a weight of zero indicates an invalid data value).
"""
struct WeightedArray{T<:AbstractFloat,N,W<:DenseArray{T,N},D<:DenseArray{T,N}}
struct WeightedArray{T<:AbstractFloat,N,
W<:DenseArray{T,N},
D<:DenseArray{T,N}}
wgt::W
dat::D
# This unique inner constructor is to make sure that the two arrays have
......@@ -36,9 +38,8 @@ struct WeightedArray{T<:AbstractFloat,N,W<:DenseArray{T,N},D<:DenseArray{T,N}}
function WeightedArray{T,N,W,D}(wgt::W, dat::D) where {T<:AbstractFloat,N,
W<:DenseArray{T,N},
D<:DenseArray{T,N}}
axes(wgt) == axes(dat) ||
throw(DimensionMismatch(
"weights and data must have the same indices"))
axes(wgt) == axes(dat) || throw(DimensionMismatch(
"weights and data must have the same indices"))
return new{T,N,W,D}(wgt, dat)
end
end
......@@ -47,35 +48,39 @@ const WeightedVector{T,W,D} = WeightedArray{T,1,W,D}
const WeightedMatrix{T,W,D} = WeightedArray{T,2,W,D}
"""
AbstractCamera{T,N}
Type `Tao.AbstractCamera{T}` is the super-type of camera and image provider
concrete types in TAO. Parameter `T` is the pixel type of the acquired images
or `Any` when the pixel type is unknown or undetermined.
is the super-type of cameras and image providers in TAO. Parameter `T` is the
pixel type of the produced images or `Any` when the pixel type is unknown or
undetermined. Parameter `N` is the number of dimensions of the produced
images, usually 2 for ordinary images and 3 for weighted images.
"""
abstract type AbstractCamera{T} end
abstract type AbstractCamera{T,N} end
"""
CameraOutput
Abstract type `Tao.CameraOutput` is the super-type of concrete types specifying
the ouptput of a camera or an image provider.
is the super-type of concrete types used to specify the ouptput of a camera or
an image provider.
"""
abstract type CameraOutput end
"""
SingleImage
Singleton type `SingleImage` is a sub-type of [`Tao.CameraOutput`](@ref) and is
used to require a single image from a camera or an image provider.
is a singleton sub-type of [`Tao.CameraOutput`](@ref) and is used to require a
single image from a camera or an image provider.
"""
struct SingleImage <: CameraOutput end
"""
WeightedImage
Singleton type `WeightedImage` is a sub-type of [`Tao.CameraOutput`](@ref) and
is used to require a pre-processed image with its weights from a camera or an
image provider.
is a singleton sub-type of [`Tao.CameraOutput`](@ref) and is used to require a
pre-processed image with its weights from a camera or an image provider.
"""
struct WeightedImage <: CameraOutput end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment