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
Tnordimsare specified, an instance ofXPA.Replyis returned with at most one answer (see documentation forXPA.getfor more details).If only
Tis specified, it can be:Stringto 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;TwhereT<:Realto return a value of typeTobtained by parsing the textual answer.Tuple{Vararg{T}}whereT<:Realto return a value of typeTobtained by parsing the textual answer;Vector{T}whereTis notStringto return the binary contents of the answer as a vector of typeT;
If both
Tanddimsare specified,Tcan be an array type likeArray{S}orArray{S,N}anddimsa list ofNdimensions to retrieve the binary contents of the answer as an array of typeArray{S,N}.
As a special case:
SAOImageDS9.get(Array; endian=:native) -> arryields 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).
See also
SAOImageDS9.connect, SAOImageDS9.set and XPA.get.
SAOImageDS9.get(VersionNumber)Retrieve the version of the SAOImage/DS9 program.
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:*") -> aptset 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()
endSee 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::AbstractMatrix; kwds...)displays image img (a 2-dimensional Julia array) in SAOImage/DS9. The following keywords are possible:
Keyword
framecan be used to specify the frame number.Keyword
cmapcan be used to specify the name of the colormap. For instance,cmap="gist_stern".Keyword
zoomcan be used to specify the zoom factor.Keywords
minand/ormaxcan 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) -> bpyields 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) -> Tyields Julia type corresponding to FITS bits-per-pixel (BITPIX) value bp. The type 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.