# Package library

## Requests to SAOImage/DS9

SAOImageDS9.getFunction
SAOImageDS9.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 nor dims are specified, an instance of XPA.Reply is returned with at most one answer (see documentation for XPA.get for more details).

• If only T is specified, it can be:

• String to return the answer as a single string;

• Vector{String}} or Tuple{Vararg{String}} to return the answer split in words as a vector or as a tuple of strings;

• T where T<:Real to return a value of type T obtained by parsing the textual answer.

• Tuple{Vararg{T}} where T<:Real to return a value of type T obtained by parsing the textual answer;

• Vector{T} where T is not String to return the binary contents of the answer as a vector of type T;

• If both T and dims are specified, T can be an array type like Array{S} or Array{S,N} and dims a list of N dimensions to retrieve the binary contents of the answer as an array of type Array{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.

source
SAOImageDS9.setFunction
SAOImageDS9.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.

source

## Connection

SAOImageDS9.connectFunction
SAOImageDS9.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.

source
SAOImageDS9.accesspointFunction
SAOImageDS9.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
source

## Drawing

SAOImageDS9.drawFunction
SAOImageDS9.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/or max 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.

source

## Utilities

SAOImageDS9.byte_orderFunction
SAOImageDS9.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.

source