AstrowidgetsImageViewerMixin
- class jdaviz.core.astrowidgets_api.AstrowidgetsImageViewerMixin[source] [edit on github]
Bases:
object
This class implements
astrowidgets
API for Jdaviz image viewer. This does not provide a fully functional viewer, but rather should be used as mixin into an existing viewer subclass.A child class that uses this must run
init_astrowidgets_api()
within its__init__
.Note
Do not use this for spectral or cube viewers.
Attributes Summary
List of all available options for automatic image cut levels.
List of colormap names.
Current image cut levels.
Marker to use.
The image stretching algorithm in use.
List of all available options for image stretching.
Zoom level:
Methods Summary
add_markers
(table[, x_colname, y_colname, ...])Creates markers w.r.t.
center_on
(point)Centers the view on a particular point.
This method must be called in child class
__init__
.offset_by
(dx, dy)Move the center to a point that is given offset away from the current center.
remove_markers
([marker_name])Remove some but not all of the markers by name used when adding the markers.
Delete all markers.
save
(filename)Save out the current image view to given PNG filename.
set_colormap
(cmap)Set colormap to the given colormap name.
zoom
(val)Zoom in or out by the given factor.
Attributes Documentation
- RESERVED_MARKER_SET_NAMES = ['all']
- autocut_options
List of all available options for automatic image cut levels.
- colormap_options
List of colormap names.
- cuts
Current image cut levels.
To set new cut levels, either provide a tuple of
(low, high)
values or one of the options fromautocut_options
.
- marker
Marker to use.
Marker can be set as follows; e.g.:
{'color': 'red', 'alpha': 1.0, 'markersize': 3} {'color': '#ff0000', 'alpha': 0.5, 'markersize': 10} {'color': (1, 0, 0)}
The valid properties for Glue markers are listed at https://docs.glueviz.org/en/stable/api/glue.core.visual.VisualAttributes.html
- stretch
The image stretching algorithm in use.
- stretch_options
List of all available options for image stretching.
Their
astropy.visualization
counterparts are also accepted, as follows:'arcsinh'
:astropy.visualization.AsinhStretch
'linear'
:astropy.visualization.LinearStretch
'log'
:astropy.visualization.LogStretch
'sqrt'
:astropy.visualization.SqrtStretch
- zoom_level
Zoom level:
1 means real-pixel-size.
2 means zoomed in by a factor of 2.
0.5 means zoomed out by a factor of 2.
‘fit’ means zoomed to fit the whole image width into display.
Methods Documentation
- add_markers(table, x_colname='x', y_colname='y', skycoord_colname='coord', use_skycoord=False, marker_name=None)[source] [edit on github]
Creates markers w.r.t. the reference image at given points in the table.
Note
Use
marker
to change marker appearance.- Parameters
- table
Table
Table containing marker locations.
- x_colname, y_colnamestr
Column names for X and Y. Coordinates must be 0-indexed.
- skycoord_colnamestr
Column name with
SkyCoord
objects.- use_skycoordbool
If
True
, useskycoord_colname
to mark. Otherwise, usex_colname
andy_colname
.- marker_namestr, optional
Name to assign the markers in the table. Providing a name allows markers to be removed by name at a later time.
- table
- Raises
- AttributeError
Sky coordinates are given but reference image does not have a valid WCS.
- ValueError
Invalid marker name.
- center_on(point)[source] [edit on github]
Centers the view on a particular point.
- Parameters
- pointtuple or
SkyCoord
If tuple of
(X, Y)
is given, it is assumed to be in data coordinates and 0-indexed.
- pointtuple or
- Raises
- AttributeError
Sky coordinates are given but image does not have a valid WCS.
- init_astrowidgets_api()[source] [edit on github]
This method must be called in child class
__init__
.
- offset_by(dx, dy)[source] [edit on github]
Move the center to a point that is given offset away from the current center.
- Parameters
- dx, dyfloat or
Quantity
Offset value. Without a unit, assumed to be pixel offsets. If a unit is attached, offset by pixel or sky is assumed from the unit.
- dx, dyfloat or
- Raises
- AttributeError
Sky offset is given but image does not have a valid WCS.
- ValueError
Offsets are of different types.
- astropy.units.core.UnitTypeError
Sky offset has invalid unit.
- remove_markers(marker_name=None)[source] [edit on github]
Remove some but not all of the markers by name used when adding the markers.
- Parameters
- marker_namestr
Name used when the markers were added. If not given, will delete markers added under default name.
- reset_markers()[source] [edit on github]
Delete all markers.
- save(filename)[source] [edit on github]
Save out the current image view to given PNG filename.
- set_colormap(cmap)[source] [edit on github]
Set colormap to the given colormap name.
- Parameters
- cmapstr
Colormap name. Possible values can be obtained from
colormap_options()
.
- Raises
- ValueError
Invalid colormap name.
- zoom(val)[source] [edit on github]
Zoom in or out by the given factor.
- Parameters
- valint or float
The zoom level to zoom the image. See
zoom_level
.
- Raises
- ValueError
Invalid zoom factor.