seantronsen / pvt

GNU General Public License v3.0
0 stars 0 forks source link

pvt -- Python Data Visualizer & Algorithm Tuner

A small collection of real-time data viewing utilities, initially created to satisfy the goal of enabling algorithmic tuning with rapid feedback.

With this viewer, your code is the bottleneck to the rendering pipeline rather than the renderer itself (looking at you JupyterLab \w matplotlib). In other words, this will render as quickly as your code can spit out the data.

Early Development Notice

Understand this project is in the early stages of development and while it remains quite functional, frequent changes should be expected when tracking the main branch. For this reason, the developer(s) recommend tracking one of the release tags for a more stable experience.

Installation

  1. Review the requirements and suggestions below.
  2. Open a shell and create / activate a fresh python virtual environment.
  3. Clone or submodule this repository.
  4. Navigate to the repository directory.
  5. Run make install-dev to install this package into the virtual environment, enabling use in any project.
  6. Mess around with the demo: python demo.py.
  7. Mess around with pyqtgraph's demos: python -c "import pvt; pvt.run_pyqtgraph_examples()"

Visualization Workflow

  1. Create an application instance (e.g. VisionViewer) as a QtApplication instance must exist before instantiating any widgets.

  2. Create all control widgets. Provide all instances with a key which will later be used to reference a unique element in the application state. Interacting with the widget will cause any subscribing display panes to be updated. Note that subscription occurs automatically when data and control panes are added to the viewer instance.

  3. Create all display panes (e.g. ImagePane), passing each a callback function to generate new frames for display. To make use of the application state, the arguments of the callback must share the same names as the key values provided to the control widgets created in step 2. Note the order of defined arguments doesn't matter nor do all possible arguments need to be specified if the function declares a **kwargs parameter. If there is no need to update the display, specify a default callback which performs no processing and merely returns the data to be displayed. Detailed examples are provided in the demo.py file.

  4. Add all panes to the viewer instance and execute the run method.

A Note about the Callback Interface

Instances of the StatefulPane class intuitively hold references to a State object. For the sake of brevity, understand that an indirect chain of callback functions is used to communicate changes to the underlying state to the pane interface. Those who are more curious are welcome to review the implementation details in the source code.

Requirements

Linux Users

Should work out of the box without any issues.

MacOS Users


brew install qt

Windows Users

Provided this is a Python project, it should be possible to run all of this on Windows with minimal changes. It's likely a similar issue to the missing Qt installation will be presented on this operating system. Open an issue if you run into any trouble or submit a pull request if you rectify the issue on your own and want to share the solution with others.

Help & Suggestions

Acknowledgements

This project was made possible by the efforts of the PyQtGraph team. If you enjoy any feature of this package, be sure to check out theirs for specifics and more advanced use cases.