EventAnalysisView¶
class EventAnalysisView(*args, **kwargs)
Bases: MetaView, WalkthroughMixin
Subclass of MetaView for visualizing and interacting with event-based signal analysis.
Handles event plotting, plugin integration, and user-triggered actions.
Public Methods¶
- EventAnalysisView.get_current_view() str¶
Abstract method to get the name of the current view.
Subclasses must override this to return the current view name.
- Returns:
The name of the view currently displayed.
- Return type:
- Raises:
NotImplementedError – Always, unless overridden by a subclass.
- EventAnalysisView.get_save_filename() str¶
Open a file dialog to let the user select a filename for saving a CSV file.
- Returns:
Absolute path to the selected file.
- Return type:
- EventAnalysisView.get_walkthrough_steps() List[Tuple[str, str, str, Callable[[], QWidget | List[QWidget]]]]¶
Abstract method to retrieve the walkthrough steps for the current view.
Subclasses must override this to return a list of walkthrough steps, each a (title, description, view name, widget getter) tuple.
- Returns:
The ordered walkthrough steps for this view.
- Return type:
List[WalkthroughStep]
- Raises:
NotImplementedError – Always, unless overridden by a subclass.
- EventAnalysisView.handle_parameter_change(submodel_name: str, action_name: str, args: tuple) None¶
Handle changes triggered by UI controls such as updates to axis selection or filters.
- EventAnalysisView.notify_plugin_state_changed(metaclass: str, plugin_key: str, reason: str) None¶
This tab does not currently react to any plugin_state_changed notifications.
- EventAnalysisView.set_data_filter_function(data_filter: Callable) None¶
Set the callcable function to filter data
- Parameters:
data_filter (Callable) – a callable function
- EventAnalysisView.set_eventfitting_status(status: bool) None¶
Set the internal event fitting status.
- Parameters:
status (bool) – Boolean indicating fitting completion status.
- EventAnalysisView.set_num_events_allowed(num_events: int) None¶
Set the maximum number of events allowed to be plotted.
- Parameters:
num_events (int) – Number of events allowed.
- EventAnalysisView.update_available_plugins(available_plugins: Dict[str, List[str]]) None¶
Called whenever a new plugin is instantiated elsewhere in the app, to keep an up-to-date list of possible data sources for use by this plugin.
- EventAnalysisView.update_channels(channels: List[int]) None¶
Update the channel list in the event analysis control widget.
- Parameters:
channels (List[int]) – List of available channel indices.
- EventAnalysisView.update_plot() None¶
Update the main plot with the latest data and features. This method should be called after data and parameters are updated.
- EventAnalysisView.update_plot_data(data: Any | None = None) None¶
Update internal storage of plot data. Can be used by signal handlers receiving data.
- Parameters:
data (Optional[Any]) – The data to be stored, can be a dict or array.
- EventAnalysisView.update_plot_features(vertical: List[float] | None = None, horizontal: List[float] | None = None, points: List[Tuple[float, float]] | None = None, vlabels: List[str] | None = None, hlabels: List[str] | None = None, plabels: List[str] | None = None) None¶
Update feature overlays for the plot, such as vertical/horizontal lines and labeled points.
- Parameters:
vertical (Optional[List[float]]) – List of vertical line positions.
horizontal (Optional[List[float]]) – List of horizontal line positions.
points (Optional[List[Tuple[float, float]]]) – List of (x, y) point coordinates.
vlabels (Optional[List[str]]) – Labels for vertical lines.
hlabels (Optional[List[str]]) – Labels for horizontal lines.
plabels (Optional[List[str]]) – Labels for points.
Private Methods¶
- EventAnalysisView.__init__(*args: Any, **kwargs: Any) None¶
Initialize the MetaTab with a blank plot canvas and a space for controls.
- EventAnalysisView._extract_commit_event_parameters(parameters: Dict[str, Any]) Tuple[str | None, List[int]]¶
Extract writer and channels from parameters.
- EventAnalysisView._extract_event_fit_parameters(parameters: Dict[str, Any]) Tuple[str | None, str | None, List[int]]¶
Extract parameters used for event finding.
- EventAnalysisView._extract_plot_event_parameters(parameters: Dict[str, Any]) Tuple[str | None, str | None, str | None, List[int], List[int] | None]¶
Extract event plotting parameters from input.
- EventAnalysisView._factors(n: int) Tuple[int, int]¶
Compute a pair of factors of n that are closest to each other. Useful for determining subplot grid dimensions.
- EventAnalysisView._get_event_index_text() str¶
Get the current text from the event index input field.
- Returns:
Stripped text content of the event index field.
- Return type:
- EventAnalysisView._handle_commit_events(parameters: Dict[str, Any]) None¶
Handle commit actions by triggering the selected writer to store events.
- Parameters:
parameters (Dict[str, Any]) – Dictionary containing selected writer and channel info.
- EventAnalysisView._handle_fit_events(parameters: Dict[str, Any]) None¶
Handle the fitting of events using the selected event fitter and data filter.
- Parameters:
parameters (Dict[str, Any]) – Dictionary of parameters from the GUI controls.
- EventAnalysisView._handle_other_actions(action_name: str, parameters: Dict[str, Any]) None¶
Handle non-standard or plugin-specific actions that do not fall into predefined handlers.
- EventAnalysisView._handle_plot_events(parameters: Dict[str, Any]) None¶
Handle loading and plotting of selected events based on provided parameters.
- Parameters:
parameters (Dict[str, Any]) – Dictionary containing eventfinder, filter, channels, and event indices.
- EventAnalysisView._init() None¶
Initialize the EventAnalysisView. Called after constructor. Used to set up internal variables or state as needed.
- EventAnalysisView._reset_actions(axis_type: str = '2d') None¶
Clears the figure and reinitializes axes. This will also add a flag to the tab action history if @register_action is being used to keep track of actions. Only actions applied after the most recent call to this function will be recreated if the related file is loaded.
- Parameters:
axis_type (str) – Either ‘2d’ or ‘3d’ to determine plot projection.
- EventAnalysisView._set_control_area(layout: QBoxLayout) None¶
Set up the control area with widgets for user interaction.
- Parameters:
layout (QBoxLayout) – Layout to which the controls will be added.
- EventAnalysisView._shift_range_and_update_plot(parameters: Dict[str, Any], direction: str) None¶
Shift ranges in the GUI and update plot and input if valid.
- EventAnalysisView._start_eventfitter(eventfitter: str, data_filter: str, channels: int | List[int]) None¶
Start the event fitting process for the selected channel(s) using the given fitter and filter.
- EventAnalysisView._start_writer(writer: str, channels: int | List[int]) None¶
Start the process of writing committed events to the database for the given channels.
- EventAnalysisView._update_event_plot(event_data: Sequence[ndarray[tuple[int, ...], dtype[float64]]], labels: Sequence[str], num_events: int, vertical_lines: Sequence[List[float] | None], horizontal_lines: Sequence[List[float] | None], points: Sequence[List[Tuple[float, float]] | None], vlabels: Sequence[Sequence[str | None] | None], hlabels: Sequence[Sequence[str | None] | None], plabels: Sequence[Sequence[str | None] | None], use_raw: bool = False) None¶
Update the event plot with raw data, annotations, and formatting.
This method generates subplots for each event, displays time-series data, and optionally overlays vertical/horizontal lines and annotated points.
- Parameters:
event_data (Sequence[npt.NDArray[np.float64]]) – List of 1D arrays containing current traces for each event.
labels (Sequence[str]) – List of strings for each subplot’s title.
num_events (int) – Total number of events to plot (i.e., number of subplots).
vertical_lines (Sequence[Optional[List[float]]]) – List of lists of x-values for vertical line annotations per subplot.
horizontal_lines (Sequence[Optional[List[float]]]) – List of lists of y-values for horizontal line annotations per subplot.
points (Sequence[Optional[List[Tuple[float, float]]]]) – List of lists of (x, y) coordinate tuples for marker points per subplot.
vlabels (Sequence[Optional[Sequence[Optional[str]]]]) – One entry per subplot, each a list of labels for that subplot’s vertical lines, or None if the fitter supplied no labels. Individual labels may also be None.
hlabels (Sequence[Optional[Sequence[Optional[str]]]]) – One entry per subplot, each a list of labels for that subplot’s horizontal lines, or None if the fitter supplied no labels. Individual labels may also be None.
plabels (Sequence[Optional[Sequence[Optional[str]]]]) – One entry per subplot, each a list of labels for that subplot’s points, or None if the fitter supplied no labels. Individual labels may also be None.
use_raw (bool) – Whether to plot/cache the raw (unfiltered) trace entries in event_data (labeled “Raw”) alongside the filtered/fit ones. Entries so labeled are skipped entirely when this is False, regardless of whether the caller included them.
- Returns:
None
- Return type:
None