Connect

class imexam.connect.Connect(target=None, path=None, viewer='ds9', wait_time=10, quit_window=True, port=None)[source]

Bases: object

Connect to a display device to look at and examine images.

The control features below are a basic set that should be available in all display tools.

The class for the display tool should override them and add it’s own extra features.

Parameters:

target: string, optional

the viewer target name or id (default is to start a new instance of a DS9 window)

path : string, optional

absolute path to the viewers executable

viewer: string, optional

The name of the image viewer you want to use, DS9 is the default

wait_time: int, optional

The time to wait for a connection to be eastablished before quitting

Attributes

window: a pointer to an object controls the viewers functions
imexam: a pointer to an object controls the imexamine functions and options

Initialize the imexam control object.

Methods Summary

aimexam([get_name]) Show the current parameters for the ‘a’ key.
alignwcs(**kwargs) Align frames with wcs.
blink(**kwargs) Blink windows if available.
cimexam([get_name]) Show the current parameters for the ‘c’ key.
clear_contour() Clear contours on window if available.
close() Close the window and end connection.
cmap(**kwargs) Set the color map table to something else.
colorbar(**kwargs) Turn the colorbar on the screen on and off.
contour(**kwargs) Show contours on the window.
contour_load(*args) Load contours from a file.
crosshair(**kwargs) Control the current position of the crosshair in the current frame.
cursor(**kwargs) Move the cursor in the current frame to the specified image pixel.
disp_header(**kwargs) Display the header of the current image to a window.
eimexam([get_name]) Show the current parameters for the ‘e’ key, returns dict.
embed(**kwargs)
frame(*args, **kwargs) Move to a different frame.
get_data() Return a numpy array of the data in the current window.
get_data_filename() Return the filename for the data in the current window.
get_frame_info() Return explicit information about the data displayed.
get_header(**kwargs) Return the current fits header as a string.
get_image() Return the full image object, not just the numpy array.
get_viewer_info() Return a dictionary with information about all frames with data.
gimexam([get_name]) Show the current parameters for curve of growth plots, returns dict.
grab() Display a snapshop of the current image in the browser window.
grid(*args, **kwargs) Convenience method to turn the grid on and off.
hideme() Lower the precedence of the display window.
himexam([get_name]) Show the current parameters for ‘h’ key, returns dict.
imexam() Run imexamine loop with user interaction.
jimexam([get_name]) Show the current parameters for 1D fit line plots, returns dict.
kimexam([get_name]) Show the current parameters for 1D fit column plots, returns dict.
limexam([get_name]) Show the current parameters for line plots, returns dict.
load_fits(*args, **kwargs) Convenience function to load fits image to current frame.
load_mef_as_cube(*args, **kwargs) Load a Mult-Extension-Fits image one frame as a cube.
load_mef_as_multi(*args, **kwargs) Load a Mult-Extension-Fits image into multiple frames.
load_region(*args, **kwargs) Load regions from a file which uses standard formatting.
load_rgb(*args, **kwargs) Load three images into a frame, each one for a different color.
make_region(*args, **kwargs) Make an input reg file with [x,y,comment] to a standard reg file.
mark_region_from_array(*args, **kwargs) Mark regions on the viewer with a list of tuples as input.
match(**kwargs) Match all other frames to the current frame.
mimexam([get_name]) Show the current parameters for statistical regions, returns dict.
nancolor(**kwargs) Set the not-a-number (NaN) color.
panto_image(*args, **kwargs) Convenience function to change to x,y images coordinates.
panto_wcs(*args, **kwargs) Pan to wcs coordinates in image.
plotname([filename]) Change or show the default save plotname for imexamine.
readcursor() Return the image coordinate postion and key pressed.
reopen() Reopen a display window closed by the user but not exited.
rimexam([get_name]) Show the current parameters for curve of growth plots, returns dict.
rotate(*args, **kwargs) Rotate the current frame (in degrees).
save_header(*args, **kwargs) Save the header of the current image to a file.
save_regions(*args, **kwargs) Save the regions on the current window to a file.
save_rgb(*args, **kwargs) Save an rgb image frame that is displayed as an MEF fits file.
scale(*args, **kwargs) Scale the image on display.
set_plot_pars([key, item, value]) Set the chosen plot parameter with the provided value.
set_region(*args, **kwargs) Display a region using the specifications in region_string.
setlog([filename, on, level]) Turn on and off logging to a logfile or the screen.
show_window_commands() Print the available commands for the selected display window.
showme() Raise the precedence of the display window.
showpix(*args, **kwargs) Display the pixel value table, close window when done.
snapsave(*args, **kwargs) Create a snap shot of the current window.
timexam([get_name]) Show current parameters for image cutouts,returns dict.
unlearn() Unlearn all the imexam parameters and reset to default.
valid_data_in_viewer() Return True if a valid file or array is loaded.
view(*args, **kwargs) Display numpy or nddata image array.
wimexam([get_name]) Show the current parameters for surface plots, returns dict.
zoom(*args, **kwargs) Zoom to parameter which can be any recognized string.
zoomtofit() Zoom the image to fit the display.

Methods Documentation

aimexam(get_name=False)[source]

Show the current parameters for the ‘a’ key.

Either returns the name of the function associated with the keyname Or it returns the dictionary of plotting parameters for that key

alignwcs(**kwargs)[source]

Align frames with wcs.

Blink windows if available.

cimexam(get_name=False)[source]

Show the current parameters for the ‘c’ key.

Either returns the name of the function associated with the keyname Or it returns the dictionary of plotting parameters for that key

clear_contour()[source]

Clear contours on window if available.

close()[source]

Close the window and end connection.

cmap(**kwargs)[source]

Set the color map table to something else.

Should verify with a defined list of options

colorbar(**kwargs)[source]

Turn the colorbar on the screen on and off.

contour(**kwargs)[source]

Show contours on the window.

contour_load(*args)[source]

Load contours from a file.

crosshair(**kwargs)[source]

Control the current position of the crosshair in the current frame.

crosshair mode is turned on by default

cursor(**kwargs)[source]

Move the cursor in the current frame to the specified image pixel.

it will also move selected regions

disp_header(**kwargs)[source]

Display the header of the current image to a window.

eimexam(get_name=False)[source]

Show the current parameters for the ‘e’ key, returns dict.

embed(**kwargs)[source]
frame(*args, **kwargs)[source]

Move to a different frame.

get_data()[source]

Return a numpy array of the data in the current window.

get_data_filename()[source]

Return the filename for the data in the current window.

get_frame_info()[source]

Return explicit information about the data displayed.

get_header(**kwargs)[source]

Return the current fits header as a string.

None is returned if there’s a problem

get_image()[source]

Return the full image object, not just the numpy array.

get_viewer_info()[source]

Return a dictionary with information about all frames with data.

gimexam(get_name=False)[source]

Show the current parameters for curve of growth plots, returns dict.

Either returns the name of the function associated with the keyname Or it returns the dictionary of plotting parameters for that key

grab()[source]

Display a snapshop of the current image in the browser window.

grid(*args, **kwargs)[source]

Convenience method to turn the grid on and off.

grid can be flushed with many more options

hideme()[source]

Lower the precedence of the display window.

himexam(get_name=False)[source]

Show the current parameters for ‘h’ key, returns dict.

Either returns the name of the function associated with the keyname Or it returns the dictionary of plotting parameters for that key

imexam()[source]

Run imexamine loop with user interaction.

At a minimum it requires a copy of the data array

jimexam(get_name=False)[source]

Show the current parameters for 1D fit line plots, returns dict.

Either returns the name of the function associated with the keyname Or it returns the dictionary of plotting parameters for that key

kimexam(get_name=False)[source]

Show the current parameters for 1D fit column plots, returns dict.

Either returns the name of the function associated with the keyname Or it returns the dictionary of plotting parameters for that key

limexam(get_name=False)[source]

Show the current parameters for line plots, returns dict.

Either returns the name of the function associated with the keyname Or it returns the dictionary of plotting parameters for that key

load_fits(*args, **kwargs)[source]

Convenience function to load fits image to current frame.

load_mef_as_cube(*args, **kwargs)[source]

Load a Mult-Extension-Fits image one frame as a cube.

load_mef_as_multi(*args, **kwargs)[source]

Load a Mult-Extension-Fits image into multiple frames.

load_region(*args, **kwargs)[source]

Load regions from a file which uses standard formatting.

load_rgb(*args, **kwargs)[source]

Load three images into a frame, each one for a different color.

make_region(*args, **kwargs)[source]

Make an input reg file with [x,y,comment] to a standard reg file.

the input file should contains lines with x,y,comment

mark_region_from_array(*args, **kwargs)[source]

Mark regions on the viewer with a list of tuples as input.

match(**kwargs)[source]

Match all other frames to the current frame.

mimexam(get_name=False)[source]

Show the current parameters for statistical regions, returns dict.

Either returns the name of the function associated with the keyname Or it returns the dictionary of plotting parameters for that key

nancolor(**kwargs)[source]

Set the not-a-number (NaN) color.

panto_image(*args, **kwargs)[source]

Convenience function to change to x,y images coordinates.

using ra,dec, x, y in image coord

panto_wcs(*args, **kwargs)[source]

Pan to wcs coordinates in image.

plotname(filename=None)[source]

Change or show the default save plotname for imexamine.

readcursor()[source]

Return the image coordinate postion and key pressed.

in the form of x,y,str with array offset

reopen()[source]

Reopen a display window closed by the user but not exited.

rimexam(get_name=False)[source]

Show the current parameters for curve of growth plots, returns dict.

Either returns the name of the function associated with the keyname Or it returns the dictionary of plotting parameters for that key

rotate(*args, **kwargs)[source]

Rotate the current frame (in degrees).

save_header(*args, **kwargs)[source]

Save the header of the current image to a file.

save_regions(*args, **kwargs)[source]

Save the regions on the current window to a file.

save_rgb(*args, **kwargs)[source]

Save an rgb image frame that is displayed as an MEF fits file.

scale(*args, **kwargs)[source]

Scale the image on display.

The default zscale is the most widely used option

set_plot_pars(key=None, item=None, value=None)[source]

Set the chosen plot parameter with the provided value.

Parameters:

key: String

The value of the option key, should be a single letter or number

item: string

The value of the parameter in the dictionary

value: float, string, int, bool

What the parameters value should be set to

Examples

set_plot_par(‘j’,’func’,’MexicanHat1D’)

where j is the key value during imexam func is the parameter you want to edit MexicanHat1D is the name of the astropy function to use

set_region(*args, **kwargs)[source]

Display a region using the specifications in region_string.

setlog(filename=None, on=True, level=20)[source]

Turn on and off logging to a logfile or the screen.

Parameters:

filename: str, optional

Name of the output file to record log information

on: bool, optional

True by default, turn the logging on or off

level: logging class, optional

set the level for logging messages, turn off screen messages by setting to logging.CRITICAL

show_window_commands()[source]

Print the available commands for the selected display window.

showme()[source]

Raise the precedence of the display window.

showpix(*args, **kwargs)[source]

Display the pixel value table, close window when done.

snapsave(*args, **kwargs)[source]

Create a snap shot of the current window.

save in the specified format. If no format is specified the filename extension is used

timexam(get_name=False)[source]

Show current parameters for image cutouts,returns dict.

Either returns the name of the function associated with the keyname Or it returns the dictionary of plotting parameters for that key

unlearn()[source]

Unlearn all the imexam parameters and reset to default.

valid_data_in_viewer()[source]

Return True if a valid file or array is loaded.

view(*args, **kwargs)[source]

Display numpy or nddata image array.

If an astropy NDData object is passed without a reference to the data one will be added. I haven’t tested this yet for multiarray data

wimexam(get_name=False)[source]

Show the current parameters for surface plots, returns dict.

Either returns the name of the function associated with the keyname Or it returns the dictionary of plotting parameters for that key

zoom(*args, **kwargs)[source]

Zoom to parameter which can be any recognized string.

zoomtofit()[source]

Zoom the image to fit the display.