# Wave Viewer
A simple GUI for viewing waveforms. It plots the waveform with vispy in a
separate process. The GUI is built with PySide6.
The `WaveViewer` class is the main interface for the wave_viewer package. It
provides methods for adding and removing lines from the plot, clearing the plot,
and closing the GUI.
## Installation
```bash
pip install wave-viewer
```
## Usage
Below is a simple example of how to use the `WaveViewer` class. Avoid calling
`clear` if you only want to update the plot. It is more efficient to update the
plot with `add_line`.
```python
from wave_viewer import WaveViewer
import numpy as np
# This if statement is required for multiprocessing on Windows
if __name__ == "__main__":
# Create the viewer
viewer = WaveViewer()
# Add a line to the plot
x = np.arange(100000) / 2e9
y = np.exp(1j * 2 * np.pi * 1e6 * x)
ys = [y.real, y.imag]
viewer.add_line("line1", x, ys, offset=0)
# Add another line to the plot
viewer.add_line("line2", x, ys, offset=2)
# Auto scale the plot
viewer.autoscale()
# Remove the first line
viewer.remove_line("line1")
# Replace the second line
y = np.exp(1j * 2 * np.pi * 2e6 * x)
ys = [y.real, y.imag]
viewer.add_line("line2", x, ys, offset=2)
# Clear the plot
viewer.clear()
# Close the GUI
viewer.close()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/kahojyun/wave-viewer",
"name": "wave-viewer",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<3.12",
"maintainer_email": "",
"keywords": "",
"author": "Jiahao Yuan",
"author_email": "kaho0769@qq.com",
"download_url": "https://files.pythonhosted.org/packages/46/86/accbc8963545acaa8e7c1e21bd2825f88d61a7cd564d0ce5fb3788b94340/wave_viewer-0.2.2.tar.gz",
"platform": null,
"description": "# Wave Viewer\n\nA simple GUI for viewing waveforms. It plots the waveform with vispy in a\nseparate process. The GUI is built with PySide6.\n\nThe `WaveViewer` class is the main interface for the wave_viewer package. It\nprovides methods for adding and removing lines from the plot, clearing the plot,\nand closing the GUI.\n\n## Installation\n\n```bash\npip install wave-viewer\n```\n\n## Usage\n\nBelow is a simple example of how to use the `WaveViewer` class. Avoid calling\n`clear` if you only want to update the plot. It is more efficient to update the\nplot with `add_line`.\n\n```python\nfrom wave_viewer import WaveViewer\nimport numpy as np\n\n\n# This if statement is required for multiprocessing on Windows\nif __name__ == \"__main__\":\n # Create the viewer\n viewer = WaveViewer()\n\n # Add a line to the plot\n x = np.arange(100000) / 2e9\n y = np.exp(1j * 2 * np.pi * 1e6 * x)\n ys = [y.real, y.imag]\n viewer.add_line(\"line1\", x, ys, offset=0)\n\n # Add another line to the plot\n viewer.add_line(\"line2\", x, ys, offset=2)\n\n # Auto scale the plot\n viewer.autoscale()\n\n # Remove the first line\n viewer.remove_line(\"line1\")\n\n # Replace the second line\n y = np.exp(1j * 2 * np.pi * 2e6 * x)\n ys = [y.real, y.imag]\n viewer.add_line(\"line2\", x, ys, offset=2)\n\n # Clear the plot\n viewer.clear()\n\n # Close the GUI\n viewer.close()\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple GUI for viewing waveforms.",
"version": "0.2.2",
"project_urls": {
"Homepage": "https://github.com/kahojyun/wave-viewer",
"Repository": "https://github.com/kahojyun/wave-viewer"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a1b0de54379dbf74f662cde042184eeac493423035947eb871d257cf6cb1bbf3",
"md5": "a15e0d3b5bca0476a42f33b44a43f27d",
"sha256": "d7a6fe1e8f576e04452acc7cdc645c2b9909b8795c4b0d6019d4d93fe90f522f"
},
"downloads": -1,
"filename": "wave_viewer-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a15e0d3b5bca0476a42f33b44a43f27d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<3.12",
"size": 6813,
"upload_time": "2023-06-24T14:50:55",
"upload_time_iso_8601": "2023-06-24T14:50:55.342106Z",
"url": "https://files.pythonhosted.org/packages/a1/b0/de54379dbf74f662cde042184eeac493423035947eb871d257cf6cb1bbf3/wave_viewer-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4686accbc8963545acaa8e7c1e21bd2825f88d61a7cd564d0ce5fb3788b94340",
"md5": "82dfc81f8f2b872b477185ee4678865b",
"sha256": "e18405682a4ec389f1bc85dcddba5d6918f157d5175956905703667b9d490b9d"
},
"downloads": -1,
"filename": "wave_viewer-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "82dfc81f8f2b872b477185ee4678865b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<3.12",
"size": 5937,
"upload_time": "2023-06-24T14:50:56",
"upload_time_iso_8601": "2023-06-24T14:50:56.994402Z",
"url": "https://files.pythonhosted.org/packages/46/86/accbc8963545acaa8e7c1e21bd2825f88d61a7cd564d0ce5fb3788b94340/wave_viewer-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-24 14:50:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kahojyun",
"github_project": "wave-viewer",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "wave-viewer"
}