Channel

class ginga.rv.Channel.Channel(name, fv, settings, datasrc=None)[source]

Bases: Callbacks

Class to manage a channel.

Parameters:
namestr

Name of the channel.

fvGingaShell

The reference viewer shell. This is the central control object for the Ginga Reference Viewer.

settingsSettingGroup

Channel settings.

datasrcDatasrc

Data cache.

Methods Summary

add_history(imname, path[, idx, ...])

Add metadata about a data object to this channel.

add_image(image[, silent, bulk_add])

Add a data object to this channel.

add_image_info(info)

Add a data object's metadata to this channel.

add_image_update(image, info[, update_viewer])

Update metadata about a data object in this channel.

connect_viewer(viewer)

Add a viewer to the set of viewers for this channel.

copy_image_to(imname, channel[, silent])

Copy a data object named imname from this channel to another channel.

get_current_image()

Return the data object being viewed in this channel.

get_image_info(imname)

Return metadata about a data object in this channel.

get_image_names()

Return the list of data items in this channel.

get_image_profile(image)

Get the image profile for data object image.

get_loaded_image(imname)

Get an data object from this channel's memory cache.

move_image_to(imname, channel)

Move a data object named imname from this channel to another channel.

next_image([loop])

Move the channel cursor to the next data object in this channel.

prev_image([loop])

Move the channel cursor to the previous data object in this channel.

refresh_cursor_image()

Refresh the channel viewer to the current item pointed to by the channel cursor.

remove_history(imname)

Remove metadata about a data object in this channel.

remove_image(imname)

Remove a data object named imname from this channel.

switch_image(image)

Switch to data object (image) in this channel.

switch_name(imname)

Switch to data object named by imname in this channel.

update_image_info(image, info)

Update metadata about a data object in this channel.

view_object(dataobj)

View the data object (dataobj) in an appropriate channel viewer.

Methods Documentation

add_history(imname, path, idx=None, image_loader=None, image_future=None)[source]

Add metadata about a data object to this channel.

See add_image_info() for use and additional information.

Parameters:
imnamestr

Unique name (to this channel) of a data object to be added.

pathstr

Path to the data object in storage.

idxint or str (optional, defaults to None)

An optional index into the file, indicating an HDU or logical subunit of the file to load.

image_loaderfunction (optional, defaults to None)

An optional loader for this data item. If None is passed, then defaults to the default loader.

image_futureFuture (optional, default: None)

An optional image future used to reload the image if it is unloaded from memory. If None is passed, then defaults to a future using the default loader.

Returns:
infoBunch

A record of the metadata about the data object.

add_image(image, silent=False, bulk_add=False)[source]

Add a data object to this channel.

Parameters:
imagesubclass of ViewerObjectBase

Data object to be added.

silentbool (optional, defaults to False)

Indicates a “silent add”, in which case the callback is suppressed.

bulk_addbool (optional, defaults to False)

Indicates a “bulk add”, in which the callback is not suppressed, but the channel viewer will not be updated.

add_image_info(info)[source]

Add a data object’s metadata to this channel.

This function is used to add enough metadata about a data object to the channel so that the object can be later loaded and viewed from the channel on demand. To do so, the bunch passed as info should include as a minimum:

  • name: name of object

  • path: file path to object

Optionally, an image loader or image future can be specified. If ommitted, the default loader is used and a future is created using that loader.

Parameters:
infoBunch

Metadata about a data object to be added.

add_image_update(image, info, update_viewer=False)[source]

Update metadata about a data object in this channel.

Parameters:
imagesubclass of ViewerObjectBase

Data object to be updated.

infoBunch

Metadata about the data object to be updated.

update_viewerbool (optional, defaults to False)

If True, will also update the channel viewer if the data object is the same as the most recent object in the channel.

connect_viewer(viewer)[source]

Add a viewer to the set of viewers for this channel.

copy_image_to(imname, channel, silent=False)[source]

Copy a data object named imname from this channel to another channel.

Parameters:
imnamestr

Name of the data in this channel (names are unique per-channel)

channelChannel

Channel to which we will copy the data

get_current_image()[source]

Return the data object being viewed in this channel.

Returns:
imagesubclass of ViewerObjectBase

Data object.

get_image_info(imname)[source]

Return metadata about a data object in this channel.

Parameters:
imnamestr

Name of the data in this channel (names are unique per-channel)

Returns:
infoBunch

Metadata about a data object to be added.

get_image_names()[source]

Return the list of data items in this channel.

get_image_profile(image)[source]

Get the image profile for data object image.

The image profile is not an ICC profile, but rather a set of settings that the image was last viewed with. The settings can be saved and restored when an image is viewed according to the channel preferences under Reset (Viewer) and Rememeber (Image).

get_loaded_image(imname)[source]

Get an data object from this channel’s memory cache.

Parameters:
imnamestr

Key, usually image name and extension.

Returns:
imagesubclass of ViewerObjectBase

Data object.

Raises:
KeyError

If the named data item is not in the memory cache.

move_image_to(imname, channel)[source]

Move a data object named imname from this channel to another channel.

Parameters:
imnamestr

Name of the data in this channel (names are unique per-channel)

channelChannel

Channel to which we will move the data

next_image(loop=True)[source]

Move the channel cursor to the next data object in this channel.

Parameters:
loopbool (optional, defaults to True)

If True, will loop around to the start of the channel’s data objects if the cursor is at the end.

prev_image(loop=True)[source]

Move the channel cursor to the previous data object in this channel.

Parameters:
loopbool (optional, defaults to True)

If True, will loop around to the end of the channel’s data objects if the cursor is at the start.

refresh_cursor_image()[source]

Refresh the channel viewer to the current item pointed to by the channel cursor.

Mostly internal routine used when the channel cursor is changed.

remove_history(imname)[source]

Remove metadata about a data object in this channel.

Parameters:
imnamestr

Unique name (to this channel) of a data object.

remove_image(imname)[source]

Remove a data object named imname from this channel.

Parameters:
imnamestr

Name of the data in this channel (names are unique per-channel)

switch_image(image)[source]

Switch to data object (image) in this channel.

Parameters:
imagesubclass of ViewerObjectBase

Data object in this channel to be viewed in an appropriate channel viewer.

switch_name(imname)[source]

Switch to data object named by imname in this channel.

Parameters:
imnamestr

Unique name of a data object in this channel.

update_image_info(image, info)[source]

Update metadata about a data object in this channel.

Parameters:
imagesubclass of ViewerObjectBase

Data object to be updated.

infoBunch

Metadata about the data object to be updated.

view_object(dataobj)[source]

View the data object (dataobj) in an appropriate channel viewer.

This is a mostly internal method used to view a data object in the channel. See switch_image().

Parameters:
dataobjsubclass of ViewerObjectBase

Data object to be viewed in an appropriate channel viewer.