Module azcam.tools.ds9display

Contains the Ds9Display class.

Classes

class Ds9Display (tool_id='display', description='ds9 display')

Azcam's interface to SAO's ds9 image display tool.

Args

tool_id
name used to reference the tool (controller, display, …)
description
description of this tool

Ancestors

Instance variables

var description

Inherited from: Display.description

descriptive tool name

var enabled

Inherited from: Display.enabled

1 when tool is enabled

var initialized

Inherited from: Display.initialized

1 when tool has been initialized

var is_reset

Inherited from: Display.is_reset

1 when tool has been reset

var tool_id

Inherited from: Display.tool_id

name used to reference the tool ("controller", "display", …)

var verbosity

Inherited from: Display.verbosity

verbosity for debug, >0 is more verbose

Methods

def define_keywords(self)

Inherited from: Display.define_keywords

Defines and resets keywords.

def delete_all_rois(self)

Delete all ROIs.

:return None:

def delete_keyword(self, keyword: str)

Inherited from: Display.delete_keyword

Delete a keyword.

Args

keyword
keyword
def display(self, image, extension_number=-1)

Display a file in ds9, making a copy so locking does not occur. If specified for an MEF file, only extension_number is displayed.

:param image: a filename or an image object :param int extension_number: FITS extension number of image, -1 for all :return None:

def draw_box(self, xy, size=[51, 51], angle=0)

Draw a box on the display.

:param list xy: [x,y] coords of box to be drawn in image coordinates :param list size: [xwidth,ywidth] of box :param float angle: Angle of box. :return None:

def exam(self, box_size=20, loop=1)

Interactive: Get info around blinking cursor position. print() is allowed here as interactive only.

:param int box_size: Size of examine box :param bool Loop: True for keep looping until q pressed :return list: [KeyPressed,X,Y] or [] in case or error. KeyPressed is a character.

def find_displays(self)

Returns a list of ds9 servers. The returned list is like: ['a00009c:50064', 'a00009c:59734'], which is host:port. If not servers are found, the returned list is empty.

:return list: Display info from XPA

def get_box(self) ‑> List

Get position of the first box in image coords.

:return None:

def get_data(self, roi_number=0)

Returns [Status,[pixel1,pixel2,…]] in display ROI.

:param int roi_number: Number of ROI to get data :return list: [status,[pixel1,pixel2,…]] for ROI

def get_keyword(self, keyword: str) ‑> list

Inherited from: Display.get_keyword

Return a keyword value, its comment string, and type. Comment always returned in double quotes, even if empty.

Args

keyword
name of keyword

def get_keywords(self) ‑> list

Inherited from: Display.get_keywords

Return a list of all keyword names.

Returns

keywords
list of all keywords
def get_last_point(self, coordinate_mode='physical')

Returns coordinates of the last point selected.

:param str coordinate_mode: Coorinate mode, wcs or pysical :return list: Coords of point as [x,y] or [] if none

def get_number_rois(self)

Returns the number of defined ROI's.

:return int: Number of ROI's specified by ds9

def get_regions(self, coordinate_type='image')

Returns a list of regions, each a list of [shape,coords…].

:param str coordinate_type: Type of coords as defined by the display server ['image','detector', 'amplifier'] :param list: List of ROI info in ds9 format

def get_roi_string(self, roi_number=0, coordinate_type='')

Get an ROI descriptor formatted as a string with integer values.

:param int roi_number: roi_number to return :param str coordinate_type:

:return list: List of ROIs

def get_rois(self, roi_number=-1, coordinate_type='default')

Returns the Region Of Interest from the display tool and sets the internal ROI descriptors to the values read. If roi_number is not specified then a list of all defined ROI's is returned.

:param int roi_number: roi number to be returned :param str CoorinateType: Type of coords as defined by the display server ['image','detector', 'amplifier'] :return list: The list of ROIs

def get_stats(self, roi_number=-1)

Returns statistics [status,mean,sdev] of an ROI Also sets display.mean and display.sdev global variables.

:param int roi_number: Number of ROI to get status :return list: [status,mean,sdev] for ROI

def initialize(self)

Initialize Ds9.

:return None:

def read_header(self) ‑> list

Inherited from: Display.read_header

Reads and returns current header data.

Returns

list of header lines
[Header[]]: Each element Header[i] contains the sublist (keyword, value, …
def read_rois(self)

Read and internally save image, detector, and amplifier all Rois.

:return None:

def reset(self) ‑> None

Inherited from: Display.reset

Reset the tool.

def save_fits(self, filename='display.fits')

Save displayed image as a FITS file.

:param str filename: filename of image to be saved. :return None:

def save_image(self, filename='display.png')

Save displayed image as a PNG snapshot.

:param str filename: filename of image to be saved. :return None:

def set_cursor_mode(self, mode='point', clear_rois=0) ‑> None

Set the display cursor mode.

:param str mode: Cursor mode ("point", "crosshair") :param bool clear_rois: True to clear all ROIs

def set_display(self, display_number=-1)

Set the current ds9 display by number.

:param int display_number: Number for display to be used (0->N) :return None:

def set_keyword(self, keyword: str, value: Any, comment: str = 'none', typestring: str = 'none')

Inherited from: Display.set_keyword

Set a keyword value, comment, and type.

Args

keyword
keyword
value
value of keyword
comment
comment string
typestring
one of …
def show_stats(self, roi_number=0)

Interactive: Print stats from an ROI in a real-time loop until q is pressed. print() is allowed here as interactive only.

:param int roi_number: Number of ROI to get status :return list: [status,mean,sdev] for ROI

def start(self, flag=0)

Starts a display process.

def update_header(self)

Inherited from: Display.update_header

Update the header, reading current data. Deletes all keywords if the object is not enabled.

def xpaget(self, command)

Issue xpaget command for ds9. Returns data as a list of space deliminated items.

:param str command: command string for xpaget command :return: Return value

def xpaset(self, command) ‑> None

Issue xpaset command for ds9.

:param str command: command string for xpaset command

def zoom(self, scale=0)

Set display zoom factor relative to current zoom.

:param int Scale: Scale factor for zoom, 0 "to fit" :return None: