ginga_general¶
-
class
imexam.ginga_viewer.
ginga_general
(exam=None, close_on_del=True, logger=None, port=None)[source]¶ Bases:
object
A base class which controls all interactions between the user and the ginga widget.
The ginga contructor creates a new window using the ginga backend.
- Parameters
close_on_del (boolean, optional) – If True, try to close the window when this instance is deleted.
-
exam
¶ - Type
imexamine object
initialize a general ginga viewer object.
- Parameters
exam (imexam object) – This is the imexamine object which contains the examination functions
close_on_del (bool) – If True, the window connection shuts down when the object is deleted
logger (logger object) – Ginga viewers all need a logger, if none is provided it will create one
port (int) – This is used as the communication port for the HTML5 viewer. The user can choose to have multiple windows open at the same time as long as they have different port designations. If no port is specified, this class will choose an open port.
Methods Summary
blink
()Blink multiple frames.
close
()Close the window.
cmap
([color, load, invert, save, filename])Set the color map table to something else, using a defined list of options.
Load a file with contour information.
crosshair
(**kwargs)Control the current position of the crosshair in the frame.
cursor
(**kwargs)Move the cursor in the current frame to the specified image pixel.
Display the fits header for the current data.
embed
([width, height])Embed the current window into the notebook.
frame
()Convenience function to report frames.
get_data
()Return a numpy array of the data displayed in the current frame
Return the filename currently associated with the data
Return more explicit information about the data in current frame.
Return current fits header as string, None if there’s a problem.
Return the AstroImage instance for the data in the viewer
Return the slice tuple that is currently displayed.
Return a dictionary of information about all frames with data
grab
()grid
(*args, **kwargs)Turn the grid display on and off.
hideme
()Lower the display window in prededence.
iscube
()Return whether a cube image is displayed in the current frame.
load_fits
([fname, extver])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.
nancolor
(**kwargs)Set the not-a-number (Nan) color.
panto_image
(x, y)Change to x,y physical image coordinates.
panto_wcs
(x, y[, system])Pan to wcs location coordinates in image
Returns image coordinate postion and key pressed.
rotate
([value])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 displayed 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
([scale])Scale the image intensity, zscale is used as the default.
set_region
(*args, **kwargs)Display a region using the specifications in region_string.
Print the available commands for the selected display.
showme
()Raise the precendence of the display window.
showpix
(*args, **kwargs)Display the pixel value table, closing the window when done.
snapsave
()Save a frame display as a PNG file.
transform
([flipx, flipy, swapxy])Transform the frame.
Return bool if a valid file or array is loaded into the viewer
view
(img)Display numpy image array in current frame
zoom
(zoomlevel)Zoom the image using the specified zoomlevel.
Zoom the image to fit the display.
Methods Documentation
-
cmap
(color=None, load=None, invert=False, save=False, filename='colormap.ds9')[source]¶ Set the color map table to something else, using a defined list of options.
- Parameters
color (string) – color must be set to one of the available color map names
load (string, optional) – set to the filename which is a valid colormap lookup table valid contrast values are from 0 to 10, and valid bias values are from 0 to 1
invert (bool, optional) – invert the colormap
save (bool, optional) – save the current colormap as a file
filename (string, optional) – the name of the file to save the colormap to
-
crosshair
(**kwargs)[source]¶ Control the current position of the crosshair in the frame.
crosshair mode is turned on.
-
cursor
(**kwargs)[source]¶ Move the cursor in the current frame to the specified image pixel.
it will also move selected regions
-
frame
()[source]¶ Convenience function to report frames.
currently only 1 frame is supported per calling object in HTML5 display
-
get_data
()[source]¶ Return a numpy array of the data displayed in the current frame
Notes
This is the data array that the imexam() function from connect() uses for analysis
astropy.io.fits stores data in row-major format. So a 4d image would be [NAXIS4, NAXIS3, NAXIS2, NAXIS1] just the one image is retured in the case of multidimensional data, not the cube
-
grid
(*args, **kwargs)[source]¶ Turn the grid display on and off.
grid can be flushed with many more options
-
load_fits
(fname=None, extver=None)[source]¶ Load fits image to current frame.
- Parameters
fname (string, FITS HDU) – The name of the file to be loaded. You can specify the full extension in the name, such as filename_flt.fits[sci,1] or filename_flt.fits[1]
extver (int, optional) – The extension to load (EXTVER in the header)
Notes
Extname isn’t used here, ginga wants the absolute extension number, not the version number associated with a name
-
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.
-
panto_wcs
(x, y, system='fk5')[source]¶ Pan to wcs location coordinates in image
- Parameters
x (string) – The x location to move to, specified using the given system
y (string) – The y location to move to
system (string) – The reference system that x and y were specified in, they should be understood by DS9
-
rotate
(value=None)[source]¶ Rotate the current frame (in degrees).
the current rotation is printed with no params
- Parameters
value (float [degrees]) – Rotate the current frame {value} degrees If value is None, then the current rotation is printed
-
scale
(scale='zscale')[source]¶ Scale the image intensity, zscale is used as the default.
- Parameters
scale (string) – The scale for ds9 to use, these are set strings of [linear|log|pow|sqrt|squared|asinh|sinh|histequ]
-
snapsave
()[source]¶ Save a frame display as a PNG file.
- Parameters
filename (string) – The name of the output PNG image
-
transform
(flipx=None, flipy=None, swapxy=None)[source]¶ Transform the frame.
- Parameters
flipx (boolean) – if True flip the X axis, if False don’t, if None leave current
flipy (boolean) – if True flip the Y axis, if False don’t, if None leave current
swapxy (boolean) – if True swap the X and Y axes, if False don’t, if None leave current
-
view
(img)[source] Display numpy image array in current frame
- Parameters
img (numpy array) – The array containing data, it will be forced to numpy.array()
Examples
view(np.random.rand(100,100))