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

Remove dependency on XPA, and resume/supend methods

parent 156727bc
......@@ -13,7 +13,6 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TwoDimensional = "1907e7ba-7586-4310-a2ba-dd01462aeb50"
XPA = "d310a076-6a08-52b6-ab78-79baa254182b"
[compat]
ArrayTools = "0.2"
......
......@@ -28,10 +28,6 @@ using TwoDimensional
using EasyFITS
import EasyFITS: readfits, writefits, writefits!
using XPA
const xpaget = XPA.get
const xpaset = XPA.set
using MayOptimize
using LinearAlgebra
......@@ -41,7 +37,6 @@ import Sockets: send
import Statistics: mean
# Undocumented methods that can be imported by sub-packages.
function abort end
function algorithm end
function camera end
function configure end
......@@ -50,13 +45,9 @@ function image_size end
function layout end
function measurements end
function reference end
function resume end
function send! end
function set_reference! end
function start end
function stop end
function subimages_bounding_boxes end
function suspend end
"""
Tao.measure!(dest, alg, [wgt,] img) -> dest
......
......@@ -8,48 +8,32 @@
# 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.
#
"""
Tao.start(apt)
Tao.start(obj)
starts image acquisition by remote camera server at XPA access-point `apt`.
starts the main loop of the server owning remote object `obj`.
"""
start(apt::ServerName) = XPA.set(start(XPA.address(apt)), "start")
function start end
"""
Tao.stop(apt)
Tao.stop(obj)
stops image acquisition by remote camera server at XPA access-point `apt`.
stops the main loop of the server owning remote object `obj`.
"""
stop(apt::ServerName) = XPA.set(start(XPA.address(apt)), "stop")
function stop end
"""
Tao.abort(apt)
Tao.abort(obj)
aborts image acquisition by remote camera server at XPA access-point `apt`.
aborts the main loop of the server owning remote object `obj`.
"""
abort(apt::ServerName) = XPA.set(start(XPA.address(apt)), "abort")
"""
Tao.suspend(apt)
suspends image acquisition by remote camera server at XPA access-point `apt`.
"""
suspend(apt::ServerName) = XPA.set(suspend(XPA.address(apt)), "suspend")
"""
Tao.resume(apt)
resumes image acquisition by remote camera server at XPA access-point `apt`.
"""
resume(apt::ServerName) = XPA.set(resume(XPA.address(apt)), "resume")
function abort end
"""
mean([T=Float64,], cam::AbstractCamera, nimgs; skip=0, timeout=0.5) -> arr
......
......@@ -19,50 +19,12 @@
struct TimeoutError <: Exception; end
"""
Tao.AccessPoint("address")
yields an object of type `Tao.AccessPoint` which identifies the string
`"address"` as the accesspoint of an XPA server. This encapsulation is needed
to distinguish ordinary strings and XPA addresses in methods such as `start`,
`stop`, etc.
The string literal `xpa"address"` is a shortcut of the above to represent the
accesspoint of an XPA server.
"""
struct AccessPoint
addr::AbstractString
end
XPA.address(apt::AccessPoint) = XPA.address(apt.addr)
"""
`xpa"address"` is a string literal representing the accesspoint of an XPA
server.
"""
macro xpa_str(str)
:(AccessPoint($str))
end
"""
`Tao.ServerName` is the union of types that are suitable to represent the
accesspoint of an XPA server, that is to say a string or an instance of
[`Tao.AccessPoint`](@ref).
"""
const ServerName = Union{AbstractString,XPA.AccessPoint}
"""
WeightedArray(wgt, dat, verify=false)
WeightedArray(wgt, dat)
yields and instance of `WeightedArray` which stores an array of data `dat` with
corresponding weights `wgt`. The conventions are that all weights and data
have finite values (to avoid numerical issues in computations) and that weights
are nonnegative (a weight of zero indicates an invalid data value). If
optional argument `verify` is set true, these assumptions are verified.
are nonnegative (a weight of zero indicates an invalid data value).
"""
struct WeightedArray{T<:AbstractFloat,N,W<:DenseArray{T,N},D<:DenseArray{T,N}}
......@@ -75,7 +37,8 @@ struct WeightedArray{T<:AbstractFloat,N,W<:DenseArray{T,N},D<:DenseArray{T,N}}
W<:DenseArray{T,N},
D<:DenseArray{T,N}}
axes(wgt) == axes(dat) ||
throw(DimensionMismatch("weights and data must have the same indices"))
throw(DimensionMismatch(
"weights and data must have the same indices"))
return new{T,N,W,D}(wgt, dat)
end
end
......
......@@ -32,12 +32,10 @@ export
measurements,
reference,
reset,
resume,
set_reference!,
start,
stop,
subimages_bounding_boxes,
suspend
subimages_bounding_boxes
using ArrayTools
using TwoDimensional
......@@ -55,12 +53,10 @@ import ..Tao:
postprocess,
reference,
reset,
resume,
set_reference!,
start,
stop,
subimages_bounding_boxes,
suspend
subimages_bounding_boxes
import Base: Array, convert, copyto!
......@@ -303,22 +299,6 @@ aborts acquisition by the camera associated with wavefront sensor `wfs`.
"""
abort(wfs::AbstractWavefrontSensor) = abort(camera(wfs))
"""
Tao.suspend(wfs, args...; kwds...)
suspends acquisition by the camera associated with wavefront sensor `wfs`.
"""
suspend(wfs::AbstractWavefrontSensor) = suspend(camera(wfs))
"""
Tao.resume(wfs, args...; kwds...)
suspends acquisition by the camera associated with wavefront sensor `wfs`.
"""
resume(wfs::AbstractWavefrontSensor) = resume(camera(wfs))
"""
Tao.reset(wfs) -> wfs
......
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