Package library
Requests to SAOImage/DS9
SAOImageDS9.get
— FunctionSAOImageDS9.get([T, [dims,]] args...)
sends a "get" request to the SAOImage/DS9 server. The request is made of arguments args...
converted into strings and merged with separating spaces. An exception is thrown in case of error.
The returned value depends on the optional arguments T
and dims
:
If neither
T
nordims
are specified, an instance ofXPA.Reply
is returned with at most one answer (see documentation forXPA.get
for more details).If only
T
is specified, it can be:String
to return the answer as a single string;Vector{String}}
orTuple{Vararg{String}}
to return the answer split in words as a vector or as a tuple of strings;T
whereT<:Real
to return a value of typeT
obtained by parsing the textual answer.Tuple{Vararg{T}}
whereT<:Real
to return a value of typeT
obtained by parsing the textual answer;Vector{T}
whereT
is notString
to return the binary contents of the answer as a vector of typeT
;
If both
T
anddims
are specified,T
can be an array type likeArray{S}
orArray{S,N}
anddims
a list ofN
dimensions to retrieve the binary contents of the answer as an array of typeArray{S,N}
.
As a special case:
SAOImageDS9.get(Array; endian=:native) -> arr
yields the contents of current SAOImage/DS9 frame as an array (or as nothing
if the frame is empty). Keyword endian
can be used to specify the byte order of the received values (see SAOImageDS9.byte_order
).
To retrieve the version of the SAOImage/DS9 program:
SAOImageDS9.get(VersionNumber)
See also SAOImageDS9.connect
, SAOImageDS9.set
and XPA.get
.
SAOImageDS9.set
— FunctionSAOImageDS9.set(args...; data=nothing)
sends command and/or data to the SAOImage/DS9 server. The command is made of arguments args...
converted into strings and merged with a separating spaces. Keyword data
can be used to specify the data to send. An exception is thrown in case of error.
As a special case:
SAOImageDS9.set(arr; mask=false, new=false, endian=:native)
set the contents of the current SAOImage/DS9 frame to be array arr
. Keyword new
can be set true to create a new frame for displyaing the array. Keyword endian
can be used to specify the byte order of the values in arr
(see SAOImageDS9.byte_order
.
See also SAOImageDS9.connect
, SAOImageDS9.get
and XPA.set
.
Connection
SAOImageDS9.connect
— FunctionSAOImageDS9.connect(ident="DS9:*") -> apt
set the access point for further SAOImage/DS9 commands. Argument ident
identifies the XPA access point, it can be a template string like "DS9:*"
which is the default value or a regular expression. The returned value is the name of the access point.
To retrieve the name of the current SAOImage/DS9 access point, call the SAOImageDS9.accesspoint
method.
SAOImageDS9.accesspoint
— FunctionSAOImageDS9.accesspoint()
yields the XPA access point which identifies the SAOImage/DS9 server. This access point can be set by calling the SAOImageDS9.connect
method. An empty string is returned if no access point has been chosen. To automatically connect to SAOImage/DS9 if not yet done, you can do:
if SAOImageDS9.accesspoint() == ""; SAOImageDS9.connect(); end
See also SAOImageDS9.connect
and SAOImageDS9.accesspoint
.
Drawing
SAOImageDS9.draw
— FunctionSAOImageDS9.draw(args...; kwds...)
draws something in SAOImage/DS9 application. The operation depends on the type of the arguments.
SAOImageDS9.draw(img; kwds...)
displays image img
(a 2-dimensional Julia array) in SAOImage/DS9. The following keywords are possible:
Keyword
frame
can be used to specify the frame number.Keyword
cmap
can be used to specify the name of the colormap. For instance,cmap="gist_stern"
.Keyword
zoom
can be used to specify the zoom factor.Keywords
min
and/ormax
can be used to specify the scale limits.
SAOImageDS9.draw(pnt; kwds...)
draws pnt
as point(s) in SAOImage/DS9, pnt
is a Point
, an array or a tuple of Point
.
SAOImageDS9.draw(box; kwds...)
draws box
as rectangle(s) in SAOImage/DS9, box
is a BoundingBox
, an array or a tuple of BoundingBox
.
Utilities
SAOImageDS9.bitpix_of
— FunctionSAOImageDS9.bitpix_of(x) -> bp
yields FITS bits-per-pixel (BITPIX) value for x
which can be an array or a type. A value of 0 is returned if x
is not of a supported type.
See also SAOImageDS9.bitpix_to_type
.
SAOImageDS9.bitpix_to_type
— FunctionSAOImageDS9.bitpix_to_type(bp) -> T
yields Julia type corresponding to FITS bits-per-pixel (BITPIX) value bp
. The value Nothing
is returned if bp
is unknown.
See also SAOImageDS9.bitpix_of
.
SAOImageDS9.byte_order
— FunctionSAOImageDS9.byte_order(endian)
yields the byte order for retrieving the elements of a SAOImage/DS9 array. Argument can be one of the strings (or the equivalent symbol): "big"
for most significant byte first, "little"
for least significant byte first or "native"
to yield the byte order of the machine.
See also SAOImageDS9.get
, SAOImageDS9.set
.