SOFIARedux:docs
  • Index
  • Modules

Navigation

  • next »
  • « previous |
  • sofia_redux v1.3.4.dev38+g92ea2f4 »
  • SOFIA Redux »
  • sofia_redux.visualization: The Eye of SOFIA »
  • Gallery

Gallery¶

class sofia_redux.visualization.display.gallery.Gallery[source]¶

Bases: object

Track display gallery for viewer plots.

Artists held by this class are associated with matplotlib axes, instantiated and controlled by the sofia_redux.visualization.pane interface. This class implements updates and modifications to the existing artists. It does not create them, or explicitly track their associated axes.

Attributes:
artsdict

Keys are artist types, with allowed values ‘line’, ‘cursor’, ‘error_range’, ‘crosshair’, ‘guide’, ‘patch’, and ‘fit’. Values are lists of dicts, containing the artist information (e.g. ‘model_id’, ‘artist’, ‘state’).

Methods Summary

add_crosshairs(crosshairs)

Add crosshair artists for tracking.

add_drawing(drawing_)

Add a single drawing to the gallery.

add_drawings(drawings)

Add drawings to the gallery.

add_patches(patches)

Add patch artists for tracking.

age_artists([mode])

Mark artists as stale.

artists_at_event(event)

Gather the artists located at an event.

artists_in_pane(pane_[, kinds])

Find artists in a given pane.

catch_label_overlaps(renderer)

Fix overlapping reference line labels.

gather_artists([mode, preserve, return_drawing])

Gather all artists of a specified mode.

hide_crosshair()

Hide all crosshair artists.

hide_cursor_markers()

Hide all cursor markers.

print_artists()

Print all artists to screen.

reset_artists(selection[, panes])

Reset and remove all artists for a given selection.

set_pane_highlight_flag(pane_numbers, state)

Set visibility for border pane patches.

update_artist_options(pane_[, kinds, options])

Update artist display options.

update_crosshair(pane_number[, data_point, ...])

Update crosshair position and visibility.

update_error_ranges(pane_, updates)

Update data associated with error range artists.

update_line_data(pane_, updates[, axes])

Update data associated with line artists in a single pane.

update_line_fields(pane_, updates)

Update data and labels for a new plot field in a single pane.

update_line_type(pane_, updates)

Update plot line type.

update_marker(data_point)

Update markers to new data points.

update_reference_data(pane_, updates)

Update reference data lines.

Methods Documentation

add_crosshairs(crosshairs: List[DT]) → None[source]¶

Add crosshair artists for tracking.

Parameters:
crosshairsdict

Must contain keys ‘kind’, ‘artist’, ‘visible’, ‘direction’.

add_drawing(drawing_: DT) → bool[source]¶

Add a single drawing to the gallery.

Parameters:
drawing_Drawing

The drawing to add.

Returns:
successbool

True if drawing was successfully added; False otherwise.

add_drawings(drawings: List[DT]) → int[source]¶

Add drawings to the gallery.

Parameters:
drawingslist of Drawing

Drawings to add.

Returns:
int

The number of drawings successfully added.

add_patches(patches: Dict) → None[source]¶

Add patch artists for tracking.

Parameters:
patchesdict

Patches to add. Must have keys ‘kind’, ‘artist’, ‘visible’.

age_artists(mode: str | None = 'all') → None[source]¶

Mark artists as stale.

Parameters:
modestr, optional

The mode to age.

artists_at_event(event) → List[source]¶

Gather the artists located at an event.

Parameters:
event

Event in question.

Returns:
selectedlist

All artists that occur at the event.

artists_in_pane(pane_: Pane, kinds: str | List[str] | None = None) → List[DT][source]¶

Find artists in a given pane.

Parameters:
pane_Pane

Pane to query.

kindsstr, optional

Type of artist to search for, such as line. If not provided, return artists of all kind.

Returns:
targetslist

List of artists in the pane

catch_label_overlaps(renderer: RendererBase) → List[source]¶

Fix overlapping reference line labels.

Parameters:
rendererRendererBase

Canvas renderer containing the reference lines.

Returns:
updatedlist of str

Updated label values.

gather_artists(mode: str | None = 'all', preserve: bool | None = False, return_drawing: bool | None = False) → List[DT][source]¶

Gather all artists of a specified mode.

Parameters:
modestr, optional

Mode of artists to grab. If not provided, grab all artists.

preservebool, optional

If set, do not update the state of the artist. Otherwise, mark all stats as fresh.

Returns:
gatheredlist

List of all requested artists.

hide_crosshair() → None[source]¶

Hide all crosshair artists.

hide_cursor_markers() → None[source]¶

Hide all cursor markers.

print_artists() → None[source]¶

Print all artists to screen.

reset_artists(selection: str, panes: List | None = None) → None[source]¶

Reset and remove all artists for a given selection.

Parameters:
selectionstr

Type of artist to reset. Acceptable values are ‘lines’ which resets the data lines, ‘cursor’ which resets the marker for the cursor location, ‘collections’ which resets scatter plots, ‘v_guides’, ‘h_guides’, ‘f_guides’, ‘a_guides’ which resets vertical, horizontal, fit, and all guides, respectively. The ‘all’ flag clears everything.

paneslist, optional

The pane to clear the selected artist from. If not provided, the selected artists will be cleared from all panes.

set_pane_highlight_flag(pane_numbers: List[int] | int, state: bool) → None[source]¶

Set visibility for border pane patches.

Border pane patches must have been previously added to tracking with the add_patches method.

Parameters:
pane_numberint

Pane index associated with the border to update.

statebool

Visibility state to set. If True, the patch will be visible; if False, it will be hidden.

update_artist_options(pane_: PT | int, kinds: str | List[str] | None = None, options: List[DT] | None = None) → bool[source]¶

Update artist display options.

Currently supported options for each artist type are:
  • ‘line’ artist: ‘color’, ‘visibility’, ‘marker’

  • ‘error_range’ artist: ‘color’, ‘visibility’

  • ‘fit’ artist: ‘color’, ‘visibility’

  • ‘patch’ artist: ‘color’

  • ‘cursor’ artist: ‘color’

Parameters:
pane_Pane

Pane object holding the artists to update.

kindsstr, list

Kinds of artists to update. If all artists are to be updated, set to ‘all’.

optionslist of dict

Options to apply. The dicts must contain ‘model_id’ and ‘order’ keys. Other keys allowed are ‘color’, ‘visibility’, and ‘marker’.

update_crosshair(pane_number: int, data_point: Tuple | None = None, direction: str | None = 'hv') → None[source]¶

Update crosshair position and visibility.

Any specified directions (‘h’ or ‘v’, for horizontal and vertical) are updated and made visible. Any unspecified are hidden.

Parameters:
pane_numberint

Pane index associated with the crosshair.

data_pointtuple of float

(x, y) location to update the cursor to.

direction[‘h’, ‘v’, ‘hv’], optional

Direction of crosshair to update.

update_error_ranges(pane_: Pane, updates: List[DT]) → None[source]¶

Update data associated with error range artists.

Typically called with the update_line_data method, which updates data associated with a line plot. However, error range artists are always replaced with new artists, rather than updated in place.

Parameters:
pane_Pane

Pane object holding the line artists to update.

updateslist of dict

Updates to apply. The dicts must contain ‘model_id’, ‘order’, and ‘new_artist’ keys.

update_line_data(pane_: Pane, updates: List[DT], axes: str | None = 'primary') → None[source]¶

Update data associated with line artists in a single pane.

Parameters:
pane_Pane

Pane object holding the lines to update.

updateslist of dict

Updates to apply. The dicts must contain ‘model_id’, ‘order’, and ‘field’. Keys are from ‘new_x_data’, ‘new_y_data’, and ‘new_y_alt_data’.

axes: ‘primary’, ‘alt’, ‘both’, ‘all’
update_line_fields(pane_: PT, updates: List[DT]) → None[source]¶

Update data and labels for a new plot field in a single pane.

Parameters:
pane_Pane

Pane object holding the line artists to update.

updateslist of dict

Updates to apply. The dicts must contain ‘model_id’, ‘order’, and ‘new_field’ keys, as well as either ‘new_x_data’ or ‘new_y_data’ (but not both).

update_line_type(pane_: PT, updates: List[DT]) → None[source]¶

Update plot line type.

Line2D artists are updated in place; PathCollection artists are replaced with an equivalent new artist.

Parameters:
pane_Pane

Pane object holding the line artist to update.

updateslist of dict

Updates to apply. The dicts must contain ‘model_id’, ‘order’, and ‘type’ keys. The ‘type’ should be one of ‘step’, ‘line’, or ‘scatter’. The dict may also contain a ‘marker’ key.

update_marker(data_point: Dict[str, List[Dict]]) → None[source]¶

Update markers to new data points.

Parameters:
data_pointdict

New artist dict.

update_reference_data(pane_: Pane, updates: List[DT]) → None[source]¶

Update reference data lines.

Parameters:
pane_Pane

Pane object holding the reference lines to update.

updateslist of dict

Updates to apply

Page Contents

  • Gallery
    • Gallery
      • Gallery.add_crosshairs()
      • Gallery.add_drawing()
      • Gallery.add_drawings()
      • Gallery.add_patches()
      • Gallery.age_artists()
      • Gallery.artists_at_event()
      • Gallery.artists_in_pane()
      • Gallery.catch_label_overlaps()
      • Gallery.gather_artists()
      • Gallery.hide_crosshair()
      • Gallery.hide_cursor_markers()
      • Gallery.print_artists()
      • Gallery.reset_artists()
      • Gallery.set_pane_highlight_flag()
      • Gallery.update_artist_options()
      • Gallery.update_crosshair()
      • Gallery.update_error_ranges()
      • Gallery.update_line_data()
      • Gallery.update_line_fields()
      • Gallery.update_line_type()
      • Gallery.update_marker()
      • Gallery.update_reference_data()

Page Source   Back to Top

© Copyright 2024, SOFIA-USRA.
Created using Sphinx 7.2.6.   Last built 05 Feb 2024.