repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
ejeschke/ginga
ginga/mockw/ImageViewMock.py
ImageViewEvent.key_press_event
def key_press_event(self, widget, event): """ Called when a key is pressed and the window has the focus. Adjust method signature as appropriate for callback. """ # get keyname or keycode and translate to ginga standard # keyname = # keycode = keyname = '' ...
python
def key_press_event(self, widget, event): """ Called when a key is pressed and the window has the focus. Adjust method signature as appropriate for callback. """ # get keyname or keycode and translate to ginga standard # keyname = # keycode = keyname = '' ...
[ "def", "key_press_event", "(", "self", ",", "widget", ",", "event", ")", ":", "keyname", "=", "''", "self", ".", "logger", ".", "debug", "(", "\"key press event, key=%s\"", "%", "(", "keyname", ")", ")", "return", "self", ".", "make_ui_callback", "(", "'ke...
Called when a key is pressed and the window has the focus. Adjust method signature as appropriate for callback.
[ "Called", "when", "a", "key", "is", "pressed", "and", "the", "window", "has", "the", "focus", ".", "Adjust", "method", "signature", "as", "appropriate", "for", "callback", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/mockw/ImageViewMock.py#L309-L319
train
ejeschke/ginga
ginga/mockw/ImageViewMock.py
ImageViewEvent.key_release_event
def key_release_event(self, widget, event): """ Called when a key is released after being pressed. Adjust method signature as appropriate for callback. """ # get keyname or keycode and translate to ginga standard # keyname = # keycode = keyname = '' # sel...
python
def key_release_event(self, widget, event): """ Called when a key is released after being pressed. Adjust method signature as appropriate for callback. """ # get keyname or keycode and translate to ginga standard # keyname = # keycode = keyname = '' # sel...
[ "def", "key_release_event", "(", "self", ",", "widget", ",", "event", ")", ":", "keyname", "=", "''", "self", ".", "logger", ".", "debug", "(", "\"key release event, key=%s\"", "%", "(", "keyname", ")", ")", "return", "self", ".", "make_ui_callback", "(", ...
Called when a key is released after being pressed. Adjust method signature as appropriate for callback.
[ "Called", "when", "a", "key", "is", "released", "after", "being", "pressed", ".", "Adjust", "method", "signature", "as", "appropriate", "for", "callback", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/mockw/ImageViewMock.py#L321-L331
train
ejeschke/ginga
ginga/qtw/ImageViewQt.py
ScrolledView.resizeEvent
def resizeEvent(self, event): """Override from QAbstractScrollArea. Resize the viewer widget when the viewport is resized.""" vp = self.viewport() rect = vp.geometry() x1, y1, x2, y2 = rect.getCoords() width = x2 - x1 + 1 height = y2 - y1 + 1 self.v_w.res...
python
def resizeEvent(self, event): """Override from QAbstractScrollArea. Resize the viewer widget when the viewport is resized.""" vp = self.viewport() rect = vp.geometry() x1, y1, x2, y2 = rect.getCoords() width = x2 - x1 + 1 height = y2 - y1 + 1 self.v_w.res...
[ "def", "resizeEvent", "(", "self", ",", "event", ")", ":", "vp", "=", "self", ".", "viewport", "(", ")", "rect", "=", "vp", ".", "geometry", "(", ")", "x1", ",", "y1", ",", "x2", ",", "y2", "=", "rect", ".", "getCoords", "(", ")", "width", "=",...
Override from QAbstractScrollArea. Resize the viewer widget when the viewport is resized.
[ "Override", "from", "QAbstractScrollArea", ".", "Resize", "the", "viewer", "widget", "when", "the", "viewport", "is", "resized", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/qtw/ImageViewQt.py#L879-L888
train
ejeschke/ginga
ginga/qtw/ImageViewQt.py
ScrolledView.scrollContentsBy
def scrollContentsBy(self, dx, dy): """Override from QAbstractScrollArea. Called when the scroll bars are adjusted by the user. """ if self._adjusting: return self._scrolling = True try: bd = self.viewer.get_bindings() res = bd.calc_pa...
python
def scrollContentsBy(self, dx, dy): """Override from QAbstractScrollArea. Called when the scroll bars are adjusted by the user. """ if self._adjusting: return self._scrolling = True try: bd = self.viewer.get_bindings() res = bd.calc_pa...
[ "def", "scrollContentsBy", "(", "self", ",", "dx", ",", "dy", ")", ":", "if", "self", ".", "_adjusting", ":", "return", "self", ".", "_scrolling", "=", "True", "try", ":", "bd", "=", "self", ".", "viewer", ".", "get_bindings", "(", ")", "res", "=", ...
Override from QAbstractScrollArea. Called when the scroll bars are adjusted by the user.
[ "Override", "from", "QAbstractScrollArea", ".", "Called", "when", "the", "scroll", "bars", "are", "adjusted", "by", "the", "user", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/qtw/ImageViewQt.py#L927-L960
train
ejeschke/ginga
ginga/canvas/transform.py
get_catalog
def get_catalog(): """Returns a catalog of available transforms. These are used to build chains for rendering with different back ends. """ tforms = {} for name, value in list(globals().items()): if name.endswith('Transform'): tforms[name] = value return Bunch.Bunch(tforms,...
python
def get_catalog(): """Returns a catalog of available transforms. These are used to build chains for rendering with different back ends. """ tforms = {} for name, value in list(globals().items()): if name.endswith('Transform'): tforms[name] = value return Bunch.Bunch(tforms,...
[ "def", "get_catalog", "(", ")", ":", "tforms", "=", "{", "}", "for", "name", ",", "value", "in", "list", "(", "globals", "(", ")", ".", "items", "(", ")", ")", ":", "if", "name", ".", "endswith", "(", "'Transform'", ")", ":", "tforms", "[", "name...
Returns a catalog of available transforms. These are used to build chains for rendering with different back ends.
[ "Returns", "a", "catalog", "of", "available", "transforms", ".", "These", "are", "used", "to", "build", "chains", "for", "rendering", "with", "different", "back", "ends", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/transform.py#L553-L562
train
ejeschke/ginga
ginga/util/dp.py
masktorgb
def masktorgb(mask, color='lightgreen', alpha=1.0): """Convert boolean mask to RGB image object for canvas overlay. Parameters ---------- mask : ndarray Boolean mask to overlay. 2D image only. color : str Color name accepted by Ginga. alpha : float Opacity. Unmasked da...
python
def masktorgb(mask, color='lightgreen', alpha=1.0): """Convert boolean mask to RGB image object for canvas overlay. Parameters ---------- mask : ndarray Boolean mask to overlay. 2D image only. color : str Color name accepted by Ginga. alpha : float Opacity. Unmasked da...
[ "def", "masktorgb", "(", "mask", ",", "color", "=", "'lightgreen'", ",", "alpha", "=", "1.0", ")", ":", "mask", "=", "np", ".", "asarray", "(", "mask", ")", "if", "mask", ".", "ndim", "!=", "2", ":", "raise", "ValueError", "(", "'ndim={0} is not suppor...
Convert boolean mask to RGB image object for canvas overlay. Parameters ---------- mask : ndarray Boolean mask to overlay. 2D image only. color : str Color name accepted by Ginga. alpha : float Opacity. Unmasked data are always transparent. Returns ------- rgb...
[ "Convert", "boolean", "mask", "to", "RGB", "image", "object", "for", "canvas", "overlay", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/util/dp.py#L206-L254
train
ejeschke/ginga
ginga/doc/download_doc.py
_find_rtd_version
def _find_rtd_version(): """Find closest RTD doc version.""" vstr = 'latest' try: import ginga from bs4 import BeautifulSoup except ImportError: return vstr # No active doc build before this release, just use latest. if not minversion(ginga, '2.6.0'): return vstr...
python
def _find_rtd_version(): """Find closest RTD doc version.""" vstr = 'latest' try: import ginga from bs4 import BeautifulSoup except ImportError: return vstr # No active doc build before this release, just use latest. if not minversion(ginga, '2.6.0'): return vstr...
[ "def", "_find_rtd_version", "(", ")", ":", "vstr", "=", "'latest'", "try", ":", "import", "ginga", "from", "bs4", "import", "BeautifulSoup", "except", "ImportError", ":", "return", "vstr", "if", "not", "minversion", "(", "ginga", ",", "'2.6.0'", ")", ":", ...
Find closest RTD doc version.
[ "Find", "closest", "RTD", "doc", "version", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/doc/download_doc.py#L15-L52
train
ejeschke/ginga
ginga/doc/download_doc.py
_download_rtd_zip
def _download_rtd_zip(rtd_version=None, **kwargs): """ Download and extract HTML ZIP from RTD to installed doc data path. Download is skipped if content already exists. Parameters ---------- rtd_version : str or `None` RTD version to download; e.g., "latest", "stable", or "v2.6.0". ...
python
def _download_rtd_zip(rtd_version=None, **kwargs): """ Download and extract HTML ZIP from RTD to installed doc data path. Download is skipped if content already exists. Parameters ---------- rtd_version : str or `None` RTD version to download; e.g., "latest", "stable", or "v2.6.0". ...
[ "def", "_download_rtd_zip", "(", "rtd_version", "=", "None", ",", "**", "kwargs", ")", ":", "if", "not", "toolkit", ".", "family", ".", "startswith", "(", "'qt'", ")", ":", "raise", "ValueError", "(", "'Downloaded documentation not compatible with {} '", "'UI tool...
Download and extract HTML ZIP from RTD to installed doc data path. Download is skipped if content already exists. Parameters ---------- rtd_version : str or `None` RTD version to download; e.g., "latest", "stable", or "v2.6.0". If not given, download closest match to software version. ...
[ "Download", "and", "extract", "HTML", "ZIP", "from", "RTD", "to", "installed", "doc", "data", "path", ".", "Download", "is", "skipped", "if", "content", "already", "exists", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/doc/download_doc.py#L55-L115
train
ejeschke/ginga
ginga/doc/download_doc.py
get_doc
def get_doc(logger=None, plugin=None, reporthook=None): """ Return URL to documentation. Attempt download if does not exist. Parameters ---------- logger : obj or `None` Ginga logger. plugin : obj or `None` Plugin object. If given, URL points to plugin doc directly. If ...
python
def get_doc(logger=None, plugin=None, reporthook=None): """ Return URL to documentation. Attempt download if does not exist. Parameters ---------- logger : obj or `None` Ginga logger. plugin : obj or `None` Plugin object. If given, URL points to plugin doc directly. If ...
[ "def", "get_doc", "(", "logger", "=", "None", ",", "plugin", "=", "None", ",", "reporthook", "=", "None", ")", ":", "from", "ginga", ".", "GingaPlugin", "import", "GlobalPlugin", ",", "LocalPlugin", "if", "isinstance", "(", "plugin", ",", "GlobalPlugin", "...
Return URL to documentation. Attempt download if does not exist. Parameters ---------- logger : obj or `None` Ginga logger. plugin : obj or `None` Plugin object. If given, URL points to plugin doc directly. If this function is called from within plugin class, pass ``sel...
[ "Return", "URL", "to", "documentation", ".", "Attempt", "download", "if", "does", "not", "exist", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/doc/download_doc.py#L118-L180
train
ejeschke/ginga
ginga/rv/plugins/SaveImage.py
SaveImage.redo
def redo(self, *args): """Generate listing of images that user can save.""" if not self.gui_up: return mod_only = self.w.modified_only.get_state() treedict = Bunch.caselessDict() self.treeview.clear() self.w.status.set_text('') channel = self.fv.get_...
python
def redo(self, *args): """Generate listing of images that user can save.""" if not self.gui_up: return mod_only = self.w.modified_only.get_state() treedict = Bunch.caselessDict() self.treeview.clear() self.w.status.set_text('') channel = self.fv.get_...
[ "def", "redo", "(", "self", ",", "*", "args", ")", ":", "if", "not", "self", ".", "gui_up", ":", "return", "mod_only", "=", "self", ".", "w", ".", "modified_only", ".", "get_state", "(", ")", "treedict", "=", "Bunch", ".", "caselessDict", "(", ")", ...
Generate listing of images that user can save.
[ "Generate", "listing", "of", "images", "that", "user", "can", "save", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/SaveImage.py#L181-L257
train
ejeschke/ginga
ginga/rv/plugins/SaveImage.py
SaveImage.update_channels
def update_channels(self): """Update the GUI to reflect channels and image listing. """ if not self.gui_up: return self.logger.debug("channel configuration has changed--updating gui") try: channel = self.fv.get_channel(self.chname) except KeyErro...
python
def update_channels(self): """Update the GUI to reflect channels and image listing. """ if not self.gui_up: return self.logger.debug("channel configuration has changed--updating gui") try: channel = self.fv.get_channel(self.chname) except KeyErro...
[ "def", "update_channels", "(", "self", ")", ":", "if", "not", "self", ".", "gui_up", ":", "return", "self", ".", "logger", ".", "debug", "(", "\"channel configuration has changed--updating gui\"", ")", "try", ":", "channel", "=", "self", ".", "fv", ".", "get...
Update the GUI to reflect channels and image listing.
[ "Update", "the", "GUI", "to", "reflect", "channels", "and", "image", "listing", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/SaveImage.py#L259-L293
train
ejeschke/ginga
ginga/rv/plugins/SaveImage.py
SaveImage._format_extname
def _format_extname(self, ext): """Pretty print given extension name and number tuple.""" if ext is None: outs = ext else: outs = '{0},{1}'.format(ext[0], ext[1]) return outs
python
def _format_extname(self, ext): """Pretty print given extension name and number tuple.""" if ext is None: outs = ext else: outs = '{0},{1}'.format(ext[0], ext[1]) return outs
[ "def", "_format_extname", "(", "self", ",", "ext", ")", ":", "if", "ext", "is", "None", ":", "outs", "=", "ext", "else", ":", "outs", "=", "'{0},{1}'", ".", "format", "(", "ext", "[", "0", "]", ",", "ext", "[", "1", "]", ")", "return", "outs" ]
Pretty print given extension name and number tuple.
[ "Pretty", "print", "given", "extension", "name", "and", "number", "tuple", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/SaveImage.py#L300-L306
train
ejeschke/ginga
ginga/rv/plugins/SaveImage.py
SaveImage.browse_outdir
def browse_outdir(self): """Browse for output directory.""" self.dirsel.popup( 'Select directory', self.w.outdir.set_text, initialdir=self.outdir) self.set_outdir()
python
def browse_outdir(self): """Browse for output directory.""" self.dirsel.popup( 'Select directory', self.w.outdir.set_text, initialdir=self.outdir) self.set_outdir()
[ "def", "browse_outdir", "(", "self", ")", ":", "self", ".", "dirsel", ".", "popup", "(", "'Select directory'", ",", "self", ".", "w", ".", "outdir", ".", "set_text", ",", "initialdir", "=", "self", ".", "outdir", ")", "self", ".", "set_outdir", "(", ")...
Browse for output directory.
[ "Browse", "for", "output", "directory", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/SaveImage.py#L308-L312
train
ejeschke/ginga
ginga/rv/plugins/SaveImage.py
SaveImage.set_outdir
def set_outdir(self): """Set output directory.""" dirname = self.w.outdir.get_text() if os.path.isdir(dirname): self.outdir = dirname self.logger.debug('Output directory set to {0}'.format(self.outdir)) else: self.w.outdir.set_text(self.outdir) ...
python
def set_outdir(self): """Set output directory.""" dirname = self.w.outdir.get_text() if os.path.isdir(dirname): self.outdir = dirname self.logger.debug('Output directory set to {0}'.format(self.outdir)) else: self.w.outdir.set_text(self.outdir) ...
[ "def", "set_outdir", "(", "self", ")", ":", "dirname", "=", "self", ".", "w", ".", "outdir", ".", "get_text", "(", ")", "if", "os", ".", "path", ".", "isdir", "(", "dirname", ")", ":", "self", ".", "outdir", "=", "dirname", "self", ".", "logger", ...
Set output directory.
[ "Set", "output", "directory", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/SaveImage.py#L314-L322
train
ejeschke/ginga
ginga/rv/plugins/SaveImage.py
SaveImage.set_suffix
def set_suffix(self): """Set output suffix.""" self.suffix = self.w.suffix.get_text() self.logger.debug('Output suffix set to {0}'.format(self.suffix))
python
def set_suffix(self): """Set output suffix.""" self.suffix = self.w.suffix.get_text() self.logger.debug('Output suffix set to {0}'.format(self.suffix))
[ "def", "set_suffix", "(", "self", ")", ":", "self", ".", "suffix", "=", "self", ".", "w", ".", "suffix", ".", "get_text", "(", ")", "self", ".", "logger", ".", "debug", "(", "'Output suffix set to {0}'", ".", "format", "(", "self", ".", "suffix", ")", ...
Set output suffix.
[ "Set", "output", "suffix", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/SaveImage.py#L324-L327
train
ejeschke/ginga
ginga/rv/plugins/SaveImage.py
SaveImage._write_history
def _write_history(self, pfx, hdu, linechar=60, indentchar=2): """Write change history to given HDU header. Limit each HISTORY line to given number of characters. Subsequent lines of the same history will be indented. """ channel = self.fv.get_channel(self.chname) if chan...
python
def _write_history(self, pfx, hdu, linechar=60, indentchar=2): """Write change history to given HDU header. Limit each HISTORY line to given number of characters. Subsequent lines of the same history will be indented. """ channel = self.fv.get_channel(self.chname) if chan...
[ "def", "_write_history", "(", "self", ",", "pfx", ",", "hdu", ",", "linechar", "=", "60", ",", "indentchar", "=", "2", ")", ":", "channel", "=", "self", ".", "fv", ".", "get_channel", "(", "self", ".", "chname", ")", "if", "channel", "is", "None", ...
Write change history to given HDU header. Limit each HISTORY line to given number of characters. Subsequent lines of the same history will be indented.
[ "Write", "change", "history", "to", "given", "HDU", "header", ".", "Limit", "each", "HISTORY", "line", "to", "given", "number", "of", "characters", ".", "Subsequent", "lines", "of", "the", "same", "history", "will", "be", "indented", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/SaveImage.py#L329-L370
train
ejeschke/ginga
ginga/rv/plugins/SaveImage.py
SaveImage._write_header
def _write_header(self, image, hdu): """Write header from image object to given HDU.""" hduhdr = hdu.header # Ginga image header object for the given extension only. # Cannot use get_header() because that might also return PRI hdr. ghdr = image.metadata['header'] for ke...
python
def _write_header(self, image, hdu): """Write header from image object to given HDU.""" hduhdr = hdu.header # Ginga image header object for the given extension only. # Cannot use get_header() because that might also return PRI hdr. ghdr = image.metadata['header'] for ke...
[ "def", "_write_header", "(", "self", ",", "image", ",", "hdu", ")", ":", "hduhdr", "=", "hdu", ".", "header", "ghdr", "=", "image", ".", "metadata", "[", "'header'", "]", "for", "key", "in", "ghdr", ":", "if", "key", ".", "upper", "(", ")", "==", ...
Write header from image object to given HDU.
[ "Write", "header", "from", "image", "object", "to", "given", "HDU", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/SaveImage.py#L372-L393
train
ejeschke/ginga
ginga/rv/plugins/SaveImage.py
SaveImage._write_mef
def _write_mef(self, key, extlist, outfile): """Write out regular multi-extension FITS data.""" channel = self.fv.get_channel(self.chname) with fits.open(outfile, mode='update') as pf: # Process each modified data extension for idx in extlist: k = '{0}[{1}...
python
def _write_mef(self, key, extlist, outfile): """Write out regular multi-extension FITS data.""" channel = self.fv.get_channel(self.chname) with fits.open(outfile, mode='update') as pf: # Process each modified data extension for idx in extlist: k = '{0}[{1}...
[ "def", "_write_mef", "(", "self", ",", "key", ",", "extlist", ",", "outfile", ")", ":", "channel", "=", "self", ".", "fv", ".", "get_channel", "(", "self", ".", "chname", ")", "with", "fits", ".", "open", "(", "outfile", ",", "mode", "=", "'update'",...
Write out regular multi-extension FITS data.
[ "Write", "out", "regular", "multi", "-", "extension", "FITS", "data", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/SaveImage.py#L424-L438
train
ejeschke/ginga
ginga/rv/plugins/SaveImage.py
SaveImage.toggle_save_cb
def toggle_save_cb(self, w, res_dict): """Only enable saving if something is selected.""" if len(res_dict) > 0: self.w.save.set_enabled(True) else: self.w.save.set_enabled(False)
python
def toggle_save_cb(self, w, res_dict): """Only enable saving if something is selected.""" if len(res_dict) > 0: self.w.save.set_enabled(True) else: self.w.save.set_enabled(False)
[ "def", "toggle_save_cb", "(", "self", ",", "w", ",", "res_dict", ")", ":", "if", "len", "(", "res_dict", ")", ">", "0", ":", "self", ".", "w", ".", "save", ".", "set_enabled", "(", "True", ")", "else", ":", "self", ".", "w", ".", "save", ".", "...
Only enable saving if something is selected.
[ "Only", "enable", "saving", "if", "something", "is", "selected", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/SaveImage.py#L440-L445
train
ejeschke/ginga
ginga/rv/plugins/SaveImage.py
SaveImage.save_images
def save_images(self): """Save selected images. This uses Astropy FITS package to save the outputs no matter what user chose to load the images. """ res_dict = self.treeview.get_selected() clobber = self.settings.get('clobber', False) self.treeview.clear_selecti...
python
def save_images(self): """Save selected images. This uses Astropy FITS package to save the outputs no matter what user chose to load the images. """ res_dict = self.treeview.get_selected() clobber = self.settings.get('clobber', False) self.treeview.clear_selecti...
[ "def", "save_images", "(", "self", ")", ":", "res_dict", "=", "self", ".", "treeview", ".", "get_selected", "(", ")", "clobber", "=", "self", ".", "settings", ".", "get", "(", "'clobber'", ",", "False", ")", "self", ".", "treeview", ".", "clear_selection...
Save selected images. This uses Astropy FITS package to save the outputs no matter what user chose to load the images.
[ "Save", "selected", "images", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/SaveImage.py#L447-L496
train
ejeschke/ginga
ginga/web/pgw/PgHelp.py
font_info
def font_info(font_str): """Extract font information from a font string, such as supplied to the 'font' argument to a widget. """ vals = font_str.split(';') point_size, style, weight = 8, 'normal', 'normal' family = vals[0] if len(vals) > 1: style = vals[1] if len(vals) > 2: ...
python
def font_info(font_str): """Extract font information from a font string, such as supplied to the 'font' argument to a widget. """ vals = font_str.split(';') point_size, style, weight = 8, 'normal', 'normal' family = vals[0] if len(vals) > 1: style = vals[1] if len(vals) > 2: ...
[ "def", "font_info", "(", "font_str", ")", ":", "vals", "=", "font_str", ".", "split", "(", "';'", ")", "point_size", ",", "style", ",", "weight", "=", "8", ",", "'normal'", ",", "'normal'", "family", "=", "vals", "[", "0", "]", "if", "len", "(", "v...
Extract font information from a font string, such as supplied to the 'font' argument to a widget.
[ "Extract", "font", "information", "from", "a", "font", "string", "such", "as", "supplied", "to", "the", "font", "argument", "to", "a", "widget", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/web/pgw/PgHelp.py#L259-L277
train
ejeschke/ginga
ginga/canvas/CanvasObject.py
CanvasObjectBase.get_points
def get_points(self): """Get the set of points that is used to draw the object. Points are returned in *data* coordinates. """ if hasattr(self, 'points'): points = self.crdmap.to_data(self.points) else: points = [] return points
python
def get_points(self): """Get the set of points that is used to draw the object. Points are returned in *data* coordinates. """ if hasattr(self, 'points'): points = self.crdmap.to_data(self.points) else: points = [] return points
[ "def", "get_points", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'points'", ")", ":", "points", "=", "self", ".", "crdmap", ".", "to_data", "(", "self", ".", "points", ")", "else", ":", "points", "=", "[", "]", "return", "points" ]
Get the set of points that is used to draw the object. Points are returned in *data* coordinates.
[ "Get", "the", "set", "of", "points", "that", "is", "used", "to", "draw", "the", "object", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/CanvasObject.py#L226-L235
train
ejeschke/ginga
ginga/canvas/CanvasObject.py
CanvasObjectBase.get_data_points
def get_data_points(self, points=None): """Points returned are in data coordinates.""" if points is None: points = self.points points = self.crdmap.to_data(points) return points
python
def get_data_points(self, points=None): """Points returned are in data coordinates.""" if points is None: points = self.points points = self.crdmap.to_data(points) return points
[ "def", "get_data_points", "(", "self", ",", "points", "=", "None", ")", ":", "if", "points", "is", "None", ":", "points", "=", "self", ".", "points", "points", "=", "self", ".", "crdmap", ".", "to_data", "(", "points", ")", "return", "points" ]
Points returned are in data coordinates.
[ "Points", "returned", "are", "in", "data", "coordinates", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/CanvasObject.py#L237-L242
train
ejeschke/ginga
ginga/canvas/CanvasObject.py
CanvasObjectBase.set_data_points
def set_data_points(self, points): """ Input `points` must be in data coordinates, will be converted to the coordinate space of the object and stored. """ self.points = np.asarray(self.crdmap.data_to(points))
python
def set_data_points(self, points): """ Input `points` must be in data coordinates, will be converted to the coordinate space of the object and stored. """ self.points = np.asarray(self.crdmap.data_to(points))
[ "def", "set_data_points", "(", "self", ",", "points", ")", ":", "self", ".", "points", "=", "np", ".", "asarray", "(", "self", ".", "crdmap", ".", "data_to", "(", "points", ")", ")" ]
Input `points` must be in data coordinates, will be converted to the coordinate space of the object and stored.
[ "Input", "points", "must", "be", "in", "data", "coordinates", "will", "be", "converted", "to", "the", "coordinate", "space", "of", "the", "object", "and", "stored", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/CanvasObject.py#L244-L249
train
ejeschke/ginga
ginga/canvas/CanvasObject.py
CanvasObjectBase.convert_mapper
def convert_mapper(self, tomap): """ Converts our object from using one coordinate map to another. NOTE: In some cases this only approximately preserves the equivalent point values when transforming between coordinate spaces. """ frommap = self.crdmap if ...
python
def convert_mapper(self, tomap): """ Converts our object from using one coordinate map to another. NOTE: In some cases this only approximately preserves the equivalent point values when transforming between coordinate spaces. """ frommap = self.crdmap if ...
[ "def", "convert_mapper", "(", "self", ",", "tomap", ")", ":", "frommap", "=", "self", ".", "crdmap", "if", "frommap", "==", "tomap", ":", "return", "if", "hasattr", "(", "self", ",", "'radius'", ")", ":", "x0", ",", "y0", "=", "frommap", ".", "offset...
Converts our object from using one coordinate map to another. NOTE: In some cases this only approximately preserves the equivalent point values when transforming between coordinate spaces.
[ "Converts", "our", "object", "from", "using", "one", "coordinate", "map", "to", "another", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/CanvasObject.py#L341-L376
train
ejeschke/ginga
ginga/canvas/CanvasObject.py
CanvasObjectBase.point_within_radius
def point_within_radius(self, points, pt, canvas_radius, scales=(1.0, 1.0)): """Points `points` and point `pt` are in data coordinates. Return True for points within the circle defined by a center at point `pt` and within canvas_radius. """ scale_x, sc...
python
def point_within_radius(self, points, pt, canvas_radius, scales=(1.0, 1.0)): """Points `points` and point `pt` are in data coordinates. Return True for points within the circle defined by a center at point `pt` and within canvas_radius. """ scale_x, sc...
[ "def", "point_within_radius", "(", "self", ",", "points", ",", "pt", ",", "canvas_radius", ",", "scales", "=", "(", "1.0", ",", "1.0", ")", ")", ":", "scale_x", ",", "scale_y", "=", "scales", "x", ",", "y", "=", "pt", "a_arr", ",", "b_arr", "=", "n...
Points `points` and point `pt` are in data coordinates. Return True for points within the circle defined by a center at point `pt` and within canvas_radius.
[ "Points", "points", "and", "point", "pt", "are", "in", "data", "coordinates", ".", "Return", "True", "for", "points", "within", "the", "circle", "defined", "by", "a", "center", "at", "point", "pt", "and", "within", "canvas_radius", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/CanvasObject.py#L378-L391
train
ejeschke/ginga
ginga/canvas/CanvasObject.py
CanvasObjectBase.within_radius
def within_radius(self, viewer, points, pt, canvas_radius): """Points `points` and point `pt` are in data coordinates. Return True for points within the circle defined by a center at point `pt` and within canvas_radius. The distance between points is scaled by the canvas scale. "...
python
def within_radius(self, viewer, points, pt, canvas_radius): """Points `points` and point `pt` are in data coordinates. Return True for points within the circle defined by a center at point `pt` and within canvas_radius. The distance between points is scaled by the canvas scale. "...
[ "def", "within_radius", "(", "self", ",", "viewer", ",", "points", ",", "pt", ",", "canvas_radius", ")", ":", "scales", "=", "viewer", ".", "get_scale_xy", "(", ")", "return", "self", ".", "point_within_radius", "(", "points", ",", "pt", ",", "canvas_radiu...
Points `points` and point `pt` are in data coordinates. Return True for points within the circle defined by a center at point `pt` and within canvas_radius. The distance between points is scaled by the canvas scale.
[ "Points", "points", "and", "point", "pt", "are", "in", "data", "coordinates", ".", "Return", "True", "for", "points", "within", "the", "circle", "defined", "by", "a", "center", "at", "point", "pt", "and", "within", "canvas_radius", ".", "The", "distance", ...
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/CanvasObject.py#L393-L401
train
ejeschke/ginga
ginga/canvas/CanvasObject.py
CanvasObjectBase.get_pt
def get_pt(self, viewer, points, pt, canvas_radius=None): """Takes an array of points `points` and a target point `pt`. Returns the first index of the point that is within the radius of the target point. If none of the points are within the radius, returns None. """ if c...
python
def get_pt(self, viewer, points, pt, canvas_radius=None): """Takes an array of points `points` and a target point `pt`. Returns the first index of the point that is within the radius of the target point. If none of the points are within the radius, returns None. """ if c...
[ "def", "get_pt", "(", "self", ",", "viewer", ",", "points", ",", "pt", ",", "canvas_radius", "=", "None", ")", ":", "if", "canvas_radius", "is", "None", ":", "canvas_radius", "=", "self", ".", "cap_radius", "if", "hasattr", "(", "self", ",", "'rot_deg'",...
Takes an array of points `points` and a target point `pt`. Returns the first index of the point that is within the radius of the target point. If none of the points are within the radius, returns None.
[ "Takes", "an", "array", "of", "points", "points", "and", "a", "target", "point", "pt", ".", "Returns", "the", "first", "index", "of", "the", "point", "that", "is", "within", "the", "radius", "of", "the", "target", "point", ".", "If", "none", "of", "the...
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/CanvasObject.py#L403-L418
train
ejeschke/ginga
ginga/canvas/CanvasObject.py
CanvasObjectBase.within_line
def within_line(self, viewer, points, p_start, p_stop, canvas_radius): """Points `points` and line endpoints `p_start`, `p_stop` are in data coordinates. Return True for points within the line defined by a line from p_start to p_end and within `canvas_radius`. The distance betwee...
python
def within_line(self, viewer, points, p_start, p_stop, canvas_radius): """Points `points` and line endpoints `p_start`, `p_stop` are in data coordinates. Return True for points within the line defined by a line from p_start to p_end and within `canvas_radius`. The distance betwee...
[ "def", "within_line", "(", "self", ",", "viewer", ",", "points", ",", "p_start", ",", "p_stop", ",", "canvas_radius", ")", ":", "scale_x", ",", "scale_y", "=", "viewer", ".", "get_scale_xy", "(", ")", "new_radius", "=", "canvas_radius", "*", "1.0", "/", ...
Points `points` and line endpoints `p_start`, `p_stop` are in data coordinates. Return True for points within the line defined by a line from p_start to p_end and within `canvas_radius`. The distance between points is scaled by the viewer's canvas scale.
[ "Points", "points", "and", "line", "endpoints", "p_start", "p_stop", "are", "in", "data", "coordinates", ".", "Return", "True", "for", "points", "within", "the", "line", "defined", "by", "a", "line", "from", "p_start", "to", "p_end", "and", "within", "canvas...
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/CanvasObject.py#L439-L449
train
ejeschke/ginga
ginga/canvas/CanvasObject.py
CanvasObjectBase.get_bbox
def get_bbox(self, points=None): """ Get bounding box of this object. Returns ------- (p1, p2, p3, p4): a 4-tuple of the points in data coordinates, beginning with the lower-left and proceeding counter-clockwise. """ if points is None: x1, y1,...
python
def get_bbox(self, points=None): """ Get bounding box of this object. Returns ------- (p1, p2, p3, p4): a 4-tuple of the points in data coordinates, beginning with the lower-left and proceeding counter-clockwise. """ if points is None: x1, y1,...
[ "def", "get_bbox", "(", "self", ",", "points", "=", "None", ")", ":", "if", "points", "is", "None", ":", "x1", ",", "y1", ",", "x2", ",", "y2", "=", "self", ".", "get_llur", "(", ")", "return", "(", "(", "x1", ",", "y1", ")", ",", "(", "x1", ...
Get bounding box of this object. Returns ------- (p1, p2, p3, p4): a 4-tuple of the points in data coordinates, beginning with the lower-left and proceeding counter-clockwise.
[ "Get", "bounding", "box", "of", "this", "object", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/CanvasObject.py#L503-L516
train
ejeschke/ginga
ginga/misc/Timer.py
TimerFactory.set
def set(self, time_sec, callback_fn, *args, **kwdargs): """Convenience function to create and set a timer. Equivalent to: timer = timer_factory.timer() timer.set_callback('expired', callback_fn, *args, **kwdargs) timer.set(time_sec) """ timer = self.t...
python
def set(self, time_sec, callback_fn, *args, **kwdargs): """Convenience function to create and set a timer. Equivalent to: timer = timer_factory.timer() timer.set_callback('expired', callback_fn, *args, **kwdargs) timer.set(time_sec) """ timer = self.t...
[ "def", "set", "(", "self", ",", "time_sec", ",", "callback_fn", ",", "*", "args", ",", "**", "kwdargs", ")", ":", "timer", "=", "self", ".", "timer", "(", ")", "timer", ".", "set_callback", "(", "'expired'", ",", "callback_fn", ",", "*", "args", ",",...
Convenience function to create and set a timer. Equivalent to: timer = timer_factory.timer() timer.set_callback('expired', callback_fn, *args, **kwdargs) timer.set(time_sec)
[ "Convenience", "function", "to", "create", "and", "set", "a", "timer", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Timer.py#L29-L40
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_window_size
def set_window_size(self, width, height): """Report the size of the window to display the image. **Callbacks** Will call any callbacks registered for the ``'configure'`` event. Callbacks should have a method signature of:: (viewer, width, height, ...) .. note:: ...
python
def set_window_size(self, width, height): """Report the size of the window to display the image. **Callbacks** Will call any callbacks registered for the ``'configure'`` event. Callbacks should have a method signature of:: (viewer, width, height, ...) .. note:: ...
[ "def", "set_window_size", "(", "self", ",", "width", ",", "height", ")", ":", "self", ".", "_imgwin_wd", "=", "int", "(", "width", ")", "self", ".", "_imgwin_ht", "=", "int", "(", "height", ")", "self", ".", "_ctr_x", "=", "width", "//", "2", "self",...
Report the size of the window to display the image. **Callbacks** Will call any callbacks registered for the ``'configure'`` event. Callbacks should have a method signature of:: (viewer, width, height, ...) .. note:: This is called by the subclass with ``widt...
[ "Report", "the", "size", "of", "the", "window", "to", "display", "the", "image", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L353-L384
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_renderer
def set_renderer(self, renderer): """Set and initialize the renderer used by this instance. """ self.renderer = renderer width, height = self.get_window_size() if width > 0 and height > 0: renderer.resize((width, height))
python
def set_renderer(self, renderer): """Set and initialize the renderer used by this instance. """ self.renderer = renderer width, height = self.get_window_size() if width > 0 and height > 0: renderer.resize((width, height))
[ "def", "set_renderer", "(", "self", ",", "renderer", ")", ":", "self", ".", "renderer", "=", "renderer", "width", ",", "height", "=", "self", ".", "get_window_size", "(", ")", "if", "width", ">", "0", "and", "height", ">", "0", ":", "renderer", ".", ...
Set and initialize the renderer used by this instance.
[ "Set", "and", "initialize", "the", "renderer", "used", "by", "this", "instance", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L470-L476
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_canvas
def set_canvas(self, canvas, private_canvas=None): """Set the canvas object. Parameters ---------- canvas : `~ginga.canvas.types.layer.DrawingCanvas` Canvas object. private_canvas : `~ginga.canvas.types.layer.DrawingCanvas` or `None` Private canvas objec...
python
def set_canvas(self, canvas, private_canvas=None): """Set the canvas object. Parameters ---------- canvas : `~ginga.canvas.types.layer.DrawingCanvas` Canvas object. private_canvas : `~ginga.canvas.types.layer.DrawingCanvas` or `None` Private canvas objec...
[ "def", "set_canvas", "(", "self", ",", "canvas", ",", "private_canvas", "=", "None", ")", ":", "self", ".", "canvas", "=", "canvas", "canvas", ".", "initialize", "(", "None", ",", "self", ",", "self", ".", "logger", ")", "canvas", ".", "add_callback", ...
Set the canvas object. Parameters ---------- canvas : `~ginga.canvas.types.layer.DrawingCanvas` Canvas object. private_canvas : `~ginga.canvas.types.layer.DrawingCanvas` or `None` Private canvas object. If not given, this is the same as ``canvas``.
[ "Set", "the", "canvas", "object", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L489-L528
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.initialize_private_canvas
def initialize_private_canvas(self, private_canvas): """Initialize the private canvas used by this instance. """ if self.t_.get('show_pan_position', False): self.show_pan_mark(True) if self.t_.get('show_focus_indicator', False): self.show_focus_indicator(True)
python
def initialize_private_canvas(self, private_canvas): """Initialize the private canvas used by this instance. """ if self.t_.get('show_pan_position', False): self.show_pan_mark(True) if self.t_.get('show_focus_indicator', False): self.show_focus_indicator(True)
[ "def", "initialize_private_canvas", "(", "self", ",", "private_canvas", ")", ":", "if", "self", ".", "t_", ".", "get", "(", "'show_pan_position'", ",", "False", ")", ":", "self", ".", "show_pan_mark", "(", "True", ")", "if", "self", ".", "t_", ".", "get"...
Initialize the private canvas used by this instance.
[ "Initialize", "the", "private", "canvas", "used", "by", "this", "instance", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L541-L548
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_rgbmap
def set_rgbmap(self, rgbmap): """Set RGB map object used by this instance. It controls how the values in the image are mapped to color. Parameters ---------- rgbmap : `~ginga.RGBMap.RGBMapper` RGB map. """ self.rgbmap = rgbmap t_ = rgbmap.get...
python
def set_rgbmap(self, rgbmap): """Set RGB map object used by this instance. It controls how the values in the image are mapped to color. Parameters ---------- rgbmap : `~ginga.RGBMap.RGBMapper` RGB map. """ self.rgbmap = rgbmap t_ = rgbmap.get...
[ "def", "set_rgbmap", "(", "self", ",", "rgbmap", ")", ":", "self", ".", "rgbmap", "=", "rgbmap", "t_", "=", "rgbmap", ".", "get_settings", "(", ")", "t_", ".", "share_settings", "(", "self", ".", "t_", ",", "keylist", "=", "rgbmap", ".", "settings_keys...
Set RGB map object used by this instance. It controls how the values in the image are mapped to color. Parameters ---------- rgbmap : `~ginga.RGBMap.RGBMapper` RGB map.
[ "Set", "RGB", "map", "object", "used", "by", "this", "instance", ".", "It", "controls", "how", "the", "values", "in", "the", "image", "are", "mapped", "to", "color", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L684-L698
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_image
def get_image(self): """Get the image currently being displayed. Returns ------- image : `~ginga.AstroImage.AstroImage` or `~ginga.RGBImage.RGBImage` Image object. """ if self._imgobj is not None: # quick optomization return self._img...
python
def get_image(self): """Get the image currently being displayed. Returns ------- image : `~ginga.AstroImage.AstroImage` or `~ginga.RGBImage.RGBImage` Image object. """ if self._imgobj is not None: # quick optomization return self._img...
[ "def", "get_image", "(", "self", ")", ":", "if", "self", ".", "_imgobj", "is", "not", "None", ":", "return", "self", ".", "_imgobj", ".", "get_image", "(", ")", "canvas_img", "=", "self", ".", "get_canvas_image", "(", ")", "return", "canvas_img", ".", ...
Get the image currently being displayed. Returns ------- image : `~ginga.AstroImage.AstroImage` or `~ginga.RGBImage.RGBImage` Image object.
[ "Get", "the", "image", "currently", "being", "displayed", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L700-L714
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_canvas_image
def get_canvas_image(self): """Get canvas image object. Returns ------- imgobj : `~ginga.canvas.types.image.NormImage` Normalized image sitting on the canvas. """ if self._imgobj is not None: return self._imgobj try: # See if...
python
def get_canvas_image(self): """Get canvas image object. Returns ------- imgobj : `~ginga.canvas.types.image.NormImage` Normalized image sitting on the canvas. """ if self._imgobj is not None: return self._imgobj try: # See if...
[ "def", "get_canvas_image", "(", "self", ")", ":", "if", "self", ".", "_imgobj", "is", "not", "None", ":", "return", "self", ".", "_imgobj", "try", ":", "self", ".", "_imgobj", "=", "self", ".", "canvas", ".", "get_object_by_tag", "(", "self", ".", "_ca...
Get canvas image object. Returns ------- imgobj : `~ginga.canvas.types.image.NormImage` Normalized image sitting on the canvas.
[ "Get", "canvas", "image", "object", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L716-L749
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_image
def set_image(self, image, add_to_canvas=True): """Set an image to be displayed. If there is no error, the ``'image-unset'`` and ``'image-set'`` callbacks will be invoked. Parameters ---------- image : `~ginga.AstroImage.AstroImage` or `~ginga.RGBImage.RGBImage` ...
python
def set_image(self, image, add_to_canvas=True): """Set an image to be displayed. If there is no error, the ``'image-unset'`` and ``'image-set'`` callbacks will be invoked. Parameters ---------- image : `~ginga.AstroImage.AstroImage` or `~ginga.RGBImage.RGBImage` ...
[ "def", "set_image", "(", "self", ",", "image", ",", "add_to_canvas", "=", "True", ")", ":", "if", "not", "isinstance", "(", "image", ",", "BaseImage", ".", "BaseImage", ")", ":", "raise", "ValueError", "(", "\"Wrong type of object to load: %s\"", "%", "(", "...
Set an image to be displayed. If there is no error, the ``'image-unset'`` and ``'image-set'`` callbacks will be invoked. Parameters ---------- image : `~ginga.AstroImage.AstroImage` or `~ginga.RGBImage.RGBImage` Image object. add_to_canvas : bool ...
[ "Set", "an", "image", "to", "be", "displayed", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L751-L789
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.save_profile
def save_profile(self, **params): """Save the given parameters into profile settings. Parameters ---------- params : dict Keywords and values to be saved. """ image = self.get_image() if (image is None): return profile = image.ge...
python
def save_profile(self, **params): """Save the given parameters into profile settings. Parameters ---------- params : dict Keywords and values to be saved. """ image = self.get_image() if (image is None): return profile = image.ge...
[ "def", "save_profile", "(", "self", ",", "**", "params", ")", ":", "image", "=", "self", ".", "get_image", "(", ")", "if", "(", "image", "is", "None", ")", ":", "return", "profile", "=", "image", ".", "get", "(", "'profile'", ",", "None", ")", "if"...
Save the given parameters into profile settings. Parameters ---------- params : dict Keywords and values to be saved.
[ "Save", "the", "given", "parameters", "into", "profile", "settings", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L909-L931
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_data
def set_data(self, data, metadata=None): """Set an image to be displayed by providing raw data. This is a convenience method for first constructing an image with `~ginga.AstroImage.AstroImage` and then calling :meth:`set_image`. Parameters ---------- data : ndarray ...
python
def set_data(self, data, metadata=None): """Set an image to be displayed by providing raw data. This is a convenience method for first constructing an image with `~ginga.AstroImage.AstroImage` and then calling :meth:`set_image`. Parameters ---------- data : ndarray ...
[ "def", "set_data", "(", "self", ",", "data", ",", "metadata", "=", "None", ")", ":", "image", "=", "AstroImage", ".", "AstroImage", "(", "data", ",", "metadata", "=", "metadata", ",", "logger", "=", "self", ".", "logger", ")", "self", ".", "set_image",...
Set an image to be displayed by providing raw data. This is a convenience method for first constructing an image with `~ginga.AstroImage.AstroImage` and then calling :meth:`set_image`. Parameters ---------- data : ndarray This should be at least a 2D Numpy array. ...
[ "Set", "an", "image", "to", "be", "displayed", "by", "providing", "raw", "data", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L984-L1001
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.clear
def clear(self): """Clear the displayed image.""" self._imgobj = None try: # See if there is an image on the canvas self.canvas.delete_object_by_tag(self._canvas_img_tag) self.redraw() except KeyError: pass
python
def clear(self): """Clear the displayed image.""" self._imgobj = None try: # See if there is an image on the canvas self.canvas.delete_object_by_tag(self._canvas_img_tag) self.redraw() except KeyError: pass
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_imgobj", "=", "None", "try", ":", "self", ".", "canvas", ".", "delete_object_by_tag", "(", "self", ".", "_canvas_img_tag", ")", "self", ".", "redraw", "(", ")", "except", "KeyError", ":", "pass" ]
Clear the displayed image.
[ "Clear", "the", "displayed", "image", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1003-L1011
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.redraw
def redraw(self, whence=0): """Redraw the canvas. Parameters ---------- whence See :meth:`get_rgb_object`. """ with self._defer_lock: whence = min(self._defer_whence, whence) if not self.defer_redraw: if self._hold_re...
python
def redraw(self, whence=0): """Redraw the canvas. Parameters ---------- whence See :meth:`get_rgb_object`. """ with self._defer_lock: whence = min(self._defer_whence, whence) if not self.defer_redraw: if self._hold_re...
[ "def", "redraw", "(", "self", ",", "whence", "=", "0", ")", ":", "with", "self", ".", "_defer_lock", ":", "whence", "=", "min", "(", "self", ".", "_defer_whence", ",", "whence", ")", "if", "not", "self", ".", "defer_redraw", ":", "if", "self", ".", ...
Redraw the canvas. Parameters ---------- whence See :meth:`get_rgb_object`.
[ "Redraw", "the", "canvas", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1025-L1075
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.canvas_changed_cb
def canvas_changed_cb(self, canvas, whence): """Handle callback for when canvas has changed.""" self.logger.debug("root canvas changed, whence=%d" % (whence)) # special check for whether image changed out from under us in # a shared canvas scenario try: # See if ther...
python
def canvas_changed_cb(self, canvas, whence): """Handle callback for when canvas has changed.""" self.logger.debug("root canvas changed, whence=%d" % (whence)) # special check for whether image changed out from under us in # a shared canvas scenario try: # See if ther...
[ "def", "canvas_changed_cb", "(", "self", ",", "canvas", ",", "whence", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"root canvas changed, whence=%d\"", "%", "(", "whence", ")", ")", "try", ":", "canvas_img", "=", "self", ".", "canvas", ".", "get_o...
Handle callback for when canvas has changed.
[ "Handle", "callback", "for", "when", "canvas", "has", "changed", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1088-L1106
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.delayed_redraw
def delayed_redraw(self): """Handle delayed redrawing of the canvas.""" # This is the optimized redraw method with self._defer_lock: # pick up the lowest necessary level of redrawing whence = self._defer_whence self._defer_whence = self._defer_whence_reset ...
python
def delayed_redraw(self): """Handle delayed redrawing of the canvas.""" # This is the optimized redraw method with self._defer_lock: # pick up the lowest necessary level of redrawing whence = self._defer_whence self._defer_whence = self._defer_whence_reset ...
[ "def", "delayed_redraw", "(", "self", ")", ":", "with", "self", ".", "_defer_lock", ":", "whence", "=", "self", ".", "_defer_whence", "self", ".", "_defer_whence", "=", "self", ".", "_defer_whence_reset", "flag", "=", "self", ".", "_defer_flag", "self", ".",...
Handle delayed redrawing of the canvas.
[ "Handle", "delayed", "redrawing", "of", "the", "canvas", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1108-L1121
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_redraw_lag
def set_redraw_lag(self, lag_sec): """Set lag time for redrawing the canvas. Parameters ---------- lag_sec : float Number of seconds to wait. """ self.defer_redraw = (lag_sec > 0.0) if self.defer_redraw: self.defer_lagtime = lag_sec
python
def set_redraw_lag(self, lag_sec): """Set lag time for redrawing the canvas. Parameters ---------- lag_sec : float Number of seconds to wait. """ self.defer_redraw = (lag_sec > 0.0) if self.defer_redraw: self.defer_lagtime = lag_sec
[ "def", "set_redraw_lag", "(", "self", ",", "lag_sec", ")", ":", "self", ".", "defer_redraw", "=", "(", "lag_sec", ">", "0.0", ")", "if", "self", ".", "defer_redraw", ":", "self", ".", "defer_lagtime", "=", "lag_sec" ]
Set lag time for redrawing the canvas. Parameters ---------- lag_sec : float Number of seconds to wait.
[ "Set", "lag", "time", "for", "redrawing", "the", "canvas", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1123-L1134
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_refresh_rate
def set_refresh_rate(self, fps): """Set the refresh rate for redrawing the canvas at a timed interval. Parameters ---------- fps : float Desired rate in frames per second. """ self.rf_fps = fps self.rf_rate = 1.0 / self.rf_fps #self.set_redra...
python
def set_refresh_rate(self, fps): """Set the refresh rate for redrawing the canvas at a timed interval. Parameters ---------- fps : float Desired rate in frames per second. """ self.rf_fps = fps self.rf_rate = 1.0 / self.rf_fps #self.set_redra...
[ "def", "set_refresh_rate", "(", "self", ",", "fps", ")", ":", "self", ".", "rf_fps", "=", "fps", "self", ".", "rf_rate", "=", "1.0", "/", "self", ".", "rf_fps", "self", ".", "logger", ".", "info", "(", "\"set a refresh rate of %.2f fps\"", "%", "(", "sel...
Set the refresh rate for redrawing the canvas at a timed interval. Parameters ---------- fps : float Desired rate in frames per second.
[ "Set", "the", "refresh", "rate", "for", "redrawing", "the", "canvas", "at", "a", "timed", "interval", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1136-L1148
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.start_refresh
def start_refresh(self): """Start redrawing the canvas at the previously set timed interval. """ self.logger.debug("starting timed refresh interval") self.rf_flags['done'] = False self.rf_draw_count = 0 self.rf_timer_count = 0 self.rf_late_count = 0 self.r...
python
def start_refresh(self): """Start redrawing the canvas at the previously set timed interval. """ self.logger.debug("starting timed refresh interval") self.rf_flags['done'] = False self.rf_draw_count = 0 self.rf_timer_count = 0 self.rf_late_count = 0 self.r...
[ "def", "start_refresh", "(", "self", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"starting timed refresh interval\"", ")", "self", ".", "rf_flags", "[", "'done'", "]", "=", "False", "self", ".", "rf_draw_count", "=", "0", "self", ".", "rf_timer_cou...
Start redrawing the canvas at the previously set timed interval.
[ "Start", "redrawing", "the", "canvas", "at", "the", "previously", "set", "timed", "interval", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1150-L1165
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.stop_refresh
def stop_refresh(self): """Stop redrawing the canvas at the previously set timed interval. """ self.logger.debug("stopping timed refresh") self.rf_flags['done'] = True self.rf_timer.clear()
python
def stop_refresh(self): """Stop redrawing the canvas at the previously set timed interval. """ self.logger.debug("stopping timed refresh") self.rf_flags['done'] = True self.rf_timer.clear()
[ "def", "stop_refresh", "(", "self", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"stopping timed refresh\"", ")", "self", ".", "rf_flags", "[", "'done'", "]", "=", "True", "self", ".", "rf_timer", ".", "clear", "(", ")" ]
Stop redrawing the canvas at the previously set timed interval.
[ "Stop", "redrawing", "the", "canvas", "at", "the", "previously", "set", "timed", "interval", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1167-L1172
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_refresh_stats
def get_refresh_stats(self): """Return the measured statistics for timed refresh intervals. Returns ------- stats : float The measured rate of actual back end updates in frames per second. """ if self.rf_draw_count == 0: fps = 0.0 else: ...
python
def get_refresh_stats(self): """Return the measured statistics for timed refresh intervals. Returns ------- stats : float The measured rate of actual back end updates in frames per second. """ if self.rf_draw_count == 0: fps = 0.0 else: ...
[ "def", "get_refresh_stats", "(", "self", ")", ":", "if", "self", ".", "rf_draw_count", "==", "0", ":", "fps", "=", "0.0", "else", ":", "interval", "=", "time", ".", "time", "(", ")", "-", "self", ".", "rf_start_time", "fps", "=", "self", ".", "rf_dra...
Return the measured statistics for timed refresh intervals. Returns ------- stats : float The measured rate of actual back end updates in frames per second.
[ "Return", "the", "measured", "statistics", "for", "timed", "refresh", "intervals", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1174-L1203
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.refresh_timer_cb
def refresh_timer_cb(self, timer, flags): """Refresh timer callback. This callback will normally only be called internally. Parameters ---------- timer : a Ginga GUI timer A GUI-based Ginga timer flags : dict-like A set of flags controlling the t...
python
def refresh_timer_cb(self, timer, flags): """Refresh timer callback. This callback will normally only be called internally. Parameters ---------- timer : a Ginga GUI timer A GUI-based Ginga timer flags : dict-like A set of flags controlling the t...
[ "def", "refresh_timer_cb", "(", "self", ",", "timer", ",", "flags", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "if", "flags", ".", "get", "(", "'done'", ",", "False", ")", ":", "return", "deadline", "=", "self", ".", "rf_deadline", "...
Refresh timer callback. This callback will normally only be called internally. Parameters ---------- timer : a Ginga GUI timer A GUI-based Ginga timer flags : dict-like A set of flags controlling the timer
[ "Refresh", "timer", "callback", ".", "This", "callback", "will", "normally", "only", "be", "called", "internally", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1205-L1261
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.redraw_now
def redraw_now(self, whence=0): """Redraw the displayed image. Parameters ---------- whence See :meth:`get_rgb_object`. """ try: time_start = time.time() self.redraw_data(whence=whence) # finally update the window drawabl...
python
def redraw_now(self, whence=0): """Redraw the displayed image. Parameters ---------- whence See :meth:`get_rgb_object`. """ try: time_start = time.time() self.redraw_data(whence=whence) # finally update the window drawabl...
[ "def", "redraw_now", "(", "self", ",", "whence", "=", "0", ")", ":", "try", ":", "time_start", "=", "time", ".", "time", "(", ")", "self", ".", "redraw_data", "(", "whence", "=", "whence", ")", "self", ".", "update_image", "(", ")", "time_done", "=",...
Redraw the displayed image. Parameters ---------- whence See :meth:`get_rgb_object`.
[ "Redraw", "the", "displayed", "image", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1263-L1296
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.redraw_data
def redraw_data(self, whence=0): """Render image from RGB map and redraw private canvas. .. note:: Do not call this method unless you are implementing a subclass. Parameters ---------- whence See :meth:`get_rgb_object`. """ if not self....
python
def redraw_data(self, whence=0): """Render image from RGB map and redraw private canvas. .. note:: Do not call this method unless you are implementing a subclass. Parameters ---------- whence See :meth:`get_rgb_object`. """ if not self....
[ "def", "redraw_data", "(", "self", ",", "whence", "=", "0", ")", ":", "if", "not", "self", ".", "_imgwin_set", ":", "return", "if", "not", "self", ".", "_self_scaling", ":", "rgbobj", "=", "self", ".", "get_rgb_object", "(", "whence", "=", "whence", ")...
Render image from RGB map and redraw private canvas. .. note:: Do not call this method unless you are implementing a subclass. Parameters ---------- whence See :meth:`get_rgb_object`.
[ "Render", "image", "from", "RGB", "map", "and", "redraw", "private", "canvas", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1298-L1324
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.check_cursor_location
def check_cursor_location(self): """Check whether the data location of the last known position of the cursor has changed. If so, issue a callback. """ # Check whether cursor data position has changed relative # to previous value data_x, data_y = self.get_data_xy(self.las...
python
def check_cursor_location(self): """Check whether the data location of the last known position of the cursor has changed. If so, issue a callback. """ # Check whether cursor data position has changed relative # to previous value data_x, data_y = self.get_data_xy(self.las...
[ "def", "check_cursor_location", "(", "self", ")", ":", "data_x", ",", "data_y", "=", "self", ".", "get_data_xy", "(", "self", ".", "last_win_x", ",", "self", ".", "last_win_y", ")", "if", "(", "data_x", "!=", "self", ".", "last_data_x", "or", "data_y", "...
Check whether the data location of the last known position of the cursor has changed. If so, issue a callback.
[ "Check", "whether", "the", "data", "location", "of", "the", "last", "known", "position", "of", "the", "cursor", "has", "changed", ".", "If", "so", "issue", "a", "callback", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1326-L1346
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.getwin_array
def getwin_array(self, order='RGB', alpha=1.0, dtype=None): """Get Numpy data array for display window. Parameters ---------- order : str The desired order of RGB color layers. alpha : float Opacity. dtype : numpy dtype Numpy data ty...
python
def getwin_array(self, order='RGB', alpha=1.0, dtype=None): """Get Numpy data array for display window. Parameters ---------- order : str The desired order of RGB color layers. alpha : float Opacity. dtype : numpy dtype Numpy data ty...
[ "def", "getwin_array", "(", "self", ",", "order", "=", "'RGB'", ",", "alpha", "=", "1.0", ",", "dtype", "=", "None", ")", ":", "order", "=", "order", ".", "upper", "(", ")", "depth", "=", "len", "(", "order", ")", "if", "dtype", "is", "None", ":"...
Get Numpy data array for display window. Parameters ---------- order : str The desired order of RGB color layers. alpha : float Opacity. dtype : numpy dtype Numpy data type desired; defaults to rgb mapper setting. Returns --...
[ "Get", "Numpy", "data", "array", "for", "display", "window", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1348-L1393
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_datarect
def get_datarect(self): """Get the approximate bounding box of the displayed image. Returns ------- rect : tuple Bounding box in data coordinates in the form of ``(x1, y1, x2, y2)``. """ x1, y1, x2, y2 = self._org_x1, self._org_y1, self._org_x2, ...
python
def get_datarect(self): """Get the approximate bounding box of the displayed image. Returns ------- rect : tuple Bounding box in data coordinates in the form of ``(x1, y1, x2, y2)``. """ x1, y1, x2, y2 = self._org_x1, self._org_y1, self._org_x2, ...
[ "def", "get_datarect", "(", "self", ")", ":", "x1", ",", "y1", ",", "x2", ",", "y2", "=", "self", ".", "_org_x1", ",", "self", ".", "_org_y1", ",", "self", ".", "_org_x2", ",", "self", ".", "_org_y2", "return", "(", "x1", ",", "y1", ",", "x2", ...
Get the approximate bounding box of the displayed image. Returns ------- rect : tuple Bounding box in data coordinates in the form of ``(x1, y1, x2, y2)``.
[ "Get", "the", "approximate", "bounding", "box", "of", "the", "displayed", "image", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1407-L1418
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_limits
def get_limits(self, coord='data'): """Get the bounding box of the viewer extents. Returns ------- limits : tuple Bounding box in coordinates of type `coord` in the form of ``(ll_pt, ur_pt)``. """ limits = self.t_['limits'] if limits ...
python
def get_limits(self, coord='data'): """Get the bounding box of the viewer extents. Returns ------- limits : tuple Bounding box in coordinates of type `coord` in the form of ``(ll_pt, ur_pt)``. """ limits = self.t_['limits'] if limits ...
[ "def", "get_limits", "(", "self", ",", "coord", "=", "'data'", ")", ":", "limits", "=", "self", ".", "t_", "[", "'limits'", "]", "if", "limits", "is", "None", ":", "image", "=", "self", ".", "get_image", "(", ")", "if", "image", "is", "not", "None"...
Get the bounding box of the viewer extents. Returns ------- limits : tuple Bounding box in coordinates of type `coord` in the form of ``(ll_pt, ur_pt)``.
[ "Get", "the", "bounding", "box", "of", "the", "viewer", "extents", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1420-L1456
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_limits
def set_limits(self, limits, coord='data'): """Set the bounding box of the viewer extents. Parameters ---------- limits : tuple or None A tuple setting the extents of the viewer in the form of ``(ll_pt, ur_pt)``. """ if limits is not None: ...
python
def set_limits(self, limits, coord='data'): """Set the bounding box of the viewer extents. Parameters ---------- limits : tuple or None A tuple setting the extents of the viewer in the form of ``(ll_pt, ur_pt)``. """ if limits is not None: ...
[ "def", "set_limits", "(", "self", ",", "limits", ",", "coord", "=", "'data'", ")", ":", "if", "limits", "is", "not", "None", ":", "if", "len", "(", "limits", ")", "!=", "2", ":", "raise", "ValueError", "(", "\"limits takes a 2 tuple, or None\"", ")", "cr...
Set the bounding box of the viewer extents. Parameters ---------- limits : tuple or None A tuple setting the extents of the viewer in the form of ``(ll_pt, ur_pt)``.
[ "Set", "the", "bounding", "box", "of", "the", "viewer", "extents", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1458-L1475
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_rgb_object
def get_rgb_object(self, whence=0): """Create and return RGB slices representing the data that should be rendered at the current zoom level and pan settings. Parameters ---------- whence : {0, 1, 2, 3} Optimization flag that reduces the time to create the...
python
def get_rgb_object(self, whence=0): """Create and return RGB slices representing the data that should be rendered at the current zoom level and pan settings. Parameters ---------- whence : {0, 1, 2, 3} Optimization flag that reduces the time to create the...
[ "def", "get_rgb_object", "(", "self", ",", "whence", "=", "0", ")", ":", "time_start", "=", "t2", "=", "t3", "=", "time", ".", "time", "(", ")", "win_wd", ",", "win_ht", "=", "self", ".", "get_window_size", "(", ")", "order", "=", "self", ".", "get...
Create and return RGB slices representing the data that should be rendered at the current zoom level and pan settings. Parameters ---------- whence : {0, 1, 2, 3} Optimization flag that reduces the time to create the RGB object by only recalculating what is neces...
[ "Create", "and", "return", "RGB", "slices", "representing", "the", "data", "that", "should", "be", "rendered", "at", "the", "current", "zoom", "level", "and", "pan", "settings", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1482-L1559
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase._reset_bbox
def _reset_bbox(self): """This function should only be called internally. It resets the viewers bounding box based on changes to pan or scale. """ scale_x, scale_y = self.get_scale_xy() pan_x, pan_y = self.get_pan(coord='data')[:2] win_wd, win_ht = self.get_window_size()...
python
def _reset_bbox(self): """This function should only be called internally. It resets the viewers bounding box based on changes to pan or scale. """ scale_x, scale_y = self.get_scale_xy() pan_x, pan_y = self.get_pan(coord='data')[:2] win_wd, win_ht = self.get_window_size()...
[ "def", "_reset_bbox", "(", "self", ")", ":", "scale_x", ",", "scale_y", "=", "self", ".", "get_scale_xy", "(", ")", "pan_x", ",", "pan_y", "=", "self", ".", "get_pan", "(", "coord", "=", "'data'", ")", "[", ":", "2", "]", "win_wd", ",", "win_ht", "...
This function should only be called internally. It resets the viewers bounding box based on changes to pan or scale.
[ "This", "function", "should", "only", "be", "called", "internally", ".", "It", "resets", "the", "viewers", "bounding", "box", "based", "on", "changes", "to", "pan", "or", "scale", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1623-L1636
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.overlay_images
def overlay_images(self, canvas, data, whence=0.0): """Overlay data from any canvas image objects. Parameters ---------- canvas : `~ginga.canvas.types.layer.DrawingCanvas` Canvas containing possible images to overlay. data : ndarray Output array on which...
python
def overlay_images(self, canvas, data, whence=0.0): """Overlay data from any canvas image objects. Parameters ---------- canvas : `~ginga.canvas.types.layer.DrawingCanvas` Canvas containing possible images to overlay. data : ndarray Output array on which...
[ "def", "overlay_images", "(", "self", ",", "canvas", ",", "data", ",", "whence", "=", "0.0", ")", ":", "if", "not", "hasattr", "(", "canvas", ",", "'objects'", ")", ":", "return", "for", "obj", "in", "canvas", ".", "get_objects", "(", ")", ":", "if",...
Overlay data from any canvas image objects. Parameters ---------- canvas : `~ginga.canvas.types.layer.DrawingCanvas` Canvas containing possible images to overlay. data : ndarray Output array on which to overlay image data. whence See :meth:...
[ "Overlay", "data", "from", "any", "canvas", "image", "objects", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1712-L1735
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.convert_via_profile
def convert_via_profile(self, data_np, order, inprof_name, outprof_name): """Convert the given RGB data from the working ICC profile to the output profile in-place. Parameters ---------- data_np : ndarray RGB image data to be displayed. order : str ...
python
def convert_via_profile(self, data_np, order, inprof_name, outprof_name): """Convert the given RGB data from the working ICC profile to the output profile in-place. Parameters ---------- data_np : ndarray RGB image data to be displayed. order : str ...
[ "def", "convert_via_profile", "(", "self", ",", "data_np", ",", "order", ",", "inprof_name", ",", "outprof_name", ")", ":", "to_intent", "=", "self", ".", "t_", ".", "get", "(", "'icc_output_intent'", ",", "'perceptual'", ")", "proofprof_name", "=", "self", ...
Convert the given RGB data from the working ICC profile to the output profile in-place. Parameters ---------- data_np : ndarray RGB image data to be displayed. order : str Order of channels in the data (e.g. "BGRA"). inprof_name, outprof_name : ...
[ "Convert", "the", "given", "RGB", "data", "from", "the", "working", "ICC", "profile", "to", "the", "output", "profile", "in", "-", "place", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1737-L1782
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_data_xy
def get_data_xy(self, win_x, win_y, center=None): """Get the closest coordinates in the data array to those reported on the window. Parameters ---------- win_x, win_y : float or ndarray Window coordinates. center : bool If `True`, then the coordi...
python
def get_data_xy(self, win_x, win_y, center=None): """Get the closest coordinates in the data array to those reported on the window. Parameters ---------- win_x, win_y : float or ndarray Window coordinates. center : bool If `True`, then the coordi...
[ "def", "get_data_xy", "(", "self", ",", "win_x", ",", "win_y", ",", "center", "=", "None", ")", ":", "if", "center", "is", "not", "None", ":", "self", ".", "logger", ".", "warning", "(", "\"`center` keyword is ignored and will be deprecated\"", ")", "arr_pts",...
Get the closest coordinates in the data array to those reported on the window. Parameters ---------- win_x, win_y : float or ndarray Window coordinates. center : bool If `True`, then the coordinates are mapped such that the pixel is centered ...
[ "Get", "the", "closest", "coordinates", "in", "the", "data", "array", "to", "those", "reported", "on", "the", "window", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1791-L1816
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.offset_to_window
def offset_to_window(self, off_x, off_y): """Convert data offset to window coordinates. Parameters ---------- off_x, off_y : float or ndarray Data offsets. Returns ------- coord : tuple Offset in window coordinates in the form of ``(x, y)...
python
def offset_to_window(self, off_x, off_y): """Convert data offset to window coordinates. Parameters ---------- off_x, off_y : float or ndarray Data offsets. Returns ------- coord : tuple Offset in window coordinates in the form of ``(x, y)...
[ "def", "offset_to_window", "(", "self", ",", "off_x", ",", "off_y", ")", ":", "arr_pts", "=", "np", ".", "asarray", "(", "(", "off_x", ",", "off_y", ")", ")", ".", "T", "return", "self", ".", "tform", "[", "'cartesian_to_native'", "]", ".", "to_", "(...
Convert data offset to window coordinates. Parameters ---------- off_x, off_y : float or ndarray Data offsets. Returns ------- coord : tuple Offset in window coordinates in the form of ``(x, y)``.
[ "Convert", "data", "offset", "to", "window", "coordinates", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1866-L1881
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_pan_rect
def get_pan_rect(self): """Get the coordinates in the actual data corresponding to the area shown in the display for the current zoom level and pan. Returns ------- points : list Coordinates in the form of ``[(x0, y0), (x1, y1), (x2, y2), (x3, y3)]`` ...
python
def get_pan_rect(self): """Get the coordinates in the actual data corresponding to the area shown in the display for the current zoom level and pan. Returns ------- points : list Coordinates in the form of ``[(x0, y0), (x1, y1), (x2, y2), (x3, y3)]`` ...
[ "def", "get_pan_rect", "(", "self", ")", ":", "wd", ",", "ht", "=", "self", ".", "get_window_size", "(", ")", "win_pts", "=", "np", ".", "asarray", "(", "[", "(", "0", ",", "0", ")", ",", "(", "wd", ",", "0", ")", ",", "(", "wd", ",", "ht", ...
Get the coordinates in the actual data corresponding to the area shown in the display for the current zoom level and pan. Returns ------- points : list Coordinates in the form of ``[(x0, y0), (x1, y1), (x2, y2), (x3, y3)]`` from lower-left to lower-ri...
[ "Get", "the", "coordinates", "in", "the", "actual", "data", "corresponding", "to", "the", "area", "shown", "in", "the", "display", "for", "the", "current", "zoom", "level", "and", "pan", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1921-L1937
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_data
def get_data(self, data_x, data_y): """Get the data value at the given position. Indices are zero-based, as in Numpy. Parameters ---------- data_x, data_y : int Data indices for X and Y, respectively. Returns ------- value Data sl...
python
def get_data(self, data_x, data_y): """Get the data value at the given position. Indices are zero-based, as in Numpy. Parameters ---------- data_x, data_y : int Data indices for X and Y, respectively. Returns ------- value Data sl...
[ "def", "get_data", "(", "self", ",", "data_x", ",", "data_y", ")", ":", "image", "=", "self", ".", "get_image", "(", ")", "if", "image", "is", "not", "None", ":", "return", "image", ".", "get_data_xy", "(", "data_x", ",", "data_y", ")", "raise", "Ima...
Get the data value at the given position. Indices are zero-based, as in Numpy. Parameters ---------- data_x, data_y : int Data indices for X and Y, respectively. Returns ------- value Data slice. Raises ------ gin...
[ "Get", "the", "data", "value", "at", "the", "given", "position", ".", "Indices", "are", "zero", "-", "based", "as", "in", "Numpy", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1939-L1963
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_pixel_distance
def get_pixel_distance(self, x1, y1, x2, y2): """Calculate distance between the given pixel positions. Parameters ---------- x1, y1, x2, y2 : number Pixel coordinates. Returns ------- dist : float Rounded distance. """ dx...
python
def get_pixel_distance(self, x1, y1, x2, y2): """Calculate distance between the given pixel positions. Parameters ---------- x1, y1, x2, y2 : number Pixel coordinates. Returns ------- dist : float Rounded distance. """ dx...
[ "def", "get_pixel_distance", "(", "self", ",", "x1", ",", "y1", ",", "x2", ",", "y2", ")", ":", "dx", "=", "abs", "(", "x2", "-", "x1", ")", "dy", "=", "abs", "(", "y2", "-", "y1", ")", "dist", "=", "np", ".", "sqrt", "(", "dx", "*", "dx", ...
Calculate distance between the given pixel positions. Parameters ---------- x1, y1, x2, y2 : number Pixel coordinates. Returns ------- dist : float Rounded distance.
[ "Calculate", "distance", "between", "the", "given", "pixel", "positions", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1965-L1983
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase._sanity_check_scale
def _sanity_check_scale(self, scale_x, scale_y): """Do a sanity check on the proposed scale vs. window size. Raises an exception if there will be a problem. """ win_wd, win_ht = self.get_window_size() if (win_wd <= 0) or (win_ht <= 0): raise ImageViewError("window siz...
python
def _sanity_check_scale(self, scale_x, scale_y): """Do a sanity check on the proposed scale vs. window size. Raises an exception if there will be a problem. """ win_wd, win_ht = self.get_window_size() if (win_wd <= 0) or (win_ht <= 0): raise ImageViewError("window siz...
[ "def", "_sanity_check_scale", "(", "self", ",", "scale_x", ",", "scale_y", ")", ":", "win_wd", ",", "win_ht", "=", "self", ".", "get_window_size", "(", ")", "if", "(", "win_wd", "<=", "0", ")", "or", "(", "win_ht", "<=", "0", ")", ":", "raise", "Imag...
Do a sanity check on the proposed scale vs. window size. Raises an exception if there will be a problem.
[ "Do", "a", "sanity", "check", "on", "the", "proposed", "scale", "vs", ".", "window", "size", ".", "Raises", "an", "exception", "if", "there", "will", "be", "a", "problem", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1985-L2004
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.scale_cb
def scale_cb(self, setting, value): """Handle callback related to image scaling.""" zoomlevel = self.zoom.calc_level(value) self.t_.set(zoomlevel=zoomlevel) self.redraw(whence=0)
python
def scale_cb(self, setting, value): """Handle callback related to image scaling.""" zoomlevel = self.zoom.calc_level(value) self.t_.set(zoomlevel=zoomlevel) self.redraw(whence=0)
[ "def", "scale_cb", "(", "self", ",", "setting", ",", "value", ")", ":", "zoomlevel", "=", "self", ".", "zoom", ".", "calc_level", "(", "value", ")", "self", ".", "t_", ".", "set", "(", "zoomlevel", "=", "zoomlevel", ")", "self", ".", "redraw", "(", ...
Handle callback related to image scaling.
[ "Handle", "callback", "related", "to", "image", "scaling", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2088-L2093
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_scale_base_xy
def set_scale_base_xy(self, scale_x_base, scale_y_base): """Set stretch factors. Parameters ---------- scale_x_base, scale_y_base : float Stretch factors for X and Y, respectively. """ self.t_.set(scale_x_base=scale_x_base, scale_y_base=scale_y_base)
python
def set_scale_base_xy(self, scale_x_base, scale_y_base): """Set stretch factors. Parameters ---------- scale_x_base, scale_y_base : float Stretch factors for X and Y, respectively. """ self.t_.set(scale_x_base=scale_x_base, scale_y_base=scale_y_base)
[ "def", "set_scale_base_xy", "(", "self", ",", "scale_x_base", ",", "scale_y_base", ")", ":", "self", ".", "t_", ".", "set", "(", "scale_x_base", "=", "scale_x_base", ",", "scale_y_base", "=", "scale_y_base", ")" ]
Set stretch factors. Parameters ---------- scale_x_base, scale_y_base : float Stretch factors for X and Y, respectively.
[ "Set", "stretch", "factors", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2148-L2157
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_scale_text
def get_scale_text(self): """Report current scaling in human-readable format. Returns ------- text : str ``'<num> x'`` if enlarged, or ``'1/<num> x'`` if shrunken. """ scalefactor = self.get_scale_max() if scalefactor >= 1.0: text = '%.2f...
python
def get_scale_text(self): """Report current scaling in human-readable format. Returns ------- text : str ``'<num> x'`` if enlarged, or ``'1/<num> x'`` if shrunken. """ scalefactor = self.get_scale_max() if scalefactor >= 1.0: text = '%.2f...
[ "def", "get_scale_text", "(", "self", ")", ":", "scalefactor", "=", "self", ".", "get_scale_max", "(", ")", "if", "scalefactor", ">=", "1.0", ":", "text", "=", "'%.2fx'", "%", "(", "scalefactor", ")", "else", ":", "text", "=", "'1/%.2fx'", "%", "(", "1...
Report current scaling in human-readable format. Returns ------- text : str ``'<num> x'`` if enlarged, or ``'1/<num> x'`` if shrunken.
[ "Report", "current", "scaling", "in", "human", "-", "readable", "format", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2159-L2173
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_zoom_algorithm
def set_zoom_algorithm(self, name): """Set zoom algorithm. Parameters ---------- name : str Name of a zoom algorithm to use. """ name = name.lower() alg_names = list(zoom.get_zoom_alg_names()) if name not in alg_names: raise Image...
python
def set_zoom_algorithm(self, name): """Set zoom algorithm. Parameters ---------- name : str Name of a zoom algorithm to use. """ name = name.lower() alg_names = list(zoom.get_zoom_alg_names()) if name not in alg_names: raise Image...
[ "def", "set_zoom_algorithm", "(", "self", ",", "name", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "alg_names", "=", "list", "(", "zoom", ".", "get_zoom_alg_names", "(", ")", ")", "if", "name", "not", "in", "alg_names", ":", "raise", "ImageV...
Set zoom algorithm. Parameters ---------- name : str Name of a zoom algorithm to use.
[ "Set", "zoom", "algorithm", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2328-L2342
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.zoomsetting_change_cb
def zoomsetting_change_cb(self, setting, value): """Handle callback related to changes in zoom.""" alg_name = self.t_['zoom_algorithm'] self.zoom = zoom.get_zoom_alg(alg_name)(self) self.zoom_to(self.get_zoom())
python
def zoomsetting_change_cb(self, setting, value): """Handle callback related to changes in zoom.""" alg_name = self.t_['zoom_algorithm'] self.zoom = zoom.get_zoom_alg(alg_name)(self) self.zoom_to(self.get_zoom())
[ "def", "zoomsetting_change_cb", "(", "self", ",", "setting", ",", "value", ")", ":", "alg_name", "=", "self", ".", "t_", "[", "'zoom_algorithm'", "]", "self", ".", "zoom", "=", "zoom", ".", "get_zoom_alg", "(", "alg_name", ")", "(", "self", ")", "self", ...
Handle callback related to changes in zoom.
[ "Handle", "callback", "related", "to", "changes", "in", "zoom", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2344-L2349
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.interpolation_change_cb
def interpolation_change_cb(self, setting, value): """Handle callback related to changes in interpolation.""" canvas_img = self.get_canvas_image() canvas_img.interpolation = value canvas_img.reset_optimize() self.redraw(whence=0)
python
def interpolation_change_cb(self, setting, value): """Handle callback related to changes in interpolation.""" canvas_img = self.get_canvas_image() canvas_img.interpolation = value canvas_img.reset_optimize() self.redraw(whence=0)
[ "def", "interpolation_change_cb", "(", "self", ",", "setting", ",", "value", ")", ":", "canvas_img", "=", "self", ".", "get_canvas_image", "(", ")", "canvas_img", ".", "interpolation", "=", "value", "canvas_img", ".", "reset_optimize", "(", ")", "self", ".", ...
Handle callback related to changes in interpolation.
[ "Handle", "callback", "related", "to", "changes", "in", "interpolation", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2351-L2356
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_scale_limits
def set_scale_limits(self, scale_min, scale_max): """Set scale limits. Parameters ---------- scale_min, scale_max : float Minimum and maximum scale limits, respectively. """ # TODO: force scale to within limits if already outside? self.t_.set(scale_m...
python
def set_scale_limits(self, scale_min, scale_max): """Set scale limits. Parameters ---------- scale_min, scale_max : float Minimum and maximum scale limits, respectively. """ # TODO: force scale to within limits if already outside? self.t_.set(scale_m...
[ "def", "set_scale_limits", "(", "self", ",", "scale_min", ",", "scale_max", ")", ":", "self", ".", "t_", ".", "set", "(", "scale_min", "=", "scale_min", ",", "scale_max", "=", "scale_max", ")" ]
Set scale limits. Parameters ---------- scale_min, scale_max : float Minimum and maximum scale limits, respectively.
[ "Set", "scale", "limits", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2373-L2383
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.enable_autozoom
def enable_autozoom(self, option): """Set ``autozoom`` behavior. Parameters ---------- option : {'on', 'override', 'once', 'off'} Option for zoom behavior. A list of acceptable options can also be obtained by :meth:`get_autozoom_options`. Raises ...
python
def enable_autozoom(self, option): """Set ``autozoom`` behavior. Parameters ---------- option : {'on', 'override', 'once', 'off'} Option for zoom behavior. A list of acceptable options can also be obtained by :meth:`get_autozoom_options`. Raises ...
[ "def", "enable_autozoom", "(", "self", ",", "option", ")", ":", "option", "=", "option", ".", "lower", "(", ")", "assert", "(", "option", "in", "self", ".", "autozoom_options", ")", ",", "ImageViewError", "(", "\"Bad autozoom option '%s': must be one of %s\"", "...
Set ``autozoom`` behavior. Parameters ---------- option : {'on', 'override', 'once', 'off'} Option for zoom behavior. A list of acceptable options can also be obtained by :meth:`get_autozoom_options`. Raises ------ ginga.ImageView.ImageViewError ...
[ "Set", "autozoom", "behavior", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2385-L2404
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_pan
def set_pan(self, pan_x, pan_y, coord='data', no_reset=False): """Set pan position. Parameters ---------- pan_x, pan_y : float Pan positions in X and Y. coord : {'data', 'wcs'} Indicates whether the given pan positions are in data or WCS space. ...
python
def set_pan(self, pan_x, pan_y, coord='data', no_reset=False): """Set pan position. Parameters ---------- pan_x, pan_y : float Pan positions in X and Y. coord : {'data', 'wcs'} Indicates whether the given pan positions are in data or WCS space. ...
[ "def", "set_pan", "(", "self", ",", "pan_x", ",", "pan_y", ",", "coord", "=", "'data'", ",", "no_reset", "=", "False", ")", ":", "pan_pos", "=", "(", "pan_x", ",", "pan_y", ")", "with", "self", ".", "suppress_redraw", ":", "self", ".", "t_", ".", "...
Set pan position. Parameters ---------- pan_x, pan_y : float Pan positions in X and Y. coord : {'data', 'wcs'} Indicates whether the given pan positions are in data or WCS space. no_reset : bool Do not reset ``autocenter`` setting.
[ "Set", "pan", "position", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2417-L2441
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.pan_cb
def pan_cb(self, setting, value): """Handle callback related to changes in pan.""" pan_x, pan_y = value[:2] self.logger.debug("pan set to %.2f,%.2f" % (pan_x, pan_y)) self.redraw(whence=0)
python
def pan_cb(self, setting, value): """Handle callback related to changes in pan.""" pan_x, pan_y = value[:2] self.logger.debug("pan set to %.2f,%.2f" % (pan_x, pan_y)) self.redraw(whence=0)
[ "def", "pan_cb", "(", "self", ",", "setting", ",", "value", ")", ":", "pan_x", ",", "pan_y", "=", "value", "[", ":", "2", "]", "self", ".", "logger", ".", "debug", "(", "\"pan set to %.2f,%.2f\"", "%", "(", "pan_x", ",", "pan_y", ")", ")", "self", ...
Handle callback related to changes in pan.
[ "Handle", "callback", "related", "to", "changes", "in", "pan", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2443-L2448
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_pan
def get_pan(self, coord='data'): """Get pan positions. Parameters ---------- coord : {'data', 'wcs'} Indicates whether the pan positions are returned in data or WCS space. Returns ------- positions : tuple X and Y positions, i...
python
def get_pan(self, coord='data'): """Get pan positions. Parameters ---------- coord : {'data', 'wcs'} Indicates whether the pan positions are returned in data or WCS space. Returns ------- positions : tuple X and Y positions, i...
[ "def", "get_pan", "(", "self", ",", "coord", "=", "'data'", ")", ":", "pan_x", ",", "pan_y", "=", "self", ".", "t_", "[", "'pan'", "]", "[", ":", "2", "]", "if", "coord", "==", "'wcs'", ":", "if", "self", ".", "t_", "[", "'pan_coord'", "]", "==...
Get pan positions. Parameters ---------- coord : {'data', 'wcs'} Indicates whether the pan positions are returned in data or WCS space. Returns ------- positions : tuple X and Y positions, in that order.
[ "Get", "pan", "positions", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2450-L2486
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.center_image
def center_image(self, no_reset=True): """Pan to the center of the image. Parameters ---------- no_reset : bool See :meth:`set_pan`. """ try: xy_mn, xy_mx = self.get_limits() data_x = float(xy_mn[0] + xy_mx[0]) / 2.0 data_...
python
def center_image(self, no_reset=True): """Pan to the center of the image. Parameters ---------- no_reset : bool See :meth:`set_pan`. """ try: xy_mn, xy_mx = self.get_limits() data_x = float(xy_mn[0] + xy_mx[0]) / 2.0 data_...
[ "def", "center_image", "(", "self", ",", "no_reset", "=", "True", ")", ":", "try", ":", "xy_mn", ",", "xy_mx", "=", "self", ".", "get_limits", "(", ")", "data_x", "=", "float", "(", "xy_mn", "[", "0", "]", "+", "xy_mx", "[", "0", "]", ")", "/", ...
Pan to the center of the image. Parameters ---------- no_reset : bool See :meth:`set_pan`.
[ "Pan", "to", "the", "center", "of", "the", "image", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2523-L2550
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.enable_autocenter
def enable_autocenter(self, option): """Set ``autocenter`` behavior. Parameters ---------- option : {'on', 'override', 'once', 'off'} Option for auto-center behavior. A list of acceptable options can also be obtained by :meth:`get_autocenter_options`. Ra...
python
def enable_autocenter(self, option): """Set ``autocenter`` behavior. Parameters ---------- option : {'on', 'override', 'once', 'off'} Option for auto-center behavior. A list of acceptable options can also be obtained by :meth:`get_autocenter_options`. Ra...
[ "def", "enable_autocenter", "(", "self", ",", "option", ")", ":", "option", "=", "option", ".", "lower", "(", ")", "assert", "(", "option", "in", "self", ".", "autocenter_options", ")", ",", "ImageViewError", "(", "\"Bad autocenter option '%s': must be one of %s\"...
Set ``autocenter`` behavior. Parameters ---------- option : {'on', 'override', 'once', 'off'} Option for auto-center behavior. A list of acceptable options can also be obtained by :meth:`get_autocenter_options`. Raises ------ ginga.ImageView.Imag...
[ "Set", "autocenter", "behavior", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2552-L2571
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.cut_levels
def cut_levels(self, loval, hival, no_reset=False): """Apply cut levels on the image view. Parameters ---------- loval, hival : float Low and high values of the cut levels, respectively. no_reset : bool Do not reset ``autocuts`` setting. """ ...
python
def cut_levels(self, loval, hival, no_reset=False): """Apply cut levels on the image view. Parameters ---------- loval, hival : float Low and high values of the cut levels, respectively. no_reset : bool Do not reset ``autocuts`` setting. """ ...
[ "def", "cut_levels", "(", "self", ",", "loval", ",", "hival", ",", "no_reset", "=", "False", ")", ":", "self", ".", "t_", ".", "set", "(", "cuts", "=", "(", "loval", ",", "hival", ")", ")", "if", "(", "not", "no_reset", ")", "and", "(", "self", ...
Apply cut levels on the image view. Parameters ---------- loval, hival : float Low and high values of the cut levels, respectively. no_reset : bool Do not reset ``autocuts`` setting.
[ "Apply", "cut", "levels", "on", "the", "image", "view", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2608-L2626
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.auto_levels
def auto_levels(self, autocuts=None): """Apply auto-cut levels on the image view. Parameters ---------- autocuts : subclass of `~ginga.AutoCuts.AutoCutsBase` or `None` An object that implements the desired auto-cut algorithm. If not given, use algorithm from pref...
python
def auto_levels(self, autocuts=None): """Apply auto-cut levels on the image view. Parameters ---------- autocuts : subclass of `~ginga.AutoCuts.AutoCutsBase` or `None` An object that implements the desired auto-cut algorithm. If not given, use algorithm from pref...
[ "def", "auto_levels", "(", "self", ",", "autocuts", "=", "None", ")", ":", "if", "autocuts", "is", "None", ":", "autocuts", "=", "self", ".", "autocuts", "image", "=", "self", ".", "get_image", "(", ")", "if", "image", "is", "None", ":", "return", "l...
Apply auto-cut levels on the image view. Parameters ---------- autocuts : subclass of `~ginga.AutoCuts.AutoCutsBase` or `None` An object that implements the desired auto-cut algorithm. If not given, use algorithm from preferences.
[ "Apply", "auto", "-", "cut", "levels", "on", "the", "image", "view", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2628-L2653
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.auto_levels_cb
def auto_levels_cb(self, setting, value): """Handle callback related to changes in auto-cut levels.""" # Did we change the method? method = self.t_['autocut_method'] params = self.t_.get('autocut_params', []) params = dict(params) if method != str(self.autocuts): ...
python
def auto_levels_cb(self, setting, value): """Handle callback related to changes in auto-cut levels.""" # Did we change the method? method = self.t_['autocut_method'] params = self.t_.get('autocut_params', []) params = dict(params) if method != str(self.autocuts): ...
[ "def", "auto_levels_cb", "(", "self", ",", "setting", ",", "value", ")", ":", "method", "=", "self", ".", "t_", "[", "'autocut_method'", "]", "params", "=", "self", ".", "t_", ".", "get", "(", "'autocut_params'", ",", "[", "]", ")", "params", "=", "d...
Handle callback related to changes in auto-cut levels.
[ "Handle", "callback", "related", "to", "changes", "in", "auto", "-", "cut", "levels", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2655-L2672
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.enable_autocuts
def enable_autocuts(self, option): """Set ``autocuts`` behavior. Parameters ---------- option : {'on', 'override', 'once', 'off'} Option for auto-cut behavior. A list of acceptable options can also be obtained by :meth:`get_autocuts_options`. Raises ...
python
def enable_autocuts(self, option): """Set ``autocuts`` behavior. Parameters ---------- option : {'on', 'override', 'once', 'off'} Option for auto-cut behavior. A list of acceptable options can also be obtained by :meth:`get_autocuts_options`. Raises ...
[ "def", "enable_autocuts", "(", "self", ",", "option", ")", ":", "option", "=", "option", ".", "lower", "(", ")", "assert", "(", "option", "in", "self", ".", "autocuts_options", ")", ",", "ImageViewError", "(", "\"Bad autocuts option '%s': must be one of %s\"", "...
Set ``autocuts`` behavior. Parameters ---------- option : {'on', 'override', 'once', 'off'} Option for auto-cut behavior. A list of acceptable options can also be obtained by :meth:`get_autocuts_options`. Raises ------ ginga.ImageView.ImageViewEr...
[ "Set", "autocuts", "behavior", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2678-L2697
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_autocut_params
def set_autocut_params(self, method, **params): """Set auto-cut parameters. Parameters ---------- method : str Auto-cut algorithm. A list of acceptable options can be obtained by :meth:`get_autocut_methods`. params : dict Algorithm-specific ...
python
def set_autocut_params(self, method, **params): """Set auto-cut parameters. Parameters ---------- method : str Auto-cut algorithm. A list of acceptable options can be obtained by :meth:`get_autocut_methods`. params : dict Algorithm-specific ...
[ "def", "set_autocut_params", "(", "self", ",", "method", ",", "**", "params", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Setting autocut params method=%s params=%s\"", "%", "(", "method", ",", "str", "(", "params", ")", ")", ")", "params", "=", ...
Set auto-cut parameters. Parameters ---------- method : str Auto-cut algorithm. A list of acceptable options can be obtained by :meth:`get_autocut_methods`. params : dict Algorithm-specific keywords and values.
[ "Set", "auto", "-", "cut", "parameters", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2710-L2726
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.transform
def transform(self, flip_x, flip_y, swap_xy): """Transform view of the image. .. note:: Transforming the image is generally faster than rotating, if rotating in 90 degree increments. Also see :meth:`rotate`. Parameters ---------- flipx, flipy : bool ...
python
def transform(self, flip_x, flip_y, swap_xy): """Transform view of the image. .. note:: Transforming the image is generally faster than rotating, if rotating in 90 degree increments. Also see :meth:`rotate`. Parameters ---------- flipx, flipy : bool ...
[ "def", "transform", "(", "self", ",", "flip_x", ",", "flip_y", ",", "swap_xy", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"flip_x=%s flip_y=%s swap_xy=%s\"", "%", "(", "flip_x", ",", "flip_y", ",", "swap_xy", ")", ")", "with", "self", ".", "su...
Transform view of the image. .. note:: Transforming the image is generally faster than rotating, if rotating in 90 degree increments. Also see :meth:`rotate`. Parameters ---------- flipx, flipy : bool If `True`, flip the image in the X and Y axes, r...
[ "Transform", "view", "of", "the", "image", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2743-L2764
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.transform_cb
def transform_cb(self, setting, value): """Handle callback related to changes in transformations.""" self.make_callback('transform') # whence=0 because need to calculate new extents for proper # cutout for rotation (TODO: always make extents consider # room for rotation) ...
python
def transform_cb(self, setting, value): """Handle callback related to changes in transformations.""" self.make_callback('transform') # whence=0 because need to calculate new extents for proper # cutout for rotation (TODO: always make extents consider # room for rotation) ...
[ "def", "transform_cb", "(", "self", ",", "setting", ",", "value", ")", ":", "self", ".", "make_callback", "(", "'transform'", ")", "whence", "=", "0", "self", ".", "redraw", "(", "whence", "=", "whence", ")" ]
Handle callback related to changes in transformations.
[ "Handle", "callback", "related", "to", "changes", "in", "transformations", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2766-L2774
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.copy_attributes
def copy_attributes(self, dst_fi, attrlist, share=False): """Copy interesting attributes of our configuration to another image view. Parameters ---------- dst_fi : subclass of `ImageViewBase` Another instance of image view. attrlist : list A list...
python
def copy_attributes(self, dst_fi, attrlist, share=False): """Copy interesting attributes of our configuration to another image view. Parameters ---------- dst_fi : subclass of `ImageViewBase` Another instance of image view. attrlist : list A list...
[ "def", "copy_attributes", "(", "self", ",", "dst_fi", ",", "attrlist", ",", "share", "=", "False", ")", ":", "keylist", "=", "[", "]", "if", "'transforms'", "in", "attrlist", ":", "keylist", ".", "extend", "(", "[", "'flip_x'", ",", "'flip_y'", ",", "'...
Copy interesting attributes of our configuration to another image view. Parameters ---------- dst_fi : subclass of `ImageViewBase` Another instance of image view. attrlist : list A list of attribute names to copy. They can be ``'transforms'``, ...
[ "Copy", "interesting", "attributes", "of", "our", "configuration", "to", "another", "image", "view", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2776-L2826
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.auto_orient
def auto_orient(self): """Set the orientation for the image to a reasonable default.""" image = self.get_image() if image is None: return invert_y = not isinstance(image, AstroImage.AstroImage) # Check for various things to set based on metadata header = imag...
python
def auto_orient(self): """Set the orientation for the image to a reasonable default.""" image = self.get_image() if image is None: return invert_y = not isinstance(image, AstroImage.AstroImage) # Check for various things to set based on metadata header = imag...
[ "def", "auto_orient", "(", "self", ")", ":", "image", "=", "self", ".", "get_image", "(", ")", "if", "image", "is", "None", ":", "return", "invert_y", "=", "not", "isinstance", "(", "image", ",", "AstroImage", ".", "AstroImage", ")", "header", "=", "im...
Set the orientation for the image to a reasonable default.
[ "Set", "the", "orientation", "for", "the", "image", "to", "a", "reasonable", "default", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2908-L2941
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_image_as_buffer
def get_image_as_buffer(self, output=None): """Get the current image shown in the viewer, with any overlaid graphics, in a IO buffer with channels as needed and ordered by the back end widget. This can be overridden by subclasses. Parameters ---------- output : ...
python
def get_image_as_buffer(self, output=None): """Get the current image shown in the viewer, with any overlaid graphics, in a IO buffer with channels as needed and ordered by the back end widget. This can be overridden by subclasses. Parameters ---------- output : ...
[ "def", "get_image_as_buffer", "(", "self", ",", "output", "=", "None", ")", ":", "obuf", "=", "output", "if", "obuf", "is", "None", ":", "obuf", "=", "BytesIO", "(", ")", "arr8", "=", "self", ".", "get_image_as_array", "(", ")", "if", "not", "hasattr",...
Get the current image shown in the viewer, with any overlaid graphics, in a IO buffer with channels as needed and ordered by the back end widget. This can be overridden by subclasses. Parameters ---------- output : a file IO-like object or None open python I...
[ "Get", "the", "current", "image", "shown", "in", "the", "viewer", "with", "any", "overlaid", "graphics", "in", "a", "IO", "buffer", "with", "channels", "as", "needed", "and", "ordered", "by", "the", "back", "end", "widget", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L3282-L3314
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.get_rgb_image_as_bytes
def get_rgb_image_as_bytes(self, format='png', quality=90): """Get the current image shown in the viewer, with any overlaid graphics, in the form of a buffer in the form of bytes. Parameters ---------- format : str See :meth:`get_rgb_image_as_buffer`. qualit...
python
def get_rgb_image_as_bytes(self, format='png', quality=90): """Get the current image shown in the viewer, with any overlaid graphics, in the form of a buffer in the form of bytes. Parameters ---------- format : str See :meth:`get_rgb_image_as_buffer`. qualit...
[ "def", "get_rgb_image_as_bytes", "(", "self", ",", "format", "=", "'png'", ",", "quality", "=", "90", ")", ":", "obuf", "=", "self", ".", "get_rgb_image_as_buffer", "(", "format", "=", "format", ",", "quality", "=", "quality", ")", "return", "bytes", "(", ...
Get the current image shown in the viewer, with any overlaid graphics, in the form of a buffer in the form of bytes. Parameters ---------- format : str See :meth:`get_rgb_image_as_buffer`. quality: int See :meth:`get_rgb_image_as_buffer`. Return...
[ "Get", "the", "current", "image", "shown", "in", "the", "viewer", "with", "any", "overlaid", "graphics", "in", "the", "form", "of", "a", "buffer", "in", "the", "form", "of", "bytes", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L3344-L3363
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.save_rgb_image_as_file
def save_rgb_image_as_file(self, filepath, format='png', quality=90): """Save the current image shown in the viewer, with any overlaid graphics, in a file with the specified format and quality. This can be overridden by subclasses. Parameters ---------- filepath : str ...
python
def save_rgb_image_as_file(self, filepath, format='png', quality=90): """Save the current image shown in the viewer, with any overlaid graphics, in a file with the specified format and quality. This can be overridden by subclasses. Parameters ---------- filepath : str ...
[ "def", "save_rgb_image_as_file", "(", "self", ",", "filepath", ",", "format", "=", "'png'", ",", "quality", "=", "90", ")", ":", "with", "open", "(", "filepath", ",", "'wb'", ")", "as", "out_f", ":", "self", ".", "get_rgb_image_as_buffer", "(", "output", ...
Save the current image shown in the viewer, with any overlaid graphics, in a file with the specified format and quality. This can be overridden by subclasses. Parameters ---------- filepath : str path of the file to write format : str See :meth:`...
[ "Save", "the", "current", "image", "shown", "in", "the", "viewer", "with", "any", "overlaid", "graphics", "in", "a", "file", "with", "the", "specified", "format", "and", "quality", ".", "This", "can", "be", "overridden", "by", "subclasses", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L3383-L3403
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.set_onscreen_message
def set_onscreen_message(self, text, redraw=True): """Called by a subclass to update the onscreen message. Parameters ---------- text : str The text to show in the display. """ width, height = self.get_window_size() font = self.t_.get('onscreen_font...
python
def set_onscreen_message(self, text, redraw=True): """Called by a subclass to update the onscreen message. Parameters ---------- text : str The text to show in the display. """ width, height = self.get_window_size() font = self.t_.get('onscreen_font...
[ "def", "set_onscreen_message", "(", "self", ",", "text", ",", "redraw", "=", "True", ")", ":", "width", ",", "height", "=", "self", ".", "get_window_size", "(", ")", "font", "=", "self", ".", "t_", ".", "get", "(", "'onscreen_font'", ",", "'sans serif'",...
Called by a subclass to update the onscreen message. Parameters ---------- text : str The text to show in the display.
[ "Called", "by", "a", "subclass", "to", "update", "the", "onscreen", "message", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L3447-L3495
train
ejeschke/ginga
ginga/ImageView.py
ImageViewBase._calc_font_size
def _calc_font_size(self, win_wd): """Heuristic to calculate an appropriate font size based on the width of the viewer window. Parameters ---------- win_wd : int The width of the viewer window. Returns ------- font_size : int Appr...
python
def _calc_font_size(self, win_wd): """Heuristic to calculate an appropriate font size based on the width of the viewer window. Parameters ---------- win_wd : int The width of the viewer window. Returns ------- font_size : int Appr...
[ "def", "_calc_font_size", "(", "self", ",", "win_wd", ")", ":", "font_size", "=", "4", "if", "win_wd", ">=", "1600", ":", "font_size", "=", "24", "elif", "win_wd", ">=", "1000", ":", "font_size", "=", "18", "elif", "win_wd", ">=", "800", ":", "font_siz...
Heuristic to calculate an appropriate font size based on the width of the viewer window. Parameters ---------- win_wd : int The width of the viewer window. Returns ------- font_size : int Approximately appropriate font size in points
[ "Heuristic", "to", "calculate", "an", "appropriate", "font", "size", "based", "on", "the", "width", "of", "the", "viewer", "window", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L3497-L3532
train
ejeschke/ginga
ginga/gtkw/GtkHelp.py
FileSelection.popup
def popup(self, title, callfn, initialdir=None, filename=None): """Let user select and load file.""" self.cb = callfn self.filew.set_title(title) if initialdir: self.filew.set_current_folder(initialdir) if filename: #self.filew.set_filename(filename) ...
python
def popup(self, title, callfn, initialdir=None, filename=None): """Let user select and load file.""" self.cb = callfn self.filew.set_title(title) if initialdir: self.filew.set_current_folder(initialdir) if filename: #self.filew.set_filename(filename) ...
[ "def", "popup", "(", "self", ",", "title", ",", "callfn", ",", "initialdir", "=", "None", ",", "filename", "=", "None", ")", ":", "self", ".", "cb", "=", "callfn", "self", ".", "filew", ".", "set_title", "(", "title", ")", "if", "initialdir", ":", ...
Let user select and load file.
[ "Let", "user", "select", "and", "load", "file", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/gtkw/GtkHelp.py#L735-L746
train
ejeschke/ginga
ginga/util/loader.py
get_fileinfo
def get_fileinfo(self, filespec, dldir=None): """Break down a file specification into its components. Parameters ---------- filespec : str The path of the file to load (can be a URL). dldir Returns ------- res : `~ginga.misc.Bunch.Bunch` """ if dldir is None: ...
python
def get_fileinfo(self, filespec, dldir=None): """Break down a file specification into its components. Parameters ---------- filespec : str The path of the file to load (can be a URL). dldir Returns ------- res : `~ginga.misc.Bunch.Bunch` """ if dldir is None: ...
[ "def", "get_fileinfo", "(", "self", ",", "filespec", ",", "dldir", "=", "None", ")", ":", "if", "dldir", "is", "None", ":", "dldir", "=", "self", ".", "tmpdir", "info", "=", "iohelper", ".", "get_fileinfo", "(", "filespec", ",", "cache_dir", "=", "dldi...
Break down a file specification into its components. Parameters ---------- filespec : str The path of the file to load (can be a URL). dldir Returns ------- res : `~ginga.misc.Bunch.Bunch`
[ "Break", "down", "a", "file", "specification", "into", "its", "components", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/util/loader.py#L70-L89
train
ejeschke/ginga
ginga/rv/plugins/Zoom.py
Zoom.zoomset_cb
def zoomset_cb(self, setting, zoomlevel, fitsimage): """This method is called when a main FITS widget changes zoom level. """ if not self.gui_up: return fac_x, fac_y = fitsimage.get_scale_base_xy() fac_x_me, fac_y_me = self.zoomimage.get_scale_base_xy() if (fa...
python
def zoomset_cb(self, setting, zoomlevel, fitsimage): """This method is called when a main FITS widget changes zoom level. """ if not self.gui_up: return fac_x, fac_y = fitsimage.get_scale_base_xy() fac_x_me, fac_y_me = self.zoomimage.get_scale_base_xy() if (fa...
[ "def", "zoomset_cb", "(", "self", ",", "setting", ",", "zoomlevel", ",", "fitsimage", ")", ":", "if", "not", "self", ".", "gui_up", ":", "return", "fac_x", ",", "fac_y", "=", "fitsimage", ".", "get_scale_base_xy", "(", ")", "fac_x_me", ",", "fac_y_me", "...
This method is called when a main FITS widget changes zoom level.
[ "This", "method", "is", "called", "when", "a", "main", "FITS", "widget", "changes", "zoom", "level", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Zoom.py#L279-L290
train
ejeschke/ginga
ginga/rv/plugins/Zoom.py
Zoom.set_amount_cb
def set_amount_cb(self, widget, val): """This method is called when 'Zoom Amount' control is adjusted. """ self.zoom_amount = val zoomlevel = self.fitsimage_focus.get_zoom() self._zoomset(self.fitsimage_focus, zoomlevel)
python
def set_amount_cb(self, widget, val): """This method is called when 'Zoom Amount' control is adjusted. """ self.zoom_amount = val zoomlevel = self.fitsimage_focus.get_zoom() self._zoomset(self.fitsimage_focus, zoomlevel)
[ "def", "set_amount_cb", "(", "self", ",", "widget", ",", "val", ")", ":", "self", ".", "zoom_amount", "=", "val", "zoomlevel", "=", "self", ".", "fitsimage_focus", ".", "get_zoom", "(", ")", "self", ".", "_zoomset", "(", "self", ".", "fitsimage_focus", "...
This method is called when 'Zoom Amount' control is adjusted.
[ "This", "method", "is", "called", "when", "Zoom", "Amount", "control", "is", "adjusted", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Zoom.py#L377-L382
train
ejeschke/ginga
experimental/remote_image/plugin/RemoteImage.py
RemoteImage._slice
def _slice(self, view): """ Send view to remote server and do slicing there. """ if self._data is not None: return self._data[view] return self._proxy.get_view(self.id, view)
python
def _slice(self, view): """ Send view to remote server and do slicing there. """ if self._data is not None: return self._data[view] return self._proxy.get_view(self.id, view)
[ "def", "_slice", "(", "self", ",", "view", ")", ":", "if", "self", ".", "_data", "is", "not", "None", ":", "return", "self", ".", "_data", "[", "view", "]", "return", "self", ".", "_proxy", ".", "get_view", "(", "self", ".", "id", ",", "view", ")...
Send view to remote server and do slicing there.
[ "Send", "view", "to", "remote", "server", "and", "do", "slicing", "there", "." ]
a78c893ec6f37a837de851947e9bb4625c597915
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/experimental/remote_image/plugin/RemoteImage.py#L49-L55
train