RawDataView¶
class RawDataView()
Bases: MetaEventTabView
Subclass of MetaEventTabView for visualizing raw signal data and PSD plots.
Handles plot rendering, signal responses, and interactions with readers, filters, and event finders.
Public Methods¶
- RawDataView.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.
- RawDataView.get_save_filename() str¶
Open a dialog to save a CSV file.
- Returns:
Selected file path, or an empty string if cancelled.
- Return type:
- RawDataView.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.
- RawDataView.handle_parameter_change(submodel_name: str, action_name: str, args: tuple) None¶
Handle parameter changes triggered by RawDataControls and dispatch the corresponding action.
- RawDataView.register_eventfinder_channels(channels_by_finder: Mapping[str, Sequence[int]]) None¶
Give each event finder not seen before a default time range for every channel.
The channel lookup is
RawDataController’s: it resolves every finder up front and hands the answers down. A finder absent fromchannels_by_finder, or present with no channels, is left unregistered so the next push retries it. Registering one whose lookup failed would leave it with empty time limits permanently, since nothing asks again for a finder it already knows.A finder already in
analysis_time_limitskeeps the ranges the user set on it; only genuinely new finders get defaults.
- RawDataView.set_commit_statuses(writer: str, statuses: List[Tuple[int, str | None]], experiment_name: str, output_file: str) None¶
Confirm replacing any channel the output already holds, then ask for the commit.
One prompt per held channel, as the event-finding prompt does, so declining one keeps that channel’s events and skips only it. A stored experiment name that differs from
experiment_nameis named in the prompt for the user to decide on: the events file keys on channel alone, so a Yes replaces the other experiment’s events.- Parameters:
- Returns:
None
- Return type:
None
- RawDataView.set_event_plot_data(event_data: Sequence[ndarray[tuple[int, ...], dtype[float64]]], time_bases: Sequence[ndarray[tuple[int, ...], dtype[float64]]], event_indices: Sequence[int]) None¶
Plot the events the Controller loaded, or report that there were none.
event_indicesis the surviving list: an event the finder could not supply is dropped by the Controller, so the traces and the indices labelling them stay aligned without this method having to prune anything.- Parameters:
event_data (Sequence[npt.NDArray[np.float64]]) – one array of samples per surviving event
time_bases (Sequence[npt.NDArray[np.float64]]) – one time axis per event in microseconds, index-aligned with event_data and built by MetaModel.time_bases
event_indices (Sequence[int]) – the event indices that produced data, index-aligned with event_data
- Returns:
None
- Return type:
None
- RawDataView.set_eventfinding_statuses(eventfinder: str, statuses: List[Tuple[int, bool]], data_filter: str) None¶
Confirm any already-finished channels, then ask for the approved ones to run.
The per-channel prompt is kept exactly as it was, including that declining one channel skips only that channel - a coarser guard that abandoned the batch would be a behaviour change.
A channel with no configured time limits stops the whole launch, as before. What changed is how it stops: it used to raise
KeyErrorout of this tab, which was survivable while the call chain started at a Qt signal on the View. It now runs inside a call from the Controller’s slot, where an escaping exception would reach Qt, so it is reported instead. Nothing launches either way.
- RawDataView.set_psd(Pxx_list: List[ndarray[tuple[int, ...], dtype[float64]]], rms_list: List[ndarray[tuple[int, ...], dtype[float64]]], frequency: ndarray[tuple[int, ...], dtype[float64]] | None, kept_indices: List[int]) None¶
Set the PSD and RMS lists for visualization.
- Parameters:
Pxx_list (List[npt.NDArray[np.float64]]) – Power spectral density data, one array per kept channel.
rms_list (List[npt.NDArray[np.float64]]) – RMS noise data, one array per kept channel.
frequency (Optional[npt.NDArray[np.float64]]) – Frequency axis data, or None if no channel was processed.
kept_indices (List[int]) – Indices into the channel list passed to calculate_psd that were successfully processed, since some channels may have been skipped.
- RawDataView.set_trace_data(data_list: Sequence[ndarray[tuple[int, ...], dtype[float64]]], time_bases: Sequence[ndarray[tuple[int, ...], dtype[float64]]], channels: Sequence[int], start: float, baseline: bool) None¶
Plot the trace the Controller loaded, or report that there was none.
The tail of
_handle_load_data_and_update_plot.channelsis the surviving list - a channel the reader could not supply is dropped by the Controller - so it anddata_liststay index-aligned without this method having to prune anything.- Parameters:
data_list (Sequence[npt.NDArray[np.float64]]) – one array per surviving channel
time_bases (Sequence[npt.NDArray[np.float64]]) – one time axis per channel, index-aligned with data_list
channels (Sequence[int]) – the channels that produced data, index-aligned with data_list
start (float) – the start time being plotted from
baseline (bool) – whether the user asked for the baseline band
- Returns:
None
- Return type:
None
- RawDataView.set_trace_for_psd(data_list: Sequence[ndarray[tuple[int, ...], dtype[float64]]], channels: Sequence[int]) None¶
Compute and draw the PSD of the trace the Controller loaded.
Only the loading happens elsewhere; the PSD computation below asks this tab’s own Controller through
calculate_psdand reads the answer back offpsd_kept_indicesand friends on the next statement. That read is safe because the connection is direct, soset_psdhas already run by the time it returns - an invariant worth knowing before anyone makes the connection queued.- Parameters:
data_list (Sequence[npt.NDArray[np.float64]]) – one array per surviving channel
channels (Sequence[int]) – the channels that produced data, index-aligned with data_list
- Returns:
None
- Return type:
None
- RawDataView.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.
- RawDataView.update_channels(channels: Sequence[int]) None¶
Update the channel combo box with available channels.
- Parameters:
channels (Sequence[int]) – Available channel identifiers.
- RawDataView.update_plot(data: Sequence[ndarray[tuple[int, ...], dtype[float64]]], time_bases: Sequence[ndarray[tuple[int, ...], dtype[float64]]], channels: Sequence[int], start: float = 0, baseline_stats: List[Tuple[float, float, float] | None] | None = None) None¶
Update the plot area with the provided data across multiple channels in a grid layout.
- Parameters:
data (Sequence[npt.NDArray[np.float64]]) – One array of current samples per channel.
time_bases (Sequence[npt.NDArray[np.float64]]) – One time axis per channel in seconds from the start of the recording, index-aligned with data. Built by MetaModel.time_bases, since the axis is a property of the samples and the rate they were taken at rather than of the drawing.
channels (Sequence[int]) – List of channel identifiers corresponding to the data.
start (float) – Time offset added to the plotted time axis, in seconds.
baseline_stats (Optional[List[Optional[Tuple[float, float, float]]]]) – Per-channel (amplitude, mean, stdev) from the Model, index-aligned with data, or None to draw no baseline overlay at all. An individual entry may be None where that channel’s fit failed.
- RawDataView.update_plot_samplerate(samplerate: float) None¶
Update the sampling rate used for plotting.
- Parameters:
samplerate (float) – Sampling frequency in Hz.
- RawDataView.update_psd(psd_data: Sequence[ndarray[tuple[int, ...], dtype[float64]]], rms_data: Sequence[ndarray[tuple[int, ...], dtype[float64]]], frequency: ndarray[tuple[int, ...], dtype[float64]], channels: Sequence[int]) None¶
Update the plot area with the provided psd and frequency data across multiple channels in a grid layout.
- Parameters:
psd_data (Sequence[npt.NDArray[np.float64]]) – Power spectral density values, one array for each channel.
rms_data (Sequence[npt.NDArray[np.float64]]) – Integrated RMS noise values corresponding to
psd_data, one array for each channel.frequency (npt.NDArray[np.float64]) – Frequency axis shared across all channels.
channels (Sequence[int]) – List of channel identifiers corresponding to the data.