Pane¶
- class sofia_redux.visualization.display.pane.Pane(signals: Signals, ax: Axes | None = None)[source]¶
Bases:
object
Plot window management.
The Pane class is analogous to a matplotlib subplot. It contains plot axes and instantiates artists associated with them. This class determines appropriate updates for display options, but it does not manage updating artists themselves after they are instantiated. The
Gallery
class manages all artist modifications.The Pane class is abstract. It should not be instantiated directly: it should be subclassed to provide specific display functionality, depending on desired plot type.
- Parameters:
- axmatplotlib.axes.Axes, optional
Plot axes to display in the pane.
- Attributes:
- axmatplotlib.axes.Axes
Plot axes to display in the pane.
- ax_altmatplotlib.axes.Axes
Alternative plot axes to display in the pane.
- modelsdict
Data models displayed in the pane. Keys are model IDs; values are sofia_redux.visualization.models.HighModel instances.
- referencedict
Reference model for lines and corresponding labels. Values are sofia_redux.visualization.models.reference_model .ReferenceData instances.
- fieldsdict
Model fields currently displayed in the pane.
- show_overplot: bool
To over plot the alternative axis.
- brewer_cyclelist of str
Color hex values for the ‘spectral’ color cycle.
- tab10_cyclelist of str
Color hex values for the ‘tableau’ color cycle.
- accessible_cyclelist of str
Color hex values for the ‘accessible’ color cycle.
- default_colorslist of str
Default color cycle. Set to
accessible_cycle
on initialization.- default_markerslist of str
Default plot marker cycle.
- fit_linestylesiterable
Line style cycle, for use in feature fit overlays.
- bordermatplotlib.Rectangle
Border artist, used to highlight the current pane in the view display.
Methods Summary
add_model
(model)Add a model to the pane.
analogous
(color[, degree])Produce list of analogous colors to the input color.
ap_order_state
(model_ids)Determine number of orders and apertures for each model_id.
axes
()Get primary and alternate axes.
Create new artists from all current models.
Retrieve the currently displayed units.
Get the current axis limits.
Get the axis scale setting.
Retrieve the current border artist.
get_field
(axis)Get the currently displayed field.
get_orders
(axis, **kwargs)Get the currently displayed orders.
get_scale
(axis)Get the currently displayed scale.
get_unit
(axis)Get the currently displayed unit.
get_unit_string
(axis)Get the current unit string for the plot label.
grayscale
(color[, scheme])Translate color hex to equivalent grayscale value.
Get the number of models attached to the pane.
model_extensions
(model_id)Obtain a list of extensions for a model with a given model_id.
Get current overplot state.
perform_zoom
(zoom_points, direction)Perform a zoom action.
Retrieve possible units for the model.
remove_model
([filename, model_id, model])Remove a model from the pane.
Set the color cycle for apertures.
set_axis
(ax[, kind])Assign an axes instance to the pane.
set_border_visibility
(state)Set the border visibility.
set_color_cycle_by_name
(cycle_name)Set the color cycle to be used in displayed plots.
set_error
(state)Set the plot error range visibility.
set_fields
(fields)Set the plot fields.
set_grid
(state)Set the plot grid visibility.
set_limits
(limits)Set the plot limits.
set_markers
(state)Set the plot marker symbols.
set_orders
(orders[, enable, aperture, ...])Enable specified orders.
set_plot_type
(plot_type)Set the plot line type.
set_scales
(scale)Set the plot scale.
set_units
(units, axes)Set the plot units.
split_complementary
(color)Produce split complementary colors to the input color.
Update colors in currently displayed plots.
Methods Documentation
- add_model(model: MT) None [source]¶
Add a model to the pane.
- Parameters:
- modelhigh_model.HighModel
The model to add.
- static analogous(color, degree=130.0)[source]¶
Produce list of analogous colors to the input color.
- Parameters:
- colorstr
Color hex value.
- degreefloat
Color wheel angle to set as the distance above and below the input color.
- Returns:
- analogouslist of str
Two-element list of colors analogous to the input color.
- ap_order_state(model_ids: List[IDT] | IDT) Tuple[Dict[IDT, int], Dict[IDT, int]] [source]¶
Determine number of orders and apertures for each model_id.
- Parameters:
- model_ids: uuid.UUID, list(uuid.UUID)
Single or list of model_ids.
- Returns:
- apertures, orders: dict
Dictionaries with model_ids as keys and values are the total number of apertures and orders respectively that model contains.
- axes()[source]¶
Get primary and alternate axes.
- Returns:
- axeslist of matplotlib.axes.Axes
The current axes, as [primary, alternate].
- current_units() Dict[str, str] [source]¶
Retrieve the currently displayed units.
- Returns:
- unitsdict
Keys are axis names; values are unit names.
- get_axis_limits() Dict[str, Tuple | str] [source]¶
Get the current axis limits.
- Returns:
- limitsdict
Keys are axis names; values are current limits.
- get_axis_scale() Dict[str, str] [source]¶
Get the axis scale setting.
- Returns:
- scaledict
Keys are axis names; values are ‘log’ or ‘linear’.
- get_border() Rectangle [source]¶
Retrieve the current border artist.
- Returns:
- bordermatplotlib.Rectangle
The border artist.
- get_field(axis: str | None) str | Dict[str, str] [source]¶
Get the currently displayed field.
- Parameters:
- axisstr, optional
If provided, retrieves the field only for the specified axis.
- Returns:
- fieldstr or dict
If axis is specified, only the field name for that axis is returned. Otherwise, a dictionary with axis name keys and field name values is returned.
- get_orders(axis: str | None, **kwargs) str | Dict[str, str] [source]¶
Get the currently displayed orders.
- Parameters:
- axisstr, optional
If provided, retrieves the orders only for the specified axis.
- Returns:
- ordersstr or dict
If axis is specified, only the order name for that axis is returned. Otherwise, a dictionary with axis name keys and order name values is returned.
- get_scale(axis: str | None) str | Dict[str, str] [source]¶
Get the currently displayed scale.
- Parameters:
- axisstr, optional
If provided, retrieves the scale only for the specified axis.
- Returns:
- scalestr or dict
If axis is specified, only the scale name for that axis is returned. Otherwise, a dictionary with axis name keys and scale name values is returned.
- get_unit(axis: str | None) str | Dict[str, str] [source]¶
Get the currently displayed unit.
- Parameters:
- axisstr, optional
If provided, retrieves the unit only for the specified axis.
- Returns:
- unitstr or dict
If axis is specified, only the unit name for that axis is returned. Otherwise, a dictionary with axis name keys and unit name values is returned.
- get_unit_string(axis: str) str [source]¶
Get the current unit string for the plot label.
- Parameters:
- axisstr
The axis name to retrieve units from.
- Returns:
- unit_namestr
The unit label.
- static grayscale(color: str, scheme: str | None = 'yiq')[source]¶
Translate color hex to equivalent grayscale value.
- Parameters:
- colorstr
Color hex value.
- scheme{‘yiq’, ‘hex’, ‘rgb’}
Color scheme to use for formatting output grayscale.
- Returns:
- graystr
Grayscale value equivalent to the input color.
- model_count() int [source]¶
Get the number of models attached to the pane.
- Returns:
- countint
The model count.
- model_extensions(model_id: str) List[str] [source]¶
Obtain a list of extensions for a model with a given model_id.
- Parameters:
- model_idstr
Specific id to a model object (high_model.HighModel).
- Returns:
- model.extension()list of str
Model extensions are a list of the hdu names for a given hdul. If
model_id
is not found, returns empty list.
- overplot_state() bool [source]¶
Get current overplot state.
- Returns:
- statebool
True if overplot is shown; False otherwise.
- perform_zoom(zoom_points: List, direction: str) None [source]¶
Perform a zoom action.
- Parameters:
- zoom_pointslist
User selected cursor positions, defining the zoom limits.
- directionstr
Direction of the zoom.
- possible_units() Dict[str, List[Any]] [source]¶
Retrieve possible units for the model.
- Returns:
- unitsdict
Keys are axis names; values are lists of unit names.
- remove_model(filename: str | None = None, model_id: IDT | None = None, model: MT | None = None) None [source]¶
Remove a model from the pane.
Either filename or model must be specified.
- Parameters:
- filenamestr, optional
Model filename to remove.
- model: high_model.HighModel, optional
Model instance to remove.
- set_axis(ax: Axes, kind: str = 'primary') None [source]¶
Assign an axes instance to the pane.
Also instantiates the border highlight for the pane.
- Parameters:
- axmatplotlib.axes.Axes
The axes to assign.
- kind{‘primary’, ‘secondary’}, optional
If given, specifies which axis is being given. Defaults to ‘primary’.
- set_border_visibility(state: bool) None [source]¶
Set the border visibility.
- Parameters:
- statebool
If True, the border is shown. If False, the border is hidden.
- set_color_cycle_by_name(cycle_name: str) None [source]¶
Set the color cycle to be used in displayed plots.
- Parameters:
- cycle_name[‘spectral’, ‘tableau’, ‘accessible’]
The color cycle to set.
- set_fields(fields: Dict[str, str]) None [source]¶
Set the plot fields.
- Parameters:
- fieldsdict
Keys are axis names; values are fields to set.
- set_limits(limits: Dict[str, float]) None [source]¶
Set the plot limits.
- Parameters:
- limitsdict
Keys are axis names; values are limits to set.
- set_orders(orders: Dict[str, List[Any]], enable: bool | None = True, aperture: bool | None = False, return_updates: bool | None = False) List[Any] | None [source]¶
Enable specified orders.
- Parameters:
- ordersdict
Keys are model IDs; values are lists of orders to enable.
- enablebool, optional
Set to True to enable; False to disable.
- aperturebool, optional
True if apertures are present; False otherwise.
- return_updatesbool, optional
If set, an update structure is returned.
- set_plot_type(plot_type: str) None [source]¶
Set the plot line type.
- Parameters:
- plot_typestr
The plot type to set.
- set_scales(scale: Dict[str, str]) None [source]¶
Set the plot scale.
- Parameters:
- scaledict
Keys are axis names; values are scales to set (‘log’ or ‘linear’).
- set_units(units: Dict[str, str], axes: str) Any [source]¶
Set the plot units.
- Parameters:
- unitsdict
Keys are axis names; values are units to set.
- axesstr
Which axes to pull data from.