magscope.ui.plots
=================

.. py:module:: magscope.ui.plots


Classes
-------

.. autoapisummary::

   magscope.ui.plots.PlotWorker
   magscope.ui.plots.TimeSeriesPlotBase
   magscope.ui.plots.TracksTimeSeriesPlot


Module Contents
---------------

.. py:class:: PlotWorker

   Bases: :py:obj:`PyQt6.QtCore.QObject`


   .. py:attribute:: image_signal


   .. py:attribute:: limits_signal


   .. py:attribute:: selected_bead_signal


   .. py:attribute:: reference_bead_signal


   .. py:attribute:: stop_signal


   .. py:attribute:: figure_size_signal


   .. py:attribute:: time_mode_signal


   .. py:attribute:: relative_window_signal


   .. py:attribute:: axes
      :type:  matplotlib.axes.Axes


   .. py:attribute:: locks
      :type:  dict[str, multiprocessing.synchronize.Lock]


   .. py:attribute:: figure
      :type:  matplotlib.figure.Figure | None
      :value: None



   .. py:attribute:: canvas
      :type:  matplotlib.backends.backend_qtagg.FigureCanvasQTAgg


   .. py:attribute:: _is_running
      :type:  bool
      :value: False



   .. py:attribute:: plots
      :value: []



   .. py:attribute:: limits
      :type:  dict[str, tuple[float, float]]


   .. py:attribute:: selected_bead
      :type:  int | None
      :value: 0



   .. py:attribute:: reference_bead
      :type:  int | None
      :value: None



   .. py:attribute:: n_plots
      :type:  int


   .. py:attribute:: update_on
      :type:  bool
      :value: True



   .. py:attribute:: _update_last_time
      :type:  float


   .. py:attribute:: fig_width
      :value: 5



   .. py:attribute:: fig_height
      :value: 4



   .. py:attribute:: dpi
      :value: 100



   .. py:attribute:: time_mode
      :value: 'absolute'



   .. py:attribute:: relative_window_seconds
      :type:  float | None
      :value: 300



   .. py:attribute:: _tracks_snapshot
      :type:  numpy.ndarray | None
      :value: None



   .. py:attribute:: mutex
      :type:  PyQt6.QtCore.QMutex


   .. py:attribute:: figure_size_changed
      :value: True



   .. py:method:: setup()


   .. py:method:: run()


   .. py:method:: do_main_loop()


   .. py:method:: add_plot(plot: TimeSeriesPlotBase)

      Used to add plots before the process has started



   .. py:method:: _set_limits(limits: dict[str, list[float, float]])


   .. py:method:: _set_selected_bead(bead: int)


   .. py:method:: _set_reference_bead(bead: int | None)


   .. py:method:: set_locks(locks: dict[str, multiprocessing.synchronize.Lock])


   .. py:method:: _stop()


   .. py:method:: dispose() -> None


   .. py:method:: _update_figure_size(width: int, height: int)

      Slot: update figure size based on QLabel dimensions.



   .. py:method:: _recreate_figure_if_needed()

      Recreate figure and canvas if size changed.



   .. py:method:: _set_time_mode(time_mode: str)


   .. py:method:: _set_relative_window(window_seconds: float | None)


   .. py:method:: _apply_time_axis_format()


.. py:class:: TimeSeriesPlotBase(buffer_name: str, ylabel: str)

   .. py:attribute:: buffer
      :type:  magscope.datatypes.MatrixBuffer


   .. py:attribute:: buffer_name


   .. py:attribute:: parent
      :type:  PlotWorker


   .. py:attribute:: axes
      :type:  matplotlib.axes.Axes


   .. py:attribute:: ylabel


   .. py:method:: setup()

      Called after the parent process is started



   .. py:method:: set_parent(parent: PlotWorker)


   .. py:method:: set_axes(axes: matplotlib.axes.Axes)


   .. py:method:: update()
      :abstractmethod:



.. py:class:: TracksTimeSeriesPlot(axis_name: str)

   Bases: :py:obj:`TimeSeriesPlotBase`


   .. py:attribute:: axis_name


   .. py:attribute:: axis_index


   .. py:attribute:: line
      :type:  matplotlib.lines.Line2D


   .. py:method:: setup()

      Called after the parent process is started



   .. py:method:: update()


