pax_global_header00006660000000000000000000000064145724007120014514gustar00rootroot0000000000000052 comment=10960bed34d22d3e932232295ea3e4c082702035 pyqtgraph-pyqtgraph-0.13.4/000077500000000000000000000000001457240071200156355ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/.coveragerc000066400000000000000000000005131457240071200177550ustar00rootroot00000000000000[run] source = pyqtgraph branch = True [report] omit = */python?.?/* */site-packages/nose/* *test* */__pycache__/* *.pyc exclude_lines = pragma: no cover def __repr__ if self\.debug raise AssertionError raise NotImplementedError if 0: if __name__ == .__main__.: ignore_errors = True pyqtgraph-pyqtgraph-0.13.4/.flake8000066400000000000000000000002351457240071200170100ustar00rootroot00000000000000[flake8] exclude = .git,.tox,__pycache__,doc,old,build,dist show_source = True statistics = True verbose = 2 max-line-length = 88 extend-ignore = E203, W503 pyqtgraph-pyqtgraph-0.13.4/.github/000077500000000000000000000000001457240071200171755ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/.github/ISSUE_TEMPLATE/000077500000000000000000000000001457240071200213605ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/.github/ISSUE_TEMPLATE/bug_report.md000066400000000000000000000021011457240071200240440ustar00rootroot00000000000000--- name: Bug Report about: Create a report to help us improve title: '' labels: '' assignees: '' --- ### Short description ### Code to reproduce ```python import pyqtgraph as pg import numpy as np ``` ### Expected behavior ### Real behavior ``` An error occurred? Post the full traceback inside these 'code fences'! ``` ### Tested environment(s) * PyQtGraph version: * Qt Python binding: * Python version: * NumPy version: * Operating system: * Installation method: ### Additional context pyqtgraph-pyqtgraph-0.13.4/.github/dependabot.yml000066400000000000000000000007221457240071200220260ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: # Check for updates to GitHub Actions every weekday interval: "daily" - package-ecosystem: "pip" directory: "/doc" schedule: interval: "daily" - package-ecosystem: "pip" directory: ".github/workflows/etc" ignore: - dependency-name: "numpy" # NEP-29 governs supported versions of NumPy schedule: interval: "daily" pyqtgraph-pyqtgraph-0.13.4/.github/pull_request_template.md000066400000000000000000000020661457240071200241420ustar00rootroot00000000000000Detail the reasoning behind the code change. If there is an associated issue that this PR will resolve add Fixes # ### Other Tasks
Bump Dependency Versions ### Files that need updates Confirm the following files have been either updated or there has been a determination that no update is needed. - [ ] `README.md` - [ ] `setup.py` - [ ] `tox.ini` - [ ] `.github/workflows/main.yml` and associated `requirements.txt` and conda `environemt.yml` files - [ ] `pyproject.toml` - [ ] `binder/requirements.txt`
Pre-Release Checklist ### Pre Release Checklist - [ ] Update version info in `__init__.py` - [ ] Update `CHANGELOG` primarily using contents from automated changelog generation in GitHub release page - [ ] Have git tag in the format of pyqtgraph-
Post-Release Checklist ### Steps To Complete - [ ] Append `.dev0` to `__version__` in `__init__.py` - [ ] Announce on mail list - [ ] Announce on Twitter
pyqtgraph-pyqtgraph-0.13.4/.github/workflows/000077500000000000000000000000001457240071200212325ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/.github/workflows/etc/000077500000000000000000000000001457240071200220055ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/.github/workflows/etc/environment-pyqt.yml000066400000000000000000000001731457240071200260700ustar00rootroot00000000000000name: test channels: - conda-forge dependencies: - pyqt - qt-main - numpy - nomkl - scipy - pyopengl - pip pyqtgraph-pyqtgraph-0.13.4/.github/workflows/etc/environment-pyside.yml000066400000000000000000000001761457240071200263730ustar00rootroot00000000000000name: test channels: - conda-forge dependencies: - pyside2 - qt-main - numpy - nomkl - scipy - pyopengl - pip pyqtgraph-pyqtgraph-0.13.4/.github/workflows/etc/requirements.txt000066400000000000000000000006651457240071200253000ustar00rootroot00000000000000# numpy based on python version and NEP-29 requirements numpy; python_version == '3.10' numpy; python_version == '3.11' numpy~=1.22.0; python_version == '3.9' # image testing scipy==1.12.0 # optional high performance paths numba==0.59.0; python_version == '3.9' # optional 3D pyopengl==3.1.7 # supplimental tools matplotlib==3.8.3 h5py==3.10.0 # testing pytest==8.1.0 pytest-xdist==3.5.0 pytest-xvfb==3.0.0; sys_platform == 'linux' pyqtgraph-pyqtgraph-0.13.4/.github/workflows/main.yml000066400000000000000000000274701457240071200227130ustar00rootroot00000000000000name: main on: push: branches-ignore: "dependabot/**" pull_request: paths-ignore: - '**.md' env: PIP_DISABLE_PIP_VERSION_CHECK: 1 concurrency: group: ${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: run-mypy: runs-on: ubuntu-latest steps: - name: Setup Python uses: actions/setup-python@v5 with: python-version: "3.10" - name: Checkout uses: actions/checkout@v4 - name: Install mypy run: pip install mypy - name: Run mypy run: mypy test-pip: runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] qt-lib: [pyqt, pyside] python-version: ["3.9", "3.10", "3.11"] include: - python-version: "3.9" qt-lib: "pyqt" qt-version: "PyQt5~=5.15.0" - python-version: "3.9" qt-lib: "pyside" qt-version: "PySide2~=5.15.0" - python-version: "3.10" qt-lib: "pyqt" qt-version: "PyQt6~=6.2.0 PyQt6-Qt6~=6.2.0" - python-version: "3.10" qt-lib: "pyside" qt-version: "PySide6~=6.2.0" - python-version: "3.11" qt-lib: "pyqt" qt-version: "PyQt6" - python-version: "3.11" qt-lib: "pyside" qt-version: "PySide6-Essentials" steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: # Semantic version range syntax or exact version of a Python version python-version: ${{ matrix.python-version }} cache: pip - name: Get pip cache dir id: pip-cache run: | echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT shell: bash - name: pip cache uses: actions/cache@v4 with: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: "Install Windows-Mesa OpenGL DLL" if: runner.os == 'Windows' run: | curl -LJO https://github.com/pal1000/mesa-dist-win/releases/download/19.2.7/mesa3d-19.2.7-release-msvc.7z 7z x mesa3d-19.2.7-release-msvc.7z cd x64 xcopy opengl32.dll C:\windows\system32\mesadrv.dll* xcopy opengl32.dll C:\windows\syswow64\mesadrv.dll* REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DLL /t REG_SZ /d "mesadrv.dll" /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DriverVersion /t REG_DWORD /d 1 /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Flags /t REG_DWORD /d 1 /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Version /t REG_DWORD /d 2 /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DLL /t REG_SZ /d "mesadrv.dll" /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DriverVersion /t REG_DWORD /d 1 /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Flags /t REG_DWORD /d 1 /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Version /t REG_DWORD /d 2 /f shell: cmd - name: Install Dependencies run: | python -m pip install -r .github/workflows/etc/requirements.txt ${{ matrix.qt-version }} . - name: "Install Linux VirtualDisplay" if: runner.os == 'Linux' run: | sudo apt-get update -y --allow-releaseinfo-change sudo apt-get install --no-install-recommends -y \ libxkbcommon-x11-0 \ x11-utils \ libyaml-dev \ libegl1-mesa \ libxcb-icccm4 \ libxcb-image0 \ libxcb-keysyms1 \ libxcb-randr0 \ libxcb-render-util0 \ libxcb-xinerama0 \ libopengl0 \ libxcb-cursor0 - name: 'Debug Info' run: | echo python location: `which python` echo python version: `python --version` echo pytest location: `which pytest` echo installed packages python -m pip list echo pyqtgraph system info python -c "import pyqtgraph as pg; pg.systemInfo()" shell: bash env: QT_DEBUG_PLUGINS: 1 - name: 'XVFB Display Info' run: | xvfb-run --server-args="-screen 0, 1920x1200x24 -ac +extension GLX +render -noreset" python -m pyqtgraph.util.glinfo xvfb-run --server-args="-screen 0, 1920x1200x24 -ac +extension GLX +render -noreset" python -m pyqtgraph.util.get_resolution if: runner.os == 'Linux' - name: 'Display Info' run: | python -m pyqtgraph.util.glinfo python -m pyqtgraph.util.get_resolution if: runner.os != 'Linux' - name: Run Tests run: | mkdir $SCREENSHOT_DIR pytest tests -v pytest pyqtgraph/examples -v -n 2 shell: bash - name: Upload Screenshots uses: actions/upload-artifact@v4 with: name: Screenshots (Python ${{ matrix.python-version }} - Qt-Bindings ${{ matrix.qt-lib }} - OS ${{ matrix.os }}) path: $SCREENSHOT_DIR if-no-files-found: ignore env: SCREENSHOT_DIR: ./screenshots test-conda: runs-on: ${{ matrix.os }} timeout-minutes: 30 defaults: run: shell: bash -l {0} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] qt-lib: [pyqt, pyside] include: - qt-lib: pyqt environment-file: .github/workflows/etc/environment-pyqt.yml - qt-lib: pyside environment-file: .github/workflows/etc/environment-pyside.yml steps: - name: Checkout uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v3 with: miniforge-version: latest miniforge-variant: Mambaforge environment-file: ${{ matrix.environment-file }} auto-update-conda: false python-version: "3.10" use-mamba: true - name: "Install Test Framework" run: pip install pytest pytest-xdist - name: "Install Windows-Mesa OpenGL DLL" if: runner.os == 'Windows' run: | curl -LJO https://github.com/pal1000/mesa-dist-win/releases/download/19.2.7/mesa3d-19.2.7-release-msvc.7z 7z x mesa3d-19.2.7-release-msvc.7z cd x64 xcopy opengl32.dll C:\windows\system32\mesadrv.dll* xcopy opengl32.dll C:\windows\syswow64\mesadrv.dll* REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DLL /t REG_SZ /d "mesadrv.dll" /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DriverVersion /t REG_DWORD /d 1 /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Flags /t REG_DWORD /d 1 /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Version /t REG_DWORD /d 2 /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DLL /t REG_SZ /d "mesadrv.dll" /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DriverVersion /t REG_DWORD /d 1 /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Flags /t REG_DWORD /d 1 /f REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Version /t REG_DWORD /d 2 /f shell: cmd - name: "Install Linux VirtualDisplay" if: runner.os == 'Linux' run: | sudo apt-get update -y --allow-releaseinfo-change sudo apt-get install -y --no-install-recommends \ libxkbcommon-x11-0 \ x11-utils \ libyaml-dev \ libegl1-mesa \ libxcb-icccm4 \ libxcb-image0 \ libxcb-keysyms1 \ libxcb-randr0 \ libxcb-render-util0 \ libxcb-xinerama0 \ libopengl0 \ libxcb-cursor0 pip install pytest-xvfb - name: 'Debug Info' run: | echo python location: `which python` echo python version: `python --version` echo pytest location: `which pytest` echo installed packages conda list pip list echo pyqtgraph system info python -c "import pyqtgraph as pg; pg.systemInfo()" env: QT_DEBUG_PLUGINS: 1 - name: 'XVFB Display Info' run: | xvfb-run --server-args="-screen 0, 1920x1200x24 -ac +extension GLX +render -noreset" python -m pyqtgraph.util.glinfo xvfb-run --server-args="-screen 0, 1920x1200x24 -ac +extension GLX +render -noreset" python -m pyqtgraph.util.get_resolution if: runner.os == 'Linux' - name: 'Display Info' run: | python -m pyqtgraph.util.glinfo python -m pyqtgraph.util.get_resolution if: runner.os != 'Linux' - name: Run Tests run: | mkdir $SCREENSHOT_DIR pytest tests -v pytest pyqtgraph/examples -v -n 2 env: SCREENSHOT_DIR: ./screenshots build-wheel: name: build wheel runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Build Wheel run: | python -m pip install setuptools wheel python setup.py bdist_wheel analyze: name: analyze runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: # We must fetch at least the immediate parents so that if this is # a pull request then we can checkout the head. fetch-depth: 2 - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install Dependencies run: | python -m pip install PyQt5 numpy scipy echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: languages: 'python' # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. queries: +security-and-quality setup-python-dependencies: false # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild uses: github/codeql-action/autobuild@v3 # â„¹ï¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl # âœï¸ If the Autobuild fails above, remove it and uncomment the following three lines # and modify them (or add more) to build your code if your project # uses a compiled language #- run: | # make bootstrap # make release - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 pyqtgraph-pyqtgraph-0.13.4/.github/workflows/python-publish.yml000066400000000000000000000017771457240071200247560ustar00rootroot00000000000000# This workflows will upload a Python Package using setup.py/twine when a release is created # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries name: Upload Python Package on: release: types: [published] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies run: | python -m pip install --upgrade pip pip install wheel twine setuptools - name: Build and publish env: TWINE_USERNAME: __token__ # The PYPI_PASSWORD must be a pypi token with the "pypi-" prefix with sufficient permissions to upload this package # https://pypi.org/help/#apitoken TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | python setup.py sdist bdist_wheel twine upload dist/* pyqtgraph-pyqtgraph-0.13.4/.gitignore000066400000000000000000000026101457240071200176240ustar00rootroot00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python env/ bin/ build/ develop-eggs/ dist/ eggs/ lib/ lib64/ parts/ sdist/ var/ *.egg-info/ .installed.cfg *.egg # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ cover/ .coverage .cache nosetests.xml coverage.xml .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Mr Developer .mr.developer.cfg .project .pydevproject # Rope .ropeproject # Django stuff: *.log *.pot #mac .DS_Store *~ #vim *.swp #pycharm .idea/* #Dolphin browser files .directory/ .directory #Binary data files *.volume *.am *.tiff *.tif *.png !doc/source/**/*.png *.dat *.DAT # Sphinx documentation doc/_build/ doc/resource/api/generated/ # Enaml __enamlcache__/ # Sublime Text *.sublime-workspace *.sublime-project # pyright pyrightconfig.json # PyBuilder target/ MANIFEST deb_build rtr.cvs # ctags .tags* # asv artifcats .asv/ asv.conf.json # jupyter notebooks .ipynb_checkpoints # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # mypy .mypy_cache/ .dmypy.json dmypy.jsonpyqtgraph-pyqtgraph-0.13.4/.pre-commit-config.yaml000066400000000000000000000010161457240071200221140ustar00rootroot00000000000000repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - id: check-added-large-files args: ['--maxkb=100'] - id: check-case-conflict - id: end-of-file-fixer - id: fix-encoding-pragma args: ['--remove'] - id: mixed-line-ending args: [--fix=lf] - id: check-merge-conflict - id: check-toml - id: debug-statements - id: check-ast - repo: https://github.com/pycqa/isort rev: 5.12.0 hooks: - id: isort pyqtgraph-pyqtgraph-0.13.4/.readthedocs.yaml000066400000000000000000000005021457240071200210610ustar00rootroot00000000000000# Read the Docs configuration file # https://docs.readthedocs.io/en/stable/config-file/v2.html version: 2 build: os: ubuntu-22.04 tools: python: "3" apt_packages: - libopengl0 sphinx: fail_on_warning: true configuration: doc/source/conf.py python: install: - requirements: doc/requirements.txt pyqtgraph-pyqtgraph-0.13.4/CHANGELOG000066400000000000000000003122321457240071200170520ustar00rootroot00000000000000pyqtgraph-0.13.4 ## What's Changed ### Highlights * Optimize clip and downsample by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2719 * Drop python 3.8 and numpy 1.20 support by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2740 * speed up PColorMeshItem by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2768 * NonUniformImage improvements by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2764 * Fix 'import pyqtgraph.canvas' crash by @nicoddemus in https://github.com/pyqtgraph/pyqtgraph/pull/2934 * Add LabelItem font family option by @misantroop in https://github.com/pyqtgraph/pyqtgraph/pull/2919 ### API/Behavior Changes * Drop python 3.8 and numpy 1.20 support by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2740 * Add `dataBounds()` method to `TextItem` to make autoRange more predictable by @redruin1 in https://github.com/pyqtgraph/pyqtgraph/pull/2646 * speed up PColorMeshItem by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2768 * NonUniformImage improvements by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2764 * Adapt hide icon (invisible eye) to style of other icons by @stephan-senkbeil in https://github.com/pyqtgraph/pyqtgraph/pull/2731 * Add updatePristineValues arg to Parameter.setDefault by @outofculture in https://github.com/pyqtgraph/pyqtgraph/pull/2853 * Allow ROI context menu to show if non-removable by @samtygier in https://github.com/pyqtgraph/pyqtgraph/pull/2932 * Add LabelItem font family option by @misantroop in https://github.com/pyqtgraph/pyqtgraph/pull/2919 * Center exportDialog using screen geometry by @MorbidCuriosity84 in https://github.com/pyqtgraph/pyqtgraph/pull/2930 * Give siPrefix behavior to values of zero by @outofculture in https://github.com/pyqtgraph/pyqtgraph/pull/2842 * make ColorBarItem agnostic of the image kind by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2879 * Allow menu selection of ColorMap(s) by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2779 * AxisItem: Add adjustable label overlap tolerances, vertical overlap by default by @NilsNemitz in https://github.com/pyqtgraph/pyqtgraph/pull/2836 * chg: NodeGraphicsItem in Node.py by @Doralitze in https://github.com/pyqtgraph/pyqtgraph/pull/2869 * ScatterPlotItem: implement hidpi pixmap by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2863 * Axis ticker update by @NilsNemitz in https://github.com/pyqtgraph/pyqtgraph/pull/2827 * Preserve tick pen by @NilsNemitz in https://github.com/pyqtgraph/pyqtgraph/pull/2828 * Add turbo colormap to local ColorMaps and GradientEditorItem by @ptuemmler in https://github.com/pyqtgraph/pyqtgraph/pull/2778 ### Bug Fixes * GLViewWidget: fix mouse pos jumps when mouse tracking is off by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2698 * TypeError when using multiple pens for different lines by @adriandavidauer in https://github.com/pyqtgraph/pyqtgraph/pull/2704 * PySide6 6.5.1 compatibility updates by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2734 * guard against auto-downsample oscillation by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2726 * For SVG exports, shift PlotCurveItems to be about 0,0 by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2728 * Update TextItem.py by @dingo9 in https://github.com/pyqtgraph/pyqtgraph/pull/2761 * Fix invisible InfiniteLine at plot edges by @bbc131 in https://github.com/pyqtgraph/pyqtgraph/pull/2762 * Fix #2786: proper handling of slider parameter suffix by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2796 * fix: wrong key set to _pixelVectorCache by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2795 * PlotCurveItem check if args is None first by @JayanthBontha in https://github.com/pyqtgraph/pyqtgraph/pull/2835 * fixed recursive PlotWidget.__getattr__ calls by @nleclercq in https://github.com/pyqtgraph/pyqtgraph/pull/2860 * Do not move PlotCurveItem to origin by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2950 * close ROI handle subpath by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2949 * Add updatePristineValues arg to Parameter.setDefault by @outofculture in https://github.com/pyqtgraph/pyqtgraph/pull/2853 * Use non-deprecated method to access screen info by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2938 * coerce to dtype after creation by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2939 * disconnect only slots that got connected by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2923 * Prevent containerChanged from collapsing an entire container tree by @UsYer in https://github.com/pyqtgraph/pyqtgraph/pull/2888 * fix: paint method widget argument can be None by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2903 * Fix 'import pyqtgraph.canvas' crash by @nicoddemus in https://github.com/pyqtgraph/pyqtgraph/pull/2934 * Fix Python 3.12 `DeprecationWarning`: `datetime.datetime.utcfromtimestamp()` by @bersbersbers in https://github.com/pyqtgraph/pyqtgraph/pull/2848 * convert QPointF to QPoint before calling mapToScene() by @sevas in https://github.com/pyqtgraph/pyqtgraph/pull/2870 * Numpy > 1.20 by @MalteOlle in https://github.com/pyqtgraph/pyqtgraph/pull/2739 * Fix resizing ViewBox if aspect locked + apply ViewBox limits immediately by @bbc131 in https://github.com/pyqtgraph/pyqtgraph/pull/2799 ### Misc * bump to dev version by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2693 * Don't draw InfiniteLine anti-aliased if vertical or horizontal by @bbc131 in https://github.com/pyqtgraph/pyqtgraph/pull/2709 * Optimize clip and downsample by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2719 * WidgetGroup: avoid lambda by using self.sender() by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2694 * keep track of respective finiteness of x and y by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2720 * refactor GLViewWidget code into GLViewMixin by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2659 * Fix NumPy warning in test_functions by @swt2c in https://github.com/pyqtgraph/pyqtgraph/pull/2746 * generate random integers directly by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2748 * Fix tox config, bump min numpy to 1.22 by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2755 * Simplify fps computation by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2752 * Add iterations argparse argument to benchmarks by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2418 * export dialog - compare items by "is" rather than "==" (operator not implemented!) by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2758 * workaround Python 3.11.4 flag inversion issue by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2760 * use QGraphicsPixmapItem instead of ImageItem to draw colorbar by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2781 * ImageItem: cache nan check by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2784 * ImageItem: request for 256-entry lut by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2808 * update gitignore setting by @longqzh in https://github.com/pyqtgraph/pyqtgraph/pull/2834 * workaround PYSIDE-2487 for pen parameter by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2844 * ButtonItem: draw pixmap to logical size by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2873 * Allow release info change during apt-get update on ubuntu by @spchamp in https://github.com/pyqtgraph/pyqtgraph/pull/2893 * various fixes for NumPy 2.0 by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2894 * Fix typo invloved -> involved by @NilsIrl in https://github.com/pyqtgraph/pyqtgraph/pull/2905 * Add int typehint to ClickRadius by @robtau in https://github.com/pyqtgraph/pyqtgraph/pull/2943 * Refactor ImageItem QImage creation routines by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2944 * Better editable install by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2935 * Use QColor.fromString instead of deprecated QColor.setNamedColor by @zariiii9003 in https://github.com/pyqtgraph/pyqtgraph/pull/2877 * Add pickling to SRTTransform by @outofculture in https://github.com/pyqtgraph/pyqtgraph/pull/2914 * pcmi: refactor setData() by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2876 ### Docs * Update .readthedocs.yaml by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2732 * Address pydata-sphinx-theme warning by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2861 * Docs: Update Qt binding selection details by @veractor in https://github.com/pyqtgraph/pyqtgraph/pull/2807 * Bump pyqt6 from 6.5.0 to 6.5.1 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2741 * Bump pyqt6 from 6.5.1 to 6.5.2 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2780 * Bump pyqt6 from 6.5.2 to 6.5.3 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2846 * Bump pyqt6 from 6.5.3 to 6.6.0 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2862 * Bump pyqt6 from 6.6.0 to 6.6.1 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2895 * Bump sphinx from 6.1.3 to 6.2.1 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2705 * Bump sphinx from 6.2.1 to 7.1.0 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2782 * Bump sphinx from 7.1.0 to 7.1.2 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2791 * Bump sphinx from 7.1.2 to 7.2.2 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2802 * Bump sphinx from 7.2.2 to 7.2.3 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2806 * Bump sphinx from 7.2.3 to 7.2.4 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2809 * Bump sphinx from 7.2.4 to 7.2.5 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2813 * Bump sphinx from 7.2.5 to 7.2.6 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2821 * Bump pydata-sphinx-theme from 0.13.3 to 0.14.1 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2825 * Bump pydata-sphinx-theme from 0.14.2 to 0.14.3 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2865 * Bump pydata-sphinx-theme from 0.14.3 to 0.14.4 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2889 * Bump pydata-sphinx-theme from 0.14.4 to 0.15.2 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2916 * Bump sphinx-design from 0.4.1 to 0.5.0 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2783 ### Testing/CI * [CI] add mypy settings for CI by @longqzh in https://github.com/pyqtgraph/pyqtgraph/pull/2845 * fix: test Python 3.10 against Qt 6.2 by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2837 * cast float to signed int before to unsigned int by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2946 * Bump pyopengl from 3.1.6 to 3.1.7 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2730 * Bump h5py from 3.8.0 to 3.9.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2750 * Bump h5py from 3.9.0 to 3.10.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2839 * Bump pytest-xvfb from 2.0.0 to 3.0.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2735 * Bump pytest from 7.3.0 to 7.3.1 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2696 * Bump pytest from 7.3.1 to 7.3.2 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2743 * Bump pytest from 7.3.2 to 7.4.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2753 * Bump pytest from 7.4.0 to 7.4.2 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2817 * Bump pytest from 7.4.2 to 7.4.3 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2856 * Bump pytest from 7.4.3 to 8.0.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2922 * Bump pytest from 8.0.0 to 8.0.1 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2942 * Bump pytest from 8.0.1 to 8.0.2 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2945 * Bump pytest from 8.0.2 to 8.1.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2948 * Bump pytest-xdist from 3.2.1 to 3.3.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2722 * Bump pytest-xdist from 3.3.0 to 3.3.1 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2727 * Bump pytest-xdist from 3.3.1 to 3.4.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2880 * Bump pytest-xdist from 3.4.0 to 3.5.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2886 * Bump matplotlib from 3.7.1 to 3.7.2 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2766 * Bump matplotlib from 3.7.2 to 3.7.3 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2818 * Bump matplotlib from 3.7.3 to 3.8.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2823 * Bump matplotlib from 3.8.0 to 3.8.1 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2868 * Bump matplotlib from 3.8.1 to 3.8.2 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2885 * Bump matplotlib from 3.8.2 to 3.8.3 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2937 * Bump numba from 0.56.4 to 0.57.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2711 * Bump numba from 0.57.0 to 0.57.1 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2751 * Bump numba from 0.57.1 to 0.58.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2826 * Bump numba from 0.58.0 to 0.58.1 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2851 * Bump numba from 0.58.1 to 0.59.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2924 * Bump scipy from 1.10.1 to 1.11.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2757 * Bump scipy from 1.11.0 to 1.11.1 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2763 * Bump scipy from 1.11.1 to 1.11.2 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2803 * Bump scipy from 1.11.2 to 1.11.3 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2831 * Bump scipy from 1.11.3 to 1.11.4 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2884 * Bump scipy from 1.11.4 to 1.12.0 in /.github/workflows/etc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2917 * Bump actions/upload-artifact from 3 to 4 by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2902 * Bump actions/checkout from 3 to 4 by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2814 * Bump actions/cache from 3 to 4 by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2915 * Bump actions/setup-python from 4 to 5 by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2898 * Bump conda-incubator/setup-miniconda from 2 to 3 by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2890 * Bump github/codeql-action from 2 to 3 by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2901 ## New Contributors * @adriandavidauer made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2704 * @MalteOlle made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2739 * @redruin1 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2646 * @dingo9 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2761 * @stephan-senkbeil made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2731 * @ptuemmler made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2778 * @veractor made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2807 * @longqzh made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2834 * @nleclercq made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2860 * @bersbersbers made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2848 * @JayanthBontha made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2835 * @sevas made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2870 * @Doralitze made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2869 * @spchamp made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2893 * @NilsIrl made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2905 * @nicoddemus made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2934 * @MorbidCuriosity84 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2930 * @UsYer made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2888 * @misantroop made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2919 * @zariiii9003 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2877 * @samtygier made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2932 * @robtau made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2943 **Full Changelog**: https://github.com/pyqtgraph/pyqtgraph/compare/pyqtgraph-0.13.3...pyqtgraph-0.13.4 pyqtgraph-0.13.3 ## What's Changed ### Highlights * PySide6 6.5 Compatability ### Bug Fixes * Return float values from QColor in getByIndex by @nickdimitroff in https://github.com/pyqtgraph/pyqtgraph/pull/2648 * GLViewWidget: don't assume mouse tracking is disabled by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2653 * Tolerate an empty BarGraphItem by @jmakovicka in https://github.com/pyqtgraph/pyqtgraph/pull/2658 * Only apply nan mask workaround for cp version below 10.0. by @koenstrien in https://github.com/pyqtgraph/pyqtgraph/pull/2689 ### Misc * unify ndarray_from_qpolygonf implementation by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2654 * re-enable tests taking gui thread on PySide6 by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2657 * inherit GraphicsWidgetAnchor on the left-hand-side by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2662 * Prepare support for PySide6 drawLines and friends by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2596 * Avoid changing background colors of text and rows for group parameter… by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2683 ### Testing * Allow macOS to have fudge factor in test_polyROI by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2687 ### Docs * Update pydata-sphinx-theme and fix warnings by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2643 * Bump sphinx-design from 0.3.0 to 0.4.1 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2686 * Bump sphinx from 5.3.0 to 6.1.3 in /doc by @dependabot in https://github.com/pyqtgraph/pyqtgraph/pull/2585 ## New Contributors * @nickdimitroff made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2648 * @koenstrien made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2689 **Full Changelog**: https://github.com/pyqtgraph/pyqtgraph/compare/pyqtgraph-0.13.2...pyqtgraph-0.13.3 pyqtgraph-0.13.2 ## What's Changed ### Highlights * Fix InfiniteLine bounding rect calculation by @ixjlyons in https://github.com/pyqtgraph/pyqtgraph/pull/2407 * Allow plotting multiple data items at once by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2461 * Migrate to PyData Sphinx Theme - Restructure Docs by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2449 ### API/Behavior Changes * re-enable hmac authentication for win32 by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2465 * Add keyword argument in PColorMeshItem to enable consistent colormap scaling during animation by @SimenZhor in https://github.com/pyqtgraph/pyqtgraph/pull/2463 * fix: use connect='finite' if finite-ness of data is unknown by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2471 * Fix `ViewBox.autoRange()` for case of data with constant y-value by @bbc131 in https://github.com/pyqtgraph/pyqtgraph/pull/2489 * Make `ActionGroup` compatible with existing Parameter conventions by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2505 * Update `PenParameter` by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2536 * remove resizeEvent on screen change by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2546 * BarGraphItem: implement dataBounds and pixelPadding by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2565 * Maintain argument propagation for GLGraphicsItems to super class by @koutoftimer in https://github.com/pyqtgraph/pyqtgraph/pull/2516 * Accept custom ROI objects for ImageView by @ktahar in https://github.com/pyqtgraph/pyqtgraph/pull/2581 * PColorMeshItem colorbar support by @SimenZhor in https://github.com/pyqtgraph/pyqtgraph/pull/2477 * feat(PlotItem) define context menu action visibility by @jmkerloch in https://github.com/pyqtgraph/pyqtgraph/pull/2584 * Allow plotting multiple data items at once by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2461 ### Bug Fixes * Fix renderView to not use mremap on FreeBSD by @yurivict in https://github.com/pyqtgraph/pyqtgraph/pull/2445 * Fix action parameter button that is briefly made visible before getting a parent by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2451 * Fix InfiniteLine bounding rect calculation by @ixjlyons in https://github.com/pyqtgraph/pyqtgraph/pull/2407 * Fix disconnect of signal proxy by @dgoeries in https://github.com/pyqtgraph/pyqtgraph/pull/2453 * Fix ButtonItem hover event by @bbc131 in https://github.com/pyqtgraph/pyqtgraph/pull/2473 * test and fix for ChecklistParameter.show bug by @outofculture in https://github.com/pyqtgraph/pyqtgraph/pull/2480 * fix segmented line mode with no segments by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2481 * Prevent flickering `ActionGroup` when switching parameter trees by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2484 * fix: ndarray_from_qimage does not hold a reference to qimage by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2492 * Fix exportDialog drawn off screen by @aksy2512 in https://github.com/pyqtgraph/pyqtgraph/pull/2510 * partial fix for Qmenu leak by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2518 * Fix last QMenu leak and its associated segfaults by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2522 * fix setMaximumHeight(1e6) in SpinBox.py by @sem-geologist in https://github.com/pyqtgraph/pyqtgraph/pull/2519 * Use base_prefix to detect virtual env by @eendebakpt in https://github.com/pyqtgraph/pyqtgraph/pull/2566 * typo: dataRange -> dataBounds by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2589 * NonUniformImage: implement floating point boundingRect by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2587 * PColorMeshItem: implement dataBounds and pixelPadding by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2586 * BarGraphItem: calculate boundingRect without drawing by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2599 * Fix bounds handling when data is int16 or similar formats by @NilsNemitz in https://github.com/pyqtgraph/pyqtgraph/pull/2515 * ImageView: make .nframes() to use .axis['t'] instead of .shape[0] by @sem-geologist in https://github.com/pyqtgraph/pyqtgraph/pull/2623 * Fix GraphicsScene ValueError in mouseReleaseEvent by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2605 * PlotCurveItem error with stepMode="center", autoRange and autoVisible by @djdt in https://github.com/pyqtgraph/pyqtgraph/pull/2595 ### Examples * Fix #2482 argparse inputs were ignored by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2483 * PlotSpeedTest: reflect initial use_opengl state by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2487 * draw example histogram using BarGraphItem by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2556 ### Tests * ROI: Add test with mouseDrag event and check snapping by @dgoeries in https://github.com/pyqtgraph/pyqtgraph/pull/2476 * fix wrong logic for assert_alldead by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2503 * fix: instantiate QApplication for test_Parameter.py by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2539 * don't use pg.plot() in tests by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2625 ### Docs * Migrate to PyData Sphinx Theme - Restructure Docs by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2449 * Fix Qt crash course example by @Jaime02 in https://github.com/pyqtgraph/pyqtgraph/pull/2470 ### Other * Remove remaining templates by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2448 * Have canvas deprecation warning by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2446 * unify win32 and unix mmap codepaths by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2457 * Update setup.py, import distutils after setuptools by @LocutusOfBorg in https://github.com/pyqtgraph/pyqtgraph/pull/2459 * Raise appropriate Exceptions in place of generic exceptions by @Nibba2018 in https://github.com/pyqtgraph/pyqtgraph/pull/2474 * Remove old unused mains by @Jaime02 in https://github.com/pyqtgraph/pyqtgraph/pull/2490 * make DockDrop be a non-mixin by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2450 * Use non-deprecated QMouseEvent signatures by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2509 * Remove STRTransform main by @Jaime02 in https://github.com/pyqtgraph/pyqtgraph/pull/2466 * Minor improvements to `InteractiveFunction` ecosystem by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2521 * Improve `ChecklistParameter.setValue` logic. by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2544 * Remove antiquated Qt crash prevention by @NeilGirdhar in https://github.com/pyqtgraph/pyqtgraph/pull/2573 * create internals.PrimitiveArray by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2591 * rename "method" to "use_array" and make it keyword only by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2609 ## New Contributors * @yurivict made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2445 * @Jaime02 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2468 * @SimenZhor made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2463 * @Nibba2018 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2474 * @rookiepeng made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2491 * @aksy2512 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2510 * @noonchen made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2553 * @ZeitgeberH made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2559 * @NeilGirdhar made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2573 * @koutoftimer made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2516 * @ktahar made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2581 * @bilaljo made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2577 * @djdt made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2595 * @jmkerloch made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2584 **Full Changelog**: https://github.com/pyqtgraph/pyqtgraph/compare/pyqtgraph-0.13.1...pyqtgraph-0.13.2 pyqtgraph-0.13.1 ## What's Changed Bug Fixes * Refactor examples using `Interactor` to run on changing function parameters by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2437 API Change * deprecate GraphicsObject::parentChanged method by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2420 Other * Move Console to generic template and make font Courier New by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2435 pyqtgraph-0.13.0 ## What's Changed Highlights * With PyQt6 6.3.2+ PyQtGraph uses sip.array, which leads to significantly faster draw performance by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2314 * Introducing "interactive" parameter trees by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2318 * Minimum Qt version now 5.15 for Qt5 and 6.2+ for Qt6 by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2403 * with `enableExperimental` pyqtgraph accesses QPainterPathPrivate for faster QPainterPath generation by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2324 New Features * Interactive params fixup by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2318 * Added possibility to use custom dock labels by @ardiloot in https://github.com/pyqtgraph/pyqtgraph/pull/2274 * Introduce API option to control whether lines are drawn as segmented lines by @swvanbuuren in https://github.com/pyqtgraph/pyqtgraph/pull/2185 * access QPainterPathPrivate for faster arrayToQPath by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2324 * Update LabelItem to allow transparency in the text by @ElpadoCan in https://github.com/pyqtgraph/pyqtgraph/pull/2300 * Make parameter tree read-only values selectable and copiable by @ardiloot in https://github.com/pyqtgraph/pyqtgraph/pull/2311 * Have CSV exporter export error bar information by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2405 * map pyqtgraph symbols to a matplotlib equivalent by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2395 Performance Improvements * Improve performance of PlotCurveItem with QOpenGLWidget by @bbc131 in https://github.com/pyqtgraph/pyqtgraph/pull/2264 * ScatterPlotItem: use Format_ARGB32_Premultiplied by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2317 * access QPainterPathPrivate for faster arrayToQPath by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2324 * make use of PyQt sip.array by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2314 Bug Fixes * Fix GLImageItem regression by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2232 * Fixed the app crash on right clicked by @Cosmicoppai in https://github.com/pyqtgraph/pyqtgraph/pull/2236 * Fix Regression in in ViewBox.updateScaleBox Caused by #2034 by @campagnola in https://github.com/pyqtgraph/pyqtgraph/pull/2241 * Fix UFuncTypeError when plotting integer data on windows by @campagnola in https://github.com/pyqtgraph/pyqtgraph/pull/2249 * Fixed division by zero when no pixmap is loaded by @StSav012 in https://github.com/pyqtgraph/pyqtgraph/pull/2275 * Ensure in PlotCurveItem lookup occurs in tuple, not str by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2294 * Fixed a crash when `step` option is missing by @StSav012 in https://github.com/pyqtgraph/pyqtgraph/pull/2261 * Invalidate cached properties on geometryChanged signal by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2357 * Bugfix: Handle example search failure due to bad regex by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2121 * Address #2303 unapplied pen parameter constructor options by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2305 * Issue #2203 Potential Fix: Disabled FlowchartCtrlWidget.nodeRenamed o… by @HallowedDust5 in https://github.com/pyqtgraph/pyqtgraph/pull/2301 * Fix #2289 unwanted growing in scene context menu by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2306 * #2283 delete limitation by rectangle width ROI by @sasha-sem in https://github.com/pyqtgraph/pyqtgraph/pull/2285 * Update exception handling to catch exceptions in threads (py3 change) by @campagnola in https://github.com/pyqtgraph/pyqtgraph/pull/2309 * Fix PlotCurveItem errors when pen=None by @campagnola in https://github.com/pyqtgraph/pyqtgraph/pull/2315 * ScatterPlotItem point masking fix by @ardiloot in https://github.com/pyqtgraph/pyqtgraph/pull/2310 * Use property to lazily declare rectangle by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/2356 * Fix missing import in Flowchart.py by @Puff-Machine in https://github.com/pyqtgraph/pyqtgraph/pull/2421 * Fix doubling labels in DateAxisItem by @bbc131 in https://github.com/pyqtgraph/pyqtgraph/pull/2413 * GridItem: Fix pen for usage of dash-pattern by @bbc131 in https://github.com/pyqtgraph/pyqtgraph/pull/2304 * Update PColorMeshItem.py by @LarsVoxen in https://github.com/pyqtgraph/pyqtgraph/pull/2327 * Fix infinite loop within DateAxisItem by @bbc131 in https://github.com/pyqtgraph/pyqtgraph/pull/2365 * Fix GraphicsScene.itemsNearEvent and setClickRadius by @bbc131 in https://github.com/pyqtgraph/pyqtgraph/pull/2383 * Modify MatplotlibWidget to accept QWidget super constructor parameters. by @Dolphindalt in https://github.com/pyqtgraph/pyqtgraph/pull/2366 * Fix flickering, when panning/scrolling in a fully zoomed-out view by @bbc131 in https://github.com/pyqtgraph/pyqtgraph/pull/2387 * Make auto downsample factor calculation more robust by @StSav012 in https://github.com/pyqtgraph/pyqtgraph/pull/2253 * Fix : QPoint() no longer accepts float arguments by @campagnola in https://github.com/pyqtgraph/pyqtgraph/pull/2260 * avoid double __init__ of DockDrop by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2286 * Add a few ImageView improvements by @outofculture in https://github.com/pyqtgraph/pyqtgraph/pull/1828 API/Behavior Changes * remove border QGraphicsRectItem from scene by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2225 * Introduce API option to control whether lines are drawn as segmented lines by @swvanbuuren in https://github.com/pyqtgraph/pyqtgraph/pull/2185 * Modify CSV exporter to output original data without log mapping by @NilsNemitz in https://github.com/pyqtgraph/pyqtgraph/pull/2297 * Expose useCache ScatterPlotItem option from plot method by @ibrewster in https://github.com/pyqtgraph/pyqtgraph/pull/2258 * remove legend items manually from scene by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2368 * `getHistogramRange` for `HistogramLUTItem` by @kremeyer in https://github.com/pyqtgraph/pyqtgraph/pull/2397 * Axis pen improvements by @ibrewster in https://github.com/pyqtgraph/pyqtgraph/pull/2398 * remove MatplotlibWidget from pg namespace by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2400 * change the libOrder to favor Qt6 by @Wubbzi in https://github.com/pyqtgraph/pyqtgraph/pull/2157 Examples * Added Jupyter console widget and Example by @jonmatthis in https://github.com/pyqtgraph/pyqtgraph/pull/2353 * Add glow example by @edumur in https://github.com/pyqtgraph/pyqtgraph/pull/2242 * update multiplePlotSpeedTest.py to use PlotCurveItem instead of QGraphicsPathItem by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2426 Docs * Add GLTextItem to docs by @jebguth in https://github.com/pyqtgraph/pyqtgraph/pull/2419 * Add logo to docs by @ixjlyons in https://github.com/pyqtgraph/pyqtgraph/pull/2384 * Enable nit-picky mode in documentation and fix associated warnings by @j9ac9k in https://github.com/pyqtgraph/pyqtgraph/pull/1753 * Added UML class diagram to give overview of the most important classes by @titusjan in https://github.com/pyqtgraph/pyqtgraph/pull/1631 Other * Remove old Qt workarounds by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2224 * Track when ScatterPlotItem clears the tooltip, only clear when needed by @ixjlyons in https://github.com/pyqtgraph/pyqtgraph/pull/2235 * Avoid import error in HDF5 exporter by @campagnola in https://github.com/pyqtgraph/pyqtgraph/pull/2259 * test enum using : "enums & enum" by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2250 * add support for PySide6 6.3.0 QOverrideCursorGuard by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2263 * Used the power of `blockIfUnchanged` decorator by @StSav012 in https://github.com/pyqtgraph/pyqtgraph/pull/2181 * Handle/remove unused variables by @ksunden in https://github.com/pyqtgraph/pyqtgraph/pull/2094 * BusyCursor and QPainter fixes for PyPy by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2349 * Add a pyi stub file to import best-guess pyqt type hints by @outofculture in https://github.com/pyqtgraph/pyqtgraph/pull/2358 * test_PlotCurveItem: unset skipFiniteCheck for next test by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2313 * lazy create the rectangle selection item by @danielhrisca in https://github.com/pyqtgraph/pyqtgraph/pull/2168 * fix: super().__init__ does not need self by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2359 * Promote interactive `Run` action to group level by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2414 * Enhance testing for creating parameters from saved states by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2319 * add support for PySide6's usage of Python Enums by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2329 * remove QFileDialog PyQt4 compatibility code by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2394 * Bugfix: `interact` on decorated method that uses `self`. by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2408 * use single generic template for all bindings by @pijyoi in https://github.com/pyqtgraph/pyqtgraph/pull/2226 * `interact()` defaults to `ON_ACTION` behavior and accepts `runActionTemplate` argument by @ntjess in https://github.com/pyqtgraph/pyqtgraph/pull/2432 ## New Contributors * @andriyor made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2212 * @keziah55 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2191 * @Cosmicoppai made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2236 * @bbc131 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2264 * @StSav012 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2181 * @ardiloot made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2274 * @sasha-sem made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2285 * @swvanbuuren made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2185 * @Anatoly1010 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2330 * @LarsVoxen made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2327 * @HallowedDust5 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2301 * @ElpadoCan made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2300 * @dependabot made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2342 * @jaj42 made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2389 * @Dolphindalt made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2366 * @kremeyer made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2397 * @jonmatthis made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2353 * @jebguth made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2419 * @Puff-Machine made their first contribution in https://github.com/pyqtgraph/pyqtgraph/pull/2421 **Full Changelog**: https://github.com/pyqtgraph/pyqtgraph/compare/pyqtgraph-0.12.4...pyqtgraph-0.13.0 pyqtgraph-0.12.4 Highlights: - #2055 Jupyter Support via jupyter-rfb - #2011 Experimental High Performance With Lines > 1px Thickness - #2059/#2153 Python 3.10 Support New Features: - #2041 Allow unsetting various options in PlotDataItem and PlotCurveItem - #2052 PlotItem Average pen and shadow pen are now accessible - #2090 More coninient methods for color maps and bars Performance Enhancements: - #2023 PColorMeshItem Performance Improvements - #2032 Speed up PlotCurveItem fillLevel - #2036 Speed up arrayToQPath for connect='all' with non-finite values - #2111 PlotCurveItem OpenGL avoid automatic conversion from float64 to float32 - #2124 Go back to using np.clip on Windows with numpy 1.22 or newer - #2131 Avoid PyOpenGL automatic array conversion - #2198 Cache values used in GraphicsWidget .boundingRect() and .shape() methods - #2199 Avoid unnecessary call to viewRange if autoRange is disabled - #2202 Cachce ViewBox view pixel size Bug Fixes: - #2034 Fix Mouse Event possitioning issue with grid - #2047 Fixed WidgetGroup Handling QSplitter - #2054 Limit ViewBox based on double precision limitations - #2085 Reverse coordinates when drawing on row-major images - #2087 Fix broken imports in some examples - #2089 Don't raise exception when close method of an already-closed dock is called - #2101 Change GroupParameterItem palette to look ok in darkmode on macOS - #2103 Fix stuck ColorBarItem - #2132 Workaround for PySide6 6.2.2 breaking change - #2130 RangeColorMapItem derives from ColorMapParameter - #2147 Fire correct signal for Checklist ParameterItem type - #2148 Avoid comparing a string with a np.ndarray - #2170 Fix formatting on minimum value of GradientLegend API/Behavior Changes: - #2081 Separate x and y flags for AxisItem.setLogMode - #2086 ParameterTree PenParameter now uses GrouParameter instead of popup button - #2097 Add a proxy delay to checklist ParameterItem changes via children edits - #2192 Added option to makeARGB to disable masking NaNs Other: - #1915 Deprecate QtWidgets accessed through QtGui - #2002 isort and pycln prun over entire repo - #2038 Fixed various deprecations - #2045 Examples Directory moved inside project directory - #2051 Implement Pickle Protocol for RemoteGraphicsView - #2053 Disable unneeded call to ViewBox.prepareForPaint() - #2057 Avoid re-dispatching mouse events from the AxisItem - #2064 Add a quantization limit to ViewBox - #2073 Implementing glInfo without PyOpenGL - #2077 Improved error message for invalid PYQTGRAPH_QT_LIB - #2083 Added check for ROI to make sure its in a GraphicsScene - #2093 Add helpful exceptions for invalid inputs to some methods - #2096 Be lazier about importing h5py - #2098 Remove polluting import namespace using * - #2099 Convert == None to is None checks - #2100 Avoid re-using variables in nested loops - #2124 Fixed variety of deprecation warnings - #2154 Fix typos and formatting errors in comments/docstrings - #2194 stop using deprecated numpy.fromstring and use numpy.frombuffer instead pyqtgraph-0.12.3 Highlights: - PlotCurveItem render speed is now substantially faster - #1868/#1873 Example app now has filter text input - #1910 PlotSpeedTest now has parameter tree control panel New Features: - #1844 More parameter item types (File, Calendar, ProgressBar, Font, Pen, Slider) - #1865 Matplotlib colormaps viridis, plasma, magma and inferno are now included in pyqtgraph - #1911 Extend Colormap with HSL cycles and subset generation - #1932 Make anti-aliasing optional for paintGL in PlotCurveItem - #1944 Expand use of QColor functions/methods, including setNamedColor - #1952 Add checklist parameter item - #1998 ThreadTrace can now save to a file Performance Enhancement: - #1927 Reduce ColorMap inefficiencies - #1956 use QByteArray as backing store in arrayToQPath - #1965 perform arrayToQPath in chunks Bug Fixes: - #1845 Fix zoom behavior with showGrid by separating mouse events stolen by AxisItem - #1860 RemoteGraphicsView and RemoteSpeedTest now work under windows venv environments - #1865 Fixed matplotlib colormap importer code - #1869 Fix ColorBarItem tick position on export - #1871 Allow adding items to GLViewWidget before showing plot - #1875 Fix calls in mouse methods in GLViewWidgets due to missing event.localPos() in PyQt6 - #1876 Fix for improper placement of ROI handle positions in some cases - #1889/#2003 Fix call to drawText in GLTextItem and GLGradientLegendItem on Python 3.10 - #1897/#1902 Re-enable "experimental" feature with fix for PlotCurveItem with OpenGL on Windows - #1907 Fix GLVolumeItem example for arm64 platforms - #1909 Check if AxisItem.label is None before and exit early in resizeEvent - #1920 arrayToQPath can handle empty paths - #1936 QPolygonF creation can now handle empty arrays - #1968 Fix output of clip_array in colormap.modulatedBarData not being assigned - #1973 Fix PlotItem.updateDecimate unhiding intentionally hidden curves - #1974 Fix ImageView levelMode with levelMode == 'rgba' - #1987 Fix HistogramLUTItem itemChanged with use of autoLevel - #2009 Fix ROI curves hidding in ImageView API/Behavior Changes: - #1992 Reverted to traditional log10 mode for PlotDataItem - #1840 Allow border=False in GraphicsLayout - #1846 Reduced pollution to pg.namespace - #1853 ColorMap.getColors and getStops behavior changes - #1864 Draw GradientLegend in ViewBox coordinates - #1885 Raise TypeError instead of general Exception if functions.eq is unable to determine equality - #1903 Cleanup GLViewWidget - #1908 More readable parameters for ColorBarItem - #1914 Emit deprecation warning for use of pyqtgraph.ptime - #1928 Restore previous signature of TargetItem.setPos - #1940 fix log mode by reverting to previous formulation - #1954 Deprecate use of values opt for list parameter type - #1995 ColorButton now takes optional padding argument instead of hardcoded value of 6 Other: - #1862/#1901 MetaArray now under deprecation warning, to be removed in a future version - #1892 Add GLPainterItem Example - #1844 Debugged elusive intermitted CI segfault - #1870/#1891 Updated README.md - #1895 Update CONTRIBUTING.md - #1913 Bump sphinx and theme versions - #1919 Re-organize paramtypes - #1935 Remove some unused imports - #1939 Remove usage of python2_3.py - #1941 Remove str casting of QTextEdit.toPlainText output - #1942 Add EOF newline to files missing it - #1943 Remove python2 code paths - #1951 Fix typos in docs - #1957 Bump minimum numpy version to 1.18 - #1968 Fix ImageView calling deprecated QGraphicsItem.scale() - #1985 delegate float LUTs to makeARGB with warning - #2014 Replace couple absolute imports with relative imports pyqtgraph-0.12.2 Highlights - Qt6 6.0 support has been removed in favor of Qt6 6.1+ - More numba utilization, specifically for makeARGB - Substantial ImageItem performance improvements have been made thanks to @pijyoi and @outofculture - Significant performance improvements made to ScatterPlotItem and LinePlots - More ColorMap features/support (more are coming!) New Features - #1318 Added TargetItem - #1707 Added Qt 6.1 support - #1729 Allow gradient position to be configured on a histogram - #1742 Better support for plotting with gradients - #1776 Add GLTextItem - #1797 Add ColorMap linearization (using CIELab calculations), colorDistance functionality - #1865 Include viridis, magma, plasma, inferno, and cividis colormaps - #1868/#1873 Example app now has a filter text box to search for relevant examples Performance enhancement: - #1738, #1695, 1786, #1768, 1794 - ImageItem/makeARGB performance improvements - #1724 Use math module for scalar values math instead of numpy functions - #1796 Greatly speed up line plots with use-case of connect='all' - #1817 Speed up some cases of connect='finite' (few discontinuities) - #1829 Use QPainter.drawPixmapFragments for ScatterPlotItem Bug Fixes: - #1700 Fixed ROI getArrayRegion - #1748 Fixed bug when plotting boolean arrays in PlotDataItem - #1791 Callable LUTs being used on the ImageItem substrates - #1783 Fix memory leak in GLMeshItem - #1802 Updated cx_freeze example and added workaround for template files - #1804 Fix mouseClick handling for Qt6 on ROIs - #1799 Force cameraPosition() to return a Vector in GLViewWidget - #1809 Sanitize ShowGrid Alpha Input PlotItem - #1816 Fix bug with Parameter value failing with numpy array-like values - #1827 Fix BusyCursor to use internal stack provided by setOverrideCursor/restoreOverrideCursor - #1833 Fix ScatterPlot render issues for PyQt6 6.1.0 - #1843 Fix zoom only applied to y-axis with show grid - #1860 Fix pyqtgraph multiprocessing on Windows inside a venv environment - #1869 Fix color bar ticks not being drawn correctly during export - #1865 Fix matplotlib colormap import code - #1876 Fix LineROI handle positions being way off-base in some circumstances - #1871 Allow adding items to GLViewWidget before calling GLViewWidget.show() - #1864 Draw GradientLegend in ViewBox coordinate system with correct orientation - #1875 Fixed mouse events in GLViewWidget for PyQt6 bindings API/Behavior Changes: - #519 Expose clickable property in PlotDataItem - #1772 Keep ColorMap values for RGBA as uint8 - #1736 RemoteGraphicsView is now hidpi aware - #1779 Have SpinBox use fallback minStep in dec mode - #1706 Colors defined with hex string values must start with a # - #1819 Added method to disable autoscaling for HistogramLUTItem - #1638 Expose number of subsamples in ImageItem auto-level determination - #1824 Remove little-endian assumption for image export Other - #1807 Merge pyqtgraph/test-data repo into main repo, move test files to tests directory - #1862 Scheduled deprecation for MetaArray module - #1846 Cleaned up pg namespace pyqtgraph-0.12.1 New Features - #1596 - Add ColorBarItem for simplified image level adjustment Performance enhancement: - #1650 Don't use clip_array on scalers in DynamicPlotRange - #1617 Optimize makeARGB for ubyte images - #1648 Implement blocked variant of rescaleData API/Behavior Change: - #1690 Parameter Item default created from value if not present Bug Fixes: - #1665 Don't pass brush to mkPen in LegendItem.paint() - #1660 Include colormaps in the python wheel - #1653 Fix accidental disabling of style updates in PlotDataItem - #1647 Handle empty adjacency array for GraphItem - #1680 Fix test suite for big-endian architectures - #1694 DateAxisItem now accounts for Daylight Savings Time - #1691 Make sure dynamic range limiter runs on PlotDataItem pyqtgraph-0.12.0 Deprecations: - Qt < 5.12, Python < 3.7, and NumPy < 1.17 are no longer supported New Features: - Qt6 Compatibility (thank you so much @pijyoi !) - #1466 CuPy/CUDA support for ImageItem! (thanks you so much @outofculture !) - #1520/#1518 i18n Localization support for dialogs - #1497 Allow toggling visibility via mouse click on LegendItem - #1527 Expand parameter tree documentation - #1563 Fixes to FlowChart documentation - #1534 Extend pixmaps for GraphIcons - #1566 Toggle-able options for ScatterPlotSpeedTest.py - #1572 Arbitrary scale center ROI - #1581 Equilateral Triangle ROI Performance enhancement: - #1493 significant speedup to invertQTransform() - #1501 various ImageItem performance improvements - #1509 mkQApp will now have settings for better HiDPI settings - #1518 Small Optimizations for functions.rescaleData() - #1556 Reduce reallocation in PlotDataItem dynamic range limiter - #1560 Cache scatter-plot items by hashable properties - #1564 Correct id-based keyring of scatter plot pixmap cache - #1569 Fix ScatterPlotItem performance regression - #1619 Stop PlotDataItem from always sending full style information to PlotCurveItem/ScatterPlotItem - #1630 Combine levels and lut only if both are present - #1632/#1641/#1649 workaround for np.clip regression since numpy 1.17 - #1641 Introduce functions.clip_array as faster replacement for currently slow np.clip - #1637 PlotDataItem Fix viewRange <-> dynamic range limit - #1650 Introduce functions.clip_scalar to clip scalar values API/Behavior Change: - #1476 Use log modulus transform for y-axis log scaling - #1522 InfiniteLine emits clicked signal event - #1525 Use QOpenGLWidget instead of QGLWidget - #1540 Support siPrefix with no suffix in SpinBox - #1541 Use qWaitForWindowExposed instead of qWaitForWindowShown - #1554 Disable paint in GLScatterPlotItem if it has no data - #1573/1576 Add deprecation warnings to portions of library - #1587 qApp.property('darkMode') is now a dynamic property - #1613 Added keys() method to Parameter class - #1646 Removed unhelpful warnings - #1645 Make main stanza PyQt6 compatible - #1644 Deprecate use of hex strings that do not start with "#" in mkColor Bug Fixes: - #1487 Fix InfiniteLabel object has no attribute 'updateText' - #1491 LinearRegionItem would break with setSpan - #1496 enableMenu setting now preserved when passing ViewBox to PlotItem - #1498 PlotDataItem now signals on setPos() - #1500 AlignCenter should have been AlignHCenter - #1506 Fix "camerPosition" typo in GLViewWidget - #1510 Fix RemoteGraphicsView mouse interactions on Qt 5.12 - #1517 Fix RemoteSpeedTest Shutdown Errors - #1528 Support suffix for int parameters in SpinBox - #1546 ImageView guards against key events when there is no time axis - #1558 Fix Small Heights in ErrorBarItem - #1567 Handle 0-d arrays in InfiniteLine.setPos() - #1583 RawImageWidget fix port to QOpenGLWidget - #1594 PlotItem removeItem regression fixed - #1595 Workaround for CuPy Indexing Bug - #1597 Fix RawImageWidget transpose did not handle luminance only images - #1598 Remove references to self from lambdas for Signals - #1618 Install sys.excepthook for PyQt6 - #1639 Fix transformations in GradientLegend - #1647 Have GraphItem handle empty adjacency array - #1653 Fix accidentally styled updates in PlotDataItem - #1651 Use collections.abc for collections metaclasses in colormap.py pyqtgraph-0.11.1 New Features: - #800 Legend for bar graphs - #1244 Arrow scatter symbols - #161 Allow hiding individual points in scatter plot - #395 LegendItem display options - #1310 Added `Pa` to Units - #1310 `debug.ThreadTrace` add support for thread names - #117 Flow Chart Nodes now resized based on number of inputs/outputs - #1154 `DateAxisItem` - #1285 Improve control over ROI/handle pens - #1273 `PColorMeshItem` - #1397 `LegendItem` enable customization of label text size - #1422 Permit entry of non-finite values into float `SpinBox` - #1442 `TickSliderItem.allowRemote` property added - #1441 `Tick.removeAllowed` is now a regular property and used with `TickSliderItem` - #1388 Emit a signal when `GraphicsScene` `addItem` or `removeItem` methods called Performance enhancement: - #1240/#345 GLImageItem clear need update flag - #977 Faster computation option for pseudoscatter - #1297 Improve ArrowItem performance - #1296 Update `h5py` deps in metaarray - #1295 Improve TextItem performance - #1283 Performance improvements to arrayToQPath - #816 Avoid constructing shadow pens when no shadow pen is set - #1311 HistogramLUTItem detect trivial gradients - #1312 avoid extra work when setLabelAngle would have no effect - #1391 cache viewRect of `GraphicsItem` to reduce CPU load - #150 Slight speedup to ViewBox panning - #1420 Many ScatterPlot Improvements API/Behavior Change: - #496 Always antialias lines between gradient and region in HistogramLUTItem - #385 Add headWidth parameter to arrows - #551 fps variable on ImageView - #1251 Allow explicit utcOffset timezone in DateAxisItem - #1310 Add `SignalProxy.block` for temporary disabling of signal forwarding - #1310 `InfiniteLine.setPos` add support for array argument - #1310 Rate-limit Qt event processing in ProgressDialog if it is modal - #1289 Disable autoSIPrefix for DateAxisItem by default - #1274 Add tickAlpha to AxisItem Style Options - #402 Added `clear()` method to `GLViewWidget` - #1264 Added exception to checkOpenGLVersion to highlight OpenGL ES incompatibility - #1257 Make painter tick font dependent for AxisItem - #1256 Added `setState`, `setState` and `saveState` to `ROI` - #1324 Pass through kwargs from MultiPlotItem.plot to PlotItem.plot - #1387 ScatterPlotItem: Make + and x symbols thicker - #1362 Make flowchart.Terminal sortable - #1360 Add "left" and "right" step Modes to PlotCurveItem and PlotDataItem - #1414 Emit event with mouse clicks for some items - #1413 `InfiniteLine.viewTransformChanged` now calls superclass-method - #1411 Hide `WidgetParameterItem.defaultBtn` if param has no default - #1410 add fontSize kwarg to `Dock` - #159 Add wrapping option to `SpinBox` - #330 Set parameter default button `autoDefault` value to `False` - #157 Provide `WidgetGroupInterface` to `GradientWidget` - #151 Optional provide custom `PlotItem` to `PlotWidget` - #1140 Dynamic range limiting in `PlotDataItem` - #1383 GraphicsView set a transparent background palette - #1428 Add default color for `ColorMap` type in `ColorMapWidget` Bug Fixes: - #1239 Avoid adding PlotItem twice - #508 siScale precision - #503 Fix butg in RawImageWidget which resulted in mirrored image - #1242,#1267 Add the mouse event to the sigClicked signal in PlotCurveItem - #1247 Restore the now-deprecated PlotWindow and ImageWindow classes - #1249 Remove ScatterPlotItem's SpotItems during addItem call - #1252 Fix incorrect tick text boundaries calculation on axis by setting the font - #1310 Fixed `Vector.__init__` when used with `QVector3D` argument - #1310 Fix console exception filtering for python3 - #1310 BusyCursor only restore cursor after all nested levels have exited - #1310 `SimpleParameter.setValue` coerces argument to int if parameter type is int - #1307 Fixed `reload` methods for python3 - #1294 Various console fixes - #1293 Various Python3 code fixes - #1282 Handle Axis SI prefix scaling in MatplotlibExporter - #1276 Fix problems with high frequency gaming mice - #1270 Various fixes with AxisItem space being taken - #1272 `LegendItem.clear()` fixed - #1268 Check for container before setting dock orientation - #1312 Avoid divide by 0 condition in TargetItem - #1309 Properly retain and use hoverPen argument in _PolyLineSegment - #1371 Explicitly set line width in PlotCurveItem when using OpenGL - #1319 don't automatically reload modules without pyc - #1319 make ptime.time on py3 return precision wall-clock time - #1334 Edge case detection in PlotCurveItem - #1339 fix handling of QVector3D args in Vector.__init__ - #1336 Make `parent` an explicit kwarg of ArrowItem.__init__, avoid passing into setStyle - #1368 Disconnect from correct slots in Flowchart - #1364 fix log scaling - #963 Allow last image in stack to be selected by slider in ImageView - #1045 Raise AttributeError in __getattr__ in TabWindow - #960 Work around PySide setOverrideCursor bug in BusyCursor - #309 Encode QPropertyAnimation property name if not passed as bytes - #1072 Fix storing of ragged curves in HDF5Exporter - #1275 Fix Parameter.hasDefault - #1291 Get ImageView ROI working with both row and col major data - #1377 Consolidate and fix downsample factor computation in ImageItem - #1376 Fix PlotItem.setAxisItems - #1392 SignalProxy: Correct initialization without slot argument - #1306 Fix incorrect rendering of overlapping object in renderToArray() - #1349 Avoid calling method on undefined attribute - #1367 AxisItem: Account for empty strings in the visibility of text and units - #1356 Fix `ParameterTree` tree name and title handling - #1419 Fix `DataTreeWidget` dict sorting crash - #1408 Fix mouse interaction issues with `DockLabel` - #329 Fix bug where `int` and `float` parameter limits are not always set - #158 Make `DockArea` compatible with Qt Designer - #1405 Fix name setting in `ScatterPlotItem` options - #1403 Do not apply transparent background to Qt4 - #1468 Allow zero step in `ImageItem` - #1464 Remove `ViewBox.childGroup`'s `ItemClipsChildrenToShape` flag - #1461 arrayToQPath revert to old behavior of `connect=ndarray` parameter - #1459 Fix `TickSliderItem` to avoid ghost ticks - #1456 Resolve issue with `PlotCurveItem` with merging PRs in an incorrect order - #1287 Fill in non-finite plot values for Qt versions >= 5.12.3 - #1447 Clipped AxisItem tick value labels to prevent drawing artifacts - #1435 Fix autosize not taking to the correct range with `TextItem` in view - #1452 merge `InfiniteLine` caching calls - #1446 Fix `PlotDataItem.setData([], [])` - #1443 Fix Viewbox axis zoom in RectMode - #1439 Fix `TickSliderItem.setTickValue` when it references a `GradientEditorItem` method - #1361 Prevent item duplication in `Node` context menu - #1423 Fix typo in `kwargs` for `GridItem.setTextPen` - #1401 Fix width, height and background in SVG exporter - #1416 Handle case in `ROI` when `shape`, `vectors`, or `origin` keywords are passed in Maintenance: - #389 Revert workaround for upstream QT bug regarding mouse events - #1243 Ensure setPos in ROI is initialized correctly - #1241 Pin pytest-xvfb version on py2 - #1310 Added tests for `functions.subArray` - #1307 Add `ThreadSafeTimer` to `__init__.py` - #467 derivatePlots cleanup - #400 `ImageView.Timeline` better visibility - #1265 Make the documentation reproducible - #1319 clean up exception messages in console - #356 Fix some NumPy warnings - #1326 Improve docs for MultiPlotWidget and MultiPlotItem - #1331 Migrate imports of PyQt5's sip module to new namespace - #1370 Fix deprecation warning in multiprocess module - #308 Fix opt name for SpinBox: range -> bounds in UnsharpMaskNode example - #887 Update collections.abc imports - #1142 Miscellaneous doc fixups - #1169 Avoid using mutable default argument value - #1073 Python3 fixes - #1284 Update doc strings to clarify getArrayRegion API for ROI subclasses - #1042 Close windows at the end of test functions - #1374 Test warnings cleanup - #1375 Add targeted Vector test coverage - #1384 GLViewWidget.pan docstring typo - #1382 Autoformat LegendItem - #1396 Add tests for GraphicsView - #1399 Disable mouse rate limiting on test_ROI - #1409 Prepend conda-forge channel prior to env creation in CI - #1302 Fix Example app now works with Qt4/Python2 - #1402 Handle case of version string having no `+` - #1400 Fix sphinx warnings on `PColorMeshItem` - #1328 Add docs build job to CI - #1464 Use `conda-forge` on pyside2+linux - #1448 Fixes for `examples/CustomPlot.py` - #1432 ExampleApp fix to use `pg` module from directory pyqtgraph-0.11.0 NOTICE: This is the _last_ feature release to support Python 2 and Qt 4 (PyQt4 or pyside 1) New Features: - #101: GridItem formatting options - #410: SpinBox custom formatting options - #415: ROI.getArrayRegion supports nearest-neighbor interpolation (especially handy for label images) - #428: DataTreeWidget: - Add DiffTreeWidget, which highlights differences between two DataTreeWidgets - Improved support for displaying tracebacks - Use TableWidget to represent arrays rather than plain text - #446: Added Perceptually Uniform Sequential colormaps from the matplotlib 2.0 release - #476: Add option to set composition mode for scatterplotitem - #518: TreeWidget: - Add new signals: sigItemCheckStateChanged, sigItemTextChanged, sigColumnCountChanged - Allow setting expansion state of items before they are added to a treewidget - Support for using TreeWidget.invisibleRootItem() (see also #592, #595) - #542: Add collapsible QGroupBox widgets - #543: Add TargetItem: simple graphicsitem that draws a scale-invariant circle + crosshair - #544: Make DockArea.restoreState behavior configurable in cases where either a dock to be restored is missing, or an extra dock exists that is not mentioned in the restore state. - #545: Allow more types to be mapped through Transform3D - #548: Adds a disconnect() function that allows to conditionally disconnect signals, including after reload. Also, a SignalBlock class used to temporarily block a signal-slot pair - #557: Allow console stack to be set outside of exceptions (see also: pg.stack) - #558: CanvasItem save/restore, make Canvas ui easier to embed - #559: Image exporter gets option to invert value while leaving hue fixed - #560: Add function to enable faulthandler on all threads, also allow Mutex to be used as drop-in replacement for python's Lock - #567: Flowchart - Add several new data nodes - Add floordiv node - Add EvalNode.setCode - Binary operator nodes can select output array type - #568: LinearRegionItem - InfiniteLine can draw markers attached to the line - InfiniteLine can limit the region of the viewbox over which it is drawn - LinearRegionItem gets customizable line swap behavior (lines can block or push each other) - Added LinearRegionItem.setHoverBrush - #580: Allow calling sip.setapi in subprocess before pyqtgraph is imported - #582: Add ComboBox save/restoreState methods - #586: ParameterTree - Add GroupParameter.sigAddNew signal - systemsolver: add method for checking constraints / DOF - add systemsolver copy method - Parameter.child raises KeyError if requested child name does not exist - #587: Make PathButton margin customizable - #588: Add PlotCurveItem composition mode - #589: Add RulerROI - #591: Add nested progress dialogs - #597: Fancy new interactive fractal demo - #621: RGB mode for HistogramLUTWidget - #628,670: Add point selection in ScatterPlotWidget - #635: PySide2 support - #671: Add SVG export option to force non-scaling stroke - #676: OpenGL allow for panning in the plane of the camera - #683: Allow data filter entries to be updated after they are created - #685: Add option to set enum default values in DataFilterWidget - #710: Adds ability to rotate/scale ROIs by mouse drag on the ROI itself (using alt/shift modifiers) - #813,814,817: Performance improvements - #837: Added options for field variables in ColorMapWidget - #840, 932: Improve clipping behavior - #841: Set color of tick-labels separately - #922: Curve fill for fill-patches - #996: Allow the update of LegendItem - #1023: Add bookkeeping exporter parameters - #1072: HDF5Exporter handling of ragged curves with tests - #1124: Syntax highlighting for examples. - #1154: Date axis item - #393: NEW show/hide gradient ticks NEW link gradientEditor to others - #1211: Add support for running pyside2-uic binary to dynamically compile ui files API / behavior changes: - Deprecated graphicsWindow classes; these have been unnecessary for many years because widgets can be placed into a new window just by calling show(). - #158: Make DockArea compatible with Qt Designer - #406: Applying alpha mask on numpy.nan data values - #566: ArrowItem's `angle` option now rotates the arrow without affecting its coordinate system. The result is visually the same, but children of ArrowItem are no longer rotated (this allows screen-aligned text to be attached more easily). To mimic the old behavior, use ArrowItem.rotate() instead of the `angle` argument. - #673: Integer values in ParameterTree are now formatted as integer (%d) by default, rather than scientific notation (%g). This can be overridden by providing `format={value:g}` when creating the parameter. - #374: ConsoleWidget uses the console's namespace as both global and local scope, which - #410: SpinBox siPrefix without suffix is not longer allowed, select only numerical portion of text on focus-in allows functions defined in the console to access the global namespace. - #479,521: ParameterTree simple parameters check types before setting value - #555: multiprocess using callSync='sync' no longer returns a future in case of timeout - #583: eq() no longer compares array values if they have different shape - #589: Remove SpiralROI (this was unintentionally added in the first case) - #593: Override qAbort on slot exceptions for PyQt>=5.5 - #657: When a floating Dock window is closed, the dock is now returned home - #771: Suppress RuntimeWarning for arrays containing zeros in logscale - #942: If the visible GraphicsView is garbage collected, a warning is issued. - #958: Nicer Legend - #963: Last image in image-stack can now be selected with the z-slider - #992: Added a setter for GlGridItem.color. - #999: Make outline around fillLevel optional. - #1014: Enable various arguments as color in colormap. - #1044: Raise AttributeError in __getattr__ in graphicsWindows (deprecated) - #1055: Remove global for CONFIG_OPTIONS in setConfigOption - #1066: Add RemoteGraphicsView to __init__.py - #1069: Allow actions to display title instead of name - #1074: Validate min/max text inputs in ViewBoxMenu - #1076: Reset currentRow and currentCol on GraphicsLayout.clear() - #1079: Improve performance of updateData PlotCurveItem - #1082: Allow MetaArray.__array__ to accept an optional dtype arg - #841: set color of tick-labels separately - #1111: Add name label to GradientEditorItem - #1145: Pass showAxRect keyword arguments to setRange - #1184: improve SymbolAtlas.getSymbolCoords performance - #1198: improve SymbolAtlas.getSymbolCoords and ScatterPlotItem.plot performance - #1197: Disable remove ROI menu action in handle context menu - #1188: Added support for plot curve to handle both fill and connect args - #801: Remove use of GraphicsScene._addressCache in translateGraphicsItem - Deprecates registerObject meethod of GraphicsScene - Deprecates regstar argument to GraphicsScene.__init__ - #1166: pg.mkQApp: Pass non-empty string array to QApplication() as default - #1199: Pass non-empty sys.argv to QApplication - #1090: dump ExportDialog.exporterParameters - #1173: GraphicsLayout: Always call layout.activate() after adding items - #1097: pretty-print log-scale axes labels - #755: Check lastDownsample in viewTransformChanged - #1216: Add cache for mapRectFromView - #444: Fix duplicate menus in GradientEditorItem - #151: Optionally provide custom PlotItem to PlotWidget - #1093: Fix aspectRatio and zoom range issues when zooming - #390: moved some functionality from method 'export' to new method - #468: Patch/window handling - #392: new method 'getAxpectRatio' with code taken from 'setAspectLocked' - #1206: Added context menu option to parametertree - #1228: Minor improvements to LegendItem Bugfixes: - #88: Fixed image scatterplot export - #356: Fix some NumPy warnings - #408: Fix `cleanup` when the running qt application is not a QApplication - #410: SpinBox fixes - fixed bug with exponents disappearing after edit - fixed parsing of values with junk after suffix - fixed red border - reverted default decimals to 6 - make suffix editable (but show red border if it's wrong) - revert invalid text on focus lost - siPrefix without suffix is no longer allowed - fixed parametree sending invalid options to spinbox - fix spinbox wrapping (merged #159 from @lidstrom83) - fixed parametertree ignoring spinbox bounds (merged #329 from @lidstrom83) - fixed spinbox height too small for font size - ROI subclass getArrayRegion methods are a bit more consistent (still need work) - #424: Fix crash when running pyqtgraph with python -OO - #429: Fix fft premature slicing away of 0 freq bin - #458: Fixed image export problems with new numpy API - #478: Fixed PySide image memory leak - #475: Fixed unicode error when exporting to SVG with non-ascii symbols - #477: Fix handling of the value argument to functions.intColor - #485: Fixed incorrect height in VTickGroup - #514: Fixes bug where ViewBox emits sigRangeChanged before it has marked its transform dirty. - #516,668: Fix GL Views being half size on hidpi monitors - #526: Fix autorange exception with empty scatterplot - #528: Prevent image downsampling causing exception in makeQImage - #530: Fixed issue where setData only updated opts if data is given - #541: Fixed issue where render would error because 'mapToDevice' would return None if the view size was too small. - #553: Fixed legend size after remove item - #555: Fixed console color issues, problems with subprocess closing - #559: HDF5 exporter: check for ragged array length - #563: Prevent viewbox auto-scaling to items that are not in the same scene. (This could happen if an item that was previously added to the viewbox is then removed using scene.removeItem(). - #564: Allow console exception label to wrap text (prevents console growing too large for long exception messages) - #565: Fixed AxisItem preventing mouse events reaching the ViewBox if it is displaying grid lines and has its Z value set higher than the ViewBox. - #567: fix flowchart spinbox bounds - #569: PlotItem.addLegend will not try to add more than once - #570: ViewBox: make sure transform is up to date in all mapping functions - #577: Fix bargraphitem plotting horizontal bars - #581: Fix colormapwidget saveState - #586: ParameterTree - Make parameter name,value inint args go through setValue and setName - Fix colormapwidget saveState - #589: Fix click area for small ellipse/circle ROIs - #592,595: Fix InvisibleRootItem issues introduced in #518 - #596: Fix polyline click causing lines to bedrawn to the wrong node - #598: Better ParameterTree support for dark themes - #599: Prevent invalid list access in GraphicsScene - #623: Fix PyQt5 / ScatterPlot issue with custom symbols - #626: Fix OpenGL texture state leaking to wrong items - #627: Fix ConsoleWidget stack handling on python 3.5 - #633: Fix OpenGL cylinder geometry - #637: Fix TypeError in isosurface - #641,642: Fix SVG export on Qt5 / high-DPI displays - #645: ScatterPlotWidget behaves nicely when data contains infs - #653: ScatterPlotItem: Fix a GC memory leak due to numpy issue 6581 - #648: fix color ignored in GLGridItem - #671: Fixed SVG export failing if the first value of a plot is nan - #674: Fixed parallelizer leaking file handles - #675: Gracefully handle case where image data has size==0 - #679: Fix overflow in Point.length() - #682: Fix: mkQApp returned None if a QApplication was already created elsewhere - #689: ViewBox fix: don't call setRange with empty args - #693: Fix GLLinePlotItem setting color - #696: Fix error when using PlotDataItem with both stepMode and symbol - #697: Fix SpinBox validation on python 3 - #699: Fix nan handling in ImageItem.setData - #713: ConsoleWidget: Fixed up/down arrows sometimes unable to get back to the original (usually blank) input state - #715: Fix file dialog handling in Qt 5 - #718: Fix SVG export with items that require option.exposedRect - #721: Fixes mouse wheel ignoring disabled mouse axes -- although the scaling was correct, it was causing auto range to be disabled. - #723: Fix axis ticks when using self.scale - #739: Fix handling of 2-axis mouse wheel events - #742: Fix Metaarray in python 3 - #758: Fix remote graphicsview "ValueError: mmap length is greater than file size" on OSX. - #763: Fix OverflowError when using Auto Downsampling. - #767: Fix Image display for images with the same value everywhere. - #770: Fix GLVieWidget.setCameraPosition ignoring first parameter. - #782: Fix missing FileForwarder thread termination. - #787: Fix encoding errors in checkOpenGLVersion. - #793: Fix wrong default scaling in makeARGB - #815: Fixed mirroring of x-axis with "invert Axis" submenu. - #824: Fix several issues related with mouse movement and GraphicsView. - #832: Fix Permission error in tests due to unclosed filehandle. - #836: Fix tickSpacing bug that lead to axis not being drawn. - #861: Fix crash of PlotWidget if empty ErrorBarItem is added. - #868: Fix segfault on repeated closing of matplotlib exporter. - #875,876,887,934,947,980: Fix deprecation warnings. - #886: Fix flowchart saving on python3. - #888: Fix TreeWidget.topLevelItems in python3. - #924: Fix QWheelEvent in RemoteGraphicsView with pyqt5. - #935: Fix PlotItem.addLine with 'pos' and 'angle' parameter. - #949: Fix multiline parameters (such as arrays) reading from config files. - #951: Fix event firing from scale handler. - #952: Fix RotateFree handle dragging - #953: Fix HistogramLUTWidget with background parameter - #968: Fix Si units in AxisItem leading to an incorrect unit. - #970: Always update transform when setting angle of a TextItem - #971: Fix a segfault stemming from incorrect signal disconnection. - #972: Correctly include SI units for log AxisItems - #974: Fix recursion error when instancing CtrlNode. - #987: Fix visibility reset when PlotItems are removed. - #998: Fix QtProcess proxy being unable to handle numpy arrays with dtype uint8. - #1010: Fix matplotlib/CSV export. - #1012: Fix circular texture centering - #1015: Iterators are now converted to NumPy arrays. - #1016: Fix synchronisation of multiple ImageViews with time axis. - #1017: Fix duplicate paint calls emitted by Items on ViewBox. - #1019: Fix disappearing GLGridItems when PlotItems are removed and readded. - #1024: Prevent element-wise string comparison - #1031: Reset ParentItem to None on removing from PlotItem/ViewBox - #1044: Fix PlotCurveItem.paintGL - #1048: Fix bounding box for InfiniteLine - #1062: Fix flowchart context menu redundant menu - #1062: Fix a typo - #1073: Fix Python3 compatibility - #1083: Fix SVG export of scatter plots - #1085: Fix ofset when drawing symbol - #1101: Fix small oversight in LegendItem - #1113: Correctly call hasFaceIndexedData function - #1139: Bug fix in LegendItem for `setPen`, `setBrush` etc (Call update instead of paint) - #1110: fix for makeARGB error after #955 - #1063: Fix: AttributeError in ViewBox.setEnableMenu - #1151: ImageExporter py2-pyside fix with test - #1133: compatibility-fix for py2/pyside - #1152: Nanmask fix in makeARGB - #1159: Fix: Update axes after data is set - #1156: SVGExporter: Correct image pixelation - #1169: Replace default list arg with None - #770: Do not ignore pos argument of setCameraPosition - #1180: Fix: AxisItem tickFont is defined in two places while only one is used - #1168: GroupParameterItem: Did not pass changed options to ParameterItem - #1174: Fixed a possible race condition with linked views - #809: Fix selection of FlowchartWidget input/output nodes - #1071: Fix py3 execution in flowchart - #1212: Fix PixelVectors cache - #1161: Correctly import numpy where needed - #1218: Fix ParameterTree.clear() - #1175: Fix: Parameter tree ignores user-set 'expanded' state - #1219: Encode csv export header as unicode - #507: Fix Dock close event QLabel still running with no parent - #1222: py3 fix for ScatterPlotWidget.setSelectedFields - #1203: Image axis order bugfix - #1225: ParameterTree: Fix custom context menu Maintenance: - Lots of new unit tests - Lots of code cleanup - A lot of work on CI pipelines, test coverage and test passing (see e.g. #903,911) - #546: Add check for EINTR during example testing to avoid sporadic test failures on travis - #624: TravisCI no longer running python 2.6 tests - #695: "dev0" added to version string - #865,873,877 (and more): Implement Azure CI pipelines, fix Travis CI - #991: Use Azure Pipelines to do style checks, Add .pre-commit-config.yaml - #1042: Close windows at the end of test functions - #1046: Establish minimum numpy version, remove legacy workarounds - #1067: Make scipy dependency optional - #1114: doc: Fix small mistake in introduction - #1131: Update CI/tox and Enable More Tests - #1142: Miscellaneous doc fixups - #1179: DateAxisItem: AxisItem unlinking tests and doc fixed - #1201: Get readthedocs working - #1214: Pin PyVirtualDisplay Version - #1215: Skip test when on qt 5.9 - #1221: Identify pyqt5 5.15 ci issue - #1223: Remove workaround for memory leak in QImage - #1217: Get docs version and copyright year dynamically - #1229: Wrap text in tables in docs - #1231: Update readme for 0.11 release pyqtgraph-0.10.0 New Features: - PyQt5 support - Options for interpreting image data as either row-major or col-major - InfiniteLine and LinearRegionItem can have attached labels - DockArea: - Dock titles can be changed after creation - Added Dock.sigClosed - Added TextItem.setColor() - FillBetweenItem supports finite-connected curves (those that exclude nan/inf) API / behavior changes: - Improved ImageItem performance for some data types by scaling LUT instead of image - Change the defaut color kwarg to None in TextItem.setText() to avoid changing the color every time the text is changed. - FFT plots skip first sample if x-axis uses log scaling - Multiprocessing system adds bytes and unicode to the default list of no-proxy data types - Version number scheme changed to be PEP440-compliant (only affects installations from non- release git commits) Bugfixes: - Fix for numpy API change that caused casting errors for inplace operations - Fixed git version string generation on python3 - Fixed setting default values for out-of-bound points in pg.interpolateArray - Fixed plot downsampling bug on python 3 - Fixed invalid slice in ImageItem.getHistogram - DockArea: - Fixed adding Docks to DockArea after all Docks have been removed - Fixed DockArea save/restoreState when area is empty - Properly remove select box when export dialog is closed using window decorations - Remove all modifications to python builtins - Better Python 2.6 compatibility - Fix SpinBox decimals - Fixed numerous issues with ImageItem automatic downsampling - Fixed PlotItem average curves using incorrect stepMode - Fixed TableWidget eating key events - Prevent redundant updating of flowchart nodes with multiple inputs - Ignore wheel events in GraphicsView if mouse interaction is disabled - Correctly pass calls to QWidget.close() up the inheritance chain - ColorMap forces color inputs to be sorted - Fixed memory mapping for RemoteGraphicsView in OSX - Fixed QPropertyAnimation str/bytes handling - Fixed __version__ string update when using `setup.py install` with newer setuptools Maintenance: - Image comparison system for unit testing plus tests for several graphics items - Travis CI and coveralls/codecov support - Add examples to unit tests pyqtgraph-0.9.10 Fixed installation issues with more recent pip versions. pyqtgraph-0.9.9 API / behavior changes: - Dynamic import system abandoned; pg now uses static imports throughout. - Flowcharts and exporters have new pluggin systems - Version strings: - __init__.py in git repo now contains latest release version string (previously, only packaged releases had version strings). - installing from git checkout that does not correspond to a release commit will result in a more descriptive version string. - Speed improvements in functions.makeARGB - ImageItem is faster by avoiding makeQImage(transpose=True) - ComboBox will raise error when adding multiple items of the same name - ArrowItem.setStyle now updates style options rather than replacing them - Renamed GraphicsView signals to avoid collision with ViewBox signals that are wrapped in PlotWidget: sigRangeChanged => sigDeviceRangeChanged and sigTransformChanged => sigDeviceTransformChanged. - GLViewWidget.itemsAt() now measures y from top of widget to match mouse event position. - Made setPen() methods consistent throughout the package - Fix in GLScatterPlotItem requires that points will appear slightly more opaque (so you may need to adjust to lower alpha to achieve the same results) New Features: - Added ViewBox.setLimits() method - Adde ImageItem downsampling - New HDF5 example for working with very large datasets - Removed all dependency on scipy - Added Qt.loadUiType function for PySide - Simplified Profilers; can be activated with environmental variables - Added Dock.raiseDock() method - ComboBox updates: - Essentially a graphical interface to dict; all items have text and value - Assigns previously-selected text after list is cleared and repopulated - Get, set current value - Flowchart updates - Added Flowchart.sigChartChanged - Custom nodes may now be registered in sub-menu trees - ImageItem.getHistogram is more clever about constructing histograms - Added FillBetweenItem.setCurves() - MultiPlotWidget now has setMinimumPlotHeight method and displays scroll bar when plots do not fit inside the widget. - Added BarGraphItem.shape() to allow better mouse interaction - Added MeshData.cylinder - Added ViewBox.setBackgroundColor() and GLViewWidget.setBackgroundColor() - Utilities / debugging tools - Mutex used for tracing deadlocks - Color output on terminal - Multiprocess debugging colors messages by process - Stdout filter that colors text by thread - PeriodicTrace used to report deadlocks - Added AxisItem.setStyle() - Added configurable formatting for TableWidget - Added 'stepMode' argument to PlotDataItem() - Added ViewBox.invertX() - Docks now have optional close button - Added InfiniteLine.setHoverPen - Added GLVolumeItem.setData - Added PolyLineROI.setPoints, clearPoints, saveState, setState - Added ErrorBarItem.setData Bugfixes: - PlotCurveItem now has correct clicking behavior--clicks within a few px of the line will trigger a signal. - Fixes related to CSV exporter: - CSV headers include data names, if available - Exporter correctly handles items with no data - pg.plot() avoids creating empty data item - removed call to reduce() from exporter; not available in python 3 - Gave .name() methods to PlotDataItem, PlotCurveItem, and ScatterPlotItem - fixed ImageItem handling of rgb images - fixed makeARGB re-ordering of color channels - fixed unicode usage in AxisItem tick strings - fixed PlotCurveItem generating exceptions when data has length=0 - fixed ImageView.setImage only working once - PolyLineROI.setPen() now changes the pen of its segments as well - Prevent divide-by-zero in AxisItem - Major speedup when using ScatterPlotItem in pxMode - PlotCurveItem ignores clip-to-view when auto range is enabled - FillBetweenItem now forces PlotCurveItem to generate path - Fixed import errors and py3 issues in MultiPlotWidget - Isosurface works for arrays with shapes > 255 - Fixed ImageItem exception building histogram when image has only one value - Fixed MeshData exception caused when vertexes have no matching faces - Fixed GLViewWidget exception handler - Fixed unicode support in Dock - Fixed PySide crash caused by emitting signal from GraphicsObject.itemChange - Fixed possible infinite loop from FiniteCache - Allow images with NaN in ImageView - MeshData can generate edges from face-indexed vertexes - Fixed multiprocess deadlocks on windows - Fixed GLGridItem.setSize - Fixed parametertree.Parameter.sigValueChanging - Fixed AxisItem.__init__(showValues=False) - Fixed TableWidget append / sort issues - Fixed AxisItem not resizing text area when setTicks() is used - Removed a few cyclic references - Fixed Parameter 'readonly' option for bool, color, and text parameter types - Fixed alpha on GLScatterPlotItem spots (formerly maxed out at alpha=200) - Fixed a few bugs causing exit crashes pyqtgraph-0.9.8 2013-11-24 API / behavior changes: - ViewBox will auto-range when ImageItem changes shape - AxisItem: - Smarter about deciding which ticks get text - AxisItem.setScale(float) has the usual behavior, but .setScale(None) is deprecated. Instead use: AxisItem.enableAutoSIPrefix(bool) to enable/disable SI prefix scaling - Removed inf/nan checking from PlotDataItem and PlotCurveItem; improved performance New Features: - Support for dynamic downsampling and view clipping in PlotDataItem and PlotItem - Added 'connect' option to PlotDataItem and PlotCurveItem to affect which line segments are drawn - Support for FFT with non-uniform time sampling - Added BarGraphItem - OpenGL: - Added export methods to GLViewWidget - Wireframe meshes - GLLinePLotItem gets antialiasing, accepts array of colors - GLMeshItem accepts ShaderProgram or name of predefined program - Added GLBarGraphItem - LegendItem: - User-draggable - Allow custom ItemSamples - Symbol support - Support for removing items - ScatterPlotWidget, ColorMapWidget, and DataFilterWidget are stable - TableWidget: - Made numerically sortable - Added setEditable method - AxisItem ability to truncate axis lines at the last tick - arrayToQPath() added 'finite' connection mode which omits non-finite values from connections - pg.plot() and pg.PlotWidget() now accept background argument - Allow QtProcess without local QApplication - Support for dashing in mkPen() - Added Dock.close() - Added style options to flowchart connection lines - Added parentChanged and viewChanged hooks to GraphicsItem - Bidirectional pseudoScatter for beeswarm plots - Added exit() function for working around PyQt exit crashes - Added PolylineROI.getArrayRegion() Bugfixes: - Many Python 3 compatibility fixes - AxisItem: - Correctly handles scaling with values that are not power of 10 - Did not update grid line length when plot stretches - Fixed unicode handling in AxisItem label - ViewBox: - Overhauled to fix issues with aspect locking - ViewBox context menu elements are no longer deleted when using flowchart with pyside - Fixed view linking with inverted y axis - Prevent auto-range disabling when dragging with one mouse axis diabled - Ignore inf and nan when auto-ranging - ParameterTree: - fixed TextParameter editor disappearing after focus lost - ListParameter: allow unhashable types as parameter values. - Exporting: - ImageExporter correctly handles QBrush with style=NoBrush - SVGExporter text, gradients working correctly - SVGExporter correctly handles coordinate corrections for groups with mixed elements - ImageView: - Fixed auto-levelling when normalization options change - Added autoHistogramRange argument to setImage - ScatterPlotItem: - Fixed crashes caused by ScatterPlotItem - Fixed antialiasing - arrayToQPath performance improved for python 3 - Fixed makeQImage on many platforms (notably, on newer PyQt APIs) - Removed unnecessary scipy imports for faster import - GraphItem reports pixel margins to improve auto-range - Add backport ordereddict to repository; old OrderedDict class is removed - Corrected behavior of GraphicsView.setBackground - Fixed PySide bug listing image formats - Fixed QString -> str conversions in flowchart - Unicode file name support when exporting - Fixed MatplotlibWidget + PySide - Fixed 3D view updating after every scene change - Fixed handling of non-native dtypes when optimizing with weave - RemoteGraphicsView fixed for PyQt 4.10, Python 3 - Fixed GLLinePlotItem line width option - HistogramLUTWidget obeys default background color - ScaleBar complete rewrite - GraphItem obeys antialiasing flag - Workaround for PySide/QByteArray memory leak - Fixed example --test on windows, python3 - Luke finished dissertation pyqtgraph-0.9.7 2013-02-25 Bugfixes: - ArrowItem auto range now works correctly - Dock drag/drop fixed on PySide - Made padding behavior consistent across ViewBox methods - Fixed MeshData / python2.6 incompatibility - Fixed ScatterPlotItem.setSize and .setPointData - Workaround for PySide bug; GradientEditor fixed - Prefer initially selecting PlotItem rather then ViewBox when exporting - Fixed python3 import error with flowcharts Cleaned up examples, made code editable from example loader Minor documentation updates Features: - Added GraphItem class for displaying networks/trees - Added ColorMap class for mapping linear gradients and generating lookup tables (Provides gradient editor functionality without the GUI) - Added ColorMapWidget for complex user-defined color mapping - Added ScatterPlotWidget for exploring relationships in multi-column tables - Added ErrorBarItem - SVG and image exporters can now copy to clipboard - PlotItem gets new methods: addLine, setLabels, and listDataItems - AxisItem gets setTickFont method - Added functions.arrayToQPath, shared between GraphItem and PlotCurveItem - Added gradient editors to parametertree - Expanded documentation, added beginning of Qt crash course Bugfixes: - Fixed auto-ranging bugs: ViewBox now properly handles pixel-padding around data items - ViewBox ignores bounds of zoom-rect when auto ranging - Fixed AxisItem artifacts - Fixed GraphicsItem.pixelVector caching bugs and simplified workaround for fp-precision errors - LinearRegionItem.hoverEvent obeys 'movable' flag - Fixed PlotDataItem nan masking bugs - Workaround for segmentation fault in QPainter.drawPixmapFragments - multiprocess and RemoteGraphicsView work correctly in Windows. - Expanded python 3 support - Silenced weave errors by default - Fixed " 'win' in sys.platform " occurrences matching 'darwin' (duh) - Workaround for change in QImage API (PyQt 4.9.6) - Fixed axis ordering bug in GLScatterPlotItem pyqtgraph-0.9.6 2013-02-14 Features: - Added GraphItem class for displaying networks/trees - Added ColorMap class for mapping linear gradients and generating lookup tables (Provides gradient editor functionality without the GUI) - Added ColorMapWidget for complex user-defined color mapping - Added ScatterPlotWidget for exploring relationships in multi-column tables - Added ErrorBarItem - SVG and image exporters can now copy to clipboard - PlotItem gets new methods: addLine, setLabels, and listDataItems - AxisItem gets setTickFont method - Added functions.arrayToQPath, shared between GraphItem and PlotCurveItem - Added gradient editors to parametertree - Expanded documentation, added beginning of Qt crash course Bugfixes: - Fixed auto-ranging bugs: ViewBox now properly handles pixel-padding around data items - ViewBox ignores bounds of zoom-rect when auto ranging - Fixed AxisItem artifacts - Fixed GraphicsItem.pixelVector caching bugs and simplified workaround for fp-precision errors - LinearRegionItem.hoverEvent obeys 'movable' flag - Fixed PlotDataItem nan masking bugs - Workaround for segmentation fault in QPainter.drawPixmapFragments - multiprocess and RemoteGraphicsView work correctly in Windows. - Expanded python 3 support - Silenced weave errors by default - Fixed " 'win' in sys.platform " occurrences matching 'darwin' (duh) - Workaround for change in QImage API (PyQt 4.9.6) - Fixed axis ordering bug in GLScatterPlotItem Plotting performance improvements: - AxisItem shows fewer tick levels in some cases. - Lots of boundingRect and dataBounds caching (improves ViewBox auto-range performance, especially with multiple plots) - GraphicsScene avoids testing for hover intersections with non-hoverable items (much less slowdown when moving mouse over plots) Improved performance for remote plotting: - reduced cost of transferring arrays between processes (pickle is too slow) - avoid unnecessary synchronous calls Added RemoteSpeedTest example pyqtgraph-0.9.5 2013-01-11 Plotting performance improvements: - AxisItem shows fewer tick levels in some cases. - Lots of boundingRect and dataBounds caching (improves ViewBox auto-range performance, especially with multiple plots) - GraphicsScene avoids testing for hover intersections with non-hoverable items (much less slowdown when moving mouse over plots) Improved performance for remote plotting: - reduced cost of transferring arrays between processes (pickle is too slow) - avoid unnecessary synchronous calls Added RemoteSpeedTest example Documentation: - Added documentation on export system - Added flowchart documentation and custom node example Bugfixes: - prevent PlotCurveItem drawing shadow when unnecessary - deprecated flowchart.Node.__getattr__ -- causes too many problems. pyqtgraph-0.9.4 2013-01-07 Documentation: - Added documentation on export system - Added flowchart documentation and custom node example Bugfixes: - prevent PlotCurveItem drawing shadow when unnecessary - deprecated flowchart.Node.__getattr__ -- causes too many problems. Bugfix: prevent adding invalid entry to sys.path when running examples pyqtgraph-0.9.3 2012-12-29 Bugfix: prevent adding invalid entry to sys.path when running examples Bugfixes: - SVG export text elements use generic font-family as backup, corrected item transformation issues - Fixed RuntimeError caused when clearing item hierarchies from ViewBox - Fixed example execution bug Packaging maintenance: - Added missing files to MANIFEST.in, fixed setup.py package detection - Added debian control files for building source packages - Fixed version numbering in doc, __init__.py pyqtgraph-0.9.2 2012-12-29 Bugfixes: - SVG export text elements use generic font-family as backup, corrected item transformation issues - Fixed RuntimeError caused when clearing item hierarchies from ViewBox - Fixed example execution bug Packaging maintenance: - Added missing files to MANIFEST.in, fixed setup.py package detection - Added debian control files for building source packages - Fixed version numbering in doc, __init__.py pyqtgraph-0.9.1 2012-12-27 Removed incorrect version numbers Correction to setup.py - use install_requires to inform pip of dependencies. Fixed doc version (again) Added debian control files bugfixes for new package structure pyqtgraph-0.9.0 2012-12-27 * Initial release. pyqtgraph-pyqtgraph-0.13.4/CODE_OF_CONDUCT.md000066400000000000000000000176311457240071200204440ustar00rootroot00000000000000# Code of Conduct Diversity is one of our huge strengths, but it can also lead to communication issues. To support a welcoming environment for all, regardless of individual differences, we have a few ground rules that we ask people to adhere to when they participate in this community. These rules apply equally to founders, organizers, contributors, users and affiliates — in short, to all participants. This isn’t an exhaustive list of things that you must do, or can’t do. Rather, take it in the spirit in which it’s intended. It’s a guide to make it easier to enrich all of us and the technical communities in which we participate, and which we represent. ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of background or identity. This includes, but is not limited to, members of any race, ethnicity, culture, national origin, color, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, level of experience, and mental or physical ability. We pledge to be respectful. Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one. Members of the PyQtGraph community should be respectful when dealing with each other as well as with people outside the community. We pledge to be welcoming, supportive, kind and professional. We pledge to act and interact in ways that contribute to an open, diverse, inclusive, and healthy community. We pledge not insult or put down other participants, individually or as a group. Harassment and other exclusionary behavior aren’t acceptable. ## Examples Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * Violent threats or language directed against another person. * Discriminatory jokes and language. * Posting sexually explicit or violent material. * Posting (or threatening to post) other people’s personally identifying information ("doxing"). * Personal insults, especially those using racist or sexist terms. * Unwelcome sexual attention. * Repeated harassment of others. In general, if someone asks you to stop, then stop. * Advocating for, or encouraging, any of the above behavior. ## Where does this code of conduct apply This Code of Conduct applies within all online community spaces, official organized meetups, and when an individual is officially representing the community in public spaces, online or offline. ## What to do in case of violations If you believe someone is violating the code of conduct, we ask that you report it by contacting any of the following individuals, being sure to include mention of your message being about a "PyQtGraph conduct violation": * Ognyan Moore @j9ac9k * Martin Chase @outofculture * Nathan Jessurun @ntjess All complaints will be reviewed and investigated promptly and fairly. All reports will be kept confidential. In some cases, we may determine that a public statement will need to be made. If that’s the case, the identities of all victims and reporters will remain confidential unless those individuals instruct us otherwise. If you believe anyone is in physical danger, please notify appropriate law enforcement first. If you are unsure which law enforcement agency is appropriate, please include this in your report and we will attempt to notify them. ### What to include in the report * Your contact information (so we can get in touch with you if we need to follow up) * Names of any individuals involved (real names, nicknames, or pseudonyms). If there were other witnesses besides you, please try to include them as well. * When and where the incident occurred. Please be as specific as possible. * Your account of what occurred. If there is a publicly available record (e.g., a mailing list archive or a public chat logger) please include a link. Our Slack is currently on a free plan that does not retain more than 10,000 messages of history, if an incident occurred on Slack please take a screenshot so it is not lost. * Any extra context you believe existed for the incident. * Whether you believe this incident is ongoing. * Any other information you believe we should have. ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. This removal should be as transparent as possible, with information available in the same scope of context as the original moderated content, linking to an incident report, the acting moderators, and/or this document as appropriate. All community leaders are obligated to respect the privacy and security of the reporter of any incident. Upon receiving a report of misconduct, the staff must review the incident and determine the following: * What happened. * Whether this event constitutes a code of conduct violation. * Who the bad actor(s) was. * Whether this is an ongoing situation. * If any previous disiplinary measures are relevent and in effect. * If there is a threat to anyone’s physical safety. * What impact this has had on the community. After the conduct committee has a complete account of the events they need to make a decision as to how to resolve the case. Resolutions might include: * Nothing (if we determine no violation occurred). * A private reprimand from the staff to the individual(s) involved, providing clarity around the nature of the violation, and an explanation of why the behavior was inappropriate. * A request for a public or private apology. * A public reprimand. * An imposed vacation (for example, asking someone to "take a week off" from Slack). * A permanent or temporary ban from some or all PyQtGraph spaces (Slack, github, mailing list or events) or from communicating, in public or in private, with some are all of the members of our community. * Contacting law enforcement. A response must be sent within one week to the person who filed the report with either a resolution or an explanation of why the situation is not yet resolved. A Code of Conduct transparency report will then be published to [the PyQtGraph users' list](https://groups.google.com/g/pyqtgraph) with anonymized information about any violations that might have occurred. This report should be handled with care not to divulge personally identifying information about victims, reporters, and violators, and should serve as a means to ensure that members will be comfortable reporting violations and that our community will be kept accountable for supporting and encouraging safe spaces. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant, version 2.0](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html) and the [PuPPy Code of Conduct](https://www.pspython.com/pages/code-of-conduct/). pyqtgraph-pyqtgraph-0.13.4/CONTRIBUTING.md000066400000000000000000000112251457240071200200670ustar00rootroot00000000000000# Contributing to PyQtGraph Contributions to pyqtgraph are welcome! Be kind and respectful! See [our Code of Conduct](CODE_OF_CONDUCT.md) for details. Please use the following guidelines when preparing changes: ## Development Environment Creation First thing to do is fork the repository, and clone your own fork to your local computer. ```bash git clone https://github.com//pyqtgraph.git cd pyqtgraph ``` While there is nothing preventing users from using `conda` environments, as a general principle, we recommend using the `venv` module for creating an otherwise empty virtual environment. Furthermore, at this time, WSL is not supported (it can likely be made to work, but you're on your own if you go down this route). ```bash python3.9 -m venv .venv source .venv/bin/activate # on windows this would be .venv/Scripts/activate python -m pip install --upgrade wheel setuptools pip python -m pip install numpy scipy pyside6 -e . ``` Before making changes to the code-base, create a different branch with a name that should be unique (this makes it easier for maintainers to examine the proposed changes locally). ```bash git switch -c my-new-feature ``` When you're ready to submit the pull request, do so via the github, and the target of the pull request should be the `master` branch in the pyqtgraph repo. Pull requests should include only a focused and related set of changes. Mixed features and unrelated changes may be rejected. For major changes, it is recommended to discuss your plans on the mailing list or in a github issue/discussion before putting in too much effort. PyQtGraph has adopted [NEP-29](https://numpy.org/neps/nep-0029-deprecation_policy.html) which governs the timeline for phasing out support for numpy and python versions. ## Documentation * Writing proper documentation and unit tests is highly encouraged. PyQtGraph uses [`pytest`](https://docs.pytest.org/) for testing. * Documentation is generated with sphinx, and usage of [numpy-docstyle](https://numpydoc.readthedocs.io/en/latest/format.html) is encouraged (many places in the library do not use this docstring style at present, it's a gradual process to migrate). * The docs built for this PR can be previewed by clicking on the "Details" link for the read-the-docs entry in the checks section of the PR conversation page. ## Templates PyQtGraph makes use of `.ui` files where are compiled using `uic`. These files are identified by ending with `_generic.py` and have a `.ui` file next to them in the same directory. In past versions of PyQtGraph, there was a file for each binding. These are generated using tools/rebuildUi.py. Upon completion, the compiled files need to be modified such that they do not inherit from PyQt6 but from pyqtgraph's Qt abstraction layer. ## Style guidelines ### Formatting ~~Rules~~ Suggestions * PyQtGraph prefers PEP8 for most style issues, but this is not enforced rigorously as long as the code is clean and readable. * Variable and Function/Methods that are intended to be part of the public API should be camelCase. * "Private" methods/variables should have a leading underscore (`_`) before the name. ### Pre-Commit PyQtGraph developers are highly encouraged to (but not required) to use [`pre-commit`](https://pre-commit.com/). `pre-commit` does a number of checks when attempting to commit the code to being committed, such as ensuring no large files are accidentally added, address mixed-line-endings types and so on. Check the [pre-commit documentation](https://pre-commit.com) on how to setup. ## Testing ### Basic Setup * tox * pytest * pytest-cov * pytest-xdist * Optional: pytest-xvfb (used on linux with headless displays) To run the test suite, after installing the above dependencies run ```bash python -m pytest pyqtgraph/examples tests ``` ### Tox As PyQtGraph supports a wide array of Qt-bindings, and python versions, we make use of `tox` to test against as many supported configurations as feasible. With tox installed, simply run `tox` and it will run through all the configurations. This should be done if there is uncertainty regarding changes working on specific combinations of PyQt bindings and/or python versions. ### Continuous Integration For our Continuous Integration, we utilize Github Actions. Tested configurations are visible on [README](README.md). ### Benchmarks ( *Still under development* ) To ensure this library is performant, we use [Air Speed Velocity (asv)](https://asv.readthedocs.io/en/stable/) to run benchmarks. For developing on core functions and classes, be aware of any impact your changes have on their speed. To configure and run asv: ```bash pip install asv python setup.py asv_config asv run ``` ( TODO publish results ) pyqtgraph-pyqtgraph-0.13.4/LICENSE.txt000066400000000000000000000022101457240071200174530ustar00rootroot00000000000000Copyright (c) 2012 University of North Carolina at Chapel Hill Luke Campagnola ('luke.campagnola@%s.com' % 'gmail') The MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. pyqtgraph-pyqtgraph-0.13.4/MANIFEST.in000066400000000000000000000005541457240071200173770ustar00rootroot00000000000000recursive-include pyqtgraph *.py *.ui *.m README.* *.txt *.gz *.cfg recursive-include doc *.rst *.py *.svg *.png recursive-include doc/build/html * recursive-include tools * recursive-include tests * recursive-include benchmarks *.py include doc/Makefile doc/make.bat README.md LICENSE.txt CHANGELOG CODE_OF_CONDUCT.md CONTRIBUTING.md tox.ini global-exclude *.pyc pyqtgraph-pyqtgraph-0.13.4/README.md000066400000000000000000000143101457240071200171130ustar00rootroot00000000000000PyQtGraph ========= [![PyPi](https://img.shields.io/pypi/v/pyqtgraph.svg)](https://pypi.org/project/pyqtgraph/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/pyqtgraph.svg)](https://anaconda.org/conda-forge/pyqtgraph) [![Build Status](https://github.com/pyqtgraph/pyqtgraph/workflows/main/badge.svg)](https://github.com/pyqtgraph/pyqtgraph/actions/?query=workflow%3Amain) [![CodeQL Status](https://github.com/pyqtgraph/pyqtgraph/workflows/codeql/badge.svg)](https://github.com/pyqtgraph/pyqtgraph/actions/?query=workflow%3Acodeql) [![Documentation Status](https://readthedocs.org/projects/pyqtgraph/badge/?version=latest)](https://pyqtgraph.readthedocs.io/en/latest/?badge=latest) [![Discord](https://img.shields.io/discord/946624673200893953.svg?label=PyQtGraph&logo=discord)](https://discord.gg/ufTVNNreAZ) A pure-Python graphics library for PyQt5/PyQt6/PySide2/PySide6 Copyright 2023 PyQtGraph developers PyQtGraph is intended for use in mathematics / scientific / engineering applications. Despite being written entirely in python, the library is fast due to its heavy leverage of numpy for number crunching, Qt's GraphicsView framework for 2D display, and OpenGL for 3D display. Requirements ------------ PyQtGraph has adopted [NEP 29](https://numpy.org/neps/nep-0029-deprecation_policy.html). This project supports: * All minor versions of Python released 42 months prior to the project, and at minimum the two latest minor versions. * All minor versions of numpy released in the 24 months prior to the project, and at minimum the last three minor versions. * Qt5 5.15, and Qt6 6.2+ Currently this means: * Python 3.9+ * Qt 5.15, 6.2+ * [PyQt5](https://www.riverbankcomputing.com/software/pyqt/), [PyQt6](https://www.riverbankcomputing.com/software/pyqt/), [PySide2](https://wiki.qt.io/Qt_for_Python), or [PySide6](https://wiki.qt.io/Qt_for_Python) * [`numpy`](https://github.com/numpy/numpy) 1.22+ ### Optional added functionalities Through 3rd part libraries, additional functionality may be added to PyQtGraph, see the table below for a summary. | Library | Added functionality | |----------------|-| | [`scipy`] |
  • Image processing through [`ndimage`]
  • Data array filtering through [`signal`]
    • | | [`pyopengl`] |
      • 3D graphics
      • Faster image processing
      • Note: on macOS Big Sur only works with python 3.9.1+
      | | [`h5py`] |
      • Export in hdf5 format
      | | [`colorcet`] |
      • Add a collection of perceptually uniform colormaps
      | | [`matplotlib`] |
      • Export of PlotItem in matplotlib figure
      • Add matplotlib collection of colormaps
      | | [`cupy`] |
      • CUDA-enhanced image processing
      • Note: On Windows, CUDA toolkit must be >= 11.1
      | | [`numba`] |
      • Faster image processing
      | | [`jupyter_rfb`]|
      • Jupyter Notebook support
      • [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pyqtgraph/pyqtgraph/HEAD?urlpath=%2Flab%2Ftree%2Fpyqtgraph%2Fexamples%2Fnotebooks)
      | [`scipy`]: https://github.com/scipy/scipy [`ndimage`]: https://docs.scipy.org/doc/scipy/reference/ndimage.html [`signal`]: https://docs.scipy.org/doc/scipy/reference/signal.html [`pyopengl`]: https://github.com/mcfletch/pyopengl [`h5py`]: https://github.com/h5py/h5py [`colorcet`]: https://github.com/holoviz/colorcet [`matplotlib`]: https://github.com/matplotlib/matplotlib [`numba`]: https://github.com/numba/numba [`cupy`]: https://docs.cupy.dev/en/stable/install.html [`jupyter_rfb`]: https://github.com/vispy/jupyter_rfb Support ------- * Report issues on the [GitHub issue tracker](https://github.com/pyqtgraph/pyqtgraph/issues) * Post questions to * [mailing list / forum](https://groups.google.com/forum/?fromgroups#!forum/pyqtgraph) * [StackOverflow](https://stackoverflow.com/questions/tagged/pyqtgraph) * [GitHub Discussions](https://github.com/pyqtgraph/pyqtgraph/discussions) * [Python Discord](https://discord.com/channels/267624335836053506/898139460821192724) Installation Methods -------------------- * From PyPI * Last released version: `pip install pyqtgraph` * Latest development version: `pip install git+https://github.com/pyqtgraph/pyqtgraph@master` * From conda * Last released version: `conda install -c conda-forge pyqtgraph` * To install system-wide from source distribution: `python setup.py install` * Many linux package repositories have release versions. * To use with a specific project, simply copy the PyQtGraph subdirectory anywhere that is importable from your project. Documentation ------------- The official documentation lives at [pyqtgraph.readthedocs.io](https://pyqtgraph.readthedocs.io) The easiest way to learn PyQtGraph is to browse through the examples; run `python -m pyqtgraph.examples` to launch the examples application. Used By ------- Here is a partial listing of some of the applications that make use of PyQtGraph! * [ACQ4](https://github.com/acq4/acq4) * [Antenna Array Analysis](https://github.com/rookiepeng/antenna-array-analysis) * [argos](https://github.com/titusjan/argos) * [Atomize](https://github.com/Anatoly1010/Atomize) * [EnMAP-Box](https://enmap-box.readthedocs.io) * [EO Time Series Viewer](https://eo-time-series-viewer.readthedocs.io) * [ephyviewer](https://ephyviewer.readthedocs.io) * [Exo-Striker](https://github.com/3fon3fonov/exostriker) * [GraPhysio](https://github.com/jaj42/GraPhysio) * [HussariX](https://github.com/sem-geologist/HussariX) * [Joulescope](https://www.joulescope.com/) * [MaD GUI](https://github.com/mad-lab-fau/mad-gui) * [neurotic](https://neurotic.readthedocs.io) * [Orange3](https://orangedatamining.com/) * [PatchView](https://github.com/ZeitgeberH/patchview) * [pyplotter](https://github.com/pyplotter/pyplotter) * [PyMeasure](https://github.com/pymeasure/pymeasure) * [PySpectra](http://hasyweb.desy.de/services/computing/Spock/node138.html) * [rapidtide](https://rapidtide.readthedocs.io/en/latest/) * [Semi-Supervised Semantic Annotator](https://gitlab.com/s3a/s3a) * [STDF-Viewer](https://github.com/noonchen/STDF-Viewer) Do you use PyQtGraph in your own project, and want to add it to the list? Submit a pull request to update this listing! pyqtgraph-pyqtgraph-0.13.4/benchmarks/000077500000000000000000000000001457240071200177525ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/benchmarks/__init__.py000066400000000000000000000000001457240071200220510ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/benchmarks/arrayToQPath.py000066400000000000000000000016541457240071200227110ustar00rootroot00000000000000import numpy as np import pyqtgraph as pg rng = np.random.default_rng(12345) class _TimeSuite: params = ([10_000, 100_000, 1_000_000], ['all', 'finite', 'pairs', 'array']) def setup(self, nelems, connect): self.xdata = np.arange(nelems, dtype=np.float64) self.ydata = rng.standard_normal(nelems, dtype=np.float64) if connect == 'array': self.connect_array = np.ones(nelems, dtype=bool) if self.have_nonfinite: self.ydata[::5000] = np.nan def time_test(self, nelems, connect): if connect == 'array': connect = self.connect_array pg.arrayToQPath(self.xdata, self.ydata, connect=connect) class TimeSuiteAllFinite(_TimeSuite): def __init__(self): super().__init__() self.have_nonfinite = False class TimeSuiteWithNonFinite(_TimeSuite): def __init__(self): super().__init__() self.have_nonfinite = True pyqtgraph-pyqtgraph-0.13.4/benchmarks/renderImageItem.py000066400000000000000000000106061457240071200233700ustar00rootroot00000000000000import numpy as np import pyqtgraph as pg try: import cupy as cp pg.setConfigOption("useCupy", True) except ImportError: cp = None try: import numba except ImportError: numba = None def renderQImage(*args, **kwargs): imgitem = pg.ImageItem(axisOrder='row-major') if 'autoLevels' not in kwargs: kwargs['autoLevels'] = False imgitem.setImage(*args, **kwargs) imgitem.render() def prime_numba(): shape = (64, 64) lut_small = np.random.randint(256, size=(256, 3), dtype=np.uint8) lut_big = np.random.randint(256, size=(512, 3), dtype=np.uint8) for lut in [lut_small, lut_big]: renderQImage(np.zeros(shape, dtype=np.uint8), levels=(20, 220), lut=lut) renderQImage(np.zeros(shape, dtype=np.uint16), levels=(250, 3000), lut=lut) renderQImage(np.zeros(shape, dtype=np.float32), levels=(-4.0, 4.0), lut=lut) class _TimeSuite(object): def __init__(self): super(_TimeSuite, self).__init__() self.size = None self.float_data = None self.uint8_data = None self.uint8_lut = None self.uint16_data = None self.uint16_lut = None self.cupy_uint16_lut = None self.cupy_uint8_lut = None def setup(self): size = (self.size, self.size) self.float_data, self.uint16_data, self.uint8_data, self.uint16_lut, self.uint8_lut = self._create_data( size, np ) if numba is not None: # ensure JIT compilation pg.setConfigOption("useNumba", True) prime_numba() pg.setConfigOption("useNumba", False) if cp: _d1, _d2, _d3, self.cupy_uint16_lut, self.cupy_uint8_lut = self._create_data(size, cp) renderQImage(cp.asarray(self.uint16_data["data"])) # prime the gpu @property def numba_uint16_lut(self): return self.uint16_lut @property def numba_uint8_lut(self): return self.uint8_lut @property def numpy_uint16_lut(self): return self.uint16_lut @property def numpy_uint8_lut(self): return self.uint8_lut @staticmethod def _create_data(size, xp): float_data = { "data": xp.random.normal(size=size).astype("float32"), "levels": [-4.0, 4.0], } uint16_data = { "data": xp.random.randint(100, 4500, size=size).astype("uint16"), "levels": [250, 3000], } uint8_data = { "data": xp.random.randint(0, 255, size=size).astype("ubyte"), "levels": [20, 220], } c_map = xp.array([[-500.0, 255.0], [-255.0, 255.0], [0.0, 500.0]]) uint8_lut = xp.zeros((256, 4), dtype="ubyte") for i in range(3): uint8_lut[:, i] = xp.clip(xp.linspace(c_map[i][0], c_map[i][1], 256), 0, 255) uint8_lut[:, 3] = 255 uint16_lut = xp.zeros((2 ** 16, 4), dtype="ubyte") for i in range(3): uint16_lut[:, i] = xp.clip(xp.linspace(c_map[i][0], c_map[i][1], 2 ** 16), 0, 255) uint16_lut[:, 3] = 255 return float_data, uint16_data, uint8_data, uint16_lut, uint8_lut def make_test(dtype, kind, use_levels, lut_name, func_name): def time_test(self): data = getattr(self, dtype + "_data") levels = data["levels"] if use_levels else None lut = getattr(self, f"{kind}_{lut_name}_lut", None) if lut_name is not None else None pg.setConfigOption("useNumba", kind == "numba") img_data = data["data"] if kind == "cupy": img_data = cp.asarray(img_data) renderQImage(img_data, lut=lut, levels=levels) time_test.__name__ = func_name return time_test for option in ["cupy", "numba", "numpy"]: if option == "cupy" and cp is None: continue if option == "numba" and numba is None: continue for data_type in ["float", "uint16", "uint8"]: for lvls in [True, False]: if data_type == "float" and not lvls: continue for lutname in [None, "uint8", "uint16"]: name = ( f'time_1x_renderImageItem_{option}_{data_type}_{"" if lvls else "no"}levels_{lutname or "no"}lut' ) setattr(_TimeSuite, name, make_test(data_type, option, lvls, lutname, name)) class Time4096Suite(_TimeSuite): def __init__(self): super(Time4096Suite, self).__init__() self.size = 4096 pyqtgraph-pyqtgraph-0.13.4/binder/000077500000000000000000000000001457240071200171005ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/binder/apt.txt000066400000000000000000000000201457240071200204150ustar00rootroot00000000000000libgl1-mesa-glx pyqtgraph-pyqtgraph-0.13.4/binder/requirements.txt000066400000000000000000000001231457240071200223600ustar00rootroot00000000000000git+https://github.com/pyqtgraph/pyqtgraph.git pyqt5 jupyter_rfb numpy simplejpeg pyqtgraph-pyqtgraph-0.13.4/binder/runtime.txt000066400000000000000000000000141457240071200213170ustar00rootroot00000000000000python-3.9 pyqtgraph-pyqtgraph-0.13.4/binder/start000066400000000000000000000000721457240071200201570ustar00rootroot00000000000000#!/bin/bash export QT_QPA_PLATFORM=offscreen exec "$@" pyqtgraph-pyqtgraph-0.13.4/doc/000077500000000000000000000000001457240071200164025ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/Makefile000066400000000000000000000124041457240071200200430ustar00rootroot00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS ?= -n SPHINXBUILD ?= sphinx-build PAPER = BUILDDIR = build SOURCEDIR = source # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCEDIR) .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest livehtml dash help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" @echo " livehtml to create livehtml of docs that watches for changes" clean: -rm -rf $(BUILDDIR)/* livehtml: sphinx-autobuild -a "$(SOURCEDIR)" "$(BUILDDIR)/html" --watch doc/source/_static --open-browser html: # this will not detect changes in theme files, static files and # source code used with auto-doc $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dash: clean # this will create a docset of the documentation, used in documentation # viewers such as dash or zeal, requires doc2dash to be installed export BUILD_DASH_DOCSET=1;\ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/dash doc2dash -n pyqtgraph\ --online-redirect-url https://pyqtgraph.readthedocs.io/en/latest\ --icon $(SOURCEDIR)/_static/peegee_03_square_no_bg_32_cleaned.png\ --force\ -A\ $(BUILDDIR)/dash @echo dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pyqtgraph.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pyqtgraph.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/pyqtgraph" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pyqtgraph" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." make -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." pyqtgraph-pyqtgraph-0.13.4/doc/extensions/000077500000000000000000000000001457240071200206015ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/extensions/qt_doc.py000066400000000000000000000112671457240071200224330ustar00rootroot00000000000000""" Extension for building Qt-like documentation. - Method lists preceding the actual method documentation - Inherited members documented separately - Members inherited from Qt have links to qt-project documentation - Signal documentation """ def setup(app): # probably we will be making a wrapper around autodoc app.setup_extension('sphinx.ext.autodoc') # would it be useful to define a new domain? #app.add_domain(QtDomain) ## Add new configuration options app.add_config_value('todo_include_todos', False, False) ## Nodes are the basic objects representing documentation directives ## and roles app.add_node(Todolist) app.add_node(Todo, html=(visit_todo_node, depart_todo_node), latex=(visit_todo_node, depart_todo_node), text=(visit_todo_node, depart_todo_node)) ## New directives like ".. todo:" app.add_directive('todo', TodoDirective) app.add_directive('todolist', TodolistDirective) ## Connect callbacks to specific hooks in the build process app.connect('doctree-resolved', process_todo_nodes) app.connect('env-purge-doc', purge_todos) from docutils import nodes from sphinx.util.compat import Directive from sphinx.util.compat import make_admonition # Just a general node class Todolist(nodes.General, nodes.Element): pass # .. and its directive class TodolistDirective(Directive): # all directives have 'run' method that returns a list of nodes def run(self): return [Todolist('')] # Admonition classes are like notes or warnings class Todo(nodes.Admonition, nodes.Element): pass def visit_todo_node(self, node): self.visit_admonition(node) def depart_todo_node(self, node): self.depart_admonition(node) class TodoDirective(Directive): # this enables content in the directive has_content = True def run(self): env = self.state.document.settings.env # create a new target node for linking to targetid = "todo-%d" % env.new_serialno('todo') targetnode = nodes.target('', '', ids=[targetid]) # make the admonition node ad = make_admonition(Todo, self.name, [('Todo')], self.options, self.content, self.lineno, self.content_offset, self.block_text, self.state, self.state_machine) # store a handle in a global list of all todos if not hasattr(env, 'todo_all_todos'): env.todo_all_todos = [] env.todo_all_todos.append({ 'docname': env.docname, 'lineno': self.lineno, 'todo': ad[0].deepcopy(), 'target': targetnode, }) # return both the linking target and the node itself return [targetnode] + ad # env data is persistent across source files so we purge whenever the source file has changed. def purge_todos(app, env, docname): if not hasattr(env, 'todo_all_todos'): return env.todo_all_todos = [todo for todo in env.todo_all_todos if todo['docname'] != docname] # called at the end of resolving phase; we will convert temporary nodes # into finalized nodes def process_todo_nodes(app, doctree, fromdocname): if not app.config.todo_include_todos: for node in doctree.traverse(Todo): node.parent.remove(node) # Replace all todolist nodes with a list of the collected todos. # Augment each todo with a backlink to the original location. env = app.builder.env for node in doctree.traverse(Todolist): if not app.config.todo_include_todos: node.replace_self([]) continue content = [] for todo_info in env.todo_all_todos: para = nodes.paragraph() filename = env.doc2path(todo_info['docname'], base=None) description = ( ('(The original entry is located in %s, line %d and can be found ') % (filename, todo_info['lineno'])) para += nodes.Text(description, description) # Create a reference newnode = nodes.reference('', '') innernode = nodes.emphasis(('here'), ('here')) newnode['refdocname'] = todo_info['docname'] newnode['refuri'] = app.builder.get_relative_uri( fromdocname, todo_info['docname']) newnode['refuri'] += '#' + todo_info['target']['refid'] newnode.append(innernode) para += newnode para += nodes.Text('.)', '.)') # Insert into the todolist content.append(todo_info['todo']) content.append(para) node.replace_self(content) pyqtgraph-pyqtgraph-0.13.4/doc/listmissing.py000066400000000000000000000007461457240071200213300ustar00rootroot00000000000000import os dirs = [ ('graphicsItems', 'graphicsItems'), ('3dgraphics', 'opengl/items'), ('widgets', 'widgets'), ] path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..') for a, b in dirs: rst = [os.path.splitext(x)[0].lower() for x in os.listdir(os.path.join(path, 'doc', 'source', a))] py = [os.path.splitext(x)[0].lower() for x in os.listdir(os.path.join(path, "pyqtgraph", b))] print(a) for x in set(py) - set(rst): print( " ", x) pyqtgraph-pyqtgraph-0.13.4/doc/make.bat000066400000000000000000000100241457240071200200040ustar00rootroot00000000000000@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. changes to make an overview over all changed/added/deprecated items echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\pyqtgraph.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\pyqtgraph.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end pyqtgraph-pyqtgraph-0.13.4/doc/requirements.txt000066400000000000000000000003221457240071200216630ustar00rootroot00000000000000PyQt6==6.6.1 sphinx==7.2.6 pydata-sphinx-theme==0.15.2 sphinx-design==0.5.0 sphinxcontrib-images==0.9.4 sphinx-favicon==1.0.1 sphinx-autodoc-typehints sphinx-qt-documentation sphinxext-rediraffe numpy pyopengl pyqtgraph-pyqtgraph-0.13.4/doc/source/000077500000000000000000000000001457240071200177025ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/_static/000077500000000000000000000000001457240071200213305ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/_static/custom.css000066400000000000000000000314261457240071200233620ustar00rootroot00000000000000/* Template Inherited from SciPy and modified for PyQtGraph purposes https://github.com/scipy/scipy/blob/9ae8fd0f4341d7d8785777d460cca4f7b6a93edd/doc/source/_static/scipy.css SPDX-License-Identifier: BSD-3-Clause */ /* Remove parenthesis around module using fictive font and add them back. This is needed for better wrapping in the sidebar. */ .bd-sidebar .nav li > a > code { white-space: nowrap; } .bd-sidebar .nav li > a > code:before { content:'('; } .bd-sidebar .nav li > a > code:after { content:')'; } .bd-sidebar .nav li > a { font-family: "no-parens", sans-serif; } /* Retrieved from https://codepen.io/jonneal/pen/bXLEdB (MIT) It replaces (, ) with a zero-width font. This version is lighter than the original font from Adobe. */ @font-face { font-family: no-parens; src: url("data:application/x-font-woff;base64,d09GRk9UVE8AABuoAAoAAAAASrAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABDRkYgAAANJAAADlwAABk8NN4INERTSUcAABugAAAACAAAAAgAAAABT1MvMgAAAVAAAABRAAAAYABfsZtjbWFwAAAEQAAACM0AABnoJENu0WhlYWQAAAD0AAAAMwAAADYFl9tDaGhlYQAAASgAAAAeAAAAJAdaA+9obXR4AAAbgAAAAB8AABAGA+gAfG1heHAAAAFIAAAABgAAAAYIAVAAbmFtZQAAAaQAAAKbAAAF6yBNB5Jwb3N0AAANEAAAABMAAAAg/7gAMnjaY2BkYGBg5G6tPXx8azy/zVcGZuYXQBGGiz6un+F0zf8O5hzmAiCXmYEJJAoAkoQNcAB42mNgZGBgLvjfASRfMNQw1DDnMABFUAATAHAaBFEAAAAAUAAIAQAAeNpjYGZ+wTiBgZWBgamLKYKBgcEbQjPGMRgx3GFAAt//r/v/+/7///wPGOxBfEcXJ38GBwaG//+ZC/53MDAwFzBUJOgz/kfSosDAAAAMpBWaAAAAeNqdU9tu00AQPU6TcqmoRIV46YvFE5Vgm7ZOVDVPSS8iIkqquBTxhJzEuSiOHWwnwH8g/oHfgW9A/AZnx5smQZWg2MrumZ0z47MzEwCP8R0W9GNhS1b95HCPVoY3sIsdg/MrnAJO8NLgTTzEgEwr/4DWF3ww2MJTq2BwDtvWrsEbKFt7BudXOAWk1nuDN/HE+mHwfTjWL4O34OQWeR7lvuZaBm/Dyf+s9qKOb9cCLxy3/cEs8OIDVXRKlepZrVURp/hot2rn136cjKLQziiXrgHDKO1G4Vxb6viwMvHGfpT2VTDqHKqSKh85xfIyE04RYYrPiDFiCYZIYeMbf4co4gBHeHGDS0RV9MjvwCd2GZWQ72PC3UYdIbr0xsynV098PXqeS96U5yfY5/tRXkXGIpuSyAl9e8SrX6khIC/EGG3aA8zEjqlHUZVDVRXyz8hrCVpELuMyf4sn57imJ6baEVkhs69mueSN1k+GZKWiLMT8xqdwzIpUqNZjdl84fZ4GzNqhRzFWoczaOWSXb9X0P3X89xqmzDjlyT6uGDWSrBdyi1S+F1FvymhdR60gY2j9XdohraxvM+KeVMwmf2jU1tHg3pIvhGuZG2sZ9OTcVm/9s++krCd7KjPaoarFXGU5PVmfsaauVM8l1nNTFa2u6HhLdIVXVP2Gu7arnKc21ybtOifDlTu1uZ5yb3Ji6uLROPNdyPw38Y77a3o0R+f2qSqrTizWJ1ZGq09EeySnI/ZlKhXWypXc1Zcb3r2uNmsUrfUkkZguWX1h2mbO9L/F45r1YioKJ1LLRUcSU7+e6f9E7qInbukfEM0lNuSpzmpzviLmjmVGMk26c5miv3VV/THJCRXrzk55ltCrtQXc9R0H9OvKN34D31P2fwB42i3YLfAsS2GG8X9Pf3dP97QjqOBAUAUOHDhwxAUHLnHgwIEDBw4cOHDgEgeOuIsjLnHgAMU1tw7PnvNs1fT7zlfV7q9rd2bn7e0tv729RZYvsySWb76Ft9fr82wN77fHt/F+e3m73+8J74/8zPsxvdbqu3fvXjsYg2e/P/LTP33f367PfMj67sPZjXjsh/iU/V+If7W/Tvms/XPEF+xfJL5kf73lr9i/SnzN/nXiG/Z/I/7d/k3iW/ZvE/9h/0/iO/bvEt+zf5/4gf2HxI/sPyZ+Yn99xJ/Zf078wv5L4lf2XxO/sf+W+C/7fxO/s/+e+IP9f4iP7H8k/mT/f+LP9r8Qf7X/jfiH/WPik48+9E/Y8e4Tpvjv72cl6B/wD/oH/IP+Af+gf8A/6B/wD/oH/IP+Af+gf8A/6B/wD/oH/IP+Af+gf8A/6B/wD/oH/IP+Af+gf8A/6B/wD/oH/IP+Af+gf8A/6B/wD/oH/IP+Af+gf8A/6B/wD/oH/IP+4X8Z/8/OXATnIjAXwbkIkAfnIjAX4eVPv15fA/0v/C/9L/wv/S/8L/1fX5lL/wv/S/8L/0v/C/9L/wv/S/8L/0v/C/9L/wv/S/8L/0v/C/9L/wv/S/8L/0v/C/9L/wv/S/8L/0v/C/9L/wv/S/8L/0v/C/9L/wv/S/8L/0v/C/9L/wv/S/8L/0v/C/9L/wv/S/8L/0v/C/9L/9cvXNQ/4h/1j/hH/SP+Uf+If9Q/4h/1j/hH/SP+Uf+If9Q/4h/1j/hH/SP+Uf+If9Q/4h/1j/hH/SP+Uf+If9Q/4h/1j/hH/SP+Uf+If9Q/4h/1j/hH/SP+Uf+If9Q/4h/1j/hH/SP+Uf+If9Q/4h/1j/hH/SP+Uf/XlSXpn/BP+if8k/4J/6R/wj/pn/BP+if8k/4J/6R/wj/pn/BP+if8k/4J/6R/wj/pn/BP+if8k/4J/6R/wj/pn/BP+if8k/4J/6R/wj/pn/BP+if8k/4J/6R/wj/pn/BP+if8k/4J/6R/wj/pn/BP+if8k/4J/6T/6yqf9c/4Z/0z/ln/jH/WP+Of9c/4Z/0z/ln/jH/WP+Of9c/4Z/0z/ln/jH/WP+Of9c/4Z/0z/ln/jH/WP+Of9c/4Z/0z/ln/jH/WP+Of9c/4Z/0z/ln/jH/WP+Of9c/4Z/0z/ln/jH/WP+Of9c/4Z/0z/ln/jH/WvzAW/Qv+Rf+Cf9G/4F/0L/gX/Qv+Rf+Cf9G/4F/0L/gX/Qv+Rf+Cf9G/4F/0L/gX/Qv+Rf+Cf9G/4F/0L/gX/Qv+Rf+Cf9G/4F/0L/gX/Qv+Rf+Cf9G/4F/0L/gX/Qv+Rf+Cf9G/4F/0L/gX/Qv+Rf+Cf9G/4F/0r6/bT/0r/lX/in/Vv+Jf9a/4V/0r/lX/in/Vv+Jf9a/4V/0r/lX/in/Vv+Jf9a/4V/0r/lX/in/Vv+Jf9a/4V/0r/lX/in/Vv+Jf9a/4V/0r/lX/in/Vv+Jf9a/4V/0r/lX/in/Vv+Jf9a/4V/0r/lX/in/Vv378uuX/4P+65W/6N1aa/g3/pn/Dv+nf8G/6N/yb/g3/pn/Dv+nf8G/6N/yb/g3/pn/Dv+nf8G/6N/yb/g3/pn/Dv+nf8G/6N/yb/g3/pn/Dv+nf8G/6N/yb/g3/pn/Dv+nf8G/6N/yb/g3/pn/Dv+nf8G/6N/yb/g3/pn/Dv+nfGbv+Hf+uf8e/69/x7/p3/Lv+Hf+uf8e/69/x7/p3/Lv+Hf+uf8e/69/x7/p3/Lv+Hf+uf8e/69/x7/p3/Lv+Hf+uf8e/69/x7/p3/Lv+Hf+uf8e/69/x7/p3/Lv+Hf+uf8e/69/x7/p3/Lv+Hf+uf8e/69/x7/q//kEP/Qf+Q/+B/9B/4D/0H/gP/Qf+Q/+B/9B/4D/0H/gP/Qf+Q/+B/9B/4D/0H/gP/Qf+Q/+B/9B/4D/0H/gP/Qf+Q/+B/9B/4D/0H/gP/Qf+Q/+B/9B/4D/0H/gP/Qf+Q/+B/9B/4D/0H/gP/Qf+Q/+B/9B/4D/0n4xT/4n/1H/iP/Wf+E/9J/5T/4n/1H/iP/Wf+E/9J/5T/4n/1H/iP/Wf+E/9J/5T/4n/1H/iP/Wf+E/9J/5T/4n/1H/iP/Wf+E/9J/5T/4n/1H/iP/Wf+E/9J/5T/4n/1H/iP/Wf+E/9J/5T/4n/1H/iP/Wf+E/9X8+Dbv1v/G/9b/xv/W/8b/1v/G/9b/xv/W/8b/1v/G/9b/xv/W/8b/1v/G/9b/xv/W/8b/1v/G/9b/xv/W/8b/1v/G/9b/xv/W/8b/1v/G/9b/xv/W/8b/1v/G/9b/xv/W/8b/1v/G/9b/xv/W/8b/1v/G/9b/xv/W/8b/1v/G/9F+PSf+G/9F/4L/0X/kv/hf/Sf+G/9F/4L/0X/kv/hf/Sf+G/9F/4L/0X/kv/hf/Sf+G/9F/4L/0X/kv/hf/Sf+G/9F/4L/0X/kv/hf/Sf+G/9F/4L/0X/kv/hf/Sf+G/9F/4L/0X/kv/hf/Sf+G/9F/4L/0X/kv/zbj13/hv/Tf+W/+N/9Z/47/13/hv/Tf+W/+N/9Z/47/13/hv/Tf+W/+N/9Z/47/13/hv/Tf+W/+N/9Z/47/13/hv/Tf+W/+N/9Z/47/13/hv/Tf+W/+N/9Z/47/13/hv/Tf+W/+N/9Z/47/13/hv/Tf+W/+N/9b/eT1y1v/B/9H/wf/R/8H/0f/B/9H/wf/R/8H/0f/B/9H/wf/R/8H/0f/B/9H/wf/R/8H/0f/B/9H/wf/R/8H/0f/B/9H/wf/R/8H/0f/B/9H/wf/R/8H/0f/B/9H/wf/R/8H/0f/B/9H/wf/R/8H/0f/B/9H/wf/R/8H/0f/5+PWY/4P/6zH/0f/gf/Q/7Dj6H/yP/gf/o//B/+h/8D/6H/yP/gf/o//B/+h/8D/6H/yP/gf/o//B/+h/8D/6H/yP/gf/o//B/+h/8D/6H/yP/gf/o//B/+h/8D/6H/yP/gf/o//B/+h/8D/6H/yP/gf/o//B/+h/8D/6H/zPB/9/AsqUaXgAAAB42mNgZgCD/1sZjBiwAAAswgHqAHja7ZhVc5BNkIWn/QWCEzRAcHd3d3eX4J4Awd0luLu7e3B3d3d3h4RgC99e7I9YnoupOjXdXaempqamGxyjA4AoxVoENmtZvENAp/Z/ZdbwROF+IT5JwhNDeBIM+e4T4SJYkiTkJj5J/TzwSR5WK3pYs5hh9X1S+SVI6pPSCYBGqx0Q9F+Zci1adgpuG9yrRGBQry5tW7cJ9s+eNVuOjH/XXP7/RfjX6NU1uGXHrv7lOjUP7BIU2CUguGUL/7RtgoOD8mfJ0qNHj8wBf8MyNw/smCVd5v9N+c/c/9nMlD1rznzO/XFvv8mBc84DD/5IV8FVdJVcZVfFVXXVXHVXw9V0tVxtV8fVdfVcfdfANXSNXGPXxDV1Aa6Za+5auJaulWvt2ri2rp1r7zq4jq6TC3RBrrPr4rq6YNfNdXc9XE/Xy/V2fVxf18/1dwPcQDfIDXZD3FA3zA13I9xIN8qNdiFujBvrxrnxboKb6Ca5yW6Km+qmueluhpvpZrnZbo6b6+a5+W6BW+gWucVuiVvqlrnlboVb6Va51W6NW+vWufVug9voNrnNbovb6ra5ULfd7XA73S632+1xe90+t98dcAfdIXfYHXFH3TF33J1wJ90pd9qdcWfdOXfeXXAX3SV32V1xV901d93dcDfdLXfb3XF33T133z1wD90j99g9cU/dM/fcvXAv3Sv32r1xb9079959cB/dJ/fZfXFfXZgLd99chPvufrif7pf7DX+vCgIBg4CC/Tn/SBAZooAPRIVoEB1iQEyIBbEhDvhCXIgH8SEBJIRE4AeJIQkkBX9IBskhBaSEVJAa0kBaSAfpIQNkhEyQGbJAVsgG2SEH5IRckBvyQF7IB/mhABSEQlAYikBRKAbFoQSUhFJQGspAWSgH5aECVIRKUBmqQFWoBtWhBtSEWlAb6kBdqAf1oQE0hEbQGJpAUwiAZtAcWkBLaAWtoQ20hXbQHjpAR+gEgRAEnaELdIVg6AbdoQf0hF7QG/pAX+gH/WEADIRBMBiGwFAYBsNhBIyEUTAaQmAMjIVxMB4mwESYBJNhCkyFaTAdZsBMmAWzYQ7MhXkwHxbAQlgEi2EJLIVlsBxWwEpYBathDayFdbAeNsBG2ASbYQtshW0QCtthB+yEXbAb9sBe2Af74QAchENwGI7AUTgGx+EEnIRTcBrOwFk4B+fhAlyES3AZrsBVuAbX4QbchFtwG+7AXbgH9+EBPIRH8BiewFN4Bs/hBbyEV/Aa3sBbeAfv4QN8hE/wGb7AVwiDcPgGEfAdfsBP+AW/0SEgIiGjoKKhh5EwMkZBH4yK0TA6xsCYGAtjYxz0xbgYD+NjAkyIidAPE2MSTIr+mAyTYwpMiakwNabBtJgO02MGzIiZMDNmwayYDbNjDsyJuTA35sG8mA/zYwEsiIWwMBbBolgMi2MJLImlsDSWwbJYDstjBayIlbAyVsGqWA2rYw2sibWwNtbBulgP62MDbIiNsDE2waYYgM2wObbAltgKW2MbbIvtsD12wI7YCQMxCDtjF+yKwdgNu2MP7Im9sDf2wb7YD/vjAByIg3AwDsGhOAyH4wgciaNwNIbgGByL43A8TsCJOAkn4xScitNwOs7AmTgLZ+McnIvzcD4uwIW4CBfjElyKy3A5rsCVuApX4xpci+twPW7AjbgJN+MW3IrbMBS34w7cibtwN+7BvbgP9+MBPIiH8DAewaN4DI/jCTyJp/A0nsGzeA7P4wW8iJfwMl7Bq3gNr+MNvIm38Dbewbt4D+/jA3yIj/AxPsGn+Ayf4wt8ia/wNb7Bt/gO3+MH/Iif8DN+wa8YhuH4DSPwO/7An/gL/zy7BIRExCSkZORRJIpMUciHolI0ik4xKCbFotgUh3wpLsWj+JSAElIi8qPElISSkj8lo+SUglJSKkpNaSgtpaP0lIEyUibKTFkoK2Wj7JSDclIuyk15KC/lo/xUgApSISpMRagoFaPiVIJKUikqTWWoLJWj8lSBKlIlqkxVqCpVo+pUg2pSLapNdagu1aP61IAaUiNqTE2oKQVQM2pOLagltaLW1IbaUjtqTx2oI3WiQAqiztSFulIwdaPu1IN6Ui/qTX2oL/Wj/jSABtIgGkxDaCgNo+E0gkbSKBpNITSGxtI4Gk8TaCJNosk0habSNJpOM2gmzaLZNIfm0jyaTwtoIS2ixbSEltIyWk4raCWtotW0htbSOlpPG2gjbaLNtIW20jYKpe20g3bSLtpNe2gv7aP9dIAO0iE6TEfoKB2j43SCTtIpOk1n6Cydo/N0gS7SJbpMV+gqXaPrdINu0i26TXfoLt2j+/SAHtIjekxP6Ck9o+f0gl7SK3pNb+gtvaP39IE+0if6TF/oK4VROH2jCPpOP+gn/aLf7BgYmZhZWNnY40gcmaOwD0flaBydY3BMjsWxOQ77clyOx/E5ASfkROzHiTkJJ2V/TsbJOQWn5FScmtNwWk7H6TkDZ+RMnJmzcFbOxtk5B+fkXJyb83Bezsf5uQAX5EJcmItwUS7GxbkEl+RSXJrLcFkux+W5AlfkSlyZq3BVrsbVuQbX5Fpcm+twXa7H9bkBN+RG3JibcFMO4GbcnFtwS27FrbkNt+V23J47cEfuxIEcxJ25C3flYO7G3bkH9+Re3Jv7cF/ux/15AA/kQTyYh/BQHsbDeQSP5FE8mkN4DI/lcTyeJ/BEnsSTeQpP5Wk8nWfwTJ7Fs3kOz+V5PJ8X8EJexIt5CS/lZbycV/BKXsWreQ2v5XW8njfwRt7Em3kLb+VtHMrbeQfv5F28m/fwXt7H+/kAH+RDfJiP8FE+xsf5BJ/kU3yaz/BZPsfn+QJf5Et8ma/wVb7G1/kG3+RbfJvv8F2+x/f5AT/kR/yYn/BTfsbP+QW/5Ff8mt/wW37H7/kDf+RP/Jm/8FcO43D+xhH8nX/wT/7Fv+XPt09QSFhEVEw8iSSRJYr4SFSJJtElhsSUWBJb4oivxJV4El8SSEJJJH6SWJJIUvGXZJJcUkhKSSWpJY2klXSSXjJIRskkmSWLZJVskl1ySE7JJbklj+SVfJJfCkhBKSSFpYgUlWJSXEpISSklpaWMlJVyUl4qSEWpJJWlilSValJdakhNqSW1pY7UlXpSXxpIQ2kkjaWJNJUAaSbNpYW0lFbSWtpIW2kn7aWDdJROEihB0lm6SFcJlm7SXXpIT+klvaWP9JV+0l8GyEAZJINliAyVYTJcRshIGSWjJUTGyFgZJ+NlgkyUSTJZpshUmSbTZYbMlFkyW+bIXJkn82WBLJRFsliWyFJZJstlhayUVbJa1shaWSfrZYNslE2yWbbIVtkmobJddshO2SW7ZY/slX2yXw7IQTkkh+WIHJVjclxOyEk5JafljJyVc3JeLshFuSSX5YpclWtyXW7ITbklt+WO3JV7cl8eyEN5JI/liTyVZ/JcXshLeSWv5Y28lXfyXj7IR/kkn+WLfJUwCZdvEiHf5Yf8lF/yW52CopKyiqqaehpJI2sU9dGoGk2jawyNqbE0tsZRX42r8TS+JtCEmkj9NLEm0aTqr8k0uabQlJpKU2saTavpNL1m0IyaSTNrFs2q2TS75tCcmktzax7Nq/k0vxbQglpIC2sRLarFtLiW0JJaSktrGS2r5bS8VtCKWkkraxWtqtW0utbQmlpLa2sdrav1tL420IbaSBtrE22qAdpMm2sLbamttLW20bbaTttrB+2onTRQg7SzdtGuGqzdtLv20J7aS3trH+2r/bS/DtCBOkgH6xAdqsN0uI7QkTpKR2uIjtGxOk7H6wSdqJN0sk7RqTpNp+sMnamzdLbO0bk6T+frAl2oi3SxLtGlukyX6wpdqat0ta7RtbpO1+sG3aibdLNu0a26TUN1u+7QnbpLd+se3av7dL8e0IN6SA/rET2qx/S4ntCTekpP6xk9q+f0vF7Qi3pJL+sVvarX9Lre0Jt6S2/rHb2r9/S+PtCH+kgf6xN9qs/0ub7Ql/pKX+sbfavv9L1+0I/6ST/rF/2qYRqu3zRCv+sP/am/9Lc5A0MjYxNTM/MskkW2KOZjUS2aRbcYFtNiWWyLY74W1+JZfEtgCS2R+VliS2JJzd+SWXJLYSktlaW2NJbW0ll6y2AZLZNltiyW1bJZdsthOS2X5bY8ltfyWX4rYAWtkBW2IlbUillxK2ElrZSVtjJW1spZeatgFa2SVbYqVtWqWXWrYTWtltW2OlbX6ll9a2ANrZE1tibW1AKsmTW3FtbSWllra2NtrZ21tw7W0TpZoAVZZ+tiXS3Yull362E9rZf1tj7W1/pZfxtgA22QDbYhNtSG2XAbYSNtlI22EBtjY22cjbcJNtEm2WSbYlNtmk23GTbTZtlsm2NzbZ7NtwW20BbZYltiS22ZLbcVttJW2WpbY2ttna23DbbRNtlm22JbbZuF2nbbYTttl+22PbbX9tl+O2AH7ZAdtiN21I7ZcTthJ+2UnbYzdtbO2Xm7YBftkl22K3bVrtl1u2E37Zbdtjt21+7ZfXtgD+2RPbYn9tSe2XN7YS/tlb22N/bW3tl7+2Af7ZN9ti/21cIs3L5ZhH23H/bTftlv72/LjR557ImnnnmeF8mL7EXxfLyoXjQvuhfDi+nF8mJ7cTxfL64Xz4vvJfASeok8Py+xl8RL6vl7ybzkXgovpZfKS+2l8dJ66bz0XgYvo5fJy+xl8bJ62bzsXg4vp5fLy+3l8fJ6+bz8XgGvoFfIK+wV8Yp6xbziXgmvpFfKK+2V8cp65bzyXgX/7z6hESlDISxG6LeMoRQWI4J9f/X9NjSir/2s+yuN77eLFnbkRw5ZtsH3+5HwPBL+VZc18/150f6oHBLUyvfPbh758VWj/eMf//jHP/7xj/9//B1wRw5P6pN6ll+CTLG+jwvxk9IhuifynigRz3z/B+I69cx42u3BAQ0AAAgDoG/WNvBjGERgmg0AAADwwAGHXgFoAAAAAAEAAAAA"); unicode-range: U+0028, U+0029; } /* Colors from: Wong, B. Points of view: Color blindness. Nat Methods 8, 441 (2011). https://doi.org/10.1038/nmeth.1618 */ /* If the active version has the name "dev", style it orange */ #version_switcher_button[data-active-version-name*="dev"] { background-color: #E69F00; border-color: #E69F00; color: white; } /* green for `stable` */ #version_switcher_button[data-active-version-name*="stable"] { background-color: #009E73; border-color: #009E73; color: white; } /* red for `old` */ #version_switcher_button:not([data-active-version-name*="stable"]):not([data-active-version-name*="dev"]):not([data-active-version-name*="pull"]) { background-color: #980F0F; border-color: #980F0F; color: white; } /* Main index page overview cards */ .sd-card { background: #fff; border-radius: 0; padding: 30px 10px 20px 10px; margin: 10px 0px; } .sd-card .sd-card-header { text-align: center; } .sd-card .sd-card-header .sd-card-text { margin: 0px; } .sd-card .sd-card-img-top { height: 52px; width: 52px; margin-left: auto; margin-right: auto; } .sd-card .sd-card-header { border: none; background-color:white; color: #150458 !important; font-size: var(--pst-font-size-h5); font-weight: bold; padding: 2.5rem 0rem 0.5rem 0rem; border-bottom: none !important; } .sd-card .sd-card-footer { border: none; background-color:white; border-top: none !important; } .sd-card .sd-card-footer .sd-card-text{ max-width: 220px; margin-left: auto; margin-right: auto; } .custom-button { background-color:#DCDCDC; border: none; color: #484848; text-align: center; text-decoration: none; display: inline-block; font-size: 0.9rem; border-radius: 0.5rem; max-width: 120px; padding: 0.5rem 0rem; } .custom-button a { color: #484848; } .custom-button p { margin-top: 0; margin-bottom: 0rem; color: #484848; } /* Dark theme tweaking Matplotlib images are in png and inverted while other output types are assumed to be normal images. */ html[data-theme=dark] img[src*='.svg']:not(.only-dark):not(.dark-light) { filter: brightness(0.8) invert(0.82) contrast(1.2); background: unset } html[data-theme=dark] .MathJax_SVG * { fill: var(--pst-color-text-base); } /* Main index page overview cards */ html[data-theme=dark] .sd-card { background-color:var(--pst-color-background); border: none } html[data-theme=dark] .sd-shadow-sm { box-shadow: 0 .1rem 0.5rem rgba(250, 250, 250, .2) !important } html[data-theme=dark] .sd-card .sd-card-header { background-color:var(--pst-color-background); color: #150458 !important; } html[data-theme=dark] .sd-card .sd-card-footer { background-color:var(--pst-color-background); } pyqtgraph-pyqtgraph-0.13.4/doc/source/_static/dash.css000066400000000000000000000007621457240071200227660ustar00rootroot00000000000000/* Slight Modification When Building Dash Docset Dash windows can be of a variety of sizes, no need to restrict to fixed width. To be used with sphinx-pydata-theme */ .bd-header { display: none; } .bd-sidebar-primary { display: none; } .bd-main .bd-content .bd-article-container { flex-grow: 1; max-width: 100%; } .bd-container .bd-container__inner { flex-grow: 1; max-width: 100%; } /* patching issue from pydata-sphinx-theme */ div.viewcode-block:target { display: block; } pyqtgraph-pyqtgraph-0.13.4/doc/source/_static/peegee_03_square_no_bg_32_cleaned.ico000066400000000000000000000102761457240071200302710ustar00rootroot00000000000000  ¨( @ ‡ÿ· ÿ· ÿ· ÿ· ÿ‡ÿ‡ÿ· ÿ· ÿ· ÿ‡ÿ· ÿ· ÿ‡ÿ‡ÿ· ÿ· ÿ‡ÿ· ÿ‡ÿ‡ÿ· ÿ· ÿ· ÿ· ÿ· ÿ‡ÿ· ÿ· ÿ· ÿ‡[ÿWÔÿÿ&€™ÿ³xÿ‡[ÿ‡[ÿ³xÿ³xÿ‡[ÿ³xÿ³xÿWÔÿÿWÔÿÿ&€™ÿ³xÿ³xÿ‡[ÿ³xÿ³xÿ‡[ÿ‡[ÿ³xÿ³xÿ‡[ÿWÔÿÿ&€™ÿWÔÿÿ‡[ÿ³xÿ³xÿ³xÿ‡[ÿ‡[ÿWÔÿÿ&€™ÿWÔÿÿ&€™ÿ‡[ÿ³xÿ‡[ÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿ™AyÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿ&€™ÿWÔÿÿÆSÿ™AyÿÆSÿ™Ayÿ™AyÿÆSÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿÆSÿÆSÿÆSÿÆSÿ™AyÿÆSÿÆSÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿ™AyÿÆSÿ™AyÿÆSÿÆSÿÆSÿ™Ayÿ&€™ÿWÔÿÿ&€™ÿWÔÿÿWÔÿÿ7„¡ÿ™AyÿÆSÿ™AyÿyE³ÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿ&€™ÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿWÔÿÿÿÿÿÿWÔÿÿ&€™ÿ­bÿÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿWÔÿÿÿÿÿÿÿÿÿÿÿWÔÿÿ&€™ÿ&€™ÿ­bÿÿyE³ÿWÔÿÿWÔÿÿ&€™ÿÿÿÿÿÿWÔÿÿ&€™ÿWÔÿÿ&€™ÿ­bÿÿyE³ÿ­bÿÿyE³ÿ­bÿÿ&€™ÿWÔÿÿWÔÿÿ&€™ÿ&€™ÿWÔÿÿ&€™ÿWÔÿÿ&€™ÿ­bÿÿ­bÿÿ­bÿÿ­bÿÿ­bÿÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿ­bÿÿyE³ÿ­bÿÿ&€™ÿ&€™ÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿ­bÿÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿUÏùÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿVÒýÿ&€™ÿWÔÿÿVÑûÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿWÓþÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿWÓþÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿ&€™ÿWÔÿÿWÔÿÿWÔÿÿWÔÿÿ?ÿÿÿ?ÿÿÿÿÁÏÿÿÿãÿÿüÿÿ(ž?ÿ'¿ÿóŸÿøßÿþ_ÿ Ã_ÿùÿüÿàÿý„ÿùþÿƒþÿÿÿ€?ÿ?ÿÿÀÿÿàÿÿðÿÿøÿÿüÿÿþÿÿÿÿÿÿÁÿÿÿàÿÿÿøÿÿÿþpyqtgraph-pyqtgraph-0.13.4/doc/source/_static/peegee_03_square_no_bg_32_cleaned.png000066400000000000000000000012131457240071200302720ustar00rootroot00000000000000‰PNG  IHDR szzôsRGB®ÎéCIDATXGÅ–½KAÅg1…`gŸNlTP°Jg)˜JAÁBPÐÁ€E*cgaQAPPQ,íA0blD$ÞN?²ò6Î2·Þ%wgN·É]¸Û÷›÷f–SôK—ǵú}³îŸHa¬îÝПø‰ÏåTâ®0[ꀸÖDn™,˜Ä#žÄ?>5¥Ú~Ö'«O (óZMÓÚAÉä.G¿¥‰»—@qžÞ×jc4¶Å|·žsg±úÑã' Ëôñ Ø‹Åg0äg?úÒé­·:Ð{™ÕƒÚ±À|þèÞbþ³/}à@„é;ûÌæŸüàùÓ÷î}ñô΃=BO?«5 „yÑÌ/>8Žv }P(f5aþäÃW.&<üÏ¿O_ùο.0û¢pÖÙ=ظf”ÔôPn8Ðc6scm€èü«_É z¶>Ðxcƒš“ô™ÉԔĠÑù÷ût•ÝÀ×|ce¦™ÞùXs#ŒÎ1¹ázç€Ìd'1$rÞiÆw.U–÷„Y]rTMïq*·Ö˵™ ÐÇa±ÚÒÖz9&5´ÑÙ#tõtﻞ0ƒ'KwcÞ÷Eá¾™ÔZ·Ü»»­HÛ W¯&³á’ƒóî±_ï³UtvÉqlpcÖ/0Ó {¸È*:;Ð=fkž>6£³fWÐ5ôzüd˜<3z&Ì7o¢‹f9@C_èvÙ±%Õ·¾r å„­Î8—LÊÚ£t‰ëìÊâ66¶øÖÛO/ý˧wï?g×IeK˜\*›5¯î@›»´¬Áf 5ü>Ø3H¨†ö]£EéÐð=­ágËk¼ZÜ´oá;VC[íúœŸ¶Ð1 ?[B=ƒn¦^¾%98¨¥†Úœk—Ÿúý–ˆih„™Zýýÿ³kæ#rŠn8ÍRQt ¤±²uüMI†hŒ0ÓËßyðñ%Z÷3éfU„Nƒ4WÖ¡NC ¯ä¾_›BÝZWϤ›Y K! ·Íèry$}¡†@‚´ø*ãÙt³9ÐáÀ.Z 3m•‚ 2ÅJ†Ì*5Ð7Q ] (-ÏÁ|éØw%!º.»´9™Á½5¬eÈ×wq6–¼¾¬Z¹Å^ ¤%eKº·²–‘‡ÑZ«¯gÕÍ+É‘£®Ðp ±}‹ýÆC–0[É™u³ Ð1HSPã¢ñèP[H î“J«­g—)›‹Ð ÒºôÉD/s0Ç¢µdÁ¸©±Z fjA'ÍQ5BouX£5¤÷–9ŽÜ㱩¡:ö¨–èðs„Ǿ,`¦2|Xòõl\d/RÃhI¦;ÊÂP«”̈M~*Jc[×°._^þÔ{‚ìÛä „ÖŸÖïúÒö4rƒ¸Zr}Ç€`¾Äø…‚}ŸÞ„Î.í뛓““K’%–䊗Èò⃧g›‹ÀÔÐá¥4  W`_ÿg³ù×ËÕÛÌ ´ÜÉ?Π­_×ȘvF}¦ìBûb@?ûÒ»“Òyè%BENä¡-t¼ÔA¥åjäFg„ûÎAJ&:—š3]ù)€Fà'ñn±äåF4ØËGSÉá@oH wÖšFíY¢´6B/WœÏ—T\8-9 i.ÚèØ‘ÓQ¡ÆHàJé êv¡cÑ™‹Ð´Ïký¼|¨m8µ›u½¹Ñ’û;°LЗƒx¸'åqøøÀ°:ŸÚT9 ¹íoìÿèÑY2qÍßi’¬F)Ð4b–FÍØé´Ð š(œs$ÝP)ÕÏ.7ÖžÝUƒMß$®› $‡•ÞMÁŒCÙÔçØ­D1}fUJ"6]h6^ +ßÚÛWKFhN"”DRhpƒÕ'Ao—¦¢sj±~ŸJN#S[‚¨|øô\jž£@s0—è] Ì]Æä€&âC¦n-…Yu©d™,Jà >‹ Ï}²§æ”@—ÂÌA-Î1-]"iäæÚ”ä2¹…Z h|úº¦]Ëæoe¡µ@ƒBK£ó PçBDÑÕ2Ì‚Ä6a ÚžŸÈJ .@ç`¦°J@•”I{@ÙqÙþlpdÓ ±Â*)S9ç»®¾L€æTšMâ¡ ¡=ç!‡ Œøi” ÆæôS°Ò _hÁ eŠdÎAX*O4@ǤL¹ÑÚ+€%§ã(ÈТdsC ª´\?ì¢É[;uÔ*B)Ô\;1O6ŠÒ+xas¢ä–#ÏYH@FÛ¤ B¹PG»†–¿×’@K!ä –¶Ù èÚG³èÁ} È`—ækœ_õ«§wï?·rÉ‘oC’ã|:EÖ@h½}]³8,…8÷´ =õV‘s‘^ËE]‰Ö.™ä#•úpPi”FÃË é„Æà¥ÐÒ²µç%´yåˆ~$^Y[W@k"3ÛCEi”æòÃt!¼-|Äÿú·a³%¦haF‰.N]G˼o:‰².ËJqQ:µ•Œ½7Õß›Ú̽¹$—Œ{„.c„–n:¹úa­k¦ Æ‰§2¢7Àt¤ÒsÑœ_bíx„æ¼öôõ©€†£,¢0×t·‰‹Ê0nIdÎ-$è ¦P=ýÃ?¾¼²N“}¹‡/ÅEeMªÏ#4ï÷T‰îÑL?Ô§P#Ì[BL#ilg±tK<ô‰­§d* õfÚ×Ìe14Q9ÔâáÝ.9dsXô›ïß|_/ö÷ÓoÖµ)÷¦¥jRr’{„–x)^F_ fÚÇNÁÎ¥ÔÀ| )äi»ž@s ïêhp ÈjsÆ#ô¨@øv©{Á .‹õwHÏ’fÕãX_³Lr”DçEêÞ ¶ûY’Ç®ÇbÞä@kaž|±¸Ì~ŽCÿ†’ƒ™J i9ýx»Öì 3Ê Z?Íu@§ôq l =Ý)U˜[˜Y.Ãüsj£Æ%‡ rh œ-"µDòX¼anüvëºú0«Ì½òR©-tßP‘û_5k`Æþ­ –€l¼-ʶ€Ìr GÆQó†ÈÕçl¬ˆÔ½sÀÜá&—Üd¯_OKŽZ9 9è$ÞbŒ·ý•¼Ù¨ÌµùÒ¹#§™á_ºÌëmÖB-™Úi´P £e«û\T¦2~·ØJ/CbîÒq ­#ŸPi¹˜Ïm ¾Dç–0§¾«öØéÜ(ÚŒþ6ÐÖ0K‰œ-œ<Éõ!¬K‚³ezNúT‹Ge†üëk k"¤d¥ hSä¥û°yý%:·‚™»èÑA–Ä—¹šƒMF¾W®Z[Ó§Bz„Ï'ZêÖÜÙi\ô9Ì<¨ÒWÉÔZ-X¹pPk@Ö.ß|ÿ|÷ç¯Ãâkù¦ÖÖ0k.z”N¦—ƒ§¾9¸4ûRÏÒ¾k!û”Dê†ýÇ6g<"KÁЗã¶M?V]Mî ÛÀ>š–󈬛6m­<Ð &[;Ъz’h]ÕÁºrâÎþÜŒáŽÚTè½ÀÜyfæÎº‹í0«gå†oY«]XUñ6гڡw~w:æ[w–ú–Ùõ€Xñh¹zúhhäÉ7æ¸3°Úàð…ŠÑ¤8ÌFެlÆ®t Tw˜ œhÔÄ!FS>”JÚŽ´ŽÑ¼y3  hä˜BPcm8Ì㼿š°Õäk`–LÓVöHÆvÄ2Í€æê Bj,t Üx%Ñûˆf³9Ð¥`´[+rv´óhÌ4S KaFGµD óLèc]{À h-Ì-¡E¿;tý<`t-Ì- öèÜ¢‘zªšƒ¹táe!?æ‘ë;–* K`¦fµ^p¹Ôè ÑH½©ÖŒƷ‚Ú£óHxõK ¥²Áj‡¹?@£õxH´Ž®µQž“1¥v69>žr,@Ój9,”¼9 ŒJÉN`¹k¼ÆŒ¸thÅ,/å ®}Í›LòF˜qÂ|Ìyˆ`åœhjÌÜÌïõj -`Öȇùx°J,®Úf)ÔœQ-ÆÄõé¯ã%mÇ}ÜÇtuKJǃcq˜[ÎÊmGóÐ#|œ—@í Ï[Qª7Vz NµÃÜc&æéch ©)Üñ<€õéÿËó…xcõrIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/000077500000000000000000000000001457240071200224715ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/000077500000000000000000000000001457240071200245205ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/glaxisitem.rst000066400000000000000000000002121457240071200274130ustar00rootroot00000000000000GLAxisItem ========== .. autoclass:: pyqtgraph.opengl.GLAxisItem :members: .. automethod:: pyqtgraph.opengl.GLAxisItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/glgraphicsitem.rst000066400000000000000000000002701457240071200302530ustar00rootroot00000000000000GLGraphicsItem ============== .. autoclass:: pyqtgraph.opengl.GLGraphicsItem.GLGraphicsItem :members: .. automethod:: pyqtgraph.opengl.GLGraphicsItem.GLGraphicsItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/glgraphitem.rst000066400000000000000000000002101457240071200275460ustar00rootroot00000000000000GLGraphItem =========== .. autoclass:: pyqtgraph.opengl.GLGraphItem :members: .. automethod:: pyqtgraph.opengl.GLGraphItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/glgriditem.rst000066400000000000000000000002121457240071200273740ustar00rootroot00000000000000GLGridItem ========== .. autoclass:: pyqtgraph.opengl.GLGridItem :members: .. automethod:: pyqtgraph.opengl.GLGridItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/glimageitem.rst000066400000000000000000000002161457240071200275350ustar00rootroot00000000000000GLImageItem =========== .. autoclass:: pyqtgraph.opengl.GLImageItem :members: .. automethod:: pyqtgraph.opengl.GLImageItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/gllineplotitem.rst000066400000000000000000000002321457240071200302770ustar00rootroot00000000000000GLLinePlotItem ============== .. autoclass:: pyqtgraph.opengl.GLLinePlotItem :members: .. automethod:: pyqtgraph.opengl.GLLinePlotItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/glmeshitem.rst000066400000000000000000000002121457240071200274030ustar00rootroot00000000000000GLMeshItem ========== .. autoclass:: pyqtgraph.opengl.GLMeshItem :members: .. automethod:: pyqtgraph.opengl.GLMeshItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/glscatterplotitem.rst000066400000000000000000000002461457240071200310220ustar00rootroot00000000000000GLScatterPlotItem ================= .. autoclass:: pyqtgraph.opengl.GLScatterPlotItem :members: .. automethod:: pyqtgraph.opengl.GLScatterPlotItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/glsurfaceplotitem.rst000066400000000000000000000002461457240071200310050ustar00rootroot00000000000000GLSurfacePlotItem ================= .. autoclass:: pyqtgraph.opengl.GLSurfacePlotItem :members: .. automethod:: pyqtgraph.opengl.GLSurfacePlotItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/gltextitem.rst000066400000000000000000000002121457240071200274330ustar00rootroot00000000000000GLTextItem ========== .. autoclass:: pyqtgraph.opengl.GLTextItem :members: .. automethod:: pyqtgraph.opengl.GLTextItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/glviewwidget.rst000066400000000000000000000012471457240071200277570ustar00rootroot00000000000000GLViewWidget ============ .. autoclass:: pyqtgraph.opengl.GLViewWidget :members: :show-inheritance: :inherited-members: QOpenGLWidget .. automethod:: pyqtgraph.opengl.GLViewWidget.__init__ .. autoclass:: pyqtgraph.opengl.GLViewWidget::GLViewMixin .. warning:: The intention of this class is to provide users who want to use ``QOpenGLWindow`` instead of ``QOpenGLWidget`` but retain the benefits of ``GLViewWidget``. Usage of this class should be considered experimental for the time being as it may change without warning in future releases. :members: .. automethod:: pyqtgraph.opengl.GLViewWidget::GLViewMixin.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/glvolumeitem.rst000066400000000000000000000002221457240071200277570ustar00rootroot00000000000000GLVolumeItem ============ .. autoclass:: pyqtgraph.opengl.GLVolumeItem :members: .. automethod:: pyqtgraph.opengl.GLVolumeItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/index.rst000066400000000000000000000017771457240071200263750ustar00rootroot00000000000000PyQtGraph's 3D Graphics System ============================== The 3D graphics system in pyqtgraph is composed of a :class:`view widget ` and several graphics items (all subclasses of :class:`GLGraphicsItem `) which can be added to a view widget. **Note 1:** pyqtgraph.opengl is based on the deprecated OpenGL fixed-function pipeline. Although it is currently a functioning system, it is likely to be superceded in the future by `VisPy `_. **Note 2:** use of this system requires python-opengl bindings. Linux users should install the python-opengl packages from their distribution. Windows/OSX users can download from ``_. Contents: .. toctree:: :maxdepth: 2 glviewwidget glgriditem glgraphitem glsurfaceplotitem glvolumeitem glimageitem glmeshitem gllineplotitem glaxisitem glgraphicsitem glscatterplotitem gltextitem meshdata pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/3dgraphics/meshdata.rst000066400000000000000000000002021457240071200270320ustar00rootroot00000000000000MeshData ======== .. autoclass:: pyqtgraph.opengl.MeshData :members: .. automethod:: pyqtgraph.opengl.MeshData.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/colormap.rst000066400000000000000000000061311457240071200250400ustar00rootroot00000000000000.. _apiref_colormap: Color Maps ========== A color map defines a relationship between scalar data values and a range of colors. Color maps are commonly used to generate false color images, color scatter-plot points, and illustrate the height of surface plots. PyQtGraph's :class:`~pyqtgraph.ColorMap` can conveniently be applied to images and interactively adjusted by using :class:`~pyqtgraph.ColorBarItem`. To provide interactively user-defined color mappings, see :class:`~pyqtgraph.GradientEditorItem` and :class:`~pyqtgraph.GradientWidget`, which wraps it. :class:`~pyqtgraph.GradientEditorItem` combines the editing with a histogram and controls for interactively adjusting image levels. Setting a color map and adding a color bar can be as simple as:: plot.addItem( img_item := pg.ImageItem(img_data) ) plot.addColorBar( img_item, colorMap='viridis', values=(0, 1) ) ``` ColorMap can also be used a convenient source of colors from a consistent palette or to generate :class:`QPen` and :class:`QBrush` objects used to draw lines and fills that are colored according to their values along the horizontal or vertical axis. Sources for color maps ---------------------- Color maps can be user defined by assigning a number of *stops* over the range of 0 to 1. A color is given for each stop, and the in-between values are generated by interpolation. When map colors directly represent values, an improperly designed map can obscure detail over certain ranges of values, while creating false detail in others. PyQtGraph includes the perceptually uniform color maps provided by the `Colorcet project `_. Color maps can also be imported from the ``colorcet`` library or from ``matplotlib``, if either of these is installed. To see all available color maps, please run the `ColorMap` demonstration available in the suite of :ref:`examples`. Examples -------- False color display of a 2D data set. Display levels are controlled by a :class:`ColorBarItem `: .. literalinclude:: /images/gen_example_false_color_image.py :lines: 18-28 :dedent: 8 Using QtGui.QPen and QtGui.QBrush to color plots according to the plotted value: .. literalinclude:: /images/gen_example_gradient_plot.py :lines: 16-33 :dedent: 8 .. thumbnail:: /images/example_false_color_image.png :width: 49% :alt: Example of a false color image :title: False color image .. thumbnail:: /images/example_gradient_plot.png :width: 49% :alt: Example of drawing and filling plots with gradients :title: Drawing and filling plots with gradients The use of color maps is also demonstrated in the `ImageView`, `Color Gradient Plots` and `ColorBarItem` :ref:`examples`. API Reference ------------- .. autofunction:: pyqtgraph.colormap.listMaps .. autofunction:: pyqtgraph.colormap.get .. autofunction:: pyqtgraph.colormap.getFromMatplotlib .. autofunction:: pyqtgraph.colormap.getFromColorcet .. autofunction:: pyqtgraph.colormap.modulatedBarData .. autoclass:: pyqtgraph.ColorMap :members: .. automethod:: pyqtgraph.ColorMap.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/config_options.rst000066400000000000000000000100701457240071200262410ustar00rootroot00000000000000.. currentmodule:: pyqtgraph .. _apiref_config: Global Configuration Options ============================ PyQtGraph has several global configuration options that allow you to change its default behavior. These can be accessed using the :func:`setConfigOptions` and :func:`getConfigOption` functions: ================== =================== ================== ================================================================================ **Option** **Type** **Default** leftButtonPan bool True If True, dragging the left mouse button over a ViewBox causes the view to be panned. If False, then dragging the left mouse button draws a rectangle that the ViewBox will zoom to. foreground See :func:`mkColor` 'd' Default foreground color for text, lines, axes, etc. background See :func:`mkColor` 'k' Default background for :class:`GraphicsView`. antialias bool False Enabling antialiasing causes lines to be drawn with smooth edges at the cost of reduced performance. imageAxisOrder str 'col-major' For 'row-major', image data is expected in the standard row-major (row, col) order. For 'col-major', image data is expected in reversed column-major (col, row) order. The default is 'col-major' for backward compatibility, but this may change in the future. editorCommand str or None None Command used to invoke code editor from ConsoleWidget. exitCleanup bool True Attempt to work around some exit crash bugs in PyQt and PySide. useOpenGL bool False Enable OpenGL in GraphicsView. useCupy bool False Use cupy to perform calculations on the GPU. Only currently applies to ImageItem and its associated functions. useNumba bool False Use numba acceleration where implemented. enableExperimental bool False Enable experimental features (the curious can search for this key in the code). In combination with useOpenGL, this makes PlotCurveItem use PyOpenGL for curve drawing. **Caveats** * Only a very limited subset of the full options of PlotCurveItem is implemented. * Single precision is used. This may cause drawing artifacts. crashWarning bool False If True, print warnings about situations that may result in a crash. segmentedLineMode str 'auto' For 'on', lines are always plotted in segments. For 'off', lines are never plotted in segments. For 'auto', whether lines are plotted in segments is automatically decided based on pen poperties and whether anti-aliasing is enabled. ================== =================== ================== ================================================================================ .. autofunction:: pyqtgraph.setConfigOptions .. autofunction:: pyqtgraph.setConfigOption .. autofunction:: pyqtgraph.getConfigOption pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/dockarea.rst000066400000000000000000000003041457240071200247710ustar00rootroot00000000000000Dock Area Module ================ .. automodule:: pyqtgraph.dockarea :members: .. autoclass:: pyqtgraph.dockarea.DockArea :members: .. autoclass:: pyqtgraph.dockarea.Dock :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/exporters/000077500000000000000000000000001457240071200245245ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/exporters/Exporter.rst000066400000000000000000000001211457240071200270600ustar00rootroot00000000000000Exporter ============ .. autoclass:: pyqtgraph.exporters.Exporter :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/exporters/SVGExporter.rst000066400000000000000000000003321457240071200274440ustar00rootroot00000000000000SVGExporter ============ .. autoclass:: pyqtgraph.exporters.SVGExporter :members: .. autofunction:: pyqtgraph.exporters.SVGExporter.generateSvg .. autofunction:: pyqtgraph.exporters.SVGExporter._generateItemSvg pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/exporters/index.rst000066400000000000000000000001641457240071200263660ustar00rootroot00000000000000.. _exporter: API Reference ============= Contents: .. toctree:: :maxdepth: 2 Exporter SVGExporter pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/flowchart/000077500000000000000000000000001457240071200244625ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/flowchart/flowchart.rst000066400000000000000000000002401457240071200272010ustar00rootroot00000000000000flowchart.Flowchart =================== .. autoclass:: pyqtgraph.flowchart.Flowchart :members: .. automethod:: pyqtgraph.flowchart.Flowchart.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/flowchart/index.rst000066400000000000000000000242531457240071200263310ustar00rootroot00000000000000.. _flowchart: Visual Programming with Flowcharts ================================== PyQtGraph's flowcharts provide a visual programming environment similar in concept to LabView--functional modules are added to a flowchart and connected by wires to define a more complex and arbitrarily configurable algorithm. A small number of predefined modules (called Nodes) are included with pyqtgraph, but most flowchart developers will want to define their own library of Nodes. At their core, the Nodes are little more than 1) a python function 2) a list of input/output terminals, and 3) an optional widget providing a control panel for the Node. Nodes may transmit/receive any type of Python object via their terminals. One major limitation of flowcharts is that there is no mechanism for looping within a flowchart. (however individual Nodes may contain loops (they may contain any Python code at all), and an entire flowchart may be executed from within a loop). There are two distinct modes of executing the code in a flowchart: 1. Provide data to the input terminals of the flowchart. This method is slower and will provide a graphical representation of the data as it passes through the flowchart. This is useful for debugging as it allows the user to inspect the data at each terminal and see where exceptions occurred within the flowchart. 2. Call :func:`Flowchart.process() `. This method does not update the displayed state of the flowchart and only retains the state of each terminal as long as it is needed. Additionally, Nodes which do not contribute to the output values of the flowchart (such as plotting nodes) are ignored. This mode allows for faster processing of large data sets and avoids memory issues which can occur if too much data is present in the flowchart at once (e.g., when processing image data through several stages). See the flowchart example for more information. API Reference: .. toctree:: :maxdepth: 2 flowchart node terminal Basic Use --------- Flowcharts are most useful in situations where you have a processing stage in your application that you would like to be arbitrarily configurable by the user. Rather than giving a pre-defined algorithm with parameters for the user to tweak, you supply a set of pre-defined functions and allow the user to arrange and connect these functions how they like. A very common example is the use of filter networks in audio / video processing applications. To begin, you must decide what the input and output variables will be for your flowchart. Create a flowchart with one terminal defined for each variable:: ## This example creates just a single input and a single output. ## Flowcharts may define any number of terminals, though. from pyqtgraph.flowchart import Flowchart fc = Flowchart(terminals={ 'nameOfInputTerminal': {'io': 'in'}, 'nameOfOutputTerminal': {'io': 'out'} }) In the example above, each terminal is defined by a dictionary of options which define the behavior of that terminal (see :func:`Terminal.__init__() ` for more information and options). Note that Terminals are not typed; any python object may be passed from one Terminal to another. Once the flowchart is created, add its control widget to your application:: ctrl = fc.widget() myLayout.addWidget(ctrl) ## read Qt docs on QWidget and layouts for more information The control widget provides several features: * Displays a list of all nodes in the flowchart containing the control widget for each node. * Provides access to the flowchart design window via the 'flowchart' button * Interface for saving / restoring flowcharts to disk. At this point your user has the ability to generate flowcharts based on the built-in node library. It is recommended to provide a default set of flowcharts for your users to build from. All that remains is to process data through the flowchart. As noted above, there are two ways to do this: .. _processing methods: 1. Set the values of input terminals with :func:`Flowchart.setInput() `, then read the values of output terminals with :func:`Flowchart.output() `:: fc.setInput(nameOfInputTerminal=newValue) output = fc.output() # returns {terminalName:value} This method updates all of the values displayed in the flowchart design window, allowing the user to inspect values at all terminals in the flowchart and indicating the location of errors that occurred during processing. 2. Call :func:`Flowchart.process() `:: output = fc.process(nameOfInputTerminal=newValue) This method processes data without updating any of the displayed terminal values. Additionally, all :func:`Node.process() ` methods are called with display=False to request that they not invoke any custom display code. This allows data to be processed both more quickly and with a smaller memory footprint, but errors that occur during Flowchart.process() will be more difficult for the user to diagnose. It is thus recommended to use this method for batch processing through flowcharts that have already been tested and debugged with method 1. Implementing Custom Nodes ------------------------- PyQtGraph includes a small library of built-in flowchart nodes. This library is intended to cover some of the most commonly-used functions as well as provide examples for some more exotic Node types. Most applications that use the flowchart system will find the built-in library insufficient and will thus need to implement custom Node classes. A node subclass implements at least: 1) A list of input / output terminals and their properties 2) A :func:`process() ` function which takes the names of input terminals as keyword arguments and returns a dict with the names of output terminals as keys. Optionally, a Node subclass can implement the :func:`ctrlWidget() ` method, which must return a QWidget (usually containing other widgets) that will be displayed in the flowchart control panel. A minimal Node subclass looks like:: class SpecialFunctionNode(Node): """SpecialFunction: short description This description will appear in the flowchart design window when the user selects a node of this type. """ nodeName = 'SpecialFunction' # Node type name that will appear to the user. def __init__(self, name): # all Nodes are provided a unique name when they # are created. Node.__init__(self, name, terminals={ # Initialize with a dict # describing the I/O terminals # on this Node. 'inputTerminalName': {'io': 'in'}, 'anotherInputTerminal': {'io': 'in'}, 'outputTerminalName': {'io': 'out'}, }) def process(self, **kwds): # kwds will have one keyword argument per input terminal. return {'outputTerminalName': result} def ctrlWidget(self): # this method is optional return someQWidget Some nodes implement fairly complex control widgets, but most nodes follow a simple form-like pattern: a list of parameter names and a single value (represented as spin box, check box, etc..) for each parameter. To make this easier, the ``pyqtgraph.flowchart.library.common.CtrlNode`` subclass allows you to instead define a simple data structure that CtrlNode will use to automatically generate the control widget. This is used in many of the built-in library nodes (especially the filters). There are many other optional parameters for nodes and terminals -- whether the user is allowed to add/remove/rename terminals, whether one terminal may be connected to many others or just one, etc. See the documentation on the :class:`~pyqtgraph.flowchart.Node` and :class:`~pyqtgraph.flowchart.Terminal` classes for more details. After implementing a new Node subclass, you will most likely want to register the class so that it appears in the menu of Nodes the user can select from:: import pyqtgraph.flowchart.library as fclib fclib.registerNodeType(SpecialFunctionNode, [('Category', 'Sub-Category')]) The second argument to registerNodeType is a list of tuples, with each tuple describing a menu location in which SpecialFunctionNode should appear. See the FlowchartCustomNode example for more information. Debugging Custom Nodes ^^^^^^^^^^^^^^^^^^^^^^ When designing flowcharts or custom Nodes, it is important to set the input of the flowchart with data that at least has the same types and structure as the data you intend to process (see `processing methods`_ #1 above). When you use :func:`Flowchart.setInput() `, the flowchart displays visual feedback in its design window that can tell you what data is present at any terminal and whether there were errors in processing. Nodes that generated errors are displayed with a red border. If you select a Node, its input and output values will be displayed as well as the exception that occurred while the node was processing, if any. Using Nodes Without Flowcharts ------------------------------ Flowchart Nodes implement a very useful generalization in data processing by combining a function with a GUI for configuring that function. This generalization is useful even outside the context of a flowchart. For example:: ## We defined a useful filter Node for use in flowcharts, but would like to ## re-use its processing code and GUI without having a flowchart present. filterNode = MyFilterNode("filterNodeName") ## get the Node's control widget and place it inside the main window filterCtrl = filterNode.ctrlWidget() someLayout.addWidget(filterCtrl) ## later on, process data through the node filteredData = filterNode.process(inputTerminal=rawData) pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/flowchart/node.rst000066400000000000000000000002141457240071200261360ustar00rootroot00000000000000flowchart.Node ============== .. autoclass:: pyqtgraph.flowchart.Node :members: .. automethod:: pyqtgraph.flowchart.Node.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/flowchart/terminal.rst000066400000000000000000000002341457240071200270260ustar00rootroot00000000000000flowchart.Terminal ================== .. autoclass:: pyqtgraph.flowchart.Terminal :members: .. automethod:: pyqtgraph.flowchart.Terminal.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/functions.rst000066400000000000000000000054311457240071200252360ustar00rootroot00000000000000PyQtGraph's Helper Functions ============================ Simple Data Display Functions ----------------------------- .. autofunction:: pyqtgraph.plot .. autofunction:: pyqtgraph.image .. autofunction:: pyqtgraph.dbg Color, Pen, and Brush Functions ------------------------------- Qt uses the classes QColor, QPen, and QBrush to determine how to draw lines and fill shapes. These classes are highly capable but somewhat awkward to use. PyQtGraph offers the functions :func:`~pyqtgraph.mkColor`, :func:`~pyqtgraph.mkPen`, and :func:`~pyqtgraph.mkBrush` to simplify the process of creating these classes. In most cases, however, it will be unnecessary to call these functions directly--any function or method that accepts *pen* or *brush* arguments will make use of these functions for you. For example, the following three lines all have the same effect:: pg.plot(xdata, ydata, pen='r') pg.plot(xdata, ydata, pen=pg.mkPen('r')) pg.plot(xdata, ydata, pen=QPen(QColor(255, 0, 0))) .. autofunction:: pyqtgraph.mkColor .. autofunction:: pyqtgraph.mkPen .. autofunction:: pyqtgraph.mkBrush .. autofunction:: pyqtgraph.hsvColor .. autofunction:: pyqtgraph.intColor .. autofunction:: pyqtgraph.CIELabColor .. autofunction:: pyqtgraph.colorCIELab .. autofunction:: pyqtgraph.colorDistance Data Slicing ------------ .. autofunction:: pyqtgraph.affineSlice Coordinate Transformation ------------------------- .. autofunction:: pyqtgraph.transformToArray .. autofunction:: pyqtgraph.transformCoordinates .. autofunction:: pyqtgraph.solve3DTransform .. autofunction:: pyqtgraph.solveBilinearTransform SI Unit Conversion Functions ---------------------------- .. autofunction:: pyqtgraph.siFormat .. autofunction:: pyqtgraph.siScale .. autofunction:: pyqtgraph.siEval .. autofunction:: pyqtgraph.siParse Image Preparation Functions --------------------------- .. autofunction:: pyqtgraph.makeARGB .. autofunction:: pyqtgraph.makeQImage .. autofunction:: pyqtgraph.applyLookupTable .. autofunction:: pyqtgraph.rescaleData .. autofunction:: pyqtgraph.imageToArray Mesh Generation Functions ------------------------- .. autofunction:: pyqtgraph.isocurve .. autofunction:: pyqtgraph.isosurface Miscellaneous Functions ----------------------- .. autofunction:: pyqtgraph.eq .. autofunction:: pyqtgraph.arrayToQPath .. autofunction:: pyqtgraph.pseudoScatter .. autofunction:: pyqtgraph.systemInfo .. autofunction:: pyqtgraph.exit Legacy Color Helper Functions ------------------------------- The following helper functions should no longer be used. The functionality that they implement is trivial and it is suggested that the user use the equivalent QColor methods directly. .. autofunction:: pyqtgraph.colorTuple .. autofunction:: pyqtgraph.colorStr .. autofunction:: pyqtgraph.glColor pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/000077500000000000000000000000001457240071200252735ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/arrowitem.rst000066400000000000000000000001701457240071200300340ustar00rootroot00000000000000ArrowItem ========= .. autoclass:: pyqtgraph.ArrowItem :members: .. automethod:: pyqtgraph.ArrowItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/axisitem.rst000066400000000000000000000001641457240071200276510ustar00rootroot00000000000000AxisItem ======== .. autoclass:: pyqtgraph.AxisItem :members: .. automethod:: pyqtgraph.AxisItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/bargraphitem.rst000066400000000000000000000002041457240071200304660ustar00rootroot00000000000000BarGraphItem ============ .. autoclass:: pyqtgraph.BarGraphItem :members: .. automethod:: pyqtgraph.BarGraphItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/buttonitem.rst000066400000000000000000000001741457240071200302210ustar00rootroot00000000000000ButtonItem ========== .. autoclass:: pyqtgraph.ButtonItem :members: .. automethod:: pyqtgraph.ButtonItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/colorbaritem.rst000066400000000000000000000002041457240071200305030ustar00rootroot00000000000000ColorBarItem ============ .. autoclass:: pyqtgraph.ColorBarItem :members: .. automethod:: pyqtgraph.ColorBarItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/curvearrow.rst000066400000000000000000000001741457240071200302260ustar00rootroot00000000000000CurveArrow ========== .. autoclass:: pyqtgraph.CurveArrow :members: .. automethod:: pyqtgraph.CurveArrow.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/curvepoint.rst000066400000000000000000000001741457240071200302250ustar00rootroot00000000000000CurvePoint ========== .. autoclass:: pyqtgraph.CurvePoint :members: .. automethod:: pyqtgraph.CurvePoint.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/dateaxisitem.rst000066400000000000000000000002041457240071200305020ustar00rootroot00000000000000DateAxisItem ============ .. autoclass:: pyqtgraph.DateAxisItem :members: .. automethod:: pyqtgraph.DateAxisItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/errorbaritem.rst000066400000000000000000000002041457240071200305160ustar00rootroot00000000000000ErrorBarItem ============ .. autoclass:: pyqtgraph.ErrorBarItem :members: .. automethod:: pyqtgraph.ErrorBarItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/fillbetweenitem.rst000066400000000000000000000002201457240071200311760ustar00rootroot00000000000000FillBetweenItem =============== .. autoclass:: pyqtgraph.FillBetweenItem :members: .. automethod:: pyqtgraph.FillBetweenItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/gradienteditoritem.rst000066400000000000000000000004731457240071200317140ustar00rootroot00000000000000GradientEditorItem ================== .. autoclass:: pyqtgraph.GradientEditorItem :members: .. automethod:: pyqtgraph.GradientEditorItem.__init__ TickSliderItem ================== .. autoclass:: pyqtgraph.TickSliderItem :members: .. automethod:: pyqtgraph.TickSliderItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/gradientlegend.rst000066400000000000000000000002141457240071200307760ustar00rootroot00000000000000GradientLegend ============== .. autoclass:: pyqtgraph.GradientLegend :members: .. automethod:: pyqtgraph.GradientLegend.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/graphicsitem.rst000066400000000000000000000001171457240071200305030ustar00rootroot00000000000000GraphicsItem ============ .. autoclass:: pyqtgraph.GraphicsItem :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/graphicslayout.rst000066400000000000000000000002141457240071200310600ustar00rootroot00000000000000GraphicsLayout ============== .. autoclass:: pyqtgraph.GraphicsLayout :members: .. automethod:: pyqtgraph.GraphicsLayout.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/graphicsobject.rst000066400000000000000000000002141457240071200310110ustar00rootroot00000000000000GraphicsObject ============== .. autoclass:: pyqtgraph.GraphicsObject :members: .. automethod:: pyqtgraph.GraphicsObject.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/graphicswidget.rst000066400000000000000000000002141457240071200310260ustar00rootroot00000000000000GraphicsWidget ============== .. autoclass:: pyqtgraph.GraphicsWidget :members: .. automethod:: pyqtgraph.GraphicsWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/graphicswidgetanchor.rst000066400000000000000000000002441457240071200322240ustar00rootroot00000000000000GraphicsWidgetAnchor ==================== .. autoclass:: pyqtgraph.GraphicsWidgetAnchor :members: .. automethod:: pyqtgraph.GraphicsWidgetAnchor.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/graphitem.rst000066400000000000000000000001701457240071200300030ustar00rootroot00000000000000GraphItem ========= .. autoclass:: pyqtgraph.GraphItem :members: .. automethod:: pyqtgraph.GraphItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/griditem.rst000066400000000000000000000001641457240071200276320ustar00rootroot00000000000000GridItem ======== .. autoclass:: pyqtgraph.GridItem :members: .. automethod:: pyqtgraph.GridItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/histogramlutitem.rst000066400000000000000000000002241457240071200314240ustar00rootroot00000000000000HistogramLUTItem ================ .. autoclass:: pyqtgraph.HistogramLUTItem :members: .. automethod:: pyqtgraph.HistogramLUTItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/imageitem.rst000066400000000000000000000056351457240071200277770ustar00rootroot00000000000000ImageItem ========= :class:`~pyqtgraph.ImageItem` displays images inside a :class:`~pyqtgraph.GraphicsView`, or a :class:`~pyqtgraph.ViewBox`, which may itself be part of a :class:`~pyqtgraph.PlotItem`. It is designed for rapid updates as needed for a video display. The supplied data is optionally scaled (see :func:`~pyqtgraph.ImageItem.setLevels`) and/or colored according to a lookup table (see :func:`~pyqtgraph.ImageItem.setColorMap` and :func:`~pyqtgraph.ImageItem.setLookupTable`). Data is provided as a NumPy array with an ordering of either * `col-major`, where the shape of the array represents (width, height) or * `row-major`, where the shape of the array represents (height, width). While `col-major` is the default, `row-major` ordering typically has the best performance. In either ordering, a third dimension can be added to the array to hold individual ``[R,G,B]`` or ``[R,G,B,A]`` components. Notes ----- Data ordering can be set for each ImageItem, or in the :ref:`global configuration options ` by :: pyqtgraph.setConfigOption('imageAxisOrder', 'row-major') # best performance An image can be placed into a plot area of a given extent directly through the :func:`~pyqtgraph.ImageItem.setRect` method or the ``rect`` keyword. This is internally realized through assigning a ``QtGui.QTransform``. For other translation, scaling or rotations effects that persist for all later image data, the user can also directly define and assign such a transform, as shown in the example below. ImageItem is frequently used in conjunction with :class:`~pyqtgraph.ColorBarItem` to provide a color map display and interactive level adjustments, or with :class:`~pyqtgraph.HistogramLUTItem` or :class:`~pyqtgraph.HistogramLUTWidget` for a full GUI to control the levels and lookup table used to display the image. If performance is critial, the following points may be worth investigating: * Use row-major ordering and C-contiguous image data. * Manually provide ``level`` information to avoid autoLevels sampling of the image. * Prefer `float32` to `float64` for floating point data, avoid NaN values. * Use lookup tables with <= 256 entries for false color images. * Avoid individual level adjustments RGB components. * Use the latest version of NumPy. Notably, SIMD code added in version 1.20 significantly improved performance on Linux platforms. * Enable Numba with ``pyqtgraph.setConfigOption('useNumba', True)``, although the JIT compilation will only accelerate repeated image display. .. _ImageItem_examples: Examples -------- .. literalinclude:: /images/gen_example_imageitem_transform.py :lines: 19-28 :dedent: 8 .. thumbnail:: /images/example_imageitem_transform.png :width: 49% :alt: Example of transformed image display :title: Transformed Image Display .. autoclass:: pyqtgraph.ImageItem :members: .. automethod:: pyqtgraph.ImageItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/index.rst000066400000000000000000000021251457240071200271340ustar00rootroot00000000000000PyQtGraph's Graphics Items ========================== Since pyqtgraph relies on Qt's GraphicsView framework, most of its graphics functionality is implemented as QGraphicsItem subclasses. This has two important consequences: 1) virtually anything you want to draw can be easily accomplished using the functionality provided by Qt. 2) Many of pyqtgraph's GraphicsItem classes can be used in any normal QGraphicsScene. Contents: .. toctree:: :maxdepth: 2 plotdataitem plotitem imageitem colorbaritem pcolormeshitem graphitem viewbox linearregionitem infiniteline roi graphicslayout multiplotitem plotcurveitem scatterplotitem isocurveitem axisitem textitem errorbaritem bargraphitem arrowitem fillbetweenitem curvepoint curvearrow griditem scalebar labelitem vtickgroup legenditem gradienteditoritem histogramlutitem gradientlegend buttonitem graphicsobject graphicswidget graphicsitem uigraphicsitem graphicswidgetanchor dateaxisitem targetitem pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/infiniteline.rst000066400000000000000000000003561457240071200305060ustar00rootroot00000000000000InfiniteLine ============ .. autoclass:: pyqtgraph.InfiniteLine :members: .. automethod:: pyqtgraph.InfiniteLine.__init__ .. autoclass:: pyqtgraph.InfLineLabel :members: .. automethod:: pyqtgraph.InfLineLabel.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/isocurveitem.rst000066400000000000000000000002041457240071200305370ustar00rootroot00000000000000IsocurveItem ============ .. autoclass:: pyqtgraph.IsocurveItem :members: .. automethod:: pyqtgraph.IsocurveItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/labelitem.rst000066400000000000000000000001701457240071200277610ustar00rootroot00000000000000LabelItem ========= .. autoclass:: pyqtgraph.LabelItem :members: .. automethod:: pyqtgraph.LabelItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/legenditem.rst000066400000000000000000000001741457240071200301440ustar00rootroot00000000000000LegendItem ========== .. autoclass:: pyqtgraph.LegendItem :members: .. automethod:: pyqtgraph.LegendItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/linearregionitem.rst000066400000000000000000000002241457240071200313600ustar00rootroot00000000000000LinearRegionItem ================ .. autoclass:: pyqtgraph.LinearRegionItem :members: .. automethod:: pyqtgraph.LinearRegionItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/multiplotitem.rst000066400000000000000000000001221457240071200307300ustar00rootroot00000000000000MultiPlotItem ============= .. autoclass:: pyqtgraph.MultiPlotItem :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/pcolormeshitem.rst000066400000000000000000000002141457240071200310540ustar00rootroot00000000000000PColorMeshItem ============== .. autoclass:: pyqtgraph.PColorMeshItem :members: .. automethod:: pyqtgraph.PColorMeshItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/plotcurveitem.rst000066400000000000000000000002101457240071200307200ustar00rootroot00000000000000PlotCurveItem ============= .. autoclass:: pyqtgraph.PlotCurveItem :members: .. automethod:: pyqtgraph.PlotCurveItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/plotdataitem.rst000066400000000000000000000002041457240071200305100ustar00rootroot00000000000000PlotDataItem ============ .. autoclass:: pyqtgraph.PlotDataItem :members: .. automethod:: pyqtgraph.PlotDataItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/plotitem.rst000066400000000000000000000001721457240071200276620ustar00rootroot00000000000000PlotItem ======== .. autoclass:: pyqtgraph.PlotItem() :members: .. automethod:: pyqtgraph.PlotItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/roi.rst000066400000000000000000000006311457240071200266160ustar00rootroot00000000000000ROI === .. autoclass:: pyqtgraph.ROI :members: .. autoclass:: pyqtgraph.RectROI :members: .. autoclass:: pyqtgraph.EllipseROI :members: .. autoclass:: pyqtgraph.CircleROI :members: .. autoclass:: pyqtgraph.LineSegmentROI :members: .. autoclass:: pyqtgraph.PolyLineROI :members: .. autoclass:: pyqtgraph.LineROI :members: .. autoclass:: pyqtgraph.MultiRectROI :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/scalebar.rst000066400000000000000000000001641457240071200276020ustar00rootroot00000000000000ScaleBar ======== .. autoclass:: pyqtgraph.ScaleBar :members: .. automethod:: pyqtgraph.ScaleBar.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/scatterplotitem.rst000066400000000000000000000002201457240071200312420ustar00rootroot00000000000000ScatterPlotItem =============== .. autoclass:: pyqtgraph.ScatterPlotItem :members: .. automethod:: pyqtgraph.ScatterPlotItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/targetitem.rst000066400000000000000000000004221457240071200301700ustar00rootroot00000000000000TargetItem ========== .. autoclass:: pyqtgraph.TargetItem :members: .. automethod:: pyqtgraph.TargetItem.__init__ TargetLabel ================== .. autoclass:: pyqtgraph.TargetLabel :members: .. automethod:: pyqtgraph.TargetLabel.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/textitem.rst000066400000000000000000000001641457240071200276710ustar00rootroot00000000000000TextItem ======== .. autoclass:: pyqtgraph.TextItem :members: .. automethod:: pyqtgraph.TextItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/uigraphicsitem.rst000066400000000000000000000002141457240071200310370ustar00rootroot00000000000000UIGraphicsItem ============== .. autoclass:: pyqtgraph.UIGraphicsItem :members: .. automethod:: pyqtgraph.UIGraphicsItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/viewbox.rst000066400000000000000000000001601457240071200275050ustar00rootroot00000000000000ViewBox ======= .. autoclass:: pyqtgraph.ViewBox :members: .. automethod:: pyqtgraph.ViewBox.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsItems/vtickgroup.rst000066400000000000000000000001741457240071200302240ustar00rootroot00000000000000VTickGroup ========== .. autoclass:: pyqtgraph.VTickGroup :members: .. automethod:: pyqtgraph.VTickGroup.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsscene/000077500000000000000000000000001457240071200253075ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsscene/graphicsscene.rst000066400000000000000000000002101457240071200306500ustar00rootroot00000000000000GraphicsScene ============= .. autoclass:: pyqtgraph.GraphicsScene :members: .. automethod:: pyqtgraph.GraphicsScene.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsscene/hoverevent.rst000066400000000000000000000001431457240071200302240ustar00rootroot00000000000000HoverEvent ========== .. autoclass:: pyqtgraph.GraphicsScene.mouseEvents.HoverEvent :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsscene/index.rst000066400000000000000000000002611457240071200271470ustar00rootroot00000000000000GraphicsScene and Mouse Events ============================== Contents: .. toctree:: :maxdepth: 2 graphicsscene hoverevent mouseclickevent mousedragevent pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsscene/mouseclickevent.rst000066400000000000000000000001621457240071200312400ustar00rootroot00000000000000MouseClickEvent =============== .. autoclass:: pyqtgraph.GraphicsScene.mouseEvents.MouseClickEvent :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/graphicsscene/mousedragevent.rst000066400000000000000000000001571457240071200310740ustar00rootroot00000000000000MouseDragEvent ============== .. autoclass:: pyqtgraph.GraphicsScene.mouseEvents.MouseDragEvent :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/index.rst000066400000000000000000000005341457240071200243340ustar00rootroot00000000000000.. _pyqtgraph_api_ref: API Reference ============= Contents: .. toctree:: :maxdepth: 2 config_options functions graphicsItems/index widgets/index 3dgraphics/index colormap parametertree/index dockarea graphicsscene/index exporters/index flowchart/index point transform3d uml_overview pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/parametertree/000077500000000000000000000000001457240071200253315ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/parametertree/apiref.rst000066400000000000000000000004001457240071200273230ustar00rootroot00000000000000ParameterTree API Reference =========================== Also see the 'parametertree' example included with pyqtgraph Contents: .. toctree:: :maxdepth: 2 parameter parametertree parametertypes parameteritem interactiveparameters pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/parametertree/index.rst000066400000000000000000000030511457240071200271710ustar00rootroot00000000000000.. _parametertree: Parameter Trees =============== .. currentmodule:: pyqtgraph.parametertree Parameter trees are a system for handling hierarchies of parameters while automatically generating one or more GUIs to display and interact with the parameters. This feature is commonly seen, for example, in user interface design applications which display a list of editable properties for each widget. Parameters generally have a name, a data type (int, float, string, color, etc), and a value matching the data type. Parameters may be grouped and nested to form hierarchies and may be subclassed to provide custom behavior and display widgets. PyQtGraph's parameter tree system works similarly to the model-view architecture used by some components of Qt: - A :class:`Parameter` is a purely data-handling class that exists independent of any graphical interface. - A :class:`ParameterItem` is an interactive graphical representation of a :class:`Parameter`. - A :class:`ParameterTree` is a widget that automatically generates a graphical interface which represents the state of a hierarchy of Parameter objects and allows the user to edit the values within that hierarchy. This separation of data (model) and graphical interface (view) allows the same data to be represented multiple times and in a variety of different ways. For example, a floating point number parameter could be represented by a slider or a spinbox, or both. For more information, see the 'parametertree' example included with pyqtgraph and the API reference: .. toctree:: :maxdepth: 2 apiref pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/parametertree/interactiveparameters.rst000066400000000000000000000343661457240071200325000ustar00rootroot00000000000000Interactive Parameters ====================== As indicated by the documentation for Parameters and Parameter Trees, a Parameter is commonly used to expose a value to the user without burdening developers with GUI representations. The ``interact`` method and friends extend such support to arbitrary Python functions. [1]_ Before reading further, make sure to read existing Parameter documentation to become familiar with common extra options, creation techniques, and so on. Basic Use --------- Consider a function ``a`` whose arguments should be tweakable by the user to immediately update some result. *Without* using ``interact``, you might do something like this: .. code:: python from pyqtgraph.Qt import QtWidgets import pyqtgraph as pg from pyqtgraph.parametertree import Parameter, ParameterTree, parameterTypes as ptypes def a(x=5, y=6): QtWidgets.QMessageBox.information(None, 'Hello World', f'X is {x}, Y is {y}') # ----------- # discussion is from here: params = Parameter.create(name='"a" parameters', type='group', children=[ dict(name='x', type='int', value=5), dict(name='y', type='int', value=6) ]) def onChange(_param, _value): a(**params) for child in params.children(): child.sigValueChanged.connect(onChange) # to here # ----------- app = pg.mkQApp() tree = ParameterTree() tree.setParameters(params) tree.show() pg.exec() Notice in the ``-----`` comment block, lots of boilerplate and value duplication takes place. If an argument name changes, or the default value changes, the parameter definition must be independently updated as well. In (very common) cases like these, use ``interact`` instead (the code below is functionally equivalent to above): .. code:: python from pyqtgraph.Qt import QtWidgets import pyqtgraph as pg from pyqtgraph.parametertree import Parameter, ParameterTree, interact def a(x=5, y=6): QtWidgets.QMessageBox.information(None, 'Hello World', f'X is {x}, Y is {y}') # One line of code, no name/value duplication params = interact(a) app = pg.mkQApp() tree = ParameterTree() tree.setParameters(params) tree.show() pg.exec() There are several caveats, but this is one of the most common scenarios for function interaction. ``runOptions`` ^^^^^^^^^^^^^^ Often, an ``interact``-ed function shouldn't run until multiple parameter values are changed. Or, the function should be run every time a value is *changing*, not just changed. In these cases, modify the ``runOptions`` parameter. .. code:: python from pyqtgraph.parametertree import interact, RunOptions # Will add a button named "Run". When clicked, the function will run params = interact(a, runOptions=RunOptions.ON_ACTION) # Will run on any `sigValueChanging` signal params = interact(a, runOptions=RunOptions.ON_CHANGING) # Runs on `sigValueChanged` or when "Run" is pressed params = interact(a, runOptions=[RunOptions.ON_CHANGED, RunOptions.ON_ACTION]) # Any combination of RUN_* options can be used The default run behavior can also be modified. If several functions are being interacted at once, and all should be with a "Run" button, simply use the provided context manager: .. code:: python from pyqtgraph.parametertree import interact # `runOptions` can be set to any combination of options as demonstrated above, too with interact.optsContext(runOptions=RunOptions.ON_ACTION): # All will have `runOptions` set to ON_ACTION p1 = interact(aFunc) p2 = interact(bFunc) p3 = interact(cFunc) # After the context, `runOptions` is back to the previous default If the default for all interaction should be changed, you can directly call ``interactDefaults.setOpts`` (but be warned - anyone who imports your module will have it modified for them, too. So use the context manager whenever possible). Thus, it is *highly* advised to make your own ``Interactor`` object in these cases. The previous options set will be returned for easy resetting afterward: .. code:: python from pyqtgraph.parametertree import Interactor myInteractor = Interactor() oldOpts = myInteractor.setOpts(runOptions=RunOptions.ON_ACTION) # Can also directly create interactor with these opts: # myInteractor = Interactor(runOptions=RunOptions.ON_ACTION) # ... do some things... # Unset option myInteractor.setOpts(**oldOpts) ``ignores`` ^^^^^^^^^^^ When interacting with a function where some arguments should appear as parameters and others should be hidden, use ``ignores``: .. code:: python from pyqtgraph.parametertree import interact def a(x=5, y=6): print(x, y) # Only 'x' will show up in the parameter params = interact(a, ignores=['y']) ``closures`` ^^^^^^^^^^^^ Sometimes, values that should be passed to the ``interact``-ed function should come from a different scope (or "closure"), i.e. a variable definition that should be propagated from somewhere else. In these cases, wrap that argument in a function and pass it into ``closures`` like so. Note that an ``InteractiveFunction`` object is needed as descibed in a later section. .. code:: python from skimage import morphology as morph import numpy as np from pyqtgraph.parametertree import interact, InteractiveFunction, ParameterTree import pyqtgraph as pg def dilateImage(image, radius=3): image = morph.dilation(image, morph.disk(radius)) view.setImage(image) app = pg.mkQApp() view = pg.ImageView() # Simulate a grayscale image image = np.random.randint(0, 256, size=(512, 512)) dilate_interact = InteractiveFunction(dilateImage, closures={'image': lambda: image}) params = interact(dilate_interact) # As the 'image' variable changes, the new value will be used during parameter interaction view.show() tree = ParameterTree() tree.setParameters(params) tree.show() image = 255 - image # Even though 'image' is reassigned, it will be used by the parameter pg.exec() ``parent`` ^^^^^^^^^^ Often, one parameter tree is used to represent several different interactive functions. When this is the case, specify the existing parameter as the ``parent``. In all but simple cases, it is usually easier to leverage the `decorator version <#the-decorator-version>`__. .. code:: python from pyqtgraph.parametertree import Parameter def aFunc(x=5, y=6): QtWidgets.QMessageBox.information(None, 'Hello World', f'X is {x}, Y is {y}') def bFunc(first=5, second=6): QtWidgets.QMessageBox.information(None, 'Hello World', f'first is {first}, second is {second}') def cFunc(uno=5, dos=6): QtWidgets.QMessageBox.information(None, 'Hello World', f'uno is {uno}, dos is {dos}') params = Parameter.create(name='Parameters', type='group') # All interactions are in the same parent interact(aFunc, parent=params) interact(bFunc, parent=params) interact(cFunc, parent=params) ``nest`` ^^^^^^^^ In all examples so far, ``interact`` makes a ``GroupParameter`` which houses another ``GroupParameter`` inside. The inner group contains the parameter definitions for the function arguments. If these arguments should be directly inside the parent, use ``nest=False``: .. code:: python def a(x=5, y=6): return x + y # 'x' and 'y' will be returned in a list, not nested inside another GroupParameter # If `parent=...` was specified in the `interact` call, `x` and `y` will be inserted # directly as children of `parent` params = interact(a, nest=False) ``runActionTemplate`` ^^^^^^^^^^^^^^^^^^^^^ When the ``runOptions`` argument is set to (or contains) ``RunOptions.ON_ACTION``, a button will be added next to the parameter group which can be clicked to run the function with the current parameter values. The button's options can be customized through passing a dictionary to ``runActionTemplate``. The dictionary can contain any key accepted as an ``action`` parameter option. For instance, to run a function either by pressing the button or a shortcut, you can interact like so: .. code:: python def a(x=5, y=6): return x + y # The button will be labeled "Run" and will run the function when clicked or when # the shortcut "Ctrl+R" is pressed params = interact(a, runActionTemplate={'shortcut': 'Ctrl+R'}) # Alternatively, add an icon to the button params = interact(a, runActionTemplate={'icon': 'run.png'}) # Why not both? params = interact(a, runActionTemplate={'icon': 'run.png', 'shortcut': 'Ctrl+R'}) ``existOk`` ^^^^^^^^^^^ When ``nest=False``, there can be overlap when several function arguments share the same name. In these cases, the result is an error unless ``existOk=True`` (the default). .. code:: python def a(x=5, y=6): return x + y def b(x=5, another=6): return x + another params = interact(a, nest=False) # Will raise an error, since 'x' was already in the parameter from interacting with 'a' interact(b, nest=False, parent=params, existOk=False) ``overrides`` ^^^^^^^^^^^^^ In all examples so far, additional parameter arguments such as ``limits`` were ignored. Return to the `closures <#>`__ example and observe what happens when ``radius`` is < 0: :: ValueError: All-zero footprint is not supported. To prevent such cases, ``overrides`` can contain additional parameter specifications (or default values) that will update the created parameter: .. code:: python # Cannot go lower than 0 # These are bound to the 'radius' parameter params = interact(dilate_interact, radius={'limits': [1, None]}) Now, the user is unable to set the spinbox to a value < 1. Similar options can be provided when the parameter type doesn’t match the default value (``list`` is a common case): .. code:: python def chooseOne(which='a'): print(which) params = interact(chooseOne, which={'type': 'list', 'limits': list('abc')}) Any value accepted in ``Parameter.create`` can be used in the override for a parameter. Also note that overrides can consist of raw values, in the case where just the value should be adjusted or when there is no default: .. code:: python def printAString(string): print(string) params = interact(printAString, string='anything') Functions with ``**kwargs`` """"""""""""""""""""""""""" Functions who allow ``**kwargs`` can accept additional specified overrides even if they don't match argument names: .. code:: python def a(**canBeNamedAnything): print(canBeNamedAnything) # 'one' and 'two' will be int parameters that appear params = interact(a, one=1, two=2) If additional overrides are provided when the function *doesn't* accept keywords in this manner, they are ignored. The Decorator Version --------------------- To simplify the process of interacting with multiple functions using the same parameter, a decorator is provided: .. code:: python from pyqtgraph.parametertree import Interactor, interact params = Parameter.create(name='Parameters', type='group') interactor = Interactor(parent=params) # Same parent for all `interact` calls info = QtWidgets.QMessageBox.information @interactor.decorate() def aFunc(x=5, y=6): info(None, 'Hello World', f'X is {x}, Y is {y}') @interactor.decorate() def bFunc(first=5, second=6): info(None, 'Hello World', f'first is {first}, second is {second}') @interactor.decorate() def cFunc(uno=5, dos=6): info(None, 'Hello World', f'uno is {uno}, dos is {dos}') # Alternatively, the default interactor can be used if you don't need to # make your own `Interactor` instance. @interact.decorate(parent=params) def anotherFunc(one="one"): print(one) # All interactions are in the same parent Any value accepted by ``interact`` can be passed to the decorator. Title Formatting ---------------- If functions should have formatted titles, specify this in the ``titleFormat`` parameter: .. code:: python def my_snake_case_function(a=5): print(a) def titleFormat(name): return name.replace('_', ' ').title() # The title in the parameter tree will be "My Snake Case Function" params = interact(my_snake_case_function, titleFormat=titleFormat) Using ``InteractiveFunction`` ----------------------------- In all versions of ``interact`` described so far, it is not possible to temporarily stop an interacted function from triggering on parameter changes. Normally, one can ``disconnect`` the hooked-up signals, but since the actually connected functions are out of scope, this is not possible when using ``interact``. Additionally, it is not possible to change overrides or ``closures`` arguments after the fact. Finally, it is not possible to easily call an interacted function with parameter arguments/defaults through normal `interact` use. If any of these needs arise, use an ``InteractiveFunction`` instead during registration. This provides ``disconnect()`` and ``reconnect()`` methods, and object accessors to ``closures`` arguments. .. code:: python from pyqtgraph.parametertree import InteractiveFunction, interact, Parameter, RunOptions def myfunc(a=5): print(a) useFunc = InteractiveFunction(myfunc) param = interact(useFunc, runOptions=RunOptions.ON_CHANGED) param['a'] = 6 # Will print 6 useFunc.disconnect() param['a'] = 5 # Won't print anything useFunc.reconnect() param['a'] = 10 # Will print 10 Note that in cases like these, where simple wrapping of a function must take place, you can use ``InteractiveFunction`` like a decorator: .. code:: python from pyqtgraph.parametertree import InteractiveFunction, interact, Parameter, RunOptions @InteractiveFunction def myfunc(a=5): print(a) # myfunc is now an InteractiveFunction that can be used as above # Also, calling `myfunc` will preserve parameter arguments param = interact(myfunc, RunOptions.ON_ACTION) param['a'] = 6 myfunc() # will print '6' since this is the parameter value .. [1] Functions defined in C or whose definitions cannot be parsed by ``inspect.signature`` cannot be used here. However, in these cases a dummy function can be wrapped and passed instead. Note that all values are passed as keywords, so if positional arguments are expected it will not work. pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/parametertree/parameter.rst000066400000000000000000000004321457240071200300420ustar00rootroot00000000000000Parameter ========= .. autofunction:: pyqtgraph.parametertree.registerParameterType .. autofunction:: pyqtgraph.parametertree.registerParameterItemType .. autoclass:: pyqtgraph.parametertree.Parameter :members: .. automethod:: pyqtgraph.parametertree.Parameter.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/parametertree/parameteritem.rst000066400000000000000000000002441457240071200307220ustar00rootroot00000000000000ParameterItem ============= .. autoclass:: pyqtgraph.parametertree.ParameterItem :members: .. automethod:: pyqtgraph.parametertree.ParameterItem.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/parametertree/parametertree.rst000066400000000000000000000002441457240071200307230ustar00rootroot00000000000000ParameterTree ============= .. autoclass:: pyqtgraph.parametertree.ParameterTree :members: .. automethod:: pyqtgraph.parametertree.ParameterTree.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/parametertree/parametertypes.rst000066400000000000000000000034171457240071200311350ustar00rootroot00000000000000.. This file is auto-generated from pyqtgraph/tools/rebuildPtreeRst.py. Do not modify by hand! Instead, rerun the generation script with `python pyqtgraph/tools/rebuildPtreeRst.py`. Built-in Parameter Types ======================== .. currentmodule:: pyqtgraph.parametertree.parameterTypes Parameters ---------- .. autoclass:: ActionParameter :members: .. autoclass:: CalendarParameter :members: .. autoclass:: ChecklistParameter :members: .. autoclass:: ColorMapParameter :members: .. autoclass:: ColorParameter :members: .. autoclass:: FileParameter :members: .. autoclass:: FontParameter :members: .. autoclass:: GroupParameter :members: .. autoclass:: ListParameter :members: .. autoclass:: PenParameter :members: .. autoclass:: ProgressBarParameter :members: .. autoclass:: SimpleParameter :members: .. autoclass:: SliderParameter :members: .. autoclass:: TextParameter :members: ParameterItems -------------- .. autoclass:: ActionParameterItem :members: .. autoclass:: BoolParameterItem :members: .. autoclass:: CalendarParameterItem :members: .. autoclass:: ChecklistParameterItem :members: .. autoclass:: ColorMapParameterItem :members: .. autoclass:: ColorParameterItem :members: .. autoclass:: FileParameterItem :members: .. autoclass:: FontParameterItem :members: .. autoclass:: GroupParameterItem :members: .. autoclass:: ListParameterItem :members: .. autoclass:: NumericParameterItem :members: .. autoclass:: PenParameterItem :members: .. autoclass:: ProgressBarParameterItem :members: .. autoclass:: SliderParameterItem :members: .. autoclass:: StrParameterItem :members: .. autoclass:: TextParameterItem :members: .. autoclass:: WidgetParameterItem :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/point.rst000066400000000000000000000000731457240071200243540ustar00rootroot00000000000000Point ===== .. automodule:: pyqtgraph.Point :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/transform3d.rst000066400000000000000000000001151457240071200254620ustar00rootroot00000000000000Transform3D =========== .. automodule:: pyqtgraph.Transform3D :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/uml_overview.rst000066400000000000000000000020071457240071200257450ustar00rootroot00000000000000:html_theme.sidebar_secondary.remove: UML class diagram ================= .. _uml_diagram: The UML class diagram below gives an overview of the most important classes and their relations. The green boxes represent Qt classes, the purple boxes are PyQtGraph classes. The black arrows indicate inheritance between two classes (with the parent class always above the child classes.) The gray lines with the diamonds indicate an aggregation relation. For example the :class:`PlotDataItem ` class has a ``curve`` attribute that is a reference to a :class:`PlotCurveItem ` object. .. If it's stupid, and it works, it's not stupid .. Inlining SVG code, not using tags so nodes can act as links and be clicked .. raw:: html
      .. raw:: html :file: ../images/overview_uml-dark_mode.svg .. raw:: html
      .. raw:: html :file: ../images/overview_uml-light_mode.svg .. raw:: html
      .. end of not stupid stupidity pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/000077500000000000000000000000001457240071200241375ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/busycursor.rst000066400000000000000000000001741457240071200271130ustar00rootroot00000000000000BusyCursor ========== .. autoclass:: pyqtgraph.BusyCursor :members: .. automethod:: pyqtgraph.BusyCursor.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/checktable.rst000066400000000000000000000001741457240071200267600ustar00rootroot00000000000000CheckTable ========== .. autoclass:: pyqtgraph.CheckTable :members: .. automethod:: pyqtgraph.CheckTable.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/colorbutton.rst000066400000000000000000000002001457240071200272330ustar00rootroot00000000000000ColorButton =========== .. autoclass:: pyqtgraph.ColorButton :members: .. automethod:: pyqtgraph.ColorButton.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/colormapwidget.rst000066400000000000000000000005151457240071200277120ustar00rootroot00000000000000ColorMapWidget ============== .. autoclass:: pyqtgraph.ColorMapWidget :members: .. automethod:: pyqtgraph.ColorMapWidget.__init__ .. automethod:: pyqtgraph.ColorMapParameter.setFields .. automethod:: pyqtgraph.ColorMapParameter.map .. autoclass:: pyqtgraph.widgets.ColorMapWidget.ColorMapParameter :members: pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/combobox.rst000066400000000000000000000001641457240071200265020ustar00rootroot00000000000000ComboBox ======== .. autoclass:: pyqtgraph.ComboBox :members: .. automethod:: pyqtgraph.ComboBox.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/consolewidget.rst000066400000000000000000000002341457240071200275360ustar00rootroot00000000000000ConsoleWidget ============= .. autoclass:: pyqtgraph.console.ConsoleWidget :members: .. automethod:: pyqtgraph.console.ConsoleWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/datatreewidget.rst000066400000000000000000000002141457240071200276630ustar00rootroot00000000000000DataTreeWidget ============== .. autoclass:: pyqtgraph.DataTreeWidget :members: .. automethod:: pyqtgraph.DataTreeWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/feedbackbutton.rst000066400000000000000000000002141457240071200276460ustar00rootroot00000000000000FeedbackButton ============== .. autoclass:: pyqtgraph.FeedbackButton :members: .. automethod:: pyqtgraph.FeedbackButton.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/filedialog.rst000066400000000000000000000001741457240071200267720ustar00rootroot00000000000000FileDialog ========== .. autoclass:: pyqtgraph.FileDialog :members: .. automethod:: pyqtgraph.FileDialog.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/gradientwidget.rst000066400000000000000000000002141457240071200276670ustar00rootroot00000000000000GradientWidget ============== .. autoclass:: pyqtgraph.GradientWidget :members: .. automethod:: pyqtgraph.GradientWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/graphicslayoutwidget.rst000066400000000000000000000002441457240071200311330ustar00rootroot00000000000000GraphicsLayoutWidget ==================== .. autoclass:: pyqtgraph.GraphicsLayoutWidget :members: .. automethod:: pyqtgraph.GraphicsLayoutWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/graphicsview.rst000066400000000000000000000002041457240071200273600ustar00rootroot00000000000000GraphicsView ============ .. autoclass:: pyqtgraph.GraphicsView :members: .. automethod:: pyqtgraph.GraphicsView.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/histogramlutwidget.rst000066400000000000000000000002341457240071200306160ustar00rootroot00000000000000HistogramLUTWidget ================== .. autoclass:: pyqtgraph.HistogramLUTWidget :members: .. automethod:: pyqtgraph.HistogramLUTWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/imageview.rst000066400000000000000000000001701457240071200266440ustar00rootroot00000000000000ImageView ========= .. autoclass:: pyqtgraph.ImageView :members: .. automethod:: pyqtgraph.ImageView.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/index.rst000066400000000000000000000015331457240071200260020ustar00rootroot00000000000000.. _api_widgets: PyQtGraph's Widgets =================== PyQtGraph provides several QWidget subclasses which are useful for building user interfaces. These widgets can generally be used in any Qt application and provide functionality that is frequently useful in science and engineering applications. Contents: .. toctree:: :maxdepth: 2 plotwidget imageview spinbox gradientwidget histogramlutwidget consolewidget colormapwidget scatterplotwidget graphicsview datatreewidget tablewidget treewidget checktable colorbutton graphicslayoutwidget progressdialog filedialog joystickbutton multiplotwidget verticallabel remotegraphicsview matplotlibwidget feedbackbutton combobox layoutwidget pathbutton valuelabel busycursor rawimagewidget pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/joystickbutton.rst000066400000000000000000000002141457240071200277610ustar00rootroot00000000000000JoystickButton ============== .. autoclass:: pyqtgraph.JoystickButton :members: .. automethod:: pyqtgraph.JoystickButton.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/layoutwidget.rst000066400000000000000000000002041457240071200274060ustar00rootroot00000000000000LayoutWidget ============ .. autoclass:: pyqtgraph.LayoutWidget :members: .. automethod:: pyqtgraph.LayoutWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/matplotlibwidget.rst000066400000000000000000000003061457240071200302430ustar00rootroot00000000000000MatplotlibWidget ================ .. autoclass:: pyqtgraph.widgets.MatplotlibWidget.MatplotlibWidget :members: .. automethod:: pyqtgraph.widgets.MatplotlibWidget.MatplotlibWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/multiplotwidget.rst000066400000000000000000000002201457240071200301200ustar00rootroot00000000000000MultiPlotWidget =============== .. autoclass:: pyqtgraph.MultiPlotWidget :members: .. automethod:: pyqtgraph.MultiPlotWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/pathbutton.rst000066400000000000000000000001741457240071200270630ustar00rootroot00000000000000PathButton ========== .. autoclass:: pyqtgraph.PathButton :members: .. automethod:: pyqtgraph.PathButton.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/plotwidget.rst000066400000000000000000000001741457240071200270550ustar00rootroot00000000000000PlotWidget ========== .. autoclass:: pyqtgraph.PlotWidget :members: .. automethod:: pyqtgraph.PlotWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/progressdialog.rst000066400000000000000000000002141457240071200277120ustar00rootroot00000000000000ProgressDialog ============== .. autoclass:: pyqtgraph.ProgressDialog :members: .. automethod:: pyqtgraph.ProgressDialog.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/rawimagewidget.rst000066400000000000000000000003611457240071200276710ustar00rootroot00000000000000RawImageWidget ============== .. autoclass:: pyqtgraph.RawImageWidget :members: .. automethod:: pyqtgraph.widgets.RawImageWidget.RawImageWidget.__init__ .. automethod:: pyqtgraph.widgets.RawImageWidget.RawImageWidget.setImage pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/remotegraphicsview.rst000066400000000000000000000003221457240071200305750ustar00rootroot00000000000000RemoteGraphicsView ================== .. autoclass:: pyqtgraph.widgets.RemoteGraphicsView.RemoteGraphicsView :members: .. automethod:: pyqtgraph.widgets.RemoteGraphicsView.RemoteGraphicsView.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/scatterplotwidget.rst000066400000000000000000000002301457240071200304340ustar00rootroot00000000000000ScatterPlotWidget ================= .. autoclass:: pyqtgraph.ScatterPlotWidget :members: .. automethod:: pyqtgraph.ScatterPlotWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/spinbox.rst000066400000000000000000000001601457240071200263500ustar00rootroot00000000000000SpinBox ======= .. autoclass:: pyqtgraph.SpinBox :members: .. automethod:: pyqtgraph.SpinBox.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/tablewidget.rst000066400000000000000000000002001457240071200271540ustar00rootroot00000000000000TableWidget =========== .. autoclass:: pyqtgraph.TableWidget :members: .. automethod:: pyqtgraph.TableWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/treewidget.rst000066400000000000000000000001741457240071200270360ustar00rootroot00000000000000TreeWidget ========== .. autoclass:: pyqtgraph.TreeWidget :members: .. automethod:: pyqtgraph.TreeWidget.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/valuelabel.rst000066400000000000000000000001741457240071200270070ustar00rootroot00000000000000ValueLabel ========== .. autoclass:: pyqtgraph.ValueLabel :members: .. automethod:: pyqtgraph.ValueLabel.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/api_reference/widgets/verticallabel.rst000066400000000000000000000002101457240071200274730ustar00rootroot00000000000000VerticalLabel ============= .. autoclass:: pyqtgraph.VerticalLabel :members: .. automethod:: pyqtgraph.VerticalLabel.__init__ pyqtgraph-pyqtgraph-0.13.4/doc/source/conf.py000066400000000000000000000447151457240071200212140ustar00rootroot00000000000000# # pyqtgraph documentation build configuration file, created by # sphinx-quickstart on Fri Nov 18 19:33:12 2011. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os import sys import time from datetime import datetime from sphinx.application import Sphinx # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. path = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.join(path, '..', '..')) sys.path.insert(0, os.path.join(path, '..', 'extensions')) import pyqtgraph # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ "sphinx.ext.autodoc", "sphinx.ext.viewcode", "sphinx.ext.napoleon", "sphinx.ext.intersphinx", "sphinx_qt_documentation", "sphinx_design", "sphinx_favicon", "sphinxext.rediraffe", "sphinxcontrib.images", "sphinx_autodoc_typehints" ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # Set Qt Documentation Variable qt_documentation = "Qt6" intersphinx_mapping = { 'python': ('https://docs.python.org/3', None), 'numpy': ('https://numpy.org/doc/stable/', None) } nitpick_ignore_regex = [ ("py:class", r"re\.Pattern"), # doesn't seem to be a good ref in python docs ] napoleon_preprocess_types = True napoleon_type_aliases = { "callable": ":class:`collections.abc.Callable`", "np.ndarray": ":class:`numpy.ndarray`", 'array_like': ':term:`array_like`', 'color_like': ':func:`pyqtgraph.mkColor`' } # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = 'pyqtgraph' now = datetime.utcfromtimestamp( int(os.environ.get('SOURCE_DATE_EPOCH', time.time())) ) copyright = '2011 - {}, PyQtGraph developers'.format(now.year) # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = pyqtgraph.__version__ # The full version, including alpha/beta/rc tags. release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] autodoc_inherit_docstrings = False autodoc_mock_imports = [ "scipy", "h5py", "matplotlib", ] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'pydata_sphinx_theme' # favicons favicons = [ "peegee_03_square_no_bg_32_cleaned.png", "peegee_04_square_no_bg_180_cleaned.png", "peegee_03_square_no_bg_32_cleaned.ico" ] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. html_theme_options = { "github_url": "https://github.com/pyqtgraph/pyqtgraph", "navbar_end": ["theme-switcher", "navbar-icon-links"], "twitter_url": "https://twitter.com/pyqtgraph", "use_edit_page_button": False, "secondary_sidebar_items": ["page-toc"], "navigation_with_keys": False } if os.getenv("BUILD_DASH_DOCSET"): html_theme_options |= { 'secondary_sidebar_items': [], "show_prev_next": False, "collapse_navigation": True, } # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. html_logo = os.path.join("images", "peegee_02.svg") # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = "_static/peegee_03_square_no_bg_32_cleaned.ico" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # add the theme customizations html_css_files = [ "custom.css", ] if os.getenv("BUILD_DASH_DOCSET"): html_css_files.append("dash.css") # Redirects for pages that were moved to new locations rediraffe_redirects = { "3dgraphics/glaxisitem.rst": "api_reference/3dgraphics/glaxisitem.rst", "3dgraphics/glgraphicsitem.rst": "api_reference/3dgraphics/glgraphicsitem.rst", "3dgraphics/glgraphitem.rst": "api_reference/3dgraphics/glgraphitem.rst", "3dgraphics/glgriditem.rst": "api_reference/3dgraphics/glgriditem.rst", "3dgraphics/glimageitem.rst": "api_reference/3dgraphics/glimageitem.rst", "3dgraphics/gllineplotitem.rst": "api_reference/3dgraphics/gllineplotitem.rst", "3dgraphics/glmeshitem.rst": "api_reference/3dgraphics/glmeshitem.rst", "3dgraphics/glscatterplotitem.rst": "api_reference/3dgraphics/glscatterplotitem.rst", "3dgraphics/glsurfaceplotitem.rst": "api_reference/3dgraphics/glsurfaceplotitem.rst", "3dgraphics/gltextitem.rst": "api_reference/3dgraphics/gltextitem.rst", "3dgraphics/glviewwidget.rst": "api_reference/3dgraphics/glviewwidget.rst", "3dgraphics/glvolumeitem.rst": "api_reference/3dgraphics/glvolumeitem.rst", "3dgraphics/index.rst": "api_reference/3dgraphics/index.rst", "3dgraphics/meshdata.rst": "api_reference/3dgraphics/meshdata.rst", "colormap.rst": "api_reference/colormap.rst", "config_options.rst": "api_reference/config_options.rst", "dockarea.rst": "api_reference/dockarea.rst", "flowchart/flowchart.rst": "api_reference/flowchart/flowchart.rst", "flowchart/index.rst": "api_reference/flowchart/index.rst", "flowchart/node.rst": "api_reference/flowchart/node.rst", "flowchart/terminal.rst": "api_reference/flowchart/terminal.rst", "functions.rst": "api_reference/functions.rst", "graphicsItems/arrowitem.rst": "api_reference/graphicsItems/arrowitem.rst", "graphicsItems/axisitem.rst": "api_reference/graphicsItems/axisitem.rst", "graphicsItems/bargraphitem.rst": "api_reference/graphicsItems/bargraphitem.rst", "graphicsItems/buttonitem.rst": "api_reference/graphicsItems/buttonitem.rst", "graphicsItems/colorbaritem.rst": "api_reference/graphicsItems/colorbaritem.rst", "graphicsItems/curvearrow.rst": "api_reference/graphicsItems/curvearrow.rst", "graphicsItems/curvepoint.rst": "api_reference/graphicsItems/curvepoint.rst", "graphicsItems/dateaxisitem.rst": "api_reference/graphicsItems/dateaxisitem.rst", "graphicsItems/errorbaritem.rst": "api_reference/graphicsItems/errorbaritem.rst", "graphicsItems/fillbetweenitem.rst": "api_reference/graphicsItems/fillbetweenitem.rst", "graphicsItems/gradienteditoritem.rst": "api_reference/graphicsItems/gradienteditoritem.rst", "graphicsItems/gradientlegend.rst": "api_reference/graphicsItems/gradientlegend.rst", "graphicsItems/graphicsitem.rst": "api_reference/graphicsItems/graphicsitem.rst", "graphicsItems/graphicslayout.rst": "api_reference/graphicsItems/graphicslayout.rst", "graphicsItems/graphicsobject.rst": "api_reference/graphicsItems/graphicsobject.rst", "graphicsItems/graphicswidget.rst": "api_reference/graphicsItems/graphicswidget.rst", "graphicsItems/graphicswidgetanchor.rst": "api_reference/graphicsItems/graphicswidgetanchor.rst", "graphicsItems/graphitem.rst": "api_reference/graphicsItems/graphitem.rst", "graphicsItems/griditem.rst": "api_reference/graphicsItems/griditem.rst", "graphicsItems/histogramlutitem.rst": "api_reference/graphicsItems/histogramlutitem.rst", "graphicsItems/imageitem.rst": "api_reference/graphicsItems/imageitem.rst", "graphicsItems/index.rst": "api_reference/graphicsItems/index.rst", "graphicsItems/infiniteline.rst": "api_reference/graphicsItems/infiniteline.rst", "graphicsItems/isocurveitem.rst": "api_reference/graphicsItems/isocurveitem.rst", "graphicsItems/labelitem.rst": "api_reference/graphicsItems/labelitem.rst", "graphicsItems/legenditem.rst": "api_reference/graphicsItems/legenditem.rst", "graphicsItems/linearregionitem.rst": "api_reference/graphicsItems/linearregionitem.rst", "graphicsItems/multiplotitem.rst": "api_reference/graphicsItems/multiplotitem.rst", "graphicsItems/pcolormeshitem.rst": "api_reference/graphicsItems/pcolormeshitem.rst", "graphicsItems/plotcurveitem.rst": "api_reference/graphicsItems/plotcurveitem.rst", "graphicsItems/plotdataitem.rst": "api_reference/graphicsItems/plotdataitem.rst", "graphicsItems/plotitem.rst": "api_reference/graphicsItems/plotitem.rst", "graphicsItems/roi.rst": "api_reference/graphicsItems/roi.rst", "graphicsItems/scalebar.rst": "api_reference/graphicsItems/scalebar.rst", "graphicsItems/scatterplotitem.rst": "api_reference/graphicsItems/scatterplotitem.rst", "graphicsItems/targetitem.rst": "api_reference/graphicsItems/targetitem.rst", "graphicsItems/textitem.rst": "api_reference/graphicsItems/textitem.rst", "graphicsItems/uigraphicsitem.rst": "api_reference/graphicsItems/uigraphicsitem.rst", "graphicsItems/viewbox.rst": "api_reference/graphicsItems/viewbox.rst", "graphicsItems/vtickgroup.rst": "api_reference/graphicsItems/vtickgroup.rst", "graphicsscene/graphicsscene.rst": "api_reference/graphicsscene/graphicsscene.rst", "graphicsscene/hoverevent.rst": "api_reference/graphicsscene/hoverevent.rst", "graphicsscene/index.rst": "api_reference/graphicsscene/index.rst", "graphicsscene/mouseclickevent.rst": "api_reference/graphicsscene/mouseclickevent.rst", "graphicsscene/mousedragevent.rst": "api_reference/graphicsscene/mousedragevent.rst", "apireference.rst": "api_reference/index.rst", "parametertree/apiref.rst": "api_reference/parametertree/apiref.rst", "parametertree/index.rst": "api_reference/parametertree/index.rst", "parametertree/interactiveparameters.rst": "api_reference/parametertree/interactiveparameters.rst", "parametertree/parameter.rst": "api_reference/parametertree/parameter.rst", "parametertree/parameteritem.rst": "api_reference/parametertree/parameteritem.rst", "parametertree/parametertree.rst": "api_reference/parametertree/parametertree.rst", "parametertree/parametertypes.rst": "api_reference/parametertree/parametertypes.rst", "point.rst": "api_reference/point.rst", "transform3d.rst": "api_reference/transform3d.rst", "uml_overview.rst": "api_reference/uml_overview.rst", "widgets/busycursor.rst": "api_reference/widgets/busycursor.rst", "widgets/checktable.rst": "api_reference/widgets/checktable.rst", "widgets/colorbutton.rst": "api_reference/widgets/colorbutton.rst", "widgets/colormapwidget.rst": "api_reference/widgets/colormapwidget.rst", "widgets/combobox.rst": "api_reference/widgets/combobox.rst", "widgets/consolewidget.rst": "api_reference/widgets/consolewidget.rst", "widgets/datatreewidget.rst": "api_reference/widgets/datatreewidget.rst", "widgets/feedbackbutton.rst": "api_reference/widgets/feedbackbutton.rst", "widgets/filedialog.rst": "api_reference/widgets/filedialog.rst", "widgets/gradientwidget.rst": "api_reference/widgets/gradientwidget.rst", "widgets/graphicslayoutwidget.rst": "api_reference/widgets/graphicslayoutwidget.rst", "widgets/graphicsview.rst": "api_reference/widgets/graphicsview.rst", "widgets/histogramlutwidget.rst": "api_reference/widgets/histogramlutwidget.rst", "widgets/imageview.rst": "api_reference/widgets/imageview.rst", "widgets/index.rst": "api_reference/widgets/index.rst", "widgets/joystickbutton.rst": "api_reference/widgets/joystickbutton.rst", "widgets/layoutwidget.rst": "api_reference/widgets/layoutwidget.rst", "widgets/matplotlibwidget.rst": "api_reference/widgets/matplotlibwidget.rst", "widgets/multiplotwidget.rst": "api_reference/widgets/multiplotwidget.rst", "widgets/pathbutton.rst": "api_reference/widgets/pathbutton.rst", "widgets/plotwidget.rst": "api_reference/widgets/plotwidget.rst", "widgets/progressdialog.rst": "api_reference/widgets/progressdialog.rst", "widgets/rawimagewidget.rst": "api_reference/widgets/rawimagewidget.rst", "widgets/remotegraphicsview.rst": "api_reference/widgets/remotegraphicsview.rst", "widgets/scatterplotwidget.rst": "api_reference/widgets/scatterplotwidget.rst", "widgets/spinbox.rst": "api_reference/widgets/spinbox.rst", "widgets/tablewidget.rst": "api_reference/widgets/tablewidget.rst", "widgets/treewidget.rst": "api_reference/widgets/treewidget.rst", "widgets/valuelabel.rst": "api_reference/widgets/valuelabel.rst", "widgets/verticallabel.rst": "api_reference/widgets/verticallabel.rst", "internals.rst": "developer_guide/internals.rst", "3dgraphics.rst": "getting_started/3dgraphics.rst", "how_to_use.rst": "getting_started/how_to_use.rst", "images.rst": "getting_started/images.rst", "installation.rst": "getting_started/installation.rst", "introduction.rst": "getting_started/introduction.rst", "plotting.rst": "getting_started/plotting.rst", "prototyping.rst": "getting_started/prototyping.rst", "qtcrashcourse.rst": "getting_started/qtcrashcourse.rst", "exporting.rst": "user_guide/exporting.rst", "mouse_interaction.rst": "user_guide/mouse_interaction.rst", "region_of_interest.rst": "user_guide/region_of_interest.rst", "style.rst": "user_guide/style.rst" } # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. if os.getenv("BUILD_DASH_DOCSET"): # used for building dash docsets html_sidebars = { "**": [] } else: html_sidebars = { "**": ["sidebar-nav-bs.html"], 'index': [] # don't show sidebar on main landing page } # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. html_show_sourcelink = False # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'pyqtgraphdoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'pyqtgraph.tex', 'pyqtgraph Documentation', 'Luke Campagnola', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'pyqtgraph', 'pyqtgraph Documentation', ['Luke Campagnola'], 1) ] def html_page_context(app, pagename, templatename, context, doctree): # Disable edit button for docstring generated pages if "generated" in pagename: context["theme_use_edit_page_button"] = False def setup(app: Sphinx): app.connect("html-page-context", html_page_context) pyqtgraph-pyqtgraph-0.13.4/doc/source/developer_guide/000077500000000000000000000000001457240071200230445ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/developer_guide/index.rst000066400000000000000000000003541457240071200247070ustar00rootroot00000000000000.. _developer_guide_ref: Developer Guide =============== The PyQtGraph library welcomes contributions from the community. This guide is intended to help you get started with contributing to the project. .. toctree:: internals pyqtgraph-pyqtgraph-0.13.4/doc/source/developer_guide/internals.rst000066400000000000000000000002631457240071200255760ustar00rootroot00000000000000Internals - Extensions to Qt's GraphicsView =========================================== * GraphicsView * GraphicsScene (mouse events) * GraphicsObject * GraphicsWidget * ViewBox pyqtgraph-pyqtgraph-0.13.4/doc/source/getting_started/000077500000000000000000000000001457240071200230715ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/getting_started/3dgraphics.rst000066400000000000000000000025331457240071200256550ustar00rootroot000000000000003D Graphics =========== PyQtGraph uses OpenGL to provide a 3D scenegraph system. This system is functional but still early in development. Current capabilities include: * 3D view widget with zoom/rotate controls (mouse drag and wheel) * Scenegraph allowing items to be added/removed from scene with per-item transformations and parent/child relationships. * Triangular meshes * Basic mesh computation functions: isosurfaces, per-vertex normals * Volumetric rendering item * Grid/axis items See the :doc:`API Reference <../api_reference/3dgraphics/index>` and the Volumetric (GLVolumeItem.py) and Isosurface (GLMeshItem.py) examples for more information. Basic usage example:: ## build a QApplication before building other widgets import pyqtgraph as pg pg.mkQApp() ## make a widget for displaying 3D objects import pyqtgraph.opengl as gl view = gl.GLViewWidget() view.show() ## create three grids, add each to the view xgrid = gl.GLGridItem() ygrid = gl.GLGridItem() zgrid = gl.GLGridItem() view.addItem(xgrid) view.addItem(ygrid) view.addItem(zgrid) ## rotate x and y grids to face the correct direction xgrid.rotate(90, 0, 1, 0) ygrid.rotate(90, 1, 0, 0) ## scale each grid differently xgrid.scale(0.2, 0.1, 0.1) ygrid.scale(0.2, 0.1, 0.1) zgrid.scale(0.1, 0.2, 0.1) pyqtgraph-pyqtgraph-0.13.4/doc/source/getting_started/how_to_use.rst000066400000000000000000000223411457240071200260000ustar00rootroot00000000000000How to use pyqtgraph ==================== There are a few suggested ways to use pyqtgraph: * From the interactive shell (python -i, ipython, etc) * Displaying pop-up windows from an application * Embedding widgets in a PyQt application Command-line use ---------------- PyQtGraph makes it very easy to visualize data from the command line. Observe:: import pyqtgraph as pg pg.plot(data) # data can be a list of values or a numpy array The example above would open a window displaying a line plot of the data given. The call to :func:`pg.plot ` returns a handle to the :class:`plot widget ` that is created, allowing more data to be added to the same window. **Note:** interactive plotting from the python prompt is only available with PyQt; PySide does not run the Qt event loop while the interactive prompt is running. If you wish to use pyqtgraph interactively with PySide, see the 'console' :ref:`example `. Further examples:: pw = pg.plot(xVals, yVals, pen='r') # plot x vs y in red pw.plot(xVals, yVals2, pen='b') win = pg.GraphicsLayoutWidget() # Automatically generates grids with multiple items win.addPlot(data1, row=0, col=0) win.addPlot(data2, row=0, col=1) win.addPlot(data3, row=1, col=0, colspan=2) pg.show(imageData) # imageData must be a numpy array with 2 to 4 dimensions We're only scratching the surface here--these functions accept many different data formats and options for customizing the appearance of your data. Displaying windows from within an application --------------------------------------------- While I consider this approach somewhat lazy, it is often the case that 'lazy' is indistinguishable from 'highly efficient'. The approach here is simply to use the very same functions that would be used on the command line, but from within an existing application. I often use this when I simply want to get a immediate feedback about the state of data in my application without taking the time to build a user interface for it. Embedding widgets inside PyQt applications ------------------------------------------ For the serious application developer, all of the functionality in pyqtgraph is available via :ref:`widgets ` that can be embedded just like any other Qt widgets. Most importantly, see: :class:`PlotWidget `, :class:`ImageView `, :class:`GraphicsLayoutWidget `, and :class:`GraphicsView `. PyQtGraph's widgets can be included in Designer's ui files via the "Promote To..." functionality: #. In Designer, create a QGraphicsView widget ("Graphics View" under the "Display Widgets" category). #. Right-click on the QGraphicsView and select "Promote To...". #. Under "Promoted class name", enter the class name you wish to use ("PlotWidget", "GraphicsLayoutWidget", etc). #. Under "Header file", enter "pyqtgraph". #. Click "Add", then click "Promote". See the designer documentation for more information on promoting widgets. The "VideoSpeedTest" and "ScatterPlotSpeedTest" examples both demonstrate the use of .ui files that are compiled to .py modules using pyuic5 or pyside-uic. The "designerExample" example demonstrates dynamically generating python classes from .ui files (no pyuic5 / pyside-uic needed). HiDPI Displays -------------- PyQtGraph has a method :func:`mkQApp ` that by default sets what we have tested to be the best combination of options to support hidpi displays, when in combination with non-hidpi secondary displays. For your application, you may have instantiated ``QApplication`` yourself, in which case we advise setting these options *before* runing ``QApplication.exec_()``. For Qt6 bindings, this functionally "just works" without having to set any attributes. On Versions of Qt >= 5.14 and < 6; you can get ideal behavior with the following lines:: os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "1" QApplication.setHighDpiScaleFactorRoundingPolicy(QtCore.Qt.HighDpiScaleFactorRoundingPolicy.PassThrough) If you are on Qt >= 5.6 and < 5.14; you can get near ideal behavior with the following lines:: QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps) With the later, ideal behavior was not achieved. .. autofunction:: pyqtgraph.Qt.mkQApp PyQt and PySide --------------- PyQtGraph supports two popular python wrappers for the Qt library: PyQt and PySide. Both packages provide nearly identical APIs and functionality, but for various reasons (discussed elsewhere) you may prefer to use one package or the other. When pyqtgraph is first imported, if the environment variable ``PYQTGRAPH_QT_LIB`` is not set, it automatically determines which library to use by making the following checks: #. If PyQt6 is already imported, use that #. Else, if PySide6 is already imported, use that #. Else, if PyQt5 is already imported, use that #. Else, if PySide2 is already imported, use that #. Else, attempt to import PyQt6, PySide6, PyQt5, PySide2, in that order. If you have both libraries installed on your system and you wish to force pyqtgraph to use one or the other, simply make sure it is imported before pyqtgraph:: import PySide2 ## this will force pyqtgraph to use PySide2 instead of PyQt6 import pyqtgraph as pg Embedding PyQtGraph as a sub-package of a larger project -------------------------------------------------------- When writing applications or python packages that make use of pyqtgraph, it is most common to install pyqtgraph system-wide (or within a virtualenv) and simply call `import pyqtgraph` from within your application. The main benefit to this is that pyqtgraph is configured independently of your application and thus you (or your users) are free to install newer versions of pyqtgraph without changing anything in your application. This is standard practice when developing with python. Occasionally, a specific program needs to be kept in working order for an extended amount of time after development has been completed. This is often the case for single-purpose scientific applications. If we want to ensure that the software will still work ten years later, then it is preferable to tie it to a very specific version of pyqtgraph and *avoid* importing the system-installed version, which may be much newer and potentially incompatible. This is especially true when the application requires site-specific modifications to the pyqtgraph package. To support such a separate local installation, all internal import statements in pyqtgraph are relative. That means that pyqtgraph never refers to itself internally as 'pyqtgraph'. This allows the package to be renamed or used as a sub-package without any naming conflicts with other versions of pyqtgraph on the system. The basic approach is to clone the repository into the appropriate location in your project. When you import pyqtgraph, be sure to use the full name to avoid importing any system-installed pyqtgraph packages. For example, imagine a simple project has the following structure:: my_project/ __init__.py plotting.py """Plotting functions used by this package""" import pyqtgraph as pg def my_plot_function(*data): pg.plot(*data) To embed a specific version of pyqtgraph, we would clone the pyqtgraph repository inside the project, with a directory name that distinguishes it from a system-wide installation:: my_project$ git clone https://github.com/pyqtgraph/pyqtgraph.git local_pyqtgraph Then adjust the import statements accordingly:: my_project/ __init__.py local_pyqtgraph/ plotting.py """Plotting functions used by this package""" import local_pyqtgraph.pyqtgraph as pg # be sure to use the local subpackage # rather than any globally-installed # version. def my_plot_function(*data): pg.plot(*data) Use ``git checkout pyqtgraph-x.x.x`` to select a specific library version from the repository, or use ``git pull`` to pull pyqtgraph updates from upstream (see the git documentation for more information). If you do not plan to make use of git's versioning features, adding the option ``--depth 1`` to the ``git clone`` command retrieves only the latest version. For projects that already use git for code control, it is also possible to include pyqtgraph as a git subtree within your own repository. The major advantage to this approach is that, in addition to being able to pull pyqtgraph updates from the upstream repository, it is also possible to commit your local pyqtgraph changes into the project repository and push those changes upstream:: my_project$ git remote add pyqtgraph https://github.com/pyqtgraph/pyqtgraph.git my_project$ git fetch pyqtgraph my_project$ git merge -s ours --allow-unrelated-histories --no-commit pyqtgraph/master my_project$ mkdir local_pyqtgraph my_project$ git read-tree -u --prefix=local_pyqtgraph/ pyqtgraph/master my_project$ git commit -m "Added pyqtgraph to project repository" See the ``git subtree`` documentation for more information. pyqtgraph-pyqtgraph-0.13.4/doc/source/getting_started/images.rst000066400000000000000000000035721457240071200250770ustar00rootroot00000000000000Displaying images and video =========================== PyQtGraph displays 2D numpy arrays as images and provides tools for determining how to translate between the numpy data type and RGB values on the screen. If you want to display data from common image and video file formats, you will need to load the data first using another library (PIL works well for images and built-in numpy conversion). The easiest way to display 2D or 3D data is using the :func:`pyqtgraph.image` function:: import pyqtgraph as pg pg.image(imageData) This function will accept any floating-point or integer data types and displays a single :class:`~pyqtgraph.ImageView` widget containing your data. This widget includes controls for determining how the image data will be converted to 32-bit RGBa values. Conversion happens in two steps (both are optional): 1. Scale and offset the data (by selecting the dark/light levels on the displayed histogram) 2. Convert the data to color using a lookup table (determined by the colors shown in the gradient editor) If the data is 3D (time, x, y), then a time axis will be shown with a slider that can set the currently displayed frame. (if the axes in your data are ordered differently, use numpy.transpose to rearrange them) There are a few other methods for displaying images as well: * The :class:`~pyqtgraph.ImageView` class can also be instantiated directly and embedded in Qt applications. * Instances of :class:`~pyqtgraph.ImageItem` can be used inside a :class:`ViewBox ` or :class:`GraphicsView `. * For higher performance, use :class:`~pyqtgraph.RawImageWidget`. Any of these classes are acceptable for displaying video by calling setImage() to display a new frame. For more information, see the classes listed above and the 'VideoSpeedTest', 'ImageItem', 'ImageView', and 'HistogramLUT' :ref:`examples`. pyqtgraph-pyqtgraph-0.13.4/doc/source/getting_started/index.rst000066400000000000000000000006241457240071200247340ustar00rootroot00000000000000.. _getting_started_ref: Getting Started =============== This section will guide you through the process of installing PyQtGraph and some common use cases, such as plotting data, displaying video and images, and building graphical user interfaces. .. toctree:: :maxdepth: 1 introduction installation how_to_use plotting images 3dgraphics prototyping qtcrashcourse pyqtgraph-pyqtgraph-0.13.4/doc/source/getting_started/installation.rst000066400000000000000000000034251457240071200263300ustar00rootroot00000000000000Installation ============ PyQtGraph depends on: * Python 3.7+ * A Qt library such as PyQt5, or PySide2 * numpy The easiest way to meet these dependencies is with ``pip`` or with a scientific python distribution like Anaconda. There are many different ways to install pyqtgraph, depending on your needs: pip --- The most common way to install pyqtgraph is with pip:: $ pip install pyqtgraph Some users may need to call ``pip3`` instead. This method should work on all platforms. conda ----- pyqtgraph is on the default Anaconda channel:: $ conda install pyqtgraph It is also available in the conda-forge channel:: $ conda install -c conda-forge pyqtgraph From Source ----------- To get access to the very latest features and bugfixes you have three choices: 1. Clone pyqtgraph from github:: $ git clone https://github.com/pyqtgraph/pyqtgraph $ cd pyqtgraph Now you can install pyqtgraph from the source:: $ pip install . 2. Directly install from GitHub repo:: $ pip install git+git://github.com/pyqtgraph/pyqtgraph.git@master You can change ``master`` of the above command to the branch name or the commit you prefer. 3. You can simply place the pyqtgraph folder someplace importable, such as inside the root of another project. PyQtGraph does not need to be "built" or compiled in any way. Other Packages -------------- Packages for pyqtgraph are also available in a few other forms: * **Debian, Ubuntu, and similar Linux:** Use ``apt install python-pyqtgraph`` or download the .deb file linked at the top of the pyqtgraph web page. * **Arch Linux:** https://www.archlinux.org/packages/community/any/python-pyqtgraph/ * **Windows:** Download and run the .exe installer file linked at the top of the pyqtgraph web page: http://pyqtgraph.org pyqtgraph-pyqtgraph-0.13.4/doc/source/getting_started/introduction.rst000066400000000000000000000063331457240071200263510ustar00rootroot00000000000000Introduction ============ What is pyqtgraph? ------------------ PyQtGraph is a graphics and user interface library for Python that provides functionality commonly required in engineering and science applications. Its primary goals are 1) to provide fast, interactive graphics for displaying data (plots, video, etc.) and 2) to provide tools to aid in rapid application development (for example, property trees such as used in Qt Designer). PyQtGraph makes heavy use of the Qt GUI platform (via PyQt or PySide) for its high-performance graphics and numpy for heavy number crunching. In particular, pyqtgraph uses Qt's GraphicsView framework which is a highly capable graphics system on its own; we bring optimized and simplified primitives to this framework to allow data visualization with minimal effort. It is known to run on Linux, Windows, and OSX What can it do? --------------- Amongst the core features of pyqtgraph are: * Basic data visualization primitives: Images, line and scatter plots * Fast enough for realtime update of video/plot data * Interactive scaling/panning, averaging, FFTs, SVG/PNG export * Widgets for marking/selecting plot regions * Widgets for marking/selecting image region-of-interest and automatically slicing multi-dimensional image data * Framework for building customized image region-of-interest widgets * Docking system that replaces/complements Qt's dock system to allow more complex (and more predictable) docking arrangements * ParameterTree widget for rapid prototyping of dynamic interfaces (Similar to the property trees in Qt Designer and many other applications) .. _examples: Examples -------- PyQtGraph includes an extensive set of examples that can be accessed by running either ``python -m pyqtgraph.examples`` or :: import pyqtgraph.examples pyqtgraph.examples.run() This will start a launcher with a list of available examples. Select an item from the list to view its source code and double-click an item to run the example. How does it compare to... ------------------------- * matplotlib: For plotting, pyqtgraph is not nearly as complete/mature as matplotlib, but runs much faster. Matplotlib is more aimed toward making publication-quality graphics, whereas pyqtgraph is intended for use in data acquisition and analysis applications. Matplotlib is more intuitive for matlab programmers; pyqtgraph is more intuitive for python/qt programmers. Matplotlib (to my knowledge) does not include many of pyqtgraph's features such as image interaction, volumetric rendering, parameter trees, flowcharts, etc. * pyqwt5: About as fast as pyqtgraph, but not quite as complete for plotting functionality. Image handling in pyqtgraph is much more complete (again, no ROI widgets in qwt). Also, pyqtgraph is written in pure python, so it is more portable than pyqwt, which often lags behind pyqt in development (I originally used pyqwt, but decided it was too much trouble to rely on it as a dependency in my projects). Like matplotlib, pyqwt (to my knowledge) does not include many of pyqtgraph's features such as image interaction, volumetric rendering, parameter trees, flowcharts, etc. (My experience with these libraries is somewhat outdated; please correct me if I am wrong here) pyqtgraph-pyqtgraph-0.13.4/doc/source/getting_started/plotting.rst000066400000000000000000000121751457240071200254710ustar00rootroot00000000000000Plotting in pyqtgraph ===================== There are a few basic ways to plot data in pyqtgraph: =================================================================== ===================================================== :func:`pyqtgraph.plot` Create a new plot window showing your data :func:`PlotItem.plot() ` Add a new set of data to an existing plot widget ``PlotWidget.plot()`` Calls :func:`PlotItem.plot ` :func:`GraphicsLayout.addPlot() ` Add a new plot to a grid of plots =================================================================== ===================================================== All of these will accept the same basic arguments which control how the plot data is interpreted and displayed: * x - Optional X data; if not specified, then a range of integers will be generated automatically. * y - Y data. * pen - The pen to use when drawing plot lines, or None to disable lines. * symbol - A string describing the shape of symbols to use for each point. Optionally, this may also be a sequence of strings with a different symbol for each point. * symbolPen - The pen (or sequence of pens) to use when drawing the symbol outline. * symbolBrush - The brush (or sequence of brushes) to use when filling the symbol. * fillLevel - Fills the area under the plot curve to this Y-value. * brush - The brush to use when filling under the curve. See the 'plotting' :ref:`example ` for a demonstration of these arguments. All of the above functions also return handles to the objects that are created, allowing the plots and data to be further modified. Organization of Plotting Classes -------------------------------- There are several classes involved in displaying plot data. Most of these classes are instantiated automatically, but it is useful to understand how they are organized and relate to each other. PyQtGraph is based heavily on Qt's GraphicsView framework--if you are not already familiar with this, it's worth reading about (but not essential). Most importantly: 1) Qt GUIs are composed of QWidgets, 2) A special widget called QGraphicsView is used for displaying complex graphics, and 3) QGraphicsItems define the objects that are displayed within a QGraphicsView. * Data Classes (all subclasses of QGraphicsItem) * :class:`PlotCurveItem ` - Displays a plot line given x,y data * :class:`ScatterPlotItem ` - Displays points given x,y data * :class:`PlotDataItem ` - Combines PlotCurveItem and ScatterPlotItem. The plotting functions discussed above create objects of this type. * Container Classes (subclasses of QGraphicsItem; contain other QGraphicsItem objects and must be viewed from within a GraphicsView) * :class:`PlotItem ` - Contains a ViewBox for displaying data as well as AxisItems and labels for displaying the axes and title. This is a QGraphicsItem subclass and thus may only be used from within a GraphicsView * :class:`GraphicsLayout ` - QGraphicsItem subclass which displays a grid of items. This is used to display multiple PlotItems together. * :class:`ViewBox ` - A QGraphicsItem subclass for displaying data. The user may scale/pan the contents of a ViewBox using the mouse. Typically all PlotData/PlotCurve/ScatterPlotItems are displayed from within a ViewBox. * :class:`AxisItem ` - Displays axis values, ticks, and labels. Most commonly used with PlotItem. * Container Classes (subclasses of QWidget; may be embedded in PyQt GUIs) * :class:`PlotWidget ` - A subclass of GraphicsView with a single PlotItem displayed. Most of the methods provided by PlotItem are also available through PlotWidget. * :class:`GraphicsLayoutWidget ` - QWidget subclass displaying a single :class:`~pyqtgraph.GraphicsLayout`. Most of the methods provided by :class:`~pyqtgraph.GraphicsLayout` are also available through GraphicsLayoutWidget. .. thumbnail:: /images/plottingClasses.png :title: Elements of PlotClasses See the :ref:`UML class diagram ` page for a more detailed figure of the most important classes and their relations. Examples -------- See the 'plotting' and 'PlotWidget' :ref:`examples included with pyqtgraph ` for more information. Show x,y data as scatter plot:: import pyqtgraph as pg import numpy as np x = np.random.normal(size=1000) y = np.random.normal(size=1000) pg.plot(x, y, pen=None, symbol='o') ## setting pen=None disables line drawing Create/show a plot widget, display three data curves:: import pyqtgraph as pg import numpy as np x = np.arange(1000) y = np.random.normal(size=(3, 1000)) plotWidget = pg.plot(title="Three plot curves") for i in range(3): plotWidget.plot(x, y[i], pen=(i,3)) ## setting pen=(i,3) automaticaly creates three different-colored pens pyqtgraph-pyqtgraph-0.13.4/doc/source/getting_started/prototyping.rst000066400000000000000000000047511457240071200262300ustar00rootroot00000000000000Rapid GUI prototyping ===================== [Just an overview; documentation is not complete yet] PyQtGraph offers several powerful features which are commonly used in engineering and scientific applications. Parameter Trees --------------- The parameter tree system provides a widget displaying a tree of modifiable values similar to those used in most GUI editor applications. This allows a large number of variables to be controlled by the user with relatively little programming effort. The system also provides separation between the data being controlled and the user interface controlling it (model/view architecture). Parameters may be grouped/nested to any depth and custom parameter types can be built by subclassing from Parameter and ParameterItem. See the :ref:`parametertree` documentation for more information. Visual Programming Flowcharts ----------------------------- PyQtGraph's flowcharts provide a visual programming environment similar in concept to LabView--functional modules are added to a flowchart and connected by wires to define a more complex and arbitrarily configurable algorithm. A small number of predefined modules (called Nodes) are included with pyqtgraph, but most flowchart developers will want to define their own library of Nodes. At their core, the Nodes are little more than 1) a Python function 2) a list of input/output terminals, and 3) an optional widget providing a control panel for the Node. Nodes may transmit/receive any type of Python object via their terminals. See the :ref:`flowchart` documentation and the flowchart examples for more information. .. _Canvas: Graphical Canvas ---------------- The Canvas is a system designed to allow the user to add/remove items to a 2D canvas similar to most vector graphics applications. Items can be translated/scaled/rotated and each item may define its own custom control interface. Dockable Widgets ---------------- The dockarea system allows the design of user interfaces which can be rearranged by the user at runtime. Docks can be moved, resized, stacked, and torn out of the main window. This is similar in principle to the docking system built into Qt, but offers a more deterministic dock placement API (in Qt it is very difficult to programatically generate complex dock arrangements). Additionally, Qt's docks are designed to be used as small panels around the outer edge of a window. PyQtGraph's docks were created with the notion that the entire window (or any portion of it) would consist of dockable components. pyqtgraph-pyqtgraph-0.13.4/doc/source/getting_started/qtcrashcourse.rst000066400000000000000000000102621457240071200265120ustar00rootroot00000000000000Qt Crash Course =============== PyQtGraph makes extensive use of Qt for generating nearly all of its visual output and interfaces. Qt's documentation is very well written and we encourage all pyqtgraph developers to familiarize themselves with it. The purpose of this section is to provide an introduction to programming with Qt (using either PyQt or PySide) for the pyqtgraph developer. QWidgets and Layouts -------------------- A Qt GUI is almost always composed of a few basic components: * A window. This is often provided by QMainWindow, but note that all QWidgets can be displayed in their window by simply calling widget.show() if the widget does not have a parent. * Multiple QWidget instances such as QPushButton, QLabel, QComboBox, etc. * QLayout instances (optional, but strongly encouraged) which automatically manage the positioning of widgets to allow the GUI to resize in a usable way. PyQtGraph fits into this scheme by providing its own QWidget subclasses to be inserted into your GUI. Example:: from PyQt6 import QtWidgets # Should work with PyQt5 / PySide2 / PySide6 as well import pyqtgraph as pg ## Always start by initializing Qt (only once per application) app = QtWidgets.QApplication([]) ## Define a top-level widget to hold everything w = QtWidgets.QWidget() w.setWindowTitle('PyQtGraph example') ## Create some widgets to be placed inside btn = QtWidgets.QPushButton('press me') text = QtWidgets.QLineEdit('enter text') listw = QtWidgets.QListWidget() plot = pg.PlotWidget() ## Create a grid layout to manage the widgets size and position layout = QtWidgets.QGridLayout() w.setLayout(layout) ## Add widgets to the layout in their proper positions layout.addWidget(btn, 0, 0) # button goes in upper-left layout.addWidget(text, 1, 0) # text edit goes in middle-left layout.addWidget(listw, 2, 0) # list widget goes in bottom-left layout.addWidget(plot, 0, 1, 3, 1) # plot goes on right side, spanning 3 rows ## Display the widget as a new window w.show() ## Start the Qt event loop app.exec() # or app.exec_() for PyQt5 / PySide2 More complex interfaces may be designed graphically using Qt Designer, which allows you to simply drag widgets into your window to define its appearance. Naming Conventions ------------------ Virtually every class in pyqtgraph is an extension of base classes provided by Qt. When reading the documentation, remember that all of Qt's classes start with the letter 'Q', whereas pyqtgraph's classes do not. When reading through the methods for any class, it is often helpful to see which Qt base classes are used and look through the Qt documentation as well. Most of Qt's classes define signals which can be difficult to tell apart from regular methods. Almost all signals explicity defined by pyqtgraph are named beginning with 'sig' to indicate that these signals are not defined at the Qt level. In most cases, classes which end in 'Widget' are subclassed from QWidget and can therefore be used as a GUI element in a Qt window. Classes which end in 'Item' are subclasses of QGraphicsItem and can only be displayed within a QGraphicsView instance (such as GraphicsLayoutWidget or PlotWidget). Signals, Slots, and Events -------------------------- [ to be continued.. please post a request on the pyqtgraph forum if you'd like to read more ] Qt detects and reacts to user interaction by executing its *event loop*. - what happens in the event loop? - when do I need to use QApplication.exec_() ? - what control do I have over event loop execution? (QApplication.processEvents) GraphicsView and GraphicsItems ------------------------------ More information about the architecture of Qt GraphicsView: http://qt-project.org/doc/qt-4.8/graphicsview.html Coordinate Systems and Transformations -------------------------------------- More information about the coordinate systems in Qt GraphicsView: http://qt-project.org/doc/qt-4.8/graphicsview.html#the-graphics-view-coordinate-system Mouse and Keyboard Input ------------------------ QTimer, Multi-Threading ----------------------- Multi-threading vs Multi-processing in Qt ----------------------------------------- pyqtgraph-pyqtgraph-0.13.4/doc/source/images/000077500000000000000000000000001457240071200211475ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/images/example_false_color_image.png000066400000000000000000001065151457240071200270320ustar00rootroot00000000000000‰PNG  IHDR¤á§Ž pHYsÄÄ•+ IDATxœì½i¬$YzöEdDäžù¶Ú×Þª{¦{f4MÉ!)’"-z@–iÙ†(؆% † ¶~؆ ý°¡ôòÕl‹ÞAB°,‹´5M„gÄáp¦gº‡ÓûVû^ï½Ü3öÿ¸÷Æw²2^W÷d¾ªÌšï¾u3–{oÜ|7ã|çžÏ"¢œ@ x°Ÿt@ ’I +Y@°I +Y@°I +Y@°pžt@°.]ºT”/^¼øØê¹ü'ÿÉòŸü·žÿ]ºt©ô߇]ÿ­e‡«¯@ >=ûåqB(;@ X×ëOZ€.]º´Ö ”,H@°$üÕ¿ò¯êõÿþÿøülÝ#"QÙ ÁÚãiXŒˆä I –;=ö{>-‹‘,H@°4X4~"÷}8~uñâEºxñb©\{Yõ‡Y`ñI ÄAŸ-«~ÙI –…üɼ!=-I –‹&Oº k Y`YȧOºk ‘} `% oH@°,äþ“nÁZC$@ XdAZBÙ `%ð™ßÊv¯B @ xâÊn!|¦©ÌÍöáÊüû z@ xZ‘SpÈw¨òõŸ,>e' Š@ |òðpÿ{ʱ2¢†²·¯O³¾ðg[ôù?×&"¢^Ð.êm;/Ê^%&"¢QÐ,ê¶ý¢ìÚ ÝŸnuYÆkõÉÖ.]ž,ê.o€‹S—ˆˆÒœ‡³îò«»eÍ·eËcÆë£ãEy³6 "¢0s‹º$ãë:VªÚ—[E݉Æ~Q¾5Ý!"¢çÚwŠºšóµ 'ãu}¬Ÿð¯.›²¢üB綺ñ½Ú•¨(ß :DDtÏß,êvêî‹£-—ϹîwŠòXß÷lc¯¨óì´(Çð ž««v}ìsÝ$­åÆÃàÕï é:íFÜ– ŽéÛPy„½ÐìÎ]œð¯áIÊc|]_¤?÷ŽxücU5O-‹ÛlÃû™j£Ÿð5»R”O5¶‰ˆh³û¥¢.‰ïå›ýŠò;#5ÏÏ×E݉Ïó¿£îuÿß,ênMîÒÃxfóBQ¶*<îNû¿$"¢ŒZE›þSîËà7ù"–ƒz÷¯U±ýÏÍÝ á&ÿ¨(§Éeu™ê¿ÍuÖ±OóùiÆ6:j˜ôøKݪòÎ(QìpAjx|$Ó–Í»×çûvj! RþkÃâT¶ mµ¸­Ã±úc±Óå?€õ ÂÔ©v; ÿÁigÓž»W×árè«ûN'|þfƒûµSUçõŠ*O¸­N¬úu¤Å׬Ù\Ž2.ŸnªòhÂu£„û’”$?>³ cäªÏkð#¤¾úMBÓ”Ï9Yåçö\»Bcó=G ´[ÿiB“NT¡/uu-ó’hvAš¦êOžc®ÍÇžo©ÝÙâE2ŽØ²¦ºÇÏ` w=9Ûâ²}ösê^]žƒÕá|__<Âsß®ð÷ÈÙx‘ˆˆ2â^ò^QžÀwÆ,HÍ­sEUdnî^/>Q”ÓDuƪ½PÔ%Ö©O·åøñ¿\”£Ñ¯©¾nýËEÝ`ÿoq[kj<>Ú}»¨{åÜ_åvÿCz{C>öêûøò‰ŸQ׿ÿŸuõãßž;ß þfQ¾r›)¿cÝgˆˆÈ þý¢®²ùOæÎGÔÛ¿\”'ýß%"¢<‹:\ð„ñ#©ìP1· 94`çÑ£ˆÏ´ ­j @ X È‚´Öž²‚U¼!-†µ_’Ì¥0VªŸKŽG!ËPMŒhq\ãA»¾’ÁbÜéd›¥¯×z*n’Á¶-?â`Ä1- ǸGˆÂ”UMF%÷üÖÕ¢îÈͯ”Œõ(Ä•®Ž9.Òp”„«[ã;ÜžrTì}0Umù ¨.-›ç“Õþ-""Їÿ_ßfšéë$å?´øG×k(Yudÿ|Q÷¾X”1Kã“PÅášÇÿ_bpÌÒ(õ¬ê_,êŽm|§(W%—¯6!FŸ ËæØã©¸¬]¹ÿˆ³O k¿ Áª ÏE0±dA‚eA¤…°ö ’cÇTÕ®IΆ±+Ã4R¯ún…eĽ€eÕ†êà ¬="Ûš¦å·Ý`iíGÔæ@Çáë7À‰aôaSKÓï€l»®÷5ew dÛçº,5¸9:R”«Ó"»µ‹ÿd‡eÈ·à^¸á÷œ¦×nùZ§[Lglh vçø ‡7ôÓšz#"ºýÒãÝùY\ ùMí¬ãŽôf $è?©ûÖV=]eÊìý‰ºG”–OéÓ5õ ¯Ã6‘›>·ë mõ¼¾±ÇÏ*šì~È'n¸ŠjûxÂíëÂmß×…wOúÕãLϽ3TTçЀñ½líàЋ™v}µËóu*úïøÎOužó>´•·?×´OÖ™ í?øÛEÙu~ƒˆˆªÍWŠº# QÇjnžmåöUÿµ¢Ù?Ac{ëg‹òΔåò{Úâl¢-CêÿÝ¢<ó–‡H»aœ:ûQˆÃïåë{oÑÐt¸à cí$@ Xä$oH‹@$@ X$†´Ö~Aª:aA¹Ýܦ¨ï6™zªºŠn1 7"¢)(»Œún /ÔdÆ‘À¶øU?jéÔæU""zÔR†qÂ÷2”]”[‡¶5¥5Jñæˆý¼bã›þv p78ÒRôY \)öPù ícíÚ%w®{F+ 7àúvÌÔÒ•rhWùs¤?©Ï€²ï­!+¼¶ôXL¡}M ÑŸî¨Vn:¨²ãqµµªpôàGš¾$"Úìªq}¶Æ}=[å¶~o¨h¶кïNx,~¢Ãó᦯¨º3u¾×öX©hÚÝv˜³ëÇ|¯¯lŸW×0»áòLSõŒÎ€ßá‡@>×Uç¿w œÀ‰áZÀ÷=WS×íE Iíoåkã¿W”#-ûþÊËÜ×Gíú©TÿÅ¢|ç¾Jì7 >½ÓÃgÆ!-HçO^#"¢oÐOês'Õ¶,e'‚•ÀÚ¿! Áª ϳG$8k¿ Ea‡F•Ç­•Ë9û¾¢œ* ?vÀQÀP~ìòÇrÕëãx¸Ð}!×ôRk»ûÏe”“7 M泌7ú͸&à96”G¡j×äÓÆýˆ%Ø}Ÿ¥·[u¦[Ú5.ïi#Ô 0GEªÒ8ì€‘ì  Ô6õuë0–wÁ\ÕHïÑ|åè÷5upGL¹=¨0½fÜz1Ó³7¦L%úšö뺓¹:"¢£žjã‡S¦Ñ¶\¾ï÷uÎ+l Ò‹·C¾ïZª×|nßq¾ÝÕØ7`À7zLÁ¾Ü4cÀcíz¾©Æ%î_j3eWÓògò!U+ܾ^ÄÏ㸧®»áðÜ}ùÄÏe×SÔu²»B×ãçõRSõs?yp¯øÁ/Qsã/uw&ì’R±¹-OÍÙ<ãq«fß,ʉý§Ô½üy>\#“irû'‹ºæI6O-ƒ?ø¯‹r]K×ûÍUŸÐ‚dbEHËCZVýa`í$@ øqÇA‹Äa×/² Á’pX*»¬ý‚dÙ)Yšf‰&š¨Ò”W½ÎêšQŸ•>áX™—Ú.S_ 0gh•ž*¸LÓ{»{àž<1먴Héij ö†œ½­¯…&©÷A1x|û#"šuª@Å]c†ªÔÔ\k4XªÝ нÕ}=_í¢AÑxR˜›Ï8¿éÒ75Šj8·@‹ÖUèÇŽÇ}‰ôîþËÚýˆèNü (#…SÞùÿù6S‘ÚªÝ{ XDuàÙ?Ã7õ4ù\“Ÿ± ÏШw@•ùlæ‹q•h0=ùá”çžÉ­dÏ(ûøúÿÒ5Þ“Ÿ1dÜ®ï Ô±gëLe~qøqQ®ºJñw|·¨ó!]ùGê{´ BÖÛzl‹)Zƒg6x>Þó|ˆôu³”Ÿ[8ù×üÕÿë|þfÀã~_çVjuØœ•{]»Âs³æ©gïTú¾0$†´Ö~A‚UAþÈ%RðIÙ·@ Vëÿ†d¥dkš§ÚátÇ~ïù¢ì¶Uýd ”P,æ7M&¤Ó)S¹6áLÀŒÏwëŠJHºª5xó©šó’)o&uêLK˜Mª PG]Ha>Ò*¶\ßšËløu!‡‘ ù–z î«kúlàÃÆX0…5¹—îX›©P÷ );T¶õâ;n65´b h¼ Q/l\/Ê×'jóñÛ°Ùô8Ðw&µºTí-Èou/T4Ö;»PÇÏå-­ÔÄÜMØ—ã;éùº¢2¿Ùã~#%fŒo¯ƒâð¨ÇϰYQcðÚ€•sUøiøöX=ûm ÆÎÔø—÷õ©jcr(=ðy ßð±/6U»Ò«yLîMÔæã;÷{?æ1ÜÔ!*<ìt®Ët÷p¨ÔyUŸ©¹«}Þd‹éÔŸm) 4Žø¹5Ú¡(›tèYÂ*¿;.'šsk¿ÄçÐ<œð׋ò½þ;E¹UUs?ÏÏ‘[bH‹aý$@ Xä¹Pv‹@(;@ ¬Væ éÕW_-ʯ¿þúl‰@ üh•ÝbX™éG]„ò¸I‰–{;ÝküÄâ‘’cŒÈ{ŠÁýã2©–%££‚¿ÏÉÀš;*¡™‰êB0,MCH2橸]e=ñ9ÖPÄ“ F…î æÃÑ ®ƒLSËÂ6l½±Œ=íëk¤·ÙÞà1tµS ÷Ûý³E¹£¥Ð-pØ…ûž?òºÏýÇdGÉ¢‡/Û¬³û#¸ÖÙ¶ŠuL ­3F¬ú5\~®· †ó“;ª-ßëq'LX1wJS×7¦ä—{é¾°òì«ðNÖÔܨÛüŒR| Ðô[­ÎÎ#?`SÛ ‚üŽÕ>srnÅL}WÝß""¢QÂêÇ#¦½¡iϽݯu;Gx,3úÜžþõ‡»IDDôs›¦‡ç¦‰—ÝBXûI VBÙ-Y`IÈDö½$†$‚•ÀÚ¿!Y•ˆ,XÏ‚XˆRæ\ÇXС;s¼È¸6X¨Ìynv»GW1÷µ›,·-K8Ón¨C x®²³”¹qŒwe:…³Àc˸S×ê)KÜ[àˆ>ÚW ÇZRˆ…L§j QÖÝ€Duû:ºZtÀ ¼®cD÷GÇŠ:$à¡–cÜãa7À‰ásÛÊ=ãFôÎe“ÐÏïAlÊH¼_ïq<®Záùb\Æ?†Ï·Ø!Çv;B§txØÒ±·¡ýZ<7̯hÏæXÊ>ÄÆ:zÜÞƒdƒgë3ü™ gühÂqÈëÿ2?Qåv½¯Çþ¶ù¹\ð3¼Ð9¡ûÂç¿Ðàçù{ê^/58öSÇ8AžW{ˆˆ’bo>Ͻ¶ÃsóXUŃ®=`÷†ÏýçE9œþ6µÚœèò£ÛìÖý¥ŽšÇË£$ÅÔ°mžï ¹]A¦öñ-&§†…°ö ’@ ¬ „²[ BÙ `%°þoH¹M¤é˜dz¤ôCŸe1H†Á=¡¸TÈôBžÌ_Ëç”xÛ Eå¥ Ïa—½ N FZ^iqB3„×½ªŽÃU”›ÛZJÙQ!Ï+PV¿1,0DÍAv> ¹¡5‘2³á<#m¯·¹­ÜËÐŽ6Ðh˜¬Ï$ãóÀa hgÚ ”ÛLeècSŠ'|ÿŽ¢‘Z ëFóÔ ¦{vö4}ˆ"¦Þ›é—p¾HôcÒ¾»>÷ÁȾ_Ü`ºÈO™FûÁHQ… ÿšÎˆÛrS›ª> rý&üt4TÝËž£5›eé¯ ù౦"ƒŒïUª°]UniÆ}ýƒ=¦ÜlK·3½y¥Ïæ«_ØüWéa %öæ˜Çè|MÝ÷t“Ûç|¯Š£Œo¯ÞaY÷W·˜ö|½¯Æã玣f#"z}Wm6­ýøÓGÞ+Êûš­½éóx±ÉÏõ!+?6©Ýá¹ö€23eÜ‹ô`_«&ï‚RòL˧\ÕÇý€éjTÙYÏR´dÃá~wO¿Q”ãñ¿CDD“)_k˜ðÔ4e·á±"1 ~›oÐú_Õõ»L?Þ¾þwŠò :eü¦;%¢råç:ãÒ¥KtñâÅÒz"šùÌÔ-Z¿l¬ý‚$«‚'åö ÆÃõ/ ×™ÖúÀlŒ‚%!ËóCýï ôft˜o3‡yC‚%á°Þ<øütÞã¢Ú–…µ_òÜ. 5zgÀï›|U0ËL|–äFZ’ÛèÞ*êRΚN4âärhâéh÷â ÈÆÑáÁÄ›r01MÀÝ ‡$ d®‹î (wwul,Òq/"¢*$ó ÷/ÀyÕ™þYè´ ãEyα„‘˜'ÁfQç8V‘ÔU,¥YïÑ'eã?ƒ:ÄxšZ¶íÖ9öwwÈrú@Ç{Üß+€z‰–£O"î_ ÌUGåŒcy œª` {OÇ«lCÁA¢—«ñ8 1®)\÷¾T®‰1$#QGYú±*·µ¢ÿè]9¾ÒžÏAIDDGu¬Miën˦§æþ8fG…¦ÃòM“<jÿ~©×kj>¾Øz¶¨ûà#vZ¸æ3 S¯¨ñª Øù£yë'вXŸcâ>DDOU_.ıÉ*Ѭ•ϱªƒfeJDëGÛ}L¬i9£3Xvýa`í$@ X<)Ù÷A‹Äa×/² Á’ é'ÃR¤'¹»7'«0ú¬È©z`®ªi‹0`êª ¹tFÚ8ÓŠ¥Õaj+É M™¾Ë Q¦Jfr/½iZ15[­ÁNÁHí|¯6Y¡•Meë²îÁ•yFIˆÔRoy´¦¦êòˆÇ-…²1Z !ŸÒLn&O«àà^YÈceTv œ3AEŸ¾>¦M¯x¬ðŠA½gTh¼9 Õ¸dØU¦ñê39Œå‚ò.jÊPvxÎpÊ´îWN}¿(ïêû¢ùjλ9Q)éC 7oLyÜ¿º¥œÞòXósm´êÃykÀÏøøEÿɈi§AÂó Zß* ó‹@!¿Òæñ¾í«û>ßdZø#ž¯Æ ö P­'jw\P'¾¢ûrÜceÜ»#žÇšŠ2»2`m’r»0FU½ù÷Dç£?úfQîOÕœíV™Šý`Ï(Pýþ‹§ù¹67þrQŽƒ?P×™ðw)´Õ÷ü~tx{…dAZ ‡FÙ}V|–EH O„²‚%AD ‹A$@ X2±Z‡Cz\»{£¨IÃÑ1""ªº¼ƒãE#ýy’_×aN¼©ª>Ç$<ˆM|Åi£,Ü9¦à¹°Í^£ŽRn¸®q•hAüb2b骹/š§Z0q—Ɉ“¿9`Þë¸CdÄ8X`2@ãºàUy7|ŒlÃIÀ(ÖÛz¿(g%Nn‹ù{¸Žk¬Û•ù|}<%ÜSí^Pƒ~ḘgA²Âú;Q¶ŠqeIô~À±Š"f}ªz<‡Â”ëMìçcxnà>(©u·É1¨Mpj8UWã.:läú®ŽgY`¸ú ×±#›»B5ˆûüÉÞ3E¹®c†(OàGüîªØÏ+‰ûê˜âµ€ÿTñx¾G‰v)I¸n/æ{Ýiþ†£Æí­Ï·Zåc(«ùxuÌcõÚçC˜©Ïû!˜¿ö~ƒ[}DÅŽZ­¨ûgï±ùêã}çò†´–ò†ô¤w÷ `ý! ú`IÈòOÿßÙÿÅg:>û1xùZûRž噢Pr<™0MåGJúÚ®³“:øšRË2¦ÉÆ>S 5OÑU m”JmƒM Ç ÿÍsÕ4)M€ u»7ÁÝ€*lhª/Ї\<Î}¦ÁPÎ>c:[´•¥ÖhZ1&@¦v»0f³èDô.ÚQãfMF‰£)8Œæ62ôš«ÖÀDt¬Ífm4\ y\Œk¸i\ïç¶è>¢l¼0º.¼¹¯úxh×Û}¦ ©¬Têmp}0F¬§ ï Îå]í‚ù˜Þë¿Úþˆˆ~0â6«ó|F¹øXo@Êï˜ÇÏód]ÑýçöÛc–e_×TæOiÙ<ÑMßš¨1ˆÀáù:SvaÆ×½¨¹ÿ+üÕ¤ §ÿ=ŒÉÿ­(oºL}g¹šGûÿe~eë?-Ê ©gL>Sç¾¼3Vm±‘Vû´¢†—Ÿý-ê4¿BõÚ‹ôöå_;´ö¬ä I –„O“†üåg“¶:¿LU÷$mu~™^~ö7Naþ´`íß`UðÒ¹KŸøùÎÆ×Èu¶‰òœò<%ÛªÓÎÆŸ£ŸûÒ5Úí?z/æûßõyÌ:cí¤$uÈ7N ñ<ED”j*)=¤Ì†S¥àÚj³* M8 Ðý¡7fÞa»£èÑÔhàˆPT”8úžL¹5kLk ÓC î ­ÞCsV¤¼FZùUJ">³ôyÃ>ÓEFq¨.lh,0O£ÕšV†…cV›a[âÁy"zH™ãnÒ¹'@gU 7RéÜk]¥³Àºs´ûòܵ^4î ˆ`rÚBzOÏ!tÒØë1ýxôô÷¸‰º×òk!…kæÖݽ犺WÏ|·(wt{ð ‹çÈé­+ê:@!Õæ›cÕÆŸìÆsuDDÏw™ê›j ó!E9?ã×úŠ6<âñsÛDç ­ü(àÓÛLÿUtºñmT§ ¸s,.Ÿ«©~hö›óÜÏ2¥¾Cú°Yá·_Só»_óέÿ¤(oŸ}‹ˆˆ6F$LeU"ˆ—ŽÁø»Ÿøy³þ"¹•M²,0?ÎòÃy®Âlájcí$@ XÜØýŸùù¹cž=ñ7Èu6)Nztùίӵ{ûSÞá¿]¼‘+ Yà1Â,>§vþ]ºµû?†ÅèéÇÚ/HžSKS^¨V¬ë6Ð35T-ÙÌš]ãÓ›(z­çt°™4™7ÁDµªìw)5l·ÉÇ”@NC)¡Ñë…Á,Üß fZ²¡ÖJ7ɪΆ ¢6(Û".|F±¹£ÜªI*>HËOÔ†å²tóê#=8®N‹SUÇÃóDDTið¦J¼ÖH+C É*@_Æ#E[V»W¸6_ï3}¸£iÍ>*^±!˜É¡н5Ý_6¾¢Šo¿¯(ÐNƒsMAáy+Scçü¬Æ0QÑgÆ«ùŒ.CÂÓË^¡[{²= Y`IsÕÅ û@°Xÿ7$+/xr\][µù¤p~±ŒOdêóÝÇ ßßl*n{±šÉ¶›k´ñž·&)´c©¸EŠòdˆu˜xžƒHu\ã]– ¿ÊôµÐ©"ûUp*ë]øaÄŸ£¹ªqUh€#ʶM¢%Åx}[Çh2¨ˆÈW#F“T û Rh×›ÌÜS]ÌU«*>õ8у öô½Ð\¶Þ£V-ÅN@]mr¿w@oïM#ŽÅó‹rU߆¸Í}MŸÑõ÷Nlx®Í±¯=íÔà@r;Lº·¡Ç"€ØcÚR‡-ïªñèz<7cˆÓF­­ ÏG„«ï‹Iûî‡\þò†jënÈ× 2W”ƃדU~.–Åq¶cÛ¯Ñ;—ÿŸ¢îMphëg×KøþÕÖP”Óðÿ&"¢pzîÉß7t³î͇—†{ŸÃÄú/H@°"Ên1e'‚•ÀÚ¿!M‚…}E=m6Y‹4X˜)ŠÅs˜ö@J¬©ÍS{¦P0qJ¨ƒÙf”0µµÕR”ÞÐ纪ÇÔP”˜i:AÔ«LcEQ »ʇ{££ô0°¯Ã¡ú¼î˜/ é5c&ÛÓYüÜôi:Ìídœ/Ðõi´"_ìÌGÙ¸1eµA ޹›¦ ô1H¹¡¬Ûß¿0wtj0Òr4díXÊÚ`×gÙz­ñFQÞ9»o¤Ô\˜†VÄçv¦Ãî Ý̱t\!*zkÀ(౞z¦¡èCæh¿-?Ðù˜ˆˆšuEeÞ÷™6ÝœR?»©úðþ„Û߀ù’jŽøÐÖŽÃýz{¨Ì|§)? h8|†ZŠªì%üùÞ”é»n¦ú=†k†ylÌ$*hµ~X“D±ÉÑDDTµùO\³¢¾S®}xIô„²[ k¿ Áª@òÅ.Y`Iøqpä>L¬ÿ‚”[”§ê]>ÉÊ»cuaÌ´Rb“P)¶[œŸ&jw¨èšnƒ©ÄÞHÑ!Hó¡r-sÒ`¬hhƒ¡Ï4Y«6i3Q¥Âm5Æ=‚ˆ(˘®9¶¡Œ/Ñät2eº&ׇvSQZH¹MnËFç¾¾>·¿Õaw„PÓkè413¥Ø4ê< Ö2 ¡|m ‹éæ=ÈDЇ,ÐéÎ1µ»ÃT§1_ÇìD‘ƒ,išÌJ$*F‘î Ó›£;ñ}î£v2H0w¸YŒµk\´æ@™íë_”#M¡¾ÐâÍ´¯ƒJ/€Í¨æÙ90_kð5¸ª¹ñÑ„çþs°Iw iÃ;@û~á÷{ÇSè;c®ûviÑçf®ÆsÓáïæ[{ïeÏVÇz(`aîv]Ebœ¦Ûb§…¼ÌŒÌY³@Í‘ñð,9Í{|M³‰:QVW±ŽŠÍ’â±öo}•ˆˆluÇp­“-%1¿ î[·Ûgì¹Üî“ZÂ=Y»c•˘›:áâ]hÿë0ª«ú»íq ë{ûªé6´a^l‚q°Ÿê¹î Ÿoó¸üñ>¸a:æD•ãJϵ9ä'ª]÷6‚mÃwÊ`]MÁ•a0QN Wúæ>|®“úiDDå߉u…¡æ>Í›QÎá¿”úÃÀÚ/H@°*xR檟fú4ÇÖúece¤W_}µ(¿þú¼"I VBÙ-†•Y~ÔEÈvcrZ“¹ztMpjêµ=ì³t×mçÎAùt1Å ½Wë SӉγ”L6ºl†9™ÎÓh(‡u=¦ •h¨;"¢!PzZÂ~P¾$“s݆Óné±3¦± ÁNµì» ¹€"  MÖ÷QÌŸ·µ|åÓ1äjÔ3×!š¥1S먢”20_Mþܸ=¤ ÍÇs+Õ5eç5øšþîçŠ2•P F™GDÔØü¸(Ûz·É6ä8Ú…våÚ "˜*ÝëŸãcëŠâDu䉭«EùÆmµ+ßv™Š… HÔÅ 0>¿7`eYÏÃЋÉùâ”0¿¨¨û@§@€¹êÏo±Š®ãªùð­_?ɸ­û ªìhUæò!a¾¢–§¾“¯õØaã™&nò?u]~îqÄÇÚ6çV2xkÌÔú=ý<&é”r_&{R¹×ÌÓñ²ÁJ`íß`UpØ”ÝÓþ†´ö ’ºdU–¶À¸sÂÔMÖÔ”15fm`ò)!͇e+Ôç‡ó.6_H© oÊOÝ×Ö×d…TæñyuM™áùÍ6S^† DÊ)94‡EªrùŽ\M†@ÿáµð<¤ÔŒÒi:6sÚ%æªf³,QS«÷†£c¥÷Gz7¬ŸƒÊ,Ñê>ÌCÕ=ÂÆM!M–Áùަô*o ó8E°‰7Ö´¥›IÓˆŸW¬kn½\e×€12¸3:ÎÿÐÔo ”_ܽY”ß(ª3HY9‡ Ñ4›ÏûuòT=9­Lî¡3ÐÖk«¦èÅs Òû£>›¿ÜQcôÕ žWßð|¸2fºúžÞ|á_ë¥ Þ„û^_™éÞG3aø¦½¶§òSýÊñø€|^1WwùY%0…?×T}y×=¼UCdß‹A(;@ ¬Öþ I VÙS¯ƒ;\È‚$KÂ'%Ñ<OÇ‚¤'=…¸L‰h+Ô‰æf(³*H¥}-÷†ø‚å´¦b!6œoÀ± 2ÃÉ!ž”€¹*Çeøúx]ßWñ »Êq†‰ÏRkWKÈMŸˆˆÐ~Ò$öM™GG‰x«ÆqPËÍ3hŸq“†Š]õ†¨ºhø©Ê÷úüù± 6­VU ÝjK™£ãE8E ‡ì„°QQ÷²kì 1é/Ê«TÀPâ>A $Þve>~CĉùÐI“ ¦à@aäæiæXÍnÕóŒÁý`ëÄ÷ŠòT'Þ» ý«‚áé¸ÚÓ}á8  ‰ O7U¼+ƽ]åqNÙHÕ«ØÔ §^+êÎ\|«kÜWˆÄÆnë1þbk¿tâE9HÕ»Ïq#^ncÌPKÏÿLRlë]îW]ÅÌ’ŒûrÃgé½q¨x¶Î¶¢ˆã«µ:O 0¦ó¶6Þ§DäÏ» àvÁg‡Ä@°x:Þ` 1¤Å°ö ’EL¯Y Ó Ö„_þ J­DÆLDÅ{"JÁ;ƒú\Ÿ\tæÕÒ ×·#عƒ”XKdzZRz¬m¨8d–jó¹~´r?kJ¯ ”_Óczb¹‹BmÚŠô ʇCM-™¼ID³î†ª+dó4ëº0õƒRñ²¼Eý ïæ?H®Y5È«ku¦ïŒ+DóXLÀü´Ù½¡ о™|Eš^›N™fCÙy³ÁR厖Mǘ› ˺˜*úð¦v“ØJ·‘~Ôô]Ôcùu²ëަ¯ŒY.”^‚¶må²q½ÇòêºÃc¼cŒ\¡¯÷'ìpÑÖôÞFów5½2U4œõ›»Ü—£m–ëŸÐyœ˜C]Ìxµ\ûÕS†û1Sr7´t}š¢3 Ðw¡ÚFðAŸhë6Ï¡cš2Äö/"û^ BÙ `%°öoH@°*Ên1¬ý‚”Û9ežz¯L¹;Yvükš¬ 5;ÛZEódJÚLØú<M¹ßgô³¿ ¹c{ïåÏm>Gã8šZ2ÌBšý².¢²[ k¿ Áª = q¦àÓAFO +µC²2‹ìHñcäI±B Hš‚r.«Á±Z‡›eÝ!P(ºÞP{ê`.æšæ²*¸™6M=猪ús¾Ö ÕXW÷šÉÍ”žQòÙÓ26¨ s^ºR群S¦¦œóI®ëñ^p+»£(¥­&SGCµ%_¿Ýå[¨T[mÎS33Í6 Õy¸qx£Íj®8…3)í-Ü”­Æø(òš}Kon~­Çùš KDäjE_”!¢­çü¾w`3+šå:kùš^îp»¼Š·oï]-êÞíŸ-ÊÇŠê;j×I´g’©ïÒ€uøNšøN™ñ² 1¤Å°ö ’@ ¬ $†´„²ÁJ@Þ`IÈDÔ°Ö~Aʉc83õèš 'I ö0žd20äº.Ø3ÇeõCU»Ü©ÁÊà5^+!89À½rí áL!¾€ýÓêâ´ŽNàP¡¢Ä?Ú,Õ}ÞO•‰4Ä%L’Àêóô>8!‰øLlî_HŒ mµT¼i IÇ·o»ÍIãbíÑ€Q½Áòa_Ç«PbžBÜÃѲípÿÅÒvµ[*Î5—t‚ 9ùtÿ Ÿ;µ`îX„qh¸ Æ£ˆxp^]¤ä(»›×‰ˆè8ÈÂ1vq du¼d¤Ø›K¼;õ…öí¢îï¾ÂmÑóÍ&ÇO@ll¢‡{”ð|î‚îžÏ[®öUbÁ—;|¯~Äs³ûúÿüÝjõŒÃÃeŸçÐ/=]”µmÝ>žOÀ|õ÷î©xÔ~¸GDåÉ…ÄÃÚ/H@°*Òb÷K@ ¬Öþ ÉJ,²½®‚;Ê—kCeŠ0 ef¨9¢O'a#ôÿÐ=¼­>ÏŠ€æj‚Y¤¡ò`#yŽô ¾ºF̘ÂZšž©x»Õ-0zÍ5óô"Aòª¢žúã|Ç :ü*œö™¢©u]rÀÒÞ $ðý©º®1yÅk]0 ­*Ê-˜²¤eßFÊ‹ôÒ‡ÛG”ɧí€Q-È®§Ú¸sè³yk£¹‘‚¢jóR«Ê´ Rg#áF)w<åœQ#mXZ¯uTf¢)·ÐgúÐݸLcœ0}:!Ü×Èäw OhÓT4<ÅÜJ»÷•Lô MóùW:|þ?݇-ð<Ü}rKíEì€ñB[ånºæßàöÃܺ>Ró¨ —Ý2nõ>$"¢“ ÞZðƒ!Kó'Ú™#ÎïÏ^öã_ºt‰.^¼8Wg€Ÿ-«~ÙXûI VOвÃë^T.^¼¸´úÀPv@°æ([ óMæ°°´7$³B?î×<+Ò\¨’ çUv3×Цªø¹kµ.Î|ô^nvŽ@ÓͨïL[ }èÔP\ i> ÑLºs¤gTxº);+šw<Ð'Î]F˜ÍSœõ&(ö4=‡÷wZL÷؆҃Ï[ V=í5 fs[Ñ6‡ª£ÚReàhÂ4™1Í¡ý›-V–#U î•BŽ"cˆºÓaóV¤+ V™EƵh.¤Ã@Q‘^ruƒáéXÓŽ¨L§LkšÜOU¸§ú Á IDAT 4U¢)¹Ûªü68¸@†#eºjÕ9myR¯t

      (öHçvªL™®J@…ç9幉†[å¤llmµÒl(•WÈj54É4iÔ­ ×MAqçºê¸Ùa(·{}¦Îºu¦¾ª#Þ€éhÅY”Ÿ[e5W¤MY uGDT׆¬D¬<;²yµ¨»0ÍåéM¬IÀŠÅ$àD·´ìIHî¹üŒBHažLÑÖÑ·Š:ÌùT×Tà÷÷9]zr„Ï×ךÉ×´ÁTîŽ×6PÐŽù¹ïÂFl«dû^ÄÏ#ÉÕçG«|~ ´q’«r_§ e*so|“ˆˆj6a¶€ ´ÊÏ; gÖÓ†u[Œˆ–´ -ƒšû,‹@ ¬"ž´Ê®,T‚¸xñb¡œÃ:óÿÏRÙ·@ , OÊËìúì³Ö/«Ex àÇ ¿!=é×<+%²C-ÛFus>{ Q~€“ƒÉ}–AüÄ0Æcþæ¬à´`$Ú7ʽŒ\ãùWú¼Çj×…J Iû<ˆ•”É‘š×‡f ÍWs¸–¥éLð‡±©¬¦øý8)—ÛÚä2sᤒæiÃM bI~’bGÉÃëbHˆ’áD'ök7Ø1`âCŒ¦îë¶–Oi?˜—R'k ´9+:ÔªÃrš¯±lÕn À)Á×±«­í«E]:å¸L¥¥¤ÔCŸãB˜”/¨dyIÌñºöI–£Óòåİ‚Ç"ÓWãÔ‚;ÂHÐ×ÖÏÆµY Žp<%]ï6ùþ/unå}m¶{Ì‚[Ç11áxª$Øï8N÷ó›,¿ªñ¾ q§*È݇º¿7vÓ˜¤ƒz®®æÈƘÛ:Œ·{版臈øy.âe·–Cú4õ@ð4BܾƒÄ`I|H‹aý¤Œˆ ³ƒ4Î Í(ÍüvÉçµ}ÌwTN¹u¨ ·çóÍȲÁüÔ84 ìÛ¸7Ì´ Á QÕ(߯ëc0Ÿ®IÝ é;Ó “P7†n ˜R«$@S•å¡‚®#W¯ÎÔ½Tfœ@U"}VÕÐT!8 ª.Ênð±gºÚq UÑüÔäQB™±‘ŠÅ#Þ’XÑk (ÅÉ蜧h¦ý½óEݱg¾Y”Ä<Y·rt“»É)y0à­´Sº3̘¶:Æ6n_ƒÔéš¾ÃÜLiè·†¢[¦s=0 MÕ…­)žy|}ÜÙoŒXw:l˜Š0ܽ떫ÅâH)·¼ä0—¹~·ÁtÒxÊ*¸z•ûXÓ;ý—•q¸FeÙL:uPÙ¹m¥RóÚì"лù³Ey8Pôà89 ÚÄÔê%}ÁcSƒSçº3-V¡ÝÔÊ7l¿ô¡1_b¦?#È'´éª±¸dÆÀ¿1?R³ iº 6ÑÚfÃm6ÓÎäy2'A[²±ÖŸWæ§{'Þp‹›|m‹Ï³t> ÜøZ–‡iæsTá™/'<4\M­™v<|>*ÞjF¹6f ‘isÕ r(mu™Þ‹4uTxSe¯Ïy}êZÅ7xSfL_·w>(ÊN[™xæãÈqx’]¨'L>Ö_gcT¯)Úp`6^£ÍU!†”Ôæ-r†ÌÉÛÚ‰a&Á B˹­&Ë£'>Ë€ÍPØй&QÖáv…ÚÄs»Í²í¡Ïñ +R·ê<Øhãâ–Ä \pˆèU¬¥êrÜ`ÇvJhk‡†ÌQQvhCÏ0—0?uë*â@|$œçûjóPÜP–}ýÁ‹DDäãA»Åf¡wï}¹(×::Þ±+Ä®Ï1CÚóùóJ•eåᾺWýÈ›ÜV}´[F”BÒ¾;L<³‘jo¤¤õC…_óùØgµ4}7ⱌ N×ðT1åc’/ëøç1è«ÇϨ©M_\ô­#Ö~A‚UȾƒ,H@°$e·ÖAsU¤áfÜô¤ö¬2‰6þ¸A“PÍ8å¸é˲ëÝkºÍCîK‚nl:ÞWF§í£ou] úŒ‘)қؓO)ö·‹º Ü븖Æß£X¤ô¦ qoo~¤î{&2ø¢^öÕ<@Y¸‘¸ 5•iÃ9çêü oOw‰ˆ(Éøódç#-ýR¦— 5,=@ ¬Öÿ I VBÙ-†µ_¬œ1fÔnØscΊÔWY>¡GˆsБµ8Fß7?ˆ4}Á|JàÚP\¯ô¡Q ‚ÊoF7Cß=tO"¢*Ð)Z‘7“{)¶æÊh$‹©ÛÓŽPC§ÙSnXZ×&¥Èi3Ó>îXU;!<2u”aêuMÍ “DÌ”—­Ujíæ>_(5C³Y`þZ‡\<õCS£`#"ê?xiîº9ŒËdÿ¹¢ÜÜú˜ˆˆH§îCŠq×ÓÜ/Pv¤[¯kÊ­íÍÓWã ù–¦Ý8,´<æ›=ȹŸøü 8= ´*r hÂ×`,jmNwê> öBƒyða¢Ú:IùZ7,h‹6Wý!(jƒ{/n½@DDß¹ò:•!Ö¹°3‰ž85,¡ì@°Xû7$@ XH óÅðt,H†%ÂÞ”)îðmiª²¯¸IVŸ_¦fC”š°•ç^BJpÆ(uþ^¶Å¤SÂsp_jÉU¤±fhKͤÍPÈîiÅ]ùeÒR¥¬cx_³ÉµÆ“ƒ«3Õ›YAQh“7˜2딊ËE^½ÎÔT|Ÿ7{T»¬B3¹‰*v7Öú&gÜ¿?eÊ ©¾S6ïš‹(á6×ÀR‰S¾ù[ers”}c<ÉœW&[§‡’ ôà€²š»B¼ÇÜeßhÞjLS“‚` §ÀÕm>@–ç¹u IRž²¸ç#i¨æŒ8f0€¡é–ú|À1 A  ¸&&ûs@žhsÒV÷FQ··{¡(›xÕ(ä¸OdÝU£É@¯ïBÜg8R±4WµŽ—™¸ÊýK½1Æ“!©I˜NøØtû}zAÊçcâÁ$PqÚ:Yª}vKÅŽ®ú·ixOê©ëDÇ“¾p”ïoâFDD¯´T<ê¿¿Æm½;ä$Љ–ßsØÆ6›³i(‰ø½KÛú8ð$.]ºD/^œ«3ÀÏ–U¿l¬ÿ‚$?æÀë^T.^¼¸´úÀÄ`IÈsûPÿ;‡ùÖò8±2oH¯¾újQ~ýõòÖ¥H‰©¸ ¨¥Bö uH¯™2ʾe”ÙŒ9«Ñ…ÃERsûÊ?7snF^âô0ó9R‚æ8ì*ÈÑÑiJœò¹»íó!«ÍçS±´C>Ö¸6T Ùàúæü™|N@ßU*`žZSÇÔŒ›ã;DDÔù ‹¹™Œ+…ç´?cqF éåøKK¿æªbe¤Ï´ Á â0dßo:œñåè‹K¿þ*A(;@ ¬Væ éGFNLyͨÅà†MÀå7+¡ïð|Té¹Ö|k{¸/Ì(ö¼’Ï1yI[fò8™c‘2Ķèúd‘ÞÓÇÌänÂûš30R¥É)ÎG R;ÝVõý)›Ö¦ïÈ8=TZwŠºÝ™ÜGÊ<õ¸/ yk4ä|H^çÚ\û ¹7<[ÿŸÇe»ÃN÷|Žˆfó!]™2UØÕTÜ.ºœ…¶«U‰~8&"6¶]&Dö½ÖA‚Á“JanTv¨€3 9ƒe×dA‚5ÇA‹Äa×/² Á’KX~!< Ò#ÜæŽ#"JK´Ø91Y¹}À±æZ(5?È9Ü„E¢šKú22ýÂë—$œÊÖq\JâU3®æÿàÏž …Äüý1ÞebD ² Ÿé¤z*ªƒì{RÊÊ¿ð•Pwì‡ ãžà‡ìð ú†cÂ\†qȱ?`'‚Oº>ËÍ“„¦RãÌWñš;ÐNÔD,÷7jµ ™ŸŽGìbPí°k„½û"ßKSHþ>;I4áX“,/)u ú,ÝFŒwMB‹ËS;ªÔ“ :MŽ=¥ºôÕlþ"\öÕÞ x,vûg‹r£­®µSugê, oVTnGüyrú¬ˆÍ^œGbH‹áéX`ð¤bHO dô@°xºÞp?(5O-Ð3o#ëFsÖ²k%%4 Ѭm‚9Í]Ë$àødpÃþ£\#ÊœPÊ~¢æX¤K$êö~·ÌHçõù¸ñÚgkz-·Ð©›Î·i&Ya ¨BíÄÕ€þ½zZUC£WDÕQëOXªÉ߬H rV-`¢:$Ë‹µ{Òh7î½À]Ц°6ÈÆ-| ºŒ†§-7_½õ…™6¹ÓPŽ– » ö‡ì‚P«³´}¬]ŠD}D”‚+Rm·ˆ(Ðn•:ÓxÝíŠòy-£¿2M‡H£6üCÛu0…}³¹[”wô6‚ÛLó}pïóEÙÈìïƒÜÞÉ{¬®èó!÷õ·',g÷4íX)ëó’ oH‹áéZà B¤Å £'‚•Àú¿!åÄ”U†yuJ¨¬*Ëw„çã±a>{Ñ,ufŽõPØ”9<äú`~" Q«Ÿm-¿Uq-¤Á ÝöÛô•q3y˜¬Ù6Ѭù©¨Ïó2!ž‡~®`´jò%/èŒkµÆ]}a “r›Ë•©VP¡"\â†6_š®F­C³Aûrpzزa驣вŠ#¦©ÂÕ^d«5«øà•º2UÅ_ÓAïù¢Ū-qÂퟌNðåŠ*lo\)ê ÿ±¾R†¶Ínò U=¦$#—Ë®§è¯<á¾öÀ•áêT)âî€ûC± /.ÊŽv{hzL©=Sç¶´*êÙ|kŸûR«¹/‰Êm„*½Öã ýoµÔD{sÌsÀ©ð„ BEõ%ïiÙ•ÝbXÿI VBÙ-Y`Ii1¬ÿ‚”çLµ9å¯Ë¹VÇYe9’ˆ˜fš¡ìJ®5c¨Zr#Tá4/ËšX¢’;¦­x\™lIvî‡ï_PeØm¤÷´oeÚ:@=hŽÅtêphVbžZª„ÄójÍ«%÷ºÆN¸\½ÂÆÝ´1¯˜sA¹ÁÆUCÕÙ)äsJ¸Ümp^Ho u`³k½Æ&Ÿa_™Ž,ÞØº³O•òˆJC =W]iÀ&(Ï,/h<`ãR·ËôÝèÎOåF}8sÑC¹™´ÄÓ¥g+Ól{~ w@7NjsŸo¶ØÈ5lß,ʎγԄÜIïÃæçŸè¨ ‰æªØGC×=ùFQõ§7ùü×÷Õ†ßlòmBêw³X­¶ºXÿI Vò†´dA‚%áÐ)»§üåN–s@ ¬žª7¤c8(‹6Ë.Ê‹!îb™¸ ÆÊ~‰À99n¼¯ÌÇmfî_6Êù#ÊX—•HÄë}ÄD|¨r-‹ƒa˜\r­ôµ§Ä€L2@lÊÆ#uÆ…²ȶuÜ“þ¡ëCŽJj-G§†™Ø—ŽS¡»ƒ1 ?¨é¶ðç&VCD”i‡‡Ì“T0rÅ_¾-%îCÜÇ\ŸÔî!Ç2"ˆ»Õ:= L}óq™ ¤ÊºŠÅ£S||Žïý¡’P7:·øPˆûDÚpÔž±Èà‡<ÑN]ˆ p_ÐØÙøµ]–°£œ½ÖU ú<ˆK¬ò3ØÓϰqì­R娉g]/ê’ürQöô<û™.ÇÃnNùúÛz öªìz±lÈÒbxª$@ x¢ÒBI –‘}/†µ_òŒ(/Ë1„”™®Ÿ¡é@"ž—˜¢ZèN`LDA6n¡¬ZçC²fè°Þ­ ­h@ƒ™êðNÎЋÑ“¦õr3!Ó¨«–Hã‘É,ó¥|ýˆî (7N¥®D3í6T]eâ•kL%| ].»®jx’ò”§L 9Ú•"zÛ:óPϘ›‚„eßÑHQrY“é"“㈈(KçÝ`ÞºßWF¦hΊùŠ-…¶Ð³ 4ZšòÀ9&·š«%Øn+eÙ$d5¦8¯m¿«î9Ž&wÙÁƒÔì–¦pëà®Ð‡Ô熪slž0y 樉ê+æXêO™Rko(W…QÌm !…9öÑPŒwÆL£=׺[”:ÏÔK›×‹º?ì³Sƒq›ðSV ¾>d*óLMQ©M˜£¸iT4%h?râ žÖA‚ˆƒ,H@°,H i!,uAºté]¼xqæßX¿T¤TÐX9RWq‰¢Õfeó¦,í9{ gÏוÒpP”ތ髪ì0ßP‘û©¤}D<HÎPvæú¤S/É—4“®Ü4û Ê6sý7®ê³˜6È./W|g®ýY•ë *úúå盼8&×QéÎOifC1*ãÚ|±šVž}Þ êVYÙ•j£V“ˆ¨êñç†ÆÊ@Ùæå5¨¼=• RfIÀy‰*~0“ 5wl§Ëe6†ªÎš.…©&’›Y«.·+Òôe èC(Á(ä×õæÚMPá­2½h¾¦¿{ç<·%`Å QéM`“ñÛÜï MuìG«äiЦJ¥—&¼Éwé7¤…°´ óC[”@°öXÊr.‹@ zC:Ìÿžr,ü†´¬Åèk_ûZQþú׿¾ðõà±ã Å ,«þqa)”vâG] Y„LØd&§^i‚=t-‰›ð$/‘ZÏÄJ²¹gÝÍœ¯c3±Žl^vm¡cB™;B6£õþäÏñZ›*3jE¹¹óÐÿivØ ×†2‰=AÀÃU"*‡¡C¡sÕ´†æ§óךqË€Ø[ªûå1:” ìs`2áKÖUu ißäæ3|]ä/¯p[ïŽåfë>Ujë¨Ø|lîªIN8V‚²ïj¤bLNã>· ãIp­XÇÁâ°SÔùnËFcˆØ‚ˆ¨ òý3DDÔj=àûC‚½Ž>¶É1`dÝQï""º 1¤ËpÝ/i¹{“Ìmòù©–“£ëņÓ󽱺î‡S^ÇË|¬Ï*I:¸Î8(<²¬úlj…¤'Ý@ Xˆì{1ˆì[ –…C¢ìžu:~fÞnðßëŠC[žÄ !#gј³Æ%¿F‘R„ós_»*à)>;-X¤‘2l·ØÈÔΦB^[›‡Ú?ø­Ós†~«DLæ3²¦=ž$˜/ÉÒÔ“ RïäÕaÂj™»[åöW2Û«|I쎰;fÙvUSrVÙƒ#¢–n š«:ixÿK|­æ¼¡i×a¹ø‡SåÀÐÊð6ô«âªúvû2Nyr_h©qýîèO×LSyzÀ„[òG‘eàãHéŸO¥µTÛ²°ÔéáAX×AÁã‡Pv@°,H i!¬ÿ‚”åõt`Ž£J –—|u9š|–ÐÂh¤Z8”6ÛbÚx€Hδ{æžH³iúnæþ(²3÷BÊмDe‡”¸2Z1‡ŒÚ÷¶`j÷•Ý ¥fŽ=À!#zÂÖʵ¬‚vPÔíÆ|Mh®jè¯*8ÄûLzi@œOH™ÅÚtoÄʶ2 9kœðÀ6t}ÔjÝ&ÓhÆT5Kxw"¢DSj˜ÞÛksŠòmPäÝë+J.š*œ²¢îôñ7‰ˆè6¤·lã=ýìÙ¥}¬UÔ¸ðÜH´M8Ý:j ÛvÕC°A6nƒ¬ºHˆçÇÀâ9 ë°-Ž»ÄÐXã&‘»|¯8ÿªá¯¡Ï±”ÊDÅ{’:·Ï9†ÔÙQ®6˜„¢C–Ÿ)ÊÓ@]˱uu}§m%ÁÎ3nŸ°M窇Tw4, ´[Åõ1_ÿ D’£ïNøþèÊ`ÂlƒÚЯd¬bSõã|ÜqÍW1¢æ+ŽQaªz€ëÄ2 ÒbÑÁJ`ýß`E oH‹aý¤œÊÍOË=Hjm˜‘R}7•S~e×Gšé¿××yWˆ™[•˜«ÎäV2wr[À[NÈw!6ãKs÷š¡=MÐõ hͱHùáh s&‡ÒLî%sÔ!Ýí¤®û•âÅà<ÝÇ™¿ЗÊTQKÖÿßÞ¹ÄHrÙùˆ|×»šl6I™âC42­é!ž›†{3[Þc¯½õÎ+ÃeÀ+m¹ذ<«`øŒ Ð3I‰¤(6Éîf?ꑕðâÞÿ¹7*«:3«2³Ï4::7nDfõ­8÷Äùëjµž4T†« …Ã[QœôTžëÖŒ¼v5’’@è+Þ¶qªâÄÊw1ضw›j>=3í&}MwHwõøaçŽéßút~§XÞnt`½‘ßš‡j¥®oi%—zWA:Ûÿ¼Xþì˘6¡nZ¼??ÅkGÄ—ÿΡ_Uksï4!£òÙ+‘b*~ µƒEDd¿¡ [°ëgÖþ¬äiª¶o—±ÔpUHs±þ!„¬ æ‚wBÈJ°öOHyþŒKÌ(aîÕÂÄ‚@ùkÜ^p}™gl÷ö Õ[¬£ÎSô†á]§ÚQÈ+‘ËxÚlú¾á½Œ\*¬ÚP¡óù0ð4‡ðÖ(”:ò]®Ê‹–0oA­›?0[» dº¬×bƒVS(a^éêrlë á/¸èâK·õÂ]øiµ¦7õ†'[ k‚T˜ÚÔ„!È\ý±&)dM—j«÷r·¥õ”ê[F>‹j® uƒ\ ªˆÊ* Ñ?þŽ^äá/Í9ûb:ìß*–·jFÃT‰ôõÎÖy¥¥éÙ~]û½÷e±ìʨ£¤÷ÍÖ“b9µ÷+/O¡Œû¹i÷ÉŽ†³þ¼£ËgßÈ’_ ´ýjUû=°eÞó ¤/Jvó±ö!„¬ Ù’ ô½(ðîBY 6ë å¤P #(õí×è ½‰eÃg8ã’Àñ“’sÚ÷œm¶-tÎáñ¡@T¯´’s›¡ô–„i…ë°LjLZ¤÷r°•QÞÄzJ#¿O"¾|W\7Þ«¨äº­<—t1I‹rép8”#O­ÚÏl¨jÒÑc&;Ó’ ˆÈ~˼¬9Ææ'ú2iÖr ·zxy*¿éµ F:2?–Qª|ÜVIm÷ålõ˜ÔFÚkê‹£OFÆQvr®/®î¼ö‹åfÝì;¬ª3o/ñvGFžÜêõa9s·|u‡b÷ÆpÜØJ}û;÷‹u)H\{¶¶Ò­§Úÿm•üF½[öúôZ¿»­îÀŠÕÖÀ1¸ ÷¥[sáªhë\,”ìæc³$B¹A8 Í$BYæƒwBÈJ°YOH8¼â³u—stVëÀ\Ž×VÞî…ŸZ¢P¢ˆ& À\ŠgG/ö1…xç·sPeý .„`Ð@¸ª7o4œn+ºÊ¯5³,äÐ×怢ªµeW`;„ŸFnZ ü’?ÌA©å“’al×é1^ûáæUÐQ•Õ èôÄÌí¤ÛºnwKçhµª—sEÿDD&öýƒ¼ªëâhú;–A"Álß#L"ÈÌÝÚ{¨«†ûzÞèž=~!£@øèyW­à·¡/_œ+vŠê¥=¯B»xœ˜© }ýÅÙ7ŠåØbŸj8,>qTí|Ðã¶Œ_ÿ¨X~jSU_©kÿO Ø`uË܃] Ÿæc³$B¹A2HsÁ»G!d%Xÿ'¤’pUÏ¡íìÉàÊÊUžmÚí[" Î LõlÑîï²_Üyke}½8é!”Záä®²í¾•Îë¾áÍÚV‰k[¬:–÷ÌSƒÜz°j{t”:Ýqpß"tï&Ïì÷L[E"¨‡”ÀýYÝ\D< „Ï>ÃŽ­‡t>Ô¤ BuR`Ò×/ÖCÛÀÏ:È|ÍšÆqœŒ$Xéi›[5•ÄÜMÌÀö=©íÏMžžiÈé7?.–Û¶6R£¥VëQ]åEgqÇpÕöñ·‹å—oÿ•ˆˆÜ+ö°zŸœ¨$·¿oìÞ•D¯õ{äp2vR(Ô©J5@vd“¶àKôÿÎUþ{Æ®þ ê-!›I‹&ñ"—fý$BY8‡4!dApi>Vf@º{÷n±üá‡^þÀ,ºÜ=Wç[´÷™=Fû²Õ:ÑŽ[É® /Æ6:ZïèéÀ¼ÌºÎ< ¼X+¢eÖOÚzþ݆ÁÖcs\£¢ýC_«5 /þ>©óï¿dî×ú\]vcp"&öø(Y^¸êMrtt$""ï¿ÿþÔºy×_ë? BÈŠpSOHGGGSȳëÜ¿¯ºþ:á€D! â&\v71p, H„² –õbì÷w/ž;ºi©mQ¼’•´½9$˜‰Bw! Ìá/?xà~)òMu×ÒP×E˜¨œ£‚ͳ ŽÛEÂsSI`Æ+º8Vp¾ÈÎçx‰ ØW×V(‘A¤(ð'…ÿò’¹1w1´çÃìaYMO– ¡×/´Ûƒí;†byÕ-3Ç1:×pÓxŒóMö”úP«êÅtûfî'†¹– ®ËÍ“¹”‘J¬ãæBâ†ÎõLÚ¯A[0Ÿe硞€ÅüíWÕÑÚÚz$""ýþa±ÎÒ9Ü1Åcm|R,·ûÆ_O œµ¢©#˜ÛÙùZDDÍÓb]Ž;›ùžG]-F˜Bá¿ÄÎý´ûźÌ'=šy¬7·4Uâ“§ßÒ¶ìÜW>Òtˆuágmó]øÃ’æ›–ÚÅ‹1 BÈ5Àcçƒ!„,ˆŒYvs±öRžAÈgüœ_†$r®âºÀ¾øËQy*„Ý·$4ô}ö$?wÈm^h¬Û7”ûìú(°%+{”"½{ì|ÙXw’ Û²*@ášRžÝ¶£Tèîد£A æÚ¶QÖL]¨xjé‹]¥rb¸¯y]?„¡K]HÂý.¬é°nœêÅìÝúBDDN@F§ôZ1G+9Ö8ÊlàhÖQ9¬Vf jíõ ¶×ÒÄ ,E©Î1iªÄqÛÈc/íiRCÿDe°ƒWþÒô¾¸È‹2ØkAläÁÔ&(ìCºÂ ¤QtOÞ‘VM­âo4uÙ)À÷AÒÂrÒ2’aµ›6çÃ/rýu²ö!„¬ 7õ„T6x,jýuÁ‰BV&Wgs¤,àC¹)›–¼Ê~·qLÒ+ZØ&60#ÕábCÝlGîëL8(maêº÷&É ®¡$Åt‡Étg=™® G(ùAg]’C F“ˆŸT V±òBPñÛms}I_Ë¡·à3òÊ‚_á7[ûyú¸Ó޼¬¥;ä}í JuÅÙ¡/IoúÇ]vCël«T5¤´ õ’º=p¦L[£±ž?Ou{œ˜²Þã¾&1 û/²õ£vw4ðT œuh]tO \utüb¹YWI­×3òÙ!”n÷à7Åò±• OúZb}ÜÓÔ…æ¶‘ÜŽÏÞ(ÖÜùY±|f¿ /ww¿*–OÔ˜c‰÷ÃzHóÁáœBÈJ°¹OH„rÍÐö=›5 …dºËl”8Ç}#û²§'-yòŸÛoöy‹¥’@X·=†P”ÉŠxûåÔ=i°ìgÄ­÷^‡ënL—f÷^þ Im^éxwPÉùD•éû*/›â}Ã~–ÑvÝ5¢æKvs‚䇒œ$F>Kð2hgv´UÑ S#Õ+*-űn7Í…%CuöuGꌻýŠ‘®2pËá ¤ÑÊ©Ûv«ík:оÆMóroε¡'ï™ûUV õήqÁ=8ÓTüz} €u²_ÿ\_âý‹“·µ­æ±ˆˆ4@Ò«€ãn2Ü1×RS+äúõw÷ÍyÿÛX¿ís­í”Ìu縺h(Ù͇sB!+Áf=!BÈ ²ü}› $BY”ìæbý¤ü™ÐÔK´O—Ì1í—ØÆ‹æéµó"…=¹¤_nÚ¦¬(ŸÏ) ou˸ÝKB¥2àÏι)ï[(Ö‡í{×êÚ„Ãgü¼â¼ÚÕ‹Ô¼-¸\̇Á|[}úd8oáo³n58‚1œuÒÐ4›fŽcx¬s1 |ÝŠg[‡÷Sö·L¸h§¿S¬Ã$‡Èý§Ÿá°¯sD“±±G'kIÁ*íø“ÌœwܽS¬jÖÕB>l™’¦zc0<µgmß·wë½Ïtß“oê¹ì©65õ¡í};7ôÑ@ç0T…"‚ŽGP¤ðëÑã©í5°Æ&I ‡¦†¹àÝ#„²p@"„E‘G—þó¯ÿéï\iÿA\ÉN$ŽÚä¡íŽê¥2<‡B5„PâÁ¤W[©L† \#&%¶ï€Œ'âËŠî& äáiº¶f$=Dáí…m<›!é•…ÖN¦—KïKæïW¶/ÊhÑ8ðŽåfà¾%ýQdFjËkz‚J{º­ê!Å£énOÏÛ*¹U±í¿¿»£ûf6°´Zoëµ@ !ÄÙÍÛ îe*6@>s$±Êl}$ïëmÓˆÚ¨¤XxôŸalCU[`åBjBǦ=D˜Ëýž ‚ÕèW‘Èo'vñ‹®¦;¤P)®©4‚¤‰…sÉAãƒñCùÛoÊo¿º+øïÿ|yýY3ø„D! "Êfÿùà~(ðýÛòúaCþàû·åƒ?ú᥎+ýelƒØŒ'$BYþã?ÿÝ ·ÿ£»¯Ê­íšä"2ÉriÖùÇ¿÷ª|ñþ¡ü×\x¬ˆÈà£?]POW“µòC^f5wíÂTŠTûágH•¤¤8ßå,ÞØ´}‡î+nwsH“ðo°îÛ(4¯$"X©e«o÷Å9"œ³›><ÒÄès)"á²Þ¤·:‹÷,ÍCH$>ÌGÙãb¸°lÛÃáC³¤/ŒaÞfl ôííBRÄð X~Ò6ó2ż–ˆÄ uŽ(KÌõvÎ4 âoÝþ¨X؉àË`>È%TÔë:/õx¤scÍDç‹“‘Îm¹9¨,[¢—ëòÓØ$ÀÂL ”î!/:”ìæcn» #B!‹`á¶octpN;\·2 ¿]ÙD /yÞvR]©­<ó÷3ëf²ârÀö2þÚPôúúËÊ)Ͱ¥âvw9^8+ÊsE¸*HÃðìÓø¤­í„2†Ÿ6@Bµ×…¬Þ"*–hNþÊ ¥Ä"µäÜx¬;§£ÚÔödǸg?#Ø-«©•¹^1źCç]ØÙvîE£¦VêZÍWûtja_ÔXMT?¬@ jÍÊc½ÊpHGH­dwÒU+øíw~S,GV ÌáwÛÁé[Úo¸ÆvoßuªXw¿§A¨ßÛ¿gû¢R$Z´µ½ ¶òÊ X޳ߑoïjÏW{_Ë[ó)ŽQË]0”ìæb©.;>9B^(^€Ôe¤BYœCšõrQyî κ %2_™”w^9ówÙ“Ñœ\SvŒ“ÄB2ŸiÍU×€Bî¿ å7KŒj”•¼<—]((kUq½u/¢B‚ÇçÓîFï3`á8ó¶Ã²“ýB±xÊÚÄ:NÖd—Ônâš½q]p¶ÍŠÅ¤–0÷¶;¥³ª ô»ÛºÜ2Ç5vôf`ºA¶«2YÔ1βS_ݳwü[SýJ!=!™tÿ@ÓÒ¾Êlo¾ñ¿MŸRuéuwU&;¿·X®Ø>VšOŠuûPbü§&”um%‰^—+a>kÐl-Ök9¨˜{øeO]„ÝÓ7õüÛ÷ED$”BßBŽyÖ_ë? BȪpƒsHÏÎå_5EgÒuX BE¾ä?%lŠÛy³žÊœu!)/´oR²|Éö=‡È=^Ùp ìrç¡ ç½dëÖAûžã.ð‚%Êh¡rê^¿ð\VRÃIi ]xÞ¤®;U™¸/3Ý‘Ø}<Þ]wÙ¤²3ÑÁ}õÊ™»ã°Ê›m8¾Eè#ô/«ë…U+FÃáƒi€~ÚžvñUý©uã¾:ã& ³Åm•´œË.N¼·|µÛ5SO(K$½Ê–‘ÿâXû×´ÑÃö{MÚÿÚÇPW&¼øåù+Åò7vLPëðà7z­4±¡ªØ—O;Zºý j^ò}£¥’à§û¿Ö¾¸r×pžçÝ;½Òm›2‰lÚ€D!7É’$»Ÿ>°¿dü ¼åºu 8 BÈ‚ˆPËæ¦ç} $BY|1v.^Œ鲩 Ï‘îàWf;Í]8&˜´à¥BL'9”ž3&áÍg'…E u¶ðŠÃa[ÉÅm9k»—þ€÷ ·§À¢{Qèºðxlמ7À›ÿCØî>C/C“>$5TÍ|M2„üŒÜq8 8Ð}ÝM³ªóBƒÇ‡ákpçìê¼ì‹ˆHµyR¬úêÑ·´+ Q阾VötÞIª&©¡úv±î¼¯óIã±¹á힦'ì÷tÞ'³}èBQ¿’·µ/6Ua á®ß{ãÏ‹å–=îgÞ-Ö Úß(–{}Ӈꎵûþ[ÿC÷ üüæ/°o«,-çªë¯“c@"„ëà†ŸžDÊ•«®¿.8 BÈ¢ d7ë? e—¯ëSFPZšU[iÖö™,Ш­äj¿,èÕ®Gi ­Ì^jB È-äðTßÖ}q:‚“â¢Fpsaûöd@ ,ȧ­ïQèü"úyàºP©$¼=rê:ÜÁ¶×¦ï7¦>Ä#íuçuØΛYM/_ù¤¥úbb 06¯jgjVêA"×/°¨gÕézHˆ«ä¤;³¯ÌE´ö55‡ÚK.ˆµUÓÄ…¯îÿ°X~t¦¶ì½¦Ùç ¥©AêëØ†Ã Gí×UjܶçB[ù¯{j}ÅîûK[£ID¤×¹],­,™?²š¬ÿ€D!+BɸO. $BYæ‚’@hHºy~÷ÝeϬ‡¤«05$ßy2[¨ýIX+®«Ì…º%åЃ۔‰?¤3\†A—´é Þçå$1,QŽõ’²éu^Z¼½÷ªªmÅ}×ötõ!ñ›rA­X[j8]®¼?-ÒÜ}õcýQíØºBMHgÈ@ÞLºô`W÷†z®t 2Y%v©ꢫWÕ%—Õ§x+»÷ŠåšuÆ%Ðÿ úUI`}>­GïC¹òšMpøÅýß-Ö zê>tµ‘v¶ë^†pÖ-{®ïí© ï>ÈwãÓwDD$Ž–øÍòsñâz" !„¬|B"„EAÉn.6k@šå|›A™[¯TÊ ×µ5ë›ù¼}½lit”ñªè²›Õ¯€|8«žÛ î•»F”ΰ­P‰t Ŷœ¡]‚èÎK×jS4²/ñ‚ó-]ì®ôÂUÑñf_E}4«ëù“¾-—ï²Nê’K3óc·ÛT¹ix e»”ˆÝƒðÕý=#Y¥ ù5Af;mB ¡3#ŸE ©‡úâk㥟‹ˆÈÀŠ– 7ÿ0}I uÒWç\åÖ'¦/ý¯¤ õ†öZgz]ö†âùÑý×°eÖã$P¨KD2{ßZ móçgúâìÛÛ&œõ—m díuÕew-p@š Jv„BV‚ÍzB"„„¶ïùà€D!‹‚Ò\¬ÿ€”KØ~|gg`ŽÄK7Ì-ÍœW*ã9§A«7¤D¡O­â0o”{ì@ú@ æ\>«ÏØ?¬-çú€ýÃ9 Ð91]?—´m?L¨bì‚ýk.ÀWÜC¸Vœ¯Ê+ØI³«vÖ$ƒŒµýzÃÌÁ$¸ðÅÃßž:FD$·çÀ¤†æe’ªYéÍj¿Xî6Í<Ú³¬Öu›ìݨjûƒºÎ%=µ]wûf>祦ں;pÞÝ—DD¤E÷Æ0ßU­šëuïë>ëhšw&ÆŽþæÃâºÎQºÆ¢žOfÌ×ÍÇ£¹ dG!d%Xû'$BYø„4; ]EÒ Ê{!Ií*I W‘ÿ®°¯Zµ§ßÆMxð®?l!wûâõ{vq×FY¥]é Á W<>”Ú€ò$ª)x_Üqx0¢÷¥·e(g7Ç€òó‹ÆÓáuÙÍÞšê ŒÖ;Q ·³˜£-}Ò»½MðnÏ’ªº%‹4ʃ)„“fV¾j|Z¬{rúš?2çªlig2Wݵ¶í¯ß.ÖUšOõº~WÛ²4†@Õ.¬)ð<ÑåŦ•*¥$iáonùð¿Øô‘IO—c+5Fć…Ái.6v@"„k‡¶ï¹à!„•€OH¢2X©3o‘Oø3ÚŠ¬¤6Ë%Åe:š·—¸àB²æÌJ1dž¯zòŸ}u>·š'Ù¹ãÊ$Ã|‰}Îî?¼T j8 úµ•ܾéÍì;}“&`j4pmêºIS~iÛ¤*‰ð ‰BÖšMŒDø„äáš.r¨öŠÞÍÙV ©)R ÿ^Q¾Y¿Áa»nË«ÇVäñtcÞ=,æ›p2-à3 üûW²l/ûÁ´Nañ.›Nsm…æžé£KBp)S} ¾£±±HÇ0דW´È~G2°šcÒB’˜²‰^`g sDYM¿dgMOÔvÞÜz¢çM›""’B iÒŠ9¨qS/ÀKO0òÓŽžNÀŽi§Ý}¹§YM-wÀö]¯ë|Óy×ÌWUk:÷¶WÑù¬Çv-†#MõM†&Ôv©áª7ôb,ÚµEŒÑÁ9çpûû*ë¯H„²(nÀö}ÑÀQ¶íªë¯ Jv„BV>!-§”£.2éÁý 1K˜•䀠L£6uÉsžÔéä9¸þ`í¤’HžuÞæ…¯ÂöñÅŒ¬²ã%*„ê!•ØÆ1\Õ“êÜ®Øîhj³w*V>Ûª©œ5¨LåÚŠ‡zÎñH/¼nÓýýbJ_1ÔNÊë.@W/kU¬í»ºõu±n»ñz±Üï™k8[øPÏ;²µ‹vë!éä½í†‘Ú*`ûþÕÉ›ÅòÝ—MÉ­‹$"’¦z݉­C¤ÁÂ~ǽþÖÞWźûÐ~j¯;[¦í›áªsÁ‰BÃUç‚!„, >"ͤ¢4Õá9­¢ WÒþÌrèî°’²BžCe ]vé´ V$.ˆH>´‹’Êg¡rèpÅyËÊ¡}‚ó£Ì欈 m¡dç…«ÚvQód:§(Aû“-í¸û¡{rvK/K}pÛAž Í ’_ê)_Ÿ:FDk+UÀe‡5†òÔ´•Cøêj+Å©Ù×Oo€ë¶é )$=D ©aés'5Ž:Zoi»¥åÌ]éñ!8þP^KSsŽ~[Óú‡šÄðNÓ„·þÉ}­Á”BjCÅ–Yü‘U‚!„, JvsÁ‰B»¹à€´äe/ƒÛ§_fY/ Û-Û×5‹’¼xêdG¯†Q¨¨¤ýÂÙV²=ºŠ?ð¡Ã°ž:òÜñØf襇(¼ì×Q2LíL\Õ“¹zH(9&]Ðï4Uɧ/&kÀ½†sU*Ó’ÓþV»X>y¢’W!5Ú÷ΕꋯøblV37´‚õÔ+ê¬Y¬o_:‰"µ6«ú⪓÷ œ5};¶´zužZðo’˜:P;Ÿ¯aËÞï×Zz̽Ñnp_²šp@"„±¬´ïH„²(è²›‹¥H7‹D!× ŸæbiÒ*”ÃÝHì¼G„!§0‡TX±±Ð\æB¡¬¸ç`ê3æ¡ì_ÙQ±íÛX8Ð-NJ&†Bplkˆ~s›H€óFäèc4€¸Î”Ì1e ?µVæxög¼ovºÈK‚€~DZi«ÞФ]·qA°Î²mŽ+µµ?ljzÍÇ©ÎQ¥Ûº¾zf,äµ*t,Ü•mcv~¯X׬j¿F=c›Nš:o„¶î‰µ{§¾ Û+1Þ{<Ì!4Îô¼Óï/Ðê=Ö@=k??ù–^ßÁ½bùØžêd¨A³IK(rÛÇ(⨱ªP²#„AÅn>Vf@z6>]ä²2_[rùrön×Wºàâ§‹¿¹¸¯ûåmVþü’ç55q]è%OSÅÓ4€ÇÉÈþ& 3ï 'P~ÂÛwhŽ÷ž àº2W¢Ü+;÷–7|j‚—Q]¹s/Kî«{—ßïÄ—Y£~à ®%kÃuÛò¾Û…ûíî+~¬UxŠ­èSAÑfû\÷í¹7–aû©>¡¤©9~˜=ÕuÇ÷ußsÝ7ë˜'˜É±–|NËInÎ;|¢ëÒ®~HyÛ\L«‹oðúnòéF˜»×Ñ—]Óc͸+ŽG`{¢Âо°Ú¬÷bøúÕ7ûªz-§ðä÷À6Û>Ö6Oô\éùS{}ý©>-Œ’²0är¬Ì€ô¼r^&&™üÙ‚{#ϧã1ÓJE9¸ï°t/BDDäÑ3_„ûïÿ n‡v¼ÂÏÐG—Þ3 öûÁ=pûïS[¿†å¿†åÿ\,݃µ¸LV•!díáôÔ\p@"„Á÷æciÒ*”Ã%„k…sHs±Ô'$B„B. %;BY”ìæƒ!„, HsÊ;&„B®>!BÈ‚Èij˜ H„²(f%¬ á€D!‹‚Ò\p‰BÈJ°R(˜•BB,óÿ‹|’/õϦ³Ò&òÞ{ïÝt–¯k½ØÔëZ“%ÿ)áèè¨ø³Îp@ºwïÞ½é.,^×zÁë"ˆ+~êþ¬ó DS!„,&5Ì$BYÿîè2UªH‘øuNo„u~Ä$„¼x¬Rp´“ìÊþ½N¬ÄÒºÞŸ•ÕÇ7 EµÇUvD¸äâ Ø°þ{䃪”àÄñCxøáŒnÆ·æeÉè¦ÕQfθBu=ÒRpÇm7Ý,"L˜0ºRl–²l½_ïa]eÇÕvdE’$aäÈ !„[s©aÃ,ôîÕM76%ë Â3‡ÄUvdeÝ»w†PµÉ'?¿À€ÖýaÜØ‹áÚ¯ÉÌH¦[Ô@d6ãÇÐ œ2 5D7v˜ÿ‘:Qä¹dâ¡]B+IŠ­!òJNNÄ…ƒ{ëÆ&K.j`B"ªB›ÖÍѾ]sÕ£ý¢`B"ãŒqvI?6aÉQUÆâ·$ÂiÜØÁU.¬áQ„?v„êçŽw¡ß3% µØØ\4¢ŸÿØGHD¥QÃLôêu.T¿“Æ!‘1.Ü ‰‰ÿ± @âQä;f îrïr8B"cL;¨ÊØX²#Š(Oè݆Å !QøÙí6L? ÊØX²#ŠYõÓq~ß΀ê?éÈPÃØ""¯º!)!¶Êظì›(bŒ¾¨/$¡:wÀ—“…ßÅãί6€õÒ‘®K¸è媲QØí6\oÅ‘KÆöõn Táøè³ÕšÏÉ…Ýnø‹ziâðƒ…«!TE'>™ˆ,-+3{Ÿë­ÑW8|òæs÷²£0Ø·#ê¥%TŠÁÒ’R,ùjTEÑÆ§õòçˆ*š0²·wn¨Âº}¿Æwi攸ì›Âiêø~š\º|ŠŠJ!6>-˜‘˜ˆ*˜:¾¯·üQÁ‚O¿…ªªšÏs·o —Ø;Æ ÏÖÄàŸ~P6>­—˜ˆÊÓ¸úto¥YRûág?@Bóy™‹(L†ꊔÄÊ7Ã;±dÅàMF¾ñÉ„Dd]“Gõ”Êõ¶]‡°yÛo=Þçkœ€¥p¹dÔyšø[ôÅz””zwûV=Í×-˜ê–rssÏ~œ““Sç×iÒèó4e¸>_!I·D'IRÙ׉B#)1c.ìªÍÅkÏ~¬*ŠæëV\ö]ë„”››[)¹øþ½¦¯#2R‡ÖЭ}ï=,Xä½è…š¯Þ ,™(”Æ醸[¥ø;•_„å«·œý»(¿ÿ¨.j ²¨©cÎÓÔàó6ïî}GÏþ]õx4½N ªÜðŽ¨Ž¦Žî©‰Í—n€ËýǪ:Uñh^#Y0.CžrrrjT²ËÎÎ>ûq^^^ÈÚETN’$\:²'$ŸæûŸ¯¯üBUä3s$Ë®þ¦ɪ—Œáý:hF?ï~¶¶ò U¿!é¨iÉŽIˆÂ­_÷–hÖ 3‹ª |°´r,ªn6Ÿ+ÆŠuz²ŽIÃ{À·Ç³ÿÐIüðãîJŸS=ŠæuVŒL–ì(ê]:²§¦ºrÍv:–_ésªGѬ¥µâEOÖ1}l/í¼æâ PÕÊå8Ý9$ v–B²rµb‰ŽÈÌâbì˜2¼«fÛ•w?_§y­ðy TÅ’=YC‡– ЭmCM̽½H›º[Ðæºªõ)й¡šÎ!…Ó¨ó;"%>¦RﲨąOVlÒ¼VxHöÊ}8É‚uz²†™cÎÓÌ mÜú;¶í=ª}±ª7‡ÊÖ…FJvU%¡@^Gd´™c²5¥ŽO¾úE%.Ík…¢ª­Òç˜(l²ŒÉC»hbóíÅt_ï!qQ‘e5ÈHÆð^m4ò›Ÿë_ôB碷à5OpAÏVh’™\)Þ<ŠŠË~Ô}½ªh笚LHµ¦èIˆJw¶þv$ßü¸G÷õ‘Ò %ó›5F»ÐfÉ·¿âØ©"Ý×ëß²æ… E%I’pÕèšý¿Þ^’§YÁTNxí~vLHd©IqÓ¯­&ÖÞZ²Ñï÷¨:±iÅÈdB¢¨Ô«C´iœ®éU¾õÅO~¿Go„Ä|DÁ6uHgÄÚäJ±v"¿K¾ßî÷{8B"²°+Gu×lB÷í¦ýØyà„ßïªÐ|GHl3/ÒÆæ»Ë7Áåñÿü-UU5ßcÅÈdB¢¨“çÀ¤çjîl}±ÿ’àçnx&$ ¢®­ »uMœ½VMl EÕ|;KLHu& êˆäX{¥Ga‰ ¯ÞZõ7êîŠR´ºê¢îšËÛq›÷èÜ{TˆØdB¢¨såð®€ÏÂ…÷WnA¡Î½Gy—Ö²dG¡cÇeƒ;jbìÕ%þç5ËéŦ#“ ‰¢J‡¦™èÛ®1 ø\ôU,f(§zTÍ÷±dGÁrñ€HŽ©cÅN7ÞýzKßå%¡‰MÙ‚)‰ ‰¢ÊìÝ4µöÍûŽaÝöƒÕ~¯~>¨Í£(6ç¢îšøú`Õœ)vVû½ªNlòyHD&cÇ•C:kJ¯|ñS@O}U=zef$ª»ŽÍ2Ñ«MCØü9 ïªÐ–“-›LH5&õoÄ{¥å±ÅN7Þ  $Bh—Ör„DÁ0Gg©÷–ýDZvGõ#wÀϲo Æ&Eë/ê¡©³°z (‰€êÑÖé9‡Du•çÀeý;hbëÅ¥Üý9$+ŽÞ™(*ôh™…îÍ35w³¿àg³J=ú{Ù¥yŦ.’|nC(rºñöê_þz;5p‰È¤®Þ]Ӄܸç(6ì:ðÏÐ]ÉÄÕ$×颉«w¿ÙðÈT®²#²†Œ¤8LîÓV3éûâòÀ&ŒËEʽdýÛ5Fç&õ4qõÒWÚDVÅ;B²þü&E¼«uB¬$UZ›_ìÄ‚üoV©Gxt–Ör„Duð§!]51µf×aü¨÷TØ*è.û¶^ÅŽ ‰"›]–qíàÎ@åk¯®Ú‚"§»F?Ë»´¶ò瘎¨¶§'â’ì6š˜úïòšŽ@¨Ðü+–“™(¢éÞMÓ’*•3„^X±¹Æ?K(:÷zXð¢'s¸fPç²Dþñ¹£ÅøxýÎÿ,Ýrr´rssÏ~œ““Ðk«{Q0å\ØMÓs\üó^ì>–_㟥*ÚÕF¼ÃŽ9ƒ´#÷Wþg™ð'êGH¹¹¹•’‹ïß«z-Q8toZç·j¤Y}”ûUõûÖéñÖ鹨ênZïvH‹­OnEÅ‹«j>rôWÙEÝ)LFd”?îªé5n9t+·¨ÕÏ "¢JÆ’$`ÞîšXú`ýN)(®ÕÏTuæ7­›a™CªIi/;;ûìÇyyy!kE¶Æ©‰˜–Ýð©~<»òç€ï~÷åí…Vþœõ.y2Ú°Íж^š&–æ×rä”-¸ñùy2GHú-íLBÔ2Pi¯E¥x{]Í–zW$aNuwËí¾u«wÄŽÕúgªª66­š\eG'9.×ôëä-±Uðßo6£Äí©õÏU%¿î«ÓÏՋͨÚ\5''' ¹¡@_G ±vn }Dù[¶áXaI~6ïC¢ºhY/wn¥‰¡g¾þjm'6Ëè?ÉzêT²«* ò:¢`»¼{;4HH¨4Á+ðôªÀwõö‡‹¨.nèß²Z9bŽ•àwÔùg«:‹¸ì›È@6Yºy{‹,ܲ;×üFX_BšŸmŲ…_VR<®êy®&~þýíÏuš×,§(ÚØ´b9™ ‰"ÆÅ[£MZª¦§ø¯Uƒòó9B¢ÚšÛ·+ìB®?….7^\ûKP~¾Þ²o+v–˜("HþÒ_{³áŠ=¿cÃÁÚ/§­Hw{ ^ô^iq±¸¾WMì¼´n òK]AyÝY²#2ƨv-Щ~=oÒ¨à‰ÕÁåe‘ʟ㢪Îõ½» V¶UЧ¢`þ5{WUTmlZ°³Ä„D–'¸kÀyJå píïG°jïïA{Uæ=X´£ª¤ÄÆà†óºiâæµ¼m8RX»m‚ôèÆ¦ïCbB"Ë»¨ust­Ÿ©)Y<þí³j¡W±âÒZ Ÿ¹½º!Ñî¨7nUÅ“?oä”í"‘±$÷ è£énóºôÔ”'>Þ»??Ò÷Ž”íY(4ú7hŒ¡›kb䩟òpÚå é{ U›LHD!vg·¾p{¥Ñ‘[UñPÞš¿·î‰ ‰à½áÁóiâã÷âB¼ðkðö¬óGᢢðꘖ‰é­;Á÷ᚯlߌ½gêþ¼£ê(* iMku.:¥Õ×Äæ?~\ƒR¥îÏ;ªŽ*DDÄ&Y‚à‘žƒ5½À· ÿÚ´.,mÐ]ZkÁ‹ž‚+ÑîÀûibcó©cX°gkXÚ ¿ìÛz;-Ö)!åææžý8Ç”çææòqæT+ã›¶Cïzµ—Ø´'%aiƒî²o –E(¸æuì…¬ØDMlÜ·ñ¨¾C¦Ñ[ömEµNH¾É¥ºdS1yÕD¼ÍŽ{ºœÕ§¸·ð4^Þúú|9U…¦ !E·VI鸮Íyš¸XôûN|wô@ØÚ!ôbÓ‚#¤°´˜##ª‹Ú÷F£ØUªtÜûÓ*¸U¥ú$Š Mx'Rô’<Ðu0d!WŠ §GŃ›V‡µ-ŠÐ‰M ŽÞC>‡TÓd”}öã¼ÞÙLÖÐ*)sÛh7P]qt/¾:¼'¬mÑ[e'[ð¢§àѰ5e¶ÐÄæsÛ7`QèÙT¤7‡dÅØ Ë¢†Šåºê“•“<Òe˜·ÇWáó¡âo›V†½=ªT•%;ò.dx¸ËpM<,9ƒù;Ö†½=ªš¶ø®º³‚'¤šÌ3U4¡ñ¹è›ÖT³%Êw­Çî¢Saoª·u‚FuwG»È´'hâá↓DI–yûRUmlZq„’9$.` ºJwÄãþC ªR¥cÑÌßú›`õ”*buº¥6ÄŒ¦=4±ðÕѽXrx‡!mÒM &¤Zrrrj¼ì›(P÷¶»©r¼¦>ß–å(Q܆´IoÉŠÇT{vIÆCFJå2r©êÁý[–‡l§ùê¨:sHP­×YªSÉÎ_ªéç‰*\¯&4褹¯bñÑmXq|·1Bù^v|R4ûSó>87±&6ŸÞõ=ö—„w!CEB'6­8¿ÉÈTRíqx°íHÍ='þoûWµÊKQôîõ°ÞEOµÓ61óš„ï[‹Žá¥ýáÙ-ÄEšØ„j½ØdB"S¹£Õ…ÈŠIÖì öèî•8æ ÍÓ6¥·_ïCŠvIƓƢr©N…À]ÛÃcð6 zû,FYÉŽ(˜†d´Å%YÝ ú\ÛßÞ‹‡~2¦Q¨Bâ²ï(•ÓlÚÄgibó…k°ùÌacU¢joIà²o¢ZÊp$àá6c5U±âÂ=;6Y\‘¢jïõࢆÈ×5¹1æ4 ù·ßSrÿÙÞüѻɊåd&$2œàáVã‘$Åkêóíù ÆMW¤»—÷ £À%Øbðh« €"£âàHwîø ¥jøï9Ò£ ml‚±É„D†»¬A/ôOi£)‡|“¿ ކöÑÏ5¡@Õ,¥µ^/”wW³‹Ð$¦ž&6Ÿ?¸› Ó(ª^l2!ÕL‡„†¸¹‰v –ÓžbÜ¿ç3S”êÊéÕé­X¡ÀŒÊèŒqÝ5Éè—¢ƒxîà*cå‡ÐÙÖÊŠåd&$2L¢-6Ÿ ›j‡ï¥¿íý ÇÝÆ®ªó¥W²³b/”ª×"¶î?g¼æß»Tuã®=¾ªÎ—þ²oëÅ&Bpï9ãpNL†f‰÷‚ãë±2›!íªŠwÙwåÏY¯JÕ‰“øg‹KáìšïÇ,Á~çIcVmlZbZf_ Mé¬)‡ì,=‚'-3¦QÕð.û¶~žü“ áî&ãÐ##—ðàÎï¢HuÓ°¨Bhc“ ‰È¿895šd$jz ž^ƒe›ŒiX€ôïCâ)4v¤ã‘FÓµ£ ù;Jß¡*z±é»Ùª0!QXÈq_ƒ©hÓªOÕcSé>Ì?¾Ø˜†Õ€"Õ·×iÁ^(U–(ÇáñƳ/ÅkbsaþZ|^`ž{áüQ±É„Daq]½‘è—p.Ÿ þ„§÷znß™*„¦ý\ggmvɆNGc{¦æßvSé>q½tcóûÒxæÔË“Œ€?æ*Ŧd½„TëRNNN­–}W÷Z2¿D99é× CL;ÝIâm®˜òy”ˆ’°·-”TŠä“€,xÑG²†ö˜—q=²l™º±ùuñ·x#ÿ]ËÏùR!4±)|cÕêT²ó—X*~žÉ'²4q4ÆŸ3®G=[ôú—?–þ„O½·…WÓù£@Àãs‘«¼è#U÷¸n¸&ý*8$‡nl.:³ŸžYdéÕtþ@›œC¢HÖ/¡.O›²îÿuÑJ¼Ÿÿ~Äõ>Ë©<š¥µÖ»è# ãRÆaDÒE ‰M*Þ=ýV¯ãÂD…ÐĦbÁÑ;U+VŠÃÔ´Ëp^BoïsW|¾. ðQþ¬*\‘½ÏrФí…Z±,IÒm˜•1-bZév’JE)^9ù¶–n {ÛÂIÕ½3!Q„iÓ33®A†½žnM¾D-Æk'_Ķ¿à?uzŽ “Ð SÒg VŠÕÍcž£xùij8â¶ÖF©µ¡›V,'3!‘.»äÀˆ”q¸ Ù[Ñ›:â>ˆWO<‹ž£ámœAnX¿juIr2&¦_Ž.ñÞ›èõbské&¼sòe”¨ÅámœA„ÐÆ¦bÁÎi´Œm‡‹3®@={–n~,þŸœ|.á kÛŒ¤»¨Ë¾ÃF‚„® ½1!}:bå8ÝØXž¿+ >èò±/½’çÈÒmÉ™:Ýû€nÄ-\øìÔ[ø±è»¨ºà²gÎø& ^ôVTßÑãÒg El;ú±Y œÆû'^À^çöð6Îô÷²³^l2!l’½“‡apêØ%‡n ºöâãã/à„çHXÛg ܾ½PŽB*NNÀàÔ è•<€~y~-Þ€E'_CIlQUÐÆ¦;KLHQL‚„Ž ½1$} ’méô{žªPðMÁB|_°jìûU[*´ ÈŠ½P+°KôLºRÇ!NNÐK(Q‹°ìÔ[Ø\´ˆ²{Eª&6­XNfBŠB$´MÈÆ€´‰Èt4à¿çyصKŽ¿‚cîák I鸨!¸ì’]“.@¿ÔqH°%ð›ÛŠ×aùÉ·P¤ä‡¯&¥‚#$²Y²¡}B_ôJ Gcþ/v§Z‚ïN¿ŸÏ¬„ˆÐ]kJÐYÉd½^¨ÅÈqè’t!ÎKx9 €ÿØ,ðÇŠ“o`OÉOák É ØôXpô΄âlÉèœ<ÝR†#Þ–@{7û¶œY…ïO}€¥ \M´€Gö)ÙÉÖ»èÍ$Õ‘…®)ÃÑ9ùBØ$ï¯#±é.l8ý6æ/G¸Â×H šØT,›LHKB£¸öè”:­{ŸýlU—ñ’ÍXsâ]œpí}ó,H€Ë§,â»Ô–ª'Kv4OèŽsSãœø.¼s—þg'¶ŸYu§>D‘çd˜Zi-j„Ä&R„I‹iŒÖIÐ&yìÞ… Õmsz¬tòN~ˆƒ%›Cß@ S%·äû9ë]ôÆ×­“ URÄȉªÍ}E°ñä‡8åâfUThcÓÃ9$ ? é±ÍÐ,©š%õF²£áÙ¯TwËêñÒØ|ò,Þ„h^¡(Nß^(çü’$²âÚáœÄžhšÔëlI ºØØ_¸¿œú§œ­BšØt3!Q8ÄÚ’Q?¾#&vE£Äîˆ-›ª.Éy ,ÌÃöÓŸãxIôÝ@Xú%;ë]ô¡”èÈDVB4L芆‰]a“bÎ~­ºØT„û VcûéÅ8ãŠüýç‚I@ÕĦ[¶^g‰ Éô$$8ê##® 2Ú#3¾’bWzE Ó».¥¿¬ÂžÓËQ쎎½ç‚Màò¹Æ­¸´6X$ÈHŽm‚ô¸6¨—Йñç"®lT7/ô‡b÷QìË_‰}ù+áR"ç Ãᤛ¾ËÀ­€ ÉDdÉŽ„˜†HŽm†äØæH‰k”ØpØ+½.ðÝãNÿ‚ßóWáÈ™uP#ð¡yá¤[²³àE_69I1MÛôØŒk Yªü+$ÐØT…G 7à@™ãsþ IDATþ×8Y´9ê¶¡ 6!´±é²`g‰ )¬$Øm ˆ³×C¬#ñŽúˆsd!!¶b#ÎQ_ó*j’€¼Î”îÆÑ‚ïq´à{8=§‚ÒrÒOHV¬Óë‘ ÁaOA¬½âYˆ‹©xGÄÅd!!¦1b+Œ|ÊÕ´{# âTÑ/8ZðŽŸYO”ìÄB'6™üÈÍÍ=ûqd<Ò\‚,Ù!˱°Éq°É °Éñ°Ûa³%ÂnK„Ý– »œ‡= {*bìépØR ˱º?Q(©ek„Pp¦dNÙ€“…ëàrŸ¨õÿù§@hþ|oF4žYvÀ&ÅÁf‹‡,ÇÁ.'xãRNðÆ¥- v[2bÊbÓaKEŒ#ðóÿ¢¢ö±©¨¥((ÚŒ“…ëqºp# ¸{×À}Ø—®Ã÷3-¡ äØ@ýÉAü©LHÖ!@8¥P€Z(ÅÞ„¢œ<…Þ?•ÀSxNžS€Rö(-J¸OçÜ$ŸgtküorQÞ?•’²ø,”ò¸,¬—ùÞØd©ÍÚŽ½ïý3¨I)¼"3!ÿ°y·°‡¨8CT6±|v‚Y-û¸üO¥,Ñ”nïÅ-<€êòöU§÷O–Т“ðžRR].á³ÐA-û\ù¬QÅØôTŽË³qêò‰Í²ƒ ‰^ÇÞœû[j~ˆêC5ü+"Cžrrr¿ì»`Mè߃¢—ð§WÝ "}knA­…e„÷Q(YïV^""ŠHLHDDd LHDDd LHDDd Ÿôv~ 2Æ&™•Q±ñ ‰‚g̘1F7È/Ƨõ1!‘)0!‘)0!‘)H0ÑNŸœä%"ŠLìØcª„DDDÑ‹%;""2&$""2&$""2…È|@þg0EˆÜÜ\Íùòw.yŽ«VÓóÆóY5žÏàó½ÞÍp.E¤¹¹¹Uþ‡ÿóVݹ+ÿ;Ïqõç²&çç“çÓˆsZñ¼˜á\²dGg±<<—ÁÅó\z•3ˆØ’‘Y˜õâ·¢òÒÏgí™99B" !3_üV”““ƒœœÞD_G¹¹¹gÏ¡™Î%GHD!ÂdDfä»XÁL1ÊQ˜íB·:3õâ)t"vë .ù¬9.« ½_ åçˆç³vŸÁg¶eß›ˆˆÈZX²#""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S0UBâC¸ˆˆ¢—©E/&$""2…°%$–㈈¨*aIHLFDDT°$¤œœœp¼ Y˜Ýèø3fÌÙ-Zd`Kˆˆ(œL—˜„ˆˆ¢WÙ‘)0!‘)„u•WÛ‘?a™Câ*;"¢ð9bŽ;†7Ý”aÉŽ¨n›7OÿóŸF7ƒÈ¯¶mÛâ£?@Û¶mnJ1!¨aƸmnꥧÝ"¿Þ~éäÿ¸²l½_ïÖk1‘A-xžo¿‚Íf3º)Dºþü§9HÌû®S§,§LHDÈ™3i¿íBé¾]°[ðB§È× AÌ›~ ßz’P™ˆ"QZZnºrNÍ‚ ‰Liá;oC}çH6`B"ŠL/=ù„÷B·Û –¼Ð)²ýeÞÈ:úŠ6åyãÂ’qjº­ƒˆÌ$gÎt³ypfóÈvlvë]蹚4i‚¹Ó§áô×@¶{ÇV-Ù1!ùѸqc<òÀß±{úpàìÅ-`·ñ²!óxá‰Çá|å© 1êeÅUv¼²ˆüøôÝwpô[ û\èVìyRdº}Þ<´;}E»·WŠSIX³dg½JwÞr3R¶¬CÉîml¶?²— ¯KçθñÊé(^øVåµÙ,›L7BÊÎÎ>ûq^^ž-¡hÕ¥sgÌq!Jÿó€wÅR%,Ù‘9¬øb)Žß=G'FáëdBª;&!2ÚÏþâÅ”­Vò!I–¼Ð)²¼üŸ£`Á+ðœ>©§VMH¬=UðúóÏ!eír¨…dYsXu9-EŽñcÇ`Ð9õQ²j±nŒJ²lÙ’Q™Y3gàÂ6ÍQ²v%$»Mÿ¸ì› “€Çÿz'\oýÇŒÚm$®²#²¬† âéÇÃÁ›// ùcÍž'E†_ÿ _…ZM²±jÉŽ ‰À²?ĉÇï„ÀElÅ ¬ï‘¿Ý¶§Ày`Oõq*¬§LHõžý×?‘’·¥ÇW{¡K’Y¶Þ…NÖ6zÔHL;¿7\¯?P§É»ÔzqÊ„DQíŠË/Ãðæ áüìMH&+ö<ɺ222ðÚóÿÅÉû® 8F%!àÐ[%jrÖk1Qthß½fÄ[óìu‚˾)ì6mXÂg ½ý&Ô/?„çÄ‘'$›KËLH•¾õ:ÒÖ,…KqCªIOR†fo;¢P¸õ¦yÈNrÀµú»šÅ(H!YÂãü]=§áÞ³­š%ÞZ!Q8 |n¸ô(oͯqŒ({¤õ~½[¯ÅDupåôé˜Ô½Ä—} b\I`ã¢"søë­·`RÇ–°ýômp/t™›«RptëÚ/?ý$ÄûÏ5FËq„Dd9×^‹k‡ž{Þ×Á+”‘$©v7*UЬYS,zïàƒçƒRJÖ$nDd´+§_ŽÛ.€ØuËCr¿ [p9-™Gjj ¾Y¼òG/†ôž6+––™(bÜuûm¸nÂ(Ä|·¸Ö7¾VG’e–ì¨Öl6òV}˜Ï_YŒ°ì\'E„IOÄå}»#ö‡/‚^¦«H’d®²£ZÛºa¿|7¤1 ”݇Ä9$¢ð›rÉÅxü/7"nÝ—!™®D–X²£³Ùlصé'Ä}ñvèc¸uQøMŸv)ž÷gÄ­C2IÍ$4E¬ÔÔlß¼ øø¥ðÄ(HœC" «9W_»¯žø¼!/TÄ’ªI“&ذz¤…ÿ kŒJ-9’gB"KºuÞ¸aâhÄoþ.|½Î2BH’!DXß—¬¥k—.XøÖk—†©LWà±Dáñ¯Gÿ©½º"vÇÆ°ö:Ë U…ÍfƒÇã û{“5 2ÿýǃHü~‰!1*q•Qè-xó ÈJ‚cÏæ°÷:Ë1!QUf]1÷] ’7­6,F¹ì;Høø ò燯W¢µó¤ßww¡PË‘¯Gø;f „ømë Q&¤ a"_iiiøî«åhxpÔ“G )T$i½ûúkÔ, Ž?£QРЯæþÛ×C¸œÁÛµ»GHäcÕ²¥è(—B:°ÃØ‘QïŽ"\eG4óæþ7Íš‰”-?@&èuz©ª`B"Þ•t¼õêÿö+”ü“¦‰QaÑI2!‘)½ù¿ÿáÂŽ­·û'Sô8+Â’½O ®9³¯Æ_oÈAʯ?@L1z/ÇUvDAШQ#|ñÙ§8§ä$ÄoÛÍ—ŒÀ9$^ù% íÖq»~4eŒBfB"ª“˦MÃÃwß…ôƒÛ¡²9ÃS–ì¢U«V­ðѻû °›ic°YrWz³žMŠ2/<›‹Q½º#qÏÏ0WùÃ5D§ÙW_…»oºõŽì…ZRdΑQ9‹nÌ„D†êÝ»7Þyý5¤Ÿ> ÞkšIáªp„]dYÆ‚·ÞD¿v-¿+TÀüqjÑǤ0!‘aþñÐC¸bÊ%HüíW—ËÜ=Î ˜¢Ç”É“ðì¿ç#fß6¨Gö[&F%™«ìˆÒ»woä>ù/´L°Ã¶çS-éRÄ‹‰‰Á«/½ˆÁÙÝ`ÿé;kŒŠ*’dجÔÞ2LHVóŸzã‡FzþQ¨'KBûçà²ïHvÕ¬Y¸û¶¿ ËYõðkƨlã‘?Ó/¿O=ñO8ŽŽýæíqJÖ»`p„¡:uê„?õ$:4¨‡ø#{¬£’dÉN…T§Nðäã¡kËfˆÙñ3 TÀ‚Ïi©HÖ|'é³Ùl˜ÿÔS˜0z$RóB9uÄò1êÝ:Èz1jí³N¦•‘‘G|]0™î"('~d ì?ÖÆRĸaî\Ürã\dxJ€C» €K]² I–ŒnE™.!ññÖ&Ë2~ðA̼l’KNCœ>â½È-Ø[óG€ ÉêfΘÛo¹ ãìˆ9þ›÷“£ÞeßÖûÿ1]Bb²&Y–qçí·cnÎõHtG÷yWÏY¼ôá’5Mž<ÿwï=¨Ÿ‹¸‚“g\‘£²sH}ð—›oÆ•3¦£ž ìó~Á‚½³š°âÅÍ.:7Ý0-ÔGbi!ÔÓֻݠ?AѤeË–¸ý¶[1ùâ‹S\ä÷~!{›:8B2?Y–qã 7`Î5³Q/. ®b¨…§¼«ç"=N% Eº¡C‡bÎ5³Ñ÷¼ž¨ç¡-«¿GÓ/h®²3µvíÚáÚÙWãÊ+¯„£´ö¢|ˆâÓï‘T’I⢊@™™™¸jÖ,̼ür¤'Å£ž]†§è ÔRDlÉ£:LHæ3eÊ\1}::µo‡¬ÄX¨Ç~€ˆ.ÍU…%;Š('NÄåÓ¦áüþý ©°•C¸Káñ ºFD¾$&$³èÝ»7fN¿“§L…ì,F”’B¨…ÎèŽQx÷\”eªªÝ”€1!Q%#GŽÄÔ)S0xà@ÄÛ$¤8lPŠóDoOS’qºwïŽñãÇc쨑h˜Yõâ œ9q·ÔEùcR˜È2RRR0lØ0Œ3C‡ A¬MBJŒî3ù€ (ND}OSËšOã´²AƒaÔÈ‘˜H’ÿšQ wïÞ8ÿüп?:u숄ØX¤'%AR=Pœ¥Oi)GB’8B ¶ØØXL:ú÷Gß>}Y¯b숕%xJJxJм/æ¹Hù’•0!E¸áÇãí7Þ@¬ Hª€â,¨e²Þ^sKvA÷Ò‹/`ܨ‘pÀã*…PÀí‚`9®–¬ø I&¤×±cGÄÚmP‹Ëz—VÝNßL¸Ê.èš5k»Ü¥e%Æi1!ù‘››{ö㜜œp¼%•±Ùl€$Cp$D!›Ífƒ`œ’ŽÜÜÜJIÈ÷ïZ6› ’Ì =¨8‡t6»‚qT*™,ËÞ¬·ˆYILHAg“eÆiq„Ë{åj:¢úß‹/£m›¶Áj’¥Ó¬)^óM<óÌÓF7%bÜ}Ï=¸ûοâÚY³nJÄÈÊj€o¹kÖ¬1º)cùW_áãÂétÖêûwìÜY×\äVUÍt )å¼-Z¡]ûsƒÐëKHŠÇ±ãÇðëÖ­F7%b¨ªŠ†#-5Ãè¦D;°{ÏÆiÙl6´jÝŠR»Ü%È-ªžéR0HúŸ%AQÂX‘ÌãñÞ•É ‚qdŠ¢Ân—!¼›~Õ˜ñ¹ Ið—¨*/ô`óx<‚1lŒÓàRU¥N¿ #2!åää„}Ù·ªµ¥FU0!›$I°;ì€ä®u9„*³ILHÁ&IާƺÔÚW#öd Ë)Ü˼Ù{ýƒªòB¶n¸G :wÔ4$&¦ 66ÎRTµvåbœÛìÙWãöÛï@óæ-‡ÄÄd¸\*<îÀγ¿C#²d§ c²»©ª°ÔöóVPZZŠY³®4kÖ }úôÁèÑc0xð`H’ ñ)ª —ËSÍO¢Š§ÁµdÉ,Y² 0`† ŽÁƒ/@f½,$Ä'ÁîˆGi‰ÿÀè[EdB PËQjÄ,Ù…Ôþýû±ÿ~,X°Ð¹sg 2£F¹çvDlL"$ÄÀYÊäT !…Jqq1–-[†eË–5j„ .¸ãÇOÀˆ#à,q#&& %Ånˆ IHðÏ‘ IÆdw3⢆ðÚ¼y36oÞŒgžy™™™?~<.½ô2´mÛ±Ž$HR œNþ{hH\ .‡Â;#wÞy0zôhLœ8ƒ^€Ø¸$$ħ¢¸ÈÍR0têÔ ñ‰ñ,Ù•áÉ8ÇÇË/¿Œ—_~©©©˜ÿüsÀ¨Q£0cÆL 6-[7BJJ ÂÖ–ˆKHN§Íše )Ñ·ÇS†Û½ÙI^èfŸŸ—^z/½ô"Úµk‡«®º “'OÖ›=¥ÅÑ]Ò“$™qj‹/ÆâÅ‹‹Ù³g£[·nøæ›oÂöþ—vî܉֭[!)) W]uf̸™à°§ $ /zŽÌgûöí¸ë®»p×]waܸq˜=ûZtéÜ ±1é(:}1 pÉlœN§î6n¡±),,ÄüùóѧO/̽ñZü²õ{Ä'9‘˜svŽ)&$sûôÓO1qâxŒ7K¾X€” ’eÃã&Ü$‰«ì(òFHzʇ¡=zôÀ_ïº=zœ‡-…QÐeB²†_ý×\3iii¸iÞ͸üòˆ‰ICQAtÜOÇ9$"x„¤gãÆ˜2uFŽŠ¥_¾{l>’ìPÊvvˆÄCÞßa%§OŸÆßþï~´ïÐÏ>÷8’ÓK˜b|…ú`B"À„ );;ûì*;wîÄœ9×`ü„‘X³v ’SKoƒPEÄàÉ’„xôÑ Y³&xíõ\dd–")Y6<žBuÈLH&¤¼¼¼³G¨mÛ¶ Ó.›ŠÉSÆcϾuˆO,Í.CU1‡'‹­î¾ûîA»ömðÁG/!&þ4í†ÇU°IfB"&$#lذ#.†›n™ƒ¢’ÝHJQ¡(ˆˆ‚ )ã¶Ûþ‚±ãF`ãÏ_"%Í ›M6<¾‚u°dGR%Ÿþ9úôí‰çž ›¸‘œl‡Paé`BŠ$»víÂÔ©“3÷*Ä$œ@jš0<Æ‚qH\eG`BÒõÄ£{ÎøuÇ*$§—B@@Q­y€>‹HK—.E‡mð¿×ŸBRZ>m†ÇZ]Yæ±Ä„ä×ñãÇ1qâ8ÜvûõHH9”T»FÀZŸ3ÑzèAŒu!víû©nãã­–Kv0!UëÓO¢sçöXùͤ×+…ªÀRï€|ûöíÃøñ£ñô3Ç9-Œúg Û$Ãc‹(PLHµ0ñâqÈ}öAd4(€l“ Ÿ®zQR4zô±G0}ÆD$¥FJš¹cT|ª1y1!ÕÒsÏåbòäQHJ;Œ”TÉ𼿃>‹^?ýôºwï„m;V 3Ëcx,VuˆŠ*¥¨Å„TÛ¶mC°ÿÀwÈj¤¾c²ÞÁE 4í²Éxõõ'Шi±áñ¨w°\G^LHApɤñxçÝùhtŽùVásHà‰'þ‰kç\Žf­ +—•FG*À'çÀ„4?òn¹e6š4χ,ª*LqH`ÉŽ¼¾ûî[tîܪmRÒÌ£B(!˜‚jÙ—_`ÄEQ¿ÑQ$&™c“V®²£Š<î½ûW «¡bx|ª*oM ?˜.!…ãñ¡tèÐ!ôÈî·Ø‚´ aøÅ‰;i]>}*–}õš4s£Bp‰¼L÷ÄØp‰“ªóÅK0sæ´éPhLÉ€¢0!‘ Kv‘èñþÇOÇŸæÜƒ½»âÃúÞ\Ô@ؼy.ºh¾ùf6¬‰ ë{ •sHäÅ„&¯¼ò"Μ)À]w>†m[ÂW¯ç£¡)P‡FçÎm°oßA¬Xæ}”E8Ágv‘R½ÿþ{p:KñÀßÿÍ?…§Ê9$ª §Ó‰† ëaßÞƒXýµ–¤Ä’•cB ³O?]·[Á_ïz{w¥„üý¸‹2ÕFóñË/»·61äI‰Ë¾©’–,Y„sÏí€ÓoÄÏC;RâƒÏ¨¶:ujŸ~ÚŽ¼µÉ!}¡ ¨!¸ÊÎ0O>ù|è/èÔÍÒGCs•ÕEϞѻIHc ¨ŒQâÉP}ô>’““qí5÷cë/±!y.j ºðx<è߿֮لU+!y!£äÅ’Á^{í¼·ài´në Í}H|44ÕQ~~>.9ƒ†¨!Ú:ˆ‹È‹ ÉæÏ_­x-Ûx‚þ4NÎ!Q0ìÝ»3f\Œ ‡ÿé³\öM^LH&ñàC÷c˯Ÿ¡i³`˜(8Ö­[‹ÛïÈÁ€AÁ!q•LH¦rÓM×£°x ²ÊPTå`ÉŽ‚éã?Ä‹/>Ž®Ý• Å¨à3»¨Œé5T|ìD¤ìü]—]v1¾üò;µÆ©Su¿HyÛüùOâœsš¢{·iØòKp~&&LHј„| Ö?ÿ¼Ë–Ö}ß;–ì(î¸ã¼÷^k4kÖ{÷Ö=¾c”X²3­‰G`à ’:—Cï^aDÁ6uê4kq ©i¶º•ìïC"/&$“Ú½{7î½ïÏèÛÏïÌj~å…F¯^]0~B„¨]Œ–ǧ‡#$’©-]ºü,ºtUkÕóT¹G…Á A}1i²£‹8‡D^LH&÷¯=†ß~[-ä/§xÃ!…ÞÖ­[qï½Á°a5Ñò8UY²#0!YÂu×]‰ÌÌÝHK·Õè†CUŽ(,Þ~û ¬Y³=²åZÜË’y1!YÄ”)£Ñ¯oQ-îï`B¢ð¸ñÆë–vçœS³òÀ’y1!YDAAî¸ã: ìª  C¨\aGáuþ€ó0j¤¤€ãÅclÃɘ,dùò/±ü«7ÝS‚"Pí!$Î!Qø7£G{ŠQE$x8B"0!Y΃Ü‹”ä=hÖÌPmž÷wP¸åååáµ×þ…¾½ÕçGHÄ„dIÇ Äu×f•mJYÅê%>‰“ ‘ûŸgpìèj´ií`•ç:É‹ É¢† Š+. àþ^èdŒk¯Ž®NÀî¨z³`€sHäÅ„dQ+W®À‡½Œ~}ü/³eB"£Í{%ÆrWY²˜È‹ ÉÂþvÿ_ëØ†&MôGJœC"£mذŸþ*.¼Àî„$y•NÄ„dqWÍšŒ úú­Ís‰ŒöðCC“ÇѪEL;аãD&LHÙÙÙgªÞ©S§ðÌÓÿ‡ÑÃââm|ð™ÒÂ…Ÿ`ûÖUè{^,ƒç44ô*#F‰¨’‘™é‚å%#žÓº3[lr„DBf»à#AùÓx#}päææšf¿QŽˆB„ɈÌÎw±‚ÑñÊQ˜áâŽ4F÷Þ)ô"jë .ñ¬=.§ .½_žåç‰ç´ö§¡c†eß•ˆˆÈºX²#""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""S`B"""Sø,B²WyËŒIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/doc/source/images/example_imageitem_transform.png000066400000000000000000000052071457240071200274300ustar00rootroot00000000000000‰PNG  IHDR¤á§Ž pHYsÄÄ•+ 9IDATxœíÝMnÛX@QºáAm¥*3mÃ;á‚Þ*jêm(³ZKÍ܃†TŠájK$#]‡ç¨ ?è‡7z$¬§išÞ&x°ÿkw @Üåqÿ7飸œ¶?[²!€}¹õ¸S,Óð³,>‡ty…¬µøÒ<Ï.û`3«.j!¶â75 H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ Ïk~xŒqÞžçyõ0ì×â 1~ˆÐûûp‹ÅKvâÀ–V-Ù\óéèååå¼ýúúºÅnˆº<æ_ë¦ Î-Yª!€ý¸<æ_§›‚ô><ΰ•ÅçÄ€-mvÙ÷4¹Ð€åI|Ø’ßÔ@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@Â&_a~ß¿Ÿžžž=z{{{ôlÌ{”5|B AH$ €A AH$ €A AH$ €A auÆ[ÌÀέ ’°•UAšçy«9ع»}Aßáp8oÇ{퀹<î_㦠–è–|2!€}¹õ¸S,Ñð³¸ì€„M®²sµk­º¨Á[±d@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ Ïk~xŒqÞžçyõ0ì×â 1~ˆÐûûp Kv$¬Z²»ÅåòÞ‰OT¿–Žõ׺[Äà×÷ѱþÚHY² AHX¼d7ϳ˾ØÌªsH"ÀV,Ù H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ «ƒ4ÆØbvnUÄ€­¬ Ò<Ï[ÍÀÎ=ßkG‡Ãá¼}<ïµ[äò¸»I„öåÖ㾫ìH$6¹ÊÎÕv¬µê’«ìØŠ%; €A AH$ €A AH$ €A AH¸ÛôÁ{OOO½½½=z6t8¦ïß¿ßm>! H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$¬úú‰1Æy{žçÕð_‹ƒ4Æø!BïïÀ-/Ù‰[Úäc¯ùtôòòrÞ~}}Ýb·D]ó¯µ:H×.Õ‰À~\ó¯Óª«ìœ7`+‹ƒ$Fli³Ë¾§É…,·8HâÀ–ü¦ €A AH$ €A AH$ €A AH$ €A AH$ €A AH$ €A AH$ €A áyÍ1ÎÛó<¯€ýZ¤1Æzn±xÉN|ØÒª%»iúgÙî³@‡óöñx\»[â.û×X¤Sˆ>[²!€}¹õ¸ï*;éò ;Xkñ’Ý<Ï.û`3«Î!‰[q €A AH$ €A AH$ €A AH$ €A AH$ €A AH$ €A AH$ €A AHØ$HcŒ-þvluÄ€-¬ Òcšçy«Yرç¥?xkŒ^^^ÎÛ¯¯¯Kw ÀpyÌ¿Öâ MÓËuŸJ„öãò˜mœé2>–îXËeß$ ›Érkù„@‚  H$ ‚@‚  H$ ‚@‚  H$ «¾ àÒ_ýõèØÐßÿ}×ý °™oß¾=z¾0Kv$ ‚@‚  H$ ‚@‚  H$ ‚@‚ ÁŒ1=ä  » ÒápxôÿÊlË”g«*?ff[¦<Ûgv$Z €„»}AŸ“ºì÷üOÓ4½=z°d@‚  H$Üí¢†šËÌóVïÕ^cÓÔ|>Oʳ]k·A Å’ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$ ‚@‚  H$üïü`˜_¦/IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/doc/source/images/gen_example_false_color_image.py000066400000000000000000000031221457240071200275150ustar00rootroot00000000000000""" generates 'example_false_color_image.png' """ import numpy as np import pyqtgraph as pg import pyqtgraph.exporters as exp from pyqtgraph.Qt import QtCore, QtGui, QtWidgets, mkQApp class MainWindow(pg.GraphicsLayoutWidget): """ example application main window """ def __init__(self): super().__init__() self.resize(420,400) self.show() plot = self.addPlot() # title="non-interactive") # prepare demonstration data: data = np.fromfunction(lambda i, j: (1+0.3*np.sin(i)) * (i)**2 + (j)**2, (100, 100)) noisy_data = data * (1 + 0.2 * np.random.random(data.shape) ) # Example: False color image with interactive level adjustment img = pg.ImageItem(image=noisy_data) # create monochrome image from demonstration data plot.addItem( img ) # add to PlotItem 'plot' cm = pg.colormap.get('CET-L9') # prepare a linear color map bar = pg.ColorBarItem( values= (0, 20_000), cmap=cm ) # prepare interactive color bar # Have ColorBarItem control colors of img and appear in 'plot': bar.setImageItem( img, insert_in=plot ) self.timer = pg.QtCore.QTimer( singleShot=True ) self.timer.timeout.connect(self.export) self.timer.start(100) def export(self): print('exporting') exporter = exp.ImageExporter(self.scene()) exporter.parameters()['width'] = 420 exporter.export('example_false_color_image.png') mkQApp("False color image example") main_window = MainWindow() ## Start Qt event loop if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/doc/source/images/gen_example_gradient_plot.py000066400000000000000000000037531457240071200267300ustar00rootroot00000000000000""" generates 'example_gradient_plot.png' """ import numpy as np import pyqtgraph as pg import pyqtgraph.exporters as exp from pyqtgraph.Qt import QtCore, QtGui, QtWidgets, mkQApp class MainWindow(pg.GraphicsLayoutWidget): """ example application main window """ def __init__(self): super().__init__() self.resize(420,400) self.show() # Prepare demonstration data raw = np.linspace(0.0, 2.0, 400) y_data1 = ( (raw+0.1)%1 ) ** 4 y_data2 = ( (raw+0.1)%1 ) ** 4 - ( (raw+0.6)%1 ) ** 4 # Example 1: Gradient pen cm = pg.colormap.get('CET-L17') # prepare a linear color map cm.reverse() # reverse it to put light colors at the top pen = cm.getPen( span=(0.0,1.0), width=5 ) # gradient from blue (y=0) to white (y=1) # plot a curve drawn with a pen colored according to y value: curve1 = pg.PlotDataItem( y=y_data1, pen=pen ) # Example 2: Gradient brush cm = pg.colormap.get('CET-D1') # prepare a diverging color map cm.setMappingMode('diverging') # set mapping mode brush = cm.getBrush( span=(-1., 1.) ) # gradient from blue at -1 to red at +1 # plot a curve that is filled to zero with the gradient brush: curve2 = pg.PlotDataItem( y=y_data2, pen='w', brush=brush, fillLevel=0.0 ) for idx, curve in enumerate( (curve1, curve2) ): plot = self.addPlot(row=idx, col=0) plot.getAxis('left').setWidth(25) plot.addItem( curve ) self.timer = pg.QtCore.QTimer( singleShot=True ) self.timer.timeout.connect(self.export) self.timer.start(100) def export(self): print('exporting') exporter = exp.ImageExporter(self.scene()) exporter.parameters()['width'] = 420 exporter.export('example_gradient_plot.png') mkQApp("Gradient plotting example") main_window = MainWindow() ## Start Qt event loop if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/doc/source/images/gen_example_imageitem_transform.py000066400000000000000000000026561457240071200301320ustar00rootroot00000000000000""" generates 'example_false_color_image.png' """ import numpy as np import pyqtgraph as pg import pyqtgraph.exporters as exp from pyqtgraph.Qt import QtGui, mkQApp class MainWindow(pg.GraphicsLayoutWidget): """ example application main window """ def __init__(self): super().__init__() self.resize(420,400) self.show() plot = self.addPlot() # Example: Transformed display of ImageItem tr = QtGui.QTransform() # prepare ImageItem transformation: tr.scale(6.0, 3.0) # scale horizontal and vertical axes tr.translate(-1.5, -1.5) # move 3x3 image to locate center at axis origin img = pg.ImageItem( image=np.eye(3), levels=(0,1) ) # create example image img.setTransform(tr) # assign transform plot.addItem( img ) # add ImageItem to PlotItem plot.showAxes(True) # frame it with a full set of axes plot.invertY(True) # vertical axis counts top to bottom self.timer = pg.QtCore.QTimer( singleShot=True ) self.timer.timeout.connect(self.export) self.timer.start(100) def export(self): print('exporting') exporter = exp.ImageExporter(self.scene()) exporter.parameters()['width'] = 420 exporter.export('example_imageitem_transform.png') mkQApp("ImageItem transform example") main_window = MainWindow() ## Start Qt event loop if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/doc/source/images/index_api.svg000066400000000000000000000066771457240071200236500ustar00rootroot00000000000000 image/svg+xml pyqtgraph-pyqtgraph-0.13.4/doc/source/images/index_contribute.svg000066400000000000000000000047401457240071200252420ustar00rootroot00000000000000 image/svg+xml pyqtgraph-pyqtgraph-0.13.4/doc/source/images/index_getting_started.svg000066400000000000000000000076111457240071200262530ustar00rootroot00000000000000 image/svg+xml pyqtgraph-pyqtgraph-0.13.4/doc/source/images/index_user_guide.svg000066400000000000000000000144351457240071200252210ustar00rootroot00000000000000 image/svg+xml pyqtgraph-pyqtgraph-0.13.4/doc/source/images/overview_uml-dark_mode.graphml000066400000000000000000003235021457240071200271760ustar00rootroot00000000000000 ImageView graphicsView imageItem view QGraphicsView scene() QGraphicsScene items() views() QGraphicsItem scene() QGraphicsObject GraphicsView sceneObj GraphicsObject graphicsView imageItem scene view ScatterPlotItem graphicsView imageItem scene view PlotCurveItem graphicsView imageItem scene view ImageItem graphicsView imageItem scene view PlotDataItem curve scatter GraphicsLayoutWidget graphicsLayout GraphicsItem QGraphicsLayoutItem QGraphicsWidget QGraphicsLayout QGraphicsGridLayout PlotWidget plotItem GraphicsScene graphicsView imageItem scene view GraphicsWidget graphicsView imageItem scene view ViewBox addItem(item) GraphicsLayout layout PlotItem items layout vb addItem(item) QPaintDevice QWidget QObject pyqtgraph-pyqtgraph-0.13.4/doc/source/images/overview_uml-dark_mode.svg000066400000000000000000003253251457240071200263500ustar00rootroot00000000000000 ImageView graphicsView imageItem view QGraphicsView scene() QGraphicsScene items() views() QGraphicsItem scene() QGraphicsObject GraphicsView sceneObj GraphicsObject ScatterPlotItem PlotCurveItem ImageItem PlotDataItem curve scatter GraphicsLayoutWidget graphicsLayout GraphicsItem QGraphicsLayoutItem QGraphicsWidget QGraphicsLayout QGraphicsGridLayout PlotWidget plotItem GraphicsScene GraphicsWidget ViewBox addItem(item) GraphicsLayout layout PlotItem items layout vb addItem(item) QPaintDevice QWidget QObject Widget used for display and analysis of image data. The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene. The QGraphicsScene class provides a surface for managing a large number of 2D graphical items. The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene. The QGraphicsObject class provides a base class for all graphics items that require signals, slots and properties. Re-implementation of QGraphicsView that removes scrollbars and allows unambiguous control of the viewed coordinate range. Also automatically creates a GraphicsScene and a central QGraphicsWidget that is automatically scaled to the full view geometry. Extension of QGraphicsObject with some useful methods (provided by GraphicsItem) Displays a set of x/y points. Instances of this class are created automatically as part of PlotDataItem; these rarely need to be instantiated directly. Class representing a single plot curve. Instances of this class are created automatically as part of PlotDataItem; these rarely need to be instantiated directly. GraphicsObject displaying an image. GraphicsItem for displaying plot curves, scatter plots, or both. While it is possible to use PlotCurveItem or ScatterPlotItem individually, this class provides a unified interface to both. Convenience class consisting of a GraphicsView with a single GraphicsLayout as its central item. Most of the methods provided by GraphicsLayout are also available through GraphicsLayoutWidget. Abstract class providing useful methods to GraphicsObject and GraphicsWidget. (This is required because we cannot have multiple inheritance with QObject subclasses.) The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts. The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene. The QGraphicsLayout class provides the base class for all layouts in Graphics View. The QGraphicsGridLayout class provides a grid layout for managing widgets in Graphics View. A subclass of GraphicsView with a single PlotItem displayed. Most of the methods provided by PlotItem are also available through PlotWidget. Extension of QGraphicsScene that implements a complete, parallel mouse event system. Extends QGraphicsWidget with several helpful methods and workarounds for PyQt bugs. Most of the extra functionality is inherited from GraphicsItem. Box that allows internal scaling/panning of children by mouse drag. addItem() will add a graphics item (e.g. a PlotDataItem) to the scene. This class is usually created automatically as part of a PlotItem or Canvas or with GraphicsLayout.addViewBox(). Used for laying out GraphicsWidgets in a grid. This is usually created automatically as part of a GraphicsWindow or GraphicsLayoutWidget. GraphicsWidget implementing a standard 2D plotting area with axes. addItem() will call ViewBox.addItem(), which will add the graphics item to the scene. The QPaintDevice class is the base class of objects that can be painted on with QPainter. The QWidget class is the base class of all user interface objects. The QObject class is the base class of all Qt objects. pyqtgraph-pyqtgraph-0.13.4/doc/source/images/overview_uml-light_mode.graphml000066400000000000000000003235021457240071200273640ustar00rootroot00000000000000 ImageView graphicsView imageItem view QGraphicsView scene() QGraphicsScene items() views() QGraphicsItem scene() QGraphicsObject GraphicsView sceneObj GraphicsObject graphicsView imageItem scene view ScatterPlotItem graphicsView imageItem scene view PlotCurveItem graphicsView imageItem scene view ImageItem graphicsView imageItem scene view PlotDataItem curve scatter GraphicsLayoutWidget graphicsLayout GraphicsItem QGraphicsLayoutItem QGraphicsWidget QGraphicsLayout QGraphicsGridLayout PlotWidget plotItem GraphicsScene graphicsView imageItem scene view GraphicsWidget graphicsView imageItem scene view ViewBox addItem(item) GraphicsLayout layout PlotItem items layout vb addItem(item) QPaintDevice QWidget QObject pyqtgraph-pyqtgraph-0.13.4/doc/source/images/overview_uml-light_mode.svg000066400000000000000000003227011457240071200265310ustar00rootroot00000000000000 ImageView graphicsView imageItem view QGraphicsView scene() QGraphicsScene items() views() QGraphicsItem scene() QGraphicsObject GraphicsView sceneObj GraphicsObject ScatterPlotItem PlotCurveItem ImageItem PlotDataItem curve scatter GraphicsLayoutWidget graphicsLayout GraphicsItem QGraphicsLayoutItem QGraphicsWidget QGraphicsLayout QGraphicsGridLayout PlotWidget plotItem GraphicsScene GraphicsWidget ViewBox addItem(item) GraphicsLayout layout PlotItem items layout vb addItem(item) QPaintDevice QWidget QObject Widget used for display and analysis of image data. The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene. The QGraphicsScene class provides a surface for managing a large number of 2D graphical items. The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene. The QGraphicsObject class provides a base class for all graphics items that require signals, slots and properties. Re-implementation of QGraphicsView that removes scrollbars and allows unambiguous control of the viewed coordinate range. Also automatically creates a GraphicsScene and a central QGraphicsWidget that is automatically scaled to the full view geometry. Extension of QGraphicsObject with some useful methods (provided by GraphicsItem) Displays a set of x/y points. Instances of this class are created automatically as part of PlotDataItem; these rarely need to be instantiated directly. Class representing a single plot curve. Instances of this class are created automatically as part of PlotDataItem; these rarely need to be instantiated directly. GraphicsObject displaying an image. GraphicsItem for displaying plot curves, scatter plots, or both. While it is possible to use PlotCurveItem or ScatterPlotItem individually, this class provides a unified interface to both. Convenience class consisting of a GraphicsView with a single GraphicsLayout as its central item. Most of the methods provided by GraphicsLayout are also available through GraphicsLayoutWidget. Abstract class providing useful methods to GraphicsObject and GraphicsWidget. (This is required because we cannot have multiple inheritance with QObject subclasses.) The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts. The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene. The QGraphicsLayout class provides the base class for all layouts in Graphics View. The QGraphicsGridLayout class provides a grid layout for managing widgets in Graphics View. A subclass of GraphicsView with a single PlotItem displayed. Most of the methods provided by PlotItem are also available through PlotWidget. Extension of QGraphicsScene that implements a complete, parallel mouse event system. Extends QGraphicsWidget with several helpful methods and workarounds for PyQt bugs. Most of the extra functionality is inherited from GraphicsItem. Box that allows internal scaling/panning of children by mouse drag. addItem() will add a graphics item (e.g. a PlotDataItem) to the scene. This class is usually created automatically as part of a PlotItem or Canvas or with GraphicsLayout.addViewBox(). Used for laying out GraphicsWidgets in a grid. This is usually created automatically as part of a GraphicsWindow or GraphicsLayoutWidget. GraphicsWidget implementing a standard 2D plotting area with axes. addItem() will call ViewBox.addItem(), which will add the graphics item to the scene. The QPaintDevice class is the base class of objects that can be painted on with QPainter. The QWidget class is the base class of all user interface objects. The QObject class is the base class of all Qt objects. pyqtgraph-pyqtgraph-0.13.4/doc/source/images/peegee_02.svg000066400000000000000000000277601457240071200234370ustar00rootroot00000000000000 image/svg+xml pyqtgraph-pyqtgraph-0.13.4/doc/source/images/plottingClasses.png000066400000000000000000001264321457240071200250430ustar00rootroot00000000000000‰PNG  IHDRˆ ŒÜ”LsBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î< IDATxœìwXTÇ׀ߥ*MºbCQÁ†Š½7°w£±wc‰kì½bï½£Ø{EŠ‚ ½wX¾?V®l ‰Fb’ïwßçÙ‡[æÎœ™½œ=sæÌŒ¤  €B$‰¤ððÓ‡"EDDDþËù[PPT~B"‘˜úE/ýαˆˆˆÈ‘—@ƧcAþVJ H$σ¢×ÿ~ùDDDD¾ ©@>†R ¿È±œb”H$§€ß_L‘ïBcÀçÓqòºQЇJŸTÊgEDDD¾©@9>†¹E>|º^Œ*UªQ®œÎwPDDDäïæíÛ@²²2ÊjÈw˜ ?R‰DBAAAR‘aeŽºŠŽŽî? ¶ˆˆˆHé’žžÆ€Á@6"RȲ‘ ­~²$‰ô·Ã+ÇͦSGûï*³ˆˆˆÈßÅÀ!yä ƒlÔ¸°Ãœýé“óé\*‘H"ÊWDOÏ€?Ãýé#j˜ÔÆÀàïs:zz¹cdT‰ŠFUŠÝ{îù„*•Œ©P¡R©–ö.˜´´TêÕµ’»þi¾TË*Jxxñ ±XÕoTì^hXéééÅd*-nݾDëVPQQý¦|\ßâ^Ñã"ò¯!55¥ðP¨L¦‰@§{RŠ ­ü~¯¼ñ÷÷&;'›zu­¨cfI™2eK]îÞýZqpßÅbÿKé ý¡+§ŽßFEEå«óõxInnõ-––¨ßÌ#—ÛT­jB5ãµ—¾žHóó±²j,\ {Ìû÷!èêè³gÿ&¶n:R,/oŸç9¶‹ëö—ªŒ>¼géòYlÛrLh÷À@_üü½IOO£®¹æu,QSS/ÕrëÌÆuû‹ýÖЧkîw¦œ–öWåù><”7´nթؽ€À—¤¤$ô6€œœ~1ù›äýæ;v®eÓ†ƒ(((|S^"¥J%dä ™^Lýô·™‘X €ü„úØÑ;)Ýì›bß§‹ý‰»÷® ÷·ï\C@àË?•À×Ï‹ä”$Þ¿Æ¡99Ù½?Ð;)þŸó‘J¥ôÜoŸç¸?}DxxX‰ùîÛ·oŸç_Ô ¿‡ß+oã…óœœlfÎ]D–|ŽŸØËÀ!±kcF^͘·`¡aAßTnI¸¹?àøÉ½%Þ ÀÛçÙ_Êwîü‰œw:Vìz||,=z5#2*œKWΕõ—ò/Jćw¬Z;ÿ›óùP,€:€)2o¢ (º/ùÍ$=ŒŒtfÌÅ¢%Óˆúø””$w¬¥ß v$$Æ•ª „½ &_š_ì^™2eøuñ&”••ÿRÞ·n_ÂùÒéoñ› {Ëêu ™xìøn¹ûk×/,¦KŽßÍ#×;T¯nÊ”IóJÌ733ƒÈÈðo’íÇ÷,_5GîÚ²•?co?rrr˜;"?ÿ2žðð0ÒÓÓØ»3½ûµ":&ê›Ê.‰wïCÈËË+v]"‘ðëâMh¨k|už*Ê*üÏ9yú^/ž’Ÿ/û¡—Jó¹tå ii©\¿y‘Óg!WfNv6·ï^ÁùÒ)’“?=W@hØ[ dÎά¬L®]wâœÓQ¹ûŒŒt\ßãÔ™ƒøù½ „‰Ú%ò6ø5眎rÿá 22Ò™Nöðt“K÷ÒדWþ²øö˜Ø\p>ɱ{xéë)¤ñ{åM` ¯pÆÓg.$%%pêÌAüý½¹s÷*-š·ã‰ûC!]bb<É)Idgg-\âþ»æíÈÊÊ’ÓÛoßrüÄ^>ºU¬žo‚ü9qrÏ=“'§›âãc¹xé$'Ní~×’S’8qjþ/¹}ç2—®œ¡  €®{pøèÂÃÃ8uì?M[ÈÄñ³Ù½ã4ö=rõÚy@f¨Þº}‰è˜(Nœ’y3¥Ò||ý¼8yúÏ=Ë}—¯ž%%5™›·œ9yúŸë——˽û×qºxB®Cö–ü|YG"''‡7/ræÜa"£>ÉYY™¸¹?ääéø¼ô@*•R¡B%l›´ââ¥Sråúö.˜î]û’˜O|Â粂CÞpêÌAœ.Þ5_?/9›àé3ü^y ç^/žÄÌé‹9rl—œ\"ÿ85z€2c± Ëg¨È'±DÔÕ5ÐÔÔBO×€vm»Ò±CO._=[,]@àKFŒ²§kÏ&t³o*(ÇmÛWáíóŒE¿Nçþƒ4·m÷ÂsÝî3 ß¹knîhÒØ-™.x-Ÿ{<¦Wß–ôêÛ’5ëRðyV6®ïaß§½ûµbϾM,Z2]P¡aAŒׇ½šáÐÇçOÿ;w¯ç¹Ç–.ŸÅ­Û—HJJàøÉ½Lš ë9ú¼äþÛlX»SS304¨ÀÄñ³Yµ|;šB>ÇNìaè]Ù¾s-{ömbðð.ôé߆%KgŸ À瓬߸˜_—Ï¢G¯fôé߯O…z(((²jÍ/ôØ–1ãûâëçÀ™s‡Ù²méé©Ì_8™®=›0üÇ\»î@ZZ* —LcÀà ÜÇ«èÔ¡'qqÑrÞÖ‚‚.8Ÿ oïat··<©®ïÑo`[z84cðð.xû<'??>ýÛŠÉÏïÝì› ÞÝа †ÿØ&MœÃÇ•¿÷J‰ˆüS(ÆÈ<‡y5Udõþ0~ä¢ó ÆŽž^, cúÔ 8 €øøÖm\ÌÒe³OÒVÇUìØµ%%%ŽØÃŒO#ùùR–,Áª5󈋋ÆËûƒ†v’ûñwܱšwï‚ yC¿AíÈÎÎdÉÒäææ’››ËÈÑܽôô4FŒ²Çç¥#G;àõÂEEE6nYÊéO:ù¸ÿð3fÿHnn.^/žÒ³WsòòòÈÈHgÞü‰‚q °tùlã bðÐÎøùy‘Ŭ9cpºp€7/pûîá™>Ï8z|7Ò)‰I äçKÉÉÍ¡Ic;b…‘·§°iÐ kÜžÊ Ç°wÁ$$ÄÒ¸Q B‚pܾ€Wþ>ü8¶±qÑ<÷|ÂCÛ>—çý”QcûÎã'÷Y¸h»÷nd^¡?tåÍrss˜5g ·n_‚‚“æç“ýi´ëî½ktêÐSÈ÷‚óIFÿ8µØpò„q³„áØÔ´V­ù…e+fùu26n^Š’’眎1aò@áÙå+fùÊŸùÉ+oï,×aصw#AoˆŒ|O¯¾-ÉÏÏC*•½CééiH¥RÆŒïËõÈÎÎbìøþBÛM˜<ˆÇn÷QQVaÇε<¼€¾}†qñÒ)¤ÒÏ‘NOÐ¥“šÜ¾{…7/ððÑ-&OBzz*áï1ʞа ‚C^³ïÀáùÕkç³mû*á|åêy$'%¢§g@]s+\ßû·Oä 2#±Ÿ')k#›¼¢„Lgþ¹r,$èm€`T’——Ǭ9c<`ƒþÈ›7þŒß33 ¦LšÇ•kçXºx3ffH¥ùìÚ³‘™Ó“ŸŸÇ ïg,^¸ã'÷’šš‚¦¦OÜÒ­KoâbÉÈLG*Ígáâi 6A~äÞýëœ=w˜ÞCÈÍÍeñÒŸ;j:ýûÀùò)ÚFK»H¥ùÌúy,ö2h QQ Ò‘ºæVL7‹«×γhÁz,êYãáé†Q…ÊhjjàççE½ºVèëkK á8==•k7œX´`=ÖV }÷ìß}UUU~Y8…‹Î§5r YY™8]<ÁžgYøËvíÙȲ³¹pî jÙ¶ù(óæ¬äàáíœ;‹zÖ¤¥¥’˜$ —rܹ–|©”³§î’š’Ìàá]°²jÄí;WP+«Îé·ÉÍÍe݆E¼{‚qUºwïÇ…‹'„øFO/wÒÓÒh×¶ óçççóñã~ž7Ž[ceÕ˜ûn0{ÎX®^r§bÅÊxz¹Ó¡]wž¸?@OWŸgÏ]©R¥OŸ¹RÝØó:õy÷.˜ÌÌ Ê–Uû’×JDä{ AÖ;YŒ:2ã°¨÷°D=˜””@rJ5Lj ײ³³ÈÉÉÎ55µPPT$::’•˶ÑÀª Ö šðÃð èêèÓ±CO:vi@bb<åÊÉbÆZ·îL‡vÝYÜá»Wé×g8Íšµ¼V7o;óöm FFŸãÐnß¹LvvÖʆîÌëXû‘Þõ1‚Q?NE]Mƒ®]zû§ ¤¯gȦõ©aR w÷‡|üø€æÍÚ"‘Hxâö€ÍÛ’••Éõ›Ù»óL±ïlÛöÕŒý½™™Îñ“û;ú'¶m_MAAïÞS½zMÞ¿%''‡Ô´dâ⢱´”ý^šÖ¨ÍÛ·¿û^ˆ|w éÀ2ÈâyUøä=$J¿÷ô‰SûÑÑÖ%'7OO7TUËС}w¹4oƒ‰ŽŽÄÁ~ Š˜™Y`fV7÷‡r†€mÓÖü²p ?~ êc&Õk¢¥YŽõóô™ ¶M[âëçÉÊåŽrÏ}øNLìG:w²G"‘жM45d†ÜûðP’’èÞ­/‰‡žƒ„ÞeHè[">„Qß²!Ao07¯Ïc·{˜ššÉ•ú†5>ÿ$&% ­ýy6·TšÏÆÍK…sss+™r“H0©V“F6Í0©^‹Cû‰ÆëÅS´Ëéðì¹+£FNA"‘Pä–0„ݹ“=ûl!9% €š¦f4´±dÿà—¯ÿG}är›éS ®¦ºš7¯z¢¬¬Œªj<½Üyðð&M›´ä—¹Ÿ{q}{ eðð.Ìšñ+ššZ\t>}ÏÅâ˜?¹OåJU)«¦Îë7¯¨X± yùyø¼¤™m<=ÝèЮ;Ïž»2rÄdnÞºDŸÞCyþü1;Éfz–ÓÒFOÏ€àà×Ô«× ˜ü""ÿ e?}T‘)ÁÂ^òï‡jj(++“™™!\Û±kà½OˆÅõÁk•¨kþy2Y¥JÆœw:†‡§™Yäç瓘ôÙ@4«UOH[«V]¢¢>ç…º@»œ.±ñÑrbHèj×þü|£†ÍÙAÛ6]éÙ«9ÍmÛЦMgZÙuüÓÆ1ªP™;÷®â¸c5ñ ±DÇD ¡4½séÊZÚuàÆÍ‹tïÖEBÃÞÒ±ˆwÍÜÜ’¸¸²¿2¦¹E‹v¸>¾ËàA£qwÄOÓ’Ÿ—Ϧ-ËJ¥¸¹?À®EûbÏEF†Ó¤q áܲžµ` ~ˆ|/'›•Uc_û²áÒ¬¬LfÌ–y³²2y÷>DΛVx=êc„Ð9PVVAMMCî]8pÈQˆóŽOˆåÖ5/aBc¡qP©b.]9ƒ§—ié©H¥ùÄÇÇbdT@]«®œ±¡u‘wA[·XˆSHhµkÕý\×ú#ÜÁ~0}ì°mÒ’6­»Ð¦µlbŠ‚‚½ãtñ8-š·åöÝ+T36ÁÌÌB.ïüü<ÂÞsëö%!,::Š2eÊbhPA¦ïCÞàéù„†6ÍÐÔÐ⥯'qqÑ4mÚ ELLj £‹"ÿ 4é½¼OÇe(®ù]±RÅ*¡¤¨ÄÐAcJœ1œ˜žžêêšÂµÊ•«‘šš\\ MX5Âíé#"#ßÓ´IKš6m…›û”””0©^‹ò†FrÏ%''R¦LYtudH$Œ*Êf6gd¤¡«£/W¾¡a™lIñH$!@GG=½â^Á¨¨¹ÙÒfµëý&–NBµj2/Ùs'¸¹?z¿E{“QQü4ëGLkÔ¦R%câb‘ 6×ÑÑŽ+U¬ @jЬ­Ê—¯(ÜSRR"/¿x`rBBF* ç…FÞÀþ#ÑÐÐäì¹#,^úv-Ú3oÎJÔÕ4¨VÍ”zu­¸vý<]ºôæÞƒœ;]ÜÕŸ˜OJJ²0Ф±JŠJ4oÖ†óNÇÈÊÊ$%5™–-ÚRÞùx¿|Î’E…g*U!âÃ;Ñ@ù7!A¦ë?}І8‚¢¢¢‚Ym ^ø<£J•jü4m!?M[ˆTšOæÆBÚ2ªe„aèüü<¦LÆÏ3—2dÐÊ”)ƒ­©\ÞéiÂq^^.JJŸÕqÑã’PTT’3T„ŠJ$,Y¸øøX<¼ÉÎ]ë¸sç +–9–ËgV¯›IõZ,Y¸råt=®p¯G·~ìÞ³‘¤¤nݾ̮í§>É H^^®.''‹ËžU‚¬…Ø5oÇVÇ•ø½zžž ëõõ xåsf-/±®¹¹ŸËOKf­£­­+çWTNeee¬4¡G·~Ø&¿EAA‹z ðöyŽÙ'ƒnüØ™Œ; Ø÷[Û]PPÀô™#7v&ŒD]Mƒ–mëÈ¥-ŒùÈÍÍ•›¯¤ôÇ“’ÉÌ*¹}çÎ^θÑ?ñÐåmãʵslÞp‡žƒØw`+qq1\p>)x¯å묈’’"}z ¡¦ég™UTeïysÛ6xz>áÙóÇŒ7 M<<Ÿû‘æÍÚü¡Ü"ÿ(*Èf*« I)Ôr:ñwµP«–å^ˆ’00¨@ll4)©ÉÂ?CHÈÚ¶é\búÍÛñÜã1Þñó ™GζIKΜ=„ŠjìZ´+öŒŽŽYY™DGGR¾|Eòòò y€i 3’’…ò¥R)>Å|T ''‡Ù3EO÷—î12ªÌ³ç®Â¹¥… oƒñõó¢ž5 ‚‹?77ÿ!mјö3çÓ̶5S'ÿÈb½ŠLÌyóÆ_8~÷>DV?ÝÏFãŸahXàà@Á ùÒד*•«¡££G÷®}…àâ³GqîüQ~6€¾½‡qäØ.”””ihc[âÒA††F¨¨ª²zÅŽËÎÉÍæî½kXY6BQQ‰*•«qíÆŒkCó‘QáT®d\b""ÿ ’>_Dß>ÃØ¹{= ê7ŒDÏO1Ä%-õú?yy¹´i-Ó…÷Ü 77W˜TàSÄÐxýæm[wùâʘծ‡ÓÅãH¥ù(((rÁù$ññ1tìГÐÐ ZµìHŸÞC©]«.óNúü¤Ò|ž¸=`ú””+§ÃÇð{å-xàÊ•ÓÁή=›·­ bÅ*Tª$ëÜš™Yàë÷BÈÇÏï&Õk¢¤¤DÅŠUåôäã"±æ‰DÎ`«\Ù£ •8v|à8™óàøÉ}U¨,”Y”ªUMø<Æç¥‡0QÅ¢ž5þþŸ'L¸¸~ž YÇ̒а·B§?**‚÷á¡T«fŠ„Ï²•)S£ • y-, Ô§×PÖ¬_@ãFÍ1©þÙ9ðÒד¼¼<$ ’"—Éx÷>„øøX:w”‚=}æBZZªÜLuoŸçX7…&¼ ò§Oï¡Åêû{˜Õ®Ç¾ý[ÈËËCII‰ë7/Hï^Cð÷IûvÝpè9K ÆŒÿlëëb×¢ÇOî#4äM‰k~J$jתGdT8Ú÷d“SÊæËb0›Ù¶æôÙC¼ Ä´†jjê\º|š¸¸&NøYÈ'$äõŸÚ"ß ²Ž²B‘ãbzñ»©B “ZÔªiÎÁCŽŒ1™'Oîòš•Ÿz«êZ„„½Åظe˪a×¢GÉ–407· Z5S²²³pq¹ÃŠeÛŠ•Q±b*W6æè‰=Œ>‰Óg¡¬¤Œ´ €²eÕ¨aR‹½û73hÀ\¸xRè½W5ÁÒ†={71vÌO$%%òëò™¬Z¶J•ª¢¡¡IhØ[j˜ÔƤz-NþÆÓ¸lÉfÌÅ´)ó±nЄÔÔ<=Ý8|l'ÆÍ*±=TTTyJff¯ü}ðzáNBB¼à’šŒÓ…ã´oß§‹'¨oÙuµ/_¦ cû\p>Iݺ HIIbæìQ\8÷ˆå«æ`T¡2Œ$??Ÿ‚‚ê*hÓº k×/âäéL\ò­Zvdæ%œ=„®{ñÒ׋}¶²Óñ$***4³mÃþCÛ˜ð©·lcmËÁCÛéÖõ³§!9%‰øøX¹áz‘ÿ:=ºõ#55…£í±¨gv9‚Þ’’šÄ®í§JŒ·5«]U-™Žj™2h—ÓÁª~#öÜÆ¼9²‰\Ïž?&ðÍ+ÂÃCQVRŒÉ/¡UËŽœ>{ˆÞýZccÝ”'nزé0º:úLš2„»÷®a`P7÷‡ :^xÎÍý“¦~ŽTTTdë¦#´´ëÀ¯Ëgb^§>qqÑôé5„+WÏÒÐÆ“êµèí0„±úÉy"‡Ϩq½™4uzºs–MÀ³kÑžã'÷²móQ!Û&­˜úÓ <¦Ä6èÛ{#GÛ3mƲ²2ÑÒ*'ŒØ´²ëÀ•«g?i e˪QÞÐH˜}ûÃð Œ×—Qcû`nnɃ‡7™9}±L¶šuؼm«×ÎgöÌ_11©Epðg±]Û®¤¤&3z\_,ê6@GWŸ×įŰqý~ôt ŠÅ|V3®¡¡óLB»œÊ**Ø6mÅ‘£»Xð‹,$Ê×Ï‹…K¦CzzÚW-ÐÞ¤±66¶8ô±£iÓ–<~rŸÕ+v «£ÏŽ]k¹ÿà:FF•yúÌEî](lÃÉÓ†1 ÿTUË”˜ÿŒé‹˜9{4þ¾hjhòô™+Û·É&#YÕoÌÏóÆcc݉DB¥ŠU‰‰ýˆ–f99ÇÌÛàר6mõÅuùÛù¢ÎráÐËÀðöu™‹ÂäA,˜·¦Ä^Èf'uëÚ‡ú– ‰ŽŽd‹ãJÞb Wž†O q#Y\È•kç8sö½†ÐË~³æŒ¡j•ê‚— `ß-xûĞ㙳‡PRR‚²cc£Ù½o#¾4jØŒGNaéòYT3®¾~y^x?£j•ê¼#55kë¦BgÑÃÓ «ú„afÿ€—T®lŒ†º^/žaÝ  H¥R^¾ô #3ƒ†6Í„EœsssyäO|| õë7R–M`ùç2‘uS@f¤äææR¯®‰>/=01©‰®Ž>‘Qáü0²'W/¹ËÍæÎÌÌÀç¥ÙÙYÔ«×@Î(HKKÅë…;Õª™R®œÑёԪ)û>}IMOâ·ãb }‹¥…Pœœ^úzR½º©ojj ïÃC©k^€¸¸|ý¼¨\Ù˜J«$Œ°ðê•7UM¸qó"Þ>ÏçENNö'¹³±´´‘[êëõ›W¤¤$ÑЦ—¯žåêµóìÞ!¿~d~~o4]0y IDAT‚üùø1’êÕL©Zµºo—››ËK_O¡] Ó{xº¡©Y³ÚõÈÌLÇï•7õ-Ò¦ƒgNÜ!1)ž¤¤¬4VÊxáý”ºæVB›¾ö£BùŠhkëʽ'øúy‘’’L£†Íc///·oˆŽ‰ÂÒÂF.Ì©°¼^<Å´Fm¹…Ù?D¾Gš/<æII øúy¡®®I½ºVrï@@àK´´´…°© ·(+«‹ŸÇÇÇ2hX'íw.qôJäûQd'•ÿ*ÏÈ–åIOOz´¥Í©3yñâ)kVíú[òÿ§‘J¥ Ù1£¦ÓªåŸÅ‹ˆüÝ”¶XZÆ.Þ»õRn2Ü¿‘‚‚âãcYôëtš6iYÌõoÅ×Ï‹µë²zåNrssY´d#†O¢m›/Æ/dü¤ôì1@ˆ;/mlíL9wúž``ýã—…“1¯cù—×ó)=¾Ö@üÏï}ó><”±û³qóR~Ó ûž¾Ú87fÏ=žÈ-ô)òåœ9w˜Ê•«‰Æ¡ˆÈŸ"¡šq ÿiAþ”Ð ¦þ4œºæõÿS?ðõ¬éÚ¥+WÏcÛöU 8š–vþR^ Y‹³óI¹¥Jãª&:å¿Êë7¯HOKeðÀÑžXä_ÇÞƒ2ö›·þXÖ³–›ÑüµüÞ^Ì¥ÁûðPãÿUû –&â^Ì"ÿ6þ­D‘‚¯õ ~Ó$• zzØê}{lÑ ãK›ªUªSµJõ¿-ÿšÂaEDDDDDDþûü燘EDDDDDDDDJÑ@‘C4EDDDDDDDDä(•ÄÓgòؽøöm""""¥Iµª¦Ìø´¨±ˆˆˆˆÈßG©ˆ!ao¨[·¥‘ˆˆˆH19tèØ?-†ˆˆˆÈÿ¥6‹ÙÌ̌ο|«(‘¯A[[[4EDDD¾ÿ/–¹ù·û‘Wþâ‚û"""?­ì:ÊmŸ[šˆ¢ˆˆˆH)òâÅS¶n_Í?-ŠˆˆÈÿc®]»Ê“GAr{c—&¢("""RÊ´hÞ‚3gOÿÓbˆˆˆü?FUµÌßšÿw]æfÅŠÌ;—¹sç²víZüüü„{óæÍc×®]ø|nn.¹¹¹¼xñ‚Dz å333KMΘ˜š4iBzz:IIIlÙ²…qãÆ±dÉnܸQje´nÝŸb×çÏŸÏŽ;¾:¿û÷ïãìì @~~>ÙÙÙß,£‡‡ݺuûæ|DDDDDDDþý|WqëÖ­Ô¨Qƒ¦M›¢­­Í„ ˜7o™™™jÈlݺ•Ë—/ðêÕ+Î;€··7³gÏ.59§M›Æ´iÓPWW' +++bccéÓ§UªTaΜ9¬ZµªÔÊKMM%??¿Øõ+V0qâįÎÏÍÍ[·npùòe¶lÙòÍ26lØòåËsðàÁoÎKDDDDDDäßÍwbîÔ©U«V sçÎX[[³lÙ2¹4>>>,]º”ÈÈH,,,X³f ^^^lÙ²===TTT„´ñññüøã$$$`ddÄüùó9zô(GŽA*•òÃ?0|øp™={6¶¶¶ü-2îÝ»—ŒŒŒbׯ_¿Î›7o¾:¿¼¼¼G޾ÜÝÝK5O‘ÿ]¾»8sæLÁ«6eÊ”bÞC///TUUqpp@CCƒ‘#G Þº/áÒ¥KXXXðêÕ+üüü°´´äÚµkH$¤R)C† AGG+++Z¶l‰íÛ·ÇÛ[¶,…¯¯/B ¢–– SŽ>¯^½B"‘ššÊ¬Y³ÐÕÕ¥F\¾|nݺ…ªª*Ïž=d m̘1¨««3hÐ \\\¹ŒŽŽ7ÆÓÓS®N¤§§Ó¥K´µµyüø1-[¶DGG‡[·nqêÔ)LLLä Î’¸|ù2xzzŒ¹¹97oÞD"‘ ££CçÎ)_¾r ¨¨X¬W†¡¡¡p.‘H„¶Üºu+®®®Ô¯_Ÿ_~ùåOÛ&&&Fh›víÚQ¯^=¡-þ¨m@ö}DEEýa9"""ÎÁƒ9|ø0îî»óæÍæÌ™Ã¤I“Oqqq‚W(??ŸçÏŸãáá!䓟Ÿ——YYY<~ü¸D}éãã#tTjÔ¨AÍš5…óÔÔT=z$gèdggãêêÊÛ·o¿¨>¹¹¹**Š÷ïßΆ ¸wï)))¼{÷Ž;v°téR@6É188˜ÀÀ@?~Lhh(vvvBŒ{JJ AAA„…… xVV>”óþ¥¦¦Hrr2...äääÈÕ1//'OžÈ¢XYYQ¡BáüãÇ<}ú”‚‚¹||˜±cÇ2qâDÒÓÓ9r¤699™àà`jÔ¨¯¯/¶¶¶_$S“&M !//%%%Nž<‰±±1êêê4hÐ;;;222¨P¡‚ 0‹RX~:uPSSÚ& ccã= ¿Ç›7ohÛ¶í§)™õë׳}ûvÊ—//\ëß¿?ýû÷dF‚½½=¦¦¦téÒlllhÓ¦ ùùùŒ?žçÏŸ“‘‘A«V­èÛ·/*T`ܸqÌ;—¡C‡°oß> ‰ŠŠBUU•ãÇsèÐ!ÒÓÓY±b[·nÅÉɉF1fÌ>|Hzz:öööôë×ÀÀ@444Ø»wïïÖ%-- ààà@BBáááܺu‹ýû÷£¯¯/xW¬XAùòåéß¿?:t }ûöÄÅÅ1mÚ4ÜÜÜðööfþüù4kÖ¬X°eË–,[¶ŒÜÜ\üýýéÞ½;GŽaÞ¼y0{öl¬¬¬8wîË—/ÿ"™”••3f ­[·ÆÖÖ–‹/òôéSΟ?ÏäÉ“éÑ£ôíÛ·˜B033cëÖ­˜ššòÓO?ѹsg²²²PWWçÆ}úP¿~}‚‚‚;v, ¸»»£¬¬L™2e8xð ?fêÔ©hkk°gÏjÕª€šš×®]`âÄ‰Âø²eˈ‰‰áåË—¬\¹R0;v숷·7ööö‚§uèС’A?üð&&&B|¤§§'®®®hjj²dÉTUU©Y³¦œw`Ë–-T¯^y/ =¾žžžþ¡XDDäÏQPPV>(Ô%Ó¦M###ƒÀÀ@騱#ªªªB‡LKK‹/^°ÿ~222æãÇB~…+˜››Ëur›4i€ªª*iiir8)[¶,ššštíÚx#GŽÄÔÔ”nݺýér[ššš~üÈñãÇqww/ÑKÿáôµµ‘H$ܸqƒ¨¨(ÒÒÒYÇòСCdggsîÜ9ììì¾H---ÌÍÍ9|ø0iii 0€ .°k×.Ž9‚žžèëë †jrr2aaaÂ'99™>žÐ3gΑ‘!È6`ÀîܹÃýû÷…ÎiçÎ9{ö,ÑÑÑàââB§N°´´äÝ»w$&&Â7„!q555ab`áJ…lß¾Q£FqãÆ RSSy÷î›6m"==]©ùm[êêê"•JÙ»w/ÊÊÊ‚¼)))œ;wŽÌÌL._¾üÅmÙ°aCÞ¿ÏÇIHH I“&2kÖ,\]]©Zµ*½{÷.1Ü©hݺvíÊ¡C‡HLL$>>ž¡C‡’ššúE2"†‰”¢X ¬X±B®Çù­èèè°råÊRËï{cee%ôþEDD¾ÚµkãììŒ]ºt¡_¿~¸»»sçÎ7nŒ’’’0š0|øpòòòhÛ¶-oÞ¼aÏž=œ:uŠÐÐPÊ–-K•*UèÔ©éééÂdµúõëËÅl·jÕ ‰DBÕªU111dA 'æÙÚÚ2pà@úõ뇫«+vvvLš4‰M›6Q¦LªU«F@@#FŒ>W¯^eÒ¤I„„„СC²²²Ø¶m[·n%>>555Ú¶mK·nÝ„éQ£FѵkWz÷îÍøñãY³f 4@CCƒ гgO/^̼yó„’Ÿ~ú‰yóæqãÆ lllä–…éС{öìÁÙÙ™–-[2zôhâââxþü9åË—§\¹r4hÐ@H?gÎîß¿O·nÝ044dÍš5,Z´ˆ¼¼<6lH`` :uÂÚÚšü€®V¡¦¦&Œp™››chhˆ‚‚×®]ãøñãôïߟŸþ ~üñGvíÚEóæÍÙºu+Û¶m V­ZBG`äÈ‘899áèèÈœ9s°°° {÷îŒ1‚>}ú ©©‰žžžœÑפI!,ËÈÈH˜•G^^+Vü¶Tä ²aæ€áíë/ÐÓ3øêLV­G³æÖBLˆˆˆˆHiãîîÎøñ“9¸×ùÏ©©)´jg.œñÀ;àà øïD (\êàÐÕòítê(?Ì÷%ܼ北÷CΜ=ýÕÏþ222000(ÕÒ$==Fq÷î]¹%̾…ÜÜ\š6mÊ‘#G¨[·n©ä ðôéS¦M›öŸ^lzìØ±4kÖLˆùÿ‹ªjÝóGEEõ‹ÒÒ‘7Aþy@2†L'úðY'&Y¢QDDDDäoáĉXXX0eÊ”R3A¶²ÃŽ;˜8qb±YÙÿ˸ºº*‡"¥Â¿n™›¿“üüüb3ÏDDþ×Ñ×××KûSÚñÒ¥ÉàÁƒ…}íK›&MšððáÃRÏó¿ì=lÑ¢·oßþ§ÅùÂÿÔ¯BPPuëÖECCãŸEDä_AZZžžžr³=EDDDDDþ§ D­yxåÊ•Z ‘}úôù§Eù"Æ ŠˆˆˆˆˆˆˆˆÈ!ˆ"""""""""rˆ¢ˆˆˆˆˆˆˆˆˆ¢ø7qíÚ5N:%÷¹~ý:[·nÅßß_.íîÝ»ñóóûn²¹»»ùEi÷íÛÇË—/¿(íõëׅ휜œþ²|%ÊÖ­[…s///Ž9‚““ÁÁÁßœNN3gÎ,vÝÉɉ[·n}U^¥U÷ÄÄDaÁc‘ï‰h þMhhh ¥¥Å³gÏðôôDKK uuuÆŽKíÚµ‰ŒŒdùò儇‡ Û<}.\¸Àëׯ¿(mDD„°çéŸ+lx¿zõjÂÂÂX»ví_ô,_¾œ^½z°hÑ"V­Z…ªª*Ìš5‹7n|SR©´Ä6éÞ½;mÚ´ùª¼ ëþþý{Ö¬Yó—eÒÑÑA[[›K—.ýå~üˆ……7æÈ‘#DDDP³fM† ÀòåËÑÓÓãåË—ôïߟ   ^½zE¯^½èÑ£wïÞÅÔÔ”*UªàááÁ£G¸ÿ>‰€¶mÛÀþýû‘J¥¸ººrøðaöïß··7ÊÊÊ :kkk¶lÙ‚––>>>¨ªª2mÚ4tuuظq#!!!˜™™1yòdœÑÐРK—.\¹r…[·nQ¶lY¦M›FùòåY¹r%±±±(**2{öl¹í­–.]Jdd$–––%Ö]"‘°téR ðññ‘«»ƒƒ={ödܸq±ˆˆˆˆˆÈ÷Bô ~g"##ÉÈÈ W¯^´hÑ‚=z÷^¼xA`` 7n¤_¿~¬_¿þ»É•••Err2Û¶mcΜ9lÞ¼Y¸ÍÎ;iÞ¼9GŽ`åʕ̟?Ÿ+V°wïÞßÝL¾W¯^´nÝš.]ºpâÄ LMMÙ°a\¾|‰DÂÕ«W– €¨¨¨zßÝ÷_æç>v–…ûs]\îÎÌΜdÏÞåÜŒ5 rAÊá IDATtttÈÈÈ@OOO:¦X±bo¼N__ŸŒŒ jÖ¬Ipp0S§NE&“ uᘘ˜¯&²„††²hÑ"ÒÓÓi×®tLNò™ššŠ¹¹ù;¯ÃÜÜ\š¬£P(ˆÇÊÊŠM›6ñèÑ#Ö¯_ÏÕ«W™9sæ[_omm͈#¤!:::dff~ðÞ222000xgl‚ ‚ÛD‚¨!¦¦¦ƒ‹‹ óçÏçâÅ‹\½z•””jժŭ[·èÚµ+åË—'&&æ÷Þ¼ys~ùå† Bhh(¥K—¦I“&¼.@XX˜Ô²(7n$ @Óaù,00ºuë~ôñóçÏg÷îÝy‘PýöÛoØÙÙi: ‘ æµúõ룣óC=[·n½½=666\¿~«W¯âêêJéÒ¥)]º4K–,áÀááá‘'1µlÙ’»wïJÝÂ666téÒ…/^°oß>:tè@µjÕ8}ú4Íš5ÃÚÚš?ÿü¾ûî;àUù›cÇŽqðàAúô郉‰ µk×F¥RàååÀ×_ÍíÛ·¥IÕªUã·ß~£|ùò|÷ÝwdggÓ£G)¶þýû¿ñØÙÙ™­[·Ò­[7|}}¹té—/_&""‚† 2~üx©{ÙÖÖxµp}\\¿ýö;v¤J•*œ9s€6mÚpìØ17nŒ««+J¥’^½zI×vss£dÉ’8;;£¯¯¡¡!7ndß¾}”,Y’6mÚ §§GJJ [¶l¡råÊtîÜYíÞ4hÀ­[·¸~ý:]»v¥jÕªÒ½·lÙ…BñÁ{E&“afföe?t¡@‰ŽŽ¦T©RôìÙSÓ¡ùdæÌ™]"Gxx85kÖ¤eË–y•PÐŒ1Bê1Ó4‘ æ±zõê©=½ëvÈ!ooggÇ Aƒò4¦ï¾ûNJô^÷Ã?HË•+§¶¯fÍšjÏõõõqss{ç19I’¾¾>C‡•¶çŒßË¡§§§–$õë×ïÇõêÕcÇŽ\¹rEúôíìì,#|]ãÆ¥ÇºººRÒH]ÛgÏž¥dÉ’j3ƒår¹Z‚˜Óe]²dIi›¥¥åIûÛf¿ëÞœœprr’žëèè¨%o»÷ 0iÒ¤7®!h?jÕª¥é0„|’3ôåS•.]Züž!¯;Ò41‹YÐ 'NäÎ;¹r.µÄ¯ ú÷ßùꫯ¤rC‚ ‚_D ¢ ,,,¤º‰_ªcÇŽ¹rž¼faaAŸ>}4† ‚P¹1##ƒëׯk: A(RSS5‚ ‚P©ÑÐÐR¥JåkjA(Ȭ­­¥Ùì‚ ‚£H%ˆÖÖÖ_´6® F¡œ‚ ‚P°©ñáÇ´mÛ–Úµkk:A(nܸÁ™3gÄÿ‰êéÓ§œ}ZªêââÂÌ™3?ê¼§OŸF¥RqõêU233‰gذaXXXP½zu¬¬¬¨S§:::¨T* Åkž šgllL“&M ¥V­Z<{öŒúõë“’’€J¥âüùóRËóóçÏ100 iÓ¦œ>}šøøx:uêÄ‘#Gˆ‹‹ÃÜÜjÔ¨¹¹9æææ>|˜¦M›ò×_Ñ Atuu)Q¢:::ÄÄÄаaCþøã¶mÛ&Zœ ‘ j±ãÇckkKµjÕÞy̳gÏXµjÓ§OëþK—.aggGéÒ¥s%&¥RÉÔ©S™Ï¥K—°µµ¥L™2_À¼yó8p V¬Ð"h—Æ¿·ú‚…… $%%aiiùQçµ²²¢S§NÒÒ—9kÆ¿>‘E.—«­%/\=zô`Ñ¢EDFFJëÖçÉdØØØ0}úti’‰\.G¥RHll,ÇçôéÓ„††Ò¤Iéµµk×ÆÆÆ?~̉'(Q¢wïÞ•ŽÉÈÈÀÌÌŒÌÌLÂÃÃ)^¼8÷ïß—Z!í$þçk©ÄÄD–/_þÁ²=666L˜0áûûí7nß¾ À°aþ8®M›6Q¹re 9~ü8ýúõãÁƒØÚÚ²k×.Ư6~êsDFF’žž®¶ÍÆÆ†qãÆ}Òyöïߟk÷þÃ?0kÖ¬/:‡ |ŽæÍ›³mÛ6îÞ½ËêÕ«¥uÖMLL¸yó¦Ô혳-::š˜˜š5kƆ xüø1{öìaÿþýšº!T®\™ôôtBBBÞºZTÆ ùå—_ˆ‰‰aÉ’%ܽ{—bÅŠQ¼xq>|ˆ­­-uëÖeÍš54kÖLzݵk׸xñ";wîäèÑ£¸ººÒ¤INœ8Á•+Wؽ{7eË–ÅÀÀºwïÎÌ™3™6mš4^QÐN¢QKíÛ·®]»räÈ"""¨P¡gΜáòåËŒ9’›7orðàAȲe˘3g{öìáôéÓdffÒ®];Ú´i#oûöí\¸p¹sçâëëËÎ;9wîtïÞÊ•+ãççGåÊ•9qâ666|ûí·ìÚµ kkkfΜIVVÛ¶mãÀ¨T*üüüð÷÷§^½z´jÕŠóçÏ“Mxx8äöíÛ >¥RÉÆQ(8;;Ó¯_?._¾Ì©S§ˆ‹‹#&&†¾}ûÒ´iSNœ8ÁòåËÑÕÕeòäÉdff²bÅ fÍšÅ?ÿüÃÆILL¤cÇŽ´hÑ‚½{÷ò×_‘™™‰››mÛ¶•î}ÇŽj÷¾k×.Ξ=‹¹¹9Ý»w§J•*L›6J•*qâÄ ¬­­iÑ¢;wîÄÊÊŠY³fQµjU ¹|ù²X;YÈ5åÊ•£eË–oÝסCÌÍÍ)W®¥J•âÈ‘#´nÝZúÿ6~üxŽ?NÍš5éß¿?úúú|õÕW4iÒ„K—.Ñ®];Ê–-Ë¡C‡°··§C‡ôïß_ºÆëûöí«6öQ(xFÅãÇ111@OOOZ®sܸq\¸p={öàì쌓“ðêç ¼ú°‘šš*•RêÝ»7aaaÈd2Ê”)ÃæÍ›±²²`ýúõìß¿{{{–.]Jzz:¥K—¦]»v 2„ˆˆÑЍÅD‚¨¥öî݈ 055eÇŽLœ8‘ƳeËþþûo–,Y‚ ÈÌÌ$** …BÁÚµk9xð …âÖ‚®]»ˆ¯¯/áááœE¡PP§Nµë|ýõ×dff²oß>víÚ…­­-7nd„ ØÙÙÑ«W/Ú¶mKZZ‡æàÁƒ¤¦¦Ò»wo)AÌÊÊbÙ²e¬]»–£GÒ°aC}ZíÞïÝ»' ônܸñ;ïÝÑёʕ+sðàÁù ‚ B&D-´}ûvjÖ¬)Õ©ªR¥ GÅÍÍëׯãääÄ_ýE=Ô^7yòd’““ ¥OŸ>>|ø­ç·²²ÂÕÕU­¥!g`sο2™LÌžÓíd`` îµ´´ÄÐЫW¯R¿~}ú÷ïOÿþý @©T`jj ¼*ê:uêTV¯^¥¥%ƒ–®›3ø^ „Îé:É™èò¿]^úúújããââ033Ã××WíÞCBBÞ{ïƒ zãÞ_¼ÿ¶)ÒÓÓÑ××ëyAA›ˆI*Z&66–;wî0qâD¼¼¼ðòòbܸqìØ±ƒ¸¸8‚ƒƒñ÷÷ÇÑÑ‘íÛ·K¯KLLdĈÄÄÄP©R%,--Õf'êèèÍýû÷iܸ1GåöíÛܸqƒùóçÔØ£J•*&=Ÿ={6~~~¬^½š7n°mÛ6þüóOÕ^§R©HNN&>>ž^¼xÁ£G€W-x§NâÏ?ÿÄÜÜCCÃ÷Æ —Ë©Zµ*›6mâÊ•+xyy‘˜˜ÈðáÃß{ï …‚{÷îѸqcŽ;ÆíÛ·¹yó&óæÍûèqW÷îÝ“ZP!¯å”_ùó%EhAÔ2/^¼`âĉjIK¥J•hÑ¢wîÜ‘ÊËx{{³uëVÌÌÌèܹ3¦¦¦ 8ŒY¸p!:::¸ººR¶lYd2S¦L!$$„ádzvíZ8€L&cÈ!´oß Z·n-uã6oÞœ²eËRºtiâââHNN¦xñâ|ýõ׬ZµŠ³gÏräÈ*V¬È¯¿þŠ©©)111´nÝxÕ8wî\öïßO½zõX²d ûöí£D‰4mÚ”èèhÒÓÓ ÀÍÍM*åQ¹re,,,077—ºÍ-ZıcǸ|ù2K—.ÅÂÂwwwéÞ,X€\.ÇÕÕd2?ÿü3!!!Œ1â­÷Þ®];J”(¼šl“Ó5Þ¬Y3iŒØ¥K—¤®iAÈkIIIDEE‰24ù@©TR¥J±±P¤ˆQËT­Z•ªU«¾±ýõÁäðª[4gbΘ»ÿÀ àêê*=nݺµ”´YYY1pà@µc__ ¾U«VÒã×#5Š€€|}}pppP«W˜£dÉ’Òµ@}@=Àˆ#8}ú42™ìÒnnnÒãÊ•+S¹re)AÔÕÕU›¡ý®{Ïǘs?9÷ô9÷~üøq¤X!?˜ššJ3N…¼ózÍ?A(*ÄGO!W}ûí·ØØØ––öÅç²³³ÓšÁŒ3FÓa‚ B®-ˆB®{½L—ptt|c¼bA•[÷,‚ A‘K“’’Ø»w¯¦Ã„!>>^Ó!‚ P‘JÍÌÌhÓ¦ wîÜÑt(‚P |÷ÝwÒäAû¤§§óìÙ3M‡Qè‰YÌBQT`D•J%ÕÔË úúúØÙÙñ믿æÚ9¡0ÉÎÎV[·÷Kèè舟yL¡P--“&ä­/]C^´MMÿùçªW¯þÖ‚ÄŸ*++KZ[·Zµj¹ ­Zµâ?þ`Ê”),Z´(WʦT­ZU*ä.ä ¹\Ž‘‘öööš¥Ð ëP ENM*T¨+K—õêÕKzìèè(–C„ÿﯿþbÇŽÒó#F¨­ ó9îÞ½ËÔ©S¿44á#ˆ–Úü!’C¡(enAA5"AAAÔè.fAáݲ²²D©¢| T*5‚ ä;‘ ‚ 0Ož<ùà1:::(•J^¼x‘mººº$&&’™™ùÁcmmmÅúØB¡ DA„æåË—”*Uêû¥ ùV‘Ozz:éé阛›¿ó¸˜˜lll U‚x÷î]ªV­ªé0  â'R(Èd2ÿÈë8ÞuþÌÌLÍšÌÊÊÊ•²G‚  ¬¬¬Þ¹/;;›¬¬,ôõõß{œ;rÖ–ÿÐ÷»°µæfff2tèP|||pssÓt8B>+<srÑÖ­[ùûï¿Õ¶………̪U«¸víÚg÷üùóŒ3†1cÆ0{öl~ÿý÷Ï:B¡ÀÃÃÿýW:ïäÉ“:t(K–,!""â³Îûº¹sçrêÔ)µmÙÙÙ >ü“ÎsìØ1Nœ8Àƒ¾(¦+Vpøðá/:‡ ‚ðq¶oߎ……óæÍ“Þo„¢C$ˆoaooϺuëÔ¶mÙ²KKK<==©U«–´=99Yzœ™™IVVð*™JOO^UàOMM%** &MšD×®]Ù±cÇIXRR’ô8--MZâI©T’’’ÀÚµkiÛ¶-–––ìß¿Ÿ дiSæÍ›‡““ÇçßÿE¥R‘––FFF†ôZ¥R©ö]¡PžžŽR©$11ñïEJJŠ´¢®®.‹-zg¼ðjé¯×·Ý»wÈÈH233ñóóSPŸžž®¶„UÎó„„iE¤¤$é˜!C†°aÃÞˆSAÈ=ééé¬^½š9sæÐ±cGfÏž­é„|&º˜ß¢I“&Ì™3‡—/_beeEzz:§Nbâĉ̜9“Ö­[ãââ´iÓ(V¬iii|ÿý÷ܸqƒQ£F±aÃNœ8Á† ¸}û6k×®¥Aƒaee…•••*U"..€#GްgϬ¬¬HKKÃÏÏS§NqþüyfÍšEpp0zzz¸»»³cÇŽ= @@@~~~4iÒxµ¶n“&M000 &&†‘#G¢««ËСCÉÎÎfíÚµ”+WŽgÏž±jÕ*"""˜4iŽŽŽ$$$`gg'9>xð üñQQQŒ9’ºuëÒ¡CþüóOÎ;ÇÆ177GGG‡Y³fHxx8ÅŠ#;;› HßÓóçÏsóæM–.]ŠŸŸ .”î½zõêôíÛ—Ù³g£T*ÉÎÎæúõëtëÖ{÷îñÏ?ÿ°fÍ,--iÕª¿ýöýúõË·ßA„¢fãÆÔ¯_ŸªU«R®\9~øáŽ?ηß~ûÑç8zô(.\ eË–Ô¯_¹\ž‡ ¹M$ˆo¡££C×®]Ù·ožžž„„„ТE ¤c.\¸@É’%=z4III >œ+V°~ýz®\¹‚µµ5©©©\¸pfÍš‘žžÎáǹ{÷./_¾ÄÞÞž &°fÍÖ¬Yƒ©©)Ë–-ãÌ™3´k׎'N°cÇþþûo‚‚‚xþü9VVVÈd2233yùò% 4^É™ýhkk‹®®.·oßæÂ… ríÚ5/^Œ••~~~œ;wŽR¥Jñüùs¶mÛ†\.§S§NR `¹råðööæôéÓ„„„P·n]éþׯ_ÏŒ3(Y²$û÷ï'))‰ƒ„½½=áááj­ƒM›6ÅÔÔ”)S¦ðìÙ3ÂÃà àǤW¯^èêêbkkËàÁƒ™6mIIIÌ›7E‹qñâEÚ¶mKåÊ• É»¾ B—””ÄúõëÙ´iÌœ9“ñãÇS¿~}LLL>xŽ“'O2}út:wîÌܹsyþü9®®®´jÕŠ† ŠñäZ@t1¿CçÎÙ¿?»wï¦Gjû/_¾Ì¹sçðööÆ×וJ…¾¾>ººº$$$ T*qvvæòåË\¼xQjákÓ¦ «W¯fÆ Ô©S‡iÓ¦‘žžNll,¦¦¦À«åsÆ9úøø0mÚ4† ‚ŽŽ< |ùòèééallLLL ‘‘‘üþûï,]º”={öHç244 66&L˜Àµkפî^铃ƒwïÞÀÉÉ ##£7ÆŸ„……Q²dI:t耉‰ S¦LaêÔ©ôêÕ‹7n¼óÓâßÿMTTÞÞÞx{{chhÈ£G¤µ²MMM©T©fffR·rùò剌Œü¸¢ ‚ðÉÖ­[GóæÍ¥÷gggš7o®Ö3ô.çÏŸgÒ¤I¬X±‚1cưoß>¶mÛFùòåY±b7fܸq9rDŠ%<¢ñJ”(AÕªUÙ·o2™ GGGµýÕ«WÇÈȈ¡C‡‘‘®®. 4à—_~¡fÍš8;;³cÇÒÓÓ±´´T{½‰‰ ­ZµbĈ`hhHzz:DEEQ£F V­ZŸqãXµjÁÁÁØØØ¨Í”svv&$$///\\\pqqaëÖ­Rò÷úŒã%K–°sçN 7nœ´ýñãÇÒãgÏžQ¡B…~ìíí¥.ø .PµjUªW¯ÎÚµk‰ÅÝÝzõê½õµÕªU£råÊ,]ºTúÞéëëêkž¾mýÓçÏŸcccóÁøA„O÷ï¿ÿ²uëVvïÞýƾ±cÇÒ¾}{Ο?Ï×_ýÖ×_¹r…±cDzdɵñúxxxàááÁ³gÏ8vì›6mÂ××—FѲeKÜÜÜD7t"Ä÷èÑ£C† ÁÏÏï}7fóæÍèé鑘˜HBBÓ¦M£I“& 0€àà`*T¨ÀÉ“'ÕÊ\¹r…åË—“’’ÂÕ«Wñðð K—.Lœ8‘š5krîÜ98yò$ÙÙÙ 8ôôt~ýõWúõëÇÇ¥ó͘1ƒAƒIcC¢¢¢ˆˆˆ`æÌ™oÄlaaÁæÍ›IMME&“qêÔ)‘ËåÌ™3SSSÌÍÍßHfߦcÇŽüüóϸ¸¸pøða6n܈»»;-[¶DOOCCCìííÕ^SªT)V¯^ÍÀÉÌÌÄßߟ%Jð×_ôQ?“°°0©eQAÈ]«W¯æûï¿kÎâÅ‹3mÚ4¦NÊþýûÕ†]ü÷¿ÿeøðá,X°ggçw^ÃÖÖ–>}úЧOâââ eýúõ„……áãã“ë÷”Û /_¾”zÑ +‘ ¾GݺuY¹r¥Ú§ OOOJ”(©©)›6mâÆèééQ¹reàUËâÊ•+©Y³&2™ lmmpuu•šìŒŒðññ‘>- 8øøx¹P· BQ"“ɘ>}:666Œ1BªÍû!ÑÑÑ>|OOÏknnޝ¯/S¦L!<<ÆŒóÅ-U«VeòäÉŒ1â­uy ‚ãÇS¼xq\\\4JžÓÊÄçÏŸóË/¿p÷î]¢££Ñ××§B… 4nܘnݺi|¼ü3ÃøK¿w¬HA’SÎGȧNâСC„……‘˜˜ˆµµ5+V¤W¯^j­Ô‚W …˜Àð‘ttt˜3gãÆcôèÑ,]ºôƒß»+Vлwï÷®5ýºï¿ÿžC‡Iãçøá‡Üï¿ÿž[·n1vìX‚‚‚ Üûypp°49µ°+Xßù°sçNÆŽKݺu™5kGŽa×®] 4ˆØØX<==¥’)‚ |™„„|||8~ü8?þø#6l 44”€€Ú¶mK@@K–,A©Tj:T¡ËÎÎ&,,ŒØØXM‡¢5är9 .`ܸqjuiÿWDD§NbÀ€Ÿt©S§2a„7ÊÀ}©1cÆ P(X²dI®ž÷K]¸pŒŒ š5k¦éPò…Öµ êé驽ƒWcßœœœprrâÑ£GÄÄĨ§áó<þœ~ýú½1Ö6gÌÀÀ€   nݺ%-—wýúuîß¿O·nÝ4Ý»¹¹¹áêêŠÆÆ:‡‡‡sëÖ-©³¨ÐÚDWWW©Sή]»¾sy7A>Ÿ““+V¬àÔ©SRmK™LVລ„Â!++‹‡R¦LµåBsÈårÊ—/σxüøñ5`…·322"88www–.]ʵk×6lºº;;v,žžž,_¾œ#Fäûõƒƒƒ0`@ÿ>å6­½Ûàà`ÆŒ#QÄØCAÈ#'OžDOOOmuÑÅ,ä…œI)VVVïíz=IŒŒŒÄÀÀ™L&}jÏs¾LLLŠÜýëLLLX³f  33“:h:¤Ê™lÓ­[7j×®­¶àB^‹ŽŽæÜ¹sLŸ>=ß®YPhíÿGGÇ"5XT4ÉÔÔµ•x!/DGG£§§÷QcÊutt(_¾¤bÅŠægúôéS’’’(_¾|žÅ$“É(]º4/^<ßZ¡„Ü3~üxºwïNÇŽ±²²ú¤×Eff&™™™ddd••%=ÎÙžó<##ƒÙ °Z› ººº’œœÌÕ«Wùæ›oHKK“ÆF ‚»J–,IË–-yðàééé”+Wî­“„‚+..ŽgÏžagg‡……=âÉ“'Ÿà¡R©xüø1™™™8::æy—§VVVDGGù®fmTºtiºv튿¿?³gÏþè×mÞ¼™?ÿüwwwôôôÐÓÓC___zü¿_9ûôõõóðn 6­MwíÚÅÞ½{IKKã›o¾aäȑ̘1CmÒŠ ¹ÇÓÓªU«†««+;wîdÖ¬YšKø…BAtt48::JoxöööÜ»w„„ÌÌÌ4›R©äÁƒÈår*T¨oŸ¬­­¹ÿ¾èjÖRƒæûï¿ç¿ÿý/NNN<þöíÛ¬X±‚­[·R¶lÙ|ˆ°p(} ŸáìÙ³lÞ¼Yúد_?Μ9£Ù ¡ºrå Í›7gêÔ©ÔªU‹¬¬,²²²4™ð>©©©Ü¿¹\NÅŠÕZCtttppp ::ZZçC /^¼@¥R}qlÙÙÙ„‡‡£¯¯OÙ²eóuV¼L&£L™2<}úTük!###FõQ-ˆÉÉÉŒ=šÉ“'‹äðim‚(“ÉÔŠfFDDh¼«D +###RRRÔ¶¥¤¤ˆ1\Ø‹/xðà¶¶¶ØÛÛ¿5344ÄÚÚšG}0éS*•DFFGDDÄ%VÜ¿333µIOùéõ®fAûtìØ…BÁÞ{ÜÔ©SiРnnnùYᡵ bË–-éܹ3×®]cÀ€œ¶¶¶FGG‡˜˜˜w£R©xøð!úúúT©RSSSîÝ»Gbbâ'Ç–ššJxx8666ØØØ|òës“µµ5YYYÄÅÅi4áÓÉd2&MšÄâÅ‹IKK{ë1Û¶m#<<œI“&åst…ƒÖŽAtqq¡e˖ܸqôôôˆãI!¤§§3wî\RSS‰ŠŠÂÉɉ§OŸj:,ᬬ¬044üènÛ2eÊpïÞ=LLL066~cÿãǤ^kkkŒŒŒxôèÉÉÉØÙÙ½÷ZJ¥’ÔÔTRRRˆ¥téÒ˜šš~Æå®œ®æÔÔTM‡"|†ÚµkãììÌêÕ«ßXaåîÝ»,[¶ŒÍ›7¸rNÚBëZ øúú…™™ ìÚµ‹C‡i:>333¢¢¢ðõõ%==]Óá oaddôIcútuu)S¦ =B¡P¨í{úô)™™™888¨ÓØØ˜J•*‘™™Ixx¸Ú8ÆÌÌLâããyòä ÷îÝãöíÛÄÄÄ R©¨P¡BHsh]=@áÿŒ3†­[·ª­ËššÊèÑ£™8q¢X3þ h] bVVÛ·oçÖ­[L›6MÚnii‰æ„B*<<œcÇŽñâÅ BCCW-/ 6ŸÌ ‘âÅ‹cffÆ£G¤É/_¾$)) GGÇ·Ö&”Ëå”+WŽ—/_rÿþ}ŒIMME¥Radd„±±1öööŸÔš)ŸÂÖÖ–¾}û²`Á–,YÀ´iÓ¨W¯žV,#Xi]‚h``€¯¯/mÛ¶¥víÚšG ½ºuë2oÞi-oáÝ´2AtttD©T’œœŒ©©)'Ož¤|ùòØÙÙi:…S?Ñõë×ùñÇ¥R%¾¾¾˜ššŠ®gA„BJkD•Jŵk×HJJÂÁÁ¨¨(ÌÍÍ5–P€=~ü˜íÛ·³}ûvž?ÎÆ5’Ö°··çæÍ›lß¾V­Z¡T*yùò%zzzšMAÈZ› öìÙ“ 60~üxΞ=KÆ 5•P-X°€¾}ûâààÀâÅ‹ âöíÛšK+T®\SSS^¾|I§N8}ú´XjO¡ÓÚ‘úuëÖÅÔÔ”*Uª‹··7&&&šK( .^¼ÈÍ›7Y°`ðjɰ)S¦0zôhöìÙóÖåÅ„ÿ£££CÇŽÑ××—VžhР¦ÃAòˆÖ¶ Nš4‰;wî¯ÖùôõõåÁƒš J(”J%sçÎeìØ±jµ±Ú´iC£FÔVäÞ...ŽŸ~úIsøøñcÆŒ£á¨A„¼¢µ bRR?üððjáøAƒqùòe G%D»víÂÀÀ€víÚ½±oâĉܻwÝ»wk 2íñ÷ßÓ·o_i%•6mÚ ««Kvv¶†#Aò‚Ö&ˆÖÖÖþþþ,^¼˜û÷ïçstÚã믿æðáÃ\¸pÈÈHöïßŽŽŽ¨')‚PHií_woooöíÛÇÞ½{±··§ÿþ”,YRÓa ̪U«hÒ¤ _}õÕ;)_¾<ãÇgôèÑìܹS,Ñô&&&xxxðdz³³èbA(Ä´.ALIIÁØØCCCzôèA=¤}YYY½n¨PøEEE±gÏöïßÿÁc;vìÈùóç™={63gÎ̇贃B¡ ;;¹\NµjÕ¨V­š¦CAòÖ%ˆ&L`ùòå 6Œ¤¤$µ}ÞÞÞ´hÑBC‘ Íüùó8p 666uüÔ©SéÚµ+‡ÂÍÍ-£Óׯ_çúõëT«Vùóç«í“ÉdìÙ³GC‘~ï+B®P(ò1!‡R©|ïÏE¥Råc4‚·´.A\¾|96lÐp$BAvöìYÂÂÂð÷÷ÿèײxñb<<<øê«¯pppÈõCݺu©[·.{÷îÕp4E‡žžï=ÆÄÄ„„„©šƒw %J” 99ù½?­Ö/oк1ÇöíÛÙ²e ÉÉÉÒ6Ú¶m«Á¨„‚@¡P0wî\Ƈ¾¾þ'½¶J•*x{{3zôh¶mÛ&†,üéééøúúróæM©•DGG‡£Gj8²Â©jÕª<&))é^!oèêêbeeE©R¥4Š ä­M>ÌöíÛÅ„á Û·oÇÜܜ֭[Öë{ôèÁ… X¸p¡X³ùÿ;{ö,Õ«Wÿ¤Y!o©T*ôõõ±··×t(…^xx¸¦C„|§µ ¢……Å'· …_bb"+V¬`íÚµ_tž3fÐ¥K4h Ƶ666DFFj: áèèèˆõ°óL&Ót‚ï´.A\´hIIIdeeñÃ?P«V-iÜGÇŽ©S§Ž†#4iùò帺º~TÝû˜˜˜°hÑ"† F5¤ÑEÍýû÷Ù´i2™Œk×®qéÒ%é{!“ÉðóóÓp„‚ B^к±Aƒddd¼u_Q}^‰ˆˆàÀ¥Fb–w••E||¼¦Ã(ô”J¥¦C„|§u bŽùóçóßÿþ—êÕ«Ç­[·Ø±cÅ‹×th‚œ:uŠHerÓܹséܹ3 4 Q£F¹~~m‘‘A§N¨R¥ ¶¶¶ìÞ½›Ò¥K3mÚ4M‡Vd+V ===5J¡W¼xqQÂF(r´6A¼sç7n”ž>|˜?þøƒ.]ºh0*A²³³™?>&LÈ“²4æææ,\¸1cưvíZ,,,ÐÓÓ“¾ŠÂöS§NÑ»woz÷î-m6l˜X½Hƒ E+® yFkDGGGbcc±´´D¡PpçÎ1Û´ˆÚ²e %K–ÄÕÕ5Ï®Q¯^=úõ뇗—™™™ddd™™Ivv6ºººèëë«%¯?×>}}}©H__ŸöíÛØ:kUªTáÖ­[¨T*d2‰‰‰Èår‘ ‚ RZ› þóÏ?|ûí·ØÙÙñâÅ ôôô8uê}úô-‰ED||<üúë¯y~-<<<Ô¶©T*233¥¯œÄ1çßÿÝþ®}7nÜàñãÇvèçÏŸ³{÷n¶nÝŠ¹¹9=ÂÁÁN:°~ýzÌÌÌ4¥ ‚[´6A\¾|¹Ú¬Ò””âãã±··õ‹e˖ѦM*Uª¤‘ëËd2ôõõ¿øw.))‰Ö­[ãííMÉ’%s)ºÜS³fM<¨6+,,ŒÊ•+ˆ±¿Ÿ!33S¬„R„dggÖë222ÄïIR&Dim‚¨P(Ø»w/Ïž= 22’öíÛqý;A{Ü»wÇóûï¿k:”/fbbBçÎY·n'NÔt8oÐÓÓãÖ­[„††’••…R©äüùóìÛ·¯H–ÿùRìÝ»W¬o]Äèê~Ú[®±±1+W®dåÊ•y‘P” QZ› N›6Úµk†««+qqqbæ"fîܹ 2sssM‡’+ @ûöí ä==}ú”ùóçÓ A’’’Ëåxxxˆäð35ŠQ£Fi: ¡€ó÷÷Ë[ S0ÒÔÏäáá­­-}ûö¥uëÖœ]]]ºwïή]»xðàAž–9ù‘‘‘xyyáççGJJ gΜÑtHZ+33“‘#G2pà@êׯ¯épr]éÒ¥iÔ¨Û·o×t(jÊ–-‹§§'ÅŠ£mÛ¶ÌŸ?777QæF¡ÒÚ1ˆgÏž¥}ûöÀ«UU ªGáááÁ¸qãhÕªzzz,]º”Æk:4­4sæLÊ”)À4JžñòòÂËˋ޽{˜å#ÃÃÃ)Q¢úúú´mÛVŒ÷A(ä´¶qß¾}<~üXÓa¼×³gÏpwwç§Ÿ~ÂÍÍ €æÍ›#“É ÕptÚgçÎܼy“Y³fi:”|Xj}Ö¤¯¾úŠ;v˜ú\Ú.44”ýû÷k: A  áÇS±bEM‡¡ bll,&&&Ò¬à&MšðÍ7ßh2,ñððÀÍ;ó¸‘#G2eÊZ·n] Zˆ *…BÁ¨Q£èÞ½{øùæ§Aƒ±`Á‚‘ ÆÆÆbggÇ¥K—8vìÞÞÞŽJ{]ºt‰K—.ѼysM‡"B²eË:uê$Äσ§§'AAA˜™™qñâE¼½½ñ÷÷§víÚR⨠ÉÉÉxzzÒ´iS†úÞcëÖ­KéÒ¥Ù¿¿´ž­ð¦ùóçcffÆàÁƒ5J¾kԨŊãäÉ“4kÖLcqìÙ³‡ãÇÀíÛ·ÑÕÕÅÌÌ ¦Nª±¸´““ýúõÓt‚  Ç×t­ë/:yò$}úô¡T©R”(Q‚-ZàææÆßÿ­±¸ÒÒÒ2duêÔaôèÑõš‘#G²råÊÏ^£³°Û¿?gΜaþüùEv¬æ Aƒ Òh {÷îU«àääÄ Aƒ¸wAò’Ö%ˆ÷ïß§zõêÀ«1‡îîî”*UJc³š3226l+VÄ××÷£_W£F ªV­ÊÎ;ó0:ítçÎ,X@@@ÆÆÆšGcZ´hABB—/_ÖX ÙÙÙ¯†rÔ¬Y€bÅŠ‘žž®±¸A„¼£u ¢µµµÔ+—Ë¥z‚üñUªTÉ÷x²²²1b%K–ÄÏÏï“_?bÄ‚ƒƒÉÈÈȃè´S||<#FŒ`úôéT¨PAÓáh”ŽŽŽ4¤BSþý÷_¢££pttÄÞÞž¸¸8^¼xQ`&† ‚ ¹KëD777öïßÏöíÛyþü9‘‘‘%µlä…BÁ˜1c066föìÙŸÕ Z©R%êׯ϶mÛò Bí£T*;v,íÚµ£E‹š§@hß¾=áááܾ}[#×ïÒ¥ Ó¦M㯿þ"55•Ó§O3eÊ:tè ‘xA„¼§u b©R¥X´h‡¢]»vxzzÆš5kÐ××Ï·8”J%ãÇG©T²páÂ/š‰ìííÍÚµkótý]¥RÉðáÃyðàAž]#7øûû#—Ë>|¸¦C)0tuuqwwgõêÕ¹¾»»;_ý5sæÌá›o¾aÙ²e8;;ãå契xA„¼§u³˜¯^½J:uذaÃ[÷§¤¤ðäÉ*Uª”g1¨T*¦L™Bbb"+W®üâ25eË–¥iÓ¦lܸ1ÏfënÙ²…;wîàîîÎÆ±··Ï“ë|‰?þøƒ#GްsçNQoïtíÚ•ÀÀ@¤téÒâÿ• MëþZ„††2zôhîß¿R©”¶§¤¤ Aƒò|<ßÌ™3‰ŽŽ& €bÅŠåÊ9úé'6nÜHRRR®œïuOŸ>eÅŠáååÅÀ‰‰‰Éõë|‰ððpfΜɲeË055Õt8Ž}úôaÍš5ùz]¹\Ž6l ..NmßÓ§O™;w.kÖ¬µ<óÈ… 6l6l`åÊ•ôìÙ“ß~û €ÞùÚµk×’––ÀÀIII!==µk׿Kì‚ h7­kAôññáÚµkÌŸ?Ÿ`bbBjj*zzz4iÒ„Õ«WK3.ó¼yó¸sçk×®ÍÕúvvv´iÓ†uëÖ1bĈ\;/€ŸŸýúõÃÑÑGGGÒÒÒpwwgÆ XZZæêµ>GRRÞÞÞøúújd¢‘¶èÝ»7­[·æÙ³gØÚÚæË5mmmY·nëׯgРA$$$`nnοÿþ‹­­- à»ï¾Ë—XŠªZµj1mÚ4àUÁò>}ú¼1þóÊ•+9rgggš5kÆÕ«WÙ´iÑÑÑLž©œÒ—’ËåR³R©$!!!×~?…O“‘‘±±±Ú„¸œeû&NœÈ¾}û¸zõ*ÞÞÞèééÑ¿µÖݺuëK“&M8xð .\`äÈ‘¬[·Žððpz÷îMpp0¾¾¾tîÜ™ÁƒóÓO?ѳgO|||Ø»w¯&n[ ÐÊàÅ‹œ9s†/^HÛš6mšg-P?~œ 6äÙj-ÖÖÖtìØ‘5kÖ0nܸ/>_\\ , 00ðú§Ÿ~"-- ///~ùåÕ\¹r%©©©øøøhäúÚfÀ€´k׎!C†ä{’vãÆ ®]»Fff¦´ÍÓÓ3_c(ŠrV‹ÊÊÊ";;›1cƨí?uê;wÆÎÎŽž={2pà@|||Ëå”(QBíØâÅ‹c``@ñâÅ9yò$¶¶¶„††bbbÂÙ³géÝ»7ºººüðÃÈård2]»vE__Ÿääd …N E„ÖAÌ1zôh¢¢¢011‘¾rk<àÿÚ±cà—_~ÁÌÌ,O®‘ÃÓÓ“ß~ûM-ñý\³gϦC‡899½u¿NNN 2D#Ož<Éž={X¼x±xÓùH–––´mÛ–7æëuïܹÌ3P(/^œâÅ‹ktYË¢¤N:Ì;Ö®]K£FÔö'''KÃ]tuu?z vzz:öööØÛÛãää$-:`ll,ý400ªCˆ .‚P´hm ¢©©)#GŽÌ—k5mÚ”fÍšåËx= ~üñGùùçŸ?û<'Nœà¿ÿ¯½;‹ºÎ8þšn¹U¼Ñ]“„ä×aZaýÖtÍÖÛÖ4WËÖR×L³µÔ¼]iÙáXvz¤µy<Ä3͵õ‚¼AŽafæ÷Ç8£â ïçã1™™ï÷ûy>¼çs9ÂôéÓoxܤI“˜4i£GfáÂ…56õ·ß~ã7Þ`ñâÅ×´rˆ6l}ûöeذa5Öò{ñâEúöíKß¾}k¤<ñ;OOÏ&ã=ô[·nåøßÿ½cßnŒF£Ó¹w¿ILLäÒ¥Kôë×ãÇsæÌ™ê½!„[qÛ„=zô`Ò¤I¤§§³aÃ6lØ@vvvµ”IDDDµ\ûz† ¦M›8þü¯Óé˜:u*S§N½éD…BÁ´iÓ $55³Ù|GeÞƒÁÀèÑ£7n\¥­›¢r7æoû[îá””ÄX°`ddd°aÆ+¿¾ ªt7¡ØØX|||xüñlj‰‰aüøñœ;wÎ1Þ¸ÿþ¼öÚkо}{<<oß¾}|ÿý÷lܸñ¶ÊS©T¼û5Š)S¦0mÚ´*IΞ=ËæÍ›Ù¼y3¿ýöÉÉÉŒ3Ʊ‡¶pyyy }:“&Mºíkœ:uŠM›6±iÓ&òóóyôÑG;v,:u’É(nêþûï'-- Nç´ ì—-„u“Û&ˆ`Û_xß¾}Žçaaau&AøÓŸþÄŠ+8~üø-m¸páBZ·n}W´}||X¼x1C‡eöìÙŒ?þ–ÎûÏþÃæÍ›Ù´i¥¥¥<öØcL™2…öíÛKWdpùòe7n̹sç8wîœãuI…¢nrÛñ•W^¡¤¤„””„Á`À×××ÕaU)oooFŒÁ¼yóxÿý÷oxì±cÇHOOwlÃu7üýýY¶lƒ ÂÏÏ‘#G^sŒÕjåСClÚ´‰Í›7ãååE÷îÝ™5kíÚµ»ëDíËo¼AVVF£‘˜˜Ù{Y!ê0·M×­[GFFƒ¤¤$ÆŽË?þñÛ‚¬¦ôîÝ›åË—óË/¿pÏ=÷\÷³Ṳ̀I“?~|•-ÅÈòåË8p ¾¾¾ <³ÙLff&›7ofË–-Ó½{w/^L‹-ª¤\Q{ >¥RIÛ¶myøá‡Y»víM¢®a6›9BÜ¥RéX´>qÛqçÎ|üñÇŽ]ÈŽ;êÜ zFżyóœfV´bÅ 4 ÿû¿ÿ[¥eóÿ÷ 0€ÌÌLùäL&Sµ-P/ªVII —.]’ÿ/!nƒÕjE©TÒ´iSW‡RãÜ6AT(X,ÇóS§NUÛ6{®–’’²eËØ¿?ñññNïýöÛo,_¾œµk×VKÙááá|ðÁlÛ¶É“'×¹ZqküüüÐétN¯ét:I6ÜL@@€ü qŒF#/^tu.á¶ âc=ÆÿøGŠ‹‹ú(§OŸÆÇLJ‰'sݲ֬YSi—åúõë±Z­ôë×ï†ÇÝ̼yóxæ™g0Lš4‰ììlbcc9}ú4S¦L¡uëÖ·}Í¢¢">þøc:wî|G1íÞ½›]»vñÊ+¯Üñ½:u ­VËã?~G1ÜÌÉ“'Ù²e —.]bëÖ­€íKBBÂM÷úµ‡ÕjE§ÓqöìYW‡"„Û¸Ûwæv ¢=ÑèÙ³g¥{”Öe/¿ü²c9›÷Þ{¯ÚËkß¾½#_¾|9[¶lq¼g4ùòË/9~ü8 téÒ…þ󟄇‡3yòdš6mê8÷àÁƒŒ;–Ï?ÿœ“'O’‘‘B¡ OŸ>äåå±xñbÊËËyöÙgYºt)Z­–®]»òÐC9Ê[½z5+V¬ Q£FÄÆÆ²~ýzŒF#)))4kÖŒ¥K—¢V«9tè `ýúõóÒK/qòäIŒF#mÛ¶eéÒ¥4iÒ„þóŸ\¸p_ý•Ö­[³dÉüüühÙ²% 4`ãÆxxxЯ_?"##Y¸p!J¥’ÂÂBžþy¼½½1™L,X°­VË!C0deeÑ®];¶lÙÂÎ;éС)))lÛ¶;vàïïï´¾äöíÛY¼x1~~~tëÖŒŒ rsséÑ£÷Þ{/K—.%**Ê1öoëÖ­X,ÆŒÃsÏ=Ç AƒxôÑG«e§šøøxfΜ‰Õj• nÌjµb6›¥ÕWˆÛ`µZëíd<·K7mÚĶmÛ[ÂPѳÏ>KÇŽ]VIHH uëÖ¤¦¦Öèmaa!‡&!!Ë—/ðÍ7ß`4™0acÇŽ¥]»vÄÇÇ“œœŒ¿¿¿Óùqqq( ._¾Ì¡C‡1b,\¸™3gFÿþý9zô(<ð:ubèС<øàƒŽktíÚ•ÌÌLyýõ×1b¡¡¡¤¦¦²dÉÒÓÓyÿý÷ cÒ¤I|ú駤¥¥‘ÍþýûéС{÷îeܸq€­‹788ØQÎ÷ßÏ_þòX³f £G&;;›eË–1eÊV¬XÁ·ß~K^^sçÎe„ >|˜·Þz‹#Gް~ýzøõ×_iÓ¦ ?üðS§NeÉ’%hµZ–/_ΪU«8vìgΜqÜ[rr2‹-â©§žbþüùtêÔ‰~ýú1jÔ(–-[ÆÎ;Ø»Óþõ¯ðôÓO¶ä°aƨÕêë~¿«Â¡C‡èÛ·//^Äjµ2qâD&Mšä£¨ý C½O%Ä(//wúTŸ¸m‚hµZ9xð Z­–¦M›’™™IPP«Ãª—ìɡݭ̤µo|^ñÏ~^Å„ãê_Ì«×|¼Õ‰:^^^Œ1‚¯¾úÊi¿î›-Óruœö1~·3[øê++S¡P8]÷V¯Ï?ÿü¦-¨w«qãÆ|ñÅ?~œîÝ»c±XÈËË“äÐÅ 9997<ÆÓÓ“¨¨(, V«•’’’ŠNˆºA¡P Óéð÷÷çüùó7\»6 €°°°Œ®ú¸m‚øÜsÏñá‡2aÂÀ¶XpÅu…¸Z||ü5{Yß®ÊÆcºÒøñ㫽ŒÖ­[ÈùóçùË_þÂO?ýDbbbµ—+nÌÞâ\ÙÌd“Éä˜È¤P(ðññqŒiBÜšK—.9ÖC4™L„††:*Òét †š¯Ú¸]‚hÏâÛ¶m뛥ÕjIKK“E{…¨bf³™òòrT*•c?n“ÉD‡®;ÁFÔ<¥RyË-¹*•êºØ„•»^ÏÕõ~çîvW¬ÚÆíÄ×^{ùóç3jÔ¨kÖf=z4<òˆ‹"¢î9t臢mÛ¶×´ž* Ö¯_ï¢È„BT'·KçÏŸÀ‡~xÍ{f³¹¦Ã¢N«Ø-Ÿ‘‘áôžü¾ !DÝ¥¼ù!µÓ˜1c8þ<`ëòš={¶Ó"ÅBˆªóÃ?°hÑ"GR˜••Å Aƒ\•Bˆêâv-ˆvÇçÕW_¥{÷îlݺ•””ÇNBˆª•˜˜È‰'>|8‰‰‰üôÓO·´>£B÷ä¶-ˆ÷ß?úÓŸX¾|9 6$%%ÅÕ! Qg©T*úöí‹¿¿?«V­bÀ€Õº0·B×rÛqìØ±üòË/lÞ¼™Gy„ÁƒsâÄ W‡%DtâÄ  DŸ>}øúë¯ù÷¿ÿÍk¯½æê°„BT·íb2dˆc·ŠîÝ»ÍÙ³giÙ²¥‹#¢îñòòâ_ÿúÁÁÁüýïçƒ>pqTB!ª‹Û¶ ÆÅÅaµZÙ±ccÆŒáå—_&00ÐÕa Q'5mÚ”àà`Š‹‹ùè£èÕ«»víruXB!ª‰[¶ æçç³~ýz¾øâ T*O<ñsçέ·û% QÝ<ÈêÕ«9|ø0:ŽO?ý´ÒÝ;„B¸?·kA\»v-#GŽ$ €O>ù„¡C‡Ò¨Q#I…¨&ä“O>áé§ŸfãÆ´lÙR’C!„¨ãÜ.AŒŠŠB¥RqðàAŽ=ŠÕjuuHBÔi÷ß?§NâÀ\¼xÑÕá!ªAII &“ÉÕaˆZÄíº˜HHHàÀ|öÙgüøã<üðÃtîÜ™ððpW‡'DóÊ+¯`4ùꫯ;v,'OždÓ¦M<üðÃxx¸]"„¨@§ÓqéÒ% åååx{{Ó Aüýý]šp1·kA´ëСo¿ý6ß|ó -[¶dèСlÙ²ÅÕa Q'ùøøÐ»woV¯^ÍÊ•+ùñÇéÙ³§«ÃBÜ!£ÑÈ™3gÈÍÍ%44”èèhš7oŽF£!??ŸS§NqùòeÙR³sûÿAAA 2„Áƒ£×ë]ŽuÞ=÷ÜÛo¾‰V«uu(BˆÛd2™¸téƒÐÐPcø jµµZMii)œ>}š€€‚‚‚ðññqqô¢&¹}‚h§P(¤I\ˆ¤V«]‚â™ÍfòòòÐjµÓ°aÃNîôöö&22³ÙLqq1.\@©Tä”TŠº«Î$ˆB!„pf±X(((   FC³fÍP©T·|¾J¥¢Aƒ4hÐNGaa!—.]B£Ñ„§§g5F/\ID!„¢Ž±Z­‘ŸŸŸŸÑÑÑwÌùûûãïïÉd¢°°ììl|||hР~~~Ò²X‡H‚(„BÔ!Z­–¼¼<<==‰ŠŠÂÛÛ»J¯ïééIXX¡¡¡“——Gii©ã}«Õê”(Þìë[9ÖÏÏÐÐP”J·[ëv$ABQ#¬V+f³Y–Gª&z½Þ±dMDD„£U¯º( 4 æºïW\§øf_ßè}«ÕJAAYYYDFFVû} ù-BQm¬V+z½­VKII V«•   BBB¤5¨ Ø'‘aµZ ­5È*k ¼ 6D§Ó‘““ƒŸŸáááòóSÍ$ABQ¥, :Ž’’t:^^^R©$//¬¬,Ç2+âöéõz Ñëõøûû^ç[Öüýý‰‰‰áÒ¥KdeeN@@€«Ãª³$ABq×Ìf3:­V‹^¯ÇÇǵZMXXØ5]ÊFrss)**"<<¼ÊÇÉÕEåååQTTäXr&22²^µ¤)•J"""Ðëõ\¼x­VKxxømÍÌ·FD!„wÄl6;ºŽ ~~~yÓ?Ø>>>4mÚ”¢¢"Ξ=‹Z­®±IWO¢¨Í¬V+%%%a4Q«Õ4jÔ¨Þ/ZíççGLLŒ£5:<<¼Öt­×’ !„¸e&“‰’’´Z-¥¥¥øûû£ÑhhÔ¨Ñ%w†€€òòò8}ú4aaaÕÖíl2™¸|ù2ÅÅÅx{{£V« ¨•kù•••QTTDqq1^^^h47nì6‰mMP(„……¡V«ÉÉÉ¡¸¸˜ˆˆ™UEä»(„â†ÊÊÊ-…&“‰€€‚ƒƒñ÷÷¯’„E¥RF£!77—ÂÂB"""ª¬Û¹¬¬ŒË—/SRRBPPÍš5£´´­VK~~>žžž V«ñòòª’2ï„ÅbA«ÕRTT„Éd"00&Mš¸4&wàããCtt4ùùùdggZéÌjqë$ABQ)«ÕÊùóçñõõ%,, __ßjkŪênçÒÒRòóó1 Ѽysǵ<<<ð÷÷Çjµb0Ðjµœ9s•JåhY¬‰q‘‹…ÒÒRŠŠŠ())Á××·J“ïúB¡P8fpçääPZZJxx¸«Ãrk’ !„¨”B¡ &&¦F˼ºÛùv[„ŒF#ùùù”––Ò Aƒî;¬P(ðóóÃÏψˆ %%%œ;w…BáHowÌŸÅb¡¼¼Üñ0›ÍNÏí°-<­V«‰‰‰‘îÑ»äííMÓ¦M1›Í®ÅíÉO¢BˆZçêngûlç%jz½žüü|ÊËË ¦Q£F·Ý çëëëh-µwCçää`±XÉ¢J¥º¥ÄÏÃÃ㚇*•Êñ¼>Í@®) …Bí* ßA!„µVÅnçsçÎ@hh¨Ó,iNG~~>‹…àà`Ôju•tÏz{{ãííMhh¨cfnn.‹E?QçI‚(„¢Ö«Øíl_d[©T’ŸŸR©$88¸ZMöòò"$$„j+CˆÚDD!„náêng…BQ/vÂ$ABáVìÝÎBˆêS«ļ¼—•-„BT5IÝØÀyï½÷nxŒÁ`àСC•¾?sæL~øá6oÞ|×1egg3wî\|||())aÚ´iôèу?ÿùÏ 2„ÌÌÌ».cþüù×쎣×ëo;Aœ5kÛ·oîþÞ÷ìÙÆ îêB!DmQï&©Ôûöí#::šmÛ¶ñÒK/áååÅÉ“'Q©TÄÄÄPVVƾ}ûˆ‹‹£]»v€-YÌÌÌD©TŸŸ%%%”––rìØ1æÌ™C@@ X,víÚEtt4QQQìß¿Ÿ˜˜öìÙC«V­hÔ¨;vì mÛ¶4nÜ€üãLš4 €´´4BBBX³f dee1kÖ,î¿ÿ~ 999Ò¬Y3BBB8tèEEE$$$àëëK^^EEE Š‹‹IHH@¡PZÈ… [IDAT¶í[·E›6mðõõ¥mÛ¶ŽïOVVçÎãÀÃãÑÈž={P(tìØ???´Zm¥÷¾{÷nš6mêtïÑÑÑdff:Ý{ll,QQQ >œAƒ‘””DHHHýa08}úôuß³Z­Žß°}ÊÉÉ©©Ð„¨ŒF#jµ°- vþüy§ß+;‹Å‚ŸŸ_M‡Wm$AtS«W¯¦ÿþ¨Õj¾ûî;RRRð÷÷ç¯ý+}ôK—.%<<œÆóî»ïòñÇ3räHž~úiôz=éééN­F£‘üü|ÊÊÊÐëõ 2„>}úðÓO?áååŸqãX°`‘‘‘ÄÇÇ3jÔ(zè!bcc:t(èõzJJJhÖ¬z½žo¾ù†ü‘ÀÀ@bbbX¸p!ÇŽ#--:0|øpfΜ‰··7­Zµ¢ÿþ¤§§sôèQf̘ÁsÏ=G~~>Ÿ|ò óçÏ`ÅŠ$''3sæL^|ñE"##yï½÷Xµjï¾û.F£‘˜˜V¬XÁ²eËxñÅéÕ«F£‘ôôtæÌ™ã¸÷²²2òòò(++Ã`00xð`ǽ{xxššÊ¢E‹ £cÇŽN÷>lØ0Ö¯_¿¿?;wfçΤ¤¤ÔàO‚¨Ï|}}‰ŽŽ¾á1ö?d*• L&SM„&Dáëë‹ 6¼áZÊJeÝ阕Ñ püøqâââÐh4üýïwì£;pà@^ýuÊÊÊ3f ¿ýöf³™ .HÏž=yþùç®yß}÷áëëK·nÝØºu+±±±ÄÇÇÓ¡CÆϸqãP©TôìÙ“ÄÄD¶mÛF§NxüñÇÙ»w/GŽÁl6ÓªU+rssiÒ¤‰£5m×®]9r€ääd åååL™2€1cÆ P(8yò$þþþ=z¥RITT {÷îŽ?n½zõ"99³ÙÌîÝ»yæ™g÷²mÛ66nÜ@||<&“ÉqïO<ñýû÷wº÷{î¹Çqïßÿ=mÚ´qº÷ÔÔT”J%=zôࡇbÛ¶mÄÇÇÓ³gOöíÛÇáÇéÒ¥ ­Zµâ×_­Òÿk!nD©TâååuKÇZ,¬V«ã›âæL&z½Þ±%©ýßú@D7´~ýzŠ‹‹yá…8|ø0§OŸ¦Y³ftëÖ·Þz‹±cÇ:£R©X¶lëÖ­ãý÷ß硇"55õº×?uêgÏž%##€¤¤$t:5ÀÛÛ›ÈÈH|||(--%//ÏñZ“&M¸xñ"yyy„††BóæÍùꫯ§Y³f´hÑÂQæ{g‡‡Í›7Çd2QVVØöä¶ $//Ï)OOO§ 1Z­Öé^bccX¶léééÌŸ?Ÿ¤¤$ÆÝ{?}ú4çλî½Û»Ñ}||hذ¡ãk{¬‘‘‘üøã×½®µ———l7*Äm0×LЬ/êN[h=aµZY¿~=kÖ¬aÙ²e,[¶Œ©S§²víZÀ¶3ÆìÙ³ùâ‹/œÆ•””péÒ%RSSÉÈÈà믿¦´´ÔéÚ‹€x€ÈÈHÆÏøñãIJJÂßßÿ¦±ÅÄÄ••ØÒGy„+V`4iݺ5ÉÉÉ(•JG——½)¾´´”Ý»wóÆoлwoŠŠŠ±Ø[ä¬V+:Α˜UF­Vãåååø…ž3g—/_æÒ¥KŒ7ŽŒŒ ¾ýö[§¤R¡P`6›èܹ3·}ï`÷x³î>!„ÂH ¢›Ù¹s§cR‡]÷îÝ™?>±±±¨Õj|ðAxýõ×IKKl;È|ôÑG¬Y³°uÑz{{;®¡R©ˆŠŠb„ Ìœ9“7’ššŠÉdâø;w¾il-[¶äøñãŽç3fÌ`Ú´iôîÝ›¨¨(JJJHJJâ‰'žàèÑ£Žã¼½½iÓ¦ ãÇÇßߟ?þñ,Z´ˆÁƒÄÈ‘#)++st5ßÌÈ‘#7n^^^ÄÆÆĪU«÷þä“O:Æ“€-QŽŽæÕW_eÖ¬Y8î½cÇŽ·tïÿýïéÔ©Ó-+„BÔf lIâ9 |ó7 »í‹Ì˜5‘»ÆóòË/Wu|UêØ±c<õÔS|ùå—®ÅeL&J¥•JuÍ{V«•ÒÒRGòT^^ŽR©¼­A·o¼ñ)))téÒÅéu£Ñè””]Oii©#i5›ÍìÚµ‹-[¶––†Édºí±åååxxüþ¨:ï½°°#F°råÊ›ÞgmÒ»wo>þøcâââ\ÊMíÞ½›_ÍË>¿¥ãµÚbº=ÒÎñȲ_€ƒÀQà7 0æ+Ç~ôñæïþômÇùݦÏÙðÖ¬]]é13gÎäÔ©S•ó¨EEEèt:ÂÃÃk¬L!Ü}øTMõ 2„3fœœ|Óc½½}øñû£xyyßôX€~Ïwç¿Ç”zlub¶:ñ¿×‰…€QZë™%Y …Â)¹©˜\ݪ &ðÒK/ѱcG§²n%iººE³¢;|uüÕyï³gÏ&55Õ­’CQ¿(•J ÙÙÙ®E·R_ëuIE•Òh4¬ZµªJ®•˜˜Hbbb•\«ºM›6ÍÕ!qCjµÚ±–›BÜŒLRB!„Nê] bvv6=ö˜«Ã¢V¸xñ¢«CBQ Õ«±E‹N³l…¿¯))jÖgŸ}Æ7ß|ãê0„µHnn®«Cp¨W ¢§§'111®CQÏ9’~ýú¹: !D-dßpÂÕêU‚(„µF£A£Ñ¸: !„¨”LRB!„N$AB!„Nª¬‹ùÛo¿¥°°°ª.'„NΞ=ëê„¢Þ¨’1ñÁG8úŸŸÉ9¯­ŠË !Ä5<”z=%;„¢&TI‚˜”ø(I‰VÅ¥„B!„‹É,f!„¨bÆR#999®C!î˜$ˆBQ…¼½}صk÷Ý×ÞÕ¡!ê°@u  ¨¶ëK‚(„U(¹Ûã$w{ÜÕa!Ä]‘en„B!„I…B!„ébBˆë0 hµÅ®C!ª„Åb¾­ãØ’Äs@ø:>ˆ‡§guÄ%„5Êl6³'ó'ûÓb È~G߀ÀØkÏÏ€¾5¬BÔœr@­NÌâÚ:±0:µ fîÛY³! !DͰ\yX¯z\[B©¸òP]y(¯<ì¯ !„;ºº¼n}hO‡ €0  4Â5à…­‚”JQáN¬ØZK²+ò+¯U–$¾üÂV¶Úí€h ðÁVJ(„p'Vlu ½4sí‡gà÷ñ h ´ÆÖÝb¹r¢© …îÉ^–Z@ø=Q´WŒ×;ÏzåýrÀtåÆ++R' !ܽN´×eeØê7{¢h?~¯ÍWÔcëÎÃÖrh¼‘D!„û©X·Ùëµ"l‰b•·$Ú“C{b¨ÃÖí\på}©…îÈ^'±ÕgÅØê7#Wõ®Ø[ퟒ Ø*Ñ‹€ç•çê+_«j.~!„¨2fl‰^ ¶ñ"¶$ÑÀï­ˆUüÐloyÌÇVZ¯<·»Bwc¯ÛŠà2¶úÑ>YÏ©Ñ^ꯨºrrà{å8Y3QáŽ*~.ÆV¯åsU+¢Õjµ* έ‡zlŸ²/\¹V1à­N”QáŽì9Ÿ[Îw[=g¸òº…+-ˆWW†Jl•©[r(T„î¬â‡`¶OÊÅØê;Ge¶,ñJ’hÁ–<Ú+P®|€mL¶½N”zQáNì=$Çfòû‡f§œ-Z*œdïZ–ŠPá®*v›°%~öÁÙåT>þоVWŽ-Æ6öÐÞ£"u¢Â]=ÆZ_áaOQX­V®|bV`«ôT8¯û%É¡ÂÝUœ•læªå¬V«S’x¥NTbK=°õ¤Ø¿–äPáî®^¥Áþ0«ÕjUØëÅ+"8'…R !ê’k‡½:9„kêÊŠõ¢ÔBwd­ð¯=Q¬øÀ)A´«P1‚T€BˆºÅQá]/1¼Z…Þ®ó¯B¸3ëÕÿV¬ÿZšiM¶õ4‹IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/doc/source/images/plottingClasses.svg000066400000000000000000000612341457240071200250540ustar00rootroot00000000000000 image/svg+xml PlotWidget(GraphicsView) PlotItem(GraphicsItem) ViewBox(GraphicsItem) AxisItem(GraphicsItem) AxisItem(GraphicsItem) AxisItem(GraphicsItem) AxisItem(GraphicsItem) Title - LabelItem(GraphicsItem) PlotDataItem(GraphicsItem) GraphicsLayoutWidget(GraphicsView) GraphicsLayout(GraphicsItem) PlotItem ViewBox PlotItem pyqtgraph-pyqtgraph-0.13.4/doc/source/index.rst000066400000000000000000000042471457240071200215520ustar00rootroot00000000000000:html_theme.sidebar_secondary.remove: PyQtGraph ========= A pure-python graphics and GUI library built on PyQt / PySide and numpy for use in mathematics / scientific / engineering applications. .. toctree:: :hidden: :maxdepth: 1 getting_started/index user_guide/index developer_guide/index api_reference/index .. grid:: 2 .. grid-item-card:: :img-top: /images/index_getting_started.svg Getting started ^^^^^^^^^^^^^^^ New to PyQtGraph? Check out the getting started guides. Content here includes introductions to PyQtGraph concepts and capabilities, as well as basic tutorials. +++ .. button-ref:: getting_started_ref :expand: :color: success :click-parent: To the getting started guides .. grid-item-card:: :img-top: /images/index_user_guide.svg User guide ^^^^^^^^^^ The user guide provides in-depth information on the key concepts of PyQtGraph. More complicated examples are presented and greater detail of the capabilities of the library are highlighted. Performance related considerations are detailed here. +++ .. button-ref:: user_guide_ref :expand: :color: success :click-parent: To the user guide .. grid-item-card:: :img-top: /images/index_api.svg API Reference ^^^^^^^^^^^^^ The reference guide contains a detailed description of the PyQtGraph API. +++ .. button-ref:: pyqtgraph_api_ref :expand: :color: success :click-parent: To the reference guide .. grid-item-card:: :img-top: /images/index_contribute.svg Developer guide ^^^^^^^^^^^^^^^ Guide to contributing to PyQtGraph. Provides guidance on how to contribute to PyQtGraph and factors to be careful of when trying to remain compatible with all the Qt bindings that are supported. +++ .. button-ref:: developer_guide_ref :expand: :color: success :click-parent: To the development guide pyqtgraph-pyqtgraph-0.13.4/doc/source/user_guide/000077500000000000000000000000001457240071200220355ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/doc/source/user_guide/exporting.rst000066400000000000000000000062511457240071200246120ustar00rootroot00000000000000Exporting ========= PyQtGraph provides a variety of export formats for all 2D graphics. For 3D graphics, see `Exporting 3D Graphics`_ below. Exporting from the GUI ---------------------- Any 2D graphics can be exported by right-clicking on the graphic, then selecting 'export' from the context menu. This will display the export dialog in which the user must: #. Select an item (or the entire scene) to export. Selecting an item will cause the item to be hilighted in the original graphic window (but this hilight will not be displayed in the exported file). #. Select an export format. #. Change any desired export options. #. Click the 'export' button. Export Formats -------------- * Image - PNG is the default format. The exact set of image formats supported will depend on your Qt libraries. However, common formats such as PNG, JPG, and TIFF are almost always available. * SVG - Graphics exported as SVG are targeted to work as well as possible with both Inkscape and Adobe Illustrator. For high quality SVG export, please use PyQtGraph version 0.9.3 or later. This is the preferred method for generating publication graphics from PyQtGraph. * CSV - Exports plotted data as CSV. This exporter _only_ works if a PlotItem is selected for export. * Matplotlib - This exporter opens a new window and attempts to re-plot the data using matplotlib (if available). Note that some graphic features are either not implemented for this exporter or not available in matplotlib. This exporter _only_ works if a PlotItem is selected for export. * Printer - Exports to the operating system's printing service. This exporter is provided for completeness, but is not well supported due to problems with Qt's printing system. * HDF5 - Exports data from a :class:`~pyqtgraph.PlotItem` to a HDF5 file if h5py_ is installed. This exporter supports :class:`~pyqtgraph.PlotItem` objects containing multiple curves, stacking the data into a single HDF5 dataset based on the ``columnMode`` parameter. If data items aren't the same size, each one is given its own dataset. .. _h5py: https://www.h5py.org/ Exporting from the API ---------------------- To export a file programatically, follow this example: .. code-block:: python import pyqtgraph as pg import pyqtgraph.exporters # generate something to export plt = pg.plot([1,5,2,4,3]) # create an exporter instance, as an argument give it # the item you wish to export exporter = pg.exporters.ImageExporter(plt.plotItem) # set export parameters if needed exporter.parameters()['width'] = 100 # (note this also affects height parameter) # save to file exporter.export('fileName.png') To export the overall layout of a GraphicsLayoutWidget `grl`, the exporter initialization is .. code-block:: python exporter = pg.exporters.ImageExporter( grl.scene() ) instead. Exporting 3D Graphics --------------------- The exporting functionality described above is not yet available for 3D graphics. However, it is possible to generate an image from a GLViewWidget by using QGLWidget.grabFrameBuffer or QGLWidget.renderPixmap:: glview.grabFrameBuffer().save('fileName.png') See the Qt documentation for more information. pyqtgraph-pyqtgraph-0.13.4/doc/source/user_guide/index.rst000066400000000000000000000005621457240071200237010ustar00rootroot00000000000000.. _user_guide_ref: User Guide ========== This user guide provides an in-depth description of PyQtGraph features and how they apply to common scientific visualization tasks. It is intended to be a reference for users who are already familiar with the basics of PyQtGraph. .. toctree:: :maxdepth: 1 exporting mouse_interaction region_of_interest style pyqtgraph-pyqtgraph-0.13.4/doc/source/user_guide/mouse_interaction.rst000066400000000000000000000053111457240071200263160ustar00rootroot00000000000000Mouse Interaction ================= Most applications that use pyqtgraph's data visualization will generate widgets that can be interactively scaled, panned, and otherwise configured using the mouse. This section describes mouse interaction with these widgets. 2D Graphics ----------- In pyqtgraph, most 2D visualizations follow the following mouse interaction: * **Left button:** Interacts with items in the scene (select/move objects, etc). If there are no movable objects under the mouse cursor, then dragging with the left button will pan the scene instead. * **Right button drag:** Scales the scene. Dragging left/right scales horizontally; dragging up/down scales vertically (although some scenes will have their x/y scales locked together). If there are x/y axes visible in the scene, then right-dragging over the axis will _only_ affect that axis. * **Right button click:** Clicking the right button in most cases will show a context menu with a variety of options depending on the object(s) under the mouse cursor. * **Middle button (or wheel) drag:** Dragging the mouse with the wheel pressed down will always pan the scene (this is useful in instances where panning with the left button is prevented by other objects in the scene). * **Wheel spin:** Zooms the scene in and out. For machines where dragging with the right or middle buttons is difficult (usually Mac), another mouse interaction mode exists. In this mode, dragging with the left mouse button draws a box over a region of the scene. After the button is released, the scene is scaled and panned to fit the box. This mode can be accessed in the context menu or by calling:: pyqtgraph.setConfigOption('leftButtonPan', False) Context Menu ------------ Right-clicking on most scenes will show a context menu with various options for changing the behavior of the scene. Some of the options available in this menu are: * Enable/disable automatic scaling when the data range changes * Link the axes of multiple views together * Enable disable mouse interaction per axis * Explicitly set the visible range values The exact set of items available in the menu depends on the contents of the scene and the object clicked on. 3D Graphics ----------- 3D visualizations use the following mouse interaction: * **Left button drag:** Rotates the scene around a central point * **Middle button drag:** Pan the scene by moving the central "look-at" point within the x-y plane * **Middle button drag + CTRL:** Pan the scene by moving the central "look-at" point along the z axis * **Wheel spin:** zoom in/out * **Wheel + CTRL:** change field-of-view angle And keyboard controls: * Arrow keys rotate around central point, just like dragging the left mouse button pyqtgraph-pyqtgraph-0.13.4/doc/source/user_guide/region_of_interest.rst000066400000000000000000000037751457240071200264670ustar00rootroot00000000000000Interactive Data Selection Controls =================================== PyQtGraph includes graphics items which allow the user to select and mark regions of data. Linear Selection and Marking ---------------------------- Two classes allow marking and selecting 1-dimensional data: :class:`LinearRegionItem ` and :class:`InfiniteLine `. The first class, :class:`LinearRegionItem `, may be added to any ViewBox or PlotItem to mark either a horizontal or vertical region. The region can be dragged and its bounding edges can be moved independently. The second class, :class:`InfiniteLine `, is usually used to mark a specific position along the x or y axis. These may be dragged by the user. 2D Selection and Marking ------------------------ To select a 2D region from an image, pyqtgraph uses the :class:`ROI ` class or any of its subclasses. By default, :class:`ROI ` simply displays a rectangle which can be moved by the user to mark a specific region (most often this will be a region of an image, but this is not required). To allow the ROI to be resized or rotated, there are several methods for adding handles (:func:`addScaleHandle `, :func:`addRotateHandle `, etc.) which can be dragged by the user. These handles may be placed at any location relative to the ROI and may scale/rotate the ROI around any arbitrary center point. There are several ROI subclasses with a variety of shapes and modes of interaction. To automatically extract a region of image data using an ROI and an ImageItem, use :func:`ROI.getArrayRegion `. ROI classes use the :func:`affineSlice ` function to perform this extraction. ROI can also be used as a control for moving/rotating/scaling items in a scene similar to most vector graphics editing applications. See the ROITypes example for more information. pyqtgraph-pyqtgraph-0.13.4/doc/source/user_guide/style.rst000066400000000000000000000040551457240071200237330ustar00rootroot00000000000000Line, Fill, and Color ===================== Qt relies on its QColor, QPen and QBrush classes for specifying line and fill styles for all of its drawing. Internally, pyqtgraph uses the same system but also allows many shorthand methods of specifying the same style options. Many functions and methods in pyqtgraph accept arguments specifying the line style (pen), fill style (brush), or color. For most of these function arguments, the following values may be used: * single-character string representing color (b, g, r, c, m, y, k, w) * (r, g, b) or (r, g, b, a) tuple * single greyscale value (0.0 - 1.0) * (index, maximum) tuple for automatically iterating through colors (see :func:`intColor `) * QColor * QPen / QBrush where appropriate Notably, more complex pens and brushes can be easily built using the :func:`mkPen() ` / :func:`mkBrush() ` functions or with Qt's QPen and QBrush classes:: mkPen('y', width=3, style=QtCore.Qt.DashLine) ## Make a dashed yellow line 2px wide mkPen(0.5) ## solid grey line 1px wide mkPen(color=(200, 200, 255), style=QtCore.Qt.DotLine) ## Dotted pale-blue line See the Qt documentation for 'QPen' and 'PenStyle' for more line-style options and 'QBrush' for more fill options. Colors can also be built using :func:`mkColor() `, :func:`intColor() `, :func:`hsvColor() `, or Qt's QColor class. Default Background and Foreground Colors ---------------------------------------- By default, pyqtgraph uses a black background for its plots and grey for axes, text, and plot lines. These defaults can be changed using pyqtgraph.setConfigOption():: import pyqtgraph as pg ## Switch to using white background and black foreground pg.setConfigOption('background', 'w') pg.setConfigOption('foreground', 'k') ## The following plot has inverted colors pg.plot([1,4,2,3,5]) (Note that this must be set *before* creating any widgets) pyqtgraph-pyqtgraph-0.13.4/doc/uml_overview.txt000066400000000000000000000064431457240071200216750ustar00rootroot00000000000000' Made in PlantUml. You can try it out here: http://plantuml.com/plantuml ' Based on commit eb7a60fcf83cd4e7a41ae5955e57935e39928fbd @startuml hide empty members hide circles hide stereotypes skinparam class { BorderColor Black ArrowColor Black ' Using stereotypes to define the background colors BackgroundColor<> #e5f2da BackgroundColor<> #e5e5f4 } skinparam shadowing false '----------- Qt package ----------` class QGraphicsGridLayout <> class QGraphicsItem <> class QGraphicsLayout <> class QGraphicsLayoutItem <> class QGraphicsObject <> class QGraphicsScene <> { items } class QGraphicsWidget <> class QGraphicsView <> { scene } class QObject <> class QPaintDevice <> class QWidget <> '----------- PyQtGraph package ----------` class GraphicsItem <> class GraphicsLayout <> { layout } class GraphicsLayoutWidget <> { graphicsLayout } class GraphicsObject <> class GraphicsView <> class GraphicsWidget <> class ImageItem <> class ImageView <> { graphicsView imageItem scene view } class PlotCurveItem <> class PlotDataItem <> { curve scatter } class PlotItem <> { layout vb } class PlotWidget <> { plotItem } class ScatterPlotItem <> class ViewBox <> '---------- Inheritance within Qt ----------' QObject <|-- QGraphicsObject QGraphicsItem <|-- QGraphicsObject QGraphicsObject <|-- QGraphicsWidget QGraphicsLayoutItem <|-- QGraphicsWidget QGraphicsLayoutItem <|-- QGraphicsLayout QGraphicsLayout <|-- QGraphicsGridLayout QPaintDevice <|-- QWidget QObject <|-- QWidget QObject <|-- QGraphicsScene QWidget <|-- QGraphicsView '---------- Inheritance from Qt to PyQtGraph ----------' QGraphicsWidget <|-- GraphicsWidget QGraphicsObject <|-- GraphicsObject QGraphicsView <|-- GraphicsView QWidget <|-- ImageView '---------- Inheritance within PyQtGraph ----------' GraphicsItem <|-- GraphicsObject GraphicsItem <|-- GraphicsWidget GraphicsWidget <|-- GraphicsLayout GraphicsWidget <|-- PlotItem GraphicsWidget <|-- ViewBox GraphicsObject <|-- ScatterPlotItem GraphicsObject <|-- PlotCurveItem GraphicsObject <|-- ImageItem GraphicsObject <|-- PlotDataItem GraphicsView <|-- PlotWidget GraphicsView <|-- GraphicsLayoutWidget '---------- Aggregation ----------' ' Shorter arrow so at same height in the diagram QGraphicsScene::items o- QGraphicsItem #b8b8b8 QGraphicsView::scene o- QGraphicsScene #b8b8b8 ' Longer (regular) arrows PlotWidget::plotItem o-- PlotItem #b8b8b8 GraphicsLayoutWidget::graphicsLayout o-- GraphicsLayout #b8b8b8 PlotDataItem::curve o-- PlotCurveItem #b8b8b8 PlotDataItem::scatter o-- ScatterPlotItem #b8b8b8 PlotItem::vb o-- ViewBox #b8b8b8 PlotItem::layout o-- QGraphicsGridLayout #b8b8b8 GraphicsLayout::layout o-- QGraphicsGridLayout #b8b8b8 ImageView::graphicsView o-- GraphicsView #b8b8b8 ImageView::imageItem o-- ImageItem #b8b8b8 ImageView::scene o-- QGraphicsScene #b8b8b8 ImageView::view o-- ViewBox #b8b8b8 @enduml pyqtgraph-pyqtgraph-0.13.4/pyproject.toml000066400000000000000000000017421457240071200205550ustar00rootroot00000000000000[build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" [tool.black] line-length = 88 target-version = ['py38'] include = '\.pyi?$' exclude = ''' ( /( \.eggs # exclude a few common directories in the | \.git # root of the project | \.hg | \.mypy_cache | \.tox | \.venv* | _build | buck-out | build | dist )/ ) ''' [tool.isort] profile = "black" honor_noqa = true color_output = true py_version = 38 src_paths = ["pyqtgraph", "tests"] skip_glob = ["**/*Template*.py", "**/colorama"] skip_gitignore = true known_third_party = ["QtCore", "QtGui", "QtWidgets"] [tool.pycln] all = true exclude = '(Template|__init__.py)' [tool.mypy] packages = ["pyqtgraph"] show_error_codes = true strict = true disable_error_code = ["attr-defined"] ignore_errors = true [[tool.mypy.overrides]] module = "pyqtgraph.flowchart.*" # the list will increase ignore_errors = true # will be changed to `false` when it's ready pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/000077500000000000000000000000001457240071200176545ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/GraphicsScene/000077500000000000000000000000001457240071200223725ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/GraphicsScene/GraphicsScene.py000066400000000000000000000613151457240071200254700ustar00rootroot00000000000000import warnings import weakref from time import perf_counter, perf_counter_ns from .. import debug as debug from .. import getConfigOption from ..Point import Point from ..Qt import QtCore, QtGui, QtWidgets, isQObjectAlive from .mouseEvents import HoverEvent, MouseClickEvent, MouseDragEvent getMillis = lambda: perf_counter_ns() // 10 ** 6 __all__ = ['GraphicsScene'] class GraphicsScene(QtWidgets.QGraphicsScene): """ Extension of QGraphicsScene that implements a complete, parallel mouse event system. (It would have been preferred to just alter the way QGraphicsScene creates and delivers events, but this turned out to be impossible because the constructor for QGraphicsMouseEvent is private) * Generates MouseClicked events in addition to the usual press/move/release events. (This works around a problem where it is impossible to have one item respond to a drag if another is watching for a click.) * Adjustable radius around click that will catch objects so you don't have to click *exactly* over small/thin objects * Global context menu--if an item implements a context menu, then its parent(s) may also add items to the menu. * Allows items to decide _before_ a mouse click which item will be the recipient of mouse events. This lets us indicate unambiguously to the user which item they are about to click/drag on * Eats mouseMove events that occur too soon after a mouse press. * Reimplements items() and itemAt() to circumvent PyQt bug ====================== ==================================================================== **Signals** sigMouseClicked(event) Emitted when the mouse is clicked over the scene. Use ev.pos() to get the click position relative to the item that was clicked on, or ev.scenePos() to get the click position in scene coordinates. See :class:`pyqtgraph.GraphicsScene.mouseEvents.MouseClickEvent`. sigMouseMoved(pos) Emitted when the mouse cursor moves over the scene. The position is given in scene coordinates. sigMouseHover(items) Emitted when the mouse is moved over the scene. Items is a list of items under the cursor. sigItemAdded(item) Emitted when an item is added via addItem(). The item is given. sigItemRemoved(item) Emitted when an item is removed via removeItem(). The item is given. ====================== ==================================================================== Mouse interaction is as follows: 1) Every time the mouse moves, the scene delivers both the standard hoverEnter/Move/LeaveEvents as well as custom HoverEvents. 2) Items are sent HoverEvents in Z-order and each item may optionally call event.acceptClicks(button), acceptDrags(button) or both. If this method call returns True, this informs the item that _if_ the user clicks/drags the specified mouse button, the item is guaranteed to be the recipient of click/drag events (the item may wish to change its appearance to indicate this). If the call to acceptClicks/Drags returns False, then the item is guaranteed to *not* receive the requested event (because another item has already accepted it). 3) If the mouse is clicked, a mousePressEvent is generated as usual. If any items accept this press event, then No click/drag events will be generated and mouse interaction proceeds as defined by Qt. This allows items to function properly if they are expecting the usual press/move/release sequence of events. (It is recommended that items do NOT accept press events, and instead use click/drag events) Note: The default implementation of QGraphicsItem.mousePressEvent will *accept* the event if the item is has its Selectable or Movable flags enabled. You may need to override this behavior. 4) If no item accepts the mousePressEvent, then the scene will begin delivering mouseDrag and/or mouseClick events. If the mouse is moved a sufficient distance (or moved slowly enough) before the button is released, then a mouseDragEvent is generated. If no drag events are generated before the button is released, then a mouseClickEvent is generated. 5) Click/drag events are delivered to the item that called acceptClicks/acceptDrags on the HoverEvent in step 1. If no such items exist, then the scene attempts to deliver the events to items near the event. ClickEvents may be delivered in this way even if no item originally claimed it could accept the click. DragEvents may only be delivered this way if it is the initial move in a drag. """ sigMouseHover = QtCore.Signal(object) ## emits a list of objects hovered over sigMouseMoved = QtCore.Signal(object) ## emits position of mouse on every move sigMouseClicked = QtCore.Signal(object) ## emitted when mouse is clicked. Check for event.isAccepted() to see whether the event has already been acted on. sigPrepareForPaint = QtCore.Signal() ## emitted immediately before the scene is about to be rendered sigItemAdded = QtCore.Signal(object) ## emits the item object just added sigItemRemoved = QtCore.Signal(object) ## emits the item object just removed _addressCache = weakref.WeakValueDictionary() ExportDirectory = None def __init__(self, clickRadius: int = 2, moveDistance=5, parent=None): QtWidgets.QGraphicsScene.__init__(self, parent) self.setClickRadius(clickRadius) self.setMoveDistance(moveDistance) self.exportDirectory = None self.clickEvents = [] self.dragButtons = [] self.mouseGrabber = None self.dragItem = None self.lastDrag = None self.hoverItems = weakref.WeakKeyDictionary() self.lastHoverEvent = None self.minDragTime = 0.5 # drags shorter than 0.5 sec are interpreted as clicks self.contextMenu = [QtGui.QAction(QtCore.QCoreApplication.translate("GraphicsScene", "Export..."), self)] self.contextMenu[0].triggered.connect(self.showExportDialog) self.exportDialog = None self._lastMoveEventTime = 0 def render(self, *args): self.prepareForPaint() return QtWidgets.QGraphicsScene.render(self, *args) def prepareForPaint(self): """Called before every render. This method will inform items that the scene is about to be rendered by emitting sigPrepareForPaint. This allows items to delay expensive processing until they know a paint will be required.""" self.sigPrepareForPaint.emit() def setClickRadius(self, r: int): """ Set the distance away from mouse clicks to search for interacting items. When clicking, the scene searches first for items that directly intersect the click position followed by any other items that are within a rectangle that extends r pixels away from the click position. """ self._clickRadius = int(r) def setMoveDistance(self, d): """ Set the distance the mouse must move after a press before mouseMoveEvents will be delivered. This ensures that clicks with a small amount of movement are recognized as clicks instead of drags. """ self._moveDistance = d def mousePressEvent(self, ev): super().mousePressEvent(ev) if self.mouseGrabberItem() is None: ## nobody claimed press; we are free to generate drag/click events if self.lastHoverEvent is not None: # If the mouse has moved since the last hover event, send a new one. # This can happen if a context menu is open while the mouse is moving. if ev.scenePos() != self.lastHoverEvent.scenePos(): self.sendHoverEvents(ev) self.clickEvents.append(MouseClickEvent(ev)) ## set focus on the topmost focusable item under this click items = self.items(ev.scenePos()) for i in items: if i.isEnabled() and i.isVisible() and (i.flags() & i.GraphicsItemFlag.ItemIsFocusable): i.setFocus(QtCore.Qt.FocusReason.MouseFocusReason) break def _moveEventIsAllowed(self): # For ignoring events that are too close together # Max number of events per second rateLimit = getConfigOption('mouseRateLimit') if rateLimit <= 0: return True # Delay between events (in milliseconds) delay = 1000.0 / rateLimit if getMillis() - self._lastMoveEventTime >= delay: return True return False def mouseMoveEvent(self, ev): # ignore high frequency events if self._moveEventIsAllowed(): self._lastMoveEventTime = getMillis() self.sigMouseMoved.emit(ev.scenePos()) # First allow QGraphicsScene to eliver hoverEvent/Move/Exit Events super().mouseMoveEvent(ev) # Next Deliver our own Hover Events self.sendHoverEvents(ev) if ev.buttons(): # button is pressed' send mouseMoveEvents and mouseDragEvents super().mouseMoveEvent(ev) if self.mouseGrabberItem() is None: now = perf_counter() init = False ## keep track of which buttons are involved in dragging for btn in [QtCore.Qt.MouseButton.LeftButton, QtCore.Qt.MouseButton.MiddleButton, QtCore.Qt.MouseButton.RightButton]: if not (ev.buttons() & btn): continue if btn not in self.dragButtons: ## see if we've dragged far enough yet cev = [e for e in self.clickEvents if e.button() == btn] if cev: cev = cev[0] dist = Point(ev.scenePos() - cev.scenePos()).length() if dist == 0 or (dist < self._moveDistance and now - cev.time() < self.minDragTime): continue init = init or (len(self.dragButtons) == 0) ## If this is the first button to be dragged, then init=True self.dragButtons.append(btn) ## if we have dragged buttons, deliver a drag event if len(self.dragButtons) > 0: if self.sendDragEvent(ev, init=init): ev.accept() else: super().mouseMoveEvent(ev) # if you do not accept event (which is ignored) then cursor will disappear ev.accept() def leaveEvent(self, ev): ## inform items that mouse is gone if len(self.dragButtons) == 0: self.sendHoverEvents(ev, exitOnly=True) def mouseReleaseEvent(self, ev): if self.mouseGrabberItem() is None: if ev.button() in self.dragButtons: if self.sendDragEvent(ev, final=True): #print "sent drag event" ev.accept() self.dragButtons.remove(ev.button()) else: cev = [e for e in self.clickEvents if e.button() == ev.button()] if cev: if self.sendClickEvent(cev[0]): ev.accept() try: self.clickEvents.remove(cev[0]) except ValueError: warnings.warn( ("A ValueError can occur here with errant " "QApplication.processEvent() calls, see " "https://github.com/pyqtgraph/pyqtgraph/pull/2580 " "for more information."), RuntimeWarning, stacklevel=2 ) if not ev.buttons(): self.dragItem = None self.dragButtons = [] self.clickEvents = [] self.lastDrag = None super().mouseReleaseEvent(ev) self.sendHoverEvents(ev) ## let items prepare for next click/drag def mouseDoubleClickEvent(self, ev): super().mouseDoubleClickEvent(ev) if self.mouseGrabberItem() is None: ## nobody claimed press; we are free to generate drag/click events self.clickEvents.append(MouseClickEvent(ev, double=True)) def sendHoverEvents(self, ev, exitOnly=False): ## if exitOnly, then just inform all previously hovered items that the mouse has left. if exitOnly: acceptable=False items = [] event = HoverEvent(None, acceptable) else: acceptable = not ev.buttons() ## if we are in mid-drag, do not allow items to accept the hover event. event = HoverEvent(ev, acceptable) items = self.itemsNearEvent(event, hoverable=True) self.sigMouseHover.emit(items) prevItems = list(self.hoverItems.keys()) for item in items: if hasattr(item, 'hoverEvent'): event.currentItem = item if item not in self.hoverItems: self.hoverItems[item] = None event.enter = True else: prevItems.remove(item) event.enter = False try: item.hoverEvent(event) except: debug.printExc("Error sending hover event:") event.enter = False event.exit = True #print "hover exit items:", prevItems for item in prevItems: event.currentItem = item try: # NOTE: isQObjectAlive(item) was added for PySide6 where # verlet_chain_demo.py triggers a RuntimeError. if isQObjectAlive(item) and item.scene() is self: item.hoverEvent(event) except: debug.printExc("Error sending hover exit event:") finally: del self.hoverItems[item] # Update last hover event unless: # - mouse is dragging (move+buttons); in this case we want the dragged # item to continue receiving events until the drag is over # - event is not a mouse event (QEvent.Type.Leave sometimes appears here) if (ev.type() == ev.Type.GraphicsSceneMousePress or (ev.type() == ev.Type.GraphicsSceneMouseMove and not ev.buttons())): self.lastHoverEvent = event ## save this so we can ask about accepted events later. def sendDragEvent(self, ev, init=False, final=False): ## Send a MouseDragEvent to the current dragItem or to ## items near the beginning of the drag event = MouseDragEvent(ev, self.clickEvents[0], self.lastDrag, start=init, finish=final) #print "dragEvent: init=", init, 'final=', final, 'self.dragItem=', self.dragItem if init and self.dragItem is None: if self.lastHoverEvent is not None: acceptedItem = self.lastHoverEvent.dragItems().get(event.button(), None) else: acceptedItem = None if acceptedItem is not None and acceptedItem.scene() is self: #print "Drag -> pre-selected item:", acceptedItem self.dragItem = acceptedItem event.currentItem = self.dragItem try: self.dragItem.mouseDragEvent(event) except: debug.printExc("Error sending drag event:") else: #print "drag -> new item" for item in self.itemsNearEvent(event): #print "check item:", item if not item.isVisible() or not item.isEnabled(): continue if hasattr(item, 'mouseDragEvent'): event.currentItem = item try: item.mouseDragEvent(event) except: debug.printExc("Error sending drag event:") if event.isAccepted(): #print " --> accepted" self.dragItem = item if item.flags() & item.GraphicsItemFlag.ItemIsFocusable: item.setFocus(QtCore.Qt.FocusReason.MouseFocusReason) break elif self.dragItem is not None: event.currentItem = self.dragItem try: self.dragItem.mouseDragEvent(event) except: debug.printExc("Error sending hover exit event:") self.lastDrag = event return event.isAccepted() def sendClickEvent(self, ev): ## if we are in mid-drag, click events may only go to the dragged item. if self.dragItem is not None and hasattr(self.dragItem, 'mouseClickEvent'): ev.currentItem = self.dragItem self.dragItem.mouseClickEvent(ev) ## otherwise, search near the cursor else: if self.lastHoverEvent is not None: acceptedItem = self.lastHoverEvent.clickItems().get(ev.button(), None) else: acceptedItem = None if acceptedItem is not None: ev.currentItem = acceptedItem try: acceptedItem.mouseClickEvent(ev) except: debug.printExc("Error sending click event:") else: for item in self.itemsNearEvent(ev): if not item.isVisible() or not item.isEnabled(): continue if hasattr(item, 'mouseClickEvent'): ev.currentItem = item try: item.mouseClickEvent(ev) except: debug.printExc("Error sending click event:") if ev.isAccepted(): if item.flags() & item.GraphicsItemFlag.ItemIsFocusable: item.setFocus(QtCore.Qt.FocusReason.MouseFocusReason) break self.sigMouseClicked.emit(ev) return ev.isAccepted() def addItem(self, item): # extend QGraphicsScene.addItem to emit a sigItemAdded signal ret = QtWidgets.QGraphicsScene.addItem(self, item) self.sigItemAdded.emit(item) return ret def removeItem(self, item): # extend QGraphicsScene.removeItem to emit a sigItemRemoved signal ret = QtWidgets.QGraphicsScene.removeItem(self, item) self.sigItemRemoved.emit(item) return ret def itemsNearEvent( self, event, selMode=QtCore.Qt.ItemSelectionMode.IntersectsItemShape, sortOrder=QtCore.Qt.SortOrder.DescendingOrder, hoverable=False, ): """ Return an iterator that iterates first through the items that directly intersect point (in Z order) followed by any other items that are within the scene's click radius. """ view = self.views()[0] tr = view.viewportTransform() if hasattr(event, "buttonDownScenePos"): point = event.buttonDownScenePos() else: point = event.scenePos() ## Sort by descending Z-order (don't trust scene.itms() to do this either) ## use 'absolute' z value, which is the sum of all item/parent ZValues def absZValue(item): if item is None: return 0 return item.zValue() + absZValue(item.parentItem()) ## Get items, which directly are at the given point (sorted by z-value) items_at_point = self.items(point, selMode, sortOrder, tr) items_at_point.sort(key=absZValue, reverse=True) ## Get items, which are within the click radius around the given point (sorted by z-value) r = self._clickRadius items_within_radius = [] rgn = None if r > 0: rect = view.mapToScene(QtCore.QRect(0, 0, 2 * r, 2 * r)).boundingRect() w = rect.width() h = rect.height() rgn = QtCore.QRectF(point.x() - w / 2, point.y() - h / 2, w, h) items_within_radius = self.items(rgn, selMode, sortOrder, tr) items_within_radius.sort(key=absZValue, reverse=True) # Remove items, which are already in the other list for item in items_at_point: if item in items_within_radius: items_within_radius.remove(item) ## Put both groups of items together, but in the correct order ## The items directly at the given point shall have higher priority all_items = items_at_point + items_within_radius ## Remove items, which we don't want, due to several reasons selected_items = [] for item in all_items: if hoverable and not hasattr(item, "hoverEvent"): continue if item.scene() is not self: continue shape = item.shape() # Note: default shape() returns boundingRect() if shape is None: continue # Remove items whose shape does not contain point or region # (scene.items() apparently sucks at this) if ( rgn is not None and shape.intersects(item.mapFromScene(rgn).boundingRect()) ) or shape.contains(item.mapFromScene(point)): selected_items.append(item) return selected_items def getViewWidget(self): return self.views()[0] def addParentContextMenus(self, item, menu, event): """ Can be called by any item in the scene to expand its context menu to include parent context menus. Parents may implement getContextMenus to add new menus / actions to the existing menu. getContextMenus must accept 1 argument (the event that generated the original menu) and return a single QMenu or a list of QMenus. The final menu will look like: | Original Item 1 | Original Item 2 | ... | Original Item N | ------------------ | Parent Item 1 | Parent Item 2 | ... | Grandparent Item 1 | ... ============== ================================================== **Arguments:** item The item that initially created the context menu (This is probably the item making the call to this function) menu The context menu being shown by the item event The original event that triggered the menu to appear. ============== ================================================== """ menusToAdd = [] while item is not self: item = item.parentItem() if item is None: item = self if not hasattr(item, "getContextMenus"): continue subMenus = item.getContextMenus(event) or [] if isinstance(subMenus, list): ## so that some items (like FlowchartViewBox) can return multiple menus menusToAdd.extend(subMenus) else: menusToAdd.append(subMenus) # Filter out options that were previously added existingActions = menu.actions() actsToAdd = [] for menuOrAct in menusToAdd: if isinstance(menuOrAct, QtWidgets.QMenu): menuOrAct = menuOrAct.menuAction() elif not isinstance(menuOrAct, QtGui.QAction): raise Exception( f"Cannot add object {menuOrAct} (type={type(menuOrAct)}) to QMenu." ) if menuOrAct not in existingActions: actsToAdd.append(menuOrAct) if actsToAdd: menu.addSeparator() menu.addActions(actsToAdd) return menu def getContextMenus(self, event): self.contextMenuItem = event.acceptedItem return self.contextMenu def showExportDialog(self): if self.exportDialog is None: from . import exportDialog self.exportDialog = exportDialog.ExportDialog(self) self.exportDialog.show(self.contextMenuItem) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/GraphicsScene/__init__.py000066400000000000000000000000351457240071200245010ustar00rootroot00000000000000from .GraphicsScene import * pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/GraphicsScene/exportDialog.py000066400000000000000000000121631457240071200254100ustar00rootroot00000000000000from .. import exporters as exporters from .. import functions as fn from ..graphicsItems.PlotItem import PlotItem from ..graphicsItems.ViewBox import ViewBox from ..Qt import QtCore, QtWidgets from . import exportDialogTemplate_generic as ui_template class FormatExportListWidgetItem(QtWidgets.QListWidgetItem): def __init__(self, expClass, *args, **kwargs): QtWidgets.QListWidgetItem.__init__(self, *args, **kwargs) self.expClass = expClass class ExportDialog(QtWidgets.QWidget): def __init__(self, scene): QtWidgets.QWidget.__init__(self) self.setVisible(False) self.setWindowTitle("Export") self.shown = False self.currentExporter = None self.scene = scene self.selectBox = QtWidgets.QGraphicsRectItem() self.selectBox.setPen(fn.mkPen('y', width=3, style=QtCore.Qt.PenStyle.DashLine)) self.selectBox.hide() self.scene.addItem(self.selectBox) self.ui = ui_template.Ui_Form() self.ui.setupUi(self) self.ui.closeBtn.clicked.connect(self.close) self.ui.exportBtn.clicked.connect(self.exportClicked) self.ui.copyBtn.clicked.connect(self.copyClicked) self.ui.itemTree.currentItemChanged.connect(self.exportItemChanged) self.ui.formatList.currentItemChanged.connect(self.exportFormatChanged) def show(self, item=None): if item is not None: ## Select next exportable parent of the item originally clicked on while not isinstance(item, ViewBox) and not isinstance(item, PlotItem) and item is not None: item = item.parentItem() ## if this is a ViewBox inside a PlotItem, select the parent instead. if isinstance(item, ViewBox) and isinstance(item.parentItem(), PlotItem): item = item.parentItem() self.updateItemList(select=item) self.setVisible(True) self.activateWindow() self.raise_() self.selectBox.setVisible(True) if not self.shown: self.shown = True center = self.screen().availableGeometry().center() frame = self.frameGeometry() frame.moveCenter(center) self.move(frame.topLeft()) def updateItemList(self, select=None): self.ui.itemTree.clear() si = QtWidgets.QTreeWidgetItem(["Entire Scene"]) si.gitem = self.scene self.ui.itemTree.addTopLevelItem(si) self.ui.itemTree.setCurrentItem(si) si.setExpanded(True) for child in self.scene.items(): if child.parentItem() is None: self.updateItemTree(child, si, select=select) def updateItemTree(self, item, treeItem, select=None): si = None if isinstance(item, ViewBox): si = QtWidgets.QTreeWidgetItem(['ViewBox']) elif isinstance(item, PlotItem): si = QtWidgets.QTreeWidgetItem(['Plot']) if si is not None: si.gitem = item treeItem.addChild(si) treeItem = si if si.gitem is select: self.ui.itemTree.setCurrentItem(si) for ch in item.childItems(): self.updateItemTree(ch, treeItem, select=select) def exportItemChanged(self, item, prev): if item is None: return if item.gitem is self.scene: newBounds = self.scene.views()[0].viewRect() else: newBounds = item.gitem.sceneBoundingRect() self.selectBox.setRect(newBounds) self.selectBox.show() self.updateFormatList() def updateFormatList(self): current = self.ui.formatList.currentItem() self.ui.formatList.clear() gotCurrent = False for exp in exporters.listExporters(): item = FormatExportListWidgetItem(exp, QtCore.QCoreApplication.translate('Exporter', exp.Name)) self.ui.formatList.addItem(item) if item is current: self.ui.formatList.setCurrentRow(self.ui.formatList.count() - 1) gotCurrent = True if not gotCurrent: self.ui.formatList.setCurrentRow(0) def exportFormatChanged(self, item, prev): if item is None: self.currentExporter = None self.ui.paramTree.clear() return expClass = item.expClass exp = expClass(item=self.ui.itemTree.currentItem().gitem) params = exp.parameters() if params is None: self.ui.paramTree.clear() else: self.ui.paramTree.setParameters(params) self.currentExporter = exp self.ui.copyBtn.setEnabled(exp.allowCopy) def exportClicked(self): self.selectBox.hide() self.currentExporter.export() def copyClicked(self): self.selectBox.hide() self.currentExporter.export(copy=True) def close(self): self.selectBox.setVisible(False) self.setVisible(False) def closeEvent(self, event): self.close() super().closeEvent(event) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/GraphicsScene/exportDialogTemplate.ui000066400000000000000000000050301457240071200270640ustar00rootroot00000000000000 Form 0 0 241 367 Export 0 Item to export: false 1 Export format Export Close 2 false 1 Export options Copy ParameterTree QTreeWidget

      ..parametertree
      pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py000066400000000000000000000055521457240071200306040ustar00rootroot00000000000000# Form implementation generated from reading ui file '../pyqtgraph/GraphicsScene/exportDialogTemplate.ui' # # Created by: PyQt6 UI code generator 6.1.0 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. from ..Qt import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(241, 367) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(Form) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 3) self.itemTree = QtWidgets.QTreeWidget(Form) self.itemTree.setObjectName("itemTree") self.itemTree.headerItem().setText(0, "1") self.itemTree.header().setVisible(False) self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3) self.label_2 = QtWidgets.QLabel(Form) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3) self.formatList = QtWidgets.QListWidget(Form) self.formatList.setObjectName("formatList") self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3) self.exportBtn = QtWidgets.QPushButton(Form) self.exportBtn.setObjectName("exportBtn") self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1) self.closeBtn = QtWidgets.QPushButton(Form) self.closeBtn.setObjectName("closeBtn") self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1) self.paramTree = ParameterTree(Form) self.paramTree.setColumnCount(2) self.paramTree.setObjectName("paramTree") self.paramTree.headerItem().setText(0, "1") self.paramTree.header().setVisible(False) self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3) self.label_3 = QtWidgets.QLabel(Form) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3) self.copyBtn = QtWidgets.QPushButton(Form) self.copyBtn.setObjectName("copyBtn") self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Export")) self.label.setText(_translate("Form", "Item to export:")) self.label_2.setText(_translate("Form", "Export format")) self.exportBtn.setText(_translate("Form", "Export")) self.closeBtn.setText(_translate("Form", "Close")) self.label_3.setText(_translate("Form", "Export options")) self.copyBtn.setText(_translate("Form", "Copy")) from ..parametertree import ParameterTree pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/GraphicsScene/mouseEvents.py000066400000000000000000000336731457240071200252750ustar00rootroot00000000000000__all__ = ["MouseDragEvent", "MouseClickEvent", "HoverEvent"] import weakref from time import perf_counter from ..Point import Point from ..Qt import QtCore class MouseDragEvent(object): """ Instances of this class are delivered to items in a :class:`GraphicsScene ` via their mouseDragEvent() method when the item is being mouse-dragged. """ def __init__(self, moveEvent, pressEvent, lastEvent, start=False, finish=False): self.start = start self.finish = finish self.accepted = False self.currentItem = None self._buttonDownScenePos = {} self._buttonDownScreenPos = {} for btn in [QtCore.Qt.MouseButton.LeftButton, QtCore.Qt.MouseButton.MiddleButton, QtCore.Qt.MouseButton.RightButton]: self._buttonDownScenePos[btn] = moveEvent.buttonDownScenePos(btn) self._buttonDownScreenPos[btn] = moveEvent.buttonDownScreenPos(btn) self._scenePos = moveEvent.scenePos() self._screenPos = moveEvent.screenPos() if lastEvent is None: self._lastScenePos = pressEvent.scenePos() self._lastScreenPos = pressEvent.screenPos() else: self._lastScenePos = lastEvent.scenePos() self._lastScreenPos = lastEvent.screenPos() self._buttons = moveEvent.buttons() self._button = pressEvent.button() self._modifiers = moveEvent.modifiers() self.acceptedItem = None def accept(self): """An item should call this method if it can handle the event. This will prevent the event being delivered to any other items.""" self.accepted = True self.acceptedItem = self.currentItem def ignore(self): """An item should call this method if it cannot handle the event. This will allow the event to be delivered to other items.""" self.accepted = False def isAccepted(self): return self.accepted def scenePos(self): """Return the current scene position of the mouse.""" return Point(self._scenePos) def screenPos(self): """Return the current screen position (pixels relative to widget) of the mouse.""" return Point(self._screenPos) def buttonDownScenePos(self, btn=None): """ Return the scene position of the mouse at the time *btn* was pressed. If *btn* is omitted, then the button that initiated the drag is assumed. """ if btn is None: btn = self.button() return Point(self._buttonDownScenePos[btn]) def buttonDownScreenPos(self, btn=None): """ Return the screen position (pixels relative to widget) of the mouse at the time *btn* was pressed. If *btn* is omitted, then the button that initiated the drag is assumed. """ if btn is None: btn = self.button() return Point(self._buttonDownScreenPos[btn]) def lastScenePos(self): """ Return the scene position of the mouse immediately prior to this event. """ return Point(self._lastScenePos) def lastScreenPos(self): """ Return the screen position of the mouse immediately prior to this event. """ return Point(self._lastScreenPos) def buttons(self): """ Return the buttons currently pressed on the mouse. (see QGraphicsSceneMouseEvent::buttons in the Qt documentation) """ return self._buttons def button(self): """Return the button that initiated the drag (may be different from the buttons currently pressed) (see QGraphicsSceneMouseEvent::button in the Qt documentation) """ return self._button def pos(self): """ Return the current position of the mouse in the coordinate system of the item that the event was delivered to. """ return Point(self.currentItem.mapFromScene(self._scenePos)) def lastPos(self): """ Return the previous position of the mouse in the coordinate system of the item that the event was delivered to. """ return Point(self.currentItem.mapFromScene(self._lastScenePos)) def buttonDownPos(self, btn=None): """ Return the position of the mouse at the time the drag was initiated in the coordinate system of the item that the event was delivered to. """ if btn is None: btn = self.button() return Point(self.currentItem.mapFromScene(self._buttonDownScenePos[btn])) def isStart(self): """Returns True if this event is the first since a drag was initiated.""" return self.start def isFinish(self): """Returns False if this is the last event in a drag. Note that this event will have the same position as the previous one.""" return self.finish def __repr__(self): if self.currentItem is None: lp = self._lastScenePos p = self._scenePos else: lp = self.lastPos() p = self.pos() return "(%g,%g) buttons=%s start=%s finish=%s>" % (lp.x(), lp.y(), p.x(), p.y(), str(self.buttons()), str(self.isStart()), str(self.isFinish())) def modifiers(self): """Return any keyboard modifiers currently pressed. (see QGraphicsSceneMouseEvent::modifiers in the Qt documentation) """ return self._modifiers class MouseClickEvent(object): """ Instances of this class are delivered to items in a :class:`GraphicsScene ` via their mouseClickEvent() method when the item is clicked. """ def __init__(self, pressEvent, double=False): self.accepted = False self.currentItem = None self._double = double self._scenePos = pressEvent.scenePos() self._screenPos = pressEvent.screenPos() self._button = pressEvent.button() self._buttons = pressEvent.buttons() self._modifiers = pressEvent.modifiers() self._time = perf_counter() self.acceptedItem = None def accept(self): """An item should call this method if it can handle the event. This will prevent the event being delivered to any other items.""" self.accepted = True self.acceptedItem = self.currentItem def ignore(self): """An item should call this method if it cannot handle the event. This will allow the event to be delivered to other items.""" self.accepted = False def isAccepted(self): return self.accepted def scenePos(self): """Return the current scene position of the mouse.""" return Point(self._scenePos) def screenPos(self): """Return the current screen position (pixels relative to widget) of the mouse.""" return Point(self._screenPos) def buttons(self): """ Return the buttons currently pressed on the mouse. (see QGraphicsSceneMouseEvent::buttons in the Qt documentation) """ return self._buttons def button(self): """Return the mouse button that generated the click event. (see QGraphicsSceneMouseEvent::button in the Qt documentation) """ return self._button def double(self): """Return True if this is a double-click.""" return self._double def pos(self): """ Return the current position of the mouse in the coordinate system of the item that the event was delivered to. """ return Point(self.currentItem.mapFromScene(self._scenePos)) def lastPos(self): """ Return the previous position of the mouse in the coordinate system of the item that the event was delivered to. """ return Point(self.currentItem.mapFromScene(self._lastScenePos)) def modifiers(self): """Return any keyboard modifiers currently pressed. (see QGraphicsSceneMouseEvent::modifiers in the Qt documentation) """ return self._modifiers def __repr__(self): try: if self.currentItem is None: p = self._scenePos else: p = self.pos() return "" % (p.x(), p.y(), str(self.button())) except: return "" % (str(self.button())) def time(self): return self._time class HoverEvent(object): """ Instances of this class are delivered to items in a :class:`GraphicsScene ` via their hoverEvent() method when the mouse is hovering over the item. This event class both informs items that the mouse cursor is nearby and allows items to communicate with one another about whether each item will accept *potential* mouse events. It is common for multiple overlapping items to receive hover events and respond by changing their appearance. This can be misleading to the user since, in general, only one item will respond to mouse events. To avoid this, items make calls to event.acceptClicks(button) and/or acceptDrags(button). Each item may make multiple calls to acceptClicks/Drags, each time for a different button. If the method returns True, then the item is guaranteed to be the recipient of the claimed event IF the user presses the specified mouse button before moving. If claimEvent returns False, then this item is guaranteed NOT to get the specified event (because another has already claimed it) and the item should change its appearance accordingly. event.isEnter() returns True if the mouse has just entered the item's shape; event.isExit() returns True if the mouse has just left. """ def __init__(self, moveEvent, acceptable): self.enter = False self.acceptable = acceptable self.exit = False self.__clickItems = weakref.WeakValueDictionary() self.__dragItems = weakref.WeakValueDictionary() self.currentItem = None if moveEvent is not None: self._scenePos = moveEvent.scenePos() self._screenPos = moveEvent.screenPos() self._lastScenePos = moveEvent.lastScenePos() self._lastScreenPos = moveEvent.lastScreenPos() self._buttons = moveEvent.buttons() self._modifiers = moveEvent.modifiers() else: self.exit = True def isEnter(self): """Returns True if the mouse has just entered the item's shape""" return self.enter def isExit(self): """Returns True if the mouse has just exited the item's shape""" return self.exit def acceptClicks(self, button): """Inform the scene that the item (that the event was delivered to) would accept a mouse click event if the user were to click before moving the mouse again. Returns True if the request is successful, otherwise returns False (indicating that some other item would receive an incoming click). """ if not self.acceptable: return False if button not in self.__clickItems: self.__clickItems[button] = self.currentItem return True return False def acceptDrags(self, button): """Inform the scene that the item (that the event was delivered to) would accept a mouse drag event if the user were to drag before the next hover event. Returns True if the request is successful, otherwise returns False (indicating that some other item would receive an incoming drag event). """ if not self.acceptable: return False if button not in self.__dragItems: self.__dragItems[button] = self.currentItem return True return False def scenePos(self): """Return the current scene position of the mouse.""" return Point(self._scenePos) def screenPos(self): """Return the current screen position of the mouse.""" return Point(self._screenPos) def lastScenePos(self): """Return the previous scene position of the mouse.""" return Point(self._lastScenePos) def lastScreenPos(self): """Return the previous screen position of the mouse.""" return Point(self._lastScreenPos) def buttons(self): """ Return the buttons currently pressed on the mouse. (see QGraphicsSceneMouseEvent::buttons in the Qt documentation) """ return self._buttons def pos(self): """ Return the current position of the mouse in the coordinate system of the item that the event was delivered to. """ return Point(self.currentItem.mapFromScene(self._scenePos)) def lastPos(self): """ Return the previous position of the mouse in the coordinate system of the item that the event was delivered to. """ return Point(self.currentItem.mapFromScene(self._lastScenePos)) def __repr__(self): if self.exit: return "" if self.currentItem is None: lp = self._lastScenePos p = self._scenePos else: lp = self.lastPos() p = self.pos() return "(%g,%g) buttons=%s enter=%s exit=%s>" % (lp.x(), lp.y(), p.x(), p.y(), str(self.buttons()), str(self.isEnter()), str(self.isExit())) def modifiers(self): """Return any keyboard modifiers currently pressed. (see QGraphicsSceneMouseEvent::modifiers in the Qt documentation) """ return self._modifiers def clickItems(self): return self.__clickItems def dragItems(self): return self.__dragItems pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/PlotData.py000066400000000000000000000030441457240071200217370ustar00rootroot00000000000000import numpy as np class PlotData(object): """ Class used for managing plot data - allows data sharing between multiple graphics items (curve, scatter, graph..) - each item may define the columns it needs - column groupings ('pos' or x, y, z) - efficiently appendable - log, fft transformations - color mode conversion (float/byte/qcolor) - pen/brush conversion - per-field cached masking - allows multiple masking fields (different graphics need to mask on different criteria) - removal of nan/inf values - option for single value shared by entire column - cached downsampling - cached min / max / hasnan / isuniform """ def __init__(self): self.fields = {} self.maxVals = {} ## cache for max/min self.minVals = {} def addFields(self, **fields): for f in fields: if f not in self.fields: self.fields[f] = None def hasField(self, f): return f in self.fields def __getitem__(self, field): return self.fields[field] def __setitem__(self, field, val): self.fields[field] = val def max(self, field): mx = self.maxVals.get(field, None) if mx is None: mx = np.max(self[field]) self.maxVals[field] = mx return mx def min(self, field): mn = self.minVals.get(field, None) if mn is None: mn = np.min(self[field]) self.minVals[field] = mn return mn pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Point.py000066400000000000000000000107001457240071200213150ustar00rootroot00000000000000""" Point.py - Extension of QPointF which adds a few missing methods. Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. """ from math import atan2, degrees, hypot from .Qt import QtCore class Point(QtCore.QPointF): """Extension of QPointF which adds a few missing methods.""" __slots__ = () def __init__(self, *args): if len(args) == 1: if isinstance(args[0], (QtCore.QSize, QtCore.QSizeF)): super().__init__(float(args[0].width()), float(args[0].height())) return elif isinstance(args[0], (int, float)): super().__init__(float(args[0]), float(args[0])) return elif hasattr(args[0], '__getitem__'): super().__init__(float(args[0][0]), float(args[0][1])) return elif len(args) == 2: super().__init__(args[0], args[1]) return super().__init__(*args) def __len__(self): return 2 def __reduce__(self): return (Point, (self.x(), self.y())) def __getitem__(self, i): if i == 0: return self.x() elif i == 1: return self.y() else: raise IndexError("Point has no index %s" % str(i)) def __iter__(self): yield(self.x()) yield(self.y()) def __setitem__(self, i, x): if i == 0: return self.setX(x) elif i == 1: return self.setY(x) else: raise IndexError("Point has no index %s" % str(i)) def __radd__(self, a): return self._math_('__radd__', a) def __add__(self, a): return self._math_('__add__', a) def __rsub__(self, a): return self._math_('__rsub__', a) def __sub__(self, a): return self._math_('__sub__', a) def __rmul__(self, a): return self._math_('__rmul__', a) def __mul__(self, a): return self._math_('__mul__', a) def __rdiv__(self, a): return self._math_('__rdiv__', a) def __div__(self, a): return self._math_('__div__', a) def __truediv__(self, a): return self._math_('__truediv__', a) def __rtruediv__(self, a): return self._math_('__rtruediv__', a) def __rpow__(self, a): return self._math_('__rpow__', a) def __pow__(self, a): return self._math_('__pow__', a) def _math_(self, op, x): if not isinstance(x, QtCore.QPointF): x = Point(x) return Point(getattr(self.x(), op)(x.x()), getattr(self.y(), op)(x.y())) def length(self): """Returns the vector length of this Point.""" return hypot(self.x(), self.y()) # length def norm(self): """Returns a vector in the same direction with unit length.""" return self / self.length() def angle(self, a, units="degrees"): """ Returns the angle in degrees from the vector a to self. Parameters ---------- a : Point, QPointF or QPoint The Point to return the angle with units : str, optional The units with which to compute the angle with, "degrees" or "radians", default "degrees" Returns ------- float The angle between two vectors """ rads = atan2(self.y(), self.x()) - atan2(a.y(), a.x()) if units == "radians": return rads return degrees(rads) def dot(self, a): """Returns the dot product of a and this Point.""" if not isinstance(a, QtCore.QPointF): a = Point(a) return Point.dotProduct(self, a) def cross(self, a): """Returns the cross product of a and this Point""" if not isinstance(a, QtCore.QPointF): a = Point(a) return self.x() * a.y() - self.y() * a.x() def proj(self, b): """Return the projection of this vector onto the vector b""" b1 = b.norm() return self.dot(b1) * b1 def __repr__(self): return "Point(%f, %f)" % (self.x(), self.y()) def min(self): return min(self.x(), self.y()) def max(self): return max(self.x(), self.y()) def copy(self): return Point(self) def toQPoint(self): return self.toPoint() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/000077500000000000000000000000001457240071200202405ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/QtCore/000077500000000000000000000000001457240071200214355ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/QtCore/__init__.py000066400000000000000000000000001457240071200235340ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/QtGui/000077500000000000000000000000001457240071200212715ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/QtGui/__init__.py000066400000000000000000000000001457240071200233700ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/QtWidgets/000077500000000000000000000000001457240071200221535ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/QtWidgets/__init__.py000066400000000000000000000000001457240071200242520ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/__init__.py000066400000000000000000000277351457240071200223670ustar00rootroot00000000000000""" This module exists to smooth out some of the differences between Qt versions. * Automatically import Qt lib depending on availability * Allow you to import QtCore/QtGui from pyqtgraph.Qt without specifying which Qt wrapper you want to use. """ import os import re import subprocess import sys import time import warnings PYSIDE = 'PySide' PYSIDE2 = 'PySide2' PYSIDE6 = 'PySide6' PYQT4 = 'PyQt4' PYQT5 = 'PyQt5' PYQT6 = 'PyQt6' QT_LIB = os.getenv('PYQTGRAPH_QT_LIB') if QT_LIB is not None: try: __import__(QT_LIB) except ModuleNotFoundError: raise ModuleNotFoundError(f"Environment variable PYQTGRAPH_QT_LIB is set to '{os.getenv('PYQTGRAPH_QT_LIB')}', but no module with this name was found.") ## Automatically determine which Qt package to use (unless specified by ## environment variable). ## This is done by first checking to see whether one of the libraries ## is already imported. If not, then attempt to import in the order ## specified in libOrder. if QT_LIB is None: libOrder = [PYQT6, PYSIDE6, PYQT5, PYSIDE2] for lib in libOrder: if lib in sys.modules: QT_LIB = lib break if QT_LIB is None: for lib in libOrder: qt = lib + '.QtCore' try: __import__(qt) QT_LIB = lib break except ImportError: pass if QT_LIB is None: raise Exception("PyQtGraph requires one of PyQt5, PyQt6, PySide2 or PySide6; none of these packages could be imported.") class FailedImport(object): """Used to defer ImportErrors until we are sure the module is needed. """ def __init__(self, err): self.err = err def __getattr__(self, attr): raise self.err # Make a loadUiType function like PyQt has # Credit: # http://stackoverflow.com/questions/4442286/python-code-genration-with-pyside-uic/14195313#14195313 class _StringIO(object): """Alternative to built-in StringIO needed to circumvent unicode/ascii issues""" def __init__(self): self.data = [] def write(self, data): self.data.append(data) def getvalue(self): return ''.join(map(str, self.data)).encode('utf8') def _loadUiType(uiFile): """ PySide lacks a "loadUiType" command like PyQt4's, so we have to convert the ui file to py code in-memory first and then execute it in a special frame to retrieve the form_class. from stackoverflow: http://stackoverflow.com/a/14195313/3781327 seems like this might also be a legitimate solution, but I'm not sure how to make PyQt4 and pyside look the same... http://stackoverflow.com/a/8717832 """ pyside2uic = None if QT_LIB == PYSIDE2: try: import pyside2uic except ImportError: # later versions of pyside2 have dropped pyside2uic; use the uic binary instead. pyside2uic = None if pyside2uic is None: pyside2version = tuple(map(int, PySide2.__version__.split("."))) if (5, 14) <= pyside2version < (5, 14, 2, 2): warnings.warn('For UI compilation, it is recommended to upgrade to PySide >= 5.15', RuntimeWarning, stacklevel=2) # get class names from ui file import xml.etree.ElementTree as xml parsed = xml.parse(uiFile) widget_class = parsed.find('widget').get('class') form_class = parsed.find('class').text # convert ui file to python code if pyside2uic is None: uic_executable = QT_LIB.lower() + '-uic' uipy = subprocess.check_output([uic_executable, uiFile]) else: o = _StringIO() with open(uiFile, 'r') as f: pyside2uic.compileUi(f, o, indent=0) uipy = o.getvalue() # execute python code pyc = compile(uipy, '', 'exec') frame = {} exec(pyc, frame) # fetch the base_class and form class based on their type in the xml from designer form_class = frame['Ui_%s'%form_class] base_class = eval('QtWidgets.%s'%widget_class) return form_class, base_class # For historical reasons, pyqtgraph maintains a Qt4-ish interface back when # there wasn't a QtWidgets module. This _was_ done by monkey-patching all of # QtWidgets into the QtGui module. This monkey-patching modifies QtGui at a # global level. # To avoid this, we now maintain a local "mirror" of QtCore, QtGui and QtWidgets. # Thus, when monkey-patching happens later on in this file, they will only affect # the local modules and not the global modules. def _copy_attrs(src, dst): for o in dir(src): if not hasattr(dst, o): setattr(dst, o, getattr(src, o)) from . import QtCore, QtGui, QtWidgets, compat if QT_LIB == PYQT5: # We're using PyQt5 which has a different structure so we're going to use a shim to # recreate the Qt4 structure for Qt5 import PyQt5.QtCore import PyQt5.QtGui import PyQt5.QtWidgets _copy_attrs(PyQt5.QtCore, QtCore) _copy_attrs(PyQt5.QtGui, QtGui) _copy_attrs(PyQt5.QtWidgets, QtWidgets) try: from PyQt5 import sip except ImportError: # some Linux distros package it this way (e.g. Ubuntu) import sip from PyQt5 import uic try: from PyQt5 import QtSvg except ImportError as err: QtSvg = FailedImport(err) try: from PyQt5 import QtTest except ImportError as err: QtTest = FailedImport(err) VERSION_INFO = 'PyQt5 ' + QtCore.PYQT_VERSION_STR + ' Qt ' + QtCore.QT_VERSION_STR elif QT_LIB == PYQT6: import PyQt6.QtCore import PyQt6.QtGui import PyQt6.QtWidgets _copy_attrs(PyQt6.QtCore, QtCore) _copy_attrs(PyQt6.QtGui, QtGui) _copy_attrs(PyQt6.QtWidgets, QtWidgets) from PyQt6 import sip, uic try: from PyQt6 import QtSvg except ImportError as err: QtSvg = FailedImport(err) try: from PyQt6 import QtOpenGLWidgets except ImportError as err: QtOpenGLWidgets = FailedImport(err) try: from PyQt6 import QtTest except ImportError as err: QtTest = FailedImport(err) VERSION_INFO = 'PyQt6 ' + QtCore.PYQT_VERSION_STR + ' Qt ' + QtCore.QT_VERSION_STR elif QT_LIB == PYSIDE2: import PySide2.QtCore import PySide2.QtGui import PySide2.QtWidgets _copy_attrs(PySide2.QtCore, QtCore) _copy_attrs(PySide2.QtGui, QtGui) _copy_attrs(PySide2.QtWidgets, QtWidgets) try: from PySide2 import QtSvg except ImportError as err: QtSvg = FailedImport(err) try: from PySide2 import QtTest except ImportError as err: QtTest = FailedImport(err) import PySide2 import shiboken2 as shiboken VERSION_INFO = 'PySide2 ' + PySide2.__version__ + ' Qt ' + QtCore.__version__ elif QT_LIB == PYSIDE6: import PySide6.QtCore import PySide6.QtGui import PySide6.QtWidgets _copy_attrs(PySide6.QtCore, QtCore) _copy_attrs(PySide6.QtGui, QtGui) _copy_attrs(PySide6.QtWidgets, QtWidgets) try: from PySide6 import QtSvg except ImportError as err: QtSvg = FailedImport(err) try: from PySide6 import QtOpenGLWidgets except ImportError as err: QtOpenGLWidgets = FailedImport(err) try: from PySide6 import QtTest except ImportError as err: QtTest = FailedImport(err) import PySide6 import shiboken6 as shiboken VERSION_INFO = 'PySide6 ' + PySide6.__version__ + ' Qt ' + QtCore.__version__ else: raise ValueError("Invalid Qt lib '%s'" % QT_LIB) if QT_LIB in [PYQT6, PYSIDE6]: # We're using Qt6 which has a different structure so we're going to use a shim to # recreate the Qt5 structure if not isinstance(QtOpenGLWidgets, FailedImport): QtWidgets.QOpenGLWidget = QtOpenGLWidgets.QOpenGLWidget # PySide6 incorrectly placed QFileSystemModel inside QtWidgets if QT_LIB == PYSIDE6 and hasattr(QtWidgets, 'QFileSystemModel'): module = getattr(QtWidgets, "QFileSystemModel") setattr(QtGui, "QFileSystemModel", module) else: # Shim Qt5 namespace to match Qt6 module_whitelist = [ "QAction", "QActionGroup", "QFileSystemModel", "QShortcut", "QUndoCommand", "QUndoGroup", "QUndoStack", ] for module in module_whitelist: attr = getattr(QtWidgets, module) setattr(QtGui, module, attr) # Common to PySide2 and PySide6 if QT_LIB in [PYSIDE2, PYSIDE6]: QtVersion = QtCore.__version__ loadUiType = _loadUiType isQObjectAlive = shiboken.isValid # PySide does not implement qWait if not isinstance(QtTest, FailedImport): if not hasattr(QtTest.QTest, 'qWait'): @staticmethod def qWait(msec): start = time.time() QtWidgets.QApplication.processEvents() while time.time() < start + msec * 0.001: QtWidgets.QApplication.processEvents() QtTest.QTest.qWait = qWait compat.wrapinstance = shiboken.wrapInstance compat.unwrapinstance = lambda x : shiboken.getCppPointer(x)[0] compat.voidptr = shiboken.VoidPtr # Common to PyQt5 and PyQt6 if QT_LIB in [PYQT5, PYQT6]: QtVersion = QtCore.QT_VERSION_STR # PyQt, starting in v5.5, calls qAbort when an exception is raised inside # a slot. To maintain backward compatibility (and sanity for interactive # users), we install a global exception hook to override this behavior. if sys.excepthook == sys.__excepthook__: sys_excepthook = sys.excepthook def pyqt_qabort_override(*args, **kwds): return sys_excepthook(*args, **kwds) sys.excepthook = pyqt_qabort_override def isQObjectAlive(obj): return not sip.isdeleted(obj) loadUiType = uic.loadUiType QtCore.Signal = QtCore.pyqtSignal compat.wrapinstance = sip.wrapinstance compat.unwrapinstance = sip.unwrapinstance compat.voidptr = sip.voidptr from . import internals # Alert user if using Qt < 5.15, but do not raise exception versionReq = [5, 15] m = re.match(r'(\d+)\.(\d+).*', QtVersion) if m is not None and list(map(int, m.groups())) < versionReq: warnings.warn( f"PyQtGraph supports Qt version >= {versionReq[0]}.{versionReq[1]}," f" but {QtVersion} detected.", RuntimeWarning, stacklevel=2 ) App = QtWidgets.QApplication # subclassing QApplication causes segfaults on PySide{2, 6} / Python 3.8.7+ QAPP = None def mkQApp(name=None): """ Creates new QApplication or returns current instance if existing. ============== ======================================================== **Arguments:** name (str) Application name, passed to Qt ============== ======================================================== """ global QAPP def onPaletteChange(palette): color = palette.base().color() app = QtWidgets.QApplication.instance() darkMode = color.lightnessF() < 0.5 app.setProperty('darkMode', darkMode) QAPP = QtWidgets.QApplication.instance() if QAPP is None: # hidpi handling qtVersionCompare = tuple(map(int, QtVersion.split("."))) if qtVersionCompare > (6, 0): # Qt6 seems to support hidpi without needing to do anything so continue pass elif qtVersionCompare > (5, 14): os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "1" QtWidgets.QApplication.setHighDpiScaleFactorRoundingPolicy(QtCore.Qt.HighDpiScaleFactorRoundingPolicy.PassThrough) else: # qt 5.12 and 5.13 QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps) QAPP = QtWidgets.QApplication(sys.argv or ["pyqtgraph"]) QAPP.paletteChanged.connect(onPaletteChange) QAPP.paletteChanged.emit(QAPP.palette()) if name is not None: QAPP.setApplicationName(name) return QAPP # exec() is used within _loadUiType, so we define as exec_() here and rename in pg namespace def exec_(): app = mkQApp() return app.exec() if hasattr(app, 'exec') else app.exec_() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/__init__.pyi000066400000000000000000000025541457240071200225300ustar00rootroot00000000000000""" This stub file is to aid in the PyCharm auto-completion of the Qt imports. """ from typing import Union try: from PyQt5 import QtCore, QtGui, QtSvg, QtTest, QtWidgets QtCore = QtCore QtGui = QtGui QtWidgets = QtWidgets QtTest = QtTest QtSvg = QtSvg except ImportError: try: from PyQt6 import QtCore, QtGui, QtSvg, QtTest, QtWidgets QtCore = QtCore QtGui = QtGui QtWidgets = QtWidgets QtTest = QtTest QtSvg = QtSvg except ImportError: try: from PySide2 import QtCore, QtGui, QtSvg, QtTest, QtWidgets QtCore = QtCore QtGui = QtGui QtWidgets = QtWidgets QtTest = QtTest QtSvg = QtSvg except ImportError: try: from PySide6 import QtCore, QtGui, QtSvg, QtTest, QtWidgets QtCore = QtCore QtGui = QtGui QtWidgets = QtWidgets QtTest = QtTest QtSvg = QtSvg except ImportError as e: raise ImportError("No suitable qt binding found") from e App: QtWidgets.QApplication VERSION_INFO: str QT_LIB: str QtVersion: str def exec_() -> QtWidgets.QApplication: ... def mkQApp(name: Union[str, None] = None) -> QtWidgets.QApplication: ... def isQObjectAlive(obj: QtCore.QObject) -> bool: ... pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/compat/000077500000000000000000000000001457240071200215235ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/compat/__init__.py000066400000000000000000000000001457240071200236220ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Qt/internals.py000066400000000000000000000175201457240071200226160ustar00rootroot00000000000000import ctypes import itertools import numpy as np from . import QT_LIB, QtCore, QtGui, compat __all__ = ["get_qpainterpath_element_array"] if QT_LIB.startswith('PyQt'): from . import sip elif QT_LIB == 'PySide2': from PySide2 import __version_info__ as pyside_version_info elif QT_LIB == 'PySide6': from PySide6 import __version_info__ as pyside_version_info class QArrayDataQt5(ctypes.Structure): _fields_ = [ ("ref", ctypes.c_int), ("size", ctypes.c_int), ("alloc", ctypes.c_uint, 31), ("offset", ctypes.c_ssize_t), ] class QPainterPathPrivateQt5(ctypes.Structure): _fields_ = [ ("ref", ctypes.c_int), ("adata", ctypes.POINTER(QArrayDataQt5)), ] class QArrayDataQt6(ctypes.Structure): _fields_ = [ ("ref", ctypes.c_int), ("flags", ctypes.c_uint), ("alloc", ctypes.c_ssize_t), ] class QPainterPathPrivateQt6(ctypes.Structure): _fields_ = [ ("ref", ctypes.c_int), ("adata", ctypes.POINTER(QArrayDataQt6)), ("data", ctypes.c_void_p), ("size", ctypes.c_ssize_t), ] def get_qpainterpath_element_array(qpath, nelems=None): writable = nelems is not None if writable: qpath.reserve(nelems) itemsize = 24 dtype = dict(names=['x','y','c'], formats=['f8', 'f8', 'i4'], itemsize=itemsize) ptr0 = compat.unwrapinstance(qpath) pte_cp = ctypes.c_void_p.from_address(ptr0) if not pte_cp: return np.zeros(0, dtype=dtype) # _cp : ctypes pointer # _ci : ctypes instance if QT_LIB in ['PyQt5', 'PySide2']: PTR = ctypes.POINTER(QPainterPathPrivateQt5) pte_ci = ctypes.cast(pte_cp, PTR).contents size_ci = pte_ci.adata[0] eptr = ctypes.addressof(size_ci) + size_ci.offset elif QT_LIB in ['PyQt6', 'PySide6']: PTR = ctypes.POINTER(QPainterPathPrivateQt6) pte_ci = ctypes.cast(pte_cp, PTR).contents size_ci = pte_ci eptr = pte_ci.data else: raise NotImplementedError if writable: size_ci.size = nelems else: nelems = size_ci.size vp = compat.voidptr(eptr, itemsize*nelems, writable) return np.frombuffer(vp, dtype=dtype) class PrimitiveArray: # Note: This class is an internal implementation detail and is not part # of the public API. # # QPainter has a C++ native API that takes an array of objects: # drawPrimitives(const Primitive *array, int count, ...) # where "Primitive" is one of QPointF, QLineF, QRectF, PixmapFragment # # PySide (with the exception of drawPixmapFragments) and older PyQt # require a Python list of "Primitive" instances to be provided to # the respective "drawPrimitives" method. # # This is inefficient because: # 1) constructing the Python list involves calling wrapinstance multiple times. # - this is mitigated here by reusing the instance pointers # 2) The binding will anyway have to repack the instances into a contiguous array, # in order to call the underlying C++ native API. # # Newer PyQt provides sip.array, which is more efficient. # # PySide's drawPixmapFragments() takes an instance to the first item of a # C array of PixmapFragment(s) _and_ the length of the array. # There is no overload that takes a Python list of PixmapFragment(s). def __init__(self, Klass, nfields, *, use_array=None): self._Klass = Klass self._nfields = nfields self._capa = -1 self.use_sip_array = False self.use_ptr_to_array = False if QT_LIB.startswith('PyQt'): if use_array is None: use_array = ( hasattr(sip, 'array') and ( (0x60301 <= QtCore.PYQT_VERSION) or (0x50f07 <= QtCore.PYQT_VERSION < 0x60000) ) ) self.use_sip_array = use_array if QT_LIB.startswith('PySide'): if use_array is None: use_array = ( Klass is QtGui.QPainter.PixmapFragment or pyside_version_info >= (6, 4, 3) ) self.use_ptr_to_array = use_array self.resize(0) def resize(self, size): if self.use_sip_array: # For reference, SIP_VERSION 6.7.8 first arrived # in PyQt5_sip 12.11.2 and PyQt6_sip 13.4.2 if sip.SIP_VERSION >= 0x60708: if size <= self._capa: self._size = size return else: # sip.array prior to SIP_VERSION 6.7.8 had a # buggy slicing implementation. # so trigger a reallocate for any different size if size == self._capa: return self._siparray = sip.array(self._Klass, size) else: if size <= self._capa: self._size = size return self._ndarray = np.empty((size, self._nfields), dtype=np.float64) if self.use_ptr_to_array: # defer creation self._objs = None else: self._objs = self._wrap_instances(self._ndarray) self._capa = size self._size = size def _wrap_instances(self, array): return list(map(compat.wrapinstance, itertools.count(array.ctypes.data, array.strides[0]), itertools.repeat(self._Klass, array.shape[0]))) def __len__(self): return self._size def ndarray(self): # ndarray views are cheap to recreate each time if self.use_sip_array: if ( sip.SIP_VERSION >= 0x60708 and np.__version__ != "1.22.4" # TODO: remove me after numpy 1.23+ ): # workaround for numpy/sip compatability issue # see https://github.com/numpy/numpy/issues/21612 mv = self._siparray else: # sip.array prior to SIP_VERSION 6.7.8 had a buggy buffer protocol # that set the wrong size. # workaround it by going through a sip.voidptr mv = sip.voidptr(self._siparray, self._capa*self._nfields*8) # note that we perform the slicing by using only _size rows nd = np.frombuffer(mv, dtype=np.float64, count=self._size*self._nfields) return nd.reshape((-1, self._nfields)) else: return self._ndarray[:self._size] def instances(self): # this returns an iterable container of Klass instances. # for "use_ptr_to_array" mode, such a container may not # be required at all, so its creation is deferred if self.use_sip_array: if self._size == self._capa: # avoiding slicing when it's not necessary # handles the case where sip.array had a buggy # slicing implementation return self._siparray else: # this is a view return self._siparray[:self._size] if self._objs is None: self._objs = self._wrap_instances(self._ndarray) if self._size == self._capa: return self._objs else: # this is a shallow copy return self._objs[:self._size] def drawargs(self): # returns arguments to apply to the respective drawPrimitives() functions if self.use_ptr_to_array: if self._capa > 0: # wrap memory only if it is safe to do so ptr = compat.wrapinstance(self._ndarray.ctypes.data, self._Klass) else: # shiboken translates None <--> nullptr # alternatively, we could instantiate a dummy _Klass() ptr = None return ptr, self._size else: return self.instances(), pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/SRTTransform.py000066400000000000000000000120751457240071200225770ustar00rootroot00000000000000from math import atan2, degrees import numpy as np from . import SRTTransform3D from .Point import Point from .Qt import QtGui class SRTTransform(QtGui.QTransform): """Transform that can always be represented as a combination of 3 matrices: scale * rotate * translate This transform has no shear; angles are always preserved. """ def __init__(self, init=None): QtGui.QTransform.__init__(self) self.reset() if init is None: return elif isinstance(init, dict): self.restoreState(init) elif isinstance(init, SRTTransform): self._state = { 'pos': Point(init._state['pos']), 'scale': Point(init._state['scale']), 'angle': init._state['angle'] } self.update() elif isinstance(init, QtGui.QTransform): self.setFromQTransform(init) elif isinstance(init, QtGui.QMatrix4x4): self.setFromMatrix4x4(init) else: raise Exception("Cannot create SRTTransform from input type: %s" % str(type(init))) def getScale(self): return self._state['scale'] def getRotation(self): return self._state['angle'] def getTranslation(self): return self._state['pos'] def reset(self): self._state = { 'pos': Point(0,0), 'scale': Point(1,1), 'angle': 0.0 ## in degrees } self.update() def setFromQTransform(self, tr): p1 = Point(tr.map(0., 0.)) p2 = Point(tr.map(1., 0.)) p3 = Point(tr.map(0., 1.)) dp2 = Point(p2-p1) dp3 = Point(p3-p1) ## detect flipped axes if dp2.angle(dp3, units="radians") > 0: da = 0 sy = -1.0 else: da = 0 sy = 1.0 self._state = { 'pos': Point(p1), 'scale': Point(dp2.length(), dp3.length() * sy), 'angle': degrees(atan2(dp2[1], dp2[0])) + da } self.update() def setFromMatrix4x4(self, m): m = SRTTransform3D.SRTTransform3D(m) angle, axis = m.getRotation() if angle != 0 and (axis[0] != 0 or axis[1] != 0 or axis[2] != 1): print("angle: %s axis: %s" % (str(angle), str(axis))) raise Exception("Can only convert 4x4 matrix to 3x3 if rotation is around Z-axis.") self._state = { 'pos': Point(m.getTranslation()), 'scale': Point(m.getScale()), 'angle': angle } self.update() def translate(self, *args): """Acceptable arguments are: x, y [x, y] Point(x,y)""" t = Point(*args) self.setTranslate(self._state['pos']+t) def setTranslate(self, *args): """Acceptable arguments are: x, y [x, y] Point(x,y)""" self._state['pos'] = Point(*args) self.update() def scale(self, *args): """Acceptable arguments are: x, y [x, y] Point(x,y)""" s = Point(*args) self.setScale(self._state['scale'] * s) def setScale(self, *args): """Acceptable arguments are: x, y [x, y] Point(x,y)""" self._state['scale'] = Point(*args) self.update() def rotate(self, angle): """Rotate the transformation by angle (in degrees)""" self.setRotate(self._state['angle'] + angle) def setRotate(self, angle): """Set the transformation rotation to angle (in degrees)""" self._state['angle'] = angle self.update() def __truediv__(self, t): """A / B == B^-1 * A""" dt = t.inverted()[0] * self return SRTTransform(dt) def __div__(self, t): return self.__truediv__(t) def __mul__(self, t): return SRTTransform(QtGui.QTransform.__mul__(self, t)) def saveState(self): p = self._state['pos'] s = self._state['scale'] return {'pos': (p[0], p[1]), 'scale': (s[0], s[1]), 'angle': self._state['angle']} def __reduce__(self): return SRTTransform, (self.saveState(),) def restoreState(self, state): self._state['pos'] = Point(state.get('pos', (0,0))) self._state['scale'] = Point(state.get('scale', (1.,1.))) self._state['angle'] = state.get('angle', 0) self.update() def update(self): QtGui.QTransform.reset(self) ## modifications to the transform are multiplied on the right, so we need to reverse order here. QtGui.QTransform.translate(self, *self._state['pos']) QtGui.QTransform.rotate(self, self._state['angle']) QtGui.QTransform.scale(self, *self._state['scale']) def __repr__(self): return str(self.saveState()) def matrix(self): return np.array([[self.m11(), self.m12(), self.m13()],[self.m21(), self.m22(), self.m23()],[self.m31(), self.m32(), self.m33()]]) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/SRTTransform3D.py000066400000000000000000000201601457240071200227600ustar00rootroot00000000000000from math import atan2, degrees import numpy as np from . import SRTTransform from .Qt import QtGui from .Transform3D import Transform3D from .Vector import Vector class SRTTransform3D(Transform3D): """4x4 Transform matrix that can always be represented as a combination of 3 matrices: scale * rotate * translate This transform has no shear; angles are always preserved. """ def __init__(self, init=None): Transform3D.__init__(self) self.reset() if init is None: return if init.__class__ is QtGui.QTransform: init = SRTTransform.SRTTransform(init) if isinstance(init, dict): self.restoreState(init) elif isinstance(init, SRTTransform3D): self._state = { 'pos': Vector(init._state['pos']), 'scale': Vector(init._state['scale']), 'angle': init._state['angle'], 'axis': Vector(init._state['axis']), } self.update() elif isinstance(init, SRTTransform.SRTTransform): self._state = { 'pos': Vector(init._state['pos']), 'scale': Vector(init._state['scale']), 'angle': init._state['angle'], 'axis': Vector(0, 0, 1), } self._state['scale'][2] = 1.0 self.update() elif isinstance(init, QtGui.QMatrix4x4): self.setFromMatrix(init) else: raise Exception("Cannot build SRTTransform3D from argument type:", type(init)) def getScale(self): return Vector(self._state['scale']) def getRotation(self): """Return (angle, axis) of rotation""" return self._state['angle'], Vector(self._state['axis']) def getTranslation(self): return Vector(self._state['pos']) def reset(self): self._state = { 'pos': Vector(0,0,0), 'scale': Vector(1,1,1), 'angle': 0.0, ## in degrees 'axis': (0, 0, 1) } self.update() def translate(self, *args): """Adjust the translation of this transform""" t = Vector(*args) self.setTranslate(self._state['pos']+t) def setTranslate(self, *args): """Set the translation of this transform""" self._state['pos'] = Vector(*args) self.update() def scale(self, *args): """adjust the scale of this transform""" ## try to prevent accidentally setting 0 scale on z axis if len(args) == 1 and hasattr(args[0], '__len__'): args = args[0] if len(args) == 2: args = args + (1,) s = Vector(*args) self.setScale(self._state['scale'] * s) def setScale(self, *args): """Set the scale of this transform""" if len(args) == 1 and hasattr(args[0], '__len__'): args = args[0] if len(args) == 2: args = args + (1,) self._state['scale'] = Vector(*args) self.update() def rotate(self, angle, axis=(0,0,1)): """Adjust the rotation of this transform""" origAxis = self._state['axis'] if axis[0] == origAxis[0] and axis[1] == origAxis[1] and axis[2] == origAxis[2]: self.setRotate(self._state['angle'] + angle) else: m = QtGui.QMatrix4x4() m.translate(*self._state['pos']) m.rotate(self._state['angle'], *self._state['axis']) m.rotate(angle, *axis) m.scale(*self._state['scale']) self.setFromMatrix(m) def setRotate(self, angle, axis=(0,0,1)): """Set the transformation rotation to angle (in degrees)""" self._state['angle'] = angle self._state['axis'] = Vector(axis) self.update() def setFromMatrix(self, m): """ Set this transform based on the elements of *m* The input matrix must be affine AND have no shear, otherwise the conversion will most likely fail. """ import numpy.linalg for i in range(4): self.setRow(i, m.row(i)) m = self.matrix().reshape(4,4) ## translation is 4th column self._state['pos'] = m[:3,3] ## scale is vector-length of first three columns scale = (m[:3,:3]**2).sum(axis=0)**0.5 ## see whether there is an inversion z = np.cross(m[0, :3], m[1, :3]) if np.dot(z, m[2, :3]) < 0: scale[1] *= -1 ## doesn't really matter which axis we invert self._state['scale'] = scale ## rotation axis is the eigenvector with eigenvalue=1 r = m[:3, :3] / scale[np.newaxis, :] try: evals, evecs = numpy.linalg.eig(r) except: print("Rotation matrix: %s" % str(r)) print("Scale: %s" % str(scale)) print("Original matrix: %s" % str(m)) raise eigIndex = np.argwhere(np.abs(evals-1) < 1e-6) if len(eigIndex) < 1: print("eigenvalues: %s" % str(evals)) print("eigenvectors: %s" % str(evecs)) print("index: %s, %s" % (str(eigIndex), str(evals-1))) raise Exception("Could not determine rotation axis.") axis = evecs[:,eigIndex[0,0]].real axis /= ((axis**2).sum())**0.5 self._state['axis'] = axis ## trace(r) == 2 cos(angle) + 1, so: cos = (r.trace()-1)*0.5 ## this only gets us abs(angle) ## The off-diagonal values can be used to correct the angle ambiguity, ## but we need to figure out which element to use: axisInd = np.argmax(np.abs(axis)) rInd,sign = [((1,2), -1), ((0,2), 1), ((0,1), -1)][axisInd] ## Then we have r-r.T = sin(angle) * 2 * sign * axis[axisInd]; ## solve for sin(angle) sin = (r-r.T)[rInd] / (2. * sign * axis[axisInd]) ## finally, we get the complete angle from arctan(sin/cos) self._state['angle'] = degrees(atan2(sin, cos)) if self._state['angle'] == 0: self._state['axis'] = (0,0,1) def as2D(self): """Return a QTransform representing the x,y portion of this transform (if possible)""" return SRTTransform.SRTTransform(self) #def __div__(self, t): #"""A / B == B^-1 * A""" #dt = t.inverted()[0] * self #return SRTTransform.SRTTransform(dt) #def __mul__(self, t): #return SRTTransform.SRTTransform(QtGui.QTransform.__mul__(self, t)) def saveState(self): p = self._state['pos'] s = self._state['scale'] ax = self._state['axis'] #if s[0] == 0: #raise Exception('Invalid scale: %s' % str(s)) return { 'pos': (p[0], p[1], p[2]), 'scale': (s[0], s[1], s[2]), 'angle': self._state['angle'], 'axis': (ax[0], ax[1], ax[2]) } def restoreState(self, state): self._state['pos'] = Vector(state.get('pos', (0.,0.,0.))) scale = state.get('scale', (1.,1.,1.)) scale = tuple(scale) + (1.,) * (3-len(scale)) self._state['scale'] = Vector(scale) self._state['angle'] = state.get('angle', 0.) self._state['axis'] = state.get('axis', (0, 0, 1)) self.update() def update(self): Transform3D.setToIdentity(self) ## modifications to the transform are multiplied on the right, so we need to reverse order here. Transform3D.translate(self, *self._state['pos']) Transform3D.rotate(self, self._state['angle'], *self._state['axis']) Transform3D.scale(self, *self._state['scale']) def __repr__(self): return str(self.saveState()) def matrix(self, nd=3): if nd == 3: return np.array(self.copyDataTo()).reshape(4,4) elif nd == 2: m = np.array(self.copyDataTo()).reshape(4,4) m[2] = m[3] m[:,2] = m[:,3] return m[:3,:3] else: raise Exception("Argument 'nd' must be 2 or 3") def __reduce__(self): return SRTTransform3D, (self.saveState(),) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/SignalProxy.py000066400000000000000000000072301457240071200225070ustar00rootroot00000000000000import weakref from time import perf_counter from .functions import SignalBlock from .Qt import QtCore from .ThreadsafeTimer import ThreadsafeTimer __all__ = ['SignalProxy'] class SignalProxy(QtCore.QObject): """Object which collects rapid-fire signals and condenses them into a single signal or a rate-limited stream of signals. Used, for example, to prevent a SpinBox from generating multiple signals when the mouse wheel is rolled over it. Emits sigDelayed after input signals have stopped for a certain period of time. """ sigDelayed = QtCore.Signal(object) def __init__(self, signal, delay=0.3, rateLimit=0, slot=None, *, threadSafe=True): """Initialization arguments: signal - a bound Signal or pyqtSignal instance delay - Time (in seconds) to wait for signals to stop before emitting (default 0.3s) slot - Optional function to connect sigDelayed to. rateLimit - (signals/sec) if greater than 0, this allows signals to stream out at a steady rate while they are being received. threadSafe - Specify if thread-safety is required. For backwards compatibility, it defaults to True. """ QtCore.QObject.__init__(self) self.delay = delay self.rateLimit = rateLimit self.args = None Timer = ThreadsafeTimer if threadSafe else QtCore.QTimer self.timer = Timer() self.timer.timeout.connect(self.flush) self.lastFlushTime = None self.signal = signal self.signal.connect(self.signalReceived) if slot is not None: self.blockSignal = False self.sigDelayed.connect(slot) self.slot = weakref.ref(slot) else: self.blockSignal = True self.slot = None def setDelay(self, delay): self.delay = delay def signalReceived(self, *args): """Received signal. Cancel previous timer and store args to be forwarded later.""" if self.blockSignal: return self.args = args if self.rateLimit == 0: self.timer.stop() self.timer.start(int(self.delay * 1000) + 1) else: now = perf_counter() if self.lastFlushTime is None: leakTime = 0 else: lastFlush = self.lastFlushTime leakTime = max(0, (lastFlush + (1.0 / self.rateLimit)) - now) self.timer.stop() self.timer.start(int(min(leakTime, self.delay) * 1000) + 1) def flush(self): """If there is a signal queued up, send it now.""" if self.args is None or self.blockSignal: return False args, self.args = self.args, None self.timer.stop() self.lastFlushTime = perf_counter() self.sigDelayed.emit(args) return True def disconnect(self): self.blockSignal = True try: self.signal.disconnect(self.signalReceived) except: pass try: slot = self.slot() if slot is not None: self.sigDelayed.disconnect(slot) except: pass finally: self.slot = None def connectSlot(self, slot): """Connect the `SignalProxy` to an external slot""" assert self.slot is None, "Slot was already connected!" self.slot = weakref.ref(slot) self.sigDelayed.connect(slot) self.blockSignal = False def block(self): """Return a SignalBlocker that temporarily blocks input signals to this proxy. """ return SignalBlock(self.signal, self.signalReceived) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/ThreadsafeTimer.py000066400000000000000000000031131457240071200232730ustar00rootroot00000000000000from .Qt import QtCore __all__ = ['ThreadsafeTimer'] class ThreadsafeTimer(QtCore.QObject): """ Thread-safe replacement for QTimer. """ timeout = QtCore.Signal() sigTimerStopRequested = QtCore.Signal() sigTimerStartRequested = QtCore.Signal(object) def __init__(self): QtCore.QObject.__init__(self) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.timerFinished) self.timer.moveToThread(QtCore.QCoreApplication.instance().thread()) self.moveToThread(QtCore.QCoreApplication.instance().thread()) self.sigTimerStopRequested.connect(self.stop, QtCore.Qt.ConnectionType.QueuedConnection) self.sigTimerStartRequested.connect(self.start, QtCore.Qt.ConnectionType.QueuedConnection) def start(self, timeout): isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread() if isGuiThread: #print "start timer", self, "from gui thread" self.timer.start(int(timeout)) else: #print "start timer", self, "from remote thread" self.sigTimerStartRequested.emit(timeout) def stop(self): isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread() if isGuiThread: #print "stop timer", self, "from gui thread" self.timer.stop() else: #print "stop timer", self, "from remote thread" self.sigTimerStopRequested.emit() def timerFinished(self): self.timeout.emit() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Transform3D.py000066400000000000000000000034541457240071200223760ustar00rootroot00000000000000import numpy as np from . import functions as fn from .Qt import QtGui from .Vector import Vector class Transform3D(QtGui.QMatrix4x4): """ Extension of QMatrix4x4 with some helpful methods added. """ def __init__(self, *args): if len(args) == 1: if isinstance(args[0], (list, tuple, np.ndarray)): args = [x for y in args[0] for x in y] if len(args) != 16: raise TypeError("Single argument to Transform3D must have 16 elements.") elif isinstance(args[0], QtGui.QMatrix4x4): args = list(args[0].copyDataTo()) QtGui.QMatrix4x4.__init__(self, *args) def matrix(self, nd=3): if nd == 3: return np.array(self.copyDataTo()).reshape(4,4) elif nd == 2: m = np.array(self.copyDataTo()).reshape(4,4) m[2] = m[3] m[:,2] = m[:,3] return m[:3,:3] else: raise Exception("Argument 'nd' must be 2 or 3") def map(self, obj): """ Extends QMatrix4x4.map() to allow mapping (3, ...) arrays of coordinates """ if isinstance(obj, np.ndarray) and obj.shape[0] in (2,3): if obj.ndim >= 2: return fn.transformCoordinates(self, obj) elif obj.ndim == 1: v = QtGui.QMatrix4x4.map(self, Vector(obj)) return np.array([v.x(), v.y(), v.z()])[:obj.shape[0]] elif isinstance(obj, (list, tuple)): v = QtGui.QMatrix4x4.map(self, Vector(obj)) return type(obj)([v.x(), v.y(), v.z()])[:len(obj)] else: return QtGui.QMatrix4x4.map(self, obj) def inverted(self): inv, b = QtGui.QMatrix4x4.inverted(self) return Transform3D(inv), b pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/Vector.py000066400000000000000000000066401457240071200214760ustar00rootroot00000000000000""" Vector.py - Extension of QVector3D which adds a few missing methods. Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. """ from math import acos, degrees from . import functions as fn from .Qt import QT_LIB, QtCore, QtGui class Vector(QtGui.QVector3D): """Extension of QVector3D which adds a few helpful methods.""" def __init__(self, *args): """ Handle additional constructions of a Vector ============== ================================================================================================ **Arguments:** *args* Could be any of: * 3 numerics (x, y, and z) * 2 numerics (x, y, and `0` assumed for z) * Either of the previous in a list-like collection * 1 QSizeF (`0` assumed for z) * 1 QPointF (`0` assumed for z) * Any other valid QVector3D init args. ============== ================================================================================================ """ initArgs = args if len(args) == 1: if isinstance(args[0], QtCore.QSizeF): initArgs = (float(args[0].width()), float(args[0].height()), 0) elif isinstance(args[0], QtCore.QPoint) or isinstance(args[0], QtCore.QPointF): initArgs = (float(args[0].x()), float(args[0].y()), 0) elif hasattr(args[0], '__getitem__') and not isinstance(args[0], QtGui.QVector3D): vals = list(args[0]) if len(vals) == 2: vals.append(0) if len(vals) != 3: raise Exception('Cannot init Vector with sequence of length %d' % len(args[0])) initArgs = vals elif isinstance(args[0], QtGui.QVector3D): # PySide6 6.1 does not accept initialization from QVector3D initArgs = args[0].x(), args[0].y(), args[0].z() elif len(args) == 2: initArgs = (args[0], args[1], 0) QtGui.QVector3D.__init__(self, *initArgs) def __len__(self): return 3 def __getitem__(self, i): if i == 0: return self.x() elif i == 1: return self.y() elif i == 2: return self.z() else: raise IndexError("Point has no index %s" % str(i)) def __setitem__(self, i, x): if i == 0: return self.setX(x) elif i == 1: return self.setY(x) elif i == 2: return self.setZ(x) else: raise IndexError("Point has no index %s" % str(i)) def __iter__(self): yield(self.x()) yield(self.y()) yield(self.z()) def angle(self, a): """Returns the angle in degrees between this vector and the vector a.""" n1 = self.length() n2 = a.length() if n1 == 0. or n2 == 0.: return None ## Probably this should be done with arctan2 instead.. rads = acos(fn.clip_scalar(QtGui.QVector3D.dotProduct(self, a) / (n1 * n2), -1.0, 1.0)) ### in radians # c = self.crossProduct(a) # if c > 0: # ang *= -1. return degrees(rads) def __abs__(self): return Vector(abs(self.x()), abs(self.y()), abs(self.z())) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/WidgetGroup.py000066400000000000000000000224731457240071200224760ustar00rootroot00000000000000""" WidgetGroup.py - WidgetGroup class for easily managing lots of Qt widgets Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. This class addresses the problem of having to save and restore the state of a large group of widgets. """ import inspect import weakref from .Qt import QtCore, QtWidgets __all__ = ['WidgetGroup'] def splitterState(w): s = w.saveState().toPercentEncoding().data().decode() return s def restoreSplitter(w, s): if type(s) is list: w.setSizes(s) elif type(s) is str: w.restoreState(QtCore.QByteArray.fromPercentEncoding(s.encode())) else: print("Can't configure QSplitter using object of type", type(s)) if w.count() > 0: # make sure at least one item is not collapsed for i in w.sizes(): if i > 0: return w.setSizes([50] * w.count()) def comboState(w): ind = w.currentIndex() data = w.itemData(ind) if data is not None: try: if not data.isValid(): data = None else: data = data.toInt()[0] except AttributeError: pass if data is None: return str(w.itemText(ind)) else: return data def setComboState(w, v): if type(v) is int: ind = w.findData(v) if ind > -1: w.setCurrentIndex(ind) return w.setCurrentIndex(w.findText(str(v))) class WidgetGroup(QtCore.QObject): """State manager for groups of widgets. WidgetGroup handles common problems that arise when dealing with groups of widgets like a control panel: - Provide a single place for saving / restoring the state of all widgets in the group - Provide a single signal for detecting when any of the widgets have changed """ # List of widget types that can be handled by WidgetGroup. # The value for each type is a tuple (change signal function, get function, set function, [auto-add children]) # The change signal function that takes an object and returns a signal that is emitted any time the state of the widget changes, not just # when it is changed by user interaction. (for example, 'clicked' is not a valid signal here) # If the change signal is None, the value of the widget is not cached. # Custom widgets not in this list can be made to work with WidgetGroup by giving them a 'widgetGroupInterface' method # which returns the tuple. classes = { QtWidgets.QSpinBox: ( lambda w: w.valueChanged, QtWidgets.QSpinBox.value, QtWidgets.QSpinBox.setValue ), QtWidgets.QDoubleSpinBox: ( lambda w: w.valueChanged, QtWidgets.QDoubleSpinBox.value, QtWidgets.QDoubleSpinBox.setValue ), QtWidgets.QSplitter: ( None, splitterState, restoreSplitter, True ), QtWidgets.QCheckBox: ( lambda w: w.stateChanged, QtWidgets.QCheckBox.isChecked, QtWidgets.QCheckBox.setChecked ), QtWidgets.QComboBox: ( lambda w: w.currentIndexChanged, comboState, setComboState ), QtWidgets.QGroupBox: ( lambda w: w.toggled, QtWidgets.QGroupBox.isChecked, QtWidgets.QGroupBox.setChecked, True ), QtWidgets.QLineEdit: ( lambda w: w.editingFinished, lambda w: str(w.text()), QtWidgets.QLineEdit.setText ), QtWidgets.QRadioButton: ( lambda w: w.toggled, QtWidgets.QRadioButton.isChecked, QtWidgets.QRadioButton.setChecked ), QtWidgets.QSlider: ( lambda w: w.valueChanged, QtWidgets.QSlider.value, QtWidgets.QSlider.setValue ), } sigChanged = QtCore.Signal(str, object) def __init__(self, widgetList=None): """Initialize WidgetGroup, adding specified widgets into this group. widgetList can be: - a list of widget specifications (widget, [name], [scale]) - a dict of name: widget pairs - any QObject, and all compatible child widgets will be added recursively. The 'scale' parameter for each widget allows QSpinBox to display a different value than the value recorded in the group state (for example, the program may set a spin box value to 100e-6 and have it displayed as 100 to the user) """ QtCore.QObject.__init__(self) self.widgetList = weakref.WeakKeyDictionary() # Make sure widgets don't stick around just because they are listed here self.scales = weakref.WeakKeyDictionary() self.cache = {} # name:value pairs self.uncachedWidgets = weakref.WeakKeyDictionary() if isinstance(widgetList, QtCore.QObject): self.autoAdd(widgetList) elif isinstance(widgetList, list): for w in widgetList: self.addWidget(*w) elif isinstance(widgetList, dict): for name, w in widgetList.items(): self.addWidget(w, name) elif widgetList is None: return else: raise Exception("Wrong argument type %s" % type(widgetList)) def addWidget(self, w, name=None, scale=None): if not self.acceptsType(w): raise Exception("Widget type %s not supported by WidgetGroup" % type(w)) if name is None: name = str(w.objectName()) if name == '': raise Exception("Cannot add widget '%s' without a name." % str(w)) self.widgetList[w] = name self.scales[w] = scale self.readWidget(w) if type(w) in WidgetGroup.classes: signal = WidgetGroup.classes[type(w)][0] else: signal = w.widgetGroupInterface()[0] if signal is not None: if inspect.isfunction(signal) or inspect.ismethod(signal): signal = signal(w) signal.connect(self.widgetChanged) else: self.uncachedWidgets[w] = None def findWidget(self, name): for w in self.widgetList: if self.widgetList[w] == name: return w return None def interface(self, obj): t = type(obj) if t in WidgetGroup.classes: return WidgetGroup.classes[t] else: return obj.widgetGroupInterface() def checkForChildren(self, obj): """Return true if we should automatically search the children of this object for more.""" iface = self.interface(obj) return (len(iface) > 3 and iface[3]) def autoAdd(self, obj): # Find all children of this object and add them if possible. accepted = self.acceptsType(obj) if accepted: self.addWidget(obj) if not accepted or self.checkForChildren(obj): for c in obj.children(): self.autoAdd(c) def acceptsType(self, obj): for c in WidgetGroup.classes: if isinstance(obj, c): return True if hasattr(obj, 'widgetGroupInterface'): return True return False def setScale(self, widget, scale): val = self.readWidget(widget) self.scales[widget] = scale self.setWidget(widget, val) def widgetChanged(self, *args): w = self.sender() n = self.widgetList[w] v1 = self.cache[n] v2 = self.readWidget(w) if v1 != v2: self.sigChanged.emit(self.widgetList[w], v2) def state(self): for w in self.uncachedWidgets: self.readWidget(w) return self.cache.copy() def setState(self, s): for w in self.widgetList: n = self.widgetList[w] if n not in s: continue self.setWidget(w, s[n]) def readWidget(self, w): if type(w) in WidgetGroup.classes: getFunc = WidgetGroup.classes[type(w)][1] else: getFunc = w.widgetGroupInterface()[1] if getFunc is None: return None # if the getter function provided in the interface is a bound method, # then just call the method directly. Otherwise, pass in the widget as the first arg # to the function. if inspect.ismethod(getFunc) and getFunc.__self__ is not None: val = getFunc() else: val = getFunc(w) if self.scales[w] is not None: val /= self.scales[w] n = self.widgetList[w] self.cache[n] = val return val def setWidget(self, w, v): if self.scales[w] is not None: v *= self.scales[w] if type(w) in WidgetGroup.classes: setFunc = WidgetGroup.classes[type(w)][2] else: setFunc = w.widgetGroupInterface()[2] # if the setter function provided in the interface is a bound method, # then just call the method directly. Otherwise, pass in the widget as the first arg # to the function. if inspect.ismethod(setFunc) and setFunc.__self__ is not None: setFunc(v) else: setFunc(w, v) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/__init__.py000066400000000000000000000417731457240071200220010ustar00rootroot00000000000000""" PyQtGraph - Scientific Graphics and GUI Library for Python www.pyqtgraph.org """ __version__ = '0.13.4' ### import all the goodies and add some helper functions for easy CLI use import importlib import os import sys import numpy # # pyqtgraph requires numpy ## 'Qt' is a local module; it is intended mainly to cover up the differences ## between PyQt and PySide. from .colors import palette from .Qt import QtCore, QtGui, QtWidgets from .Qt import exec_ as exec from .Qt import mkQApp ## not really safe--If we accidentally create another QApplication, the process hangs (and it is very difficult to trace the cause) #if QtWidgets.QApplication.instance() is None: #app = QtWidgets.QApplication([]) ## (import here to avoid massive error dump later on if numpy is not available) ## in general openGL is poorly supported with Qt+GraphicsView. ## we only enable it where the performance benefit is critical. ## Note this only applies to 2D graphics; 3D graphics always use OpenGL. if 'linux' in sys.platform: ## linux has numerous bugs in opengl implementation useOpenGL = False elif 'darwin' in sys.platform: ## openGL can have a major impact on mac, but also has serious bugs useOpenGL = False else: useOpenGL = False ## on windows there's a more even performance / bugginess tradeoff. CONFIG_OPTIONS = { 'useOpenGL': useOpenGL, ## by default, this is platform-dependent (see widgets/GraphicsView). Set to True or False to explicitly enable/disable opengl. 'leftButtonPan': True, ## if false, left button drags a rubber band for zooming in viewbox # foreground/background take any arguments to the 'mkColor' in /pyqtgraph/functions.py 'foreground': 'd', ## default foreground color for axes, labels, etc. 'background': 'k', ## default background for GraphicsWidget 'antialias': False, 'editorCommand': None, ## command used to invoke code editor from ConsoleWidgets 'exitCleanup': True, ## Attempt to work around some exit crash bugs in PyQt and PySide 'enableExperimental': False, ## Enable experimental features (the curious can search for this key in the code) 'crashWarning': False, # If True, print warnings about situations that may result in a crash 'mouseRateLimit': 100, # For ignoring frequent mouse events, max number of mouse move events per second, if <= 0, then it is switched off 'imageAxisOrder': 'col-major', # For 'row-major', image data is expected in the standard (row, col) order. # For 'col-major', image data is expected in reversed (col, row) order. # The default is 'col-major' for backward compatibility, but this may # change in the future. 'useCupy': False, # When True, attempt to use cupy ( currently only with ImageItem and related functions ) 'useNumba': False, # When True, use numba 'segmentedLineMode': 'auto', # segmented line mode, controls if lines are plotted in segments or continuous # 'auto': whether lines are plotted in segments is automatically decided using pen properties and whether anti-aliasing is enabled # 'on' or True: lines are always plotted in segments # 'off' or False: lines are never plotted in segments } def setConfigOption(opt, value): if opt not in CONFIG_OPTIONS: raise KeyError('Unknown configuration option "%s"' % opt) if opt == 'imageAxisOrder' and value not in ('row-major', 'col-major'): raise ValueError('imageAxisOrder must be either "row-major" or "col-major"') if opt == 'segmentedLineMode' and value not in ('auto', 'on', 'off'): raise ValueError('segmentedLineMode must be "auto", "on" or "off"') CONFIG_OPTIONS[opt] = value def setConfigOptions(**opts): """Set global configuration options. Each keyword argument sets one global option. """ for k,v in opts.items(): setConfigOption(k, v) def getConfigOption(opt): """Return the value of a single global configuration option. """ return CONFIG_OPTIONS[opt] def systemInfo(): print("sys.platform: %s" % sys.platform) print("sys.version: %s" % sys.version) from .Qt import VERSION_INFO print("qt bindings: %s" % VERSION_INFO) global __version__ rev = None if __version__ is None: ## this code was probably checked out from bzr; look up the last-revision file lastRevFile = os.path.join(os.path.dirname(__file__), '..', '.bzr', 'branch', 'last-revision') if os.path.exists(lastRevFile): with open(lastRevFile, 'r') as fd: rev = fd.read().strip() print("pyqtgraph: %s; %s" % (__version__, rev)) print("config:") import pprint pprint.pprint(CONFIG_OPTIONS) ## Rename orphaned .pyc files. This is *probably* safe :) ## We only do this if __version__ is None, indicating the code was probably pulled ## from the repository. def renamePyc(startDir): ### Used to rename orphaned .pyc files ### When a python file changes its location in the repository, usually the .pyc file ### is left behind, possibly causing mysterious and difficult to track bugs. ### Note that this is no longer necessary for python 3.2; from PEP 3147: ### "If the py source file is missing, the pyc file inside __pycache__ will be ignored. ### This eliminates the problem of accidental stale pyc file imports." printed = False startDir = os.path.abspath(startDir) for path, dirs, files in os.walk(startDir): if '__pycache__' in path: continue for f in files: fileName = os.path.join(path, f) base, ext = os.path.splitext(fileName) py = base + ".py" if ext == '.pyc' and not os.path.isfile(py): if not printed: print("NOTE: Renaming orphaned .pyc files:") printed = True n = 1 while True: name2 = fileName + ".renamed%d" % n if not os.path.exists(name2): break n += 1 print(" " + fileName + " ==>") print(" " + name2) os.rename(fileName, name2) path = os.path.split(__file__)[0] ## Import almost everything to make it available from a single namespace ## don't import the more complex systems--canvas, parametertree, flowchart, dockarea ## these must be imported separately. #from . import frozenSupport #def importModules(path, globals, locals, excludes=()): #"""Import all modules residing within *path*, return a dict of name: module pairs. #Note that *path* MUST be relative to the module doing the import. #""" #d = os.path.join(os.path.split(globals['__file__'])[0], path) #files = set() #for f in frozenSupport.listdir(d): #if frozenSupport.isdir(os.path.join(d, f)) and f not in ['__pycache__', 'tests']: #files.add(f) #elif f[-3:] == '.py' and f != '__init__.py': #files.add(f[:-3]) #elif f[-4:] == '.pyc' and f != '__init__.pyc': #files.add(f[:-4]) #mods = {} #path = path.replace(os.sep, '.') #for modName in files: #if modName in excludes: #continue #try: #if len(path) > 0: #modName = path + '.' + modName #print( "from .%s import * " % modName) #mod = __import__(modName, globals, locals, ['*'], 1) #mods[modName] = mod #except: #import traceback #traceback.print_stack() #sys.excepthook(*sys.exc_info()) #print("[Error importing module: %s]" % modName) #return mods #def importAll(path, globals, locals, excludes=()): #"""Given a list of modules, import all names from each module into the global namespace.""" #mods = importModules(path, globals, locals, excludes) #for mod in mods.values(): #if hasattr(mod, '__all__'): #names = mod.__all__ #else: #names = [n for n in dir(mod) if n[0] != '_'] #for k in names: #if hasattr(mod, k): #globals[k] = getattr(mod, k) # Dynamic imports are disabled. This causes too many problems. #importAll('graphicsItems', globals(), locals()) #importAll('widgets', globals(), locals(), #excludes=['MatplotlibWidget', 'RawImageWidget', 'RemoteGraphicsView']) ## Attempts to work around exit crashes: import atexit from .colormap import * from .functions import * from .graphicsItems.ArrowItem import * from .graphicsItems.AxisItem import * from .graphicsItems.BarGraphItem import * from .graphicsItems.ButtonItem import * from .graphicsItems.ColorBarItem import * from .graphicsItems.CurvePoint import * from .graphicsItems.DateAxisItem import * from .graphicsItems.ErrorBarItem import * from .graphicsItems.FillBetweenItem import * from .graphicsItems.GradientEditorItem import * from .graphicsItems.GradientLegend import * from .graphicsItems.GraphicsItem import * from .graphicsItems.GraphicsLayout import * from .graphicsItems.GraphicsObject import * from .graphicsItems.GraphicsWidget import * from .graphicsItems.GraphicsWidgetAnchor import * from .graphicsItems.GraphItem import * from .graphicsItems.GridItem import * from .graphicsItems.HistogramLUTItem import * from .graphicsItems.ImageItem import * from .graphicsItems.InfiniteLine import * from .graphicsItems.IsocurveItem import * from .graphicsItems.ItemGroup import * from .graphicsItems.LabelItem import * from .graphicsItems.LegendItem import * from .graphicsItems.LinearRegionItem import * from .graphicsItems.MultiPlotItem import * from .graphicsItems.PColorMeshItem import * from .graphicsItems.PlotCurveItem import * from .graphicsItems.PlotDataItem import * from .graphicsItems.PlotItem import * from .graphicsItems.ROI import * from .graphicsItems.ScaleBar import * from .graphicsItems.ScatterPlotItem import * from .graphicsItems.TargetItem import * from .graphicsItems.TextItem import * from .graphicsItems.UIGraphicsItem import * from .graphicsItems.ViewBox import * from .graphicsItems.VTickGroup import * # indirect imports used within library from .GraphicsScene import GraphicsScene from .imageview import * # indirect imports known to be used outside of the library from .metaarray import MetaArray from .Point import Point from .Qt import isQObjectAlive from .SignalProxy import * from .SRTTransform import SRTTransform from .SRTTransform3D import SRTTransform3D from .ThreadsafeTimer import * from .Transform3D import Transform3D from .util.cupy_helper import getCupy from .Vector import Vector from .WidgetGroup import * from .widgets.BusyCursor import * from .widgets.CheckTable import * from .widgets.ColorButton import * from .widgets.ColorMapWidget import * from .widgets.ComboBox import * from .widgets.DataFilterWidget import * from .widgets.DataTreeWidget import * from .widgets.DiffTreeWidget import * from .widgets.FeedbackButton import * from .widgets.FileDialog import * from .widgets.GradientWidget import * from .widgets.GraphicsLayoutWidget import * from .widgets.GraphicsView import * from .widgets.GroupBox import GroupBox from .widgets.HistogramLUTWidget import * from .widgets.JoystickButton import * from .widgets.LayoutWidget import * from .widgets.MultiPlotWidget import * from .widgets.PathButton import * from .widgets.PlotWidget import * from .widgets.ProgressDialog import * from .widgets.RawImageWidget import * from .widgets.RemoteGraphicsView import RemoteGraphicsView from .widgets.ScatterPlotWidget import * from .widgets.SpinBox import * from .widgets.TableWidget import * from .widgets.TreeWidget import * from .widgets.ValueLabel import * from .widgets.VerticalLabel import * ############################################################## ## PyQt and PySide both are prone to crashing on exit. ## There are two general approaches to dealing with this: ## 1. Install atexit handlers that assist in tearing down to avoid crashes. ## This helps, but is never perfect. ## 2. Terminate the process before python starts tearing down ## This is potentially dangerous _cleanupCalled = False def cleanup(): global _cleanupCalled if _cleanupCalled: return if not getConfigOption('exitCleanup'): return ViewBox.quit() ## tell ViewBox that it doesn't need to deregister views anymore. _cleanupCalled = True atexit.register(cleanup) # Call cleanup when QApplication quits. This is necessary because sometimes # the QApplication will quit before the atexit callbacks are invoked. # Note: cannot connect this function until QApplication has been created, so # instead we have GraphicsView.__init__ call this for us. _cleanupConnected = False def _connectCleanup(): global _cleanupConnected if _cleanupConnected: return QtWidgets.QApplication.instance().aboutToQuit.connect(cleanup) _cleanupConnected = True ## Optional function for exiting immediately (with some manual teardown) def exit(): """ Causes python to exit without garbage-collecting any objects, and thus avoids calling object destructor methods. This is a sledgehammer workaround for a variety of bugs in PyQt and Pyside that cause crashes on exit. This function does the following in an attempt to 'safely' terminate the process: * Invoke atexit callbacks * Close all open file handles * os._exit() Note: there is some potential for causing damage with this function if you are using objects that _require_ their destructors to be called (for example, to properly terminate log files, disconnect from devices, etc). Situations like this are probably quite rare, but use at your own risk. """ ## first disable our own cleanup function; won't be needing it. setConfigOptions(exitCleanup=False) ## invoke atexit callbacks atexit._run_exitfuncs() ## close file handles if sys.platform == 'darwin': for fd in range(3, 4096): if fd in [7]: # trying to close 7 produces an illegal instruction on the Mac. continue try: os.close(fd) except OSError: pass else: os.closerange(3, 4096) ## just guessing on the maximum descriptor count.. os._exit(0) ## Convenience functions for command-line use plots = [] images = [] QAPP = None def plot(*args, **kargs): """ Create and return a :class:`PlotWidget ` Accepts a *title* argument to set the title of the window. All other arguments are used to plot data. (see :func:`PlotItem.plot() `) """ mkQApp() pwArgList = ['title', 'labels', 'name', 'left', 'right', 'top', 'bottom', 'background'] pwArgs = {} dataArgs = {} for k in kargs: if k in pwArgList: pwArgs[k] = kargs[k] else: dataArgs[k] = kargs[k] windowTitle = pwArgs.pop("title", "PlotWidget") w = PlotWidget(**pwArgs) w.setWindowTitle(windowTitle) if len(args) > 0 or len(dataArgs) > 0: w.plot(*args, **dataArgs) plots.append(w) w.show() return w def image(*args, **kargs): """ Create and return an :class:`ImageView ` Will show 2D or 3D image data. Accepts a *title* argument to set the title of the window. All other arguments are used to show data. (see :func:`ImageView.setImage() `) """ mkQApp() w = ImageView() windowTitle = kargs.pop("title", "ImageView") w.setWindowTitle(windowTitle) w.setImage(*args, **kargs) images.append(w) w.show() return w show = image ## for backward compatibility def dbg(*args, **kwds): """ Create a console window and begin watching for exceptions. All arguments are passed to :func:`ConsoleWidget.__init__() `. """ mkQApp() from . import console c = console.ConsoleWidget(*args, **kwds) c.catchAllExceptions() c.show() global consoles try: consoles.append(c) except NameError: consoles = [c] return c def stack(*args, **kwds): """ Create a console window and show the current stack trace. All arguments are passed to :func:`ConsoleWidget.__init__() `. """ mkQApp() from . import console c = console.ConsoleWidget(*args, **kwds) c.setStack() c.show() global consoles try: consoles.append(c) except NameError: consoles = [c] return c def setPalette(app, style): if isinstance(style, str): style = style.lower() if style == 'qdarkstylelight': p = palette.getQDarkStyleLightQPalette() elif style in ['qdarkstyle','qdarkstyledark']: p = palette.getQDarkStyleDarkQPalette() else: raise ValueError(f'no palette by the name {style} exists') elif isinstance(style, QtGui.QPalette): p = style else: raise TypeError('style either be a string or QPalette') app.paletteChanged.emit(p) app.setPalette(p) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/canvas/000077500000000000000000000000001457240071200211275ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/canvas/Canvas.py000066400000000000000000000374421457240071200227260ustar00rootroot00000000000000__all__ = ["Canvas"] import gc import importlib import weakref import warnings from ..graphicsItems.GridItem import GridItem from ..graphicsItems.ROI import ROI from ..graphicsItems.ViewBox import ViewBox from ..Qt import QT_LIB, QtCore, QtGui, QtWidgets from . import CanvasTemplate_generic as ui_template from .CanvasItem import CanvasItem, GroupCanvasItem from .CanvasManager import CanvasManager translate = QtCore.QCoreApplication.translate class Canvas(QtWidgets.QWidget): sigSelectionChanged = QtCore.Signal(object, object) sigItemTransformChanged = QtCore.Signal(object, object) sigItemTransformChangeFinished = QtCore.Signal(object, object) def __init__(self, parent=None, allowTransforms=True, hideCtrl=False, name=None): QtWidgets.QWidget.__init__(self, parent) warnings.warn( 'pyqtgrapoh.cavas will be deprecated in pyqtgraph and migrate to ' 'acq4. Removal will occur after September, 2023.', DeprecationWarning, stacklevel=2 ) self.ui = ui_template.Ui_Form() self.ui.setupUi(self) self.view = ViewBox() self.ui.view.setCentralItem(self.view) self.itemList = self.ui.itemList self.itemList.setSelectionMode(self.itemList.SelectionMode.ExtendedSelection) self.allowTransforms = allowTransforms self.multiSelectBox = SelectBox() self.view.addItem(self.multiSelectBox) self.multiSelectBox.hide() self.multiSelectBox.setZValue(1e6) self.ui.mirrorSelectionBtn.hide() self.ui.reflectSelectionBtn.hide() self.ui.resetTransformsBtn.hide() self.redirect = None ## which canvas to redirect items to self.items = [] self.view.setAspectLocked(True) grid = GridItem() self.grid = CanvasItem(grid, name='Grid', movable=False) self.addItem(self.grid) self.hideBtn = QtWidgets.QPushButton('>', self) self.hideBtn.setFixedWidth(20) self.hideBtn.setFixedHeight(20) self.ctrlSize = 200 self.sizeApplied = False self.hideBtn.clicked.connect(self.hideBtnClicked) self.ui.splitter.splitterMoved.connect(self.splitterMoved) self.ui.itemList.itemChanged.connect(self.treeItemChanged) self.ui.itemList.sigItemMoved.connect(self.treeItemMoved) self.ui.itemList.itemSelectionChanged.connect(self.treeItemSelected) self.ui.autoRangeBtn.clicked.connect(self.autoRange) self.ui.redirectCheck.toggled.connect(self.updateRedirect) self.ui.redirectCombo.currentIndexChanged.connect(self.updateRedirect) self.multiSelectBox.sigRegionChanged.connect(self.multiSelectBoxChanged) self.multiSelectBox.sigRegionChangeFinished.connect(self.multiSelectBoxChangeFinished) self.ui.mirrorSelectionBtn.clicked.connect(self.mirrorSelectionClicked) self.ui.reflectSelectionBtn.clicked.connect(self.reflectSelectionClicked) self.ui.resetTransformsBtn.clicked.connect(self.resetTransformsClicked) self.resizeEvent() if hideCtrl: self.hideBtnClicked() if name is not None: self.registeredName = CanvasManager.instance().registerCanvas(self, name) self.ui.redirectCombo.setHostName(self.registeredName) self.menu = QtWidgets.QMenu() remAct = QtGui.QAction(translate("Context Menu", "Remove item"), self.menu) remAct.triggered.connect(self.removeClicked) self.menu.addAction(remAct) self.menu.remAct = remAct self.ui.itemList.contextMenuEvent = self.itemListContextMenuEvent def splitterMoved(self): self.resizeEvent() def hideBtnClicked(self): ctrlSize = self.ui.splitter.sizes()[1] if ctrlSize == 0: cs = self.ctrlSize w = self.ui.splitter.size().width() if cs > w: cs = w - 20 self.ui.splitter.setSizes([w-cs, cs]) self.hideBtn.setText('>') else: self.ctrlSize = ctrlSize self.ui.splitter.setSizes([100, 0]) self.hideBtn.setText('<') self.resizeEvent() def autoRange(self): self.view.autoRange() def resizeEvent(self, ev=None): if ev is not None: super().resizeEvent(ev) self.hideBtn.move(self.ui.view.size().width() - self.hideBtn.width(), 0) if not self.sizeApplied: self.sizeApplied = True s = int( min(self.width(), max(100, min(200, self.width()//4))) ) s2 = self.width()-s self.ui.splitter.setSizes([s2, s]) def updateRedirect(self, *args): ### Decide whether/where to redirect items and make it so cname = str(self.ui.redirectCombo.currentText()) man = CanvasManager.instance() if self.ui.redirectCheck.isChecked() and cname != '': redirect = man.getCanvas(cname) else: redirect = None if self.redirect is redirect: return self.redirect = redirect if redirect is None: self.reclaimItems() else: self.redirectItems(redirect) def redirectItems(self, canvas): for i in self.items: if i is self.grid: continue li = i.listItem parent = li.parent() if parent is None: tree = li.treeWidget() if tree is None: print("Skipping item", i, i.name) continue tree.removeTopLevelItem(li) else: parent.removeChild(li) canvas.addItem(i) def reclaimItems(self): items = self.items self.items = [self.grid] items.remove(self.grid) for i in items: i.canvas.removeItem(i) self.addItem(i) def treeItemChanged(self, item, col): try: citem = item.canvasItem() except AttributeError: return if item.checkState(0) == QtCore.Qt.CheckState.Checked: for i in range(item.childCount()): item.child(i).setCheckState(0, QtCore.Qt.CheckState.Checked) citem.show() else: for i in range(item.childCount()): item.child(i).setCheckState(0, QtCore.Qt.CheckState.Unchecked) citem.hide() def treeItemSelected(self): sel = self.selectedItems() if len(sel) == 0: return multi = len(sel) > 1 for i in self.items: ## updated the selected state of every item i.selectionChanged(i in sel, multi) if len(sel)==1: self.multiSelectBox.hide() self.ui.mirrorSelectionBtn.hide() self.ui.reflectSelectionBtn.hide() self.ui.resetTransformsBtn.hide() elif len(sel) > 1: self.showMultiSelectBox() self.sigSelectionChanged.emit(self, sel) def selectedItems(self): """ Return list of all selected canvasItems """ return [item.canvasItem() for item in self.itemList.selectedItems() if item.canvasItem() is not None] def selectItem(self, item): li = item.listItem self.itemList.setCurrentItem(li) def showMultiSelectBox(self): ## Get list of selected canvas items items = self.selectedItems() rect = self.view.itemBoundingRect(items[0].graphicsItem()) for i in items: if not i.isMovable(): ## all items in selection must be movable return br = self.view.itemBoundingRect(i.graphicsItem()) rect = rect|br self.multiSelectBox.blockSignals(True) self.multiSelectBox.setPos([rect.x(), rect.y()]) self.multiSelectBox.setSize(rect.size()) self.multiSelectBox.setAngle(0) self.multiSelectBox.blockSignals(False) self.multiSelectBox.show() self.ui.mirrorSelectionBtn.show() self.ui.reflectSelectionBtn.show() self.ui.resetTransformsBtn.show() def mirrorSelectionClicked(self): for ci in self.selectedItems(): ci.mirrorY() self.showMultiSelectBox() def reflectSelectionClicked(self): for ci in self.selectedItems(): ci.mirrorXY() self.showMultiSelectBox() def resetTransformsClicked(self): for i in self.selectedItems(): i.resetTransformClicked() self.showMultiSelectBox() def multiSelectBoxChanged(self): self.multiSelectBoxMoved() def multiSelectBoxChangeFinished(self): for ci in self.selectedItems(): ci.applyTemporaryTransform() ci.sigTransformChangeFinished.emit(ci) def multiSelectBoxMoved(self): transform = self.multiSelectBox.getGlobalTransform() for ci in self.selectedItems(): ci.setTemporaryTransform(transform) ci.sigTransformChanged.emit(ci) def addGraphicsItem(self, item, **opts): """Add a new GraphicsItem to the scene at pos. Common options are name, pos, scale, and z """ citem = CanvasItem(item, **opts) item._canvasItem = citem self.addItem(citem) return citem def addGroup(self, name, **kargs): group = GroupCanvasItem(name=name) self.addItem(group, **kargs) return group def addItem(self, citem): """ Add an item to the canvas. """ ## Check for redirections if self.redirect is not None: name = self.redirect.addItem(citem) self.items.append(citem) return name if not self.allowTransforms: citem.setMovable(False) citem.sigTransformChanged.connect(self.itemTransformChanged) citem.sigTransformChangeFinished.connect(self.itemTransformChangeFinished) citem.sigVisibilityChanged.connect(self.itemVisibilityChanged) ## Determine name to use in the item list name = citem.opts['name'] if name is None: name = 'item' ## find parent and add item to tree insertLocation = 0 ## determine parent list item where this item should be inserted parent = citem.parentItem() if parent in (None, self.view.childGroup): parent = self.itemList.invisibleRootItem() else: parent = parent.listItem ## set Z value above all other siblings if none was specified siblings = [parent.child(i).canvasItem() for i in range(parent.childCount())] z = citem.zValue() if z is None: zvals = [i.zValue() for i in siblings] if parent is self.itemList.invisibleRootItem(): if len(zvals) == 0: z = 0 else: z = max(zvals)+10 else: if len(zvals) == 0: z = parent.canvasItem().zValue() else: z = max(zvals)+1 citem.setZValue(z) ## determine location to insert item relative to its siblings for i in range(parent.childCount()): ch = parent.child(i) zval = ch.canvasItem().graphicsItem().zValue() ## should we use CanvasItem.zValue here? if zval < z: insertLocation = i break else: insertLocation = i+1 node = QtWidgets.QTreeWidgetItem([name]) flags = node.flags() | QtCore.Qt.ItemFlag.ItemIsUserCheckable | QtCore.Qt.ItemFlag.ItemIsDragEnabled if not isinstance(citem, GroupCanvasItem): flags = flags & ~QtCore.Qt.ItemFlag.ItemIsDropEnabled node.setFlags(flags) if citem.opts['visible']: node.setCheckState(0, QtCore.Qt.CheckState.Checked) else: node.setCheckState(0, QtCore.Qt.CheckState.Unchecked) node.name = name parent.insertChild(insertLocation, node) citem.name = name citem.listItem = node node.canvasItem = weakref.ref(citem) self.items.append(citem) ctrl = citem.ctrlWidget() ctrl.hide() self.ui.ctrlLayout.addWidget(ctrl) ## inform the canvasItem that its parent canvas has changed citem.setCanvas(self) ## Autoscale to fit the first item added (not including the grid). if len(self.items) == 2: self.autoRange() return citem def treeItemMoved(self, item, parent, index): ##Item moved in tree; update Z values if parent is self.itemList.invisibleRootItem(): item.canvasItem().setParentItem(self.view.childGroup) else: item.canvasItem().setParentItem(parent.canvasItem()) siblings = [parent.child(i).canvasItem() for i in range(parent.childCount())] zvals = [i.zValue() for i in siblings] zvals.sort(reverse=True) for i in range(len(siblings)): item = siblings[i] item.setZValue(zvals[i]) def itemVisibilityChanged(self, item): listItem = item.listItem checked = listItem.checkState(0) == QtCore.Qt.CheckState.Checked vis = item.isVisible() if vis != checked: if vis: listItem.setCheckState(0, QtCore.Qt.CheckState.Checked) else: listItem.setCheckState(0, QtCore.Qt.CheckState.Unchecked) def removeItem(self, item): if isinstance(item, QtWidgets.QTreeWidgetItem): item = item.canvasItem() if isinstance(item, CanvasItem): item.setCanvas(None) listItem = item.listItem listItem.canvasItem = None item.listItem = None self.itemList.removeTopLevelItem(listItem) self.items.remove(item) ctrl = item.ctrlWidget() ctrl.hide() self.ui.ctrlLayout.removeWidget(ctrl) ctrl.setParent(None) else: if hasattr(item, '_canvasItem'): self.removeItem(item._canvasItem) else: self.view.removeItem(item) gc.collect() def clear(self): while len(self.items) > 0: self.removeItem(self.items[0]) def addToScene(self, item): self.view.addItem(item) def removeFromScene(self, item): self.view.removeItem(item) def listItems(self): """Return a dictionary of name:item pairs""" return self.items def getListItem(self, name): return self.items[name] def itemTransformChanged(self, item): self.sigItemTransformChanged.emit(self, item) def itemTransformChangeFinished(self, item): self.sigItemTransformChangeFinished.emit(self, item) def itemListContextMenuEvent(self, ev): self.menuItem = self.itemList.itemAt(ev.pos()) self.menu.popup(ev.globalPos()) def removeClicked(self): for item in self.selectedItems(): self.removeItem(item) self.menuItem = None import gc gc.collect() class SelectBox(ROI): def __init__(self, scalable=False): #QtWidgets.QGraphicsRectItem.__init__(self, 0, 0, size[0], size[1]) ROI.__init__(self, [0,0], [1,1]) center = [0.5, 0.5] if scalable: self.addScaleHandle([1, 1], center, lockAspect=True) self.addScaleHandle([0, 0], center, lockAspect=True) self.addRotateHandle([0, 1], center) self.addRotateHandle([1, 0], center) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/canvas/CanvasItem.py000066400000000000000000000432711457240071200235420ustar00rootroot00000000000000__all__ = ["CanvasItem", "GroupCanvasItem"] import importlib from .. import ItemGroup, SRTTransform, debug from .. import functions as fn from ..graphicsItems.ROI import ROI from ..Qt import QT_LIB, QtCore, QtWidgets from . import TransformGuiTemplate_generic as ui_template translate = QtCore.QCoreApplication.translate class SelectBox(ROI): def __init__(self, scalable=False, rotatable=True): #QtWidgets.QGraphicsRectItem.__init__(self, 0, 0, size[0], size[1]) ROI.__init__(self, [0,0], [1,1], invertible=True) center = [0.5, 0.5] if scalable: self.addScaleHandle([1, 1], center, lockAspect=True) self.addScaleHandle([0, 0], center, lockAspect=True) if rotatable: self.addRotateHandle([0, 1], center) self.addRotateHandle([1, 0], center) class CanvasItem(QtCore.QObject): sigResetUserTransform = QtCore.Signal(object) sigTransformChangeFinished = QtCore.Signal(object) sigTransformChanged = QtCore.Signal(object) """CanvasItem takes care of managing an item's state--alpha, visibility, z-value, transformations, etc. and provides a control widget""" sigVisibilityChanged = QtCore.Signal(object) transformCopyBuffer = None def __init__(self, item, **opts): defOpts = {'name': None, 'z': None, 'movable': True, 'scalable': False, 'rotatable': True, 'visible': True, 'parent':None} #'pos': [0,0], 'scale': [1,1], 'angle':0, defOpts.update(opts) self.opts = defOpts self.selectedAlone = False ## whether this item is the only one selected QtCore.QObject.__init__(self) self.canvas = None self._graphicsItem = item parent = self.opts['parent'] if parent is not None: self._graphicsItem.setParentItem(parent.graphicsItem()) self._parentItem = parent else: self._parentItem = None z = self.opts['z'] if z is not None: item.setZValue(z) self.ctrl = QtWidgets.QWidget() self.layout = QtWidgets.QGridLayout() self.layout.setSpacing(0) self.layout.setContentsMargins(0,0,0,0) self.ctrl.setLayout(self.layout) self.alphaLabel = QtWidgets.QLabel(translate("CanvasItem", "Alpha")) self.alphaSlider = QtWidgets.QSlider() self.alphaSlider.setMaximum(1023) self.alphaSlider.setOrientation(QtCore.Qt.Orientation.Horizontal) self.alphaSlider.setValue(1023) self.layout.addWidget(self.alphaLabel, 0, 0) self.layout.addWidget(self.alphaSlider, 0, 1) self.resetTransformBtn = QtWidgets.QPushButton('Reset Transform') self.copyBtn = QtWidgets.QPushButton('Copy') self.pasteBtn = QtWidgets.QPushButton('Paste') self.transformWidget = QtWidgets.QWidget() self.transformGui = ui_template.Ui_Form() self.transformGui.setupUi(self.transformWidget) self.layout.addWidget(self.transformWidget, 3, 0, 1, 2) self.transformGui.mirrorImageBtn.clicked.connect(self.mirrorY) self.transformGui.reflectImageBtn.clicked.connect(self.mirrorXY) self.layout.addWidget(self.resetTransformBtn, 1, 0, 1, 2) self.layout.addWidget(self.copyBtn, 2, 0, 1, 1) self.layout.addWidget(self.pasteBtn, 2, 1, 1, 1) self.alphaSlider.valueChanged.connect(self.alphaChanged) self.alphaSlider.sliderPressed.connect(self.alphaPressed) self.alphaSlider.sliderReleased.connect(self.alphaReleased) self.resetTransformBtn.clicked.connect(self.resetTransformClicked) self.copyBtn.clicked.connect(self.copyClicked) self.pasteBtn.clicked.connect(self.pasteClicked) self.setMovable(self.opts['movable']) ## update gui to reflect this option if 'transform' in self.opts: self.baseTransform = self.opts['transform'] else: self.baseTransform = SRTTransform() if 'pos' in self.opts and self.opts['pos'] is not None: self.baseTransform.translate(self.opts['pos']) if 'angle' in self.opts and self.opts['angle'] is not None: self.baseTransform.rotate(self.opts['angle']) if 'scale' in self.opts and self.opts['scale'] is not None: self.baseTransform.scale(self.opts['scale']) ## create selection box (only visible when selected) tr = self.baseTransform.saveState() if 'scalable' not in opts and tr['scale'] == (1,1): self.opts['scalable'] = True ## every CanvasItem implements its own individual selection box ## so that subclasses are free to make their own. self.selectBox = SelectBox(scalable=self.opts['scalable'], rotatable=self.opts['rotatable']) self.selectBox.hide() self.selectBox.setZValue(1e6) self.selectBox.sigRegionChanged.connect(self.selectBoxChanged) ## calls selectBoxMoved self.selectBox.sigRegionChangeFinished.connect(self.selectBoxChangeFinished) ## set up the transformations that will be applied to the item ## (It is not safe to use item.setTransform, since the item might count on that not changing) self.itemRotation = QtWidgets.QGraphicsRotation() self.itemScale = QtWidgets.QGraphicsScale() self._graphicsItem.setTransformations([self.itemRotation, self.itemScale]) self.tempTransform = SRTTransform() ## holds the additional transform that happens during a move - gets added to the userTransform when move is done. self.userTransform = SRTTransform() ## stores the total transform of the object self.resetUserTransform() def setMovable(self, m): self.opts['movable'] = m if m: self.resetTransformBtn.show() self.copyBtn.show() self.pasteBtn.show() else: self.resetTransformBtn.hide() self.copyBtn.hide() self.pasteBtn.hide() def setCanvas(self, canvas): ## Called by canvas whenever the item is added. ## It is our responsibility to add all graphicsItems to the canvas's scene ## The canvas will automatically add our graphicsitem, ## so we just need to take care of the selectbox. if canvas is self.canvas: return if canvas is None: self.canvas.removeFromScene(self._graphicsItem) self.canvas.removeFromScene(self.selectBox) else: canvas.addToScene(self._graphicsItem) canvas.addToScene(self.selectBox) self.canvas = canvas def graphicsItem(self): """Return the graphicsItem for this canvasItem.""" return self._graphicsItem def parentItem(self): return self._parentItem def setParentItem(self, parent): self._parentItem = parent if parent is not None: if isinstance(parent, CanvasItem): parent = parent.graphicsItem() self.graphicsItem().setParentItem(parent) #def name(self): #return self.opts['name'] def copyClicked(self): CanvasItem.transformCopyBuffer = self.saveTransform() def pasteClicked(self): t = CanvasItem.transformCopyBuffer if t is None: return else: self.restoreTransform(t) def mirrorY(self): if not self.isMovable(): return #flip = self.transformGui.mirrorImageCheck.isChecked() #tr = self.userTransform.saveState() inv = SRTTransform() inv.scale(-1, 1) self.userTransform = self.userTransform * inv self.updateTransform() self.selectBoxFromUser() self.sigTransformChangeFinished.emit(self) #if flip: #if tr['scale'][0] < 0 xor tr['scale'][1] < 0: #return #else: #self.userTransform.setScale([-tr['scale'][0], tr['scale'][1]]) #self.userTransform.setTranslate([-tr['pos'][0], tr['pos'][1]]) #self.userTransform.setRotate(-tr['angle']) #self.updateTransform() #self.selectBoxFromUser() #return #elif not flip: #if tr['scale'][0] > 0 and tr['scale'][1] > 0: #return #else: #self.userTransform.setScale([-tr['scale'][0], tr['scale'][1]]) #self.userTransform.setTranslate([-tr['pos'][0], tr['pos'][1]]) #self.userTransform.setRotate(-tr['angle']) #self.updateTransform() #self.selectBoxFromUser() #return def mirrorXY(self): if not self.isMovable(): return self.rotate(180.) # inv = SRTTransform() # inv.scale(-1, -1) # self.userTransform = self.userTransform * inv #flip lr/ud # s=self.updateTransform() # self.setTranslate(-2*s['pos'][0], -2*s['pos'][1]) # self.selectBoxFromUser() def hasUserTransform(self): #print self.userRotate, self.userTranslate return not self.userTransform.isIdentity() def ctrlWidget(self): return self.ctrl def alphaChanged(self, val): alpha = val / 1023. self._graphicsItem.setOpacity(alpha) def setAlpha(self, alpha): self.alphaSlider.setValue(int(fn.clip_scalar(alpha * 1023, 0, 1023))) def alpha(self): return self.alphaSlider.value() / 1023. def isMovable(self): return self.opts['movable'] def selectBoxMoved(self): """The selection box has moved; get its transformation information and pass to the graphics item""" self.userTransform = self.selectBox.getGlobalTransform(relativeTo=self.selectBoxBase) self.updateTransform() def scale(self, x, y): self.userTransform.scale(x, y) self.selectBoxFromUser() self.updateTransform() def rotate(self, ang): self.userTransform.rotate(ang) self.selectBoxFromUser() self.updateTransform() def translate(self, x, y): self.userTransform.translate(x, y) self.selectBoxFromUser() self.updateTransform() def setTranslate(self, x, y): self.userTransform.setTranslate(x, y) self.selectBoxFromUser() self.updateTransform() def setRotate(self, angle): self.userTransform.setRotate(angle) self.selectBoxFromUser() self.updateTransform() def setScale(self, x, y): self.userTransform.setScale(x, y) self.selectBoxFromUser() self.updateTransform() def setTemporaryTransform(self, transform): self.tempTransform = transform self.updateTransform() def applyTemporaryTransform(self): """Collapses tempTransform into UserTransform, resets tempTransform""" self.userTransform = self.userTransform * self.tempTransform ## order is important! self.resetTemporaryTransform() self.selectBoxFromUser() ## update the selection box to match the new userTransform def resetTemporaryTransform(self): self.tempTransform = SRTTransform() ## don't use Transform.reset()--this transform might be used elsewhere. self.updateTransform() def transform(self): return self._graphicsItem.transform() def updateTransform(self): """Regenerate the item position from the base, user, and temp transforms""" transform = self.baseTransform * self.userTransform * self.tempTransform ## order is important s = transform.saveState() self._graphicsItem.setPos(*s['pos']) self.itemRotation.setAngle(s['angle']) self.itemScale.setXScale(s['scale'][0]) self.itemScale.setYScale(s['scale'][1]) self.displayTransform(transform) return(s) # return the transform state def displayTransform(self, transform): """Updates transform numbers in the ctrl widget.""" tr = transform.saveState() self.transformGui.translateLabel.setText("Translate: (%f, %f)" %(tr['pos'][0], tr['pos'][1])) self.transformGui.rotateLabel.setText("Rotate: %f degrees" %tr['angle']) self.transformGui.scaleLabel.setText("Scale: (%f, %f)" %(tr['scale'][0], tr['scale'][1])) def resetUserTransform(self): self.userTransform.reset() self.updateTransform() self.selectBox.blockSignals(True) self.selectBoxToItem() self.selectBox.blockSignals(False) self.sigTransformChanged.emit(self) self.sigTransformChangeFinished.emit(self) def resetTransformClicked(self): self.resetUserTransform() self.sigResetUserTransform.emit(self) def restoreTransform(self, tr): try: self.userTransform = SRTTransform(tr) self.updateTransform() self.selectBoxFromUser() ## move select box to match self.sigTransformChanged.emit(self) self.sigTransformChangeFinished.emit(self) except: self.userTransform = SRTTransform() debug.printExc("Failed to load transform:") def saveTransform(self): """Return a dict containing the current user transform""" return self.userTransform.saveState() def selectBoxFromUser(self): """Move the selection box to match the current userTransform""" ## user transform #trans = QtGui.QTransform() #trans.translate(*self.userTranslate) #trans.rotate(-self.userRotate) #x2, y2 = trans.map(*self.selectBoxBase['pos']) self.selectBox.blockSignals(True) self.selectBox.setState(self.selectBoxBase) self.selectBox.applyGlobalTransform(self.userTransform) #self.selectBox.setAngle(self.userRotate) #self.selectBox.setPos([x2, y2]) self.selectBox.blockSignals(False) def selectBoxToItem(self): """Move/scale the selection box so it fits the item's bounding rect. (assumes item is not rotated)""" self.itemRect = self._graphicsItem.boundingRect() rect = self._graphicsItem.mapRectToParent(self.itemRect) self.selectBox.blockSignals(True) self.selectBox.setPos([rect.x(), rect.y()]) self.selectBox.setSize(rect.size()) self.selectBox.setAngle(0) self.selectBoxBase = self.selectBox.getState().copy() self.selectBox.blockSignals(False) def zValue(self): return self.opts['z'] def setZValue(self, z): self.opts['z'] = z if z is not None: self._graphicsItem.setZValue(z) def selectionChanged(self, sel, multi): """ Inform the item that its selection state has changed. ============== ========================================================= **Arguments:** sel (bool) whether the item is currently selected multi (bool) whether there are multiple items currently selected ============== ========================================================= """ self.selectedAlone = sel and not multi self.showSelectBox() if self.selectedAlone: self.ctrlWidget().show() else: self.ctrlWidget().hide() def showSelectBox(self): """Display the selection box around this item if it is selected and movable""" if self.selectedAlone and self.isMovable() and self.isVisible(): #and len(self.canvas.itemList.selectedItems())==1: self.selectBox.show() else: self.selectBox.hide() def hideSelectBox(self): self.selectBox.hide() def selectBoxChanged(self): self.selectBoxMoved() self.sigTransformChanged.emit(self) def selectBoxChangeFinished(self): self.sigTransformChangeFinished.emit(self) def alphaPressed(self): """Hide selection box while slider is moving""" self.hideSelectBox() def alphaReleased(self): self.showSelectBox() def show(self): if self.opts['visible']: return self.opts['visible'] = True self._graphicsItem.show() self.showSelectBox() self.sigVisibilityChanged.emit(self) def hide(self): if not self.opts['visible']: return self.opts['visible'] = False self._graphicsItem.hide() self.hideSelectBox() self.sigVisibilityChanged.emit(self) def setVisible(self, vis): if vis: self.show() else: self.hide() def isVisible(self): return self.opts['visible'] def saveState(self): return { 'type': self.__class__.__name__, 'name': self.name, 'visible': self.isVisible(), 'alpha': self.alpha(), 'userTransform': self.saveTransform(), 'z': self.zValue(), 'scalable': self.opts['scalable'], 'rotatable': self.opts['rotatable'], 'movable': self.opts['movable'], } def restoreState(self, state): self.setVisible(state['visible']) self.setAlpha(state['alpha']) self.restoreTransform(state['userTransform']) self.setZValue(state['z']) class GroupCanvasItem(CanvasItem): """ Canvas item used for grouping others """ def __init__(self, **opts): defOpts = {'movable': False, 'scalable': False} defOpts.update(opts) item = ItemGroup() CanvasItem.__init__(self, item, **defOpts) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/canvas/CanvasManager.py000066400000000000000000000043601457240071200242120ustar00rootroot00000000000000from ..Qt import QtCore, QtWidgets if not hasattr(QtCore, 'Signal'): QtCore.Signal = QtCore.pyqtSignal import weakref class CanvasManager(QtCore.QObject): SINGLETON = None sigCanvasListChanged = QtCore.Signal() def __init__(self): if CanvasManager.SINGLETON is not None: raise Exception("Can only create one canvas manager.") # It is important to save SINGLETON *after* the call to QObject.__init__, see #2838. QtCore.QObject.__init__(self) CanvasManager.SINGLETON = self self.canvases = weakref.WeakValueDictionary() @classmethod def instance(cls): return CanvasManager.SINGLETON def registerCanvas(self, canvas, name): n2 = name i = 0 while n2 in self.canvases: n2 = "%s_%03d" % (name, i) i += 1 self.canvases[n2] = canvas self.sigCanvasListChanged.emit() return n2 def unregisterCanvas(self, name): c = self.canvases[name] del self.canvases[name] self.sigCanvasListChanged.emit() def listCanvases(self): return list(self.canvases.keys()) def getCanvas(self, name): return self.canvases[name] manager = CanvasManager() class CanvasCombo(QtWidgets.QComboBox): def __init__(self, parent=None): QtWidgets.QComboBox.__init__(self, parent) man = CanvasManager.instance() man.sigCanvasListChanged.connect(self.updateCanvasList) self.hostName = None self.updateCanvasList() def updateCanvasList(self): canvases = CanvasManager.instance().listCanvases() canvases.insert(0, "") if self.hostName in canvases: canvases.remove(self.hostName) sel = self.currentText() if sel in canvases: self.blockSignals(True) ## change does not affect current selection; block signals during update self.clear() for i in canvases: self.addItem(i) if i == sel: self.setCurrentIndex(self.count()) self.blockSignals(False) def setHostName(self, name): self.hostName = name self.updateCanvasList() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/canvas/CanvasTemplate.ui000066400000000000000000000103541457240071200244000ustar00rootroot00000000000000 Form 0 0 821 578 PyQtGraph 0 0 Qt::Horizontal Qt::Vertical 0 1 Auto Range 0 Check to display all local items in a remote canvas. Redirect 0 100 true 1 Reset Transforms Mirror Selection MirrorXY 0 0 TreeWidget QTreeWidget
      ..widgets.TreeWidget
      GraphicsView QGraphicsView
      ..widgets.GraphicsView
      CanvasCombo QComboBox
      .CanvasManager
      pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/canvas/CanvasTemplate_generic.py000066400000000000000000000117051457240071200261100ustar00rootroot00000000000000# Form implementation generated from reading ui file '../pyqtgraph/canvas/CanvasTemplate.ui' # # Created by: PyQt6 UI code generator 6.1.0 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. from ..Qt import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(821, 578) self.gridLayout_2 = QtWidgets.QGridLayout(Form) self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.gridLayout_2.setSpacing(0) self.gridLayout_2.setObjectName("gridLayout_2") self.splitter = QtWidgets.QSplitter(Form) self.splitter.setOrientation(QtCore.Qt.Orientation.Horizontal) self.splitter.setObjectName("splitter") self.view = GraphicsView(self.splitter) self.view.setObjectName("view") self.vsplitter = QtWidgets.QSplitter(self.splitter) self.vsplitter.setOrientation(QtCore.Qt.Orientation.Vertical) self.vsplitter.setObjectName("vsplitter") self.canvasCtrlWidget = QtWidgets.QWidget(self.vsplitter) self.canvasCtrlWidget.setObjectName("canvasCtrlWidget") self.gridLayout = QtWidgets.QGridLayout(self.canvasCtrlWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.autoRangeBtn = QtWidgets.QPushButton(self.canvasCtrlWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.autoRangeBtn.sizePolicy().hasHeightForWidth()) self.autoRangeBtn.setSizePolicy(sizePolicy) self.autoRangeBtn.setObjectName("autoRangeBtn") self.gridLayout.addWidget(self.autoRangeBtn, 0, 0, 1, 2) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setSpacing(0) self.horizontalLayout.setObjectName("horizontalLayout") self.redirectCheck = QtWidgets.QCheckBox(self.canvasCtrlWidget) self.redirectCheck.setObjectName("redirectCheck") self.horizontalLayout.addWidget(self.redirectCheck) self.redirectCombo = CanvasCombo(self.canvasCtrlWidget) self.redirectCombo.setObjectName("redirectCombo") self.horizontalLayout.addWidget(self.redirectCombo) self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 2) self.itemList = TreeWidget(self.canvasCtrlWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(100) sizePolicy.setHeightForWidth(self.itemList.sizePolicy().hasHeightForWidth()) self.itemList.setSizePolicy(sizePolicy) self.itemList.setHeaderHidden(True) self.itemList.setObjectName("itemList") self.itemList.headerItem().setText(0, "1") self.gridLayout.addWidget(self.itemList, 2, 0, 1, 2) self.resetTransformsBtn = QtWidgets.QPushButton(self.canvasCtrlWidget) self.resetTransformsBtn.setObjectName("resetTransformsBtn") self.gridLayout.addWidget(self.resetTransformsBtn, 3, 0, 1, 2) self.mirrorSelectionBtn = QtWidgets.QPushButton(self.canvasCtrlWidget) self.mirrorSelectionBtn.setObjectName("mirrorSelectionBtn") self.gridLayout.addWidget(self.mirrorSelectionBtn, 4, 0, 1, 1) self.reflectSelectionBtn = QtWidgets.QPushButton(self.canvasCtrlWidget) self.reflectSelectionBtn.setObjectName("reflectSelectionBtn") self.gridLayout.addWidget(self.reflectSelectionBtn, 4, 1, 1, 1) self.canvasItemCtrl = QtWidgets.QWidget(self.vsplitter) self.canvasItemCtrl.setObjectName("canvasItemCtrl") self.ctrlLayout = QtWidgets.QGridLayout(self.canvasItemCtrl) self.ctrlLayout.setContentsMargins(0, 0, 0, 0) self.ctrlLayout.setSpacing(0) self.ctrlLayout.setObjectName("ctrlLayout") self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "PyQtGraph")) self.autoRangeBtn.setText(_translate("Form", "Auto Range")) self.redirectCheck.setToolTip(_translate("Form", "Check to display all local items in a remote canvas.")) self.redirectCheck.setText(_translate("Form", "Redirect")) self.resetTransformsBtn.setText(_translate("Form", "Reset Transforms")) self.mirrorSelectionBtn.setText(_translate("Form", "Mirror Selection")) self.reflectSelectionBtn.setText(_translate("Form", "MirrorXY")) from ..widgets.GraphicsView import GraphicsView from ..widgets.TreeWidget import TreeWidget from .CanvasManager import CanvasCombo pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/canvas/TransformGuiTemplate.ui000066400000000000000000000034301457240071200256020ustar00rootroot00000000000000 Form 0 0 224 117 0 0 PyQtGraph 1 0 Translate: Rotate: Scale: Mirror Reflect pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/canvas/TransformGuiTemplate_generic.py000066400000000000000000000051211457240071200273100ustar00rootroot00000000000000# Form implementation generated from reading ui file '../pyqtgraph/canvas/TransformGuiTemplate.ui' # # Created by: PyQt6 UI code generator 6.1.0 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. from ..Qt import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(224, 117) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setSpacing(1) self.verticalLayout.setObjectName("verticalLayout") self.translateLabel = QtWidgets.QLabel(Form) self.translateLabel.setObjectName("translateLabel") self.verticalLayout.addWidget(self.translateLabel) self.rotateLabel = QtWidgets.QLabel(Form) self.rotateLabel.setObjectName("rotateLabel") self.verticalLayout.addWidget(self.rotateLabel) self.scaleLabel = QtWidgets.QLabel(Form) self.scaleLabel.setObjectName("scaleLabel") self.verticalLayout.addWidget(self.scaleLabel) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.mirrorImageBtn = QtWidgets.QPushButton(Form) self.mirrorImageBtn.setToolTip("") self.mirrorImageBtn.setObjectName("mirrorImageBtn") self.horizontalLayout.addWidget(self.mirrorImageBtn) self.reflectImageBtn = QtWidgets.QPushButton(Form) self.reflectImageBtn.setObjectName("reflectImageBtn") self.horizontalLayout.addWidget(self.reflectImageBtn) self.verticalLayout.addLayout(self.horizontalLayout) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "PyQtGraph")) self.translateLabel.setText(_translate("Form", "Translate:")) self.rotateLabel.setText(_translate("Form", "Rotate:")) self.scaleLabel.setText(_translate("Form", "Scale:")) self.mirrorImageBtn.setText(_translate("Form", "Mirror")) self.reflectImageBtn.setText(_translate("Form", "Reflect")) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/canvas/__init__.py000066400000000000000000000000601457240071200232340ustar00rootroot00000000000000from .Canvas import * from .CanvasItem import * pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colormap.py000066400000000000000000001024341457240071200220460ustar00rootroot00000000000000from collections.abc import Callable, Sequence from os import listdir, path import numpy as np from .functions import clip_array, clip_scalar, colorDistance, eq, mkColor from .Qt import QtCore, QtGui __all__ = ['ColorMap'] _mapCache = {} def listMaps(source=None): """ .. warning:: Experimental, subject to change. List available color maps. Parameters ---------- source: str, optional Color map source. If omitted, locally stored maps are listed. Otherwise: - 'matplotlib' lists maps that can be imported from Matplotlib - 'colorcet' lists maps that can be imported from ColorCET Returns ------- list of str Known color map names. """ if source is None: pathname = path.join(path.dirname(__file__), 'colors','maps') files = listdir( pathname ) list_of_maps = [] for filename in files: if filename[-4:] == '.csv' or filename[-4:] == '.hex': list_of_maps.append(filename[:-4]) return list_of_maps elif source.lower() == 'matplotlib': try: import matplotlib.pyplot as mpl_plt list_of_maps = mpl_plt.colormaps() return list_of_maps except ModuleNotFoundError: return [] elif source.lower() == 'colorcet': try: import colorcet list_of_maps = list( colorcet.palette.keys() ) list_of_maps.sort() return list_of_maps except ModuleNotFoundError: return [] return [] def get(name, source=None, skipCache=False): """ .. warning:: Experimental, subject to change. Returns a ColorMap object from a local definition or imported from another library. The generated ColorMap objects are cached for fast repeated access. Parameters ---------- name: str Name of color map. In addition to the included maps, this can also be a path to a file in the local folder. See the files in the ``pyqtgraph/colors/maps/`` folder for examples of the format. source: str, optional If omitted, a locally stored map is returned. Otherwise: - 'matplotlib' imports a map defined by Matplotlib. - 'colorcet' imports a map defined by ColorCET. skipCache: bool, optional If `skipCache=True`, the internal cache is skipped and a new ColorMap object is generated. This can load an unaltered copy when the previous ColorMap object has been modified. """ if not skipCache and name in _mapCache: return _mapCache[name] if source is None: return _getFromFile(name) elif source == 'matplotlib': return getFromMatplotlib(name) elif source == 'colorcet': return getFromColorcet(name) return None def _getFromFile(name): filename = name if filename[0] !='.': # load from built-in directory dirname = path.dirname(__file__) filename = path.join(dirname, 'colors/maps/'+filename) if not path.isfile( filename ): # try suffixes if file is not found: if path.isfile( filename+'.csv' ): filename += '.csv' elif path.isfile( filename+'.hex' ): filename += '.hex' with open(filename,'r') as fh: idx = 0 color_list = [] if filename[-4:].lower() != '.hex': csv_mode = True else: csv_mode = False for line in fh: line = line.strip() if len(line) == 0: continue # empty line if line[0] == ';': continue # comment parts = line.split(sep=';', maxsplit=1) # split into color and names/comments if csv_mode: comp = parts[0].split(',') if len( comp ) < 3: continue # not enough components given color_tuple = tuple( [ int(255*float(c)+0.5) for c in comp ] ) else: hex_str = parts[0] if hex_str[0] == '#': hex_str = hex_str[1:] # strip leading # if len(hex_str) < 3: continue # not enough information if len(hex_str) == 3: # parse as abbreviated RGB hex_str = 2*hex_str[0] + 2*hex_str[1] + 2*hex_str[2] elif len(hex_str) == 4: # parse as abbreviated RGBA hex_str = 2*hex_str[0] + 2*hex_str[1] + 2*hex_str[2] + 2*hex_str[3] if len(hex_str) < 6: continue # not enough information try: color_tuple = tuple( bytes.fromhex( hex_str ) ) except ValueError as e: raise ValueError(f"failed to convert hexadecimal value '{hex_str}'.") from e color_list.append( color_tuple ) idx += 1 # end of line reading loop # end of open cmap = ColorMap( name=name, pos=np.linspace(0.0, 1.0, len(color_list)), color=color_list) #, names=color_names) if cmap is not None: cmap.name = name _mapCache[name] = cmap return cmap def getFromMatplotlib(name): """ Generates a ColorMap object from a Matplotlib definition. Same as ``colormap.get(name, source='matplotlib')``. """ # inspired and informed by "mpl_cmaps_in_ImageItem.py", published by Sebastian Hoefer at # https://github.com/honkomonk/pyqtgraph_sandbox/blob/master/mpl_cmaps_in_ImageItem.py try: import matplotlib.pyplot as mpl_plt except ModuleNotFoundError: return None cmap = None col_map = mpl_plt.get_cmap(name) if hasattr(col_map, '_segmentdata'): # handle LinearSegmentedColormap data = col_map._segmentdata if ('red' in data) and isinstance(data['red'], (Sequence, np.ndarray)): positions = set() # super-set of handle positions in individual channels for key in ['red','green','blue']: for tup in data[key]: positions.add(tup[0]) col_data = np.zeros((len(positions),4 )) col_data[:,-1] = sorted(positions) for idx, key in enumerate(['red','green','blue']): positions = np.zeros( len(data[key] ) ) comp_vals = np.zeros( len(data[key] ) ) for idx2, tup in enumerate( data[key] ): positions[idx2] = tup[0] comp_vals[idx2] = tup[1] # these are sorted in the raw data col_data[:,idx] = np.interp(col_data[:,3], positions, comp_vals) cmap = ColorMap(pos=col_data[:,-1], color=255*col_data[:,:3]+0.5) # some color maps (gnuplot in particular) are defined by RGB component functions: elif ('red' in data) and isinstance(data['red'], Callable): col_data = np.zeros((64, 4)) col_data[:,-1] = np.linspace(0., 1., 64) for idx, key in enumerate(['red','green','blue']): col_data[:,idx] = np.clip( data[key](col_data[:,-1]), 0, 1) cmap = ColorMap(pos=col_data[:,-1], color=255*col_data[:,:3]+0.5) elif hasattr(col_map, 'colors'): # handle ListedColormap col_data = np.array(col_map.colors) cmap = ColorMap( name=name, pos = np.linspace(0.0, 1.0, col_data.shape[0]), color=255*col_data[:,:3]+0.5 ) if cmap is not None: cmap.name = name _mapCache[name] = cmap return cmap def getFromColorcet(name): """ Generates a ColorMap object from a colorcet definition. Same as ``colormap.get(name, source='colorcet')``. """ try: import colorcet except ModuleNotFoundError: return None color_strings = colorcet.palette[name] color_list = [] for hex_str in color_strings: if hex_str[0] != '#': continue if len(hex_str) != 7: raise ValueError(f"Invalid color string '{hex_str}' in colorcet import.") color_tuple = tuple( bytes.fromhex( hex_str[1:] ) ) color_list.append( color_tuple ) if len(color_list) == 0: return None cmap = ColorMap( name=name, pos=np.linspace(0.0, 1.0, len(color_list)), color=color_list) #, names=color_names) if cmap is not None: cmap.name = name _mapCache[name] = cmap return cmap def makeHslCycle( hue=0.0, saturation=1.0, lightness=0.5, steps=36 ): """ Returns a ColorMap object that traces a circular or spiraling path around the HSL color space. Parameters ---------- hue : float or tuple of floats Starting point or (start, end) for hue. Values can lie outside the [0 to 1] range to realize multiple cycles. For a single value, one full hue cycle is generated. The default starting hue is 0.0 (red). saturation : float or tuple of floats, optional Saturation value for the colors in the cycle, in the range of [0 to 1]. If a (start, end) tuple is given, saturation gradually changes between these values. The default saturation is 1.0. lightness : float or tuple of floats, optional Lightness value for the colors in the cycle, in the range of [0 to 1]. If a (start, end) tuple is given, lightness gradually changes between these values. The default lightness is 0.5. steps: int, optional Number of steps in the cycle. Between these steps, the color map will interpolate in RGB space. The default number of steps is 36, generating a color map with 37 stops. """ if isinstance( hue, (tuple, list) ): hueA, hueB = hue else: hueA = hue hueB = hueA + 1.0 if isinstance( saturation, (tuple, list) ): satA, satB = saturation else: satA = satB = saturation if isinstance( lightness, (tuple, list) ): lgtA, lgtB = lightness else: lgtA = lgtB = lightness hue_vals = np.linspace(hueA, hueB, num=steps+1) sat_vals = np.linspace(satA, satB, num=steps+1) lgt_vals = np.linspace(lgtA, lgtB, num=steps+1) color_list = [] for hue, sat, lgt in zip( hue_vals, sat_vals, lgt_vals): qcol = QtGui.QColor.fromHslF( hue%1.0, sat, lgt ) color_list.append( qcol ) name = f'Hue {hueA:0.2f}-{hueB:0.2f}' return ColorMap( None, color_list, name=name ) def makeMonochrome(color='neutral'): """ Returns a ColorMap object with a dark to bright ramp and adjustable tint. In addition to neutral, warm or cold grays, imitations of monochrome computer monitors are also available. The following predefined color ramps are available: `neutral`, `warm`, `cool`, `green`, `amber`, `blue`, `red`, `pink`, `lavender`. The ramp can also be specified by a tuple of float values in the range of 0 to 1. In this case `(h, s, l0, l1)` describe hue, saturation, minimum lightness and maximum lightness within the HSL color space. The values `l0` and `l1` can be omitted. They default to `l0=0.0` and `l1=1.0` in this case. Parameters ---------- color: str or tuple of floats Color description. Can be one of the predefined identifiers, or a tuple `(h, s, l0, l1)`, `(h, s)` or (`h`). 'green', 'amber', 'blue', 'red', 'lavender', 'pink' or a tuple of relative ``(R,G,B)`` contributions in range 0.0 to 1.0 """ name=f'Monochrome {color}' defaults = { 'neutral': (0.00, 0.00, 0.00, 1.00), 'warm' : (0.10, 0.08, 0.00, 0.95), 'cool' : (0.60, 0.08, 0.00, 0.95), 'green' : (0.35, 0.55, 0.02, 0.90), 'amber' : (0.09, 0.80, 0.02, 0.80), 'blue' : (0.58, 0.85, 0.02, 0.95), 'red' : (0.01, 0.60, 0.02, 0.90), 'pink' : (0.93, 0.65, 0.02, 0.95), 'lavender': (0.75, 0.50, 0.02, 0.90) } if isinstance(color, str): if color in defaults: h_val, s_val, l_min, l_max = defaults[color] else: valid = ','.join(defaults.keys()) raise ValueError(f"Undefined color descriptor '{color}', known values are:\n{valid}") else: s_val = 0.70 # set up default values l_min = 0.00 l_max = 1.00 if not hasattr(color,'__len__'): h_val = float(color) elif len(color) == 1: h_val = color[0] elif len(color) == 2: h_val, s_val = color elif len(color) == 4: h_val, s_val, l_min, l_max = color else: raise ValueError(f"Invalid color descriptor '{color}'") l_vals = np.linspace(l_min, l_max, num=16) color_list = [] for l_val in l_vals: qcol = QtGui.QColor.fromHslF( h_val, s_val, l_val ) color_list.append( qcol ) return ColorMap( None, color_list, name=name, linearize=True ) def modulatedBarData(length=768, width=32): """ Returns an NumPy array that represents a modulated color bar ranging from 0 to 1. This is used to judge the perceived variation of the color gradient. Parameters ---------- length: int Length of the data set. Values will vary from 0 to 1 over this axis. width: int Width of the data set. The modulation will vary from 0% to 4% over this axis. """ gradient = np.linspace(0.00, 1.00, length) modulation = -0.04 * np.sin( (np.pi/4) * np.arange(length) ) data = np.zeros( (length, width) ) for idx in range(width): data[:,idx] = gradient + (idx/(width-1)) * modulation clip_array(data, 0.0, 1.0, out=data) return data class ColorMap(object): """ ColorMap(pos, color, mapping=ColorMap.CLIP) ColorMap stores a mapping of specific data values to colors, for example: | 0.0 → black | 0.2 → red | 0.6 → yellow | 1.0 → white The colors for intermediate values are determined by interpolating between the two nearest colors in RGB color space. A ColorMap object provides access to the interpolated colors by indexing with a float value: ``cm[0.5]`` returns a QColor corresponding to the center of ColorMap `cm`. """ ## mapping modes CLIP = 1 REPEAT = 2 MIRROR = 3 DIVERGING = 4 ## return types BYTE = 1 FLOAT = 2 QCOLOR = 3 enumMap = { 'clip': CLIP, 'repeat': REPEAT, 'mirror': MIRROR, 'diverging': DIVERGING, 'byte': BYTE, 'float': FLOAT, 'qcolor': QCOLOR, } def __init__(self, pos, color, mapping=CLIP, mode=None, linearize=False, name=''): """ __init__(pos, color, mapping=ColorMap.CLIP) Parameters ---------- pos: array_like of float, optional Assigned positions of specified colors. `None` sets equal spacing. Values need to be in range 0.0-1.0. color: array_like of color_like List of colors, interpreted via :func:`mkColor() `. mapping: str or int, optional Controls how values outside the 0 to 1 range are mapped to colors. See :func:`setMappingMode() ` for details. The default of `ColorMap.CLIP` continues to show the colors assigned to 0 and 1 for all values below or above this range, respectively. """ self.name = name # storing a name helps identify ColorMaps sampled by Palette if pos is None: order = range(len(color)) self.pos = np.linspace(0.0, 1.0, num=len(color)) else: self.pos = np.array(pos) order = np.argsort(self.pos) self.pos = self.pos[order] self.color = np.zeros( (len(color), 4) ) # stores float rgba values for cnt, idx in enumerate(order): self.color[cnt] = mkColor(color[idx]).getRgbF() # alternative code may be more efficient, but fails to handle lists of QColor. # self.color = np.apply_along_axis( # func1d = lambda x: np.uint8( mkColor(x).getRgb() ), # cast RGB integer values to uint8 # axis = -1, # arr = color, # )[order] self.mapping_mode = self.CLIP # default to CLIP mode if mapping is not None: self.setMappingMode( mapping ) self.stopsCache = {} if linearize: self.linearize() def setMappingMode(self, mapping): """ Sets the way that values outside of the range 0 to 1 are mapped to colors. Parameters ---------- mapping: int or str Sets mapping mode to - `ColorMap.CLIP` or 'clip': Values are clipped to the range 0 to 1. ColorMap defaults to this. - `ColorMap.REPEAT` or 'repeat': Colors repeat cyclically, i.e. range 1 to 2 repeats the colors for 0 to 1. - `ColorMap.MIRROR` or 'mirror': The range 0 to -1 uses same colors (in reverse order) as 0 to 1. - `ColorMap.DIVERGING` or 'diverging': Colors are mapped to -1 to 1 such that the central value appears at 0. """ if isinstance(mapping, str): mapping = self.enumMap[mapping.lower()] if mapping in [self.CLIP, self.REPEAT, self.DIVERGING, self.MIRROR]: self.mapping_mode = mapping # only allow defined values else: raise ValueError(f"Undefined mapping type '{mapping}'") self.stopsCache = {} def __str__(self): """ provide human-readable identifier """ if self.name is None: return 'unnamed ColorMap({:d})'.format(len(self.pos)) return "ColorMap({:d}):'{:s}'".format(len(self.pos),self.name) def __getitem__(self, key): """ Convenient shorthand access to palette colors """ if isinstance(key, int): # access by color index return self.getByIndex(key) # otherwise access by map try: # accept any numerical format that converts to float float_idx = float(key) return self.mapToQColor(float_idx) except ValueError: pass return None def linearize(self): """ Adjusts the positions assigned to color stops to approximately equalize the perceived color difference for a fixed step. """ colors = self.getColors(mode=self.QCOLOR) distances = colorDistance(colors) positions = np.insert( np.cumsum(distances), 0, 0.0 ) self.pos = positions / positions[-1] # normalize last value to 1.0 self.stopsCache = {} def reverse(self): """ Reverses the color map, so that the color assigned to a value of 1 now appears at 0 and vice versa. This is convenient to adjust imported color maps. """ self.pos = 1.0 - np.flip( self.pos ) self.color = np.flip( self.color, axis=0 ) self.stopsCache = {} def getSubset(self, start, span): """ Returns a new ColorMap object that extracts the subset specified by 'start' and 'length' to the full 0.0 to 1.0 range. A negative length results in a color map that is reversed relative to the original. Parameters ---------- start : float Starting value that defines the 0.0 value of the new color map. Possible value between 0.0 to 1.0 span : float Span of the extracted region. The original color map will be treated as cyclical if the extracted interval exceeds the 0.0 to 1.0 range. Possible values between -1.0 to 1.0. """ pos, col = self.getStops( mode=ColorMap.FLOAT ) start = clip_scalar(start, 0.0, 1.0) span = clip_scalar(span, -1.0, 1.0) if span == 0.0: raise ValueError("'length' needs to be non-zero") stop = (start + span) if stop > 1.0 or stop < 0.0: stop = stop % 1.0 # find indices *inside* range, start and end will be added by sampling later if span > 0: ref_pos = start # lowest position value at start idxA = np.searchsorted( pos, start, side='right' ) idxB = np.searchsorted( pos, stop , side='left' ) # + 1 # right-side element of interval wraps = bool( stop < start ) # wraps around? else: ref_pos = stop # lowest position value at stop idxA = np.searchsorted( pos, stop , side='right') idxB = np.searchsorted( pos, start, side='left' ) # + 1 # right-side element of interval wraps = bool( stop > start ) # wraps around? if wraps: # wraps around: length1 = (len(pos)-idxA) # before wrap length2 = idxB # after wrap new_length = length1 + length2 + 2 # combined; plus edge elements new_pos = np.zeros( new_length ) new_col = np.zeros( (new_length, 4) ) new_pos[ 1:length1+1] = (0 + pos[idxA:] - ref_pos) / span # starting point lie in 0 to 1 range new_pos[length1+1:-1] = (1 + pos[:idxB] - ref_pos) / span # end point wrapped to -1 to 0 range new_pos[length1] -= np.copysign(1e-6, span) # breaks degeneracy of shifted 0.0 and 1.0 values new_col[ 1:length1+1] = col[idxA:] new_col[length1+1:-1] = col[:idxB] else: # does not wrap around: new_length = (idxB - idxA) + 2 # two additional edge values will be added new_pos = np.zeros( new_length ) new_col = np.zeros( (new_length, 4) ) new_pos[1:-1] = (pos[idxA:idxB] - ref_pos) / span new_col[1:-1] = col[idxA:idxB] if span < 0: # for reversed subsets, positions now progress 0 to -1 and need to be flipped new_pos += 1.0 new_pos = np.flip( new_pos) new_col = np.flip( new_col, axis=0 ) new_pos[ 0] = 0.0 new_col[ 0] = self.mapToFloat(start) new_pos[-1] = 1.0 new_col[-1] = self.mapToFloat(stop) cmap = ColorMap( pos=new_pos, color=255.*new_col ) cmap.name = f"{self.name}[{start:.2f}({span:+.2f})]" return cmap def map(self, data, mode=BYTE): """ map(data, mode=ColorMap.BYTE) Returns an array of colors corresponding to a single value or an array of values. Data must be either a scalar position or an array (any shape) of positions. Parameters ---------- data: float or array_like of float Scalar value(s) to be mapped to colors mode: str or int, optional Determines return format: - `ColorMap.BYTE` or 'byte': Colors are returned as 0-255 unsigned bytes. (default) - `ColorMap.FLOAT` or 'float': Colors are returned as 0.0-1.0 floats. - `ColorMap.QCOLOR` or 'qcolor': Colors are returned as QColor objects. Returns ------- np.ndarray of {``ColorMap.BYTE``, ``ColorMap.FLOAT``, QColor} for `ColorMap.BYTE` or `ColorMap.FLOAT`: RGB values for each `data` value, arranged in the same shape as `data`. list of QColor for `ColorMap.QCOLOR`: Colors for each `data` value as QColor objects. """ if isinstance(mode, str): mode = self.enumMap[mode.lower()] if mode == self.QCOLOR: pos, color = self.getStops(self.FLOAT) else: pos, color = self.getStops(mode) if np.isscalar(data): interp = np.empty((color.shape[1],), dtype=color.dtype) else: if not isinstance(data, np.ndarray): data = np.array(data) interp = np.empty(data.shape + (color.shape[1],), dtype=color.dtype) if self.mapping_mode != self.CLIP: if self.mapping_mode == self.REPEAT: data = data % 1.0 elif self.mapping_mode == self.DIVERGING: data = (data/2)+0.5 elif self.mapping_mode == self.MIRROR: data = abs(data) for i in range(color.shape[1]): interp[...,i] = np.interp(data, pos, color[:,i]) # Convert to QColor if requested if mode == self.QCOLOR: if np.isscalar(data): return QtGui.QColor.fromRgbF(*interp) else: return [QtGui.QColor.fromRgbF(*x.tolist()) for x in interp] else: return interp def mapToQColor(self, data): """Convenience function; see :func:`map() `.""" return self.map(data, mode=self.QCOLOR) def mapToByte(self, data): """Convenience function; see :func:`map() `.""" return self.map(data, mode=self.BYTE) def mapToFloat(self, data): """Convenience function; see :func:`map() `.""" return self.map(data, mode=self.FLOAT) def getByIndex(self, idx): """Retrieve a QColor by the index of the stop it is assigned to.""" return QtGui.QColor.fromRgbF( *self.color[idx] ) def getGradient(self, p1=None, p2=None): """ Returns a QtGui.QLinearGradient corresponding to this ColorMap. The span and orientation is given by two points in plot coordinates. When no parameters are given for `p1` and `p2`, the gradient is mapped to the `y` coordinates 0 to 1, unless the color map is defined for a more limited range. This is a somewhat expensive operation, and it is recommended to store and reuse the returned gradient instead of repeatedly regenerating it. Parameters ---------- p1: QtCore.QPointF, optional Starting point (value 0) of the gradient. Default value is QPointF(0., 0.) p2: QtCore.QPointF, optional End point (value 1) of the gradient. Default parameter `dy` is the span of ``max(pos) - min(pos)`` over which the color map is defined, typically `dy=1`. Default is QPointF(dy, 0.) """ if p1 is None: p1 = QtCore.QPointF(0,0) if p2 is None: p2 = QtCore.QPointF(self.pos.max()-self.pos.min(),0) grad = QtGui.QLinearGradient(p1, p2) pos, color = self.getStops(mode=self.QCOLOR) if self.mapping_mode == self.MIRROR: pos_n = (1. - np.flip(pos)) / 2 col_n = np.flip( color, axis=0 ) pos_p = (1. + pos) / 2 col_p = color pos = np.concatenate( (pos_n, pos_p) ) color = np.concatenate( (col_n, col_p) ) grad.setStops(list(zip(pos, color))) if self.mapping_mode == self.REPEAT: grad.setSpread( QtGui.QGradient.Spread.RepeatSpread ) return grad def getBrush(self, span=(0.,1.), orientation='vertical'): """ Returns a QBrush painting with the color map applied over the selected span of plot values. When the mapping mode is set to `ColorMap.MIRROR`, the selected span includes the color map twice, first in reversed order and then normal. It is recommended to store and reuse this gradient brush instead of regenerating it repeatedly. Parameters ---------- span : tuple of float, optional Span of data values covered by the gradient: - Color map value 0.0 will appear at `min`, - Color map value 1.0 will appear at `max`. Default value is (0., 1.) orientation : str, default 'vertical' Orientation of the gradient: - 'vertical': `span` corresponds to the `y` coordinate. - 'horizontal': `span` corresponds to the `x` coordinate. """ if orientation == 'vertical': grad = self.getGradient( p1=QtCore.QPointF(0.,span[0]), p2=QtCore.QPointF(0.,span[1]) ) elif orientation == 'horizontal': grad = self.getGradient( p1=QtCore.QPointF(span[0],0.), p2=QtCore.QPointF(span[1],0.) ) else: raise ValueError("Orientation must be 'vertical' or 'horizontal'") return QtGui.QBrush(grad) def getPen(self, span=(0.,1.), orientation='vertical', width=1.0): """ Returns a QPen that draws according to the color map based on vertical or horizontal position. It is recommended to store and reuse this gradient pen instead of regenerating it repeatedly. Parameters ---------- span : tuple of float Span of the data values covered by the gradient: - Color map value 0.0 will appear at `min`. - Color map value 1.0 will appear at `max`. Default is (0., 1.) orientation : str, default 'vertical' Orientation of the gradient: - 'vertical' creates a vertical gradient, where `span` corresponds to the `y` coordinate. - 'horizontal' creates a horizontal gradient, where `span` corresponds to the `x` coordinate. width : int or float Width of the pen in pixels on screen. """ brush = self.getBrush( span=span, orientation=orientation ) pen = QtGui.QPen(brush, width) pen.setCosmetic(True) return pen def getColors(self, mode=BYTE): """ Returns a list of the colors associated with the stops of the color map. The parameter `mode` can be one of - `ColorMap.BYTE` or 'byte' to return colors as RGBA tuples in byte format (0 to 255) - `ColorMap.FLOAT` or 'float' to return colors as RGBA tuples in float format (0.0 to 1.0) - `ColorMap.QCOLOR` or 'qcolor' to return a list of QColors The default is byte format. """ stops, color = self.getStops(mode=mode) return color def getStops(self, mode=BYTE): """ Returns a tuple (stops, colors) containing a list of all stops (ranging 0.0 to 1.0) and a list of the associated colors. The parameter `mode` can be one of - `ColorMap.BYTE` or 'byte' to return colors as RGBA tuples in byte format (0 to 255) - `ColorMap.FLOAT` or 'float' to return colors as RGBA tuples in float format (0.0 to 1.0) - `ColorMap.QCOLOR` or 'qcolor' to return a list of QColors The default is byte format. """ if isinstance(mode, str): mode = self.enumMap[mode.lower()] if mode not in self.stopsCache: color = self.color if mode == self.BYTE and color.dtype.kind == 'f': color = (color*255).astype(np.ubyte) elif mode == self.FLOAT and color.dtype.kind != 'f': color = color.astype(float) / 255. elif mode == self.QCOLOR: if color.dtype.kind == 'f': factory = QtGui.QColor.fromRgbF else: factory = QtGui.QColor.fromRgb color = [factory(*x.tolist()) for x in color] self.stopsCache[mode] = (self.pos, color) return self.stopsCache[mode] def getLookupTable(self, start=0.0, stop=1.0, nPts=512, alpha=None, mode=BYTE): """ getLookupTable(start=0.0, stop=1.0, nPts=512, alpha=None, mode=ColorMap.BYTE) Returns an equally-spaced lookup table of RGB(A) values created by interpolating the specified color stops. Parameters ---------- start: float, default=0.0 The starting value in the lookup table stop: float, default=1.0 The final value in the lookup table nPts: int, default=512 The number of points in the returned lookup table. alpha: bool, optional Specifies whether or not alpha values are included in the table. If alpha is None, it will be automatically determined. mode: int or str, default='byte' Determines return type as described in :func:`map() `, can be either `ColorMap.BYTE` (0 to 255), `ColorMap.FLOAT` (0.0 to 1.0) or `ColorMap.QColor`. Returns ------- np.ndarray of {``ColorMap.BYTE``, ``ColorMap.FLOAT``} for `ColorMap.BYTE` or `ColorMap.FLOAT`: RGB values for each `data` value, arranged in the same shape as `data`. If alpha values are included the array has shape (`nPts`, 4), otherwise (`nPts`, 3). list of QColor for `ColorMap.QCOLOR`: Colors for each `data` value as QColor objects. """ if isinstance(mode, str): mode = self.enumMap[mode.lower()] if alpha is None: alpha = self.usesAlpha() x = np.linspace(start, stop, nPts) table = self.map(x, mode) if not alpha and mode != self.QCOLOR: return table[:,:3] else: return table def usesAlpha(self): """Returns `True` if any stops have assigned colors with alpha < 255.""" max = 1.0 if self.color.dtype.kind == 'f' else 255 return np.any(self.color[:,3] != max) def isMapTrivial(self): """ Returns `True` if the gradient has exactly two stops in it: Black at 0.0 and white at 1.0. """ if len(self.pos) != 2: return False if self.pos[0] != 0.0 or self.pos[1] != 1.0: return False if self.color.dtype.kind == 'f': return np.all(self.color == np.array([[0.,0.,0.,1.], [1.,1.,1.,1.]])) else: return np.all(self.color == np.array([[0,0,0,255], [255,255,255,255]])) def __repr__(self): pos = repr(self.pos).replace('\n', '') color = repr(self.color).replace('\n', '') return "ColorMap(%s, %s)" % (pos, color) def __eq__(self, other): if other is None: return False return eq(self.pos, other.pos) and eq(self.color, other.color) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/000077500000000000000000000000001457240071200211555ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/__init__.py000066400000000000000000000000001457240071200232540ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/000077500000000000000000000000001457240071200221155ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CC-BY license - applies to CET color map data.txt000066400000000000000000000352161457240071200323460ustar00rootroot00000000000000Creative Commons Attribution 4.0 International Public License (CC-BY) By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. Section 1 - Definitions. a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section [5]2(b)(1)-(2) are not Copyright and Similar Rights. d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. h. Licensor means the individual(s) or entity(ies) granting rights under this Public License. i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. Section 2 - Scope. a. License grant. 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: A. reproduce and Share the Licensed Material, in whole or in part; and B. produce, reproduce, and Share Adapted Material. 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 3. Term. The term of this Public License is specified in Section [6]6(a). 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section [7]2(a)(4) never produces Adapted Material. 5. Downstream recipients. A. Offer from the Licensor - Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section [8]3(a)(1)(A)(i). b. Other rights. 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 2. Patent and trademark rights are not licensed under this Public License. 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. Section 3 - License Conditions. Your exercise of the Licensed Rights is expressly made subject to the following conditions. a. Attribution. 1. If You Share the Licensed Material (including in modified form), You must: A. retain the following if it is supplied by the Licensor with the Licensed Material: i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); ii. a copyright notice; iii. a notice that refers to this Public License; iv. a notice that refers to the disclaimer of warranties; v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 2. You may satisfy the conditions in Section [9]3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 3. If requested by the Licensor, You must remove any of the information required by Section [10]3(a)(1)(A) to the extent reasonably practicable. 4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. Section 4 - Sui Generis Database Rights. Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: a. for the avoidance of doubt, Section [11]2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and c. You must comply with the conditions in Section [12]3(a) if You Share all or a substantial portion of the contents of the database. For the avoidance of doubt, this Section [13]4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. Section 5 - Disclaimer of Warranties and Limitation of Liability. a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. Section 6 - Term and Termination. a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. b. Where Your right to use the Licensed Material has terminated under Section [14]6(a), it reinstates: 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 2. upon express reinstatement by the Licensor. For the avoidance of doubt, this Section [15]6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. d. Sections [16]1, [17]5, [18]6, [19]7, and [20]8 survive termination of this Public License. Section 7 - Other Terms and Conditions. a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. Section 8 - Interpretation. a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. CC0 legal code - applies to virids, magma, plasma, inferno and cividis.txt000066400000000000000000000156101457240071200370120ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/mapsCreative Commons Legal Code CC0 1.0 Universal CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER. Statement of Purpose The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. 1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; ii. moral rights retained by the original author(s) and/or performer(s); iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; v. rights protecting the extraction, dissemination, use and reuse of data in a Work; vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. 2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. 3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. 4. Limitations and Disclaimers. a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C1.csv000066400000000000000000000110001457240071200234760ustar00rootroot000000000000000.976,0.520,0.971 0.980,0.517,0.963 0.984,0.514,0.954 0.987,0.509,0.945 0.990,0.504,0.934 0.991,0.499,0.923 0.992,0.492,0.911 0.992,0.486,0.899 0.992,0.478,0.886 0.992,0.471,0.872 0.991,0.463,0.858 0.989,0.455,0.844 0.988,0.446,0.830 0.986,0.438,0.815 0.984,0.429,0.800 0.981,0.420,0.786 0.979,0.411,0.771 0.976,0.402,0.756 0.973,0.393,0.741 0.971,0.384,0.726 0.968,0.375,0.711 0.964,0.365,0.696 0.961,0.356,0.682 0.958,0.347,0.667 0.954,0.337,0.652 0.951,0.328,0.637 0.947,0.318,0.623 0.943,0.309,0.608 0.938,0.300,0.593 0.934,0.291,0.578 0.929,0.282,0.564 0.924,0.273,0.549 0.919,0.264,0.534 0.914,0.256,0.519 0.908,0.247,0.504 0.903,0.239,0.489 0.897,0.231,0.474 0.890,0.223,0.459 0.884,0.215,0.444 0.877,0.207,0.429 0.871,0.200,0.414 0.864,0.193,0.399 0.857,0.185,0.384 0.850,0.178,0.369 0.842,0.171,0.354 0.835,0.164,0.339 0.828,0.157,0.324 0.820,0.150,0.309 0.812,0.143,0.295 0.805,0.136,0.280 0.797,0.129,0.265 0.790,0.122,0.251 0.782,0.116,0.236 0.775,0.110,0.222 0.767,0.104,0.208 0.760,0.099,0.194 0.753,0.095,0.180 0.747,0.091,0.167 0.740,0.089,0.154 0.734,0.088,0.142 0.729,0.089,0.130 0.724,0.091,0.118 0.720,0.095,0.107 0.716,0.100,0.096 0.713,0.106,0.086 0.711,0.113,0.077 0.710,0.121,0.068 0.709,0.130,0.060 0.709,0.139,0.052 0.710,0.149,0.045 0.711,0.159,0.039 0.713,0.169,0.033 0.715,0.180,0.029 0.717,0.191,0.025 0.720,0.201,0.023 0.723,0.212,0.021 0.727,0.222,0.019 0.730,0.233,0.018 0.734,0.243,0.017 0.738,0.253,0.017 0.742,0.263,0.016 0.746,0.273,0.016 0.750,0.283,0.016 0.754,0.293,0.016 0.758,0.303,0.016 0.762,0.312,0.017 0.765,0.322,0.017 0.769,0.331,0.017 0.773,0.341,0.018 0.777,0.350,0.018 0.780,0.359,0.018 0.784,0.369,0.018 0.787,0.378,0.019 0.791,0.387,0.019 0.794,0.396,0.019 0.797,0.406,0.019 0.800,0.415,0.019 0.803,0.424,0.019 0.806,0.433,0.019 0.809,0.443,0.019 0.811,0.452,0.019 0.814,0.461,0.019 0.816,0.471,0.018 0.819,0.480,0.018 0.821,0.489,0.018 0.823,0.498,0.017 0.825,0.508,0.017 0.827,0.517,0.017 0.829,0.526,0.016 0.831,0.535,0.016 0.833,0.544,0.016 0.834,0.554,0.016 0.836,0.563,0.016 0.837,0.572,0.017 0.839,0.580,0.018 0.840,0.589,0.020 0.841,0.598,0.023 0.841,0.606,0.027 0.842,0.614,0.032 0.842,0.622,0.040 0.841,0.629,0.049 0.840,0.636,0.059 0.839,0.643,0.070 0.836,0.649,0.083 0.834,0.654,0.096 0.830,0.658,0.109 0.825,0.662,0.123 0.820,0.665,0.138 0.814,0.667,0.153 0.807,0.669,0.169 0.799,0.669,0.184 0.791,0.669,0.200 0.782,0.668,0.215 0.772,0.666,0.231 0.761,0.664,0.246 0.750,0.661,0.261 0.739,0.658,0.276 0.727,0.655,0.291 0.714,0.651,0.306 0.701,0.647,0.320 0.688,0.642,0.334 0.675,0.638,0.348 0.661,0.633,0.361 0.647,0.628,0.375 0.632,0.624,0.388 0.618,0.619,0.401 0.602,0.614,0.413 0.587,0.609,0.426 0.571,0.604,0.438 0.555,0.599,0.450 0.539,0.594,0.463 0.522,0.590,0.475 0.504,0.585,0.486 0.486,0.580,0.498 0.468,0.575,0.510 0.449,0.570,0.522 0.430,0.565,0.533 0.410,0.560,0.545 0.390,0.555,0.556 0.369,0.549,0.568 0.348,0.544,0.579 0.327,0.538,0.591 0.306,0.532,0.603 0.284,0.526,0.614 0.263,0.519,0.626 0.242,0.513,0.638 0.223,0.506,0.649 0.204,0.498,0.661 0.186,0.490,0.673 0.171,0.482,0.685 0.157,0.473,0.697 0.146,0.464,0.709 0.139,0.454,0.722 0.134,0.445,0.734 0.132,0.434,0.746 0.133,0.424,0.759 0.135,0.413,0.771 0.139,0.401,0.783 0.144,0.390,0.796 0.150,0.378,0.808 0.156,0.366,0.820 0.162,0.354,0.833 0.169,0.342,0.845 0.175,0.330,0.856 0.181,0.318,0.868 0.187,0.306,0.879 0.194,0.295,0.889 0.201,0.285,0.900 0.208,0.275,0.909 0.216,0.266,0.918 0.225,0.258,0.927 0.234,0.251,0.934 0.244,0.245,0.941 0.254,0.241,0.948 0.265,0.239,0.953 0.277,0.237,0.958 0.288,0.238,0.962 0.300,0.239,0.965 0.311,0.242,0.968 0.323,0.246,0.970 0.335,0.251,0.972 0.346,0.257,0.974 0.357,0.263,0.975 0.368,0.270,0.976 0.379,0.277,0.977 0.390,0.285,0.977 0.400,0.293,0.977 0.410,0.300,0.978 0.420,0.308,0.978 0.430,0.316,0.978 0.440,0.324,0.978 0.449,0.332,0.978 0.459,0.340,0.978 0.469,0.348,0.978 0.478,0.355,0.978 0.488,0.363,0.979 0.498,0.370,0.979 0.508,0.377,0.979 0.518,0.384,0.979 0.529,0.391,0.980 0.540,0.398,0.980 0.551,0.404,0.981 0.563,0.410,0.981 0.575,0.416,0.982 0.588,0.421,0.982 0.600,0.427,0.983 0.613,0.432,0.984 0.627,0.437,0.985 0.640,0.442,0.986 0.654,0.446,0.987 0.668,0.451,0.988 0.682,0.455,0.989 0.696,0.460,0.990 0.710,0.464,0.991 0.724,0.468,0.992 0.738,0.472,0.994 0.752,0.476,0.995 0.766,0.480,0.996 0.780,0.484,0.997 0.794,0.488,0.998 0.807,0.492,0.999 0.821,0.496,1.000 0.834,0.500,1.000 0.847,0.503,1.000 0.860,0.507,1.000 0.873,0.510,1.000 0.885,0.513,1.000 0.897,0.516,1.000 0.909,0.519,1.000 0.919,0.521,1.000 0.930,0.523,0.999 0.939,0.524,0.996 0.948,0.525,0.993 0.956,0.524,0.989 0.964,0.524,0.984 0.970,0.522,0.978 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C1s.csv000066400000000000000000000110001457240071200236610ustar00rootroot000000000000000.244,0.245,0.941 0.254,0.241,0.948 0.265,0.239,0.953 0.277,0.237,0.958 0.288,0.238,0.962 0.300,0.239,0.965 0.311,0.242,0.968 0.323,0.246,0.970 0.335,0.251,0.972 0.346,0.257,0.974 0.357,0.263,0.975 0.368,0.270,0.976 0.379,0.277,0.977 0.390,0.285,0.977 0.400,0.293,0.977 0.410,0.300,0.978 0.420,0.308,0.978 0.430,0.316,0.978 0.440,0.324,0.978 0.449,0.332,0.978 0.459,0.340,0.978 0.469,0.348,0.978 0.478,0.355,0.978 0.488,0.363,0.979 0.498,0.370,0.979 0.508,0.377,0.979 0.518,0.384,0.979 0.529,0.391,0.980 0.540,0.398,0.980 0.551,0.404,0.981 0.563,0.410,0.981 0.575,0.416,0.982 0.588,0.421,0.982 0.600,0.427,0.983 0.613,0.432,0.984 0.627,0.437,0.985 0.640,0.442,0.986 0.654,0.446,0.987 0.668,0.451,0.988 0.682,0.455,0.989 0.696,0.460,0.990 0.710,0.464,0.991 0.724,0.468,0.992 0.738,0.472,0.994 0.752,0.476,0.995 0.766,0.480,0.996 0.780,0.484,0.997 0.794,0.488,0.998 0.807,0.492,0.999 0.821,0.496,1.000 0.834,0.500,1.000 0.847,0.503,1.000 0.860,0.507,1.000 0.873,0.510,1.000 0.885,0.513,1.000 0.897,0.516,1.000 0.909,0.519,1.000 0.919,0.521,1.000 0.930,0.523,0.999 0.939,0.524,0.996 0.948,0.525,0.993 0.956,0.524,0.989 0.964,0.524,0.984 0.970,0.522,0.978 0.976,0.520,0.971 0.980,0.517,0.963 0.984,0.514,0.954 0.987,0.509,0.945 0.990,0.504,0.934 0.991,0.499,0.923 0.992,0.492,0.911 0.992,0.486,0.899 0.992,0.478,0.886 0.992,0.471,0.872 0.991,0.463,0.858 0.989,0.455,0.844 0.988,0.446,0.830 0.986,0.438,0.815 0.984,0.429,0.800 0.981,0.420,0.786 0.979,0.411,0.771 0.976,0.402,0.756 0.973,0.393,0.741 0.971,0.384,0.726 0.968,0.375,0.711 0.964,0.365,0.696 0.961,0.356,0.682 0.958,0.347,0.667 0.954,0.337,0.652 0.951,0.328,0.637 0.947,0.318,0.623 0.943,0.309,0.608 0.938,0.300,0.593 0.934,0.291,0.578 0.929,0.282,0.564 0.924,0.273,0.549 0.919,0.264,0.534 0.914,0.256,0.519 0.908,0.247,0.504 0.903,0.239,0.489 0.897,0.231,0.474 0.890,0.223,0.459 0.884,0.215,0.444 0.877,0.207,0.429 0.871,0.200,0.414 0.864,0.193,0.399 0.857,0.185,0.384 0.850,0.178,0.369 0.842,0.171,0.354 0.835,0.164,0.339 0.828,0.157,0.324 0.820,0.150,0.309 0.812,0.143,0.295 0.805,0.136,0.280 0.797,0.129,0.265 0.790,0.122,0.251 0.782,0.116,0.236 0.775,0.110,0.222 0.767,0.104,0.208 0.760,0.099,0.194 0.753,0.095,0.180 0.747,0.091,0.167 0.740,0.089,0.154 0.734,0.088,0.142 0.729,0.089,0.130 0.724,0.091,0.118 0.720,0.095,0.107 0.716,0.100,0.096 0.713,0.106,0.086 0.711,0.113,0.077 0.710,0.121,0.068 0.709,0.130,0.060 0.709,0.139,0.052 0.710,0.149,0.045 0.711,0.159,0.039 0.713,0.169,0.033 0.715,0.180,0.029 0.717,0.191,0.025 0.720,0.201,0.023 0.723,0.212,0.021 0.727,0.222,0.019 0.730,0.233,0.018 0.734,0.243,0.017 0.738,0.253,0.017 0.742,0.263,0.016 0.746,0.273,0.016 0.750,0.283,0.016 0.754,0.293,0.016 0.758,0.303,0.016 0.762,0.312,0.017 0.765,0.322,0.017 0.769,0.331,0.017 0.773,0.341,0.018 0.777,0.350,0.018 0.780,0.359,0.018 0.784,0.369,0.018 0.787,0.378,0.019 0.791,0.387,0.019 0.794,0.396,0.019 0.797,0.406,0.019 0.800,0.415,0.019 0.803,0.424,0.019 0.806,0.433,0.019 0.809,0.443,0.019 0.811,0.452,0.019 0.814,0.461,0.019 0.816,0.471,0.018 0.819,0.480,0.018 0.821,0.489,0.018 0.823,0.498,0.017 0.825,0.508,0.017 0.827,0.517,0.017 0.829,0.526,0.016 0.831,0.535,0.016 0.833,0.544,0.016 0.834,0.554,0.016 0.836,0.563,0.016 0.837,0.572,0.017 0.839,0.580,0.018 0.840,0.589,0.020 0.841,0.598,0.023 0.841,0.606,0.027 0.842,0.614,0.032 0.842,0.622,0.040 0.841,0.629,0.049 0.840,0.636,0.059 0.839,0.643,0.070 0.836,0.649,0.083 0.834,0.654,0.096 0.830,0.658,0.109 0.825,0.662,0.123 0.820,0.665,0.138 0.814,0.667,0.153 0.807,0.669,0.169 0.799,0.669,0.184 0.791,0.669,0.200 0.782,0.668,0.215 0.772,0.666,0.231 0.761,0.664,0.246 0.750,0.661,0.261 0.739,0.658,0.276 0.727,0.655,0.291 0.714,0.651,0.306 0.701,0.647,0.320 0.688,0.642,0.334 0.675,0.638,0.348 0.661,0.633,0.361 0.647,0.628,0.375 0.632,0.624,0.388 0.618,0.619,0.401 0.602,0.614,0.413 0.587,0.609,0.426 0.571,0.604,0.438 0.555,0.599,0.450 0.539,0.594,0.463 0.522,0.590,0.475 0.504,0.585,0.486 0.486,0.580,0.498 0.468,0.575,0.510 0.449,0.570,0.522 0.430,0.565,0.533 0.410,0.560,0.545 0.390,0.555,0.556 0.369,0.549,0.568 0.348,0.544,0.579 0.327,0.538,0.591 0.306,0.532,0.603 0.284,0.526,0.614 0.263,0.519,0.626 0.242,0.513,0.638 0.223,0.506,0.649 0.204,0.498,0.661 0.186,0.490,0.673 0.171,0.482,0.685 0.157,0.473,0.697 0.146,0.464,0.709 0.139,0.454,0.722 0.134,0.445,0.734 0.132,0.434,0.746 0.133,0.424,0.759 0.135,0.413,0.771 0.139,0.401,0.783 0.144,0.390,0.796 0.150,0.378,0.808 0.156,0.366,0.820 0.162,0.354,0.833 0.169,0.342,0.845 0.175,0.330,0.856 0.181,0.318,0.868 0.187,0.306,0.879 0.194,0.295,0.889 0.201,0.285,0.900 0.208,0.275,0.909 0.216,0.266,0.918 0.225,0.258,0.927 0.234,0.251,0.934 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C2.csv000066400000000000000000000110001457240071200234770ustar00rootroot000000000000000.938,0.334,0.948 0.944,0.343,0.942 0.949,0.353,0.936 0.954,0.363,0.929 0.959,0.374,0.922 0.963,0.386,0.914 0.966,0.397,0.906 0.969,0.409,0.897 0.972,0.421,0.888 0.975,0.433,0.879 0.977,0.446,0.869 0.978,0.458,0.859 0.980,0.470,0.849 0.981,0.482,0.839 0.983,0.494,0.829 0.984,0.506,0.819 0.985,0.518,0.808 0.985,0.530,0.798 0.986,0.541,0.787 0.986,0.553,0.776 0.987,0.564,0.766 0.987,0.575,0.755 0.987,0.586,0.744 0.987,0.597,0.733 0.987,0.608,0.722 0.987,0.618,0.712 0.987,0.629,0.701 0.987,0.639,0.690 0.987,0.649,0.679 0.987,0.659,0.668 0.987,0.670,0.657 0.986,0.679,0.645 0.986,0.689,0.634 0.986,0.699,0.623 0.986,0.708,0.612 0.986,0.718,0.601 0.986,0.727,0.589 0.986,0.736,0.578 0.987,0.745,0.566 0.987,0.754,0.555 0.987,0.763,0.543 0.987,0.772,0.531 0.988,0.781,0.519 0.988,0.789,0.507 0.988,0.798,0.495 0.988,0.807,0.483 0.989,0.815,0.470 0.989,0.824,0.458 0.989,0.832,0.445 0.989,0.840,0.432 0.988,0.849,0.418 0.988,0.857,0.404 0.987,0.865,0.390 0.986,0.873,0.376 0.985,0.880,0.362 0.983,0.888,0.347 0.981,0.895,0.332 0.978,0.901,0.316 0.975,0.907,0.301 0.972,0.913,0.285 0.967,0.918,0.270 0.962,0.923,0.254 0.957,0.927,0.239 0.951,0.930,0.224 0.944,0.932,0.209 0.936,0.934,0.195 0.928,0.935,0.182 0.920,0.935,0.169 0.910,0.935,0.157 0.901,0.934,0.146 0.891,0.933,0.136 0.881,0.931,0.127 0.870,0.928,0.120 0.859,0.925,0.113 0.848,0.922,0.107 0.837,0.919,0.103 0.826,0.915,0.099 0.815,0.911,0.095 0.803,0.907,0.092 0.792,0.903,0.090 0.780,0.899,0.088 0.769,0.895,0.086 0.757,0.891,0.084 0.746,0.887,0.082 0.734,0.882,0.081 0.722,0.878,0.079 0.711,0.874,0.078 0.699,0.869,0.076 0.687,0.865,0.075 0.675,0.861,0.074 0.663,0.856,0.072 0.652,0.852,0.071 0.640,0.848,0.070 0.628,0.843,0.068 0.616,0.839,0.067 0.604,0.835,0.066 0.591,0.830,0.064 0.579,0.826,0.063 0.567,0.822,0.062 0.554,0.817,0.060 0.542,0.813,0.059 0.529,0.808,0.058 0.517,0.804,0.057 0.504,0.800,0.055 0.491,0.795,0.054 0.478,0.791,0.053 0.465,0.786,0.051 0.452,0.782,0.050 0.438,0.777,0.049 0.424,0.773,0.048 0.411,0.768,0.047 0.397,0.764,0.047 0.382,0.759,0.046 0.368,0.755,0.047 0.354,0.750,0.047 0.339,0.745,0.049 0.324,0.741,0.051 0.310,0.736,0.054 0.295,0.731,0.058 0.281,0.726,0.064 0.267,0.721,0.070 0.254,0.716,0.078 0.241,0.711,0.087 0.230,0.706,0.097 0.220,0.700,0.107 0.211,0.695,0.119 0.204,0.689,0.131 0.199,0.683,0.144 0.196,0.677,0.158 0.195,0.671,0.172 0.196,0.664,0.186 0.198,0.658,0.200 0.202,0.651,0.215 0.206,0.644,0.230 0.212,0.638,0.245 0.218,0.631,0.261 0.224,0.623,0.276 0.230,0.616,0.291 0.236,0.609,0.306 0.242,0.602,0.321 0.247,0.595,0.335 0.252,0.587,0.350 0.256,0.580,0.365 0.260,0.572,0.379 0.263,0.565,0.393 0.266,0.558,0.407 0.268,0.550,0.421 0.270,0.543,0.435 0.271,0.535,0.449 0.272,0.528,0.462 0.272,0.521,0.476 0.271,0.513,0.489 0.270,0.506,0.503 0.268,0.498,0.516 0.266,0.491,0.529 0.263,0.484,0.542 0.260,0.476,0.555 0.256,0.469,0.568 0.252,0.461,0.581 0.247,0.454,0.594 0.242,0.446,0.606 0.236,0.438,0.619 0.230,0.431,0.631 0.224,0.423,0.644 0.218,0.415,0.656 0.212,0.407,0.667 0.206,0.399,0.679 0.199,0.391,0.691 0.194,0.382,0.702 0.188,0.374,0.713 0.183,0.365,0.724 0.178,0.356,0.735 0.174,0.347,0.745 0.170,0.337,0.756 0.166,0.327,0.766 0.163,0.317,0.776 0.160,0.307,0.786 0.157,0.297,0.796 0.155,0.286,0.805 0.152,0.275,0.815 0.150,0.264,0.824 0.147,0.253,0.833 0.146,0.241,0.843 0.144,0.230,0.851 0.143,0.218,0.860 0.143,0.206,0.869 0.144,0.195,0.877 0.146,0.183,0.885 0.150,0.172,0.892 0.155,0.161,0.900 0.162,0.151,0.906 0.171,0.141,0.913 0.181,0.132,0.919 0.192,0.124,0.924 0.204,0.118,0.929 0.217,0.112,0.933 0.230,0.108,0.937 0.244,0.105,0.941 0.258,0.104,0.944 0.272,0.104,0.947 0.287,0.106,0.950 0.301,0.108,0.952 0.314,0.112,0.954 0.328,0.116,0.956 0.341,0.120,0.958 0.354,0.125,0.960 0.367,0.131,0.961 0.379,0.136,0.963 0.392,0.142,0.964 0.404,0.148,0.966 0.415,0.154,0.967 0.427,0.159,0.969 0.438,0.165,0.970 0.449,0.171,0.971 0.460,0.176,0.973 0.471,0.182,0.974 0.482,0.188,0.975 0.493,0.193,0.976 0.504,0.198,0.978 0.514,0.203,0.979 0.525,0.208,0.980 0.536,0.213,0.981 0.548,0.217,0.982 0.559,0.221,0.982 0.571,0.225,0.983 0.582,0.229,0.984 0.594,0.233,0.984 0.606,0.236,0.985 0.619,0.239,0.985 0.631,0.242,0.985 0.644,0.245,0.985 0.657,0.247,0.985 0.669,0.250,0.985 0.682,0.252,0.985 0.695,0.254,0.985 0.708,0.256,0.985 0.721,0.258,0.984 0.734,0.260,0.984 0.747,0.261,0.984 0.760,0.263,0.983 0.773,0.265,0.983 0.785,0.267,0.982 0.798,0.269,0.982 0.810,0.271,0.981 0.822,0.273,0.980 0.834,0.275,0.979 0.846,0.278,0.978 0.857,0.281,0.977 0.868,0.284,0.975 0.878,0.288,0.973 0.889,0.293,0.971 0.898,0.298,0.968 0.907,0.303,0.965 0.916,0.310,0.962 0.924,0.317,0.958 0.931,0.325,0.953 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C2s.csv000066400000000000000000000110001457240071200236620ustar00rootroot000000000000000.181,0.132,0.919 0.192,0.124,0.924 0.204,0.118,0.929 0.217,0.112,0.933 0.230,0.108,0.937 0.244,0.105,0.941 0.258,0.104,0.944 0.272,0.104,0.947 0.287,0.106,0.950 0.301,0.108,0.952 0.314,0.112,0.954 0.328,0.116,0.956 0.341,0.120,0.958 0.354,0.125,0.960 0.367,0.131,0.961 0.379,0.136,0.963 0.392,0.142,0.964 0.404,0.148,0.966 0.415,0.154,0.967 0.427,0.159,0.969 0.438,0.165,0.970 0.449,0.171,0.971 0.460,0.176,0.973 0.471,0.182,0.974 0.482,0.188,0.975 0.493,0.193,0.976 0.504,0.198,0.978 0.514,0.203,0.979 0.525,0.208,0.980 0.536,0.213,0.981 0.548,0.217,0.982 0.559,0.221,0.982 0.571,0.225,0.983 0.582,0.229,0.984 0.594,0.233,0.984 0.606,0.236,0.985 0.619,0.239,0.985 0.631,0.242,0.985 0.644,0.245,0.985 0.657,0.247,0.985 0.669,0.250,0.985 0.682,0.252,0.985 0.695,0.254,0.985 0.708,0.256,0.985 0.721,0.258,0.984 0.734,0.260,0.984 0.747,0.261,0.984 0.760,0.263,0.983 0.773,0.265,0.983 0.785,0.267,0.982 0.798,0.269,0.982 0.810,0.271,0.981 0.822,0.273,0.980 0.834,0.275,0.979 0.846,0.278,0.978 0.857,0.281,0.977 0.868,0.284,0.975 0.878,0.288,0.973 0.889,0.293,0.971 0.898,0.298,0.968 0.907,0.303,0.965 0.916,0.310,0.962 0.924,0.317,0.958 0.931,0.325,0.953 0.938,0.334,0.948 0.944,0.343,0.942 0.949,0.353,0.936 0.954,0.363,0.929 0.959,0.374,0.922 0.963,0.386,0.914 0.966,0.397,0.906 0.969,0.409,0.897 0.972,0.421,0.888 0.975,0.433,0.879 0.977,0.446,0.869 0.978,0.458,0.859 0.980,0.470,0.849 0.981,0.482,0.839 0.983,0.494,0.829 0.984,0.506,0.819 0.985,0.518,0.808 0.985,0.530,0.798 0.986,0.541,0.787 0.986,0.553,0.776 0.987,0.564,0.766 0.987,0.575,0.755 0.987,0.586,0.744 0.987,0.597,0.733 0.987,0.608,0.722 0.987,0.618,0.712 0.987,0.629,0.701 0.987,0.639,0.690 0.987,0.649,0.679 0.987,0.659,0.668 0.987,0.670,0.657 0.986,0.679,0.645 0.986,0.689,0.634 0.986,0.699,0.623 0.986,0.708,0.612 0.986,0.718,0.601 0.986,0.727,0.589 0.986,0.736,0.578 0.987,0.745,0.566 0.987,0.754,0.555 0.987,0.763,0.543 0.987,0.772,0.531 0.988,0.781,0.519 0.988,0.789,0.507 0.988,0.798,0.495 0.988,0.807,0.483 0.989,0.815,0.470 0.989,0.824,0.458 0.989,0.832,0.445 0.989,0.840,0.432 0.988,0.849,0.418 0.988,0.857,0.404 0.987,0.865,0.390 0.986,0.873,0.376 0.985,0.880,0.362 0.983,0.888,0.347 0.981,0.895,0.332 0.978,0.901,0.316 0.975,0.907,0.301 0.972,0.913,0.285 0.967,0.918,0.270 0.962,0.923,0.254 0.957,0.927,0.239 0.951,0.930,0.224 0.944,0.932,0.209 0.936,0.934,0.195 0.928,0.935,0.182 0.920,0.935,0.169 0.910,0.935,0.157 0.901,0.934,0.146 0.891,0.933,0.136 0.881,0.931,0.127 0.870,0.928,0.120 0.859,0.925,0.113 0.848,0.922,0.107 0.837,0.919,0.103 0.826,0.915,0.099 0.815,0.911,0.095 0.803,0.907,0.092 0.792,0.903,0.090 0.780,0.899,0.088 0.769,0.895,0.086 0.757,0.891,0.084 0.746,0.887,0.082 0.734,0.882,0.081 0.722,0.878,0.079 0.711,0.874,0.078 0.699,0.869,0.076 0.687,0.865,0.075 0.675,0.861,0.074 0.663,0.856,0.072 0.652,0.852,0.071 0.640,0.848,0.070 0.628,0.843,0.068 0.616,0.839,0.067 0.604,0.835,0.066 0.591,0.830,0.064 0.579,0.826,0.063 0.567,0.822,0.062 0.554,0.817,0.060 0.542,0.813,0.059 0.529,0.808,0.058 0.517,0.804,0.057 0.504,0.800,0.055 0.491,0.795,0.054 0.478,0.791,0.053 0.465,0.786,0.051 0.452,0.782,0.050 0.438,0.777,0.049 0.424,0.773,0.048 0.411,0.768,0.047 0.397,0.764,0.047 0.382,0.759,0.046 0.368,0.755,0.047 0.354,0.750,0.047 0.339,0.745,0.049 0.324,0.741,0.051 0.310,0.736,0.054 0.295,0.731,0.058 0.281,0.726,0.064 0.267,0.721,0.070 0.254,0.716,0.078 0.241,0.711,0.087 0.230,0.706,0.097 0.220,0.700,0.107 0.211,0.695,0.119 0.204,0.689,0.131 0.199,0.683,0.144 0.196,0.677,0.158 0.195,0.671,0.172 0.196,0.664,0.186 0.198,0.658,0.200 0.202,0.651,0.215 0.206,0.644,0.230 0.212,0.638,0.245 0.218,0.631,0.261 0.224,0.623,0.276 0.230,0.616,0.291 0.236,0.609,0.306 0.242,0.602,0.321 0.247,0.595,0.335 0.252,0.587,0.350 0.256,0.580,0.365 0.260,0.572,0.379 0.263,0.565,0.393 0.266,0.558,0.407 0.268,0.550,0.421 0.270,0.543,0.435 0.271,0.535,0.449 0.272,0.528,0.462 0.272,0.521,0.476 0.271,0.513,0.489 0.270,0.506,0.503 0.268,0.498,0.516 0.266,0.491,0.529 0.263,0.484,0.542 0.260,0.476,0.555 0.256,0.469,0.568 0.252,0.461,0.581 0.247,0.454,0.594 0.242,0.446,0.606 0.236,0.438,0.619 0.230,0.431,0.631 0.224,0.423,0.644 0.218,0.415,0.656 0.212,0.407,0.667 0.206,0.399,0.679 0.199,0.391,0.691 0.194,0.382,0.702 0.188,0.374,0.713 0.183,0.365,0.724 0.178,0.356,0.735 0.174,0.347,0.745 0.170,0.337,0.756 0.166,0.327,0.766 0.163,0.317,0.776 0.160,0.307,0.786 0.157,0.297,0.796 0.155,0.286,0.805 0.152,0.275,0.815 0.150,0.264,0.824 0.147,0.253,0.833 0.146,0.241,0.843 0.144,0.230,0.851 0.143,0.218,0.860 0.143,0.206,0.869 0.144,0.195,0.877 0.146,0.183,0.885 0.150,0.172,0.892 0.155,0.161,0.900 0.162,0.151,0.906 0.171,0.141,0.913 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C3.csv000066400000000000000000000110001457240071200235000ustar00rootroot000000000000000.881,0.843,0.856 0.886,0.842,0.849 0.891,0.839,0.840 0.896,0.835,0.831 0.900,0.830,0.821 0.904,0.825,0.811 0.907,0.819,0.800 0.911,0.812,0.789 0.914,0.804,0.778 0.917,0.797,0.766 0.919,0.788,0.754 0.922,0.780,0.742 0.924,0.771,0.730 0.926,0.762,0.717 0.928,0.752,0.705 0.930,0.743,0.692 0.932,0.734,0.679 0.933,0.724,0.667 0.935,0.714,0.654 0.936,0.705,0.641 0.937,0.695,0.629 0.938,0.685,0.616 0.939,0.676,0.604 0.940,0.666,0.591 0.940,0.656,0.579 0.941,0.646,0.566 0.941,0.636,0.554 0.941,0.627,0.541 0.941,0.617,0.529 0.941,0.607,0.517 0.941,0.597,0.504 0.941,0.587,0.492 0.941,0.577,0.480 0.940,0.567,0.468 0.940,0.557,0.456 0.939,0.547,0.444 0.939,0.537,0.431 0.938,0.527,0.419 0.937,0.516,0.407 0.936,0.506,0.395 0.935,0.496,0.383 0.934,0.485,0.371 0.932,0.475,0.359 0.931,0.464,0.348 0.930,0.454,0.336 0.928,0.443,0.324 0.926,0.432,0.312 0.925,0.421,0.300 0.923,0.410,0.288 0.921,0.399,0.277 0.919,0.388,0.265 0.916,0.377,0.254 0.914,0.365,0.242 0.911,0.354,0.231 0.908,0.343,0.220 0.905,0.332,0.209 0.901,0.320,0.198 0.898,0.309,0.188 0.893,0.299,0.178 0.889,0.288,0.168 0.883,0.278,0.159 0.877,0.268,0.151 0.871,0.259,0.143 0.864,0.250,0.136 0.857,0.242,0.130 0.849,0.235,0.124 0.840,0.229,0.119 0.831,0.223,0.115 0.821,0.218,0.111 0.811,0.214,0.109 0.800,0.211,0.107 0.789,0.208,0.105 0.778,0.206,0.104 0.766,0.204,0.103 0.755,0.202,0.103 0.743,0.201,0.103 0.730,0.200,0.103 0.718,0.199,0.103 0.706,0.198,0.104 0.694,0.198,0.104 0.681,0.197,0.105 0.669,0.196,0.105 0.656,0.195,0.106 0.644,0.195,0.106 0.631,0.194,0.107 0.619,0.193,0.107 0.607,0.192,0.108 0.594,0.191,0.108 0.582,0.190,0.109 0.570,0.189,0.109 0.558,0.188,0.110 0.546,0.187,0.110 0.534,0.186,0.110 0.521,0.184,0.111 0.509,0.183,0.111 0.497,0.182,0.111 0.485,0.180,0.112 0.474,0.179,0.112 0.462,0.177,0.112 0.450,0.176,0.112 0.438,0.174,0.112 0.426,0.172,0.112 0.414,0.171,0.112 0.403,0.169,0.113 0.391,0.167,0.113 0.379,0.165,0.113 0.368,0.163,0.113 0.356,0.161,0.113 0.345,0.159,0.113 0.333,0.157,0.113 0.322,0.155,0.113 0.310,0.153,0.113 0.299,0.151,0.113 0.288,0.149,0.113 0.277,0.146,0.113 0.266,0.144,0.113 0.255,0.142,0.114 0.244,0.140,0.114 0.234,0.138,0.115 0.224,0.136,0.116 0.215,0.135,0.118 0.206,0.133,0.120 0.197,0.132,0.122 0.189,0.131,0.125 0.182,0.130,0.129 0.176,0.130,0.133 0.170,0.130,0.138 0.165,0.131,0.144 0.161,0.131,0.150 0.157,0.133,0.157 0.155,0.134,0.164 0.153,0.136,0.173 0.152,0.139,0.182 0.151,0.142,0.191 0.151,0.145,0.201 0.152,0.148,0.212 0.152,0.152,0.223 0.154,0.156,0.235 0.155,0.160,0.246 0.157,0.164,0.258 0.159,0.169,0.271 0.162,0.173,0.283 0.164,0.178,0.296 0.166,0.182,0.309 0.168,0.187,0.322 0.170,0.192,0.335 0.172,0.196,0.348 0.174,0.201,0.361 0.176,0.206,0.375 0.178,0.211,0.388 0.180,0.216,0.402 0.181,0.221,0.415 0.183,0.226,0.429 0.184,0.230,0.443 0.185,0.235,0.457 0.186,0.240,0.470 0.187,0.245,0.484 0.188,0.250,0.499 0.188,0.255,0.513 0.188,0.261,0.527 0.189,0.266,0.541 0.189,0.271,0.555 0.188,0.276,0.570 0.188,0.281,0.584 0.187,0.286,0.599 0.187,0.291,0.614 0.186,0.297,0.628 0.184,0.302,0.643 0.183,0.307,0.658 0.181,0.312,0.673 0.179,0.317,0.687 0.177,0.323,0.702 0.174,0.328,0.717 0.171,0.333,0.732 0.168,0.339,0.747 0.165,0.344,0.762 0.161,0.349,0.777 0.158,0.355,0.792 0.154,0.360,0.807 0.150,0.366,0.822 0.146,0.371,0.837 0.143,0.377,0.851 0.140,0.382,0.865 0.138,0.388,0.878 0.137,0.393,0.892 0.138,0.399,0.904 0.141,0.405,0.916 0.146,0.410,0.927 0.153,0.416,0.937 0.162,0.422,0.947 0.173,0.428,0.955 0.186,0.434,0.963 0.200,0.440,0.969 0.216,0.446,0.975 0.232,0.452,0.979 0.248,0.458,0.983 0.265,0.465,0.986 0.282,0.471,0.988 0.299,0.477,0.989 0.316,0.484,0.990 0.332,0.490,0.990 0.348,0.497,0.990 0.364,0.503,0.989 0.380,0.510,0.989 0.394,0.517,0.988 0.409,0.523,0.986 0.423,0.530,0.985 0.437,0.537,0.983 0.450,0.544,0.982 0.463,0.551,0.980 0.476,0.557,0.979 0.488,0.564,0.977 0.500,0.571,0.975 0.512,0.578,0.973 0.524,0.585,0.972 0.535,0.592,0.970 0.546,0.599,0.968 0.557,0.606,0.966 0.568,0.613,0.964 0.578,0.620,0.963 0.589,0.627,0.961 0.599,0.635,0.959 0.609,0.642,0.957 0.619,0.649,0.955 0.629,0.656,0.953 0.638,0.663,0.951 0.648,0.671,0.950 0.657,0.678,0.948 0.666,0.685,0.946 0.675,0.692,0.944 0.685,0.700,0.942 0.693,0.707,0.940 0.702,0.714,0.938 0.711,0.722,0.936 0.720,0.729,0.934 0.728,0.736,0.932 0.737,0.744,0.930 0.745,0.751,0.928 0.754,0.759,0.925 0.762,0.766,0.923 0.770,0.773,0.921 0.778,0.780,0.919 0.786,0.788,0.917 0.794,0.795,0.914 0.802,0.801,0.912 0.810,0.808,0.909 0.817,0.814,0.906 0.825,0.820,0.903 0.832,0.826,0.900 0.839,0.831,0.896 0.846,0.835,0.892 0.852,0.838,0.887 0.859,0.841,0.882 0.865,0.843,0.877 0.871,0.844,0.870 0.876,0.844,0.864 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C3s.csv000066400000000000000000000110001457240071200236630ustar00rootroot000000000000000.200,0.440,0.969 0.216,0.446,0.975 0.232,0.452,0.979 0.248,0.458,0.983 0.265,0.465,0.986 0.282,0.471,0.988 0.299,0.477,0.989 0.316,0.484,0.990 0.332,0.490,0.990 0.348,0.497,0.990 0.364,0.503,0.989 0.380,0.510,0.989 0.394,0.517,0.988 0.409,0.523,0.986 0.423,0.530,0.985 0.437,0.537,0.983 0.450,0.544,0.982 0.463,0.551,0.980 0.476,0.557,0.979 0.488,0.564,0.977 0.500,0.571,0.975 0.512,0.578,0.973 0.524,0.585,0.972 0.535,0.592,0.970 0.546,0.599,0.968 0.557,0.606,0.966 0.568,0.613,0.964 0.578,0.620,0.963 0.589,0.627,0.961 0.599,0.635,0.959 0.609,0.642,0.957 0.619,0.649,0.955 0.629,0.656,0.953 0.638,0.663,0.951 0.648,0.671,0.950 0.657,0.678,0.948 0.666,0.685,0.946 0.675,0.692,0.944 0.685,0.700,0.942 0.693,0.707,0.940 0.702,0.714,0.938 0.711,0.722,0.936 0.720,0.729,0.934 0.728,0.736,0.932 0.737,0.744,0.930 0.745,0.751,0.928 0.754,0.759,0.925 0.762,0.766,0.923 0.770,0.773,0.921 0.778,0.780,0.919 0.786,0.788,0.917 0.794,0.795,0.914 0.802,0.801,0.912 0.810,0.808,0.909 0.817,0.814,0.906 0.825,0.820,0.903 0.832,0.826,0.900 0.839,0.831,0.896 0.846,0.835,0.892 0.852,0.838,0.887 0.859,0.841,0.882 0.865,0.843,0.877 0.871,0.844,0.870 0.876,0.844,0.864 0.881,0.843,0.856 0.886,0.842,0.849 0.891,0.839,0.840 0.896,0.835,0.831 0.900,0.830,0.821 0.904,0.825,0.811 0.907,0.819,0.800 0.911,0.812,0.789 0.914,0.804,0.778 0.917,0.797,0.766 0.919,0.788,0.754 0.922,0.780,0.742 0.924,0.771,0.730 0.926,0.762,0.717 0.928,0.752,0.705 0.930,0.743,0.692 0.932,0.734,0.679 0.933,0.724,0.667 0.935,0.714,0.654 0.936,0.705,0.641 0.937,0.695,0.629 0.938,0.685,0.616 0.939,0.676,0.604 0.940,0.666,0.591 0.940,0.656,0.579 0.941,0.646,0.566 0.941,0.636,0.554 0.941,0.627,0.541 0.941,0.617,0.529 0.941,0.607,0.517 0.941,0.597,0.504 0.941,0.587,0.492 0.941,0.577,0.480 0.940,0.567,0.468 0.940,0.557,0.456 0.939,0.547,0.444 0.939,0.537,0.431 0.938,0.527,0.419 0.937,0.516,0.407 0.936,0.506,0.395 0.935,0.496,0.383 0.934,0.485,0.371 0.932,0.475,0.359 0.931,0.464,0.348 0.930,0.454,0.336 0.928,0.443,0.324 0.926,0.432,0.312 0.925,0.421,0.300 0.923,0.410,0.288 0.921,0.399,0.277 0.919,0.388,0.265 0.916,0.377,0.254 0.914,0.365,0.242 0.911,0.354,0.231 0.908,0.343,0.220 0.905,0.332,0.209 0.901,0.320,0.198 0.898,0.309,0.188 0.893,0.299,0.178 0.889,0.288,0.168 0.883,0.278,0.159 0.877,0.268,0.151 0.871,0.259,0.143 0.864,0.250,0.136 0.857,0.242,0.130 0.849,0.235,0.124 0.840,0.229,0.119 0.831,0.223,0.115 0.821,0.218,0.111 0.811,0.214,0.109 0.800,0.211,0.107 0.789,0.208,0.105 0.778,0.206,0.104 0.766,0.204,0.103 0.755,0.202,0.103 0.743,0.201,0.103 0.730,0.200,0.103 0.718,0.199,0.103 0.706,0.198,0.104 0.694,0.198,0.104 0.681,0.197,0.105 0.669,0.196,0.105 0.656,0.195,0.106 0.644,0.195,0.106 0.631,0.194,0.107 0.619,0.193,0.107 0.607,0.192,0.108 0.594,0.191,0.108 0.582,0.190,0.109 0.570,0.189,0.109 0.558,0.188,0.110 0.546,0.187,0.110 0.534,0.186,0.110 0.521,0.184,0.111 0.509,0.183,0.111 0.497,0.182,0.111 0.485,0.180,0.112 0.474,0.179,0.112 0.462,0.177,0.112 0.450,0.176,0.112 0.438,0.174,0.112 0.426,0.172,0.112 0.414,0.171,0.112 0.403,0.169,0.113 0.391,0.167,0.113 0.379,0.165,0.113 0.368,0.163,0.113 0.356,0.161,0.113 0.345,0.159,0.113 0.333,0.157,0.113 0.322,0.155,0.113 0.310,0.153,0.113 0.299,0.151,0.113 0.288,0.149,0.113 0.277,0.146,0.113 0.266,0.144,0.113 0.255,0.142,0.114 0.244,0.140,0.114 0.234,0.138,0.115 0.224,0.136,0.116 0.215,0.135,0.118 0.206,0.133,0.120 0.197,0.132,0.122 0.189,0.131,0.125 0.182,0.130,0.129 0.176,0.130,0.133 0.170,0.130,0.138 0.165,0.131,0.144 0.161,0.131,0.150 0.157,0.133,0.157 0.155,0.134,0.164 0.153,0.136,0.173 0.152,0.139,0.182 0.151,0.142,0.191 0.151,0.145,0.201 0.152,0.148,0.212 0.152,0.152,0.223 0.154,0.156,0.235 0.155,0.160,0.246 0.157,0.164,0.258 0.159,0.169,0.271 0.162,0.173,0.283 0.164,0.178,0.296 0.166,0.182,0.309 0.168,0.187,0.322 0.170,0.192,0.335 0.172,0.196,0.348 0.174,0.201,0.361 0.176,0.206,0.375 0.178,0.211,0.388 0.180,0.216,0.402 0.181,0.221,0.415 0.183,0.226,0.429 0.184,0.230,0.443 0.185,0.235,0.457 0.186,0.240,0.470 0.187,0.245,0.484 0.188,0.250,0.499 0.188,0.255,0.513 0.188,0.261,0.527 0.189,0.266,0.541 0.189,0.271,0.555 0.188,0.276,0.570 0.188,0.281,0.584 0.187,0.286,0.599 0.187,0.291,0.614 0.186,0.297,0.628 0.184,0.302,0.643 0.183,0.307,0.658 0.181,0.312,0.673 0.179,0.317,0.687 0.177,0.323,0.702 0.174,0.328,0.717 0.171,0.333,0.732 0.168,0.339,0.747 0.165,0.344,0.762 0.161,0.349,0.777 0.158,0.355,0.792 0.154,0.360,0.807 0.150,0.366,0.822 0.146,0.371,0.837 0.143,0.377,0.851 0.140,0.382,0.865 0.138,0.388,0.878 0.137,0.393,0.892 0.138,0.399,0.904 0.141,0.405,0.916 0.146,0.410,0.927 0.153,0.416,0.937 0.162,0.422,0.947 0.173,0.428,0.955 0.186,0.434,0.963 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C4.csv000066400000000000000000000110001457240071200235010ustar00rootroot000000000000000.873,0.836,0.849 0.878,0.834,0.841 0.882,0.831,0.832 0.886,0.827,0.823 0.889,0.821,0.812 0.892,0.815,0.802 0.895,0.808,0.790 0.897,0.800,0.778 0.898,0.792,0.766 0.900,0.783,0.753 0.901,0.773,0.740 0.902,0.763,0.727 0.903,0.753,0.713 0.903,0.743,0.700 0.904,0.732,0.686 0.904,0.722,0.672 0.904,0.711,0.658 0.903,0.700,0.644 0.903,0.689,0.630 0.902,0.678,0.617 0.902,0.667,0.603 0.901,0.656,0.589 0.900,0.645,0.575 0.899,0.634,0.562 0.898,0.623,0.548 0.896,0.612,0.534 0.895,0.601,0.521 0.893,0.589,0.507 0.892,0.578,0.494 0.890,0.567,0.480 0.888,0.556,0.467 0.886,0.545,0.454 0.884,0.533,0.440 0.881,0.522,0.427 0.879,0.511,0.414 0.876,0.500,0.401 0.874,0.488,0.388 0.871,0.477,0.375 0.868,0.465,0.362 0.866,0.454,0.349 0.863,0.442,0.336 0.859,0.430,0.323 0.856,0.419,0.310 0.853,0.407,0.297 0.850,0.395,0.284 0.846,0.383,0.271 0.843,0.371,0.259 0.839,0.358,0.246 0.835,0.346,0.233 0.832,0.334,0.221 0.828,0.321,0.208 0.824,0.309,0.196 0.820,0.296,0.184 0.816,0.284,0.172 0.813,0.271,0.161 0.809,0.260,0.150 0.805,0.248,0.139 0.802,0.237,0.130 0.799,0.226,0.120 0.796,0.217,0.112 0.794,0.209,0.105 0.792,0.202,0.099 0.791,0.196,0.095 0.790,0.193,0.092 0.789,0.191,0.090 0.789,0.191,0.090 0.790,0.193,0.092 0.791,0.198,0.096 0.793,0.203,0.101 0.795,0.211,0.107 0.797,0.219,0.114 0.800,0.229,0.123 0.803,0.240,0.132 0.806,0.251,0.142 0.810,0.263,0.153 0.814,0.275,0.164 0.817,0.287,0.176 0.821,0.300,0.187 0.825,0.312,0.199 0.829,0.324,0.212 0.833,0.337,0.224 0.836,0.349,0.237 0.840,0.362,0.249 0.844,0.374,0.262 0.847,0.386,0.275 0.851,0.398,0.288 0.854,0.410,0.300 0.857,0.422,0.313 0.860,0.433,0.326 0.863,0.445,0.339 0.866,0.457,0.352 0.869,0.468,0.365 0.872,0.480,0.378 0.875,0.491,0.391 0.877,0.503,0.404 0.880,0.514,0.418 0.882,0.525,0.431 0.884,0.537,0.444 0.886,0.548,0.457 0.888,0.559,0.471 0.890,0.570,0.484 0.892,0.581,0.497 0.894,0.592,0.511 0.895,0.604,0.524 0.897,0.615,0.538 0.898,0.626,0.552 0.899,0.637,0.565 0.900,0.648,0.579 0.901,0.659,0.593 0.902,0.670,0.607 0.902,0.681,0.620 0.903,0.692,0.634 0.903,0.703,0.648 0.903,0.713,0.662 0.903,0.724,0.676 0.903,0.735,0.690 0.902,0.745,0.703 0.901,0.755,0.717 0.900,0.764,0.731 0.899,0.774,0.744 0.897,0.782,0.757 0.894,0.790,0.770 0.891,0.798,0.782 0.888,0.804,0.794 0.884,0.810,0.806 0.880,0.815,0.816 0.875,0.818,0.827 0.870,0.821,0.836 0.864,0.822,0.844 0.857,0.822,0.852 0.851,0.821,0.859 0.843,0.819,0.865 0.836,0.816,0.871 0.828,0.812,0.875 0.819,0.807,0.879 0.811,0.802,0.883 0.802,0.795,0.886 0.793,0.788,0.888 0.784,0.781,0.890 0.775,0.773,0.891 0.765,0.765,0.892 0.756,0.757,0.893 0.746,0.749,0.894 0.737,0.740,0.895 0.727,0.731,0.895 0.717,0.723,0.896 0.707,0.714,0.896 0.697,0.705,0.897 0.687,0.697,0.897 0.677,0.688,0.897 0.667,0.679,0.897 0.657,0.670,0.898 0.646,0.662,0.898 0.636,0.653,0.898 0.625,0.644,0.898 0.615,0.636,0.898 0.604,0.627,0.899 0.593,0.619,0.899 0.582,0.610,0.899 0.571,0.602,0.899 0.559,0.593,0.899 0.548,0.585,0.899 0.536,0.576,0.899 0.524,0.568,0.899 0.512,0.560,0.899 0.500,0.551,0.899 0.487,0.543,0.899 0.475,0.535,0.899 0.462,0.526,0.899 0.448,0.518,0.899 0.435,0.510,0.899 0.421,0.502,0.899 0.406,0.494,0.899 0.392,0.486,0.899 0.376,0.478,0.899 0.361,0.470,0.899 0.344,0.462,0.899 0.328,0.455,0.898 0.311,0.447,0.898 0.293,0.440,0.898 0.274,0.433,0.898 0.255,0.426,0.898 0.236,0.420,0.898 0.216,0.414,0.898 0.196,0.409,0.897 0.177,0.404,0.897 0.157,0.400,0.897 0.139,0.396,0.897 0.123,0.393,0.897 0.110,0.391,0.897 0.101,0.390,0.897 0.099,0.390,0.897 0.102,0.390,0.897 0.112,0.392,0.897 0.126,0.394,0.897 0.143,0.397,0.897 0.161,0.400,0.897 0.181,0.405,0.897 0.201,0.410,0.897 0.221,0.415,0.898 0.240,0.421,0.898 0.260,0.428,0.898 0.278,0.435,0.898 0.297,0.442,0.898 0.314,0.449,0.898 0.331,0.456,0.898 0.348,0.464,0.899 0.364,0.472,0.899 0.380,0.480,0.899 0.395,0.488,0.899 0.409,0.496,0.899 0.424,0.504,0.899 0.438,0.512,0.899 0.451,0.520,0.899 0.465,0.528,0.899 0.477,0.536,0.899 0.490,0.545,0.899 0.503,0.553,0.899 0.515,0.561,0.899 0.527,0.570,0.899 0.539,0.578,0.899 0.550,0.586,0.899 0.562,0.595,0.899 0.573,0.603,0.899 0.584,0.612,0.899 0.595,0.620,0.899 0.606,0.629,0.899 0.617,0.638,0.898 0.628,0.646,0.898 0.638,0.655,0.898 0.648,0.664,0.898 0.659,0.672,0.898 0.669,0.681,0.897 0.679,0.690,0.897 0.689,0.698,0.897 0.699,0.707,0.897 0.709,0.716,0.896 0.719,0.725,0.896 0.729,0.734,0.896 0.739,0.742,0.895 0.748,0.751,0.895 0.758,0.760,0.894 0.767,0.768,0.894 0.776,0.777,0.893 0.785,0.785,0.892 0.794,0.793,0.891 0.803,0.800,0.889 0.811,0.807,0.888 0.820,0.814,0.886 0.828,0.820,0.883 0.835,0.825,0.880 0.843,0.829,0.877 0.850,0.833,0.873 0.856,0.835,0.868 0.862,0.837,0.862 0.868,0.837,0.856 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C4s.csv000066400000000000000000000110001457240071200236640ustar00rootroot000000000000000.102,0.390,0.897 0.112,0.392,0.897 0.126,0.394,0.897 0.143,0.397,0.897 0.161,0.400,0.897 0.181,0.405,0.897 0.201,0.410,0.897 0.221,0.415,0.898 0.240,0.421,0.898 0.260,0.428,0.898 0.278,0.435,0.898 0.297,0.442,0.898 0.314,0.449,0.898 0.331,0.456,0.898 0.348,0.464,0.899 0.364,0.472,0.899 0.380,0.480,0.899 0.395,0.488,0.899 0.409,0.496,0.899 0.424,0.504,0.899 0.438,0.512,0.899 0.451,0.520,0.899 0.465,0.528,0.899 0.477,0.536,0.899 0.490,0.545,0.899 0.503,0.553,0.899 0.515,0.561,0.899 0.527,0.570,0.899 0.539,0.578,0.899 0.550,0.586,0.899 0.562,0.595,0.899 0.573,0.603,0.899 0.584,0.612,0.899 0.595,0.620,0.899 0.606,0.629,0.899 0.617,0.638,0.898 0.628,0.646,0.898 0.638,0.655,0.898 0.648,0.664,0.898 0.659,0.672,0.898 0.669,0.681,0.897 0.679,0.690,0.897 0.689,0.698,0.897 0.699,0.707,0.897 0.709,0.716,0.896 0.719,0.725,0.896 0.729,0.734,0.896 0.739,0.742,0.895 0.748,0.751,0.895 0.758,0.760,0.894 0.767,0.768,0.894 0.776,0.777,0.893 0.785,0.785,0.892 0.794,0.793,0.891 0.803,0.800,0.889 0.811,0.807,0.888 0.820,0.814,0.886 0.828,0.820,0.883 0.835,0.825,0.880 0.843,0.829,0.877 0.850,0.833,0.873 0.856,0.835,0.868 0.862,0.837,0.862 0.868,0.837,0.856 0.873,0.836,0.849 0.878,0.834,0.841 0.882,0.831,0.832 0.886,0.827,0.823 0.889,0.821,0.812 0.892,0.815,0.802 0.895,0.808,0.790 0.897,0.800,0.778 0.898,0.792,0.766 0.900,0.783,0.753 0.901,0.773,0.740 0.902,0.763,0.727 0.903,0.753,0.713 0.903,0.743,0.700 0.904,0.732,0.686 0.904,0.722,0.672 0.904,0.711,0.658 0.903,0.700,0.644 0.903,0.689,0.630 0.902,0.678,0.617 0.902,0.667,0.603 0.901,0.656,0.589 0.900,0.645,0.575 0.899,0.634,0.562 0.898,0.623,0.548 0.896,0.612,0.534 0.895,0.601,0.521 0.893,0.589,0.507 0.892,0.578,0.494 0.890,0.567,0.480 0.888,0.556,0.467 0.886,0.545,0.454 0.884,0.533,0.440 0.881,0.522,0.427 0.879,0.511,0.414 0.876,0.500,0.401 0.874,0.488,0.388 0.871,0.477,0.375 0.868,0.465,0.362 0.866,0.454,0.349 0.863,0.442,0.336 0.859,0.430,0.323 0.856,0.419,0.310 0.853,0.407,0.297 0.850,0.395,0.284 0.846,0.383,0.271 0.843,0.371,0.259 0.839,0.358,0.246 0.835,0.346,0.233 0.832,0.334,0.221 0.828,0.321,0.208 0.824,0.309,0.196 0.820,0.296,0.184 0.816,0.284,0.172 0.813,0.271,0.161 0.809,0.260,0.150 0.805,0.248,0.139 0.802,0.237,0.130 0.799,0.226,0.120 0.796,0.217,0.112 0.794,0.209,0.105 0.792,0.202,0.099 0.791,0.196,0.095 0.790,0.193,0.092 0.789,0.191,0.090 0.789,0.191,0.090 0.790,0.193,0.092 0.791,0.198,0.096 0.793,0.203,0.101 0.795,0.211,0.107 0.797,0.219,0.114 0.800,0.229,0.123 0.803,0.240,0.132 0.806,0.251,0.142 0.810,0.263,0.153 0.814,0.275,0.164 0.817,0.287,0.176 0.821,0.300,0.187 0.825,0.312,0.199 0.829,0.324,0.212 0.833,0.337,0.224 0.836,0.349,0.237 0.840,0.362,0.249 0.844,0.374,0.262 0.847,0.386,0.275 0.851,0.398,0.288 0.854,0.410,0.300 0.857,0.422,0.313 0.860,0.433,0.326 0.863,0.445,0.339 0.866,0.457,0.352 0.869,0.468,0.365 0.872,0.480,0.378 0.875,0.491,0.391 0.877,0.503,0.404 0.880,0.514,0.418 0.882,0.525,0.431 0.884,0.537,0.444 0.886,0.548,0.457 0.888,0.559,0.471 0.890,0.570,0.484 0.892,0.581,0.497 0.894,0.592,0.511 0.895,0.604,0.524 0.897,0.615,0.538 0.898,0.626,0.552 0.899,0.637,0.565 0.900,0.648,0.579 0.901,0.659,0.593 0.902,0.670,0.607 0.902,0.681,0.620 0.903,0.692,0.634 0.903,0.703,0.648 0.903,0.713,0.662 0.903,0.724,0.676 0.903,0.735,0.690 0.902,0.745,0.703 0.901,0.755,0.717 0.900,0.764,0.731 0.899,0.774,0.744 0.897,0.782,0.757 0.894,0.790,0.770 0.891,0.798,0.782 0.888,0.804,0.794 0.884,0.810,0.806 0.880,0.815,0.816 0.875,0.818,0.827 0.870,0.821,0.836 0.864,0.822,0.844 0.857,0.822,0.852 0.851,0.821,0.859 0.843,0.819,0.865 0.836,0.816,0.871 0.828,0.812,0.875 0.819,0.807,0.879 0.811,0.802,0.883 0.802,0.795,0.886 0.793,0.788,0.888 0.784,0.781,0.890 0.775,0.773,0.891 0.765,0.765,0.892 0.756,0.757,0.893 0.746,0.749,0.894 0.737,0.740,0.895 0.727,0.731,0.895 0.717,0.723,0.896 0.707,0.714,0.896 0.697,0.705,0.897 0.687,0.697,0.897 0.677,0.688,0.897 0.667,0.679,0.897 0.657,0.670,0.898 0.646,0.662,0.898 0.636,0.653,0.898 0.625,0.644,0.898 0.615,0.636,0.898 0.604,0.627,0.899 0.593,0.619,0.899 0.582,0.610,0.899 0.571,0.602,0.899 0.559,0.593,0.899 0.548,0.585,0.899 0.536,0.576,0.899 0.524,0.568,0.899 0.512,0.560,0.899 0.500,0.551,0.899 0.487,0.543,0.899 0.475,0.535,0.899 0.462,0.526,0.899 0.448,0.518,0.899 0.435,0.510,0.899 0.421,0.502,0.899 0.406,0.494,0.899 0.392,0.486,0.899 0.376,0.478,0.899 0.361,0.470,0.899 0.344,0.462,0.899 0.328,0.455,0.898 0.311,0.447,0.898 0.293,0.440,0.898 0.274,0.433,0.898 0.255,0.426,0.898 0.236,0.420,0.898 0.216,0.414,0.898 0.196,0.409,0.897 0.177,0.404,0.897 0.157,0.400,0.897 0.139,0.396,0.897 0.123,0.393,0.897 0.110,0.391,0.897 0.101,0.390,0.897 0.099,0.390,0.897 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C5.csv000066400000000000000000000110001457240071200235020ustar00rootroot000000000000000.469,0.469,0.469 0.474,0.474,0.474 0.479,0.479,0.479 0.484,0.484,0.484 0.489,0.489,0.489 0.494,0.494,0.494 0.499,0.499,0.499 0.505,0.505,0.505 0.510,0.510,0.510 0.515,0.515,0.515 0.520,0.521,0.521 0.526,0.526,0.526 0.531,0.531,0.531 0.537,0.537,0.537 0.542,0.542,0.542 0.548,0.548,0.548 0.553,0.553,0.553 0.558,0.559,0.559 0.564,0.564,0.564 0.569,0.570,0.570 0.575,0.575,0.575 0.581,0.581,0.581 0.586,0.586,0.586 0.592,0.592,0.592 0.597,0.597,0.597 0.603,0.603,0.603 0.608,0.609,0.609 0.614,0.614,0.614 0.620,0.620,0.620 0.625,0.625,0.625 0.631,0.631,0.631 0.637,0.637,0.637 0.642,0.642,0.642 0.648,0.648,0.648 0.653,0.654,0.654 0.659,0.659,0.659 0.665,0.665,0.665 0.671,0.671,0.671 0.676,0.676,0.676 0.682,0.682,0.682 0.688,0.688,0.688 0.693,0.694,0.693 0.699,0.699,0.699 0.705,0.705,0.705 0.711,0.711,0.711 0.716,0.717,0.716 0.722,0.722,0.722 0.728,0.728,0.728 0.733,0.734,0.734 0.739,0.739,0.739 0.745,0.745,0.745 0.750,0.750,0.750 0.755,0.756,0.756 0.761,0.761,0.761 0.766,0.766,0.766 0.770,0.771,0.771 0.775,0.775,0.775 0.779,0.779,0.779 0.783,0.783,0.783 0.786,0.786,0.786 0.788,0.788,0.788 0.790,0.790,0.790 0.792,0.792,0.792 0.792,0.793,0.793 0.793,0.793,0.793 0.792,0.792,0.792 0.791,0.791,0.791 0.789,0.789,0.789 0.786,0.786,0.786 0.783,0.783,0.783 0.780,0.780,0.780 0.776,0.776,0.776 0.771,0.772,0.772 0.767,0.767,0.767 0.762,0.762,0.762 0.757,0.757,0.757 0.751,0.752,0.752 0.746,0.746,0.746 0.740,0.741,0.741 0.735,0.735,0.735 0.729,0.729,0.729 0.723,0.724,0.724 0.718,0.718,0.718 0.712,0.712,0.712 0.706,0.706,0.706 0.701,0.701,0.701 0.695,0.695,0.695 0.689,0.689,0.689 0.683,0.683,0.683 0.678,0.678,0.678 0.672,0.672,0.672 0.666,0.666,0.666 0.661,0.661,0.661 0.655,0.655,0.655 0.649,0.649,0.649 0.644,0.644,0.644 0.638,0.638,0.638 0.632,0.632,0.632 0.627,0.627,0.627 0.621,0.621,0.621 0.615,0.615,0.615 0.610,0.610,0.610 0.604,0.604,0.604 0.599,0.599,0.599 0.593,0.593,0.593 0.587,0.588,0.588 0.582,0.582,0.582 0.576,0.576,0.576 0.571,0.571,0.571 0.565,0.565,0.565 0.560,0.560,0.560 0.554,0.554,0.554 0.549,0.549,0.549 0.543,0.543,0.543 0.538,0.538,0.538 0.532,0.532,0.532 0.527,0.527,0.527 0.521,0.522,0.522 0.516,0.516,0.516 0.511,0.511,0.511 0.505,0.505,0.505 0.500,0.500,0.500 0.494,0.494,0.494 0.489,0.489,0.489 0.484,0.484,0.484 0.478,0.478,0.478 0.473,0.473,0.473 0.468,0.468,0.468 0.462,0.462,0.462 0.457,0.457,0.457 0.452,0.452,0.452 0.446,0.446,0.446 0.441,0.441,0.441 0.436,0.436,0.436 0.430,0.431,0.431 0.425,0.425,0.425 0.420,0.420,0.420 0.415,0.415,0.415 0.410,0.410,0.410 0.404,0.404,0.404 0.399,0.399,0.399 0.394,0.394,0.394 0.389,0.389,0.389 0.384,0.384,0.384 0.378,0.379,0.379 0.373,0.373,0.373 0.368,0.368,0.368 0.363,0.363,0.363 0.358,0.358,0.358 0.353,0.353,0.353 0.348,0.348,0.348 0.343,0.343,0.343 0.338,0.338,0.338 0.333,0.333,0.333 0.328,0.328,0.328 0.323,0.323,0.323 0.318,0.318,0.318 0.313,0.313,0.313 0.308,0.308,0.308 0.303,0.303,0.303 0.298,0.298,0.298 0.293,0.293,0.293 0.288,0.288,0.288 0.283,0.283,0.283 0.278,0.278,0.278 0.273,0.273,0.273 0.269,0.269,0.269 0.264,0.264,0.264 0.259,0.259,0.259 0.254,0.254,0.254 0.249,0.249,0.249 0.244,0.245,0.245 0.240,0.240,0.240 0.235,0.235,0.235 0.230,0.230,0.230 0.226,0.226,0.226 0.221,0.221,0.221 0.217,0.217,0.217 0.212,0.212,0.212 0.208,0.208,0.208 0.204,0.204,0.204 0.200,0.200,0.200 0.196,0.196,0.196 0.192,0.192,0.192 0.189,0.189,0.189 0.186,0.186,0.186 0.183,0.183,0.183 0.181,0.181,0.181 0.179,0.179,0.179 0.178,0.178,0.178 0.177,0.177,0.177 0.177,0.177,0.177 0.177,0.177,0.177 0.178,0.178,0.178 0.179,0.179,0.179 0.180,0.180,0.180 0.183,0.183,0.183 0.185,0.185,0.185 0.188,0.188,0.188 0.191,0.191,0.191 0.195,0.195,0.195 0.199,0.199,0.199 0.203,0.203,0.203 0.207,0.207,0.207 0.211,0.211,0.211 0.215,0.216,0.216 0.220,0.220,0.220 0.225,0.225,0.225 0.229,0.229,0.229 0.234,0.234,0.234 0.239,0.239,0.239 0.243,0.243,0.243 0.248,0.248,0.248 0.253,0.253,0.253 0.258,0.258,0.258 0.263,0.263,0.263 0.267,0.267,0.267 0.272,0.272,0.272 0.277,0.277,0.277 0.282,0.282,0.282 0.287,0.287,0.287 0.292,0.292,0.292 0.297,0.297,0.297 0.302,0.302,0.302 0.307,0.307,0.307 0.312,0.312,0.312 0.317,0.317,0.317 0.321,0.322,0.322 0.326,0.327,0.327 0.332,0.332,0.332 0.337,0.337,0.337 0.342,0.342,0.342 0.347,0.347,0.347 0.352,0.352,0.352 0.357,0.357,0.357 0.362,0.362,0.362 0.367,0.367,0.367 0.372,0.372,0.372 0.377,0.377,0.377 0.382,0.382,0.382 0.387,0.388,0.388 0.393,0.393,0.393 0.398,0.398,0.398 0.403,0.403,0.403 0.408,0.408,0.408 0.413,0.413,0.413 0.418,0.418,0.418 0.423,0.423,0.423 0.428,0.429,0.429 0.434,0.434,0.434 0.439,0.439,0.439 0.444,0.444,0.444 0.449,0.449,0.449 0.454,0.454,0.454 0.459,0.459,0.459 0.464,0.464,0.464 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C5s.csv000066400000000000000000000110001457240071200236650ustar00rootroot000000000000000.177,0.177,0.177 0.178,0.178,0.178 0.179,0.179,0.179 0.180,0.180,0.180 0.183,0.183,0.183 0.185,0.185,0.185 0.188,0.188,0.188 0.191,0.191,0.191 0.195,0.195,0.195 0.199,0.199,0.199 0.203,0.203,0.203 0.207,0.207,0.207 0.211,0.211,0.211 0.215,0.216,0.216 0.220,0.220,0.220 0.225,0.225,0.225 0.229,0.229,0.229 0.234,0.234,0.234 0.239,0.239,0.239 0.243,0.243,0.243 0.248,0.248,0.248 0.253,0.253,0.253 0.258,0.258,0.258 0.263,0.263,0.263 0.267,0.267,0.267 0.272,0.272,0.272 0.277,0.277,0.277 0.282,0.282,0.282 0.287,0.287,0.287 0.292,0.292,0.292 0.297,0.297,0.297 0.302,0.302,0.302 0.307,0.307,0.307 0.312,0.312,0.312 0.317,0.317,0.317 0.321,0.322,0.322 0.326,0.327,0.327 0.332,0.332,0.332 0.337,0.337,0.337 0.342,0.342,0.342 0.347,0.347,0.347 0.352,0.352,0.352 0.357,0.357,0.357 0.362,0.362,0.362 0.367,0.367,0.367 0.372,0.372,0.372 0.377,0.377,0.377 0.382,0.382,0.382 0.387,0.388,0.388 0.393,0.393,0.393 0.398,0.398,0.398 0.403,0.403,0.403 0.408,0.408,0.408 0.413,0.413,0.413 0.418,0.418,0.418 0.423,0.423,0.423 0.428,0.429,0.429 0.434,0.434,0.434 0.439,0.439,0.439 0.444,0.444,0.444 0.449,0.449,0.449 0.454,0.454,0.454 0.459,0.459,0.459 0.464,0.464,0.464 0.469,0.469,0.469 0.474,0.474,0.474 0.479,0.479,0.479 0.484,0.484,0.484 0.489,0.489,0.489 0.494,0.494,0.494 0.499,0.499,0.499 0.505,0.505,0.505 0.510,0.510,0.510 0.515,0.515,0.515 0.520,0.521,0.521 0.526,0.526,0.526 0.531,0.531,0.531 0.537,0.537,0.537 0.542,0.542,0.542 0.548,0.548,0.548 0.553,0.553,0.553 0.558,0.559,0.559 0.564,0.564,0.564 0.569,0.570,0.570 0.575,0.575,0.575 0.581,0.581,0.581 0.586,0.586,0.586 0.592,0.592,0.592 0.597,0.597,0.597 0.603,0.603,0.603 0.608,0.609,0.609 0.614,0.614,0.614 0.620,0.620,0.620 0.625,0.625,0.625 0.631,0.631,0.631 0.637,0.637,0.637 0.642,0.642,0.642 0.648,0.648,0.648 0.653,0.654,0.654 0.659,0.659,0.659 0.665,0.665,0.665 0.671,0.671,0.671 0.676,0.676,0.676 0.682,0.682,0.682 0.688,0.688,0.688 0.693,0.694,0.693 0.699,0.699,0.699 0.705,0.705,0.705 0.711,0.711,0.711 0.716,0.717,0.716 0.722,0.722,0.722 0.728,0.728,0.728 0.733,0.734,0.734 0.739,0.739,0.739 0.745,0.745,0.745 0.750,0.750,0.750 0.755,0.756,0.756 0.761,0.761,0.761 0.766,0.766,0.766 0.770,0.771,0.771 0.775,0.775,0.775 0.779,0.779,0.779 0.783,0.783,0.783 0.786,0.786,0.786 0.788,0.788,0.788 0.790,0.790,0.790 0.792,0.792,0.792 0.792,0.793,0.793 0.793,0.793,0.793 0.792,0.792,0.792 0.791,0.791,0.791 0.789,0.789,0.789 0.786,0.786,0.786 0.783,0.783,0.783 0.780,0.780,0.780 0.776,0.776,0.776 0.771,0.772,0.772 0.767,0.767,0.767 0.762,0.762,0.762 0.757,0.757,0.757 0.751,0.752,0.752 0.746,0.746,0.746 0.740,0.741,0.741 0.735,0.735,0.735 0.729,0.729,0.729 0.723,0.724,0.724 0.718,0.718,0.718 0.712,0.712,0.712 0.706,0.706,0.706 0.701,0.701,0.701 0.695,0.695,0.695 0.689,0.689,0.689 0.683,0.683,0.683 0.678,0.678,0.678 0.672,0.672,0.672 0.666,0.666,0.666 0.661,0.661,0.661 0.655,0.655,0.655 0.649,0.649,0.649 0.644,0.644,0.644 0.638,0.638,0.638 0.632,0.632,0.632 0.627,0.627,0.627 0.621,0.621,0.621 0.615,0.615,0.615 0.610,0.610,0.610 0.604,0.604,0.604 0.599,0.599,0.599 0.593,0.593,0.593 0.587,0.588,0.588 0.582,0.582,0.582 0.576,0.576,0.576 0.571,0.571,0.571 0.565,0.565,0.565 0.560,0.560,0.560 0.554,0.554,0.554 0.549,0.549,0.549 0.543,0.543,0.543 0.538,0.538,0.538 0.532,0.532,0.532 0.527,0.527,0.527 0.521,0.522,0.522 0.516,0.516,0.516 0.511,0.511,0.511 0.505,0.505,0.505 0.500,0.500,0.500 0.494,0.494,0.494 0.489,0.489,0.489 0.484,0.484,0.484 0.478,0.478,0.478 0.473,0.473,0.473 0.468,0.468,0.468 0.462,0.462,0.462 0.457,0.457,0.457 0.452,0.452,0.452 0.446,0.446,0.446 0.441,0.441,0.441 0.436,0.436,0.436 0.430,0.431,0.431 0.425,0.425,0.425 0.420,0.420,0.420 0.415,0.415,0.415 0.410,0.410,0.410 0.404,0.404,0.404 0.399,0.399,0.399 0.394,0.394,0.394 0.389,0.389,0.389 0.384,0.384,0.384 0.378,0.379,0.379 0.373,0.373,0.373 0.368,0.368,0.368 0.363,0.363,0.363 0.358,0.358,0.358 0.353,0.353,0.353 0.348,0.348,0.348 0.343,0.343,0.343 0.338,0.338,0.338 0.333,0.333,0.333 0.328,0.328,0.328 0.323,0.323,0.323 0.318,0.318,0.318 0.313,0.313,0.313 0.308,0.308,0.308 0.303,0.303,0.303 0.298,0.298,0.298 0.293,0.293,0.293 0.288,0.288,0.288 0.283,0.283,0.283 0.278,0.278,0.278 0.273,0.273,0.273 0.269,0.269,0.269 0.264,0.264,0.264 0.259,0.259,0.259 0.254,0.254,0.254 0.249,0.249,0.249 0.244,0.245,0.245 0.240,0.240,0.240 0.235,0.235,0.235 0.230,0.230,0.230 0.226,0.226,0.226 0.221,0.221,0.221 0.217,0.217,0.217 0.212,0.212,0.212 0.208,0.208,0.208 0.204,0.204,0.204 0.200,0.200,0.200 0.196,0.196,0.196 0.192,0.192,0.192 0.189,0.189,0.189 0.186,0.186,0.186 0.183,0.183,0.183 0.181,0.181,0.181 0.179,0.179,0.179 0.178,0.178,0.178 0.177,0.177,0.177 0.177,0.177,0.177 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C6.csv000066400000000000000000000110001457240071200235030ustar00rootroot000000000000000.967,0.214,0.103 0.967,0.220,0.092 0.966,0.228,0.082 0.967,0.239,0.072 0.967,0.252,0.063 0.968,0.266,0.055 0.969,0.282,0.047 0.971,0.298,0.040 0.972,0.315,0.033 0.974,0.333,0.027 0.976,0.350,0.023 0.978,0.368,0.019 0.980,0.386,0.015 0.983,0.403,0.012 0.985,0.421,0.010 0.987,0.438,0.007 0.989,0.455,0.005 0.991,0.472,0.003 0.992,0.489,0.001 0.994,0.505,0.000 0.996,0.522,0.000 0.998,0.538,0.000 0.999,0.554,0.000 1.000,0.569,0.000 1.000,0.585,0.000 1.000,0.600,0.000 1.000,0.616,0.000 1.000,0.631,0.000 1.000,0.646,0.000 1.000,0.660,0.000 1.000,0.675,0.000 1.000,0.689,0.000 1.000,0.703,0.000 1.000,0.717,0.000 1.000,0.730,0.000 1.000,0.743,0.000 0.997,0.755,0.000 0.993,0.766,0.000 0.988,0.777,0.000 0.983,0.787,0.000 0.976,0.795,0.000 0.968,0.803,0.000 0.959,0.809,0.000 0.949,0.814,0.000 0.938,0.817,0.000 0.925,0.820,0.000 0.912,0.821,0.000 0.898,0.821,0.000 0.883,0.820,0.000 0.868,0.817,0.000 0.852,0.814,0.000 0.835,0.810,0.000 0.818,0.805,0.000 0.801,0.800,0.000 0.783,0.794,0.000 0.765,0.788,0.000 0.747,0.781,0.000 0.729,0.774,0.000 0.711,0.767,0.000 0.692,0.760,0.000 0.674,0.752,0.000 0.655,0.745,0.000 0.637,0.737,0.000 0.618,0.730,0.000 0.600,0.722,0.000 0.581,0.714,0.000 0.562,0.707,0.001 0.543,0.699,0.003 0.524,0.691,0.004 0.505,0.684,0.006 0.486,0.676,0.008 0.467,0.668,0.010 0.448,0.661,0.014 0.429,0.654,0.017 0.409,0.647,0.022 0.390,0.640,0.027 0.371,0.633,0.034 0.352,0.627,0.042 0.334,0.621,0.051 0.316,0.616,0.061 0.298,0.611,0.071 0.281,0.607,0.082 0.265,0.604,0.094 0.249,0.602,0.106 0.235,0.601,0.119 0.222,0.601,0.133 0.210,0.601,0.147 0.199,0.603,0.162 0.190,0.606,0.177 0.183,0.610,0.193 0.177,0.614,0.210 0.173,0.620,0.227 0.170,0.626,0.244 0.169,0.632,0.262 0.169,0.640,0.281 0.169,0.648,0.299 0.171,0.656,0.318 0.173,0.665,0.337 0.176,0.674,0.356 0.179,0.683,0.375 0.181,0.692,0.395 0.184,0.702,0.414 0.187,0.711,0.434 0.190,0.721,0.454 0.192,0.731,0.473 0.194,0.741,0.493 0.195,0.751,0.513 0.196,0.760,0.533 0.197,0.770,0.552 0.198,0.780,0.572 0.197,0.790,0.592 0.197,0.800,0.612 0.196,0.810,0.632 0.194,0.820,0.652 0.192,0.830,0.672 0.190,0.839,0.692 0.187,0.848,0.712 0.183,0.858,0.732 0.180,0.866,0.752 0.176,0.874,0.771 0.172,0.882,0.790 0.167,0.889,0.809 0.163,0.895,0.827 0.159,0.901,0.845 0.155,0.905,0.862 0.151,0.908,0.878 0.149,0.910,0.893 0.147,0.911,0.907 0.146,0.911,0.920 0.146,0.909,0.932 0.147,0.906,0.943 0.149,0.901,0.953 0.152,0.896,0.961 0.156,0.889,0.969 0.160,0.881,0.975 0.164,0.873,0.980 0.168,0.863,0.985 0.172,0.853,0.989 0.176,0.843,0.992 0.180,0.832,0.995 0.183,0.820,0.997 0.186,0.809,0.999 0.188,0.797,1.000 0.190,0.785,1.000 0.192,0.773,1.000 0.193,0.760,1.000 0.193,0.748,1.000 0.193,0.736,1.000 0.192,0.723,1.000 0.191,0.711,1.000 0.189,0.699,1.000 0.187,0.687,1.000 0.184,0.674,1.000 0.181,0.662,1.000 0.177,0.650,1.000 0.173,0.638,1.000 0.169,0.626,1.000 0.165,0.614,1.000 0.161,0.603,1.000 0.158,0.591,1.000 0.156,0.580,1.000 0.155,0.570,1.000 0.155,0.559,1.000 0.158,0.550,1.000 0.163,0.541,1.000 0.170,0.533,1.000 0.180,0.525,1.000 0.193,0.519,1.000 0.207,0.513,1.000 0.224,0.509,1.000 0.242,0.506,1.000 0.262,0.504,1.000 0.283,0.503,1.000 0.304,0.503,1.000 0.326,0.504,1.000 0.348,0.507,1.000 0.370,0.510,1.000 0.392,0.514,1.000 0.414,0.519,1.000 0.435,0.525,1.000 0.457,0.531,1.000 0.478,0.538,1.000 0.498,0.546,1.000 0.518,0.553,1.000 0.538,0.561,1.000 0.558,0.570,1.000 0.577,0.578,1.000 0.595,0.586,1.000 0.614,0.595,1.000 0.632,0.604,1.000 0.649,0.613,1.000 0.667,0.622,1.000 0.684,0.631,1.000 0.701,0.640,1.000 0.718,0.648,1.000 0.734,0.657,1.000 0.751,0.666,1.000 0.767,0.675,1.000 0.783,0.684,1.000 0.799,0.692,1.000 0.814,0.701,1.000 0.830,0.709,1.000 0.845,0.716,1.000 0.861,0.723,1.000 0.876,0.730,1.000 0.890,0.736,1.000 0.905,0.740,0.994 0.919,0.744,0.987 0.932,0.747,0.979 0.945,0.749,0.970 0.957,0.750,0.959 0.969,0.749,0.947 0.980,0.747,0.934 0.990,0.743,0.920 0.999,0.738,0.904 1.000,0.732,0.887 1.000,0.725,0.870 1.000,0.716,0.851 1.000,0.707,0.832 1.000,0.696,0.812 1.000,0.685,0.792 1.000,0.673,0.771 1.000,0.661,0.750 1.000,0.648,0.729 1.000,0.635,0.707 1.000,0.621,0.686 1.000,0.607,0.664 1.000,0.593,0.643 1.000,0.579,0.621 1.000,0.564,0.600 1.000,0.549,0.578 1.000,0.535,0.557 1.000,0.520,0.536 1.000,0.505,0.515 1.000,0.489,0.494 1.000,0.474,0.473 1.000,0.458,0.452 1.000,0.443,0.431 1.000,0.427,0.411 1.000,0.411,0.390 1.000,0.395,0.370 1.000,0.378,0.350 1.000,0.362,0.330 1.000,0.346,0.310 1.000,0.329,0.291 0.999,0.313,0.272 0.995,0.297,0.254 0.991,0.282,0.235 0.987,0.267,0.218 0.984,0.253,0.201 0.980,0.240,0.185 0.977,0.230,0.169 0.974,0.221,0.154 0.972,0.215,0.140 0.970,0.212,0.127 0.968,0.211,0.115 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C6s.csv000066400000000000000000000110001457240071200236660ustar00rootroot000000000000000.684,0.631,1.000 0.701,0.640,1.000 0.718,0.648,1.000 0.734,0.657,1.000 0.751,0.666,1.000 0.767,0.675,1.000 0.783,0.684,1.000 0.799,0.692,1.000 0.814,0.701,1.000 0.830,0.709,1.000 0.845,0.716,1.000 0.861,0.723,1.000 0.876,0.730,1.000 0.890,0.736,1.000 0.905,0.740,0.994 0.919,0.744,0.987 0.932,0.747,0.979 0.945,0.749,0.970 0.957,0.750,0.959 0.969,0.749,0.947 0.980,0.747,0.934 0.990,0.743,0.920 0.999,0.738,0.904 1.000,0.732,0.887 1.000,0.725,0.870 1.000,0.716,0.851 1.000,0.707,0.832 1.000,0.696,0.812 1.000,0.685,0.792 1.000,0.673,0.771 1.000,0.661,0.750 1.000,0.648,0.729 1.000,0.635,0.707 1.000,0.621,0.686 1.000,0.607,0.664 1.000,0.593,0.643 1.000,0.579,0.621 1.000,0.564,0.600 1.000,0.549,0.578 1.000,0.535,0.557 1.000,0.520,0.536 1.000,0.505,0.515 1.000,0.489,0.494 1.000,0.474,0.473 1.000,0.458,0.452 1.000,0.443,0.431 1.000,0.427,0.411 1.000,0.411,0.390 1.000,0.395,0.370 1.000,0.378,0.350 1.000,0.362,0.330 1.000,0.346,0.310 1.000,0.329,0.291 0.999,0.313,0.272 0.995,0.297,0.254 0.991,0.282,0.235 0.987,0.267,0.218 0.984,0.253,0.201 0.980,0.240,0.185 0.977,0.230,0.169 0.974,0.221,0.154 0.972,0.215,0.140 0.970,0.212,0.127 0.968,0.211,0.115 0.967,0.214,0.103 0.967,0.220,0.092 0.966,0.228,0.082 0.967,0.239,0.072 0.967,0.252,0.063 0.968,0.266,0.055 0.969,0.282,0.047 0.971,0.298,0.040 0.972,0.315,0.033 0.974,0.333,0.027 0.976,0.350,0.023 0.978,0.368,0.019 0.980,0.386,0.015 0.983,0.403,0.012 0.985,0.421,0.010 0.987,0.438,0.007 0.989,0.455,0.005 0.991,0.472,0.003 0.992,0.489,0.001 0.994,0.505,0.000 0.996,0.522,0.000 0.998,0.538,0.000 0.999,0.554,0.000 1.000,0.569,0.000 1.000,0.585,0.000 1.000,0.600,0.000 1.000,0.616,0.000 1.000,0.631,0.000 1.000,0.646,0.000 1.000,0.660,0.000 1.000,0.675,0.000 1.000,0.689,0.000 1.000,0.703,0.000 1.000,0.717,0.000 1.000,0.730,0.000 1.000,0.743,0.000 0.997,0.755,0.000 0.993,0.766,0.000 0.988,0.777,0.000 0.983,0.787,0.000 0.976,0.795,0.000 0.968,0.803,0.000 0.959,0.809,0.000 0.949,0.814,0.000 0.938,0.817,0.000 0.925,0.820,0.000 0.912,0.821,0.000 0.898,0.821,0.000 0.883,0.820,0.000 0.868,0.817,0.000 0.852,0.814,0.000 0.835,0.810,0.000 0.818,0.805,0.000 0.801,0.800,0.000 0.783,0.794,0.000 0.765,0.788,0.000 0.747,0.781,0.000 0.729,0.774,0.000 0.711,0.767,0.000 0.692,0.760,0.000 0.674,0.752,0.000 0.655,0.745,0.000 0.637,0.737,0.000 0.618,0.730,0.000 0.600,0.722,0.000 0.581,0.714,0.000 0.562,0.707,0.001 0.543,0.699,0.003 0.524,0.691,0.004 0.505,0.684,0.006 0.486,0.676,0.008 0.467,0.668,0.010 0.448,0.661,0.014 0.429,0.654,0.017 0.409,0.647,0.022 0.390,0.640,0.027 0.371,0.633,0.034 0.352,0.627,0.042 0.334,0.621,0.051 0.316,0.616,0.061 0.298,0.611,0.071 0.281,0.607,0.082 0.265,0.604,0.094 0.249,0.602,0.106 0.235,0.601,0.119 0.222,0.601,0.133 0.210,0.601,0.147 0.199,0.603,0.162 0.190,0.606,0.177 0.183,0.610,0.193 0.177,0.614,0.210 0.173,0.620,0.227 0.170,0.626,0.244 0.169,0.632,0.262 0.169,0.640,0.281 0.169,0.648,0.299 0.171,0.656,0.318 0.173,0.665,0.337 0.176,0.674,0.356 0.179,0.683,0.375 0.181,0.692,0.395 0.184,0.702,0.414 0.187,0.711,0.434 0.190,0.721,0.454 0.192,0.731,0.473 0.194,0.741,0.493 0.195,0.751,0.513 0.196,0.760,0.533 0.197,0.770,0.552 0.198,0.780,0.572 0.197,0.790,0.592 0.197,0.800,0.612 0.196,0.810,0.632 0.194,0.820,0.652 0.192,0.830,0.672 0.190,0.839,0.692 0.187,0.848,0.712 0.183,0.858,0.732 0.180,0.866,0.752 0.176,0.874,0.771 0.172,0.882,0.790 0.167,0.889,0.809 0.163,0.895,0.827 0.159,0.901,0.845 0.155,0.905,0.862 0.151,0.908,0.878 0.149,0.910,0.893 0.147,0.911,0.907 0.146,0.911,0.920 0.146,0.909,0.932 0.147,0.906,0.943 0.149,0.901,0.953 0.152,0.896,0.961 0.156,0.889,0.969 0.160,0.881,0.975 0.164,0.873,0.980 0.168,0.863,0.985 0.172,0.853,0.989 0.176,0.843,0.992 0.180,0.832,0.995 0.183,0.820,0.997 0.186,0.809,0.999 0.188,0.797,1.000 0.190,0.785,1.000 0.192,0.773,1.000 0.193,0.760,1.000 0.193,0.748,1.000 0.193,0.736,1.000 0.192,0.723,1.000 0.191,0.711,1.000 0.189,0.699,1.000 0.187,0.687,1.000 0.184,0.674,1.000 0.181,0.662,1.000 0.177,0.650,1.000 0.173,0.638,1.000 0.169,0.626,1.000 0.165,0.614,1.000 0.161,0.603,1.000 0.158,0.591,1.000 0.156,0.580,1.000 0.155,0.570,1.000 0.155,0.559,1.000 0.158,0.550,1.000 0.163,0.541,1.000 0.170,0.533,1.000 0.180,0.525,1.000 0.193,0.519,1.000 0.207,0.513,1.000 0.224,0.509,1.000 0.242,0.506,1.000 0.262,0.504,1.000 0.283,0.503,1.000 0.304,0.503,1.000 0.326,0.504,1.000 0.348,0.507,1.000 0.370,0.510,1.000 0.392,0.514,1.000 0.414,0.519,1.000 0.435,0.525,1.000 0.457,0.531,1.000 0.478,0.538,1.000 0.498,0.546,1.000 0.518,0.553,1.000 0.538,0.561,1.000 0.558,0.570,1.000 0.577,0.578,1.000 0.595,0.586,1.000 0.614,0.595,1.000 0.632,0.604,1.000 0.649,0.613,1.000 0.667,0.622,1.000 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C7.csv000066400000000000000000000110001457240071200235040ustar00rootroot000000000000000.914,0.894,0.098 0.920,0.891,0.123 0.926,0.887,0.147 0.932,0.882,0.171 0.937,0.876,0.193 0.942,0.869,0.215 0.947,0.862,0.236 0.951,0.854,0.256 0.955,0.846,0.275 0.959,0.837,0.294 0.963,0.829,0.312 0.966,0.820,0.330 0.970,0.811,0.346 0.973,0.802,0.363 0.976,0.793,0.379 0.980,0.784,0.394 0.983,0.774,0.409 0.985,0.765,0.423 0.988,0.756,0.438 0.991,0.747,0.452 0.993,0.737,0.465 0.996,0.728,0.479 0.998,0.718,0.492 1.000,0.709,0.505 1.000,0.699,0.518 1.000,0.689,0.531 1.000,0.680,0.544 1.000,0.670,0.556 1.000,0.660,0.568 1.000,0.650,0.581 1.000,0.640,0.593 1.000,0.630,0.605 1.000,0.619,0.617 1.000,0.609,0.629 1.000,0.598,0.641 1.000,0.588,0.652 1.000,0.577,0.664 1.000,0.566,0.676 1.000,0.555,0.687 1.000,0.544,0.699 1.000,0.533,0.710 1.000,0.522,0.722 1.000,0.510,0.733 1.000,0.498,0.745 1.000,0.486,0.756 1.000,0.474,0.767 1.000,0.462,0.779 1.000,0.449,0.790 1.000,0.436,0.801 1.000,0.423,0.812 1.000,0.409,0.824 1.000,0.395,0.835 1.000,0.381,0.846 1.000,0.366,0.857 1.000,0.351,0.868 1.000,0.336,0.879 1.000,0.321,0.890 1.000,0.306,0.901 1.000,0.291,0.912 1.000,0.277,0.923 1.000,0.265,0.933 0.999,0.255,0.942 0.996,0.248,0.951 0.992,0.245,0.960 0.987,0.246,0.967 0.983,0.250,0.974 0.978,0.259,0.979 0.973,0.270,0.984 0.967,0.284,0.988 0.962,0.300,0.990 0.956,0.316,0.993 0.950,0.334,0.994 0.944,0.351,0.995 0.938,0.369,0.996 0.932,0.386,0.997 0.926,0.402,0.997 0.920,0.419,0.997 0.913,0.435,0.997 0.907,0.450,0.997 0.900,0.465,0.997 0.893,0.480,0.997 0.886,0.494,0.997 0.879,0.507,0.997 0.872,0.521,0.997 0.865,0.534,0.997 0.858,0.547,0.997 0.850,0.560,0.997 0.842,0.572,0.996 0.835,0.584,0.996 0.827,0.596,0.996 0.818,0.608,0.996 0.810,0.620,0.996 0.802,0.631,0.996 0.793,0.642,0.996 0.784,0.653,0.996 0.775,0.664,0.995 0.766,0.675,0.995 0.756,0.686,0.995 0.747,0.697,0.995 0.737,0.707,0.995 0.726,0.718,0.995 0.716,0.728,0.994 0.705,0.738,0.994 0.694,0.748,0.994 0.683,0.758,0.994 0.671,0.768,0.994 0.659,0.778,0.993 0.647,0.788,0.993 0.634,0.798,0.993 0.620,0.807,0.993 0.607,0.817,0.992 0.592,0.826,0.992 0.578,0.836,0.992 0.562,0.845,0.992 0.546,0.855,0.991 0.529,0.864,0.991 0.511,0.873,0.990 0.493,0.882,0.990 0.473,0.891,0.989 0.453,0.900,0.988 0.431,0.908,0.987 0.408,0.916,0.985 0.385,0.924,0.983 0.360,0.931,0.980 0.334,0.937,0.976 0.308,0.943,0.972 0.282,0.947,0.966 0.257,0.951,0.959 0.232,0.953,0.951 0.209,0.955,0.942 0.189,0.955,0.933 0.173,0.954,0.922 0.160,0.952,0.910 0.152,0.949,0.898 0.148,0.946,0.886 0.147,0.942,0.873 0.149,0.938,0.860 0.153,0.934,0.847 0.157,0.929,0.834 0.162,0.924,0.820 0.167,0.919,0.807 0.172,0.914,0.793 0.177,0.909,0.780 0.181,0.904,0.767 0.185,0.899,0.753 0.188,0.894,0.740 0.191,0.889,0.726 0.194,0.884,0.713 0.196,0.879,0.700 0.198,0.873,0.687 0.199,0.868,0.673 0.201,0.863,0.660 0.202,0.858,0.647 0.202,0.853,0.633 0.203,0.848,0.620 0.203,0.843,0.607 0.203,0.838,0.594 0.203,0.833,0.581 0.202,0.828,0.567 0.201,0.823,0.554 0.200,0.819,0.541 0.199,0.814,0.528 0.198,0.809,0.515 0.196,0.804,0.501 0.194,0.799,0.488 0.192,0.794,0.475 0.189,0.789,0.462 0.187,0.784,0.448 0.184,0.779,0.435 0.181,0.774,0.422 0.177,0.769,0.408 0.174,0.764,0.395 0.170,0.760,0.381 0.166,0.755,0.368 0.161,0.750,0.354 0.156,0.745,0.340 0.151,0.740,0.326 0.146,0.735,0.312 0.140,0.730,0.298 0.134,0.726,0.284 0.128,0.721,0.269 0.122,0.716,0.255 0.116,0.712,0.240 0.111,0.707,0.224 0.107,0.703,0.209 0.104,0.699,0.193 0.103,0.695,0.177 0.105,0.692,0.160 0.109,0.690,0.144 0.116,0.688,0.128 0.126,0.686,0.111 0.138,0.686,0.095 0.152,0.686,0.078 0.167,0.686,0.062 0.183,0.688,0.046 0.199,0.690,0.031 0.216,0.692,0.019 0.232,0.695,0.009 0.249,0.698,0.002 0.265,0.702,0.000 0.281,0.705,0.000 0.296,0.709,0.000 0.311,0.713,0.000 0.326,0.717,0.000 0.340,0.721,0.000 0.354,0.725,0.000 0.368,0.729,0.000 0.382,0.733,0.000 0.395,0.737,0.000 0.408,0.741,0.000 0.421,0.745,0.000 0.433,0.749,0.000 0.446,0.753,0.000 0.458,0.757,0.000 0.470,0.761,0.000 0.482,0.765,0.000 0.494,0.769,0.000 0.506,0.773,0.000 0.518,0.777,0.000 0.529,0.781,0.000 0.541,0.785,0.000 0.552,0.789,0.000 0.564,0.792,0.000 0.575,0.796,0.000 0.586,0.800,0.000 0.597,0.804,0.000 0.609,0.808,0.000 0.620,0.812,0.000 0.631,0.816,0.000 0.642,0.820,0.000 0.653,0.823,0.000 0.664,0.827,0.000 0.675,0.831,0.000 0.686,0.835,0.000 0.696,0.839,0.000 0.707,0.842,0.000 0.718,0.846,0.000 0.729,0.850,0.000 0.740,0.854,0.000 0.750,0.858,0.000 0.761,0.861,0.000 0.772,0.865,0.000 0.782,0.869,0.000 0.793,0.873,0.000 0.803,0.876,0.000 0.814,0.880,0.000 0.824,0.883,0.000 0.835,0.887,0.000 0.845,0.890,0.000 0.855,0.892,0.000 0.864,0.895,0.000 0.874,0.897,0.000 0.883,0.898,0.000 0.891,0.898,0.012 0.899,0.898,0.042 0.907,0.897,0.072 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-C7s.csv000066400000000000000000000110001457240071200236670ustar00rootroot000000000000000.152,0.686,0.078 0.167,0.686,0.062 0.183,0.688,0.046 0.199,0.690,0.031 0.216,0.692,0.019 0.232,0.695,0.009 0.249,0.698,0.002 0.265,0.702,0.000 0.281,0.705,0.000 0.296,0.709,0.000 0.311,0.713,0.000 0.326,0.717,0.000 0.340,0.721,0.000 0.354,0.725,0.000 0.368,0.729,0.000 0.382,0.733,0.000 0.395,0.737,0.000 0.408,0.741,0.000 0.421,0.745,0.000 0.433,0.749,0.000 0.446,0.753,0.000 0.458,0.757,0.000 0.470,0.761,0.000 0.482,0.765,0.000 0.494,0.769,0.000 0.506,0.773,0.000 0.518,0.777,0.000 0.529,0.781,0.000 0.541,0.785,0.000 0.552,0.789,0.000 0.564,0.792,0.000 0.575,0.796,0.000 0.586,0.800,0.000 0.597,0.804,0.000 0.609,0.808,0.000 0.620,0.812,0.000 0.631,0.816,0.000 0.642,0.820,0.000 0.653,0.823,0.000 0.664,0.827,0.000 0.675,0.831,0.000 0.686,0.835,0.000 0.696,0.839,0.000 0.707,0.842,0.000 0.718,0.846,0.000 0.729,0.850,0.000 0.740,0.854,0.000 0.750,0.858,0.000 0.761,0.861,0.000 0.772,0.865,0.000 0.782,0.869,0.000 0.793,0.873,0.000 0.803,0.876,0.000 0.814,0.880,0.000 0.824,0.883,0.000 0.835,0.887,0.000 0.845,0.890,0.000 0.855,0.892,0.000 0.864,0.895,0.000 0.874,0.897,0.000 0.883,0.898,0.000 0.891,0.898,0.012 0.899,0.898,0.042 0.907,0.897,0.072 0.914,0.894,0.098 0.920,0.891,0.123 0.926,0.887,0.147 0.932,0.882,0.171 0.937,0.876,0.193 0.942,0.869,0.215 0.947,0.862,0.236 0.951,0.854,0.256 0.955,0.846,0.275 0.959,0.837,0.294 0.963,0.829,0.312 0.966,0.820,0.330 0.970,0.811,0.346 0.973,0.802,0.363 0.976,0.793,0.379 0.980,0.784,0.394 0.983,0.774,0.409 0.985,0.765,0.423 0.988,0.756,0.438 0.991,0.747,0.452 0.993,0.737,0.465 0.996,0.728,0.479 0.998,0.718,0.492 1.000,0.709,0.505 1.000,0.699,0.518 1.000,0.689,0.531 1.000,0.680,0.544 1.000,0.670,0.556 1.000,0.660,0.568 1.000,0.650,0.581 1.000,0.640,0.593 1.000,0.630,0.605 1.000,0.619,0.617 1.000,0.609,0.629 1.000,0.598,0.641 1.000,0.588,0.652 1.000,0.577,0.664 1.000,0.566,0.676 1.000,0.555,0.687 1.000,0.544,0.699 1.000,0.533,0.710 1.000,0.522,0.722 1.000,0.510,0.733 1.000,0.498,0.745 1.000,0.486,0.756 1.000,0.474,0.767 1.000,0.462,0.779 1.000,0.449,0.790 1.000,0.436,0.801 1.000,0.423,0.812 1.000,0.409,0.824 1.000,0.395,0.835 1.000,0.381,0.846 1.000,0.366,0.857 1.000,0.351,0.868 1.000,0.336,0.879 1.000,0.321,0.890 1.000,0.306,0.901 1.000,0.291,0.912 1.000,0.277,0.923 1.000,0.265,0.933 0.999,0.255,0.942 0.996,0.248,0.951 0.992,0.245,0.960 0.987,0.246,0.967 0.983,0.250,0.974 0.978,0.259,0.979 0.973,0.270,0.984 0.967,0.284,0.988 0.962,0.300,0.990 0.956,0.316,0.993 0.950,0.334,0.994 0.944,0.351,0.995 0.938,0.369,0.996 0.932,0.386,0.997 0.926,0.402,0.997 0.920,0.419,0.997 0.913,0.435,0.997 0.907,0.450,0.997 0.900,0.465,0.997 0.893,0.480,0.997 0.886,0.494,0.997 0.879,0.507,0.997 0.872,0.521,0.997 0.865,0.534,0.997 0.858,0.547,0.997 0.850,0.560,0.997 0.842,0.572,0.996 0.835,0.584,0.996 0.827,0.596,0.996 0.818,0.608,0.996 0.810,0.620,0.996 0.802,0.631,0.996 0.793,0.642,0.996 0.784,0.653,0.996 0.775,0.664,0.995 0.766,0.675,0.995 0.756,0.686,0.995 0.747,0.697,0.995 0.737,0.707,0.995 0.726,0.718,0.995 0.716,0.728,0.994 0.705,0.738,0.994 0.694,0.748,0.994 0.683,0.758,0.994 0.671,0.768,0.994 0.659,0.778,0.993 0.647,0.788,0.993 0.634,0.798,0.993 0.620,0.807,0.993 0.607,0.817,0.992 0.592,0.826,0.992 0.578,0.836,0.992 0.562,0.845,0.992 0.546,0.855,0.991 0.529,0.864,0.991 0.511,0.873,0.990 0.493,0.882,0.990 0.473,0.891,0.989 0.453,0.900,0.988 0.431,0.908,0.987 0.408,0.916,0.985 0.385,0.924,0.983 0.360,0.931,0.980 0.334,0.937,0.976 0.308,0.943,0.972 0.282,0.947,0.966 0.257,0.951,0.959 0.232,0.953,0.951 0.209,0.955,0.942 0.189,0.955,0.933 0.173,0.954,0.922 0.160,0.952,0.910 0.152,0.949,0.898 0.148,0.946,0.886 0.147,0.942,0.873 0.149,0.938,0.860 0.153,0.934,0.847 0.157,0.929,0.834 0.162,0.924,0.820 0.167,0.919,0.807 0.172,0.914,0.793 0.177,0.909,0.780 0.181,0.904,0.767 0.185,0.899,0.753 0.188,0.894,0.740 0.191,0.889,0.726 0.194,0.884,0.713 0.196,0.879,0.700 0.198,0.873,0.687 0.199,0.868,0.673 0.201,0.863,0.660 0.202,0.858,0.647 0.202,0.853,0.633 0.203,0.848,0.620 0.203,0.843,0.607 0.203,0.838,0.594 0.203,0.833,0.581 0.202,0.828,0.567 0.201,0.823,0.554 0.200,0.819,0.541 0.199,0.814,0.528 0.198,0.809,0.515 0.196,0.804,0.501 0.194,0.799,0.488 0.192,0.794,0.475 0.189,0.789,0.462 0.187,0.784,0.448 0.184,0.779,0.435 0.181,0.774,0.422 0.177,0.769,0.408 0.174,0.764,0.395 0.170,0.760,0.381 0.166,0.755,0.368 0.161,0.750,0.354 0.156,0.745,0.340 0.151,0.740,0.326 0.146,0.735,0.312 0.140,0.730,0.298 0.134,0.726,0.284 0.128,0.721,0.269 0.122,0.716,0.255 0.116,0.712,0.240 0.111,0.707,0.224 0.107,0.703,0.209 0.104,0.699,0.193 0.103,0.695,0.177 0.105,0.692,0.160 0.109,0.690,0.144 0.116,0.688,0.128 0.126,0.686,0.111 0.138,0.686,0.095 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-CBC1.csv000066400000000000000000000110001457240071200237030ustar00rootroot000000000000000.244,0.528,0.918 0.254,0.534,0.923 0.267,0.539,0.928 0.280,0.545,0.931 0.294,0.551,0.934 0.309,0.557,0.936 0.324,0.563,0.938 0.340,0.569,0.939 0.355,0.575,0.940 0.370,0.581,0.941 0.384,0.587,0.942 0.399,0.593,0.942 0.413,0.599,0.943 0.426,0.606,0.943 0.440,0.612,0.944 0.453,0.618,0.944 0.466,0.624,0.945 0.478,0.631,0.945 0.491,0.637,0.945 0.503,0.644,0.946 0.515,0.650,0.946 0.526,0.656,0.947 0.538,0.663,0.947 0.549,0.669,0.947 0.561,0.676,0.948 0.572,0.682,0.948 0.583,0.689,0.948 0.593,0.695,0.949 0.604,0.702,0.949 0.615,0.708,0.949 0.625,0.715,0.950 0.636,0.722,0.950 0.646,0.728,0.950 0.656,0.735,0.951 0.666,0.742,0.951 0.676,0.748,0.951 0.686,0.755,0.951 0.696,0.762,0.952 0.706,0.768,0.952 0.716,0.775,0.952 0.726,0.782,0.952 0.735,0.789,0.952 0.745,0.795,0.953 0.754,0.802,0.953 0.764,0.809,0.953 0.773,0.816,0.953 0.783,0.823,0.953 0.792,0.829,0.954 0.801,0.836,0.954 0.811,0.843,0.954 0.820,0.850,0.954 0.829,0.857,0.954 0.838,0.864,0.954 0.847,0.870,0.954 0.856,0.877,0.953 0.865,0.884,0.953 0.873,0.890,0.952 0.882,0.896,0.950 0.890,0.901,0.948 0.897,0.906,0.945 0.904,0.910,0.941 0.910,0.914,0.936 0.915,0.916,0.930 0.919,0.917,0.923 0.922,0.917,0.915 0.924,0.916,0.906 0.925,0.914,0.895 0.925,0.911,0.884 0.924,0.908,0.872 0.922,0.903,0.860 0.920,0.898,0.847 0.917,0.892,0.834 0.913,0.886,0.821 0.909,0.879,0.807 0.905,0.872,0.794 0.901,0.866,0.780 0.897,0.859,0.766 0.892,0.852,0.753 0.888,0.845,0.739 0.883,0.838,0.726 0.878,0.831,0.712 0.873,0.824,0.699 0.869,0.818,0.685 0.864,0.811,0.672 0.859,0.804,0.658 0.854,0.797,0.645 0.849,0.790,0.631 0.844,0.784,0.618 0.839,0.777,0.605 0.834,0.770,0.591 0.829,0.763,0.578 0.824,0.757,0.565 0.819,0.750,0.552 0.814,0.743,0.538 0.808,0.736,0.525 0.803,0.730,0.512 0.798,0.723,0.499 0.792,0.717,0.486 0.787,0.710,0.472 0.782,0.703,0.459 0.776,0.697,0.446 0.771,0.690,0.433 0.765,0.684,0.420 0.759,0.677,0.406 0.754,0.670,0.393 0.748,0.664,0.380 0.742,0.657,0.367 0.737,0.651,0.353 0.731,0.645,0.340 0.725,0.638,0.327 0.719,0.632,0.313 0.713,0.625,0.299 0.707,0.619,0.286 0.701,0.612,0.272 0.695,0.606,0.258 0.689,0.600,0.244 0.683,0.593,0.230 0.677,0.587,0.216 0.671,0.581,0.201 0.665,0.574,0.187 0.658,0.568,0.172 0.652,0.562,0.157 0.645,0.556,0.143 0.639,0.550,0.129 0.632,0.543,0.115 0.626,0.537,0.102 0.619,0.531,0.090 0.612,0.525,0.079 0.605,0.519,0.071 0.598,0.512,0.064 0.591,0.506,0.059 0.584,0.500,0.057 0.577,0.494,0.057 0.570,0.488,0.058 0.563,0.482,0.061 0.556,0.476,0.065 0.549,0.470,0.069 0.542,0.464,0.073 0.534,0.458,0.077 0.527,0.452,0.081 0.520,0.446,0.085 0.513,0.440,0.089 0.506,0.434,0.093 0.499,0.428,0.096 0.492,0.422,0.099 0.485,0.416,0.102 0.478,0.410,0.105 0.470,0.404,0.108 0.463,0.398,0.111 0.456,0.392,0.113 0.449,0.386,0.116 0.442,0.380,0.118 0.435,0.375,0.120 0.428,0.369,0.122 0.421,0.363,0.124 0.414,0.357,0.126 0.407,0.352,0.128 0.400,0.346,0.130 0.393,0.340,0.131 0.387,0.334,0.133 0.380,0.329,0.134 0.373,0.323,0.136 0.366,0.317,0.137 0.359,0.312,0.138 0.352,0.306,0.140 0.345,0.301,0.141 0.338,0.295,0.142 0.331,0.289,0.143 0.325,0.284,0.144 0.318,0.278,0.145 0.311,0.273,0.146 0.304,0.267,0.147 0.297,0.262,0.148 0.290,0.256,0.148 0.283,0.251,0.149 0.277,0.246,0.150 0.270,0.240,0.150 0.263,0.235,0.151 0.256,0.230,0.152 0.249,0.224,0.152 0.242,0.219,0.153 0.236,0.214,0.154 0.229,0.209,0.155 0.223,0.204,0.156 0.216,0.200,0.157 0.210,0.195,0.159 0.205,0.192,0.161 0.199,0.188,0.163 0.195,0.186,0.167 0.190,0.183,0.171 0.187,0.182,0.176 0.184,0.182,0.181 0.183,0.182,0.188 0.181,0.183,0.195 0.181,0.185,0.203 0.181,0.187,0.212 0.182,0.191,0.221 0.184,0.194,0.231 0.186,0.198,0.241 0.188,0.203,0.251 0.190,0.208,0.261 0.192,0.213,0.272 0.195,0.218,0.283 0.198,0.223,0.294 0.200,0.228,0.305 0.203,0.233,0.316 0.205,0.239,0.327 0.207,0.244,0.338 0.210,0.250,0.350 0.212,0.255,0.361 0.214,0.260,0.373 0.216,0.266,0.384 0.218,0.271,0.396 0.220,0.277,0.407 0.222,0.283,0.419 0.224,0.288,0.431 0.225,0.294,0.442 0.227,0.299,0.454 0.228,0.305,0.466 0.229,0.311,0.478 0.231,0.316,0.490 0.232,0.322,0.502 0.233,0.328,0.514 0.234,0.333,0.526 0.235,0.339,0.538 0.235,0.345,0.550 0.236,0.351,0.563 0.236,0.356,0.575 0.237,0.362,0.587 0.237,0.368,0.600 0.237,0.374,0.612 0.237,0.380,0.625 0.237,0.386,0.637 0.237,0.392,0.650 0.237,0.397,0.662 0.236,0.403,0.675 0.236,0.409,0.688 0.235,0.415,0.701 0.234,0.421,0.713 0.233,0.427,0.726 0.232,0.433,0.739 0.230,0.439,0.752 0.229,0.445,0.765 0.227,0.452,0.778 0.225,0.458,0.791 0.223,0.464,0.804 0.221,0.470,0.816 0.220,0.476,0.829 0.218,0.482,0.841 0.217,0.488,0.853 0.216,0.494,0.865 0.217,0.499,0.876 0.219,0.505,0.886 0.222,0.511,0.895 0.228,0.517,0.904 0.235,0.522,0.911 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-CBC2.csv000066400000000000000000000110001457240071200237040ustar00rootroot000000000000000.933,0.930,0.927 0.935,0.929,0.918 0.935,0.926,0.909 0.935,0.923,0.899 0.933,0.919,0.887 0.931,0.914,0.875 0.929,0.909,0.863 0.925,0.903,0.849 0.922,0.896,0.836 0.918,0.890,0.822 0.914,0.883,0.808 0.910,0.876,0.793 0.906,0.869,0.779 0.901,0.862,0.765 0.897,0.855,0.750 0.893,0.848,0.736 0.888,0.841,0.721 0.883,0.834,0.707 0.879,0.827,0.693 0.874,0.820,0.678 0.869,0.813,0.664 0.864,0.806,0.650 0.860,0.799,0.636 0.855,0.792,0.622 0.850,0.785,0.607 0.845,0.779,0.593 0.840,0.772,0.579 0.835,0.765,0.565 0.829,0.758,0.551 0.824,0.751,0.537 0.819,0.744,0.523 0.814,0.738,0.509 0.808,0.731,0.495 0.803,0.724,0.481 0.798,0.717,0.467 0.792,0.711,0.452 0.787,0.704,0.438 0.781,0.697,0.424 0.775,0.691,0.410 0.770,0.684,0.396 0.764,0.677,0.382 0.758,0.671,0.368 0.753,0.664,0.353 0.747,0.658,0.339 0.741,0.651,0.325 0.735,0.644,0.310 0.729,0.638,0.296 0.723,0.631,0.281 0.717,0.625,0.266 0.711,0.618,0.251 0.704,0.612,0.235 0.698,0.605,0.220 0.692,0.599,0.204 0.686,0.593,0.187 0.680,0.587,0.171 0.674,0.580,0.154 0.668,0.575,0.136 0.662,0.569,0.118 0.657,0.564,0.099 0.652,0.559,0.080 0.647,0.555,0.060 0.643,0.551,0.040 0.641,0.548,0.023 0.639,0.546,0.011 0.638,0.546,0.006 0.638,0.546,0.007 0.639,0.547,0.014 0.641,0.549,0.027 0.644,0.552,0.046 0.648,0.556,0.066 0.653,0.560,0.085 0.658,0.565,0.104 0.663,0.570,0.123 0.669,0.576,0.141 0.675,0.582,0.158 0.681,0.588,0.175 0.688,0.594,0.192 0.694,0.601,0.208 0.700,0.607,0.224 0.706,0.614,0.240 0.712,0.620,0.255 0.718,0.627,0.270 0.724,0.633,0.285 0.730,0.640,0.300 0.736,0.646,0.314 0.742,0.653,0.329 0.748,0.659,0.343 0.754,0.666,0.357 0.760,0.672,0.372 0.766,0.679,0.386 0.771,0.686,0.400 0.777,0.692,0.414 0.783,0.699,0.428 0.788,0.706,0.442 0.794,0.712,0.456 0.799,0.719,0.470 0.805,0.726,0.484 0.810,0.733,0.498 0.815,0.739,0.512 0.820,0.746,0.527 0.826,0.753,0.541 0.831,0.760,0.555 0.836,0.767,0.569 0.841,0.773,0.583 0.846,0.780,0.597 0.851,0.787,0.611 0.856,0.794,0.625 0.861,0.801,0.640 0.866,0.808,0.654 0.871,0.815,0.668 0.875,0.822,0.682 0.880,0.829,0.697 0.885,0.836,0.711 0.889,0.843,0.725 0.894,0.850,0.740 0.898,0.857,0.754 0.902,0.864,0.768 0.907,0.871,0.783 0.911,0.877,0.797 0.915,0.884,0.812 0.918,0.890,0.826 0.921,0.897,0.840 0.924,0.902,0.854 0.926,0.907,0.867 0.927,0.912,0.880 0.927,0.915,0.892 0.927,0.918,0.903 0.925,0.919,0.913 0.922,0.919,0.922 0.918,0.919,0.930 0.913,0.917,0.937 0.908,0.914,0.943 0.901,0.910,0.948 0.894,0.905,0.951 0.886,0.900,0.954 0.877,0.894,0.956 0.869,0.888,0.958 0.860,0.881,0.960 0.850,0.874,0.961 0.841,0.868,0.961 0.832,0.861,0.962 0.822,0.854,0.963 0.812,0.847,0.963 0.803,0.840,0.964 0.793,0.833,0.964 0.783,0.826,0.964 0.773,0.819,0.965 0.763,0.812,0.965 0.753,0.805,0.966 0.743,0.798,0.966 0.733,0.791,0.966 0.723,0.785,0.967 0.713,0.778,0.967 0.703,0.771,0.968 0.692,0.764,0.968 0.682,0.757,0.968 0.671,0.750,0.969 0.660,0.744,0.969 0.650,0.737,0.969 0.639,0.730,0.969 0.628,0.724,0.970 0.616,0.717,0.970 0.605,0.710,0.970 0.594,0.704,0.971 0.582,0.697,0.971 0.570,0.690,0.971 0.559,0.684,0.971 0.546,0.677,0.971 0.534,0.671,0.972 0.522,0.664,0.972 0.509,0.657,0.972 0.496,0.651,0.972 0.483,0.644,0.972 0.469,0.638,0.973 0.455,0.632,0.973 0.441,0.625,0.973 0.426,0.619,0.973 0.411,0.612,0.973 0.396,0.606,0.973 0.380,0.600,0.973 0.363,0.594,0.973 0.346,0.588,0.973 0.329,0.582,0.974 0.311,0.576,0.974 0.293,0.571,0.974 0.276,0.566,0.974 0.259,0.561,0.974 0.244,0.557,0.974 0.231,0.554,0.974 0.221,0.552,0.974 0.214,0.551,0.974 0.212,0.550,0.974 0.215,0.551,0.974 0.222,0.552,0.974 0.233,0.555,0.974 0.247,0.558,0.974 0.263,0.562,0.974 0.280,0.567,0.974 0.297,0.572,0.974 0.315,0.577,0.974 0.333,0.583,0.974 0.350,0.589,0.973 0.367,0.595,0.973 0.383,0.601,0.973 0.399,0.607,0.973 0.415,0.614,0.973 0.430,0.620,0.973 0.444,0.627,0.973 0.458,0.633,0.973 0.472,0.639,0.972 0.486,0.646,0.972 0.499,0.652,0.972 0.512,0.659,0.972 0.524,0.665,0.972 0.537,0.672,0.972 0.549,0.679,0.971 0.561,0.685,0.971 0.573,0.692,0.971 0.585,0.698,0.971 0.596,0.705,0.970 0.608,0.712,0.970 0.619,0.718,0.970 0.630,0.725,0.970 0.641,0.732,0.969 0.652,0.738,0.969 0.663,0.745,0.969 0.673,0.752,0.968 0.684,0.759,0.968 0.694,0.766,0.968 0.705,0.772,0.968 0.715,0.779,0.967 0.725,0.786,0.967 0.736,0.793,0.966 0.746,0.800,0.966 0.756,0.807,0.966 0.766,0.814,0.965 0.775,0.820,0.965 0.785,0.827,0.964 0.795,0.834,0.964 0.805,0.841,0.963 0.814,0.848,0.963 0.824,0.855,0.963 0.834,0.862,0.962 0.843,0.869,0.962 0.852,0.876,0.961 0.862,0.883,0.960 0.871,0.890,0.960 0.880,0.896,0.959 0.888,0.903,0.957 0.896,0.909,0.956 0.904,0.914,0.954 0.911,0.919,0.952 0.918,0.923,0.948 0.923,0.926,0.944 0.928,0.929,0.940 0.931,0.930,0.934 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-CBD1.csv000066400000000000000000000110001457240071200237040ustar00rootroot000000000000000.229,0.566,0.997 0.242,0.569,0.996 0.253,0.571,0.996 0.265,0.574,0.996 0.276,0.577,0.996 0.286,0.580,0.995 0.296,0.582,0.995 0.306,0.585,0.995 0.315,0.588,0.994 0.324,0.590,0.994 0.333,0.593,0.994 0.342,0.596,0.993 0.350,0.599,0.993 0.359,0.601,0.993 0.367,0.604,0.993 0.375,0.607,0.992 0.382,0.610,0.992 0.390,0.612,0.992 0.397,0.615,0.991 0.405,0.618,0.991 0.412,0.621,0.991 0.419,0.624,0.990 0.426,0.626,0.990 0.433,0.629,0.990 0.440,0.632,0.989 0.446,0.635,0.989 0.453,0.638,0.989 0.459,0.640,0.988 0.466,0.643,0.988 0.472,0.646,0.988 0.478,0.649,0.987 0.485,0.652,0.987 0.491,0.654,0.987 0.497,0.657,0.986 0.503,0.660,0.986 0.509,0.663,0.986 0.515,0.666,0.985 0.520,0.669,0.985 0.526,0.672,0.985 0.532,0.674,0.984 0.538,0.677,0.984 0.543,0.680,0.983 0.549,0.683,0.983 0.554,0.686,0.983 0.560,0.689,0.982 0.565,0.692,0.982 0.571,0.694,0.982 0.576,0.697,0.981 0.581,0.700,0.981 0.587,0.703,0.980 0.592,0.706,0.980 0.597,0.709,0.980 0.602,0.712,0.979 0.608,0.715,0.979 0.613,0.718,0.979 0.618,0.721,0.978 0.623,0.724,0.978 0.628,0.726,0.977 0.633,0.729,0.977 0.638,0.732,0.977 0.643,0.735,0.976 0.648,0.738,0.976 0.653,0.741,0.975 0.658,0.744,0.975 0.663,0.747,0.975 0.667,0.750,0.974 0.672,0.753,0.974 0.677,0.756,0.973 0.682,0.759,0.973 0.687,0.762,0.973 0.691,0.765,0.972 0.696,0.768,0.972 0.701,0.771,0.971 0.705,0.774,0.971 0.710,0.777,0.970 0.715,0.780,0.970 0.719,0.783,0.970 0.724,0.786,0.969 0.728,0.789,0.969 0.733,0.792,0.968 0.738,0.795,0.968 0.742,0.798,0.967 0.747,0.801,0.967 0.751,0.804,0.966 0.756,0.807,0.966 0.760,0.810,0.966 0.765,0.813,0.965 0.769,0.816,0.965 0.773,0.819,0.964 0.778,0.822,0.964 0.782,0.825,0.963 0.787,0.828,0.963 0.791,0.831,0.962 0.795,0.834,0.962 0.800,0.837,0.961 0.804,0.840,0.961 0.808,0.843,0.960 0.813,0.846,0.960 0.817,0.849,0.959 0.821,0.852,0.959 0.826,0.855,0.958 0.830,0.858,0.958 0.834,0.862,0.957 0.838,0.865,0.957 0.843,0.868,0.956 0.847,0.871,0.956 0.851,0.874,0.955 0.855,0.877,0.955 0.860,0.880,0.954 0.864,0.883,0.954 0.868,0.886,0.953 0.872,0.889,0.953 0.876,0.892,0.952 0.880,0.896,0.952 0.885,0.899,0.951 0.889,0.902,0.951 0.893,0.905,0.950 0.897,0.908,0.949 0.901,0.911,0.949 0.905,0.914,0.948 0.909,0.916,0.947 0.912,0.919,0.946 0.916,0.922,0.944 0.919,0.924,0.942 0.922,0.925,0.940 0.925,0.927,0.937 0.927,0.928,0.934 0.929,0.928,0.930 0.931,0.928,0.926 0.932,0.928,0.922 0.932,0.927,0.917 0.932,0.925,0.911 0.932,0.924,0.905 0.931,0.921,0.899 0.931,0.919,0.893 0.929,0.916,0.887 0.928,0.914,0.880 0.927,0.911,0.874 0.925,0.908,0.867 0.924,0.905,0.860 0.922,0.902,0.854 0.920,0.898,0.847 0.919,0.895,0.840 0.917,0.892,0.834 0.915,0.889,0.827 0.914,0.886,0.820 0.912,0.883,0.814 0.910,0.880,0.807 0.908,0.877,0.801 0.907,0.874,0.794 0.905,0.870,0.787 0.903,0.867,0.781 0.901,0.864,0.774 0.899,0.861,0.768 0.898,0.858,0.761 0.896,0.855,0.754 0.894,0.852,0.748 0.892,0.849,0.741 0.890,0.846,0.735 0.888,0.843,0.728 0.886,0.840,0.722 0.884,0.837,0.715 0.882,0.834,0.709 0.881,0.831,0.702 0.879,0.827,0.695 0.877,0.824,0.689 0.875,0.821,0.682 0.873,0.818,0.676 0.871,0.815,0.669 0.869,0.812,0.663 0.867,0.809,0.656 0.865,0.806,0.650 0.863,0.803,0.643 0.861,0.800,0.637 0.859,0.797,0.630 0.856,0.794,0.624 0.854,0.791,0.617 0.852,0.788,0.611 0.850,0.785,0.604 0.848,0.782,0.598 0.846,0.779,0.592 0.844,0.776,0.585 0.842,0.773,0.579 0.840,0.770,0.572 0.837,0.767,0.566 0.835,0.764,0.559 0.833,0.761,0.553 0.831,0.758,0.546 0.829,0.755,0.540 0.826,0.752,0.533 0.824,0.749,0.527 0.822,0.746,0.521 0.820,0.743,0.514 0.817,0.740,0.508 0.815,0.737,0.501 0.813,0.734,0.495 0.811,0.731,0.488 0.808,0.728,0.482 0.806,0.726,0.476 0.804,0.723,0.469 0.801,0.720,0.463 0.799,0.717,0.456 0.797,0.714,0.450 0.794,0.711,0.443 0.792,0.708,0.437 0.789,0.705,0.430 0.787,0.702,0.424 0.785,0.699,0.418 0.782,0.696,0.411 0.780,0.693,0.405 0.777,0.690,0.398 0.775,0.688,0.392 0.772,0.685,0.385 0.770,0.682,0.379 0.767,0.679,0.372 0.765,0.676,0.366 0.762,0.673,0.359 0.760,0.670,0.352 0.757,0.667,0.346 0.755,0.664,0.339 0.752,0.662,0.333 0.750,0.659,0.326 0.747,0.656,0.319 0.745,0.653,0.313 0.742,0.650,0.306 0.740,0.647,0.299 0.737,0.644,0.292 0.734,0.641,0.286 0.732,0.639,0.279 0.729,0.636,0.272 0.726,0.633,0.265 0.724,0.630,0.258 0.721,0.627,0.251 0.718,0.624,0.244 0.716,0.622,0.237 0.713,0.619,0.230 0.710,0.616,0.222 0.708,0.613,0.215 0.705,0.610,0.207 0.702,0.608,0.200 0.700,0.605,0.192 0.697,0.602,0.184 0.694,0.599,0.176 0.691,0.596,0.168 0.689,0.594,0.160 0.686,0.591,0.151 0.683,0.588,0.142 0.680,0.585,0.133 0.677,0.582,0.124 0.675,0.580,0.114 0.672,0.577,0.103 0.669,0.574,0.092 0.666,0.571,0.080 0.663,0.569,0.067 0.660,0.566,0.051 0.657,0.563,0.033 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-CBL1.csv000066400000000000000000000110001457240071200237140ustar00rootroot000000000000000.066,0.066,0.066 0.068,0.069,0.075 0.070,0.073,0.084 0.072,0.076,0.091 0.073,0.079,0.099 0.075,0.082,0.106 0.076,0.085,0.113 0.077,0.088,0.120 0.077,0.090,0.127 0.077,0.093,0.135 0.078,0.096,0.142 0.078,0.098,0.149 0.078,0.101,0.157 0.078,0.104,0.164 0.078,0.107,0.171 0.078,0.109,0.179 0.077,0.112,0.186 0.077,0.115,0.193 0.076,0.118,0.200 0.075,0.120,0.208 0.075,0.123,0.215 0.074,0.126,0.222 0.072,0.129,0.229 0.071,0.132,0.237 0.070,0.135,0.244 0.068,0.138,0.251 0.067,0.140,0.258 0.065,0.143,0.265 0.063,0.146,0.272 0.061,0.149,0.279 0.059,0.152,0.286 0.056,0.155,0.293 0.054,0.158,0.300 0.051,0.161,0.307 0.048,0.164,0.314 0.045,0.167,0.321 0.042,0.170,0.328 0.039,0.173,0.335 0.036,0.176,0.341 0.032,0.179,0.348 0.029,0.182,0.355 0.025,0.185,0.361 0.022,0.188,0.368 0.019,0.191,0.374 0.015,0.194,0.381 0.012,0.197,0.387 0.009,0.200,0.393 0.006,0.203,0.400 0.004,0.206,0.406 0.001,0.209,0.412 0.000,0.212,0.418 0.000,0.215,0.424 0.000,0.218,0.430 0.000,0.221,0.436 0.000,0.224,0.441 0.000,0.228,0.447 0.000,0.231,0.452 0.000,0.234,0.458 0.000,0.237,0.463 0.000,0.240,0.468 0.000,0.243,0.474 0.000,0.246,0.479 0.000,0.249,0.484 0.002,0.252,0.488 0.005,0.255,0.493 0.010,0.259,0.498 0.015,0.262,0.502 0.021,0.265,0.507 0.028,0.268,0.511 0.035,0.271,0.515 0.043,0.274,0.519 0.052,0.277,0.523 0.060,0.281,0.526 0.068,0.284,0.530 0.076,0.287,0.533 0.084,0.290,0.536 0.092,0.293,0.539 0.100,0.296,0.542 0.108,0.299,0.545 0.117,0.303,0.547 0.125,0.306,0.549 0.133,0.309,0.552 0.141,0.312,0.553 0.149,0.315,0.555 0.158,0.319,0.556 0.166,0.322,0.558 0.175,0.325,0.558 0.183,0.328,0.559 0.191,0.331,0.560 0.200,0.335,0.560 0.209,0.338,0.559 0.217,0.341,0.559 0.226,0.344,0.558 0.235,0.348,0.557 0.243,0.351,0.556 0.252,0.354,0.554 0.261,0.357,0.551 0.270,0.361,0.549 0.279,0.364,0.546 0.287,0.367,0.544 0.295,0.370,0.541 0.303,0.374,0.539 0.311,0.377,0.536 0.318,0.380,0.533 0.326,0.384,0.531 0.333,0.387,0.528 0.340,0.390,0.525 0.347,0.394,0.523 0.354,0.397,0.520 0.361,0.401,0.517 0.368,0.404,0.515 0.374,0.407,0.512 0.381,0.411,0.509 0.387,0.414,0.507 0.394,0.418,0.504 0.400,0.421,0.501 0.406,0.424,0.498 0.412,0.428,0.496 0.419,0.431,0.493 0.425,0.435,0.490 0.431,0.438,0.487 0.437,0.442,0.484 0.442,0.445,0.481 0.448,0.448,0.479 0.454,0.452,0.476 0.460,0.455,0.473 0.466,0.459,0.470 0.471,0.462,0.467 0.477,0.466,0.464 0.483,0.469,0.461 0.488,0.473,0.458 0.494,0.476,0.455 0.499,0.480,0.452 0.505,0.483,0.449 0.510,0.487,0.446 0.516,0.490,0.443 0.521,0.494,0.440 0.527,0.497,0.437 0.532,0.501,0.434 0.537,0.504,0.431 0.543,0.508,0.428 0.548,0.511,0.425 0.553,0.515,0.422 0.559,0.518,0.418 0.564,0.522,0.415 0.569,0.525,0.412 0.574,0.529,0.409 0.580,0.532,0.405 0.585,0.536,0.402 0.590,0.539,0.399 0.595,0.543,0.395 0.600,0.547,0.392 0.606,0.550,0.389 0.611,0.554,0.385 0.616,0.557,0.382 0.621,0.561,0.378 0.626,0.564,0.375 0.631,0.568,0.371 0.637,0.571,0.367 0.642,0.575,0.364 0.647,0.578,0.361 0.652,0.582,0.358 0.657,0.586,0.355 0.661,0.589,0.353 0.666,0.593,0.351 0.671,0.596,0.350 0.675,0.600,0.349 0.680,0.604,0.348 0.684,0.607,0.348 0.689,0.611,0.347 0.693,0.614,0.348 0.698,0.618,0.348 0.702,0.622,0.349 0.706,0.625,0.350 0.710,0.629,0.351 0.715,0.633,0.353 0.719,0.636,0.354 0.723,0.640,0.357 0.727,0.644,0.359 0.731,0.647,0.361 0.735,0.651,0.364 0.739,0.655,0.367 0.743,0.658,0.370 0.747,0.662,0.373 0.751,0.666,0.377 0.755,0.670,0.381 0.759,0.673,0.385 0.763,0.677,0.389 0.766,0.681,0.393 0.770,0.685,0.398 0.774,0.688,0.402 0.778,0.692,0.407 0.781,0.696,0.412 0.785,0.699,0.417 0.789,0.703,0.422 0.792,0.707,0.428 0.796,0.711,0.433 0.800,0.715,0.439 0.803,0.718,0.445 0.807,0.722,0.451 0.810,0.726,0.457 0.814,0.730,0.463 0.817,0.733,0.470 0.820,0.737,0.476 0.824,0.741,0.483 0.827,0.745,0.489 0.830,0.749,0.496 0.834,0.753,0.503 0.837,0.756,0.510 0.840,0.760,0.517 0.843,0.764,0.525 0.847,0.768,0.532 0.850,0.772,0.540 0.853,0.776,0.547 0.856,0.780,0.555 0.859,0.783,0.563 0.862,0.787,0.571 0.865,0.791,0.579 0.868,0.795,0.587 0.871,0.799,0.595 0.873,0.803,0.603 0.876,0.807,0.611 0.879,0.811,0.620 0.882,0.815,0.628 0.884,0.818,0.637 0.887,0.822,0.646 0.890,0.826,0.655 0.892,0.830,0.664 0.895,0.834,0.672 0.897,0.838,0.682 0.900,0.842,0.691 0.902,0.846,0.700 0.904,0.850,0.709 0.907,0.854,0.719 0.909,0.858,0.728 0.911,0.862,0.738 0.913,0.866,0.747 0.915,0.870,0.757 0.917,0.874,0.767 0.919,0.878,0.776 0.921,0.882,0.786 0.923,0.886,0.796 0.925,0.890,0.806 0.927,0.894,0.816 0.928,0.898,0.827 0.930,0.902,0.837 0.932,0.907,0.847 0.933,0.911,0.858 0.935,0.915,0.868 0.936,0.919,0.879 0.937,0.923,0.889 0.939,0.927,0.900 0.940,0.931,0.911 0.941,0.935,0.922 0.942,0.939,0.933 0.943,0.944,0.943 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-CBL2.csv000066400000000000000000000110001457240071200237150ustar00rootroot000000000000000.066,0.066,0.066 0.068,0.070,0.074 0.071,0.073,0.082 0.073,0.076,0.089 0.075,0.079,0.095 0.077,0.082,0.101 0.079,0.085,0.108 0.080,0.088,0.114 0.081,0.091,0.121 0.082,0.094,0.128 0.083,0.097,0.134 0.084,0.099,0.141 0.085,0.102,0.148 0.086,0.105,0.154 0.087,0.108,0.161 0.087,0.111,0.168 0.088,0.114,0.175 0.088,0.116,0.182 0.089,0.119,0.189 0.089,0.122,0.196 0.089,0.125,0.203 0.089,0.128,0.210 0.089,0.131,0.217 0.089,0.134,0.224 0.088,0.137,0.231 0.088,0.140,0.238 0.087,0.143,0.246 0.087,0.146,0.253 0.086,0.149,0.260 0.085,0.152,0.267 0.084,0.155,0.274 0.083,0.158,0.281 0.082,0.161,0.289 0.081,0.164,0.296 0.080,0.167,0.303 0.078,0.170,0.310 0.077,0.173,0.317 0.076,0.176,0.324 0.074,0.179,0.331 0.073,0.182,0.338 0.072,0.185,0.344 0.070,0.189,0.351 0.069,0.192,0.358 0.068,0.195,0.364 0.067,0.198,0.371 0.066,0.201,0.377 0.065,0.204,0.383 0.064,0.207,0.390 0.063,0.210,0.396 0.062,0.214,0.402 0.062,0.217,0.408 0.061,0.220,0.414 0.061,0.223,0.421 0.060,0.226,0.427 0.060,0.230,0.433 0.060,0.233,0.439 0.060,0.236,0.445 0.060,0.239,0.451 0.060,0.242,0.456 0.060,0.246,0.462 0.060,0.249,0.468 0.060,0.252,0.474 0.060,0.255,0.480 0.060,0.259,0.486 0.060,0.262,0.492 0.060,0.265,0.498 0.060,0.268,0.504 0.060,0.272,0.510 0.059,0.275,0.516 0.059,0.278,0.522 0.059,0.282,0.528 0.059,0.285,0.534 0.059,0.288,0.541 0.059,0.292,0.547 0.059,0.295,0.553 0.058,0.298,0.559 0.058,0.302,0.565 0.058,0.305,0.571 0.057,0.308,0.577 0.057,0.312,0.583 0.057,0.315,0.590 0.056,0.318,0.596 0.056,0.322,0.602 0.056,0.325,0.608 0.055,0.329,0.614 0.055,0.332,0.621 0.054,0.335,0.627 0.053,0.339,0.633 0.053,0.342,0.639 0.052,0.346,0.646 0.051,0.349,0.652 0.051,0.352,0.658 0.050,0.356,0.664 0.049,0.359,0.671 0.048,0.363,0.677 0.047,0.366,0.683 0.046,0.370,0.690 0.045,0.373,0.696 0.044,0.377,0.703 0.043,0.380,0.709 0.042,0.384,0.715 0.041,0.387,0.722 0.040,0.391,0.728 0.038,0.394,0.735 0.037,0.398,0.741 0.036,0.401,0.747 0.034,0.405,0.754 0.032,0.408,0.760 0.031,0.412,0.767 0.029,0.415,0.773 0.027,0.419,0.780 0.026,0.422,0.786 0.024,0.426,0.793 0.022,0.429,0.799 0.020,0.433,0.806 0.018,0.436,0.812 0.016,0.440,0.819 0.014,0.444,0.826 0.012,0.447,0.832 0.010,0.451,0.839 0.008,0.454,0.845 0.006,0.458,0.852 0.005,0.462,0.858 0.003,0.465,0.865 0.002,0.469,0.871 0.001,0.472,0.878 0.001,0.476,0.884 0.002,0.480,0.891 0.004,0.483,0.897 0.007,0.487,0.903 0.012,0.490,0.909 0.019,0.494,0.915 0.029,0.498,0.920 0.042,0.501,0.925 0.056,0.505,0.930 0.071,0.509,0.935 0.087,0.512,0.939 0.104,0.516,0.942 0.121,0.519,0.945 0.138,0.523,0.947 0.156,0.526,0.949 0.175,0.530,0.950 0.194,0.534,0.950 0.213,0.537,0.949 0.232,0.541,0.947 0.252,0.544,0.945 0.271,0.548,0.941 0.291,0.551,0.937 0.310,0.555,0.932 0.329,0.558,0.926 0.348,0.562,0.919 0.366,0.565,0.911 0.385,0.569,0.903 0.402,0.573,0.894 0.419,0.576,0.884 0.436,0.580,0.874 0.452,0.584,0.864 0.468,0.587,0.853 0.483,0.591,0.841 0.498,0.595,0.829 0.512,0.598,0.817 0.525,0.602,0.805 0.539,0.606,0.793 0.551,0.610,0.781 0.563,0.614,0.768 0.575,0.617,0.756 0.587,0.621,0.743 0.598,0.625,0.730 0.608,0.629,0.718 0.619,0.633,0.705 0.629,0.637,0.693 0.639,0.640,0.681 0.648,0.644,0.668 0.658,0.648,0.656 0.667,0.652,0.644 0.676,0.656,0.632 0.685,0.660,0.620 0.693,0.663,0.608 0.702,0.667,0.596 0.710,0.671,0.584 0.718,0.675,0.573 0.726,0.678,0.561 0.734,0.682,0.549 0.742,0.686,0.537 0.750,0.690,0.525 0.758,0.693,0.514 0.765,0.697,0.502 0.772,0.701,0.490 0.780,0.705,0.478 0.787,0.708,0.466 0.794,0.712,0.454 0.801,0.716,0.442 0.808,0.720,0.429 0.815,0.723,0.417 0.821,0.727,0.404 0.828,0.731,0.391 0.834,0.735,0.378 0.841,0.739,0.365 0.847,0.743,0.351 0.853,0.746,0.337 0.859,0.750,0.324 0.865,0.754,0.309 0.871,0.758,0.295 0.877,0.762,0.281 0.883,0.766,0.266 0.889,0.770,0.251 0.894,0.774,0.236 0.900,0.778,0.222 0.905,0.782,0.207 0.910,0.786,0.193 0.916,0.790,0.179 0.921,0.794,0.166 0.926,0.798,0.155 0.931,0.802,0.145 0.935,0.806,0.138 0.940,0.809,0.134 0.945,0.813,0.134 0.949,0.817,0.137 0.954,0.821,0.144 0.958,0.825,0.155 0.962,0.829,0.168 0.966,0.833,0.185 0.970,0.837,0.203 0.973,0.841,0.223 0.977,0.845,0.244 0.980,0.849,0.267 0.983,0.853,0.290 0.986,0.857,0.314 0.989,0.861,0.339 0.991,0.865,0.364 0.993,0.869,0.389 0.995,0.873,0.415 0.997,0.877,0.441 0.998,0.882,0.467 0.999,0.886,0.493 1.000,0.890,0.519 1.000,0.894,0.545 1.000,0.898,0.571 1.000,0.903,0.597 1.000,0.907,0.622 1.000,0.911,0.647 1.000,0.915,0.672 0.999,0.920,0.696 0.998,0.924,0.720 0.997,0.928,0.743 0.996,0.933,0.765 0.995,0.937,0.787 0.994,0.942,0.808 0.993,0.946,0.829 0.992,0.950,0.849 0.991,0.955,0.868 0.990,0.959,0.886 0.989,0.964,0.904 0.988,0.968,0.921 0.988,0.972,0.937 0.987,0.977,0.953 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-CBTC1.csv000066400000000000000000000110001457240071200240270ustar00rootroot000000000000000.149,0.735,0.842 0.163,0.740,0.847 0.179,0.744,0.851 0.198,0.748,0.854 0.217,0.752,0.857 0.237,0.757,0.860 0.257,0.761,0.863 0.277,0.765,0.866 0.296,0.769,0.868 0.315,0.773,0.871 0.333,0.777,0.873 0.351,0.781,0.875 0.368,0.785,0.878 0.385,0.789,0.880 0.401,0.793,0.882 0.416,0.797,0.885 0.432,0.801,0.887 0.446,0.806,0.889 0.461,0.810,0.891 0.475,0.814,0.894 0.489,0.818,0.896 0.503,0.822,0.898 0.516,0.826,0.901 0.529,0.830,0.903 0.542,0.834,0.905 0.555,0.838,0.908 0.568,0.842,0.910 0.580,0.846,0.912 0.593,0.850,0.915 0.605,0.854,0.917 0.617,0.858,0.919 0.629,0.862,0.922 0.641,0.867,0.924 0.653,0.871,0.926 0.664,0.875,0.928 0.676,0.879,0.931 0.688,0.883,0.933 0.699,0.887,0.935 0.710,0.891,0.938 0.722,0.895,0.940 0.733,0.899,0.942 0.744,0.903,0.945 0.755,0.907,0.947 0.766,0.911,0.949 0.777,0.915,0.952 0.788,0.919,0.954 0.799,0.923,0.956 0.810,0.927,0.958 0.821,0.931,0.961 0.832,0.935,0.963 0.842,0.939,0.965 0.853,0.943,0.968 0.864,0.947,0.970 0.874,0.951,0.972 0.885,0.955,0.974 0.895,0.959,0.976 0.906,0.962,0.978 0.916,0.965,0.979 0.926,0.968,0.980 0.936,0.970,0.980 0.945,0.972,0.980 0.953,0.973,0.980 0.961,0.973,0.978 0.969,0.973,0.976 0.975,0.972,0.973 0.981,0.969,0.969 0.985,0.966,0.964 0.989,0.963,0.959 0.992,0.958,0.953 0.994,0.953,0.947 0.995,0.948,0.940 0.996,0.942,0.934 0.997,0.936,0.926 0.997,0.930,0.919 0.997,0.923,0.912 0.997,0.917,0.904 0.997,0.911,0.897 0.996,0.904,0.890 0.996,0.898,0.882 0.995,0.891,0.875 0.995,0.885,0.867 0.994,0.878,0.860 0.993,0.871,0.852 0.993,0.865,0.845 0.992,0.858,0.838 0.991,0.852,0.830 0.990,0.845,0.823 0.990,0.839,0.816 0.989,0.832,0.808 0.988,0.826,0.801 0.987,0.819,0.794 0.986,0.813,0.786 0.985,0.806,0.779 0.984,0.800,0.772 0.983,0.793,0.765 0.982,0.787,0.757 0.981,0.780,0.750 0.980,0.774,0.743 0.979,0.767,0.736 0.978,0.761,0.728 0.976,0.754,0.721 0.975,0.748,0.714 0.974,0.741,0.707 0.973,0.735,0.700 0.971,0.728,0.693 0.970,0.722,0.685 0.969,0.715,0.678 0.967,0.709,0.671 0.966,0.702,0.664 0.964,0.696,0.657 0.963,0.689,0.650 0.961,0.683,0.643 0.960,0.676,0.636 0.958,0.670,0.629 0.957,0.663,0.622 0.955,0.657,0.615 0.953,0.650,0.608 0.951,0.644,0.601 0.949,0.638,0.594 0.947,0.631,0.587 0.945,0.625,0.581 0.943,0.619,0.574 0.940,0.612,0.568 0.937,0.607,0.561 0.934,0.601,0.556 0.930,0.595,0.550 0.926,0.590,0.545 0.921,0.585,0.540 0.915,0.580,0.535 0.909,0.575,0.531 0.903,0.571,0.527 0.896,0.567,0.523 0.888,0.563,0.520 0.880,0.560,0.517 0.872,0.556,0.514 0.864,0.553,0.511 0.856,0.550,0.508 0.847,0.546,0.505 0.838,0.543,0.503 0.830,0.540,0.500 0.821,0.537,0.498 0.812,0.534,0.495 0.804,0.531,0.493 0.795,0.527,0.490 0.786,0.524,0.488 0.777,0.521,0.485 0.769,0.518,0.483 0.760,0.515,0.480 0.751,0.512,0.478 0.743,0.509,0.475 0.734,0.505,0.473 0.725,0.502,0.470 0.717,0.499,0.468 0.708,0.496,0.465 0.699,0.493,0.463 0.691,0.490,0.460 0.682,0.486,0.458 0.673,0.483,0.456 0.665,0.480,0.453 0.656,0.477,0.451 0.648,0.474,0.448 0.639,0.471,0.446 0.630,0.467,0.443 0.622,0.464,0.441 0.613,0.461,0.438 0.605,0.458,0.436 0.596,0.455,0.433 0.588,0.451,0.431 0.579,0.448,0.429 0.570,0.445,0.426 0.562,0.442,0.424 0.553,0.439,0.421 0.545,0.435,0.419 0.536,0.432,0.416 0.528,0.429,0.414 0.519,0.426,0.411 0.510,0.423,0.409 0.502,0.419,0.407 0.493,0.416,0.404 0.485,0.413,0.402 0.476,0.410,0.400 0.468,0.407,0.397 0.459,0.404,0.395 0.451,0.401,0.393 0.442,0.398,0.392 0.434,0.396,0.390 0.426,0.394,0.389 0.419,0.392,0.389 0.411,0.391,0.389 0.405,0.391,0.389 0.398,0.391,0.391 0.393,0.392,0.393 0.388,0.393,0.396 0.384,0.395,0.400 0.380,0.398,0.404 0.377,0.402,0.409 0.374,0.405,0.414 0.372,0.410,0.420 0.371,0.414,0.426 0.369,0.419,0.433 0.368,0.424,0.439 0.367,0.430,0.446 0.366,0.435,0.453 0.365,0.440,0.460 0.364,0.446,0.467 0.363,0.451,0.474 0.362,0.457,0.481 0.361,0.462,0.488 0.360,0.468,0.495 0.359,0.473,0.503 0.357,0.479,0.510 0.356,0.484,0.517 0.354,0.490,0.524 0.352,0.495,0.532 0.351,0.501,0.539 0.349,0.507,0.546 0.347,0.512,0.553 0.344,0.518,0.561 0.342,0.523,0.568 0.340,0.529,0.575 0.337,0.535,0.583 0.334,0.540,0.590 0.332,0.546,0.597 0.329,0.551,0.605 0.325,0.557,0.612 0.322,0.563,0.620 0.319,0.568,0.627 0.315,0.574,0.635 0.311,0.580,0.642 0.307,0.585,0.650 0.303,0.591,0.657 0.298,0.597,0.665 0.294,0.603,0.672 0.289,0.608,0.680 0.284,0.614,0.687 0.278,0.620,0.695 0.272,0.626,0.703 0.266,0.631,0.710 0.260,0.637,0.718 0.253,0.643,0.725 0.246,0.649,0.733 0.238,0.654,0.741 0.230,0.660,0.748 0.222,0.666,0.756 0.212,0.672,0.764 0.203,0.677,0.771 0.193,0.683,0.779 0.182,0.689,0.787 0.171,0.694,0.794 0.161,0.700,0.801 0.151,0.705,0.808 0.142,0.711,0.815 0.136,0.716,0.821 0.133,0.721,0.827 0.134,0.726,0.833 0.139,0.731,0.838 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-CBTC2.csv000066400000000000000000000110001457240071200240300ustar00rootroot000000000000000.985,0.981,0.982 0.989,0.979,0.978 0.992,0.976,0.974 0.995,0.973,0.970 0.997,0.968,0.964 0.998,0.964,0.958 0.999,0.958,0.952 1.000,0.953,0.945 1.000,0.947,0.938 1.000,0.940,0.931 1.000,0.934,0.924 1.000,0.928,0.916 1.000,0.921,0.909 1.000,0.915,0.901 1.000,0.908,0.894 1.000,0.902,0.886 1.000,0.895,0.879 0.999,0.889,0.871 0.999,0.882,0.864 0.998,0.876,0.857 0.998,0.869,0.849 0.997,0.863,0.842 0.997,0.856,0.834 0.996,0.850,0.827 0.996,0.843,0.819 0.995,0.836,0.812 0.995,0.830,0.805 0.994,0.823,0.797 0.993,0.817,0.790 0.992,0.810,0.783 0.992,0.804,0.775 0.991,0.797,0.768 0.990,0.791,0.761 0.989,0.784,0.753 0.988,0.778,0.746 0.987,0.771,0.739 0.986,0.765,0.732 0.985,0.758,0.724 0.984,0.752,0.717 0.983,0.745,0.710 0.982,0.739,0.703 0.981,0.732,0.695 0.980,0.726,0.688 0.979,0.719,0.681 0.977,0.713,0.674 0.976,0.706,0.667 0.975,0.700,0.660 0.974,0.693,0.653 0.972,0.687,0.646 0.971,0.680,0.638 0.970,0.673,0.631 0.968,0.667,0.624 0.967,0.660,0.617 0.965,0.654,0.610 0.964,0.648,0.604 0.962,0.641,0.597 0.961,0.635,0.590 0.959,0.629,0.584 0.958,0.624,0.578 0.957,0.619,0.573 0.956,0.614,0.568 0.955,0.611,0.564 0.954,0.608,0.561 0.954,0.606,0.559 0.953,0.605,0.558 0.953,0.605,0.558 0.954,0.606,0.560 0.954,0.609,0.562 0.955,0.612,0.565 0.956,0.616,0.569 0.957,0.620,0.574 0.958,0.625,0.580 0.960,0.631,0.586 0.961,0.637,0.592 0.963,0.643,0.599 0.964,0.649,0.605 0.966,0.656,0.612 0.967,0.662,0.619 0.969,0.669,0.626 0.970,0.675,0.633 0.971,0.682,0.640 0.973,0.688,0.647 0.974,0.695,0.655 0.975,0.701,0.662 0.977,0.708,0.669 0.978,0.714,0.676 0.979,0.721,0.683 0.980,0.727,0.690 0.981,0.734,0.697 0.982,0.740,0.705 0.984,0.747,0.712 0.985,0.754,0.719 0.986,0.760,0.726 0.987,0.767,0.734 0.988,0.773,0.741 0.988,0.780,0.748 0.989,0.786,0.755 0.990,0.793,0.763 0.991,0.799,0.770 0.992,0.806,0.777 0.993,0.812,0.785 0.993,0.819,0.792 0.994,0.825,0.799 0.995,0.832,0.807 0.995,0.838,0.814 0.996,0.845,0.821 0.997,0.851,0.829 0.997,0.858,0.836 0.998,0.864,0.844 0.998,0.871,0.851 0.999,0.877,0.858 0.999,0.884,0.866 0.999,0.890,0.873 1.000,0.897,0.881 1.000,0.903,0.888 1.000,0.910,0.896 1.000,0.916,0.903 1.000,0.923,0.911 1.000,0.929,0.918 1.000,0.936,0.926 0.999,0.942,0.933 0.998,0.948,0.940 0.996,0.953,0.947 0.994,0.958,0.953 0.992,0.963,0.959 0.988,0.967,0.964 0.984,0.970,0.969 0.979,0.973,0.973 0.973,0.975,0.977 0.966,0.976,0.979 0.959,0.976,0.981 0.950,0.975,0.982 0.941,0.973,0.983 0.932,0.971,0.982 0.922,0.969,0.982 0.912,0.966,0.981 0.902,0.963,0.979 0.891,0.959,0.978 0.881,0.956,0.976 0.870,0.952,0.974 0.859,0.948,0.972 0.848,0.944,0.970 0.837,0.940,0.968 0.826,0.936,0.965 0.815,0.932,0.963 0.804,0.928,0.961 0.793,0.924,0.959 0.782,0.920,0.957 0.771,0.916,0.955 0.760,0.912,0.953 0.748,0.908,0.950 0.737,0.905,0.948 0.725,0.901,0.946 0.714,0.897,0.944 0.702,0.893,0.942 0.691,0.889,0.940 0.679,0.885,0.938 0.667,0.881,0.935 0.655,0.877,0.933 0.643,0.873,0.931 0.631,0.869,0.929 0.618,0.865,0.927 0.606,0.861,0.925 0.593,0.857,0.923 0.581,0.853,0.920 0.568,0.849,0.918 0.555,0.845,0.916 0.542,0.841,0.914 0.528,0.837,0.912 0.515,0.833,0.910 0.501,0.829,0.907 0.487,0.825,0.905 0.472,0.821,0.903 0.457,0.817,0.901 0.442,0.813,0.899 0.427,0.809,0.897 0.411,0.805,0.895 0.395,0.801,0.892 0.378,0.797,0.890 0.360,0.793,0.888 0.342,0.789,0.886 0.324,0.785,0.884 0.305,0.782,0.882 0.285,0.778,0.880 0.265,0.774,0.878 0.246,0.771,0.876 0.227,0.768,0.875 0.209,0.766,0.874 0.193,0.764,0.872 0.181,0.762,0.872 0.174,0.762,0.871 0.171,0.761,0.871 0.175,0.762,0.871 0.184,0.763,0.872 0.197,0.764,0.873 0.213,0.766,0.874 0.231,0.769,0.875 0.250,0.772,0.877 0.270,0.775,0.879 0.289,0.779,0.880 0.309,0.782,0.882 0.328,0.786,0.884 0.346,0.790,0.887 0.364,0.794,0.889 0.381,0.798,0.891 0.398,0.802,0.893 0.414,0.806,0.895 0.430,0.810,0.897 0.446,0.814,0.899 0.461,0.818,0.901 0.475,0.822,0.904 0.490,0.826,0.906 0.504,0.830,0.908 0.518,0.834,0.910 0.531,0.838,0.912 0.545,0.842,0.914 0.558,0.846,0.917 0.571,0.850,0.919 0.584,0.854,0.921 0.596,0.858,0.923 0.609,0.862,0.925 0.621,0.866,0.927 0.633,0.870,0.929 0.646,0.874,0.932 0.658,0.878,0.934 0.670,0.882,0.936 0.681,0.886,0.938 0.693,0.890,0.940 0.705,0.893,0.942 0.716,0.897,0.944 0.728,0.901,0.947 0.739,0.905,0.949 0.751,0.909,0.951 0.762,0.913,0.953 0.773,0.917,0.955 0.785,0.921,0.957 0.796,0.925,0.959 0.807,0.929,0.962 0.818,0.933,0.964 0.829,0.937,0.966 0.840,0.941,0.968 0.851,0.945,0.970 0.861,0.949,0.972 0.872,0.953,0.974 0.883,0.957,0.976 0.893,0.960,0.978 0.904,0.964,0.980 0.914,0.968,0.982 0.924,0.971,0.984 0.934,0.974,0.985 0.943,0.977,0.986 0.952,0.979,0.987 0.960,0.981,0.987 0.967,0.982,0.987 0.974,0.983,0.986 0.980,0.982,0.984 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-CBTD1.csv000066400000000000000000000110001457240071200240300ustar00rootroot000000000000000.161,0.791,0.905 0.179,0.792,0.906 0.195,0.794,0.907 0.210,0.795,0.907 0.224,0.797,0.908 0.237,0.798,0.908 0.250,0.799,0.909 0.261,0.801,0.909 0.273,0.802,0.910 0.284,0.804,0.911 0.294,0.805,0.911 0.304,0.807,0.912 0.314,0.808,0.912 0.324,0.810,0.913 0.333,0.811,0.913 0.342,0.813,0.914 0.351,0.814,0.915 0.359,0.816,0.915 0.368,0.817,0.916 0.376,0.819,0.916 0.384,0.820,0.917 0.392,0.822,0.917 0.400,0.823,0.918 0.408,0.825,0.919 0.415,0.826,0.919 0.423,0.828,0.920 0.430,0.829,0.920 0.437,0.831,0.921 0.444,0.832,0.921 0.451,0.834,0.922 0.458,0.835,0.923 0.465,0.837,0.923 0.472,0.838,0.924 0.479,0.840,0.924 0.485,0.841,0.925 0.492,0.843,0.925 0.498,0.844,0.926 0.505,0.845,0.927 0.511,0.847,0.927 0.518,0.848,0.928 0.524,0.850,0.928 0.530,0.851,0.929 0.536,0.853,0.929 0.542,0.854,0.930 0.549,0.856,0.930 0.555,0.857,0.931 0.561,0.859,0.932 0.566,0.860,0.932 0.572,0.862,0.933 0.578,0.863,0.933 0.584,0.865,0.934 0.590,0.866,0.934 0.596,0.867,0.935 0.601,0.869,0.936 0.607,0.870,0.936 0.613,0.872,0.937 0.618,0.873,0.937 0.624,0.875,0.938 0.629,0.876,0.938 0.635,0.878,0.939 0.640,0.879,0.939 0.646,0.881,0.940 0.651,0.882,0.941 0.657,0.884,0.941 0.662,0.885,0.942 0.667,0.886,0.942 0.673,0.888,0.943 0.678,0.889,0.943 0.683,0.891,0.944 0.689,0.892,0.945 0.694,0.894,0.945 0.699,0.895,0.946 0.704,0.897,0.946 0.710,0.898,0.947 0.715,0.899,0.947 0.720,0.901,0.948 0.725,0.902,0.948 0.730,0.904,0.949 0.735,0.905,0.950 0.740,0.907,0.950 0.746,0.908,0.951 0.751,0.910,0.951 0.756,0.911,0.952 0.761,0.912,0.952 0.766,0.914,0.953 0.771,0.915,0.953 0.776,0.917,0.954 0.781,0.918,0.955 0.786,0.920,0.955 0.791,0.921,0.956 0.795,0.923,0.956 0.800,0.924,0.957 0.805,0.925,0.957 0.810,0.927,0.958 0.815,0.928,0.958 0.820,0.930,0.959 0.825,0.931,0.960 0.830,0.933,0.960 0.834,0.934,0.961 0.839,0.936,0.961 0.844,0.937,0.962 0.849,0.938,0.962 0.854,0.940,0.963 0.858,0.941,0.963 0.863,0.943,0.964 0.868,0.944,0.965 0.873,0.946,0.965 0.878,0.947,0.966 0.882,0.948,0.966 0.887,0.950,0.967 0.892,0.951,0.967 0.896,0.953,0.968 0.901,0.954,0.968 0.906,0.956,0.969 0.911,0.957,0.969 0.915,0.958,0.970 0.920,0.960,0.970 0.925,0.961,0.971 0.929,0.962,0.971 0.934,0.964,0.972 0.938,0.965,0.972 0.943,0.966,0.972 0.947,0.967,0.972 0.951,0.968,0.972 0.956,0.968,0.972 0.959,0.968,0.971 0.963,0.968,0.970 0.966,0.968,0.969 0.969,0.967,0.967 0.972,0.966,0.966 0.974,0.965,0.964 0.976,0.963,0.961 0.978,0.961,0.959 0.979,0.959,0.956 0.980,0.957,0.953 0.981,0.954,0.950 0.982,0.952,0.947 0.983,0.949,0.944 0.984,0.947,0.941 0.984,0.944,0.938 0.985,0.941,0.934 0.985,0.939,0.931 0.986,0.936,0.928 0.986,0.933,0.925 0.987,0.931,0.922 0.987,0.928,0.918 0.988,0.925,0.915 0.988,0.922,0.912 0.988,0.920,0.909 0.989,0.917,0.906 0.989,0.914,0.903 0.990,0.912,0.899 0.990,0.909,0.896 0.991,0.906,0.893 0.991,0.904,0.890 0.991,0.901,0.887 0.992,0.898,0.884 0.992,0.895,0.880 0.992,0.893,0.877 0.993,0.890,0.874 0.993,0.887,0.871 0.993,0.885,0.868 0.994,0.882,0.865 0.994,0.879,0.861 0.994,0.877,0.858 0.995,0.874,0.855 0.995,0.871,0.852 0.995,0.869,0.849 0.995,0.866,0.846 0.996,0.863,0.843 0.996,0.860,0.839 0.996,0.858,0.836 0.996,0.855,0.833 0.997,0.852,0.830 0.997,0.850,0.827 0.997,0.847,0.824 0.997,0.844,0.821 0.998,0.842,0.817 0.998,0.839,0.814 0.998,0.836,0.811 0.998,0.833,0.808 0.998,0.831,0.805 0.998,0.828,0.802 0.999,0.825,0.799 0.999,0.823,0.796 0.999,0.820,0.793 0.999,0.817,0.789 0.999,0.815,0.786 0.999,0.812,0.783 0.999,0.809,0.780 0.999,0.806,0.777 1.000,0.804,0.774 1.000,0.801,0.771 1.000,0.798,0.768 1.000,0.796,0.765 1.000,0.793,0.762 1.000,0.790,0.759 1.000,0.787,0.755 1.000,0.785,0.752 1.000,0.782,0.749 1.000,0.779,0.746 1.000,0.777,0.743 1.000,0.774,0.740 1.000,0.771,0.737 1.000,0.769,0.734 1.000,0.766,0.731 1.000,0.763,0.728 1.000,0.760,0.725 1.000,0.758,0.722 1.000,0.755,0.719 1.000,0.752,0.716 1.000,0.750,0.713 1.000,0.747,0.709 1.000,0.744,0.706 1.000,0.741,0.703 1.000,0.739,0.700 1.000,0.736,0.697 1.000,0.733,0.694 0.999,0.731,0.691 0.999,0.728,0.688 0.999,0.725,0.685 0.999,0.722,0.682 0.999,0.720,0.679 0.999,0.717,0.676 0.999,0.714,0.673 0.999,0.711,0.670 0.998,0.709,0.667 0.998,0.706,0.664 0.998,0.703,0.661 0.998,0.701,0.658 0.998,0.698,0.655 0.998,0.695,0.652 0.997,0.692,0.649 0.997,0.690,0.646 0.997,0.687,0.643 0.997,0.684,0.640 0.997,0.681,0.637 0.996,0.679,0.634 0.996,0.676,0.631 0.996,0.673,0.628 0.996,0.670,0.625 0.996,0.668,0.622 0.995,0.665,0.619 0.995,0.662,0.616 0.995,0.659,0.613 0.995,0.657,0.610 0.994,0.654,0.607 0.994,0.651,0.604 0.994,0.648,0.601 0.993,0.646,0.598 0.993,0.643,0.595 0.993,0.640,0.592 0.993,0.637,0.589 0.992,0.635,0.586 0.992,0.632,0.583 0.992,0.629,0.580 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-CBTL1.csv000066400000000000000000000110001457240071200240400ustar00rootroot000000000000000.066,0.066,0.066 0.078,0.067,0.065 0.089,0.069,0.065 0.099,0.070,0.064 0.108,0.071,0.064 0.116,0.072,0.063 0.124,0.073,0.063 0.133,0.074,0.062 0.141,0.075,0.061 0.149,0.075,0.061 0.157,0.075,0.060 0.165,0.075,0.060 0.173,0.075,0.059 0.181,0.075,0.058 0.190,0.075,0.058 0.198,0.075,0.057 0.206,0.074,0.057 0.214,0.074,0.056 0.222,0.073,0.055 0.230,0.072,0.055 0.238,0.071,0.054 0.246,0.070,0.053 0.254,0.069,0.053 0.262,0.068,0.052 0.270,0.066,0.052 0.278,0.065,0.051 0.286,0.063,0.050 0.294,0.061,0.050 0.302,0.059,0.049 0.310,0.057,0.049 0.318,0.054,0.048 0.326,0.052,0.048 0.333,0.049,0.047 0.341,0.046,0.047 0.349,0.043,0.047 0.357,0.040,0.047 0.364,0.036,0.047 0.372,0.033,0.047 0.379,0.030,0.047 0.386,0.027,0.048 0.393,0.024,0.048 0.401,0.021,0.049 0.408,0.018,0.049 0.414,0.016,0.050 0.421,0.014,0.051 0.428,0.012,0.052 0.435,0.010,0.053 0.441,0.009,0.054 0.447,0.007,0.056 0.454,0.006,0.057 0.460,0.005,0.058 0.466,0.005,0.060 0.473,0.004,0.061 0.479,0.004,0.063 0.485,0.004,0.064 0.491,0.004,0.065 0.497,0.004,0.067 0.503,0.004,0.068 0.509,0.004,0.070 0.515,0.005,0.071 0.521,0.005,0.072 0.527,0.006,0.074 0.533,0.007,0.075 0.539,0.007,0.077 0.545,0.008,0.078 0.551,0.009,0.080 0.557,0.009,0.081 0.563,0.010,0.083 0.569,0.011,0.084 0.575,0.012,0.086 0.581,0.013,0.087 0.588,0.014,0.089 0.594,0.015,0.090 0.600,0.016,0.092 0.606,0.017,0.093 0.612,0.018,0.095 0.618,0.019,0.096 0.624,0.020,0.098 0.631,0.021,0.099 0.637,0.022,0.101 0.643,0.023,0.103 0.649,0.025,0.104 0.655,0.026,0.106 0.662,0.027,0.107 0.668,0.028,0.109 0.674,0.030,0.110 0.680,0.031,0.112 0.687,0.032,0.113 0.693,0.034,0.115 0.699,0.035,0.117 0.705,0.037,0.118 0.712,0.038,0.120 0.718,0.040,0.121 0.724,0.041,0.123 0.731,0.043,0.124 0.737,0.044,0.126 0.743,0.046,0.128 0.750,0.047,0.129 0.756,0.049,0.131 0.763,0.050,0.132 0.769,0.052,0.134 0.775,0.053,0.136 0.782,0.055,0.137 0.788,0.056,0.139 0.795,0.057,0.140 0.801,0.059,0.142 0.808,0.060,0.144 0.814,0.062,0.145 0.821,0.063,0.147 0.827,0.065,0.149 0.834,0.066,0.150 0.840,0.068,0.152 0.847,0.069,0.153 0.853,0.071,0.155 0.860,0.072,0.157 0.866,0.074,0.158 0.873,0.075,0.160 0.879,0.077,0.162 0.886,0.079,0.164 0.892,0.081,0.165 0.899,0.083,0.167 0.905,0.085,0.169 0.912,0.087,0.171 0.918,0.090,0.173 0.924,0.093,0.175 0.930,0.097,0.177 0.936,0.101,0.179 0.942,0.105,0.181 0.948,0.110,0.184 0.953,0.116,0.187 0.958,0.122,0.190 0.963,0.130,0.193 0.968,0.137,0.197 0.972,0.146,0.201 0.976,0.155,0.205 0.979,0.165,0.210 0.982,0.176,0.215 0.984,0.187,0.220 0.986,0.199,0.226 0.988,0.211,0.233 0.988,0.224,0.240 0.989,0.236,0.247 0.988,0.250,0.255 0.987,0.263,0.263 0.986,0.277,0.272 0.983,0.290,0.281 0.981,0.304,0.291 0.978,0.318,0.301 0.974,0.331,0.311 0.970,0.345,0.322 0.965,0.358,0.333 0.960,0.371,0.344 0.954,0.384,0.356 0.948,0.397,0.368 0.942,0.410,0.380 0.935,0.422,0.392 0.929,0.435,0.404 0.921,0.447,0.417 0.914,0.458,0.429 0.906,0.470,0.442 0.898,0.481,0.454 0.889,0.493,0.467 0.881,0.504,0.480 0.872,0.514,0.493 0.863,0.525,0.506 0.853,0.535,0.519 0.843,0.546,0.532 0.833,0.556,0.545 0.823,0.566,0.558 0.812,0.576,0.571 0.801,0.586,0.585 0.789,0.595,0.598 0.777,0.605,0.611 0.765,0.614,0.625 0.752,0.624,0.638 0.739,0.633,0.651 0.725,0.642,0.665 0.710,0.651,0.678 0.696,0.660,0.692 0.680,0.669,0.705 0.664,0.677,0.719 0.647,0.686,0.732 0.630,0.695,0.745 0.612,0.703,0.759 0.593,0.711,0.772 0.573,0.720,0.785 0.552,0.728,0.798 0.531,0.736,0.811 0.509,0.744,0.824 0.485,0.751,0.837 0.461,0.759,0.849 0.437,0.766,0.861 0.411,0.773,0.872 0.385,0.780,0.884 0.358,0.787,0.894 0.330,0.794,0.905 0.302,0.800,0.914 0.274,0.806,0.924 0.246,0.812,0.932 0.218,0.818,0.940 0.192,0.823,0.947 0.169,0.829,0.954 0.149,0.834,0.960 0.136,0.838,0.966 0.131,0.843,0.970 0.134,0.847,0.975 0.146,0.851,0.978 0.163,0.855,0.982 0.184,0.859,0.984 0.207,0.862,0.986 0.232,0.866,0.988 0.257,0.869,0.990 0.282,0.872,0.991 0.307,0.875,0.992 0.331,0.878,0.992 0.354,0.881,0.993 0.377,0.884,0.993 0.400,0.886,0.993 0.421,0.889,0.993 0.442,0.892,0.993 0.463,0.894,0.993 0.483,0.897,0.992 0.502,0.899,0.992 0.521,0.902,0.992 0.539,0.905,0.991 0.557,0.907,0.991 0.574,0.909,0.991 0.591,0.912,0.990 0.608,0.914,0.990 0.624,0.917,0.989 0.640,0.919,0.989 0.655,0.922,0.989 0.671,0.924,0.988 0.686,0.927,0.988 0.701,0.929,0.987 0.715,0.931,0.987 0.730,0.934,0.986 0.744,0.936,0.986 0.758,0.938,0.985 0.772,0.941,0.985 0.785,0.943,0.985 0.799,0.945,0.984 0.812,0.948,0.984 0.826,0.950,0.983 0.839,0.952,0.983 0.852,0.955,0.982 0.865,0.957,0.982 0.878,0.959,0.981 0.890,0.962,0.981 0.903,0.964,0.980 0.916,0.966,0.980 0.928,0.968,0.979 0.940,0.971,0.979 0.953,0.973,0.978 0.965,0.975,0.978 0.977,0.977,0.977 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-CBTL2.csv000066400000000000000000000110001457240071200240410ustar00rootroot000000000000000.066,0.066,0.066 0.077,0.068,0.066 0.086,0.069,0.066 0.095,0.071,0.066 0.103,0.072,0.066 0.111,0.074,0.066 0.118,0.075,0.067 0.125,0.076,0.067 0.132,0.078,0.067 0.139,0.078,0.067 0.146,0.079,0.068 0.152,0.080,0.068 0.159,0.081,0.069 0.166,0.082,0.069 0.173,0.083,0.070 0.179,0.084,0.070 0.186,0.084,0.070 0.192,0.085,0.071 0.199,0.086,0.072 0.205,0.087,0.072 0.212,0.087,0.073 0.218,0.088,0.074 0.225,0.089,0.074 0.231,0.090,0.075 0.237,0.090,0.076 0.244,0.091,0.076 0.250,0.092,0.077 0.256,0.093,0.078 0.262,0.094,0.079 0.268,0.094,0.080 0.274,0.095,0.081 0.280,0.096,0.082 0.286,0.097,0.082 0.292,0.098,0.083 0.298,0.099,0.084 0.304,0.100,0.085 0.310,0.101,0.086 0.316,0.102,0.088 0.322,0.103,0.089 0.327,0.105,0.090 0.333,0.106,0.091 0.339,0.107,0.093 0.344,0.109,0.094 0.350,0.110,0.095 0.355,0.112,0.097 0.361,0.113,0.098 0.366,0.115,0.100 0.371,0.117,0.101 0.376,0.118,0.103 0.382,0.120,0.105 0.387,0.122,0.107 0.392,0.124,0.108 0.397,0.126,0.110 0.402,0.128,0.112 0.407,0.131,0.114 0.411,0.133,0.116 0.416,0.135,0.119 0.421,0.138,0.121 0.425,0.140,0.123 0.430,0.143,0.125 0.434,0.146,0.128 0.439,0.149,0.130 0.443,0.152,0.133 0.447,0.155,0.135 0.451,0.158,0.138 0.455,0.161,0.141 0.459,0.164,0.144 0.463,0.168,0.147 0.467,0.171,0.150 0.470,0.175,0.153 0.474,0.178,0.156 0.477,0.182,0.159 0.480,0.186,0.163 0.483,0.190,0.166 0.486,0.194,0.170 0.489,0.198,0.173 0.492,0.202,0.177 0.495,0.207,0.181 0.497,0.211,0.185 0.500,0.215,0.189 0.502,0.220,0.193 0.504,0.224,0.197 0.506,0.229,0.202 0.508,0.234,0.206 0.509,0.239,0.211 0.510,0.244,0.216 0.512,0.249,0.220 0.513,0.254,0.225 0.513,0.259,0.230 0.514,0.264,0.236 0.514,0.270,0.241 0.514,0.275,0.247 0.514,0.281,0.252 0.514,0.286,0.258 0.514,0.292,0.264 0.513,0.297,0.270 0.513,0.303,0.276 0.513,0.308,0.281 0.512,0.314,0.287 0.511,0.319,0.293 0.511,0.324,0.299 0.510,0.330,0.305 0.509,0.335,0.311 0.509,0.340,0.317 0.508,0.345,0.323 0.507,0.351,0.329 0.506,0.356,0.335 0.505,0.361,0.341 0.504,0.366,0.348 0.503,0.371,0.354 0.501,0.377,0.360 0.500,0.382,0.366 0.499,0.387,0.372 0.497,0.392,0.379 0.496,0.397,0.385 0.494,0.402,0.391 0.493,0.407,0.398 0.491,0.412,0.404 0.489,0.417,0.410 0.487,0.422,0.417 0.485,0.427,0.423 0.483,0.433,0.430 0.481,0.438,0.436 0.479,0.443,0.443 0.477,0.448,0.449 0.475,0.453,0.456 0.472,0.458,0.462 0.470,0.463,0.469 0.467,0.468,0.476 0.464,0.473,0.482 0.461,0.478,0.489 0.458,0.483,0.496 0.455,0.488,0.502 0.452,0.493,0.509 0.449,0.498,0.516 0.445,0.503,0.523 0.442,0.508,0.530 0.438,0.513,0.537 0.434,0.517,0.543 0.430,0.522,0.550 0.426,0.527,0.557 0.421,0.532,0.564 0.417,0.537,0.571 0.412,0.542,0.578 0.407,0.547,0.585 0.402,0.552,0.592 0.397,0.557,0.599 0.392,0.562,0.606 0.386,0.567,0.613 0.380,0.572,0.621 0.374,0.577,0.628 0.368,0.582,0.635 0.361,0.587,0.642 0.354,0.592,0.649 0.346,0.597,0.657 0.339,0.602,0.664 0.331,0.607,0.671 0.322,0.612,0.679 0.313,0.617,0.686 0.304,0.622,0.693 0.294,0.627,0.701 0.283,0.631,0.708 0.271,0.636,0.716 0.259,0.641,0.723 0.247,0.646,0.730 0.234,0.651,0.738 0.221,0.656,0.745 0.208,0.661,0.752 0.195,0.665,0.758 0.182,0.670,0.765 0.169,0.675,0.771 0.156,0.679,0.777 0.142,0.684,0.784 0.129,0.688,0.790 0.116,0.693,0.795 0.102,0.697,0.801 0.089,0.701,0.807 0.076,0.706,0.812 0.064,0.710,0.817 0.053,0.714,0.822 0.043,0.718,0.827 0.036,0.722,0.832 0.032,0.726,0.837 0.031,0.730,0.842 0.034,0.734,0.846 0.042,0.738,0.851 0.051,0.742,0.855 0.062,0.746,0.859 0.075,0.750,0.863 0.088,0.754,0.867 0.101,0.758,0.871 0.115,0.762,0.875 0.129,0.765,0.878 0.142,0.769,0.882 0.156,0.773,0.885 0.170,0.776,0.889 0.184,0.780,0.892 0.198,0.784,0.895 0.211,0.787,0.898 0.225,0.791,0.901 0.239,0.794,0.904 0.252,0.798,0.907 0.266,0.801,0.909 0.279,0.805,0.912 0.293,0.808,0.914 0.306,0.811,0.917 0.319,0.815,0.919 0.333,0.818,0.921 0.346,0.821,0.923 0.359,0.825,0.925 0.372,0.828,0.927 0.385,0.831,0.929 0.398,0.834,0.931 0.411,0.837,0.933 0.424,0.840,0.934 0.437,0.843,0.936 0.450,0.846,0.937 0.463,0.849,0.939 0.476,0.852,0.940 0.489,0.855,0.941 0.502,0.858,0.943 0.515,0.861,0.944 0.528,0.864,0.945 0.540,0.867,0.946 0.553,0.870,0.947 0.566,0.873,0.948 0.578,0.875,0.948 0.591,0.878,0.949 0.604,0.881,0.950 0.617,0.884,0.950 0.629,0.886,0.951 0.642,0.889,0.951 0.654,0.891,0.952 0.667,0.894,0.952 0.680,0.897,0.952 0.692,0.899,0.952 0.705,0.902,0.952 0.717,0.904,0.952 0.730,0.907,0.952 0.743,0.909,0.952 0.755,0.911,0.952 0.768,0.914,0.952 0.780,0.916,0.952 0.793,0.918,0.951 0.805,0.921,0.951 0.818,0.923,0.951 0.831,0.925,0.950 0.843,0.927,0.950 0.856,0.929,0.949 0.868,0.931,0.948 0.881,0.934,0.948 0.893,0.936,0.947 0.906,0.938,0.946 0.918,0.940,0.945 0.931,0.942,0.944 0.943,0.944,0.943 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D1.csv000066400000000000000000000110001457240071200234770ustar00rootroot000000000000000.128,0.316,0.858 0.147,0.320,0.859 0.164,0.325,0.860 0.179,0.329,0.861 0.194,0.333,0.862 0.207,0.338,0.863 0.220,0.342,0.864 0.232,0.346,0.864 0.243,0.351,0.865 0.254,0.355,0.866 0.264,0.360,0.867 0.274,0.364,0.868 0.284,0.369,0.869 0.294,0.373,0.869 0.303,0.377,0.870 0.312,0.382,0.871 0.321,0.386,0.872 0.329,0.391,0.873 0.337,0.395,0.874 0.346,0.400,0.874 0.354,0.404,0.875 0.362,0.409,0.876 0.369,0.414,0.877 0.377,0.418,0.878 0.384,0.423,0.878 0.392,0.427,0.879 0.399,0.432,0.880 0.406,0.436,0.881 0.413,0.441,0.882 0.420,0.446,0.882 0.427,0.450,0.883 0.434,0.455,0.884 0.440,0.460,0.885 0.447,0.464,0.886 0.454,0.469,0.886 0.460,0.474,0.887 0.467,0.478,0.888 0.473,0.483,0.889 0.479,0.488,0.889 0.485,0.492,0.890 0.492,0.497,0.891 0.498,0.502,0.892 0.504,0.507,0.892 0.510,0.511,0.893 0.516,0.516,0.894 0.522,0.521,0.895 0.528,0.526,0.895 0.534,0.530,0.896 0.540,0.535,0.897 0.545,0.540,0.898 0.551,0.545,0.898 0.557,0.550,0.899 0.563,0.555,0.900 0.568,0.559,0.900 0.574,0.564,0.901 0.580,0.569,0.902 0.585,0.574,0.903 0.591,0.579,0.903 0.596,0.584,0.904 0.602,0.588,0.905 0.607,0.593,0.905 0.613,0.598,0.906 0.618,0.603,0.907 0.623,0.608,0.907 0.629,0.613,0.908 0.634,0.618,0.909 0.639,0.623,0.909 0.645,0.628,0.910 0.650,0.633,0.911 0.655,0.638,0.911 0.660,0.643,0.912 0.666,0.648,0.913 0.671,0.653,0.913 0.676,0.658,0.914 0.681,0.663,0.915 0.686,0.668,0.915 0.691,0.673,0.916 0.697,0.678,0.917 0.702,0.683,0.917 0.707,0.688,0.918 0.712,0.693,0.918 0.717,0.698,0.919 0.722,0.703,0.920 0.727,0.708,0.920 0.732,0.713,0.921 0.737,0.718,0.921 0.742,0.723,0.922 0.747,0.728,0.923 0.752,0.733,0.923 0.757,0.738,0.924 0.762,0.743,0.924 0.766,0.748,0.925 0.771,0.754,0.926 0.776,0.759,0.926 0.781,0.764,0.927 0.786,0.769,0.927 0.791,0.774,0.928 0.796,0.779,0.928 0.801,0.784,0.929 0.805,0.789,0.929 0.810,0.795,0.930 0.815,0.800,0.930 0.820,0.805,0.931 0.825,0.810,0.932 0.829,0.815,0.932 0.834,0.821,0.933 0.839,0.826,0.933 0.844,0.831,0.934 0.848,0.836,0.934 0.853,0.841,0.935 0.858,0.846,0.935 0.863,0.852,0.935 0.867,0.857,0.936 0.872,0.862,0.936 0.877,0.867,0.936 0.881,0.872,0.937 0.886,0.876,0.937 0.890,0.881,0.936 0.895,0.885,0.936 0.899,0.890,0.936 0.903,0.893,0.935 0.908,0.897,0.934 0.912,0.900,0.932 0.916,0.903,0.931 0.919,0.905,0.928 0.923,0.906,0.926 0.926,0.907,0.923 0.929,0.907,0.919 0.932,0.907,0.915 0.935,0.905,0.911 0.937,0.904,0.906 0.939,0.901,0.900 0.941,0.898,0.895 0.942,0.895,0.888 0.944,0.891,0.882 0.945,0.887,0.875 0.946,0.882,0.869 0.946,0.877,0.861 0.947,0.872,0.854 0.947,0.866,0.847 0.948,0.861,0.840 0.948,0.855,0.832 0.948,0.849,0.825 0.948,0.843,0.817 0.948,0.837,0.810 0.948,0.831,0.802 0.948,0.825,0.794 0.948,0.819,0.787 0.948,0.813,0.779 0.947,0.807,0.772 0.947,0.800,0.764 0.947,0.794,0.757 0.947,0.788,0.749 0.946,0.782,0.742 0.946,0.776,0.734 0.945,0.770,0.727 0.945,0.764,0.719 0.944,0.758,0.712 0.944,0.752,0.704 0.943,0.746,0.697 0.942,0.740,0.689 0.942,0.733,0.682 0.941,0.727,0.675 0.940,0.721,0.667 0.940,0.715,0.660 0.939,0.709,0.653 0.938,0.703,0.645 0.937,0.697,0.638 0.936,0.691,0.631 0.935,0.685,0.623 0.934,0.679,0.616 0.933,0.673,0.609 0.932,0.666,0.601 0.931,0.660,0.594 0.930,0.654,0.587 0.929,0.648,0.580 0.928,0.642,0.573 0.927,0.636,0.565 0.925,0.630,0.558 0.924,0.624,0.551 0.923,0.618,0.544 0.922,0.612,0.537 0.920,0.605,0.530 0.919,0.599,0.522 0.917,0.593,0.515 0.916,0.587,0.508 0.915,0.581,0.501 0.913,0.575,0.494 0.912,0.569,0.487 0.910,0.562,0.480 0.908,0.556,0.473 0.907,0.550,0.466 0.905,0.544,0.459 0.904,0.538,0.452 0.902,0.531,0.445 0.900,0.525,0.438 0.898,0.519,0.431 0.897,0.513,0.424 0.895,0.507,0.417 0.893,0.500,0.410 0.891,0.494,0.403 0.889,0.488,0.396 0.887,0.481,0.390 0.885,0.475,0.383 0.884,0.469,0.376 0.882,0.463,0.369 0.880,0.456,0.362 0.878,0.450,0.355 0.875,0.443,0.349 0.873,0.437,0.342 0.871,0.431,0.335 0.869,0.424,0.328 0.867,0.418,0.322 0.865,0.411,0.315 0.863,0.405,0.308 0.860,0.398,0.301 0.858,0.391,0.295 0.856,0.385,0.288 0.854,0.378,0.281 0.851,0.372,0.275 0.849,0.365,0.268 0.846,0.358,0.261 0.844,0.351,0.255 0.842,0.344,0.248 0.839,0.337,0.241 0.837,0.331,0.235 0.834,0.323,0.228 0.832,0.316,0.222 0.829,0.309,0.215 0.827,0.302,0.208 0.824,0.295,0.202 0.821,0.287,0.195 0.819,0.280,0.188 0.816,0.272,0.182 0.813,0.265,0.175 0.811,0.257,0.169 0.808,0.249,0.162 0.805,0.241,0.155 0.803,0.233,0.148 0.800,0.224,0.142 0.797,0.216,0.135 0.794,0.207,0.128 0.791,0.198,0.121 0.788,0.189,0.115 0.786,0.179,0.108 0.783,0.169,0.101 0.780,0.159,0.093 0.777,0.148,0.086 0.774,0.137,0.079 0.771,0.124,0.071 0.768,0.111,0.064 0.765,0.096,0.056 0.762,0.080,0.047 0.759,0.061,0.039 0.756,0.036,0.030 0.752,0.008,0.022 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D10.csv000066400000000000000000000110001457240071200235570ustar00rootroot000000000000000.000,0.851,1.000 0.000,0.852,1.000 0.056,0.853,1.000 0.100,0.854,1.000 0.132,0.856,1.000 0.157,0.857,1.000 0.179,0.858,1.000 0.198,0.859,1.000 0.216,0.860,1.000 0.232,0.862,1.000 0.248,0.863,1.000 0.262,0.864,1.000 0.275,0.865,1.000 0.288,0.867,1.000 0.300,0.868,1.000 0.312,0.869,1.000 0.323,0.870,1.000 0.334,0.871,1.000 0.345,0.873,1.000 0.355,0.874,1.000 0.365,0.875,1.000 0.375,0.876,1.000 0.384,0.877,1.000 0.394,0.879,1.000 0.403,0.880,1.000 0.411,0.881,1.000 0.420,0.882,1.000 0.429,0.883,1.000 0.437,0.885,1.000 0.445,0.886,1.000 0.453,0.887,1.000 0.461,0.888,1.000 0.469,0.889,1.000 0.477,0.891,1.000 0.484,0.892,1.000 0.492,0.893,1.000 0.499,0.894,1.000 0.506,0.895,1.000 0.513,0.897,1.000 0.520,0.898,1.000 0.527,0.899,1.000 0.534,0.900,1.000 0.541,0.901,1.000 0.548,0.903,1.000 0.555,0.904,1.000 0.561,0.905,1.000 0.568,0.906,1.000 0.574,0.907,1.000 0.581,0.908,1.000 0.587,0.910,1.000 0.594,0.911,1.000 0.600,0.912,1.000 0.606,0.913,1.000 0.612,0.914,1.000 0.618,0.916,1.000 0.625,0.917,1.000 0.631,0.918,1.000 0.637,0.919,1.000 0.643,0.920,1.000 0.649,0.921,1.000 0.654,0.923,1.000 0.660,0.924,1.000 0.666,0.925,1.000 0.672,0.926,1.000 0.678,0.927,1.000 0.683,0.928,1.000 0.689,0.930,1.000 0.695,0.931,1.000 0.700,0.932,1.000 0.706,0.933,1.000 0.711,0.934,1.000 0.717,0.935,1.000 0.722,0.937,1.000 0.728,0.938,1.000 0.733,0.939,1.000 0.739,0.940,1.000 0.744,0.941,1.000 0.749,0.942,1.000 0.755,0.944,1.000 0.760,0.945,1.000 0.765,0.946,1.000 0.771,0.947,1.000 0.776,0.948,1.000 0.781,0.949,1.000 0.786,0.950,1.000 0.792,0.952,1.000 0.797,0.953,1.000 0.802,0.954,1.000 0.807,0.955,1.000 0.812,0.956,1.000 0.817,0.957,1.000 0.822,0.958,1.000 0.827,0.960,1.000 0.833,0.961,1.000 0.838,0.962,1.000 0.843,0.963,1.000 0.848,0.964,1.000 0.853,0.965,1.000 0.858,0.966,1.000 0.863,0.968,1.000 0.867,0.969,1.000 0.872,0.970,1.000 0.877,0.971,1.000 0.882,0.972,1.000 0.887,0.973,1.000 0.892,0.974,1.000 0.897,0.976,1.000 0.902,0.977,1.000 0.907,0.978,1.000 0.911,0.979,1.000 0.916,0.980,1.000 0.921,0.981,1.000 0.926,0.982,1.000 0.931,0.984,1.000 0.935,0.985,1.000 0.940,0.986,1.000 0.945,0.987,1.000 0.950,0.988,1.000 0.954,0.989,1.000 0.959,0.990,1.000 0.964,0.991,1.000 0.968,0.993,1.000 0.973,0.994,1.000 0.978,0.995,1.000 0.982,0.996,1.000 0.987,0.997,1.000 0.991,0.998,1.000 0.997,0.999,1.000 1.000,0.998,1.000 1.000,0.996,0.999 1.000,0.993,0.999 1.000,0.991,0.998 1.000,0.988,0.998 1.000,0.986,0.998 1.000,0.983,0.997 1.000,0.981,0.997 1.000,0.979,0.996 1.000,0.976,0.996 1.000,0.974,0.995 1.000,0.971,0.995 1.000,0.969,0.994 1.000,0.966,0.994 1.000,0.964,0.994 1.000,0.961,0.993 1.000,0.959,0.993 1.000,0.956,0.992 1.000,0.954,0.992 1.000,0.952,0.991 1.000,0.949,0.991 1.000,0.947,0.991 1.000,0.944,0.990 1.000,0.942,0.990 1.000,0.939,0.989 1.000,0.937,0.989 1.000,0.934,0.988 0.999,0.932,0.988 0.999,0.929,0.987 0.999,0.927,0.987 0.999,0.924,0.987 0.999,0.922,0.986 0.999,0.919,0.986 0.999,0.917,0.985 0.999,0.915,0.985 0.999,0.912,0.984 0.999,0.910,0.984 0.999,0.907,0.983 0.999,0.905,0.983 0.999,0.902,0.983 0.998,0.900,0.982 0.998,0.897,0.982 0.998,0.895,0.981 0.998,0.892,0.981 0.998,0.890,0.980 0.998,0.887,0.980 0.998,0.885,0.979 0.998,0.882,0.979 0.998,0.880,0.978 0.997,0.877,0.978 0.997,0.875,0.978 0.997,0.872,0.977 0.997,0.870,0.977 0.997,0.868,0.976 0.997,0.865,0.976 0.997,0.863,0.975 0.997,0.860,0.975 0.996,0.858,0.974 0.996,0.855,0.974 0.996,0.853,0.974 0.996,0.850,0.973 0.996,0.848,0.973 0.996,0.845,0.972 0.996,0.843,0.972 0.995,0.840,0.971 0.995,0.838,0.971 0.995,0.835,0.970 0.995,0.833,0.970 0.995,0.830,0.969 0.995,0.828,0.969 0.994,0.825,0.968 0.994,0.823,0.968 0.994,0.820,0.968 0.994,0.818,0.967 0.994,0.815,0.967 0.993,0.813,0.966 0.993,0.810,0.966 0.993,0.808,0.965 0.993,0.805,0.965 0.993,0.803,0.964 0.992,0.800,0.964 0.992,0.798,0.963 0.992,0.795,0.963 0.992,0.793,0.962 0.992,0.790,0.962 0.991,0.788,0.962 0.991,0.785,0.961 0.991,0.783,0.961 0.991,0.780,0.960 0.990,0.777,0.960 0.990,0.775,0.959 0.990,0.772,0.959 0.990,0.770,0.958 0.990,0.767,0.958 0.989,0.765,0.957 0.989,0.762,0.957 0.989,0.760,0.956 0.989,0.757,0.956 0.988,0.755,0.955 0.988,0.752,0.955 0.988,0.750,0.954 0.988,0.747,0.954 0.987,0.745,0.954 0.987,0.742,0.953 0.987,0.739,0.953 0.987,0.737,0.952 0.986,0.734,0.952 0.986,0.732,0.951 0.986,0.729,0.951 0.985,0.727,0.950 0.985,0.724,0.950 0.985,0.722,0.949 0.985,0.719,0.949 0.984,0.717,0.948 0.984,0.714,0.948 0.984,0.711,0.947 0.983,0.709,0.947 0.983,0.706,0.946 0.983,0.704,0.946 0.982,0.701,0.945 0.982,0.699,0.945 0.982,0.696,0.944 0.982,0.693,0.944 0.981,0.691,0.943 0.981,0.688,0.943 0.981,0.686,0.943 0.980,0.683,0.942 0.980,0.680,0.942 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D11.csv000066400000000000000000000110001457240071200235600ustar00rootroot000000000000000.000,0.715,1.000 0.000,0.715,1.000 0.000,0.715,1.000 0.000,0.714,1.000 0.024,0.714,1.000 0.068,0.713,0.999 0.098,0.713,0.996 0.121,0.713,0.994 0.140,0.712,0.991 0.157,0.712,0.988 0.172,0.712,0.986 0.186,0.711,0.983 0.199,0.711,0.980 0.211,0.711,0.977 0.222,0.710,0.975 0.232,0.710,0.972 0.242,0.709,0.969 0.252,0.709,0.967 0.261,0.709,0.964 0.270,0.708,0.961 0.278,0.708,0.958 0.286,0.708,0.956 0.294,0.707,0.953 0.301,0.707,0.950 0.309,0.707,0.948 0.316,0.706,0.945 0.323,0.706,0.942 0.329,0.705,0.939 0.336,0.705,0.937 0.342,0.705,0.934 0.348,0.704,0.931 0.355,0.704,0.929 0.360,0.704,0.926 0.366,0.703,0.923 0.372,0.703,0.921 0.377,0.703,0.918 0.383,0.702,0.915 0.388,0.702,0.912 0.393,0.702,0.910 0.398,0.701,0.907 0.403,0.701,0.904 0.408,0.701,0.902 0.413,0.700,0.899 0.418,0.700,0.896 0.423,0.699,0.894 0.427,0.699,0.891 0.432,0.699,0.888 0.436,0.698,0.886 0.441,0.698,0.883 0.445,0.698,0.880 0.449,0.697,0.878 0.453,0.697,0.875 0.458,0.697,0.872 0.462,0.696,0.869 0.466,0.696,0.867 0.470,0.696,0.864 0.473,0.695,0.861 0.477,0.695,0.859 0.481,0.695,0.856 0.485,0.694,0.853 0.489,0.694,0.851 0.492,0.693,0.848 0.496,0.693,0.845 0.500,0.693,0.843 0.503,0.692,0.840 0.507,0.692,0.837 0.510,0.692,0.835 0.513,0.691,0.832 0.517,0.691,0.829 0.520,0.691,0.827 0.524,0.690,0.824 0.527,0.690,0.821 0.530,0.690,0.819 0.533,0.689,0.816 0.536,0.689,0.813 0.540,0.689,0.811 0.543,0.688,0.808 0.546,0.688,0.805 0.549,0.688,0.803 0.552,0.687,0.800 0.555,0.687,0.797 0.558,0.687,0.795 0.561,0.686,0.792 0.564,0.686,0.789 0.566,0.686,0.787 0.569,0.685,0.784 0.572,0.685,0.781 0.575,0.685,0.779 0.578,0.684,0.776 0.580,0.684,0.773 0.583,0.683,0.771 0.586,0.683,0.768 0.588,0.683,0.765 0.591,0.682,0.763 0.594,0.682,0.760 0.596,0.682,0.757 0.599,0.681,0.755 0.601,0.681,0.752 0.604,0.681,0.749 0.607,0.680,0.747 0.609,0.680,0.744 0.612,0.680,0.741 0.614,0.679,0.739 0.616,0.679,0.736 0.619,0.679,0.733 0.621,0.678,0.731 0.624,0.678,0.728 0.626,0.678,0.725 0.628,0.677,0.723 0.631,0.677,0.720 0.633,0.677,0.717 0.635,0.676,0.715 0.638,0.676,0.712 0.640,0.676,0.709 0.642,0.675,0.707 0.644,0.675,0.704 0.647,0.675,0.701 0.649,0.674,0.699 0.651,0.674,0.696 0.653,0.674,0.694 0.656,0.673,0.691 0.658,0.673,0.689 0.660,0.672,0.686 0.662,0.672,0.684 0.665,0.671,0.681 0.667,0.671,0.679 0.670,0.671,0.676 0.672,0.670,0.674 0.675,0.670,0.672 0.677,0.669,0.669 0.680,0.668,0.667 0.682,0.668,0.665 0.685,0.667,0.663 0.688,0.667,0.661 0.691,0.666,0.659 0.693,0.665,0.657 0.696,0.665,0.655 0.699,0.664,0.653 0.702,0.663,0.651 0.704,0.663,0.649 0.707,0.662,0.647 0.710,0.661,0.645 0.713,0.660,0.643 0.715,0.660,0.641 0.718,0.659,0.639 0.721,0.658,0.637 0.724,0.658,0.635 0.726,0.657,0.633 0.729,0.656,0.631 0.732,0.655,0.630 0.734,0.655,0.628 0.737,0.654,0.626 0.740,0.653,0.624 0.742,0.652,0.622 0.745,0.652,0.620 0.748,0.651,0.618 0.750,0.650,0.616 0.753,0.649,0.614 0.755,0.649,0.612 0.758,0.648,0.610 0.761,0.647,0.609 0.763,0.646,0.607 0.766,0.646,0.605 0.768,0.645,0.603 0.771,0.644,0.601 0.773,0.643,0.599 0.776,0.643,0.597 0.778,0.642,0.595 0.781,0.641,0.593 0.783,0.640,0.591 0.786,0.639,0.589 0.788,0.639,0.588 0.790,0.638,0.586 0.793,0.637,0.584 0.795,0.636,0.582 0.798,0.636,0.580 0.800,0.635,0.578 0.802,0.634,0.576 0.805,0.633,0.574 0.807,0.632,0.572 0.810,0.632,0.570 0.812,0.631,0.568 0.814,0.630,0.567 0.817,0.629,0.565 0.819,0.628,0.563 0.821,0.628,0.561 0.824,0.627,0.559 0.826,0.626,0.557 0.828,0.625,0.555 0.830,0.624,0.553 0.833,0.623,0.551 0.835,0.623,0.549 0.837,0.622,0.547 0.839,0.621,0.546 0.842,0.620,0.544 0.844,0.619,0.542 0.846,0.619,0.540 0.848,0.618,0.538 0.851,0.617,0.536 0.853,0.616,0.534 0.855,0.615,0.532 0.857,0.614,0.530 0.859,0.613,0.528 0.862,0.613,0.527 0.864,0.612,0.525 0.866,0.611,0.523 0.868,0.610,0.521 0.870,0.609,0.519 0.872,0.608,0.517 0.874,0.608,0.515 0.877,0.607,0.513 0.879,0.606,0.511 0.881,0.605,0.509 0.883,0.604,0.507 0.885,0.603,0.505 0.887,0.602,0.504 0.889,0.601,0.502 0.891,0.601,0.500 0.893,0.600,0.498 0.895,0.599,0.496 0.898,0.598,0.494 0.900,0.597,0.492 0.902,0.596,0.490 0.904,0.595,0.488 0.906,0.594,0.486 0.908,0.593,0.484 0.910,0.593,0.483 0.912,0.592,0.481 0.914,0.591,0.479 0.916,0.590,0.477 0.918,0.589,0.475 0.920,0.588,0.473 0.922,0.587,0.471 0.924,0.586,0.469 0.926,0.585,0.467 0.928,0.584,0.465 0.930,0.583,0.463 0.932,0.582,0.461 0.934,0.581,0.460 0.936,0.581,0.458 0.938,0.580,0.456 0.940,0.579,0.454 0.942,0.578,0.452 0.943,0.577,0.450 0.945,0.576,0.448 0.947,0.575,0.446 0.949,0.574,0.444 0.951,0.573,0.442 0.953,0.572,0.440 0.955,0.571,0.438 0.957,0.570,0.436 0.959,0.569,0.434 0.961,0.568,0.433 0.963,0.567,0.431 0.965,0.566,0.429 0.966,0.565,0.427 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D12.csv000066400000000000000000000110001457240071200235610ustar00rootroot000000000000000.000,0.787,1.000 0.000,0.786,1.000 0.000,0.786,0.998 0.000,0.785,0.995 0.000,0.785,0.993 0.000,0.784,0.991 0.000,0.784,0.989 0.051,0.783,0.987 0.088,0.783,0.984 0.115,0.782,0.982 0.137,0.782,0.980 0.156,0.781,0.978 0.173,0.781,0.976 0.188,0.781,0.973 0.202,0.780,0.971 0.215,0.780,0.969 0.227,0.779,0.967 0.238,0.779,0.965 0.249,0.778,0.962 0.259,0.778,0.960 0.269,0.777,0.958 0.279,0.777,0.956 0.288,0.776,0.954 0.296,0.776,0.951 0.305,0.775,0.949 0.313,0.775,0.947 0.321,0.774,0.945 0.328,0.774,0.943 0.336,0.773,0.940 0.343,0.773,0.938 0.350,0.773,0.936 0.357,0.772,0.934 0.364,0.772,0.932 0.370,0.771,0.930 0.377,0.771,0.927 0.383,0.770,0.925 0.389,0.770,0.923 0.395,0.769,0.921 0.401,0.769,0.919 0.407,0.768,0.916 0.412,0.768,0.914 0.418,0.767,0.912 0.423,0.767,0.910 0.429,0.766,0.908 0.434,0.766,0.905 0.439,0.765,0.903 0.444,0.765,0.901 0.449,0.764,0.899 0.454,0.764,0.897 0.459,0.763,0.895 0.464,0.763,0.892 0.469,0.762,0.890 0.474,0.762,0.888 0.478,0.761,0.886 0.483,0.761,0.884 0.487,0.761,0.881 0.492,0.760,0.879 0.496,0.760,0.877 0.500,0.759,0.875 0.505,0.759,0.873 0.509,0.758,0.871 0.513,0.758,0.868 0.517,0.757,0.866 0.521,0.757,0.864 0.525,0.756,0.862 0.529,0.756,0.860 0.533,0.755,0.858 0.537,0.755,0.855 0.541,0.754,0.853 0.545,0.754,0.851 0.549,0.753,0.849 0.553,0.753,0.847 0.556,0.752,0.845 0.560,0.752,0.842 0.564,0.751,0.840 0.567,0.751,0.838 0.571,0.750,0.836 0.574,0.750,0.834 0.578,0.749,0.831 0.582,0.749,0.829 0.585,0.748,0.827 0.588,0.748,0.825 0.592,0.747,0.823 0.595,0.747,0.821 0.599,0.746,0.818 0.602,0.746,0.816 0.605,0.745,0.814 0.608,0.745,0.812 0.612,0.744,0.810 0.615,0.744,0.808 0.618,0.743,0.805 0.621,0.743,0.803 0.624,0.742,0.801 0.628,0.742,0.799 0.631,0.741,0.797 0.634,0.741,0.795 0.637,0.740,0.792 0.640,0.740,0.790 0.643,0.739,0.788 0.646,0.739,0.786 0.649,0.738,0.784 0.652,0.738,0.782 0.655,0.737,0.780 0.657,0.737,0.777 0.660,0.736,0.775 0.663,0.736,0.773 0.666,0.735,0.771 0.669,0.735,0.769 0.672,0.734,0.767 0.674,0.734,0.764 0.677,0.733,0.762 0.680,0.733,0.760 0.683,0.732,0.758 0.685,0.732,0.756 0.688,0.731,0.754 0.691,0.731,0.752 0.693,0.730,0.750 0.696,0.729,0.748 0.699,0.729,0.746 0.701,0.728,0.744 0.704,0.728,0.742 0.706,0.727,0.741 0.709,0.727,0.739 0.711,0.726,0.738 0.714,0.726,0.737 0.716,0.725,0.736 0.718,0.724,0.735 0.721,0.724,0.734 0.723,0.723,0.734 0.725,0.723,0.734 0.727,0.722,0.734 0.729,0.721,0.734 0.731,0.721,0.734 0.733,0.720,0.735 0.735,0.719,0.735 0.737,0.719,0.736 0.739,0.718,0.737 0.741,0.717,0.738 0.743,0.717,0.739 0.744,0.716,0.740 0.746,0.715,0.741 0.748,0.715,0.742 0.750,0.714,0.744 0.751,0.713,0.745 0.753,0.713,0.746 0.755,0.712,0.747 0.757,0.711,0.749 0.758,0.710,0.750 0.760,0.710,0.751 0.762,0.709,0.753 0.763,0.708,0.754 0.765,0.708,0.755 0.767,0.707,0.757 0.769,0.706,0.758 0.770,0.706,0.759 0.772,0.705,0.761 0.774,0.704,0.762 0.775,0.703,0.763 0.777,0.703,0.765 0.779,0.702,0.766 0.780,0.701,0.767 0.782,0.701,0.769 0.784,0.700,0.770 0.785,0.699,0.771 0.787,0.698,0.773 0.789,0.698,0.774 0.790,0.697,0.775 0.792,0.696,0.777 0.794,0.695,0.778 0.795,0.695,0.779 0.797,0.694,0.781 0.799,0.693,0.782 0.800,0.692,0.783 0.802,0.692,0.785 0.804,0.691,0.786 0.805,0.690,0.787 0.807,0.689,0.788 0.809,0.689,0.790 0.810,0.688,0.791 0.812,0.687,0.792 0.814,0.686,0.794 0.815,0.686,0.795 0.817,0.685,0.796 0.819,0.684,0.798 0.820,0.683,0.799 0.822,0.682,0.800 0.823,0.682,0.802 0.825,0.681,0.803 0.827,0.680,0.804 0.828,0.679,0.806 0.830,0.678,0.807 0.831,0.678,0.808 0.833,0.677,0.810 0.835,0.676,0.811 0.836,0.675,0.812 0.838,0.675,0.814 0.840,0.674,0.815 0.841,0.673,0.816 0.843,0.672,0.818 0.844,0.671,0.819 0.846,0.670,0.820 0.848,0.670,0.822 0.849,0.669,0.823 0.851,0.668,0.824 0.852,0.667,0.825 0.854,0.666,0.827 0.855,0.666,0.828 0.857,0.665,0.829 0.859,0.664,0.831 0.860,0.663,0.832 0.862,0.662,0.833 0.863,0.661,0.835 0.865,0.660,0.836 0.866,0.660,0.837 0.868,0.659,0.839 0.870,0.658,0.840 0.871,0.657,0.841 0.873,0.656,0.843 0.874,0.655,0.844 0.876,0.654,0.845 0.877,0.654,0.847 0.879,0.653,0.848 0.881,0.652,0.849 0.882,0.651,0.851 0.884,0.650,0.852 0.885,0.649,0.853 0.887,0.648,0.855 0.888,0.647,0.856 0.890,0.647,0.857 0.891,0.646,0.859 0.893,0.645,0.860 0.895,0.644,0.861 0.896,0.643,0.862 0.898,0.642,0.864 0.899,0.641,0.865 0.901,0.640,0.866 0.902,0.639,0.868 0.904,0.638,0.869 0.905,0.638,0.870 0.907,0.637,0.872 0.908,0.636,0.873 0.910,0.635,0.874 0.911,0.634,0.876 0.913,0.633,0.877 0.914,0.632,0.878 0.916,0.631,0.880 0.917,0.630,0.881 0.919,0.629,0.882 0.920,0.628,0.884 0.922,0.627,0.885 0.924,0.626,0.886 0.925,0.625,0.888 0.927,0.624,0.889 0.928,0.623,0.890 0.930,0.622,0.892 0.931,0.621,0.893 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D13.csv000066400000000000000000000110001457240071200235620ustar00rootroot000000000000000.066,0.176,0.408 0.070,0.181,0.416 0.074,0.186,0.424 0.078,0.191,0.433 0.083,0.196,0.441 0.087,0.200,0.449 0.091,0.205,0.458 0.095,0.210,0.466 0.099,0.215,0.475 0.103,0.220,0.483 0.107,0.225,0.491 0.111,0.230,0.500 0.114,0.235,0.508 0.118,0.241,0.516 0.122,0.246,0.525 0.126,0.251,0.533 0.129,0.256,0.542 0.133,0.261,0.550 0.136,0.267,0.558 0.140,0.272,0.567 0.143,0.277,0.575 0.147,0.283,0.583 0.150,0.288,0.591 0.154,0.294,0.600 0.157,0.299,0.608 0.160,0.305,0.616 0.163,0.310,0.624 0.166,0.316,0.633 0.169,0.321,0.641 0.172,0.327,0.649 0.175,0.333,0.657 0.178,0.338,0.665 0.181,0.344,0.673 0.184,0.350,0.681 0.186,0.356,0.689 0.189,0.362,0.697 0.191,0.368,0.705 0.194,0.374,0.713 0.196,0.380,0.721 0.198,0.386,0.729 0.200,0.392,0.736 0.202,0.398,0.744 0.204,0.404,0.752 0.206,0.410,0.759 0.207,0.416,0.767 0.209,0.423,0.774 0.210,0.429,0.781 0.211,0.436,0.789 0.212,0.442,0.796 0.213,0.449,0.803 0.213,0.455,0.810 0.214,0.462,0.817 0.214,0.468,0.824 0.214,0.475,0.831 0.214,0.482,0.838 0.213,0.489,0.844 0.212,0.496,0.851 0.211,0.502,0.857 0.210,0.509,0.863 0.208,0.517,0.869 0.206,0.524,0.875 0.205,0.531,0.881 0.203,0.538,0.887 0.200,0.545,0.892 0.199,0.552,0.898 0.197,0.560,0.903 0.196,0.567,0.908 0.195,0.574,0.913 0.194,0.581,0.917 0.195,0.588,0.922 0.196,0.596,0.926 0.198,0.603,0.931 0.201,0.610,0.935 0.206,0.617,0.939 0.211,0.624,0.942 0.217,0.631,0.946 0.224,0.637,0.950 0.231,0.644,0.953 0.240,0.651,0.956 0.249,0.658,0.959 0.259,0.665,0.962 0.270,0.671,0.965 0.281,0.678,0.967 0.293,0.684,0.970 0.305,0.691,0.972 0.317,0.697,0.974 0.330,0.704,0.976 0.343,0.710,0.978 0.356,0.716,0.979 0.370,0.723,0.981 0.384,0.729,0.982 0.398,0.735,0.983 0.412,0.741,0.984 0.427,0.747,0.985 0.441,0.753,0.985 0.456,0.759,0.986 0.471,0.765,0.986 0.486,0.771,0.986 0.502,0.777,0.986 0.517,0.783,0.986 0.532,0.788,0.986 0.548,0.794,0.985 0.563,0.800,0.985 0.579,0.805,0.984 0.595,0.811,0.983 0.610,0.816,0.982 0.626,0.822,0.981 0.641,0.827,0.979 0.657,0.833,0.978 0.672,0.838,0.977 0.687,0.844,0.975 0.702,0.849,0.974 0.717,0.855,0.972 0.732,0.860,0.970 0.747,0.865,0.969 0.761,0.871,0.967 0.776,0.876,0.965 0.789,0.881,0.963 0.803,0.887,0.961 0.816,0.892,0.959 0.828,0.897,0.957 0.840,0.902,0.955 0.850,0.906,0.952 0.859,0.910,0.949 0.866,0.914,0.945 0.872,0.917,0.941 0.875,0.919,0.937 0.876,0.921,0.932 0.875,0.922,0.926 0.871,0.922,0.921 0.865,0.921,0.914 0.857,0.920,0.908 0.848,0.918,0.901 0.836,0.916,0.894 0.824,0.913,0.886 0.810,0.910,0.879 0.796,0.906,0.871 0.781,0.902,0.864 0.766,0.899,0.856 0.750,0.895,0.848 0.734,0.891,0.841 0.718,0.886,0.833 0.702,0.882,0.825 0.685,0.878,0.818 0.669,0.874,0.810 0.653,0.870,0.802 0.636,0.865,0.795 0.620,0.861,0.787 0.603,0.856,0.779 0.587,0.852,0.772 0.570,0.848,0.764 0.554,0.843,0.756 0.537,0.838,0.748 0.521,0.834,0.740 0.505,0.829,0.732 0.489,0.824,0.724 0.473,0.819,0.716 0.458,0.814,0.707 0.442,0.809,0.699 0.427,0.804,0.690 0.412,0.799,0.682 0.397,0.794,0.673 0.383,0.789,0.664 0.368,0.783,0.655 0.354,0.778,0.647 0.341,0.772,0.638 0.327,0.767,0.628 0.314,0.761,0.619 0.301,0.756,0.610 0.288,0.750,0.601 0.276,0.745,0.591 0.264,0.739,0.581 0.252,0.733,0.572 0.241,0.727,0.562 0.230,0.721,0.552 0.220,0.715,0.542 0.211,0.709,0.532 0.201,0.703,0.522 0.193,0.697,0.512 0.185,0.691,0.502 0.178,0.685,0.492 0.171,0.679,0.481 0.165,0.673,0.471 0.160,0.667,0.460 0.155,0.660,0.450 0.152,0.654,0.439 0.149,0.648,0.428 0.146,0.641,0.418 0.145,0.635,0.407 0.143,0.629,0.396 0.142,0.622,0.386 0.142,0.616,0.375 0.141,0.609,0.365 0.141,0.603,0.355 0.140,0.597,0.345 0.140,0.590,0.335 0.139,0.584,0.325 0.139,0.577,0.315 0.138,0.571,0.306 0.137,0.564,0.297 0.136,0.558,0.288 0.135,0.552,0.279 0.134,0.545,0.271 0.132,0.539,0.263 0.131,0.533,0.255 0.129,0.526,0.247 0.127,0.520,0.239 0.125,0.514,0.232 0.123,0.507,0.225 0.121,0.501,0.217 0.119,0.495,0.211 0.116,0.488,0.204 0.114,0.482,0.197 0.112,0.476,0.191 0.109,0.470,0.184 0.107,0.463,0.178 0.104,0.457,0.172 0.101,0.451,0.166 0.099,0.445,0.160 0.096,0.438,0.154 0.093,0.432,0.149 0.090,0.426,0.143 0.087,0.420,0.138 0.084,0.414,0.132 0.082,0.408,0.127 0.078,0.402,0.122 0.075,0.395,0.117 0.072,0.389,0.112 0.069,0.383,0.108 0.066,0.377,0.103 0.063,0.371,0.098 0.060,0.365,0.094 0.057,0.359,0.089 0.053,0.353,0.085 0.050,0.347,0.081 0.047,0.341,0.076 0.043,0.335,0.072 0.040,0.329,0.068 0.037,0.324,0.064 0.033,0.318,0.060 0.030,0.312,0.057 0.027,0.306,0.053 0.024,0.300,0.049 0.021,0.294,0.045 0.019,0.289,0.042 0.016,0.283,0.038 0.013,0.277,0.035 0.011,0.271,0.032 0.009,0.265,0.029 0.007,0.260,0.026 0.005,0.254,0.023 0.004,0.248,0.020 0.002,0.243,0.016 0.001,0.237,0.013 0.001,0.232,0.009 0.000,0.226,0.006 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D1A.csv000066400000000000000000000110001457240071200236000ustar00rootroot000000000000000.092,0.161,0.447 0.093,0.165,0.458 0.095,0.170,0.469 0.096,0.174,0.481 0.098,0.178,0.492 0.099,0.182,0.504 0.101,0.187,0.515 0.102,0.191,0.527 0.103,0.196,0.538 0.104,0.200,0.550 0.106,0.204,0.562 0.107,0.209,0.573 0.108,0.213,0.585 0.109,0.218,0.597 0.111,0.222,0.609 0.112,0.227,0.621 0.113,0.231,0.633 0.114,0.236,0.645 0.115,0.240,0.657 0.116,0.245,0.669 0.118,0.249,0.681 0.119,0.254,0.693 0.121,0.259,0.704 0.122,0.263,0.716 0.124,0.268,0.728 0.127,0.273,0.740 0.129,0.278,0.751 0.133,0.282,0.762 0.137,0.287,0.773 0.141,0.292,0.784 0.147,0.297,0.794 0.153,0.302,0.804 0.159,0.307,0.813 0.167,0.312,0.822 0.175,0.317,0.830 0.184,0.322,0.838 0.194,0.328,0.845 0.203,0.333,0.852 0.214,0.338,0.858 0.224,0.344,0.864 0.235,0.349,0.870 0.246,0.355,0.875 0.257,0.361,0.879 0.268,0.366,0.884 0.279,0.372,0.888 0.290,0.378,0.892 0.300,0.384,0.896 0.311,0.390,0.899 0.321,0.395,0.903 0.332,0.401,0.906 0.342,0.407,0.910 0.352,0.413,0.913 0.361,0.419,0.916 0.371,0.425,0.920 0.380,0.431,0.923 0.390,0.437,0.926 0.399,0.443,0.930 0.408,0.449,0.933 0.417,0.455,0.936 0.426,0.462,0.939 0.434,0.468,0.943 0.443,0.474,0.946 0.452,0.480,0.949 0.460,0.486,0.952 0.469,0.492,0.956 0.477,0.498,0.959 0.485,0.505,0.962 0.494,0.511,0.965 0.502,0.517,0.968 0.510,0.523,0.970 0.518,0.530,0.973 0.526,0.536,0.976 0.535,0.543,0.978 0.543,0.549,0.980 0.551,0.555,0.982 0.559,0.562,0.984 0.567,0.568,0.986 0.576,0.575,0.987 0.584,0.582,0.988 0.592,0.588,0.989 0.600,0.595,0.990 0.608,0.602,0.990 0.617,0.608,0.991 0.625,0.615,0.991 0.633,0.622,0.990 0.641,0.629,0.990 0.649,0.636,0.990 0.657,0.643,0.989 0.665,0.650,0.989 0.672,0.657,0.988 0.680,0.664,0.987 0.688,0.671,0.986 0.696,0.678,0.985 0.703,0.685,0.985 0.711,0.692,0.984 0.718,0.699,0.983 0.726,0.706,0.982 0.733,0.713,0.981 0.740,0.720,0.980 0.747,0.727,0.979 0.755,0.734,0.978 0.762,0.742,0.977 0.769,0.749,0.976 0.776,0.756,0.975 0.783,0.763,0.973 0.790,0.770,0.972 0.797,0.778,0.971 0.804,0.785,0.970 0.810,0.792,0.969 0.817,0.799,0.968 0.824,0.806,0.967 0.831,0.814,0.965 0.837,0.821,0.964 0.844,0.828,0.963 0.851,0.835,0.961 0.857,0.841,0.960 0.864,0.848,0.958 0.871,0.854,0.956 0.877,0.861,0.953 0.883,0.866,0.951 0.890,0.872,0.948 0.896,0.876,0.944 0.902,0.881,0.940 0.909,0.884,0.936 0.914,0.887,0.931 0.920,0.889,0.926 0.926,0.889,0.920 0.931,0.890,0.913 0.936,0.889,0.906 0.941,0.887,0.898 0.946,0.884,0.889 0.950,0.880,0.881 0.954,0.876,0.871 0.958,0.871,0.861 0.961,0.865,0.851 0.965,0.858,0.841 0.968,0.851,0.830 0.970,0.844,0.820 0.973,0.836,0.809 0.975,0.828,0.798 0.977,0.820,0.786 0.979,0.811,0.775 0.980,0.802,0.764 0.982,0.794,0.753 0.983,0.785,0.742 0.984,0.776,0.730 0.986,0.767,0.719 0.987,0.758,0.708 0.988,0.748,0.697 0.988,0.739,0.686 0.989,0.730,0.675 0.990,0.721,0.664 0.990,0.712,0.652 0.991,0.703,0.641 0.991,0.694,0.630 0.991,0.684,0.619 0.991,0.675,0.609 0.991,0.666,0.598 0.991,0.657,0.587 0.991,0.647,0.576 0.991,0.638,0.565 0.991,0.629,0.554 0.990,0.619,0.543 0.990,0.610,0.533 0.989,0.601,0.522 0.989,0.591,0.511 0.988,0.582,0.501 0.987,0.572,0.490 0.986,0.563,0.480 0.985,0.554,0.470 0.983,0.544,0.459 0.982,0.535,0.449 0.980,0.525,0.439 0.978,0.516,0.429 0.976,0.507,0.419 0.974,0.498,0.410 0.971,0.488,0.400 0.969,0.479,0.391 0.966,0.470,0.382 0.963,0.461,0.373 0.959,0.453,0.364 0.956,0.444,0.356 0.952,0.435,0.347 0.948,0.426,0.339 0.944,0.418,0.330 0.940,0.409,0.322 0.936,0.401,0.314 0.931,0.392,0.306 0.927,0.384,0.299 0.922,0.375,0.291 0.917,0.367,0.283 0.912,0.358,0.276 0.908,0.350,0.268 0.903,0.341,0.260 0.898,0.333,0.253 0.893,0.324,0.245 0.888,0.315,0.238 0.883,0.306,0.230 0.878,0.297,0.223 0.873,0.288,0.215 0.868,0.279,0.208 0.863,0.270,0.200 0.858,0.260,0.193 0.853,0.251,0.186 0.848,0.241,0.178 0.843,0.231,0.171 0.837,0.221,0.164 0.832,0.211,0.156 0.827,0.200,0.149 0.821,0.190,0.142 0.816,0.179,0.135 0.810,0.168,0.128 0.804,0.156,0.121 0.798,0.145,0.114 0.792,0.133,0.108 0.786,0.121,0.101 0.779,0.109,0.095 0.772,0.097,0.090 0.765,0.085,0.084 0.757,0.073,0.079 0.750,0.061,0.074 0.742,0.049,0.070 0.733,0.037,0.065 0.724,0.027,0.062 0.715,0.019,0.058 0.706,0.012,0.056 0.697,0.007,0.053 0.687,0.004,0.051 0.677,0.002,0.049 0.667,0.001,0.047 0.657,0.001,0.045 0.646,0.001,0.044 0.636,0.002,0.043 0.625,0.003,0.042 0.615,0.004,0.041 0.604,0.006,0.040 0.594,0.008,0.039 0.583,0.009,0.038 0.573,0.011,0.037 0.562,0.013,0.036 0.552,0.014,0.034 0.542,0.016,0.033 0.531,0.017,0.032 0.521,0.019,0.030 0.511,0.020,0.029 0.500,0.021,0.027 0.490,0.022,0.026 0.480,0.023,0.024 0.470,0.024,0.023 0.460,0.025,0.021 0.450,0.026,0.019 0.440,0.026,0.017 0.430,0.027,0.015 0.420,0.027,0.013 0.410,0.028,0.011 0.400,0.028,0.009 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D2.csv000066400000000000000000000110001457240071200235000ustar00rootroot000000000000000.222,0.591,0.055 0.230,0.594,0.069 0.238,0.597,0.081 0.245,0.600,0.093 0.253,0.602,0.103 0.260,0.605,0.113 0.268,0.608,0.123 0.275,0.611,0.132 0.282,0.614,0.140 0.289,0.616,0.149 0.296,0.619,0.157 0.303,0.622,0.165 0.310,0.625,0.173 0.316,0.628,0.181 0.323,0.630,0.189 0.329,0.633,0.196 0.336,0.636,0.203 0.342,0.639,0.211 0.349,0.642,0.218 0.355,0.644,0.225 0.361,0.647,0.232 0.367,0.650,0.239 0.373,0.653,0.246 0.380,0.655,0.253 0.386,0.658,0.260 0.392,0.661,0.267 0.398,0.664,0.274 0.404,0.667,0.280 0.410,0.669,0.287 0.415,0.672,0.294 0.421,0.675,0.300 0.427,0.678,0.307 0.433,0.681,0.314 0.439,0.683,0.320 0.445,0.686,0.327 0.450,0.689,0.333 0.456,0.692,0.340 0.462,0.694,0.346 0.467,0.697,0.353 0.473,0.700,0.359 0.479,0.703,0.366 0.484,0.705,0.372 0.490,0.708,0.379 0.496,0.711,0.385 0.501,0.714,0.392 0.507,0.716,0.398 0.512,0.719,0.405 0.518,0.722,0.411 0.523,0.725,0.417 0.529,0.728,0.424 0.534,0.730,0.430 0.540,0.733,0.437 0.545,0.736,0.443 0.550,0.739,0.449 0.556,0.741,0.456 0.561,0.744,0.462 0.567,0.747,0.469 0.572,0.750,0.475 0.578,0.752,0.482 0.583,0.755,0.488 0.588,0.758,0.494 0.594,0.760,0.501 0.599,0.763,0.507 0.604,0.766,0.514 0.610,0.769,0.520 0.615,0.771,0.526 0.620,0.774,0.533 0.626,0.777,0.539 0.631,0.780,0.546 0.636,0.782,0.552 0.641,0.785,0.559 0.647,0.788,0.565 0.652,0.791,0.571 0.657,0.793,0.578 0.663,0.796,0.584 0.668,0.799,0.591 0.673,0.802,0.597 0.678,0.804,0.604 0.684,0.807,0.610 0.689,0.810,0.617 0.694,0.812,0.623 0.699,0.815,0.630 0.704,0.818,0.636 0.710,0.821,0.643 0.715,0.823,0.649 0.720,0.826,0.656 0.725,0.829,0.662 0.730,0.832,0.669 0.736,0.834,0.675 0.741,0.837,0.682 0.746,0.840,0.688 0.751,0.842,0.695 0.756,0.845,0.701 0.762,0.848,0.708 0.767,0.851,0.714 0.772,0.853,0.721 0.777,0.856,0.728 0.782,0.859,0.734 0.787,0.861,0.741 0.793,0.864,0.747 0.798,0.867,0.754 0.803,0.870,0.760 0.808,0.872,0.767 0.813,0.875,0.774 0.818,0.878,0.780 0.823,0.880,0.787 0.829,0.883,0.794 0.834,0.886,0.800 0.839,0.888,0.807 0.844,0.891,0.813 0.849,0.894,0.820 0.854,0.897,0.827 0.859,0.899,0.833 0.864,0.902,0.840 0.869,0.904,0.847 0.874,0.907,0.853 0.879,0.909,0.860 0.884,0.911,0.866 0.889,0.914,0.872 0.893,0.915,0.878 0.898,0.917,0.884 0.902,0.919,0.890 0.906,0.920,0.896 0.910,0.921,0.901 0.913,0.922,0.906 0.917,0.922,0.911 0.919,0.922,0.915 0.922,0.921,0.919 0.924,0.920,0.923 0.926,0.919,0.926 0.927,0.917,0.929 0.928,0.915,0.931 0.929,0.912,0.933 0.929,0.909,0.935 0.929,0.906,0.936 0.929,0.903,0.937 0.929,0.899,0.938 0.928,0.895,0.939 0.927,0.891,0.939 0.926,0.887,0.939 0.925,0.883,0.939 0.924,0.879,0.939 0.923,0.874,0.939 0.921,0.870,0.939 0.920,0.865,0.939 0.919,0.861,0.939 0.917,0.856,0.939 0.916,0.852,0.938 0.915,0.847,0.938 0.913,0.843,0.938 0.912,0.838,0.938 0.910,0.834,0.937 0.909,0.830,0.937 0.907,0.825,0.937 0.906,0.821,0.936 0.905,0.816,0.936 0.903,0.812,0.936 0.902,0.807,0.935 0.900,0.803,0.935 0.899,0.798,0.935 0.897,0.794,0.935 0.896,0.789,0.934 0.894,0.785,0.934 0.893,0.780,0.934 0.891,0.776,0.933 0.890,0.771,0.933 0.888,0.767,0.933 0.886,0.762,0.932 0.885,0.758,0.932 0.883,0.753,0.932 0.882,0.749,0.931 0.880,0.744,0.931 0.879,0.740,0.931 0.877,0.735,0.930 0.875,0.731,0.930 0.874,0.726,0.930 0.872,0.722,0.929 0.871,0.717,0.929 0.869,0.713,0.929 0.867,0.708,0.928 0.866,0.704,0.928 0.864,0.699,0.928 0.862,0.695,0.927 0.861,0.690,0.927 0.859,0.686,0.926 0.857,0.681,0.926 0.856,0.677,0.926 0.854,0.672,0.925 0.852,0.668,0.925 0.850,0.663,0.925 0.849,0.659,0.924 0.847,0.654,0.924 0.845,0.650,0.923 0.844,0.645,0.923 0.842,0.640,0.923 0.840,0.636,0.922 0.838,0.631,0.922 0.836,0.627,0.921 0.835,0.622,0.921 0.833,0.618,0.921 0.831,0.613,0.920 0.829,0.609,0.920 0.828,0.604,0.919 0.826,0.599,0.919 0.824,0.595,0.919 0.822,0.590,0.918 0.820,0.586,0.918 0.818,0.581,0.917 0.816,0.577,0.917 0.815,0.572,0.917 0.813,0.567,0.916 0.811,0.563,0.916 0.809,0.558,0.915 0.807,0.554,0.915 0.805,0.549,0.914 0.803,0.544,0.914 0.801,0.540,0.914 0.799,0.535,0.913 0.797,0.530,0.913 0.796,0.526,0.912 0.794,0.521,0.912 0.792,0.516,0.911 0.790,0.512,0.911 0.788,0.507,0.910 0.786,0.502,0.910 0.784,0.498,0.910 0.782,0.493,0.909 0.780,0.488,0.909 0.778,0.483,0.908 0.776,0.479,0.908 0.774,0.474,0.907 0.772,0.469,0.907 0.769,0.464,0.906 0.767,0.460,0.906 0.765,0.455,0.905 0.763,0.450,0.905 0.761,0.445,0.904 0.759,0.440,0.904 0.757,0.435,0.903 0.755,0.431,0.903 0.753,0.426,0.902 0.751,0.421,0.902 0.749,0.416,0.902 0.746,0.411,0.901 0.744,0.406,0.901 0.742,0.401,0.900 0.740,0.396,0.900 0.738,0.391,0.899 0.736,0.386,0.899 0.733,0.381,0.898 0.731,0.376,0.898 0.729,0.371,0.897 0.727,0.365,0.897 0.724,0.360,0.896 0.722,0.355,0.895 0.720,0.350,0.895 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D3.csv000066400000000000000000000110001457240071200235010ustar00rootroot000000000000000.222,0.591,0.055 0.230,0.594,0.069 0.238,0.597,0.081 0.245,0.600,0.093 0.253,0.602,0.103 0.260,0.605,0.113 0.268,0.608,0.123 0.275,0.611,0.132 0.282,0.614,0.140 0.289,0.616,0.149 0.296,0.619,0.157 0.303,0.622,0.165 0.310,0.625,0.173 0.316,0.628,0.181 0.323,0.630,0.189 0.329,0.633,0.196 0.336,0.636,0.203 0.342,0.639,0.211 0.349,0.642,0.218 0.355,0.644,0.225 0.361,0.647,0.232 0.367,0.650,0.239 0.373,0.653,0.246 0.380,0.655,0.253 0.386,0.658,0.260 0.392,0.661,0.267 0.398,0.664,0.274 0.404,0.667,0.280 0.410,0.669,0.287 0.415,0.672,0.294 0.421,0.675,0.300 0.427,0.678,0.307 0.433,0.681,0.314 0.439,0.683,0.320 0.445,0.686,0.327 0.450,0.689,0.333 0.456,0.692,0.340 0.462,0.694,0.346 0.467,0.697,0.353 0.473,0.700,0.359 0.479,0.703,0.366 0.484,0.705,0.372 0.490,0.708,0.379 0.496,0.711,0.385 0.501,0.714,0.392 0.507,0.716,0.398 0.512,0.719,0.405 0.518,0.722,0.411 0.523,0.725,0.417 0.529,0.728,0.424 0.534,0.730,0.430 0.540,0.733,0.437 0.545,0.736,0.443 0.550,0.739,0.449 0.556,0.741,0.456 0.561,0.744,0.462 0.567,0.747,0.469 0.572,0.750,0.475 0.578,0.752,0.482 0.583,0.755,0.488 0.588,0.758,0.494 0.594,0.760,0.501 0.599,0.763,0.507 0.604,0.766,0.514 0.610,0.769,0.520 0.615,0.771,0.526 0.620,0.774,0.533 0.626,0.777,0.539 0.631,0.780,0.546 0.636,0.782,0.552 0.641,0.785,0.559 0.647,0.788,0.565 0.652,0.791,0.571 0.657,0.793,0.578 0.663,0.796,0.584 0.668,0.799,0.591 0.673,0.802,0.597 0.678,0.804,0.604 0.684,0.807,0.610 0.689,0.810,0.617 0.694,0.812,0.623 0.699,0.815,0.630 0.704,0.818,0.636 0.710,0.821,0.643 0.715,0.823,0.649 0.720,0.826,0.656 0.725,0.829,0.662 0.730,0.832,0.669 0.736,0.834,0.675 0.741,0.837,0.682 0.746,0.840,0.688 0.751,0.842,0.695 0.756,0.845,0.701 0.762,0.848,0.708 0.767,0.851,0.714 0.772,0.853,0.721 0.777,0.856,0.728 0.782,0.859,0.734 0.787,0.861,0.741 0.793,0.864,0.747 0.798,0.867,0.754 0.803,0.870,0.760 0.808,0.872,0.767 0.813,0.875,0.774 0.818,0.878,0.780 0.823,0.880,0.787 0.829,0.883,0.794 0.834,0.886,0.800 0.839,0.888,0.807 0.844,0.891,0.813 0.849,0.894,0.820 0.854,0.897,0.827 0.859,0.899,0.833 0.865,0.902,0.840 0.870,0.904,0.846 0.875,0.907,0.852 0.880,0.909,0.859 0.885,0.911,0.865 0.890,0.913,0.870 0.895,0.915,0.876 0.900,0.917,0.881 0.904,0.919,0.886 0.909,0.920,0.890 0.914,0.921,0.894 0.918,0.921,0.897 0.922,0.921,0.900 0.926,0.921,0.902 0.930,0.920,0.903 0.934,0.919,0.904 0.937,0.917,0.904 0.940,0.915,0.903 0.943,0.913,0.901 0.946,0.910,0.899 0.948,0.907,0.897 0.950,0.904,0.893 0.952,0.900,0.890 0.954,0.896,0.886 0.956,0.892,0.881 0.957,0.888,0.876 0.959,0.884,0.872 0.960,0.879,0.866 0.961,0.874,0.861 0.962,0.870,0.856 0.964,0.865,0.850 0.965,0.860,0.845 0.966,0.856,0.839 0.966,0.851,0.834 0.967,0.846,0.828 0.968,0.841,0.823 0.969,0.837,0.817 0.970,0.832,0.812 0.971,0.827,0.806 0.971,0.822,0.800 0.972,0.817,0.795 0.973,0.813,0.789 0.973,0.808,0.784 0.974,0.803,0.778 0.975,0.798,0.773 0.975,0.793,0.767 0.976,0.789,0.762 0.976,0.784,0.756 0.977,0.779,0.751 0.977,0.774,0.745 0.978,0.769,0.740 0.978,0.765,0.734 0.979,0.760,0.729 0.979,0.755,0.723 0.979,0.750,0.718 0.980,0.745,0.712 0.980,0.740,0.707 0.980,0.736,0.701 0.980,0.731,0.696 0.981,0.726,0.691 0.981,0.721,0.685 0.981,0.716,0.680 0.981,0.711,0.674 0.981,0.707,0.669 0.981,0.702,0.664 0.982,0.697,0.658 0.982,0.692,0.653 0.982,0.687,0.647 0.982,0.682,0.642 0.982,0.677,0.637 0.982,0.672,0.631 0.982,0.668,0.626 0.981,0.663,0.621 0.981,0.658,0.615 0.981,0.653,0.610 0.981,0.648,0.605 0.981,0.643,0.600 0.981,0.638,0.594 0.981,0.633,0.589 0.980,0.628,0.584 0.980,0.623,0.578 0.980,0.618,0.573 0.980,0.613,0.568 0.979,0.608,0.563 0.979,0.603,0.557 0.979,0.598,0.552 0.978,0.593,0.547 0.978,0.588,0.542 0.977,0.583,0.536 0.977,0.578,0.531 0.977,0.573,0.526 0.976,0.568,0.521 0.976,0.563,0.516 0.975,0.558,0.511 0.975,0.553,0.505 0.974,0.548,0.500 0.974,0.543,0.495 0.973,0.538,0.490 0.972,0.532,0.485 0.972,0.527,0.480 0.971,0.522,0.475 0.970,0.517,0.469 0.970,0.512,0.464 0.969,0.507,0.459 0.968,0.501,0.454 0.968,0.496,0.449 0.967,0.491,0.444 0.966,0.486,0.439 0.965,0.480,0.434 0.965,0.475,0.429 0.964,0.470,0.424 0.963,0.464,0.419 0.962,0.459,0.414 0.961,0.453,0.409 0.960,0.448,0.404 0.960,0.442,0.399 0.959,0.437,0.394 0.958,0.431,0.389 0.957,0.426,0.384 0.956,0.420,0.379 0.955,0.415,0.374 0.954,0.409,0.369 0.953,0.403,0.364 0.952,0.398,0.359 0.951,0.392,0.354 0.950,0.386,0.349 0.949,0.380,0.344 0.947,0.374,0.340 0.946,0.368,0.335 0.945,0.363,0.330 0.944,0.356,0.325 0.943,0.350,0.320 0.942,0.344,0.315 0.941,0.338,0.310 0.939,0.332,0.306 0.938,0.325,0.301 0.937,0.319,0.296 0.936,0.312,0.291 0.934,0.306,0.286 0.933,0.299,0.281 0.932,0.292,0.277 0.931,0.286,0.272 0.929,0.279,0.267 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D4.csv000066400000000000000000000110001457240071200235020ustar00rootroot000000000000000.097,0.507,0.982 0.103,0.504,0.974 0.109,0.500,0.967 0.114,0.497,0.959 0.118,0.493,0.951 0.123,0.490,0.943 0.127,0.487,0.936 0.131,0.483,0.928 0.135,0.480,0.920 0.138,0.476,0.913 0.141,0.473,0.905 0.145,0.469,0.897 0.148,0.466,0.890 0.150,0.463,0.882 0.153,0.459,0.874 0.156,0.456,0.867 0.158,0.452,0.859 0.161,0.449,0.852 0.163,0.445,0.844 0.165,0.442,0.837 0.167,0.439,0.829 0.169,0.435,0.822 0.171,0.432,0.814 0.172,0.429,0.807 0.174,0.425,0.799 0.176,0.422,0.792 0.177,0.418,0.784 0.179,0.415,0.777 0.180,0.412,0.769 0.181,0.408,0.762 0.182,0.405,0.754 0.184,0.402,0.747 0.185,0.398,0.740 0.186,0.395,0.732 0.187,0.392,0.725 0.188,0.389,0.718 0.188,0.385,0.710 0.189,0.382,0.703 0.190,0.379,0.696 0.191,0.375,0.688 0.191,0.372,0.681 0.192,0.369,0.674 0.192,0.365,0.667 0.193,0.362,0.659 0.193,0.359,0.652 0.194,0.356,0.645 0.194,0.352,0.638 0.194,0.349,0.631 0.194,0.346,0.624 0.195,0.343,0.616 0.195,0.340,0.609 0.195,0.336,0.602 0.195,0.333,0.595 0.195,0.330,0.588 0.195,0.327,0.581 0.195,0.323,0.574 0.195,0.320,0.567 0.195,0.317,0.560 0.195,0.314,0.553 0.194,0.311,0.546 0.194,0.308,0.539 0.194,0.304,0.532 0.194,0.301,0.525 0.193,0.298,0.518 0.193,0.295,0.511 0.192,0.292,0.504 0.192,0.289,0.497 0.192,0.286,0.491 0.191,0.282,0.484 0.190,0.279,0.477 0.190,0.276,0.470 0.189,0.273,0.463 0.189,0.270,0.457 0.188,0.267,0.450 0.187,0.264,0.443 0.187,0.261,0.436 0.186,0.258,0.430 0.185,0.255,0.423 0.184,0.252,0.416 0.183,0.249,0.410 0.182,0.245,0.403 0.182,0.242,0.396 0.181,0.239,0.390 0.180,0.236,0.383 0.179,0.233,0.377 0.178,0.230,0.370 0.177,0.227,0.364 0.176,0.224,0.357 0.174,0.221,0.351 0.173,0.218,0.344 0.172,0.215,0.338 0.171,0.213,0.331 0.170,0.210,0.325 0.168,0.207,0.319 0.167,0.204,0.312 0.166,0.201,0.306 0.165,0.198,0.300 0.163,0.195,0.293 0.162,0.192,0.287 0.160,0.189,0.281 0.159,0.186,0.275 0.158,0.183,0.268 0.156,0.180,0.262 0.155,0.178,0.256 0.153,0.175,0.250 0.151,0.172,0.244 0.150,0.169,0.238 0.148,0.166,0.232 0.147,0.163,0.226 0.145,0.161,0.220 0.143,0.158,0.214 0.142,0.155,0.208 0.140,0.152,0.202 0.139,0.150,0.196 0.137,0.147,0.190 0.135,0.144,0.184 0.134,0.142,0.179 0.133,0.139,0.173 0.132,0.137,0.168 0.131,0.134,0.163 0.130,0.132,0.158 0.129,0.130,0.153 0.129,0.128,0.148 0.129,0.127,0.144 0.129,0.125,0.140 0.130,0.124,0.137 0.132,0.123,0.133 0.133,0.123,0.131 0.135,0.122,0.128 0.138,0.122,0.126 0.141,0.122,0.124 0.144,0.122,0.123 0.148,0.123,0.122 0.152,0.124,0.121 0.156,0.125,0.121 0.161,0.126,0.121 0.165,0.127,0.121 0.170,0.129,0.122 0.176,0.130,0.122 0.181,0.132,0.123 0.186,0.133,0.124 0.192,0.135,0.125 0.197,0.137,0.126 0.203,0.139,0.127 0.209,0.140,0.128 0.214,0.142,0.129 0.220,0.144,0.130 0.226,0.146,0.131 0.232,0.148,0.132 0.237,0.149,0.133 0.243,0.151,0.135 0.249,0.153,0.136 0.255,0.155,0.137 0.260,0.156,0.138 0.266,0.158,0.139 0.272,0.160,0.140 0.278,0.162,0.142 0.284,0.163,0.143 0.289,0.165,0.144 0.295,0.167,0.145 0.301,0.169,0.146 0.307,0.170,0.147 0.313,0.172,0.148 0.319,0.174,0.150 0.325,0.176,0.151 0.330,0.177,0.152 0.336,0.179,0.153 0.342,0.181,0.154 0.348,0.182,0.155 0.354,0.184,0.157 0.360,0.186,0.158 0.366,0.187,0.159 0.372,0.189,0.160 0.378,0.191,0.161 0.384,0.192,0.162 0.390,0.194,0.163 0.396,0.196,0.165 0.402,0.197,0.166 0.408,0.199,0.167 0.414,0.201,0.168 0.420,0.202,0.169 0.426,0.204,0.170 0.432,0.206,0.172 0.438,0.207,0.173 0.444,0.209,0.174 0.450,0.210,0.175 0.456,0.212,0.176 0.463,0.214,0.177 0.469,0.215,0.179 0.475,0.217,0.180 0.481,0.218,0.181 0.487,0.220,0.182 0.493,0.222,0.183 0.499,0.223,0.184 0.506,0.225,0.185 0.512,0.226,0.187 0.518,0.228,0.188 0.524,0.229,0.189 0.530,0.231,0.190 0.537,0.232,0.191 0.543,0.234,0.192 0.549,0.236,0.194 0.556,0.237,0.195 0.562,0.239,0.196 0.568,0.240,0.197 0.574,0.242,0.198 0.581,0.243,0.199 0.587,0.245,0.201 0.593,0.246,0.202 0.600,0.248,0.203 0.606,0.249,0.204 0.612,0.251,0.205 0.619,0.252,0.206 0.625,0.254,0.208 0.632,0.255,0.209 0.638,0.257,0.210 0.644,0.258,0.211 0.651,0.260,0.212 0.657,0.261,0.213 0.664,0.263,0.215 0.670,0.264,0.216 0.677,0.266,0.217 0.683,0.267,0.218 0.690,0.268,0.219 0.696,0.270,0.220 0.703,0.271,0.222 0.709,0.273,0.223 0.716,0.274,0.224 0.722,0.276,0.225 0.729,0.277,0.226 0.735,0.278,0.227 0.742,0.280,0.229 0.748,0.281,0.230 0.755,0.283,0.231 0.762,0.284,0.232 0.768,0.286,0.233 0.775,0.287,0.234 0.782,0.288,0.236 0.788,0.290,0.237 0.795,0.291,0.238 0.801,0.292,0.239 0.808,0.294,0.240 0.815,0.295,0.241 0.821,0.297,0.243 0.828,0.298,0.244 0.835,0.299,0.245 0.842,0.301,0.246 0.848,0.302,0.247 0.855,0.303,0.249 0.862,0.305,0.250 0.868,0.306,0.251 0.875,0.307,0.252 0.882,0.309,0.253 0.889,0.310,0.254 0.896,0.311,0.256 0.902,0.313,0.257 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D6.csv000066400000000000000000000110001457240071200235040ustar00rootroot000000000000000.057,0.580,0.981 0.066,0.575,0.973 0.074,0.571,0.966 0.082,0.567,0.958 0.089,0.563,0.950 0.095,0.559,0.943 0.101,0.555,0.935 0.106,0.551,0.927 0.111,0.547,0.919 0.116,0.543,0.912 0.120,0.539,0.904 0.124,0.535,0.896 0.128,0.531,0.889 0.132,0.526,0.881 0.135,0.522,0.874 0.138,0.518,0.866 0.141,0.514,0.858 0.144,0.510,0.851 0.147,0.506,0.843 0.150,0.502,0.836 0.152,0.498,0.828 0.155,0.494,0.821 0.157,0.490,0.813 0.159,0.486,0.806 0.161,0.482,0.798 0.163,0.478,0.791 0.165,0.474,0.783 0.167,0.470,0.776 0.168,0.466,0.768 0.170,0.462,0.761 0.172,0.458,0.754 0.173,0.455,0.746 0.174,0.451,0.739 0.176,0.447,0.732 0.177,0.443,0.724 0.178,0.439,0.717 0.179,0.435,0.710 0.180,0.431,0.702 0.181,0.427,0.695 0.182,0.423,0.688 0.183,0.419,0.680 0.184,0.415,0.673 0.184,0.412,0.666 0.185,0.408,0.659 0.186,0.404,0.651 0.186,0.400,0.644 0.187,0.396,0.637 0.187,0.392,0.630 0.188,0.388,0.623 0.188,0.385,0.616 0.188,0.381,0.609 0.189,0.377,0.601 0.189,0.373,0.594 0.189,0.369,0.587 0.189,0.366,0.580 0.189,0.362,0.573 0.189,0.358,0.566 0.189,0.354,0.559 0.189,0.351,0.552 0.189,0.347,0.545 0.189,0.343,0.538 0.189,0.339,0.531 0.189,0.336,0.524 0.189,0.332,0.517 0.188,0.328,0.510 0.188,0.324,0.504 0.188,0.321,0.497 0.187,0.317,0.490 0.187,0.313,0.483 0.186,0.310,0.476 0.186,0.306,0.469 0.186,0.302,0.463 0.185,0.299,0.456 0.184,0.295,0.449 0.184,0.291,0.442 0.183,0.288,0.436 0.182,0.284,0.429 0.182,0.281,0.422 0.181,0.277,0.416 0.180,0.273,0.409 0.180,0.270,0.402 0.179,0.266,0.396 0.178,0.263,0.389 0.177,0.259,0.383 0.176,0.255,0.376 0.175,0.252,0.370 0.174,0.248,0.363 0.173,0.245,0.357 0.172,0.241,0.350 0.171,0.238,0.344 0.170,0.234,0.337 0.169,0.231,0.331 0.168,0.227,0.324 0.166,0.224,0.318 0.165,0.220,0.312 0.164,0.217,0.305 0.163,0.214,0.299 0.162,0.210,0.293 0.160,0.207,0.287 0.159,0.203,0.280 0.157,0.200,0.274 0.156,0.196,0.268 0.155,0.193,0.262 0.153,0.190,0.256 0.152,0.186,0.249 0.150,0.183,0.243 0.149,0.180,0.237 0.147,0.176,0.231 0.146,0.173,0.225 0.144,0.170,0.219 0.142,0.166,0.213 0.141,0.163,0.207 0.139,0.160,0.201 0.138,0.157,0.195 0.136,0.154,0.190 0.135,0.151,0.184 0.133,0.148,0.178 0.132,0.145,0.173 0.130,0.142,0.167 0.129,0.139,0.162 0.128,0.137,0.157 0.127,0.135,0.152 0.127,0.133,0.148 0.127,0.131,0.143 0.127,0.129,0.139 0.127,0.128,0.135 0.127,0.128,0.132 0.128,0.127,0.129 0.130,0.127,0.126 0.131,0.127,0.124 0.133,0.128,0.122 0.135,0.129,0.120 0.138,0.130,0.119 0.141,0.131,0.118 0.144,0.133,0.117 0.147,0.135,0.116 0.151,0.137,0.116 0.155,0.140,0.116 0.159,0.142,0.116 0.162,0.145,0.116 0.167,0.148,0.116 0.171,0.151,0.116 0.175,0.154,0.117 0.179,0.157,0.117 0.183,0.160,0.117 0.188,0.163,0.118 0.192,0.166,0.118 0.196,0.169,0.119 0.201,0.172,0.119 0.205,0.175,0.120 0.209,0.178,0.120 0.214,0.181,0.121 0.218,0.184,0.121 0.222,0.187,0.121 0.227,0.191,0.122 0.231,0.194,0.122 0.236,0.197,0.123 0.240,0.200,0.123 0.244,0.203,0.123 0.249,0.207,0.124 0.253,0.210,0.124 0.257,0.213,0.125 0.262,0.216,0.125 0.266,0.219,0.125 0.271,0.223,0.126 0.275,0.226,0.126 0.280,0.229,0.126 0.284,0.232,0.126 0.288,0.236,0.127 0.293,0.239,0.127 0.297,0.242,0.127 0.302,0.245,0.128 0.306,0.249,0.128 0.311,0.252,0.128 0.315,0.255,0.128 0.320,0.259,0.129 0.324,0.262,0.129 0.329,0.265,0.129 0.333,0.269,0.129 0.338,0.272,0.129 0.342,0.275,0.129 0.347,0.279,0.130 0.352,0.282,0.130 0.356,0.286,0.130 0.361,0.289,0.130 0.365,0.292,0.130 0.370,0.296,0.130 0.374,0.299,0.130 0.379,0.303,0.131 0.384,0.306,0.131 0.388,0.309,0.131 0.393,0.313,0.131 0.397,0.316,0.131 0.402,0.320,0.131 0.407,0.323,0.131 0.411,0.327,0.131 0.416,0.330,0.131 0.421,0.334,0.131 0.425,0.337,0.131 0.430,0.341,0.131 0.435,0.344,0.131 0.439,0.348,0.131 0.444,0.351,0.131 0.449,0.355,0.130 0.453,0.358,0.130 0.458,0.362,0.130 0.463,0.365,0.130 0.468,0.369,0.130 0.472,0.372,0.130 0.477,0.376,0.130 0.482,0.379,0.129 0.487,0.383,0.129 0.491,0.386,0.129 0.496,0.390,0.129 0.501,0.394,0.129 0.506,0.397,0.128 0.510,0.401,0.128 0.515,0.404,0.128 0.520,0.408,0.127 0.525,0.412,0.127 0.530,0.415,0.127 0.534,0.419,0.126 0.539,0.422,0.126 0.544,0.426,0.126 0.549,0.430,0.125 0.554,0.433,0.125 0.559,0.437,0.124 0.564,0.441,0.124 0.568,0.444,0.123 0.573,0.448,0.123 0.578,0.452,0.122 0.583,0.455,0.122 0.588,0.459,0.121 0.593,0.463,0.121 0.598,0.466,0.120 0.603,0.470,0.120 0.608,0.474,0.119 0.613,0.477,0.118 0.618,0.481,0.118 0.622,0.485,0.117 0.627,0.489,0.116 0.632,0.492,0.115 0.637,0.496,0.115 0.642,0.500,0.114 0.647,0.503,0.113 0.652,0.507,0.112 0.657,0.511,0.111 0.662,0.515,0.110 0.667,0.518,0.109 0.672,0.522,0.108 0.677,0.526,0.107 0.682,0.530,0.106 0.687,0.534,0.105 0.692,0.537,0.104 0.697,0.541,0.103 0.702,0.545,0.102 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D7.csv000066400000000000000000000110001457240071200235050ustar00rootroot000000000000000.078,0.193,0.758 0.095,0.196,0.757 0.110,0.199,0.756 0.123,0.202,0.754 0.135,0.205,0.753 0.146,0.208,0.751 0.156,0.210,0.750 0.166,0.213,0.749 0.175,0.216,0.747 0.183,0.219,0.746 0.191,0.222,0.745 0.199,0.225,0.743 0.206,0.228,0.742 0.213,0.230,0.740 0.220,0.233,0.739 0.227,0.236,0.738 0.233,0.239,0.736 0.240,0.242,0.735 0.246,0.245,0.733 0.251,0.248,0.732 0.257,0.250,0.731 0.263,0.253,0.729 0.268,0.256,0.728 0.273,0.259,0.727 0.278,0.262,0.725 0.283,0.265,0.724 0.288,0.268,0.722 0.293,0.271,0.721 0.298,0.273,0.719 0.303,0.276,0.718 0.307,0.279,0.717 0.312,0.282,0.715 0.316,0.285,0.714 0.320,0.288,0.712 0.324,0.291,0.711 0.329,0.294,0.710 0.333,0.296,0.708 0.337,0.299,0.707 0.341,0.302,0.705 0.345,0.305,0.704 0.348,0.308,0.703 0.352,0.311,0.701 0.356,0.314,0.700 0.360,0.317,0.698 0.363,0.320,0.697 0.367,0.322,0.695 0.370,0.325,0.694 0.374,0.328,0.692 0.377,0.331,0.691 0.381,0.334,0.690 0.384,0.337,0.688 0.387,0.340,0.687 0.391,0.343,0.685 0.394,0.346,0.684 0.397,0.349,0.682 0.400,0.351,0.681 0.403,0.354,0.679 0.406,0.357,0.678 0.410,0.360,0.676 0.413,0.363,0.675 0.416,0.366,0.674 0.418,0.369,0.672 0.421,0.372,0.671 0.424,0.375,0.669 0.427,0.378,0.668 0.430,0.381,0.666 0.433,0.384,0.665 0.436,0.387,0.663 0.438,0.389,0.662 0.441,0.392,0.660 0.444,0.395,0.659 0.447,0.398,0.657 0.449,0.401,0.656 0.452,0.404,0.654 0.454,0.407,0.653 0.457,0.410,0.651 0.460,0.413,0.650 0.462,0.416,0.648 0.465,0.419,0.647 0.467,0.422,0.645 0.470,0.425,0.644 0.472,0.428,0.642 0.474,0.431,0.641 0.477,0.434,0.639 0.479,0.437,0.637 0.482,0.440,0.636 0.484,0.443,0.634 0.486,0.445,0.633 0.489,0.448,0.631 0.491,0.451,0.630 0.493,0.454,0.628 0.495,0.457,0.627 0.498,0.460,0.625 0.500,0.463,0.624 0.502,0.466,0.622 0.504,0.469,0.620 0.506,0.472,0.619 0.509,0.475,0.617 0.511,0.478,0.616 0.513,0.481,0.614 0.515,0.484,0.612 0.517,0.487,0.611 0.519,0.490,0.609 0.521,0.493,0.608 0.523,0.496,0.606 0.525,0.499,0.604 0.527,0.502,0.603 0.529,0.505,0.601 0.531,0.508,0.600 0.533,0.511,0.598 0.535,0.514,0.596 0.537,0.517,0.595 0.539,0.520,0.593 0.541,0.523,0.591 0.543,0.526,0.590 0.544,0.529,0.588 0.546,0.532,0.586 0.548,0.535,0.585 0.550,0.538,0.583 0.552,0.541,0.581 0.554,0.544,0.580 0.555,0.547,0.578 0.557,0.550,0.576 0.559,0.553,0.575 0.561,0.556,0.573 0.562,0.559,0.571 0.564,0.562,0.569 0.566,0.565,0.568 0.569,0.568,0.566 0.573,0.570,0.563 0.577,0.573,0.561 0.581,0.575,0.559 0.585,0.578,0.556 0.589,0.580,0.554 0.593,0.582,0.552 0.597,0.585,0.549 0.601,0.587,0.547 0.605,0.590,0.544 0.609,0.592,0.542 0.613,0.595,0.539 0.616,0.597,0.537 0.620,0.599,0.535 0.624,0.602,0.532 0.628,0.604,0.530 0.632,0.607,0.527 0.635,0.609,0.525 0.639,0.612,0.522 0.643,0.614,0.520 0.646,0.616,0.517 0.650,0.619,0.515 0.654,0.621,0.512 0.657,0.624,0.510 0.661,0.626,0.507 0.665,0.629,0.505 0.668,0.631,0.502 0.672,0.634,0.500 0.676,0.636,0.497 0.679,0.639,0.495 0.683,0.641,0.492 0.686,0.644,0.489 0.690,0.646,0.487 0.693,0.649,0.484 0.697,0.651,0.482 0.700,0.654,0.479 0.704,0.656,0.476 0.707,0.659,0.474 0.711,0.661,0.471 0.714,0.664,0.468 0.718,0.666,0.466 0.721,0.669,0.463 0.724,0.671,0.460 0.728,0.674,0.457 0.731,0.676,0.455 0.735,0.679,0.452 0.738,0.681,0.449 0.741,0.684,0.446 0.745,0.686,0.443 0.748,0.689,0.441 0.752,0.691,0.438 0.755,0.694,0.435 0.758,0.696,0.432 0.761,0.699,0.429 0.765,0.702,0.426 0.768,0.704,0.423 0.771,0.707,0.420 0.775,0.709,0.417 0.778,0.712,0.414 0.781,0.714,0.411 0.784,0.717,0.408 0.788,0.719,0.405 0.791,0.722,0.402 0.794,0.725,0.399 0.797,0.727,0.396 0.801,0.730,0.393 0.804,0.732,0.390 0.807,0.735,0.387 0.810,0.737,0.383 0.814,0.740,0.380 0.817,0.743,0.377 0.820,0.745,0.374 0.823,0.748,0.370 0.826,0.750,0.367 0.829,0.753,0.364 0.833,0.756,0.360 0.836,0.758,0.357 0.839,0.761,0.353 0.842,0.763,0.350 0.845,0.766,0.346 0.848,0.769,0.343 0.851,0.771,0.339 0.855,0.774,0.336 0.858,0.777,0.332 0.861,0.779,0.328 0.864,0.782,0.324 0.867,0.784,0.320 0.870,0.787,0.317 0.873,0.790,0.313 0.876,0.792,0.309 0.879,0.795,0.305 0.883,0.798,0.301 0.886,0.800,0.297 0.889,0.803,0.292 0.892,0.805,0.288 0.895,0.808,0.284 0.898,0.811,0.279 0.901,0.813,0.275 0.904,0.816,0.270 0.907,0.819,0.266 0.910,0.821,0.261 0.913,0.824,0.256 0.916,0.827,0.251 0.919,0.829,0.246 0.922,0.832,0.241 0.925,0.835,0.236 0.928,0.837,0.231 0.931,0.840,0.225 0.934,0.843,0.220 0.937,0.845,0.214 0.940,0.848,0.208 0.943,0.851,0.202 0.946,0.853,0.195 0.949,0.856,0.189 0.952,0.859,0.182 0.955,0.861,0.175 0.958,0.864,0.168 0.961,0.867,0.160 0.964,0.870,0.152 0.967,0.872,0.143 0.970,0.875,0.134 0.973,0.878,0.124 0.976,0.880,0.114 0.979,0.883,0.102 0.982,0.886,0.090 0.985,0.888,0.075 0.988,0.891,0.058 0.991,0.894,0.036 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D8.csv000066400000000000000000000110001457240071200235060ustar00rootroot000000000000000.000,0.165,0.844 0.000,0.167,0.840 0.000,0.169,0.837 0.000,0.171,0.833 0.000,0.173,0.829 0.000,0.175,0.826 0.000,0.177,0.822 0.000,0.179,0.819 0.026,0.181,0.815 0.053,0.183,0.811 0.073,0.185,0.808 0.090,0.187,0.804 0.104,0.189,0.801 0.116,0.191,0.797 0.128,0.193,0.794 0.138,0.195,0.790 0.147,0.197,0.786 0.156,0.199,0.783 0.164,0.201,0.779 0.172,0.203,0.776 0.179,0.205,0.772 0.186,0.207,0.768 0.192,0.208,0.765 0.199,0.210,0.761 0.205,0.212,0.758 0.210,0.214,0.754 0.216,0.216,0.751 0.221,0.218,0.747 0.226,0.220,0.744 0.231,0.222,0.740 0.236,0.223,0.736 0.240,0.225,0.733 0.245,0.227,0.729 0.249,0.229,0.726 0.253,0.231,0.722 0.257,0.233,0.719 0.261,0.235,0.715 0.265,0.236,0.712 0.269,0.238,0.708 0.272,0.240,0.705 0.276,0.242,0.701 0.279,0.244,0.697 0.283,0.246,0.694 0.286,0.247,0.690 0.289,0.249,0.687 0.292,0.251,0.683 0.295,0.253,0.680 0.298,0.255,0.676 0.301,0.256,0.673 0.304,0.258,0.669 0.306,0.260,0.666 0.309,0.262,0.662 0.311,0.264,0.659 0.314,0.265,0.655 0.316,0.267,0.652 0.319,0.269,0.648 0.321,0.271,0.645 0.323,0.273,0.641 0.326,0.274,0.638 0.328,0.276,0.634 0.330,0.278,0.631 0.332,0.280,0.627 0.334,0.282,0.623 0.336,0.283,0.620 0.338,0.285,0.616 0.340,0.287,0.613 0.342,0.289,0.609 0.343,0.290,0.606 0.345,0.292,0.602 0.347,0.294,0.599 0.349,0.296,0.595 0.350,0.297,0.592 0.352,0.299,0.588 0.353,0.301,0.585 0.355,0.303,0.581 0.356,0.304,0.578 0.358,0.306,0.574 0.359,0.308,0.571 0.361,0.310,0.567 0.362,0.311,0.564 0.363,0.313,0.560 0.365,0.315,0.557 0.366,0.316,0.553 0.367,0.318,0.550 0.368,0.320,0.546 0.369,0.322,0.543 0.371,0.323,0.539 0.372,0.325,0.536 0.373,0.327,0.532 0.374,0.329,0.529 0.375,0.330,0.525 0.376,0.332,0.522 0.377,0.334,0.518 0.378,0.335,0.515 0.378,0.337,0.511 0.379,0.339,0.508 0.380,0.340,0.505 0.381,0.342,0.501 0.382,0.344,0.498 0.382,0.346,0.494 0.383,0.347,0.490 0.384,0.349,0.487 0.384,0.351,0.483 0.385,0.352,0.480 0.386,0.354,0.476 0.386,0.356,0.473 0.387,0.357,0.469 0.387,0.359,0.466 0.388,0.361,0.462 0.388,0.362,0.459 0.389,0.364,0.455 0.389,0.366,0.452 0.390,0.368,0.448 0.390,0.369,0.445 0.390,0.371,0.441 0.391,0.373,0.438 0.391,0.374,0.434 0.391,0.376,0.431 0.392,0.378,0.427 0.392,0.379,0.424 0.392,0.381,0.420 0.392,0.383,0.417 0.393,0.384,0.413 0.393,0.386,0.409 0.393,0.388,0.406 0.393,0.389,0.402 0.393,0.391,0.399 0.393,0.393,0.395 0.397,0.393,0.392 0.403,0.393,0.390 0.410,0.392,0.387 0.417,0.392,0.385 0.423,0.391,0.382 0.429,0.391,0.380 0.436,0.390,0.377 0.442,0.390,0.375 0.448,0.389,0.373 0.454,0.388,0.370 0.460,0.388,0.368 0.466,0.387,0.365 0.472,0.387,0.363 0.478,0.386,0.360 0.484,0.385,0.358 0.490,0.385,0.355 0.496,0.384,0.353 0.501,0.383,0.350 0.507,0.383,0.348 0.513,0.382,0.346 0.518,0.381,0.343 0.524,0.380,0.341 0.529,0.380,0.338 0.535,0.379,0.336 0.540,0.378,0.333 0.545,0.377,0.331 0.551,0.376,0.328 0.556,0.376,0.326 0.561,0.375,0.323 0.567,0.374,0.321 0.572,0.373,0.318 0.577,0.372,0.316 0.582,0.371,0.313 0.587,0.370,0.311 0.593,0.369,0.308 0.598,0.368,0.306 0.603,0.367,0.303 0.608,0.366,0.301 0.613,0.365,0.298 0.618,0.364,0.296 0.623,0.363,0.293 0.628,0.362,0.291 0.633,0.361,0.288 0.638,0.360,0.286 0.643,0.359,0.283 0.648,0.358,0.281 0.653,0.356,0.278 0.657,0.355,0.275 0.662,0.354,0.273 0.667,0.353,0.270 0.672,0.351,0.268 0.677,0.350,0.265 0.682,0.349,0.263 0.686,0.347,0.260 0.691,0.346,0.257 0.696,0.345,0.255 0.701,0.343,0.252 0.705,0.342,0.250 0.710,0.340,0.247 0.715,0.339,0.244 0.720,0.337,0.242 0.724,0.336,0.239 0.729,0.334,0.237 0.734,0.333,0.234 0.738,0.331,0.231 0.743,0.330,0.229 0.748,0.328,0.226 0.752,0.326,0.223 0.757,0.324,0.221 0.761,0.323,0.218 0.766,0.321,0.215 0.771,0.319,0.212 0.775,0.317,0.210 0.780,0.315,0.207 0.784,0.313,0.204 0.789,0.311,0.201 0.794,0.309,0.199 0.798,0.307,0.196 0.803,0.305,0.193 0.807,0.303,0.190 0.812,0.301,0.187 0.816,0.299,0.184 0.821,0.296,0.182 0.825,0.294,0.179 0.830,0.292,0.176 0.834,0.290,0.173 0.839,0.287,0.170 0.843,0.285,0.167 0.848,0.282,0.164 0.852,0.280,0.161 0.857,0.277,0.158 0.861,0.274,0.155 0.866,0.271,0.152 0.870,0.269,0.149 0.875,0.266,0.145 0.879,0.263,0.142 0.884,0.260,0.139 0.888,0.257,0.136 0.892,0.254,0.132 0.897,0.250,0.129 0.901,0.247,0.126 0.906,0.244,0.122 0.910,0.240,0.119 0.915,0.237,0.115 0.919,0.233,0.112 0.923,0.229,0.108 0.928,0.225,0.104 0.932,0.222,0.100 0.937,0.217,0.096 0.941,0.213,0.092 0.945,0.209,0.088 0.950,0.204,0.084 0.954,0.200,0.080 0.959,0.195,0.075 0.963,0.190,0.070 0.967,0.185,0.066 0.972,0.179,0.060 0.976,0.174,0.055 0.981,0.168,0.050 0.985,0.162,0.043 0.989,0.156,0.037 0.994,0.149,0.030 0.998,0.142,0.024 1.000,0.134,0.018 1.000,0.126,0.012 1.000,0.117,0.005 1.000,0.108,0.000 1.000,0.097,0.000 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-D9.csv000066400000000000000000000110001457240071200235070ustar00rootroot000000000000000.141,0.501,0.998 0.162,0.504,0.998 0.181,0.508,0.998 0.198,0.511,0.998 0.214,0.514,0.998 0.228,0.518,0.998 0.242,0.521,0.998 0.255,0.524,0.998 0.267,0.528,0.998 0.279,0.531,0.998 0.290,0.535,0.998 0.301,0.538,0.998 0.311,0.541,0.998 0.321,0.545,0.998 0.331,0.548,0.998 0.340,0.552,0.998 0.350,0.555,0.998 0.359,0.559,0.998 0.367,0.562,0.998 0.376,0.565,0.998 0.385,0.569,0.998 0.393,0.572,0.998 0.401,0.576,0.998 0.409,0.579,0.998 0.417,0.583,0.998 0.424,0.586,0.997 0.432,0.590,0.997 0.439,0.593,0.997 0.447,0.597,0.997 0.454,0.600,0.997 0.461,0.604,0.997 0.468,0.608,0.997 0.475,0.611,0.997 0.482,0.615,0.997 0.489,0.618,0.997 0.495,0.622,0.997 0.502,0.625,0.997 0.509,0.629,0.997 0.515,0.633,0.997 0.521,0.636,0.997 0.528,0.640,0.996 0.534,0.643,0.996 0.540,0.647,0.996 0.547,0.651,0.996 0.553,0.654,0.996 0.559,0.658,0.996 0.565,0.661,0.996 0.571,0.665,0.996 0.577,0.669,0.996 0.583,0.672,0.996 0.589,0.676,0.995 0.594,0.680,0.995 0.600,0.683,0.995 0.606,0.687,0.995 0.612,0.691,0.995 0.617,0.694,0.995 0.623,0.698,0.995 0.629,0.702,0.995 0.634,0.705,0.994 0.640,0.709,0.994 0.645,0.713,0.994 0.651,0.717,0.994 0.656,0.720,0.994 0.661,0.724,0.994 0.667,0.728,0.994 0.672,0.731,0.993 0.678,0.735,0.993 0.683,0.739,0.993 0.688,0.743,0.993 0.693,0.746,0.993 0.699,0.750,0.993 0.704,0.754,0.992 0.709,0.758,0.992 0.714,0.762,0.992 0.719,0.765,0.992 0.724,0.769,0.992 0.730,0.773,0.992 0.735,0.777,0.991 0.740,0.780,0.991 0.745,0.784,0.991 0.750,0.788,0.991 0.755,0.792,0.991 0.760,0.796,0.990 0.765,0.800,0.990 0.770,0.803,0.990 0.775,0.807,0.990 0.780,0.811,0.989 0.784,0.815,0.989 0.789,0.819,0.989 0.794,0.823,0.989 0.799,0.826,0.989 0.804,0.830,0.988 0.809,0.834,0.988 0.814,0.838,0.988 0.818,0.842,0.988 0.823,0.846,0.987 0.828,0.850,0.987 0.833,0.853,0.987 0.837,0.857,0.987 0.842,0.861,0.986 0.847,0.865,0.986 0.852,0.869,0.986 0.856,0.873,0.986 0.861,0.877,0.985 0.866,0.881,0.985 0.870,0.885,0.985 0.875,0.889,0.985 0.880,0.893,0.984 0.884,0.896,0.984 0.889,0.900,0.984 0.894,0.904,0.983 0.898,0.908,0.983 0.903,0.912,0.983 0.908,0.916,0.982 0.912,0.920,0.982 0.917,0.924,0.982 0.921,0.928,0.982 0.926,0.932,0.981 0.930,0.936,0.981 0.935,0.940,0.981 0.939,0.944,0.980 0.944,0.948,0.980 0.949,0.952,0.980 0.953,0.956,0.979 0.958,0.960,0.978 0.962,0.963,0.977 0.967,0.966,0.975 0.972,0.967,0.972 0.975,0.966,0.967 0.978,0.964,0.962 0.980,0.960,0.956 0.981,0.955,0.949 0.982,0.951,0.943 0.983,0.946,0.936 0.984,0.941,0.930 0.985,0.936,0.924 0.986,0.931,0.917 0.986,0.926,0.911 0.987,0.921,0.905 0.988,0.916,0.898 0.988,0.911,0.892 0.989,0.906,0.886 0.990,0.901,0.879 0.990,0.896,0.873 0.991,0.891,0.867 0.991,0.886,0.860 0.992,0.881,0.854 0.992,0.876,0.848 0.992,0.871,0.841 0.993,0.866,0.835 0.993,0.861,0.829 0.993,0.857,0.823 0.994,0.852,0.816 0.994,0.847,0.810 0.994,0.842,0.804 0.994,0.837,0.798 0.995,0.832,0.791 0.995,0.827,0.785 0.995,0.822,0.779 0.995,0.817,0.773 0.995,0.812,0.767 0.995,0.807,0.760 0.995,0.802,0.754 0.995,0.797,0.748 0.995,0.792,0.742 0.995,0.787,0.736 0.995,0.782,0.730 0.995,0.777,0.724 0.995,0.772,0.717 0.995,0.767,0.711 0.994,0.762,0.705 0.994,0.757,0.699 0.994,0.753,0.693 0.994,0.748,0.687 0.994,0.743,0.681 0.993,0.738,0.675 0.993,0.733,0.669 0.993,0.728,0.663 0.992,0.723,0.657 0.992,0.718,0.651 0.991,0.713,0.645 0.991,0.708,0.639 0.990,0.703,0.633 0.990,0.698,0.627 0.989,0.693,0.621 0.989,0.688,0.615 0.988,0.683,0.609 0.988,0.678,0.603 0.987,0.673,0.597 0.987,0.668,0.591 0.986,0.663,0.585 0.985,0.658,0.579 0.985,0.653,0.573 0.984,0.648,0.567 0.983,0.643,0.561 0.982,0.638,0.555 0.982,0.633,0.549 0.981,0.628,0.543 0.980,0.623,0.537 0.979,0.618,0.532 0.978,0.613,0.526 0.978,0.608,0.520 0.977,0.603,0.514 0.976,0.598,0.508 0.975,0.592,0.502 0.974,0.587,0.496 0.973,0.582,0.491 0.972,0.577,0.485 0.971,0.572,0.479 0.970,0.567,0.473 0.969,0.562,0.468 0.968,0.557,0.462 0.967,0.552,0.456 0.966,0.547,0.450 0.964,0.541,0.444 0.963,0.536,0.439 0.962,0.531,0.433 0.961,0.526,0.427 0.960,0.521,0.422 0.958,0.516,0.416 0.957,0.510,0.410 0.956,0.505,0.404 0.955,0.500,0.399 0.953,0.495,0.393 0.952,0.489,0.387 0.951,0.484,0.382 0.949,0.479,0.376 0.948,0.474,0.370 0.947,0.468,0.365 0.945,0.463,0.359 0.944,0.458,0.354 0.942,0.452,0.348 0.941,0.447,0.342 0.940,0.441,0.337 0.938,0.436,0.331 0.937,0.431,0.325 0.935,0.425,0.320 0.933,0.420,0.314 0.932,0.414,0.309 0.930,0.409,0.303 0.929,0.403,0.298 0.927,0.397,0.292 0.926,0.392,0.286 0.924,0.386,0.281 0.922,0.380,0.275 0.921,0.375,0.270 0.919,0.369,0.264 0.917,0.363,0.259 0.915,0.357,0.253 0.914,0.351,0.248 0.912,0.345,0.242 0.910,0.339,0.237 0.908,0.333,0.231 0.907,0.327,0.226 0.905,0.321,0.220 0.903,0.315,0.214 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-I1.csv000066400000000000000000000110001457240071200235040ustar00rootroot000000000000000.216,0.718,0.926 0.218,0.718,0.923 0.220,0.718,0.919 0.223,0.719,0.916 0.225,0.719,0.912 0.227,0.719,0.909 0.230,0.720,0.906 0.232,0.720,0.902 0.234,0.720,0.899 0.236,0.721,0.895 0.238,0.721,0.892 0.240,0.721,0.888 0.242,0.721,0.885 0.245,0.722,0.882 0.247,0.722,0.878 0.249,0.722,0.875 0.251,0.723,0.871 0.253,0.723,0.868 0.255,0.723,0.864 0.257,0.723,0.861 0.259,0.724,0.857 0.261,0.724,0.854 0.263,0.724,0.850 0.265,0.724,0.847 0.267,0.725,0.843 0.269,0.725,0.840 0.271,0.725,0.836 0.273,0.725,0.833 0.274,0.726,0.829 0.276,0.726,0.826 0.278,0.726,0.822 0.280,0.726,0.819 0.282,0.727,0.815 0.284,0.727,0.812 0.286,0.727,0.808 0.288,0.727,0.805 0.290,0.728,0.801 0.291,0.728,0.798 0.293,0.728,0.794 0.295,0.728,0.791 0.297,0.729,0.787 0.299,0.729,0.784 0.301,0.729,0.780 0.303,0.729,0.776 0.304,0.729,0.773 0.306,0.730,0.769 0.308,0.730,0.766 0.310,0.730,0.762 0.312,0.730,0.759 0.314,0.730,0.755 0.316,0.731,0.751 0.318,0.731,0.748 0.319,0.731,0.744 0.321,0.731,0.740 0.323,0.731,0.737 0.325,0.731,0.733 0.327,0.732,0.730 0.329,0.732,0.726 0.331,0.732,0.722 0.333,0.732,0.719 0.335,0.732,0.715 0.337,0.732,0.711 0.339,0.732,0.708 0.341,0.733,0.704 0.343,0.733,0.700 0.345,0.733,0.696 0.347,0.733,0.693 0.349,0.733,0.689 0.351,0.733,0.685 0.353,0.733,0.682 0.355,0.733,0.678 0.357,0.733,0.674 0.359,0.734,0.670 0.361,0.734,0.667 0.363,0.734,0.663 0.366,0.734,0.659 0.368,0.734,0.655 0.370,0.734,0.652 0.372,0.734,0.648 0.375,0.734,0.644 0.377,0.734,0.640 0.379,0.734,0.636 0.381,0.734,0.633 0.384,0.734,0.629 0.386,0.734,0.625 0.389,0.734,0.621 0.391,0.734,0.617 0.394,0.734,0.613 0.396,0.734,0.610 0.399,0.734,0.606 0.401,0.734,0.602 0.404,0.734,0.598 0.406,0.734,0.594 0.409,0.734,0.590 0.412,0.734,0.586 0.415,0.733,0.582 0.417,0.733,0.579 0.420,0.733,0.575 0.423,0.733,0.571 0.426,0.733,0.567 0.429,0.733,0.563 0.432,0.733,0.559 0.435,0.732,0.555 0.438,0.732,0.552 0.441,0.732,0.548 0.444,0.732,0.544 0.448,0.731,0.540 0.451,0.731,0.536 0.454,0.731,0.532 0.458,0.731,0.529 0.461,0.730,0.525 0.465,0.730,0.521 0.468,0.730,0.517 0.472,0.729,0.513 0.475,0.729,0.510 0.479,0.729,0.506 0.483,0.728,0.502 0.486,0.728,0.499 0.490,0.727,0.495 0.494,0.727,0.492 0.498,0.726,0.488 0.502,0.726,0.485 0.506,0.725,0.481 0.510,0.725,0.478 0.514,0.724,0.474 0.518,0.724,0.471 0.522,0.723,0.468 0.526,0.722,0.465 0.530,0.722,0.462 0.534,0.721,0.459 0.538,0.720,0.456 0.542,0.720,0.453 0.547,0.719,0.450 0.551,0.718,0.447 0.555,0.717,0.444 0.559,0.717,0.441 0.563,0.716,0.439 0.568,0.715,0.436 0.572,0.714,0.434 0.576,0.713,0.431 0.580,0.713,0.429 0.585,0.712,0.427 0.589,0.711,0.424 0.593,0.710,0.422 0.597,0.709,0.420 0.601,0.708,0.418 0.606,0.707,0.416 0.610,0.706,0.414 0.614,0.706,0.412 0.618,0.705,0.410 0.622,0.704,0.408 0.626,0.703,0.406 0.630,0.702,0.404 0.634,0.701,0.402 0.638,0.700,0.401 0.642,0.699,0.399 0.646,0.698,0.397 0.650,0.697,0.395 0.654,0.696,0.394 0.658,0.695,0.392 0.662,0.694,0.391 0.666,0.693,0.389 0.670,0.692,0.388 0.674,0.691,0.386 0.678,0.690,0.385 0.681,0.689,0.384 0.685,0.688,0.383 0.689,0.687,0.381 0.693,0.685,0.380 0.697,0.684,0.379 0.700,0.683,0.378 0.704,0.682,0.377 0.708,0.681,0.376 0.712,0.680,0.375 0.715,0.679,0.374 0.719,0.678,0.373 0.723,0.676,0.373 0.726,0.675,0.372 0.730,0.674,0.371 0.734,0.673,0.371 0.737,0.672,0.370 0.741,0.671,0.370 0.745,0.669,0.369 0.748,0.668,0.369 0.752,0.667,0.368 0.755,0.666,0.368 0.759,0.664,0.367 0.762,0.663,0.367 0.766,0.662,0.367 0.769,0.661,0.367 0.773,0.660,0.367 0.776,0.658,0.367 0.780,0.657,0.366 0.783,0.656,0.366 0.787,0.654,0.366 0.790,0.653,0.367 0.793,0.652,0.367 0.797,0.651,0.367 0.800,0.649,0.367 0.803,0.648,0.367 0.807,0.647,0.367 0.810,0.645,0.368 0.813,0.644,0.368 0.816,0.643,0.369 0.820,0.641,0.369 0.823,0.640,0.369 0.826,0.639,0.370 0.829,0.637,0.370 0.833,0.636,0.371 0.836,0.634,0.372 0.839,0.633,0.372 0.842,0.632,0.373 0.845,0.630,0.374 0.848,0.629,0.374 0.851,0.628,0.375 0.854,0.626,0.376 0.857,0.625,0.377 0.861,0.623,0.377 0.864,0.622,0.378 0.867,0.620,0.379 0.870,0.619,0.380 0.873,0.618,0.381 0.876,0.616,0.382 0.878,0.615,0.383 0.881,0.613,0.384 0.884,0.612,0.385 0.887,0.610,0.386 0.890,0.609,0.387 0.893,0.607,0.389 0.896,0.606,0.390 0.899,0.604,0.391 0.902,0.603,0.392 0.905,0.601,0.393 0.907,0.600,0.395 0.910,0.598,0.396 0.913,0.597,0.397 0.916,0.595,0.398 0.919,0.594,0.400 0.921,0.592,0.401 0.924,0.591,0.402 0.927,0.589,0.404 0.930,0.587,0.405 0.932,0.586,0.407 0.935,0.584,0.408 0.938,0.583,0.410 0.940,0.581,0.411 0.943,0.580,0.413 0.946,0.578,0.414 0.948,0.576,0.416 0.951,0.575,0.417 0.954,0.573,0.419 0.956,0.572,0.420 0.959,0.570,0.422 0.961,0.568,0.423 0.964,0.567,0.425 0.966,0.565,0.427 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-I2.csv000066400000000000000000000110001457240071200235050ustar00rootroot000000000000000.438,0.821,1.000 0.438,0.822,1.000 0.438,0.822,1.000 0.439,0.823,1.000 0.439,0.823,1.000 0.439,0.823,0.998 0.439,0.824,0.995 0.440,0.824,0.992 0.440,0.824,0.989 0.440,0.825,0.985 0.441,0.825,0.982 0.441,0.825,0.979 0.441,0.826,0.976 0.442,0.826,0.973 0.442,0.826,0.970 0.442,0.827,0.967 0.443,0.827,0.964 0.443,0.827,0.960 0.443,0.828,0.957 0.444,0.828,0.954 0.444,0.828,0.951 0.445,0.829,0.948 0.445,0.829,0.945 0.445,0.829,0.942 0.446,0.830,0.938 0.446,0.830,0.935 0.447,0.830,0.932 0.447,0.831,0.929 0.448,0.831,0.926 0.448,0.831,0.922 0.449,0.832,0.919 0.449,0.832,0.916 0.450,0.832,0.913 0.450,0.833,0.910 0.451,0.833,0.906 0.451,0.833,0.903 0.452,0.833,0.900 0.452,0.834,0.897 0.453,0.834,0.893 0.454,0.834,0.890 0.454,0.834,0.887 0.455,0.835,0.884 0.455,0.835,0.880 0.456,0.835,0.877 0.457,0.836,0.874 0.457,0.836,0.871 0.458,0.836,0.867 0.459,0.836,0.864 0.460,0.837,0.861 0.460,0.837,0.857 0.461,0.837,0.854 0.462,0.837,0.851 0.463,0.838,0.847 0.463,0.838,0.844 0.464,0.838,0.841 0.465,0.838,0.838 0.466,0.838,0.834 0.467,0.839,0.831 0.468,0.839,0.827 0.469,0.839,0.824 0.470,0.839,0.821 0.470,0.839,0.817 0.471,0.840,0.814 0.472,0.840,0.811 0.473,0.840,0.807 0.474,0.840,0.804 0.476,0.840,0.800 0.477,0.841,0.797 0.478,0.841,0.793 0.479,0.841,0.790 0.480,0.841,0.787 0.481,0.841,0.783 0.482,0.841,0.780 0.484,0.841,0.776 0.485,0.842,0.773 0.486,0.842,0.769 0.488,0.842,0.766 0.489,0.842,0.762 0.490,0.842,0.759 0.492,0.842,0.755 0.493,0.842,0.752 0.495,0.842,0.748 0.496,0.842,0.745 0.498,0.842,0.741 0.499,0.842,0.738 0.501,0.843,0.734 0.502,0.843,0.730 0.504,0.843,0.727 0.506,0.843,0.723 0.508,0.843,0.720 0.509,0.843,0.716 0.511,0.843,0.713 0.513,0.843,0.709 0.515,0.843,0.705 0.517,0.843,0.702 0.519,0.843,0.698 0.521,0.843,0.694 0.523,0.843,0.691 0.525,0.843,0.687 0.527,0.842,0.684 0.530,0.842,0.680 0.532,0.842,0.676 0.534,0.842,0.673 0.537,0.842,0.669 0.539,0.842,0.665 0.541,0.842,0.662 0.544,0.842,0.658 0.547,0.841,0.655 0.549,0.841,0.651 0.552,0.841,0.647 0.555,0.841,0.644 0.557,0.841,0.640 0.560,0.840,0.636 0.563,0.840,0.633 0.566,0.840,0.629 0.569,0.840,0.626 0.572,0.839,0.622 0.575,0.839,0.619 0.578,0.839,0.615 0.582,0.838,0.612 0.585,0.838,0.608 0.588,0.837,0.605 0.592,0.837,0.601 0.595,0.837,0.598 0.598,0.836,0.595 0.602,0.836,0.591 0.606,0.835,0.588 0.609,0.835,0.585 0.613,0.834,0.582 0.616,0.834,0.579 0.620,0.833,0.575 0.624,0.832,0.572 0.628,0.832,0.569 0.631,0.831,0.566 0.635,0.831,0.564 0.639,0.830,0.561 0.643,0.829,0.558 0.647,0.829,0.555 0.651,0.828,0.552 0.655,0.827,0.550 0.659,0.827,0.547 0.663,0.826,0.545 0.667,0.825,0.542 0.671,0.824,0.540 0.674,0.824,0.537 0.678,0.823,0.535 0.682,0.822,0.533 0.686,0.821,0.531 0.690,0.820,0.529 0.694,0.820,0.526 0.698,0.819,0.524 0.702,0.818,0.522 0.706,0.817,0.520 0.710,0.816,0.518 0.714,0.815,0.516 0.718,0.815,0.514 0.722,0.814,0.513 0.726,0.813,0.511 0.729,0.812,0.509 0.733,0.811,0.507 0.737,0.810,0.505 0.741,0.809,0.503 0.745,0.808,0.502 0.748,0.807,0.500 0.752,0.806,0.498 0.756,0.805,0.497 0.760,0.805,0.495 0.763,0.804,0.493 0.767,0.803,0.492 0.771,0.802,0.490 0.774,0.801,0.489 0.778,0.800,0.487 0.782,0.799,0.486 0.785,0.798,0.485 0.789,0.797,0.483 0.793,0.796,0.482 0.796,0.795,0.481 0.800,0.794,0.479 0.804,0.793,0.478 0.807,0.792,0.477 0.811,0.791,0.476 0.814,0.790,0.475 0.818,0.789,0.474 0.821,0.788,0.473 0.825,0.786,0.472 0.829,0.785,0.471 0.832,0.784,0.470 0.836,0.783,0.469 0.839,0.782,0.468 0.843,0.781,0.468 0.846,0.780,0.467 0.849,0.779,0.466 0.853,0.778,0.466 0.856,0.777,0.465 0.860,0.775,0.465 0.863,0.774,0.464 0.866,0.773,0.464 0.870,0.772,0.463 0.873,0.771,0.463 0.877,0.770,0.462 0.880,0.769,0.462 0.883,0.767,0.462 0.887,0.766,0.462 0.890,0.765,0.462 0.893,0.764,0.461 0.896,0.763,0.461 0.900,0.761,0.461 0.903,0.760,0.461 0.906,0.759,0.462 0.909,0.758,0.462 0.912,0.757,0.462 0.916,0.755,0.462 0.919,0.754,0.462 0.922,0.753,0.463 0.925,0.752,0.463 0.928,0.750,0.463 0.931,0.749,0.464 0.934,0.748,0.464 0.937,0.747,0.465 0.940,0.745,0.465 0.943,0.744,0.466 0.946,0.743,0.466 0.949,0.742,0.467 0.952,0.740,0.468 0.955,0.739,0.468 0.958,0.738,0.469 0.961,0.737,0.470 0.964,0.735,0.471 0.967,0.734,0.472 0.970,0.733,0.473 0.973,0.732,0.474 0.975,0.730,0.475 0.978,0.729,0.476 0.981,0.728,0.477 0.984,0.726,0.478 0.986,0.725,0.479 0.989,0.724,0.480 0.992,0.723,0.481 0.995,0.721,0.483 0.997,0.720,0.484 1.000,0.719,0.485 1.000,0.717,0.486 1.000,0.716,0.488 1.000,0.715,0.489 1.000,0.713,0.490 1.000,0.712,0.492 1.000,0.711,0.493 1.000,0.710,0.495 1.000,0.708,0.496 1.000,0.707,0.498 1.000,0.706,0.499 1.000,0.704,0.501 1.000,0.703,0.503 1.000,0.702,0.504 1.000,0.700,0.506 1.000,0.699,0.508 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-I3.csv000066400000000000000000000110001457240071200235060ustar00rootroot000000000000000.078,0.727,0.901 0.097,0.727,0.901 0.112,0.726,0.902 0.126,0.726,0.902 0.139,0.725,0.903 0.150,0.725,0.903 0.161,0.724,0.904 0.171,0.723,0.904 0.181,0.723,0.905 0.190,0.722,0.905 0.198,0.722,0.906 0.207,0.721,0.906 0.215,0.720,0.907 0.222,0.720,0.907 0.230,0.719,0.908 0.237,0.719,0.908 0.244,0.718,0.909 0.251,0.717,0.909 0.257,0.717,0.910 0.264,0.716,0.910 0.270,0.716,0.911 0.276,0.715,0.911 0.282,0.714,0.912 0.288,0.714,0.912 0.294,0.713,0.913 0.300,0.712,0.913 0.305,0.712,0.914 0.311,0.711,0.914 0.316,0.711,0.914 0.322,0.710,0.915 0.327,0.709,0.915 0.332,0.709,0.916 0.337,0.708,0.916 0.342,0.707,0.916 0.347,0.707,0.917 0.352,0.706,0.917 0.357,0.705,0.918 0.362,0.705,0.918 0.366,0.704,0.918 0.371,0.703,0.919 0.376,0.703,0.919 0.380,0.702,0.919 0.385,0.701,0.920 0.389,0.701,0.920 0.394,0.700,0.920 0.398,0.699,0.921 0.403,0.699,0.921 0.407,0.698,0.921 0.411,0.697,0.922 0.416,0.697,0.922 0.420,0.696,0.922 0.424,0.695,0.922 0.428,0.694,0.923 0.432,0.694,0.923 0.436,0.693,0.923 0.441,0.692,0.923 0.445,0.692,0.924 0.449,0.691,0.924 0.453,0.690,0.924 0.457,0.689,0.924 0.461,0.689,0.924 0.465,0.688,0.925 0.468,0.687,0.925 0.472,0.686,0.925 0.476,0.686,0.925 0.480,0.685,0.925 0.484,0.684,0.925 0.488,0.683,0.925 0.492,0.683,0.926 0.495,0.682,0.926 0.499,0.681,0.926 0.503,0.680,0.926 0.507,0.680,0.926 0.510,0.679,0.926 0.514,0.678,0.926 0.518,0.677,0.926 0.521,0.677,0.926 0.525,0.676,0.926 0.529,0.675,0.926 0.532,0.674,0.926 0.536,0.673,0.926 0.540,0.673,0.926 0.543,0.672,0.926 0.547,0.671,0.926 0.550,0.670,0.925 0.554,0.669,0.925 0.558,0.669,0.925 0.561,0.668,0.925 0.565,0.667,0.925 0.568,0.666,0.925 0.572,0.665,0.924 0.575,0.664,0.924 0.579,0.664,0.924 0.582,0.663,0.924 0.586,0.662,0.923 0.589,0.661,0.923 0.593,0.660,0.923 0.596,0.659,0.922 0.600,0.659,0.922 0.603,0.658,0.921 0.607,0.657,0.921 0.610,0.656,0.921 0.614,0.655,0.920 0.617,0.654,0.920 0.621,0.653,0.919 0.624,0.653,0.919 0.627,0.652,0.918 0.631,0.651,0.917 0.634,0.650,0.917 0.638,0.649,0.916 0.641,0.648,0.915 0.644,0.647,0.915 0.648,0.646,0.914 0.651,0.645,0.913 0.655,0.645,0.912 0.658,0.644,0.911 0.661,0.643,0.910 0.665,0.642,0.910 0.668,0.641,0.909 0.671,0.640,0.908 0.675,0.639,0.907 0.678,0.638,0.905 0.681,0.638,0.904 0.684,0.637,0.903 0.688,0.636,0.902 0.691,0.635,0.901 0.694,0.634,0.900 0.697,0.633,0.898 0.700,0.632,0.897 0.704,0.631,0.896 0.707,0.631,0.894 0.710,0.630,0.893 0.713,0.629,0.892 0.716,0.628,0.890 0.719,0.627,0.889 0.722,0.626,0.887 0.725,0.625,0.886 0.728,0.625,0.885 0.731,0.624,0.883 0.734,0.623,0.882 0.737,0.622,0.880 0.740,0.621,0.879 0.743,0.620,0.877 0.746,0.619,0.876 0.749,0.619,0.874 0.752,0.618,0.873 0.754,0.617,0.871 0.757,0.616,0.870 0.760,0.615,0.868 0.763,0.614,0.867 0.766,0.613,0.865 0.768,0.613,0.863 0.771,0.612,0.862 0.774,0.611,0.860 0.777,0.610,0.859 0.779,0.609,0.857 0.782,0.608,0.855 0.785,0.608,0.854 0.787,0.607,0.852 0.790,0.606,0.850 0.793,0.605,0.849 0.795,0.604,0.847 0.798,0.603,0.846 0.800,0.602,0.844 0.803,0.602,0.842 0.806,0.601,0.841 0.808,0.600,0.839 0.811,0.599,0.837 0.813,0.598,0.835 0.816,0.597,0.834 0.818,0.596,0.832 0.821,0.596,0.830 0.823,0.595,0.829 0.826,0.594,0.827 0.828,0.593,0.825 0.830,0.592,0.824 0.833,0.591,0.822 0.835,0.590,0.820 0.838,0.590,0.818 0.840,0.589,0.817 0.842,0.588,0.815 0.845,0.587,0.813 0.847,0.586,0.811 0.849,0.585,0.810 0.852,0.584,0.808 0.854,0.584,0.806 0.856,0.583,0.804 0.859,0.582,0.803 0.861,0.581,0.801 0.863,0.580,0.799 0.866,0.579,0.797 0.868,0.578,0.796 0.870,0.578,0.794 0.872,0.577,0.792 0.874,0.576,0.790 0.877,0.575,0.788 0.879,0.574,0.787 0.881,0.573,0.785 0.883,0.572,0.783 0.885,0.572,0.781 0.888,0.571,0.780 0.890,0.570,0.778 0.892,0.569,0.776 0.894,0.568,0.774 0.896,0.567,0.772 0.898,0.566,0.770 0.900,0.565,0.769 0.903,0.565,0.767 0.905,0.564,0.765 0.907,0.563,0.763 0.909,0.562,0.761 0.911,0.561,0.760 0.913,0.560,0.758 0.915,0.559,0.756 0.917,0.558,0.754 0.919,0.558,0.752 0.921,0.557,0.750 0.923,0.556,0.749 0.925,0.555,0.747 0.927,0.554,0.745 0.929,0.553,0.743 0.931,0.552,0.741 0.933,0.551,0.739 0.935,0.550,0.738 0.937,0.550,0.736 0.939,0.549,0.734 0.941,0.548,0.732 0.943,0.547,0.730 0.945,0.546,0.728 0.947,0.545,0.727 0.949,0.544,0.725 0.950,0.543,0.723 0.952,0.542,0.721 0.954,0.541,0.719 0.956,0.541,0.717 0.958,0.540,0.715 0.960,0.539,0.714 0.962,0.538,0.712 0.964,0.537,0.710 0.965,0.536,0.708 0.967,0.535,0.706 0.969,0.534,0.704 0.971,0.533,0.702 0.973,0.532,0.701 0.975,0.531,0.699 0.976,0.531,0.697 0.978,0.530,0.695 0.980,0.529,0.693 0.982,0.528,0.691 0.984,0.527,0.689 0.985,0.526,0.687 0.987,0.525,0.686 0.989,0.524,0.684 0.991,0.523,0.682 0.992,0.522,0.680 0.994,0.521,0.678 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L1.csv000066400000000000000000000110001457240071200235070ustar00rootroot000000000000000.000,0.000,0.000 0.006,0.006,0.006 0.011,0.011,0.011 0.017,0.017,0.017 0.022,0.022,0.022 0.028,0.028,0.028 0.034,0.034,0.034 0.039,0.039,0.039 0.045,0.045,0.045 0.050,0.050,0.050 0.054,0.054,0.054 0.059,0.059,0.059 0.063,0.063,0.063 0.067,0.067,0.067 0.071,0.071,0.071 0.074,0.075,0.075 0.078,0.078,0.078 0.081,0.081,0.081 0.085,0.085,0.085 0.088,0.088,0.088 0.091,0.091,0.091 0.094,0.094,0.094 0.097,0.097,0.097 0.100,0.100,0.100 0.103,0.103,0.103 0.106,0.106,0.106 0.109,0.109,0.109 0.112,0.112,0.112 0.115,0.115,0.115 0.119,0.119,0.119 0.122,0.122,0.122 0.125,0.125,0.125 0.128,0.128,0.128 0.131,0.131,0.131 0.134,0.134,0.134 0.137,0.137,0.137 0.141,0.141,0.141 0.144,0.144,0.144 0.147,0.147,0.147 0.150,0.150,0.150 0.153,0.153,0.153 0.157,0.157,0.157 0.160,0.160,0.160 0.163,0.163,0.163 0.166,0.166,0.166 0.170,0.170,0.170 0.173,0.173,0.173 0.176,0.176,0.176 0.179,0.179,0.179 0.183,0.183,0.183 0.186,0.186,0.186 0.189,0.189,0.189 0.193,0.193,0.193 0.196,0.196,0.196 0.199,0.199,0.199 0.203,0.203,0.203 0.206,0.206,0.206 0.209,0.210,0.209 0.213,0.213,0.213 0.216,0.216,0.216 0.220,0.220,0.220 0.223,0.223,0.223 0.226,0.227,0.227 0.230,0.230,0.230 0.233,0.233,0.233 0.237,0.237,0.237 0.240,0.240,0.240 0.244,0.244,0.244 0.247,0.247,0.247 0.251,0.251,0.251 0.254,0.254,0.254 0.258,0.258,0.258 0.261,0.261,0.261 0.265,0.265,0.265 0.268,0.268,0.268 0.272,0.272,0.272 0.275,0.275,0.275 0.279,0.279,0.279 0.282,0.282,0.282 0.286,0.286,0.286 0.289,0.289,0.289 0.293,0.293,0.293 0.297,0.297,0.297 0.300,0.300,0.300 0.304,0.304,0.304 0.307,0.307,0.307 0.311,0.311,0.311 0.314,0.315,0.315 0.318,0.318,0.318 0.322,0.322,0.322 0.325,0.325,0.325 0.329,0.329,0.329 0.333,0.333,0.333 0.336,0.336,0.336 0.340,0.340,0.340 0.344,0.344,0.344 0.347,0.347,0.347 0.351,0.351,0.351 0.355,0.355,0.355 0.358,0.358,0.358 0.362,0.362,0.362 0.366,0.366,0.366 0.369,0.370,0.370 0.373,0.373,0.373 0.377,0.377,0.377 0.381,0.381,0.381 0.384,0.384,0.384 0.388,0.388,0.388 0.392,0.392,0.392 0.396,0.396,0.396 0.399,0.399,0.399 0.403,0.403,0.403 0.407,0.407,0.407 0.411,0.411,0.411 0.415,0.415,0.415 0.418,0.418,0.418 0.422,0.422,0.422 0.426,0.426,0.426 0.430,0.430,0.430 0.434,0.434,0.434 0.437,0.437,0.437 0.441,0.441,0.441 0.445,0.445,0.445 0.449,0.449,0.449 0.453,0.453,0.453 0.457,0.457,0.457 0.460,0.461,0.461 0.464,0.464,0.464 0.468,0.468,0.468 0.472,0.472,0.472 0.476,0.476,0.476 0.480,0.480,0.480 0.484,0.484,0.484 0.488,0.488,0.488 0.492,0.492,0.492 0.495,0.496,0.496 0.499,0.499,0.499 0.503,0.503,0.503 0.507,0.507,0.507 0.511,0.511,0.511 0.515,0.515,0.515 0.519,0.519,0.519 0.523,0.523,0.523 0.527,0.527,0.527 0.531,0.531,0.531 0.535,0.535,0.535 0.539,0.539,0.539 0.543,0.543,0.543 0.547,0.547,0.547 0.551,0.551,0.551 0.555,0.555,0.555 0.559,0.559,0.559 0.563,0.563,0.563 0.567,0.567,0.567 0.571,0.571,0.571 0.575,0.575,0.575 0.579,0.579,0.579 0.583,0.583,0.583 0.587,0.587,0.587 0.591,0.591,0.591 0.595,0.595,0.595 0.599,0.599,0.599 0.603,0.603,0.603 0.607,0.607,0.607 0.611,0.611,0.611 0.615,0.615,0.615 0.619,0.619,0.619 0.623,0.624,0.624 0.628,0.628,0.628 0.632,0.632,0.632 0.636,0.636,0.636 0.640,0.640,0.640 0.644,0.644,0.644 0.648,0.648,0.648 0.652,0.652,0.652 0.656,0.656,0.656 0.660,0.660,0.660 0.664,0.665,0.665 0.669,0.669,0.669 0.673,0.673,0.673 0.677,0.677,0.677 0.681,0.681,0.681 0.685,0.685,0.685 0.689,0.689,0.689 0.694,0.694,0.694 0.698,0.698,0.698 0.702,0.702,0.702 0.706,0.706,0.706 0.710,0.710,0.710 0.714,0.715,0.714 0.719,0.719,0.719 0.723,0.723,0.723 0.727,0.727,0.727 0.731,0.731,0.731 0.735,0.735,0.735 0.740,0.740,0.740 0.744,0.744,0.744 0.748,0.748,0.748 0.752,0.752,0.752 0.756,0.757,0.757 0.761,0.761,0.761 0.765,0.765,0.765 0.769,0.769,0.769 0.773,0.774,0.774 0.778,0.778,0.778 0.782,0.782,0.782 0.786,0.786,0.786 0.790,0.791,0.791 0.795,0.795,0.795 0.799,0.799,0.799 0.803,0.803,0.803 0.808,0.808,0.808 0.812,0.812,0.812 0.816,0.816,0.816 0.820,0.821,0.821 0.825,0.825,0.825 0.829,0.829,0.829 0.833,0.833,0.833 0.838,0.838,0.838 0.842,0.842,0.842 0.846,0.846,0.846 0.851,0.851,0.851 0.855,0.855,0.855 0.859,0.859,0.859 0.864,0.864,0.864 0.868,0.868,0.868 0.872,0.872,0.872 0.877,0.877,0.877 0.881,0.881,0.881 0.885,0.885,0.885 0.890,0.890,0.890 0.894,0.894,0.894 0.898,0.899,0.898 0.903,0.903,0.903 0.907,0.907,0.907 0.911,0.912,0.912 0.916,0.916,0.916 0.920,0.920,0.920 0.925,0.925,0.925 0.929,0.929,0.929 0.933,0.934,0.934 0.938,0.938,0.938 0.942,0.942,0.942 0.947,0.947,0.947 0.951,0.951,0.951 0.955,0.956,0.956 0.960,0.960,0.960 0.964,0.965,0.964 0.969,0.969,0.969 0.973,0.973,0.973 0.978,0.978,0.978 0.982,0.982,0.982 0.987,0.987,0.987 0.991,0.991,0.991 0.995,0.996,0.996 1.000,1.000,1.000 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L10.csv000066400000000000000000000110001457240071200235670ustar00rootroot000000000000000.399,0.606,0.565 0.402,0.607,0.563 0.404,0.608,0.561 0.407,0.609,0.559 0.410,0.610,0.557 0.413,0.611,0.555 0.416,0.612,0.553 0.419,0.613,0.552 0.421,0.614,0.550 0.424,0.615,0.548 0.427,0.616,0.546 0.430,0.617,0.544 0.433,0.617,0.543 0.436,0.618,0.541 0.439,0.619,0.539 0.442,0.620,0.537 0.445,0.621,0.535 0.448,0.622,0.534 0.450,0.623,0.532 0.453,0.624,0.530 0.456,0.624,0.528 0.459,0.625,0.527 0.462,0.626,0.525 0.465,0.627,0.523 0.468,0.628,0.521 0.471,0.629,0.520 0.474,0.629,0.518 0.478,0.630,0.516 0.481,0.631,0.515 0.484,0.632,0.513 0.487,0.633,0.511 0.490,0.633,0.509 0.493,0.634,0.508 0.496,0.635,0.506 0.500,0.636,0.505 0.503,0.636,0.503 0.506,0.637,0.501 0.509,0.638,0.500 0.513,0.639,0.498 0.516,0.639,0.496 0.519,0.640,0.495 0.523,0.641,0.493 0.526,0.641,0.492 0.530,0.642,0.490 0.533,0.643,0.489 0.537,0.643,0.487 0.540,0.644,0.486 0.544,0.644,0.484 0.547,0.645,0.483 0.551,0.645,0.481 0.555,0.646,0.480 0.558,0.647,0.478 0.562,0.647,0.477 0.566,0.648,0.475 0.570,0.648,0.474 0.574,0.648,0.473 0.578,0.649,0.471 0.582,0.649,0.470 0.586,0.650,0.469 0.590,0.650,0.467 0.594,0.650,0.466 0.598,0.651,0.465 0.602,0.651,0.463 0.607,0.651,0.462 0.611,0.652,0.461 0.616,0.652,0.460 0.620,0.652,0.459 0.625,0.652,0.458 0.630,0.652,0.457 0.634,0.652,0.456 0.639,0.652,0.455 0.644,0.652,0.454 0.649,0.652,0.453 0.654,0.652,0.452 0.660,0.652,0.451 0.665,0.652,0.450 0.671,0.652,0.449 0.676,0.652,0.449 0.682,0.651,0.448 0.687,0.651,0.447 0.692,0.651,0.447 0.697,0.651,0.446 0.702,0.650,0.445 0.707,0.650,0.445 0.712,0.650,0.444 0.717,0.650,0.443 0.722,0.650,0.443 0.726,0.650,0.442 0.730,0.650,0.441 0.735,0.650,0.440 0.739,0.650,0.440 0.743,0.650,0.439 0.747,0.650,0.438 0.751,0.650,0.438 0.755,0.650,0.437 0.759,0.651,0.436 0.762,0.651,0.436 0.766,0.651,0.435 0.769,0.651,0.434 0.773,0.652,0.434 0.776,0.652,0.433 0.779,0.652,0.432 0.782,0.653,0.432 0.785,0.653,0.431 0.788,0.653,0.430 0.791,0.654,0.430 0.794,0.654,0.429 0.796,0.655,0.428 0.799,0.656,0.428 0.801,0.656,0.427 0.803,0.657,0.426 0.806,0.657,0.426 0.808,0.658,0.425 0.810,0.659,0.424 0.812,0.660,0.424 0.814,0.660,0.423 0.816,0.661,0.422 0.818,0.662,0.422 0.819,0.663,0.421 0.821,0.664,0.420 0.822,0.665,0.420 0.824,0.666,0.419 0.825,0.667,0.418 0.826,0.668,0.418 0.827,0.669,0.417 0.829,0.670,0.416 0.830,0.672,0.415 0.830,0.673,0.415 0.831,0.674,0.414 0.832,0.675,0.414 0.833,0.677,0.413 0.834,0.678,0.413 0.834,0.679,0.412 0.835,0.680,0.412 0.836,0.682,0.412 0.836,0.683,0.412 0.837,0.684,0.412 0.838,0.685,0.412 0.838,0.687,0.413 0.839,0.688,0.413 0.840,0.689,0.414 0.840,0.690,0.414 0.841,0.692,0.415 0.841,0.693,0.416 0.842,0.694,0.417 0.842,0.695,0.418 0.843,0.697,0.419 0.843,0.698,0.420 0.844,0.699,0.421 0.844,0.700,0.423 0.845,0.702,0.424 0.845,0.703,0.426 0.846,0.704,0.427 0.846,0.706,0.429 0.846,0.707,0.431 0.847,0.708,0.433 0.847,0.709,0.435 0.847,0.711,0.437 0.848,0.712,0.440 0.848,0.713,0.442 0.848,0.714,0.444 0.848,0.716,0.447 0.849,0.717,0.450 0.849,0.718,0.453 0.849,0.720,0.455 0.849,0.721,0.458 0.849,0.722,0.461 0.849,0.723,0.465 0.849,0.725,0.468 0.850,0.726,0.471 0.850,0.727,0.475 0.850,0.729,0.478 0.850,0.730,0.482 0.850,0.731,0.486 0.849,0.733,0.490 0.849,0.734,0.494 0.849,0.735,0.498 0.849,0.737,0.502 0.849,0.738,0.506 0.849,0.739,0.510 0.848,0.740,0.515 0.848,0.742,0.519 0.848,0.743,0.523 0.848,0.744,0.527 0.848,0.746,0.532 0.848,0.747,0.536 0.847,0.748,0.540 0.847,0.749,0.545 0.847,0.751,0.549 0.847,0.752,0.553 0.847,0.753,0.557 0.847,0.755,0.562 0.847,0.756,0.566 0.846,0.757,0.570 0.846,0.758,0.574 0.846,0.760,0.579 0.846,0.761,0.583 0.846,0.762,0.587 0.846,0.763,0.591 0.846,0.765,0.596 0.846,0.766,0.600 0.845,0.767,0.604 0.845,0.768,0.608 0.845,0.769,0.613 0.845,0.771,0.617 0.845,0.772,0.621 0.845,0.773,0.625 0.845,0.774,0.630 0.844,0.776,0.634 0.844,0.777,0.638 0.844,0.778,0.642 0.844,0.779,0.646 0.844,0.780,0.651 0.844,0.782,0.655 0.843,0.783,0.659 0.843,0.784,0.663 0.843,0.785,0.668 0.843,0.787,0.672 0.843,0.788,0.676 0.843,0.789,0.680 0.842,0.790,0.684 0.842,0.791,0.689 0.842,0.793,0.693 0.842,0.794,0.697 0.842,0.795,0.701 0.841,0.796,0.706 0.841,0.797,0.710 0.841,0.799,0.714 0.841,0.800,0.718 0.841,0.801,0.722 0.840,0.802,0.727 0.840,0.804,0.731 0.840,0.805,0.735 0.840,0.806,0.739 0.839,0.807,0.744 0.839,0.808,0.748 0.839,0.810,0.752 0.838,0.811,0.756 0.838,0.812,0.760 0.838,0.813,0.765 0.838,0.814,0.769 0.837,0.816,0.773 0.837,0.817,0.777 0.837,0.818,0.782 0.836,0.819,0.786 0.836,0.820,0.790 0.836,0.822,0.794 0.835,0.823,0.798 0.835,0.824,0.803 0.835,0.825,0.807 0.834,0.826,0.811 0.834,0.828,0.815 0.833,0.829,0.820 0.833,0.830,0.824 0.833,0.831,0.828 0.832,0.832,0.832 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L11.csv000066400000000000000000000110001457240071200235700ustar00rootroot000000000000000.438,0.678,0.361 0.443,0.678,0.361 0.449,0.679,0.361 0.454,0.679,0.362 0.459,0.679,0.362 0.465,0.680,0.363 0.470,0.680,0.363 0.475,0.680,0.364 0.480,0.680,0.364 0.485,0.681,0.365 0.491,0.681,0.365 0.496,0.681,0.366 0.501,0.682,0.366 0.506,0.682,0.366 0.511,0.682,0.367 0.515,0.682,0.367 0.520,0.683,0.368 0.525,0.683,0.368 0.530,0.683,0.369 0.535,0.683,0.369 0.539,0.684,0.370 0.544,0.684,0.370 0.549,0.684,0.371 0.554,0.684,0.371 0.558,0.685,0.372 0.563,0.685,0.372 0.567,0.685,0.373 0.572,0.685,0.373 0.577,0.686,0.374 0.581,0.686,0.374 0.585,0.686,0.374 0.590,0.686,0.375 0.594,0.687,0.375 0.599,0.687,0.376 0.603,0.687,0.376 0.608,0.687,0.377 0.612,0.687,0.377 0.616,0.688,0.378 0.621,0.688,0.378 0.625,0.688,0.379 0.629,0.688,0.379 0.633,0.689,0.380 0.638,0.689,0.380 0.642,0.689,0.381 0.646,0.689,0.381 0.650,0.689,0.382 0.654,0.690,0.382 0.658,0.690,0.383 0.662,0.690,0.383 0.666,0.690,0.384 0.671,0.690,0.384 0.675,0.691,0.385 0.679,0.691,0.385 0.683,0.691,0.386 0.687,0.691,0.386 0.691,0.691,0.387 0.694,0.692,0.387 0.698,0.692,0.388 0.702,0.692,0.388 0.706,0.692,0.389 0.710,0.692,0.389 0.714,0.693,0.390 0.718,0.693,0.390 0.722,0.693,0.391 0.725,0.693,0.391 0.729,0.694,0.392 0.733,0.694,0.392 0.737,0.694,0.393 0.740,0.694,0.393 0.744,0.694,0.394 0.748,0.695,0.394 0.751,0.695,0.395 0.755,0.695,0.395 0.759,0.695,0.396 0.762,0.695,0.396 0.766,0.696,0.397 0.769,0.696,0.398 0.773,0.696,0.398 0.776,0.696,0.399 0.780,0.697,0.399 0.783,0.697,0.400 0.787,0.697,0.400 0.790,0.697,0.401 0.794,0.698,0.401 0.797,0.698,0.402 0.800,0.698,0.402 0.804,0.698,0.403 0.807,0.699,0.403 0.810,0.699,0.404 0.814,0.699,0.405 0.817,0.700,0.405 0.820,0.700,0.406 0.823,0.700,0.406 0.826,0.700,0.407 0.830,0.701,0.407 0.833,0.701,0.408 0.836,0.701,0.408 0.839,0.702,0.409 0.842,0.702,0.410 0.845,0.702,0.410 0.848,0.703,0.411 0.851,0.703,0.411 0.853,0.704,0.412 0.856,0.704,0.412 0.859,0.704,0.413 0.862,0.705,0.414 0.864,0.705,0.414 0.867,0.706,0.415 0.870,0.706,0.415 0.872,0.707,0.416 0.875,0.707,0.417 0.877,0.708,0.417 0.879,0.709,0.418 0.882,0.709,0.418 0.884,0.710,0.419 0.886,0.710,0.420 0.888,0.711,0.420 0.890,0.712,0.421 0.892,0.713,0.421 0.894,0.713,0.422 0.896,0.714,0.423 0.897,0.715,0.423 0.899,0.716,0.424 0.900,0.717,0.425 0.901,0.718,0.425 0.902,0.719,0.426 0.903,0.720,0.427 0.903,0.722,0.428 0.904,0.723,0.428 0.904,0.725,0.429 0.904,0.726,0.430 0.904,0.727,0.431 0.904,0.729,0.432 0.905,0.730,0.433 0.905,0.732,0.434 0.905,0.733,0.436 0.905,0.734,0.437 0.905,0.736,0.438 0.906,0.737,0.440 0.906,0.739,0.441 0.906,0.740,0.443 0.906,0.741,0.445 0.906,0.743,0.446 0.906,0.744,0.448 0.906,0.746,0.450 0.907,0.747,0.452 0.907,0.748,0.454 0.907,0.750,0.456 0.907,0.751,0.458 0.907,0.753,0.461 0.907,0.754,0.463 0.907,0.755,0.465 0.907,0.757,0.468 0.907,0.758,0.471 0.907,0.759,0.473 0.908,0.761,0.476 0.908,0.762,0.479 0.908,0.763,0.481 0.908,0.765,0.484 0.908,0.766,0.487 0.908,0.768,0.490 0.908,0.769,0.494 0.908,0.770,0.497 0.908,0.772,0.500 0.908,0.773,0.503 0.908,0.774,0.507 0.907,0.776,0.510 0.907,0.777,0.514 0.907,0.778,0.517 0.907,0.780,0.521 0.907,0.781,0.525 0.907,0.782,0.529 0.907,0.784,0.532 0.907,0.785,0.536 0.907,0.786,0.540 0.906,0.788,0.545 0.906,0.789,0.549 0.906,0.790,0.553 0.906,0.792,0.557 0.905,0.793,0.562 0.905,0.794,0.566 0.905,0.796,0.570 0.905,0.797,0.575 0.905,0.798,0.579 0.904,0.800,0.583 0.904,0.801,0.588 0.904,0.802,0.592 0.904,0.804,0.596 0.904,0.805,0.601 0.903,0.806,0.605 0.903,0.807,0.609 0.903,0.809,0.614 0.903,0.810,0.618 0.903,0.811,0.622 0.903,0.813,0.627 0.902,0.814,0.631 0.902,0.815,0.635 0.902,0.816,0.639 0.902,0.818,0.644 0.902,0.819,0.648 0.902,0.820,0.652 0.901,0.821,0.657 0.901,0.823,0.661 0.901,0.824,0.665 0.901,0.825,0.669 0.901,0.826,0.674 0.901,0.828,0.678 0.900,0.829,0.682 0.900,0.830,0.687 0.900,0.831,0.691 0.900,0.833,0.695 0.900,0.834,0.699 0.900,0.835,0.704 0.899,0.836,0.708 0.899,0.838,0.712 0.899,0.839,0.717 0.899,0.840,0.721 0.899,0.841,0.725 0.898,0.842,0.729 0.898,0.844,0.734 0.898,0.845,0.738 0.898,0.846,0.742 0.898,0.847,0.746 0.897,0.849,0.751 0.897,0.850,0.755 0.897,0.851,0.759 0.897,0.852,0.763 0.897,0.854,0.768 0.896,0.855,0.772 0.896,0.856,0.776 0.896,0.857,0.781 0.896,0.858,0.785 0.895,0.860,0.789 0.895,0.861,0.793 0.895,0.862,0.798 0.894,0.863,0.802 0.894,0.865,0.806 0.894,0.866,0.810 0.894,0.867,0.815 0.893,0.868,0.819 0.893,0.869,0.823 0.893,0.871,0.828 0.892,0.872,0.832 0.892,0.873,0.836 0.892,0.874,0.840 0.891,0.875,0.845 0.891,0.877,0.849 0.891,0.878,0.853 0.890,0.879,0.858 0.890,0.880,0.862 0.889,0.882,0.866 0.889,0.883,0.870 0.889,0.884,0.875 0.888,0.885,0.879 0.888,0.886,0.883 0.887,0.888,0.888 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L12.csv000066400000000000000000000110001457240071200235710ustar00rootroot000000000000000.943,0.944,0.943 0.940,0.942,0.943 0.937,0.940,0.943 0.934,0.938,0.943 0.931,0.936,0.943 0.928,0.934,0.942 0.925,0.932,0.942 0.922,0.930,0.942 0.919,0.929,0.942 0.917,0.927,0.941 0.914,0.925,0.941 0.911,0.923,0.941 0.908,0.921,0.941 0.905,0.919,0.940 0.902,0.917,0.940 0.899,0.916,0.940 0.896,0.914,0.939 0.893,0.912,0.939 0.890,0.910,0.939 0.887,0.908,0.939 0.884,0.906,0.938 0.881,0.904,0.938 0.878,0.903,0.938 0.875,0.901,0.937 0.872,0.899,0.937 0.869,0.897,0.937 0.866,0.895,0.937 0.863,0.893,0.936 0.860,0.892,0.936 0.857,0.890,0.936 0.854,0.888,0.935 0.851,0.886,0.935 0.848,0.884,0.935 0.845,0.882,0.934 0.842,0.880,0.934 0.839,0.879,0.934 0.836,0.877,0.933 0.833,0.875,0.933 0.830,0.873,0.933 0.827,0.871,0.932 0.824,0.869,0.932 0.821,0.868,0.931 0.818,0.866,0.931 0.815,0.864,0.931 0.812,0.862,0.930 0.809,0.860,0.930 0.806,0.858,0.930 0.803,0.857,0.929 0.800,0.855,0.929 0.797,0.853,0.928 0.794,0.851,0.928 0.791,0.849,0.928 0.788,0.847,0.927 0.785,0.846,0.927 0.782,0.844,0.926 0.779,0.842,0.926 0.776,0.840,0.925 0.773,0.838,0.925 0.770,0.836,0.925 0.767,0.835,0.924 0.764,0.833,0.924 0.761,0.831,0.923 0.758,0.829,0.923 0.755,0.827,0.922 0.752,0.825,0.922 0.749,0.824,0.921 0.746,0.822,0.921 0.743,0.820,0.920 0.740,0.818,0.920 0.737,0.816,0.919 0.734,0.815,0.919 0.731,0.813,0.918 0.728,0.811,0.918 0.725,0.809,0.917 0.722,0.807,0.917 0.719,0.805,0.916 0.716,0.804,0.915 0.713,0.802,0.915 0.710,0.800,0.914 0.707,0.798,0.914 0.704,0.796,0.913 0.701,0.794,0.912 0.698,0.793,0.912 0.695,0.791,0.911 0.692,0.789,0.911 0.689,0.787,0.910 0.686,0.785,0.909 0.684,0.784,0.909 0.681,0.782,0.908 0.678,0.780,0.907 0.675,0.778,0.906 0.672,0.776,0.906 0.669,0.774,0.905 0.666,0.773,0.904 0.663,0.771,0.903 0.660,0.769,0.903 0.658,0.767,0.902 0.655,0.765,0.901 0.652,0.764,0.900 0.649,0.762,0.899 0.646,0.760,0.898 0.643,0.758,0.897 0.641,0.756,0.897 0.638,0.754,0.896 0.635,0.753,0.895 0.632,0.751,0.894 0.630,0.749,0.893 0.627,0.747,0.892 0.624,0.745,0.891 0.622,0.743,0.889 0.619,0.742,0.888 0.617,0.740,0.887 0.614,0.738,0.886 0.612,0.736,0.884 0.609,0.734,0.883 0.607,0.732,0.882 0.604,0.731,0.880 0.602,0.729,0.879 0.600,0.727,0.878 0.597,0.725,0.876 0.595,0.723,0.875 0.592,0.721,0.874 0.590,0.720,0.872 0.588,0.718,0.871 0.585,0.716,0.869 0.583,0.714,0.868 0.581,0.712,0.866 0.578,0.710,0.865 0.576,0.708,0.863 0.574,0.707,0.862 0.571,0.705,0.860 0.569,0.703,0.859 0.567,0.701,0.857 0.565,0.699,0.856 0.562,0.697,0.854 0.560,0.696,0.853 0.558,0.694,0.851 0.556,0.692,0.849 0.553,0.690,0.848 0.551,0.688,0.846 0.549,0.686,0.845 0.547,0.685,0.843 0.545,0.683,0.841 0.542,0.681,0.840 0.540,0.679,0.838 0.538,0.677,0.836 0.536,0.675,0.835 0.534,0.673,0.833 0.532,0.672,0.831 0.530,0.670,0.830 0.528,0.668,0.828 0.526,0.666,0.826 0.524,0.664,0.824 0.521,0.662,0.823 0.519,0.661,0.821 0.517,0.659,0.819 0.515,0.657,0.817 0.513,0.655,0.816 0.511,0.653,0.814 0.509,0.651,0.812 0.507,0.650,0.810 0.505,0.648,0.808 0.503,0.646,0.807 0.502,0.644,0.805 0.500,0.642,0.803 0.498,0.640,0.801 0.496,0.639,0.799 0.494,0.637,0.797 0.492,0.635,0.795 0.490,0.633,0.793 0.488,0.631,0.791 0.486,0.629,0.790 0.484,0.628,0.788 0.482,0.626,0.786 0.480,0.624,0.784 0.478,0.622,0.782 0.476,0.620,0.781 0.474,0.618,0.779 0.472,0.617,0.777 0.470,0.615,0.776 0.468,0.613,0.774 0.466,0.611,0.773 0.463,0.609,0.771 0.461,0.608,0.769 0.459,0.606,0.768 0.456,0.604,0.767 0.454,0.602,0.765 0.452,0.600,0.764 0.449,0.599,0.762 0.447,0.597,0.761 0.444,0.595,0.760 0.442,0.593,0.758 0.439,0.592,0.757 0.437,0.590,0.756 0.434,0.588,0.754 0.432,0.586,0.753 0.429,0.585,0.752 0.427,0.583,0.751 0.424,0.581,0.749 0.421,0.579,0.748 0.419,0.578,0.747 0.416,0.576,0.746 0.413,0.574,0.745 0.410,0.572,0.744 0.408,0.571,0.742 0.405,0.569,0.741 0.402,0.567,0.740 0.399,0.565,0.739 0.396,0.564,0.738 0.394,0.562,0.737 0.391,0.560,0.736 0.388,0.558,0.735 0.385,0.557,0.734 0.382,0.555,0.733 0.379,0.553,0.732 0.376,0.552,0.731 0.373,0.550,0.730 0.370,0.548,0.729 0.367,0.546,0.728 0.364,0.545,0.727 0.361,0.543,0.726 0.357,0.541,0.725 0.354,0.540,0.724 0.351,0.538,0.723 0.348,0.536,0.722 0.345,0.534,0.721 0.341,0.533,0.721 0.338,0.531,0.720 0.335,0.529,0.719 0.331,0.528,0.718 0.328,0.526,0.717 0.324,0.524,0.716 0.321,0.523,0.715 0.318,0.521,0.715 0.314,0.519,0.714 0.310,0.518,0.713 0.307,0.516,0.712 0.303,0.514,0.711 0.300,0.513,0.710 0.296,0.511,0.710 0.292,0.509,0.709 0.288,0.508,0.708 0.285,0.506,0.707 0.281,0.504,0.706 0.277,0.503,0.706 0.273,0.501,0.705 0.269,0.499,0.704 0.265,0.498,0.703 0.260,0.496,0.703 0.256,0.494,0.702 0.252,0.493,0.701 0.248,0.491,0.700 0.243,0.489,0.700 0.239,0.488,0.699 0.234,0.486,0.698 0.230,0.484,0.698 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L13.csv000066400000000000000000000110001457240071200235720ustar00rootroot000000000000000.000,0.000,0.000 0.008,0.002,0.000 0.016,0.003,0.000 0.024,0.005,0.000 0.032,0.006,0.000 0.040,0.008,0.000 0.048,0.009,0.000 0.055,0.010,0.000 0.062,0.012,0.000 0.069,0.013,0.000 0.075,0.014,0.000 0.081,0.015,0.000 0.086,0.016,0.000 0.092,0.017,0.000 0.097,0.018,0.000 0.102,0.019,0.000 0.107,0.020,0.000 0.112,0.021,0.000 0.116,0.022,0.000 0.121,0.023,0.000 0.125,0.024,0.000 0.129,0.024,0.000 0.133,0.025,0.000 0.137,0.026,0.000 0.141,0.027,0.000 0.145,0.027,0.000 0.149,0.028,0.000 0.152,0.029,0.000 0.156,0.029,0.000 0.159,0.030,0.000 0.163,0.031,0.000 0.166,0.031,0.000 0.169,0.032,0.000 0.173,0.033,0.000 0.176,0.033,0.000 0.179,0.034,0.000 0.182,0.034,0.000 0.185,0.035,0.000 0.188,0.036,0.000 0.191,0.036,0.000 0.194,0.037,0.000 0.197,0.037,0.000 0.200,0.038,0.000 0.203,0.038,0.000 0.206,0.039,0.000 0.209,0.039,0.000 0.212,0.040,0.000 0.215,0.041,0.000 0.218,0.041,0.000 0.221,0.042,0.000 0.223,0.042,0.000 0.226,0.043,0.000 0.229,0.043,0.000 0.232,0.044,0.000 0.235,0.044,0.000 0.238,0.045,0.000 0.241,0.046,0.000 0.244,0.046,0.000 0.247,0.047,0.000 0.250,0.047,0.000 0.253,0.048,0.000 0.256,0.048,0.000 0.259,0.049,0.000 0.262,0.049,0.000 0.265,0.050,0.000 0.268,0.051,0.000 0.271,0.051,0.000 0.274,0.052,0.000 0.277,0.052,0.000 0.280,0.053,0.000 0.283,0.053,0.000 0.286,0.054,0.000 0.289,0.055,0.000 0.292,0.055,0.000 0.295,0.056,0.000 0.298,0.056,0.000 0.301,0.057,0.000 0.304,0.057,0.000 0.307,0.058,0.000 0.310,0.059,0.000 0.313,0.059,0.000 0.316,0.060,0.000 0.319,0.060,0.000 0.322,0.061,0.000 0.325,0.061,0.000 0.328,0.062,0.000 0.332,0.063,0.000 0.335,0.063,0.000 0.338,0.064,0.000 0.341,0.064,0.000 0.344,0.065,0.000 0.347,0.066,0.000 0.350,0.066,0.000 0.353,0.067,0.000 0.356,0.067,0.000 0.359,0.068,0.000 0.363,0.068,0.000 0.366,0.069,0.000 0.369,0.070,0.000 0.372,0.070,0.000 0.375,0.071,0.000 0.378,0.071,0.000 0.381,0.072,0.000 0.384,0.073,0.000 0.388,0.073,0.000 0.391,0.074,0.000 0.394,0.074,0.000 0.397,0.075,0.000 0.400,0.076,0.000 0.403,0.076,0.000 0.406,0.077,0.000 0.410,0.077,0.000 0.413,0.078,0.000 0.416,0.079,0.000 0.419,0.079,0.000 0.422,0.080,0.000 0.426,0.080,0.000 0.429,0.081,0.000 0.432,0.082,0.000 0.435,0.082,0.000 0.438,0.083,0.000 0.441,0.083,0.000 0.445,0.084,0.000 0.448,0.085,0.000 0.451,0.085,0.000 0.454,0.086,0.000 0.458,0.086,0.000 0.461,0.087,0.000 0.464,0.088,0.000 0.467,0.088,0.000 0.470,0.089,0.000 0.474,0.089,0.000 0.477,0.090,0.000 0.480,0.091,0.000 0.483,0.091,0.000 0.487,0.092,0.000 0.490,0.093,0.000 0.493,0.093,0.000 0.496,0.094,0.000 0.500,0.094,0.000 0.503,0.095,0.000 0.506,0.096,0.000 0.510,0.096,0.000 0.513,0.097,0.000 0.516,0.098,0.000 0.519,0.098,0.000 0.523,0.099,0.000 0.526,0.099,0.000 0.529,0.100,0.000 0.533,0.101,0.000 0.536,0.101,0.000 0.539,0.102,0.000 0.543,0.102,0.000 0.546,0.103,0.000 0.549,0.104,0.000 0.552,0.104,0.000 0.556,0.105,0.000 0.559,0.106,0.000 0.563,0.106,0.000 0.566,0.107,0.000 0.569,0.108,0.000 0.572,0.108,0.000 0.576,0.109,0.000 0.579,0.109,0.000 0.583,0.110,0.000 0.586,0.111,0.000 0.589,0.111,0.000 0.593,0.112,0.000 0.596,0.113,0.000 0.599,0.113,0.000 0.603,0.114,0.000 0.606,0.114,0.000 0.609,0.115,0.000 0.613,0.116,0.000 0.616,0.116,0.000 0.620,0.117,0.000 0.623,0.118,0.000 0.626,0.118,0.000 0.630,0.119,0.000 0.633,0.120,0.000 0.637,0.120,0.000 0.640,0.121,0.000 0.643,0.122,0.000 0.647,0.122,0.000 0.650,0.123,0.000 0.654,0.123,0.000 0.657,0.124,0.000 0.660,0.125,0.000 0.664,0.125,0.000 0.667,0.126,0.000 0.671,0.127,0.000 0.674,0.127,0.000 0.678,0.128,0.000 0.681,0.129,0.000 0.685,0.129,0.000 0.688,0.130,0.000 0.691,0.131,0.000 0.695,0.131,0.000 0.698,0.132,0.000 0.702,0.133,0.000 0.705,0.133,0.000 0.709,0.134,0.000 0.712,0.135,0.000 0.716,0.135,0.000 0.719,0.136,0.000 0.723,0.136,0.000 0.726,0.137,0.000 0.730,0.138,0.000 0.733,0.138,0.000 0.737,0.139,0.000 0.740,0.140,0.000 0.744,0.140,0.000 0.747,0.141,0.000 0.751,0.142,0.000 0.754,0.142,0.000 0.758,0.143,0.000 0.761,0.144,0.000 0.765,0.144,0.000 0.768,0.145,0.000 0.772,0.146,0.000 0.775,0.146,0.000 0.779,0.147,0.000 0.782,0.148,0.000 0.786,0.148,0.000 0.789,0.149,0.000 0.793,0.150,0.000 0.796,0.150,0.000 0.800,0.151,0.000 0.803,0.152,0.000 0.807,0.152,0.000 0.810,0.153,0.000 0.814,0.154,0.000 0.818,0.154,0.000 0.821,0.155,0.000 0.825,0.156,0.000 0.828,0.156,0.000 0.832,0.157,0.000 0.835,0.158,0.000 0.839,0.158,0.000 0.842,0.159,0.000 0.846,0.160,0.000 0.850,0.160,0.000 0.853,0.161,0.000 0.857,0.162,0.000 0.860,0.163,0.000 0.864,0.163,0.000 0.868,0.164,0.000 0.871,0.165,0.000 0.875,0.165,0.000 0.878,0.166,0.000 0.882,0.167,0.000 0.886,0.167,0.000 0.889,0.168,0.000 0.893,0.169,0.000 0.896,0.169,0.000 0.900,0.170,0.000 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L14.csv000066400000000000000000000110001457240071200235730ustar00rootroot000000000000000.000,0.000,0.000 0.000,0.004,0.000 0.000,0.007,0.000 0.000,0.011,0.000 0.000,0.015,0.000 0.000,0.018,0.000 0.000,0.022,0.000 0.000,0.025,0.000 0.000,0.029,0.000 0.000,0.032,0.000 0.000,0.036,0.000 0.000,0.040,0.000 0.000,0.043,0.000 0.000,0.047,0.000 0.000,0.050,0.000 0.000,0.053,0.000 0.000,0.056,0.000 0.000,0.059,0.000 0.000,0.061,0.000 0.000,0.064,0.000 0.000,0.067,0.000 0.000,0.069,0.000 0.000,0.071,0.000 0.000,0.074,0.000 0.000,0.076,0.000 0.000,0.078,0.000 0.000,0.081,0.000 0.000,0.083,0.000 0.000,0.085,0.000 0.000,0.087,0.000 0.000,0.089,0.000 0.000,0.091,0.000 0.000,0.093,0.000 0.000,0.095,0.000 0.000,0.097,0.000 0.000,0.098,0.000 0.000,0.100,0.000 0.000,0.102,0.000 0.000,0.104,0.000 0.000,0.106,0.000 0.000,0.107,0.000 0.000,0.109,0.000 0.000,0.111,0.000 0.000,0.112,0.000 0.000,0.114,0.000 0.000,0.115,0.000 0.000,0.117,0.000 0.000,0.119,0.000 0.000,0.120,0.000 0.000,0.122,0.000 0.000,0.123,0.000 0.000,0.125,0.000 0.000,0.127,0.000 0.000,0.128,0.000 0.000,0.130,0.000 0.000,0.132,0.000 0.000,0.133,0.000 0.000,0.135,0.000 0.000,0.136,0.000 0.000,0.138,0.000 0.000,0.140,0.000 0.000,0.141,0.000 0.000,0.143,0.000 0.000,0.145,0.000 0.000,0.146,0.000 0.000,0.148,0.000 0.000,0.150,0.000 0.000,0.151,0.000 0.000,0.153,0.000 0.000,0.154,0.000 0.000,0.156,0.000 0.000,0.158,0.000 0.000,0.159,0.000 0.000,0.161,0.000 0.000,0.163,0.000 0.000,0.165,0.000 0.000,0.166,0.000 0.000,0.168,0.000 0.000,0.170,0.000 0.000,0.171,0.000 0.000,0.173,0.000 0.000,0.175,0.000 0.000,0.176,0.000 0.000,0.178,0.000 0.000,0.180,0.000 0.000,0.181,0.000 0.000,0.183,0.000 0.000,0.185,0.000 0.000,0.187,0.000 0.000,0.188,0.000 0.000,0.190,0.000 0.000,0.192,0.000 0.000,0.193,0.000 0.000,0.195,0.000 0.000,0.197,0.000 0.000,0.199,0.000 0.000,0.200,0.000 0.000,0.202,0.000 0.000,0.204,0.000 0.000,0.205,0.000 0.000,0.207,0.000 0.000,0.209,0.000 0.000,0.211,0.000 0.000,0.212,0.000 0.000,0.214,0.000 0.000,0.216,0.000 0.000,0.218,0.000 0.000,0.219,0.000 0.000,0.221,0.000 0.000,0.223,0.000 0.000,0.225,0.000 0.000,0.226,0.000 0.000,0.228,0.000 0.000,0.230,0.000 0.000,0.232,0.000 0.000,0.234,0.000 0.000,0.235,0.000 0.000,0.237,0.000 0.000,0.239,0.000 0.000,0.241,0.000 0.000,0.242,0.000 0.000,0.244,0.000 0.000,0.246,0.000 0.000,0.248,0.000 0.000,0.250,0.000 0.000,0.251,0.000 0.000,0.253,0.000 0.000,0.255,0.000 0.000,0.257,0.000 0.000,0.259,0.000 0.000,0.260,0.000 0.000,0.262,0.000 0.000,0.264,0.000 0.000,0.266,0.000 0.000,0.268,0.000 0.000,0.269,0.000 0.000,0.271,0.000 0.000,0.273,0.000 0.000,0.275,0.000 0.000,0.277,0.000 0.000,0.278,0.000 0.000,0.280,0.000 0.000,0.282,0.000 0.000,0.284,0.000 0.000,0.286,0.000 0.000,0.288,0.000 0.000,0.289,0.000 0.000,0.291,0.000 0.000,0.293,0.000 0.000,0.295,0.000 0.000,0.297,0.000 0.000,0.299,0.000 0.000,0.300,0.000 0.000,0.302,0.000 0.000,0.304,0.000 0.000,0.306,0.000 0.000,0.308,0.000 0.000,0.310,0.000 0.000,0.312,0.000 0.000,0.313,0.000 0.000,0.315,0.000 0.000,0.317,0.000 0.000,0.319,0.000 0.000,0.321,0.000 0.000,0.323,0.000 0.000,0.325,0.000 0.000,0.327,0.000 0.000,0.328,0.000 0.000,0.330,0.000 0.000,0.332,0.000 0.000,0.334,0.000 0.000,0.336,0.000 0.000,0.338,0.000 0.000,0.340,0.000 0.000,0.342,0.000 0.000,0.343,0.000 0.000,0.345,0.000 0.000,0.347,0.000 0.000,0.349,0.000 0.000,0.351,0.000 0.000,0.353,0.000 0.000,0.355,0.000 0.000,0.357,0.000 0.000,0.359,0.000 0.000,0.361,0.000 0.000,0.362,0.000 0.000,0.364,0.000 0.000,0.366,0.000 0.000,0.368,0.000 0.000,0.370,0.000 0.000,0.372,0.000 0.000,0.374,0.000 0.000,0.376,0.000 0.000,0.378,0.000 0.000,0.380,0.000 0.000,0.382,0.000 0.000,0.384,0.000 0.000,0.385,0.000 0.000,0.387,0.000 0.000,0.389,0.000 0.000,0.391,0.000 0.000,0.393,0.000 0.000,0.395,0.000 0.000,0.397,0.000 0.000,0.399,0.000 0.000,0.401,0.000 0.000,0.403,0.000 0.000,0.405,0.000 0.000,0.407,0.000 0.000,0.409,0.000 0.000,0.411,0.000 0.000,0.413,0.000 0.000,0.415,0.000 0.000,0.417,0.000 0.000,0.418,0.000 0.000,0.420,0.000 0.000,0.422,0.000 0.000,0.424,0.000 0.000,0.426,0.000 0.000,0.428,0.000 0.000,0.430,0.000 0.000,0.432,0.000 0.000,0.434,0.000 0.000,0.436,0.000 0.000,0.438,0.000 0.000,0.440,0.000 0.000,0.442,0.000 0.000,0.444,0.000 0.000,0.446,0.000 0.000,0.448,0.000 0.000,0.450,0.000 0.000,0.452,0.000 0.000,0.454,0.000 0.000,0.456,0.000 0.000,0.458,0.000 0.000,0.460,0.000 0.000,0.462,0.000 0.000,0.464,0.000 0.000,0.466,0.000 0.000,0.468,0.000 0.000,0.470,0.000 0.000,0.472,0.000 0.000,0.474,0.000 0.000,0.476,0.000 0.000,0.478,0.000 0.000,0.480,0.000 0.000,0.482,0.000 0.000,0.484,0.000 0.000,0.486,0.000 0.000,0.488,0.000 0.000,0.490,0.000 0.000,0.492,0.000 0.000,0.494,0.000 0.000,0.496,0.000 0.000,0.498,0.000 0.000,0.500,0.000 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L15.csv000066400000000000000000000110001457240071200235740ustar00rootroot000000000000000.000,0.000,0.000 0.001,0.002,0.007 0.001,0.005,0.015 0.002,0.007,0.022 0.003,0.010,0.030 0.004,0.012,0.038 0.004,0.015,0.045 0.005,0.017,0.052 0.006,0.020,0.059 0.007,0.022,0.066 0.007,0.024,0.073 0.008,0.026,0.079 0.009,0.028,0.086 0.009,0.030,0.092 0.010,0.032,0.098 0.010,0.034,0.105 0.011,0.037,0.111 0.012,0.038,0.117 0.012,0.040,0.122 0.013,0.042,0.128 0.013,0.044,0.133 0.014,0.046,0.138 0.014,0.047,0.144 0.015,0.049,0.149 0.015,0.051,0.153 0.016,0.052,0.158 0.016,0.054,0.163 0.017,0.055,0.167 0.017,0.057,0.172 0.018,0.058,0.176 0.018,0.059,0.180 0.018,0.061,0.184 0.019,0.062,0.188 0.019,0.063,0.192 0.020,0.065,0.196 0.020,0.066,0.200 0.020,0.067,0.204 0.021,0.069,0.208 0.021,0.070,0.211 0.021,0.071,0.215 0.022,0.072,0.218 0.022,0.073,0.222 0.023,0.074,0.225 0.023,0.075,0.229 0.023,0.077,0.232 0.024,0.078,0.235 0.024,0.079,0.238 0.024,0.080,0.242 0.025,0.081,0.245 0.025,0.082,0.248 0.025,0.083,0.252 0.025,0.084,0.255 0.026,0.085,0.258 0.026,0.086,0.261 0.026,0.087,0.265 0.027,0.088,0.268 0.027,0.089,0.271 0.027,0.091,0.274 0.028,0.092,0.278 0.028,0.093,0.281 0.028,0.094,0.284 0.029,0.095,0.288 0.029,0.096,0.291 0.029,0.097,0.294 0.030,0.098,0.297 0.030,0.099,0.301 0.030,0.100,0.304 0.031,0.101,0.307 0.031,0.103,0.311 0.031,0.104,0.314 0.032,0.105,0.317 0.032,0.106,0.321 0.032,0.107,0.324 0.033,0.108,0.327 0.033,0.109,0.331 0.033,0.110,0.334 0.034,0.111,0.338 0.034,0.113,0.341 0.034,0.114,0.344 0.035,0.115,0.348 0.035,0.116,0.351 0.035,0.117,0.354 0.036,0.118,0.358 0.036,0.119,0.361 0.036,0.120,0.365 0.037,0.121,0.368 0.037,0.123,0.371 0.037,0.124,0.375 0.038,0.125,0.378 0.038,0.126,0.382 0.039,0.127,0.385 0.039,0.128,0.389 0.039,0.129,0.392 0.040,0.131,0.395 0.040,0.132,0.399 0.040,0.133,0.402 0.041,0.134,0.406 0.041,0.135,0.409 0.041,0.136,0.413 0.042,0.137,0.416 0.042,0.138,0.420 0.042,0.140,0.423 0.043,0.141,0.427 0.043,0.142,0.430 0.043,0.143,0.434 0.044,0.144,0.437 0.044,0.145,0.441 0.044,0.147,0.444 0.045,0.148,0.448 0.045,0.149,0.451 0.045,0.150,0.455 0.046,0.151,0.458 0.046,0.152,0.462 0.047,0.153,0.465 0.047,0.155,0.469 0.047,0.156,0.472 0.048,0.157,0.476 0.048,0.158,0.479 0.048,0.159,0.483 0.049,0.160,0.486 0.049,0.162,0.490 0.049,0.163,0.493 0.050,0.164,0.497 0.050,0.165,0.500 0.050,0.166,0.504 0.051,0.168,0.508 0.051,0.169,0.511 0.051,0.170,0.515 0.052,0.171,0.518 0.052,0.172,0.522 0.053,0.173,0.526 0.053,0.175,0.529 0.053,0.176,0.533 0.054,0.177,0.536 0.054,0.178,0.540 0.054,0.179,0.543 0.055,0.181,0.547 0.055,0.182,0.551 0.055,0.183,0.554 0.056,0.184,0.558 0.056,0.185,0.562 0.057,0.187,0.565 0.057,0.188,0.569 0.057,0.189,0.572 0.058,0.190,0.576 0.058,0.191,0.580 0.058,0.193,0.583 0.059,0.194,0.587 0.059,0.195,0.591 0.059,0.196,0.594 0.060,0.197,0.598 0.060,0.199,0.602 0.061,0.200,0.605 0.061,0.201,0.609 0.061,0.202,0.613 0.062,0.203,0.616 0.062,0.205,0.620 0.062,0.206,0.624 0.063,0.207,0.627 0.063,0.208,0.631 0.063,0.209,0.635 0.064,0.211,0.638 0.064,0.212,0.642 0.065,0.213,0.646 0.065,0.214,0.650 0.065,0.216,0.653 0.066,0.217,0.657 0.066,0.218,0.661 0.066,0.219,0.664 0.067,0.220,0.668 0.067,0.222,0.672 0.068,0.223,0.676 0.068,0.224,0.679 0.068,0.225,0.683 0.069,0.227,0.687 0.069,0.228,0.691 0.069,0.229,0.694 0.070,0.230,0.698 0.070,0.232,0.702 0.071,0.233,0.705 0.071,0.234,0.709 0.071,0.235,0.713 0.072,0.237,0.717 0.072,0.238,0.721 0.072,0.239,0.724 0.073,0.240,0.728 0.073,0.242,0.732 0.074,0.243,0.736 0.074,0.244,0.739 0.074,0.245,0.743 0.075,0.247,0.747 0.075,0.248,0.751 0.075,0.249,0.755 0.076,0.250,0.758 0.076,0.252,0.762 0.077,0.253,0.766 0.077,0.254,0.770 0.077,0.255,0.774 0.078,0.257,0.777 0.078,0.258,0.781 0.079,0.259,0.785 0.079,0.260,0.789 0.079,0.262,0.793 0.080,0.263,0.797 0.080,0.264,0.800 0.080,0.265,0.804 0.081,0.267,0.808 0.081,0.268,0.812 0.082,0.269,0.816 0.082,0.270,0.820 0.082,0.272,0.823 0.083,0.273,0.827 0.083,0.274,0.831 0.084,0.276,0.835 0.084,0.277,0.839 0.084,0.278,0.843 0.085,0.279,0.847 0.085,0.281,0.851 0.085,0.282,0.854 0.086,0.283,0.858 0.086,0.285,0.862 0.087,0.286,0.866 0.087,0.287,0.870 0.087,0.288,0.874 0.088,0.290,0.878 0.088,0.291,0.882 0.089,0.292,0.886 0.089,0.294,0.889 0.089,0.295,0.893 0.090,0.296,0.897 0.090,0.297,0.901 0.091,0.299,0.905 0.091,0.300,0.909 0.091,0.301,0.913 0.092,0.303,0.917 0.092,0.304,0.921 0.092,0.305,0.925 0.093,0.306,0.929 0.093,0.308,0.933 0.094,0.309,0.937 0.094,0.310,0.941 0.094,0.312,0.944 0.095,0.313,0.948 0.095,0.314,0.952 0.096,0.316,0.956 0.096,0.317,0.960 0.096,0.318,0.964 0.097,0.320,0.968 0.097,0.321,0.972 0.098,0.322,0.976 0.098,0.323,0.980 0.098,0.325,0.984 0.099,0.326,0.988 0.099,0.327,0.992 0.100,0.329,0.996 0.100,0.330,1.000 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L16.csv000066400000000000000000000110001457240071200235750ustar00rootroot000000000000000.108,0.108,0.108 0.115,0.108,0.125 0.121,0.107,0.142 0.127,0.107,0.159 0.132,0.107,0.176 0.137,0.106,0.193 0.141,0.106,0.210 0.145,0.105,0.226 0.148,0.104,0.243 0.151,0.104,0.260 0.154,0.103,0.276 0.156,0.103,0.292 0.158,0.102,0.308 0.159,0.101,0.324 0.160,0.101,0.340 0.161,0.100,0.356 0.161,0.100,0.371 0.161,0.099,0.387 0.161,0.099,0.402 0.160,0.098,0.416 0.159,0.098,0.431 0.158,0.098,0.445 0.156,0.098,0.460 0.154,0.098,0.473 0.152,0.098,0.487 0.150,0.098,0.500 0.147,0.099,0.513 0.144,0.099,0.526 0.140,0.100,0.539 0.137,0.101,0.551 0.133,0.102,0.562 0.129,0.104,0.574 0.124,0.106,0.585 0.120,0.107,0.596 0.115,0.110,0.606 0.110,0.112,0.616 0.105,0.114,0.625 0.099,0.117,0.634 0.094,0.120,0.643 0.088,0.124,0.651 0.083,0.127,0.659 0.077,0.131,0.666 0.071,0.135,0.673 0.066,0.139,0.679 0.060,0.143,0.685 0.055,0.148,0.690 0.050,0.152,0.695 0.045,0.157,0.699 0.041,0.163,0.702 0.038,0.168,0.705 0.036,0.173,0.708 0.034,0.179,0.709 0.033,0.184,0.711 0.032,0.190,0.712 0.031,0.196,0.714 0.030,0.201,0.715 0.029,0.207,0.716 0.028,0.212,0.717 0.028,0.217,0.718 0.027,0.223,0.719 0.027,0.228,0.720 0.026,0.233,0.720 0.026,0.239,0.721 0.026,0.244,0.721 0.026,0.250,0.721 0.026,0.255,0.721 0.026,0.260,0.721 0.026,0.266,0.721 0.026,0.271,0.720 0.026,0.276,0.720 0.026,0.282,0.719 0.026,0.287,0.718 0.027,0.292,0.717 0.027,0.298,0.716 0.027,0.303,0.714 0.028,0.308,0.713 0.028,0.314,0.711 0.028,0.319,0.709 0.028,0.324,0.707 0.028,0.330,0.704 0.028,0.335,0.701 0.028,0.341,0.698 0.028,0.346,0.695 0.027,0.352,0.692 0.026,0.357,0.688 0.025,0.363,0.684 0.024,0.368,0.680 0.023,0.374,0.675 0.022,0.379,0.670 0.024,0.385,0.665 0.027,0.390,0.659 0.032,0.396,0.654 0.039,0.401,0.648 0.047,0.406,0.642 0.055,0.411,0.635 0.063,0.417,0.629 0.071,0.422,0.622 0.079,0.427,0.615 0.086,0.432,0.608 0.094,0.437,0.601 0.101,0.442,0.594 0.107,0.447,0.586 0.114,0.452,0.578 0.120,0.457,0.570 0.126,0.462,0.562 0.132,0.466,0.554 0.137,0.471,0.546 0.143,0.476,0.538 0.147,0.481,0.529 0.152,0.486,0.520 0.156,0.491,0.511 0.160,0.495,0.503 0.164,0.500,0.493 0.168,0.505,0.484 0.171,0.510,0.475 0.174,0.515,0.465 0.177,0.519,0.456 0.179,0.524,0.446 0.181,0.529,0.436 0.183,0.534,0.426 0.185,0.538,0.415 0.186,0.543,0.405 0.188,0.548,0.394 0.188,0.553,0.384 0.189,0.558,0.373 0.190,0.562,0.363 0.192,0.567,0.352 0.193,0.571,0.343 0.195,0.576,0.333 0.197,0.580,0.324 0.200,0.585,0.315 0.203,0.589,0.306 0.206,0.593,0.297 0.209,0.597,0.289 0.213,0.601,0.281 0.217,0.606,0.273 0.221,0.610,0.265 0.226,0.614,0.257 0.231,0.618,0.250 0.236,0.622,0.242 0.241,0.625,0.235 0.247,0.629,0.228 0.252,0.633,0.221 0.259,0.637,0.214 0.265,0.641,0.207 0.271,0.644,0.200 0.278,0.648,0.194 0.285,0.652,0.187 0.292,0.655,0.180 0.299,0.659,0.174 0.306,0.662,0.168 0.314,0.666,0.161 0.321,0.669,0.155 0.329,0.673,0.149 0.337,0.676,0.143 0.345,0.679,0.136 0.353,0.683,0.130 0.361,0.686,0.124 0.369,0.689,0.118 0.378,0.693,0.112 0.386,0.696,0.106 0.395,0.699,0.100 0.403,0.702,0.095 0.412,0.705,0.089 0.421,0.708,0.083 0.430,0.711,0.077 0.439,0.714,0.071 0.448,0.717,0.065 0.457,0.720,0.059 0.466,0.723,0.053 0.476,0.726,0.048 0.485,0.729,0.042 0.494,0.732,0.036 0.504,0.735,0.031 0.513,0.737,0.027 0.523,0.740,0.023 0.532,0.743,0.019 0.542,0.746,0.017 0.552,0.748,0.014 0.562,0.751,0.012 0.571,0.753,0.011 0.581,0.756,0.010 0.591,0.758,0.010 0.601,0.761,0.009 0.611,0.763,0.009 0.620,0.766,0.010 0.630,0.768,0.010 0.639,0.771,0.010 0.649,0.773,0.011 0.658,0.776,0.012 0.667,0.779,0.014 0.676,0.781,0.015 0.685,0.784,0.017 0.694,0.786,0.019 0.703,0.789,0.021 0.712,0.791,0.024 0.721,0.794,0.026 0.729,0.796,0.030 0.738,0.799,0.033 0.746,0.801,0.037 0.755,0.804,0.041 0.763,0.807,0.046 0.771,0.809,0.050 0.780,0.812,0.055 0.788,0.814,0.060 0.796,0.817,0.064 0.804,0.820,0.069 0.812,0.822,0.074 0.819,0.825,0.079 0.827,0.828,0.084 0.835,0.831,0.090 0.842,0.833,0.095 0.849,0.836,0.100 0.857,0.839,0.106 0.864,0.842,0.112 0.871,0.845,0.118 0.878,0.848,0.124 0.884,0.851,0.130 0.891,0.854,0.136 0.897,0.857,0.142 0.904,0.860,0.149 0.910,0.863,0.156 0.916,0.866,0.163 0.922,0.869,0.170 0.927,0.873,0.177 0.932,0.876,0.185 0.937,0.880,0.193 0.942,0.883,0.201 0.946,0.887,0.210 0.950,0.891,0.219 0.954,0.895,0.228 0.957,0.899,0.238 0.960,0.903,0.248 0.962,0.907,0.260 0.965,0.911,0.273 0.968,0.915,0.288 0.970,0.919,0.304 0.973,0.923,0.322 0.976,0.927,0.341 0.979,0.931,0.362 0.982,0.934,0.385 0.985,0.938,0.408 0.987,0.941,0.434 0.990,0.945,0.461 0.993,0.948,0.490 0.995,0.951,0.521 0.997,0.954,0.554 0.999,0.957,0.589 1.000,0.960,0.626 1.000,0.963,0.666 1.000,0.966,0.709 0.999,0.968,0.755 0.997,0.971,0.804 0.993,0.973,0.858 0.986,0.975,0.915 0.977,0.977,0.977 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L17.csv000066400000000000000000000110001457240071200235760ustar00rootroot000000000000001.000,1.000,1.000 0.998,0.997,0.989 0.996,0.994,0.978 0.995,0.991,0.967 0.993,0.988,0.956 0.991,0.985,0.945 0.989,0.982,0.934 0.987,0.979,0.923 0.985,0.976,0.912 0.983,0.973,0.901 0.981,0.970,0.890 0.979,0.967,0.879 0.977,0.964,0.868 0.974,0.961,0.857 0.972,0.958,0.846 0.970,0.955,0.835 0.968,0.952,0.824 0.965,0.949,0.813 0.963,0.946,0.803 0.961,0.943,0.792 0.958,0.940,0.781 0.956,0.937,0.770 0.953,0.934,0.759 0.951,0.931,0.748 0.950,0.927,0.741 0.951,0.923,0.734 0.951,0.919,0.728 0.951,0.915,0.721 0.951,0.911,0.714 0.951,0.906,0.708 0.951,0.902,0.701 0.951,0.898,0.695 0.951,0.894,0.688 0.951,0.890,0.682 0.951,0.886,0.675 0.951,0.882,0.669 0.951,0.878,0.662 0.951,0.874,0.655 0.951,0.870,0.649 0.951,0.865,0.642 0.950,0.861,0.636 0.950,0.857,0.629 0.950,0.853,0.623 0.950,0.849,0.616 0.950,0.845,0.610 0.949,0.841,0.603 0.949,0.837,0.597 0.949,0.832,0.592 0.950,0.828,0.587 0.950,0.823,0.582 0.951,0.819,0.577 0.951,0.814,0.573 0.952,0.810,0.568 0.952,0.805,0.563 0.953,0.801,0.559 0.953,0.796,0.554 0.954,0.792,0.549 0.954,0.787,0.544 0.955,0.783,0.540 0.955,0.778,0.535 0.955,0.773,0.530 0.956,0.769,0.526 0.956,0.764,0.521 0.956,0.760,0.516 0.956,0.755,0.512 0.957,0.751,0.507 0.957,0.746,0.502 0.957,0.742,0.498 0.957,0.737,0.493 0.957,0.732,0.489 0.958,0.728,0.485 0.958,0.723,0.482 0.958,0.718,0.479 0.959,0.713,0.476 0.959,0.708,0.474 0.959,0.704,0.471 0.960,0.699,0.468 0.960,0.694,0.465 0.960,0.689,0.463 0.960,0.684,0.460 0.961,0.679,0.457 0.961,0.675,0.455 0.961,0.670,0.452 0.961,0.665,0.449 0.961,0.660,0.446 0.961,0.655,0.444 0.962,0.650,0.441 0.962,0.645,0.438 0.962,0.640,0.435 0.962,0.635,0.433 0.962,0.630,0.430 0.962,0.625,0.427 0.962,0.620,0.425 0.962,0.615,0.423 0.962,0.610,0.422 0.961,0.605,0.421 0.961,0.600,0.420 0.961,0.595,0.419 0.961,0.590,0.418 0.960,0.585,0.417 0.960,0.580,0.417 0.960,0.575,0.416 0.959,0.570,0.415 0.959,0.565,0.414 0.959,0.560,0.413 0.958,0.555,0.412 0.958,0.550,0.412 0.957,0.544,0.411 0.957,0.539,0.410 0.957,0.534,0.409 0.956,0.529,0.408 0.956,0.524,0.407 0.955,0.518,0.406 0.955,0.513,0.406 0.954,0.508,0.405 0.954,0.502,0.404 0.953,0.497,0.403 0.952,0.492,0.404 0.951,0.487,0.405 0.950,0.482,0.405 0.948,0.477,0.406 0.947,0.472,0.407 0.946,0.467,0.408 0.945,0.462,0.408 0.943,0.457,0.409 0.942,0.451,0.410 0.941,0.446,0.410 0.940,0.441,0.411 0.938,0.436,0.412 0.937,0.430,0.412 0.936,0.425,0.413 0.934,0.420,0.414 0.933,0.414,0.414 0.932,0.409,0.415 0.930,0.404,0.416 0.929,0.398,0.416 0.928,0.393,0.417 0.926,0.387,0.418 0.925,0.382,0.418 0.924,0.376,0.419 0.921,0.371,0.420 0.919,0.366,0.422 0.917,0.361,0.424 0.914,0.356,0.426 0.912,0.351,0.428 0.909,0.347,0.430 0.907,0.342,0.431 0.904,0.337,0.433 0.902,0.332,0.435 0.899,0.326,0.437 0.897,0.321,0.438 0.894,0.316,0.440 0.892,0.311,0.442 0.889,0.306,0.444 0.887,0.300,0.445 0.884,0.295,0.447 0.882,0.290,0.449 0.879,0.284,0.450 0.876,0.279,0.452 0.874,0.273,0.454 0.871,0.268,0.455 0.869,0.262,0.457 0.866,0.256,0.459 0.863,0.252,0.461 0.859,0.247,0.463 0.855,0.243,0.466 0.851,0.239,0.468 0.847,0.235,0.470 0.843,0.230,0.473 0.839,0.226,0.475 0.835,0.222,0.478 0.831,0.217,0.480 0.827,0.213,0.482 0.823,0.208,0.485 0.819,0.204,0.487 0.815,0.199,0.489 0.811,0.194,0.492 0.807,0.190,0.494 0.803,0.185,0.496 0.799,0.180,0.499 0.795,0.175,0.501 0.791,0.170,0.503 0.787,0.165,0.506 0.783,0.160,0.508 0.778,0.155,0.510 0.774,0.150,0.513 0.769,0.146,0.515 0.764,0.144,0.518 0.758,0.141,0.520 0.753,0.139,0.523 0.747,0.137,0.525 0.741,0.134,0.528 0.736,0.132,0.530 0.730,0.129,0.533 0.724,0.127,0.535 0.718,0.125,0.538 0.712,0.122,0.541 0.707,0.120,0.543 0.701,0.118,0.546 0.695,0.115,0.548 0.689,0.113,0.551 0.683,0.111,0.553 0.677,0.109,0.556 0.671,0.106,0.558 0.665,0.104,0.561 0.659,0.102,0.563 0.653,0.100,0.566 0.647,0.097,0.568 0.641,0.095,0.571 0.634,0.094,0.573 0.626,0.096,0.576 0.619,0.097,0.578 0.611,0.099,0.580 0.603,0.100,0.582 0.596,0.102,0.585 0.588,0.103,0.587 0.580,0.104,0.589 0.572,0.106,0.591 0.564,0.107,0.594 0.555,0.108,0.596 0.547,0.109,0.598 0.539,0.111,0.600 0.531,0.112,0.603 0.522,0.113,0.605 0.514,0.114,0.607 0.505,0.115,0.609 0.496,0.116,0.612 0.487,0.117,0.614 0.478,0.119,0.616 0.469,0.120,0.618 0.460,0.121,0.620 0.450,0.122,0.623 0.441,0.123,0.625 0.430,0.126,0.626 0.419,0.128,0.628 0.408,0.131,0.629 0.396,0.133,0.631 0.384,0.136,0.632 0.372,0.138,0.633 0.360,0.140,0.635 0.347,0.142,0.636 0.334,0.144,0.638 0.321,0.146,0.639 0.307,0.148,0.640 0.292,0.150,0.642 0.277,0.152,0.643 0.261,0.153,0.645 0.244,0.155,0.646 0.226,0.156,0.648 0.206,0.158,0.649 0.184,0.159,0.650 0.159,0.161,0.652 0.131,0.162,0.653 0.094,0.163,0.655 0.038,0.164,0.656 0.000,0.165,0.658 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L18.csv000066400000000000000000000110001457240071200235770ustar00rootroot000000000000001.000,1.000,1.000 0.998,0.998,0.990 0.995,0.997,0.980 0.993,0.995,0.969 0.991,0.993,0.959 0.989,0.991,0.949 0.986,0.990,0.939 0.984,0.988,0.929 0.981,0.986,0.919 0.979,0.984,0.909 0.976,0.983,0.898 0.974,0.981,0.888 0.971,0.979,0.878 0.969,0.977,0.868 0.966,0.976,0.858 0.964,0.974,0.848 0.961,0.972,0.838 0.958,0.971,0.828 0.956,0.969,0.818 0.953,0.967,0.807 0.950,0.965,0.797 0.947,0.964,0.787 0.944,0.962,0.777 0.941,0.960,0.767 0.940,0.958,0.760 0.939,0.955,0.754 0.938,0.953,0.748 0.937,0.950,0.742 0.936,0.947,0.736 0.935,0.945,0.730 0.934,0.942,0.724 0.933,0.940,0.718 0.932,0.937,0.712 0.931,0.934,0.706 0.930,0.932,0.700 0.929,0.929,0.694 0.928,0.927,0.688 0.927,0.924,0.682 0.926,0.922,0.676 0.925,0.919,0.670 0.924,0.916,0.664 0.923,0.914,0.658 0.922,0.911,0.652 0.920,0.909,0.646 0.919,0.906,0.640 0.918,0.904,0.634 0.917,0.901,0.628 0.916,0.898,0.623 0.916,0.895,0.617 0.915,0.893,0.612 0.915,0.890,0.607 0.915,0.887,0.602 0.914,0.884,0.597 0.914,0.881,0.592 0.913,0.879,0.586 0.913,0.876,0.581 0.912,0.873,0.576 0.911,0.870,0.571 0.911,0.867,0.566 0.910,0.864,0.560 0.910,0.862,0.555 0.909,0.859,0.550 0.909,0.856,0.545 0.908,0.853,0.540 0.907,0.850,0.535 0.907,0.848,0.529 0.906,0.845,0.524 0.906,0.842,0.519 0.905,0.839,0.514 0.904,0.836,0.509 0.904,0.833,0.504 0.904,0.830,0.499 0.903,0.827,0.495 0.903,0.824,0.490 0.903,0.821,0.485 0.903,0.818,0.481 0.903,0.815,0.476 0.902,0.812,0.472 0.902,0.809,0.467 0.902,0.806,0.463 0.902,0.803,0.458 0.901,0.800,0.453 0.901,0.797,0.449 0.901,0.794,0.444 0.900,0.791,0.440 0.900,0.788,0.435 0.900,0.785,0.431 0.899,0.782,0.426 0.899,0.779,0.421 0.899,0.776,0.417 0.898,0.773,0.412 0.898,0.771,0.408 0.897,0.768,0.403 0.897,0.764,0.399 0.897,0.761,0.395 0.897,0.758,0.391 0.897,0.755,0.387 0.897,0.752,0.383 0.897,0.749,0.379 0.897,0.746,0.375 0.896,0.742,0.371 0.896,0.739,0.367 0.896,0.736,0.363 0.896,0.733,0.359 0.896,0.730,0.355 0.896,0.727,0.351 0.895,0.724,0.347 0.895,0.720,0.343 0.895,0.717,0.339 0.895,0.714,0.335 0.895,0.711,0.331 0.894,0.708,0.327 0.894,0.705,0.323 0.894,0.702,0.318 0.894,0.698,0.314 0.893,0.695,0.310 0.893,0.692,0.306 0.893,0.689,0.303 0.893,0.686,0.300 0.893,0.682,0.296 0.893,0.679,0.293 0.893,0.676,0.289 0.893,0.672,0.286 0.893,0.669,0.283 0.892,0.666,0.279 0.892,0.663,0.276 0.892,0.659,0.272 0.892,0.656,0.269 0.892,0.653,0.266 0.892,0.649,0.262 0.892,0.646,0.259 0.891,0.643,0.255 0.891,0.639,0.252 0.891,0.636,0.248 0.891,0.633,0.245 0.891,0.629,0.241 0.890,0.626,0.238 0.890,0.623,0.235 0.890,0.620,0.231 0.890,0.616,0.228 0.890,0.613,0.225 0.890,0.609,0.222 0.889,0.606,0.219 0.889,0.602,0.217 0.889,0.599,0.214 0.889,0.596,0.211 0.889,0.592,0.208 0.889,0.589,0.206 0.889,0.585,0.203 0.888,0.582,0.200 0.888,0.578,0.197 0.888,0.575,0.195 0.888,0.571,0.192 0.888,0.568,0.189 0.887,0.564,0.186 0.887,0.561,0.183 0.887,0.557,0.181 0.887,0.554,0.178 0.886,0.550,0.175 0.886,0.547,0.172 0.886,0.543,0.169 0.886,0.540,0.166 0.885,0.536,0.164 0.885,0.533,0.161 0.885,0.529,0.159 0.885,0.525,0.158 0.885,0.522,0.156 0.884,0.518,0.154 0.884,0.515,0.152 0.884,0.511,0.150 0.884,0.507,0.148 0.883,0.504,0.146 0.883,0.500,0.144 0.883,0.496,0.142 0.882,0.493,0.140 0.882,0.489,0.138 0.882,0.485,0.136 0.882,0.481,0.134 0.881,0.478,0.132 0.881,0.474,0.130 0.881,0.470,0.128 0.880,0.466,0.126 0.880,0.463,0.124 0.880,0.459,0.122 0.879,0.455,0.120 0.879,0.451,0.119 0.878,0.447,0.117 0.878,0.443,0.116 0.878,0.440,0.115 0.877,0.436,0.114 0.877,0.432,0.113 0.877,0.428,0.112 0.876,0.424,0.111 0.876,0.420,0.110 0.875,0.416,0.110 0.875,0.412,0.109 0.874,0.408,0.108 0.874,0.404,0.107 0.874,0.400,0.106 0.873,0.396,0.105 0.873,0.392,0.104 0.872,0.387,0.103 0.872,0.383,0.102 0.871,0.379,0.101 0.871,0.375,0.100 0.870,0.371,0.100 0.870,0.367,0.099 0.869,0.362,0.098 0.869,0.358,0.097 0.868,0.354,0.096 0.868,0.349,0.097 0.867,0.345,0.097 0.867,0.341,0.097 0.866,0.336,0.097 0.865,0.332,0.097 0.865,0.327,0.097 0.864,0.323,0.097 0.864,0.318,0.097 0.863,0.313,0.097 0.862,0.309,0.098 0.862,0.304,0.098 0.861,0.299,0.098 0.861,0.295,0.098 0.860,0.290,0.098 0.859,0.285,0.098 0.859,0.280,0.098 0.858,0.275,0.098 0.857,0.270,0.098 0.857,0.265,0.098 0.856,0.259,0.098 0.855,0.254,0.098 0.855,0.249,0.098 0.854,0.243,0.099 0.853,0.238,0.099 0.852,0.232,0.100 0.852,0.226,0.101 0.851,0.221,0.102 0.850,0.215,0.103 0.849,0.209,0.104 0.848,0.203,0.104 0.847,0.196,0.105 0.846,0.190,0.106 0.846,0.183,0.106 0.845,0.177,0.107 0.844,0.169,0.108 0.843,0.162,0.108 0.842,0.155,0.109 0.841,0.147,0.110 0.840,0.138,0.110 0.840,0.130,0.111 0.839,0.120,0.112 0.838,0.110,0.112 0.837,0.099,0.113 0.836,0.088,0.113 0.835,0.074,0.114 0.834,0.059,0.114 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L19.csv000066400000000000000000000110001457240071200236000ustar00rootroot000000000000001.000,1.000,1.000 0.995,0.998,1.000 0.990,0.996,0.999 0.985,0.994,0.999 0.980,0.992,0.998 0.975,0.990,0.998 0.970,0.989,0.998 0.965,0.987,0.997 0.960,0.985,0.997 0.955,0.983,0.996 0.950,0.981,0.996 0.945,0.979,0.996 0.940,0.977,0.995 0.935,0.975,0.995 0.930,0.973,0.994 0.925,0.971,0.994 0.920,0.969,0.994 0.915,0.967,0.993 0.910,0.965,0.993 0.905,0.963,0.992 0.900,0.962,0.992 0.895,0.960,0.992 0.890,0.958,0.991 0.885,0.956,0.991 0.881,0.954,0.991 0.877,0.951,0.991 0.873,0.949,0.991 0.869,0.947,0.991 0.865,0.944,0.992 0.861,0.942,0.992 0.857,0.940,0.992 0.853,0.938,0.992 0.849,0.935,0.993 0.845,0.933,0.993 0.840,0.931,0.993 0.836,0.928,0.993 0.832,0.926,0.993 0.828,0.924,0.994 0.824,0.922,0.994 0.820,0.919,0.994 0.816,0.917,0.994 0.812,0.915,0.994 0.808,0.913,0.994 0.804,0.910,0.995 0.799,0.908,0.995 0.795,0.906,0.995 0.791,0.904,0.995 0.788,0.901,0.995 0.786,0.898,0.996 0.783,0.896,0.996 0.781,0.893,0.996 0.778,0.890,0.996 0.776,0.888,0.997 0.773,0.885,0.997 0.771,0.882,0.997 0.768,0.880,0.997 0.766,0.877,0.998 0.763,0.874,0.998 0.761,0.871,0.998 0.758,0.869,0.998 0.756,0.866,0.998 0.753,0.863,0.999 0.751,0.861,0.999 0.748,0.858,0.999 0.746,0.855,0.999 0.743,0.853,1.000 0.740,0.850,1.000 0.738,0.847,1.000 0.735,0.845,1.000 0.733,0.842,1.000 0.731,0.839,1.000 0.731,0.836,1.000 0.730,0.833,1.000 0.730,0.830,0.999 0.729,0.827,0.999 0.729,0.824,0.999 0.728,0.821,0.998 0.728,0.817,0.998 0.727,0.814,0.998 0.727,0.811,0.997 0.726,0.808,0.997 0.726,0.805,0.996 0.725,0.802,0.996 0.725,0.799,0.996 0.724,0.796,0.995 0.724,0.793,0.995 0.723,0.789,0.995 0.723,0.786,0.994 0.722,0.783,0.994 0.722,0.780,0.994 0.721,0.777,0.993 0.721,0.774,0.993 0.720,0.771,0.992 0.720,0.767,0.992 0.722,0.764,0.990 0.723,0.760,0.989 0.725,0.757,0.987 0.726,0.753,0.986 0.728,0.750,0.985 0.729,0.746,0.983 0.731,0.743,0.982 0.732,0.739,0.980 0.734,0.735,0.979 0.735,0.732,0.977 0.736,0.728,0.976 0.738,0.725,0.974 0.739,0.721,0.973 0.740,0.718,0.971 0.742,0.714,0.970 0.743,0.710,0.968 0.744,0.707,0.967 0.746,0.703,0.966 0.747,0.699,0.964 0.748,0.696,0.963 0.749,0.692,0.961 0.750,0.689,0.960 0.752,0.685,0.958 0.755,0.681,0.955 0.758,0.677,0.952 0.760,0.673,0.949 0.763,0.669,0.946 0.766,0.665,0.943 0.768,0.661,0.940 0.771,0.657,0.937 0.774,0.653,0.934 0.776,0.649,0.931 0.779,0.645,0.928 0.781,0.641,0.926 0.784,0.637,0.923 0.786,0.633,0.920 0.789,0.629,0.917 0.791,0.624,0.914 0.794,0.620,0.911 0.796,0.616,0.908 0.798,0.612,0.905 0.801,0.608,0.902 0.803,0.604,0.899 0.805,0.600,0.896 0.807,0.595,0.893 0.809,0.591,0.890 0.812,0.587,0.886 0.816,0.582,0.881 0.819,0.578,0.876 0.822,0.574,0.872 0.824,0.569,0.867 0.827,0.565,0.863 0.830,0.560,0.858 0.833,0.556,0.853 0.836,0.551,0.849 0.838,0.547,0.844 0.841,0.542,0.839 0.844,0.538,0.835 0.846,0.533,0.830 0.849,0.529,0.826 0.851,0.524,0.821 0.854,0.520,0.817 0.856,0.515,0.812 0.859,0.510,0.807 0.861,0.505,0.803 0.864,0.501,0.798 0.866,0.496,0.794 0.868,0.491,0.789 0.870,0.486,0.785 0.873,0.482,0.779 0.875,0.477,0.773 0.877,0.473,0.766 0.879,0.468,0.760 0.882,0.463,0.754 0.884,0.458,0.748 0.886,0.454,0.741 0.888,0.449,0.735 0.890,0.444,0.729 0.892,0.439,0.723 0.894,0.434,0.717 0.896,0.429,0.711 0.898,0.425,0.704 0.899,0.420,0.698 0.901,0.415,0.692 0.903,0.410,0.686 0.905,0.404,0.680 0.906,0.399,0.674 0.908,0.394,0.668 0.910,0.389,0.662 0.911,0.384,0.655 0.913,0.378,0.649 0.914,0.373,0.643 0.915,0.368,0.636 0.916,0.364,0.629 0.917,0.359,0.621 0.918,0.354,0.614 0.918,0.350,0.606 0.919,0.345,0.599 0.920,0.340,0.592 0.920,0.335,0.584 0.921,0.330,0.577 0.921,0.326,0.569 0.922,0.321,0.562 0.922,0.316,0.555 0.923,0.311,0.547 0.923,0.306,0.540 0.924,0.300,0.532 0.924,0.295,0.525 0.924,0.290,0.518 0.925,0.285,0.510 0.925,0.279,0.503 0.925,0.274,0.496 0.925,0.268,0.489 0.925,0.263,0.481 0.925,0.257,0.474 0.925,0.252,0.467 0.924,0.248,0.458 0.923,0.244,0.450 0.922,0.240,0.442 0.921,0.237,0.434 0.919,0.233,0.425 0.918,0.229,0.417 0.917,0.224,0.409 0.916,0.220,0.401 0.914,0.216,0.393 0.913,0.212,0.385 0.912,0.208,0.376 0.910,0.204,0.368 0.909,0.200,0.360 0.908,0.195,0.352 0.906,0.191,0.344 0.905,0.186,0.336 0.903,0.182,0.328 0.901,0.177,0.320 0.900,0.173,0.312 0.898,0.168,0.304 0.897,0.163,0.295 0.895,0.159,0.287 0.893,0.154,0.279 0.890,0.153,0.271 0.887,0.152,0.262 0.884,0.151,0.253 0.880,0.149,0.245 0.877,0.148,0.236 0.874,0.147,0.227 0.871,0.146,0.218 0.867,0.145,0.210 0.864,0.144,0.201 0.861,0.143,0.192 0.857,0.141,0.183 0.854,0.140,0.174 0.851,0.139,0.164 0.847,0.138,0.155 0.844,0.137,0.145 0.840,0.136,0.136 0.837,0.135,0.126 0.833,0.134,0.115 0.830,0.133,0.105 0.826,0.132,0.094 0.823,0.131,0.082 0.819,0.130,0.069 0.816,0.130,0.056 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L2.csv000066400000000000000000000110001457240071200235100ustar00rootroot000000000000000.108,0.108,0.108 0.110,0.110,0.110 0.113,0.113,0.113 0.116,0.116,0.116 0.118,0.118,0.118 0.121,0.121,0.121 0.123,0.123,0.123 0.126,0.126,0.126 0.129,0.129,0.129 0.131,0.132,0.132 0.134,0.134,0.134 0.137,0.137,0.137 0.140,0.140,0.140 0.142,0.142,0.142 0.145,0.145,0.145 0.148,0.148,0.148 0.150,0.150,0.150 0.153,0.153,0.153 0.156,0.156,0.156 0.159,0.159,0.159 0.161,0.161,0.161 0.164,0.164,0.164 0.167,0.167,0.167 0.170,0.170,0.170 0.172,0.173,0.173 0.175,0.175,0.175 0.178,0.178,0.178 0.181,0.181,0.181 0.184,0.184,0.184 0.187,0.187,0.187 0.189,0.189,0.189 0.192,0.192,0.192 0.195,0.195,0.195 0.198,0.198,0.198 0.201,0.201,0.201 0.204,0.204,0.204 0.206,0.207,0.206 0.209,0.209,0.209 0.212,0.212,0.212 0.215,0.215,0.215 0.218,0.218,0.218 0.221,0.221,0.221 0.224,0.224,0.224 0.227,0.227,0.227 0.230,0.230,0.230 0.232,0.233,0.233 0.235,0.235,0.235 0.238,0.238,0.238 0.241,0.241,0.241 0.244,0.244,0.244 0.247,0.247,0.247 0.250,0.250,0.250 0.253,0.253,0.253 0.256,0.256,0.256 0.259,0.259,0.259 0.262,0.262,0.262 0.265,0.265,0.265 0.268,0.268,0.268 0.271,0.271,0.271 0.274,0.274,0.274 0.277,0.277,0.277 0.280,0.280,0.280 0.283,0.283,0.283 0.286,0.286,0.286 0.289,0.289,0.289 0.292,0.292,0.292 0.295,0.295,0.295 0.298,0.298,0.298 0.301,0.301,0.301 0.304,0.304,0.304 0.307,0.307,0.307 0.310,0.310,0.310 0.313,0.313,0.313 0.316,0.317,0.317 0.320,0.320,0.320 0.323,0.323,0.323 0.326,0.326,0.326 0.329,0.329,0.329 0.332,0.332,0.332 0.335,0.335,0.335 0.338,0.338,0.338 0.341,0.341,0.341 0.344,0.344,0.344 0.347,0.348,0.348 0.351,0.351,0.351 0.354,0.354,0.354 0.357,0.357,0.357 0.360,0.360,0.360 0.363,0.363,0.363 0.366,0.366,0.366 0.369,0.370,0.370 0.373,0.373,0.373 0.376,0.376,0.376 0.379,0.379,0.379 0.382,0.382,0.382 0.385,0.385,0.385 0.389,0.389,0.389 0.392,0.392,0.392 0.395,0.395,0.395 0.398,0.398,0.398 0.401,0.401,0.401 0.404,0.405,0.405 0.408,0.408,0.408 0.411,0.411,0.411 0.414,0.414,0.414 0.417,0.417,0.417 0.421,0.421,0.421 0.424,0.424,0.424 0.427,0.427,0.427 0.430,0.430,0.430 0.434,0.434,0.434 0.437,0.437,0.437 0.440,0.440,0.440 0.443,0.443,0.443 0.447,0.447,0.447 0.450,0.450,0.450 0.453,0.453,0.453 0.456,0.456,0.456 0.460,0.460,0.460 0.463,0.463,0.463 0.466,0.466,0.466 0.470,0.470,0.470 0.473,0.473,0.473 0.476,0.476,0.476 0.479,0.480,0.480 0.483,0.483,0.483 0.486,0.486,0.486 0.489,0.489,0.489 0.493,0.493,0.493 0.496,0.496,0.496 0.499,0.499,0.499 0.503,0.503,0.503 0.506,0.506,0.506 0.509,0.509,0.509 0.513,0.513,0.513 0.516,0.516,0.516 0.519,0.520,0.520 0.523,0.523,0.523 0.526,0.526,0.526 0.530,0.530,0.530 0.533,0.533,0.533 0.536,0.536,0.536 0.540,0.540,0.540 0.543,0.543,0.543 0.546,0.547,0.546 0.550,0.550,0.550 0.553,0.553,0.553 0.557,0.557,0.557 0.560,0.560,0.560 0.563,0.563,0.563 0.567,0.567,0.567 0.570,0.570,0.570 0.574,0.574,0.574 0.577,0.577,0.577 0.580,0.581,0.581 0.584,0.584,0.584 0.587,0.587,0.587 0.591,0.591,0.591 0.594,0.594,0.594 0.598,0.598,0.598 0.601,0.601,0.601 0.605,0.605,0.605 0.608,0.608,0.608 0.611,0.612,0.612 0.615,0.615,0.615 0.618,0.618,0.618 0.622,0.622,0.622 0.625,0.625,0.625 0.629,0.629,0.629 0.632,0.632,0.632 0.636,0.636,0.636 0.639,0.639,0.639 0.643,0.643,0.643 0.646,0.646,0.646 0.650,0.650,0.650 0.653,0.653,0.653 0.657,0.657,0.657 0.660,0.660,0.660 0.664,0.664,0.664 0.667,0.667,0.667 0.671,0.671,0.671 0.674,0.674,0.674 0.678,0.678,0.678 0.681,0.681,0.681 0.685,0.685,0.685 0.688,0.688,0.688 0.692,0.692,0.692 0.695,0.696,0.695 0.699,0.699,0.699 0.702,0.703,0.703 0.706,0.706,0.706 0.710,0.710,0.710 0.713,0.713,0.713 0.717,0.717,0.717 0.720,0.720,0.720 0.724,0.724,0.724 0.727,0.728,0.727 0.731,0.731,0.731 0.735,0.735,0.735 0.738,0.738,0.738 0.742,0.742,0.742 0.745,0.745,0.745 0.749,0.749,0.749 0.752,0.753,0.753 0.756,0.756,0.756 0.760,0.760,0.760 0.763,0.763,0.763 0.767,0.767,0.767 0.770,0.771,0.771 0.774,0.774,0.774 0.778,0.778,0.778 0.781,0.781,0.781 0.785,0.785,0.785 0.789,0.789,0.789 0.792,0.792,0.792 0.796,0.796,0.796 0.799,0.800,0.800 0.803,0.803,0.803 0.807,0.807,0.807 0.810,0.810,0.810 0.814,0.814,0.814 0.818,0.818,0.818 0.821,0.821,0.821 0.825,0.825,0.825 0.829,0.829,0.829 0.832,0.832,0.832 0.836,0.836,0.836 0.840,0.840,0.840 0.843,0.843,0.843 0.847,0.847,0.847 0.851,0.851,0.851 0.854,0.854,0.854 0.858,0.858,0.858 0.862,0.862,0.862 0.865,0.865,0.865 0.869,0.869,0.869 0.873,0.873,0.873 0.876,0.877,0.876 0.880,0.880,0.880 0.884,0.884,0.884 0.887,0.888,0.888 0.891,0.891,0.891 0.895,0.895,0.895 0.899,0.899,0.899 0.902,0.902,0.902 0.906,0.906,0.906 0.910,0.910,0.910 0.913,0.914,0.914 0.917,0.917,0.917 0.921,0.921,0.921 0.925,0.925,0.925 0.928,0.929,0.929 0.932,0.932,0.932 0.936,0.936,0.936 0.940,0.940,0.940 0.943,0.944,0.943 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L3.csv000066400000000000000000000110001457240071200235110ustar00rootroot000000000000000.000,0.000,0.000 0.027,0.000,0.000 0.052,0.000,0.000 0.072,0.000,0.000 0.087,0.000,0.000 0.101,0.000,0.000 0.113,0.000,0.000 0.124,0.000,0.000 0.135,0.001,0.000 0.144,0.001,0.000 0.153,0.001,0.000 0.161,0.001,0.000 0.169,0.001,0.000 0.177,0.001,0.000 0.184,0.002,0.000 0.191,0.002,0.000 0.198,0.002,0.000 0.204,0.002,0.000 0.210,0.002,0.000 0.216,0.002,0.000 0.222,0.002,0.000 0.228,0.002,0.000 0.234,0.002,0.000 0.240,0.002,0.000 0.245,0.002,0.000 0.251,0.002,0.000 0.257,0.002,0.000 0.263,0.002,0.000 0.269,0.002,0.000 0.275,0.002,0.000 0.280,0.002,0.000 0.286,0.003,0.000 0.292,0.003,0.000 0.298,0.003,0.000 0.304,0.003,0.000 0.310,0.003,0.000 0.316,0.003,0.000 0.322,0.003,0.000 0.328,0.003,0.000 0.334,0.004,0.000 0.341,0.004,0.000 0.347,0.004,0.000 0.353,0.004,0.000 0.359,0.004,0.000 0.365,0.004,0.000 0.371,0.005,0.000 0.378,0.005,0.000 0.384,0.005,0.000 0.390,0.005,0.000 0.396,0.005,0.000 0.403,0.005,0.000 0.409,0.006,0.000 0.415,0.006,0.000 0.422,0.006,0.000 0.428,0.006,0.000 0.434,0.007,0.000 0.441,0.007,0.000 0.447,0.007,0.000 0.453,0.007,0.000 0.460,0.007,0.000 0.466,0.008,0.000 0.473,0.008,0.000 0.479,0.008,0.000 0.486,0.009,0.000 0.492,0.009,0.000 0.499,0.009,0.000 0.505,0.009,0.000 0.512,0.010,0.000 0.518,0.010,0.000 0.525,0.010,0.000 0.532,0.011,0.000 0.538,0.011,0.000 0.545,0.011,0.000 0.552,0.012,0.000 0.558,0.012,0.000 0.565,0.013,0.000 0.572,0.013,0.000 0.578,0.013,0.000 0.585,0.014,0.000 0.592,0.014,0.000 0.598,0.015,0.000 0.605,0.015,0.000 0.612,0.015,0.000 0.619,0.016,0.000 0.625,0.016,0.000 0.632,0.017,0.000 0.639,0.017,0.000 0.646,0.018,0.000 0.653,0.018,0.000 0.660,0.019,0.000 0.666,0.020,0.000 0.673,0.020,0.000 0.680,0.021,0.000 0.687,0.021,0.000 0.694,0.022,0.000 0.701,0.023,0.000 0.708,0.023,0.000 0.715,0.024,0.000 0.722,0.025,0.000 0.729,0.026,0.000 0.736,0.026,0.000 0.743,0.027,0.000 0.750,0.028,0.000 0.757,0.029,0.000 0.764,0.030,0.000 0.771,0.031,0.000 0.778,0.032,0.000 0.785,0.033,0.000 0.792,0.034,0.000 0.799,0.035,0.000 0.806,0.036,0.000 0.813,0.037,0.000 0.820,0.038,0.000 0.827,0.040,0.000 0.834,0.041,0.000 0.841,0.043,0.000 0.848,0.044,0.000 0.855,0.046,0.000 0.863,0.048,0.000 0.870,0.050,0.000 0.877,0.052,0.000 0.884,0.054,0.000 0.891,0.056,0.000 0.898,0.059,0.000 0.905,0.062,0.000 0.911,0.065,0.000 0.918,0.069,0.000 0.924,0.075,0.000 0.931,0.081,0.000 0.936,0.089,0.000 0.942,0.097,0.000 0.947,0.107,0.000 0.952,0.117,0.000 0.957,0.127,0.000 0.961,0.138,0.000 0.965,0.150,0.000 0.968,0.161,0.000 0.971,0.173,0.000 0.974,0.185,0.000 0.977,0.197,0.000 0.979,0.208,0.000 0.981,0.220,0.000 0.983,0.232,0.000 0.985,0.243,0.000 0.987,0.254,0.000 0.988,0.265,0.000 0.989,0.276,0.000 0.991,0.287,0.000 0.992,0.297,0.000 0.993,0.308,0.000 0.993,0.318,0.000 0.994,0.328,0.000 0.995,0.338,0.000 0.996,0.347,0.000 0.996,0.357,0.000 0.997,0.366,0.000 0.997,0.376,0.000 0.998,0.385,0.000 0.998,0.394,0.000 0.998,0.403,0.000 0.999,0.411,0.000 0.999,0.420,0.000 0.999,0.429,0.000 0.999,0.437,0.000 1.000,0.446,0.000 1.000,0.454,0.000 1.000,0.462,0.000 1.000,0.470,0.000 1.000,0.478,0.000 1.000,0.486,0.000 1.000,0.494,0.000 1.000,0.502,0.000 1.000,0.510,0.000 1.000,0.518,0.000 1.000,0.525,0.000 1.000,0.533,0.000 1.000,0.540,0.000 1.000,0.548,0.000 1.000,0.555,0.000 1.000,0.562,0.001 1.000,0.570,0.001 1.000,0.577,0.001 1.000,0.584,0.001 1.000,0.591,0.001 1.000,0.598,0.002 1.000,0.605,0.002 1.000,0.612,0.002 1.000,0.619,0.003 1.000,0.626,0.003 1.000,0.633,0.003 1.000,0.640,0.004 1.000,0.647,0.004 1.000,0.653,0.004 1.000,0.660,0.005 1.000,0.667,0.005 1.000,0.673,0.006 1.000,0.680,0.006 1.000,0.687,0.007 1.000,0.693,0.007 1.000,0.700,0.008 1.000,0.706,0.009 1.000,0.713,0.009 1.000,0.719,0.010 1.000,0.726,0.011 1.000,0.732,0.012 1.000,0.739,0.012 1.000,0.745,0.013 1.000,0.751,0.014 1.000,0.758,0.015 1.000,0.764,0.016 1.000,0.770,0.017 1.000,0.777,0.018 1.000,0.783,0.019 1.000,0.789,0.020 1.000,0.796,0.021 1.000,0.802,0.023 1.000,0.808,0.024 1.000,0.814,0.025 1.000,0.820,0.027 1.000,0.827,0.028 1.000,0.833,0.030 1.000,0.839,0.032 1.000,0.845,0.033 1.000,0.851,0.035 1.000,0.857,0.037 1.000,0.863,0.040 1.000,0.869,0.042 1.000,0.876,0.044 1.000,0.882,0.047 1.000,0.888,0.050 1.000,0.894,0.053 1.000,0.900,0.056 1.000,0.906,0.060 1.000,0.912,0.064 1.000,0.918,0.069 1.000,0.924,0.074 1.000,0.930,0.081 1.000,0.936,0.091 1.000,0.942,0.104 1.000,0.948,0.121 1.000,0.953,0.141 1.000,0.959,0.167 1.000,0.965,0.198 1.000,0.970,0.235 1.000,0.975,0.279 1.000,0.980,0.329 1.000,0.984,0.386 1.000,0.988,0.449 1.000,0.991,0.517 1.000,0.994,0.588 1.000,0.996,0.660 1.000,0.998,0.732 1.000,0.999,0.803 1.000,1.000,0.871 1.000,1.000,0.937 1.000,1.000,1.000 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L4.csv000066400000000000000000000110001457240071200235120ustar00rootroot000000000000000.000,0.000,0.000 0.026,0.000,0.000 0.051,0.000,0.000 0.070,0.000,0.000 0.085,0.000,0.000 0.099,0.000,0.000 0.111,0.000,0.000 0.122,0.000,0.000 0.132,0.000,0.000 0.142,0.001,0.000 0.150,0.001,0.000 0.159,0.001,0.000 0.166,0.001,0.000 0.174,0.001,0.000 0.181,0.001,0.000 0.188,0.001,0.000 0.195,0.001,0.000 0.201,0.001,0.000 0.207,0.001,0.000 0.213,0.001,0.000 0.219,0.002,0.000 0.224,0.002,0.000 0.230,0.002,0.000 0.236,0.002,0.000 0.241,0.002,0.000 0.247,0.002,0.000 0.253,0.002,0.000 0.258,0.002,0.000 0.264,0.002,0.000 0.270,0.002,0.000 0.275,0.002,0.000 0.281,0.002,0.000 0.287,0.003,0.000 0.293,0.003,0.000 0.298,0.003,0.000 0.304,0.003,0.000 0.310,0.003,0.000 0.316,0.003,0.000 0.322,0.003,0.000 0.328,0.003,0.000 0.334,0.004,0.000 0.339,0.004,0.000 0.345,0.004,0.000 0.351,0.004,0.000 0.357,0.004,0.000 0.363,0.004,0.000 0.369,0.004,0.000 0.375,0.005,0.000 0.381,0.005,0.000 0.387,0.005,0.000 0.394,0.005,0.000 0.400,0.005,0.000 0.406,0.006,0.000 0.412,0.006,0.000 0.418,0.006,0.000 0.424,0.006,0.000 0.430,0.006,0.000 0.437,0.007,0.000 0.443,0.007,0.000 0.449,0.007,0.000 0.455,0.007,0.000 0.461,0.008,0.000 0.468,0.008,0.000 0.474,0.008,0.000 0.480,0.008,0.000 0.487,0.009,0.000 0.493,0.009,0.000 0.499,0.009,0.000 0.506,0.009,0.000 0.512,0.010,0.000 0.518,0.010,0.000 0.525,0.010,0.000 0.531,0.011,0.000 0.538,0.011,0.000 0.544,0.011,0.000 0.551,0.012,0.000 0.557,0.012,0.000 0.563,0.012,0.000 0.570,0.013,0.000 0.576,0.013,0.000 0.583,0.014,0.000 0.589,0.014,0.000 0.596,0.014,0.000 0.603,0.015,0.000 0.609,0.015,0.000 0.616,0.016,0.000 0.622,0.016,0.000 0.629,0.017,0.000 0.635,0.017,0.000 0.642,0.018,0.000 0.649,0.018,0.000 0.655,0.019,0.000 0.662,0.019,0.000 0.669,0.020,0.000 0.675,0.020,0.000 0.682,0.021,0.000 0.689,0.022,0.000 0.695,0.022,0.000 0.702,0.023,0.000 0.709,0.024,0.000 0.716,0.024,0.000 0.722,0.025,0.000 0.729,0.026,0.000 0.736,0.026,0.000 0.743,0.027,0.000 0.750,0.028,0.000 0.756,0.029,0.000 0.763,0.030,0.000 0.770,0.031,0.000 0.777,0.032,0.000 0.784,0.033,0.000 0.790,0.034,0.000 0.797,0.035,0.000 0.804,0.036,0.000 0.811,0.037,0.000 0.818,0.038,0.000 0.825,0.039,0.000 0.832,0.041,0.000 0.839,0.042,0.000 0.845,0.044,0.000 0.852,0.045,0.000 0.859,0.047,0.000 0.866,0.049,0.000 0.873,0.050,0.000 0.880,0.052,0.000 0.887,0.055,0.000 0.893,0.057,0.000 0.900,0.060,0.000 0.907,0.063,0.000 0.913,0.066,0.000 0.920,0.071,0.000 0.926,0.076,0.000 0.932,0.084,0.000 0.937,0.093,0.000 0.942,0.104,0.000 0.946,0.115,0.000 0.950,0.128,0.000 0.953,0.140,0.000 0.956,0.153,0.000 0.959,0.166,0.000 0.961,0.179,0.000 0.963,0.191,0.000 0.965,0.203,0.000 0.967,0.215,0.000 0.969,0.227,0.000 0.970,0.238,0.000 0.972,0.249,0.000 0.973,0.260,0.000 0.974,0.270,0.000 0.975,0.281,0.000 0.976,0.291,0.000 0.977,0.301,0.000 0.978,0.311,0.000 0.979,0.320,0.000 0.980,0.330,0.000 0.981,0.339,0.000 0.982,0.348,0.000 0.982,0.357,0.000 0.983,0.366,0.000 0.984,0.375,0.000 0.984,0.383,0.000 0.985,0.392,0.000 0.985,0.400,0.000 0.986,0.408,0.000 0.986,0.416,0.000 0.987,0.425,0.000 0.987,0.433,0.000 0.988,0.440,0.000 0.988,0.448,0.000 0.989,0.456,0.000 0.989,0.464,0.000 0.989,0.471,0.000 0.990,0.479,0.000 0.990,0.486,0.000 0.991,0.494,0.000 0.991,0.501,0.000 0.991,0.508,0.000 0.991,0.515,0.000 0.992,0.523,0.000 0.992,0.530,0.000 0.992,0.537,0.000 0.993,0.544,0.000 0.993,0.551,0.000 0.993,0.558,0.000 0.993,0.565,0.000 0.994,0.571,0.000 0.994,0.578,0.000 0.994,0.585,0.000 0.994,0.592,0.000 0.995,0.598,0.000 0.995,0.605,0.000 0.995,0.612,0.000 0.995,0.618,0.000 0.995,0.625,0.000 0.996,0.632,0.000 0.996,0.638,0.000 0.996,0.645,0.000 0.996,0.651,0.000 0.996,0.657,0.000 0.996,0.664,0.000 0.997,0.670,0.000 0.997,0.677,0.000 0.997,0.683,0.000 0.997,0.689,0.000 0.997,0.696,0.000 0.997,0.702,0.000 0.997,0.708,0.000 0.997,0.714,0.000 0.998,0.721,0.000 0.998,0.727,0.000 0.998,0.733,0.000 0.998,0.739,0.000 0.998,0.745,0.000 0.998,0.752,0.000 0.998,0.758,0.000 0.998,0.764,0.000 0.998,0.770,0.000 0.999,0.776,0.000 0.999,0.782,0.000 0.999,0.788,0.000 0.999,0.794,0.000 0.999,0.800,0.000 0.999,0.806,0.000 0.999,0.812,0.000 0.999,0.818,0.000 0.999,0.824,0.000 0.999,0.830,0.000 0.999,0.836,0.000 0.999,0.842,0.000 0.999,0.848,0.000 0.999,0.854,0.000 0.999,0.860,0.000 1.000,0.866,0.000 1.000,0.872,0.000 1.000,0.878,0.000 1.000,0.884,0.000 1.000,0.890,0.000 1.000,0.895,0.000 1.000,0.901,0.000 1.000,0.907,0.000 1.000,0.913,0.000 1.000,0.919,0.000 1.000,0.925,0.000 1.000,0.930,0.000 1.000,0.936,0.000 1.000,0.942,0.000 1.000,0.948,0.000 1.000,0.954,0.000 1.000,0.960,0.000 1.000,0.965,0.000 1.000,0.971,0.000 1.000,0.977,0.000 1.000,0.983,0.000 1.000,0.988,0.000 1.000,0.994,0.000 1.000,1.000,0.000 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L5.csv000066400000000000000000000110001457240071200235130ustar00rootroot000000000000000.002,0.083,0.022 0.004,0.086,0.022 0.007,0.090,0.022 0.009,0.093,0.022 0.012,0.096,0.022 0.014,0.100,0.022 0.017,0.103,0.022 0.019,0.106,0.022 0.022,0.109,0.022 0.024,0.112,0.022 0.026,0.115,0.022 0.028,0.118,0.022 0.030,0.121,0.022 0.032,0.124,0.022 0.033,0.127,0.022 0.034,0.130,0.022 0.036,0.133,0.022 0.036,0.136,0.022 0.037,0.140,0.021 0.037,0.143,0.021 0.037,0.146,0.021 0.037,0.150,0.021 0.037,0.153,0.021 0.036,0.156,0.021 0.036,0.160,0.021 0.036,0.163,0.020 0.035,0.167,0.020 0.035,0.170,0.020 0.035,0.173,0.020 0.034,0.177,0.020 0.034,0.180,0.020 0.034,0.184,0.019 0.033,0.187,0.019 0.033,0.191,0.019 0.033,0.194,0.019 0.033,0.197,0.019 0.033,0.201,0.019 0.033,0.204,0.019 0.033,0.208,0.019 0.034,0.211,0.018 0.034,0.215,0.018 0.035,0.218,0.018 0.036,0.222,0.019 0.037,0.225,0.019 0.038,0.228,0.019 0.039,0.232,0.019 0.040,0.235,0.019 0.041,0.239,0.019 0.042,0.242,0.019 0.043,0.246,0.019 0.044,0.249,0.019 0.045,0.253,0.019 0.046,0.256,0.019 0.047,0.260,0.020 0.048,0.263,0.020 0.049,0.267,0.020 0.050,0.270,0.020 0.051,0.274,0.020 0.052,0.277,0.020 0.053,0.281,0.020 0.054,0.284,0.020 0.055,0.288,0.020 0.057,0.292,0.020 0.058,0.295,0.020 0.059,0.299,0.020 0.060,0.302,0.020 0.061,0.306,0.020 0.062,0.310,0.020 0.063,0.313,0.020 0.064,0.317,0.021 0.065,0.320,0.021 0.066,0.324,0.021 0.067,0.328,0.022 0.068,0.331,0.022 0.069,0.335,0.022 0.070,0.339,0.023 0.070,0.342,0.023 0.071,0.346,0.023 0.072,0.350,0.024 0.073,0.353,0.024 0.074,0.357,0.024 0.075,0.361,0.025 0.076,0.365,0.025 0.077,0.368,0.025 0.078,0.372,0.026 0.079,0.376,0.026 0.080,0.380,0.026 0.081,0.383,0.027 0.082,0.387,0.027 0.083,0.391,0.028 0.084,0.395,0.028 0.085,0.398,0.028 0.086,0.402,0.029 0.087,0.406,0.029 0.088,0.410,0.030 0.089,0.413,0.030 0.090,0.417,0.030 0.091,0.421,0.031 0.092,0.425,0.031 0.093,0.429,0.032 0.094,0.433,0.032 0.095,0.436,0.032 0.096,0.440,0.033 0.097,0.444,0.033 0.098,0.448,0.034 0.099,0.452,0.034 0.100,0.456,0.034 0.101,0.460,0.035 0.102,0.463,0.036 0.103,0.467,0.036 0.104,0.471,0.036 0.105,0.475,0.037 0.106,0.479,0.037 0.107,0.483,0.038 0.108,0.487,0.038 0.109,0.491,0.039 0.110,0.495,0.039 0.111,0.499,0.039 0.112,0.503,0.040 0.113,0.506,0.040 0.114,0.510,0.041 0.115,0.514,0.041 0.116,0.518,0.042 0.117,0.522,0.042 0.118,0.526,0.043 0.119,0.530,0.043 0.120,0.534,0.044 0.121,0.538,0.044 0.122,0.542,0.045 0.123,0.546,0.045 0.124,0.550,0.045 0.125,0.554,0.046 0.126,0.558,0.046 0.127,0.562,0.047 0.128,0.566,0.047 0.129,0.570,0.048 0.130,0.574,0.048 0.131,0.578,0.049 0.132,0.582,0.049 0.133,0.586,0.050 0.134,0.590,0.050 0.135,0.595,0.050 0.136,0.599,0.051 0.137,0.603,0.051 0.138,0.607,0.052 0.139,0.611,0.052 0.140,0.615,0.053 0.141,0.619,0.053 0.142,0.623,0.054 0.143,0.627,0.054 0.144,0.631,0.054 0.145,0.635,0.055 0.146,0.639,0.055 0.147,0.644,0.056 0.148,0.648,0.056 0.149,0.652,0.057 0.150,0.656,0.057 0.151,0.660,0.058 0.152,0.664,0.058 0.153,0.668,0.059 0.155,0.673,0.059 0.156,0.677,0.060 0.157,0.681,0.060 0.158,0.685,0.060 0.159,0.689,0.061 0.160,0.693,0.061 0.161,0.698,0.062 0.162,0.702,0.062 0.163,0.706,0.063 0.164,0.710,0.063 0.165,0.714,0.064 0.166,0.719,0.064 0.167,0.723,0.064 0.168,0.727,0.065 0.169,0.731,0.065 0.170,0.735,0.066 0.171,0.740,0.066 0.172,0.744,0.067 0.173,0.748,0.067 0.174,0.752,0.068 0.175,0.757,0.068 0.177,0.761,0.069 0.178,0.765,0.069 0.179,0.769,0.070 0.180,0.774,0.070 0.181,0.778,0.070 0.182,0.782,0.071 0.183,0.786,0.071 0.184,0.791,0.072 0.185,0.795,0.072 0.186,0.799,0.073 0.187,0.803,0.073 0.188,0.808,0.074 0.189,0.812,0.074 0.190,0.816,0.074 0.191,0.821,0.075 0.193,0.825,0.075 0.194,0.829,0.076 0.195,0.834,0.076 0.196,0.838,0.077 0.197,0.842,0.077 0.198,0.847,0.077 0.199,0.851,0.078 0.200,0.855,0.078 0.201,0.860,0.079 0.202,0.864,0.079 0.203,0.868,0.080 0.204,0.873,0.080 0.205,0.877,0.081 0.206,0.881,0.081 0.208,0.886,0.082 0.209,0.890,0.082 0.210,0.895,0.082 0.212,0.899,0.083 0.216,0.903,0.083 0.222,0.907,0.084 0.231,0.911,0.084 0.242,0.915,0.084 0.254,0.919,0.084 0.267,0.923,0.084 0.281,0.926,0.085 0.296,0.930,0.085 0.311,0.933,0.085 0.327,0.936,0.085 0.343,0.940,0.085 0.359,0.943,0.085 0.375,0.946,0.085 0.392,0.949,0.085 0.408,0.952,0.084 0.425,0.955,0.084 0.441,0.958,0.084 0.458,0.960,0.084 0.474,0.963,0.084 0.491,0.966,0.084 0.507,0.968,0.084 0.524,0.971,0.083 0.540,0.973,0.083 0.557,0.976,0.083 0.573,0.978,0.083 0.589,0.980,0.083 0.606,0.982,0.083 0.622,0.985,0.082 0.638,0.987,0.082 0.655,0.989,0.082 0.671,0.991,0.082 0.687,0.993,0.082 0.703,0.995,0.082 0.719,0.996,0.082 0.735,0.998,0.082 0.751,1.000,0.081 0.767,1.000,0.081 0.783,1.000,0.081 0.800,1.000,0.081 0.816,1.000,0.081 0.832,1.000,0.081 0.848,1.000,0.081 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L6.csv000066400000000000000000000110001457240071200235140ustar00rootroot000000000000000.000,0.002,0.307 0.000,0.004,0.314 0.000,0.006,0.322 0.000,0.008,0.330 0.000,0.009,0.337 0.000,0.010,0.345 0.000,0.011,0.352 0.000,0.011,0.360 0.000,0.011,0.368 0.002,0.011,0.376 0.004,0.011,0.384 0.007,0.010,0.392 0.009,0.010,0.400 0.012,0.010,0.407 0.015,0.010,0.416 0.018,0.009,0.424 0.021,0.009,0.432 0.024,0.009,0.440 0.026,0.009,0.448 0.029,0.008,0.456 0.032,0.008,0.464 0.036,0.008,0.473 0.039,0.007,0.481 0.041,0.007,0.489 0.044,0.007,0.498 0.047,0.007,0.506 0.049,0.006,0.514 0.052,0.006,0.523 0.054,0.006,0.531 0.056,0.006,0.540 0.057,0.006,0.549 0.059,0.005,0.557 0.061,0.005,0.566 0.062,0.005,0.575 0.063,0.005,0.583 0.064,0.005,0.592 0.064,0.006,0.601 0.064,0.006,0.610 0.064,0.006,0.619 0.063,0.007,0.628 0.062,0.007,0.637 0.060,0.008,0.646 0.058,0.009,0.656 0.055,0.010,0.665 0.052,0.011,0.674 0.049,0.013,0.683 0.046,0.014,0.692 0.043,0.016,0.701 0.040,0.017,0.710 0.038,0.019,0.719 0.036,0.021,0.727 0.033,0.024,0.736 0.032,0.026,0.744 0.031,0.029,0.753 0.030,0.031,0.761 0.029,0.034,0.769 0.029,0.038,0.777 0.030,0.041,0.785 0.031,0.044,0.793 0.032,0.048,0.801 0.034,0.051,0.808 0.037,0.055,0.816 0.040,0.058,0.823 0.043,0.062,0.831 0.047,0.065,0.838 0.052,0.069,0.845 0.056,0.072,0.852 0.061,0.076,0.859 0.066,0.080,0.866 0.071,0.084,0.873 0.076,0.087,0.879 0.082,0.091,0.886 0.087,0.095,0.892 0.092,0.099,0.898 0.097,0.104,0.904 0.102,0.108,0.910 0.107,0.113,0.915 0.111,0.118,0.920 0.116,0.123,0.925 0.120,0.128,0.930 0.124,0.134,0.935 0.128,0.139,0.939 0.132,0.145,0.944 0.135,0.151,0.948 0.139,0.157,0.951 0.142,0.163,0.955 0.146,0.169,0.958 0.149,0.175,0.962 0.152,0.181,0.964 0.155,0.187,0.967 0.158,0.194,0.970 0.160,0.200,0.972 0.163,0.206,0.974 0.165,0.213,0.976 0.168,0.220,0.977 0.170,0.226,0.979 0.172,0.233,0.980 0.174,0.239,0.981 0.175,0.246,0.982 0.177,0.253,0.982 0.178,0.260,0.983 0.179,0.266,0.983 0.180,0.273,0.984 0.181,0.280,0.984 0.182,0.286,0.984 0.183,0.292,0.985 0.184,0.299,0.985 0.185,0.305,0.985 0.185,0.311,0.986 0.186,0.317,0.986 0.186,0.323,0.987 0.186,0.329,0.987 0.187,0.335,0.987 0.187,0.341,0.988 0.187,0.347,0.988 0.187,0.353,0.988 0.187,0.359,0.989 0.186,0.365,0.989 0.186,0.371,0.989 0.186,0.376,0.990 0.185,0.382,0.990 0.184,0.388,0.990 0.184,0.393,0.991 0.183,0.399,0.991 0.182,0.405,0.991 0.181,0.410,0.992 0.180,0.416,0.992 0.178,0.421,0.992 0.177,0.427,0.993 0.176,0.432,0.993 0.175,0.438,0.993 0.174,0.443,0.994 0.173,0.449,0.994 0.172,0.454,0.994 0.171,0.459,0.994 0.171,0.465,0.994 0.170,0.470,0.995 0.170,0.475,0.995 0.170,0.480,0.995 0.170,0.486,0.995 0.170,0.491,0.995 0.171,0.496,0.995 0.171,0.501,0.995 0.172,0.506,0.995 0.173,0.511,0.995 0.174,0.516,0.995 0.175,0.521,0.995 0.176,0.526,0.995 0.178,0.531,0.995 0.179,0.536,0.995 0.181,0.541,0.995 0.183,0.546,0.995 0.185,0.551,0.995 0.187,0.556,0.994 0.189,0.561,0.994 0.192,0.566,0.994 0.194,0.571,0.994 0.197,0.575,0.993 0.199,0.580,0.993 0.201,0.585,0.993 0.203,0.590,0.993 0.205,0.595,0.993 0.206,0.600,0.992 0.207,0.605,0.992 0.208,0.610,0.992 0.209,0.615,0.992 0.210,0.620,0.992 0.211,0.624,0.991 0.211,0.629,0.991 0.211,0.634,0.991 0.211,0.639,0.991 0.211,0.644,0.991 0.211,0.649,0.991 0.210,0.654,0.990 0.210,0.659,0.990 0.209,0.664,0.990 0.208,0.669,0.990 0.206,0.674,0.990 0.205,0.679,0.990 0.203,0.684,0.990 0.201,0.689,0.990 0.199,0.694,0.989 0.197,0.699,0.989 0.194,0.704,0.989 0.191,0.709,0.989 0.188,0.714,0.989 0.185,0.719,0.989 0.182,0.724,0.989 0.179,0.729,0.989 0.177,0.734,0.989 0.174,0.739,0.988 0.172,0.744,0.988 0.170,0.749,0.988 0.168,0.754,0.988 0.166,0.759,0.988 0.165,0.764,0.987 0.163,0.769,0.987 0.162,0.774,0.987 0.161,0.778,0.987 0.160,0.783,0.987 0.160,0.788,0.986 0.160,0.793,0.986 0.160,0.798,0.986 0.160,0.803,0.985 0.161,0.807,0.985 0.161,0.812,0.985 0.162,0.817,0.984 0.164,0.822,0.984 0.165,0.827,0.984 0.167,0.831,0.983 0.169,0.836,0.983 0.171,0.841,0.982 0.174,0.845,0.982 0.177,0.850,0.982 0.183,0.855,0.981 0.190,0.859,0.981 0.199,0.864,0.980 0.210,0.868,0.980 0.221,0.872,0.979 0.233,0.876,0.979 0.246,0.880,0.979 0.260,0.884,0.978 0.273,0.888,0.978 0.287,0.892,0.977 0.301,0.896,0.977 0.314,0.900,0.976 0.328,0.904,0.976 0.342,0.907,0.976 0.356,0.911,0.975 0.370,0.915,0.975 0.384,0.918,0.974 0.397,0.922,0.974 0.411,0.925,0.973 0.424,0.929,0.973 0.438,0.932,0.973 0.451,0.936,0.972 0.464,0.939,0.972 0.478,0.943,0.971 0.491,0.946,0.971 0.504,0.949,0.970 0.517,0.953,0.970 0.529,0.956,0.969 0.542,0.959,0.969 0.555,0.962,0.968 0.568,0.966,0.968 0.580,0.969,0.968 0.593,0.972,0.967 0.605,0.975,0.967 0.618,0.978,0.966 0.630,0.981,0.966 0.642,0.984,0.965 0.654,0.987,0.965 0.667,0.990,0.964 0.679,0.993,0.964 0.691,0.996,0.963 0.703,0.999,0.963 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L7.csv000066400000000000000000000110001457240071200235150ustar00rootroot000000000000000.000,0.008,0.296 0.000,0.010,0.303 0.000,0.012,0.311 0.000,0.014,0.319 0.000,0.016,0.327 0.000,0.017,0.335 0.000,0.018,0.343 0.000,0.019,0.351 0.000,0.019,0.359 0.000,0.020,0.368 0.000,0.020,0.376 0.000,0.020,0.384 0.000,0.020,0.392 0.000,0.020,0.401 0.001,0.020,0.409 0.002,0.020,0.417 0.003,0.020,0.426 0.005,0.021,0.434 0.006,0.021,0.442 0.007,0.021,0.451 0.008,0.021,0.459 0.009,0.021,0.468 0.010,0.021,0.476 0.012,0.021,0.485 0.013,0.021,0.493 0.014,0.021,0.502 0.015,0.021,0.511 0.016,0.021,0.519 0.017,0.022,0.528 0.018,0.022,0.537 0.019,0.022,0.546 0.020,0.022,0.554 0.021,0.022,0.563 0.022,0.022,0.572 0.022,0.023,0.581 0.023,0.023,0.590 0.023,0.023,0.599 0.023,0.024,0.607 0.023,0.024,0.616 0.023,0.024,0.625 0.023,0.025,0.634 0.022,0.025,0.643 0.021,0.026,0.652 0.020,0.027,0.661 0.019,0.028,0.670 0.018,0.029,0.679 0.018,0.030,0.688 0.018,0.031,0.697 0.019,0.032,0.706 0.020,0.033,0.714 0.021,0.035,0.723 0.023,0.036,0.731 0.025,0.038,0.740 0.029,0.039,0.748 0.032,0.041,0.756 0.037,0.043,0.764 0.041,0.044,0.772 0.046,0.046,0.780 0.052,0.048,0.788 0.057,0.050,0.796 0.063,0.052,0.804 0.069,0.054,0.811 0.075,0.056,0.819 0.081,0.058,0.826 0.087,0.060,0.833 0.094,0.063,0.841 0.100,0.065,0.848 0.106,0.067,0.855 0.113,0.070,0.862 0.119,0.072,0.869 0.126,0.075,0.876 0.133,0.077,0.882 0.140,0.079,0.889 0.148,0.082,0.895 0.156,0.084,0.901 0.165,0.086,0.907 0.174,0.088,0.913 0.184,0.090,0.919 0.194,0.092,0.924 0.204,0.094,0.929 0.214,0.095,0.934 0.225,0.097,0.939 0.236,0.098,0.943 0.247,0.099,0.947 0.258,0.101,0.951 0.269,0.102,0.955 0.281,0.103,0.959 0.292,0.104,0.962 0.304,0.105,0.966 0.316,0.106,0.969 0.327,0.107,0.971 0.339,0.107,0.974 0.351,0.108,0.976 0.363,0.109,0.979 0.375,0.109,0.980 0.387,0.110,0.982 0.399,0.110,0.984 0.411,0.110,0.985 0.423,0.111,0.986 0.435,0.111,0.987 0.447,0.111,0.988 0.458,0.111,0.988 0.470,0.111,0.989 0.481,0.111,0.989 0.493,0.111,0.990 0.504,0.111,0.991 0.515,0.111,0.991 0.525,0.111,0.992 0.536,0.112,0.992 0.547,0.112,0.993 0.557,0.112,0.993 0.568,0.112,0.993 0.578,0.112,0.994 0.588,0.112,0.994 0.598,0.112,0.994 0.608,0.112,0.995 0.618,0.112,0.995 0.628,0.112,0.995 0.638,0.112,0.995 0.648,0.112,0.996 0.657,0.112,0.996 0.667,0.112,0.996 0.677,0.112,0.996 0.686,0.112,0.996 0.696,0.112,0.996 0.705,0.112,0.996 0.715,0.112,0.996 0.724,0.112,0.996 0.733,0.112,0.996 0.742,0.112,0.996 0.751,0.113,0.996 0.760,0.114,0.996 0.769,0.115,0.996 0.777,0.117,0.996 0.785,0.119,0.996 0.793,0.122,0.996 0.801,0.125,0.996 0.809,0.128,0.996 0.816,0.132,0.996 0.823,0.136,0.996 0.831,0.140,0.996 0.838,0.145,0.996 0.845,0.149,0.996 0.851,0.154,0.996 0.858,0.160,0.996 0.864,0.165,0.996 0.871,0.171,0.996 0.877,0.176,0.996 0.883,0.182,0.996 0.888,0.188,0.996 0.894,0.195,0.996 0.900,0.201,0.996 0.905,0.208,0.996 0.910,0.214,0.996 0.915,0.221,0.996 0.920,0.228,0.996 0.925,0.234,0.996 0.930,0.241,0.996 0.934,0.249,0.996 0.939,0.256,0.996 0.943,0.263,0.997 0.947,0.270,0.997 0.951,0.278,0.997 0.955,0.285,0.997 0.958,0.293,0.996 0.961,0.301,0.996 0.965,0.308,0.996 0.968,0.316,0.996 0.971,0.324,0.996 0.973,0.332,0.996 0.976,0.340,0.996 0.978,0.348,0.996 0.981,0.356,0.996 0.983,0.364,0.996 0.985,0.372,0.995 0.987,0.381,0.995 0.988,0.389,0.995 0.990,0.397,0.995 0.991,0.405,0.995 0.992,0.414,0.994 0.993,0.422,0.994 0.994,0.430,0.994 0.994,0.439,0.994 0.995,0.447,0.993 0.995,0.456,0.993 0.995,0.464,0.993 0.995,0.472,0.992 0.996,0.481,0.992 0.996,0.489,0.992 0.996,0.497,0.992 0.996,0.504,0.991 0.996,0.512,0.991 0.996,0.520,0.991 0.996,0.527,0.991 0.996,0.535,0.991 0.996,0.542,0.991 0.997,0.550,0.991 0.997,0.557,0.991 0.997,0.564,0.991 0.997,0.572,0.991 0.997,0.579,0.991 0.997,0.586,0.991 0.997,0.593,0.991 0.997,0.600,0.991 0.997,0.607,0.991 0.997,0.614,0.991 0.997,0.620,0.991 0.997,0.627,0.991 0.997,0.634,0.992 0.997,0.641,0.992 0.997,0.647,0.992 0.997,0.654,0.992 0.997,0.660,0.993 0.997,0.667,0.993 0.997,0.673,0.993 0.997,0.680,0.994 0.997,0.686,0.994 0.997,0.693,0.994 0.997,0.699,0.995 0.997,0.705,0.995 0.997,0.712,0.995 0.997,0.718,0.995 0.997,0.724,0.995 0.998,0.730,0.996 0.998,0.736,0.996 0.998,0.743,0.996 0.998,0.749,0.996 0.998,0.755,0.996 0.998,0.761,0.996 0.998,0.767,0.997 0.998,0.773,0.997 0.998,0.779,0.997 0.998,0.785,0.997 0.998,0.791,0.997 0.998,0.797,0.997 0.998,0.803,0.997 0.999,0.809,0.997 0.999,0.815,0.997 0.999,0.821,0.997 0.999,0.827,0.997 0.999,0.833,0.997 0.999,0.839,0.998 0.999,0.845,0.998 0.999,0.851,0.998 0.999,0.857,0.998 0.999,0.863,0.998 0.999,0.868,0.998 0.998,0.874,0.998 0.998,0.880,0.998 0.998,0.886,0.998 0.998,0.892,0.998 0.998,0.898,0.998 0.998,0.903,0.997 0.998,0.909,0.997 0.998,0.915,0.997 0.998,0.921,0.997 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L8.csv000066400000000000000000000110001457240071200235160ustar00rootroot000000000000000.002,0.058,0.364 0.002,0.060,0.370 0.003,0.062,0.377 0.004,0.064,0.383 0.006,0.065,0.390 0.008,0.067,0.396 0.010,0.069,0.402 0.013,0.071,0.409 0.016,0.072,0.415 0.019,0.074,0.421 0.023,0.076,0.427 0.028,0.077,0.433 0.033,0.079,0.439 0.039,0.081,0.445 0.045,0.082,0.451 0.052,0.084,0.457 0.058,0.085,0.463 0.065,0.087,0.468 0.071,0.088,0.474 0.078,0.089,0.480 0.085,0.091,0.485 0.092,0.092,0.490 0.099,0.093,0.496 0.107,0.095,0.501 0.114,0.096,0.506 0.122,0.097,0.511 0.129,0.098,0.516 0.137,0.099,0.520 0.145,0.100,0.525 0.153,0.101,0.529 0.162,0.102,0.534 0.170,0.102,0.538 0.178,0.103,0.542 0.187,0.104,0.546 0.196,0.104,0.549 0.205,0.104,0.553 0.214,0.105,0.556 0.224,0.105,0.559 0.233,0.105,0.562 0.243,0.105,0.564 0.253,0.104,0.566 0.263,0.104,0.568 0.273,0.103,0.570 0.284,0.102,0.571 0.295,0.101,0.572 0.306,0.100,0.573 0.317,0.098,0.573 0.328,0.097,0.573 0.339,0.095,0.574 0.350,0.093,0.574 0.360,0.092,0.574 0.370,0.090,0.574 0.380,0.088,0.574 0.390,0.087,0.573 0.399,0.085,0.573 0.409,0.083,0.573 0.418,0.081,0.573 0.428,0.079,0.572 0.437,0.077,0.572 0.446,0.075,0.572 0.455,0.074,0.571 0.464,0.072,0.570 0.473,0.070,0.570 0.481,0.068,0.569 0.490,0.066,0.568 0.499,0.064,0.568 0.507,0.062,0.567 0.515,0.060,0.566 0.524,0.058,0.565 0.532,0.056,0.564 0.540,0.054,0.563 0.548,0.052,0.562 0.556,0.051,0.560 0.564,0.049,0.559 0.572,0.048,0.558 0.580,0.046,0.556 0.588,0.045,0.555 0.596,0.043,0.554 0.603,0.042,0.552 0.611,0.041,0.551 0.619,0.040,0.549 0.626,0.039,0.548 0.634,0.038,0.546 0.641,0.038,0.545 0.648,0.037,0.543 0.656,0.037,0.542 0.663,0.037,0.540 0.670,0.037,0.538 0.677,0.037,0.537 0.684,0.037,0.535 0.691,0.038,0.534 0.698,0.039,0.532 0.705,0.040,0.530 0.712,0.041,0.529 0.719,0.042,0.527 0.726,0.044,0.525 0.733,0.045,0.523 0.739,0.047,0.522 0.746,0.049,0.520 0.753,0.051,0.518 0.759,0.054,0.516 0.766,0.056,0.514 0.772,0.059,0.513 0.779,0.061,0.511 0.785,0.064,0.509 0.792,0.067,0.507 0.798,0.070,0.505 0.804,0.074,0.503 0.811,0.078,0.501 0.817,0.082,0.499 0.823,0.087,0.496 0.828,0.092,0.494 0.834,0.097,0.492 0.840,0.103,0.489 0.845,0.108,0.487 0.850,0.114,0.484 0.856,0.120,0.481 0.861,0.126,0.478 0.866,0.133,0.475 0.871,0.139,0.472 0.876,0.146,0.469 0.880,0.152,0.466 0.885,0.159,0.463 0.889,0.166,0.460 0.894,0.173,0.456 0.898,0.180,0.453 0.902,0.187,0.449 0.906,0.194,0.445 0.910,0.201,0.441 0.914,0.208,0.438 0.918,0.215,0.434 0.921,0.223,0.429 0.924,0.230,0.425 0.928,0.237,0.421 0.931,0.245,0.417 0.934,0.252,0.412 0.937,0.259,0.408 0.940,0.267,0.403 0.943,0.274,0.399 0.945,0.281,0.394 0.948,0.289,0.390 0.950,0.296,0.386 0.952,0.303,0.382 0.955,0.311,0.378 0.957,0.318,0.374 0.959,0.325,0.370 0.961,0.333,0.366 0.962,0.340,0.363 0.964,0.347,0.359 0.966,0.354,0.355 0.967,0.361,0.352 0.968,0.369,0.348 0.970,0.376,0.345 0.971,0.383,0.341 0.972,0.390,0.338 0.973,0.398,0.335 0.974,0.405,0.332 0.974,0.412,0.329 0.975,0.419,0.325 0.975,0.426,0.323 0.976,0.434,0.320 0.976,0.441,0.317 0.976,0.448,0.314 0.976,0.455,0.311 0.976,0.462,0.309 0.976,0.469,0.306 0.976,0.477,0.304 0.976,0.484,0.301 0.976,0.491,0.299 0.976,0.497,0.296 0.976,0.504,0.294 0.976,0.511,0.291 0.976,0.517,0.289 0.976,0.524,0.286 0.976,0.530,0.284 0.976,0.537,0.281 0.976,0.543,0.278 0.976,0.549,0.276 0.976,0.555,0.273 0.976,0.562,0.271 0.977,0.568,0.268 0.977,0.574,0.266 0.977,0.580,0.263 0.978,0.585,0.261 0.978,0.591,0.258 0.979,0.597,0.256 0.979,0.603,0.253 0.980,0.609,0.250 0.980,0.614,0.248 0.981,0.620,0.245 0.981,0.625,0.243 0.982,0.631,0.240 0.983,0.636,0.238 0.983,0.642,0.235 0.984,0.647,0.232 0.985,0.653,0.230 0.986,0.658,0.227 0.987,0.663,0.225 0.987,0.669,0.224 0.988,0.674,0.222 0.988,0.680,0.221 0.989,0.685,0.220 0.989,0.690,0.220 0.989,0.696,0.219 0.990,0.701,0.219 0.990,0.707,0.218 0.990,0.712,0.218 0.990,0.718,0.218 0.990,0.723,0.219 0.990,0.728,0.219 0.991,0.734,0.219 0.991,0.739,0.220 0.991,0.745,0.221 0.990,0.750,0.221 0.990,0.755,0.222 0.990,0.761,0.223 0.990,0.766,0.224 0.990,0.772,0.225 0.990,0.777,0.226 0.990,0.783,0.228 0.989,0.788,0.229 0.989,0.793,0.230 0.989,0.799,0.232 0.988,0.804,0.233 0.988,0.810,0.235 0.987,0.815,0.237 0.987,0.820,0.238 0.987,0.826,0.240 0.986,0.831,0.242 0.986,0.836,0.244 0.985,0.842,0.245 0.984,0.847,0.247 0.984,0.853,0.249 0.983,0.858,0.251 0.983,0.863,0.254 0.982,0.869,0.256 0.981,0.874,0.258 0.980,0.879,0.260 0.980,0.885,0.262 0.979,0.890,0.264 0.978,0.895,0.267 0.977,0.901,0.269 0.976,0.906,0.271 0.975,0.912,0.274 0.974,0.917,0.276 0.973,0.922,0.279 0.972,0.928,0.281 0.971,0.933,0.284 0.970,0.938,0.286 0.969,0.944,0.289 0.968,0.949,0.291 0.967,0.954,0.294 0.966,0.960,0.297 0.964,0.965,0.299 0.963,0.970,0.302 0.962,0.976,0.305 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-L9.csv000066400000000000000000000110001457240071200235170ustar00rootroot000000000000000.020,0.000,0.673 0.022,0.009,0.675 0.024,0.020,0.676 0.026,0.032,0.677 0.028,0.043,0.679 0.029,0.053,0.680 0.031,0.063,0.682 0.033,0.072,0.683 0.035,0.080,0.684 0.036,0.087,0.686 0.038,0.094,0.687 0.039,0.101,0.688 0.041,0.108,0.689 0.042,0.114,0.690 0.043,0.121,0.692 0.045,0.127,0.693 0.046,0.133,0.694 0.047,0.139,0.695 0.048,0.144,0.696 0.048,0.150,0.697 0.049,0.155,0.698 0.050,0.161,0.699 0.051,0.166,0.700 0.051,0.171,0.701 0.052,0.177,0.702 0.052,0.182,0.703 0.053,0.187,0.703 0.053,0.192,0.704 0.053,0.197,0.705 0.054,0.202,0.705 0.054,0.207,0.706 0.054,0.212,0.707 0.054,0.216,0.707 0.054,0.221,0.708 0.054,0.226,0.708 0.054,0.231,0.709 0.054,0.236,0.709 0.054,0.240,0.709 0.053,0.245,0.709 0.053,0.250,0.710 0.053,0.254,0.710 0.052,0.259,0.710 0.052,0.264,0.710 0.051,0.268,0.710 0.051,0.273,0.710 0.050,0.278,0.709 0.049,0.282,0.709 0.048,0.287,0.709 0.047,0.292,0.708 0.046,0.296,0.708 0.045,0.301,0.707 0.044,0.305,0.706 0.043,0.310,0.705 0.042,0.315,0.704 0.041,0.319,0.703 0.039,0.324,0.702 0.038,0.329,0.700 0.036,0.333,0.698 0.035,0.338,0.697 0.033,0.343,0.695 0.031,0.347,0.692 0.030,0.352,0.690 0.028,0.357,0.687 0.026,0.362,0.684 0.025,0.367,0.681 0.023,0.372,0.677 0.022,0.377,0.673 0.022,0.381,0.668 0.024,0.386,0.663 0.028,0.391,0.659 0.032,0.396,0.654 0.039,0.401,0.648 0.045,0.405,0.643 0.052,0.410,0.637 0.059,0.414,0.632 0.067,0.419,0.626 0.074,0.423,0.620 0.080,0.428,0.614 0.087,0.432,0.607 0.094,0.437,0.601 0.100,0.441,0.594 0.106,0.446,0.588 0.112,0.450,0.581 0.117,0.454,0.574 0.123,0.459,0.567 0.128,0.463,0.560 0.133,0.467,0.553 0.138,0.472,0.545 0.142,0.476,0.538 0.147,0.480,0.530 0.151,0.485,0.523 0.155,0.489,0.515 0.158,0.493,0.507 0.162,0.497,0.499 0.165,0.502,0.491 0.168,0.506,0.482 0.171,0.510,0.474 0.174,0.514,0.466 0.176,0.519,0.457 0.179,0.523,0.448 0.181,0.527,0.440 0.182,0.531,0.431 0.184,0.536,0.422 0.185,0.540,0.413 0.187,0.544,0.403 0.188,0.548,0.394 0.188,0.552,0.384 0.189,0.557,0.375 0.190,0.561,0.366 0.191,0.565,0.357 0.192,0.569,0.348 0.194,0.573,0.339 0.196,0.577,0.331 0.198,0.581,0.323 0.200,0.585,0.315 0.202,0.588,0.307 0.205,0.592,0.299 0.208,0.596,0.292 0.211,0.600,0.284 0.215,0.603,0.277 0.218,0.607,0.270 0.222,0.611,0.263 0.226,0.614,0.256 0.230,0.618,0.250 0.235,0.621,0.243 0.240,0.625,0.237 0.245,0.628,0.230 0.250,0.631,0.224 0.255,0.635,0.218 0.260,0.638,0.212 0.266,0.641,0.205 0.272,0.645,0.200 0.278,0.648,0.194 0.284,0.651,0.188 0.290,0.654,0.182 0.296,0.657,0.176 0.303,0.661,0.171 0.309,0.664,0.165 0.316,0.667,0.159 0.323,0.670,0.154 0.329,0.673,0.148 0.336,0.676,0.143 0.343,0.679,0.137 0.351,0.682,0.132 0.358,0.685,0.127 0.365,0.688,0.121 0.372,0.691,0.116 0.380,0.694,0.111 0.387,0.696,0.105 0.395,0.699,0.100 0.403,0.702,0.095 0.411,0.705,0.090 0.418,0.707,0.084 0.426,0.710,0.079 0.434,0.713,0.074 0.442,0.716,0.069 0.450,0.718,0.064 0.458,0.721,0.058 0.466,0.723,0.053 0.475,0.726,0.048 0.483,0.728,0.043 0.491,0.731,0.038 0.500,0.733,0.033 0.508,0.736,0.029 0.516,0.738,0.025 0.525,0.741,0.022 0.533,0.743,0.019 0.542,0.746,0.016 0.551,0.748,0.014 0.559,0.750,0.013 0.568,0.752,0.011 0.577,0.755,0.010 0.586,0.757,0.010 0.594,0.759,0.010 0.603,0.761,0.009 0.611,0.764,0.009 0.620,0.766,0.010 0.628,0.768,0.010 0.637,0.770,0.010 0.645,0.773,0.011 0.653,0.775,0.012 0.662,0.777,0.013 0.670,0.779,0.014 0.678,0.781,0.015 0.686,0.784,0.017 0.694,0.786,0.019 0.702,0.788,0.021 0.709,0.790,0.023 0.717,0.793,0.025 0.725,0.795,0.028 0.733,0.797,0.031 0.740,0.800,0.034 0.748,0.802,0.038 0.755,0.804,0.042 0.763,0.806,0.045 0.770,0.809,0.049 0.777,0.811,0.053 0.784,0.813,0.057 0.792,0.816,0.062 0.799,0.818,0.066 0.806,0.820,0.070 0.813,0.823,0.075 0.820,0.825,0.079 0.826,0.828,0.084 0.833,0.830,0.089 0.840,0.833,0.093 0.846,0.835,0.098 0.853,0.837,0.103 0.859,0.840,0.108 0.865,0.843,0.113 0.872,0.845,0.118 0.878,0.848,0.124 0.884,0.850,0.129 0.890,0.853,0.135 0.895,0.856,0.140 0.901,0.858,0.146 0.906,0.861,0.152 0.912,0.864,0.158 0.917,0.867,0.164 0.922,0.870,0.171 0.927,0.873,0.177 0.932,0.876,0.184 0.936,0.879,0.191 0.940,0.882,0.198 0.944,0.885,0.206 0.948,0.888,0.213 0.952,0.892,0.221 0.955,0.895,0.230 0.957,0.899,0.238 0.960,0.903,0.248 0.962,0.906,0.258 0.964,0.910,0.269 0.967,0.914,0.282 0.969,0.917,0.296 0.971,0.921,0.311 0.974,0.924,0.327 0.976,0.928,0.345 0.979,0.931,0.363 0.981,0.934,0.383 0.984,0.937,0.404 0.987,0.940,0.426 0.989,0.943,0.450 0.991,0.946,0.475 0.994,0.949,0.501 0.996,0.952,0.529 0.997,0.955,0.558 0.999,0.957,0.590 1.000,0.960,0.623 1.000,0.962,0.658 1.000,0.965,0.695 1.000,0.967,0.735 0.998,0.969,0.777 0.996,0.971,0.822 0.991,0.973,0.870 0.985,0.975,0.922 0.977,0.977,0.977 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-R1.csv000066400000000000000000000110001457240071200235150ustar00rootroot000000000000000.000,0.187,0.963 0.000,0.202,0.949 0.000,0.217,0.935 0.000,0.231,0.921 0.011,0.244,0.908 0.036,0.257,0.894 0.056,0.269,0.880 0.069,0.281,0.867 0.079,0.292,0.853 0.087,0.302,0.840 0.092,0.313,0.826 0.096,0.323,0.813 0.098,0.333,0.799 0.100,0.342,0.786 0.100,0.352,0.772 0.099,0.361,0.759 0.098,0.370,0.745 0.097,0.378,0.732 0.095,0.386,0.719 0.093,0.395,0.706 0.092,0.402,0.693 0.092,0.410,0.680 0.092,0.417,0.667 0.093,0.425,0.654 0.095,0.432,0.641 0.099,0.438,0.629 0.104,0.445,0.616 0.110,0.451,0.604 0.117,0.457,0.592 0.125,0.463,0.580 0.134,0.469,0.568 0.142,0.474,0.556 0.151,0.480,0.544 0.160,0.485,0.532 0.169,0.491,0.520 0.177,0.496,0.509 0.185,0.501,0.497 0.193,0.506,0.485 0.200,0.511,0.473 0.206,0.516,0.462 0.213,0.522,0.450 0.218,0.527,0.438 0.223,0.532,0.426 0.228,0.537,0.414 0.232,0.542,0.402 0.236,0.547,0.390 0.239,0.552,0.378 0.242,0.557,0.365 0.245,0.562,0.353 0.247,0.567,0.340 0.249,0.573,0.327 0.250,0.578,0.314 0.252,0.583,0.301 0.253,0.588,0.288 0.254,0.593,0.275 0.255,0.598,0.262 0.256,0.603,0.248 0.257,0.608,0.235 0.258,0.613,0.221 0.260,0.618,0.208 0.263,0.623,0.195 0.266,0.627,0.182 0.270,0.632,0.169 0.274,0.636,0.156 0.280,0.641,0.144 0.286,0.645,0.133 0.293,0.649,0.122 0.302,0.653,0.112 0.311,0.657,0.102 0.320,0.660,0.094 0.331,0.664,0.086 0.341,0.667,0.080 0.353,0.671,0.075 0.364,0.674,0.070 0.376,0.677,0.067 0.388,0.680,0.065 0.400,0.683,0.064 0.412,0.686,0.064 0.425,0.689,0.064 0.437,0.692,0.064 0.449,0.695,0.065 0.461,0.698,0.067 0.473,0.701,0.068 0.485,0.703,0.070 0.496,0.706,0.071 0.508,0.709,0.073 0.520,0.712,0.075 0.531,0.715,0.077 0.542,0.717,0.078 0.554,0.720,0.080 0.565,0.723,0.082 0.576,0.725,0.084 0.587,0.728,0.086 0.598,0.731,0.087 0.609,0.733,0.089 0.620,0.736,0.091 0.631,0.739,0.093 0.642,0.741,0.095 0.653,0.744,0.096 0.664,0.746,0.098 0.674,0.749,0.100 0.685,0.751,0.102 0.696,0.754,0.103 0.707,0.757,0.105 0.717,0.759,0.107 0.728,0.762,0.109 0.738,0.764,0.111 0.749,0.766,0.112 0.759,0.769,0.114 0.770,0.771,0.116 0.780,0.774,0.118 0.791,0.776,0.120 0.801,0.778,0.121 0.812,0.781,0.123 0.822,0.783,0.125 0.832,0.785,0.127 0.843,0.787,0.128 0.853,0.789,0.130 0.863,0.791,0.132 0.873,0.793,0.133 0.882,0.794,0.135 0.892,0.795,0.136 0.901,0.796,0.137 0.910,0.797,0.139 0.918,0.797,0.140 0.926,0.797,0.141 0.933,0.796,0.142 0.940,0.795,0.142 0.946,0.793,0.143 0.952,0.791,0.143 0.957,0.789,0.143 0.962,0.786,0.143 0.966,0.782,0.143 0.969,0.779,0.142 0.972,0.774,0.142 0.974,0.770,0.141 0.976,0.765,0.140 0.977,0.760,0.139 0.978,0.754,0.138 0.979,0.749,0.137 0.979,0.743,0.136 0.980,0.737,0.135 0.980,0.732,0.133 0.980,0.726,0.132 0.979,0.720,0.131 0.979,0.714,0.130 0.979,0.707,0.128 0.979,0.701,0.127 0.978,0.695,0.126 0.978,0.689,0.124 0.977,0.683,0.123 0.977,0.677,0.122 0.976,0.670,0.121 0.976,0.664,0.119 0.975,0.658,0.118 0.975,0.652,0.117 0.974,0.645,0.116 0.974,0.639,0.114 0.973,0.633,0.113 0.973,0.627,0.112 0.972,0.620,0.111 0.971,0.614,0.110 0.971,0.608,0.108 0.970,0.601,0.107 0.969,0.595,0.106 0.969,0.588,0.105 0.968,0.582,0.104 0.967,0.575,0.103 0.966,0.569,0.102 0.966,0.563,0.100 0.965,0.556,0.099 0.964,0.549,0.098 0.963,0.543,0.097 0.962,0.536,0.096 0.961,0.530,0.095 0.961,0.523,0.094 0.960,0.516,0.093 0.959,0.510,0.092 0.958,0.503,0.091 0.957,0.496,0.090 0.956,0.489,0.089 0.955,0.482,0.088 0.954,0.476,0.087 0.953,0.469,0.086 0.952,0.462,0.085 0.951,0.455,0.084 0.950,0.448,0.083 0.949,0.440,0.083 0.948,0.433,0.082 0.947,0.426,0.082 0.946,0.419,0.082 0.945,0.412,0.082 0.944,0.405,0.083 0.943,0.398,0.084 0.942,0.391,0.086 0.941,0.384,0.088 0.941,0.378,0.091 0.940,0.371,0.095 0.940,0.365,0.100 0.940,0.360,0.106 0.940,0.355,0.113 0.940,0.350,0.121 0.941,0.346,0.130 0.942,0.343,0.139 0.943,0.340,0.150 0.944,0.338,0.161 0.946,0.337,0.173 0.948,0.337,0.186 0.950,0.338,0.199 0.952,0.339,0.213 0.954,0.341,0.227 0.957,0.343,0.242 0.959,0.346,0.257 0.962,0.350,0.272 0.965,0.354,0.288 0.967,0.358,0.304 0.970,0.362,0.320 0.973,0.367,0.336 0.975,0.372,0.352 0.978,0.377,0.368 0.980,0.382,0.385 0.983,0.387,0.401 0.985,0.392,0.418 0.987,0.397,0.434 0.990,0.403,0.451 0.992,0.408,0.467 0.993,0.413,0.484 0.995,0.418,0.500 0.997,0.424,0.517 0.999,0.429,0.533 1.000,0.434,0.550 1.000,0.440,0.567 1.000,0.445,0.583 1.000,0.451,0.600 1.000,0.456,0.617 1.000,0.461,0.634 1.000,0.467,0.651 1.000,0.472,0.668 1.000,0.478,0.685 1.000,0.483,0.702 1.000,0.488,0.719 1.000,0.494,0.736 1.000,0.499,0.753 1.000,0.505,0.770 1.000,0.510,0.787 1.000,0.516,0.805 1.000,0.521,0.822 1.000,0.527,0.840 1.000,0.532,0.857 1.000,0.538,0.874 1.000,0.544,0.892 1.000,0.549,0.910 0.998,0.555,0.927 0.997,0.560,0.945 0.995,0.566,0.963 0.992,0.572,0.980 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-R2.csv000066400000000000000000000110001457240071200235160ustar00rootroot000000000000000.000,0.204,0.963 0.000,0.215,0.951 0.000,0.226,0.940 0.000,0.237,0.929 0.000,0.247,0.918 0.000,0.256,0.907 0.000,0.266,0.896 0.000,0.275,0.885 0.000,0.283,0.874 0.000,0.292,0.863 0.000,0.300,0.852 0.000,0.309,0.841 0.000,0.317,0.830 0.000,0.325,0.819 0.000,0.332,0.808 0.000,0.340,0.797 0.000,0.347,0.786 0.000,0.355,0.775 0.000,0.362,0.765 0.000,0.369,0.754 0.000,0.376,0.743 0.000,0.383,0.732 0.000,0.390,0.721 0.000,0.396,0.710 0.000,0.403,0.699 0.000,0.409,0.689 0.000,0.416,0.678 0.000,0.422,0.667 0.000,0.428,0.657 0.000,0.433,0.646 0.000,0.439,0.636 0.000,0.444,0.626 0.000,0.449,0.616 0.000,0.454,0.606 0.000,0.459,0.596 0.004,0.464,0.586 0.030,0.468,0.577 0.056,0.472,0.567 0.077,0.477,0.558 0.095,0.481,0.548 0.111,0.485,0.539 0.125,0.489,0.530 0.138,0.493,0.520 0.149,0.497,0.511 0.160,0.501,0.502 0.169,0.505,0.492 0.177,0.508,0.483 0.185,0.512,0.474 0.192,0.516,0.464 0.199,0.520,0.455 0.204,0.524,0.445 0.210,0.529,0.436 0.215,0.533,0.426 0.219,0.537,0.417 0.223,0.541,0.407 0.227,0.545,0.397 0.230,0.549,0.387 0.233,0.553,0.377 0.236,0.557,0.367 0.238,0.561,0.357 0.240,0.565,0.347 0.242,0.569,0.336 0.243,0.574,0.326 0.245,0.578,0.315 0.246,0.582,0.304 0.246,0.586,0.293 0.247,0.590,0.282 0.247,0.594,0.271 0.247,0.599,0.259 0.247,0.603,0.247 0.247,0.607,0.235 0.246,0.611,0.222 0.246,0.615,0.209 0.246,0.619,0.196 0.246,0.623,0.183 0.246,0.627,0.170 0.247,0.631,0.156 0.249,0.635,0.143 0.252,0.639,0.130 0.256,0.642,0.117 0.261,0.646,0.106 0.267,0.649,0.095 0.274,0.652,0.085 0.282,0.655,0.076 0.291,0.658,0.070 0.300,0.661,0.065 0.311,0.664,0.061 0.321,0.666,0.059 0.332,0.669,0.058 0.343,0.671,0.058 0.354,0.674,0.058 0.364,0.676,0.060 0.375,0.679,0.061 0.386,0.681,0.063 0.396,0.683,0.065 0.407,0.686,0.067 0.417,0.688,0.069 0.427,0.690,0.071 0.437,0.693,0.072 0.447,0.695,0.074 0.457,0.697,0.076 0.467,0.700,0.078 0.476,0.702,0.080 0.486,0.704,0.082 0.495,0.706,0.084 0.505,0.709,0.086 0.514,0.711,0.088 0.523,0.713,0.089 0.533,0.715,0.091 0.542,0.717,0.093 0.551,0.720,0.095 0.560,0.722,0.097 0.569,0.724,0.098 0.578,0.726,0.100 0.587,0.728,0.102 0.596,0.730,0.104 0.605,0.733,0.106 0.614,0.735,0.107 0.622,0.737,0.109 0.631,0.739,0.111 0.640,0.741,0.113 0.649,0.743,0.115 0.657,0.745,0.116 0.666,0.747,0.118 0.675,0.749,0.120 0.683,0.751,0.122 0.692,0.753,0.123 0.701,0.756,0.125 0.709,0.758,0.127 0.718,0.760,0.129 0.726,0.762,0.130 0.735,0.764,0.132 0.743,0.766,0.134 0.752,0.768,0.136 0.760,0.770,0.137 0.769,0.772,0.139 0.777,0.773,0.141 0.786,0.775,0.143 0.794,0.777,0.144 0.803,0.779,0.146 0.811,0.781,0.148 0.819,0.783,0.150 0.828,0.785,0.151 0.836,0.787,0.153 0.845,0.789,0.155 0.853,0.791,0.157 0.861,0.793,0.158 0.870,0.794,0.160 0.878,0.796,0.162 0.886,0.798,0.163 0.895,0.800,0.165 0.903,0.801,0.167 0.911,0.802,0.168 0.919,0.804,0.170 0.927,0.805,0.171 0.935,0.805,0.172 0.942,0.805,0.173 0.949,0.805,0.174 0.955,0.804,0.174 0.961,0.803,0.174 0.966,0.801,0.174 0.971,0.798,0.173 0.975,0.795,0.172 0.978,0.792,0.171 0.981,0.788,0.170 0.983,0.784,0.168 0.985,0.779,0.167 0.987,0.775,0.165 0.988,0.770,0.163 0.989,0.764,0.161 0.990,0.759,0.158 0.991,0.754,0.156 0.991,0.749,0.154 0.992,0.744,0.152 0.993,0.738,0.150 0.993,0.733,0.148 0.994,0.728,0.145 0.995,0.722,0.143 0.995,0.717,0.141 0.996,0.712,0.139 0.996,0.706,0.137 0.997,0.701,0.134 0.997,0.695,0.132 0.998,0.690,0.130 0.998,0.684,0.128 0.998,0.679,0.126 0.999,0.674,0.123 0.999,0.668,0.121 1.000,0.663,0.119 1.000,0.657,0.117 1.000,0.652,0.115 1.000,0.646,0.112 1.000,0.641,0.110 1.000,0.635,0.108 1.000,0.629,0.106 1.000,0.624,0.104 1.000,0.618,0.101 1.000,0.613,0.099 1.000,0.607,0.097 1.000,0.601,0.095 1.000,0.596,0.092 1.000,0.590,0.090 1.000,0.584,0.088 1.000,0.578,0.086 1.000,0.573,0.084 1.000,0.567,0.081 1.000,0.561,0.079 1.000,0.555,0.077 1.000,0.549,0.075 1.000,0.543,0.072 1.000,0.537,0.070 1.000,0.531,0.068 1.000,0.525,0.065 1.000,0.519,0.063 1.000,0.513,0.061 1.000,0.507,0.059 1.000,0.501,0.056 1.000,0.495,0.054 1.000,0.489,0.051 1.000,0.482,0.049 1.000,0.476,0.047 1.000,0.470,0.044 1.000,0.463,0.042 1.000,0.457,0.040 1.000,0.450,0.037 1.000,0.444,0.035 1.000,0.437,0.032 1.000,0.430,0.030 1.000,0.424,0.028 1.000,0.417,0.026 1.000,0.410,0.024 1.000,0.403,0.022 1.000,0.396,0.020 1.000,0.389,0.019 1.000,0.382,0.017 1.000,0.374,0.015 0.999,0.367,0.013 0.999,0.359,0.012 0.999,0.352,0.010 0.998,0.344,0.009 0.998,0.336,0.007 0.997,0.328,0.006 0.997,0.320,0.005 0.997,0.311,0.004 0.996,0.303,0.002 0.996,0.294,0.001 0.995,0.285,0.000 0.995,0.276,0.000 0.994,0.266,0.000 0.994,0.257,0.000 0.993,0.247,0.000 0.993,0.236,0.000 0.992,0.225,0.000 0.992,0.214,0.000 0.991,0.202,0.000 0.990,0.189,0.000 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-R3.csv000066400000000000000000000110001457240071200235170ustar00rootroot000000000000000.032,0.362,0.973 0.058,0.371,0.958 0.076,0.380,0.943 0.089,0.389,0.928 0.098,0.397,0.914 0.105,0.406,0.899 0.110,0.414,0.884 0.114,0.422,0.869 0.116,0.430,0.854 0.116,0.438,0.839 0.115,0.445,0.824 0.113,0.453,0.809 0.109,0.461,0.794 0.105,0.468,0.780 0.099,0.475,0.765 0.093,0.482,0.750 0.086,0.489,0.735 0.080,0.496,0.720 0.075,0.503,0.705 0.071,0.509,0.689 0.071,0.515,0.674 0.074,0.521,0.658 0.080,0.527,0.643 0.089,0.532,0.627 0.100,0.538,0.611 0.113,0.543,0.594 0.126,0.548,0.578 0.139,0.553,0.561 0.152,0.557,0.544 0.164,0.562,0.527 0.175,0.566,0.510 0.185,0.571,0.493 0.194,0.575,0.475 0.202,0.580,0.458 0.209,0.584,0.440 0.215,0.589,0.422 0.220,0.593,0.404 0.224,0.598,0.386 0.227,0.602,0.368 0.230,0.607,0.349 0.232,0.611,0.331 0.233,0.616,0.312 0.234,0.620,0.294 0.236,0.624,0.276 0.237,0.629,0.258 0.239,0.633,0.240 0.241,0.637,0.223 0.244,0.641,0.207 0.249,0.644,0.193 0.254,0.648,0.179 0.261,0.651,0.167 0.268,0.655,0.156 0.277,0.658,0.147 0.286,0.661,0.140 0.297,0.663,0.134 0.307,0.666,0.130 0.318,0.669,0.126 0.329,0.671,0.124 0.340,0.674,0.122 0.351,0.676,0.120 0.362,0.678,0.119 0.373,0.681,0.118 0.384,0.683,0.117 0.394,0.686,0.116 0.405,0.688,0.116 0.415,0.690,0.115 0.425,0.693,0.114 0.435,0.695,0.113 0.445,0.697,0.113 0.455,0.699,0.112 0.465,0.702,0.111 0.474,0.704,0.110 0.484,0.706,0.110 0.493,0.709,0.109 0.503,0.711,0.108 0.512,0.713,0.107 0.521,0.715,0.106 0.531,0.718,0.105 0.540,0.720,0.104 0.549,0.722,0.103 0.558,0.724,0.103 0.567,0.726,0.102 0.576,0.729,0.101 0.585,0.731,0.100 0.594,0.733,0.099 0.603,0.735,0.098 0.611,0.737,0.097 0.620,0.739,0.096 0.629,0.742,0.095 0.638,0.744,0.094 0.646,0.746,0.092 0.655,0.748,0.091 0.663,0.750,0.090 0.672,0.752,0.089 0.681,0.754,0.088 0.689,0.756,0.087 0.698,0.758,0.085 0.706,0.760,0.084 0.715,0.762,0.083 0.723,0.765,0.082 0.732,0.767,0.080 0.740,0.769,0.079 0.748,0.771,0.078 0.757,0.773,0.076 0.765,0.775,0.075 0.774,0.777,0.073 0.782,0.779,0.072 0.790,0.781,0.070 0.799,0.783,0.069 0.807,0.785,0.067 0.815,0.786,0.065 0.824,0.788,0.064 0.832,0.790,0.062 0.840,0.792,0.060 0.849,0.794,0.058 0.857,0.796,0.057 0.865,0.798,0.055 0.874,0.800,0.054 0.882,0.801,0.054 0.890,0.803,0.054 0.898,0.804,0.056 0.907,0.805,0.058 0.915,0.806,0.063 0.923,0.806,0.069 0.930,0.806,0.077 0.938,0.806,0.087 0.945,0.805,0.098 0.951,0.803,0.110 0.957,0.801,0.123 0.963,0.798,0.136 0.968,0.794,0.149 0.972,0.790,0.162 0.975,0.786,0.175 0.978,0.781,0.188 0.980,0.776,0.200 0.982,0.771,0.212 0.984,0.765,0.224 0.985,0.760,0.235 0.986,0.754,0.245 0.987,0.749,0.255 0.988,0.743,0.265 0.989,0.738,0.275 0.990,0.732,0.284 0.991,0.726,0.293 0.991,0.720,0.302 0.992,0.715,0.310 0.993,0.709,0.319 0.993,0.703,0.327 0.994,0.697,0.335 0.994,0.692,0.343 0.995,0.686,0.351 0.995,0.680,0.358 0.996,0.674,0.366 0.996,0.668,0.373 0.996,0.663,0.380 0.997,0.657,0.387 0.997,0.651,0.394 0.997,0.645,0.401 0.998,0.639,0.408 0.998,0.633,0.415 0.998,0.627,0.422 0.998,0.621,0.428 0.998,0.615,0.435 0.998,0.609,0.441 0.999,0.603,0.448 0.999,0.596,0.454 0.999,0.590,0.461 0.999,0.584,0.467 0.999,0.578,0.473 0.998,0.572,0.479 0.998,0.565,0.486 0.998,0.559,0.492 0.998,0.553,0.498 0.998,0.546,0.504 0.998,0.540,0.510 0.997,0.533,0.516 0.997,0.527,0.522 0.997,0.520,0.528 0.997,0.514,0.533 0.996,0.507,0.539 0.996,0.500,0.545 0.995,0.494,0.551 0.995,0.487,0.557 0.995,0.480,0.562 0.994,0.473,0.568 0.993,0.466,0.574 0.993,0.459,0.579 0.992,0.452,0.585 0.992,0.445,0.591 0.991,0.437,0.596 0.990,0.430,0.602 0.990,0.423,0.608 0.989,0.415,0.613 0.988,0.407,0.619 0.987,0.400,0.624 0.986,0.392,0.629 0.986,0.384,0.635 0.985,0.376,0.640 0.984,0.368,0.644 0.983,0.360,0.649 0.982,0.352,0.653 0.981,0.344,0.656 0.980,0.336,0.658 0.979,0.328,0.660 0.978,0.320,0.660 0.976,0.312,0.659 0.975,0.305,0.656 0.974,0.298,0.652 0.973,0.291,0.646 0.972,0.285,0.639 0.970,0.279,0.631 0.969,0.273,0.621 0.968,0.268,0.610 0.966,0.262,0.599 0.965,0.257,0.587 0.963,0.252,0.574 0.961,0.248,0.562 0.959,0.243,0.548 0.958,0.238,0.535 0.956,0.233,0.522 0.954,0.229,0.509 0.951,0.224,0.495 0.949,0.219,0.482 0.947,0.215,0.469 0.945,0.210,0.456 0.942,0.205,0.442 0.940,0.200,0.429 0.937,0.196,0.416 0.935,0.191,0.403 0.932,0.186,0.390 0.929,0.181,0.377 0.926,0.176,0.364 0.923,0.171,0.351 0.921,0.166,0.338 0.918,0.161,0.325 0.915,0.156,0.311 0.911,0.151,0.298 0.908,0.146,0.285 0.905,0.140,0.272 0.902,0.135,0.259 0.898,0.129,0.246 0.895,0.124,0.233 0.892,0.118,0.220 0.888,0.112,0.206 0.885,0.106,0.193 0.881,0.100,0.179 0.877,0.094,0.165 0.874,0.087,0.151 0.870,0.080,0.136 0.866,0.073,0.121 0.862,0.065,0.105 0.859,0.057,0.088 0.855,0.048,0.070 0.851,0.038,0.049 0.847,0.028,0.024 0.843,0.018,0.002 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/CET-R4.csv000066400000000000000000000110001457240071200235200ustar00rootroot000000000000000.015,0.002,0.425 0.015,0.002,0.437 0.016,0.002,0.448 0.016,0.002,0.460 0.016,0.002,0.472 0.017,0.002,0.483 0.017,0.001,0.495 0.017,0.001,0.507 0.017,0.001,0.519 0.018,0.001,0.531 0.018,0.001,0.543 0.018,0.001,0.555 0.018,0.001,0.567 0.019,0.001,0.579 0.019,0.002,0.590 0.020,0.002,0.602 0.020,0.003,0.614 0.021,0.005,0.625 0.021,0.007,0.636 0.022,0.010,0.647 0.023,0.013,0.657 0.024,0.017,0.667 0.025,0.023,0.676 0.027,0.029,0.685 0.028,0.036,0.694 0.030,0.044,0.703 0.032,0.051,0.711 0.034,0.059,0.719 0.036,0.067,0.727 0.038,0.074,0.735 0.040,0.081,0.742 0.042,0.088,0.750 0.044,0.095,0.757 0.045,0.102,0.765 0.047,0.108,0.773 0.049,0.115,0.780 0.050,0.121,0.788 0.052,0.127,0.795 0.053,0.133,0.803 0.055,0.139,0.810 0.056,0.146,0.818 0.057,0.151,0.825 0.059,0.157,0.833 0.060,0.163,0.841 0.061,0.169,0.848 0.062,0.174,0.856 0.063,0.180,0.863 0.064,0.186,0.871 0.065,0.191,0.879 0.066,0.197,0.886 0.067,0.203,0.894 0.068,0.208,0.901 0.069,0.214,0.909 0.071,0.220,0.916 0.072,0.226,0.922 0.074,0.232,0.928 0.077,0.239,0.933 0.080,0.246,0.937 0.084,0.254,0.940 0.089,0.262,0.941 0.094,0.271,0.941 0.099,0.280,0.939 0.104,0.290,0.934 0.110,0.301,0.928 0.114,0.312,0.920 0.119,0.324,0.910 0.122,0.335,0.898 0.123,0.347,0.885 0.124,0.359,0.871 0.123,0.371,0.856 0.120,0.383,0.841 0.115,0.395,0.824 0.109,0.406,0.808 0.101,0.418,0.791 0.091,0.429,0.774 0.079,0.439,0.756 0.066,0.450,0.739 0.051,0.460,0.721 0.037,0.470,0.703 0.026,0.479,0.684 0.021,0.488,0.665 0.022,0.497,0.646 0.030,0.506,0.627 0.045,0.514,0.607 0.063,0.522,0.586 0.081,0.529,0.565 0.099,0.537,0.544 0.115,0.544,0.522 0.129,0.551,0.500 0.142,0.558,0.478 0.153,0.565,0.455 0.163,0.572,0.432 0.171,0.579,0.408 0.177,0.586,0.385 0.181,0.593,0.361 0.184,0.600,0.337 0.187,0.607,0.313 0.188,0.613,0.289 0.189,0.620,0.265 0.191,0.626,0.242 0.193,0.633,0.219 0.195,0.639,0.196 0.200,0.645,0.174 0.206,0.651,0.153 0.214,0.656,0.133 0.224,0.662,0.115 0.235,0.667,0.098 0.248,0.672,0.082 0.262,0.677,0.069 0.276,0.681,0.057 0.291,0.686,0.047 0.306,0.690,0.039 0.321,0.694,0.033 0.337,0.699,0.029 0.351,0.703,0.027 0.366,0.707,0.025 0.381,0.711,0.024 0.395,0.715,0.023 0.409,0.719,0.023 0.423,0.724,0.022 0.437,0.728,0.021 0.450,0.732,0.021 0.464,0.736,0.020 0.477,0.740,0.020 0.490,0.744,0.020 0.503,0.748,0.019 0.515,0.752,0.019 0.528,0.756,0.018 0.541,0.760,0.018 0.553,0.764,0.017 0.566,0.768,0.017 0.578,0.772,0.016 0.590,0.776,0.016 0.602,0.780,0.015 0.615,0.784,0.015 0.627,0.788,0.014 0.639,0.792,0.014 0.651,0.795,0.013 0.663,0.799,0.013 0.674,0.803,0.012 0.686,0.807,0.012 0.698,0.811,0.012 0.710,0.815,0.011 0.722,0.819,0.011 0.733,0.823,0.010 0.745,0.826,0.010 0.757,0.830,0.009 0.769,0.834,0.009 0.780,0.838,0.008 0.792,0.842,0.008 0.803,0.845,0.008 0.815,0.849,0.007 0.827,0.853,0.007 0.838,0.856,0.007 0.850,0.860,0.006 0.861,0.863,0.006 0.873,0.866,0.006 0.884,0.869,0.006 0.895,0.871,0.006 0.906,0.873,0.007 0.916,0.874,0.007 0.926,0.874,0.008 0.935,0.873,0.010 0.943,0.872,0.011 0.950,0.869,0.013 0.957,0.866,0.015 0.962,0.862,0.018 0.967,0.857,0.020 0.971,0.851,0.023 0.974,0.845,0.026 0.977,0.838,0.029 0.979,0.831,0.032 0.980,0.824,0.035 0.981,0.816,0.038 0.982,0.809,0.041 0.983,0.801,0.044 0.984,0.793,0.047 0.984,0.785,0.049 0.985,0.777,0.052 0.985,0.769,0.054 0.985,0.761,0.056 0.986,0.753,0.058 0.986,0.745,0.060 0.986,0.737,0.062 0.986,0.729,0.064 0.987,0.721,0.066 0.987,0.713,0.068 0.987,0.705,0.069 0.987,0.697,0.071 0.987,0.689,0.073 0.987,0.681,0.074 0.987,0.673,0.075 0.987,0.664,0.077 0.987,0.656,0.078 0.987,0.648,0.079 0.987,0.640,0.081 0.987,0.631,0.082 0.987,0.623,0.083 0.987,0.614,0.083 0.987,0.606,0.084 0.987,0.597,0.084 0.987,0.588,0.085 0.987,0.580,0.085 0.987,0.571,0.084 0.987,0.561,0.084 0.988,0.552,0.083 0.988,0.543,0.082 0.989,0.533,0.081 0.990,0.524,0.080 0.990,0.514,0.079 0.991,0.504,0.077 0.992,0.494,0.076 0.992,0.483,0.074 0.993,0.473,0.073 0.994,0.462,0.071 0.994,0.452,0.070 0.995,0.441,0.068 0.995,0.430,0.067 0.996,0.418,0.065 0.996,0.407,0.064 0.997,0.395,0.063 0.997,0.383,0.061 0.997,0.371,0.060 0.998,0.358,0.059 0.998,0.345,0.058 0.998,0.332,0.057 0.998,0.319,0.056 0.998,0.305,0.055 0.997,0.291,0.054 0.996,0.277,0.053 0.995,0.262,0.053 0.993,0.248,0.052 0.991,0.234,0.052 0.989,0.221,0.051 0.985,0.207,0.051 0.981,0.195,0.051 0.977,0.183,0.051 0.972,0.172,0.051 0.966,0.161,0.051 0.960,0.152,0.051 0.953,0.143,0.051 0.947,0.135,0.051 0.939,0.127,0.051 0.932,0.120,0.051 0.925,0.113,0.051 0.917,0.106,0.052 0.910,0.099,0.052 0.902,0.092,0.052 0.895,0.085,0.052 0.887,0.077,0.052 0.880,0.069,0.052 0.872,0.061,0.052 0.864,0.052,0.052 0.857,0.042,0.052 0.849,0.031,0.052 0.842,0.020,0.052 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/PAL-relaxed.hex000066400000000000000000000004341457240071200246620ustar00rootroot00000000000000; PyQtGraph's "relaxed" plot color palette ; This is the darker variant for plotting on a light background ("light mode") ; #f97f10 ; orange #e5bb00 ; yellow #94ab00 ; grass #12a12a ; green #007c8c ; sea #0e56c2 ; blue #813be3 ; indigo #c01188 ; purple #e23512 ; red #f97f10 ; orange pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/PAL-relaxed_bright.hex000066400000000000000000000004341457240071200262210ustar00rootroot00000000000000; PyQtGraph's "relaxed" plot color palette ; This is the brighter variant for plotting on a dark background ("dark mode") ; #ff9d47 ; orange #f7e100 ; yellow #b3cf00 ; grass #1ec23a ; green #00a0b5 ; sea #1f78ff ; blue #a54dff ; indigo #e22ca8 ; purple #ff532b ; red #ff9d47 ; orange pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/cividis.csv000066400000000000000000000163641457240071200242760ustar00rootroot00000000000000; cividis colormap, optimized with consideration for color vision deficiency ; to enable accurate interpretation of scientific data ; ; Published by Jamie R. Nuñez, Christopher R. Anderton and Ryan S. Renslow ; in PLoS ONE 13(7): e0199239. https://doi.org/10.1371/journal.pone.0199239 ; available under Creative Commons CC0 public domain dedication. ; ; You should have received a copy of the CC0 legalcode along with this ; work. If not, see . ; 0.000000,0.126200,0.301500 0.000000,0.129200,0.307700 0.000000,0.132100,0.314200 0.000000,0.135000,0.320500 0.000000,0.137900,0.326900 0.000000,0.140800,0.333400 0.000000,0.143700,0.340000 0.000000,0.146500,0.346700 0.000000,0.149200,0.353700 0.000000,0.151900,0.360600 0.000000,0.154600,0.367600 0.000000,0.157400,0.374600 0.000000,0.160100,0.381700 0.000000,0.162900,0.388800 0.000000,0.165700,0.396000 0.000000,0.168500,0.403100 0.000000,0.171400,0.410200 0.000000,0.174300,0.417200 0.000000,0.177300,0.424100 0.000000,0.179800,0.430700 0.000000,0.181700,0.434700 0.000000,0.183400,0.436300 0.000000,0.185200,0.436800 0.000000,0.187200,0.436800 0.000000,0.190100,0.436500 0.000000,0.193000,0.436100 0.000000,0.195800,0.435600 0.000000,0.198700,0.434900 0.000000,0.201500,0.434300 0.000000,0.204400,0.433600 0.000000,0.207300,0.432900 0.005500,0.210100,0.432200 0.023600,0.213000,0.431400 0.041600,0.215800,0.430800 0.057600,0.218700,0.430100 0.071000,0.221500,0.429300 0.082700,0.224400,0.428700 0.093200,0.227200,0.428000 0.103000,0.230000,0.427400 0.112000,0.232900,0.426800 0.120400,0.235700,0.426200 0.128300,0.238500,0.425600 0.135900,0.241400,0.425100 0.143100,0.244200,0.424500 0.150000,0.247000,0.424100 0.156600,0.249800,0.423600 0.163000,0.252600,0.423200 0.169200,0.255500,0.422800 0.175200,0.258300,0.422400 0.181100,0.261100,0.422000 0.186800,0.263900,0.421700 0.192300,0.266700,0.421400 0.197700,0.269500,0.421200 0.203000,0.272300,0.420900 0.208200,0.275100,0.420700 0.213300,0.278000,0.420500 0.218300,0.280800,0.420400 0.223200,0.283600,0.420300 0.228100,0.286400,0.420200 0.232800,0.289200,0.420100 0.237500,0.292000,0.420000 0.242100,0.294800,0.420000 0.246600,0.297600,0.420000 0.251100,0.300400,0.420100 0.255600,0.303200,0.420100 0.259900,0.306000,0.420200 0.264300,0.308800,0.420300 0.268600,0.311600,0.420500 0.272800,0.314400,0.420600 0.277000,0.317200,0.420800 0.281100,0.320000,0.421000 0.285300,0.322800,0.421200 0.289400,0.325600,0.421500 0.293400,0.328400,0.421800 0.297400,0.331200,0.422100 0.301400,0.334000,0.422400 0.305400,0.336800,0.422700 0.309300,0.339600,0.423100 0.313200,0.342400,0.423600 0.317000,0.345300,0.424000 0.320900,0.348100,0.424400 0.324700,0.350900,0.424900 0.328500,0.353700,0.425400 0.332300,0.356500,0.425900 0.336100,0.359300,0.426400 0.339800,0.362200,0.427000 0.343500,0.365000,0.427600 0.347200,0.367800,0.428200 0.350900,0.370600,0.428800 0.354600,0.373400,0.429400 0.358200,0.376300,0.430200 0.361900,0.379100,0.430800 0.365500,0.381900,0.431600 0.369100,0.384800,0.432200 0.372700,0.387600,0.433100 0.376300,0.390400,0.433800 0.379800,0.393300,0.434600 0.383400,0.396100,0.435500 0.386900,0.399000,0.436400 0.390500,0.401800,0.437200 0.394000,0.404700,0.438100 0.397500,0.407500,0.439000 0.401000,0.410400,0.440000 0.404500,0.413200,0.440900 0.408000,0.416100,0.441900 0.411400,0.418900,0.443000 0.414900,0.421800,0.444000 0.418300,0.424700,0.445000 0.421800,0.427500,0.446200 0.425200,0.430400,0.447300 0.428600,0.433300,0.448500 0.432000,0.436200,0.449600 0.435400,0.439000,0.450800 0.438800,0.441900,0.452100 0.442200,0.444800,0.453400 0.445600,0.447700,0.454700 0.448900,0.450600,0.456100 0.452300,0.453500,0.457500 0.455600,0.456400,0.458900 0.458900,0.459300,0.460400 0.462200,0.462200,0.462000 0.465600,0.465100,0.463500 0.468900,0.468000,0.465000 0.472200,0.470900,0.466500 0.475600,0.473800,0.467900 0.479000,0.476700,0.469100 0.482500,0.479700,0.470100 0.486100,0.482600,0.470700 0.489700,0.485600,0.471400 0.493400,0.488600,0.471900 0.497100,0.491500,0.472300 0.500800,0.494500,0.472700 0.504500,0.497500,0.473000 0.508300,0.500500,0.473200 0.512100,0.503500,0.473400 0.515800,0.506500,0.473600 0.519600,0.509500,0.473700 0.523400,0.512500,0.473800 0.527200,0.515500,0.473900 0.531000,0.518600,0.473900 0.534900,0.521600,0.473800 0.538700,0.524600,0.473900 0.542500,0.527700,0.473800 0.546400,0.530700,0.473600 0.550200,0.533800,0.473500 0.554100,0.536800,0.473300 0.557900,0.539900,0.473200 0.561800,0.543000,0.472900 0.565700,0.546100,0.472700 0.569600,0.549100,0.472300 0.573500,0.552200,0.472000 0.577400,0.555300,0.471700 0.581300,0.558400,0.471400 0.585200,0.561500,0.470900 0.589200,0.564600,0.470500 0.593100,0.567800,0.470100 0.597000,0.570900,0.469600 0.601000,0.574000,0.469100 0.605000,0.577200,0.468500 0.608900,0.580300,0.468000 0.612900,0.583500,0.467300 0.616800,0.586600,0.466800 0.620800,0.589800,0.466200 0.624800,0.592900,0.465500 0.628800,0.596100,0.464900 0.632800,0.599300,0.464100 0.636800,0.602500,0.463200 0.640800,0.605700,0.462500 0.644900,0.608900,0.461700 0.648900,0.612100,0.460900 0.652900,0.615300,0.460000 0.657000,0.618500,0.459100 0.661000,0.621700,0.458300 0.665100,0.625000,0.457300 0.669100,0.628200,0.456200 0.673200,0.631500,0.455300 0.677300,0.634700,0.454300 0.681300,0.638000,0.453200 0.685400,0.641200,0.452100 0.689500,0.644500,0.451100 0.693600,0.647800,0.449900 0.697700,0.651100,0.448700 0.701800,0.654400,0.447500 0.706000,0.657700,0.446300 0.710100,0.661000,0.445000 0.714200,0.664300,0.443700 0.718400,0.667600,0.442400 0.722500,0.671000,0.440900 0.726700,0.674300,0.439600 0.730800,0.677600,0.438200 0.735000,0.681000,0.436800 0.739200,0.684400,0.435200 0.743400,0.687700,0.433800 0.747600,0.691100,0.432200 0.751800,0.694500,0.430700 0.756000,0.697900,0.429000 0.760200,0.701300,0.427300 0.764400,0.704700,0.425800 0.768600,0.708100,0.424100 0.772900,0.711500,0.422300 0.777100,0.715000,0.420500 0.781400,0.718400,0.418800 0.785600,0.721800,0.416800 0.789900,0.725300,0.415000 0.794200,0.728800,0.412900 0.798500,0.732200,0.411100 0.802700,0.735700,0.409000 0.807000,0.739200,0.407000 0.811400,0.742700,0.404900 0.815700,0.746200,0.402800 0.820000,0.749700,0.400700 0.824300,0.753200,0.398400 0.828700,0.756800,0.396100 0.833000,0.760300,0.393800 0.837400,0.763900,0.391500 0.841700,0.767400,0.389200 0.846100,0.771000,0.386900 0.850500,0.774500,0.384300 0.854800,0.778100,0.381800 0.859200,0.781700,0.379300 0.863600,0.785300,0.376600 0.868100,0.788900,0.373900 0.872500,0.792600,0.371200 0.876900,0.796200,0.368400 0.881300,0.799800,0.365700 0.885800,0.803500,0.362700 0.890200,0.807100,0.359900 0.894700,0.810800,0.356900 0.899200,0.814500,0.353800 0.903700,0.818200,0.350700 0.908200,0.821900,0.347400 0.912700,0.825600,0.344200 0.917200,0.829300,0.340900 0.921700,0.833000,0.337400 0.926200,0.836700,0.334000 0.930800,0.840500,0.330600 0.935300,0.844200,0.326800 0.939900,0.848000,0.323200 0.944400,0.851800,0.319500 0.949000,0.855600,0.315500 0.953600,0.859300,0.311600 0.958200,0.863200,0.307600 0.962800,0.867000,0.303400 0.967400,0.870800,0.299000 0.972100,0.874600,0.294700 0.976700,0.878500,0.290100 0.981400,0.882300,0.285600 0.986000,0.886200,0.280700 0.990700,0.890100,0.275900 0.995400,0.894000,0.270800 1.000000,0.897900,0.265500 1.000000,0.901800,0.260000 1.000000,0.905700,0.259300 1.000000,0.909400,0.263400 1.000000,0.913100,0.268000 1.000000,0.916900,0.273100 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/inferno.csv000066400000000000000000000166261457240071200243050ustar00rootroot00000000000000; New matplotlib colormaps by Nathaniel J. Smith, Stefan van der Walt, ; and (in the case of viridis) Eric Firing. ; ; This file and the colormaps in it are released under the CC0 license / ; public domain dedication. The creators would appreciate credit if you use or ; redistribute these colormaps, but do not impose any legal restrictions. ; ; To the extent possible under law, the persons who associated CC0 with ; mpl-colormaps have waived all copyright and related or neighboring rights ; to mpl-colormaps. ; ; You should have received a copy of the CC0 legalcode along with this ; work. If not, see . ; 0.001462,0.000466,0.013866 0.002267,0.001270,0.018570 0.003299,0.002249,0.024239 0.004547,0.003392,0.030909 0.006006,0.004692,0.038558 0.007676,0.006136,0.046836 0.009561,0.007713,0.055143 0.011663,0.009417,0.063460 0.013995,0.011225,0.071862 0.016561,0.013136,0.080282 0.019373,0.015133,0.088767 0.022447,0.017199,0.097327 0.025793,0.019331,0.105930 0.029432,0.021503,0.114621 0.033385,0.023702,0.123397 0.037668,0.025921,0.132232 0.042253,0.028139,0.141141 0.046915,0.030324,0.150164 0.051644,0.032474,0.159254 0.056449,0.034569,0.168414 0.061340,0.036590,0.177642 0.066331,0.038504,0.186962 0.071429,0.040294,0.196354 0.076637,0.041905,0.205799 0.081962,0.043328,0.215289 0.087411,0.044556,0.224813 0.092990,0.045583,0.234358 0.098702,0.046402,0.243904 0.104551,0.047008,0.253430 0.110536,0.047399,0.262912 0.116656,0.047574,0.272321 0.122908,0.047536,0.281624 0.129285,0.047293,0.290788 0.135778,0.046856,0.299776 0.142378,0.046242,0.308553 0.149073,0.045468,0.317085 0.155850,0.044559,0.325338 0.162689,0.043554,0.333277 0.169575,0.042489,0.340874 0.176493,0.041402,0.348111 0.183429,0.040329,0.354971 0.190367,0.039309,0.361447 0.197297,0.038400,0.367535 0.204209,0.037632,0.373238 0.211095,0.037030,0.378563 0.217949,0.036615,0.383522 0.224763,0.036405,0.388129 0.231538,0.036405,0.392400 0.238273,0.036621,0.396353 0.244967,0.037055,0.400007 0.251620,0.037705,0.403378 0.258234,0.038571,0.406485 0.264810,0.039647,0.409345 0.271347,0.040922,0.411976 0.277850,0.042353,0.414392 0.284321,0.043933,0.416608 0.290763,0.045644,0.418637 0.297178,0.047470,0.420491 0.303568,0.049396,0.422182 0.309935,0.051407,0.423721 0.316282,0.053490,0.425116 0.322610,0.055634,0.426377 0.328921,0.057827,0.427511 0.335217,0.060060,0.428524 0.341500,0.062325,0.429425 0.347771,0.064616,0.430217 0.354032,0.066925,0.430906 0.360284,0.069247,0.431497 0.366529,0.071579,0.431994 0.372768,0.073915,0.432400 0.379001,0.076253,0.432719 0.385228,0.078591,0.432955 0.391453,0.080927,0.433109 0.397674,0.083257,0.433183 0.403894,0.085580,0.433179 0.410113,0.087896,0.433098 0.416331,0.090203,0.432943 0.422549,0.092501,0.432714 0.428768,0.094790,0.432412 0.434987,0.097069,0.432039 0.441207,0.099338,0.431594 0.447428,0.101597,0.431080 0.453651,0.103848,0.430498 0.459875,0.106089,0.429846 0.466100,0.108322,0.429125 0.472328,0.110547,0.428334 0.478558,0.112764,0.427475 0.484789,0.114974,0.426548 0.491022,0.117179,0.425552 0.497257,0.119379,0.424488 0.503493,0.121575,0.423356 0.509730,0.123769,0.422156 0.515967,0.125960,0.420887 0.522206,0.128150,0.419549 0.528444,0.130341,0.418142 0.534683,0.132534,0.416667 0.540920,0.134729,0.415123 0.547157,0.136929,0.413511 0.553392,0.139134,0.411829 0.559624,0.141346,0.410078 0.565854,0.143567,0.408258 0.572081,0.145797,0.406369 0.578304,0.148039,0.404411 0.584521,0.150294,0.402385 0.590734,0.152563,0.400290 0.596940,0.154848,0.398125 0.603139,0.157151,0.395891 0.609330,0.159474,0.393589 0.615513,0.161817,0.391219 0.621685,0.164184,0.388781 0.627847,0.166575,0.386276 0.633998,0.168992,0.383704 0.640135,0.171438,0.381065 0.646260,0.173914,0.378359 0.652369,0.176421,0.375586 0.658463,0.178962,0.372748 0.664540,0.181539,0.369846 0.670599,0.184153,0.366879 0.676638,0.186807,0.363849 0.682656,0.189501,0.360757 0.688653,0.192239,0.357603 0.694627,0.195021,0.354388 0.700576,0.197851,0.351113 0.706500,0.200728,0.347777 0.712396,0.203656,0.344383 0.718264,0.206636,0.340931 0.724103,0.209670,0.337424 0.729909,0.212759,0.333861 0.735683,0.215906,0.330245 0.741423,0.219112,0.326576 0.747127,0.222378,0.322856 0.752794,0.225706,0.319085 0.758422,0.229097,0.315266 0.764010,0.232554,0.311399 0.769556,0.236077,0.307485 0.775059,0.239667,0.303526 0.780517,0.243327,0.299523 0.785929,0.247056,0.295477 0.791293,0.250856,0.291390 0.796607,0.254728,0.287264 0.801871,0.258674,0.283099 0.807082,0.262692,0.278898 0.812239,0.266786,0.274661 0.817341,0.270954,0.270390 0.822386,0.275197,0.266085 0.827372,0.279517,0.261750 0.832299,0.283913,0.257383 0.837165,0.288385,0.252988 0.841969,0.292933,0.248564 0.846709,0.297559,0.244113 0.851384,0.302260,0.239636 0.855992,0.307038,0.235133 0.860533,0.311892,0.230606 0.865006,0.316822,0.226055 0.869409,0.321827,0.221482 0.873741,0.326906,0.216886 0.878001,0.332060,0.212268 0.882188,0.337287,0.207628 0.886302,0.342586,0.202968 0.890341,0.347957,0.198286 0.894305,0.353399,0.193584 0.898192,0.358911,0.188860 0.902003,0.364492,0.184116 0.905735,0.370140,0.179350 0.909390,0.375856,0.174563 0.912966,0.381636,0.169755 0.916462,0.387481,0.164924 0.919879,0.393389,0.160070 0.923215,0.399359,0.155193 0.926470,0.405389,0.150292 0.929644,0.411479,0.145367 0.932737,0.417627,0.140417 0.935747,0.423831,0.135440 0.938675,0.430091,0.130438 0.941521,0.436405,0.125409 0.944285,0.442772,0.120354 0.946965,0.449191,0.115272 0.949562,0.455660,0.110164 0.952075,0.462178,0.105031 0.954506,0.468744,0.099874 0.956852,0.475356,0.094695 0.959114,0.482014,0.089499 0.961293,0.488716,0.084289 0.963387,0.495462,0.079073 0.965397,0.502249,0.073859 0.967322,0.509078,0.068659 0.969163,0.515946,0.063488 0.970919,0.522853,0.058367 0.972590,0.529798,0.053324 0.974176,0.536780,0.048392 0.975677,0.543798,0.043618 0.977092,0.550850,0.039050 0.978422,0.557937,0.034931 0.979666,0.565057,0.031409 0.980824,0.572209,0.028508 0.981895,0.579392,0.026250 0.982881,0.586606,0.024661 0.983779,0.593849,0.023770 0.984591,0.601122,0.023606 0.985315,0.608422,0.024202 0.985952,0.615750,0.025592 0.986502,0.623105,0.027814 0.986964,0.630485,0.030908 0.987337,0.637890,0.034916 0.987622,0.645320,0.039886 0.987819,0.652773,0.045581 0.987926,0.660250,0.051750 0.987945,0.667748,0.058329 0.987874,0.675267,0.065257 0.987714,0.682807,0.072489 0.987464,0.690366,0.079990 0.987124,0.697944,0.087731 0.986694,0.705540,0.095694 0.986175,0.713153,0.103863 0.985566,0.720782,0.112229 0.984865,0.728427,0.120785 0.984075,0.736087,0.129527 0.983196,0.743758,0.138453 0.982228,0.751442,0.147565 0.981173,0.759135,0.156863 0.980032,0.766837,0.166353 0.978806,0.774545,0.176037 0.977497,0.782258,0.185923 0.976108,0.789974,0.196018 0.974638,0.797692,0.206332 0.973088,0.805409,0.216877 0.971468,0.813122,0.227658 0.969783,0.820825,0.238686 0.968041,0.828515,0.249972 0.966243,0.836191,0.261534 0.964394,0.843848,0.273391 0.962517,0.851476,0.285546 0.960626,0.859069,0.298010 0.958720,0.866624,0.310820 0.956834,0.874129,0.323974 0.954997,0.881569,0.337475 0.953215,0.888942,0.351369 0.951546,0.896226,0.365627 0.950018,0.903409,0.380271 0.948683,0.910473,0.395289 0.947594,0.917399,0.410665 0.946809,0.924168,0.426373 0.946392,0.930761,0.442367 0.946403,0.937159,0.458592 0.946903,0.943348,0.474970 0.947937,0.949318,0.491426 0.949545,0.955063,0.507860 0.951740,0.960587,0.524203 0.954529,0.965896,0.540361 0.957896,0.971003,0.556275 0.961812,0.975924,0.571925 0.966249,0.980678,0.587206 0.971162,0.985282,0.602154 0.976511,0.989753,0.616760 0.982257,0.994109,0.631017 0.988362,0.998364,0.644924 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/magma.csv000066400000000000000000000166261457240071200237270ustar00rootroot00000000000000; New matplotlib colormaps by Nathaniel J. Smith, Stefan van der Walt, ; and (in the case of viridis) Eric Firing. ; ; This file and the colormaps in it are released under the CC0 license / ; public domain dedication. The creators would appreciate credit if you use or ; redistribute these colormaps, but do not impose any legal restrictions. ; ; To the extent possible under law, the persons who associated CC0 with ; mpl-colormaps have waived all copyright and related or neighboring rights ; to mpl-colormaps. ; ; You should have received a copy of the CC0 legalcode along with this ; work. If not, see . ; 0.001462,0.000466,0.013866 0.002258,0.001295,0.018331 0.003279,0.002305,0.023708 0.004512,0.003490,0.029965 0.005950,0.004843,0.037130 0.007588,0.006356,0.044973 0.009426,0.008022,0.052844 0.011465,0.009828,0.060750 0.013708,0.011771,0.068667 0.016156,0.013840,0.076603 0.018815,0.016026,0.084584 0.021692,0.018320,0.092610 0.024792,0.020715,0.100676 0.028123,0.023201,0.108787 0.031696,0.025765,0.116965 0.035520,0.028397,0.125209 0.039608,0.031090,0.133515 0.043830,0.033830,0.141886 0.048062,0.036607,0.150327 0.052320,0.039407,0.158841 0.056615,0.042160,0.167446 0.060949,0.044794,0.176129 0.065330,0.047318,0.184892 0.069764,0.049726,0.193735 0.074257,0.052017,0.202660 0.078815,0.054184,0.211667 0.083446,0.056225,0.220755 0.088155,0.058133,0.229922 0.092949,0.059904,0.239164 0.097833,0.061531,0.248477 0.102815,0.063010,0.257854 0.107899,0.064335,0.267289 0.113094,0.065492,0.276784 0.118405,0.066479,0.286321 0.123833,0.067295,0.295879 0.129380,0.067935,0.305443 0.135053,0.068391,0.315000 0.140858,0.068654,0.324538 0.146785,0.068738,0.334011 0.152839,0.068637,0.343404 0.159018,0.068354,0.352688 0.165308,0.067911,0.361816 0.171713,0.067305,0.370771 0.178212,0.066576,0.379497 0.184801,0.065732,0.387973 0.191460,0.064818,0.396152 0.198177,0.063862,0.404009 0.204935,0.062907,0.411514 0.211718,0.061992,0.418647 0.218512,0.061158,0.425392 0.225302,0.060445,0.431742 0.232077,0.059889,0.437695 0.238826,0.059517,0.443256 0.245543,0.059352,0.448436 0.252220,0.059415,0.453248 0.258857,0.059706,0.457710 0.265447,0.060237,0.461840 0.271994,0.060994,0.465660 0.278493,0.061978,0.469190 0.284951,0.063168,0.472451 0.291366,0.064553,0.475462 0.297740,0.066117,0.478243 0.304081,0.067835,0.480812 0.310382,0.069702,0.483186 0.316654,0.071690,0.485380 0.322899,0.073782,0.487408 0.329114,0.075972,0.489287 0.335308,0.078236,0.491024 0.341482,0.080564,0.492631 0.347636,0.082946,0.494121 0.353773,0.085373,0.495501 0.359898,0.087831,0.496778 0.366012,0.090314,0.497960 0.372116,0.092816,0.499053 0.378211,0.095332,0.500067 0.384299,0.097855,0.501002 0.390384,0.100379,0.501864 0.396467,0.102902,0.502658 0.402548,0.105420,0.503386 0.408629,0.107930,0.504052 0.414709,0.110431,0.504662 0.420791,0.112920,0.505215 0.426877,0.115395,0.505714 0.432967,0.117855,0.506160 0.439062,0.120298,0.506555 0.445163,0.122724,0.506901 0.451271,0.125132,0.507198 0.457386,0.127522,0.507448 0.463508,0.129893,0.507652 0.469640,0.132245,0.507809 0.475780,0.134577,0.507921 0.481929,0.136891,0.507989 0.488088,0.139186,0.508011 0.494258,0.141462,0.507988 0.500438,0.143719,0.507920 0.506629,0.145958,0.507806 0.512831,0.148179,0.507648 0.519045,0.150383,0.507443 0.525270,0.152569,0.507192 0.531507,0.154739,0.506895 0.537755,0.156894,0.506551 0.544015,0.159033,0.506159 0.550287,0.161158,0.505719 0.556571,0.163269,0.505230 0.562866,0.165368,0.504692 0.569172,0.167454,0.504105 0.575490,0.169530,0.503466 0.581819,0.171596,0.502777 0.588158,0.173652,0.502035 0.594508,0.175701,0.501241 0.600868,0.177743,0.500394 0.607238,0.179779,0.499492 0.613617,0.181811,0.498536 0.620005,0.183840,0.497524 0.626401,0.185867,0.496456 0.632805,0.187893,0.495332 0.639216,0.189921,0.494150 0.645633,0.191952,0.492910 0.652056,0.193986,0.491611 0.658483,0.196027,0.490253 0.664915,0.198075,0.488836 0.671349,0.200133,0.487358 0.677786,0.202203,0.485819 0.684224,0.204286,0.484219 0.690661,0.206384,0.482558 0.697098,0.208501,0.480835 0.703532,0.210638,0.479049 0.709962,0.212797,0.477201 0.716387,0.214982,0.475290 0.722805,0.217194,0.473316 0.729216,0.219437,0.471279 0.735616,0.221713,0.469180 0.742004,0.224025,0.467018 0.748378,0.226377,0.464794 0.754737,0.228772,0.462509 0.761077,0.231214,0.460162 0.767398,0.233705,0.457755 0.773695,0.236249,0.455289 0.779968,0.238851,0.452765 0.786212,0.241514,0.450184 0.792427,0.244242,0.447543 0.798608,0.247040,0.444848 0.804752,0.249911,0.442102 0.810855,0.252861,0.439305 0.816914,0.255895,0.436461 0.822926,0.259016,0.433573 0.828886,0.262229,0.430644 0.834791,0.265540,0.427671 0.840636,0.268953,0.424666 0.846416,0.272473,0.421631 0.852126,0.276106,0.418573 0.857763,0.279857,0.415496 0.863320,0.283729,0.412403 0.868793,0.287728,0.409303 0.874176,0.291859,0.406205 0.879464,0.296125,0.403118 0.884651,0.300530,0.400047 0.889731,0.305079,0.397002 0.894700,0.309773,0.393995 0.899552,0.314616,0.391037 0.904281,0.319610,0.388137 0.908884,0.324755,0.385308 0.913354,0.330052,0.382563 0.917689,0.335500,0.379915 0.921884,0.341098,0.377376 0.925937,0.346844,0.374959 0.929845,0.352734,0.372677 0.933606,0.358764,0.370541 0.937221,0.364929,0.368567 0.940687,0.371224,0.366762 0.944006,0.377643,0.365136 0.947180,0.384178,0.363701 0.950210,0.390820,0.362468 0.953099,0.397563,0.361438 0.955849,0.404400,0.360619 0.958464,0.411324,0.360014 0.960949,0.418323,0.359630 0.963310,0.425390,0.359469 0.965549,0.432519,0.359529 0.967671,0.439703,0.359810 0.969680,0.446936,0.360311 0.971582,0.454210,0.361030 0.973381,0.461520,0.361965 0.975082,0.468861,0.363111 0.976690,0.476226,0.364466 0.978210,0.483612,0.366025 0.979645,0.491014,0.367783 0.981000,0.498428,0.369734 0.982279,0.505851,0.371874 0.983485,0.513280,0.374198 0.984622,0.520713,0.376698 0.985693,0.528148,0.379371 0.986700,0.535582,0.382210 0.987646,0.543015,0.385210 0.988533,0.550446,0.388365 0.989363,0.557873,0.391671 0.990138,0.565296,0.395122 0.990871,0.572706,0.398714 0.991558,0.580107,0.402441 0.992196,0.587502,0.406299 0.992785,0.594891,0.410283 0.993326,0.602275,0.414390 0.993834,0.609644,0.418613 0.994309,0.616999,0.422950 0.994738,0.624350,0.427397 0.995122,0.631696,0.431951 0.995480,0.639027,0.436607 0.995810,0.646344,0.441361 0.996096,0.653659,0.446213 0.996341,0.660969,0.451160 0.996580,0.668256,0.456192 0.996775,0.675541,0.461314 0.996925,0.682828,0.466526 0.997077,0.690088,0.471811 0.997186,0.697349,0.477182 0.997254,0.704611,0.482635 0.997325,0.711848,0.488154 0.997351,0.719089,0.493755 0.997351,0.726324,0.499428 0.997341,0.733545,0.505167 0.997285,0.740772,0.510983 0.997228,0.747981,0.516859 0.997138,0.755190,0.522806 0.997019,0.762398,0.528821 0.996898,0.769591,0.534892 0.996727,0.776795,0.541039 0.996571,0.783977,0.547233 0.996369,0.791167,0.553499 0.996162,0.798348,0.559820 0.995932,0.805527,0.566202 0.995680,0.812706,0.572645 0.995424,0.819875,0.579140 0.995131,0.827052,0.585701 0.994851,0.834213,0.592307 0.994524,0.841387,0.598983 0.994222,0.848540,0.605696 0.993866,0.855711,0.612482 0.993545,0.862859,0.619299 0.993170,0.870024,0.626189 0.992831,0.877168,0.633109 0.992440,0.884330,0.640099 0.992089,0.891470,0.647116 0.991688,0.898627,0.654202 0.991332,0.905763,0.661309 0.990930,0.912915,0.668481 0.990570,0.920049,0.675675 0.990175,0.927196,0.682926 0.989815,0.934329,0.690198 0.989434,0.941470,0.697519 0.989077,0.948604,0.704863 0.988717,0.955742,0.712242 0.988367,0.962878,0.719649 0.988033,0.970012,0.727077 0.987691,0.977154,0.734536 0.987387,0.984288,0.742002 0.987053,0.991438,0.749504 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/plasma.csv000066400000000000000000000166261457240071200241220ustar00rootroot00000000000000; New matplotlib colormaps by Nathaniel J. Smith, Stefan van der Walt, ; and (in the case of viridis) Eric Firing. ; ; This file and the colormaps in it are released under the CC0 license / ; public domain dedication. The creators would appreciate credit if you use or ; redistribute these colormaps, but do not impose any legal restrictions. ; ; To the extent possible under law, the persons who associated CC0 with ; mpl-colormaps have waived all copyright and related or neighboring rights ; to mpl-colormaps. ; ; You should have received a copy of the CC0 legalcode along with this ; work. If not, see . ; 0.050383,0.029803,0.527975 0.063536,0.028426,0.533124 0.075353,0.027206,0.538007 0.086222,0.026125,0.542658 0.096379,0.025165,0.547103 0.105980,0.024309,0.551368 0.115124,0.023556,0.555468 0.123903,0.022878,0.559423 0.132381,0.022258,0.563250 0.140603,0.021687,0.566959 0.148607,0.021154,0.570562 0.156421,0.020651,0.574065 0.164070,0.020171,0.577478 0.171574,0.019706,0.580806 0.178950,0.019252,0.584054 0.186213,0.018803,0.587228 0.193374,0.018354,0.590330 0.200445,0.017902,0.593364 0.207435,0.017442,0.596333 0.214350,0.016973,0.599239 0.221197,0.016497,0.602083 0.227983,0.016007,0.604867 0.234715,0.015502,0.607592 0.241396,0.014979,0.610259 0.248032,0.014439,0.612868 0.254627,0.013882,0.615419 0.261183,0.013308,0.617911 0.267703,0.012716,0.620346 0.274191,0.012109,0.622722 0.280648,0.011488,0.625038 0.287076,0.010855,0.627295 0.293478,0.010213,0.629490 0.299855,0.009561,0.631624 0.306210,0.008902,0.633694 0.312543,0.008239,0.635700 0.318856,0.007576,0.637640 0.325150,0.006915,0.639512 0.331426,0.006261,0.641316 0.337683,0.005618,0.643049 0.343925,0.004991,0.644710 0.350150,0.004382,0.646298 0.356359,0.003798,0.647810 0.362553,0.003243,0.649245 0.368733,0.002724,0.650601 0.374897,0.002245,0.651876 0.381047,0.001814,0.653068 0.387183,0.001434,0.654177 0.393304,0.001114,0.655199 0.399411,0.000859,0.656133 0.405503,0.000678,0.656977 0.411580,0.000577,0.657730 0.417642,0.000564,0.658390 0.423689,0.000646,0.658956 0.429719,0.000831,0.659425 0.435734,0.001127,0.659797 0.441732,0.001540,0.660069 0.447714,0.002080,0.660240 0.453677,0.002755,0.660310 0.459623,0.003574,0.660277 0.465550,0.004545,0.660139 0.471457,0.005678,0.659897 0.477344,0.006980,0.659549 0.483210,0.008460,0.659095 0.489055,0.010127,0.658534 0.494877,0.011990,0.657865 0.500678,0.014055,0.657088 0.506454,0.016333,0.656202 0.512206,0.018833,0.655209 0.517933,0.021563,0.654109 0.523633,0.024532,0.652901 0.529306,0.027747,0.651586 0.534952,0.031217,0.650165 0.540570,0.034950,0.648640 0.546157,0.038954,0.647010 0.551715,0.043136,0.645277 0.557243,0.047331,0.643443 0.562738,0.051545,0.641509 0.568201,0.055778,0.639477 0.573632,0.060028,0.637349 0.579029,0.064296,0.635126 0.584391,0.068579,0.632812 0.589719,0.072878,0.630408 0.595011,0.077190,0.627917 0.600266,0.081516,0.625342 0.605485,0.085854,0.622686 0.610667,0.090204,0.619951 0.615812,0.094564,0.617140 0.620919,0.098934,0.614257 0.625987,0.103312,0.611305 0.631017,0.107699,0.608287 0.636008,0.112092,0.605205 0.640959,0.116492,0.602065 0.645872,0.120898,0.598867 0.650746,0.125309,0.595617 0.655580,0.129725,0.592317 0.660374,0.134144,0.588971 0.665129,0.138566,0.585582 0.669845,0.142992,0.582154 0.674522,0.147419,0.578688 0.679160,0.151848,0.575189 0.683758,0.156278,0.571660 0.688318,0.160709,0.568103 0.692840,0.165141,0.564522 0.697324,0.169573,0.560919 0.701769,0.174005,0.557296 0.706178,0.178437,0.553657 0.710549,0.182868,0.550004 0.714883,0.187299,0.546338 0.719181,0.191729,0.542663 0.723444,0.196158,0.538981 0.727670,0.200586,0.535293 0.731862,0.205013,0.531601 0.736019,0.209439,0.527908 0.740143,0.213864,0.524216 0.744232,0.218288,0.520524 0.748289,0.222711,0.516834 0.752312,0.227133,0.513149 0.756304,0.231555,0.509468 0.760264,0.235976,0.505794 0.764193,0.240396,0.502126 0.768090,0.244817,0.498465 0.771958,0.249237,0.494813 0.775796,0.253658,0.491171 0.779604,0.258078,0.487539 0.783383,0.262500,0.483918 0.787133,0.266922,0.480307 0.790855,0.271345,0.476706 0.794549,0.275770,0.473117 0.798216,0.280197,0.469538 0.801855,0.284626,0.465971 0.805467,0.289057,0.462415 0.809052,0.293491,0.458870 0.812612,0.297928,0.455338 0.816144,0.302368,0.451816 0.819651,0.306812,0.448306 0.823132,0.311261,0.444806 0.826588,0.315714,0.441316 0.830018,0.320172,0.437836 0.833422,0.324635,0.434366 0.836801,0.329105,0.430905 0.840155,0.333580,0.427455 0.843484,0.338062,0.424013 0.846788,0.342551,0.420579 0.850066,0.347048,0.417153 0.853319,0.351553,0.413734 0.856547,0.356066,0.410322 0.859750,0.360588,0.406917 0.862927,0.365119,0.403519 0.866078,0.369660,0.400126 0.869203,0.374212,0.396738 0.872303,0.378774,0.393355 0.875376,0.383347,0.389976 0.878423,0.387932,0.386600 0.881443,0.392529,0.383229 0.884436,0.397139,0.379860 0.887402,0.401762,0.376494 0.890340,0.406398,0.373130 0.893250,0.411048,0.369768 0.896131,0.415712,0.366407 0.898984,0.420392,0.363047 0.901807,0.425087,0.359688 0.904601,0.429797,0.356329 0.907365,0.434524,0.352970 0.910098,0.439268,0.349610 0.912800,0.444029,0.346251 0.915471,0.448807,0.342890 0.918109,0.453603,0.339529 0.920714,0.458417,0.336166 0.923287,0.463251,0.332801 0.925825,0.468103,0.329435 0.928329,0.472975,0.326067 0.930798,0.477867,0.322697 0.933232,0.482780,0.319325 0.935630,0.487712,0.315952 0.937990,0.492667,0.312575 0.940313,0.497642,0.309197 0.942598,0.502639,0.305816 0.944844,0.507658,0.302433 0.947051,0.512699,0.299049 0.949217,0.517763,0.295662 0.951344,0.522850,0.292275 0.953428,0.527960,0.288883 0.955470,0.533093,0.285490 0.957469,0.538250,0.282096 0.959424,0.543431,0.278701 0.961336,0.548636,0.275305 0.963203,0.553865,0.271909 0.965024,0.559118,0.268513 0.966798,0.564396,0.265118 0.968526,0.569700,0.261721 0.970205,0.575028,0.258325 0.971835,0.580382,0.254931 0.973416,0.585761,0.251540 0.974947,0.591165,0.248151 0.976428,0.596595,0.244767 0.977856,0.602051,0.241387 0.979233,0.607532,0.238013 0.980556,0.613039,0.234646 0.981826,0.618572,0.231287 0.983041,0.624131,0.227937 0.984199,0.629718,0.224595 0.985301,0.635330,0.221265 0.986345,0.640969,0.217948 0.987332,0.646633,0.214648 0.988260,0.652325,0.211364 0.989128,0.658043,0.208100 0.989935,0.663787,0.204859 0.990681,0.669558,0.201642 0.991365,0.675355,0.198453 0.991985,0.681179,0.195295 0.992541,0.687030,0.192170 0.993032,0.692907,0.189084 0.993456,0.698810,0.186041 0.993814,0.704741,0.183043 0.994103,0.710698,0.180097 0.994324,0.716681,0.177208 0.994474,0.722691,0.174381 0.994553,0.728728,0.171622 0.994561,0.734791,0.168938 0.994495,0.740880,0.166335 0.994355,0.746995,0.163821 0.994141,0.753137,0.161404 0.993851,0.759304,0.159092 0.993482,0.765499,0.156891 0.993033,0.771720,0.154808 0.992505,0.777967,0.152855 0.991897,0.784239,0.151042 0.991209,0.790537,0.149377 0.990439,0.796859,0.147870 0.989587,0.803205,0.146529 0.988648,0.809579,0.145357 0.987621,0.815978,0.144363 0.986509,0.822401,0.143557 0.985314,0.828846,0.142945 0.984031,0.835315,0.142528 0.982653,0.841812,0.142303 0.981190,0.848329,0.142279 0.979644,0.854866,0.142453 0.977995,0.861432,0.142808 0.976265,0.868016,0.143351 0.974443,0.874622,0.144061 0.972530,0.881250,0.144923 0.970533,0.887896,0.145919 0.968443,0.894564,0.147014 0.966271,0.901249,0.148180 0.964021,0.907950,0.149370 0.961681,0.914672,0.150520 0.959276,0.921407,0.151566 0.956808,0.928152,0.152409 0.954287,0.934908,0.152921 0.951726,0.941671,0.152925 0.949151,0.948435,0.152178 0.946602,0.955190,0.150328 0.944152,0.961916,0.146861 0.941896,0.968590,0.140956 0.940015,0.975158,0.131326 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/turbo.csv000066400000000000000000000144011457240071200237650ustar00rootroot00000000000000; turbo colormap, an improved rainbow colormap enabling high contrast and smooth visualization of data ; Published by Anton Mikhailov et. al. https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html ; SPDX-License-Identifier: Apache-2.0 ; 0.18995,0.07176,0.23217 0.19483,0.08339,0.26149 0.19956,0.09498,0.29024 0.20415,0.10652,0.31844 0.20860,0.11802,0.34607 0.21291,0.12947,0.37314 0.21708,0.14087,0.39964 0.22111,0.15223,0.42558 0.22500,0.16354,0.45096 0.22875,0.17481,0.47578 0.23236,0.18603,0.50004 0.23582,0.19720,0.52373 0.23915,0.20833,0.54686 0.24234,0.21941,0.56942 0.24539,0.23044,0.59142 0.24830,0.24143,0.61286 0.25107,0.25237,0.63374 0.25369,0.26327,0.65406 0.25618,0.27412,0.67381 0.25853,0.28492,0.69300 0.26074,0.29568,0.71162 0.26280,0.30639,0.72968 0.26473,0.31706,0.74718 0.26652,0.32768,0.76412 0.26816,0.33825,0.78050 0.26967,0.34878,0.79631 0.27103,0.35926,0.81156 0.27226,0.36970,0.82624 0.27334,0.38008,0.84037 0.27429,0.39043,0.85393 0.27509,0.40072,0.86692 0.27576,0.41097,0.87936 0.27628,0.42118,0.89123 0.27667,0.43134,0.90254 0.27691,0.44145,0.91328 0.27701,0.45152,0.92347 0.27698,0.46153,0.93309 0.27680,0.47151,0.94214 0.27648,0.48144,0.95064 0.27603,0.49132,0.95857 0.27543,0.50115,0.96594 0.27469,0.51094,0.97275 0.27381,0.52069,0.97899 0.27273,0.53040,0.98461 0.27106,0.54015,0.98930 0.26878,0.54995,0.99303 0.26592,0.55979,0.99583 0.26252,0.56967,0.99773 0.25862,0.57958,0.99876 0.25425,0.58950,0.99896 0.24946,0.59943,0.99835 0.24427,0.60937,0.99697 0.23874,0.61931,0.99485 0.23288,0.62923,0.99202 0.22676,0.63913,0.98851 0.22039,0.64901,0.98436 0.21382,0.65886,0.97959 0.20708,0.66866,0.97423 0.20021,0.67842,0.96833 0.19326,0.68812,0.96190 0.18625,0.69775,0.95498 0.17923,0.70732,0.94761 0.17223,0.71680,0.93981 0.16529,0.72620,0.93161 0.15844,0.73551,0.92305 0.15173,0.74472,0.91416 0.14519,0.75381,0.90496 0.13886,0.76279,0.89550 0.13278,0.77165,0.88580 0.12698,0.78037,0.87590 0.12151,0.78896,0.86581 0.11639,0.79740,0.85559 0.11167,0.80569,0.84525 0.10738,0.81381,0.83484 0.10357,0.82177,0.82437 0.10026,0.82955,0.81389 0.09750,0.83714,0.80342 0.09532,0.84455,0.79299 0.09377,0.85175,0.78264 0.09287,0.85875,0.77240 0.09267,0.86554,0.76230 0.09320,0.87211,0.75237 0.09451,0.87844,0.74265 0.09662,0.88454,0.73316 0.09958,0.89040,0.72393 0.10342,0.89600,0.71500 0.10815,0.90142,0.70599 0.11374,0.90673,0.69651 0.12014,0.91193,0.68660 0.12733,0.91701,0.67627 0.13526,0.92197,0.66556 0.14391,0.92680,0.65448 0.15323,0.93151,0.64308 0.16319,0.93609,0.63137 0.17377,0.94053,0.61938 0.18491,0.94484,0.60713 0.19659,0.94901,0.59466 0.20877,0.95304,0.58199 0.22142,0.95692,0.56914 0.23449,0.96065,0.55614 0.24797,0.96423,0.54303 0.26180,0.96765,0.52981 0.27597,0.97092,0.51653 0.29042,0.97403,0.50321 0.30513,0.97697,0.48987 0.32006,0.97974,0.47654 0.33517,0.98234,0.46325 0.35043,0.98477,0.45002 0.36581,0.98702,0.43688 0.38127,0.98909,0.42386 0.39678,0.99098,0.41098 0.41229,0.99268,0.39826 0.42778,0.99419,0.38575 0.44321,0.99551,0.37345 0.45854,0.99663,0.36140 0.47375,0.99755,0.34963 0.48879,0.99828,0.33816 0.50362,0.99879,0.32701 0.51822,0.99910,0.31622 0.53255,0.99919,0.30581 0.54658,0.99907,0.29581 0.56026,0.99873,0.28623 0.57357,0.99817,0.27712 0.58646,0.99739,0.26849 0.59891,0.99638,0.26038 0.61088,0.99514,0.25280 0.62233,0.99366,0.24579 0.63323,0.99195,0.23937 0.64362,0.98999,0.23356 0.65394,0.98775,0.22835 0.66428,0.98524,0.22370 0.67462,0.98246,0.21960 0.68494,0.97941,0.21602 0.69525,0.97610,0.21294 0.70553,0.97255,0.21032 0.71577,0.96875,0.20815 0.72596,0.96470,0.20640 0.73610,0.96043,0.20504 0.74617,0.95593,0.20406 0.75617,0.95121,0.20343 0.76608,0.94627,0.20311 0.77591,0.94113,0.20310 0.78563,0.93579,0.20336 0.79524,0.93025,0.20386 0.80473,0.92452,0.20459 0.81410,0.91861,0.20552 0.82333,0.91253,0.20663 0.83241,0.90627,0.20788 0.84133,0.89986,0.20926 0.85010,0.89328,0.21074 0.85868,0.88655,0.21230 0.86709,0.87968,0.21391 0.87530,0.87267,0.21555 0.88331,0.86553,0.21719 0.89112,0.85826,0.21880 0.89870,0.85087,0.22038 0.90605,0.84337,0.22188 0.91317,0.83576,0.22328 0.92004,0.82806,0.22456 0.92666,0.82025,0.22570 0.93301,0.81236,0.22667 0.93909,0.80439,0.22744 0.94489,0.79634,0.22800 0.95039,0.78823,0.22831 0.95560,0.78005,0.22836 0.96049,0.77181,0.22811 0.96507,0.76352,0.22754 0.96931,0.75519,0.22663 0.97323,0.74682,0.22536 0.97679,0.73842,0.22369 0.98000,0.73000,0.22161 0.98289,0.72140,0.21918 0.98549,0.71250,0.21650 0.98781,0.70330,0.21358 0.98986,0.69382,0.21043 0.99163,0.68408,0.20706 0.99314,0.67408,0.20348 0.99438,0.66386,0.19971 0.99535,0.65341,0.19577 0.99607,0.64277,0.19165 0.99654,0.63193,0.18738 0.99675,0.62093,0.18297 0.99672,0.60977,0.17842 0.99644,0.59846,0.17376 0.99593,0.58703,0.16899 0.99517,0.57549,0.16412 0.99419,0.56386,0.15918 0.99297,0.55214,0.15417 0.99153,0.54036,0.14910 0.98987,0.52854,0.14398 0.98799,0.51667,0.13883 0.98590,0.50479,0.13367 0.98360,0.49291,0.12849 0.98108,0.48104,0.12332 0.97837,0.46920,0.11817 0.97545,0.45740,0.11305 0.97234,0.44565,0.10797 0.96904,0.43399,0.10294 0.96555,0.42241,0.09798 0.96187,0.41093,0.09310 0.95801,0.39958,0.08831 0.95398,0.38836,0.08362 0.94977,0.37729,0.07905 0.94538,0.36638,0.07461 0.94084,0.35566,0.07031 0.93612,0.34513,0.06616 0.93125,0.33482,0.06218 0.92623,0.32473,0.05837 0.92105,0.31489,0.05475 0.91572,0.30530,0.05134 0.91024,0.29599,0.04814 0.90463,0.28696,0.04516 0.89888,0.27824,0.04243 0.89298,0.26981,0.03993 0.88691,0.26152,0.03753 0.88066,0.25334,0.03521 0.87422,0.24526,0.03297 0.86760,0.23730,0.03082 0.86079,0.22945,0.02875 0.85380,0.22170,0.02677 0.84662,0.21407,0.02487 0.83926,0.20654,0.02305 0.83172,0.19912,0.02131 0.82399,0.19182,0.01966 0.81608,0.18462,0.01809 0.80799,0.17753,0.01660 0.79971,0.17055,0.01520 0.79125,0.16368,0.01387 0.78260,0.15693,0.01264 0.77377,0.15028,0.01148 0.76476,0.14374,0.01041 0.75556,0.13731,0.00942 0.74617,0.13098,0.00851 0.73661,0.12477,0.00769 0.72686,0.11867,0.00695 0.71692,0.11268,0.00629 0.70680,0.10680,0.00571 0.69650,0.10102,0.00522 0.68602,0.09536,0.00481 0.67535,0.08980,0.00449 0.66449,0.08436,0.00424 0.65345,0.07902,0.00408 0.64223,0.07380,0.00401 0.63082,0.06868,0.00401 0.61923,0.06367,0.00410 0.60746,0.05878,0.00427 0.59550,0.05399,0.00453 0.58336,0.04931,0.00486 0.57103,0.04474,0.00529 0.55852,0.04028,0.00579 0.54583,0.03593,0.00638 0.53295,0.03169,0.00705 0.51989,0.02756,0.00780 0.50664,0.02354,0.00863 0.49321,0.01963,0.00955 0.47960,0.01583,0.01055 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/maps/viridis.csv000066400000000000000000000166261457240071200243160ustar00rootroot00000000000000; New matplotlib colormaps by Nathaniel J. Smith, Stefan van der Walt, ; and (in the case of viridis) Eric Firing. ; ; This file and the colormaps in it are released under the CC0 license / ; public domain dedication. The creators would appreciate credit if you use or ; redistribute these colormaps, but do not impose any legal restrictions. ; ; To the extent possible under law, the persons who associated CC0 with ; mpl-colormaps have waived all copyright and related or neighboring rights ; to mpl-colormaps. ; ; You should have received a copy of the CC0 legalcode along with this ; work. If not, see . ; 0.267004,0.004874,0.329415 0.268510,0.009605,0.335427 0.269944,0.014625,0.341379 0.271305,0.019942,0.347269 0.272594,0.025563,0.353093 0.273809,0.031497,0.358853 0.274952,0.037752,0.364543 0.276022,0.044167,0.370164 0.277018,0.050344,0.375715 0.277941,0.056324,0.381191 0.278791,0.062145,0.386592 0.279566,0.067836,0.391917 0.280267,0.073417,0.397163 0.280894,0.078907,0.402329 0.281446,0.084320,0.407414 0.281924,0.089666,0.412415 0.282327,0.094955,0.417331 0.282656,0.100196,0.422160 0.282910,0.105393,0.426902 0.283091,0.110553,0.431554 0.283197,0.115680,0.436115 0.283229,0.120777,0.440584 0.283187,0.125848,0.444960 0.283072,0.130895,0.449241 0.282884,0.135920,0.453427 0.282623,0.140926,0.457517 0.282290,0.145912,0.461510 0.281887,0.150881,0.465405 0.281412,0.155834,0.469201 0.280868,0.160771,0.472899 0.280255,0.165693,0.476498 0.279574,0.170599,0.479997 0.278826,0.175490,0.483397 0.278012,0.180367,0.486697 0.277134,0.185228,0.489898 0.276194,0.190074,0.493001 0.275191,0.194905,0.496005 0.274128,0.199721,0.498911 0.273006,0.204520,0.501721 0.271828,0.209303,0.504434 0.270595,0.214069,0.507052 0.269308,0.218818,0.509577 0.267968,0.223549,0.512008 0.266580,0.228262,0.514349 0.265145,0.232956,0.516599 0.263663,0.237631,0.518762 0.262138,0.242286,0.520837 0.260571,0.246922,0.522828 0.258965,0.251537,0.524736 0.257322,0.256130,0.526563 0.255645,0.260703,0.528312 0.253935,0.265254,0.529983 0.252194,0.269783,0.531579 0.250425,0.274290,0.533103 0.248629,0.278775,0.534556 0.246811,0.283237,0.535941 0.244972,0.287675,0.537260 0.243113,0.292092,0.538516 0.241237,0.296485,0.539709 0.239346,0.300855,0.540844 0.237441,0.305202,0.541921 0.235526,0.309527,0.542944 0.233603,0.313828,0.543914 0.231674,0.318106,0.544834 0.229739,0.322361,0.545706 0.227802,0.326594,0.546532 0.225863,0.330805,0.547314 0.223925,0.334994,0.548053 0.221989,0.339161,0.548752 0.220057,0.343307,0.549413 0.218130,0.347432,0.550038 0.216210,0.351535,0.550627 0.214298,0.355619,0.551184 0.212395,0.359683,0.551710 0.210503,0.363727,0.552206 0.208623,0.367752,0.552675 0.206756,0.371758,0.553117 0.204903,0.375746,0.553533 0.203063,0.379716,0.553925 0.201239,0.383670,0.554294 0.199430,0.387607,0.554642 0.197636,0.391528,0.554969 0.195860,0.395433,0.555276 0.194100,0.399323,0.555565 0.192357,0.403199,0.555836 0.190631,0.407061,0.556089 0.188923,0.410910,0.556326 0.187231,0.414746,0.556547 0.185556,0.418570,0.556753 0.183898,0.422383,0.556944 0.182256,0.426184,0.557120 0.180629,0.429975,0.557282 0.179019,0.433756,0.557430 0.177423,0.437527,0.557565 0.175841,0.441290,0.557685 0.174274,0.445044,0.557792 0.172719,0.448791,0.557885 0.171176,0.452530,0.557965 0.169646,0.456262,0.558030 0.168126,0.459988,0.558082 0.166617,0.463708,0.558119 0.165117,0.467423,0.558141 0.163625,0.471133,0.558148 0.162142,0.474838,0.558140 0.160665,0.478540,0.558115 0.159194,0.482237,0.558073 0.157729,0.485932,0.558013 0.156270,0.489624,0.557936 0.154815,0.493313,0.557840 0.153364,0.497000,0.557724 0.151918,0.500685,0.557587 0.150476,0.504369,0.557430 0.149039,0.508051,0.557250 0.147607,0.511733,0.557049 0.146180,0.515413,0.556823 0.144759,0.519093,0.556572 0.143343,0.522773,0.556295 0.141935,0.526453,0.555991 0.140536,0.530132,0.555659 0.139147,0.533812,0.555298 0.137770,0.537492,0.554906 0.136408,0.541173,0.554483 0.135066,0.544853,0.554029 0.133743,0.548535,0.553541 0.132444,0.552216,0.553018 0.131172,0.555899,0.552459 0.129933,0.559582,0.551864 0.128729,0.563265,0.551229 0.127568,0.566949,0.550556 0.126453,0.570633,0.549841 0.125394,0.574318,0.549086 0.124395,0.578002,0.548287 0.123463,0.581687,0.547445 0.122606,0.585371,0.546557 0.121831,0.589055,0.545623 0.121148,0.592739,0.544641 0.120565,0.596422,0.543611 0.120092,0.600104,0.542530 0.119738,0.603785,0.541400 0.119512,0.607464,0.540218 0.119423,0.611141,0.538982 0.119483,0.614817,0.537692 0.119699,0.618490,0.536347 0.120081,0.622161,0.534946 0.120638,0.625828,0.533488 0.121380,0.629492,0.531973 0.122312,0.633153,0.530398 0.123444,0.636809,0.528763 0.124780,0.640461,0.527068 0.126326,0.644107,0.525311 0.128087,0.647749,0.523491 0.130067,0.651384,0.521608 0.132268,0.655014,0.519661 0.134692,0.658636,0.517649 0.137339,0.662252,0.515571 0.140210,0.665859,0.513427 0.143303,0.669459,0.511215 0.146616,0.673050,0.508936 0.150148,0.676631,0.506589 0.153894,0.680203,0.504172 0.157851,0.683765,0.501686 0.162016,0.687316,0.499129 0.166383,0.690856,0.496502 0.170948,0.694384,0.493803 0.175707,0.697900,0.491033 0.180653,0.701402,0.488189 0.185783,0.704891,0.485273 0.191090,0.708366,0.482284 0.196571,0.711827,0.479221 0.202219,0.715272,0.476084 0.208030,0.718701,0.472873 0.214000,0.722114,0.469588 0.220124,0.725509,0.466226 0.226397,0.728888,0.462789 0.232815,0.732247,0.459277 0.239374,0.735588,0.455688 0.246070,0.738910,0.452024 0.252899,0.742211,0.448284 0.259857,0.745492,0.444467 0.266941,0.748751,0.440573 0.274149,0.751988,0.436601 0.281477,0.755203,0.432552 0.288921,0.758394,0.428426 0.296479,0.761561,0.424223 0.304148,0.764704,0.419943 0.311925,0.767822,0.415586 0.319809,0.770914,0.411152 0.327796,0.773980,0.406640 0.335885,0.777018,0.402049 0.344074,0.780029,0.397381 0.352360,0.783011,0.392636 0.360741,0.785964,0.387814 0.369214,0.788888,0.382914 0.377779,0.791781,0.377939 0.386433,0.794644,0.372886 0.395174,0.797475,0.367757 0.404001,0.800275,0.362552 0.412913,0.803041,0.357269 0.421908,0.805774,0.351910 0.430983,0.808473,0.346476 0.440137,0.811138,0.340967 0.449368,0.813768,0.335384 0.458674,0.816363,0.329727 0.468053,0.818921,0.323998 0.477504,0.821444,0.318195 0.487026,0.823929,0.312321 0.496615,0.826376,0.306377 0.506271,0.828786,0.300362 0.515992,0.831158,0.294279 0.525776,0.833491,0.288127 0.535621,0.835785,0.281908 0.545524,0.838039,0.275626 0.555484,0.840254,0.269281 0.565498,0.842430,0.262877 0.575563,0.844566,0.256415 0.585678,0.846661,0.249897 0.595839,0.848717,0.243329 0.606045,0.850733,0.236712 0.616293,0.852709,0.230052 0.626579,0.854645,0.223353 0.636902,0.856542,0.216620 0.647257,0.858400,0.209861 0.657642,0.860219,0.203082 0.668054,0.861999,0.196293 0.678489,0.863742,0.189503 0.688944,0.865448,0.182725 0.699415,0.867117,0.175971 0.709898,0.868751,0.169257 0.720391,0.870350,0.162603 0.730889,0.871916,0.156029 0.741388,0.873449,0.149561 0.751884,0.874951,0.143228 0.762373,0.876424,0.137064 0.772852,0.877868,0.131109 0.783315,0.879285,0.125405 0.793760,0.880678,0.120005 0.804182,0.882046,0.114965 0.814576,0.883393,0.110347 0.824940,0.884720,0.106217 0.835270,0.886029,0.102646 0.845561,0.887322,0.099702 0.855810,0.888601,0.097452 0.866013,0.889868,0.095953 0.876168,0.891125,0.095250 0.886271,0.892374,0.095374 0.896320,0.893616,0.096335 0.906311,0.894855,0.098125 0.916242,0.896091,0.100717 0.926106,0.897330,0.104071 0.935904,0.898570,0.108131 0.945636,0.899815,0.112838 0.955300,0.901065,0.118128 0.964894,0.902323,0.123941 0.974417,0.903590,0.130215 0.983868,0.904867,0.136897 0.993248,0.906157,0.143936 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/colors/palette.py000066400000000000000000000070131457240071200231660ustar00rootroot00000000000000from ..Qt import QtGui def getQDarkStyleDarkQPalette(): BG_DARK = QtGui.QColor('#19232D') BG_NORMAL = QtGui.QColor('#37414F') BG_LIGHT = QtGui.QColor('#455364') FG_DARK = QtGui.QColor('#9DA9B5') FG_NORMAL = QtGui.QColor('#E0E1E3') FG_LIGHT = QtGui.QColor('#F0F0F0') SEL_DARK = QtGui.QColor('#1A72BB') SEL_NORMAL = QtGui.QColor('#26486B') SEL_LIGHT = QtGui.QColor('#346792') qpal = QtGui.QPalette(QtGui.QColor(BG_DARK)) for ptype in (QtGui.QPalette.Active, QtGui.QPalette.Inactive): qpal.setColor(ptype, QtGui.QPalette.Base, BG_DARK) qpal.setColor(ptype, QtGui.QPalette.Window, BG_DARK) qpal.setColor(ptype, QtGui.QPalette.WindowText, FG_NORMAL) qpal.setColor(ptype, QtGui.QPalette.AlternateBase, BG_LIGHT) qpal.setColor(ptype, QtGui.QPalette.Button, BG_LIGHT) qpal.setColor(ptype, QtGui.QPalette.ButtonText, FG_LIGHT) qpal.setColor(ptype, QtGui.QPalette.Highlight, SEL_LIGHT) qpal.setColor(ptype, QtGui.QPalette.HighlightedText, FG_LIGHT) qpal.setColor(ptype, QtGui.QPalette.Text, FG_LIGHT) qpal.setColor(ptype, QtGui.QPalette.ToolTipBase, BG_LIGHT) qpal.setColor(ptype, QtGui.QPalette.ToolTipText, FG_LIGHT) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.Base, BG_NORMAL) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.Button, BG_NORMAL) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, FG_DARK) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, FG_DARK) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.Text, FG_DARK) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.Highlight, BG_LIGHT) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.HighlightedText, FG_DARK) return qpal def getQDarkStyleLightQPalette(): BG_DARK = QtGui.QColor('#ACB1B6') BG_NORMAL = QtGui.QColor('#E0E1E3') BG_LIGHT = QtGui.QColor('#FAFAFA') FG_DARK = QtGui.QColor('#19223D') FG_NORMAL = QtGui.QColor('#293544') FG_LIGHT = QtGui.QColor('#788D9C') SEL_DARK = QtGui.QColor('#1A72BB') SEL_NORMAL = QtGui.QColor('#26486B') SEL_LIGHT = QtGui.QColor('#9FCBFF') qpal = QtGui.QPalette(QtGui.QColor(BG_LIGHT)) for ptype in (QtGui.QPalette.Active, QtGui.QPalette.Inactive): qpal.setColor(ptype, QtGui.QPalette.Base, BG_LIGHT) qpal.setColor(ptype, QtGui.QPalette.Window, BG_LIGHT) qpal.setColor(ptype, QtGui.QPalette.WindowText, FG_NORMAL) qpal.setColor(ptype, QtGui.QPalette.AlternateBase, BG_NORMAL) qpal.setColor(ptype, QtGui.QPalette.Button, BG_NORMAL) qpal.setColor(ptype, QtGui.QPalette.ButtonText, FG_DARK) qpal.setColor(ptype, QtGui.QPalette.Highlight, SEL_LIGHT) qpal.setColor(ptype, QtGui.QPalette.HighlightedText, FG_DARK) qpal.setColor(ptype, QtGui.QPalette.Text, FG_DARK) qpal.setColor(ptype, QtGui.QPalette.ToolTipBase, BG_DARK) qpal.setColor(ptype, QtGui.QPalette.ToolTipText, FG_DARK) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.Base, BG_NORMAL) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.Button, BG_NORMAL) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, FG_LIGHT) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, FG_LIGHT) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.Text, FG_LIGHT) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.Highlight, SEL_LIGHT) qpal.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.HighlightedText, FG_NORMAL) return qpal pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/configfile.py000066400000000000000000000140721457240071200223370ustar00rootroot00000000000000""" configfile.py - Human-readable text configuration file library Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. Used for reading and writing dictionary objects to a python-like configuration file format. Data structures may be nested and contain any data type as long as it can be converted to/from a string using repr and eval. """ import datetime import os import re import sys from collections import OrderedDict import numpy from . import units from .colormap import ColorMap from .Point import Point from .Qt import QtCore GLOBAL_PATH = None # so not thread safe. class ParseError(Exception): def __init__(self, message, lineNum, line, fileName=None): self.lineNum = lineNum self.line = line self.message = message self.fileName = fileName Exception.__init__(self, message) def __str__(self): if self.fileName is None: msg = "Error parsing string at line %d:\n" % self.lineNum else: msg = "Error parsing config file '%s' at line %d:\n" % (self.fileName, self.lineNum) msg += "%s\n%s" % (self.line, Exception.__str__(self)) return msg def writeConfigFile(data, fname): s = genString(data) with open(fname, 'wt') as fd: fd.write(s) def readConfigFile(fname, **scope): #cwd = os.getcwd() global GLOBAL_PATH if GLOBAL_PATH is not None: fname2 = os.path.join(GLOBAL_PATH, fname) if os.path.exists(fname2): fname = fname2 GLOBAL_PATH = os.path.dirname(os.path.abspath(fname)) local = {**scope, **units.allUnits} local['OrderedDict'] = OrderedDict local['readConfigFile'] = readConfigFile local['Point'] = Point local['QtCore'] = QtCore local['ColorMap'] = ColorMap local['datetime'] = datetime # Needed for reconstructing numpy arrays local['array'] = numpy.array for dtype in ['int8', 'uint8', 'int16', 'uint16', 'float16', 'int32', 'uint32', 'float32', 'int64', 'uint64', 'float64']: local[dtype] = getattr(numpy, dtype) try: #os.chdir(newDir) ## bad. with open(fname, "rt") as fd: s = fd.read() s = s.replace("\r\n", "\n") s = s.replace("\r", "\n") data = parseString(s, **local)[1] except ParseError: sys.exc_info()[1].fileName = fname raise except: print("Error while reading config file %s:"% fname) raise #finally: #os.chdir(cwd) return data def appendConfigFile(data, fname): s = genString(data) with open(fname, 'at') as fd: fd.write(s) def genString(data, indent=''): s = '' for k in data: sk = str(k) if len(sk) == 0: print(data) raise Exception('blank dict keys not allowed (see data above)') if sk[0] == ' ' or ':' in sk: print(data) raise Exception('dict keys must not contain ":" or start with spaces [offending key is "%s"]' % sk) if isinstance(data[k], dict): s += indent + sk + ':\n' s += genString(data[k], indent + ' ') else: s += indent + sk + ': ' + repr(data[k]).replace("\n", "\\\n") + '\n' return s def parseString(lines, start=0, **scope): data = OrderedDict() if isinstance(lines, str): lines = lines.replace("\\\n", "") lines = lines.split('\n') lines = [l for l in lines if re.search(r'\S', l) and not re.match(r'\s*#', l)] ## remove empty lines indent = measureIndent(lines[start]) ln = start - 1 try: while True: ln += 1 #print ln if ln >= len(lines): break l = lines[ln] ## Skip blank lines or lines starting with # if re.match(r'\s*#', l) or not re.search(r'\S', l): continue ## Measure line indentation, make sure it is correct for this level lineInd = measureIndent(l) if lineInd < indent: ln -= 1 break if lineInd > indent: #print lineInd, indent raise ParseError('Indentation is incorrect. Expected %d, got %d' % (indent, lineInd), ln+1, l) if ':' not in l: raise ParseError('Missing colon', ln+1, l) (k, p, v) = l.partition(':') k = k.strip() v = v.strip() ## set up local variables to use for eval if len(k) < 1: raise ParseError('Missing name preceding colon', ln+1, l) if k[0] == '(' and k[-1] == ')': ## If the key looks like a tuple, try evaluating it. try: k1 = eval(k, scope) if type(k1) is tuple: k = k1 except: # If tuple conversion fails, keep the string pass if re.search(r'\S', v) and v[0] != '#': ## eval the value try: val = eval(v, scope) except: ex = sys.exc_info()[1] raise ParseError("Error evaluating expression '%s': [%s: %s]" % (v, ex.__class__.__name__, str(ex)), (ln+1), l) else: if ln+1 >= len(lines) or measureIndent(lines[ln+1]) <= indent: #print "blank dict" val = {} else: #print "Going deeper..", ln+1 (ln, val) = parseString(lines, start=ln+1, **scope) data[k] = val #print k, repr(val) except ParseError: raise except: ex = sys.exc_info()[1] raise ParseError("%s: %s" % (ex.__class__.__name__, str(ex)), ln+1, l) #print "Returning shallower..", ln+1 return (ln, data) def measureIndent(s): n = 0 while n < len(s) and s[n] == ' ': n += 1 return n pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/console/000077500000000000000000000000001457240071200213165ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/console/CmdInput.py000066400000000000000000000026611457240071200234200ustar00rootroot00000000000000from ..Qt import QtCore, QtWidgets class CmdInput(QtWidgets.QLineEdit): sigExecuteCmd = QtCore.Signal(object) def __init__(self, parent): QtWidgets.QLineEdit.__init__(self, parent) self.ps1 = ">>> " self.ps2 = "... " self.history = [""] self.ptr = 0 self.setMultiline(False) def setMultiline(self, ml): if ml: self.setPlaceholderText(self.ps2) else: self.setPlaceholderText(self.ps1) def keyPressEvent(self, ev): if ev.key() == QtCore.Qt.Key.Key_Up: if self.ptr < len(self.history) - 1: self.setHistory(self.ptr+1) ev.accept() return elif ev.key() == QtCore.Qt.Key.Key_Down: if self.ptr > 0: self.setHistory(self.ptr-1) ev.accept() return elif ev.key() in (QtCore.Qt.Key.Key_Return, QtCore.Qt.Key.Key_Enter): self.execCmd() else: super().keyPressEvent(ev) self.history[0] = self.text() def execCmd(self): cmd = self.text() if len(self.history) == 1 or cmd != self.history[1]: self.history.insert(1, cmd) self.history[0] = "" self.setHistory(0) self.sigExecuteCmd.emit(cmd) def setHistory(self, num): self.ptr = num self.setText(self.history[self.ptr]) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/console/Console.py000066400000000000000000000154671457240071200233070ustar00rootroot00000000000000import os import sys import pickle import subprocess from .. import getConfigOption from ..Qt import QtCore, QtWidgets from .repl_widget import ReplWidget from .exception_widget import ExceptionHandlerWidget class ConsoleWidget(QtWidgets.QWidget): """ Widget displaying console output and accepting command input. Implements: - eval python expressions / exec python statements - storable history of commands - exception handling allowing commands to be interpreted in the context of any level in the exception stack frame Why not just use python in an interactive shell (or ipython) ? There are a few reasons: - pyside does not yet allow Qt event processing and interactive shell at the same time - on some systems, typing in the console _blocks_ the qt event loop until the user presses enter. This can be baffling and frustrating to users since it would appear the program has frozen. - some terminals (eg windows cmd.exe) have notoriously unfriendly interfaces - ability to add extra features like exception stack introspection - ability to have multiple interactive prompts, including for spawned sub-processes """ def __init__(self, parent=None, namespace=None, historyFile=None, text=None, editor=None): """ ============== ============================================================================= **Arguments:** namespace dictionary containing the initial variables present in the default namespace historyFile optional file for storing command history text initial text to display in the console window editor optional string for invoking code editor (called when stack trace entries are double-clicked). May contain {fileName} and {lineNum} format keys. Example:: editorCommand --loadfile {fileName} --gotoline {lineNum} ============== ============================================================================= """ QtWidgets.QWidget.__init__(self, parent) self._setupUi() if namespace is None: namespace = {} namespace['__console__'] = self self.localNamespace = namespace self.editor = editor self.output = self.repl.output self.input = self.repl.input self.input.setFocus() if text is not None: self.output.setPlainText(text) self.historyFile = historyFile try: history = self.loadHistory() except Exception as exc: sys.excepthook(*sys.exc_info()) history = None if history is not None: self.input.history = [""] + history self.historyList.addItems(history[::-1]) self.currentTraceback = None def _setupUi(self): self.layout = QtWidgets.QGridLayout(self) self.setLayout(self.layout) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setSpacing(0) self.splitter = QtWidgets.QSplitter(QtCore.Qt.Orientation.Vertical, self) self.layout.addWidget(self.splitter, 0, 0) self.repl = ReplWidget(self.globals, self.locals, self) self.splitter.addWidget(self.repl) self.historyList = QtWidgets.QListWidget(self) self.historyList.hide() self.splitter.addWidget(self.historyList) self.historyBtn = QtWidgets.QPushButton('History', self) self.historyBtn.setCheckable(True) self.repl.inputLayout.addWidget(self.historyBtn) self.repl.sigCommandEntered.connect(self._commandEntered) self.repl.sigCommandRaisedException.connect(self._commandRaisedException) self.excHandler = ExceptionHandlerWidget(self) self.excHandler.hide() self.splitter.addWidget(self.excHandler) self.exceptionBtn = QtWidgets.QPushButton("Exceptions..", self) self.exceptionBtn.setCheckable(True) self.repl.inputLayout.addWidget(self.exceptionBtn) self.excHandler.sigStackItemDblClicked.connect(self._stackItemDblClicked) self.exceptionBtn.toggled.connect(self.excHandler.setVisible) self.historyBtn.toggled.connect(self.historyList.setVisible) self.historyList.itemClicked.connect(self.cmdSelected) self.historyList.itemDoubleClicked.connect(self.cmdDblClicked) def catchAllExceptions(self, catch=True): if catch: self.exceptionBtn.setChecked(True) self.excHandler.catchAllExceptions(catch) def catchNextException(self, catch=True): if catch: self.exceptionBtn.setChecked(True) self.excHandler.catchNextException(catch) def setStack(self, frame=None): self.excHandler.setStack(frame) def loadHistory(self): """Return the list of previously-invoked command strings (or None).""" if self.historyFile is not None and os.path.exists(self.historyFile): with open(self.historyFile, 'rb') as pf: return pickle.load(pf) def saveHistory(self, history): """Store the list of previously-invoked command strings.""" if self.historyFile is not None: with open(self.historyFile, 'wb') as pf: pickle.dump(history, pf) def _commandEntered(self, repl, cmd): self.historyList.addItem(cmd) self.saveHistory(self.input.history[1:100]) sb = self.historyList.verticalScrollBar() sb.setValue(sb.maximum()) def _commandRaisedException(self, repl, exc): self.excHandler.exceptionHandler(exc) def globals(self): frame = self.excHandler.selectedFrame() if frame is not None and self.excHandler.runSelectedFrameCheck.isChecked(): return frame.f_globals else: return self.localNamespace def locals(self): frame = self.excHandler.selectedFrame() if frame is not None and self.excHandler.runSelectedFrameCheck.isChecked(): return frame.f_locals else: return self.localNamespace def cmdSelected(self, item): index = -(self.historyList.row(item)+1) self.input.setHistory(index) self.input.setFocus() def cmdDblClicked(self, item): index = -(self.historyList.row(item)+1) self.input.setHistory(index) self.input.execCmd() def _stackItemDblClicked(self, handler, item): editor = self.editor if editor is None: editor = getConfigOption('editorCommand') if editor is None: return tb = self.excHandler.selectedFrame() lineNum = tb.f_lineno fileName = tb.f_code.co_filename subprocess.Popen(self.editor.format(fileName=fileName, lineNum=lineNum), shell=True) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/console/__init__.py000066400000000000000000000000431457240071200234240ustar00rootroot00000000000000from .Console import ConsoleWidget pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/console/exception_widget.py000066400000000000000000000235431457240071200252400ustar00rootroot00000000000000import sys, re, traceback, threading from .. import exceptionHandling as exceptionHandling from ..Qt import QtWidgets, QtCore from ..functions import SignalBlock from .stackwidget import StackWidget class ExceptionHandlerWidget(QtWidgets.QGroupBox): sigStackItemClicked = QtCore.Signal(object, object) # self, item sigStackItemDblClicked = QtCore.Signal(object, object) # self, item _threadException = QtCore.Signal(object) def __init__(self, parent=None): super().__init__(parent) self._setupUi() self.filterString = '' self._inSystrace = False # send exceptions raised in non-gui threads back to the main thread by signal. self._threadException.connect(self._threadExceptionHandler) def _setupUi(self): self.setTitle("Exception Handling") self.layout = QtWidgets.QGridLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setHorizontalSpacing(2) self.layout.setVerticalSpacing(0) self.clearExceptionBtn = QtWidgets.QPushButton("Clear Stack", self) self.clearExceptionBtn.setEnabled(False) self.layout.addWidget(self.clearExceptionBtn, 0, 6, 1, 1) self.catchAllExceptionsBtn = QtWidgets.QPushButton("Show All Exceptions", self) self.catchAllExceptionsBtn.setCheckable(True) self.layout.addWidget(self.catchAllExceptionsBtn, 0, 1, 1, 1) self.catchNextExceptionBtn = QtWidgets.QPushButton("Show Next Exception", self) self.catchNextExceptionBtn.setCheckable(True) self.layout.addWidget(self.catchNextExceptionBtn, 0, 0, 1, 1) self.onlyUncaughtCheck = QtWidgets.QCheckBox("Only Uncaught Exceptions", self) self.onlyUncaughtCheck.setChecked(True) self.layout.addWidget(self.onlyUncaughtCheck, 0, 4, 1, 1) self.stackTree = StackWidget(self) self.layout.addWidget(self.stackTree, 2, 0, 1, 7) self.runSelectedFrameCheck = QtWidgets.QCheckBox("Run commands in selected stack frame", self) self.runSelectedFrameCheck.setChecked(True) self.layout.addWidget(self.runSelectedFrameCheck, 3, 0, 1, 7) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) self.layout.addItem(spacerItem, 0, 5, 1, 1) self.filterLabel = QtWidgets.QLabel("Filter (regex):", self) self.layout.addWidget(self.filterLabel, 0, 2, 1, 1) self.filterText = QtWidgets.QLineEdit(self) self.layout.addWidget(self.filterText, 0, 3, 1, 1) self.catchAllExceptionsBtn.toggled.connect(self.catchAllExceptions) self.catchNextExceptionBtn.toggled.connect(self.catchNextException) self.clearExceptionBtn.clicked.connect(self.clearExceptionClicked) self.stackTree.itemClicked.connect(self.stackItemClicked) self.stackTree.itemDoubleClicked.connect(self.stackItemDblClicked) self.onlyUncaughtCheck.toggled.connect(self.updateSysTrace) self.filterText.textChanged.connect(self._filterTextChanged) def setStack(self, frame=None): self.clearExceptionBtn.setEnabled(True) self.stackTree.setStack(frame) def setException(self, exc=None, lastFrame=None): self.clearExceptionBtn.setEnabled(True) self.stackTree.setException(exc, lastFrame=lastFrame) def selectedFrame(self): return self.stackTree.selectedFrame() def catchAllExceptions(self, catch=True): """ If True, the console will catch all unhandled exceptions and display the stack trace. Each exception caught clears the last. """ with SignalBlock(self.catchAllExceptionsBtn.toggled, self.catchAllExceptions): self.catchAllExceptionsBtn.setChecked(catch) if catch: with SignalBlock(self.catchNextExceptionBtn.toggled, self.catchNextException): self.catchNextExceptionBtn.setChecked(False) self.enableExceptionHandling() else: self.disableExceptionHandling() def catchNextException(self, catch=True): """ If True, the console will catch the next unhandled exception and display the stack trace. """ with SignalBlock(self.catchNextExceptionBtn.toggled, self.catchNextException): self.catchNextExceptionBtn.setChecked(catch) if catch: with SignalBlock(self.catchAllExceptionsBtn.toggled, self.catchAllExceptions): self.catchAllExceptionsBtn.setChecked(False) self.enableExceptionHandling() else: self.disableExceptionHandling() def enableExceptionHandling(self): exceptionHandling.registerCallback(self.exceptionHandler) self.updateSysTrace() def disableExceptionHandling(self): exceptionHandling.unregisterCallback(self.exceptionHandler) self.updateSysTrace() def clearExceptionClicked(self): self.stackTree.clear() self.clearExceptionBtn.setEnabled(False) def updateSysTrace(self): ## Install or uninstall sys.settrace handler if not self.catchNextExceptionBtn.isChecked() and not self.catchAllExceptionsBtn.isChecked(): if sys.gettrace() == self.systrace: self._disableSysTrace() return if self.onlyUncaughtCheck.isChecked(): if sys.gettrace() == self.systrace: self._disableSysTrace() else: if sys.gettrace() not in (None, self.systrace): self.onlyUncaughtCheck.setChecked(False) raise Exception("sys.settrace is in use (are you using another debugger?); cannot monitor for caught exceptions.") else: self._enableSysTrace() def _enableSysTrace(self): # set global trace function # note: this has no effect on pre-existing frames or threads # until settrace_all_threads arrives in python 3.12. sys.settrace(self.systrace) # affects current thread only threading.settrace(self.systrace) # affects new threads only if hasattr(threading, 'settrace_all_threads'): threading.settrace_all_threads(self.systrace) def _disableSysTrace(self): sys.settrace(None) threading.settrace(None) if hasattr(threading, 'settrace_all_threads'): threading.settrace_all_threads(None) def exceptionHandler(self, excInfo, lastFrame=None): if isinstance(excInfo, Exception): exc = excInfo else: exc = excInfo.exc_value # exceptions raised in non-gui threads must be sent to the gui thread by signal isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread() if not isGuiThread: # note: we are giving the user the ability to modify a frame owned by another thread.. # expect trouble :) self._threadException.emit((excInfo, lastFrame)) return if self.catchNextExceptionBtn.isChecked(): self.catchNextExceptionBtn.setChecked(False) elif not self.catchAllExceptionsBtn.isChecked(): return self.setException(exc, lastFrame=lastFrame) def _threadExceptionHandler(self, args): self.exceptionHandler(*args) def systrace(self, frame, event, arg): if event != 'exception': return self.systrace if self._inSystrace: # prevent recursve calling return self.systrace self._inSystrace = True try: if self.checkException(*arg): # note: the exception has no __traceback__ at this point! self.exceptionHandler(arg[1], lastFrame=frame) except Exception as exc: print("Exception in systrace:") traceback.print_exc() finally: self.inSystrace = False return self.systrace def checkException(self, excType, exc, tb): ## Return True if the exception is interesting; False if it should be ignored. filename = tb.tb_frame.f_code.co_filename function = tb.tb_frame.f_code.co_name filterStr = self.filterString if filterStr != '': if isinstance(exc, Exception): msg = traceback.format_exception_only(type(exc), exc) elif isinstance(exc, str): msg = exc else: msg = repr(exc) match = re.search(filterStr, "%s:%s:%s" % (filename, function, msg)) return match is not None ## Go through a list of common exception points we like to ignore: if excType is GeneratorExit or excType is StopIteration: return False if excType is AttributeError: if filename.endswith('numpy/core/fromnumeric.py') and function in ('all', '_wrapit', 'transpose', 'sum'): return False if filename.endswith('numpy/core/arrayprint.py') and function in ('_array2string'): return False if filename.endswith('MetaArray.py') and function == '__getattr__': for name in ('__array_interface__', '__array_struct__', '__array__'): ## numpy looks for these when converting objects to array if name in exc: return False if filename.endswith('flowchart/eq.py'): return False if excType is TypeError: if filename.endswith('numpy/lib/function_base.py') and function == 'iterable': return False return True def stackItemClicked(self, item): self.sigStackItemClicked.emit(self, item) def stackItemDblClicked(self, item): self.sigStackItemDblClicked.emit(self, item) def _filterTextChanged(self, value): self.filterString = str(value) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/console/repl_widget.py000066400000000000000000000170371457240071200242050ustar00rootroot00000000000000import code, sys, traceback from ..Qt import QtWidgets, QtGui, QtCore from ..functions import mkBrush from .CmdInput import CmdInput class ReplWidget(QtWidgets.QWidget): sigCommandEntered = QtCore.Signal(object, object) # self, command sigCommandRaisedException = QtCore.Signal(object, object) # self, exc def __init__(self, globals, locals, parent=None): self.globals = globals self.locals = locals self._lastCommandRow = None self._commandBuffer = [] # buffer to hold multiple lines of input self.stdoutInterceptor = StdoutInterceptor(self.write) self.ps1 = ">>> " self.ps2 = "... " QtWidgets.QWidget.__init__(self, parent=parent) self._setupUi() # define text styles isDark = self.output.palette().color(QtGui.QPalette.ColorRole.Base).value() < 128 outputBlockFormat = QtGui.QTextBlockFormat() outputFirstLineBlockFormat = QtGui.QTextBlockFormat(outputBlockFormat) outputFirstLineBlockFormat.setTopMargin(5) outputCharFormat = QtGui.QTextCharFormat() outputCharFormat.setFontWeight(QtGui.QFont.Weight.Normal) cmdBlockFormat = QtGui.QTextBlockFormat() cmdBlockFormat.setBackground(mkBrush("#335" if isDark else "#CCF")) cmdCharFormat = QtGui.QTextCharFormat() cmdCharFormat.setFontWeight(QtGui.QFont.Weight.Bold) self.textStyles = { 'command': (cmdCharFormat, cmdBlockFormat), 'output': (outputCharFormat, outputBlockFormat), 'output_first_line': (outputCharFormat, outputFirstLineBlockFormat), } self.input.ps1 = self.ps1 self.input.ps2 = self.ps2 def _setupUi(self): self.layout = QtWidgets.QVBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setSpacing(0) self.setLayout(self.layout) self.output = QtWidgets.QTextEdit(self) font = QtGui.QFont() font.setFamily("Courier New") font.setStyleStrategy(QtGui.QFont.StyleStrategy.PreferAntialias) self.output.setFont(font) self.output.setReadOnly(True) self.layout.addWidget(self.output) # put input box in a horizontal layout so we can easily place buttons at the end self.inputWidget = QtWidgets.QWidget(self) self.layout.addWidget(self.inputWidget) self.inputLayout = QtWidgets.QHBoxLayout() self.inputWidget.setLayout(self.inputLayout) self.inputLayout.setContentsMargins(0, 0, 0, 0) self.input = CmdInput(parent=self) self.inputLayout.addWidget(self.input) self.input.sigExecuteCmd.connect(self.runCmd) def runCmd(self, cmd): if '\n' in cmd: for line in cmd.split('\n'): self.runCmd(line) return if len(self._commandBuffer) == 0: self.write(f"{self.ps1}{cmd}\n", style='command') else: self.write(f"{self.ps2}{cmd}\n", style='command') self.sigCommandEntered.emit(self, cmd) self._commandBuffer.append(cmd) fullcmd = '\n'.join(self._commandBuffer) try: cmdCode = code.compile_command(fullcmd) self.input.setMultiline(False) except Exception: # cannot continue processing this command; reset and print exception self._commandBuffer = [] self.displayException() self.input.setMultiline(False) else: if cmdCode is None: # incomplete input; wait for next line self.input.setMultiline(True) return self._commandBuffer = [] # run command try: with self.stdoutInterceptor: exec(cmdCode, self.globals(), self.locals()) except Exception as exc: self.displayException() self.sigCommandRaisedException.emit(self, exc) # Add a newline if the output did not cursor = self.output.textCursor() if cursor.columnNumber() > 0: self.write('\n') def write(self, strn, style='output', scrollToBottom='auto'): """Write a string into the console. If scrollToBottom is 'auto', then the console is automatically scrolled to fit the new text only if it was already at the bottom. """ isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread() if not isGuiThread: sys.__stdout__.write(strn) return cursor = self.output.textCursor() cursor.movePosition(QtGui.QTextCursor.MoveOperation.End) self.output.setTextCursor(cursor) sb = self.output.verticalScrollBar() scroll = sb.value() if scrollToBottom == 'auto': atBottom = scroll == sb.maximum() scrollToBottom = atBottom row = cursor.blockNumber() if style == 'command': self._lastCommandRow = row if style == 'output' and row == self._lastCommandRow + 1: # adjust style for first line of output firstLine, endl, strn = strn.partition('\n') self._setTextStyle('output_first_line') self.output.insertPlainText(firstLine + endl) if len(strn) > 0: self._setTextStyle(style) self.output.insertPlainText(strn) # return to output style immediately to avoid seeing an extra line of command style if style != 'output': self._setTextStyle('output') if scrollToBottom: sb.setValue(sb.maximum()) else: sb.setValue(scroll) def displayException(self): """ Display the current exception and stack. """ tb = traceback.format_exc() lines = [] indent = 4 prefix = '' for l in tb.split('\n'): lines.append(" "*indent + prefix + l) self.write('\n'.join(lines)) def _setTextStyle(self, style): charFormat, blockFormat = self.textStyles[style] cursor = self.output.textCursor() cursor.setBlockFormat(blockFormat) self.output.setCurrentCharFormat(charFormat) class StdoutInterceptor: """Used to temporarily redirect writes meant for sys.stdout and sys.stderr to a new location """ def __init__(self, writeFn): self._orig_stdout = None self._orig_stderr = None self.writeFn = writeFn def realOutputFiles(self): """Return the real sys.stdout and stderr (which are sometimes masked while running commands) """ return ( self._orig_stdout or sys.stdout, self._orig_stderr or sys.stderr ) def print(self, *args): """Print to real stdout (for debugging) """ self.realOutputFiles()[0].write(' '.join(map(str, args)) + "\n") def flush(self): # Need to implement this since we temporarily occlude sys.stdout pass def fileno(self): # Need to implement this since we temporarily occlude sys.stdout, and someone may be looking for it (faulthandler, for example) return 1 def write(self, strn): self.writeFn(strn) def __enter__(self): self._orig_stdout = sys.stdout self._orig_stderr = sys.stderr sys.stdout = self sys.stderr = self def __exit__(self, exc_type, exc_val, exc_tb): sys.stdout = self._orig_stdout sys.stderr = self._orig_stderr self._orig_stdout = None self._orig_stderr = None pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/console/stackwidget.py000066400000000000000000000122761457240071200242110ustar00rootroot00000000000000import sys, traceback from ..Qt import QtWidgets, QtGui class StackWidget(QtWidgets.QTreeWidget): def __init__(self, parent=None): QtWidgets.QTreeWidget.__init__(self, parent) self.setAlternatingRowColors(True) self.setHeaderHidden(True) def selectedFrame(self): """Return the currently selected stack frame (or None if there is no selection) """ sel = self.selectedItems() if len(sel) == 0: return None else: return sel[0].frame def clear(self): QtWidgets.QTreeWidget.clear(self) self.frames = [] def setException(self, exc=None, lastFrame=None): """Display an exception chain with its tracebacks and call stack. """ if exc is None: exc = sys.exc_info()[1] self.clear() exceptions = exceptionChain(exc) for ex, cause in exceptions: stackFrames, tbFrames = stacksFromTraceback(ex.__traceback__, lastFrame=lastFrame) catchMsg = textItem("Exception caught here") excStr = ''.join(traceback.format_exception_only(type(ex), ex)).strip() items = makeItemTree(stackFrames + [catchMsg] + tbFrames, excStr) self.addTopLevelItem(items[0]) if cause is not None: if cause == 'cause': causeItem = textItem("The above exception was the direct cause of the following exception:") elif cause == 'context': causeItem = textItem("During handling of the above exception, another exception occurred:") self.addTopLevelItem(causeItem) items[0].setExpanded(True) def setStack(self, frame=None, expand=True, lastFrame=None): """Display a call stack and exception traceback. This allows the user to probe the contents of any frame in the given stack. *frame* may either be a Frame instance or None, in which case the current frame is retrieved from ``sys._getframe()``. If *tb* is provided then the frames in the traceback will be appended to the end of the stack list. If *tb* is None, then sys.exc_info() will be checked instead. """ if frame is None: frame = sys._getframe().f_back self.clear() stack = stackFromFrame(frame, lastFrame=lastFrame) items = makeItemTree(stack, "Call stack") self.addTopLevelItem(items[0]) if expand: items[0].setExpanded(True) def stackFromFrame(frame, lastFrame=None): """Return (text, stack_frame) for the entire stack ending at *frame* If *lastFrame* is given and present in the stack, then the stack is truncated at that frame. """ lines = traceback.format_stack(frame) frames = [] while frame is not None: frames.insert(0, frame) frame = frame.f_back if lastFrame is not None and lastFrame in frames: frames = frames[:frames.index(lastFrame)+1] return list(zip(lines[:len(frames)], frames)) def stacksFromTraceback(tb, lastFrame=None): """Return (text, stack_frame) for a traceback and the stack preceding it If *lastFrame* is given and present in the stack, then the stack is truncated at that frame. """ # get stack before tb stack = stackFromFrame(tb.tb_frame.f_back if tb is not None else lastFrame) if tb is None: return stack, [] # walk to last frame of traceback lines = traceback.format_tb(tb) frames = [] while True: frames.append(tb.tb_frame) if tb.tb_next is None or tb.tb_frame is lastFrame: break tb = tb.tb_next return stack, list(zip(lines[:len(frames)], frames)) def makeItemTree(stack, title): topItem = QtWidgets.QTreeWidgetItem([title]) topItem.frame = None font = topItem.font(0) font.setWeight(font.Weight.Bold) topItem.setFont(0, font) items = [topItem] for entry in stack: if isinstance(entry, QtWidgets.QTreeWidgetItem): item = entry else: text, frame = entry item = QtWidgets.QTreeWidgetItem([text.rstrip()]) item.frame = frame topItem.addChild(item) items.append(item) return items def exceptionChain(exc): """Return a list of (exception, 'cause'|'context') pairs for exceptions leading up to *exc* """ exceptions = [(exc, None)] while True: # walk through chained exceptions if exc.__cause__ is not None: exc = exc.__cause__ exceptions.insert(0, (exc, 'cause')) elif exc.__context__ is not None and exc.__suppress_context__ is False: exc = exc.__context__ exceptions.insert(0, (exc, 'context')) else: break return exceptions def textItem(text): """Return a tree item with no associated stack frame and a darker background color """ item = QtWidgets.QTreeWidgetItem([text]) item.frame = None item.setBackground(0, QtGui.QBrush(QtGui.QColor(220, 220, 220))) item.setForeground(0, QtGui.QBrush(QtGui.QColor(0, 0, 0))) item.setChildIndicatorPolicy(item.ChildIndicatorPolicy.DontShowIndicator) return item pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/debug.py000066400000000000000000001235741457240071200213300ustar00rootroot00000000000000""" debug.py - Functions to aid in debugging Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. """ from __future__ import print_function import contextlib import cProfile import gc import inspect import os import re import sys import threading import time import traceback import types import warnings import weakref from time import perf_counter from numpy import ndarray from .Qt import QT_LIB, QtCore from .util import cprint from .util.mutex import Mutex # credit to Wolph: https://stackoverflow.com/a/17603000 @contextlib.contextmanager def open_maybe_console(filename=None): fh = sys.stdout if filename is None else open(filename, "w", encoding='utf-8') try: yield fh finally: if fh is not sys.stdout: fh.close() __ftraceDepth = 0 def ftrace(func): """Decorator used for marking the beginning and end of function calls. Automatically indents nested calls. """ def w(*args, **kargs): global __ftraceDepth pfx = " " * __ftraceDepth print(pfx + func.__name__ + " start") __ftraceDepth += 1 try: rv = func(*args, **kargs) finally: __ftraceDepth -= 1 print(pfx + func.__name__ + " done") return rv return w class Tracer(object): """ Prints every function enter/exit. Useful for debugging crashes / lockups. """ def __init__(self): self.count = 0 self.stack = [] def trace(self, frame, event, arg): self.count += 1 # If it has been a long time since we saw the top of the stack, # print a reminder if self.count % 1000 == 0: print("----- current stack: -----") for line in self.stack: print(line) if event == 'call': line = " " * len(self.stack) + ">> " + self.frameInfo(frame) print(line) self.stack.append(line) elif event == 'return': self.stack.pop() line = " " * len(self.stack) + "<< " + self.frameInfo(frame) print(line) if len(self.stack) == 0: self.count = 0 return self.trace def stop(self): sys.settrace(None) def start(self): sys.settrace(self.trace) def frameInfo(self, fr): filename = fr.f_code.co_filename funcname = fr.f_code.co_name lineno = fr.f_lineno callfr = sys._getframe(3) callline = "%s %d" % (callfr.f_code.co_name, callfr.f_lineno) args, _, _, value_dict = inspect.getargvalues(fr) if len(args) and args[0] == 'self': instance = value_dict.get('self', None) if instance is not None: cls = getattr(instance, '__class__', None) if cls is not None: funcname = cls.__name__ + "." + funcname return "%s: %s %s: %s" % (callline, filename, lineno, funcname) def warnOnException(func): """Decorator that catches/ignores exceptions and prints a stack trace.""" def w(*args, **kwds): try: func(*args, **kwds) except: printExc('Ignored exception:') return w def getExc(indent=4, prefix='| ', skip=1): lines = formatException(*sys.exc_info(), skip=skip) lines2 = [] for l in lines: lines2.extend(l.strip('\n').split('\n')) lines3 = [" "*indent + prefix + l for l in lines2] return '\n'.join(lines3) def printExc(msg='', indent=4, prefix='|'): """Print an error message followed by an indented exception backtrace (This function is intended to be called within except: blocks)""" exc = getExc(indent=0, prefix="", skip=2) # print(" "*indent + prefix + '='*30 + '>>') warnings.warn("\n".join([msg, exc]), RuntimeWarning, stacklevel=2) # print(" "*indent + prefix + '='*30 + '<<') def printTrace(msg='', indent=4, prefix='|'): """Print an error message followed by an indented stack trace""" trace = backtrace(1) #exc = getExc(indent, prefix + ' ') print("[%s] %s\n" % (time.strftime("%H:%M:%S"), msg)) print(" "*indent + prefix + '='*30 + '>>') for line in trace.split('\n'): print(" "*indent + prefix + " " + line) print(" "*indent + prefix + '='*30 + '<<') def backtrace(skip=0): return ''.join(traceback.format_stack()[:-(skip+1)]) def formatException(exctype, value, tb, skip=0): """Return a list of formatted exception strings. Similar to traceback.format_exception, but displays the entire stack trace rather than just the portion downstream of the point where the exception is caught. In particular, unhandled exceptions that occur during Qt signal handling do not usually show the portion of the stack that emitted the signal. """ lines = traceback.format_exception(exctype, value, tb) lines = [lines[0]] + traceback.format_stack()[:-(skip+1)] + [' --- exception caught here ---\n'] + lines[1:] return lines def printException(exctype, value, traceback): """Print an exception with its full traceback. Set `sys.excepthook = printException` to ensure that exceptions caught inside Qt signal handlers are printed with their full stack trace. """ print(''.join(formatException(exctype, value, traceback, skip=1))) def listObjs(regex='Q', typ=None): """List all objects managed by python gc with class name matching regex. Finds 'Q...' classes by default.""" if typ is not None: return [x for x in gc.get_objects() if isinstance(x, typ)] else: return [x for x in gc.get_objects() if re.match(regex, type(x).__name__)] def findRefPath(startObj, endObj, maxLen=8, restart=True, seen=None, path=None, ignore=None): """Determine all paths of object references from startObj to endObj""" refs = [] if path is None: path = [endObj] if ignore is None: ignore = {} if seen is None: seen = {} ignore[id(sys._getframe())] = None ignore[id(path)] = None ignore[id(seen)] = None prefix = " "*(8-maxLen) #print prefix + str(map(type, path)) prefix += " " if restart: #gc.collect() seen.clear() gc.collect() newRefs = [r for r in gc.get_referrers(endObj) if id(r) not in ignore] ignore[id(newRefs)] = None #fo = allFrameObjs() #newRefs = [] #for r in gc.get_referrers(endObj): #try: #if r not in fo: #newRefs.append(r) #except: #newRefs.append(r) for r in newRefs: #print prefix+"->"+str(type(r)) if type(r).__name__ in ['frame', 'function', 'listiterator']: #print prefix+" FRAME" continue try: if any(r is x for x in path): #print prefix+" LOOP", objChainString([r]+path) continue except: print(r) print(path) raise if r is startObj: refs.append([r]) print(refPathString([startObj]+path)) continue if maxLen == 0: #print prefix+" END:", objChainString([r]+path) continue ## See if we have already searched this node. ## If not, recurse. tree = None try: cache = seen[id(r)] if cache[0] >= maxLen: tree = cache[1] for p in tree: print(refPathString(p+path)) except KeyError: pass ignore[id(tree)] = None if tree is None: tree = findRefPath(startObj, r, maxLen-1, restart=False, path=[r]+path, ignore=ignore) seen[id(r)] = [maxLen, tree] ## integrate any returned results if len(tree) == 0: #print prefix+" EMPTY TREE" continue else: for p in tree: refs.append(p+[r]) #seen[id(r)] = [maxLen, refs] return refs def objString(obj): """Return a short but descriptive string for any object""" try: if type(obj) in [int, float]: return str(obj) elif isinstance(obj, dict): if len(obj) > 5: return "" % (",".join(list(obj.keys())[:5])) else: return "" % (",".join(list(obj.keys()))) elif isinstance(obj, str): if len(obj) > 50: return '"%s..."' % obj[:50] else: return obj[:] elif isinstance(obj, ndarray): return "" % (str(obj.dtype), str(obj.shape)) elif hasattr(obj, '__len__'): if len(obj) > 5: return "<%s [%s,...]>" % (type(obj).__name__, ",".join([type(o).__name__ for o in obj[:5]])) else: return "<%s [%s]>" % (type(obj).__name__, ",".join([type(o).__name__ for o in obj])) else: return "<%s %s>" % (type(obj).__name__, obj.__class__.__name__) except: return str(type(obj)) def refPathString(chain): """Given a list of adjacent objects in a reference path, print the 'natural' path names (ie, attribute names, keys, and indexes) that follow from one object to the next .""" s = objString(chain[0]) i = 0 while i < len(chain)-1: #print " -> ", i i += 1 o1 = chain[i-1] o2 = chain[i] cont = False if isinstance(o1, list) or isinstance(o1, tuple): if any(o2 is x for x in o1): s += "[%d]" % o1.index(o2) continue #print " not list" if isinstance(o2, dict) and hasattr(o1, '__dict__') and o2 == o1.__dict__: i += 1 if i >= len(chain): s += ".__dict__" continue o3 = chain[i] for k in o2: if o2[k] is o3: s += '.%s' % k cont = True continue #print " not __dict__" if isinstance(o1, dict): try: if o2 in o1: s += "[key:%s]" % objString(o2) continue except TypeError: pass for k in o1: if o1[k] is o2: s += "[%s]" % objString(k) cont = True continue #print " not dict" #for k in dir(o1): ## Not safe to request attributes like this. #if getattr(o1, k) is o2: #s += ".%s" % k #cont = True #continue #print " not attr" if cont: continue s += " ? " sys.stdout.flush() return s def objectSize(obj, ignore=None, verbose=False, depth=0, recursive=False): """Guess how much memory an object is using""" ignoreTypes = ['MethodType', 'UnboundMethodType', 'BuiltinMethodType', 'FunctionType', 'BuiltinFunctionType'] ignoreTypes = [getattr(types, key) for key in ignoreTypes if hasattr(types, key)] ignoreRegex = re.compile('(method-wrapper|Flag|ItemChange|Option|Mode)') if ignore is None: ignore = {} indent = ' '*depth try: hash(obj) hsh = obj except: hsh = "%s:%d" % (str(type(obj)), id(obj)) if hsh in ignore: return 0 ignore[hsh] = 1 try: size = sys.getsizeof(obj) except TypeError: size = 0 if isinstance(obj, ndarray): try: size += len(obj.data) except: pass if recursive: if type(obj) in [list, tuple]: if verbose: print(indent+"list:") for o in obj: s = objectSize(o, ignore=ignore, verbose=verbose, depth=depth+1) if verbose: print(indent+' +', s) size += s elif isinstance(obj, dict): if verbose: print(indent+"list:") for k in obj: s = objectSize(obj[k], ignore=ignore, verbose=verbose, depth=depth+1) if verbose: print(indent+' +', k, s) size += s #elif isinstance(obj, QtCore.QObject): #try: #childs = obj.children() #if verbose: #print indent+"Qt children:" #for ch in childs: #s = objectSize(obj, ignore=ignore, verbose=verbose, depth=depth+1) #size += s #if verbose: #print indent + ' +', ch.objectName(), s #except: #pass #if isinstance(obj, types.InstanceType): gc.collect() if verbose: print(indent+'attrs:') for k in dir(obj): if k in ['__dict__']: continue o = getattr(obj, k) if type(o) in ignoreTypes: continue strtyp = str(type(o)) if ignoreRegex.search(strtyp): continue #if isinstance(o, types.ObjectType) and strtyp == "": #continue #if verbose: #print indent, k, '?' refs = [r for r in gc.get_referrers(o) if type(r) != types.FrameType] if len(refs) == 1: s = objectSize(o, ignore=ignore, verbose=verbose, depth=depth+1) size += s if verbose: print(indent + " +", k, s) #else: #if verbose: #print indent + ' -', k, len(refs) return size class GarbageWatcher(object): """ Convenient dictionary for holding weak references to objects. Mainly used to check whether the objects have been collect yet or not. Example: gw = GarbageWatcher() gw['objName'] = obj gw['objName2'] = obj2 gw.check() """ def __init__(self): self.objs = weakref.WeakValueDictionary() self.allNames = [] def add(self, obj, name): self.objs[name] = obj self.allNames.append(name) def __setitem__(self, name, obj): self.add(obj, name) def check(self): """Print a list of all watched objects and whether they have been collected.""" gc.collect() dead = self.allNames[:] alive = [] for k in self.objs: dead.remove(k) alive.append(k) print("Deleted objects:", dead) print("Live objects:", alive) def __getitem__(self, item): return self.objs[item] class Profiler(object): """Simple profiler allowing measurement of multiple time intervals. By default, profilers are disabled. To enable profiling, set the environment variable `PYQTGRAPHPROFILE` to a comma-separated list of fully-qualified names of profiled functions. Calling a profiler registers a message (defaulting to an increasing counter) that contains the time elapsed since the last call. When the profiler is about to be garbage-collected, the messages are passed to the outer profiler if one is running, or printed to stdout otherwise. If `delayed` is set to False, messages are immediately printed instead. Example: def function(...): profiler = Profiler() ... do stuff ... profiler('did stuff') ... do other stuff ... profiler('did other stuff') # profiler is garbage-collected and flushed at function end If this function is a method of class C, setting `PYQTGRAPHPROFILE` to "C.function" (without the module name) will enable this profiler. For regular functions, use the qualified name of the function, stripping only the initial "pyqtgraph." prefix from the module. """ _profilers = os.environ.get("PYQTGRAPHPROFILE", None) _profilers = _profilers.split(",") if _profilers is not None else [] _depth = 0 _msgs = [] disable = False # set this flag to disable all or individual profilers at runtime class DisabledProfiler(object): def __init__(self, *args, **kwds): pass def __call__(self, *args): pass def finish(self): pass def mark(self, msg=None): pass _disabledProfiler = DisabledProfiler() def __new__(cls, msg=None, disabled='env', delayed=True): """Optionally create a new profiler based on caller's qualname. """ if disabled is True or (disabled == 'env' and len(cls._profilers) == 0): return cls._disabledProfiler # determine the qualified name of the caller function caller_frame = sys._getframe(1) try: caller_object_type = type(caller_frame.f_locals["self"]) except KeyError: # we are in a regular function qualifier = caller_frame.f_globals["__name__"].split(".", 1)[-1] else: # we are in a method qualifier = caller_object_type.__name__ func_qualname = qualifier + "." + caller_frame.f_code.co_name if disabled == 'env' and func_qualname not in cls._profilers: # don't do anything return cls._disabledProfiler # create an actual profiling object cls._depth += 1 obj = super(Profiler, cls).__new__(cls) obj._name = msg or func_qualname obj._delayed = delayed obj._markCount = 0 obj._finished = False obj._firstTime = obj._lastTime = perf_counter() obj._newMsg("> Entering " + obj._name) return obj def __call__(self, msg=None): """Register or print a new message with timing information. """ if self.disable: return if msg is None: msg = str(self._markCount) self._markCount += 1 newTime = perf_counter() self._newMsg(" %s: %0.4f ms", msg, (newTime - self._lastTime) * 1000) self._lastTime = newTime def mark(self, msg=None): self(msg) def _newMsg(self, msg, *args): msg = " " * (self._depth - 1) + msg if self._delayed: self._msgs.append((msg, args)) else: self.flush() print(msg % args) def __del__(self): self.finish() def finish(self, msg=None): """Add a final message; flush the message list if no parent profiler. """ if self._finished or self.disable: return self._finished = True if msg is not None: self(msg) self._newMsg("< Exiting %s, total time: %0.4f ms", self._name, (perf_counter() - self._firstTime) * 1000) type(self)._depth -= 1 if self._depth < 1: self.flush() def flush(self): if self._msgs: print("\n".join([m[0]%m[1] for m in self._msgs])) type(self)._msgs = [] def profile(code, name='profile_run', sort='cumulative', num=30): """Common-use for cProfile""" import pstats cProfile.run(code, name) stats = pstats.Stats(name) stats.sort_stats(sort) stats.print_stats(num) return stats #### Code for listing (nearly) all objects in the known universe #### http://utcc.utoronto.ca/~cks/space/blog/python/GetAllObjects # Recursively expand slist's objects # into olist, using seen to track # already processed objects. def _getr(slist, olist, first=True): i = 0 for e in slist: oid = id(e) typ = type(e) if oid in olist or typ is int: ## or e in olist: ## since we're excluding all ints, there is no longer a need to check for olist keys continue olist[oid] = e if first and (i%1000) == 0: gc.collect() tl = gc.get_referents(e) if tl: _getr(tl, olist, first=False) i += 1 # The public function. def get_all_objects(): """Return a list of all live Python objects (excluding int and long), not including the list itself.""" gc.collect() gcl = gc.get_objects() olist = {} _getr(gcl, olist) del olist[id(olist)] del olist[id(gcl)] del olist[id(sys._getframe())] return olist def lookup(oid, objects=None): """Return an object given its ID, if it exists.""" if objects is None: objects = get_all_objects() return objects[oid] class ObjTracker(object): """ Tracks all objects under the sun, reporting the changes between snapshots: what objects are created, deleted, and persistent. This class is very useful for tracking memory leaks. The class goes to great (but not heroic) lengths to avoid tracking its own internal objects. Example: ot = ObjTracker() # takes snapshot of currently existing objects ... do stuff ... ot.diff() # prints lists of objects created and deleted since ot was initialized ... do stuff ... ot.diff() # prints lists of objects created and deleted since last call to ot.diff() # also prints list of items that were created since initialization AND have not been deleted yet # (if done correctly, this list can tell you about objects that were leaked) arrays = ot.findPersistent('ndarray') ## returns all objects matching 'ndarray' (string match, not instance checking) ## that were considered persistent when the last diff() was run describeObj(arrays[0]) ## See if we can determine who has references to this array """ allObjs = {} ## keep track of all objects created and stored within class instances allObjs[id(allObjs)] = None def __init__(self): self.startRefs = {} ## list of objects that exist when the tracker is initialized {oid: weakref} ## (If it is not possible to weakref the object, then the value is None) self.startCount = {} self.newRefs = {} ## list of objects that have been created since initialization self.persistentRefs = {} ## list of objects considered 'persistent' when the last diff() was called self.objTypes = {} ObjTracker.allObjs[id(self)] = None self.objs = [self.__dict__, self.startRefs, self.startCount, self.newRefs, self.persistentRefs, self.objTypes] self.objs.append(self.objs) for v in self.objs: ObjTracker.allObjs[id(v)] = None self.start() def findNew(self, regex): """Return all objects matching regex that were considered 'new' when the last diff() was run.""" return self.findTypes(self.newRefs, regex) def findPersistent(self, regex): """Return all objects matching regex that were considered 'persistent' when the last diff() was run.""" return self.findTypes(self.persistentRefs, regex) def start(self): """ Remember the current set of objects as the comparison for all future calls to diff() Called automatically on init, but can be called manually as well. """ refs, count, objs = self.collect() for r in self.startRefs: self.forgetRef(self.startRefs[r]) self.startRefs.clear() self.startRefs.update(refs) for r in refs: self.rememberRef(r) self.startCount.clear() self.startCount.update(count) #self.newRefs.clear() #self.newRefs.update(refs) def diff(self, **kargs): """ Compute all differences between the current object set and the reference set. Print a set of reports for created, deleted, and persistent objects """ refs, count, objs = self.collect() ## refs contains the list of ALL objects ## Which refs have disappeared since call to start() (these are only displayed once, then forgotten.) delRefs = {} for i in list(self.startRefs.keys()): if i not in refs: delRefs[i] = self.startRefs[i] del self.startRefs[i] self.forgetRef(delRefs[i]) for i in list(self.newRefs.keys()): if i not in refs: delRefs[i] = self.newRefs[i] del self.newRefs[i] self.forgetRef(delRefs[i]) #print "deleted:", len(delRefs) ## Which refs have appeared since call to start() or diff() persistentRefs = {} ## created since start(), but before last diff() createRefs = {} ## created since last diff() for o in refs: if o not in self.startRefs: if o not in self.newRefs: createRefs[o] = refs[o] ## object has been created since last diff() else: persistentRefs[o] = refs[o] ## object has been created since start(), but before last diff() (persistent) #print "new:", len(newRefs) ## self.newRefs holds the entire set of objects created since start() for r in self.newRefs: self.forgetRef(self.newRefs[r]) self.newRefs.clear() self.newRefs.update(persistentRefs) self.newRefs.update(createRefs) for r in self.newRefs: self.rememberRef(self.newRefs[r]) #print "created:", len(createRefs) ## self.persistentRefs holds all objects considered persistent. self.persistentRefs.clear() self.persistentRefs.update(persistentRefs) print("----------- Count changes since start: ----------") c1 = count.copy() for k in self.startCount: c1[k] = c1.get(k, 0) - self.startCount[k] typs = list(c1.keys()) typs.sort(key=lambda a: c1[a]) for t in typs: if c1[t] == 0: continue num = "%d" % c1[t] print(" " + num + " "*(10-len(num)) + str(t)) print("----------- %d Deleted since last diff: ------------" % len(delRefs)) self.report(delRefs, objs, **kargs) print("----------- %d Created since last diff: ------------" % len(createRefs)) self.report(createRefs, objs, **kargs) print("----------- %d Created since start (persistent): ------------" % len(persistentRefs)) self.report(persistentRefs, objs, **kargs) def __del__(self): self.startRefs.clear() self.startCount.clear() self.newRefs.clear() self.persistentRefs.clear() del ObjTracker.allObjs[id(self)] for v in self.objs: del ObjTracker.allObjs[id(v)] @classmethod def isObjVar(cls, o): return type(o) is cls or id(o) in cls.allObjs def collect(self): print("Collecting list of all objects...") gc.collect() objs = get_all_objects() frame = sys._getframe() del objs[id(frame)] ## ignore the current frame del objs[id(frame.f_code)] ignoreTypes = [int] refs = {} count = {} for k in objs: o = objs[k] typ = type(o) oid = id(o) if ObjTracker.isObjVar(o) or typ in ignoreTypes: continue try: ref = weakref.ref(o) except: ref = None refs[oid] = ref typ = type(o) typStr = typeStr(o) self.objTypes[oid] = typStr ObjTracker.allObjs[id(typStr)] = None count[typ] = count.get(typ, 0) + 1 print("All objects: %d Tracked objects: %d" % (len(objs), len(refs))) return refs, count, objs def forgetRef(self, ref): if ref is not None: del ObjTracker.allObjs[id(ref)] def rememberRef(self, ref): ## Record the address of the weakref object so it is not included in future object counts. if ref is not None: ObjTracker.allObjs[id(ref)] = None def lookup(self, oid, ref, objs=None): if ref is None or ref() is None: try: obj = lookup(oid, objects=objs) except: obj = None else: obj = ref() return obj def report(self, refs, allobjs=None, showIDs=False): if allobjs is None: allobjs = get_all_objects() count = {} rev = {} for oid in refs: obj = self.lookup(oid, refs[oid], allobjs) if obj is None: typ = "[del] " + self.objTypes[oid] else: typ = typeStr(obj) if typ not in rev: rev[typ] = [] rev[typ].append(oid) c = count.get(typ, [0,0]) count[typ] = [c[0]+1, c[1]+objectSize(obj)] typs = list(count.keys()) typs.sort(key=lambda a: count[a][1]) for t in typs: line = " %d\t%d\t%s" % (count[t][0], count[t][1], t) if showIDs: line += "\t"+",".join(map(str,rev[t])) print(line) def findTypes(self, refs, regex): allObjs = get_all_objects() objs = [] r = re.compile(regex) for k in refs: if r.search(self.objTypes[k]): objs.append(self.lookup(k, refs[k], allObjs)) return objs def describeObj(obj, depth=4, path=None, ignore=None): """ Trace all reference paths backward, printing a list of different ways this object can be accessed. Attempts to answer the question "who has a reference to this object" """ if path is None: path = [obj] if ignore is None: ignore = {} ## holds IDs of objects used within the function. ignore[id(sys._getframe())] = None ignore[id(path)] = None gc.collect() refs = gc.get_referrers(obj) ignore[id(refs)] = None printed=False for ref in refs: if id(ref) in ignore: continue if id(ref) in list(map(id, path)): print("Cyclic reference: " + refPathString([ref]+path)) printed = True continue newPath = [ref]+path if len(newPath) >= depth: refStr = refPathString(newPath) if '[_]' not in refStr: ## ignore '_' references generated by the interactive shell print(refStr) printed = True else: describeObj(ref, depth, newPath, ignore) printed = True if not printed: print("Dead end: " + refPathString(path)) def typeStr(obj): """Create a more useful type string by making types report their class.""" typ = type(obj) if typ == getattr(types, 'InstanceType', None): return "" % obj.__class__.__name__ else: return str(typ) def searchRefs(obj, *args): """Pseudo-interactive function for tracing references backward. **Arguments:** obj: The initial object from which to start searching args: A set of string or int arguments. each integer selects one of obj's referrers to be the new 'obj' each string indicates an action to take on the current 'obj': t: print the types of obj's referrers l: print the lengths of obj's referrers (if they have __len__) i: print the IDs of obj's referrers o: print obj ro: return obj rr: return list of obj's referrers Examples:: searchRefs(obj, 't') ## Print types of all objects referring to obj searchRefs(obj, 't', 0, 't') ## ..then select the first referrer and print the types of its referrers searchRefs(obj, 't', 0, 't', 'l') ## ..also print lengths of the last set of referrers searchRefs(obj, 0, 1, 'ro') ## Select index 0 from obj's referrer, then select index 1 from the next set of referrers, then return that object """ ignore = {id(sys._getframe()): None} gc.collect() refs = gc.get_referrers(obj) ignore[id(refs)] = None refs = [r for r in refs if id(r) not in ignore] for a in args: #fo = allFrameObjs() #refs = [r for r in refs if r not in fo] if type(a) is int: obj = refs[a] gc.collect() refs = gc.get_referrers(obj) ignore[id(refs)] = None refs = [r for r in refs if id(r) not in ignore] elif a == 't': print(list(map(typeStr, refs))) elif a == 'i': print(list(map(id, refs))) elif a == 'l': def slen(o): if hasattr(o, '__len__'): return len(o) else: return None print(list(map(slen, refs))) elif a == 'o': print(obj) elif a == 'ro': return obj elif a == 'rr': return refs def allFrameObjs(): """Return list of frame objects in current stack. Useful if you want to ignore these objects in refernece searches""" f = sys._getframe() objs = [] while f is not None: objs.append(f) objs.append(f.f_code) #objs.append(f.f_locals) #objs.append(f.f_globals) #objs.append(f.f_builtins) f = f.f_back return objs def findObj(regex): """Return a list of objects whose typeStr matches regex""" allObjs = get_all_objects() objs = [] r = re.compile(regex) for i in allObjs: obj = allObjs[i] if r.search(typeStr(obj)): objs.append(obj) return objs def listRedundantModules(): """List modules that have been imported more than once via different paths.""" mods = {} for name, mod in sys.modules.items(): if not hasattr(mod, '__file__'): continue mfile = os.path.abspath(mod.__file__) if mfile[-1] == 'c': mfile = mfile[:-1] if mfile in mods: print("module at %s has 2 names: %s, %s" % (mfile, name, mods[mfile])) else: mods[mfile] = name def walkQObjectTree(obj, counts=None, verbose=False, depth=0): """ Walk through a tree of QObjects, doing nothing to them. The purpose of this function is to find dead objects and generate a crash immediately rather than stumbling upon them later. Prints a count of the objects encountered, for fun. (or is it?) """ if verbose: print(" "*depth + typeStr(obj)) if counts is None: counts = {} typ = str(type(obj)) try: counts[typ] += 1 except KeyError: counts[typ] = 1 for child in obj.children(): walkQObjectTree(child, counts, verbose, depth+1) return counts QObjCache = {} def qObjectReport(verbose=False): """Generate a report counting all QObjects and their types""" global qObjCache count = {} for obj in findObj('PyQt'): if isinstance(obj, QtCore.QObject): oid = id(obj) if oid not in QObjCache: QObjCache[oid] = typeStr(obj) + " " + obj.objectName() try: QObjCache[oid] += " " + obj.parent().objectName() QObjCache[oid] += " " + obj.text() except: pass print("check obj", oid, str(QObjCache[oid])) if obj.parent() is None: walkQObjectTree(obj, count, verbose) typs = list(count.keys()) typs.sort() for t in typs: print(count[t], "\t", t) class PrintDetector(object): """Find code locations that print to stdout.""" def __init__(self): self.stdout = sys.stdout sys.stdout = self def remove(self): sys.stdout = self.stdout def __del__(self): self.remove() def write(self, x): self.stdout.write(x) traceback.print_stack() def flush(self): self.stdout.flush() def listQThreads(): """Prints Thread IDs (Qt's, not OS's) for all QThreads.""" thr = findObj('[Tt]hread') thr = [t for t in thr if isinstance(t, QtCore.QThread)] try: from PyQt5 import sip except ImportError: import sip for t in thr: print("--> ", t) print(" Qt ID: 0x%x" % sip.unwrapinstance(t)) def pretty(data, indent=''): """Format nested dict/list/tuple structures into a more human-readable string This function is a bit better than pprint for displaying OrderedDicts. """ ret = "" ind2 = indent + " " if isinstance(data, dict): ret = indent+"{\n" for k, v in data.items(): ret += ind2 + repr(k) + ": " + pretty(v, ind2).strip() + "\n" ret += indent+"}\n" elif isinstance(data, list) or isinstance(data, tuple): s = repr(data) if len(s) < 40: ret += indent + s else: if isinstance(data, list): d = '[]' else: d = '()' ret = indent+d[0]+"\n" for i, v in enumerate(data): ret += ind2 + str(i) + ": " + pretty(v, ind2).strip() + "\n" ret += indent+d[1]+"\n" else: ret += indent + repr(data) return ret class ThreadTrace(object): """ Used to debug freezing by starting a new thread that reports on the location of other threads periodically. """ def __init__(self, interval=10.0, logFile=None): self.interval = interval self.lock = Mutex() self._stop = False self.logFile = logFile self.start() def stop(self): with self.lock: self._stop = True def start(self, interval=None): if interval is not None: self.interval = interval self._stop = False self.thread = threading.Thread(target=self.run) self.thread.daemon = True self.thread.start() def run(self): iter = 0 with open_maybe_console(self.logFile) as printFile: while True: with self.lock: if self._stop is True: return printFile.write(f"\n============= THREAD FRAMES {iter}: ================\n") for id, frame in sys._current_frames().items(): if id == threading.current_thread().ident: continue name = threadName() printFile.write("<< thread %d \"%s\" >>\n" % (id, name)) tb = str(''.join(traceback.format_stack(frame))) printFile.write(tb) printFile.write("\n") printFile.write("===============================================\n\n") printFile.flush() iter += 1 time.sleep(self.interval) def threadName(threadId=None): """Return a string name for a thread id. If *threadId* is None, then the current thread's id is used. This attempts to look up thread names either from `threading._active`, or from QThread._names. However, note that the latter does not exist by default; rather you must manually add id:name pairs to a dictionary there:: # for python threads: t1 = threading.Thread(name="mythread") # for Qt threads: class Thread(Qt.QThread): def __init__(self, name): self._threadname = name if not hasattr(Qt.QThread, '_names'): Qt.QThread._names = {} Qt.QThread.__init__(self, *args, **kwds) def run(self): Qt.QThread._names[threading.current_thread().ident] = self._threadname """ if threadId is None: threadId = threading.current_thread().ident try: name = threading._active.get(threadId, None) except Exception: name = None if name is None: try: # QThread._names must be manually set by thread creators. name = QtCore.QThread._names.get(threadId) except Exception: name = None if name is None: name = "???" return name class ThreadColor(object): """ Wrapper on stdout/stderr that colors text by the current thread ID. *stream* must be 'stdout' or 'stderr'. """ colors = {} lock = Mutex() def __init__(self, stream): self.stream = getattr(sys, stream) self.err = stream == 'stderr' setattr(sys, stream, self) def write(self, msg): with self.lock: cprint.cprint(self.stream, self.color(), msg, -1, stderr=self.err) def flush(self): with self.lock: self.stream.flush() def color(self): tid = threading.current_thread() if tid not in self.colors: c = (len(self.colors) % 15) + 1 self.colors[tid] = c return self.colors[tid] def enableFaulthandler(): """ Enable faulthandler for all threads. If the faulthandler package is available, this function disables and then re-enables fault handling for all threads (this is necessary to ensure any new threads are handled correctly), and returns True. If faulthandler is not available, then returns False. """ try: import faulthandler # necessary to disable first or else new threads may not be handled. faulthandler.disable() faulthandler.enable(all_threads=True) return True except ImportError: return False pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/dockarea/000077500000000000000000000000001457240071200214255ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/dockarea/Container.py000066400000000000000000000223371457240071200237300ustar00rootroot00000000000000__all__ = ["Container", "HContainer", "VContainer", "TContainer"] import weakref from ..Qt import QtCore, QtWidgets from .Dock import Dock class Container(object): #sigStretchChanged = QtCore.Signal() ## can't do this here; not a QObject. def __init__(self, area): object.__init__(self) self.area = area self._container = None self._stretch = (10, 10) self.stretches = weakref.WeakKeyDictionary() def container(self): return self._container def containerChanged(self, c): self._container = c if c is None: self.area = None else: self.area = c.area def type(self): return None def insert(self, new, pos=None, neighbor=None): if not isinstance(new, list): new = [new] for n in new: # remove from existing parent first n.setParent(None) if neighbor is None: if pos == 'before': index = 0 else: index = self.count() else: index = self.indexOf(neighbor) if index == -1: index = 0 if pos == 'after': index += 1 for n in new: #print "insert", n, " -> ", self, index self._insertItem(n, index) #print "change container", n, " -> ", self n.containerChanged(self) index += 1 n.sigStretchChanged.connect(self.childStretchChanged) #print "child added", self self.updateStretch() def apoptose(self, propagate=True): # if there is only one (or zero) item in this container, disappear. # if propagate is True, then also attempt to apoptose parent containers. cont = self._container c = self.count() if c > 1: return if c == 1: ## if there is one item, give it to the parent container (unless this is the top) ch = self.widget(0) if (self.area is not None and self is self.area.topContainer and not isinstance(ch, Container)) or self.container() is None: return self.container().insert(ch, 'before', self) #print "apoptose:", self self.close() if propagate and cont is not None: cont.apoptose() def close(self): self.setParent(None) if self.area is not None and self.area.topContainer is self: self.area.topContainer = None self.containerChanged(None) def childEvent_(self, ev): # NOTE: this method has been renamed to avoid having the same method name as # QSplitter.childEvent() # this causes problems for PyQt6 since SplitContainer inherits from # Container and QSplitter. ch = ev.child() if ev.removed() and hasattr(ch, 'sigStretchChanged'): #print "Child", ev.child(), "removed, updating", self try: ch.sigStretchChanged.disconnect(self.childStretchChanged) except: pass self.updateStretch() def childStretchChanged(self): #print "child", QtCore.QObject.sender(self), "changed shape, updating", self self.updateStretch() def setStretch(self, x=None, y=None): #print "setStretch", self, x, y self._stretch = (x, y) self.sigStretchChanged.emit() def updateStretch(self): ###Set the stretch values for this container to reflect its contents pass def stretch(self): """Return the stretch factors for this container""" return self._stretch class SplitContainer(Container, QtWidgets.QSplitter): """Horizontal or vertical splitter with some changes: - save/restore works correctly """ sigStretchChanged = QtCore.Signal() def __init__(self, area, orientation): QtWidgets.QSplitter.__init__(self) self.setOrientation(orientation) Container.__init__(self, area) #self.splitterMoved.connect(self.restretchChildren) def _insertItem(self, item, index): self.insertWidget(index, item) item.show() ## need to show since it may have been previously hidden by tab def saveState(self): sizes = self.sizes() if all(x == 0 for x in sizes): sizes = [10] * len(sizes) return {'sizes': sizes} def restoreState(self, state): sizes = state['sizes'] self.setSizes(sizes) for i in range(len(sizes)): self.setStretchFactor(i, sizes[i]) def childEvent(self, ev): super().childEvent(ev) # call QSplitter.childEvent() Container.childEvent_(self, ev) #def restretchChildren(self): #sizes = self.sizes() #tot = sum(sizes) class HContainer(SplitContainer): def __init__(self, area): SplitContainer.__init__(self, area, QtCore.Qt.Orientation.Horizontal) def type(self): return 'horizontal' def updateStretch(self): ##Set the stretch values for this container to reflect its contents #print "updateStretch", self x = 0 y = 0 sizes = [] for i in range(self.count()): wx, wy = self.widget(i).stretch() x += wx y = max(y, wy) sizes.append(wx) #print " child", self.widget(i), wx, wy self.setStretch(x, y) #print sizes tot = float(sum(sizes)) if tot == 0: scale = 1.0 else: scale = self.width() / tot self.setSizes([int(s*scale) for s in sizes]) class VContainer(SplitContainer): def __init__(self, area): SplitContainer.__init__(self, area, QtCore.Qt.Orientation.Vertical) def type(self): return 'vertical' def updateStretch(self): ##Set the stretch values for this container to reflect its contents #print "updateStretch", self x = 0 y = 0 sizes = [] for i in range(self.count()): wx, wy = self.widget(i).stretch() y += wy x = max(x, wx) sizes.append(wy) #print " child", self.widget(i), wx, wy self.setStretch(x, y) #print sizes tot = float(sum(sizes)) if tot == 0: scale = 1.0 else: scale = self.height() / tot self.setSizes([int(s*scale) for s in sizes]) class StackedWidget(QtWidgets.QStackedWidget): def __init__(self, *, container): super().__init__() self.container = container def childEvent(self, ev): super().childEvent(ev) self.container.childEvent_(ev) class TContainer(Container, QtWidgets.QWidget): sigStretchChanged = QtCore.Signal() def __init__(self, area): QtWidgets.QWidget.__init__(self) Container.__init__(self, area) self.layout = QtWidgets.QGridLayout() self.layout.setSpacing(0) self.layout.setContentsMargins(0,0,0,0) self.setLayout(self.layout) self.hTabLayout = QtWidgets.QHBoxLayout() self.hTabBox = QtWidgets.QWidget() self.hTabBox.setLayout(self.hTabLayout) self.hTabLayout.setSpacing(2) self.hTabLayout.setContentsMargins(0,0,0,0) self.layout.addWidget(self.hTabBox, 0, 1) self.stack = StackedWidget(container=self) self.layout.addWidget(self.stack, 1, 1) self.setLayout(self.layout) for n in ['count', 'widget', 'indexOf']: setattr(self, n, getattr(self.stack, n)) def _insertItem(self, item, index): if not isinstance(item, Dock): raise Exception("Tab containers may hold only docks, not other containers.") self.stack.insertWidget(index, item) self.hTabLayout.insertWidget(index, item.label) #QtCore.QObject.connect(item.label, QtCore.SIGNAL('clicked'), self.tabClicked) item.label.sigClicked.connect(self.tabClicked) self.tabClicked(item.label) def tabClicked(self, tab, ev=None): if ev is None or ev.button() == QtCore.Qt.MouseButton.LeftButton: for i in range(self.count()): w = self.widget(i) if w is tab.dock: w.label.setDim(False) self.stack.setCurrentIndex(i) else: w.label.setDim(True) def raiseDock(self, dock): """Move *dock* to the top of the stack""" self.stack.currentWidget().label.setDim(True) self.stack.setCurrentWidget(dock) dock.label.setDim(False) def type(self): return 'tab' def saveState(self): return {'index': self.stack.currentIndex()} def restoreState(self, state): self.stack.setCurrentIndex(state['index']) def updateStretch(self): ##Set the stretch values for this container to reflect its contents x = 0 y = 0 for i in range(self.count()): wx, wy = self.widget(i).stretch() x = max(x, wx) y = max(y, wy) self.setStretch(x, y) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/dockarea/Dock.py000066400000000000000000000302121457240071200226550ustar00rootroot00000000000000import warnings from ..Qt import QtCore, QtGui, QtWidgets from ..widgets.VerticalLabel import VerticalLabel from .DockDrop import DockDrop class Dock(QtWidgets.QWidget): sigStretchChanged = QtCore.Signal() sigClosed = QtCore.Signal(object) def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, label=None, **kargs): QtWidgets.QWidget.__init__(self) self.dockdrop = DockDrop(self) self._container = None self._name = name self.area = area self.label = label if self.label is None: self.label = DockLabel(name, **kargs) self.label.dock = self if self.label.isClosable(): self.label.sigCloseClicked.connect(self.close) self.labelHidden = False self.moveLabel = True ## If false, the dock is no longer allowed to move the label. self.autoOrient = autoOrientation self.orientation = 'horizontal' #self.label.setAlignment(QtCore.Qt.AlignmentFlag.AlignHCenter) self.topLayout = QtWidgets.QGridLayout() self.topLayout.setContentsMargins(0, 0, 0, 0) self.topLayout.setSpacing(0) self.setLayout(self.topLayout) self.topLayout.addWidget(self.label, 0, 1) self.widgetArea = QtWidgets.QWidget() self.topLayout.addWidget(self.widgetArea, 1, 1) self.layout = QtWidgets.QGridLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setSpacing(0) self.widgetArea.setLayout(self.layout) self.widgetArea.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) self.widgets = [] self.currentRow = 0 #self.titlePos = 'top' self.dockdrop.raiseOverlay() self.hStyle = """ Dock > QWidget { border: 1px solid #000; border-radius: 5px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-top-width: 0px; }""" self.vStyle = """ Dock > QWidget { border: 1px solid #000; border-radius: 5px; border-top-left-radius: 0px; border-bottom-left-radius: 0px; border-left-width: 0px; }""" self.nStyle = """ Dock > QWidget { border: 1px solid #000; border-radius: 5px; }""" self.dragStyle = """ Dock > QWidget { border: 4px solid #00F; border-radius: 5px; }""" self.setAutoFillBackground(False) self.widgetArea.setStyleSheet(self.hStyle) self.setStretch(*size) if widget is not None: self.addWidget(widget) if hideTitle: self.hideTitleBar() def implements(self, name=None): if name is None: return ['dock'] else: return name == 'dock' def setStretch(self, x=None, y=None): """ Set the 'target' size for this Dock. The actual size will be determined by comparing this Dock's stretch value to the rest of the docks it shares space with. """ if x is None: x = 0 if y is None: y = 0 self._stretch = (x, y) self.sigStretchChanged.emit() def stretch(self): return self._stretch def hideTitleBar(self): """ Hide the title bar for this Dock. This will prevent the Dock being moved by the user. """ self.label.hide() self.labelHidden = True self.dockdrop.removeAllowedArea('center') self.updateStyle() def showTitleBar(self): """ Show the title bar for this Dock. """ self.label.show() self.labelHidden = False self.dockdrop.addAllowedArea('center') self.updateStyle() def title(self): """ Gets the text displayed in the title bar for this dock. """ return self.label.text() def setTitle(self, text): """ Sets the text displayed in title bar for this Dock. """ self.label.setText(text) def setOrientation(self, o='auto', force=False): """ Sets the orientation of the title bar for this Dock. Must be one of 'auto', 'horizontal', or 'vertical'. By default ('auto'), the orientation is determined based on the aspect ratio of the Dock. """ # setOrientation may be called before the container is set in some cases # (via resizeEvent), so there's no need to do anything here until called # again by containerChanged if self.container() is None: return if o == 'auto' and self.autoOrient: if self.container().type() == 'tab': o = 'horizontal' elif self.width() > self.height()*1.5: o = 'vertical' else: o = 'horizontal' if force or self.orientation != o: self.orientation = o self.label.setOrientation(o) self.updateStyle() def updateStyle(self): ## updates orientation and appearance of title bar if self.labelHidden: self.widgetArea.setStyleSheet(self.nStyle) elif self.orientation == 'vertical': self.label.setOrientation('vertical') if self.moveLabel: self.topLayout.addWidget(self.label, 1, 0) self.widgetArea.setStyleSheet(self.vStyle) else: self.label.setOrientation('horizontal') if self.moveLabel: self.topLayout.addWidget(self.label, 0, 1) self.widgetArea.setStyleSheet(self.hStyle) def resizeEvent(self, ev): self.setOrientation() self.dockdrop.resizeOverlay(self.size()) def name(self): return self._name def addWidget(self, widget, row=None, col=0, rowspan=1, colspan=1): """ Add a new widget to the interior of this Dock. Each Dock uses a QGridLayout to arrange widgets within. """ if row is None: row = self.currentRow self.currentRow = max(row+1, self.currentRow) self.widgets.append(widget) self.layout.addWidget(widget, row, col, rowspan, colspan) self.dockdrop.raiseOverlay() def startDrag(self): self.drag = QtGui.QDrag(self) mime = QtCore.QMimeData() self.drag.setMimeData(mime) self.widgetArea.setStyleSheet(self.dragStyle) self.update() action = self.drag.exec() if hasattr(self.drag, 'exec') else self.drag.exec_() self.updateStyle() def float(self): self.area.floatDock(self) def container(self): return self._container def containerChanged(self, c): if self._container is not None: # ask old container to close itself if it is no longer needed self._container.apoptose(propagate=False) self._container = c if c is None: self.area = None else: self.area = c.area if c.type() != 'tab': self.moveLabel = True self.label.setDim(False) else: self.moveLabel = False self.setOrientation(force=True) def raiseDock(self): """If this Dock is stacked underneath others, raise it to the top.""" self.container().raiseDock(self) def close(self): """Remove this dock from the DockArea it lives inside.""" if self._container is None: warnings.warn(f"Cannot close dock {self} because it is not open.", RuntimeWarning, stacklevel=2) return self.setParent(None) QtWidgets.QLabel.close(self.label) self.label.setParent(None) self._container.apoptose() self._container = None self.sigClosed.emit(self) def __repr__(self): return "" % (self.name(), self.stretch()) def dragEnterEvent(self, *args): self.dockdrop.dragEnterEvent(*args) def dragMoveEvent(self, *args): self.dockdrop.dragMoveEvent(*args) def dragLeaveEvent(self, *args): self.dockdrop.dragLeaveEvent(*args) def dropEvent(self, *args): self.dockdrop.dropEvent(*args) class DockLabel(VerticalLabel): sigClicked = QtCore.Signal(object, object) sigCloseClicked = QtCore.Signal() def __init__(self, text, closable=False, fontSize="12px"): self.dim = False self.fixedWidth = False self.fontSize = fontSize VerticalLabel.__init__(self, text, orientation='horizontal', forceWidth=False) self.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop|QtCore.Qt.AlignmentFlag.AlignHCenter) self.dock = None self.updateStyle() self.setAutoFillBackground(False) self.mouseMoved = False self.closeButton = None if closable: self.closeButton = QtWidgets.QToolButton(self) self.closeButton.clicked.connect(self.sigCloseClicked) self.closeButton.setIcon(QtWidgets.QApplication.style().standardIcon(QtWidgets.QStyle.StandardPixmap.SP_TitleBarCloseButton)) def updateStyle(self): r = '3px' if self.dim: fg = '#aaa' bg = '#44a' border = '#339' else: fg = '#fff' bg = '#66c' border = '#55B' if self.orientation == 'vertical': self.vStyle = """DockLabel { background-color : %s; color : %s; border-top-right-radius: 0px; border-top-left-radius: %s; border-bottom-right-radius: 0px; border-bottom-left-radius: %s; border-width: 0px; border-right: 2px solid %s; padding-top: 3px; padding-bottom: 3px; font-size: %s; }""" % (bg, fg, r, r, border, self.fontSize) self.setStyleSheet(self.vStyle) else: self.hStyle = """DockLabel { background-color : %s; color : %s; border-top-right-radius: %s; border-top-left-radius: %s; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; border-width: 0px; border-bottom: 2px solid %s; padding-left: 3px; padding-right: 3px; font-size: %s; }""" % (bg, fg, r, r, border, self.fontSize) self.setStyleSheet(self.hStyle) def setDim(self, d): if self.dim != d: self.dim = d self.updateStyle() def setOrientation(self, o): VerticalLabel.setOrientation(self, o) self.updateStyle() def isClosable(self): return self.closeButton is not None def mousePressEvent(self, ev): lpos = ev.position() if hasattr(ev, 'position') else ev.localPos() self.pressPos = lpos self.mouseMoved = False ev.accept() def mouseMoveEvent(self, ev): if not self.mouseMoved: lpos = ev.position() if hasattr(ev, 'position') else ev.localPos() self.mouseMoved = (lpos - self.pressPos).manhattanLength() > QtWidgets.QApplication.startDragDistance() if self.mouseMoved and ev.buttons() == QtCore.Qt.MouseButton.LeftButton: self.dock.startDrag() ev.accept() def mouseReleaseEvent(self, ev): ev.accept() if not self.mouseMoved: self.sigClicked.emit(self, ev) def mouseDoubleClickEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.LeftButton: self.dock.float() def resizeEvent (self, ev): if self.closeButton: if self.orientation == 'vertical': size = ev.size().width() pos = QtCore.QPoint(0, 0) else: size = ev.size().height() pos = QtCore.QPoint(ev.size().width() - size, 0) self.closeButton.setFixedSize(QtCore.QSize(size, size)) self.closeButton.move(pos) super(DockLabel,self).resizeEvent(ev) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/dockarea/DockArea.py000066400000000000000000000332521457240071200234550ustar00rootroot00000000000000import weakref from ..Qt import QtWidgets from .Container import Container, HContainer, TContainer, VContainer from .Dock import Dock from .DockDrop import DockDrop class DockArea(Container, QtWidgets.QWidget): def __init__(self, parent=None, temporary=False, home=None): Container.__init__(self, self) QtWidgets.QWidget.__init__(self, parent=parent) self.dockdrop = DockDrop(self) self.dockdrop.removeAllowedArea('center') self.layout = QtWidgets.QVBoxLayout() self.layout.setContentsMargins(0,0,0,0) self.layout.setSpacing(0) self.setLayout(self.layout) self.docks = weakref.WeakValueDictionary() self.topContainer = None self.dockdrop.raiseOverlay() self.temporary = temporary self.tempAreas = [] self.home = home def type(self): return "top" def addDock(self, dock=None, position='bottom', relativeTo=None, **kwds): """Adds a dock to this area. ============== ================================================================= **Arguments:** dock The new Dock object to add. If None, then a new Dock will be created. position 'bottom', 'top', 'left', 'right', 'above', or 'below' relativeTo If relativeTo is None, then the new Dock is added to fill an entire edge of the window. If relativeTo is another Dock, then the new Dock is placed adjacent to it (or in a tabbed configuration for 'above' and 'below'). ============== ================================================================= All extra keyword arguments are passed to Dock.__init__() if *dock* is None. """ if dock is None: dock = Dock(**kwds) # store original area that the dock will return to when un-floated if not self.temporary: dock.orig_area = self ## Determine the container to insert this dock into. ## If there is no neighbor, then the container is the top. if relativeTo is None or relativeTo is self: if self.topContainer is None: container = self neighbor = None else: container = self.topContainer neighbor = None else: if isinstance(relativeTo, str): relativeTo = self.docks[relativeTo] container = self.getContainer(relativeTo) if container is None: raise TypeError("Dock %s is not contained in a DockArea; cannot add another dock relative to it." % relativeTo) neighbor = relativeTo ## what container type do we need? neededContainer = { 'bottom': 'vertical', 'top': 'vertical', 'left': 'horizontal', 'right': 'horizontal', 'above': 'tab', 'below': 'tab' }[position] ## Can't insert new containers into a tab container; insert outside instead. if neededContainer != container.type() and container.type() == 'tab': neighbor = container container = container.container() ## Decide if the container we have is suitable. ## If not, insert a new container inside. if neededContainer != container.type(): if neighbor is None: container = self.addContainer(neededContainer, self.topContainer) else: container = self.addContainer(neededContainer, neighbor) ## Insert the new dock before/after its neighbor insertPos = { 'bottom': 'after', 'top': 'before', 'left': 'before', 'right': 'after', 'above': 'before', 'below': 'after' }[position] #print "request insert", dock, insertPos, neighbor old = dock.container() container.insert(dock, insertPos, neighbor) self.docks[dock.name()] = dock if old is not None: old.apoptose() return dock def moveDock(self, dock, position, neighbor): """ Move an existing Dock to a new location. """ ## Moving to the edge of a tabbed dock causes a drop outside the tab box if position in ['left', 'right', 'top', 'bottom'] and neighbor is not None and neighbor.container() is not None and neighbor.container().type() == 'tab': neighbor = neighbor.container() self.addDock(dock, position, neighbor) def getContainer(self, obj): if obj is None: return self return obj.container() def makeContainer(self, typ): if typ == 'vertical': new = VContainer(self) elif typ == 'horizontal': new = HContainer(self) elif typ == 'tab': new = TContainer(self) else: raise ValueError("typ must be one of 'vertical', 'horizontal', or 'tab'") return new def addContainer(self, typ, obj): """Add a new container around obj""" new = self.makeContainer(typ) container = self.getContainer(obj) container.insert(new, 'before', obj) #print "Add container:", new, " -> ", container if obj is not None: new.insert(obj) self.dockdrop.raiseOverlay() return new def insert(self, new, pos=None, neighbor=None): if self.topContainer is not None: # Adding new top-level container; addContainer() should # take care of giving the old top container a new home. self.topContainer.containerChanged(None) self.layout.addWidget(new) new.containerChanged(self) self.topContainer = new self.dockdrop.raiseOverlay() def count(self): if self.topContainer is None: return 0 return 1 def resizeEvent(self, ev): self.dockdrop.resizeOverlay(self.size()) def addTempArea(self): if self.home is None: area = DockArea(temporary=True, home=self) self.tempAreas.append(area) win = TempAreaWindow(area) area.win = win win.show() else: area = self.home.addTempArea() #print "added temp area", area, area.window() return area def floatDock(self, dock): """Removes *dock* from this DockArea and places it in a new window.""" area = self.addTempArea() area.win.resize(dock.size()) area.moveDock(dock, 'top', None) def removeTempArea(self, area): self.tempAreas.remove(area) #print "close window", area.window() area.window().close() def saveState(self): """ Return a serialized (storable) representation of the state of all Docks in this DockArea.""" if self.topContainer is None: main = None else: main = self.childState(self.topContainer) state = {'main': main, 'float': []} for a in self.tempAreas: geo = a.win.geometry() geo = (geo.x(), geo.y(), geo.width(), geo.height()) state['float'].append((a.saveState(), geo)) return state def childState(self, obj): if isinstance(obj, Dock): return ('dock', obj.name(), {}) else: childs = [] for i in range(obj.count()): childs.append(self.childState(obj.widget(i))) return (obj.type(), childs, obj.saveState()) def restoreState(self, state, missing='error', extra='bottom'): """ Restore Dock configuration as generated by saveState. This function does not create any Docks--it will only restore the arrangement of an existing set of Docks. By default, docks that are described in *state* but do not exist in the dock area will cause an exception to be raised. This behavior can be changed by setting *missing* to 'ignore' or 'create'. Extra docks that are in the dockarea but that are not mentioned in *state* will be added to the bottom of the dockarea, unless otherwise specified by the *extra* argument. """ ## 1) make dict of all docks and list of existing containers containers, docks = self.findAll() oldTemps = self.tempAreas[:] #print "found docks:", docks ## 2) create container structure, move docks into new containers if state['main'] is not None: self.buildFromState(state['main'], docks, self, missing=missing) ## 3) create floating areas, populate for s in state['float']: a = self.addTempArea() a.buildFromState(s[0]['main'], docks, a, missing=missing) a.win.setGeometry(*s[1]) a.apoptose() # ask temp area to close itself if it is empty ## 4) Add any remaining docks to a float for d in docks.values(): if extra == 'float': a = self.addTempArea() a.addDock(d, 'below') else: self.moveDock(d, extra, None) #print "\nKill old containers:" ## 5) kill old containers for c in containers: c.close() for a in oldTemps: a.apoptose() def buildFromState(self, state, docks, root, depth=0, missing='error'): typ, contents, state = state if typ == 'dock': try: obj = docks[contents] del docks[contents] except KeyError: if missing == 'error': raise Exception('Cannot restore dock state; no dock with name "%s"' % contents) elif missing == 'create': obj = Dock(name=contents) elif missing == 'ignore': return else: raise ValueError('"missing" argument must be one of "error", "create", or "ignore".') else: obj = self.makeContainer(typ) root.insert(obj, 'after') if typ != 'dock': for o in contents: self.buildFromState(o, docks, obj, depth+1, missing=missing) # remove this container if possible. (there are valid situations when a restore will # generate empty containers, such as when using missing='ignore') obj.apoptose(propagate=False) obj.restoreState(state) ## this has to be done later? def findAll(self, obj=None, c=None, d=None): if obj is None: obj = self.topContainer ## check all temp areas first if c is None: c = [] d = {} for a in self.tempAreas: c1, d1 = a.findAll() c.extend(c1) d.update(d1) if isinstance(obj, Dock): d[obj.name()] = obj elif obj is not None: c.append(obj) for i in range(obj.count()): o2 = obj.widget(i) c2, d2 = self.findAll(o2) c.extend(c2) d.update(d2) return (c, d) def apoptose(self, propagate=True): # remove top container if possible, close this area if it is temporary. #print "apoptose area:", self.temporary, self.topContainer, self.topContainer.count() if self.topContainer is None or self.topContainer.count() == 0: self.topContainer = None if self.temporary and self.home is not None: self.home.removeTempArea(self) #self.close() def clear(self): docks = self.findAll()[1] for dock in docks.values(): dock.close() def dragEnterEvent(self, *args): self.dockdrop.dragEnterEvent(*args) def dragMoveEvent(self, *args): self.dockdrop.dragMoveEvent(*args) def dragLeaveEvent(self, *args): self.dockdrop.dragLeaveEvent(*args) def dropEvent(self, *args): self.dockdrop.dropEvent(*args) def printState(self, state=None, name='Main'): # for debugging if state is None: state = self.saveState() print("=== %s dock area ===" % name) if state['main'] is None: print(" (empty)") else: self._printAreaState(state['main']) for i, float in enumerate(state['float']): self.printState(float[0], name='float %d' % i) def _printAreaState(self, area, indent=0): if area[0] == 'dock': print(" " * indent + area[0] + " " + str(area[1:])) return else: print(" " * indent + area[0]) for ch in area[1]: self._printAreaState(ch, indent+1) class TempAreaWindow(QtWidgets.QWidget): def __init__(self, area, **kwargs): QtWidgets.QWidget.__init__(self, **kwargs) self.layout = QtWidgets.QGridLayout() self.setLayout(self.layout) self.layout.setContentsMargins(0, 0, 0, 0) self.dockarea = area self.layout.addWidget(area) def closeEvent(self, *args): # restore docks to their original area docks = self.dockarea.findAll()[1] for dock in docks.values(): if hasattr(dock, 'orig_area'): dock.orig_area.addDock(dock, ) # clear dock area, and close remaining docks self.dockarea.clear() super().closeEvent(*args) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/dockarea/DockDrop.py000066400000000000000000000105641457240071200235120ustar00rootroot00000000000000__all__ = ["DockDrop"] from ..Qt import QtCore, QtGui, QtWidgets class DockDrop: """Provides dock-dropping methods""" def __init__(self, dndWidget): self.dndWidget = dndWidget self.allowedAreas = {'center', 'right', 'left', 'top', 'bottom'} self.dndWidget.setAcceptDrops(True) self.dropArea = None self.overlay = DropAreaOverlay(dndWidget) self.overlay.raise_() def addAllowedArea(self, area): self.allowedAreas.update(area) def removeAllowedArea(self, area): self.allowedAreas.discard(area) def resizeOverlay(self, size): self.overlay.resize(size) def raiseOverlay(self): self.overlay.raise_() def dragEnterEvent(self, ev): src = ev.source() if hasattr(src, 'implements') and src.implements('dock'): #print "drag enter accept" ev.accept() else: #print "drag enter ignore" ev.ignore() def dragMoveEvent(self, ev): #print "drag move" # QDragMoveEvent inherits QDropEvent which provides posF() # PyQt6 provides only position() width, height = self.dndWidget.width(), self.dndWidget.height() posF = ev.posF() if hasattr(ev, 'posF') else ev.position() ld = posF.x() rd = width - ld td = posF.y() bd = height - td mn = min(ld, rd, td, bd) if mn > 30: self.dropArea = "center" elif (ld == mn or td == mn) and mn > height/3: self.dropArea = "center" elif (rd == mn or ld == mn) and mn > width/3: self.dropArea = "center" elif rd == mn: self.dropArea = "right" elif ld == mn: self.dropArea = "left" elif td == mn: self.dropArea = "top" elif bd == mn: self.dropArea = "bottom" if ev.source() is self.dndWidget and self.dropArea == 'center': #print " no self-center" self.dropArea = None ev.ignore() elif self.dropArea not in self.allowedAreas: #print " not allowed" self.dropArea = None ev.ignore() else: #print " ok" ev.accept() self.overlay.setDropArea(self.dropArea) def dragLeaveEvent(self, ev): self.dropArea = None self.overlay.setDropArea(self.dropArea) def dropEvent(self, ev): area = self.dropArea if area is None: return if area == 'center': area = 'above' self.dndWidget.area.moveDock(ev.source(), area, self.dndWidget) self.dropArea = None self.overlay.setDropArea(self.dropArea) class DropAreaOverlay(QtWidgets.QWidget): """Overlay widget that draws drop areas during a drag-drop operation""" def __init__(self, parent): QtWidgets.QWidget.__init__(self, parent) self.dropArea = None self.hide() self.setAttribute(QtCore.Qt.WidgetAttribute.WA_TransparentForMouseEvents) def setDropArea(self, area): self.dropArea = area if area is None: self.hide() else: ## Resize overlay to just the region where drop area should be displayed. ## This works around a Qt bug--can't display transparent widgets over QGLWidget prgn = self.parent().rect() rgn = QtCore.QRect(prgn) w = min(30, int(prgn.width() / 3)) h = min(30, int(prgn.height() / 3)) if self.dropArea == 'left': rgn.setWidth(w) elif self.dropArea == 'right': rgn.setLeft(rgn.left() + prgn.width() - w) elif self.dropArea == 'top': rgn.setHeight(h) elif self.dropArea == 'bottom': rgn.setTop(rgn.top() + prgn.height() - h) elif self.dropArea == 'center': rgn.adjust(w, h, -w, -h) self.setGeometry(rgn) self.show() self.update() def paintEvent(self, ev): if self.dropArea is None: return p = QtGui.QPainter(self) rgn = self.rect() p.setBrush(QtGui.QBrush(QtGui.QColor(100, 100, 255, 50))) p.setPen(QtGui.QPen(QtGui.QColor(50, 50, 150), 3)) p.drawRect(rgn) p.end() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/dockarea/__init__.py000066400000000000000000000001011457240071200235260ustar00rootroot00000000000000from .Dock import Dock, DockLabel from .DockArea import DockArea pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/000077500000000000000000000000001457240071200214725ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/Arrow.py000066400000000000000000000026651457240071200231470ustar00rootroot00000000000000""" Display an animated arrowhead following a curve. This example uses the CurveArrow class, which is a combination of ArrowItem and CurvePoint. To place a static arrow anywhere in a scene, use ArrowItem. To attach other types of item to a curve, use CurvePoint. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtWidgets app = pg.mkQApp("Arrow Example") w = QtWidgets.QMainWindow() cw = pg.GraphicsLayoutWidget() w.show() w.resize(400,600) w.setCentralWidget(cw) w.setWindowTitle('pyqtgraph example: Arrow') p = cw.addPlot(row=0, col=0) p2 = cw.addPlot(row=1, col=0) ## variety of arrow shapes a1 = pg.ArrowItem(angle=-160, tipAngle=60, headLen=40, tailLen=40, tailWidth=20, pen={'color': 'w', 'width': 3}) a2 = pg.ArrowItem(angle=-120, tipAngle=30, baseAngle=20, headLen=40, tailLen=40, tailWidth=8, pen=None, brush='y') a3 = pg.ArrowItem(angle=-60, baseAngle=20, headLen=40, headWidth=20, tailLen=None, brush=None) a4 = pg.ArrowItem(angle=-20, tipAngle=30, baseAngle=-30, headLen=40, tailLen=None) a2.setPos(10,0) a3.setPos(20,0) a4.setPos(30,0) p.addItem(a1) p.addItem(a2) p.addItem(a3) p.addItem(a4) p.setRange(QtCore.QRectF(-20, -10, 60, 20)) ## Animated arrow following curve c = p2.plot(x=np.sin(np.linspace(0, 2*np.pi, 1000)), y=np.cos(np.linspace(0, 6*np.pi, 1000))) a = pg.CurveArrow(c) a.setStyle(headLen=40) p2.addItem(a) anim = a.makeAnimation(loop=-1) anim.start() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/AxisItem_label_overlap.py000066400000000000000000000042071457240071200264610ustar00rootroot00000000000000""" This example demonstrates many of the 2D plotting capabilities in pyqtgraph. All of the plots may be panned/scaled by dragging with the left/right mouse buttons. Right click on any plot to show a context menu. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtGui app = pg.mkQApp("AxisItem - label overlap settings") win = pg.GraphicsLayoutWidget(show=True, title="AxisItem - label overlap settings") win.resize(800,600) win.setWindowTitle("AxisItem - label overlap settings") # Enable antialiasing for prettier plots pg.setConfigOptions(antialias=True) x_data = np.arange(101) + 1_000. y_data = np.random.normal(scale=40., size=101) font = QtGui.QFont() font.setPointSize(14) # A larger font makes the effects more visible p1 = win.addPlot(title="Default settings: Overlap allowed for y axis", x=x_data, y=y_data) for axis_key in ('top', 'bottom', 'left', 'right'): ax = p1.getAxis(axis_key) ax.setTickFont( font ) p2 = win.addPlot(title="Overlap allowed for X axis", x=x_data, y=y_data) for axis_key, hide_overlap in ( ('top' , False), ('bottom', False), ('left' , True ), ('right' , True ) ): ax = p2.getAxis(axis_key) ax.setStyle( hideOverlappingLabels = hide_overlap ) ax.setTickFont( font ) win.nextRow() p3 = win.addPlot(title="All overlap disabled", x=x_data, y=y_data) for axis_key in ('top', 'bottom', 'left', 'right'): ax = p3.getAxis(axis_key) ax.setStyle( hideOverlappingLabels = True ) ax.setTickFont( font ) p4 = win.addPlot(title="All overlap enabled, custom tolerances", x=x_data, y=y_data) for axis_key, tolerance in ( ('top' , 15 ), ('bottom', 200 ), ('left' , 100 ), ('right' , 15 ) ): ax = p4.getAxis(axis_key) ax.setStyle( hideOverlappingLabels = tolerance ) ax.setTickFont( font ) # Link all axes and set viewing range with no padding: for p in (p1, p2, p3, p4): p.showAxes(True, showValues=(True, True, True, True)) if p != p1: p.setXLink(p1) p.setYLink(p1) ax.setTickFont( font ) p1.setXRange( 1_000., 1_100., padding=0.0) p1.setYRange(-60., 60., padding=0.0) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/BarGraphItem.py000066400000000000000000000013551457240071200243550ustar00rootroot00000000000000""" Simple example using BarGraphItem """ import numpy as np import pyqtgraph as pg win = pg.plot() win.setWindowTitle('pyqtgraph example: BarGraphItem') x = np.arange(10) y1 = np.sin(x) y2 = 1.1 * np.sin(x+1) y3 = 1.2 * np.sin(x+2) bg1 = pg.BarGraphItem(x=x, height=y1, width=0.3, brush='r') bg2 = pg.BarGraphItem(x=x+0.33, height=y2, width=0.3, brush='g') bg3 = pg.BarGraphItem(x=x+0.66, height=y3, width=0.3, brush='b') win.addItem(bg1) win.addItem(bg2) win.addItem(bg3) # Final example shows how to handle mouse clicks: class BarGraph(pg.BarGraphItem): def mouseClickEvent(self, event): print("clicked") bg = BarGraph(x=x, y=y1*0.3+2, height=0.4+y1*0.2, width=0.8) win.addItem(bg) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/CLIexample.py000066400000000000000000000011751457240071200240330ustar00rootroot00000000000000""" Display a plot and an image with minimal setup. pg.plot() and pg.image() are indended to be used from an interactive prompt to allow easy data inspection (but note that PySide unfortunately does not call the Qt event loop while the interactive prompt is running, in this case it is necessary to call QApplication.exec_() to make the windows appear). """ import numpy as np import pyqtgraph as pg data = np.random.normal(size=1000) pg.plot(data, title="Simplest possible plotting example") data = np.random.normal(size=(500,500)) pg.image(data, title="Simplest possible image example") if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ColorBarItem.py000066400000000000000000000064251457240071200243750ustar00rootroot00000000000000""" This example demonstrates the use of ColorBarItem, which displays a simple interactive color bar. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets, mkQApp class MainWindow(QtWidgets.QMainWindow): """ example application main window """ def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) gr_wid = pg.GraphicsLayoutWidget(show=True) self.setCentralWidget(gr_wid) self.setWindowTitle('pyqtgraph example: Interactive color bar') self.resize(800,700) self.show() ## Create image items data = np.fromfunction(lambda i, j: (1+0.3*np.sin(i)) * (i)**2 + (j)**2, (100, 100)) noisy_data = data * (1 + 0.2 * np.random.random(data.shape) ) noisy_transposed = noisy_data.transpose() #--- add non-interactive image with integrated color ------------------ p1 = gr_wid.addPlot(title="non-interactive") # Basic steps to create a false color image with color bar: i1 = pg.ImageItem(image=data) p1.addItem( i1 ) p1.addColorBar( i1, colorMap='CET-L9', values=(0, 30_000)) # , interactive=False) # p1.setMouseEnabled( x=False, y=False) p1.disableAutoRange() p1.hideButtons() p1.setRange(xRange=(0,100), yRange=(0,100), padding=0) p1.showAxes(True, showValues=(True,False,False,True) ) #--- add interactive image with integrated horizontal color bar ------- i2 = pg.ImageItem(image=noisy_data) p2 = gr_wid.addPlot(1,0, 1,1, title="interactive") p2.addItem( i2, title='' ) # inserted color bar also works with labels on the right. p2.showAxis('right') p2.getAxis('left').setStyle( showValues=False ) p2.getAxis('bottom').setLabel('bottom axis label') p2.getAxis('right').setLabel('right axis label') bar = pg.ColorBarItem( values = (0, 30_000), colorMap='CET-L4', label='horizontal color bar', limits = (0, None), rounding=1000, orientation = 'h', pen='#8888FF', hoverPen='#EEEEFF', hoverBrush='#EEEEFF80' ) bar.setImageItem( i2, insert_in=p2 ) #--- multiple images adjusted by a separate color bar ------------------------ i3 = pg.ImageItem(image=noisy_data) p3 = gr_wid.addPlot(0,1, 1,1, title="shared 1") p3.addItem( i3 ) i4 = pg.ImageItem(image=noisy_transposed) p4 = gr_wid.addPlot(1,1, 1,1, title="shared 2") p4.addItem( i4 ) cmap = pg.colormap.get('CET-L8') bar = pg.ColorBarItem( # values = (-15_000, 15_000), limits = (-30_000, 30_000), # start with full range... rounding=1000, width = 10, colorMap=cmap ) bar.setImageItem( [i3, i4] ) bar.setLevels( low=-5_000, high=15_000) # ... then adjust to retro sunset. # manually adjust reserved space at top and bottom to align with plot bar.getAxis('bottom').setHeight(21) bar.getAxis('top').setHeight(31) gr_wid.addItem(bar, 0,2, 2,1) # large bar spanning both rows mkQApp("ColorBarItem Example") main_window = MainWindow() ## Start Qt event loop if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ColorButton.py000066400000000000000000000011341457240071200243150ustar00rootroot00000000000000""" Simple example demonstrating a button which displays a colored rectangle and allows the user to select a new color by clicking on the button. """ import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets app = pg.mkQApp("ColorButton Example") win = QtWidgets.QMainWindow() btn = pg.ColorButton() win.setCentralWidget(btn) win.show() win.setWindowTitle('pyqtgraph example: ColorButton') def change(btn): print("change", btn.color()) def done(btn): print("done", btn.color()) btn.sigColorChanging.connect(change) btn.sigColorChanged.connect(done) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ColorGradientPlots.py000066400000000000000000000140461457240071200256270ustar00rootroot00000000000000""" This example demonstrates plotting with color gradients. It also shows multiple plots with timed rolling updates """ import time import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore, mkQApp class DataSource(object): """ source of buffered demonstration data """ def __init__(self, sample_rate=200., signal_period=0.55, negative_period=None, max_length=300): """ prepare, but don't start yet """ self.rate = sample_rate self.period = signal_period self.neg_period = negative_period self.start_time = 0. self.sample_idx = 0 # number of next sample to be taken def start(self, timestamp): """ start acquiring simulated data """ self.start_time = timestamp self.sample_idx = 0 def get_data(self, timestamp, max_length=6000): """ return all data acquired since last get_data call """ next_idx = int( (timestamp - self.start_time) * self.rate ) if next_idx - self.sample_idx > max_length: self.sample_idx = next_idx - max_length # catch up if needed # create some mildly intersting data: sample_phases = np.arange( self.sample_idx, next_idx, dtype=np.float64 ) self.sample_idx = next_idx sample_phase_pos = sample_phases / (self.period*self.rate) sample_phase_pos %= 1.0 if self.neg_period is None: return sample_phase_pos**4 sample_phase_neg = sample_phases / (self.neg_period*self.rate) sample_phase_neg %= 1.0 return sample_phase_pos**4 - sample_phase_neg**4 class MainWindow(pg.GraphicsLayoutWidget): """ example application main window """ def __init__(self): super().__init__() self.setWindowTitle('pyqtgraph example: gradient plots') self.resize(800,800) self.show() layout = self # we are using a GraphicsLayoutWidget as main window for convenience cm = pg.colormap.get('CET-L17') cm.reverse() pen0 = cm.getPen( span=(0.0,1.0), width=5 ) curve0 = pg.PlotDataItem(pen=pen0 ) comment0 = 'Clipped color map applied to vertical axis' cm = pg.colormap.get('CET-D1') cm.setMappingMode('diverging') brush = cm.getBrush( span=(-1., 1.), orientation='vertical' ) curve1 = pg.PlotDataItem(pen='w', brush=brush, fillLevel=0.0 ) comment1 = 'Diverging vertical color map used as brush' cm = pg.colormap.get('CET-L17') cm.setMappingMode('mirror') pen2 = cm.getPen( span=(400.0,600.0), width=5, orientation='horizontal' ) curve2 = pg.PlotDataItem(pen=pen2 ) comment2 = 'Mirrored color map applied to horizontal axis' cm = pg.colormap.get('CET-C2') cm.setMappingMode('repeat') pen3 = cm.getPen( span=(100, 200), width=5, orientation='horizontal' ) curve3 = pg.PlotDataItem(pen=pen3 ) # vertical diverging fill comment3 = 'Repeated color map applied to horizontal axis' curves = (curve0, curve1, curve2, curve3) comments = (comment0, comment1, comment2, comment3) length = int( 3.0 * 200. ) # length of display in samples self.top_plot = None for idx, (curve, comment) in enumerate( zip(curves,comments) ): plot = layout.addPlot(row=idx+1, col=0) text = pg.TextItem( comment, anchor=(0,1) ) text.setPos(0.,1.) if self.top_plot is None: self.top_plot = plot else: plot.setXLink( self.top_plot ) plot.addItem( curve ) plot.addItem( text ) plot.setXRange( 0, length ) if idx != 1: plot.setYRange( 0. , 1.1 ) else : plot.setYRange( -1. , 1.2 ) # last plot include positive/negative data self.traces = ( {'crv': curve0, 'buf': np.zeros( length ), 'ptr':0, 'ds': DataSource( signal_period=0.55 ) }, {'crv': curve1, 'buf': np.zeros( length ), 'ptr':0, 'ds': DataSource( signal_period=0.61, negative_period=0.55 ) }, {'crv': curve2, 'buf': np.zeros( length ), 'ptr':0, 'ds': DataSource( signal_period=0.65 ) }, {'crv': curve3, 'buf': np.zeros( length ), 'ptr':0, 'ds': DataSource( signal_period=0.52 ) }, ) self.timer = QtCore.QTimer(timerType=QtCore.Qt.TimerType.PreciseTimer) self.timer.timeout.connect(self.update) timestamp = time.perf_counter() for dic in self.traces: dic['ds'].start( timestamp ) self.last_update = time.perf_counter() self.mean_dt = None self.timer.start(33) def update(self): """ called by timer at 30 Hz """ timestamp = time.perf_counter() # measure actual update rate: dt = timestamp - self.last_update if self.mean_dt is None: self.mean_dt = dt else: self.mean_dt = 0.95 * self.mean_dt + 0.05 * dt # average over fluctuating measurements self.top_plot.setTitle( 'refresh: {:0.1f}ms -> {:0.1f} fps'.format( 1000*self.mean_dt, 1/self.mean_dt ) ) # handle rolling buffer: self.last_update = timestamp for dic in self.traces: new_data = dic['ds'].get_data( timestamp ) idx_a = dic['ptr'] idx_b = idx_a + len( new_data ) len_buffer = dic['buf'].shape[0] if idx_b < len_buffer: # data does not cross buffer boundary dic['buf'][idx_a:idx_b] = new_data else: # part of the new data needs to roll over to beginning of buffer len_1 = len_buffer - idx_a # this many elements still fit dic['buf'][idx_a:idx_a+len_1] = new_data[:len_1] # first part of data at end idx_b = len(new_data) - len_1 dic['buf'][0:idx_b] = new_data[len_1:] # second part of data at re-start dic['ptr'] = idx_b dic['crv'].setData( dic['buf'] ) mkQApp("Gradient plotting example") main_window = MainWindow() ## Start Qt event loop if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ConsoleWidget.py000066400000000000000000000015071457240071200246150ustar00rootroot00000000000000""" ConsoleWidget is used to allow execution of user-supplied python commands in an application. It also includes a command history and functionality for trapping and inspecting stack traces. """ import numpy as np import pyqtgraph as pg import pyqtgraph.console app = pg.mkQApp() ## build an initial namespace for console commands to be executed in (this is optional; ## the user can always import these modules manually) namespace = {'pg': pg, 'np': np} ## initial text to display in the console text = """ This is an interactive python console. The numpy and pyqtgraph modules have already been imported as 'np' and 'pg'. Go, play. """ c = pyqtgraph.console.ConsoleWidget(namespace=namespace, text=text) c.resize(800, 400) c.show() c.setWindowTitle('pyqtgraph example: ConsoleWidget') if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/CustomGraphItem.py000066400000000000000000000065201457240071200251220ustar00rootroot00000000000000""" Simple example of subclassing GraphItem. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore # Enable antialiasing for prettier plots pg.setConfigOptions(antialias=True) w = pg.GraphicsLayoutWidget(show=True) w.setWindowTitle('pyqtgraph example: CustomGraphItem') v = w.addViewBox() v.setAspectLocked() class Graph(pg.GraphItem): def __init__(self): self.dragPoint = None self.dragOffset = None self.textItems = [] pg.GraphItem.__init__(self) self.scatter.sigClicked.connect(self.clicked) def setData(self, **kwds): self.text = kwds.pop('text', []) self.data = kwds if 'pos' in self.data: npts = self.data['pos'].shape[0] self.data['data'] = np.empty(npts, dtype=[('index', int)]) self.data['data']['index'] = np.arange(npts) self.setTexts(self.text) self.updateGraph() def setTexts(self, text): for i in self.textItems: i.scene().removeItem(i) self.textItems = [] for t in text: item = pg.TextItem(t) self.textItems.append(item) item.setParentItem(self) def updateGraph(self): pg.GraphItem.setData(self, **self.data) for i,item in enumerate(self.textItems): item.setPos(*self.data['pos'][i]) def mouseDragEvent(self, ev): if ev.button() != QtCore.Qt.MouseButton.LeftButton: ev.ignore() return if ev.isStart(): # We are already one step into the drag. # Find the point(s) at the mouse cursor when the button was first # pressed: pos = ev.buttonDownPos() pts = self.scatter.pointsAt(pos) if len(pts) == 0: ev.ignore() return self.dragPoint = pts[0] ind = pts[0].data()[0] self.dragOffset = self.data['pos'][ind] - pos elif ev.isFinish(): self.dragPoint = None return else: if self.dragPoint is None: ev.ignore() return ind = self.dragPoint.data()[0] self.data['pos'][ind] = ev.pos() + self.dragOffset self.updateGraph() ev.accept() def clicked(self, pts): print("clicked: %s" % pts) g = Graph() v.addItem(g) ## Define positions of nodes pos = np.array([ [0,0], [10,0], [0,10], [10,10], [5,5], [15,5] ], dtype=float) ## Define the set of connections in the graph adj = np.array([ [0,1], [1,3], [3,2], [2,0], [1,5], [3,5], ]) ## Define the symbol to use for each node (this is optional) symbols = ['o','o','o','o','t','+'] ## Define the line style for each connection (this is optional) lines = np.array([ (255,0,0,255,1), (255,0,255,255,2), (255,0,255,255,3), (255,255,0,255,2), (255,0,0,255,1), (255,255,255,255,4), ], dtype=[('red',np.ubyte),('green',np.ubyte),('blue',np.ubyte),('alpha',np.ubyte),('width',float)]) ## Define text to show next to each symbol texts = ["Point %d" % i for i in range(6)] ## Update the graph g.setData(pos=pos, adj=adj, pen=lines, size=1, symbol=symbols, pxMode=False, text=texts) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/DataSlicing.py000066400000000000000000000027131457240071200242310ustar00rootroot00000000000000""" Demonstrate a simple data-slicing task: given 3D data (displayed at top), select a 2D plane and interpolate data along that plane to generate a slice image (displayed at bottom). """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets app = pg.mkQApp("Data Slicing Example") ## Create window with two ImageView widgets win = QtWidgets.QMainWindow() win.resize(800,800) win.setWindowTitle('pyqtgraph example: DataSlicing') cw = QtWidgets.QWidget() win.setCentralWidget(cw) l = QtWidgets.QGridLayout() cw.setLayout(l) imv1 = pg.ImageView() imv2 = pg.ImageView() l.addWidget(imv1, 0, 0) l.addWidget(imv2, 1, 0) win.show() roi = pg.LineSegmentROI([[10, 64], [120,64]], pen='r') imv1.addItem(roi) x1 = np.linspace(-30, 10, 128)[:, np.newaxis, np.newaxis] x2 = np.linspace(-20, 20, 128)[:, np.newaxis, np.newaxis] y = np.linspace(-30, 10, 128)[np.newaxis, :, np.newaxis] z = np.linspace(-20, 20, 128)[np.newaxis, np.newaxis, :] d1 = np.sqrt(x1**2 + y**2 + z**2) d2 = 2*np.sqrt(x1[::-1]**2 + y**2 + z**2) d3 = 4*np.sqrt(x2**2 + y[:,::-1]**2 + z**2) data = (np.sin(d1) / d1**2) + (np.sin(d2) / d2**2) + (np.sin(d3) / d3**2) def update(): global data, imv1, imv2 d2 = roi.getArrayRegion(data, imv1.imageItem, axes=(1,2)) imv2.setImage(d2) roi.sigRegionChanged.connect(update) ## Display the data imv1.setImage(data) imv1.setHistogramRange(-0.01, 0.01) imv1.setLevels(-0.003, 0.003) update() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/DataTreeWidget.py000066400000000000000000000015511457240071200247030ustar00rootroot00000000000000 """ Simple use of DataTreeWidget to display a structure of nested dicts, lists, and arrays """ import numpy as np import pyqtgraph as pg # for generating a traceback object to display def some_func1(): return some_func2() def some_func2(): try: raise Exception() except: import sys return sys.exc_info()[2] app = pg.mkQApp("DataTreeWidget Example") d = { 'a list': [1,2,3,4,5,6, {'nested1': 'aaaaa', 'nested2': 'bbbbb'}, "seven"], 'a dict': { 'x': 1, 'y': 2, 'z': 'three' }, 'an array': np.random.randint(10, size=(40,10)), 'a traceback': some_func1(), 'a function': some_func1, 'a class': pg.DataTreeWidget, } tree = pg.DataTreeWidget(data=d) tree.show() tree.setWindowTitle('pyqtgraph example: DataTreeWidget') tree.resize(600,600) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/DateAxisItem.py000066400000000000000000000012261457240071200243660ustar00rootroot00000000000000""" Demonstrates the usage of DateAxisItem to display properly-formatted timestamps on x-axis which automatically adapt to current zoom level. """ import time import numpy as np import pyqtgraph as pg app = pg.mkQApp("DateAxisItem Example") # Create a plot with a date-time axis w = pg.PlotWidget(axisItems = {'bottom': pg.DateAxisItem()}) w.showGrid(x=True, y=True) # Plot sin(1/x^2) with timestamps in the last 100 years now = time.time() x = np.linspace(2*np.pi, 1000*2*np.pi, 8301) w.plot(now-(2*np.pi/x)**2*100*np.pi*1e7, np.sin(x), symbol='o') w.setWindowTitle('pyqtgraph example: DateAxisItem') w.show() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/DateAxisItem_QtDesigner.py000066400000000000000000000026041457240071200265140ustar00rootroot00000000000000""" Demonstrates the usage of DateAxisItem in a layout created with Qt Designer. The spotlight here is on the 'setAxisItems' method, without which one would have to subclass plotWidget in order to attach a dateaxis to it. """ import os import time import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets, loadUiType pg.setConfigOption('background', 'w') pg.setConfigOption('foreground', 'k') BLUE = pg.mkPen('#1f77b4') path = os.path.dirname(os.path.abspath(__file__)) uiFile = os.path.join(path, 'DateAxisItem_QtDesigner.ui') Design, _ = loadUiType(uiFile) class ExampleApp(QtWidgets.QMainWindow, Design): def __init__(self): super().__init__() self.setupUi(self) now = time.time() # Plot random values with timestamps in the last 6 months timestamps = np.linspace(now - 6*30*24*3600, now, 100) self.curve = self.plotWidget.plot(x=timestamps, y=np.random.rand(100), symbol='o', symbolSize=5, pen=BLUE) # 'o' circle 't' triangle 'd' diamond '+' plus 's' square self.plotWidget.setAxisItems({'bottom': pg.DateAxisItem()}) self.plotWidget.showGrid(x=True, y=True) app = pg.mkQApp("DateAxisItem_QtDesigner Example") window = ExampleApp() window.setWindowTitle('pyqtgraph example: DateAxisItem_QtDesigner') window.show() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/DateAxisItem_QtDesigner.ui000066400000000000000000000017621457240071200265050ustar00rootroot00000000000000 MainWindow 0 0 536 381 MainWindow 0 0 536 18 PlotWidget QGraphicsView
      pyqtgraph
      pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/DiffTreeWidget.py000066400000000000000000000017151457240071200247040ustar00rootroot00000000000000 """ Simple use of DiffTreeWidget to display differences between structures of nested dicts, lists, and arrays. """ import numpy as np import pyqtgraph as pg app = pg.mkQApp("DiffTreeWidget Example") A = { 'a list': [1,2,2,4,5,6, {'nested1': 'aaaa', 'nested2': 'bbbbb'}, "seven"], 'a dict': { 'x': 1, 'y': 2, 'z': 'three' }, 'an array': np.random.randint(10, size=(40,10)), #'a traceback': some_func1(), #'a function': some_func1, #'a class': pg.DataTreeWidget, } B = { 'a list': [1,2,3,4,5,5, {'nested1': 'aaaaa', 'nested2': 'bbbbb'}, "seven"], 'a dict': { 'x': 2, 'y': 2, 'z': 'three', 'w': 5 }, 'another dict': {1:2, 2:3, 3:4}, 'an array': np.random.randint(10, size=(40,10)), } tree = pg.DiffTreeWidget() tree.setData(A, B) tree.show() tree.setWindowTitle('pyqtgraph example: DiffTreeWidget') tree.resize(1000, 800) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/Draw.py000066400000000000000000000014761457240071200227510ustar00rootroot00000000000000""" Demonstrate ability of ImageItem to be used as a canvas for painting with the mouse. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore app = pg.mkQApp("Draw Example") ## Create window with GraphicsView widget w = pg.GraphicsView() w.show() w.resize(800,800) w.setWindowTitle('pyqtgraph example: Draw') view = pg.ViewBox() w.setCentralItem(view) ## lock the aspect ratio view.setAspectLocked(True) ## Create image item img = pg.ImageItem(np.zeros((200,200))) view.addItem(img) ## Set initial view bounds view.setRange(QtCore.QRectF(0, 0, 200, 200)) ## start drawing with 3x3 brush kern = np.array([ [0.0, 0.5, 0.0], [0.5, 1.0, 0.5], [0.0, 0.5, 0.0] ]) img.setDrawKernel(kern, mask=kern, center=(1,1), mode='add') img.setLevels([0, 10]) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ErrorBarItem.py000066400000000000000000000007501457240071200244030ustar00rootroot00000000000000""" Demonstrates basic use of ErrorBarItem """ import numpy as np import pyqtgraph as pg pg.setConfigOptions(antialias=True) x = np.arange(10) y = np.arange(10) %3 top = np.linspace(1.0, 3.0, 10) bottom = np.linspace(2, 0.5, 10) plt = pg.plot() plt.setWindowTitle('pyqtgraph example: ErrorBarItem') err = pg.ErrorBarItem(x=x, y=y, top=top, bottom=bottom, beam=0.5) plt.addItem(err) plt.plot(x, y, symbol='o', pen={'color': 0.8, 'width': 2}) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ExampleApp.py000066400000000000000000000507141457240071200241070ustar00rootroot00000000000000import keyword import os import pkgutil import re import subprocess import sys from argparse import Namespace from collections import OrderedDict from functools import lru_cache import pyqtgraph as pg from pyqtgraph.Qt import QT_LIB, QtCore, QtGui, QtWidgets app = pg.mkQApp() path = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, path) import exampleLoaderTemplate_generic as ui_template import utils # based on https://github.com/art1415926535/PyQt5-syntax-highlighting QRegularExpression = QtCore.QRegularExpression QFont = QtGui.QFont QColor = QtGui.QColor QTextCharFormat = QtGui.QTextCharFormat QSyntaxHighlighter = QtGui.QSyntaxHighlighter def charFormat(color, style='', background=None): """ Return a QTextCharFormat with the given attributes. """ _color = pg.functions.mkColor(color) _format = QTextCharFormat() _format.setForeground(_color) if 'bold' in style: _format.setFontWeight(QFont.Weight.Bold) if 'italic' in style: _format.setFontItalic(True) if background is not None: _format.setBackground(pg.mkColor(background)) return _format class LightThemeColors: Red = "#B71C1C" Pink = "#FCE4EC" Purple = "#4A148C" DeepPurple = "#311B92" Indigo = "#1A237E" Blue = "#0D47A1" LightBlue = "#01579B" Cyan = "#006064" Teal = "#004D40" Green = "#1B5E20" LightGreen = "#33691E" Lime = "#827717" Yellow = "#F57F17" Amber = "#FF6F00" Orange = "#E65100" DeepOrange = "#BF360C" Brown = "#3E2723" Grey = "#212121" BlueGrey = "#263238" class DarkThemeColors: Red = "#F44336" Pink = "#F48FB1" Purple = "#CE93D8" DeepPurple = "#B39DDB" Indigo = "#9FA8DA" Blue = "#90CAF9" LightBlue = "#81D4FA" Cyan = "#80DEEA" Teal = "#80CBC4" Green = "#A5D6A7" LightGreen = "#C5E1A5" Lime = "#E6EE9C" Yellow = "#FFF59D" Amber = "#FFE082" Orange = "#FFCC80" DeepOrange = "#FFAB91" Brown = "#BCAAA4" Grey = "#EEEEEE" BlueGrey = "#B0BEC5" LIGHT_STYLES = { 'keyword': charFormat(LightThemeColors.Blue, 'bold'), 'operator': charFormat(LightThemeColors.Red, 'bold'), 'brace': charFormat(LightThemeColors.Purple), 'defclass': charFormat(LightThemeColors.Indigo, 'bold'), 'string': charFormat(LightThemeColors.Amber), 'string2': charFormat(LightThemeColors.DeepPurple), 'comment': charFormat(LightThemeColors.Green, 'italic'), 'self': charFormat(LightThemeColors.Blue, 'bold'), 'numbers': charFormat(LightThemeColors.Teal), } DARK_STYLES = { 'keyword': charFormat(DarkThemeColors.Blue, 'bold'), 'operator': charFormat(DarkThemeColors.Red, 'bold'), 'brace': charFormat(DarkThemeColors.Purple), 'defclass': charFormat(DarkThemeColors.Indigo, 'bold'), 'string': charFormat(DarkThemeColors.Amber), 'string2': charFormat(DarkThemeColors.DeepPurple), 'comment': charFormat(DarkThemeColors.Green, 'italic'), 'self': charFormat(DarkThemeColors.Blue, 'bold'), 'numbers': charFormat(DarkThemeColors.Teal), } class PythonHighlighter(QSyntaxHighlighter): """Syntax highlighter for the Python language. """ # Python keywords keywords = keyword.kwlist # Python operators operators = [ r'=', # Comparison r'==', r'!=', r'<', r'<=', r'>', r'>=', # Arithmetic r'\+', r"-", r'\*', r'/', r'//', r'%', r'\*\*', # In-place r'\+=', r'-=', r'\*=', r'/=', r'\%=', # Bitwise r'\^', r'\|', r'&', r'~', r'>>', r'<<', ] # Python braces braces = [ r'\{', r'\}', r'\(', r'\)', r'\[', r'\]', ] def __init__(self, document): super().__init__(document) # Multi-line strings (expression, flag, style) self.tri_single = (QRegularExpression("'''"), 1, 'string2') self.tri_double = (QRegularExpression('"""'), 2, 'string2') rules = [] # Keyword, operator, and brace rules rules += [(r'\b%s\b' % w, 0, 'keyword') for w in PythonHighlighter.keywords] rules += [(o, 0, 'operator') for o in PythonHighlighter.operators] rules += [(b, 0, 'brace') for b in PythonHighlighter.braces] # All other rules rules += [ # 'self' (r'\bself\b', 0, 'self'), # 'def' followed by an identifier (r'\bdef\b\s*(\w+)', 1, 'defclass'), # 'class' followed by an identifier (r'\bclass\b\s*(\w+)', 1, 'defclass'), # Numeric literals (r'\b[+-]?[0-9]+[lL]?\b', 0, 'numbers'), (r'\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\b', 0, 'numbers'), (r'\b[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\b', 0, 'numbers'), # Double-quoted string, possibly containing escape sequences (r'"[^"\\]*(\\.[^"\\]*)*"', 0, 'string'), # Single-quoted string, possibly containing escape sequences (r"'[^'\\]*(\\.[^'\\]*)*'", 0, 'string'), # From '#' until a newline (r'#[^\n]*', 0, 'comment'), ] self.rules = rules self.searchText = None @property def styles(self): app = QtWidgets.QApplication.instance() return DARK_STYLES if app.property('darkMode') else LIGHT_STYLES def highlightBlock(self, text): """Apply syntax highlighting to the given block of text. """ # Do other syntax formatting rules = self.rules.copy() for expression, nth, format in rules: format = self.styles[format] for n, match in enumerate(re.finditer(expression, text)): if n < nth: continue start = match.start() length = match.end() - start self.setFormat(start, length, format) self.applySearchHighlight(text) self.setCurrentBlockState(0) # Do multi-line strings in_multiline = self.match_multiline(text, *self.tri_single) if not in_multiline: in_multiline = self.match_multiline(text, *self.tri_double) def match_multiline(self, text, delimiter, in_state, style): """Do highlighting of multi-line strings. =========== ========================================================== delimiter (QRegularExpression) for triple-single-quotes or triple-double-quotes in_state (int) to represent the corresponding state changes when inside those strings. Returns True if we're still inside a multi-line string when this function is finished. style (str) representation of the kind of style to use =========== ========================================================== """ # If inside triple-single quotes, start at 0 if self.previousBlockState() == in_state: start = 0 add = 0 # Otherwise, look for the delimiter on this line else: match = delimiter.match(text) start = match.capturedStart() # Move past this match add = match.capturedLength() # As long as there's a delimiter match on this line... while start >= 0: # Look for the ending delimiter match = delimiter.match(text, start + add) end = match.capturedEnd() # Ending delimiter on this line? if end >= add: length = end - start + add + match.capturedLength() self.setCurrentBlockState(0) # No; multi-line string else: self.setCurrentBlockState(in_state) length = len(text) - start + add # Apply formatting self.setFormat(start, length, self.styles[style]) # Highlighting sits on top of this formatting # Look for the next match match = delimiter.match(text, start + length) start = match.capturedStart() self.applySearchHighlight(text) # Return True if still inside a multi-line string, False otherwise if self.currentBlockState() == in_state: return True else: return False def applySearchHighlight(self, text): if not self.searchText: return expr = f'(?i){self.searchText}' palette: QtGui.QPalette = app.palette() color = palette.highlight().color() fgndColor = palette.color(palette.ColorGroup.Current, palette.ColorRole.Text).name() style = charFormat(fgndColor, background=color.name()) for match in re.finditer(expr, text): start = match.start() length = match.end() - start self.setFormat(start, length, style) def unnestedDict(exDict): """Converts a dict-of-dicts to a singly nested dict for non-recursive parsing""" out = {} for kk, vv in exDict.items(): if isinstance(vv, dict): out.update(unnestedDict(vv)) else: out[kk] = vv return out class ExampleLoader(QtWidgets.QMainWindow): # update qtLibCombo item order to match bindings in the UI file and recreate # the templates files if you change bindings. bindings = {'PyQt6': 0, 'PySide6': 1, 'PyQt5': 2, 'PySide2': 3} modules = tuple(m.name for m in pkgutil.iter_modules()) def __init__(self): QtWidgets.QMainWindow.__init__(self) self.ui = ui_template.Ui_Form() self.cw = QtWidgets.QWidget() self.setCentralWidget(self.cw) self.ui.setupUi(self.cw) self.setWindowTitle("PyQtGraph Examples") self.codeBtn = QtWidgets.QPushButton('Run Edited Code') self.codeLayout = QtWidgets.QGridLayout() self.ui.codeView.setLayout(self.codeLayout) self.hl = PythonHighlighter(self.ui.codeView.document()) app = QtWidgets.QApplication.instance() app.paletteChanged.connect(self.updateTheme) policy = QtWidgets.QSizePolicy.Policy.Expanding self.codeLayout.addItem(QtWidgets.QSpacerItem(100,100, policy, policy), 0, 0) self.codeLayout.addWidget(self.codeBtn, 1, 1) self.codeBtn.hide() textFil = self.ui.exampleFilter self.curListener = None self.ui.exampleFilter.setFocus() self.ui.qtLibCombo.addItems(self.bindings.keys()) self.ui.qtLibCombo.setCurrentIndex(self.bindings[QT_LIB]) def onComboChanged(searchType): if self.curListener is not None: self.curListener.disconnect() self.curListener = textFil.textChanged # In case the regex was invalid before switching to title search, # ensure the "invalid" color is reset self.ui.exampleFilter.setStyleSheet('') if searchType == 'Content Search': self.curListener.connect(self.filterByContent) else: self.hl.searchText = None self.curListener.connect(self.filterByTitle) # Fire on current text, too self.curListener.emit(textFil.text()) self.ui.searchFiles.currentTextChanged.connect(onComboChanged) onComboChanged(self.ui.searchFiles.currentText()) self.itemCache = [] self.populateTree(self.ui.exampleTree.invisibleRootItem(), utils.examples_) self.ui.exampleTree.expandAll() self.resize(1000,500) self.show() self.ui.splitter.setSizes([250,750]) self.oldText = self.ui.codeView.toPlainText() self.ui.loadBtn.clicked.connect(self.loadFile) self.ui.exampleTree.currentItemChanged.connect(self.showFile) self.ui.exampleTree.itemDoubleClicked.connect(self.loadFile) self.ui.codeView.textChanged.connect(self.onTextChange) self.codeBtn.clicked.connect(self.runEditedCode) self.updateCodeViewTabWidth(self.ui.codeView.font()) def updateCodeViewTabWidth(self,font): """ Change the codeView tabStopDistance to 4 spaces based on the size of the current font """ fm = QtGui.QFontMetrics(font) tabWidth = fm.horizontalAdvance(' ' * 4) # the default value is 80 pixels! that's more than 2x what we want. self.ui.codeView.setTabStopDistance(tabWidth) def showEvent(self, event) -> None: super(ExampleLoader, self).showEvent(event) disabledColor = QColor(QtCore.Qt.GlobalColor.red) for name, idx in self.bindings.items(): disableBinding = name not in self.modules if disableBinding: item = self.ui.qtLibCombo.model().item(idx) item.setData(disabledColor, QtCore.Qt.ItemDataRole.ForegroundRole) item.setEnabled(False) item.setToolTip(f'{item.text()} is not installed') def onTextChange(self): """ textChanged fires when the highlighter is reassigned the same document. Prevent this from showing "run edited code" by checking for actual content change """ newText = self.ui.codeView.toPlainText() if newText != self.oldText: self.oldText = newText self.codeEdited() def filterByTitle(self, text): self.showExamplesByTitle(self.getMatchingTitles(text)) self.hl.setDocument(self.ui.codeView.document()) def filterByContent(self, text=None): # If the new text isn't valid regex, fail early and highlight the search filter red to indicate a problem # to the user validRegex = True try: re.compile(text) self.ui.exampleFilter.setStyleSheet('') except re.error: colors = DarkThemeColors if app.property('darkMode') else LightThemeColors errorColor = pg.mkColor(colors.Red) validRegex = False errorColor.setAlpha(100) # Tuple prints nicely :) self.ui.exampleFilter.setStyleSheet(f'background: rgba{errorColor.getRgb()}') if not validRegex: return checkDict = unnestedDict(utils.examples_) self.hl.searchText = text # Need to reapply to current document self.hl.setDocument(self.ui.codeView.document()) titles = [] text = text.lower() for kk, vv in checkDict.items(): if isinstance(vv, Namespace): vv = vv.filename filename = os.path.join(path, vv) contents = self.getExampleContent(filename).lower() if text in contents: titles.append(kk) self.showExamplesByTitle(titles) def getMatchingTitles(self, text, exDict=None, acceptAll=False): if exDict is None: exDict = utils.examples_ text = text.lower() titles = [] for kk, vv in exDict.items(): matched = acceptAll or text in kk.lower() if isinstance(vv, dict): titles.extend(self.getMatchingTitles(text, vv, acceptAll=matched)) elif matched: titles.append(kk) return titles def showExamplesByTitle(self, titles): QTWI = QtWidgets.QTreeWidgetItemIterator flag = QTWI.IteratorFlag.NoChildren treeIter = QTWI(self.ui.exampleTree, flag) item = treeIter.value() while item is not None: parent = item.parent() show = (item.childCount() or item.text(0) in titles) item.setHidden(not show) # If all children of a parent are gone, hide it if parent: hideParent = True for ii in range(parent.childCount()): if not parent.child(ii).isHidden(): hideParent = False break parent.setHidden(hideParent) treeIter += 1 item = treeIter.value() def simulate_black_mode(self): """ used to simulate MacOS "black mode" on other platforms intended for debug only, as it manage only the QPlainTextEdit """ # first, a dark background c = QtGui.QColor('#171717') p = self.ui.codeView.palette() p.setColor(QtGui.QPalette.ColorGroup.Active, QtGui.QPalette.ColorRole.Base, c) p.setColor(QtGui.QPalette.ColorGroup.Inactive, QtGui.QPalette.ColorRole.Base, c) self.ui.codeView.setPalette(p) # then, a light font f = QtGui.QTextCharFormat() f.setForeground(QtGui.QColor('white')) self.ui.codeView.setCurrentCharFormat(f) # finally, override application automatic detection app = QtWidgets.QApplication.instance() app.setProperty('darkMode', True) def updateTheme(self): self.hl = PythonHighlighter(self.ui.codeView.document()) def populateTree(self, root, examples): bold_font = None for key, val in examples.items(): item = QtWidgets.QTreeWidgetItem([key]) self.itemCache.append(item) # PyQt 4.9.6 no longer keeps references to these wrappers, # so we need to make an explicit reference or else the .file # attribute will disappear. if isinstance(val, OrderedDict): self.populateTree(item, val) elif isinstance(val, Namespace): item.file = val.filename if 'recommended' in val: if bold_font is None: bold_font = item.font(0) bold_font.setBold(True) item.setFont(0, bold_font) else: item.file = val root.addChild(item) def currentFile(self): item = self.ui.exampleTree.currentItem() if hasattr(item, 'file'): return os.path.join(path, item.file) return None def loadFile(self, *, edited=False): # make *edited* keyword-only so it is not confused for extra arguments # sent by ui signals qtLib = self.ui.qtLibCombo.currentText() env = dict(os.environ, PYQTGRAPH_QT_LIB=qtLib) example_path = os.path.abspath(os.path.dirname(__file__)) path = os.path.dirname(os.path.dirname(example_path)) env['PYTHONPATH'] = f'{path}' if edited: proc = subprocess.Popen([sys.executable, '-'], stdin=subprocess.PIPE, cwd=example_path, env=env) code = self.ui.codeView.toPlainText().encode('UTF-8') proc.stdin.write(code) proc.stdin.close() else: fn = self.currentFile() if fn is None: return subprocess.Popen([sys.executable, fn], cwd=path, env=env) def showFile(self): fn = self.currentFile() text = self.getExampleContent(fn) self.ui.codeView.setPlainText(text) self.ui.loadedFileLabel.setText(fn) self.codeBtn.hide() @lru_cache(100) def getExampleContent(self, filename): if filename is None: self.ui.codeView.clear() return if os.path.isdir(filename): filename = os.path.join(filename, '__main__.py') with open(filename, "r") as currentFile: text = currentFile.read() return text def codeEdited(self): self.codeBtn.show() def runEditedCode(self): self.loadFile(edited=True) def keyPressEvent(self, event): super().keyPressEvent(event) if not (event.modifiers() & QtCore.Qt.KeyboardModifier.ControlModifier): return key = event.key() Key = QtCore.Qt.Key # Allow quick navigate to search if key == Key.Key_F: self.ui.exampleFilter.setFocus() event.accept() return if key not in [Key.Key_Plus, Key.Key_Minus, Key.Key_Underscore, Key.Key_Equal, Key.Key_0]: return font = self.ui.codeView.font() oldSize = font.pointSize() if key == Key.Key_Plus or key == Key.Key_Equal: font.setPointSize(oldSize + max(oldSize*.15, 1)) elif key == Key.Key_Minus or key == Key.Key_Underscore: newSize = oldSize - max(oldSize*.15, 1) font.setPointSize(max(newSize, 1)) elif key == Key.Key_0: # Reset to original size font.setPointSize(10) self.ui.codeView.setFont(font) self.updateCodeViewTabWidth(font) event.accept() def main(): app = pg.mkQApp() loader = ExampleLoader() loader.ui.exampleTree.setCurrentIndex( loader.ui.exampleTree.model().index(0,0) ) pg.exec() if __name__ == '__main__': main() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/FillBetweenItem.py000066400000000000000000000023161457240071200250650ustar00rootroot00000000000000""" Demonstrates use of FillBetweenItem to fill the space between two plot curves. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore #FIXME: When running on Qt5, not as perfect as on Qt4 win = pg.plot() win.setWindowTitle('pyqtgraph example: FillBetweenItem') win.setXRange(-10, 10) win.setYRange(-10, 10) N = 200 x = np.linspace(-10, 10, N) gauss = np.exp(-x**2 / 20.) mn = mx = np.zeros(len(x)) curves = [win.plot(x=x, y=np.zeros(len(x)), pen='k') for i in range(4)] brushes = [0.5, (100, 100, 255), 0.5] fills = [pg.FillBetweenItem(curves[i], curves[i+1], brushes[i]) for i in range(3)] for f in fills: win.addItem(f) def update(): global mx, mn, curves, gauss, x a = 5 / abs(np.random.normal(loc=1, scale=0.2)) y1 = -np.abs(a*gauss + np.random.normal(size=len(x))) y2 = np.abs(a*gauss + np.random.normal(size=len(x))) s = 0.01 mn = np.where(y1mx, y2, mx) * (1-s) + y2 * s curves[0].setData(x, mn) curves[1].setData(x, y1) curves[2].setData(x, y2) curves[3].setData(x, mx) timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(30) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/Flowchart.py000066400000000000000000000043361457240071200240030ustar00rootroot00000000000000""" This example demonstrates a very basic use of flowcharts: filter data, displaying both the input and output of the filter. The behavior of the filter can be reprogrammed by the user. Basic steps are: - create a flowchart and two plots - input noisy data to the flowchart - flowchart connects data to the first plot, where it is displayed - add a gaussian filter to lowpass the data, then display it in the second plot. """ import numpy as np import pyqtgraph as pg import pyqtgraph.metaarray as metaarray from pyqtgraph.flowchart import Flowchart from pyqtgraph.Qt import QtWidgets app = pg.mkQApp("Flowchart Example") ## Create main window with grid layout win = QtWidgets.QMainWindow() win.setWindowTitle('pyqtgraph example: Flowchart') cw = QtWidgets.QWidget() win.setCentralWidget(cw) layout = QtWidgets.QGridLayout() cw.setLayout(layout) ## Create flowchart, define input/output terminals fc = Flowchart(terminals={ 'dataIn': {'io': 'in'}, 'dataOut': {'io': 'out'} }) w = fc.widget() ## Add flowchart control panel to the main window layout.addWidget(fc.widget(), 0, 0, 2, 1) ## Add two plot widgets pw1 = pg.PlotWidget() pw2 = pg.PlotWidget() layout.addWidget(pw1, 0, 1) layout.addWidget(pw2, 1, 1) win.show() ## generate signal data to pass through the flowchart data = np.random.normal(size=1000) data[200:300] += 1 data += np.sin(np.linspace(0, 100, 1000)) data = metaarray.MetaArray(data, info=[{'name': 'Time', 'values': np.linspace(0, 1.0, len(data))}, {}]) ## Feed data into the input terminal of the flowchart fc.setInput(dataIn=data) ## populate the flowchart with a basic set of processing nodes. ## (usually we let the user do this) plotList = {'Top Plot': pw1, 'Bottom Plot': pw2} pw1Node = fc.createNode('PlotWidget', pos=(0, -150)) pw1Node.setPlotList(plotList) pw1Node.setPlot(pw1) pw2Node = fc.createNode('PlotWidget', pos=(150, -150)) pw2Node.setPlot(pw2) pw2Node.setPlotList(plotList) fNode = fc.createNode('GaussianFilter', pos=(0, 0)) fNode.ctrls['sigma'].setValue(5) fc.connectTerminals(fc['dataIn'], fNode['In']) fc.connectTerminals(fc['dataIn'], pw1Node['In']) fc.connectTerminals(fNode['Out'], pw2Node['In']) fc.connectTerminals(fNode['Out'], fc['dataOut']) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/FlowchartCustomNode.py000066400000000000000000000130551457240071200260020ustar00rootroot00000000000000""" This example demonstrates writing a custom Node subclass for use with flowcharts. We implement a couple of simple image processing nodes. """ import numpy as np import pyqtgraph as pg import pyqtgraph.flowchart.library as fclib from pyqtgraph.flowchart import Flowchart, Node from pyqtgraph.flowchart.library.common import CtrlNode from pyqtgraph.Qt import QtWidgets app = pg.mkQApp("Flowchart Custom Node Example") ## Create main window with a grid layout inside win = QtWidgets.QMainWindow() win.setWindowTitle('pyqtgraph example: FlowchartCustomNode') cw = QtWidgets.QWidget() win.setCentralWidget(cw) layout = QtWidgets.QGridLayout() cw.setLayout(layout) ## Create an empty flowchart with a single input and output fc = Flowchart(terminals={ 'dataIn': {'io': 'in'}, 'dataOut': {'io': 'out'} }) w = fc.widget() layout.addWidget(fc.widget(), 0, 0, 2, 1) ## Create two ImageView widgets to display the raw and processed data with contrast ## and color control. v1 = pg.ImageView() v2 = pg.ImageView() layout.addWidget(v1, 0, 1) layout.addWidget(v2, 1, 1) win.show() ## generate random input data data = np.random.normal(size=(100,100)) data = 25 * pg.gaussianFilter(data, (5,5)) data += np.random.normal(size=(100,100)) data[40:60, 40:60] += 15.0 data[30:50, 30:50] += 15.0 #data += np.sin(np.linspace(0, 100, 1000)) #data = metaarray.MetaArray(data, info=[{'name': 'Time', 'values': np.linspace(0, 1.0, len(data))}, {}]) ## Set the raw data as the input value to the flowchart fc.setInput(dataIn=data) ## At this point, we need some custom Node classes since those provided in the library ## are not sufficient. Each node will define a set of input/output terminals, a ## processing function, and optionally a control widget (to be displayed in the ## flowchart control panel) class ImageViewNode(Node): """Node that displays image data in an ImageView widget""" nodeName = 'ImageView' def __init__(self, name): self.view = None ## Initialize node with only a single input terminal Node.__init__(self, name, terminals={'data': {'io':'in'}}) def setView(self, view): ## setView must be called by the program self.view = view def process(self, data, display=True): ## if process is called with display=False, then the flowchart is being operated ## in batch processing mode, so we should skip displaying to improve performance. if display and self.view is not None: ## the 'data' argument is the value given to the 'data' terminal if data is None: self.view.setImage(np.zeros((1,1))) # give a blank array to clear the view else: self.view.setImage(data) ## We will define an unsharp masking filter node as a subclass of CtrlNode. ## CtrlNode is just a convenience class that automatically creates its ## control widget based on a simple data structure. class UnsharpMaskNode(CtrlNode): """Return the input data passed through an unsharp mask.""" nodeName = "UnsharpMask" uiTemplate = [ ('sigma', 'spin', {'value': 1.0, 'step': 1.0, 'bounds': [0.0, None]}), ('strength', 'spin', {'value': 1.0, 'dec': True, 'step': 0.5, 'minStep': 0.01, 'bounds': [0.0, None]}), ] def __init__(self, name): ## Define the input / output terminals available on this node terminals = { 'dataIn': dict(io='in'), # each terminal needs at least a name and 'dataOut': dict(io='out'), # to specify whether it is input or output } # other more advanced options are available # as well.. CtrlNode.__init__(self, name, terminals=terminals) def process(self, dataIn, display=True): # CtrlNode has created self.ctrls, which is a dict containing {ctrlName: widget} sigma = self.ctrls['sigma'].value() strength = self.ctrls['strength'].value() output = dataIn - (strength * pg.gaussianFilter(dataIn, (sigma,sigma))) return {'dataOut': output} ## To make our custom node classes available in the flowchart context menu, ## we can either register them with the default node library or make a ## new library. ## Method 1: Register to global default library: #fclib.registerNodeType(ImageViewNode, [('Display',)]) #fclib.registerNodeType(UnsharpMaskNode, [('Image',)]) ## Method 2: If we want to make our custom node available only to this flowchart, ## then instead of registering the node type globally, we can create a new ## NodeLibrary: library = fclib.LIBRARY.copy() # start with the default node set library.addNodeType(ImageViewNode, [('Display',)]) # Add the unsharp mask node to two locations in the menu to demonstrate # that we can create arbitrary menu structures library.addNodeType(UnsharpMaskNode, [('Image',), ('Submenu_test','submenu2','submenu3')]) fc.setLibrary(library) ## Now we will programmatically add nodes to define the function of the flowchart. ## Normally, the user will do this manually or by loading a pre-generated ## flowchart file. v1Node = fc.createNode('ImageView', pos=(0, -150)) v1Node.setView(v1) v2Node = fc.createNode('ImageView', pos=(150, -150)) v2Node.setView(v2) fNode = fc.createNode('UnsharpMask', pos=(0, 0)) fc.connectTerminals(fc['dataIn'], fNode['dataIn']) fc.connectTerminals(fc['dataIn'], v1Node['data']) fc.connectTerminals(fNode['dataOut'], v2Node['data']) fc.connectTerminals(fNode['dataOut'], fc['dataOut']) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLBarGraphItem.py000066400000000000000000000015071457240071200245770ustar00rootroot00000000000000""" This example demonstrates the use of GLBarGraphItem. """ import numpy as np import pyqtgraph as pg import pyqtgraph.opengl as gl app = pg.mkQApp("GLBarGraphItem Example") w = gl.GLViewWidget() w.show() w.setWindowTitle('pyqtgraph example: GLBarGraphItem') w.setCameraPosition(distance=40) gx = gl.GLGridItem() gx.rotate(90, 0, 1, 0) gx.translate(-10, 0, 10) w.addItem(gx) gy = gl.GLGridItem() gy.rotate(90, 1, 0, 0) gy.translate(0, -10, 10) w.addItem(gy) gz = gl.GLGridItem() gz.translate(0, 0, 0) w.addItem(gz) # regular grid of starting positions pos = np.mgrid[0:10, 0:10, 0:1].reshape(3,10,10).transpose(1,2,0) # fixed widths, random heights size = np.empty((10,10,3)) size[...,0:2] = 0.4 size[...,2] = np.random.normal(size=(10,10)) bg = gl.GLBarGraphItem(pos, size) w.addItem(bg) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLGradientLegendItem.py000066400000000000000000000020321457240071200257570ustar00rootroot00000000000000import numpy import pyqtgraph as pg import pyqtgraph.opengl as gl app = pg.mkQApp() w = gl.GLViewWidget() w.show() w.setWindowTitle("pyqtgraph example: GLGradientLegendItem") w.setCameraPosition(distance=60) gx = gl.GLGridItem() gx.rotate(90, 0, 1, 0) w.addItem(gx) md = gl.MeshData.cylinder(rows=10, cols=20, radius=[5.0, 5], length=20.0) md._vertexes[:, 2] = md._vertexes[:, 2] - 10 # set color based on z coordinates color_map = pg.colormap.get("CET-L10") h = md.vertexes()[:, 2] # remember these h_max, h_min = h.max(), h.min() h = (h - h_min) / (h_max - h_min) colors = color_map.map(h, mode="float") md.setFaceColors(colors) m = gl.GLMeshItem(meshdata=md, smooth=True) w.addItem(m) legendLabels = numpy.linspace(h_max, h_min, 5) legendPos = numpy.linspace(1, 0, 5) legend = dict(zip(map(str, legendLabels), legendPos)) gll = gl.GLGradientLegendItem( pos=(10, 10), size=(50, 300), gradient=color_map, labels=legend ) w.addItem(gll) ## Start Qt event loop unless running in interactive mode. if __name__ == "__main__": pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLGraphItem.py000066400000000000000000000011211457240071200241420ustar00rootroot00000000000000""" Demonstrates use of GLGraphItem """ import numpy as np import pyqtgraph as pg import pyqtgraph.opengl as gl app = pg.mkQApp("GLGraphItem Example") w = gl.GLViewWidget() w.setCameraPosition(distance=20) w.show() edges = np.array([ [0, 2], [0, 3], [1, 2], [1, 3], [2, 3] ]) nodes = np.array( [ [0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 1] ] ) edgeColor=pg.glColor("w") gi = gl.GLGraphItem( edges=edges, nodePositions=nodes, edgeWidth=1., nodeSize=10. ) w.addItem(gi) if __name__ == "__main__": pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLImageItem.py000066400000000000000000000026401457240071200241320ustar00rootroot00000000000000""" Use GLImageItem to display image data on rectangular planes. In this example, the image data is sampled from a volume and the image planes placed as if they slice through the volume. """ import numpy as np import pyqtgraph as pg import pyqtgraph.opengl as gl app = pg.mkQApp("GLImageItem Example") w = gl.GLViewWidget() w.show() w.setWindowTitle('pyqtgraph example: GLImageItem') w.setCameraPosition(distance=200) ## create volume data set to slice three images from shape = (100,100,70) data = pg.gaussianFilter(np.random.normal(size=shape), (4,4,4)) data += pg.gaussianFilter(np.random.normal(size=shape), (15,15,15))*15 ## slice out three planes, convert to RGBA for OpenGL texture levels = (-0.08, 0.08) tex1 = pg.makeRGBA(data[shape[0]//2], levels=levels)[0] # yz plane tex2 = pg.makeRGBA(data[:,shape[1]//2], levels=levels)[0] # xz plane tex3 = pg.makeRGBA(data[:,:,shape[2]//2], levels=levels)[0] # xy plane #tex1[:,:,3] = 128 #tex2[:,:,3] = 128 #tex3[:,:,3] = 128 ## Create three image items from textures, add to view v1 = gl.GLImageItem(tex1) v1.translate(-shape[1]/2, -shape[2]/2, 0) v1.rotate(90, 0,0,1) v1.rotate(-90, 0,1,0) w.addItem(v1) v2 = gl.GLImageItem(tex2) v2.translate(-shape[0]/2, -shape[2]/2, 0) v2.rotate(-90, 1,0,0) w.addItem(v2) v3 = gl.GLImageItem(tex3) v3.translate(-shape[0]/2, -shape[1]/2, 0) w.addItem(v3) ax = gl.GLAxisItem() w.addItem(ax) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLIsosurface.py000066400000000000000000000026731457240071200244020ustar00rootroot00000000000000""" This example uses the isosurface function to convert a scalar field (a hydrogen orbital) into a mesh for 3D display. """ import numpy as np import pyqtgraph as pg import pyqtgraph.opengl as gl app = pg.mkQApp("GLIsosurface Example") w = gl.GLViewWidget() w.show() w.setWindowTitle('pyqtgraph example: GLIsosurface') w.setCameraPosition(distance=40) g = gl.GLGridItem() g.scale(2,2,1) w.addItem(g) ## Define a scalar field from which we will generate an isosurface def psi(i, j, k, offset=(25, 25, 50)): x = i-offset[0] y = j-offset[1] z = k-offset[2] th = np.arctan2(z, np.hypot(x, y)) r = np.sqrt(x**2 + y**2 + z **2) a0 = 1 ps = (1./81.) * 1./(6.*np.pi)**0.5 * (1./a0)**(3/2) * (r/a0)**2 * np.exp(-r/(3*a0)) * (3 * np.cos(th)**2 - 1) return ps print("Generating scalar field..") data = np.abs(np.fromfunction(psi, (50,50,100))) print("Generating isosurface..") verts, faces = pg.isosurface(data, data.max()/4.) md = gl.MeshData(vertexes=verts, faces=faces) colors = np.ones((md.faceCount(), 4), dtype=float) colors[:,3] = 0.2 colors[:,2] = np.linspace(0, 1, colors.shape[0]) md.setFaceColors(colors) m1 = gl.GLMeshItem(meshdata=md, smooth=False, shader='balloon') m1.setGLOptions('additive') #w.addItem(m1) m1.translate(-25, -25, -20) m2 = gl.GLMeshItem(meshdata=md, smooth=True, shader='balloon') m2.setGLOptions('additive') w.addItem(m2) m2.translate(-25, -25, -50) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLLinePlotItem.py000066400000000000000000000016071457240071200246400ustar00rootroot00000000000000""" Demonstrate use of GLLinePlotItem to draw cross-sections of a surface. """ import numpy as np import pyqtgraph as pg import pyqtgraph.opengl as gl app = pg.mkQApp("GLLinePlotItem Example") w = gl.GLViewWidget() w.show() w.setWindowTitle('pyqtgraph example: GLLinePlotItem') w.setCameraPosition(distance=40) gx = gl.GLGridItem() gx.rotate(90, 0, 1, 0) gx.translate(-10, 0, 0) w.addItem(gx) gy = gl.GLGridItem() gy.rotate(90, 1, 0, 0) gy.translate(0, -10, 0) w.addItem(gy) gz = gl.GLGridItem() gz.translate(0, 0, -10) w.addItem(gz) n = 51 y = np.linspace(-10,10,n) x = np.linspace(-10,10,100) for i in range(n): yi = y[i] d = np.hypot(x, yi) z = 10 * np.cos(d) / (d+1) pts = np.column_stack([x, np.full_like(x, yi), z]) plt = gl.GLLinePlotItem(pos=pts, color=pg.mkColor((i,n*1.3)), width=(i+1)/10., antialias=True) w.addItem(plt) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLMeshItem.py000066400000000000000000000056301457240071200240060ustar00rootroot00000000000000""" Simple examples demonstrating the use of GLMeshItem. """ import pyqtgraph as pg import pyqtgraph.opengl as gl app = pg.mkQApp("GLMeshItem Example") w = gl.GLViewWidget() w.show() w.setWindowTitle('pyqtgraph example: GLMeshItem') w.setCameraPosition(distance=40) g = gl.GLGridItem() g.scale(2,2,1) w.addItem(g) import numpy as np ## Example 1: ## Array of vertex positions and array of vertex indexes defining faces ## Colors are specified per-face verts = np.array([ [0, 0, 0], [2, 0, 0], [1, 2, 0], [1, 1, 1], ]) faces = np.array([ [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3] ]) colors = np.array([ [1, 0, 0, 0.3], [0, 1, 0, 0.3], [0, 0, 1, 0.3], [1, 1, 0, 0.3] ]) ## Mesh item will automatically compute face normals. m1 = gl.GLMeshItem(vertexes=verts, faces=faces, faceColors=colors, smooth=False) m1.translate(5, 5, 0) m1.setGLOptions('additive') w.addItem(m1) ## Example 2: ## Array of vertex positions, three per face verts = np.empty((36, 3, 3), dtype=np.float32) theta = np.linspace(0, 2*np.pi, 37)[:-1] verts[:,0] = np.vstack([2*np.cos(theta), 2*np.sin(theta), [0]*36]).T verts[:,1] = np.vstack([4*np.cos(theta+0.2), 4*np.sin(theta+0.2), [-1]*36]).T verts[:,2] = np.vstack([4*np.cos(theta-0.2), 4*np.sin(theta-0.2), [1]*36]).T ## Colors are specified per-vertex colors = np.random.random(size=(verts.shape[0], 3, 4)) m2 = gl.GLMeshItem(vertexes=verts, vertexColors=colors, smooth=False, shader='balloon', drawEdges=True, edgeColor=(1, 1, 0, 1)) m2.translate(-5, 5, 0) w.addItem(m2) ## Example 3: ## sphere md = gl.MeshData.sphere(rows=10, cols=20) #colors = np.random.random(size=(md.faceCount(), 4)) #colors[:,3] = 0.3 #colors[100:] = 0.0 colors = np.ones((md.faceCount(), 4), dtype=float) colors[::2,0] = 0 colors[:,1] = np.linspace(0, 1, colors.shape[0]) md.setFaceColors(colors) m3 = gl.GLMeshItem(meshdata=md, smooth=False)#, shader='balloon') m3.translate(5, -5, 0) w.addItem(m3) # Example 4: # wireframe md = gl.MeshData.sphere(rows=4, cols=8) m4 = gl.GLMeshItem(meshdata=md, smooth=False, drawFaces=False, drawEdges=True, edgeColor=(1,1,1,1)) m4.translate(0,10,0) w.addItem(m4) # Example 5: # cylinder md = gl.MeshData.cylinder(rows=10, cols=20, radius=[1., 2.0], length=5.) md2 = gl.MeshData.cylinder(rows=10, cols=20, radius=[2., 0.5], length=10.) colors = np.ones((md.faceCount(), 4), dtype=float) colors[::2,0] = 0 colors[:,1] = np.linspace(0, 1, colors.shape[0]) md.setFaceColors(colors) m5 = gl.GLMeshItem(meshdata=md, smooth=True, drawEdges=True, edgeColor=(1,0,0,1), shader='balloon') colors = np.ones((md.faceCount(), 4), dtype=float) colors[::2,0] = 0 colors[:,1] = np.linspace(0, 1, colors.shape[0]) md2.setFaceColors(colors) m6 = gl.GLMeshItem(meshdata=md2, smooth=True, drawEdges=False, shader='balloon') m6.translate(0,0,7.5) m6.rotate(0., 0, 1, 1) #m5.translate(-3,3,0) w.addItem(m5) w.addItem(m6) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLPainterItem.py000066400000000000000000000057161457240071200245210ustar00rootroot00000000000000""" Demonstrate using QPainter on a subclass of GLGraphicsItem. """ import OpenGL.GL as GL import pyqtgraph as pg from pyqtgraph.opengl import GLAxisItem, GLGraphicsItem, GLGridItem, GLViewWidget from pyqtgraph.Qt import QtCore, QtGui SIZE = 32 class GLPainterItem(GLGraphicsItem.GLGraphicsItem): def __init__(self, **kwds): super().__init__() glopts = kwds.pop('glOptions', 'additive') self.setGLOptions(glopts) def compute_projection(self): modelview = GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX) projection = GL.glGetDoublev(GL.GL_PROJECTION_MATRIX) mvp = projection.T @ modelview.T mvp = QtGui.QMatrix4x4(mvp.ravel().tolist()) # note that QRectF.bottom() != QRect.bottom() rect = QtCore.QRectF(self.view().rect()) ndc_to_viewport = QtGui.QMatrix4x4() ndc_to_viewport.viewport(rect.left(), rect.bottom(), rect.width(), -rect.height()) return ndc_to_viewport * mvp def paint(self): self.setupGLState() painter = QtGui.QPainter(self.view()) self.draw(painter) painter.end() def draw(self, painter): painter.setPen(QtCore.Qt.GlobalColor.white) painter.setRenderHints(QtGui.QPainter.RenderHint.Antialiasing | QtGui.QPainter.RenderHint.TextAntialiasing) rect = self.view().rect() af = QtCore.Qt.AlignmentFlag painter.drawText(rect, af.AlignTop | af.AlignRight, 'TR') painter.drawText(rect, af.AlignBottom | af.AlignLeft, 'BL') painter.drawText(rect, af.AlignBottom | af.AlignRight, 'BR') opts = self.view().cameraParams() lines = [] center = opts['center'] lines.append(f"center : ({center.x():.1f}, {center.y():.1f}, {center.z():.1f})") for key in ['distance', 'fov', 'elevation', 'azimuth']: lines.append(f"{key} : {opts[key]:.1f}") xyz = self.view().cameraPosition() lines.append(f"xyz : ({xyz.x():.1f}, {xyz.y():.1f}, {xyz.z():.1f})") info = "\n".join(lines) painter.drawText(rect, af.AlignTop | af.AlignLeft, info) project = self.compute_projection() hsize = SIZE // 2 for xi in range(-hsize, hsize+1): for yi in range(-hsize, hsize+1): if xi == -hsize and yi == -hsize: # skip one corner for visual orientation continue vec3 = QtGui.QVector3D(xi, yi, 0) pos = project.map(vec3).toPointF() painter.drawEllipse(pos, 1, 1) pg.mkQApp("GLPainterItem Example") glv = GLViewWidget() glv.show() glv.setWindowTitle('pyqtgraph example: GLPainterItem') glv.setCameraPosition(distance=50, elevation=90, azimuth=0) griditem = GLGridItem() griditem.setSize(SIZE, SIZE) griditem.setSpacing(1, 1) glv.addItem(griditem) axisitem = GLAxisItem() axisitem.setSize(SIZE/2, SIZE/2, 1) glv.addItem(axisitem) paintitem = GLPainterItem() glv.addItem(paintitem) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLScatterPlotItem.py000066400000000000000000000051731457240071200253600ustar00rootroot00000000000000""" Demonstrates use of GLScatterPlotItem with rapidly-updating plots. """ import numpy as np import pyqtgraph as pg import pyqtgraph.opengl as gl from pyqtgraph import functions as fn from pyqtgraph.Qt import QtCore app = pg.mkQApp("GLScatterPlotItem Example") w = gl.GLViewWidget() w.show() w.setWindowTitle('pyqtgraph example: GLScatterPlotItem') w.setCameraPosition(distance=20) g = gl.GLGridItem() w.addItem(g) ## ## First example is a set of points with pxMode=False ## These demonstrate the ability to have points with real size down to a very small scale ## pos = np.empty((53, 3)) size = np.empty((53)) color = np.empty((53, 4)) pos[0] = (1,0,0); size[0] = 0.5; color[0] = (1.0, 0.0, 0.0, 0.5) pos[1] = (0,1,0); size[1] = 0.2; color[1] = (0.0, 0.0, 1.0, 0.5) pos[2] = (0,0,1); size[2] = 2./3.; color[2] = (0.0, 1.0, 0.0, 0.5) z = 0.5 d = 6.0 for i in range(3,53): pos[i] = (0,0,z) size[i] = 2./d color[i] = (0.0, 1.0, 0.0, 0.5) z *= 0.5 d *= 2.0 sp1 = gl.GLScatterPlotItem(pos=pos, size=size, color=color, pxMode=False) sp1.translate(5,5,0) w.addItem(sp1) ## ## Second example shows a volume of points with rapidly updating color ## and pxMode=True ## pos = np.random.random(size=(100000,3)) pos *= [10,-10,10] pos[0] = (0,0,0) color = np.ones((pos.shape[0], 4)) d2 = (pos**2).sum(axis=1)**0.5 size = np.random.random(size=pos.shape[0])*10 sp2 = gl.GLScatterPlotItem(pos=pos, color=(1,1,1,1), size=size) phase = 0. w.addItem(sp2) ## ## Third example shows a grid of points with rapidly updating position ## and pxMode = False ## pos3 = np.zeros((100,100,3)) pos3[:,:,:2] = np.mgrid[:100, :100].transpose(1,2,0) * [-0.1,0.1] pos3 = pos3.reshape(10000,3) d3 = (pos3**2).sum(axis=1)**0.5 sp3 = gl.GLScatterPlotItem(pos=pos3, color=(1,1,1,.3), size=0.1, pxMode=False) w.addItem(sp3) def update(): ## update volume colors global phase, sp2, d2 s = -np.cos(d2*2+phase) color = np.empty((len(d2),4), dtype=np.float32) color[:,3] = fn.clip_array(s * 0.1, 0., 1.) color[:,0] = fn.clip_array(s * 3.0, 0., 1.) color[:,1] = fn.clip_array(s * 1.0, 0., 1.) color[:,2] = fn.clip_array(s ** 3, 0., 1.) sp2.setData(color=color) phase -= 0.1 ## update surface positions and colors global sp3, d3, pos3 z = -np.cos(d3*2+phase) pos3[:,2] = z color = np.empty((len(d3),4), dtype=np.float32) color[:,3] = 0.3 color[:,0] = np.clip(z * 3.0, 0, 1) color[:,1] = np.clip(z * 1.0, 0, 1) color[:,2] = np.clip(z ** 3, 0, 1) sp3.setData(pos=pos3, color=color) t = QtCore.QTimer() t.timeout.connect(update) t.start(50) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLSurfacePlot.py000066400000000000000000000050241457240071200245170ustar00rootroot00000000000000""" This example demonstrates the use of GLSurfacePlotItem. """ import numpy as np import pyqtgraph as pg import pyqtgraph.opengl as gl from pyqtgraph.Qt import QtCore ## Create a GL View widget to display data app = pg.mkQApp("GLSurfacePlot Example") w = gl.GLViewWidget() w.show() w.setWindowTitle('pyqtgraph example: GLSurfacePlot') w.setCameraPosition(distance=50) ## Add a grid to the view g = gl.GLGridItem() g.scale(2,2,1) g.setDepthValue(10) # draw grid after surfaces since they may be translucent w.addItem(g) ## Simple surface plot example ## x, y values are not specified, so assumed to be 0:50 z = pg.gaussianFilter(np.random.normal(size=(50,50)), (1,1)) p1 = gl.GLSurfacePlotItem(z=z, shader='shaded', color=(0.5, 0.5, 1, 1)) p1.scale(16./49., 16./49., 1.0) p1.translate(-18, 2, 0) w.addItem(p1) ## Saddle example with x and y specified x = np.linspace(-8, 8, 50) y = np.linspace(-8, 8, 50) z = 0.1 * ((x.reshape(50,1) ** 2) - (y.reshape(1,50) ** 2)) p2 = gl.GLSurfacePlotItem(x=x, y=y, z=z, shader='normalColor') p2.translate(-10,-10,0) w.addItem(p2) ## Manually specified colors z = pg.gaussianFilter(np.random.normal(size=(50,50)), (1,1)) x = np.linspace(-12, 12, 50) y = np.linspace(-12, 12, 50) colors = np.ones((50,50,4), dtype=float) colors[...,0] = np.clip(np.cos(((x.reshape(50,1) ** 2) + (y.reshape(1,50) ** 2)) ** 0.5), 0, 1) colors[...,1] = colors[...,0] p3 = gl.GLSurfacePlotItem(z=z, colors=colors.reshape(50*50,4), shader='shaded', smooth=False) p3.scale(16./49., 16./49., 1.0) p3.translate(2, -18, 0) w.addItem(p3) ## Animated example ## compute surface vertex data cols = 90 rows = 100 x = np.linspace(-8, 8, cols+1).reshape(cols+1,1) y = np.linspace(-8, 8, rows+1).reshape(1,rows+1) d = (x**2 + y**2) * 0.1 d2 = d ** 0.5 + 0.1 ## precompute height values for all frames phi = np.arange(0, np.pi*2, np.pi/20.) z = np.sin(d[np.newaxis,...] + phi.reshape(phi.shape[0], 1, 1)) / d2[np.newaxis,...] ## create a surface plot, tell it to use the 'heightColor' shader ## since this does not require normal vectors to render (thus we ## can set computeNormals=False to save time when the mesh updates) p4 = gl.GLSurfacePlotItem(x=x[:,0], y = y[0,:], shader='heightColor', computeNormals=False, smooth=False) p4.shader()['colorMap'] = np.array([0.2, 2, 0.5, 0.2, 1, 1, 0.2, 0, 2]) p4.translate(10, 10, 0) w.addItem(p4) index = 0 def update(): global p4, z, index index -= 1 p4.setData(z=z[index%z.shape[0]]) timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(30) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLTextItem.py000066400000000000000000000012451457240071200240340ustar00rootroot00000000000000""" Simple examples demonstrating the use of GLTextItem. """ import pyqtgraph as pg import pyqtgraph.opengl as gl from pyqtgraph.Qt import mkQApp app = mkQApp("GLTextItem Example") gvw = gl.GLViewWidget() gvw.show() gvw.setWindowTitle('pyqtgraph example: GLTextItem') griditem = gl.GLGridItem() griditem.setSize(10, 10) griditem.setSpacing(1, 1) gvw.addItem(griditem) axisitem = gl.GLAxisItem() gvw.addItem(axisitem) txtitem1 = gl.GLTextItem(pos=(0.0, 0.0, 0.0), text='text1') gvw.addItem(txtitem1) txtitem2 = gl.GLTextItem() txtitem2.setData(pos=(1.0, -1.0, 2.0), color=(127, 255, 127, 255), text='text2') gvw.addItem(txtitem2) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLViewWidget.py000066400000000000000000000007411457240071200243470ustar00rootroot00000000000000""" Very basic 3D graphics example; create a view widget and add a few items. """ import pyqtgraph as pg import pyqtgraph.opengl as gl pg.mkQApp("GLViewWidget Example") w = gl.GLViewWidget() w.show() w.setWindowTitle('pyqtgraph example: GLViewWidget') w.setCameraPosition(distance=20) ax = gl.GLAxisItem() ax.setSize(5,5,5) w.addItem(ax) b = gl.GLBoxItem() w.addItem(b) ax2 = gl.GLAxisItem() ax2.setParentItem(b) b.translate(1,1,1) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLVolumeItem.py000066400000000000000000000042771457240071200243670ustar00rootroot00000000000000""" Demonstrates GLVolumeItem for displaying volumetric data. """ import numpy as np import pyqtgraph as pg import pyqtgraph.opengl as gl from pyqtgraph import functions as fn app = pg.mkQApp("GLVolumeItem Example") w = gl.GLViewWidget() w.show() w.setWindowTitle('pyqtgraph example: GLVolumeItem') w.setCameraPosition(distance=200) g = gl.GLGridItem() g.scale(10, 10, 1) w.addItem(g) ## Hydrogen electron probability density def psi(i, j, k, offset=(50,50,100)): x = i-offset[0] y = j-offset[1] z = k-offset[2] th = np.arctan2(z, np.hypot(x, y)) r = np.sqrt(x**2 + y**2 + z **2) a0 = 2 return ( (1.0 / 81.0) * 1.0 / (6.0 * np.pi) ** 0.5 * (1.0 / a0) ** (3 / 2) * (r / a0) ** 2 * np.exp(-r / (3 * a0)) * (3 * np.cos(th) ** 2 - 1) ) data = np.fromfunction(psi, (100,100,200)) with np.errstate(divide = 'ignore'): positive = np.log(fn.clip_array(data, 0, data.max())**2) negative = np.log(fn.clip_array(-data, 0, -data.min())**2) d2 = np.empty(data.shape + (4,), dtype=np.ubyte) # Original Code # d2[..., 0] = positive * (255./positive.max()) # d2[..., 1] = negative * (255./negative.max()) # Reformulated Code # Both positive.max() and negative.max() are negative-valued. # Thus the next 2 lines are _not_ bounded to [0, 255] positive = positive * (255./positive.max()) negative = negative * (255./negative.max()) # When casting to ubyte, the original code relied on +Inf to be # converted to 0. On arm64, it gets converted to 255. # Thus the next 2 lines change +Inf explicitly to 0 instead. positive[np.isinf(positive)] = 0 negative[np.isinf(negative)] = 0 # When casting to ubyte, the original code relied on the conversion # to do modulo 256. The next 2 lines do it explicitly instead as # documentation. d2[..., 0] = positive.astype(int) % 256 d2[..., 1] = negative.astype(int) % 256 d2[..., 2] = d2[...,1] d2[..., 3] = d2[..., 0]*0.3 + d2[..., 1]*0.3 d2[..., 3] = (d2[..., 3].astype(float) / 255.) **2 * 255 d2[:, 0, 0] = [255,0,0,100] d2[0, :, 0] = [0,255,0,100] d2[0, 0, :] = [0,0,255,100] v = gl.GLVolumeItem(d2) v.translate(-50,-50,-100) w.addItem(v) ax = gl.GLAxisItem() w.addItem(ax) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GLshaders.py000066400000000000000000000053141457240071200237230ustar00rootroot00000000000000""" Demonstration of some of the shader programs included with pyqtgraph that can be used to affect the appearance of a surface. """ import numpy as np import pyqtgraph as pg import pyqtgraph.opengl as gl app = pg.mkQApp("GLShaders Example") w = gl.GLViewWidget() w.show() w.setWindowTitle('pyqtgraph example: GL Shaders') w.setCameraPosition(distance=15, azimuth=-90) g = gl.GLGridItem() g.scale(2,2,1) w.addItem(g) md = gl.MeshData.sphere(rows=10, cols=20) x = np.linspace(-8, 8, 6) m1 = gl.GLMeshItem(meshdata=md, smooth=True, color=(1, 0, 0, 0.2), shader='balloon', glOptions='additive') m1.translate(x[0], 0, 0) m1.scale(1, 1, 2) w.addItem(m1) m2 = gl.GLMeshItem(meshdata=md, smooth=True, shader='normalColor', glOptions='opaque') m2.translate(x[1], 0, 0) m2.scale(1, 1, 2) w.addItem(m2) m3 = gl.GLMeshItem(meshdata=md, smooth=True, shader='viewNormalColor', glOptions='opaque') m3.translate(x[2], 0, 0) m3.scale(1, 1, 2) w.addItem(m3) m4 = gl.GLMeshItem(meshdata=md, smooth=True, shader='shaded', glOptions='opaque') m4.translate(x[3], 0, 0) m4.scale(1, 1, 2) w.addItem(m4) m5 = gl.GLMeshItem(meshdata=md, smooth=True, color=(1, 0, 0, 1), shader='edgeHilight', glOptions='opaque') m5.translate(x[4], 0, 0) m5.scale(1, 1, 2) w.addItem(m5) m6 = gl.GLMeshItem(meshdata=md, smooth=True, color=(1, 0, 0, 1), shader='heightColor', glOptions='opaque') m6.translate(x[5], 0, 0) m6.scale(1, 1, 2) w.addItem(m6) #def psi(i, j, k, offset=(25, 25, 50)): #x = i-offset[0] #y = j-offset[1] #z = k-offset[2] #th = np.arctan2(z, (x**2+y**2)**0.5) #phi = np.arctan2(y, x) #r = (x**2 + y**2 + z **2)**0.5 #a0 = 1 ##ps = (1./81.) * (2./np.pi)**0.5 * (1./a0)**(3/2) * (6 - r/a0) * (r/a0) * np.exp(-r/(3*a0)) * np.cos(th) #ps = (1./81.) * 1./(6.*np.pi)**0.5 * (1./a0)**(3/2) * (r/a0)**2 * np.exp(-r/(3*a0)) * (3 * np.cos(th)**2 - 1) #return ps ##return ((1./81.) * (1./np.pi)**0.5 * (1./a0)**(3/2) * (r/a0)**2 * (r/a0) * np.exp(-r/(3*a0)) * np.sin(th) * np.cos(th) * np.exp(2 * 1j * phi))**2 #print("Generating scalar field..") #data = np.abs(np.fromfunction(psi, (50,50,100))) ##data = np.fromfunction(lambda i,j,k: np.sin(0.2*((i-25)**2+(j-15)**2+k**2)**0.5), (50,50,50)); #print("Generating isosurface..") #verts = pg.isosurface(data, data.max()/4.) #md = gl.MeshData.MeshData(vertexes=verts) #colors = np.ones((md.vertexes(indexed='faces').shape[0], 4), dtype=float) #colors[:,3] = 0.3 #colors[:,2] = np.linspace(0, 1, colors.shape[0]) #m1 = gl.GLMeshItem(meshdata=md, color=colors, smooth=False) #w.addItem(m1) #m1.translate(-25, -25, -20) #m2 = gl.GLMeshItem(vertexes=verts, color=colors, smooth=True) #w.addItem(m2) #m2.translate(-25, -25, -50) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GradientEditor.py000066400000000000000000000004641457240071200247540ustar00rootroot00000000000000 import pyqtgraph as pg app = pg.mkQApp("Gradiant Editor Example") mw = pg.GraphicsView() mw.resize(800,800) mw.show() #ts = pg.TickSliderItem() #mw.setCentralItem(ts) #ts.addTick(0.5, 'r') #ts.addTick(0.9, 'b') ge = pg.GradientEditorItem() mw.setCentralItem(ge) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GradientWidget.py000066400000000000000000000024461457240071200247530ustar00rootroot00000000000000""" Demonstrates the appearance / interactivity of GradientWidget (without actually doing anything useful with it) """ import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets app = pg.mkQApp("Gradiant Widget Example") w = QtWidgets.QMainWindow() w.show() w.setWindowTitle('pyqtgraph example: GradientWidget') w.setGeometry(10, 50, 400, 400) cw = QtWidgets.QWidget() w.setCentralWidget(cw) l = QtWidgets.QGridLayout() l.setSpacing(0) cw.setLayout(l) w1 = pg.GradientWidget(orientation='top') w2 = pg.GradientWidget(orientation='right', allowAdd=False) #w2.setTickColor(1, QtGui.QColor(255,255,255)) w3 = pg.GradientWidget(orientation='bottom', allowAdd=False, allowRemove=False) w4 = pg.GradientWidget(orientation='left') w4.loadPreset('spectrum') label = QtWidgets.QLabel(""" - Click a triangle to change its color - Drag triangles to move - Right-click a gradient to load triangle presets - Click in an empty area to add a new color (adding is disabled for the bottom-side and right-side widgets) - Right click a triangle to remove (only possible if more than two triangles are visible) (removing is disabled for the bottom-side widget) """) l.addWidget(w1, 0, 1) l.addWidget(w2, 1, 2) l.addWidget(w3, 2, 1) l.addWidget(w4, 1, 0) l.addWidget(label, 1, 1) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GraphItem.py000066400000000000000000000022041457240071200237220ustar00rootroot00000000000000""" Simple example of GraphItem use. """ import numpy as np import pyqtgraph as pg # Enable antialiasing for prettier plots pg.setConfigOptions(antialias=True) w = pg.GraphicsLayoutWidget(show=True) w.setWindowTitle('pyqtgraph example: GraphItem') v = w.addViewBox() v.setAspectLocked() g = pg.GraphItem() v.addItem(g) ## Define positions of nodes pos = np.array([ [0,0], [10,0], [0,10], [10,10], [5,5], [15,5] ]) ## Define the set of connections in the graph adj = np.array([ [0,1], [1,3], [3,2], [2,0], [1,5], [3,5], ]) ## Define the symbol to use for each node (this is optional) symbols = ['o','o','o','o','t','+'] ## Define the line style for each connection (this is optional) lines = np.array([ (255,0,0,255,1), (255,0,255,255,2), (255,0,255,255,3), (255,255,0,255,2), (255,0,0,255,1), (255,255,255,255,4), ], dtype=[('red',np.ubyte),('green',np.ubyte),('blue',np.ubyte),('alpha',np.ubyte),('width',float)]) ## Update the graph g.setData(pos=pos, adj=adj, pen=lines, size=1, symbol=symbols, pxMode=False) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GraphicsLayout.py000066400000000000000000000037761457240071200250170ustar00rootroot00000000000000""" Demonstrate the use of layouts to control placement of multiple plots / views / labels """ import numpy as np import pyqtgraph as pg app = pg.mkQApp("Gradiant Layout Example") view = pg.GraphicsView() l = pg.GraphicsLayout(border=(100,100,100)) view.setCentralItem(l) view.show() view.setWindowTitle('pyqtgraph example: GraphicsLayout') view.resize(800,600) ## Title at top text = """ This example demonstrates the use of GraphicsLayout to arrange items in a grid.
      The items added to the layout must be subclasses of QGraphicsWidget (this includes
      PlotItem, ViewBox, LabelItem, and GrphicsLayout itself). """ l.addLabel(text, col=1, colspan=4) l.nextRow() ## Put vertical label on left side l.addLabel('Long Vertical Label', angle=-90, rowspan=3) ## Add 3 plots into the first row (automatic position) p1 = l.addPlot(title="Plot 1") p2 = l.addPlot(title="Plot 2") vb = l.addViewBox(lockAspect=True) img = pg.ImageItem(np.random.normal(size=(100,100))) vb.addItem(img) vb.autoRange() ## Add a sub-layout into the second row (automatic position) ## The added item should avoid the first column, which is already filled l.nextRow() l2 = l.addLayout(colspan=3, border=(50,0,0)) l2.setContentsMargins(10, 10, 10, 10) l2.addLabel("Sub-layout: this layout demonstrates the use of shared axes and axis labels", colspan=3) l2.nextRow() l2.addLabel('Vertical Axis Label', angle=-90, rowspan=2) p21 = l2.addPlot() p22 = l2.addPlot() l2.nextRow() p23 = l2.addPlot() p24 = l2.addPlot() l2.nextRow() l2.addLabel("HorizontalAxisLabel", col=1, colspan=2) ## hide axes on some plots p21.hideAxis('bottom') p22.hideAxis('bottom') p22.hideAxis('left') p24.hideAxis('left') p21.hideButtons() p22.hideButtons() p23.hideButtons() p24.hideButtons() ## Add 2 more plots into the third row (manual position) p4 = l.addPlot(row=3, col=1) p5 = l.addPlot(row=3, col=2, colspan=2) ## show some content in the plots p1.plot([1,3,2,4,3,5]) p2.plot([1,3,2,4,3,5]) p4.plot([1,3,2,4,3,5]) p5.plot([1,3,2,4,3,5]) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/GraphicsScene.py000066400000000000000000000022111457240071200245560ustar00rootroot00000000000000import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtWidgets app = pg.mkQApp("GraphicsScene Example") win = pg.GraphicsView() win.show() class Obj(QtWidgets.QGraphicsObject): def __init__(self): QtWidgets.QGraphicsObject.__init__(self) def paint(self, p, *args): p.setPen(pg.mkPen(200,200,200)) p.drawRect(self.boundingRect()) def boundingRect(self): return QtCore.QRectF(0, 0, 20, 20) def mouseClickEvent(self, ev): if ev.double(): print("double click") else: print("click") ev.accept() #def mouseDragEvent(self, ev): #print "drag" #ev.accept() #self.setPos(self.pos() + ev.pos()-ev.lastPos()) vb = pg.ViewBox() win.setCentralItem(vb) obj = Obj() vb.addItem(obj) obj2 = Obj() win.addItem(obj2) def clicked(): print("button click") btn = QtWidgets.QPushButton("BTN") btn.clicked.connect(clicked) prox = QtWidgets.QGraphicsProxyWidget() prox.setWidget(btn) prox.setPos(100,0) vb.addItem(prox) g = pg.GridItem() vb.addItem(g) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/HistogramLUT.py000066400000000000000000000023631457240071200243720ustar00rootroot00000000000000""" Use a HistogramLUTWidget to control the contrast / coloration of an image. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets app = pg.mkQApp("Histogram Lookup Table Example") win = QtWidgets.QMainWindow() win.resize(880, 600) win.show() win.setWindowTitle('pyqtgraph example: Histogram LUT') cw = QtWidgets.QWidget() win.setCentralWidget(cw) layout = QtWidgets.QGridLayout() cw.setLayout(layout) layout.setSpacing(0) view = pg.GraphicsView() vb = pg.ViewBox() vb.setAspectLocked() view.setCentralItem(vb) layout.addWidget(view, 0, 1, 3, 1) hist = pg.HistogramLUTWidget(gradientPosition="left") layout.addWidget(hist, 0, 2) monoRadio = QtWidgets.QRadioButton('mono') rgbaRadio = QtWidgets.QRadioButton('rgba') layout.addWidget(monoRadio, 1, 2) layout.addWidget(rgbaRadio, 2, 2) monoRadio.setChecked(True) def setLevelMode(): mode = 'mono' if monoRadio.isChecked() else 'rgba' hist.setLevelMode(mode) monoRadio.toggled.connect(setLevelMode) data = pg.gaussianFilter(np.random.normal(size=(256, 256, 3)), (20, 20, 0)) for i in range(32): for j in range(32): data[i*8, j*8] += .1 img = pg.ImageItem(data) vb.addItem(img) vb.autoRange() hist.setImageItem(img) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ImageItem.py000066400000000000000000000025311457240071200237060ustar00rootroot00000000000000""" Demonstrates very basic use of ImageItem to display image data inside a ViewBox. """ from time import perf_counter import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore app = pg.mkQApp("ImageItem Example") ## Create window with GraphicsView widget win = pg.GraphicsLayoutWidget() win.show() ## show widget alone in its own window win.setWindowTitle('pyqtgraph example: ImageItem') view = win.addViewBox() ## lock the aspect ratio so pixels are always square view.setAspectLocked(True) ## Create image item img = pg.ImageItem(border='w') view.addItem(img) ## Set initial view bounds view.setRange(QtCore.QRectF(0, 0, 600, 600)) ## Create random image data = np.random.normal(size=(15, 600, 600), loc=1024, scale=64).astype(np.uint16) i = 0 updateTime = perf_counter() elapsed = 0 timer = QtCore.QTimer() timer.setSingleShot(True) # not using QTimer.singleShot() because of persistence on PyQt. see PR #1605 def updateData(): global img, data, i, updateTime, elapsed ## Display the data img.setImage(data[i]) i = (i+1) % data.shape[0] timer.start(1) now = perf_counter() elapsed_now = now - updateTime updateTime = now elapsed = elapsed * 0.9 + elapsed_now * 0.1 # print(f"{1 / elapsed:.1f} fps") timer.timeout.connect(updateData) updateData() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ImageView.py000066400000000000000000000042261457240071200237250ustar00rootroot00000000000000""" This example demonstrates the use of ImageView with 3-color image stacks. ImageView is a high-level widget for displaying and analyzing 2D and 3D data. ImageView provides: 1. A zoomable region (ViewBox) for displaying the image 2. A combination histogram and gradient editor (HistogramLUTItem) for controlling the visual appearance of the image 3. A timeline for selecting the currently displayed frame (for 3D data only). 4. Tools for very basic analysis of image data (see ROI and Norm buttons) """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets # Interpret image data as row-major instead of col-major pg.setConfigOptions(imageAxisOrder='row-major') app = pg.mkQApp("ImageView Example") ## Create window with ImageView widget win = QtWidgets.QMainWindow() win.resize(800,800) imv = pg.ImageView(discreteTimeLine=True) win.setCentralWidget(imv) win.show() win.setWindowTitle('pyqtgraph example: ImageView') imv.setHistogramLabel("Histogram label goes here") ## Create random 3D data set with time varying signals dataRed = np.ones((100, 200, 200)) * np.linspace(90, 150, 100)[:, np.newaxis, np.newaxis] dataRed += pg.gaussianFilter(np.random.normal(size=(200, 200)), (5, 5)) * 100 dataGrn = np.ones((100, 200, 200)) * np.linspace(90, 180, 100)[:, np.newaxis, np.newaxis] dataGrn += pg.gaussianFilter(np.random.normal(size=(200, 200)), (5, 5)) * 100 dataBlu = np.ones((100, 200, 200)) * np.linspace(180, 90, 100)[:, np.newaxis, np.newaxis] dataBlu += pg.gaussianFilter(np.random.normal(size=(200, 200)), (5, 5)) * 100 data = np.concatenate( (dataRed[:, :, :, np.newaxis], dataGrn[:, :, :, np.newaxis], dataBlu[:, :, :, np.newaxis]), axis=3 ) # Display the data and assign each frame a time value from 1.0 to 3.0 imv.setImage(data, xvals=np.linspace(1., 3., data.shape[0])) imv.play(10) ## Set a custom color map colors = [ (0, 0, 0), (45, 5, 61), (84, 42, 55), (150, 87, 60), (208, 171, 141), (255, 255, 255) ] cmap = pg.ColorMap(pos=np.linspace(0.0, 1.0, 6), color=colors) imv.setColorMap(cmap) # Start up with an ROI imv.ui.roiBtn.setChecked(True) imv.roiClicked() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/InfiniteLine.py000066400000000000000000000043371457240071200244300ustar00rootroot00000000000000""" This example demonstrates some of the plotting items available in pyqtgraph. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore app = pg.mkQApp("InfiniteLine Example") win = pg.GraphicsLayoutWidget(show=True, title="Plotting items examples") win.resize(1000,600) # Enable antialiasing for prettier plots pg.setConfigOptions(antialias=True) # Create a plot with some random data p1 = win.addPlot(title="Plot Items example", y=np.random.normal(size=100, scale=10), pen=0.5) p1.setYRange(-40, 40) # Add three infinite lines with labels inf1 = pg.InfiniteLine(movable=True, angle=90, label='x={value:0.2f}', labelOpts={'position':0.1, 'color': (200,200,100), 'fill': (200,200,200,50), 'movable': True}) inf2 = pg.InfiniteLine(movable=True, angle=0, pen=(0, 0, 200), bounds = [-20, 20], hoverPen=(0,200,0), label='y={value:0.2f}mm', labelOpts={'color': (200,0,0), 'movable': True, 'fill': (0, 0, 200, 100)}) inf3 = pg.InfiniteLine(movable=True, angle=45, pen='g', label='diagonal', labelOpts={'rotateAxis': [1, 0], 'fill': (0, 200, 0, 100), 'movable': True}) inf1.setPos([2,2]) p1.addItem(inf1) p1.addItem(inf2) p1.addItem(inf3) targetItem1 = pg.TargetItem() targetItem2 = pg.TargetItem( pos=(30, 5), size=20, symbol="star", pen="#F4511E", label="vert={1:0.2f}", labelOpts={ "offset": QtCore.QPoint(15, 15) } ) targetItem2.label().setAngle(45) targetItem3 = pg.TargetItem( pos=(10, 10), size=10, symbol="x", pen="#00ACC1", ) targetItem3.setLabel( "Third Label", { "anchor": QtCore.QPointF(0.5, 0.5), "offset": QtCore.QPointF(30, 0), "color": "#558B2F", "rotateAxis": (0, 1) } ) def callableFunction(x, y): return f"Square Values: ({x**2:.4f}, {y**2:.4f})" targetItem4 = pg.TargetItem( pos=(10, -10), label=callableFunction ) p1.addItem(targetItem1) p1.addItem(targetItem2) p1.addItem(targetItem3) p1.addItem(targetItem4) # Add a linear region with a label lr = pg.LinearRegionItem(values=[70, 80]) p1.addItem(lr) label = pg.InfLineLabel(lr.lines[1], "region 1", position=0.95, rotateAxis=(1,0), anchor=(1, 1)) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/InteractiveParameter.py000066400000000000000000000040461457240071200261660ustar00rootroot00000000000000from functools import wraps import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets from pyqtgraph.parametertree import ( Parameter, ParameterTree, RunOptions, InteractiveFunction, Interactor, ) app = pg.mkQApp() class LAST_RESULT: """Just for testing purposes""" value = None def printResult(func): @wraps(func) def wrapper(*args, **kwargs): LAST_RESULT.value = func(*args, **kwargs) QtWidgets.QMessageBox.information( QtWidgets.QApplication.activeWindow(), "Function Run!", f"Func result: {LAST_RESULT.value}", ) return wrapper host = Parameter.create(name="Interactive Parameter Use", type="group") interactor = Interactor(parent=host, runOptions=RunOptions.ON_CHANGED) @interactor.decorate() @printResult def easySample(a=5, b=6): return a + b @interactor.decorate() @printResult def stringParams(a="5", b="6"): return a + b @interactor.decorate(a=10) @printResult def requiredParam(a, b=10): return a + b @interactor.decorate(ignores=["a"]) @printResult def ignoredAParam(a=10, b=20): return a * b @interactor.decorate(runOptions=RunOptions.ON_ACTION) @printResult def runOnButton(a=10, b=20): return a + b x = 5 @printResult def accessVarInDifferentScope(x, y=10): return x + y func_interactive = InteractiveFunction( accessVarInDifferentScope, closures={"x": lambda: x} ) # Value is redeclared, but still bound x = 10 interactor(func_interactive) with interactor.optsContext(titleFormat=str.upper): @interactor.decorate() @printResult def capslocknames(a=5): return a @interactor.decorate( runOptions=(RunOptions.ON_CHANGED, RunOptions.ON_ACTION), a={"type": "list", "limits": [5, 10, 20]}, ) @printResult def runOnBtnOrChange_listOpts(a=5): return a @interactor.decorate(nest=False) @printResult def onlyTheArgumentsAppear(thisIsAFunctionArg=True): return thisIsAFunctionArg tree = ParameterTree() tree.setParameters(host) tree.show() if __name__ == "__main__": pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/JoystickButton.py000066400000000000000000000021121457240071200250330ustar00rootroot00000000000000""" JoystickButton is a button with x/y values. When the button is depressed and the mouse dragged, the x/y values change to follow the mouse. When the mouse button is released, the x/y values change to 0,0 (rather like letting go of the joystick). """ import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtWidgets app = pg.mkQApp("Joystick Button Example") mw = QtWidgets.QMainWindow() mw.resize(300,50) mw.setWindowTitle('pyqtgraph example: JoystickButton') cw = QtWidgets.QWidget() mw.setCentralWidget(cw) layout = QtWidgets.QGridLayout() cw.setLayout(layout) mw.show() l1 = pg.ValueLabel(siPrefix=True, suffix='m') l2 = pg.ValueLabel(siPrefix=True, suffix='m') jb = pg.JoystickButton() jb.setFixedWidth(30) jb.setFixedHeight(30) layout.addWidget(l1, 0, 0) layout.addWidget(l2, 0, 1) layout.addWidget(jb, 0, 2) x = 0 y = 0 def update(): global x, y, l1, l2, jb dx, dy = jb.getState() x += dx * 1e-3 y += dy * 1e-3 l1.setValue(x) l2.setValue(y) timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(30) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/Legend.py000066400000000000000000000023171457240071200232450ustar00rootroot00000000000000""" Demonstrates basic use of LegendItem """ import numpy as np import pyqtgraph as pg win = pg.plot() win.setWindowTitle('pyqtgraph example: BarGraphItem') # # option1: only for .plot(), following c1,c2 for example----------------------- # win.addLegend(frame=False, colCount=2) # bar graph x = np.arange(10) y = np.sin(x+2) * 3 bg1 = pg.BarGraphItem(x=x, height=y, width=0.3, brush='b', pen='w', name='bar') win.addItem(bg1) # curve c1 = win.plot([np.random.randint(0,8) for i in range(10)], pen='r', symbol='t', symbolPen='r', symbolBrush='g', name='curve1') c2 = win.plot([2,1,4,3,1,3,2,4,3,2], pen='g', fillLevel=0, fillBrush=(255,255,255,30), name='curve2') # scatter plot s1 = pg.ScatterPlotItem(size=10, pen=pg.mkPen(None), brush=pg.mkBrush(255, 255, 255, 120), name='scatter') spots = [{'pos': [i, np.random.randint(-3, 3)], 'data': 1} for i in range(10)] s1.addPoints(spots) win.addItem(s1) # # option2: generic method------------------------------------------------ legend = pg.LegendItem((80,60), offset=(70,20)) legend.setParentItem(win.graphicsItem()) legend.addItem(bg1, 'bar') legend.addItem(c1, 'curve1') legend.addItem(c2, 'curve2') legend.addItem(s1, 'scatter') if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/LogPlotTest.py000066400000000000000000000013441457240071200242660ustar00rootroot00000000000000""" Simple logarithmic plotting test """ import numpy as np import pyqtgraph as pg app = pg.mkQApp("Log Plot Example") win = pg.GraphicsLayoutWidget(show=True, title="Basic plotting examples") win.resize(1000,600) win.setWindowTitle('pyqtgraph example: LogPlotTest') p5 = win.addPlot(title="Scatter plot, axis labels, log scale") x = np.random.normal(size=1000) * 1e-5 y = x*1000 + 0.005 * np.random.normal(size=1000) y -= y.min()-1.0 mask = x > 1e-15 x = x[mask] y = y[mask] p5.plot(x, y, pen=None, symbol='t', symbolPen=None, symbolSize=10, symbolBrush=(100, 100, 255, 50)) p5.setLabel('left', "Y Axis", units='A') p5.setLabel('bottom', "Y Axis", units='s') p5.setLogMode(x=True, y=False) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/MatrixDisplayExample.py000066400000000000000000000050271457240071200261560ustar00rootroot00000000000000""" This example demonstrates ViewBox and AxisItem configuration to plot a correlation matrix. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtWidgets, mkQApp class MainWindow(QtWidgets.QMainWindow): """ example application main window """ def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) gr_wid = pg.GraphicsLayoutWidget(show=True) self.setCentralWidget(gr_wid) self.setWindowTitle('pyqtgraph example: Correlation matrix display') self.resize(600,500) self.show() corrMatrix = np.array([ [ 1. , 0.5184571 , -0.70188642], [ 0.5184571 , 1. , -0.86094096], [-0.70188642, -0.86094096, 1. ] ]) columns = ["A", "B", "C"] pg.setConfigOption('imageAxisOrder', 'row-major') # Switch default order to Row-major correlogram = pg.ImageItem() # create transform to center the corner element on the origin, for any assigned image: tr = QtGui.QTransform().translate(-0.5, -0.5) correlogram.setTransform(tr) correlogram.setImage(corrMatrix) plotItem = gr_wid.addPlot() # add PlotItem to the main GraphicsLayoutWidget plotItem.invertY(True) # orient y axis to run top-to-bottom plotItem.setDefaultPadding(0.0) # plot without padding data range plotItem.addItem(correlogram) # display correlogram # show full frame, label tick marks at top and left sides, with some extra space for labels: plotItem.showAxes( True, showValues=(True, True, False, False), size=20 ) # define major tick marks and labels: ticks = [ (idx, label) for idx, label in enumerate( columns ) ] for side in ('left','top','right','bottom'): plotItem.getAxis(side).setTicks( (ticks, []) ) # add list of major ticks; no minor ticks plotItem.getAxis('bottom').setHeight(10) # include some additional space at bottom of figure colorMap = pg.colormap.get("CET-D1") # choose perceptually uniform, diverging color map # generate an adjustabled color bar, initially spanning -1 to 1: bar = pg.ColorBarItem( values=(-1,1), colorMap=colorMap) # link color bar and color map to correlogram, and show it in plotItem: bar.setImageItem(correlogram, insert_in=plotItem) mkQApp("Correlation matrix display") main_window = MainWindow() ## Start Qt event loop if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/MouseSelection.py000066400000000000000000000014251457240071200250040ustar00rootroot00000000000000""" Demonstrates selecting plot curves by mouse click """ import numpy as np import pyqtgraph as pg win = pg.plot() win.setWindowTitle('pyqtgraph example: Plot data selection') curves = [ pg.PlotCurveItem(y=np.sin(np.linspace(0, 20, 1000)), pen='r', clickable=True), pg.PlotCurveItem(y=np.sin(np.linspace(1, 21, 1000)), pen='g', clickable=True), pg.PlotCurveItem(y=np.sin(np.linspace(2, 22, 1000)), pen='b', clickable=True), ] def plotClicked(curve): global curves for i,c in enumerate(curves): if c is curve: c.setPen('rgb'[i], width=3) else: c.setPen('rgb'[i], width=1) for c in curves: win.addItem(c) c.sigClicked.connect(plotClicked) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/MultiDataPlot.py000066400000000000000000000042331457240071200245710ustar00rootroot00000000000000import traceback import numpy as np import pyqtgraph as pg from pyqtgraph.graphicsItems.ScatterPlotItem import name_list from pyqtgraph.Qt import QtWidgets, QtCore from pyqtgraph.parametertree import interact, ParameterTree, Parameter import random pg.mkQApp() rng = np.random.default_rng(10) random.seed(10) def sortedRandint(low, high, size): return np.sort(rng.integers(low, high, size)) def isNoneOrScalar(value): return value is None or np.isscalar(value[0]) values = { # Convention 1 "None (replaced by integer indices)": None, # Convention 2 "Single curve values": sortedRandint(0, 20, 15), # Convention 3 list form "container of (optionally) mixed-size curve values": [ sortedRandint(0, 20, 15), *[sortedRandint(0, 20, 15) for _ in range(4)], ], # Convention 3 array form "2D matrix": np.row_stack([sortedRandint(20, 40, 15) for _ in range(6)]), } def next_plot(xtype="random", ytype="random", symbol="o", symbolBrush="#f00"): constKwargs = locals() x = y = None if xtype == "random": xtype = random.choice(list(values)) if ytype == "random": ytype = random.choice(list(values)) x = values[xtype] y = values[ytype] textbox.setValue(f"x={xtype}\ny={ytype}") pltItem.clear() try: pltItem.multiDataPlot( x=x, y=y, pen=cmap.getLookupTable(nPts=6), constKwargs=constKwargs ) except Exception as e: QtWidgets.QMessageBox.critical(widget, "Error", traceback.format_exc()) cmap = pg.colormap.get("viridis") widget = pg.PlotWidget() pltItem: pg.PlotItem = widget.plotItem xytype = dict(type="list", values=list(values)) topParam = interact( next_plot, symbolBrush=dict(type="color"), symbol=dict(type="list", values=name_list), xtype=xytype, ytype=xytype, ) tree = ParameterTree() tree.setMinimumWidth(150) tree.addParameters(topParam, showTop=True) textbox = Parameter.create(name="text", type="text", readonly=True) tree.addParameters(textbox) win = QtWidgets.QWidget() win.setLayout(lay := QtWidgets.QHBoxLayout()) lay.addWidget(widget) lay.addWidget(tree) if __name__ == "__main__": win.show() pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/MultiPlotSpeedTest.py000066400000000000000000000030561457240071200256220ustar00rootroot00000000000000#!/usr/bin/python """ Test the speed of rapidly updating multiple plot curves """ import argparse import itertools import numpy as np from utils import FrameCounter import pyqtgraph as pg from pyqtgraph.Qt import QtCore parser = argparse.ArgumentParser() parser.add_argument('--iterations', default=float('inf'), type=float, help="Number of iterations to run before exiting" ) args = parser.parse_args() iterations_counter = itertools.count() # pg.setConfigOptions(useOpenGL=True) app = pg.mkQApp("MultiPlot Speed Test") plot = pg.plot() plot.setWindowTitle('pyqtgraph example: MultiPlotSpeedTest') plot.setLabel('bottom', 'Index', units='B') nPlots = 100 nSamples = 500 curves = [] for idx in range(nPlots): curve = pg.PlotCurveItem(pen=({'color': (idx, nPlots*1.3), 'width': 1}), skipFiniteCheck=True) plot.addItem(curve) curve.setPos(0,idx*6) curves.append(curve) plot.setYRange(0, nPlots*6) plot.setXRange(0, nSamples) plot.resize(600,900) rgn = pg.LinearRegionItem([nSamples/5.,nSamples/3.]) plot.addItem(rgn) data = np.random.normal(size=(nPlots*23,nSamples)) ptr = 0 def update(): global ptr if next(iterations_counter) > args.iterations: timer.stop() app.quit() return None for i in range(nPlots): curves[i].setData(data[(ptr+i)%data.shape[0]]) ptr += nPlots framecnt.update() timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(0) framecnt = FrameCounter() framecnt.sigFpsUpdate.connect(lambda fps: plot.setTitle(f'{fps:.1f} fps')) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/MultiplePlotAxes.py000066400000000000000000000030121457240071200253130ustar00rootroot00000000000000""" Demonstrates a way to put multiple axes around a single plot. (This will eventually become a built-in feature of PlotItem) """ import pyqtgraph as pg pg.mkQApp() pw = pg.PlotWidget() pw.show() pw.setWindowTitle('pyqtgraph example: MultiplePlotAxes') p1 = pw.plotItem p1.setLabels(left='axis 1') ## create a new ViewBox, link the right axis to its coordinate system p2 = pg.ViewBox() p1.showAxis('right') p1.scene().addItem(p2) p1.getAxis('right').linkToView(p2) p2.setXLink(p1) p1.getAxis('right').setLabel('axis2', color='#0000ff') ## create third ViewBox. ## this time we need to create a new axis as well. p3 = pg.ViewBox() ax3 = pg.AxisItem('right') p1.layout.addItem(ax3, 2, 3) p1.scene().addItem(p3) ax3.linkToView(p3) p3.setXLink(p1) ax3.setZValue(-10000) ax3.setLabel('axis 3', color='#ff0000') ## Handle view resizing def updateViews(): ## view has resized; update auxiliary views to match global p1, p2, p3 p2.setGeometry(p1.vb.sceneBoundingRect()) p3.setGeometry(p1.vb.sceneBoundingRect()) ## need to re-update linked axes since this was called ## incorrectly while views had different shapes. ## (probably this should be handled in ViewBox.resizeEvent) p2.linkedViewChanged(p1.vb, p2.XAxis) p3.linkedViewChanged(p1.vb, p3.XAxis) updateViews() p1.vb.sigResized.connect(updateViews) p1.plot([1,2,4,8,16,32]) p2.addItem(pg.PlotCurveItem([10,20,40,80,40,20], pen='b')) p3.addItem(pg.PlotCurveItem([3200,1600,800,400,200,100], pen='r')) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/NonUniformImage.py000066400000000000000000000037461457240071200251130ustar00rootroot00000000000000""" Display a non-uniform image. This example displays 2-d data as an image with non-uniformly distributed sample points. """ import numpy as np import pyqtgraph as pg from pyqtgraph.graphicsItems.NonUniformImage import NonUniformImage RPM2RADS = 2 * np.pi / 60 RADS2RPM = 1 / RPM2RADS kfric = 1 # [Ws/rad] angular damping coefficient [0;100] kfric3 = 1.5e-6 # [Ws3/rad3] angular damping coefficient (3rd order) [0;10-3] psi = 0.2 # [Vs] flux linkage [0.001;10] res = 5e-3 # [Ohm] resistance [0;100] v_ref = 200 # [V] reference DC voltage [0;1000] k_v = 5 # linear voltage coefficient [-100;100] # create the (non-uniform) scales tau = np.array([0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 160, 180, 200, 220], dtype=np.float32) w = np.array([0, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000], dtype=np.float32) * RPM2RADS v = 380 # calculate the power losses TAU, W = np.meshgrid(tau, w, indexing='ij') V = np.ones_like(TAU) * v P_loss = kfric * W + kfric3 * W ** 3 + (res * (TAU / psi) ** 2) + k_v * (V - v_ref) P_mech = TAU * W P_loss[P_mech > 1.5e5] = np.nan app = pg.mkQApp("NonUniform Image Example") win = pg.GraphicsLayoutWidget() win.show() win.resize(600, 400) win.setWindowTitle('pyqtgraph example: Non-uniform Image') p = win.addPlot(title="Power Losses [W]", row=0, col=0) hist = pg.HistogramLUTItem(orientation="horizontal") p.setMouseEnabled(x=False, y=False) win.nextRow() win.addItem(hist) image = NonUniformImage(w * RADS2RPM, tau, P_loss.T) image.setZValue(-1) p.addItem(image) # green - orange - red cmap = pg.ColorMap([0.0, 0.5, 1.0], [(74, 158, 71), (255, 230, 0), (191, 79, 76)]) hist.gradient.setColorMap(cmap) hist.setImageItem(image) p.showGrid(x=True, y=True) p.setLabel(axis='bottom', text='Speed [rpm]') p.setLabel(axis='left', text='Torque [Nm]') # elevate the grid lines p.axes['bottom']['item'].setZValue(1000) p.axes['left']['item'].setZValue(1000) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/PColorMeshItem.py000066400000000000000000000073121457240071200247010ustar00rootroot00000000000000""" Demonstrates very basic use of PColorMeshItem """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore from utils import FrameCounter app = pg.mkQApp("PColorMesh Example") ## Create window with GraphicsView widget win = pg.GraphicsLayoutWidget() win.show() ## show widget alone in its own window win.setWindowTitle('pyqtgraph example: pColorMeshItem') view_auto_scale = win.addPlot(0,0,1,1, title="Auto-scaling colorscheme", enableMenu=False) view_consistent_scale = win.addPlot(1,0,1,1, title="Consistent colorscheme", enableMenu=False) ## Create data # To enhance the non-grid meshing, we randomize the polygon vertices per and # certain amount randomness = 5 # x and y being the vertices of the polygons, they share the same shape # However the shape can be different in both dimension xn = 50 # nb points along x yn = 40 # nb points along y x = np.repeat(np.arange(1, xn+1), yn).reshape(xn, yn)\ + np.random.random((xn, yn))*randomness y = np.tile(np.arange(1, yn+1), xn).reshape(xn, yn)\ + np.random.random((xn, yn))*randomness x.sort(axis=0) y.sort(axis=0) # z being the color of the polygons its shape must be decreased by one in each dimension z = np.exp(-(x*xn)**2/1000)[:-1,:-1] ## Create autoscaling image item edgecolors = None antialiasing = False cmap = pg.colormap.get('viridis') levels = (-2,2) # Will be overwritten unless enableAutoLevels is set to False # edgecolors = {'color':'w', 'width':2} # May be uncommented to see edgecolor effect # antialiasing = True # May be uncommented to see antialiasing effect # cmap = pg.colormap.get('plasma') # May be uncommented to see a different colormap than the default 'viridis' pcmi_auto = pg.PColorMeshItem(edgecolors=edgecolors, antialiasing=antialiasing, colorMap=cmap, levels=levels, enableAutoLevels=True) view_auto_scale.addItem(pcmi_auto) # Add colorbar bar = pg.ColorBarItem( label = "Z value [arbitrary unit]", interactive=False, # Setting `interactive=True` would override `enableAutoLevels=True` of pcmi_auto (resulting in consistent colors) rounding=0.1) bar.setImageItem( [pcmi_auto] ) win.addItem(bar, 0,1,1,1) # Create image item with consistent colors and an interactive colorbar pcmi_consistent = pg.PColorMeshItem(edgecolors=edgecolors, antialiasing=antialiasing, colorMap=cmap, levels=levels, enableAutoLevels=False) view_consistent_scale.addItem(pcmi_consistent) # Add colorbar bar_static = pg.ColorBarItem( label = "Z value [arbitrary unit]", interactive=True, rounding=0.1) bar_static.setImageItem( [pcmi_consistent] ) win.addItem(bar_static,1,1,1,1) # Add timing label to the autoscaling view textitem = pg.TextItem(anchor=(1, 0)) view_auto_scale.addItem(textitem) # Wave parameters wave_amplitude = 3 wave_speed = 0.3 wave_length = 10 color_speed = 0.3 color_noise_freq = 0.05 # display info in top-right corner miny = np.min(y) - wave_amplitude maxy = np.max(y) + wave_amplitude view_auto_scale.setYRange(miny, maxy) textitem.setPos(np.max(x), maxy) textpos = None i=0 def updateData(): global i global textpos ## Display the new data set color_noise = np.sin(i * 2*np.pi*color_noise_freq) new_x = x new_y = y+wave_amplitude*np.cos(x/wave_length+i) new_z = np.exp(-(x-np.cos(i*color_speed)*xn)**2/1000)[:-1,:-1] + color_noise pcmi_auto.setData(new_x, new_y, new_z) pcmi_consistent.setData(new_x, new_y, new_z) i += wave_speed framecnt.update() timer = QtCore.QTimer() timer.timeout.connect(updateData) timer.start() framecnt = FrameCounter() framecnt.sigFpsUpdate.connect(lambda fps: textitem.setText(f'{fps:.1f} fps')) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/PanningPlot.py000066400000000000000000000012001457240071200242660ustar00rootroot00000000000000""" Shows use of PlotWidget to display panning data """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore win = pg.GraphicsLayoutWidget(show=True) win.setWindowTitle('pyqtgraph example: PanningPlot') plt = win.addPlot() #plt.setAutoVisibleOnly(y=True) curve = plt.plot() data = [] count = 0 def update(): global data, curve, count data.append(np.random.normal(size=10) + np.sin(count * 0.1) * 5) if len(data) > 100: data.pop(0) curve.setData(np.hstack(data)) count += 1 timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(50) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/PlotAutoRange.py000066400000000000000000000015241457240071200245720ustar00rootroot00000000000000 """ This example demonstrates the different auto-ranging capabilities of ViewBoxes """ import time import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore app = pg.mkQApp("Plot Auto Range Example") win = pg.GraphicsLayoutWidget(show=True, title="Plot auto-range examples") win.resize(800,600) win.setWindowTitle('pyqtgraph example: PlotAutoRange') d = np.random.normal(size=100) d[50:54] += 10 p1 = win.addPlot(title="95th percentile range", y=d) p1.enableAutoRange('y', 0.95) p2 = win.addPlot(title="Auto Pan Only") p2.setAutoPan(y=True) curve = p2.plot() t0 = time.time() def update(): t = time.time() - t0 data = np.ones(100) * np.sin(t) data[50:60] += np.sin(t) curve.setData(data) timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(50) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/PlotSpeedTest.py000066400000000000000000000122671457240071200246130ustar00rootroot00000000000000#!/usr/bin/python """ Update a simple plot as rapidly as possible to measure speed. """ import argparse import itertools import numpy as np from utils import FrameCounter import pyqtgraph as pg import pyqtgraph.functions as fn import pyqtgraph.parametertree as ptree from pyqtgraph.Qt import QtCore, QtGui, QtWidgets # defaults here result in the same configuration as the original PlotSpeedTest parser = argparse.ArgumentParser() parser.add_argument('--noise', dest='noise', action='store_true') parser.add_argument('--no-noise', dest='noise', action='store_false') parser.set_defaults(noise=True) parser.add_argument('--nsamples', default=5000, type=int) parser.add_argument('--frames', default=50, type=int) parser.add_argument('--fsample', default=1000, type=float) parser.add_argument('--frequency', default=0, type=float) parser.add_argument('--amplitude', default=5, type=float) parser.add_argument('--opengl', dest='use_opengl', action='store_true') parser.add_argument('--no-opengl', dest='use_opengl', action='store_false') parser.set_defaults(use_opengl=None) parser.add_argument('--allow-opengl-toggle', action='store_true', help="""Allow on-the-fly change of OpenGL setting. This may cause unwanted side effects. """) parser.add_argument('--iterations', default=float('inf'), type=float, help="Number of iterations to run before exiting" ) args = parser.parse_args() if args.use_opengl is not None: pg.setConfigOption('useOpenGL', args.use_opengl) pg.setConfigOption('enableExperimental', args.use_opengl) use_opengl = pg.getConfigOption('useOpenGL') # don't limit frame rate to vsync sfmt = QtGui.QSurfaceFormat() sfmt.setSwapInterval(0) QtGui.QSurfaceFormat.setDefaultFormat(sfmt) class MonkeyCurveItem(pg.PlotCurveItem): def __init__(self, *args, **kwds): super().__init__(*args, **kwds) self.monkey_mode = '' def setMethod(self, value): self.monkey_mode = value def paint(self, painter, opt, widget): if self.monkey_mode not in ['drawPolyline']: return super().paint(painter, opt, widget) painter.setRenderHint(painter.RenderHint.Antialiasing, self.opts['antialias']) painter.setPen(pg.mkPen(self.opts['pen'])) if self.monkey_mode == 'drawPolyline': painter.drawPolyline(fn.arrayToQPolygonF(self.xData, self.yData)) app = pg.mkQApp("Plot Speed Test") default_pen = pg.mkPen() params = ptree.Parameter.create(name='Parameters', type='group') pt = ptree.ParameterTree(showHeader=False) pt.setParameters(params) pw = pg.PlotWidget() splitter = QtWidgets.QSplitter() splitter.addWidget(pt) splitter.addWidget(pw) splitter.show() interactor = ptree.Interactor( parent=params, nest=False, runOptions=ptree.RunOptions.ON_CHANGED ) pw.setWindowTitle('pyqtgraph example: PlotSpeedTest') pw.setLabel('bottom', 'Index', units='B') curve = MonkeyCurveItem(pen=default_pen, brush='b') pw.addItem(curve) iterations_counter = itertools.count() @interactor.decorate( nest=True, nsamples={'limits': [0, None]}, frames={'limits': [1, None]}, fsample={'units': 'Hz'}, frequency={'units': 'Hz'} ) def makeData( noise=args.noise, nsamples=args.nsamples, frames=args.frames, fsample=args.fsample, frequency=args.frequency, amplitude=args.amplitude, ): global data, connect_array, ptr ttt = np.arange(frames * nsamples, dtype=np.float64) / fsample data = amplitude*np.sin(2*np.pi*frequency*ttt).reshape((frames, nsamples)) if noise: data += np.random.normal(size=data.shape) connect_array = np.ones(data.shape[-1], dtype=bool) ptr = 0 pw.setRange(QtCore.QRectF(0, -10, nsamples, 20)) params.child('makeData').setOpts(title='Plot Options') @interactor.decorate( connect={'type': 'list', 'limits': ['all', 'pairs', 'finite', 'array']} ) def update( antialias=pg.getConfigOption('antialias'), connect='all', skipFiniteCheck=False ): global ptr if next(iterations_counter) > args.iterations: # cleanly close down benchmark timer.stop() app.quit() return None if connect == 'array': connect = connect_array curve.setData( data[ptr], antialias=antialias, connect=connect, skipFiniteCheck=skipFiniteCheck ) ptr = (ptr + 1) % data.shape[0] framecnt.update() @interactor.decorate( useOpenGL={'readonly': not args.allow_opengl_toggle}, plotMethod={'limits': ['pyqtgraph', 'drawPolyline'], 'type': 'list'}, curvePen={'type': 'pen'} ) def updateOptions( curvePen=pg.mkPen(), plotMethod='pyqtgraph', fillLevel=False, enableExperimental=use_opengl, useOpenGL=use_opengl, ): pg.setConfigOption('enableExperimental', enableExperimental) pw.useOpenGL(useOpenGL) curve.setPen(curvePen) curve.setFillLevel(0.0 if fillLevel else None) curve.setMethod(plotMethod) makeData() timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(0) framecnt = FrameCounter() framecnt.sigFpsUpdate.connect(lambda fps: pw.setTitle(f'{fps:.1f} fps')) if __name__ == '__main__': # Splitter by default gives too small of a width to the parameter tree, # so fix that right before the event loop pt.setMinimumSize(225,0) pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/PlotWidget.py000066400000000000000000000042161457240071200241310ustar00rootroot00000000000000""" Demonstrates use of PlotWidget class. This is little more than a GraphicsView with a PlotItem placed in its center. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtWidgets app = pg.mkQApp() mw = QtWidgets.QMainWindow() mw.setWindowTitle('pyqtgraph example: PlotWidget') mw.resize(800,800) cw = QtWidgets.QWidget() mw.setCentralWidget(cw) l = QtWidgets.QVBoxLayout() cw.setLayout(l) pw = pg.PlotWidget(name='Plot1') ## giving the plots names allows us to link their axes together l.addWidget(pw) pw2 = pg.PlotWidget(name='Plot2') l.addWidget(pw2) pw3 = pg.PlotWidget() l.addWidget(pw3) mw.show() ## Create an empty plot curve to be filled later, set its pen p1 = pw.plot() p1.setPen((200,200,100)) ## Add in some extra graphics rect = QtWidgets.QGraphicsRectItem(QtCore.QRectF(0, 0, 1, 5e-11)) rect.setPen(pg.mkPen(100, 200, 100)) pw.addItem(rect) pw.setLabel('left', 'Value', units='V') pw.setLabel('bottom', 'Time', units='s') pw.setXRange(0, 2) pw.setYRange(0, 1e-10) def rand(n): data = np.random.random(n) data[int(n*0.1):int(n*0.13)] += .5 data[int(n*0.18)] += 2 data[int(n*0.1):int(n*0.13)] *= 5 data[int(n*0.18)] *= 20 data *= 1e-12 return data, np.arange(n, n+len(data)) / float(n) def updateData(): yd, xd = rand(10000) p1.setData(y=yd, x=xd) ## Start a timer to rapidly update the plot in pw t = QtCore.QTimer() t.timeout.connect(updateData) t.start(50) #updateData() ## Multiple parameterized plots--we can autogenerate averages for these. for i in range(0, 5): for j in range(0, 3): yd, xd = rand(10000) pw2.plot(y=yd*(j+1), x=xd, params={'iter': i, 'val': j}) ## Test large numbers curve = pw3.plot(np.random.normal(size=100)*1e0, clickable=True) curve.curve.setClickable(True) curve.setPen('w') ## white pen curve.setShadowPen(pg.mkPen((70,70,30), width=6, cosmetic=True)) def clicked(): print("curve clicked") curve.sigClicked.connect(clicked) lr = pg.LinearRegionItem([1, 30], bounds=[0,100], movable=True) pw3.addItem(lr) line = pg.InfiniteLine(angle=90, movable=True) pw3.addItem(line) line.setBounds([0,200]) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/Plotting.py000066400000000000000000000054571457240071200236570ustar00rootroot00000000000000""" This example demonstrates many of the 2D plotting capabilities in pyqtgraph. All of the plots may be panned/scaled by dragging with the left/right mouse buttons. Right click on any plot to show a context menu. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore app = pg.mkQApp("Plotting Example") #mw = QtWidgets.QMainWindow() #mw.resize(800,800) win = pg.GraphicsLayoutWidget(show=True, title="Basic plotting examples") win.resize(1000,600) win.setWindowTitle('pyqtgraph example: Plotting') # Enable antialiasing for prettier plots pg.setConfigOptions(antialias=True) p1 = win.addPlot(title="Basic array plotting", y=np.random.normal(size=100)) p2 = win.addPlot(title="Multiple curves") p2.plot(np.random.normal(size=100), pen=(255,0,0), name="Red curve") p2.plot(np.random.normal(size=110)+5, pen=(0,255,0), name="Green curve") p2.plot(np.random.normal(size=120)+10, pen=(0,0,255), name="Blue curve") p3 = win.addPlot(title="Drawing with points") p3.plot(np.random.normal(size=100), pen=(200,200,200), symbolBrush=(255,0,0), symbolPen='w') win.nextRow() p4 = win.addPlot(title="Parametric, grid enabled") x = np.cos(np.linspace(0, 2*np.pi, 1000)) y = np.sin(np.linspace(0, 4*np.pi, 1000)) p4.plot(x, y) p4.showGrid(x=True, y=True) p5 = win.addPlot(title="Scatter plot, axis labels, log scale") x = np.random.normal(size=1000) * 1e-5 y = x*1000 + 0.005 * np.random.normal(size=1000) y -= y.min()-1.0 mask = x > 1e-15 x = x[mask] y = y[mask] p5.plot(x, y, pen=None, symbol='t', symbolPen=None, symbolSize=10, symbolBrush=(100, 100, 255, 50)) p5.setLabel('left', "Y Axis", units='A') p5.setLabel('bottom', "Y Axis", units='s') p5.setLogMode(x=True, y=False) p6 = win.addPlot(title="Updating plot") curve = p6.plot(pen='y') data = np.random.normal(size=(10,1000)) ptr = 0 def update(): global curve, data, ptr, p6 curve.setData(data[ptr%10]) if ptr == 0: p6.enableAutoRange('xy', False) ## stop auto-scaling after the first data set is plotted ptr += 1 timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(50) win.nextRow() p7 = win.addPlot(title="Filled plot, axis disabled") y = np.sin(np.linspace(0, 10, 1000)) + np.random.normal(size=1000, scale=0.1) p7.plot(y, fillLevel=-0.3, brush=(50,50,200,100)) p7.showAxis('bottom', False) x2 = np.linspace(-100, 100, 1000) data2 = np.sin(x2) / x2 p8 = win.addPlot(title="Region Selection") p8.plot(data2, pen=(255,255,255,200)) lr = pg.LinearRegionItem([400,700]) lr.setZValue(-10) p8.addItem(lr) p9 = win.addPlot(title="Zoom on selected region") p9.plot(data2) def updatePlot(): p9.setXRange(*lr.getRegion(), padding=0) def updateRegion(): lr.setRegion(p9.getViewBox().viewRange()[0]) lr.sigRegionChanged.connect(updatePlot) p9.sigXRangeChanged.connect(updateRegion) updatePlot() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ProgressDialog.py000066400000000000000000000025071457240071200247740ustar00rootroot00000000000000""" Using ProgressDialog to show progress updates in a nested process. """ import time import pyqtgraph as pg app = pg.mkQApp("Progress Dialog Example") def runStage(i): """Waste time for 2 seconds while incrementing a progress bar. """ with pg.ProgressDialog("Running stage %s.." % i, maximum=100, nested=True) as dlg: for j in range(100): time.sleep(0.02) dlg += 1 if dlg.wasCanceled(): print("Canceled stage %s" % i) break def runManyStages(i): """Iterate over runStage() 3 times while incrementing a progress bar. """ with pg.ProgressDialog("Running stage %s.." % i, maximum=3, nested=True, wait=0) as dlg: for j in range(1,4): runStage('%d.%d' % (i, j)) dlg += 1 if dlg.wasCanceled(): print("Canceled stage %s" % i) break with pg.ProgressDialog("Doing a multi-stage process..", maximum=5, nested=True, wait=0) as dlg1: for i in range(1,6): if i == 3: # this stage will have 3 nested progress bars runManyStages(i) else: # this stage will have 2 nested progress bars runStage(i) dlg1 += 1 if dlg1.wasCanceled(): print("Canceled process") break pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ROIExamples.py000066400000000000000000000107471457240071200242050ustar00rootroot00000000000000""" Demonstrates a variety of uses for ROI. This class provides a user-adjustable region of interest marker. It is possible to customize the layout and function of the scale/rotate handles in very flexible ways. """ import numpy as np import pyqtgraph as pg pg.setConfigOptions(imageAxisOrder='row-major') ## Create image to display arr = np.ones((100, 100), dtype=float) arr[45:55, 45:55] = 0 arr[25, :] = 5 arr[:, 25] = 5 arr[75, :] = 5 arr[:, 75] = 5 arr[50, :] = 10 arr[:, 50] = 10 arr += np.sin(np.linspace(0, 20, 100)).reshape(1, 100) arr += np.random.normal(size=(100,100)) # add an arrow for asymmetry arr[10, :50] = 10 arr[9:12, 44:48] = 10 arr[8:13, 44:46] = 10 ## create GUI app = pg.mkQApp("ROI Examples") w = pg.GraphicsLayoutWidget(show=True, size=(1000,800), border=True) w.setWindowTitle('pyqtgraph example: ROI Examples') text = """Data Selection From Image.
      \n Drag an ROI or its handles to update the selected image.
      Hold CTRL while dragging to snap to pixel boundaries
      and 15-degree rotation angles. """ w1 = w.addLayout(row=0, col=0) label1 = w1.addLabel(text, row=0, col=0) v1a = w1.addViewBox(row=1, col=0, lockAspect=True) v1b = w1.addViewBox(row=2, col=0, lockAspect=True) img1a = pg.ImageItem(arr) v1a.addItem(img1a) img1b = pg.ImageItem() v1b.addItem(img1b) v1a.disableAutoRange('xy') v1b.disableAutoRange('xy') v1a.autoRange() v1b.autoRange() rois = [] rois.append(pg.RectROI([20, 20], [20, 20], pen=(0,9))) rois[-1].addRotateHandle([1,0], [0.5, 0.5]) rois.append(pg.LineROI([0, 60], [20, 80], width=5, pen=(1,9))) rois.append(pg.TriangleROI([80, 75], 20, pen=(5, 9))) rois.append(pg.MultiRectROI([[20, 90], [50, 60], [60, 90]], width=5, pen=(2,9))) rois.append(pg.EllipseROI([60, 10], [30, 20], pen=(3,9))) rois.append(pg.CircleROI([80, 50], [20, 20], pen=(4,9))) #rois.append(pg.LineSegmentROI([[110, 50], [20, 20]], pen=(5,9))) rois.append(pg.PolyLineROI([[80, 60], [90, 30], [60, 40]], pen=(6,9), closed=True)) def update(roi): img1b.setImage(roi.getArrayRegion(arr, img1a), levels=(0, arr.max())) v1b.autoRange() for roi in rois: roi.sigRegionChanged.connect(update) v1a.addItem(roi) update(rois[-1]) text = """User-Modifiable ROIs
      Click on a line segment to add a new handle. Right click on a handle to remove. """ w2 = w.addLayout(row=0, col=1) label2 = w2.addLabel(text, row=0, col=0) v2a = w2.addViewBox(row=1, col=0, lockAspect=True) r2a = pg.PolyLineROI([[0,0], [10,10], [10,30], [30,10]], closed=True) v2a.addItem(r2a) r2b = pg.PolyLineROI([[0,-20], [10,-10], [10,-30]], closed=False) v2a.addItem(r2b) v2a.disableAutoRange('xy') #v2b.disableAutoRange('xy') v2a.autoRange() #v2b.autoRange() text = """Building custom ROI types
      ROIs can be built with a variety of different handle types
      that scale and rotate the roi around an arbitrary center location """ w3 = w.addLayout(row=1, col=0) label3 = w3.addLabel(text, row=0, col=0) v3 = w3.addViewBox(row=1, col=0, lockAspect=True) r3a = pg.ROI([0,0], [10,10]) v3.addItem(r3a) ## handles scaling horizontally around center r3a.addScaleHandle([1, 0.5], [0.5, 0.5]) r3a.addScaleHandle([0, 0.5], [0.5, 0.5]) ## handles scaling vertically from opposite edge r3a.addScaleHandle([0.5, 0], [0.5, 1]) r3a.addScaleHandle([0.5, 1], [0.5, 0]) ## handles scaling both vertically and horizontally r3a.addScaleHandle([1, 1], [0, 0]) r3a.addScaleHandle([0, 0], [1, 1]) r3b = pg.ROI([20,0], [10,10]) v3.addItem(r3b) ## handles rotating around center r3b.addRotateHandle([1, 1], [0.5, 0.5]) r3b.addRotateHandle([0, 0], [0.5, 0.5]) ## handles rotating around opposite corner r3b.addRotateHandle([1, 0], [0, 1]) r3b.addRotateHandle([0, 1], [1, 0]) ## handles rotating/scaling around center r3b.addScaleRotateHandle([0, 0.5], [0.5, 0.5]) # handles rotating/scaling around arbitrary point r3b.addScaleRotateHandle([0.3, 0], [0.9, 0.7]) v3.disableAutoRange('xy') v3.autoRange() text = """Transforming objects with ROI""" w4 = w.addLayout(row=1, col=1) label4 = w4.addLabel(text, row=0, col=0) v4 = w4.addViewBox(row=1, col=0, lockAspect=True) g = pg.GridItem() v4.addItem(g) r4 = pg.ROI([0,0], [100,100], resizable=False, removable=True) r4.addRotateHandle([1,0], [0.5, 0.5]) r4.addRotateHandle([0,1], [0.5, 0.5]) img4 = pg.ImageItem(arr) v4.addItem(r4) img4.setParentItem(r4) v4.disableAutoRange('xy') v4.autoRange() # Provide a callback to remove the ROI (and its children) when # "remove" is selected from the context menu. def remove(): v4.removeItem(r4) r4.sigRemoveRequested.connect(remove) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ROItypes.py000066400000000000000000000057641457240071200235760ustar00rootroot00000000000000#!/usr/bin/python -i import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui pg.setConfigOptions(imageAxisOrder='row-major') ## create GUI app = pg.mkQApp("ROI Types Examples") w = pg.GraphicsLayoutWidget(show=True, size=(800,800), border=True) v = w.addViewBox(colspan=2) v.invertY(True) ## Images usually have their Y-axis pointing downward v.setAspectLocked(True) ## Create image to display arr = np.ones((100, 100), dtype=float) arr[45:55, 45:55] = 0 arr[25, :] = 5 arr[:, 25] = 5 arr[75, :] = 5 arr[:, 75] = 5 arr[50, :] = 10 arr[:, 50] = 10 # add an arrow for asymmetry arr[10, :50] = 10 arr[9:12, 44:48] = 10 arr[8:13, 44:46] = 10 ## Create image items, add to scene and set position im1 = pg.ImageItem(arr) im2 = pg.ImageItem(arr) v.addItem(im1) v.addItem(im2) im2.moveBy(110, 20) v.setRange(QtCore.QRectF(0, 0, 200, 120)) im1.setTransform(QtGui.QTransform.fromScale(0.8, 0.5)) im3 = pg.ImageItem() v2 = w.addViewBox(1,0) v2.addItem(im3) v2.setRange(QtCore.QRectF(0, 0, 60, 60)) v2.invertY(True) v2.setAspectLocked(True) #im3.moveBy(0, 130) im3.setZValue(10) im4 = pg.ImageItem() v3 = w.addViewBox(1,1) v3.addItem(im4) v3.setRange(QtCore.QRectF(0, 0, 60, 60)) v3.invertY(True) v3.setAspectLocked(True) #im4.moveBy(110, 130) im4.setZValue(10) ## create the plot pi1 = w.addPlot(2,0, colspan=2) #pi1 = pg.PlotItem() #s.addItem(pi1) #pi1.scale(0.5, 0.5) #pi1.setGeometry(0, 170, 300, 100) lastRoi = None def updateRoi(roi): global im1, im2, im3, im4, arr, lastRoi if roi is None: return lastRoi = roi arr1 = roi.getArrayRegion(im1.image, img=im1) im3.setImage(arr1) arr2 = roi.getArrayRegion(im2.image, img=im2) im4.setImage(arr2) updateRoiPlot(roi, arr1) def updateRoiPlot(roi, data=None): if data is None: data = roi.getArrayRegion(im1.image, img=im1) if data is not None: roi.curve.setData(data.mean(axis=1)) ## Create a variety of different ROI types rois = [] rois.append(pg.TestROI([0, 0], [20, 20], maxBounds=QtCore.QRectF(-10, -10, 230, 140), pen=(0,9))) rois.append(pg.LineROI([0, 0], [20, 20], width=5, pen=(1,9))) rois.append(pg.MultiRectROI([[0, 50], [50, 60], [60, 30]], width=5, pen=(2,9))) rois.append(pg.EllipseROI([110, 10], [30, 20], pen=(3,9))) rois.append(pg.CircleROI([110, 50], [20, 20], pen=(4,9))) rois.append(pg.PolyLineROI([[2,0], [2.1,0], [2,.1]], pen=(5,9))) #rois.append(SpiralROI([20,30], [1,1], pen=mkPen(0))) ## Add each ROI to the scene and link its data to a plot curve with the same color for r in rois: v.addItem(r) c = pi1.plot(pen=r.pen) r.curve = c r.sigRegionChanged.connect(updateRoi) def updateImage(): global im1, arr, lastRoi r = abs(np.random.normal(loc=0, scale=(arr.max()-arr.min())*0.1, size=arr.shape)) im1.updateImage(arr + r) updateRoi(lastRoi) for r in rois: updateRoiPlot(r) ## Rapidly update one of the images with random noise t = QtCore.QTimer() t.timeout.connect(updateImage) t.start(50) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/RemoteGraphicsView.py000066400000000000000000000016701457240071200256170ustar00rootroot00000000000000""" Very simple example demonstrating RemoteGraphicsView. This allows graphics to be rendered in a child process and displayed in the parent, which can improve CPU usage on multi-core processors. """ import pyqtgraph as pg from pyqtgraph.widgets.RemoteGraphicsView import RemoteGraphicsView app = pg.mkQApp() ## Create the widget v = RemoteGraphicsView(debug=False) # setting debug=True causes both processes to print information # about interprocess communication v.show() v.setWindowTitle('pyqtgraph example: RemoteGraphicsView') ## v.pg is a proxy to the remote process' pyqtgraph module. All attribute ## requests and function calls made with this object are forwarded to the ## remote process and executed there. See pyqtgraph.multiprocess.remoteproxy ## for more inormation. plt = v.pg.PlotItem() v.setCentralItem(plt) plt.plot([1,4,2,3,6,2,3,4,2,3], pen='g') if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/RemoteSpeedTest.py000066400000000000000000000056061457240071200251270ustar00rootroot00000000000000""" This example demonstrates the use of RemoteGraphicsView to improve performance in applications with heavy load. It works by starting a second process to handle all graphics rendering, thus freeing up the main process to do its work. In this example, the update() function is very expensive and is called frequently. After update() generates a new set of data, it can either plot directly to a local plot (bottom) or remotely via a RemoteGraphicsView (top), allowing speed comparison between the two cases. IF you have a multi-core CPU, it should be obvious that the remote case is much faster. """ import argparse import itertools import numpy as np from utils import FrameCounter import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtWidgets parser = argparse.ArgumentParser() parser.add_argument('--iterations', default=float('inf'), type=float, help="Number of iterations to run before exiting" ) args = parser.parse_args() iterations_counter = itertools.count() app = pg.mkQApp() view = pg.widgets.RemoteGraphicsView.RemoteGraphicsView() pg.setConfigOptions(antialias=True) ## this will be expensive for the local plot view.pg.setConfigOptions(antialias=True) ## prettier plots at no cost to the main process! view.setWindowTitle('pyqtgraph example: RemoteSpeedTest') app.aboutToQuit.connect(view.close) label = QtWidgets.QLabel() rcheck = QtWidgets.QCheckBox('plot remote') rcheck.setChecked(True) lcheck = QtWidgets.QCheckBox('plot local') lplt = pg.PlotWidget() layout = pg.LayoutWidget() layout.addWidget(rcheck) layout.addWidget(lcheck) layout.addWidget(label) layout.addWidget(view, row=1, col=0, colspan=3) layout.addWidget(lplt, row=2, col=0, colspan=3) layout.resize(800,800) layout.show() ## Create a PlotItem in the remote process that will be displayed locally rplt = view.pg.PlotItem() rplt._setProxyOptions(deferGetattr=True) ## speeds up access to rplt.plot view.setCentralItem(rplt) def update(): if next(iterations_counter) > args.iterations: timer.stop() app.quit() return None data = np.random.normal(size=(10000,50)).sum(axis=1) data += 5 * np.sin(np.linspace(0, 10, data.shape[0])) if rcheck.isChecked(): rplt.plot(data, clear=True, _callSync='off') ## We do not expect a return value. ## By turning off callSync, we tell ## the proxy that it does not need to ## wait for a reply from the remote ## process. if lcheck.isChecked(): lplt.plot(data, clear=True) framecnt.update() timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(0) framecnt = FrameCounter() framecnt.sigFpsUpdate.connect(lambda fps : label.setText(f"Generating {fps:.1f}")) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/RunExampleApp.py000066400000000000000000000007571457240071200245760ustar00rootroot00000000000000""" This file is used by test_examples.py for ensuring the Example App works. It is not named test_ExampleApp.py as that way the Example application is not run twice. """ from ExampleApp import ExampleLoader import pyqtgraph as pg from pyqtgraph.Qt import QtTest pg.mkQApp() def test_ExampleLoader(): loader = ExampleLoader() QtTest.QTest.qWaitForWindowExposed(loader) QtTest.QTest.qWait(200) loader.close() if __name__ == "__main__": test_ExampleLoader() pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ScaleBar.py000066400000000000000000000007271457240071200235260ustar00rootroot00000000000000""" Demonstrates ScaleBar """ import numpy as np import pyqtgraph as pg pg.mkQApp() win = pg.GraphicsLayoutWidget(show=True) win.setWindowTitle('pyqtgraph example: ScaleBar') vb = win.addViewBox() vb.setAspectLocked() img = pg.ImageItem() img.setImage(np.random.normal(size=(100,100))) img.setScale(0.01) vb.addItem(img) scale = pg.ScaleBar(size=0.1) scale.setParentItem(vb) scale.anchor((1, 1), (1, 1), offset=(-20, -20)) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ScatterPlot.py000066400000000000000000000102371457240071200243130ustar00rootroot00000000000000""" Example demonstrating a variety of scatter plot features. """ from collections import namedtuple import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtWidgets app = pg.mkQApp("Scatter Plot Item Example") mw = QtWidgets.QMainWindow() mw.resize(800,800) view = pg.GraphicsLayoutWidget() ## GraphicsView with GraphicsLayout inserted by default mw.setCentralWidget(view) mw.show() mw.setWindowTitle('pyqtgraph example: ScatterPlot') ## create four areas to add plots w1 = view.addPlot() w2 = view.addViewBox() w2.setAspectLocked(True) view.nextRow() w3 = view.addPlot() w4 = view.addPlot() print("Generating data, this takes a few seconds...") ## Make all plots clickable clickedPen = pg.mkPen('b', width=2) lastClicked = [] def clicked(plot, points): global lastClicked for p in lastClicked: p.resetPen() print("clicked points", points) for p in points: p.setPen(clickedPen) lastClicked = points ## There are a few different ways we can draw scatter plots; each is optimized for different types of data: ## 1) All spots identical and transform-invariant (top-left plot). ## In this case we can get a huge performance boost by pre-rendering the spot ## image and just drawing that image repeatedly. n = 300 s1 = pg.ScatterPlotItem(size=10, pen=pg.mkPen(None), brush=pg.mkBrush(255, 255, 255, 120)) pos = np.random.normal(size=(2,n), scale=1e-5) spots = [{'pos': pos[:,i], 'data': 1} for i in range(n)] + [{'pos': [0,0], 'data': 1}] s1.addPoints(spots) w1.addItem(s1) s1.sigClicked.connect(clicked) ## 2) Spots are transform-invariant, but not identical (top-right plot). ## In this case, drawing is almsot as fast as 1), but there is more startup ## overhead and memory usage since each spot generates its own pre-rendered ## image. TextSymbol = namedtuple("TextSymbol", "label symbol scale") def createLabel(label, angle): symbol = QtGui.QPainterPath() #symbol.addText(0, 0, QFont("San Serif", 10), label) f = QtGui.QFont() f.setPointSize(10) symbol.addText(0, 0, f, label) br = symbol.boundingRect() scale = min(1. / br.width(), 1. / br.height()) tr = QtGui.QTransform() tr.scale(scale, scale) tr.rotate(angle) tr.translate(-br.x() - br.width()/2., -br.y() - br.height()/2.) return TextSymbol(label, tr.map(symbol), 0.1 / scale) random_str = lambda : (''.join([chr(np.random.randint(ord('A'),ord('z'))) for i in range(np.random.randint(1,5))]), np.random.randint(0, 360)) s2 = pg.ScatterPlotItem(size=10, pen=pg.mkPen('w'), pxMode=True) pos = np.random.normal(size=(2,n), scale=1e-5) spots = [{'pos': pos[:,i], 'data': 1, 'brush':pg.intColor(i, n), 'symbol': i%10, 'size': 5+i/10.} for i in range(n)] s2.addPoints(spots) spots = [{'pos': pos[:,i], 'data': 1, 'brush':pg.intColor(i, n), 'symbol': label[1], 'size': label[2]*(5+i/10.)} for (i, label) in [(i, createLabel(*random_str())) for i in range(n)]] s2.addPoints(spots) w2.addItem(s2) s2.sigClicked.connect(clicked) ## 3) Spots are not transform-invariant, not identical (bottom-left). ## This is the slowest case, since all spots must be completely re-drawn ## every time because their apparent transformation may have changed. s3 = pg.ScatterPlotItem( pxMode=False, # Set pxMode=False to allow spots to transform with the view hoverable=True, hoverPen=pg.mkPen('g'), hoverSize=1e-6 ) spots3 = [] for i in range(10): for j in range(10): spots3.append({'pos': (1e-6*i, 1e-6*j), 'size': 1e-6, 'pen': {'color': 'w', 'width': 2}, 'brush':pg.intColor(i*10+j, 100)}) s3.addPoints(spots3) w3.addItem(s3) s3.sigClicked.connect(clicked) ## Test performance of large scatterplots s4 = pg.ScatterPlotItem( size=10, pen=pg.mkPen(None), brush=pg.mkBrush(255, 255, 255, 20), hoverable=True, hoverSymbol='s', hoverSize=15, hoverPen=pg.mkPen('r', width=2), hoverBrush=pg.mkBrush('g'), ) n = 10000 pos = np.random.normal(size=(2, n), scale=1e-9) s4.addPoints( x=pos[0], y=pos[1], # size=(np.random.random(n) * 20.).astype(int), # brush=[pg.mkBrush(x) for x in np.random.randint(0, 256, (n, 3))], data=np.arange(n) ) w4.addItem(s4) s4.sigClicked.connect(clicked) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ScatterPlotSpeedTest.py000066400000000000000000000072701457240071200261370ustar00rootroot00000000000000#!/usr/bin/python """ For testing rapid updates of ScatterPlotItem under various conditions. (Scatter plots are still rather slow to draw; expect about 20fps) """ import argparse import itertools import re import numpy as np from utils import FrameCounter import pyqtgraph as pg import pyqtgraph.parametertree as ptree from pyqtgraph.Qt import QtCore, QtWidgets translate = QtCore.QCoreApplication.translate parser = argparse.ArgumentParser() parser.add_argument('--iterations', default=float('inf'), type=float, help="Number of iterations to run before exiting" ) args = parser.parse_args() iterations_counter = itertools.count() app = pg.mkQApp() pt = ptree.ParameterTree(showHeader=False) param = ptree.Parameter.create(name=translate("ScatterPlot", "Parameters"), type="group") pt.setParameters(param) p = pg.PlotWidget() splitter = QtWidgets.QSplitter() splitter.addWidget(pt) splitter.addWidget(p) splitter.setSizes([300, p.width()]) splitter.show() data = {} item = pg.ScatterPlotItem() hoverBrush = pg.mkBrush("y") ptr = 0 timer = QtCore.QTimer() def fmt(name): replace = r"\1 \2" name = re.sub(r"(\w)([A-Z])", replace, name) name = name.replace("_", " ") return translate("ScatterPlot", f"{name.title().strip()}: ") interactor = ptree.Interactor( titleFormat=fmt, nest=False, parent=param, runOptions=ptree.RunOptions.ON_CHANGED ) @interactor.decorate( count=dict(limits=[1, None], step=100), size=dict(limits=[1, None]), ) def mkDataAndItem(count=500, size=10): global data scale = 100 data = { "pos": np.random.normal(size=(50, count), scale=scale), "pen": [pg.mkPen(x) for x in np.random.randint(0, 256, (count, 3))], "brush": [pg.mkBrush(x) for x in np.random.randint(0, 256, (count, 3))], "size": (np.random.random(count) * size).astype(int), } data["pen"][0] = pg.mkPen("w") data["size"][0] = size data["brush"][0] = pg.mkBrush("b") bound = 5 * scale p.setRange(xRange=[-bound, bound], yRange=[-bound, bound]) mkItem() @interactor.decorate() def mkItem(pxMode=True, useCache=True): global item item = pg.ScatterPlotItem(pxMode=pxMode, **getData()) item.opts["useCache"] = useCache p.clear() p.addItem(item) @interactor.decorate() def getData(randomize=False): pos = data["pos"] pen = data["pen"] size = data["size"] brush = data["brush"] if not randomize: pen = pen[0] size = size[0] brush = brush[0] return dict(x=pos[ptr % 50], y=pos[(ptr + 1) % 50], pen=pen, brush=brush, size=size) @interactor.decorate( mode=dict( type="list", limits=["New Item", "Reuse Item", "Simulate Pan/Zoom", "Simulate Hover"], ), ) def update(mode="Reuse Item"): global ptr if next(iterations_counter) > args.iterations: timer.stop() app.quit() return None if mode == "New Item": mkItem() elif mode == "Reuse Item": item.setData(**getData()) elif mode == "Simulate Pan/Zoom": item.viewTransformChanged() item.update() elif mode == "Simulate Hover": pts = item.points() old = pts[(ptr - 1) % len(pts)] new = pts[ptr % len(pts)] item.pointsAt(new.pos()) old.resetBrush() # reset old's brush before setting new's to better simulate hovering new.setBrush(hoverBrush) ptr += 1 framecnt.update() @interactor.decorate() def pausePlot(paused=False): if paused: timer.stop() else: timer.start() mkDataAndItem() timer.timeout.connect(update) timer.start(0) framecnt = FrameCounter() framecnt.sigFpsUpdate.connect(lambda fps : p.setTitle(f'{fps:.1f} fps')) if __name__ == "__main__": pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ScatterPlotWidget.py000066400000000000000000000045121457240071200254560ustar00rootroot00000000000000""" Demonstration of ScatterPlotWidget for exploring structure in tabular data. The widget consists of four components: 1) A list of column names from which the user may select 1 or 2 columns to plot. If one column is selected, the data for that column will be plotted in a histogram-like manner by using pg.pseudoScatter(). If two columns are selected, then the scatter plot will be generated with x determined by the first column that was selected and y by the second. 2) A DataFilter that allows the user to select a subset of the data by specifying multiple selection criteria. 3) A ColorMap that allows the user to determine how points are colored by specifying multiple criteria. 4) A PlotWidget for displaying the data. """ import numpy as np import pyqtgraph as pg pg.mkQApp() # Make up some tabular data with structure data = np.empty(1000, dtype=[('x_pos', float), ('y_pos', float), ('count', int), ('amplitude', float), ('decay', float), ('type', 'U10')]) strings = ['Type-A', 'Type-B', 'Type-C', 'Type-D', 'Type-E'] typeInds = np.random.randint(5, size=1000) data['type'] = np.array(strings)[typeInds] data['x_pos'] = np.random.normal(size=1000) data['x_pos'][data['type'] == 'Type-A'] -= 1 data['x_pos'][data['type'] == 'Type-B'] -= 1 data['x_pos'][data['type'] == 'Type-C'] += 2 data['x_pos'][data['type'] == 'Type-D'] += 2 data['x_pos'][data['type'] == 'Type-E'] += 2 data['y_pos'] = np.random.normal(size=1000) + data['x_pos']*0.1 data['y_pos'][data['type'] == 'Type-A'] += 3 data['y_pos'][data['type'] == 'Type-B'] += 3 data['amplitude'] = data['x_pos'] * 1.4 + data['y_pos'] + np.random.normal(size=1000, scale=0.4) data['count'] = (np.random.exponential(size=1000, scale=100) * data['x_pos']).astype(int) data['decay'] = np.random.normal(size=1000, scale=1e-3) + data['amplitude'] * 1e-4 data['decay'][data['type'] == 'Type-A'] /= 2 data['decay'][data['type'] == 'Type-E'] *= 3 # Create ScatterPlotWidget and configure its fields spw = pg.ScatterPlotWidget() spw.setFields([ ('x_pos', {'units': 'm'}), ('y_pos', {'units': 'm'}), ('count', {}), ('amplitude', {'units': 'V'}), ('decay', {'units': 's'}), ('type', {'mode': 'enum', 'values': strings}), ]) spw.setData(data) spw.show() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/SimplePlot.py000066400000000000000000000002541457240071200241350ustar00rootroot00000000000000import numpy as np import pyqtgraph as pg plt = pg.plot(np.random.normal(size=100), title="Simplest possible plotting example") if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/SpinBox.py000066400000000000000000000112431457240071200234270ustar00rootroot00000000000000""" This example demonstrates the SpinBox widget, which is an extension of QDoubleSpinBox providing some advanced features: * SI-prefixed units * Non-linear stepping modes * Bounded/unbounded values """ import ast import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets app = pg.mkQApp("SpinBox Example") spins = [ ("Floating-point spin box, min=0, no maximum.
      Non-finite values (nan, inf) are permitted.", pg.SpinBox(value=5.0, bounds=[0, None], finite=False)), ("Integer spin box, dec stepping
      (1-9, 10-90, 100-900, etc), decimals=4", pg.SpinBox(value=10, int=True, dec=True, minStep=1, step=1, decimals=4)), ("Float with SI-prefixed units
      (n, u, m, k, M, etc)", pg.SpinBox(value=0.9, suffix='V', siPrefix=True)), ("Float with SI-prefixed units,
      dec step=0.1, minStep=0.1", pg.SpinBox(value=1.0, suffix='PSI', siPrefix=True, dec=True, step=0.1, minStep=0.1)), ("Float with SI-prefixed units,
      dec step=0.5, minStep=0.01", pg.SpinBox(value=1.0, suffix='V', siPrefix=True, dec=True, step=0.5, minStep=0.01)), ("Float with SI-prefixed units,
      dec step=1.0, minStep=0.001", pg.SpinBox(value=1.0, suffix='V', siPrefix=True, dec=True, step=1.0, minStep=0.001)), ("Float with SI-prefixed units,
      scaleAtZero=1e-6, step=1e-9", pg.SpinBox(value=0, suffix='V', siPrefix=True, scaleAtZero=1e-6, step=1e-9)), ("Float with SI prefix but no suffix", pg.SpinBox(value=1e9, siPrefix=True)), ("Float with custom formatting", pg.SpinBox(value=23.07, format='${value:0.02f}', regex='\$?(?P(-?\d+(\.\d+)?)|(-?\.\d+))$')), ("Int with suffix", pg.SpinBox(value=999, step=1, int=True, suffix="V")), ("Int with custom formatting", pg.SpinBox(value=4567, step=1, int=True, bounds=[0,None], format='0x{value:X}', regex='(0x)?(?P[0-9a-fA-F]+)$', evalFunc=lambda s: ast.literal_eval('0x'+s))), ("Integer with bounds=[10, 20] and wrapping", pg.SpinBox(value=10, bounds=[10, 20], int=True, minStep=1, step=1, wrapping=True)), ] win = QtWidgets.QMainWindow() win.setWindowTitle('pyqtgraph example: SpinBox') cw = QtWidgets.QWidget() layout = QtWidgets.QGridLayout() cw.setLayout(layout) win.setCentralWidget(cw) win.show() #win.resize(300, 600) changingLabel = QtWidgets.QLabel() ## updated immediately changedLabel = QtWidgets.QLabel() ## updated only when editing is finished or mouse wheel has stopped for 0.3sec changingLabel.setMinimumWidth(200) font = changingLabel.font() font.setBold(True) font.setPointSize(14) changingLabel.setFont(font) changedLabel.setFont(font) labels = [] def valueChanged(sb): changedLabel.setText("Final value: %s" % str(sb.value())) def valueChanging(sb, value): changingLabel.setText("Value changing: %s" % str(sb.value())) for text, spin in spins: label = QtWidgets.QLabel(text) labels.append(label) layout.addWidget(label) layout.addWidget(spin) spin.sigValueChanged.connect(valueChanged) spin.sigValueChanging.connect(valueChanging) layout.addWidget(changingLabel, 0, 1) layout.addWidget(changedLabel, 2, 1) #def mkWin(): #win = QtWidgets.QMainWindow() #g = QtWidgets.QFormLayout() #w = QtWidgets.QWidget() #w.setLayout(g) #win.setCentralWidget(w) #s1 = SpinBox(value=5, step=0.1, bounds=[-1.5, None], suffix='units') #t1 = QtWidgets.QLineEdit() #g.addRow(s1, t1) #s2 = SpinBox(value=10e-6, dec=True, step=0.1, minStep=1e-6, suffix='A', siPrefix=True) #t2 = QtWidgets.QLineEdit() #g.addRow(s2, t2) #s3 = SpinBox(value=1000, dec=True, step=0.5, minStep=1e-6, bounds=[1, 1e9], suffix='Hz', siPrefix=True) #t3 = QtWidgets.QLineEdit() #g.addRow(s3, t3) #s4 = SpinBox(int=True, dec=True, step=1, minStep=1, bounds=[-10, 1000]) #t4 = QtWidgets.QLineEdit() #g.addRow(s4, t4) #win.show() #import sys #for sb in [s1, s2, s3,s4]: ##QtCore.QObject.connect(sb, QtCore.SIGNAL('valueChanged(double)'), lambda v: sys.stdout.write(str(sb) + " valueChanged\n")) ##QtCore.QObject.connect(sb, QtCore.SIGNAL('editingFinished()'), lambda: sys.stdout.write(str(sb) + " editingFinished\n")) #sb.sigValueChanged.connect(valueChanged) #sb.sigValueChanging.connect(valueChanging) #sb.editingFinished.connect(lambda: sys.stdout.write(str(sb) + " editingFinished\n")) #return win, w, [s1, s2, s3, s4] #a = mkWin() #def test(n=100): #for i in range(n): #win, w, sb = mkWin() #for s in sb: #w.setParent(None) #s.setParent(None) #s.valueChanged.disconnect() #s.editingFinished.disconnect() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/Symbols.py000077500000000000000000000051041457240071200234770ustar00rootroot00000000000000""" This example shows all the scatter plot symbols available in pyqtgraph. These symbols are used to mark point locations for scatter plots and some line plots, similar to "markers" in matplotlib and vispy. """ import pyqtgraph as pg app = pg.mkQApp("Symbols Examples") win = pg.GraphicsLayoutWidget(show=True, title="Scatter Plot Symbols") win.resize(1000,600) pg.setConfigOptions(antialias=True) plot = win.addPlot(title="Plotting with symbols") plot.addLegend() plot.plot([0, 1, 2, 3, 4], pen=(0,0,200), symbolBrush=(0,0,200), symbolPen='w', symbol='o', symbolSize=14, name="symbol='o'") plot.plot([1, 2, 3, 4, 5], pen=(0,128,0), symbolBrush=(0,128,0), symbolPen='w', symbol='t', symbolSize=14, name="symbol='t'") plot.plot([2, 3, 4, 5, 6], pen=(19,234,201), symbolBrush=(19,234,201), symbolPen='w', symbol='t1', symbolSize=14, name="symbol='t1'") plot.plot([3, 4, 5, 6, 7], pen=(195,46,212), symbolBrush=(195,46,212), symbolPen='w', symbol='t2', symbolSize=14, name="symbol='t2'") plot.plot([4, 5, 6, 7, 8], pen=(250,194,5), symbolBrush=(250,194,5), symbolPen='w', symbol='t3', symbolSize=14, name="symbol='t3'") plot.plot([5, 6, 7, 8, 9], pen=(54,55,55), symbolBrush=(55,55,55), symbolPen='w', symbol='s', symbolSize=14, name="symbol='s'") plot.plot([6, 7, 8, 9, 10], pen=(0,114,189), symbolBrush=(0,114,189), symbolPen='w', symbol='p', symbolSize=14, name="symbol='p'") plot.plot([7, 8, 9, 10, 11], pen=(217,83,25), symbolBrush=(217,83,25), symbolPen='w', symbol='h', symbolSize=14, name="symbol='h'") plot.plot([8, 9, 10, 11, 12], pen=(237,177,32), symbolBrush=(237,177,32), symbolPen='w', symbol='star', symbolSize=14, name="symbol='star'") plot.plot([9, 10, 11, 12, 13], pen=(126,47,142), symbolBrush=(126,47,142), symbolPen='w', symbol='+', symbolSize=14, name="symbol='+'") plot.plot([10, 11, 12, 13, 14], pen=(119,172,48), symbolBrush=(119,172,48), symbolPen='w', symbol='d', symbolSize=14, name="symbol='d'") plot.plot([11, 12, 13, 14, 15], pen=(253, 216, 53), symbolBrush=(253, 216, 53), symbolPen='w', symbol='arrow_down', symbolSize=22, name="symbol='arrow_down'") plot.plot([12, 13, 14, 15, 16], pen=(189, 189, 189), symbolBrush=(189, 189, 189), symbolPen='w', symbol='arrow_left', symbolSize=22, name="symbol='arrow_left'") plot.plot([13, 14, 15, 16, 17], pen=(187, 26, 95), symbolBrush=(187, 26, 95), symbolPen='w', symbol='arrow_up', symbolSize=22, name="symbol='arrow_up'") plot.plot([14, 15, 16, 17, 18], pen=(248, 187, 208), symbolBrush=(248, 187, 208), symbolPen='w', symbol='arrow_right', symbolSize=22, name="symbol='arrow_right'") plot.setXRange(-2, 4) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/TableWidget.py000066400000000000000000000011131457240071200242330ustar00rootroot00000000000000""" Simple demonstration of TableWidget, which is an extension of QTableWidget that automatically displays a variety of tabluar data formats. """ import numpy as np import pyqtgraph as pg app = pg.mkQApp("Table Widget Example") w = pg.TableWidget() w.show() w.resize(500,500) w.setWindowTitle('pyqtgraph example: TableWidget') data = np.array([ (1, 1.6, 'x'), (3, 5.4, 'y'), (8, 12.5, 'z'), (443, 1e-12, 'w'), ], dtype=[('Column 1', int), ('Column 2', float), ('Column 3', object)]) w.setData(data) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/TreeWidget.py000066400000000000000000000022551457240071200241130ustar00rootroot00000000000000""" Simple demonstration of TreeWidget, which is an extension of QTreeWidget that allows widgets to be added and dragged within the tree more easily. """ import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets app = pg.mkQApp("TreeWidget Example") w = pg.TreeWidget() w.setColumnCount(2) w.show() w.setWindowTitle('pyqtgraph example: TreeWidget') i1 = QtWidgets.QTreeWidgetItem(["Item 1"]) i11 = QtWidgets.QTreeWidgetItem(["Item 1.1"]) i12 = QtWidgets.QTreeWidgetItem(["Item 1.2"]) i2 = QtWidgets.QTreeWidgetItem(["Item 2"]) i21 = QtWidgets.QTreeWidgetItem(["Item 2.1"]) i211 = pg.TreeWidgetItem(["Item 2.1.1"]) i212 = pg.TreeWidgetItem(["Item 2.1.2"]) i22 = pg.TreeWidgetItem(["Item 2.2"]) i3 = pg.TreeWidgetItem(["Item 3"]) i4 = pg.TreeWidgetItem(["Item 4"]) i5 = pg.TreeWidgetItem(["Item 5"]) b5 = QtWidgets.QPushButton('Button') i5.setWidget(1, b5) w.addTopLevelItem(i1) w.addTopLevelItem(i2) w.addTopLevelItem(i3) w.addTopLevelItem(i4) w.addTopLevelItem(i5) i1.addChild(i11) i1.addChild(i12) i2.addChild(i21) i21.addChild(i211) i21.addChild(i212) i2.addChild(i22) b1 = QtWidgets.QPushButton("Button") w.setItemWidget(i1, 1, b1) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/VideoSpeedTest.py000066400000000000000000000226161457240071200247420ustar00rootroot00000000000000""" Tests the speed of image updates for an ImageItem and RawImageWidget. The speed will generally depend on the type of data being shown, whether it is being scaled and/or converted by lookup table, and whether OpenGL is used by the view widget """ import argparse import itertools import sys import numpy as np from utils import FrameCounter import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui, QtWidgets pg.setConfigOption('imageAxisOrder', 'row-major') import VideoTemplate_generic as ui_template try: import cupy as cp pg.setConfigOption("useCupy", True) _has_cupy = True except ImportError: cp = None _has_cupy = False try: import numba _has_numba = True except ImportError: numba = None _has_numba = False try: from pyqtgraph.widgets.RawImageWidget import RawImageGLWidget except ImportError: RawImageGLWidget = None parser = argparse.ArgumentParser(description="Benchmark for testing video performance") parser.add_argument('--cuda', default=False, action='store_true', help="Use CUDA to process on the GPU", dest="cuda") parser.add_argument('--dtype', default='uint8', choices=['uint8', 'uint16', 'float'], help="Image dtype (uint8, uint16, or float)") parser.add_argument('--frames', default=3, type=int, help="Number of image frames to generate (default=3)") parser.add_argument('--image-mode', default='mono', choices=['mono', 'rgb'], help="Image data mode (mono or rgb)", dest='image_mode') parser.add_argument('--levels', default=None, type=lambda s: tuple([float(x) for x in s.split(',')]), help="min,max levels to scale monochromatic image dynamic range, or rmin,rmax,gmin,gmax,bmin,bmax to scale rgb") parser.add_argument('--lut', default=False, action='store_true', help="Use color lookup table") parser.add_argument('--lut-alpha', default=False, action='store_true', help="Use alpha color lookup table", dest='lut_alpha') parser.add_argument('--size', default='512x512', type=lambda s: tuple([int(x) for x in s.split('x')]), help="WxH image dimensions default='512x512'") parser.add_argument('--iterations', default=float('inf'), type=float, help="Number of iterations to run before exiting" ) args = parser.parse_args(sys.argv[1:]) iterations_counter = itertools.count() if RawImageGLWidget is not None: # don't limit frame rate to vsync sfmt = QtGui.QSurfaceFormat() sfmt.setSwapInterval(0) QtGui.QSurfaceFormat.setDefaultFormat(sfmt) app = pg.mkQApp("Video Speed Test Example") win = QtWidgets.QMainWindow() win.setWindowTitle('pyqtgraph example: VideoSpeedTest') ui = ui_template.Ui_MainWindow() ui.setupUi(win) win.show() if RawImageGLWidget is None: ui.rawGLRadio.setEnabled(False) ui.rawGLRadio.setText(ui.rawGLRadio.text() + " (OpenGL not available)") else: ui.rawGLImg = RawImageGLWidget() ui.stack.addWidget(ui.rawGLImg) # read in CLI args ui.cudaCheck.setChecked(args.cuda and _has_cupy) ui.cudaCheck.setEnabled(_has_cupy) ui.numbaCheck.setChecked(_has_numba and pg.getConfigOption("useNumba")) ui.numbaCheck.setEnabled(_has_numba) ui.framesSpin.setValue(args.frames) ui.widthSpin.setValue(args.size[0]) ui.heightSpin.setValue(args.size[1]) ui.dtypeCombo.setCurrentText(args.dtype) ui.rgbCheck.setChecked(args.image_mode=='rgb') ui.maxSpin1.setOpts(value=255, step=1) ui.minSpin1.setOpts(value=0, step=1) levelSpins = [ui.minSpin1, ui.maxSpin1, ui.minSpin2, ui.maxSpin2, ui.minSpin3, ui.maxSpin3] if args.cuda and _has_cupy: xp = cp else: xp = np if args.levels is None: ui.scaleCheck.setChecked(False) ui.rgbLevelsCheck.setChecked(False) else: ui.scaleCheck.setChecked(True) if len(args.levels) == 2: ui.rgbLevelsCheck.setChecked(False) ui.minSpin1.setValue(args.levels[0]) ui.maxSpin1.setValue(args.levels[1]) elif len(args.levels) == 6: ui.rgbLevelsCheck.setChecked(True) for spin,val in zip(levelSpins, args.levels): spin.setValue(val) else: raise ValueError("levels argument must be 2 or 6 comma-separated values (got %r)" % (args.levels,)) ui.lutCheck.setChecked(args.lut) ui.alphaCheck.setChecked(args.lut_alpha) #ui.graphicsView.useOpenGL() ## buggy, but you can try it if you need extra speed. vb = pg.ViewBox() ui.graphicsView.setCentralItem(vb) vb.setAspectLocked() img = pg.ImageItem() vb.addItem(img) LUT = None def updateLUT(): global LUT, ui dtype = ui.dtypeCombo.currentText() if dtype == 'uint8': n = 256 else: n = 4096 LUT = ui.gradient.getLookupTable(n, alpha=ui.alphaCheck.isChecked()) if _has_cupy and xp == cp: LUT = cp.asarray(LUT) ui.gradient.sigGradientChanged.connect(updateLUT) updateLUT() ui.alphaCheck.toggled.connect(updateLUT) def updateScale(): global ui, levelSpins if ui.rgbLevelsCheck.isChecked(): for s in levelSpins[2:]: s.setEnabled(True) else: for s in levelSpins[2:]: s.setEnabled(False) updateScale() ui.rgbLevelsCheck.toggled.connect(updateScale) cache = {} def mkData(): with pg.BusyCursor(): global data, cache, ui, xp frames = ui.framesSpin.value() width = ui.widthSpin.value() height = ui.heightSpin.value() cacheKey = (ui.dtypeCombo.currentText(), ui.rgbCheck.isChecked(), frames, width, height) if cacheKey not in cache: if cacheKey[0] == 'uint8': dt = xp.uint8 loc = 128 scale = 64 mx = 255 elif cacheKey[0] == 'uint16': dt = xp.uint16 loc = 4096 scale = 1024 mx = 2**16 - 1 elif cacheKey[0] == 'float': dt = xp.float32 loc = 1.0 scale = 0.1 mx = 1.0 else: raise ValueError(f"unable to handle dtype: {cacheKey[0]}") chan_shape = (height, width) if ui.rgbCheck.isChecked(): frame_shape = chan_shape + (3,) else: frame_shape = chan_shape data = xp.empty((frames,) + frame_shape, dtype=dt) view = data.reshape((-1,) + chan_shape) for idx in range(view.shape[0]): subdata = xp.random.normal(loc=loc, scale=scale, size=chan_shape) # note: gaussian filtering has been removed as it slows down array # creation greatly. if cacheKey[0] != 'float': xp.clip(subdata, 0, mx, out=subdata) view[idx] = subdata data[:, 10:50, 10] = mx data[:, 48, 9:12] = mx data[:, 47, 8:13] = mx cache = {cacheKey: data} # clear to save memory (but keep one to prevent unnecessary regeneration) data = cache[cacheKey] updateLUT() updateSize() def updateSize(): global ui, vb frames = ui.framesSpin.value() width = ui.widthSpin.value() height = ui.heightSpin.value() dtype = xp.dtype(str(ui.dtypeCombo.currentText())) rgb = 3 if ui.rgbCheck.isChecked() else 1 ui.sizeLabel.setText('%d MB' % (frames * width * height * rgb * dtype.itemsize / 1e6)) vb.setRange(QtCore.QRectF(0, 0, width, height)) def noticeCudaCheck(): global xp, cache cache = {} if ui.cudaCheck.isChecked(): if _has_cupy: xp = cp else: xp = np ui.cudaCheck.setChecked(False) else: xp = np mkData() def noticeNumbaCheck(): pg.setConfigOption('useNumba', _has_numba and ui.numbaCheck.isChecked()) mkData() ui.dtypeCombo.currentIndexChanged.connect(mkData) ui.rgbCheck.toggled.connect(mkData) ui.widthSpin.editingFinished.connect(mkData) ui.heightSpin.editingFinished.connect(mkData) ui.framesSpin.editingFinished.connect(mkData) ui.widthSpin.valueChanged.connect(updateSize) ui.heightSpin.valueChanged.connect(updateSize) ui.framesSpin.valueChanged.connect(updateSize) ui.cudaCheck.toggled.connect(noticeCudaCheck) ui.numbaCheck.toggled.connect(noticeNumbaCheck) ptr = 0 def update(): global ptr if next(iterations_counter) > args.iterations: # cleanly close down benchmark timer.stop() app.quit() return None if ui.lutCheck.isChecked(): useLut = LUT else: useLut = None downsample = ui.downsampleCheck.isChecked() if ui.scaleCheck.isChecked(): if ui.rgbLevelsCheck.isChecked(): useScale = [ [ui.minSpin1.value(), ui.maxSpin1.value()], [ui.minSpin2.value(), ui.maxSpin2.value()], [ui.minSpin3.value(), ui.maxSpin3.value()]] else: useScale = [ui.minSpin1.value(), ui.maxSpin1.value()] else: useScale = None if ui.rawRadio.isChecked(): ui.rawImg.setImage(data[ptr%data.shape[0]], lut=useLut, levels=useScale) ui.stack.setCurrentIndex(1) elif ui.rawGLRadio.isChecked(): ui.rawGLImg.setImage(data[ptr%data.shape[0]], lut=useLut, levels=useScale) ui.stack.setCurrentIndex(2) else: img.setImage(data[ptr%data.shape[0]], autoLevels=False, levels=useScale, lut=useLut, autoDownsample=downsample) ui.stack.setCurrentIndex(0) #img.setImage(data[ptr%data.shape[0]], autoRange=False) ptr += 1 framecnt.update() timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(0) framecnt = FrameCounter() framecnt.sigFpsUpdate.connect(lambda fps: ui.fpsLabel.setText(f'{fps:.1f} fps')) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/VideoTemplate.ui000066400000000000000000000230151457240071200245740ustar00rootroot00000000000000 MainWindow 0 0 695 798 MainWindow Use CUDA (GPU) if available Use Numba if available Auto downsample Scale Data RawImageWidget GraphicsView + ImageItem true 1 0 0 RawGLImageWidget uint8 uint16 float Data type RGB false <---> Qt::AlignCenter false <---> Qt::AlignCenter false <---> Qt::AlignCenter false Use Lookup Table alpha 0 0 Qt::Horizontal 40 20 12 FPS Qt::AlignCenter RGB Image size QAbstractSpinBox::NoButtons 10 QAbstractSpinBox::PlusMinus 10000 512 QAbstractSpinBox::NoButtons 10000 512 GraphicsView QGraphicsView
      pyqtgraph
      RawImageWidget QWidget
      pyqtgraph.widgets.RawImageWidget
      1
      GradientWidget QWidget
      pyqtgraph
      1
      SpinBox QDoubleSpinBox
      pyqtgraph
      pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/VideoTemplate_generic.py000066400000000000000000000266331457240071200263140ustar00rootroot00000000000000# Form implementation generated from reading ui file 'examples/VideoTemplate.ui' # # Created by: PyQt6 UI code generator 6.1.0 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. from pyqtgraph.Qt import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(695, 798) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout_2 = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout_2.setObjectName("gridLayout_2") self.cudaCheck = QtWidgets.QCheckBox(self.centralwidget) self.cudaCheck.setObjectName("cudaCheck") self.gridLayout_2.addWidget(self.cudaCheck, 9, 0, 1, 2) self.numbaCheck = QtWidgets.QCheckBox(self.centralwidget) self.numbaCheck.setObjectName("numbaCheck") self.gridLayout_2.addWidget(self.numbaCheck, 9, 2, 1, 2) self.downsampleCheck = QtWidgets.QCheckBox(self.centralwidget) self.downsampleCheck.setObjectName("downsampleCheck") self.gridLayout_2.addWidget(self.downsampleCheck, 8, 0, 1, 2) self.scaleCheck = QtWidgets.QCheckBox(self.centralwidget) self.scaleCheck.setObjectName("scaleCheck") self.gridLayout_2.addWidget(self.scaleCheck, 4, 0, 1, 1) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.rawRadio = QtWidgets.QRadioButton(self.centralwidget) self.rawRadio.setObjectName("rawRadio") self.gridLayout.addWidget(self.rawRadio, 3, 0, 1, 1) self.gfxRadio = QtWidgets.QRadioButton(self.centralwidget) self.gfxRadio.setChecked(True) self.gfxRadio.setObjectName("gfxRadio") self.gridLayout.addWidget(self.gfxRadio, 2, 0, 1, 1) self.stack = QtWidgets.QStackedWidget(self.centralwidget) self.stack.setObjectName("stack") self.page = QtWidgets.QWidget() self.page.setObjectName("page") self.gridLayout_3 = QtWidgets.QGridLayout(self.page) self.gridLayout_3.setObjectName("gridLayout_3") self.graphicsView = GraphicsView(self.page) self.graphicsView.setObjectName("graphicsView") self.gridLayout_3.addWidget(self.graphicsView, 0, 0, 1, 1) self.stack.addWidget(self.page) self.page_2 = QtWidgets.QWidget() self.page_2.setObjectName("page_2") self.gridLayout_4 = QtWidgets.QGridLayout(self.page_2) self.gridLayout_4.setObjectName("gridLayout_4") self.rawImg = RawImageWidget(self.page_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.rawImg.sizePolicy().hasHeightForWidth()) self.rawImg.setSizePolicy(sizePolicy) self.rawImg.setObjectName("rawImg") self.gridLayout_4.addWidget(self.rawImg, 0, 0, 1, 1) self.stack.addWidget(self.page_2) self.gridLayout.addWidget(self.stack, 0, 0, 1, 1) self.rawGLRadio = QtWidgets.QRadioButton(self.centralwidget) self.rawGLRadio.setObjectName("rawGLRadio") self.gridLayout.addWidget(self.rawGLRadio, 4, 0, 1, 1) self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 4) self.dtypeCombo = QtWidgets.QComboBox(self.centralwidget) self.dtypeCombo.setObjectName("dtypeCombo") self.dtypeCombo.addItem("") self.dtypeCombo.addItem("") self.dtypeCombo.addItem("") self.gridLayout_2.addWidget(self.dtypeCombo, 3, 2, 1, 1) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setObjectName("label") self.gridLayout_2.addWidget(self.label, 3, 0, 1, 1) self.rgbLevelsCheck = QtWidgets.QCheckBox(self.centralwidget) self.rgbLevelsCheck.setObjectName("rgbLevelsCheck") self.gridLayout_2.addWidget(self.rgbLevelsCheck, 4, 1, 1, 1) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.minSpin2 = SpinBox(self.centralwidget) self.minSpin2.setEnabled(False) self.minSpin2.setObjectName("minSpin2") self.horizontalLayout_2.addWidget(self.minSpin2) self.label_3 = QtWidgets.QLabel(self.centralwidget) self.label_3.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.label_3.setObjectName("label_3") self.horizontalLayout_2.addWidget(self.label_3) self.maxSpin2 = SpinBox(self.centralwidget) self.maxSpin2.setEnabled(False) self.maxSpin2.setObjectName("maxSpin2") self.horizontalLayout_2.addWidget(self.maxSpin2) self.gridLayout_2.addLayout(self.horizontalLayout_2, 5, 2, 1, 1) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.minSpin1 = SpinBox(self.centralwidget) self.minSpin1.setObjectName("minSpin1") self.horizontalLayout.addWidget(self.minSpin1) self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.label_2.setObjectName("label_2") self.horizontalLayout.addWidget(self.label_2) self.maxSpin1 = SpinBox(self.centralwidget) self.maxSpin1.setObjectName("maxSpin1") self.horizontalLayout.addWidget(self.maxSpin1) self.gridLayout_2.addLayout(self.horizontalLayout, 4, 2, 1, 1) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.minSpin3 = SpinBox(self.centralwidget) self.minSpin3.setEnabled(False) self.minSpin3.setObjectName("minSpin3") self.horizontalLayout_3.addWidget(self.minSpin3) self.label_4 = QtWidgets.QLabel(self.centralwidget) self.label_4.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.label_4.setObjectName("label_4") self.horizontalLayout_3.addWidget(self.label_4) self.maxSpin3 = SpinBox(self.centralwidget) self.maxSpin3.setEnabled(False) self.maxSpin3.setObjectName("maxSpin3") self.horizontalLayout_3.addWidget(self.maxSpin3) self.gridLayout_2.addLayout(self.horizontalLayout_3, 6, 2, 1, 1) self.lutCheck = QtWidgets.QCheckBox(self.centralwidget) self.lutCheck.setObjectName("lutCheck") self.gridLayout_2.addWidget(self.lutCheck, 7, 0, 1, 1) self.alphaCheck = QtWidgets.QCheckBox(self.centralwidget) self.alphaCheck.setObjectName("alphaCheck") self.gridLayout_2.addWidget(self.alphaCheck, 7, 1, 1, 1) self.gradient = GradientWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.gradient.sizePolicy().hasHeightForWidth()) self.gradient.setSizePolicy(sizePolicy) self.gradient.setObjectName("gradient") self.gridLayout_2.addWidget(self.gradient, 7, 2, 1, 2) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) self.gridLayout_2.addItem(spacerItem, 3, 3, 1, 1) self.fpsLabel = QtWidgets.QLabel(self.centralwidget) font = QtGui.QFont() font.setPointSize(12) self.fpsLabel.setFont(font) self.fpsLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.fpsLabel.setObjectName("fpsLabel") self.gridLayout_2.addWidget(self.fpsLabel, 0, 0, 1, 4) self.rgbCheck = QtWidgets.QCheckBox(self.centralwidget) self.rgbCheck.setObjectName("rgbCheck") self.gridLayout_2.addWidget(self.rgbCheck, 3, 1, 1, 1) self.label_5 = QtWidgets.QLabel(self.centralwidget) self.label_5.setObjectName("label_5") self.gridLayout_2.addWidget(self.label_5, 2, 0, 1, 1) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.framesSpin = QtWidgets.QSpinBox(self.centralwidget) self.framesSpin.setButtonSymbols(QtWidgets.QAbstractSpinBox.ButtonSymbols.NoButtons) self.framesSpin.setProperty("value", 10) self.framesSpin.setObjectName("framesSpin") self.horizontalLayout_4.addWidget(self.framesSpin) self.widthSpin = QtWidgets.QSpinBox(self.centralwidget) self.widthSpin.setButtonSymbols(QtWidgets.QAbstractSpinBox.ButtonSymbols.PlusMinus) self.widthSpin.setMaximum(10000) self.widthSpin.setProperty("value", 512) self.widthSpin.setObjectName("widthSpin") self.horizontalLayout_4.addWidget(self.widthSpin) self.heightSpin = QtWidgets.QSpinBox(self.centralwidget) self.heightSpin.setButtonSymbols(QtWidgets.QAbstractSpinBox.ButtonSymbols.NoButtons) self.heightSpin.setMaximum(10000) self.heightSpin.setProperty("value", 512) self.heightSpin.setObjectName("heightSpin") self.horizontalLayout_4.addWidget(self.heightSpin) self.gridLayout_2.addLayout(self.horizontalLayout_4, 2, 1, 1, 2) self.sizeLabel = QtWidgets.QLabel(self.centralwidget) self.sizeLabel.setText("") self.sizeLabel.setObjectName("sizeLabel") self.gridLayout_2.addWidget(self.sizeLabel, 2, 3, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) self.stack.setCurrentIndex(1) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.cudaCheck.setText(_translate("MainWindow", "Use CUDA (GPU) if available")) self.numbaCheck.setText(_translate("MainWindow", "Use Numba if available")) self.downsampleCheck.setText(_translate("MainWindow", "Auto downsample")) self.scaleCheck.setText(_translate("MainWindow", "Scale Data")) self.rawRadio.setText(_translate("MainWindow", "RawImageWidget")) self.gfxRadio.setText(_translate("MainWindow", "GraphicsView + ImageItem")) self.rawGLRadio.setText(_translate("MainWindow", "RawGLImageWidget")) self.dtypeCombo.setItemText(0, _translate("MainWindow", "uint8")) self.dtypeCombo.setItemText(1, _translate("MainWindow", "uint16")) self.dtypeCombo.setItemText(2, _translate("MainWindow", "float")) self.label.setText(_translate("MainWindow", "Data type")) self.rgbLevelsCheck.setText(_translate("MainWindow", "RGB")) self.label_3.setText(_translate("MainWindow", "<--->")) self.label_2.setText(_translate("MainWindow", "<--->")) self.label_4.setText(_translate("MainWindow", "<--->")) self.lutCheck.setText(_translate("MainWindow", "Use Lookup Table")) self.alphaCheck.setText(_translate("MainWindow", "alpha")) self.fpsLabel.setText(_translate("MainWindow", "FPS")) self.rgbCheck.setText(_translate("MainWindow", "RGB")) self.label_5.setText(_translate("MainWindow", "Image size")) from pyqtgraph import GradientWidget, GraphicsView, SpinBox from pyqtgraph.widgets.RawImageWidget import RawImageWidget pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ViewBox.py000066400000000000000000000047071457240071200234370ustar00rootroot00000000000000#!/usr/bin/python """ ViewBox is the general-purpose graphical container that allows the user to zoom / pan to inspect any area of a 2D coordinate system. This unimaginative example demonstrates the construction of a ViewBox-based plot area with axes, very similar to the way PlotItem is built. """ ## This example uses a ViewBox to create a PlotWidget-like interface import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtWidgets app = pg.mkQApp("ViewBox Example") mw = QtWidgets.QMainWindow() mw.setWindowTitle('pyqtgraph example: ViewBox') mw.show() mw.resize(800, 600) gv = pg.GraphicsView() mw.setCentralWidget(gv) l = QtWidgets.QGraphicsGridLayout() l.setHorizontalSpacing(0) l.setVerticalSpacing(0) vb = pg.ViewBox() p1 = pg.PlotDataItem() vb.addItem(p1) ## Just something to play with inside the ViewBox class movableRect(QtWidgets.QGraphicsRectItem): def __init__(self, *args): QtWidgets.QGraphicsRectItem.__init__(self, *args) self.setAcceptHoverEvents(True) def hoverEnterEvent(self, ev): self.savedPen = self.pen() self.setPen(pg.mkPen(255, 255, 255)) ev.ignore() def hoverLeaveEvent(self, ev): self.setPen(self.savedPen) ev.ignore() def mousePressEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.LeftButton: ev.accept() self.pressDelta = self.mapToParent(ev.pos()) - self.pos() else: ev.ignore() def mouseMoveEvent(self, ev): self.setPos(self.mapToParent(ev.pos()) - self.pressDelta) rect = movableRect(QtCore.QRectF(0, 0, 1, 1)) rect.setPen(pg.mkPen(100, 200, 100)) vb.addItem(rect) l.addItem(vb, 0, 1) gv.centralWidget.setLayout(l) xScale = pg.AxisItem(orientation='bottom', linkView=vb) l.addItem(xScale, 1, 1) yScale = pg.AxisItem(orientation='left', linkView=vb) l.addItem(yScale, 0, 0) xScale.setLabel(text="X Axis", units="s") yScale.setLabel('Y Axis', units='V') def rand(n): data = np.random.random(n) data[int(n*0.1):int(n*0.13)] += .5 data[int(n*0.18)] += 2 data[int(n*0.1):int(n*0.13)] *= 5 data[int(n*0.18)] *= 20 return data, np.arange(n, n+len(data)) / float(n) def updateData(): yd, xd = rand(10000) p1.setData(y=yd, x=xd) yd, xd = rand(10000) updateData() vb.autoRange() t = QtCore.QTimer() t.timeout.connect(updateData) t.start(50) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ViewBoxFeatures.py000066400000000000000000000041511457240071200251270ustar00rootroot00000000000000""" ViewBox is the general-purpose graphical container that allows the user to zoom / pan to inspect any area of a 2D coordinate system. This example demonstrates many of the features ViewBox provides. """ import numpy as np import pyqtgraph as pg x = np.arange(1000, dtype=float) y = np.random.normal(size=1000) y += 5 * np.sin(x/100) win = pg.GraphicsLayoutWidget(show=True) win.setWindowTitle('pyqtgraph example: ____') win.resize(1000, 800) win.ci.setBorder((50, 50, 100)) sub1 = win.addLayout() sub1.addLabel("Standard mouse interaction:
      left-drag to pan, right-drag to zoom.") sub1.nextRow() v1 = sub1.addViewBox() l1 = pg.PlotDataItem(y) v1.addItem(l1) sub2 = win.addLayout() sub2.addLabel("One-button mouse interaction:
      left-drag zoom to box, wheel to zoom out.") sub2.nextRow() v2 = sub2.addViewBox() v2.setMouseMode(v2.RectMode) l2 = pg.PlotDataItem(y) v2.addItem(l2) win.nextRow() sub3 = win.addLayout() sub3.addLabel("Locked aspect ratio when zooming.") sub3.nextRow() v3 = sub3.addViewBox() v3.setAspectLocked(1.0) l3 = pg.PlotDataItem(y) v3.addItem(l3) sub4 = win.addLayout() sub4.addLabel("View limits:
      prevent panning or zooming past limits.") sub4.nextRow() v4 = sub4.addViewBox() v4.setLimits(xMin=-100, xMax=1100, minXRange=20, maxXRange=500, yMin=-10, yMax=10, minYRange=1, maxYRange=10) l4 = pg.PlotDataItem(y) v4.addItem(l4) win.nextRow() sub5 = win.addLayout() sub5.addLabel("Linked axes: Data in this plot is always X-aligned to
      the plot above.") sub5.nextRow() v5 = sub5.addViewBox() v5.setXLink(v3) l5 = pg.PlotDataItem(y) v5.addItem(l5) sub6 = win.addLayout() sub6.addLabel("Disable mouse: Per-axis control over mouse input.
      " "Auto-scale-visible: Automatically fit *visible* data within view
      " "(try panning left-right).") sub6.nextRow() v6 = sub6.addViewBox() v6.setMouseEnabled(x=True, y=False) v6.enableAutoRange(x=False, y=True) v6.setXRange(300, 450) v6.setAutoVisible(x=False, y=True) l6 = pg.PlotDataItem(y) v6.addItem(l6) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/ViewLimits.py000066400000000000000000000003531457240071200241410ustar00rootroot00000000000000import numpy as np import pyqtgraph as pg plt = pg.plot(np.random.normal(size=100), title="View limit example") plt.centralWidget.vb.setLimits(xMin=-20, xMax=120, minXRange=5, maxXRange=100) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/__init__.py000066400000000000000000000000441457240071200236010ustar00rootroot00000000000000from .ExampleApp import main as run pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/__main__.py000066400000000000000000000001171457240071200235630ustar00rootroot00000000000000 if __name__ == '__main__': from .ExampleApp import main as run run() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/_buildParamTypes.py000066400000000000000000000065511457240071200253170ustar00rootroot00000000000000from _paramtreecfg import cfg from pyqtgraph.parametertree import Parameter from pyqtgraph.parametertree.Parameter import PARAM_TYPES from pyqtgraph.parametertree.parameterTypes import GroupParameter _encounteredTypes = {'group'} def makeChild(chType, cfgDict): _encounteredTypes.add(chType) param = Parameter.create(name='widget', type=chType) if param.hasValue(): param.setDefault(param.value()) def setOpt(_param, _val): # Treat blank strings as "None" to allow 'unsetting' that option if isinstance(_val, str) and _val == '': _val = None param.setOpts(**{_param.name(): _val}) optsChildren = [] metaChildren = [] for optName, optVals in cfgDict.items(): child = Parameter.create(name=optName, **optVals) if ' ' in optName: metaChildren.append(child) else: optsChildren.append(child) child.sigValueChanged.connect(setOpt) # Populate initial options for p in optsChildren: setOpt(p, p.value() if p.hasValue() else None) grp = Parameter.create( name=f'Sample {chType.title()}', type='group', children=metaChildren + [param] + optsChildren ) grp.setOpts(expanded=False) return grp def makeMetaChild(name, cfgDict): children = [] for chName, chOpts in cfgDict.items(): if not isinstance(chOpts, dict): ch = Parameter.create(name=chName, type=chName, value=chOpts) else: ch = Parameter.create(name=chName, **chOpts) _encounteredTypes.add(ch.type()) children.append(ch) param = Parameter.create(name=name, type='group', children=children) param.setOpts(expanded=False) return param def makeAllParamTypes(): children = [] for name, paramCfg in cfg.items(): if ' ' in name: children.append(makeMetaChild(name, paramCfg)) else: children.append(makeChild(name, paramCfg)) params = Parameter.create(name='Example Parameters', type='group', children=children) # Slider needs minor tweak sliderGrp = params.child('Sample Slider') slider = sliderGrp.child('widget') slider.setOpts(limits=[0, 100]) # Also minor tweak to meta opts def setOpt(_param, _val): infoChild.setOpts(**{_param.name(): _val}) meta = params.child('Applies to All Types') infoChild = meta.child('Extra Information') for child in meta.children()[1:]: child.sigValueChanged.connect(setOpt) def onChange(_param, _val): if _val == 'Use span': span = slider.opts.pop('span', None) slider.setOpts(span=span) else: limits = slider.opts.pop('limits', None) slider.setOpts(limits=limits) sliderGrp.child('How to Set').sigValueChanged.connect(onChange) def activate(action): for ch in params: if isinstance(ch, GroupParameter): ch.setOpts(expanded=action.name() == 'Expand All') for name in 'Collapse', 'Expand': btn = Parameter.create(name=f'{name} All', type='action') btn.sigActivated.connect(activate) params.insertChild(0, btn) missing = [ typ for typ in set(PARAM_TYPES).difference(_encounteredTypes) if not typ.startswith("_") ] if missing: raise RuntimeError(f'{missing} parameters are not represented') return params pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/_paramtreecfg.py000066400000000000000000000120501457240071200246410ustar00rootroot00000000000000import numpy as np from pyqtgraph.parametertree.parameterTypes import QtEnumParameter as enum from pyqtgraph.Qt import QtWidgets dlg = QtWidgets.QFileDialog cfg = { 'list': { 'limits': { 'type': 'checklist', 'limits': ['a', 'b', 'c'] } }, 'file': { 'acceptMode': { 'type': 'list', 'limits': list(enum(dlg.AcceptMode, dlg).enumMap) }, 'fileMode': { 'type': 'list', 'limits': list(enum(dlg.FileMode, dlg).enumMap) }, 'viewMode': { 'type': 'list', 'limits': list(enum(dlg.ViewMode, dlg).enumMap) }, 'dialogLabel': { 'type': 'list', 'limits': list(enum(dlg.DialogLabel, dlg).enumMap) }, 'relativeTo': { 'type': 'str', 'value': None }, 'directory': { 'type': 'str', 'value': None }, 'windowTitle': { 'type': 'str', 'value': None }, 'nameFilter': { 'type': 'str', 'value': None } }, 'float': { 'Float Information': { 'type': 'str', 'readonly': True, 'value': 'Note that all options except "finite" also apply to "int" parameters', }, 'step': { 'type': 'float', 'limits': [0, None], 'value': 1, }, 'limits': { 'type': 'list', 'limits': {'[0, None]': [0, None], '[1, 5]': [1, 5]}, }, 'suffix': { 'type': 'list', 'limits': ['Hz', 's', 'm'], }, 'siPrefix': { 'type': 'bool', 'value': True }, 'finite': { 'type': 'bool', 'value': True, }, 'dec': { 'type': 'bool', 'value': False, }, 'minStep': { 'type': 'float', 'value': 1.0e-12, }, }, 'checklist': { 'limits': { 'type': 'checklist', 'limits': ['one', 'two', 'three', 'four'], }, 'exclusive': { 'type': 'bool', 'value': False, }, 'delay': { 'type': 'float', 'value': 1.0, 'limits': [0, None] } }, 'pen': { 'Pen Information': { 'type': 'str', 'value': 'Click the button to see options', 'readonly': True, }, }, 'slider': { 'step': { 'type': 'float', 'limits': [0, None], 'value': 1, }, 'format': { 'type': 'str', 'value': '{0:>3}', }, 'precision': { 'type': 'int', 'value': 2, 'limits': [1, None], }, 'span': { 'type': 'list', 'limits': {'linspace(-pi, pi)': np.linspace(-np.pi, np.pi), 'arange(10)**2': np.arange(10) ** 2}, }, 'How to Set': { 'type': 'list', 'limits': ['Use span', 'Use step + limits'], } }, 'action': { 'shortcut': { 'type': 'str', 'value': "Ctrl+Shift+P", }, 'icon': { 'type': 'file', 'value': None, 'nameFilter': "Images (*.png *.jpg *.bmp *.jpeg *.svg)", }, }, 'calendar': { 'format': { 'type': 'str', 'value': 'MM DD', } }, 'Applies to All Types': { 'Extra Information': { 'type': 'text', 'value': 'These apply to all parameters. Watch how this text box is altered by any setting you change.', 'default': 'These apply to all parameters. Watch how this text box is altered by any setting you change.', 'readonly': True, }, 'readonly': { 'type': 'bool', 'value': True, }, 'removable': { 'type': 'bool', 'tip': 'Adds a context menu option to remove this parameter', 'value': False, }, 'visible': { 'type': 'bool', 'value': True, }, 'disabled': { 'type': 'bool', 'value': False, }, 'title': { 'type': 'str', 'value': 'Meta Options', }, 'default': { 'tip': 'The default value that gets set when clicking the arrow in the right column', 'type': 'str', }, 'expanded': { 'type': 'bool', 'value': True, }, }, 'No Extra Options': { 'text': 'Unlike the other parameters shown, these don\'t have extra settable options.\n' \ + 'Note: "int" *does* have the same options as float, mentioned above', 'int': 10, 'str': 'Hi, world!', 'color': '#fff', 'bool': False, 'colormap': None, 'cmaplut' : 'viridis', 'progress': 50, 'font': 'Inter', } } pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/beeswarm.py000066400000000000000000000014311457240071200236500ustar00rootroot00000000000000""" Example beeswarm / bar chart """ import numpy as np import pyqtgraph as pg win = pg.plot() win.setWindowTitle('pyqtgraph example: beeswarm') data = np.random.normal(size=(4,20)) data[0] += 5 data[1] += 7 data[2] += 5 data[3] = 10 + data[3] * 2 ## Make bar graph #bar = pg.BarGraphItem(x=range(4), height=data.mean(axis=1), width=0.5, brush=0.4) #win.addItem(bar) ## add scatter plots on top for i in range(4): xvals = pg.pseudoScatter(data[i], spacing=0.4, bidir=True) * 0.2 win.plot(x=xvals+i, y=data[i], pen=None, symbol='o', symbolBrush=pg.intColor(i,6,maxValue=128)) ## Make error bars err = pg.ErrorBarItem(x=np.arange(4), y=data.mean(axis=1), height=data.std(axis=1), beam=0.5, pen={'color':'w', 'width':2}) win.addItem(err) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/colorMaps.py000066400000000000000000000040051457240071200240020ustar00rootroot00000000000000""" This example displays all color maps currently available, either as local data or imported from Matplotlib of ColorCET. """ import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtWidgets app = pg.mkQApp() win = QtWidgets.QMainWindow() win.resize(1000,800) lw = pg.GraphicsLayoutWidget() lw.setFixedWidth(1000) lw.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) scr = QtWidgets.QScrollArea() scr.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOn) scr.setWidget(lw) win.setCentralWidget(scr) win.setWindowTitle('pyqtgraph example: Color maps') win.show() bar_width = 32 bar_data = pg.colormap.modulatedBarData(width=bar_width) num_bars = 0 def add_heading(lw, name): global num_bars lw.addLabel('=== '+name+' ===') num_bars += 1 lw.nextRow() def add_bar(lw, name, cm): global num_bars lw.addLabel(name) imi = pg.ImageItem( bar_data ) imi.setLookupTable( cm.getLookupTable(alpha=True) ) vb = lw.addViewBox(lockAspect=True, enableMouse=False) vb.addItem( imi ) num_bars += 1 lw.nextRow() add_heading(lw, 'local color maps') list_of_maps = pg.colormap.listMaps() list_of_maps = sorted( list_of_maps, key=lambda x: x.swapcase() ) for map_name in list_of_maps: cm = pg.colormap.get(map_name) add_bar(lw, map_name, cm) add_heading(lw, 'Matplotlib import') list_of_maps = pg.colormap.listMaps('matplotlib') list_of_maps = sorted( list_of_maps, key=lambda x: x.lower() ) for map_name in list_of_maps: cm = pg.colormap.get(map_name, source='matplotlib', skipCache=True) if cm is not None: add_bar(lw, map_name, cm) add_heading(lw, 'ColorCET import') list_of_maps = pg.colormap.listMaps('colorcet') list_of_maps = sorted( list_of_maps, key=lambda x: x.lower() ) for map_name in list_of_maps: cm = pg.colormap.get(map_name, source='colorcet', skipCache=True) if cm is not None: add_bar(lw, map_name, cm) lw.setFixedHeight(num_bars * (bar_width+5) ) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/colorMapsLinearized.py000066400000000000000000000060741457240071200260210ustar00rootroot00000000000000""" This example demonstrates linearized ColorMap objects using colormap.makeMonochrome() or using the `ColorMap`'s `linearize()` method. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui, QtWidgets name_list = ( 'warm','neutral','cool', 'green','amber','blue','red','pink','lavender', (0.5, 0.2, 0.1, 0.8) ) ramp_list = [ pg.colormap.makeMonochrome(name) for name in name_list ] cm_list = [] # Create a gray ramp for demonstrating the idea: cm = pg.ColorMap( None, [ QtGui.QColor( 0, 0, 0), QtGui.QColor( 10, 10, 10), QtGui.QColor(127, 127, 127), QtGui.QColor(240, 240, 240), QtGui.QColor(255, 255, 255) ]) cm_list.append(('Distorted gray ramp',cm)) # Create a rainbow scale in HSL color space: length = 41 col_list = [] for idx in range(length): frac = idx/(length-1) qcol = QtGui.QColor() qcol.setHslF( (2*frac-0.15)%1.0, 0.8, 0.5-0.5*np.cos(np.pi*frac) ) col_list.append(qcol) cm = pg.ColorMap( None, col_list ) cm_list.append( ('Distorted HSL spiral', cm) ) # Create some random examples: for example_idx in range(3): previous = None col_list = [] for idx in range(8): values = np.random.random((3)) if previous is not None: intermediate = (values + previous) / 2 qcol = QtGui.QColor() qcol.setRgbF( *intermediate ) col_list.append( qcol) qcol1 = QtGui.QColor() qcol1.setRgbF( *values ) col_list.append( qcol1) previous = values cm = pg.ColorMap( None, col_list ) cm_list.append( (f'random {example_idx+1}', cm) ) app = pg.mkQApp() win = QtWidgets.QMainWindow() win.resize(1000,800) lw = pg.GraphicsLayoutWidget() lw.setFixedWidth(1000) lw.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) scr = QtWidgets.QScrollArea() scr.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOn) scr.setWidget(lw) win.setCentralWidget(scr) win.setWindowTitle('pyqtgraph example: Linearized color maps') win.show() bar_width = 32 bar_data = pg.colormap.modulatedBarData(width=bar_width) num_bars = 0 def add_heading(lw, name): global num_bars lw.addLabel('=== '+name+' ===') num_bars += 1 lw.nextRow() def add_bar(lw, name, cm): global num_bars lw.addLabel(name) imi = pg.ImageItem( bar_data ) imi.setLookupTable( cm.getLookupTable(alpha=True) ) vb = lw.addViewBox(lockAspect=True, enableMouse=False) vb.addItem( imi ) num_bars += 1 lw.nextRow() add_heading(lw, 'ramp generator') for cm in ramp_list: add_bar(lw, cm.name, cm) add_heading(lw, 'linearizer demonstration') for (name, cm) in cm_list: add_bar(lw, name, cm) cm.linearize() add_bar(lw, '> linearized', cm) add_heading(lw, 'consistency with included maps') for name in ('CET-C3', 'CET-L17', 'CET-L2'): # lw.addLabel(str(name)) cm = pg.colormap.get(name) add_bar(lw, name, cm) cm.linearize() add_bar(lw, '> linearized', cm) lw.setFixedHeight(num_bars * (bar_width+5) ) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/console_exception_inspection.py000066400000000000000000000126211457240071200300210ustar00rootroot00000000000000""" Using ConsoleWidget to interactively inspect exception backtraces TODO - fix uncaught exceptions in threads (python 3.12) - allow using qtconsole - provide thread info for stacks - add thread browser? - add object browser? - clicking on a stack frame populates list of locals? - optional merged exception stacks """ import sys import queue import functools import threading import pyqtgraph as pg import pyqtgraph.console from pyqtgraph.Qt import QtWidgets from pyqtgraph.debug import threadName def raiseException(): """Raise an exception """ x = "inside raiseException()" raise Exception(f"Raised an exception {x} in {threadName()}") def raiseNested(): """Raise an exception while handling another """ x = "inside raiseNested()" try: raiseException() except Exception: raise Exception(f"Raised during exception handling {x} in {threadName()}") def raiseFrom(): """Raise an exception from another """ x = "inside raiseFrom()" try: raiseException() except Exception as exc: raise Exception(f"Raised-from during exception handling {x} in {threadName()}") from exc def raiseCaughtException(): """Raise and catch an exception """ x = "inside raiseCaughtException()" try: raise Exception(f"Raised an exception {x} in {threadName()}") except Exception: print(f"Raised and caught exception {x} in {threadName()} trace: {sys._getframe().f_trace}") def captureStack(): """Inspect the curent call stack """ x = "inside captureStack()" global console console.setStack() return x # Background thread for running functions threadRunQueue = queue.Queue() def threadRunner(): global threadRunQueue # This is necessary to allow installing trace functions in the thread later on sys.settrace(lambda *args: None) while True: func, args = threadRunQueue.get() try: print(f"running {func} from thread, trace: {sys._getframe().f_trace}") func(*args) except Exception: sys.excepthook(*sys.exc_info()) thread = threading.Thread(target=threadRunner, name="background_thread", daemon=True) thread.start() # functions used to generate a stack a few items deep def runInStack(func): x = "inside runInStack(func)" runInStack2(func) return x def runInStack2(func): x = "inside runInStack2(func)" runInStack3(func) return x def runInStack3(func): x = "inside runInStack3(func)" runInStack4(func) return x def runInStack4(func): x = "inside runInStack4(func)" func() return x class SignalEmitter(pg.QtCore.QObject): signal = pg.QtCore.Signal(object, object) def __init__(self, queued): pg.QtCore.QObject.__init__(self) if queued: self.signal.connect(self.run, pg.QtCore.Qt.ConnectionType.QueuedConnection) else: self.signal.connect(self.run) def run(self, func, args): func(*args) signalEmitter = SignalEmitter(queued=False) queuedSignalEmitter = SignalEmitter(queued=True) def runFunc(func): if signalCheck.isChecked(): if queuedSignalCheck.isChecked(): func = functools.partial(queuedSignalEmitter.signal.emit, runInStack, (func,)) else: func = functools.partial(signalEmitter.signal.emit, runInStack, (func,)) if threadCheck.isChecked(): threadRunQueue.put((runInStack, (func,))) else: runInStack(func) funcs = [ raiseException, raiseNested, raiseFrom, raiseCaughtException, captureStack, ] app = pg.mkQApp() win = pg.QtWidgets.QSplitter(pg.QtCore.Qt.Orientation.Horizontal) ctrl = QtWidgets.QWidget() ctrlLayout = QtWidgets.QVBoxLayout() ctrl.setLayout(ctrlLayout) win.addWidget(ctrl) btns = [] for func in funcs: btn = QtWidgets.QPushButton(func.__doc__) btn.clicked.connect(functools.partial(runFunc, func)) btns.append(btn) ctrlLayout.addWidget(btn) threadCheck = QtWidgets.QCheckBox('Run in thread') ctrlLayout.addWidget(threadCheck) signalCheck = QtWidgets.QCheckBox('Run from Qt signal') ctrlLayout.addWidget(signalCheck) queuedSignalCheck = QtWidgets.QCheckBox('Use queued Qt signal') ctrlLayout.addWidget(queuedSignalCheck) ctrlLayout.addStretch() console = pyqtgraph.console.ConsoleWidget(text=""" Use ConsoleWidget to interactively inspect exception tracebacks and call stacks! - Enable "Show next exception" and the next unhandled exception will be displayed below. - Click any of the buttons to the left to generate an exception. - When an exception traceback is shown, you can select any of the stack frames and then run commands from that context, allowing you to inspect variables along the stack. (hint: most of the functions called by the buttons to the left have a variable named "x" in their local scope) - Note that this is not like a typical debugger--the program is not paused when an exception is caught; we simply keep a reference to the stack frames and continue on. - By default, we only catch unhandled exceptions. If you need to inspect a handled exception (one that is caught by a try:except block), then uncheck the "Only handled exceptions" box. Note, however that this incurs a performance penalty and will interfere with other debuggers. """) console.catchNextException() win.addWidget(console) win.resize(1400, 800) win.setSizes([300, 1100]) win.show() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/contextMenu.py000066400000000000000000000102231457240071200243530ustar00rootroot00000000000000""" Demonstrates adding a custom context menu to a GraphicsItem and extending the context menu of a ViewBox. PyQtGraph implements a system that allows each item in a scene to implement its own context menu, and for the menus of its parent items to be automatically displayed as well. """ import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui, QtWidgets win = pg.GraphicsLayoutWidget(show=True) win.setWindowTitle('pyqtgraph example: context menu') view = win.addViewBox() # add two new actions to the ViewBox context menu: zoom1 = view.menu.addAction('Zoom to box 1') zoom2 = view.menu.addAction('Zoom to box 2') # define callbacks for these actions def zoomTo1(): # note that box1 is defined below view.autoRange(items=[box1]) zoom1.triggered.connect(zoomTo1) def zoomTo2(): # note that box1 is defined below view.autoRange(items=[box2]) zoom2.triggered.connect(zoomTo2) class MenuBox(pg.GraphicsObject): """ This class draws a rectangular area. Right-clicking inside the area will raise a custom context menu which also includes the context menus of its parents. """ def __init__(self, name): self.name = name self.pen = pg.mkPen('r') # menu creation is deferred because it is expensive and often # the user will never see the menu anyway. self.menu = None # note that the use of super() is often avoided because Qt does not # allow to inherit from multiple QObject subclasses. pg.GraphicsObject.__init__(self) # All graphics items must have paint() and boundingRect() defined. def boundingRect(self): return QtCore.QRectF(0, 0, 10, 10) def paint(self, p, *args): p.setPen(self.pen) p.drawRect(self.boundingRect()) # On right-click, raise the context menu def mouseClickEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.RightButton: if self.raiseContextMenu(ev): ev.accept() def raiseContextMenu(self, ev): menu = self.getContextMenus() # Let the scene add on to the end of our context menu # (this is optional) menu = self.scene().addParentContextMenus(self, menu, ev) pos = ev.screenPos() menu.popup(QtCore.QPoint(int(pos.x()), int(pos.y()))) return True # This method will be called when this item's _children_ want to raise # a context menu that includes their parents' menus. def getContextMenus(self, event=None): if self.menu is None: self.menu = QtWidgets.QMenu() self.menu.setTitle(self.name+ " options..") green = QtGui.QAction("Turn green", self.menu) green.triggered.connect(self.setGreen) self.menu.addAction(green) self.menu.green = green blue = QtGui.QAction("Turn blue", self.menu) blue.triggered.connect(self.setBlue) self.menu.addAction(blue) self.menu.green = blue alpha = QtWidgets.QWidgetAction(self.menu) alphaSlider = QtWidgets.QSlider() alphaSlider.setOrientation(QtCore.Qt.Orientation.Horizontal) alphaSlider.setMaximum(255) alphaSlider.setValue(255) alphaSlider.valueChanged.connect(self.setAlpha) alpha.setDefaultWidget(alphaSlider) self.menu.addAction(alpha) self.menu.alpha = alpha self.menu.alphaSlider = alphaSlider return self.menu # Define context menu callbacks def setGreen(self): self.pen = pg.mkPen('g') # inform Qt that this item must be redrawn. self.update() def setBlue(self): self.pen = pg.mkPen('b') self.update() def setAlpha(self, a): self.setOpacity(a/255.) # This box's context menu will include the ViewBox's menu box1 = MenuBox("Menu Box #1") view.addItem(box1) # This box's context menu will include both the ViewBox's menu and box1's menu box2 = MenuBox("Menu Box #2") box2.setParentItem(box1) box2.setPos(5, 5) box2.setScale(0.2) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/crosshair.py000066400000000000000000000045461457240071200240520ustar00rootroot00000000000000""" Demonstrates some customized mouse interaction by drawing a crosshair that follows the mouse. """ import numpy as np import pyqtgraph as pg #generate layout app = pg.mkQApp("Crosshair Example") win = pg.GraphicsLayoutWidget(show=True) win.setWindowTitle('pyqtgraph example: crosshair') label = pg.LabelItem(justify='right') win.addItem(label) p1 = win.addPlot(row=1, col=0) # customize the averaged curve that can be activated from the context menu: p1.avgPen = pg.mkPen('#FFFFFF') p1.avgShadowPen = pg.mkPen('#8080DD', width=10) p2 = win.addPlot(row=2, col=0) region = pg.LinearRegionItem() region.setZValue(10) # Add the LinearRegionItem to the ViewBox, but tell the ViewBox to exclude this # item when doing auto-range calculations. p2.addItem(region, ignoreBounds=True) #pg.dbg() p1.setAutoVisible(y=True) #create numpy arrays #make the numbers large to show that the range shows data from 10000 to all the way 0 data1 = 10000 + 15000 * pg.gaussianFilter(np.random.random(size=10000), 10) + 3000 * np.random.random(size=10000) data2 = 15000 + 15000 * pg.gaussianFilter(np.random.random(size=10000), 10) + 3000 * np.random.random(size=10000) p1.plot(data1, pen="r") p1.plot(data2, pen="g") p2d = p2.plot(data1, pen="w") # bound the LinearRegionItem to the plotted data region.setClipItem(p2d) def update(): region.setZValue(10) minX, maxX = region.getRegion() p1.setXRange(minX, maxX, padding=0) region.sigRegionChanged.connect(update) def updateRegion(window, viewRange): rgn = viewRange[0] region.setRegion(rgn) p1.sigRangeChanged.connect(updateRegion) region.setRegion([1000, 2000]) #cross hair vLine = pg.InfiniteLine(angle=90, movable=False) hLine = pg.InfiniteLine(angle=0, movable=False) p1.addItem(vLine, ignoreBounds=True) p1.addItem(hLine, ignoreBounds=True) vb = p1.vb def mouseMoved(evt): pos = evt if p1.sceneBoundingRect().contains(pos): mousePoint = vb.mapSceneToView(pos) index = int(mousePoint.x()) if index > 0 and index < len(data1): label.setText("x=%0.1f, y1=%0.1f, y2=%0.1f" % (mousePoint.x(), data1[index], data2[index])) vLine.setPos(mousePoint.x()) hLine.setPos(mousePoint.y()) p1.scene().sigMouseMoved.connect(mouseMoved) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/customGraphicsItem.py000066400000000000000000000036421457240071200256630ustar00rootroot00000000000000""" Demonstrate creation of a custom graphic (a candlestick plot) """ import pyqtgraph as pg from pyqtgraph import QtCore, QtGui ## Create a subclass of GraphicsObject. ## The only required methods are paint() and boundingRect() ## (see QGraphicsItem documentation) class CandlestickItem(pg.GraphicsObject): def __init__(self, data): pg.GraphicsObject.__init__(self) self.data = data ## data must have fields: time, open, close, min, max self.generatePicture() def generatePicture(self): ## pre-computing a QPicture object allows paint() to run much more quickly, ## rather than re-drawing the shapes every time. self.picture = QtGui.QPicture() p = QtGui.QPainter(self.picture) p.setPen(pg.mkPen('w')) w = (self.data[1][0] - self.data[0][0]) / 3. for (t, open, close, min, max) in self.data: p.drawLine(QtCore.QPointF(t, min), QtCore.QPointF(t, max)) if open > close: p.setBrush(pg.mkBrush('r')) else: p.setBrush(pg.mkBrush('g')) p.drawRect(QtCore.QRectF(t-w, open, w*2, close-open)) p.end() def paint(self, p, *args): p.drawPicture(0, 0, self.picture) def boundingRect(self): ## boundingRect _must_ indicate the entire area that will be drawn on ## or else we will get artifacts and possibly crashing. ## (in this case, QPicture does all the work of computing the bouning rect for us) return QtCore.QRectF(self.picture.boundingRect()) data = [ ## fields are (time, open, close, min, max). (1., 10, 13, 5, 15), (2., 13, 17, 9, 20), (3., 17, 14, 11, 23), (4., 14, 15, 5, 19), (5., 15, 9, 8, 22), (6., 9, 15, 8, 16), ] item = CandlestickItem(data) plt = pg.plot() plt.addItem(item) plt.setWindowTitle('pyqtgraph example: customGraphicsItem') if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/customPlot.py000066400000000000000000000056311457240071200242220ustar00rootroot00000000000000""" This example demonstrates the creation of a plot with DateAxisItem and a customized ViewBox. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore class CustomViewBox(pg.ViewBox): def __init__(self, *args, **kwds): kwds['enableMenu'] = False pg.ViewBox.__init__(self, *args, **kwds) self.setMouseMode(self.RectMode) ## reimplement right-click to zoom out def mouseClickEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.RightButton: self.autoRange() ## reimplement mouseDragEvent to disable continuous axis zoom def mouseDragEvent(self, ev, axis=None): if axis is not None and ev.button() == QtCore.Qt.MouseButton.RightButton: ev.ignore() else: pg.ViewBox.mouseDragEvent(self, ev, axis=axis) class CustomTickSliderItem(pg.TickSliderItem): def __init__(self, *args, **kwds): pg.TickSliderItem.__init__(self, *args, **kwds) self.all_ticks = {} self._range = [0,1] def setTicks(self, ticks): for tick, pos in self.listTicks(): self.removeTick(tick) for pos in ticks: tickItem = self.addTick(pos, movable=False, color="#333333") self.all_ticks[pos] = tickItem self.updateRange(None, self._range) def updateRange(self, vb, viewRange): origin = self.tickSize/2. length = self.length lengthIncludingPadding = length + self.tickSize + 2 self._range = viewRange for pos in self.all_ticks: tickValueIncludingPadding = (pos - viewRange[0]) / (viewRange[1] - viewRange[0]) tickValue = (tickValueIncludingPadding*lengthIncludingPadding - origin) / length # Convert from np.bool_ to bool for setVisible visible = bool(tickValue >= 0 and tickValue <= 1) tick = self.all_ticks[pos] tick.setVisible(visible) if visible: self.setTickValue(tick, tickValue) app = pg.mkQApp() axis = pg.DateAxisItem(orientation='bottom') vb = CustomViewBox() pw = pg.PlotWidget(viewBox=vb, axisItems={'bottom': axis}, enableMenu=False, title="PlotItem with DateAxisItem, custom ViewBox and markers on x axis
      Menu disabled, mouse behavior changed: left-drag to zoom, right-click to reset zoom") dates = np.arange(8) * (3600*24*356) pw.plot(x=dates, y=[1,6,2,4,3,5,6,8], symbol='o') # Using allowAdd and allowRemove to limit user interaction tickViewer = CustomTickSliderItem(allowAdd=False, allowRemove=False) vb.sigXRangeChanged.connect(tickViewer.updateRange) pw.plotItem.layout.addItem(tickViewer, 4, 1) tickViewer.setTicks( [dates[0], dates[2], dates[-1]] ) pw.show() pw.setWindowTitle('pyqtgraph example: customPlot') r = pg.PolyLineROI([(0,0), (10, 10)]) pw.addItem(r) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/cx_freeze/000077500000000000000000000000001457240071200234445ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/cx_freeze/plotTest.py000066400000000000000000000011451457240071200256350ustar00rootroot00000000000000import sys import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets # For packages that require scipy, these may be needed: # from scipy.stats import futil # from scipy.sparse.csgraph import _validation pg.setConfigOption('background','w') pg.setConfigOption('foreground','k') app = QtWidgets.QApplication(sys.argv) pw = pg.plot(x = [0, 1, 2, 4], y = [4, 5, 9, 6]) pw.showGrid(x=True,y=True) text = pg.TextItem(html='
      %s
      ' % "here",anchor=(0.0, 0.0)) text.setPos(1.0, 5.0) pw.addItem(text) status = app.exec_() sys.exit(status) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/cx_freeze/setup.py000066400000000000000000000027041457240071200251610ustar00rootroot00000000000000# Build with `python setup.py build_exe` import shutil from pathlib import Path from cx_Freeze import Executable, setup # Remove the build folder shutil.rmtree("build", ignore_errors=True) shutil.rmtree("dist", ignore_errors=True) import sys includes = ['pyqtgraph.graphicsItems', 'numpy', 'atexit'] excludes = ['cvxopt','_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl','tables', 'Tkconstants', 'Tkinter', 'zmq','PySide','pysideuic','scipy','matplotlib'] # Workaround for making sure the templates are included in the frozen app package include_files = [] import pyqtgraph pg_folder = Path(pyqtgraph.__file__).parent templates = pg_folder.rglob('*template*.py') sources = [str(w) for w in templates] destinations = ['lib' + w.replace(str(pg_folder.parent), '') for w in sources] for a in zip(sources, destinations): include_files.append(a) print(include_files) if sys.version[0] == '2': # causes syntax error on py2 excludes.append('PyQt4.uic.port_v3') base = None if sys.platform == "win32": base = "Win32GUI" build_exe_options = {'excludes': excludes, 'includes':includes, 'include_msvcr':True, 'optimize':1, "include_files": include_files,} setup(name = "cx_freeze plot test", version = "0.2", description = "cx_freeze plot test", options = {"build_exe": build_exe_options}, executables = [Executable("plotTest.py", base=base)]) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/designerExample.py000066400000000000000000000021421457240071200251570ustar00rootroot00000000000000""" Simple example of loading UI template created with Qt Designer. This example uses uic.loadUiType to parse and load the ui at runtime. It is also possible to pre-compile the .ui file using pyuic (see VideoSpeedTest and ScatterPlotSpeedTest examples; these .ui files have been compiled with the tools/rebuildUi.py script). """ import os import numpy as np import pyqtgraph as pg pg.mkQApp() ## Define main window class from template path = os.path.dirname(os.path.abspath(__file__)) uiFile = os.path.join(path, 'designerExample.ui') WindowTemplate, TemplateBaseClass = pg.Qt.loadUiType(uiFile) class MainWindow(TemplateBaseClass): def __init__(self): TemplateBaseClass.__init__(self) self.setWindowTitle('pyqtgraph example: Qt Designer') # Create the main window self.ui = WindowTemplate() self.ui.setupUi(self) self.ui.plotBtn.clicked.connect(self.plot) self.show() def plot(self): self.ui.plot.plot(np.random.normal(size=100), clear=True) win = MainWindow() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/designerExample.ui000066400000000000000000000015411457240071200251460ustar00rootroot00000000000000 Form 0 0 400 300 PyQtGraph Plot! PlotWidget QGraphicsView
      pyqtgraph
      pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/dockarea.py000066400000000000000000000074671457240071200236330ustar00rootroot00000000000000""" This example demonstrates the use of pyqtgraph's dock widget system. The dockarea system allows the design of user interfaces which can be rearranged by the user at runtime. Docks can be moved, resized, stacked, and torn out of the main window. This is similar in principle to the docking system built into Qt, but offers a more deterministic dock placement API (in Qt it is very difficult to programatically generate complex dock arrangements). Additionally, Qt's docks are designed to be used as small panels around the outer edge of a window. Pyqtgraph's docks were created with the notion that the entire window (or any portion of it) would consist of dockable components. """ import numpy as np import pyqtgraph as pg from pyqtgraph.console import ConsoleWidget from pyqtgraph.dockarea.Dock import Dock from pyqtgraph.dockarea.DockArea import DockArea from pyqtgraph.Qt import QtWidgets app = pg.mkQApp("DockArea Example") win = QtWidgets.QMainWindow() area = DockArea() win.setCentralWidget(area) win.resize(1000,500) win.setWindowTitle('pyqtgraph example: dockarea') ## Create docks, place them into the window one at a time. ## Note that size arguments are only a suggestion; docks will still have to ## fill the entire dock area and obey the limits of their internal widgets. d1 = Dock("Dock1", size=(1, 1)) ## give this dock the minimum possible size d2 = Dock("Dock2 - Console", size=(500,300), closable=True) d3 = Dock("Dock3", size=(500,400)) d4 = Dock("Dock4 (tabbed) - Plot", size=(500,200)) d5 = Dock("Dock5 - Image", size=(500,200)) d6 = Dock("Dock6 (tabbed) - Plot", size=(500,200)) area.addDock(d1, 'left') ## place d1 at left edge of dock area (it will fill the whole space since there are no other docks yet) area.addDock(d2, 'right') ## place d2 at right edge of dock area area.addDock(d3, 'bottom', d1)## place d3 at bottom edge of d1 area.addDock(d4, 'right') ## place d4 at right edge of dock area area.addDock(d5, 'left', d1) ## place d5 at left edge of d1 area.addDock(d6, 'top', d4) ## place d5 at top edge of d4 ## Test ability to move docks programatically after they have been placed area.moveDock(d4, 'top', d2) ## move d4 to top edge of d2 area.moveDock(d6, 'above', d4) ## move d6 to stack on top of d4 area.moveDock(d5, 'top', d2) ## move d5 to top edge of d2 ## Add widgets into each dock ## first dock gets save/restore buttons w1 = pg.LayoutWidget() label = QtWidgets.QLabel(""" -- DockArea Example -- This window has 6 Dock widgets in it. Each dock can be dragged by its title bar to occupy a different space within the window but note that one dock has its title bar hidden). Additionally, the borders between docks may be dragged to resize. Docks that are dragged on top of one another are stacked in a tabbed layout. Double-click a dock title bar to place it in its own window. """) saveBtn = QtWidgets.QPushButton('Save dock state') restoreBtn = QtWidgets.QPushButton('Restore dock state') restoreBtn.setEnabled(False) w1.addWidget(label, row=0, col=0) w1.addWidget(saveBtn, row=1, col=0) w1.addWidget(restoreBtn, row=2, col=0) d1.addWidget(w1) state = None def save(): global state state = area.saveState() restoreBtn.setEnabled(True) def load(): global state area.restoreState(state) saveBtn.clicked.connect(save) restoreBtn.clicked.connect(load) w2 = ConsoleWidget() d2.addWidget(w2) ## Hide title bar on dock 3 d3.hideTitleBar() w3 = pg.PlotWidget(title="Plot inside dock with no title bar") w3.plot(np.random.normal(size=100)) d3.addWidget(w3) w4 = pg.PlotWidget(title="Dock 4 plot") w4.plot(np.random.normal(size=100)) d4.addWidget(w4) w5 = pg.ImageView() w5.setImage(np.random.normal(size=(100,100))) d5.addWidget(w5) w6 = pg.PlotWidget(title="Dock 6 plot") w6.plot(np.random.normal(size=100)) d6.addWidget(w6) win.show() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/exampleLoaderTemplate.ui000066400000000000000000000057251457240071200263200ustar00rootroot00000000000000 Form 0 0 846 552 PyQtGraph Qt::Horizontal Run Example false 1 Qt Library: Type to filter... Title Search Content Search true Qt::AlignCenter Courier New pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/exampleLoaderTemplate_generic.py000066400000000000000000000075571457240071200300340ustar00rootroot00000000000000# Form implementation generated from reading ui file '../pyqtgraph/examples/exampleLoaderTemplate.ui' # # Created by: PyQt6 UI code generator 6.2.2 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. from pyqtgraph.Qt import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(846, 552) self.gridLayout_2 = QtWidgets.QGridLayout(Form) self.gridLayout_2.setObjectName("gridLayout_2") self.splitter = QtWidgets.QSplitter(Form) self.splitter.setOrientation(QtCore.Qt.Orientation.Horizontal) self.splitter.setObjectName("splitter") self.layoutWidget = QtWidgets.QWidget(self.splitter) self.layoutWidget.setObjectName("layoutWidget") self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.qtLibCombo = QtWidgets.QComboBox(self.layoutWidget) self.qtLibCombo.setObjectName("qtLibCombo") self.gridLayout.addWidget(self.qtLibCombo, 4, 1, 1, 1) self.loadBtn = QtWidgets.QPushButton(self.layoutWidget) self.loadBtn.setObjectName("loadBtn") self.gridLayout.addWidget(self.loadBtn, 6, 1, 1, 1) self.exampleTree = QtWidgets.QTreeWidget(self.layoutWidget) self.exampleTree.setObjectName("exampleTree") self.exampleTree.headerItem().setText(0, "1") self.exampleTree.header().setVisible(False) self.gridLayout.addWidget(self.exampleTree, 3, 0, 1, 2) self.label = QtWidgets.QLabel(self.layoutWidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 4, 0, 1, 1) self.exampleFilter = QtWidgets.QLineEdit(self.layoutWidget) self.exampleFilter.setObjectName("exampleFilter") self.gridLayout.addWidget(self.exampleFilter, 0, 0, 1, 2) self.searchFiles = QtWidgets.QComboBox(self.layoutWidget) self.searchFiles.setObjectName("searchFiles") self.searchFiles.addItem("") self.searchFiles.addItem("") self.gridLayout.addWidget(self.searchFiles, 1, 0, 1, 2) self.layoutWidget1 = QtWidgets.QWidget(self.splitter) self.layoutWidget1.setObjectName("layoutWidget1") self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget1) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.loadedFileLabel = QtWidgets.QLabel(self.layoutWidget1) font = QtGui.QFont() font.setBold(True) self.loadedFileLabel.setFont(font) self.loadedFileLabel.setText("") self.loadedFileLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.loadedFileLabel.setObjectName("loadedFileLabel") self.verticalLayout.addWidget(self.loadedFileLabel) self.codeView = QtWidgets.QPlainTextEdit(self.layoutWidget1) font = QtGui.QFont() font.setFamily("Courier New") self.codeView.setFont(font) self.codeView.setObjectName("codeView") self.verticalLayout.addWidget(self.codeView) self.gridLayout_2.addWidget(self.splitter, 1, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "PyQtGraph")) self.loadBtn.setText(_translate("Form", "Run Example")) self.label.setText(_translate("Form", "Qt Library:")) self.exampleFilter.setPlaceholderText(_translate("Form", "Type to filter...")) self.searchFiles.setItemText(0, _translate("Form", "Title Search")) self.searchFiles.setItemText(1, _translate("Form", "Content Search")) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/fractal.py000066400000000000000000000062331457240071200234640ustar00rootroot00000000000000""" Displays an interactive Koch fractal """ from functools import reduce import numpy as np import pyqtgraph as pg app = pg.mkQApp("Fractal Example") # Set up UI widgets win = pg.QtWidgets.QWidget() win.setWindowTitle('pyqtgraph example: fractal demo') layout = pg.QtWidgets.QGridLayout() win.setLayout(layout) layout.setContentsMargins(0, 0, 0, 0) depthLabel = pg.QtWidgets.QLabel('fractal depth:') layout.addWidget(depthLabel, 0, 0) depthSpin = pg.SpinBox(value=5, step=1, bounds=[1, 10], delay=0, int=True) depthSpin.resize(100, 20) layout.addWidget(depthSpin, 0, 1) w = pg.GraphicsLayoutWidget() layout.addWidget(w, 1, 0, 1, 2) win.show() # Set up graphics v = w.addViewBox() v.setAspectLocked() baseLine = pg.PolyLineROI([[0, 0], [1, 0], [1.5, 1], [2, 0], [3, 0]], pen=(0, 255, 0, 100), movable=False) v.addItem(baseLine) fc = pg.PlotCurveItem(pen=(255, 255, 255, 200), antialias=True) v.addItem(fc) v.autoRange() transformMap = [0, 0, None] def update(): # recalculate and redraw the fractal curve depth = depthSpin.value() pts = baseLine.getState()['points'] nbseg = len(pts) - 1 nseg = nbseg**depth # Get a transformation matrix for each base segment trs = [] v1 = pts[-1] - pts[0] l1 = v1.length() for i in range(len(pts)-1): p1 = pts[i] p2 = pts[i+1] v2 = p2 - p1 t = p1 - pts[0] r = v2.angle(v1) s = v2.length() / l1 trs.append(pg.SRTTransform({'pos': t, 'scale': (s, s), 'angle': r})) basePts = [np.array(list(pt) + [1]) for pt in baseLine.getState()['points']] baseMats = np.dstack([tr.matrix().T for tr in trs]).transpose(2, 0, 1) # Generate an array of matrices to transform base points global transformMap if transformMap[:2] != [depth, nbseg]: # we can cache the transform index to save a little time.. nseg = nbseg**depth matInds = np.empty((depth, nseg), dtype=int) for i in range(depth): matInds[i] = np.tile(np.repeat(np.arange(nbseg), nbseg**(depth-1-i)), nbseg**i) transformMap = [depth, nbseg, matInds] # Each column in matInds contains the indices referring to the base transform # matrices that must be multiplied together to generate the final transform # for each segment of the fractal matInds = transformMap[2] # Collect all matrices needed for generating fractal curve mats = baseMats[matInds] # Magic-multiply stacks of matrices together def matmul(a, b): return np.sum(np.transpose(a,(0,2,1))[..., None] * b[..., None, :], axis=-3) mats = reduce(matmul, mats) # Transform base points through matrix array pts = np.empty((nseg * nbseg + 1, 2)) for l in range(len(trs)): bp = basePts[l] pts[l:-1:len(trs)] = np.dot(mats, bp)[:, :2] # Finish the curve with the last base point pts[-1] = basePts[-1][:2] # update fractal curve with new points fc.setData(pts[:,0], pts[:,1]) # Update the fractal whenever the base shape or depth has changed baseLine.sigRegionChanged.connect(update) depthSpin.valueChanged.connect(update) # Initialize update() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/glow.py000066400000000000000000000076461457240071200230310ustar00rootroot00000000000000# This Python file uses the following encoding: utf-8 """ This example demonstrates how to makes your plotDataItem glow. This is strongly inspired by this repository: https://github.com/dhaitz/mplcyberpunk """ from pyqtgraph.Qt import QtGui, QtWidgets import numpy as np import pyqtgraph as pg # Enable antialiasing for prettier plots pg.setConfigOptions(antialias=True) app = pg.mkQApp("Glow Example") # Dedicated colors which look "good" colors = ['#08F7FE', '#FE53BB', '#F5D300', '#00ff41', '#FF0000', '#9467bd', ] # We create the ParameterTree children = [ dict(name='make_line_glow', type='bool', value=False), dict(name='add_underglow', type='list', limits=['None', 'Full', 'Gradient'], value='None'), dict(name='nb_lines', type='int', limits=[1, 6], value=1), dict(name='nb glow lines', type='int', limits=[0, 15], value=10), dict(name='alpha_start', type='int', limits=[0, 255], value=25, step=1), dict(name='alpha_stop', type='int', limits=[0, 255], value=25, step=1), dict(name='alpha_underglow', type='int', limits=[0, 255], value=25, step=1), dict(name='linewidth_start', type='float', limits=[0.1, 50], value=1, step=0.1), dict(name='linewidth_stop', type='float', limits=[0.2, 50], value=8, step=0.1), ] params = pg.parametertree.Parameter.create(name='Parameters', type='group', children=children) pt = pg.parametertree.ParameterTree(showHeader=False) pt.setParameters(params) pw2 = pg.PlotWidget() splitter = QtWidgets.QSplitter() splitter.addWidget(pt) splitter.addWidget(pw2) splitter.show() # Add some noise on the curves noise = 0.1 noises: list = np.random.rand(6, 100)*noise def update_plot(): pw2.clear() nb_glow_lines = params.child('nb glow lines').value() alpha_start = params.child('alpha_start').value() alpha_stop = params.child('alpha_stop').value() alpha_underglow = params.child('alpha_underglow').value() linewidth_start = params.child('linewidth_start').value() linewidth_stop = params.child('linewidth_stop').value() nb_lines = params.child('nb_lines').value() xs = [] ys = [] for i in range(nb_lines): xs.append(np.linspace(0, 2*np.pi, 100)-i) ys.append(np.sin(xs[-1])*xs[-1]-i/3+noises[i]) # For each line we: # 1. Add a PlotDataItem with the pen and brush corresponding to the line # color and the underglow # 2. Add nb_glow_lines PlotDatamItem with increasing width and low alpha # to create the glow effect for color, x, y in zip(colors, xs, ys): pen = pg.mkPen(color=color) if params.child('add_underglow').value()=='Full': kw={'fillLevel' : 0.0, 'fillBrush' : pg.mkBrush(color='{}{:02x}'.format(color, alpha_underglow)), } elif params.child('add_underglow').value()=='Gradient': grad = QtGui.QLinearGradient(x.mean(), y.min(), x.mean(), y.max()) grad.setColorAt(0.001, pg.mkColor(color)) grad.setColorAt(abs(y.min())/(y.max()-y.min()), pg.mkColor('{}{:02x}'.format(color, alpha_underglow))) grad.setColorAt(0.999, pg.mkColor(color)) brush = QtGui.QBrush(grad) kw={'fillLevel' : 0.0, 'fillBrush' : brush, } else: kw = {} pw2.addItem(pg.PlotDataItem(x, y, pen=pen, **kw)) if params.child('make_line_glow').value(): alphas = np.linspace(alpha_start, alpha_stop, nb_glow_lines, dtype=int) lws = np.linspace(linewidth_start, linewidth_stop, nb_glow_lines) for alpha, lw in zip(alphas, lws): pen = pg.mkPen(color='{}{:02x}'.format(color, alpha), width=lw, connect="finite") pw2.addItem(pg.PlotDataItem(x, y, pen=pen)) params.sigTreeStateChanged.connect(update_plot) update_plot() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/hdf5.py000066400000000000000000000114121457240071200226710ustar00rootroot00000000000000""" In this example we create a subclass of PlotCurveItem for displaying a very large data set from an HDF5 file that does not fit in memory. The basic approach is to override PlotCurveItem.viewRangeChanged such that it reads only the portion of the HDF5 data that is necessary to display the visible portion of the data. This is further downsampled to reduce the number of samples being displayed. A more clever implementation of this class would employ some kind of caching to avoid re-reading the entire visible waveform at every update. """ import os import sys import h5py import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets pg.mkQApp() plt = pg.plot() plt.setWindowTitle('pyqtgraph example: HDF5 big data') plt.enableAutoRange(False, False) plt.setXRange(0, 500) class HDF5Plot(pg.PlotCurveItem): def __init__(self, *args, **kwds): self.hdf5 = None self.limit = 10000 # maximum number of samples to be plotted pg.PlotCurveItem.__init__(self, *args, **kwds) def setHDF5(self, data): self.hdf5 = data self.updateHDF5Plot() def viewRangeChanged(self): self.updateHDF5Plot() def updateHDF5Plot(self): if self.hdf5 is None: self.setData([]) return vb = self.getViewBox() if vb is None: return # no ViewBox yet # Determine what data range must be read from HDF5 range_ = vb.viewRange()[0] start = max(0,int(range_[0])-1) stop = min(len(self.hdf5), int(range_[1]+2)) # Decide by how much we should downsample ds = int((stop-start) / self.limit) + 1 if ds == 1: # Small enough to display with no intervention. visible = self.hdf5[start:stop] scale = 1 else: # Here convert data into a down-sampled array suitable for visualizing. # Must do this piecewise to limit memory usage. samples = 1 + ((stop-start) // ds) visible = np.zeros(samples*2, dtype=self.hdf5.dtype) sourcePtr = start targetPtr = 0 # read data in chunks of ~1M samples chunkSize = (1000000//ds) * ds while sourcePtr < stop-1: chunk = self.hdf5[sourcePtr:min(stop,sourcePtr+chunkSize)] sourcePtr += len(chunk) # reshape chunk to be integral multiple of ds chunk = chunk[:(len(chunk)//ds) * ds].reshape(len(chunk)//ds, ds) # compute max and min chunkMax = chunk.max(axis=1) chunkMin = chunk.min(axis=1) # interleave min and max into plot data to preserve envelope shape visible[targetPtr:targetPtr+chunk.shape[0]*2:2] = chunkMin visible[1+targetPtr:1+targetPtr+chunk.shape[0]*2:2] = chunkMax targetPtr += chunk.shape[0]*2 visible = visible[:targetPtr] scale = ds * 0.5 self.setData(visible) # update the plot self.setPos(start, 0) # shift to match starting index self.resetTransform() self.scale(scale, 1) # scale to match downsampling def createFile(finalSize=2000000000): """Create a large HDF5 data file for testing. Data consists of 1M random samples tiled through the end of the array. """ chunk = np.random.normal(size=1000000).astype(np.float32) f = h5py.File('test.hdf5', 'w') f.create_dataset('data', data=chunk, chunks=True, maxshape=(None,)) data = f['data'] nChunks = finalSize // (chunk.size * chunk.itemsize) with pg.ProgressDialog("Generating test.hdf5...", 0, nChunks) as dlg: for i in range(nChunks): newshape = [data.shape[0] + chunk.shape[0]] data.resize(newshape) data[-chunk.shape[0]:] = chunk dlg += 1 if dlg.wasCanceled(): f.close() os.remove('test.hdf5') sys.exit() dlg += 1 f.close() if len(sys.argv) > 1: fileName = sys.argv[1] else: fileName = 'test.hdf5' if not os.path.isfile(fileName): size, ok = QtWidgets.QInputDialog.getDouble(None, "Create HDF5 Dataset?", "This demo requires a large HDF5 array. To generate a file, enter the array size (in GB) and press OK.", 2.0) if not ok: sys.exit(0) else: createFile(int(size*1e9)) #raise Exception("No suitable HDF5 file found. Use createFile() to generate an example file.") f = h5py.File(fileName, 'r') curve = HDF5Plot() curve.setHDF5(f['data']) plt.addItem(curve) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/histogram.py000066400000000000000000000021171457240071200240420ustar00rootroot00000000000000""" In this example we draw two different kinds of histogram. """ import numpy as np import pyqtgraph as pg win = pg.GraphicsLayoutWidget(show=True) win.resize(800,480) win.setWindowTitle('pyqtgraph example: Histogram') plt1 = win.addPlot() plt2 = win.addPlot() ## make interesting distribution of values vals = np.hstack([np.random.normal(size=500), np.random.normal(size=260, loc=4)]) ## compute standard histogram y,x = np.histogram(vals, bins=np.linspace(-3, 8, 40)) ## Using stepMode="center" causes the plot to draw two lines for each sample. ## notice that len(x) == len(y)+1 plt1.plot(x, y, stepMode="center", fillLevel=0, fillOutline=True, brush=(0,0,255,150)) ## Now draw all points as a nicely-spaced scatter plot psy = pg.pseudoScatter(vals, spacing=0.15) plt2.plot(vals, psy, pen=None, symbol='o', symbolSize=5, symbolPen=(255,255,255,200), symbolBrush=(0,0,255,150)) # draw histogram using BarGraphItem win.nextRow() plt3 = win.addPlot() bgi = pg.BarGraphItem(x0=x[:-1], x1=x[1:], height=y, pen='w', brush=(0,0,255,150)) plt3.addItem(bgi) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/imageAnalysis.py000066400000000000000000000060361457240071200246370ustar00rootroot00000000000000""" Demonstrates common image analysis tools. Many of the features demonstrated here are already provided by the ImageView widget, but here we present a lower-level approach that provides finer control over the user interface. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtGui # Interpret image data as row-major instead of col-major pg.setConfigOptions(imageAxisOrder='row-major') pg.mkQApp() win = pg.GraphicsLayoutWidget() win.setWindowTitle('pyqtgraph example: Image Analysis') # A plot area (ViewBox + axes) for displaying the image p1 = win.addPlot(title="") # Item for displaying image data img = pg.ImageItem() p1.addItem(img) # Custom ROI for selecting an image region roi = pg.ROI([-8, 14], [6, 5]) roi.addScaleHandle([0.5, 1], [0.5, 0.5]) roi.addScaleHandle([0, 0.5], [0.5, 0.5]) p1.addItem(roi) roi.setZValue(10) # make sure ROI is drawn above image # Isocurve drawing iso = pg.IsocurveItem(level=0.8, pen='g') iso.setParentItem(img) iso.setZValue(5) # Contrast/color control hist = pg.HistogramLUTItem() hist.setImageItem(img) win.addItem(hist) # Draggable line for setting isocurve level isoLine = pg.InfiniteLine(angle=0, movable=True, pen='g') hist.vb.addItem(isoLine) hist.vb.setMouseEnabled(y=False) # makes user interaction a little easier isoLine.setValue(0.8) isoLine.setZValue(1000) # bring iso line above contrast controls # Another plot area for displaying ROI data win.nextRow() p2 = win.addPlot(colspan=2) p2.setMaximumHeight(250) win.resize(800, 800) win.show() # Generate image data data = np.random.normal(size=(200, 100)) data[20:80, 20:80] += 2. data = pg.gaussianFilter(data, (3, 3)) data += np.random.normal(size=(200, 100)) * 0.1 img.setImage(data) hist.setLevels(data.min(), data.max()) # build isocurves from smoothed data iso.setData(pg.gaussianFilter(data, (2, 2))) # set position and scale of image tr = QtGui.QTransform() img.setTransform(tr.scale(0.2, 0.2).translate(-50, 0)) # zoom to fit imageo p1.autoRange() # Callbacks for handling user interaction def updatePlot(): global img, roi, data, p2 selected = roi.getArrayRegion(data, img) p2.plot(selected.mean(axis=0), clear=True) roi.sigRegionChanged.connect(updatePlot) updatePlot() def updateIsocurve(): global isoLine, iso iso.setLevel(isoLine.value()) isoLine.sigDragged.connect(updateIsocurve) def imageHoverEvent(event): """Show the position, pixel, and value under the mouse cursor. """ if event.isExit(): p1.setTitle("") return pos = event.pos() i, j = pos.y(), pos.x() i = int(np.clip(i, 0, data.shape[0] - 1)) j = int(np.clip(j, 0, data.shape[1] - 1)) val = data[i, j] ppos = img.mapToParent(pos) x, y = ppos.x(), ppos.y() p1.setTitle("pos: (%0.1f, %0.1f) pixel: (%d, %d) value: %.3g" % (x, y, i, j, val)) # Monkey-patch the image to use our custom hover function. # This is generally discouraged (you should subclass ImageItem instead), # but it works for a very simple use like this. img.hoverEvent = imageHoverEvent if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/infiniteline_performance.py000066400000000000000000000015511457240071200271040ustar00rootroot00000000000000#!/usr/bin/python import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore from utils import FrameCounter app = pg.mkQApp("Infinite Line Performance") p = pg.plot() p.setWindowTitle('pyqtgraph performance: InfiniteLine') p.setRange(QtCore.QRectF(0, -10, 5000, 20)) p.setLabel('bottom', 'Index', units='B') curve = p.plot() # Add a large number of horizontal InfiniteLine to plot for i in range(100): line = pg.InfiniteLine(pos=np.random.randint(5000), movable=True) p.addItem(line) data = np.random.normal(size=(50, 5000)) ptr = 0 def update(): global ptr curve.setData(data[ptr % 10]) ptr += 1 framecnt.update() timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(0) framecnt = FrameCounter() framecnt.sigFpsUpdate.connect(lambda fps: p.setTitle(f'{fps:.1f} fps')) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/isocurve.py000066400000000000000000000025221457240071200237040ustar00rootroot00000000000000""" Tests use of IsoCurve item displayed with image """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore app = pg.mkQApp("Isocurve Example") ## make pretty looping data frames = 200 data = np.random.normal(size=(frames,30,30), loc=0, scale=100) data = np.concatenate([data, data], axis=0) data = pg.gaussianFilter(data, (10, 10, 10))[frames//2:frames + frames//2] data[:, 15:16, 15:17] += 1 win = pg.GraphicsLayoutWidget(show=True) win.setWindowTitle('pyqtgraph example: Isocurve') vb = win.addViewBox() img = pg.ImageItem(data[0]) vb.addItem(img) vb.setAspectLocked() ## generate empty curves curves = [] levels = np.linspace(data.min(), data.max(), 10) for i in range(len(levels)): v = levels[i] ## generate isocurve with automatic color selection c = pg.IsocurveItem(level=v, pen=(i, len(levels)*1.5)) c.setParentItem(img) ## make sure isocurve is always correctly displayed over image c.setZValue(10) curves.append(c) ## animate! ptr = 0 imgLevels = (data.min(), data.max() * 2) def update(): global data, curves, img, ptr, imgLevels ptr = (ptr + 1) % data.shape[0] data[ptr] img.setImage(data[ptr], levels=imgLevels) for c in curves: c.setData(data[ptr]) timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(50) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/jupyter_console_example.py000066400000000000000000000070211457240071200270030ustar00rootroot00000000000000""" This example show how to create a Rich Jupyter Widget, and places it in a MainWindow alongside a PlotWidget. The widgets are implemented as `Docks` so they may be moved around within the Main Window The `__main__` function shows an example that inputs the commands to plot simple `sine` and cosine` waves, equivalent to creating such plots by entering the commands manually in the console Also shows the use of `whos`, which returns a list of the variables defined within the `ipython` kernel This method for creating a Jupyter console is based on the example(s) here: https://github.com/jupyter/qtconsole/tree/b4e08f763ef1334d3560d8dac1d7f9095859545a/examples especially- https://github.com/jupyter/qtconsole/blob/b4e08f763ef1334d3560d8dac1d7f9095859545a/examples/embed_qtconsole.py#L19 """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets from pyqtgraph.dockarea.Dock import Dock from pyqtgraph.dockarea.DockArea import DockArea try: from qtconsole import inprocess except (ImportError, NameError): print( "The example in `jupyter_console_example.py` requires `qtconsole` to run. Install with `pip install qtconsole` or equivalent." ) class JupyterConsoleWidget(inprocess.QtInProcessRichJupyterWidget): def __init__(self): super().__init__() self.kernel_manager = inprocess.QtInProcessKernelManager() self.kernel_manager.start_kernel() self.kernel_client = self.kernel_manager.client() self.kernel_client.start_channels() def shutdown_kernel(self): self.kernel_client.stop_channels() self.kernel_manager.shutdown_kernel() class MainWindow(QtWidgets.QMainWindow): def __init__(self, dark_mode=True): super().__init__() central_dock_area = DockArea() # create plot widget (and dock) self.plot_widget = pg.PlotWidget() plot_dock = Dock(name="Plot Widget Dock", closable=True) plot_dock.addWidget(self.plot_widget) central_dock_area.addDock(plot_dock) # create jupyter console widget (and dock) self.jupyter_console_widget = JupyterConsoleWidget() jupyter_console_dock = Dock("Jupyter Console Dock") jupyter_console_dock.addWidget(self.jupyter_console_widget) central_dock_area.addDock(jupyter_console_dock) self.setCentralWidget(central_dock_area) app = QtWidgets.QApplication.instance() app.aboutToQuit.connect(self.jupyter_console_widget.shutdown_kernel) kernel = self.jupyter_console_widget.kernel_manager.kernel kernel.shell.push(dict(np=np, pw=self.plot_widget)) # set dark mode if dark_mode: # Set Dark bg color via this relatively roundabout method self.jupyter_console_widget.set_default_style( "linux" ) if __name__ == "__main__": pg.mkQApp() main = MainWindow(dark_mode=True) main.show() main.jupyter_console_widget.execute('print("hello world :D ")') # plot a sine/cosine waves by printing to console # this is equivalent to typing the commands into the console manually main.jupyter_console_widget.execute("x = np.arange(0, 3 * np.pi, .1)") main.jupyter_console_widget.execute("pw.plotItem.plot(np.sin(x), pen='r')") main.jupyter_console_widget.execute( "pw.plotItem.plot(np.cos(x),\ pen='cyan',\ symbol='o',\ symbolPen='m',\ symbolBrush=(0,0,255))" ) main.jupyter_console_widget.execute("whos") main.jupyter_console_widget.execute("") pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/linkedViews.py000066400000000000000000000023071457240071200243320ustar00rootroot00000000000000""" This example demonstrates the ability to link the axes of views together Views can be linked manually using the context menu, but only if they are given names. """ import numpy as np import pyqtgraph as pg app = pg.mkQApp("Linked Views Example") #mw = QtWidgets.QMainWindow() #mw.resize(800,800) x = np.linspace(-50, 50, 1000) y = np.sin(x) / x win = pg.GraphicsLayoutWidget(show=True, title="pyqtgraph example: Linked Views") win.resize(800,600) win.addLabel("Linked Views", colspan=2) win.nextRow() p1 = win.addPlot(x=x, y=y, name="Plot1", title="Plot1") p2 = win.addPlot(x=x, y=y, name="Plot2", title="Plot2: Y linked with Plot1") p2.setLabel('bottom', "Label to test offset") p2.setYLink('Plot1') ## test linking by name ## create plots 3 and 4 out of order p4 = win.addPlot(x=x, y=y, name="Plot4", title="Plot4: X -> Plot3 (deferred), Y -> Plot1", row=2, col=1) p4.setXLink('Plot3') ## Plot3 has not been created yet, but this should still work anyway. p4.setYLink(p1) p3 = win.addPlot(x=x, y=y, name="Plot3", title="Plot3: X linked with Plot1", row=2, col=0) p3.setXLink(p1) p3.setLabel('left', "Label to test offset") #QtWidgets.QApplication.processEvents() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/logAxis.py000066400000000000000000000027241457240071200234570ustar00rootroot00000000000000""" Demonstrate programmatic setting of log transformation modes. """ import numpy as np import pyqtgraph as pg app = pg.mkQApp("Log Axis Example") w = pg.GraphicsLayoutWidget(show=True) w.resize(800,800) w.setWindowTitle('pyqtgraph example: Log Axis, or How to Recognise Different Types of Curves from Quite a Long Way Away') p0 = w.addPlot(0,0, title="Linear") p1 = w.addPlot(0,1, title="X Semilog") p2 = w.addPlot(1,0, title="Y Semilog") p3 = w.addPlot(1,1, title="XY Log") # configure logarithmic axis scaling: p1.setLogMode(True, False) p2.setLogMode(False, True) p3.setLogMode(True, True) # 1000 points from 0.1 to 10, chosen to give a compatible range of values across curves: x = np.logspace(-1, 1, 1000) plotdata = ( # legend entry, color, and plotted equation: ('1 / 3x' , '#ff9d47', 1./(3*x) ), ('sqrt x' , '#b3cf00', 1/np.sqrt(x) ), ('exp. decay', '#00a0b5', 5 * np.exp(-x/1) ), ('-log x' , '#a54dff', - np.log10(x) ) ) p0.addLegend(offset=(-20,20)) # include legend only in top left plot for p in (p0, p1, p2, p3): # draw identical numerical data in all four plots p.showGrid(True, True) # turn on grid for all four plots p.showAxes(True, size=(40,None)) # show a full frame, and reserve identical room for y labels for name, color, y in plotdata: # draw all four curves as defined in plotdata pen = pg.mkPen(color, width=2) p.plot( x,y, pen=pen, name=name ) w.show() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/multiplePlotSpeedTest.py000066400000000000000000000040051457240071200263560ustar00rootroot00000000000000from time import perf_counter import numpy as np import pyqtgraph as pg app = pg.mkQApp() plt = pg.PlotWidget() app.processEvents() ## Putting this at the beginning or end does not have much effect plt.show() ## The auto-range is recomputed after each item is added, ## so disabling it before plotting helps plt.enableAutoRange(False, False) def plot(): start = perf_counter() n = 15 pts = 100 x = np.linspace(0, 0.8, pts) y = np.random.random(size=pts)*0.8 for i in range(n): for j in range(n): ## calling PlotWidget.plot() generates a PlotDataItem, which ## has a bit more overhead than PlotCurveItem, which is all ## we need here. This overhead adds up quickly and makes a big ## difference in speed. plt.addItem(pg.PlotCurveItem(x=x+i, y=y+j)) dt = perf_counter() - start print(f"Create plots took: {dt * 1000:.3f} ms") ## Plot and clear 5 times, printing the time it took for _ in range(5): plt.clear() plot() app.processEvents() plt.autoRange() def fastPlot(): ## Different approach: generate a single item with all data points. ## This runs many times faster. start = perf_counter() n = 15 pts = 100 x = np.linspace(0, 0.8, pts) y = np.random.random(size=pts)*0.8 shape = (n, n, pts) xdata = np.empty(shape) xdata[:] = x + np.arange(shape[1]).reshape((1,-1,1)) ydata = np.empty(shape) ydata[:] = y + np.arange(shape[0]).reshape((-1,1,1)) conn = np.ones(shape, dtype=bool) conn[...,-1] = False # make sure plots are disconnected item = pg.PlotCurveItem() item.setData(xdata.ravel(), ydata.ravel(), connect=conn.ravel()) plt.addItem(item) dt = perf_counter() - start print("Create plots took: %0.3fms" % (dt*1000)) ## Plot and clear 5 times, printing the time it took for _ in range(5): plt.clear() fastPlot() app.processEvents() plt.autoRange() if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/multiprocess.py000066400000000000000000000022311457240071200245730ustar00rootroot00000000000000 import numpy as np import pyqtgraph as pg import pyqtgraph.multiprocess as mp print("\n=================\nStart Process") proc = mp.Process() import os print("parent:", os.getpid(), "child:", proc.proc.pid) print("started") rnp = proc._import('numpy') arr = rnp.array([1,2,3,4]) print(repr(arr)) print(str(arr)) print("return value:", repr(arr.mean(_returnType='value'))) print( "return proxy:", repr(arr.mean(_returnType='proxy'))) print( "return auto: ", repr(arr.mean(_returnType='auto'))) proc.join() print( "process finished") print( "\n=================\nStart ForkedProcess") proc = mp.ForkedProcess() rnp = proc._import('numpy') arr = rnp.array([1,2,3,4]) print( repr(arr)) print( str(arr)) print( repr(arr.mean())) proc.join() print( "process finished") import pyqtgraph as pg app = pg.mkQApp("Multiprocess Example") print( "\n=================\nStart QtProcess") import sys if (sys.flags.interactive != 1): print( " (not interactive; remote process will exit immediately.)") proc = mp.QtProcess() d1 = proc.transfer(np.random.normal(size=1000)) d2 = proc.transfer(np.random.normal(size=1000)) rpg = proc._import('pyqtgraph') plt = rpg.plot(d1+d2) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/notebooks/000077500000000000000000000000001457240071200234755ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/notebooks/ImageAnalysis.ipynb000066400000000000000000000116671457240071200273010ustar00rootroot00000000000000{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\"\"\"\n", "Demonstrates common image analysis tools.\n", "\n", "Many of the features demonstrated here are already provided by the ImageView\n", "widget, but here we present a lower-level approach that provides finer control\n", "over the user interface.\n", "\"\"\"\n", "from pyqtgraph.jupyter import GraphicsLayoutWidget\n", "import ipywidgets\n", "from IPython.display import display\n", "\n", "import pyqtgraph as pg\n", "from pyqtgraph.Qt import QtCore, QtGui\n", "import numpy as np\n", "\n", "\n", "# Interpret image data as row-major instead of col-major\n", "pg.setConfigOptions(imageAxisOrder='row-major')\n", "\n", "pg.mkQApp()\n", "win = GraphicsLayoutWidget(css_width=\"800px\", css_height=\"480px\")\n", "\n", "# A plot area (ViewBox + axes) for displaying the image\n", "p1 = win.addPlot(title=\"\")\n", "\n", "# Item for displaying image data\n", "img = pg.ImageItem()\n", "p1.addItem(img)\n", "\n", "# Custom ROI for selecting an image region\n", "roi = pg.ROI([-8, 14], [6, 5])\n", "roi.addScaleHandle([0.5, 1], [0.5, 0.5])\n", "roi.addScaleHandle([0, 0.5], [0.5, 0.5])\n", "p1.addItem(roi)\n", "roi.setZValue(10) # make sure ROI is drawn above image\n", "\n", "# Isocurve drawing\n", "iso = pg.IsocurveItem(level=0.8, pen='g')\n", "iso.setParentItem(img)\n", "iso.setZValue(5)\n", "\n", "# Contrast/color control\n", "hist = pg.HistogramLUTItem()\n", "hist.setImageItem(img)\n", "win.addItem(hist)\n", "\n", "# Draggable line for setting isocurve level\n", "isoLine = pg.InfiniteLine(angle=0, movable=True, pen='g')\n", "hist.vb.addItem(isoLine)\n", "hist.vb.setMouseEnabled(y=False) # makes user interaction a little easier\n", "isoLine.setValue(0.8)\n", "isoLine.setZValue(1000) # bring iso line above contrast controls\n", "\n", "# Another plot area for displaying ROI data\n", "win.nextRow()\n", "p2 = win.addPlot(colspan=2)\n", "p2.setMaximumHeight(250)\n", "\n", "\n", "# Generate image data\n", "data = np.random.normal(size=(200, 100))\n", "data[20:80, 20:80] += 2.\n", "data = pg.gaussianFilter(data, (3, 3))\n", "data += np.random.normal(size=(200, 100)) * 0.1\n", "img.setImage(data)\n", "hist.setLevels(data.min(), data.max())\n", "\n", "# build isocurves from smoothed data\n", "iso.setData(pg.gaussianFilter(data, (2, 2)))\n", "\n", "# set position and scale of image\n", "tr = QtGui.QTransform()\n", "img.setTransform(tr.scale(0.2, 0.2).translate(-50, 0))\n", "\n", "# zoom to fit imageo\n", "p1.autoRange() \n", "\n", "\n", "# Callbacks for handling user interaction\n", "def updatePlot():\n", " global img, roi, data, p2\n", " selected = roi.getArrayRegion(data, img)\n", " p2.plot(selected.mean(axis=0), clear=True)\n", "\n", "roi.sigRegionChanged.connect(updatePlot)\n", "updatePlot()\n", "\n", "def updateIsocurve():\n", " global isoLine, iso\n", " iso.setLevel(isoLine.value())\n", "\n", "isoLine.sigDragged.connect(updateIsocurve)\n", "\n", "def imageHoverEvent(event):\n", " \"\"\"Show the position, pixel, and value under the mouse cursor.\n", " \"\"\"\n", " if event.isExit():\n", " p1.setTitle(\"\")\n", " return\n", " pos = event.pos()\n", " i, j = pos.y(), pos.x()\n", " i = int(np.clip(i, 0, data.shape[0] - 1))\n", " j = int(np.clip(j, 0, data.shape[1] - 1))\n", " val = data[i, j]\n", " ppos = img.mapToParent(pos)\n", " x, y = ppos.x(), ppos.y()\n", " p1.setTitle(\"pos: (%0.1f, %0.1f) pixel: (%d, %d) value: %.3g\" % (x, y, i, j, val))\n", "\n", "# Monkey-patch the image to use our custom hover function. \n", "# This is generally discouraged (you should subclass ImageItem instead),\n", "# but it works for a very simple use like this. \n", "img.hoverEvent = imageHoverEvent\n", "\n", "\n", "# disable HistogramLUTItem right-click context menus to prevent crashes\n", "hist.vb.setMenuEnabled(False)\n", "hist.gradient.showMenu = lambda ev : None\n", "display(win)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 2 } pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/notebooks/PColorMeshItem.ipynb000066400000000000000000000076411457240071200274020ustar00rootroot00000000000000{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\"\"\"\n", "Demonstrates very basic use of PColorMeshItem\n", "\"\"\"\n", "from pyqtgraph.jupyter import GraphicsLayoutWidget\n", "import ipywidgets\n", "from IPython.display import display\n", "\n", "import time\n", "import numpy as np\n", "import pyqtgraph as pg\n", "\n", "## Create window with GraphicsView widget\n", "pg.mkQApp()\n", "win = GraphicsLayoutWidget(css_width=\"800px\", css_height=\"480px\")\n", "view = win.addViewBox()\n", "\n", "\n", "## Create data\n", "\n", "# To enhance the non-grid meshing, we randomize the polygon vertices per and \n", "# certain amount\n", "randomness = 5\n", "\n", "# x and y being the vertices of the polygons, they share the same shape\n", "# However the shape can be different in both dimension\n", "xn = 50 # nb points along x\n", "yn = 40 # nb points along y\n", "\n", "\n", "x = np.repeat(np.arange(1, xn+1), yn).reshape(xn, yn)\\\n", " + np.random.random((xn, yn))*randomness\n", "y = np.tile(np.arange(1, yn+1), xn).reshape(xn, yn)\\\n", " + np.random.random((xn, yn))*randomness\n", "x.sort(axis=0)\n", "y.sort(axis=0)\n", "\n", "\n", "# z being the color of the polygons its shape must be decreased by one in each dimension\n", "z = np.exp(-(x*xn)**2/1000)[:-1,:-1]\n", "\n", "## Create image item\n", "edgecolors = None\n", "antialiasing = False\n", "# edgecolors = {'color':'w', 'width':2} # May be uncommened to see edgecolor effect\n", "# antialiasing = True # May be uncommened to see antialiasing effect\n", "pcmi = pg.PColorMeshItem(edgecolors=edgecolors, antialiasing=antialiasing)\n", "view.addItem(pcmi)\n", "textitem = pg.TextItem(anchor=(1, 0))\n", "view.addItem(textitem)\n", "\n", "\n", "## Set the animation\n", "fps = 25 # Frame per second of the animation\n", "\n", "# Wave parameters\n", "wave_amplitude = 3\n", "wave_speed = 0.3\n", "wave_length = 10\n", "color_speed = 0.3\n", "\n", "textpos = None\n", "i = 0\n", "def updateData():\n", " global i\n", " global textpos\n", " \n", " ## Display the new data set\n", " t0 = time.perf_counter()\n", " new_x = x\n", " new_y = y+wave_amplitude*np.cos(x/wave_length+i)\n", " new_z = np.exp(-(x-np.cos(i*color_speed)*xn)**2/1000)[:-1,:-1]\n", " t1 = time.perf_counter()\n", " pcmi.setData(new_x,\n", " new_y,\n", " new_z)\n", " t2 = time.perf_counter()\n", "\n", " i += wave_speed\n", " \n", " # display info in top-right corner\n", " textitem.setText(f'{(t2 - t1)*1000:.1f} ms')\n", " if textpos is None:\n", " textpos = pcmi.width(), pcmi.height()\n", " textitem.setPos(*textpos)\n", "\n", "updateData()\n", "\n", "def onPlay(change):\n", " updateData()\n", " win.request_draw()\n", "\n", "play = ipywidgets.Play(\n", " interval = 40,\n", " min = 0,\n", " max = 1000,\n", ")\n", "play.observe(onPlay, names='value')\n", "\n", "display(play)\n", "display(win)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 2 } pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/notebooks/Plotting.ipynb000066400000000000000000000106461457240071200263470ustar00rootroot00000000000000{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\"\"\"\n", "This example demonstrates many of the 2D plotting capabilities\n", "in pyqtgraph. All of the plots may be panned/scaled by dragging with \n", "the left/right mouse buttons. Right click on any plot to show a context menu.\n", "\"\"\"\n", "from pyqtgraph.jupyter import GraphicsLayoutWidget\n", "from IPython.display import display\n", "\n", "import numpy as np\n", "import pyqtgraph as pg\n", "\n", "class CustomGLW(GraphicsLayoutWidget):\n", " def get_frame(self):\n", " # rather than eating up cpu cycles by perpetually updating \"Updating plot\",\n", " # we will only update it opportunistically on a redraw.\n", " # self.request_draw()\n", " update()\n", " return super().get_frame()\n", "\n", "pg.mkQApp()\n", "win = CustomGLW(css_width=\"1000px\", css_height=\"600px\")\n", "\n", "# Enable antialiasing for prettier plots\n", "pg.setConfigOptions(antialias=True)\n", "\n", "p1 = win.addPlot(title=\"Basic array plotting\", y=np.random.normal(size=100))\n", "\n", "p2 = win.addPlot(title=\"Multiple curves\")\n", "p2.plot(np.random.normal(size=100), pen=(255,0,0), name=\"Red curve\")\n", "p2.plot(np.random.normal(size=110)+5, pen=(0,255,0), name=\"Green curve\")\n", "p2.plot(np.random.normal(size=120)+10, pen=(0,0,255), name=\"Blue curve\")\n", "\n", "p3 = win.addPlot(title=\"Drawing with points\")\n", "p3.plot(np.random.normal(size=100), pen=(200,200,200), symbolBrush=(255,0,0), symbolPen='w')\n", "\n", "\n", "win.nextRow()\n", "\n", "p4 = win.addPlot(title=\"Parametric, grid enabled\")\n", "x = np.cos(np.linspace(0, 2*np.pi, 1000))\n", "y = np.sin(np.linspace(0, 4*np.pi, 1000))\n", "p4.plot(x, y)\n", "p4.showGrid(x=True, y=True)\n", "\n", "p5 = win.addPlot(title=\"Scatter plot, axis labels, log scale\")\n", "x = np.random.normal(size=1000) * 1e-5\n", "y = x*1000 + 0.005 * np.random.normal(size=1000)\n", "y -= y.min()-1.0\n", "mask = x > 1e-15\n", "x = x[mask]\n", "y = y[mask]\n", "p5.plot(x, y, pen=None, symbol='t', symbolPen=None, symbolSize=10, symbolBrush=(100, 100, 255, 50))\n", "p5.setLabel('left', \"Y Axis\", units='A')\n", "p5.setLabel('bottom', \"Y Axis\", units='s')\n", "p5.setLogMode(x=True, y=False)\n", "\n", "p6 = win.addPlot(title=\"Updating plot\")\n", "curve = p6.plot(pen='y')\n", "data = np.random.normal(size=(10,1000))\n", "ptr = 0\n", "def update():\n", " global curve, data, ptr, p6\n", " curve.setData(data[ptr%10])\n", " if ptr == 0:\n", " p6.enableAutoRange('xy', False) ## stop auto-scaling after the first data set is plotted\n", " ptr += 1\n", "\n", "win.nextRow()\n", "\n", "p7 = win.addPlot(title=\"Filled plot, axis disabled\")\n", "y = np.sin(np.linspace(0, 10, 1000)) + np.random.normal(size=1000, scale=0.1)\n", "p7.plot(y, fillLevel=-0.3, brush=(50,50,200,100))\n", "p7.showAxis('bottom', False)\n", "\n", "\n", "x2 = np.linspace(-100, 100, 1000)\n", "data2 = np.sin(x2) / x2\n", "p8 = win.addPlot(title=\"Region Selection\")\n", "p8.plot(data2, pen=(255,255,255,200))\n", "lr = pg.LinearRegionItem([400,700])\n", "lr.setZValue(-10)\n", "p8.addItem(lr)\n", "\n", "p9 = win.addPlot(title=\"Zoom on selected region\")\n", "p9.plot(data2)\n", "def updatePlot():\n", " p9.setXRange(*lr.getRegion(), padding=0)\n", "def updateRegion():\n", " lr.setRegion(p9.getViewBox().viewRange()[0])\n", "lr.sigRegionChanged.connect(updatePlot)\n", "p9.sigXRangeChanged.connect(updateRegion)\n", "updatePlot()\n", "\n", "display(win)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 2 } pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/notebooks/ROIExamples.ipynb000066400000000000000000000152721457240071200266770ustar00rootroot00000000000000{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\"\"\"\n", "Demonstrates a variety of uses for ROI. This class provides a user-adjustable\n", "region of interest marker. It is possible to customize the layout and \n", "function of the scale/rotate handles in very flexible ways. \n", "\"\"\"\n", "from pyqtgraph.jupyter import GraphicsLayoutWidget\n", "from IPython.display import display\n", "\n", "import pyqtgraph as pg\n", "import numpy as np\n", "\n", "pg.setConfigOptions(imageAxisOrder='row-major')\n", "\n", "## Create image to display\n", "arr = np.ones((100, 100), dtype=float)\n", "arr[45:55, 45:55] = 0\n", "arr[25, :] = 5\n", "arr[:, 25] = 5\n", "arr[75, :] = 5\n", "arr[:, 75] = 5\n", "arr[50, :] = 10\n", "arr[:, 50] = 10\n", "arr += np.sin(np.linspace(0, 20, 100)).reshape(1, 100)\n", "arr += np.random.normal(size=(100,100))\n", "\n", "# add an arrow for asymmetry\n", "arr[10, :50] = 10\n", "arr[9:12, 44:48] = 10\n", "arr[8:13, 44:46] = 10\n", "\n", "\n", "## create GUI\n", "app = pg.mkQApp()\n", "font = app.font()\n", "if font.pointSize() > 10:\n", " font.setPointSize(10)\n", " app.setFont(font)\n", "w = GraphicsLayoutWidget(css_width=\"1000px\", css_height=\"800px\")\n", "\n", "text = \"\"\"Data Selection From Image.
      \\n\n", "Drag an ROI or its handles to update the selected image.
      \n", "Hold CTRL while dragging to snap to pixel boundaries
      \n", "and 15-degree rotation angles.\n", "\"\"\"\n", "w1 = w.addLayout(row=0, col=0)\n", "label1 = w1.addLabel(text, row=0, col=0)\n", "v1a = w1.addViewBox(row=1, col=0, lockAspect=True)\n", "v1b = w1.addViewBox(row=2, col=0, lockAspect=True)\n", "img1a = pg.ImageItem(arr)\n", "v1a.addItem(img1a)\n", "img1b = pg.ImageItem()\n", "v1b.addItem(img1b)\n", "v1a.disableAutoRange('xy')\n", "v1b.disableAutoRange('xy')\n", "v1a.autoRange()\n", "v1b.autoRange()\n", "\n", "rois = []\n", "rois.append(pg.RectROI([20, 20], [20, 20], pen=(0,9)))\n", "rois[-1].addRotateHandle([1,0], [0.5, 0.5])\n", "rois.append(pg.LineROI([0, 60], [20, 80], width=5, pen=(1,9)))\n", "rois.append(pg.TriangleROI([80, 75], 20, pen=(5, 9)))\n", "rois.append(pg.MultiRectROI([[20, 90], [50, 60], [60, 90]], width=5, pen=(2,9)))\n", "rois.append(pg.EllipseROI([60, 10], [30, 20], pen=(3,9)))\n", "rois.append(pg.CircleROI([80, 50], [20, 20], pen=(4,9)))\n", "#rois.append(pg.LineSegmentROI([[110, 50], [20, 20]], pen=(5,9)))\n", "rois.append(pg.PolyLineROI([[80, 60], [90, 30], [60, 40]], pen=(6,9), closed=True))\n", "\n", "def update(roi):\n", " img1b.setImage(roi.getArrayRegion(arr, img1a), levels=(0, arr.max()))\n", " v1b.autoRange()\n", " \n", "for roi in rois:\n", " roi.sigRegionChanged.connect(update)\n", " v1a.addItem(roi)\n", "\n", "update(rois[-1])\n", " \n", "\n", "\n", "text = \"\"\"User-Modifiable ROIs
      \n", "Click on a line segment to add a new handle.\n", "Right click on a handle to remove.\n", "\"\"\"\n", "w2 = w.addLayout(row=0, col=1)\n", "label2 = w2.addLabel(text, row=0, col=0)\n", "v2a = w2.addViewBox(row=1, col=0, lockAspect=True)\n", "r2a = pg.PolyLineROI([[0,0], [10,10], [10,30], [30,10]], closed=True)\n", "v2a.addItem(r2a)\n", "r2b = pg.PolyLineROI([[0,-20], [10,-10], [10,-30]], closed=False)\n", "v2a.addItem(r2b)\n", "v2a.disableAutoRange('xy')\n", "#v2b.disableAutoRange('xy')\n", "v2a.autoRange()\n", "#v2b.autoRange()\n", "\n", "text = \"\"\"Building custom ROI types
      \n", "ROIs can be built with a variety of different handle types
      \n", "that scale and rotate the roi around an arbitrary center location\n", "\"\"\"\n", "w3 = w.addLayout(row=1, col=0)\n", "label3 = w3.addLabel(text, row=0, col=0)\n", "v3 = w3.addViewBox(row=1, col=0, lockAspect=True)\n", "\n", "r3a = pg.ROI([0,0], [10,10])\n", "v3.addItem(r3a)\n", "## handles scaling horizontally around center\n", "r3a.addScaleHandle([1, 0.5], [0.5, 0.5])\n", "r3a.addScaleHandle([0, 0.5], [0.5, 0.5])\n", "\n", "## handles scaling vertically from opposite edge\n", "r3a.addScaleHandle([0.5, 0], [0.5, 1])\n", "r3a.addScaleHandle([0.5, 1], [0.5, 0])\n", "\n", "## handles scaling both vertically and horizontally\n", "r3a.addScaleHandle([1, 1], [0, 0])\n", "r3a.addScaleHandle([0, 0], [1, 1])\n", "\n", "r3b = pg.ROI([20,0], [10,10])\n", "v3.addItem(r3b)\n", "## handles rotating around center\n", "r3b.addRotateHandle([1, 1], [0.5, 0.5])\n", "r3b.addRotateHandle([0, 0], [0.5, 0.5])\n", "\n", "## handles rotating around opposite corner\n", "r3b.addRotateHandle([1, 0], [0, 1])\n", "r3b.addRotateHandle([0, 1], [1, 0])\n", "\n", "## handles rotating/scaling around center\n", "r3b.addScaleRotateHandle([0, 0.5], [0.5, 0.5])\n", "\n", "# handles rotating/scaling around arbitrary point\n", "r3b.addScaleRotateHandle([0.3, 0], [0.9, 0.7])\n", "\n", "v3.disableAutoRange('xy')\n", "v3.autoRange()\n", "\n", "\n", "text = \"\"\"Transforming objects with ROI\"\"\"\n", "w4 = w.addLayout(row=1, col=1)\n", "label4 = w4.addLabel(text, row=0, col=0)\n", "v4 = w4.addViewBox(row=1, col=0, lockAspect=True)\n", "g = pg.GridItem()\n", "v4.addItem(g)\n", "r4 = pg.ROI([0,0], [100,100], resizable=False, removable=True)\n", "r4.addRotateHandle([1,0], [0.5, 0.5])\n", "r4.addRotateHandle([0,1], [0.5, 0.5])\n", "img4 = pg.ImageItem(arr)\n", "v4.addItem(r4)\n", "img4.setParentItem(r4)\n", "\n", "v4.disableAutoRange('xy')\n", "v4.autoRange()\n", "\n", "# Provide a callback to remove the ROI (and its children) when\n", "# \"remove\" is selected from the context menu.\n", "def remove():\n", " v4.removeItem(r4)\n", "r4.sigRemoveRequested.connect(remove)\n", "\n", "\n", "display(w)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 2 } pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/notebooks/ScatterPlot.ipynb000066400000000000000000000140031457240071200270020ustar00rootroot00000000000000{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\"\"\"\n", "Example demonstrating a variety of scatter plot features.\n", "\"\"\"\n", "from pyqtgraph.jupyter import GraphicsLayoutWidget\n", "import ipywidgets\n", "from IPython.display import display\n", "\n", "from pyqtgraph.Qt import QtGui\n", "import pyqtgraph as pg\n", "import numpy as np\n", "from collections import namedtuple\n", "\n", "pg.mkQApp()\n", "view = GraphicsLayoutWidget(css_width=\"800px\", css_height=\"800px\")\n", "\n", "## create four areas to add plots\n", "w1 = view.addPlot()\n", "w2 = view.addViewBox()\n", "w2.setAspectLocked(True)\n", "view.nextRow()\n", "w3 = view.addPlot()\n", "w4 = view.addPlot()\n", "print(\"Generating data, this takes a few seconds...\")\n", "\n", "## Make all plots clickable\n", "clickedPen = pg.mkPen('b', width=2)\n", "lastClicked = []\n", "def clicked(plot, points):\n", " global lastClicked\n", " for p in lastClicked:\n", " p.resetPen()\n", " with out:\n", " print(\"clicked points\", points)\n", " for p in points:\n", " p.setPen(clickedPen)\n", " lastClicked = points\n", " view.request_draw()\n", "\n", "\n", "## There are a few different ways we can draw scatter plots; each is optimized for different types of data:\n", "\n", "## 1) All spots identical and transform-invariant (top-left plot).\n", "## In this case we can get a huge performance boost by pre-rendering the spot\n", "## image and just drawing that image repeatedly.\n", "\n", "n = 300\n", "s1 = pg.ScatterPlotItem(size=10, pen=pg.mkPen(None), brush=pg.mkBrush(255, 255, 255, 120))\n", "pos = np.random.normal(size=(2,n), scale=1e-5)\n", "spots = [{'pos': pos[:,i], 'data': 1} for i in range(n)] + [{'pos': [0,0], 'data': 1}]\n", "s1.addPoints(spots)\n", "w1.addItem(s1)\n", "s1.sigClicked.connect(clicked)\n", "\n", "\n", "## 2) Spots are transform-invariant, but not identical (top-right plot).\n", "## In this case, drawing is almsot as fast as 1), but there is more startup\n", "## overhead and memory usage since each spot generates its own pre-rendered\n", "## image.\n", "\n", "TextSymbol = namedtuple(\"TextSymbol\", \"label symbol scale\")\n", "\n", "def createLabel(label, angle):\n", " symbol = QtGui.QPainterPath()\n", " #symbol.addText(0, 0, QFont(\"San Serif\", 10), label)\n", " f = QtGui.QFont()\n", " f.setPointSize(10)\n", " symbol.addText(0, 0, f, label)\n", " br = symbol.boundingRect()\n", " scale = min(1. / br.width(), 1. / br.height())\n", " tr = QtGui.QTransform()\n", " tr.scale(scale, scale)\n", " tr.rotate(angle)\n", " tr.translate(-br.x() - br.width()/2., -br.y() - br.height()/2.)\n", " return TextSymbol(label, tr.map(symbol), 0.1 / scale)\n", "\n", "random_str = lambda : (''.join([chr(np.random.randint(ord('A'),ord('z'))) for i in range(np.random.randint(1,5))]), np.random.randint(0, 360))\n", "\n", "s2 = pg.ScatterPlotItem(size=10, pen=pg.mkPen('w'), pxMode=True)\n", "pos = np.random.normal(size=(2,n), scale=1e-5)\n", "spots = [{'pos': pos[:,i], 'data': 1, 'brush':pg.intColor(i, n), 'symbol': i%10, 'size': 5+i/10.} for i in range(n)]\n", "s2.addPoints(spots)\n", "spots = [{'pos': pos[:,i], 'data': 1, 'brush':pg.intColor(i, n), 'symbol': label[1], 'size': label[2]*(5+i/10.)} for (i, label) in [(i, createLabel(*random_str())) for i in range(n)]]\n", "s2.addPoints(spots)\n", "w2.addItem(s2)\n", "s2.sigClicked.connect(clicked)\n", "\n", "\n", "## 3) Spots are not transform-invariant, not identical (bottom-left).\n", "## This is the slowest case, since all spots must be completely re-drawn\n", "## every time because their apparent transformation may have changed.\n", "\n", "s3 = pg.ScatterPlotItem(\n", " pxMode=False, # Set pxMode=False to allow spots to transform with the view\n", " hoverable=True,\n", " hoverPen=pg.mkPen('g'),\n", " hoverSize=1e-6\n", ")\n", "spots3 = []\n", "for i in range(10):\n", " for j in range(10):\n", " spots3.append({'pos': (1e-6*i, 1e-6*j), 'size': 1e-6, 'pen': {'color': 'w', 'width': 2}, 'brush':pg.intColor(i*10+j, 100)})\n", "s3.addPoints(spots3)\n", "w3.addItem(s3)\n", "s3.sigClicked.connect(clicked)\n", "\n", "## Test performance of large scatterplots\n", "\n", "s4 = pg.ScatterPlotItem(\n", " size=10,\n", " pen=pg.mkPen(None),\n", " brush=pg.mkBrush(255, 255, 255, 20),\n", " hoverable=True,\n", " hoverSymbol='s',\n", " hoverSize=15,\n", " hoverPen=pg.mkPen('r', width=2),\n", " hoverBrush=pg.mkBrush('g'),\n", ")\n", "n = 10000\n", "pos = np.random.normal(size=(2, n), scale=1e-9)\n", "s4.addPoints(\n", " x=pos[0],\n", " y=pos[1],\n", " # size=(np.random.random(n) * 20.).astype(int),\n", " # brush=[pg.mkBrush(x) for x in np.random.randint(0, 256, (n, 3))],\n", " data=np.arange(n)\n", ")\n", "w4.addItem(s4)\n", "s4.sigClicked.connect(clicked)\n", "\n", "\n", "out = ipywidgets.Output(layout={'border': '1px solid black'})\n", "display(view)\n", "display(out)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 2 } pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/notebooks/simple.ipynb000066400000000000000000000043471457240071200260410ustar00rootroot00000000000000{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "fa151629", "metadata": {}, "outputs": [], "source": [ "import pyqtgraph as pg\n", "import numpy as np\n", "from pyqtgraph.jupyter import PlotWidget\n", "\n", "pg.mkQApp()" ] }, { "cell_type": "code", "execution_count": null, "id": "3c28c27d", "metadata": {}, "outputs": [], "source": [ "pw1 = PlotWidget()\n", "pw1.plot(np.arange(10))\n", "pw1" ] }, { "cell_type": "code", "execution_count": null, "id": "9a2fe974", "metadata": {}, "outputs": [], "source": [ "pw2 = PlotWidget()\n", "pditem = pw2.plot()\n", "x = np.linspace(-3, 3, 1000)\n", "data = np.sinc(x)\n", "pditem.setData(data)\n", "pw2" ] }, { "cell_type": "code", "execution_count": null, "id": "8644cd6f", "metadata": {}, "outputs": [], "source": [ "pw3 = PlotWidget()\n", "imgitem = pg.ImageItem(axisOrder='row-major')\n", "pw3.addItem(imgitem)\n", "x = np.linspace(-3, 3, 1000)\n", "y = np.linspace(-3, 3, 1000)\n", "data = np.sinc(y)[:,None] * np.sinc(x)\n", "imgitem.setImage(data)\n", "\n", "limits = data.min(), data.max()\n", "# bar = pw3.addColorBar( imgitem, colorMap='viridis', values=limits, limits=limits, rounding=0.1)\n", "cmap = pg.colormap.get('viridis')\n", "bar = pg.ColorBarItem(values=limits, colorMap=cmap, limits=limits, rounding=0.1)\n", "bar.setImageItem(imgitem, insert_in=pw3.getPlotItem())\n", "bar.sigLevelsChanged.connect(pw3.request_draw)\n", "bar.sigLevelsChangeFinished.connect(pw3.request_draw)\n", "\n", "pw3" ] }, { "cell_type": "code", "execution_count": null, "id": "f695e828", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 5 } pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/optics/000077500000000000000000000000001457240071200227735ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/optics/__init__.py000066400000000000000000000000271457240071200251030ustar00rootroot00000000000000from .pyoptic import * pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/optics/pyoptic.py000066400000000000000000000432601457240071200250410ustar00rootroot00000000000000import csv import gzip import os from math import asin, atan2, cos, degrees, hypot, sin, sqrt import numpy as np import pyqtgraph as pg from pyqtgraph import Point from pyqtgraph.Qt import QtCore, QtGui class GlassDB: """ Database of dispersion coefficients for Schott glasses + Corning 7980 """ def __init__(self, fileName='schott_glasses.csv'): path = os.path.dirname(__file__) fh = gzip.open(os.path.join(path, 'schott_glasses.csv.gz'), 'rb') r = csv.reader(map(str, fh.readlines())) lines = [x for x in r] self.data = {} header = lines[0] for l in lines[1:]: info = {} for i in range(1, len(l)): info[header[i]] = l[i] self.data[l[0]] = info self.data['Corning7980'] = { ## Thorlabs UV fused silica--not in schott catalog. 'B1': 0.68374049400, 'B2': 0.42032361300, 'B3': 0.58502748000, 'C1': 0.00460352869, 'C2': 0.01339688560, 'C3': 64.49327320000, 'TAUI25/250': 0.95, ## transmission data is fabricated, but close. 'TAUI25/1400': 0.98, } for k in self.data: self.data[k]['ior_cache'] = {} def ior(self, glass, wl): """ Return the index of refraction for *glass* at wavelength *wl*. The *glass* argument must be a key in self.data. """ info = self.data[glass] cache = info['ior_cache'] if wl not in cache: B = list(map(float, [info['B1'], info['B2'], info['B3']])) C = list(map(float, [info['C1'], info['C2'], info['C3']])) w2 = (wl/1000.)**2 n = sqrt(1.0 + (B[0]*w2 / (w2-C[0])) + (B[1]*w2 / (w2-C[1])) + (B[2]*w2 / (w2-C[2]))) cache[wl] = n return cache[wl] def transmissionCurve(self, glass): data = self.data[glass] keys = [int(x[7:]) for x in data.keys() if 'TAUI25' in x] keys.sort() curve = np.empty((2,len(keys))) for i in range(len(keys)): curve[0][i] = keys[i] key = 'TAUI25/%d' % keys[i] val = data[key] if val == '': val = 0 else: val = float(val) curve[1][i] = val return curve GLASSDB = GlassDB() def wlPen(wl): """Return a pen representing the given wavelength""" l1 = 400 l2 = 700 hue = np.clip(((l2-l1) - (wl-l1)) * 0.8 / (l2-l1), 0, 0.8) val = 1.0 if wl > 700: val = 1.0 * (((700-wl)/700.) + 1) elif wl < 400: val = wl * 1.0/400. #print hue, val color = pg.hsvColor(hue, 1.0, val) pen = pg.mkPen(color) return pen class ParamObj(object): # Just a helper for tracking parameters and responding to changes def __init__(self): self.__params = {} def __setitem__(self, item, val): self.setParam(item, val) def setParam(self, param, val): self.setParams(**{param:val}) def setParams(self, **params): """Set parameters for this optic. This is a good function to override for subclasses.""" self.__params.update(params) self.paramStateChanged() def paramStateChanged(self): pass def __getitem__(self, item): # bug in pyside 1.2.2 causes getitem to be called inside QGraphicsObject.parentItem: return self.getParam(item) # PySide bug: https://bugreports.qt.io/browse/PYSIDE-671 def __len__(self): # Workaround for PySide bug: https://bugreports.qt.io/browse/PYSIDE-671 return 0 def getParam(self, param): return self.__params[param] class Optic(pg.GraphicsObject, ParamObj): sigStateChanged = QtCore.Signal() def __init__(self, gitem, **params): ParamObj.__init__(self) pg.GraphicsObject.__init__(self) #, [0,0], [1,1]) self.gitem = gitem self.surfaces = gitem.surfaces gitem.setParentItem(self) self.roi = pg.ROI([0,0], [1,1]) self.roi.addRotateHandle([1, 1], [0.5, 0.5]) self.roi.setParentItem(self) defaults = { 'pos': Point(0,0), 'angle': 0, } defaults.update(params) self._ior_cache = {} self._connRoiChanged = self.roi.sigRegionChanged.connect(self.roiChanged) self.setParams(**defaults) def updateTransform(self): self.setPos(0, 0) tr = QtGui.QTransform() self.setTransform(tr.translate(Point(self['pos'])).rotate(self['angle'])) def setParam(self, param, val): ParamObj.setParam(self, param, val) def paramStateChanged(self): """Some parameters of the optic have changed.""" # Move graphics item self.gitem.setPos(Point(self['pos'])) self.gitem.resetTransform() self.gitem.setRotation(self['angle']) # Move ROI to match try: # workaround PYSIDE-2487 that affects PySide 6.5.3 by # disconnecting through a handle if isinstance(self._connRoiChanged, QtCore.QMetaObject.Connection): self.roi.sigRegionChanged.disconnect(self._connRoiChanged) else: # this branch is for PySide2 5.15 which returns a # boolean instead of a QMetaObject.Connection self.roi.sigRegionChanged.disconnect(self.roiChanged) br = self.gitem.boundingRect() o = self.gitem.mapToParent(br.topLeft()) self.roi.setAngle(self['angle']) self.roi.setPos(o) self.roi.setSize([br.width(), br.height()]) finally: self._connRoiChanged = self.roi.sigRegionChanged.connect(self.roiChanged) self.sigStateChanged.emit() def roiChanged(self, *args): pos = self.roi.pos() # rotate gitem temporarily so we can decide where it will need to move self.gitem.resetTransform() self.gitem.setRotation(self.roi.angle()) br = self.gitem.boundingRect() o1 = self.gitem.mapToParent(br.topLeft()) self.setParams(angle=self.roi.angle(), pos=pos + (self.gitem.pos() - o1)) def boundingRect(self): return QtCore.QRectF() def paint(self, p, *args): pass def ior(self, wavelength): return GLASSDB.ior(self['glass'], wavelength) class Lens(Optic): def __init__(self, **params): defaults = { 'dia': 25.4, ## diameter of lens 'r1': 50., ## positive means convex, use 0 for planar 'r2': 0, ## negative means convex 'd': 4.0, 'glass': 'N-BK7', 'reflect': False, } defaults.update(params) d = defaults.pop('d') defaults['x1'] = -d/2. defaults['x2'] = d/2. gitem = CircularSolid(brush=(100, 100, 130, 100), **defaults) Optic.__init__(self, gitem, **defaults) def propagateRay(self, ray): """Refract, reflect, absorb, and/or scatter ray. This function may create and return new rays""" """ NOTE:: We can probably use this to compute refractions faster: (from GLSL 120 docs) For the incident vector I and surface normal N, and the ratio of indices of refraction eta, return the refraction vector. The result is computed by k = 1.0 - eta * eta * (1.0 - dot(N, I) * dot(N, I)) if (k < 0.0) return genType(0.0) else return eta * I - (eta * dot(N, I) + sqrt(k)) * N The input parameters for the incident vector I and the surface normal N must already be normalized to get the desired results. eta == ratio of IORs For reflection: For the incident vector I and surface orientation N, returns the reflection direction: I – 2 ∗ dot(N, I) ∗ N N must already be normalized in order to achieve the desired result. """ iors = [self.ior(ray['wl']), 1.0] for i in [0,1]: surface = self.surfaces[i] ior = iors[i] p1, ai = surface.intersectRay(ray) if p1 is None: ray.setEnd(None) break p1 = surface.mapToItem(ray, p1) rd = ray['dir'] a1 = atan2(rd[1], rd[0]) try: ar = a1 - ai + asin((sin(ai) * ray['ior'] / ior)) except ValueError: ar = np.nan ray.setEnd(p1) dp = Point(cos(ar), sin(ar)) ray = Ray(parent=ray, ior=ior, dir=dp) return [ray] class Mirror(Optic): def __init__(self, **params): defaults = { 'r1': 0, 'r2': 0, 'd': 0.01, } defaults.update(params) d = defaults.pop('d') defaults['x1'] = -d/2. defaults['x2'] = d/2. gitem = CircularSolid(brush=(100,100,100,255), **defaults) Optic.__init__(self, gitem, **defaults) def propagateRay(self, ray): """Refract, reflect, absorb, and/or scatter ray. This function may create and return new rays""" surface = self.surfaces[0] p1, ai = surface.intersectRay(ray) if p1 is not None: p1 = surface.mapToItem(ray, p1) rd = ray['dir'] a1 = atan2(rd[1], rd[0]) ar = a1 + np.pi - 2 * ai ray.setEnd(p1) dp = Point(cos(ar), sin(ar)) ray = Ray(parent=ray, dir=dp) else: ray.setEnd(None) return [ray] class CircularSolid(pg.GraphicsObject, ParamObj): """GraphicsObject with two circular or flat surfaces.""" def __init__(self, pen=None, brush=None, **opts): """ Arguments for each surface are: x1,x2 - position of center of _physical surface_ r1,r2 - radius of curvature d1,d2 - diameter of optic """ defaults = dict(x1=-2, r1=100, d1=25.4, x2=2, r2=100, d2=25.4) defaults.update(opts) ParamObj.__init__(self) self.surfaces = [CircleSurface(defaults['r1'], defaults['d1']), CircleSurface(-defaults['r2'], defaults['d2'])] pg.GraphicsObject.__init__(self) for s in self.surfaces: s.setParentItem(self) if pen is None: self.pen = pg.mkPen((220,220,255,200), width=1, cosmetic=True) else: self.pen = pg.mkPen(pen) if brush is None: self.brush = pg.mkBrush((230, 230, 255, 30)) else: self.brush = pg.mkBrush(brush) self.setParams(**defaults) def paramStateChanged(self): self.updateSurfaces() def updateSurfaces(self): self.surfaces[0].setParams(self['r1'], self['d1']) self.surfaces[1].setParams(-self['r2'], self['d2']) self.surfaces[0].setPos(self['x1'], 0) self.surfaces[1].setPos(self['x2'], 0) self.path = QtGui.QPainterPath() self.path.connectPath(self.surfaces[0].path.translated(self.surfaces[0].pos())) self.path.connectPath(self.surfaces[1].path.translated(self.surfaces[1].pos()).toReversed()) self.path.closeSubpath() def boundingRect(self): return self.path.boundingRect() def shape(self): return self.path def paint(self, p, *args): p.setRenderHints(p.renderHints() | p.RenderHint.Antialiasing) p.setPen(self.pen) p.fillPath(self.path, self.brush) p.drawPath(self.path) class CircleSurface(pg.GraphicsObject): def __init__(self, radius=None, diameter=None): """center of physical surface is at 0,0 radius is the radius of the surface. If radius is None, the surface is flat. diameter is of the optic's edge.""" pg.GraphicsObject.__init__(self) self.r = radius self.d = diameter self.mkPath() def setParams(self, r, d): self.r = r self.d = d self.mkPath() def mkPath(self): self.prepareGeometryChange() r = self.r d = self.d h2 = d/2. self.path = QtGui.QPainterPath() if r == 0: ## flat surface self.path.moveTo(0, h2) self.path.lineTo(0, -h2) else: ## half-height of surface can't be larger than radius h2 = min(h2, abs(r)) arc = QtCore.QRectF(0, -r, r*2, r*2) a1 = degrees(asin(h2/r)) a2 = -2*a1 a1 += 180. self.path.arcMoveTo(arc, a1) self.path.arcTo(arc, a1, a2) self.h2 = h2 def boundingRect(self): return self.path.boundingRect() def paint(self, p, *args): return ## usually we let the optic draw. def intersectRay(self, ray): ## return the point of intersection and the angle of incidence #print "intersect ray" h = self.h2 r = self.r p, dir = ray.currentState(relativeTo=self) # position and angle of ray in local coords. #print " ray: ", p, dir p = p - Point(r, 0) ## move position so center of circle is at 0,0 #print " adj: ", p, r if r == 0: #print " flat" if dir[0] == 0: y = 0 else: y = p[1] - p[0] * dir[1]/dir[0] if abs(y) > h: return None, None else: return (Point(0, y), atan2(dir[1], dir[0])) else: #print " curve" ## find intersection of circle and line (quadratic formula) dx = dir[0] dy = dir[1] dr = hypot(dx, dy) # length D = p[0] * (p[1]+dy) - (p[0]+dx) * p[1] idr2 = 1.0 / dr**2 disc = r**2 * dr**2 - D**2 if disc < 0: return None, None disc2 = disc**0.5 if dy < 0: sgn = -1 else: sgn = 1 br = self.path.boundingRect() x1 = (D*dy + sgn*dx*disc2) * idr2 y1 = (-D*dx + abs(dy)*disc2) * idr2 if br.contains(x1+r, y1): pt = Point(x1, y1) else: x2 = (D*dy - sgn*dx*disc2) * idr2 y2 = (-D*dx - abs(dy)*disc2) * idr2 pt = Point(x2, y2) if not br.contains(x2+r, y2): return None, None norm = atan2(pt[1], pt[0]) if r < 0: norm += np.pi dp = p - pt ang = atan2(dp[1], dp[0]) return pt + Point(r, 0), ang-norm class Ray(pg.GraphicsObject, ParamObj): """Represents a single straight segment of a ray""" sigStateChanged = QtCore.Signal() def __init__(self, **params): ParamObj.__init__(self) defaults = { 'ior': 1.0, 'wl': 500, 'end': None, 'dir': Point(1,0), } self.params = {} pg.GraphicsObject.__init__(self) self.children = [] parent = params.get('parent', None) if parent is not None: defaults['start'] = parent['end'] defaults['wl'] = parent['wl'] self['ior'] = parent['ior'] self['dir'] = parent['dir'] parent.addChild(self) defaults.update(params) defaults['dir'] = Point(defaults['dir']) self.setParams(**defaults) self.mkPath() def clearChildren(self): for c in self.children: c.clearChildren() c.setParentItem(None) self.scene().removeItem(c) self.children = [] def paramStateChanged(self): pass def addChild(self, ch): self.children.append(ch) ch.setParentItem(self) def currentState(self, relativeTo=None): pos = self['start'] dir = self['dir'] if relativeTo is None: return pos, dir else: trans = self.itemTransform(relativeTo)[0] p1 = trans.map(pos) p2 = trans.map(pos + dir) return Point(p1), Point(p2-p1) def setEnd(self, end): self['end'] = end self.mkPath() def boundingRect(self): return self.path.boundingRect() def paint(self, p, *args): #p.setPen(pg.mkPen((255,0,0, 150))) p.setRenderHints(p.renderHints() | p.RenderHint.Antialiasing) p.setCompositionMode(p.CompositionMode.CompositionMode_Plus) p.setPen(wlPen(self['wl'])) p.drawPath(self.path) def mkPath(self): self.prepareGeometryChange() self.path = QtGui.QPainterPath() self.path.moveTo(self['start']) if self['end'] is not None: self.path.lineTo(self['end']) else: self.path.lineTo(self['start']+500*self['dir']) def trace(rays, optics): if len(optics) < 1 or len(rays) < 1: return for r in rays: r.clearChildren() o = optics[0] r2 = o.propagateRay(r) trace(r2, optics[1:]) class Tracer(QtCore.QObject): """ Simple ray tracer. Initialize with a list of rays and optics; calling trace() will cause rays to be extended by propagating them through each optic in sequence. """ def __init__(self, rays, optics): QtCore.QObject.__init__(self) self.optics = optics self.rays = rays for o in self.optics: o.sigStateChanged.connect(self.trace) self.trace() def trace(self): trace(self.rays, self.optics) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/optics/schott_glasses.csv.gz000066400000000000000000001105601457240071200271570ustar00rootroot00000000000000‹|n}Sschott_glasses.csví½Û²$×u$ø®¯(ãKKmyNíûå‘AjÖ£866ý% 6 À@Éô_3?Ð_6ËÝ׎Øq¢N¡ VK=-€¬Ìÿî»Ç×_<¾~÷ø‡/ÿðîñËo¾úæß¾ùí7_¼{ü">~‘¿È_ÆÇ/Óã—ùñ«ðøU|ü*=þ<<þ<>¾úü÷ûÅçZøú÷wO_}iïó;]ý‹ÞùæCOýìûoß}÷Ý›oþðý—¿ýü+ûêïþîï¾üí—ï¾þþñ›Ÿÿÿ)Õ·©†pÜΩ®ÛqöãþXóyÛ>fÝîçKÛyoKÇÍ:Λ¥7Ï—•óe%O(ç;”Pϛǽyž7ÏÈç7ÎíxY®ç½¹7ÏÈñ¼¹‹ó#Òùéüˆt~õäÃy8q{N»}NÜ^‡·×á´Ûý|i;ï]‡Ón®Ã‰›~8qó|Y9_¶'nžï°'o÷®Ã‰›çGäó¯Ã‰›ço]‡7ÏX‡7·cq~D:?"‘Ú~ ¿øãßþíWïÞü |ó§¿ø³Ç/ÿæñÉß<>û›ÇÏÿæñ×óøÕ»¯¿ûòûzüæwßÄüøMn¿|÷ù÷o~ûù>ÿ­=òæOû‡?ó»¾ùú‹?þöû/ÿÁîþSáòÏŸõ‡¿ÿüÍSÆa÷?’¾ñÿõÍ¿þÝû¾{óûo¾øãW´ÿó?{üõ7_~÷Ý7_¿ùöóï¿üæÍŸþ·ÿ÷ÏŸ~ýÍ7xó÷ŸûÅ×ÀØŸþå§öøùß~ûùw_Úó¶»ÿžúxóæk,‡ç‚[X Ï‘·jšöÍqËÂsÀ­ïqñ.¾ÅÅ/yñpÙrz¸ñ+\|‹w¸ø„|Êïpñ÷¸øvŠôA9&}Nší¹óÆú6©Œçüøú“'û({—'|ØÏÞ¼ùë7ß=¾ÿ™nýòñßúâñK¿õîñ…ßúÝã¿õåãïuë?àÅoÖm{ÃïÖm{ƒÿ°nÛ[ϱ79î··Ñý¿ÂGÞünÝüäñnÝ\Ÿþ+|üï~öø [2Ü¢ÿæÝï?ÿöÿþîñ«Ï¿÷øöÝWÏoþúÛ/ûîñþÍÓ_ÙB²‹Ÿÿæñ—ñôWòIzÄgÃY(¼.a2¶ {$—šs®óžS˜¡ç؛ݞ¹çÚcKv;„9{/yôˆ¿J¥†Þú#ÆøyÝ:žßbJ×5d].ÚØjã5ÎÖËEl×¶1ëÛ²]Û·àëjàJl­%¾ß(µ?ò!öÀf7ÒÀJ9à`•1°ÈÓ̃wöÀ…“xØbácIwê*•’ùL¾ FÌ‡Žª_U]ù¡Œ ö[r+ÏÙñWï>ÿÛø÷Ÿùõ—_ÿîÍïh¾ÿ§?¼{¤ô6½%`šáø/ó’{Ä)ëZêÄØZðä&ºLdøL.…É£3¹ÆµR¹B†Û ß"¦cþa?ÉûW¼£:o_Ž·žS[ý ÉÿBòÓŸ|RyÀrá Ý>%g;\¹?›9PC)4(qòÙ\ ÍŽ°ŒA¸;^¡ðë•Ú[Âÿ ÂÕŽH¶JÒsÌáVáfˇ6ä&>Öïl†á®€a8 \pNˆÏ® M;¶Âñ€på{.ûƒ@«|ÏÆËÑh,ÇØûÚß/7ë6ƉºÁ–øÐ;g^F\ö¦íèáÎ\³ÄíÃ^éý²Ý¾ôæ/È×àõ=…'vðùMËìNvK7ðCg}4;;u8jíhf`l×3sÿî…h¬}¥X/ÜÎGOD÷ 3óÚðÉëщvûòDc0di±¦q[´@siB}ºSæ®Ñhq€â¦µ‡•y¢Ö¾p´÷@ ŽC™©µüËPKÇÍwz{ïŒr_"7«R£^N(ÇŒ¿Æ˜BGÔ•™¦'^G¿Îº¶d?ÇB³dýCÀÃÂØ·ö;l)ÿɧÜjˆ™ÇÕŽ‡‚ölkÆ.í»åü–V-Ö6zàj´ ,µTK)4ö»ZÌ“ßÍœÀ’ìŒÒgƒBØÇ øÏ½t[ņ£æøíIøÍ„-¬½™$šàbÇÃñÛd‚¦@¬nd‰_·Í0ìÄ}ÓÈx_Ve¯‰é‚ÛÄo"~‰¬QÃi‘|ùßÝe]nFö‚Üqî£ÝPÌ{ê8QÌOϼùB ’¹®„™ûöá»I¾Ú}ËùðƳã¹?]xæÆÜ¸SËèÄâ_-:œX× ÈNû—‡¤cAÙáµ]óÑíxÓ®G{ü%ùh›@¥ÏUF ¹,£Ðż<]ka³|“׿ºL@ד Ø®«/ä4o ×€®¶DyL…Elzñï'éðÌÃ7ÇÓùHòG‚<ëæÈòGš/L.vßQi)»c5l ¸Cdw¦ó‰ð×.w?VÁ‰ÌbѦϑô{ƒèCßö‚µ§|Ø4ß½Š×.ëËï¯ï©oHÿO'4ó=-¶Zà¶—˜•vkm ý7ùÑm™¡64Oó€2[RØ?³5!\ÑPá*Ûx4ªyAS £êï1õ|·ù1†z[ŸîBjì´í5ÁËÅu-enRíÕö¦~B–ž7“ƒ'©" H3…‘ðZN‹…“?#‹ª8É>- Ò•V4×¢°|iÏ—„uµîµ_ÕmG7•·ãm²Ëÿå“Ïøs›¹}ÄŠ!±".¶ýÍ. dÙ]ü®jAÇèò÷íÔZÅÓ[l ê‹+D3)ršl;-ö”>íôµi¦Å?ü-ó÷Ý2g·ÌQHˆ]±ÛvM´}ÿ€V…¿g€=$.dE„Üe”‡êzå°w7Ê´àv|î°¡œ®vROF]™¶Ëx^އåÀØ(ç»ÉöVžú¬Ô–0 æŽÿìÎ~úµ“»µCè£,oÙ€·eÕr>ÞMvv<³uÜS¹¸¢m¡Çv°í_5_Ç•ÿÌ·1GÆ~y±¯S¹d+×ö[û¶ ž4Dµ0hEG®,J£:-`kUÛ¨¡‰®p7ç™jP <º\çiN&¯-2æu’Kl.M¾­W\[„ë¸ Ø'L{–+n~¡m‡+=#¾Ý(rž 3°çøK©‹Ã•îÊÒ‰KB®êu<›™Ñ¡ Ï4WšhÈAŸaá‡\gGi.±oØÏÈ-ò=~öSûæ¿üê«7ûî·ßüþÝ›/¿þ¯üòÛòÇ?ÿîÍ7÷æ¯>ÿú  ÷xóõ7ß¿ùOüý»¯¿x÷Å›¿ûæÛ7_¿ûÇ7_¼ûîËß}ý³GšoË[ ŸˆýÿÌsT‹ö;5v²§¹¨¸„ËÛßrs4§:õAŒÛ¡k£)Ú³!çÜ<Ο½Ú9ͨj[›$s u}Ø:¨ˆŠWf¬Œ•K üiîPü98ø‹GÔí°Î8g\t<:ïè¡¶¿¢¹«Îx»^º­Y» K”þhÈJe¨]9è𦯞ۧ‹¹L”ʪÛ&Â,¶þ^Î>Îp?Ã7å¥fP°«/ð1aô;ìIöpn"¾p Ø÷ÊÐÁ¹ t®é²Ø·«8[…í©L.òÛ&óDƒª#Џ6*+‡Àn~X®Š³ÜáVB×&ÑJÑf¡ÄH™Ú`´ymç¶P¹™hÓ°ÿ|3ÑãÈðýmIÎôx;Ýè<¾©ªÆyºÓô š[bí2=É¡f¬Y«o]V[gÌ\W<³ñ± =Ÿá ÷ë.ðgƒžýŒ<Û3^þ/úøÃ ·X¼¾eB)üɯþÉÖŽ¨XÆPkÀÎn•]ötX|;¨‚+`KÜblõ€8—”ÙûlÞV(í}lÙÎð@"Ìö Ûÿº­ŽeïãŠÄ³"qsß!?uãleÒNs=ï,ŒÜ—<>Ys¦Í:@€{ ʧçÀØÞd|V~j‰[,®¼×G³2µÊ\×èríèãzáRJI)× èËi­yÜ=îYù_*²n'Ðëönt¾ôÆgV.Úh‹õü†w·ø¶·.Ì# ´Ck©æôqoÄ‘äÎ)f¸G„÷˜íîQ›!OÊÀ4f¿ JÌ…÷œ˜›îY®­&¢ÕÜFfÇz©z‹Æãm¡Ú5¶ ^Wî*½+Xï£s×0O¢¥õ8”ª=+Æ]TI²dv'½šA›‰“UO¼3s·ˆUùµ•ë–S Š`ìrÄ»›úè¦>yPm‡¾[$RísíåJw··ý-ȆÔOTBˆÜë(Ø´†KóPryË\šsNël[¬9>]YÒ<Íû‰^·„í· j>ü#A3£Â [,¬NâWgÇjnŽÕ¹ÌsVÃÕ#Š{x¼gÏg>¢|„ßé'Gù“¾Â?\{­i7þ˜àõµBÐ+®¼g—•Rݪ`®üÄP†ÙQøÞeOÚýØbÕkþ¼6–-ë=âèÎ÷Ééúì8]ò݈±þB.„nIS®á´FìˆfÈi¾Rfö;é #pE҃멬v«Š [댌Ízz–\‘¯9‡Y×þ÷¨ªEd® YòX”5OYÙô©ZUp+'÷†,ó™ý.‰‘ŒÝ(rÒ‹jV:Dæ²Ë&óDâ«ñæ=%žeàKS$ÍÒU t—¶ª'/L½ˆ/éoƒ;~O€Éú`v,N™\DÙ¿þõ'ü¡ Ûq`ÃD ó~SE… 2"9šK“²ÜZñ¥˜³-æ¹A;¾J{õÊìÉøv1t;’Ù¾¾­ê5æ^Vñ*&÷²P£*\Çò²³§Çê‘èÞ`š<ø<ÒÝu ë%g¹Š.fAðËðÅ› ÎÛ¯¬Ö¢v»ç5ü@{vlÍ_ÜêWñÌ‹)#6T Ï{&þžô¾W¦?Æ¿—Íõ=yÉ\Á¾—Ç“ŒHºd¾•›¨A›ûP7„52d‘%hY+;Ѫfñ #c5”KY¯4¯séÊ\™;­Ì•ðn¡0qiðïJdEí UûB‘ÿw]ÆL Uí=i¿È Ýk›´ãµOí3Ìtâ9êÙrWÔœD®©‘ádR’3ÉѬ¾ÿ«‚’*Ÿb>9Ñ]¼„­¼„êWæñø±TñÙŒàÆ«ºe[ýó+à|Ð.£ ]˜ìþÏO¿øù'ª¶÷ 8¤#þ/d’Ò°›æéI3Û €ÁÔ6T$ú öCbjžŽO¶í™o„çb›êÀù ¿ÂHã|öé>t+gV’ç»Gñ°E,ÙåUÍêGt|‚µÕèqDÇáx zºÌ‹Øôµ‹ãœÁJ‘'ª¨=¶€ù’ë.ʷڕ燷ø–{œ‡Êaó£µgÈY+gíê…­M¹Ò0ßýƒ×bxÁ±Ÿ_É=hB\~t”MÖ‡2þ¬S¡R»EÌÀjqÖ}}à«·š*T¼¨#Wf«½Û™~ÐÌ'3MàòVÆÈI±p˜ºîD[c2…×Jœ™9UBÍŒƒÇÂC±pQðÖƒ·9ïk• 7•CFPBÍŽ:ïŸóãèÂì2) 3ã‰KakL¢Š 7»"Õ˜ÃÌçD…ËY†ÚŸSe¯‘ös\Œõ Nƒõþ®ýp;$¶Í™)MHY!z%øä-Ty …ë’¸šå:±g¶Ñ¶"¹Å† qñ™?Dçµ03 UQJPÁ”"ÎÌNSžnM“[Ói/4¨¡æ;‚#a”œ ’Ž u¼˜æáîfGÛù@Þ°¸²WQ9í ÈÒn?V‘§)ì¤úžº‘=.¯²Uñ\é;øú™«ç­’ñwÌ¥Œ¼AØ?ï5ÜÝýÜ[1Ë¿ÊFŠ,˜«–§W´ÓKÜ©6¹5 P;ÿu¦_;‹-žn§œ­ùΈxÀÉ:¢ôjÅémhçÎòjgpއ[»Yª¬™{©¶~ÄõHJT‡$æVpnÇe’óQœÙ%œ›[+o×Þ`ÃY wwƒÕZäI L³Ë‰å•‰ì¸Si*`õb ‹öÂè†×+^+Rxˆ³kxÉvœìVq·,ÈÑ£·ÝLßÙ~òü¶áâÒv]`NÕ2‹rA9CÝ×nDÑßð›m\õçd{PÊç0Ü”T˜7oÌ IR5¢@{g;g\ë¹8ÝíïbЭªÆÊôùÃó@d>lb?hZ«¢¤ðôá)Uщ¸¼Å¡nîvªÆîÚîÜH!Ž÷×v".žøB´ÒR|f¾’4v‡5ÊfÄ^õ˜÷{vØ¥vÊ Äô›C¤Î¾©ðx-!æ3m™;[X('u&†jLÈ g`¦Jk—§Š—ˆ’"a 3•¦¨Q¹)…›»ÌRQ=ÇŒ›–béJ)“Ý Ô±–¦’P×¥J*UQÊØ)Y]u¢Ö{kìÊʯŠJXCU´{aH^)ê¼, vòÃì°üQûîkº¹KéZbC³¯kŸü ÇyAï°vUÛÉh"†Fð›X)̃æÎ Å´Ü4&̧íUÔšd9z±÷¨Ý>—‰É’¿"È;e`C O:EsUAè Ȥ•lBß+1[ƒÍ„{™³ qó°vÝ£;OåØ^ÛœÍ4ÒníŠûŒ¶Ò8pW½RêTää8øº‡|Hd…‡ð'Uîà]É‘°Õ.få^ Ùª¢w@¾JeRôÆgæÓ*ûšøüвâ`Žnø‹ö˜óµ¼ÍŸi«¦ÊeNj¤ m¤K“é™ÅàqÒ²´‹tMÉ5ëh‡ÿdÃß4]t)û'wÍ– :A“NÓ/JËØ¢æßµŠSh`£ãj¥ÈËEääÖ»îŸâ¶9EfÅv¹/p¦iô¾"]Ë÷SÏŸ=ºC+æS3´¶ƒèDê3£ó=°Õ.FßÝœ[':Â…;œ}O¦zt$̉U|™¼J#¯‹èî …<íeUOž¬l­›ÔŒ¢°ñŒ’Ò#öEQt`ó8eœe¦»`Ó&Y,æ¡”GNoéا˜çÊMÞÞÆ¨Î‹EEh*£„ìµE?ôÌG³rÛÃc´Sífg’fÙÒˆlóq§›Ò(ÐçÅvˆ2®‘OÞÌæÁ©ªH€ÃáÌæó‘Ó®ž/?™$½’èü8²±r¹ac·¯÷ èÎ…Ê·ËüwŽ”Qᬌ\Å#%{á!—õ‡«*Í›™®‚ª¥",ªÖç5—UpY¤Eûiˆš3”‹Ò6–ã1]ÅÅ|BšARââ }¡&¥kšQÔÂ9” M ªrU[Yöö[v|~ê2ËSH½¬l\7%déËbçˆQ×ÕµÉw ;3Ú Zsì§ÁýV>#+%àU*ýê\ceMrpb¢SyÒz›"†Ù+YÎH+D6Óh½e¯´ OÉ:Ç?”uµh!ÂÓÆ”PGJè@¶ TC…¬ŽJ­vVq +×Þ2%ì Em^öµzRòÑ]UéÈ6ÛÛíÀòëß`ÎJÄñ3'y¶ŠNí"1–rð˜ò" /ãì1=!ÂÊÊ–®õHÅ£ù nGº6œÆp¾/MJh?VG’ ò–)ò¦ d‰Çăj§¹iòÜì¤MpVP®WôG\“ßM U2K•{ ²0¯›X»*!hø‘IœZõJªr>¨¤êþÑï ×Uæîm#úuSåeÂÔÞsðÞTó@ä w…ž9]M¯èr;†‚T­û<7½ª¤45r#C±ÑéPŒùEüºÜq@í·_œêè“_¢šñ”33h|ó3^d>è$ÕéóˆÔ”²¶…vUËþT Ù j@œMg9[ðÐS@i:Ls³z†yÍ«¯ôåS×áíÕê%ÐHJÃbQ†š5ÝK.úâQ1™šÛA9,^1ñWdVLlÁ©™ž-{Åd__èÞǺµÎx$)hÞj(|×<.)$åTE\“ÝüŒûüZéµn¨”ägщã¶ôÏ”87æ¹"ðh\M­þ8QÈßšê ¬°ôªµÀjh‚_•kÑaæ”$yäËnv ʯì0søuÿ{Š pY¬Š’=ZnJçàžñôfÞõãˆÆ^ÅÿeP|ú¹©©›':,ÕÚ©ó¥œôûm[àSª÷ðñíŠúô˜M›xUMæ-­DÞ5ŸÁczë:Ǩô¬ &ÃÙ2ù`í`§a^d·Ð£ýp¤qá‹Ö`ß()Ø`TV%7l§Œ¶Èa¸ìàoËJ/ÁnY­;!y°;^¤vÙ°ã©Ýz8µý¨ÄŽ/uÎÔTÞª)¬©ÜjÃ8Ýb§ÿ÷-ø»XŸ|ézà<`¥xúv'òý•ßÀ6·ç˜˜¤[}:2Å»ÂÅݽ½ó®d±7Ûñ9bÓ4®¬â.W»SÜ[ŒµÂ•‚?˪ ›©¸fÔTÌ=‡m_2—ªŽÒwU§\Ï߼ƱȺ.Ê×¢VÛâ¾ié~ÿ¾2ñ"r‘Ù^™P/Ï4=6ð%Ïã5™Nkø<ÈÉË,¥Ú/d"»¼v'džÂ¼ñ ½Ÿ§-¾[Gtr '­3ö¶¿ÊC•ýûLr2­uöÂâg’l)?J|«ãÜìƒy<#óÈ̶‹¦Ó… ¥Ø·¢YpâÍš#Uíi"Jƒ/pôØ´èõ“Þou¯S¥"®¶™èÖÏ>Ó}O¯œ”£{½„Ÿ~í^_Ä>äo+ó¸*âÉúíÝåcwL·{ü²o&Ey×x¼ÖÐpZ9ï®=®íÙÛÇâ¨oÜßìWn>ð%äÝ &aû"jó©‡mó:efÎ@ü­ÍÎÝ,Ù4÷¹GgÛŒšu :X=(zb¥³’™u ™?Už5£e‡Õ‘,’@º®j$¯Aâ']Ï N'4'Ö7¡ïº,YQ•¥&B½mÿêç^¤EiN d,A6J={Ó=Ϧ(pªZ’ÄHUä'åÒ}¯ØB¯ä []yÉ9c|e¸˜ñž·ýìñ‚Cñ É0‹»7p7b;rh‰>ì›I·„»²²Xv£6od³]vöÆ’héJv;ÈBZ1`²±@ֲ켬 [µG4{C‹—B†/éíèLG‹y¥5cQÃI9}‹û,¯@в¾I(íÝ*is"Çåí¥ˆ|^(I/xÎÇÙ"?áç=ÅÇy^^UúùZç²K¸åô%EÚóB Ó©GSéïe²”ˆ…ë×ÆŽƒºKÍvÒÖãW4tŽ; G´™¬ F›Þ§ÖX)Šè2^‡²Køˆ~3‡ǜޗ¦>¶ò¸/Nä›úÔb÷¾µ¦\|’ ‡£œ€ëCÎUþ½ ©pEG1©¸|°ä@ë¬/ŠNîzÓe½HIÂQ•NõäjN‡iÛ©±vøìW"¸Ù¾á§Þ'ßyT 9 A5ô–Ø¥¡ßjØŽbVމ¾œlc.êgŸh˜ Ý¿Av4ìH)¼m1Ú_fÀç´ãb¦63Åž^(=$%^ðXížda%Y ûáÖ׌ä¦Gpyó%ãQP‰Gàš§c¸0UÀ÷TŒgXÃfhn錋s¹+=ì^`¸Ý¯#ÖÎK¹žEŒïó;xOx\ìKUö==ãßìNšû˜äé‡/Ëí2nß2ßAd¢Ânæ˜Ä{ /̦s>ºGWÃë ˆõ[yå´…L~AÑ™@ø¸Ã–ÞŠ -(¤Žô÷Rxˆú{–(YZ»vE )ín+ÞPRîÕà®6sáØ¼To#÷”úQø@j}5׸r­]æ7† á š¨8eŠÑ£@RžmW?‹a‘.Hôvñá Ï\Ž|y— LÈê‹ò~c#Ô½ÀËïE—zhÊPÃð?šá ?ZFåyGC6;™Ô1›£y ™™3Ö6•¸±ƒ­ÆEm”g&;B†[߸Ï:.«{ œ@¢»,)µF¦‚”6)µt¸®^^=‹¦Y¼ øˆ{~–;þ1½¨*J;ãÂÐksq&÷û_Ã~Úн•F½òHD+fYLè‰Gɨ³Ï­óÛ?ä_ª~Ò^nT^99»Íœ;¨u8%å“÷4¬NH½ChÙù¯«E]|±H_졇$É ·åt½.ÜNá{–y•}hÍ•X”Ë ^K‰IÍ)±¨ŠêNkº¿õ|[Ù€iÊ’}HÊ%5©ø”cÊMRQ%u…Eæü¦Sþ!TÕ1FtÎ22Tü«Ë^só®b òóùX êV©Í-;·ó®ö{ü@GM]HÀ^Èíη³¥šwQ2I,LI#:ž©ŽøïÑEü¢êžÉãˆ>_>ú±Œ‚½ûc³ÝMâV,Aˆ7%’kÊgETt:e“öíäŸ'“ø1´ˆr~AQZD+•&‘"3ï?û Ñÿ :…·P`<žÑbƹKê´0×do ² ±7ÍVïj¬Mdl°˜Íé:ê ëò/‹±¦.Qœ [¡y½Ø8s)öå{çê!pY!ð¡åÒ²c9ú µ££cìÈæf ©­4ïÊ'í¢õ€:œo ±ÐÛSwkÉ^Üø.N v1½{7¨h±[<Ü·t“XýtöþФÛÏ×_¸ñnwÛ+±rðFœÜxÅÀÝëèÜ6ÔÏ0o=)Ëw6¿€]ðSî@c<Ô´¤ï9<‡Ë£ÉÚãÒ>,«ö¨Ý56罋°<@Ž)‰òW%Ø«RS±Uïît¢ï¾Fã{•Lù>(Ø"àà}ô=IÃ1óP"ˆ«Ç›øâ¼§\GWpS.3[‡d«“UÄ(ºò`·¢EB¥¨Û<’T «»ÃŸ|*-*‰Û؆mŽÊgtŸ9x¸‹4÷Të¸ÙMÛªFr© > îÙ?eåg ’sÄ‚&ŸÙÌY€‘O]](:#«ª*g¬FW6lKûÌs»O´zOÑ…ÍÀ("ÄžˆÃ'ZÖ'ƾ‡,ZãýºÌ¼ Û;ÚOK3»Î7€‘fà²Ñå=Û«‚È¥¸¿ûÂw%´ûå=žÜc׎Ïõ8xçEßÍU‘t¶QßÊ%¯Ê ŒŸü“áÖ*Œ»pƒá óˆëPýç H©SX]!‘¢+¶ñA_KÅÆoÀzBQ¦–¯–Ná4Úׇ®;í`éÙ53V¥Oý=\qðÐLtᵦÅÞXýÄâÏ7ÀŽ'¨Ss¶éšŠ.ÈV¼ëxf•KZ–Úù©@Äí¡œ”wt6-¤œª’\.Ý5ȨóVEí9ªcžFÕPì¢/"90>€÷ƒIKÂ=9AxueŸEÄF¿·ýÆ5;ößýñËï?Ç0 h­üáÛw¿ý’~ÿÍW_|ùõïàe—·Ò¶sVéÅ0µeÄŸëøU)!u;£ Ü.u$¹Üc²³"ò2a±D…Y¥™WÓšoPovZb´sÔ鋘×óÜìfb–·b÷`eh² ”}ÓèÅ“dÅØÉŸH…x’•fV*ȼl¼,¼Ä¶@–Õ…Vžº_>ÚyYy™øœÁG+/ß’ø|,Ëê!õ%°¾Ó_k¿KµÝÃkܳõÅp,T™å È^o[U¤¹µŠ÷Ý›xÍ«¾{áÃN¬çÖ¶{áܧT$.RUob²q§P½IV¿¦MË%ƒÝÉ´²Ô“¢NDb\7Ðå£ÚаÕÍt7 5pÙ"ëJ§5 ¨öÉ´µ]O>6m¹ëï2|Ó8W‹/úx[üTq¬.ÈÊt;$It£&Œ¢d„|‰ÎcGa¨y…H…¸$zS-NµðP›ƒx½¨8%U³ªæ´T«oî”ó™H¢ÁKž(«.D¡ª”Rèæ Ul¨=g;Þ¹=ĦúIJï5 Û>4¹`,4o@OæeJ}¡»< 6—¥s>«Ü)Ú|%/ª/ãNKÞñ}ç Æ——v£ü|q T«¢W¼¹-Iç7ÝИ¿ê¿ÜÕšþyi‚;qC>‚¾[8ðï$ZEá«Æ|õõmÕ¢&ŽT÷”¡"ŸY°rå`7f¯.Ë27W/v[?.:]ÍX±ººñ·#:7#y4|‹8Þ3®Õ³¾³2àY¹W³!S$®Úñxc¤ì™n»iHÉ¥ú9AØ; èr³€$©<©C¡ú˜ƒÅGæ3ÛâS-é&×O:¥UÛÊ~VèÐ9Ûe|ú‰k=ë(&ˆWü,\¦“S§‰K†aV¥´ºò¼öE‡ÏM°/~« NSè Nlå°Ï€1o.ˆ\ʲïaé*²÷IµƒðÁhýè4˜'ˆç)Üt¶óñr 5_+ŽW«k:|ŸíÄDZsªî¤¥{Ò,l¨U[©³—ÂkÊ;·±°»äάb˜åÄÇ‹áþ±täý‹©îÖ˜zãºÄ{å:¦;³Ê‘(©Šž¯ Ÿy£Vë¦Ä*¬‹2mÝ cpÃèÙ2Ec÷ìØÑÝ—O-lzù)({f±§°êu«ËªeVL{BŽqeÇ” Þk0ӅЬ2¨ÈÞÛ#^aÙ%TíJÍbT%e_ku¤׌ÀÛäÖ¬‡¬BU×út,gÔ&*ë#/° Ácµ vמ„JUIˆÙ‹²KM6›ÇŸ˜wMÂÈ4G4Ç;öìP± \]æÈ"§Ç!.pʲÚlj/Ù› ×nI+Aš÷ ÔOìŒÅ´¬é“W¥ÆâA¿JGí8HÊUcDì.<´2’,¥»Í: î >›u*þÆ8ÑèÓ9xO=û¼Ã]øäIC%Ö—¶U}×]lOÄ8?º*uÙ5¶N†Kû¾ Ðt‹%±•Ôw_6Ûɳ‰“„In2•D± °:nqáœ]·­åÙG†4çɵĤÁhͼÛt¨ܖϲly݉fõèù«»AO‡¸qÙºò1óoÏžßÁž?a”­eA*Ü þJƒîÞCçÊb7óQº5ˆk;‘NMXVüt²«$Îô ²àããÙ%{ÎKÞdû–)÷Y¡g+¾71´­G÷…Ýv($í2ââøyópÞ¹ éáú ÑæYM½º”_’¬á˜Ý»~„óéIX^«°…é‚Ps¨0$ØÝ¢_Ö-p$ÈF÷˜@wGUžrf§§û5ÍβnO˜Ö( ¯.3»U]bH©oeŽ«î¤ìYlÖN§ûä±·ÄƾÔOu= .±ø9¯ðÃ{å¼"s⡵ã’–ß;‰ð˜ÐžG̬*EÁô3v’Í\G‘HEÃV’Üò‰6É<–Ôq-ØÀ ŠBxC`bæòpÌÕ†”l©;–Çt©CPñ˜CÜ,ï#ú–çíVQâ´íàN¼»óÃG”x;/¢rñTqÎÄ­N'â–7þô{2Û»¦[9±§6"e©6f·sº‘Ïs÷cDzSaÒæ-{¨ü–oá±ûÞ{Þ}«û|Épìâ/CÉó=Q3[!PÄA9IDÖîé-èáøN×V,ùu`"n:=B¥èÔiê4«%Îw BlYc ÉÕ%kÇ÷·U)Å(ŸÛKâ]‚æKà]u›EÒŠém7ÛÕƒ«Ÿ,¥7'‚*%*Ì‹$Z]è­ˆr—](NÛµ%p½à¸¦|­Y$Êë4Õs,VgùX$›Yâ)i˜ê’™  H·í”‹Ìêb‰+õùb&DnDh¨œC“&%HšÎüëá­“¶Ó3Î þ¢Ë Ì »¿³Lm‘l2©U%iÆ. sæµ¥ež„y7É{ŸSqÛš.™ãvx’Ëçzž²8ì³ÉyBé]Ä—ô÷.ß¼AçÞÖ¾÷÷îÝNg‚kn›‚ÒáÞŽQΔ—X©»:ꢈŒ¶·úîßå#š|ߣ·ÅÚ^ÒÙP¬¼—h¨~‹'Pß‹eì™vrÐâÚ˜‘à2 /¥S8û¶«ˆ>jW‡†„Q» ¥š±RGÆT=‡tjæLKPøwp´åE»ÇJ‹‚ÉÎO˜Í¾.]vbh¼@nÙ' ©s£v=èmü[´º$ x‘»a•Xñtî‰ðÆO‹%WÌQˆR¼1Š1wô¹0—TÅËqñ˜áÇ9zý£"iGss4“¨^æ_ÿœt²^ÔUØA €o {*ªè›Í-)‰Nf{S%“  MØç#ØWŽ<Ð4Ɇxõ»ê A­ý)KЫɧúµçChµ,¤Ç•,s•ã ×8¬©~"«¬ùÎ/{ŠžÌ^}ë É.Ž ½q8LdH1gnQ¯3O^+=o|ï½M'šòŒªØ­ò¥ÊNJ–»ÖñeL‡3C$θºï|•×)û# kƒ9Õ3Ô©:“’åRA£kË`Cؽ¦g5'õ«¡lA†î EW ;0U•LŠ5V@SS®±4MA× G¹žTê9øÄQ3;¤u­&©(O‡Áìù¶`ÕÊdY¯ÞlKNè&ðn{êA¸Åœ GY×Þ›¥jÃì½V+V½&¨gªFWšÚ7Õ]‡T˜y9Óm5ê÷kÛ'‹Ò‹ý7¹$Î>«êÈä/C¿dF3#†w¿Ý\2=ñ›‡ÈR“'ÕûdA²MÎL« ²f¦º=]‘R´Ã52R8ãLÔÉ]ÎG“Õ’¨ó!>m ñ‰ ‹ùUÇ‘­GÙ·ì -—ÓHGØ»rÛnO_{œä %`§Q«Úû0qo´¸å±|¦¢^÷EyN»B!FŠÌ x¯Êÿ—™ ^áŠ2ŠËäG4Tm|±1Ò¼7Xjj™’O|ªØ)öR~ûVéDF¥´†0Š&~µQ)FHÞ š$ù(ÒQ­ŠÇYsyˆš…¦¦–¦n—¨B¯#ÑT4÷g=ßך]ó샡Ç;SÑ×µ‹ëéͰ*9™óÇÝÔ6µç5ÁQ:³£Ô HÇ%½ò¼€´JMžTÊNeà¦Ñ?ª<¥&ñ5}p€Ìn07ô*Y>t €ÛÏ(½’‘ºç„)¬5HÕû9|››èÊ6Ëi¾ ¤Ð³É"wesÑ{×þ«­÷€¡0™ ÊúÑùbò—}ü€C]ã+Ýä¶øØqé&׃Ë|ÖÖÀ7Ž˜µuFª¦üb0mžÃáNܹæqqêV ÛœMê¦Ã:HÇ@T;ÂI‰¦¾Ó&î•ÕíÒÉZŠðN ôäY^±Ò@ì†#\£¬$†ä#CÚÐÊ·Ó˜Rµ®,sþ1…໹ǵžAÓ06´òË ÚpiJmþœ ¥ ·¨LA7¦œÑ¬Ü|ž Þñ  ðp‰G5ê8¨If®Lv4˜‡ªÕÕDÁî­±æ‹yY|Ü»ü °E€àäµ*ã×ëúÅõкž“1&tu¨±o™ª.ºEˆCE&Ö°8IæT"ž©’Ã7V“$ŽãCRü™>G@ñFr¾¶OήÞ˸jÃ}eœ-\¶[B'¹ýG¼`ÜésâŠÃ¹Èkœ¸YI´JB¦³He`¨¶„tSSÆ [Ížr˶_ÖäR´ÂÛv¤2—Ì©Lv Ãfí|`_ϧŒG8dÒ”¾Au‘‡tT—+꺮ž@Þ!øZwòžF¾¥hï äxÆ­€LŠ€Â5™¼$TÝ5ö—†ãkÐÜ‹Caûž½w‚RŸ(¶¯L.®Â½r¯l¨`ÕWRÍ1•D@»¢¸ o’ê=8üZáï“tèáq#hJ}JM˜m´JÑC)N Z‹Æ\†è‹Ö'Tï‹XήRd…›Tèn;½c ÔrÁ¢ÝÑ#$–žò‹MXÔÎ¥Ñ2cºÒ•³œzºÎ-€ \ýi–ô%PVdš}Ë €Â àIát#»t6C‡Oa'Òb“ImTW1"E;¼Ý RUä® •&|—©<£4Êõ%+™žèMˆe ,ˆÉ±H< â)“°ŠOíÂaäÃã˜/ݺ~«²˜•ý…ƒ]7l,–”À±æ}²îUí™{Ò(m4‹¾A0ž5  ˆåÂ},9r5#¾Ö´pJ_Ûä:óžxj‰¨|Óšµ±µSëðsOÀ¡BÓ'¥y$Z$;>±ý¡ž3«ËÖþrþ#Ù½V·hI–¯›®Xe!”RJJ“ï*ôy³QŸ…z=xŒîËÖÛ²…S•º|[i6–WàãJGd Óáã>þy'ÁHû*HnçeêˆG®øƒ¼µ,$oë<†Ú1ˆ@ChÞ©xÎËzò»éëbÐQÀÕ3ÜÞŸ}äéòÃc¤=Õ–Ñ}9Fš•žx4¥©×Ø6º4T‰H¶9E1”€Ò{]r[Ý\cý:Ûö,@n [t$7v´­rŽK©?Eê¸å­ï¡ÓV©§‰&’øˆ‡@R¢)zZ«_¡ˆi±¤]Û!$µ-Œ%QÅvl¥ž÷Œµ¼)£ŽÍ(ofzg.KÅY‚ù˜(ò±Q–VFXŒmcr¼G,òÖ316ßÛçDŸ¤ei7KwÀI¹ÑEñmúÞëéèƒð/£ ÿ9\YѦħó,ìÌò;¢£éàªÃ‰t°$%l‰È…>·,ªÒ¶EYÖ¤ûÉ·¥å”…]‰ª VúWJP;÷ÒÅ“©µœ–5ÅêµSï³ì7T/Ì&o«m©Û ·¾ÊgYÖ¥n7¼…AY%)8'ú›ûùÀW.˜™tΪnV¥¬Õ“Æø™ž -Íc—Å•ÈÀ±cNmíƒfœ†«é_½›E·ÍŒÆ†*Ü@°m\î%,ÑÅÍ‹î4ª/Ãy½]éN^V GÊ÷1¡ à³½GA¹Ágö”/—²ÚòÊ{Zû÷PóÞI¼g’öêåFµ78æÓ|_†ß­î;õÖ¼¯¿ÿÃÝ÷ùbX·׎IUcÔV.¬û°§IÅÁœï l¼RaÜ °mA' ®©*‘˜4cj0]jÌ÷æ[ ‚Berå:¡+ ù­Q“´:*~¼nÅQô¸ý¯+מ.ÎAõÓ¬A†^e¥*”ô‹Z¤€…ù“*¿ˆ"^5Øñr•{«ÊZPl)0j²3ëäÅ8åh¨D¼kai(¯4¯»¾˜Ÿk?£š=BáöŽ·Iö²¶<~¨YEî-î{,¨j8¶PÁ¶b…Fp…ž¡YíTC^GŽ€~ <šûNÆí§*ƒ‡vŸ$Þƒ†uši‰›çCò.- €prôþ·[wYO!DŸ¢Ë¤í)BÇVp%±¤¯4‘¢Aq!V,ºsw÷fÁbƒÑØ(‰ž’#¼¡6Žp÷nïÍ®/¸+”²&‹ì%ÜÝé}%\¾LDˆçf²;Æîkƒâ'Ên[š— dÉKÏîgç–PH¹Á#›>ÔÂ6(p×Vj3Â%ù]êµGt×$éZ|ðŒ)ˆ­¤ItÁÙ®%\ =E-cìº,gn E˜áj›2ºÐÇT-w¨¦k>p<éÆfåÛbWíE mM?ÎÁsfk6 VwĨóß5›€\S­<…MÊ®¬Zj¼9al6ô ÐæóR³摜 jÿÃÀ¢õ•–ãhßÍ["ìg¶¦þGèô¥á~"BYá· %r LÅ"n¤qH&6³ö$œQ¼e / t jÑaudÿÓCâa-—ó‹ñ_»õ=¦‡à͸ÿ>V‘DmÏÞßöÔч»nwå!"žïP•øÙŒ¬Ì÷6^“.½ç¾l©#"¨¹˜G>?åB×guw^±²ºó|©ËŠúá^]µ¡B†»m2Àù…Μ^€Z+ÚÄÌCã@EhN­êªÈ†µ' jÄæWg>Wv(À5üÉÌL™Msí¦ãPdFÎá*VãÐe5ŸzÿÎÉ6ÀirÔÅk}©·vT]p6yÞV³à˜wf³­WYÕl›ÔÃ%¡ 9huh0_-×v)¨!9ÍØ™a¡¹ËCLKÍ:f~Í1NÆÞOø&ŸêlM0I=uÂõYö7%Lèý€M8²„K0³ W½j`pYô"ªÃf¿cª©¯C‹¯]ñÅJ¢´·Ìn2‹ó”Ú®L÷´.9o ë Á»qÏ!^«C ^yÈêŠûÏàÑÛæû=å´5È]”svz®Úðä’ŠN¼qŸ¼†ßI'ÙÙ/W?VlwóÝÎù¨)Ñ÷ž€­'~ï ðY#|7iPNUøµôøµIxrau“[ÜL”RàI,U¹ºÌÈÙûøZh#"¸ÑljÒh³ØÑù«C×]ãjÓ@{Ž²Â¹J^:woëó×gEiXÄᶘ#ÇÝêþQEAvëv©>lºûµSËÐŒ÷ÕpY̸ži_Ðñ›Ïœ7Ó*[>f¯îT÷c´fŒÍÙ衬¸¤ãœ5Üö°ÁM6XmŠê’$þsŽÖôÌ‚×uê"+޳|iTŒQV6›ŠüõK>â§9ÿœÑ{&Ü“NN /ík¬¬Á66åH,TanŽÁqüj/ÿšë±<õE`jîŒ#ɉÎìbW“ln{¥[3ÓÊO-':¬ _c¸]D<ìñ¼‚´8óðQ·LU?¦ƒô• ì&†4­úõî!åîLï÷Ë1ÝÉ›}¯ÀîjЪŒ«¡;à#ÅÇkÔûñ%Ø»-ßùÞÇÃgª9\bäšýJÀ•2ëâÙ:/‚ùãa#¸­è—ÑZu¾žhl¬UüÇñ¹ÎŒe8õkÉ3òš£ÐU…-ѯ5à ëNŒ‰àõ¤ çW'+^Ö1rÅêõéÀüƒª!öÿ("3* îcUá(‹[1³†•Í*+›åJS.–íÊ!»A–-šš¨I¢¢>Ôáe^óJ¢ËdÌk¼HŒƒTx²ånÇý‘`!ìz"ùüåN’¦‹Q™æ’;üifþP¼:Çuškà ÑnÔdÛ]øÇr´D“ÁÎÆ éìŸw΢†‘ã皤¹˜Å£Ü2ÒÁÝûŒ°"Ùrôé·Î'Û©nÀïìÆ;ì„ñØ`Üî*S·ó}PßÅGÝ$böF['žGÃuUq9½["ëtßÒÄ>Eéµø56Å^œÒí°}Y>gkÌóX³°d…¸H“ Qq\Ú¡Íø÷`×µsÉñC‘—E!œ}Ò9I=¶/©óÀ³@–¢@œÞdF@T g —ä×CÌäœï/Q 0—E“Ò¨ëëÒ&]JDZu‚¤†9ô>3OµÜ;¢(G !"¸KßÀ-î—[Ò.XU Ïkàηì´$¶_·÷â:#ùEªzÔ Üõw};Ô<‰C£C\!ÿT»ENP”bÔ9ïG«pTÕÁ|–§c‚.Ÿ¼~D ,zÀÌ}ò·ÃÌ”ÁQÒlÞØ2r˜D.-u!Ÿ‘–:-KÝ¢C<Xu‹G܆å†#ÖŽÎAñH†Ícg˜„9Nˆ÷â{Â뵤ðÞ×7ˆK¦·ëÞéÃ÷ßçUÈñaÞw¿ýÄyÚp¾§¾^#7î÷ìɹ®|1ß·fz~{±µTþYAiÜ(ÚŸ§kÊc À_8ÁánÿÔŸ({Njy.±HIó°åšj6ÜMžM¢à0Ù+NE¶c¸~ÅÍèIŠïvݵ®ÛZßá¾Î¹mo#JjÒx^ÌZ[2ié®EÝG®ÎI³-¸çÜ•tR~É»êÔs±å–½] Õ$MWoÿ{9;«P¡9ƒÉç`Ï—•©é\Œv³æ©$yjŽ<ªÆª DÅ+˜ºø¨‡Û.!EW5Ü3Úæ’v©ÁDV묛áÔj³NànxÊÎ~¶ÅÝ¡â$P»]9RNy÷¶z§bmê)ŽôÐ=3–|ïBÓu‰Q{´½Ò_®S½z÷’תΨû),=:dþn|×w™ª‡æµï‰cïݹ[Š{¯;+Òö¼r–¬yƒª1*»Òõ5‰¢¨’ÈÑ.ewRÕVû¨)7£þªÚ¥òC$vÄ:6ß_=1’hr¾]]3²òeg• ÊFˆê!—ÜùC4Ü!y¤HÜódÔ…µçv´%’¹êa+òžžçJJ‘”æ2VÓ»þú²"éèy°}e3ÂV¾­Nµæ75ñÚ¶[i´G gžÌÂue¹)^OßF)1Y‰CRRwjÒxózí µyÂ&)©,wÒ3Õöº¦C¯­øpød÷,öÅù°UlϾ%BîOŠVוmY#G±ÎJk)'—¹€Z¸ºì1DJ;L´ƒÖÐ? 5d¡Ó…þqÔ¨Ú’…ÍKQ2½…= Põèª?‡³¼ ‡8/¤z@îQy:d­¢wüÑßzôæOÙwź×Úˆ¶{.&[ÁõVXVí§ŸaµjíŒJ1–kaù 7‡-þMèûå¾Å춨*êÒ^õ éŠ.¨.7s×öð‚ÝÓ<› TèWùGª¨bg•­»Hîýi5SÔìŒú탠8œ/2{ôœ•ØTAúò=h®J‚\î¼Ç ~{Ÿßr]Ò´êÞ¯>V=U‘¶YkEæml vYR0ËâZÍÐÖ€ÄÓËùvžH‰ÂnU è´Æ¬ÛéǶ)«×\7¬\ U#»56— ?`p½œOjV]ÎsŒò÷ænw^–q ض¾uª³¹ Ó'ÐY„>+ïQH%õ%¶™lGª³mï(màÀd¼&È­¸×í’ï0Ø«{¨¬*sxÛ}ÎÒ>gÞ—Ý÷â^¡v·»sÝEɧÅ~¨<Ñ=v·ûn~o pçLmuæ½{èY{ ÍR¾¨ÔaÖ÷q¥?¾ß8´ÅÓìAíáWÛ _Í=¼Á½ö؆ÝðVÔ–›zíiWšZƒJU™-!¢L'Œ:ÅÉÔ±‡Mt· ©È¦Êoë>¡¢g¸˜ £ÌÅøPZ‚,¾„$d¯+šgº0¿Ó7¹íƳ¯-"YN¦HËÎé2¢C]÷Å;.„ÎÃVL¬ã74Éex–û€¥*"mZÃ%—íÍ—6AL*n[îÏè2<)˜ðgŸdŽnÀìR%•A…+-)Œs¨nóò¢RÇX½t4ý%éåÛ^¢qšæƒ44Sá/ƒ::õ3ïT6h¢ã8Ókº&Æ (;n|ÂR_ƒÒò¨==œØç#}ö;´CúfÝ—¬ZÓËh‹IÈÇVÂÍ”±Å“ê´nöšÏ^eÞ.ûVo¤;E-AÉø6÷¶¸a0}âÅF|–Ò Ói»ÄÝÝ«¿_Æ §[ l„™Üvn%*¾¨5ŠÁëÁ5^ 7É[þ þÉQhð&´'orh("÷g .yã§'iàVqç(‰²%Eò†AC·M£‰ƒ9\Ðbt gbÕ:oA÷‘h›¯ óâmî˜J^ÛYÕu Ì‚Ï<Ó‘‚„Ǹ4n¦³²¦«4|áP¬R—}ÑQvTÖ¢Þ_Íü=ºÔ0}“'˜öyIt!dÇFÆ3‡Â.w9ö¬´Px QFƒG–úZgAj¾Í•Xc[U0+¡z¬`î y®E5­KÏÈ<„ù1‘9{¶õÝæ®–@§i2 Þ ‡·!ų i¡›z“V×ßdt·¶üŽ;Çц„À8©)/¬lZ‚ &jæ`æ™ò|’úXÏ“5¶ª–»Ç¬ÛÆ¡©µËB2¼m.¾ð F_£q©F¼ÅÙu#o —j.'µSåˆ%Y¶¯±²ÒéÄ@óÊö&Mkõ,:•³•)8§æ#W¶ha¥ƒ7Ðþx­i(#FÁ76汇K:Zp¥æ¡4X¼i’Ûe+kÔÛZì¥oƒQ‚y¢ë=:ŠS'U 9úL´âZ¢lÝIW¤¢Æ?5Ô1 ÁÚaí…:™©ø`ŒÙÛqW芇íËæžÙbô(oÇ[®NèEí^A×Ès3Z‡\Ýôù‹rq\óÜͯe¢?Û·,ãU[´¹$Ö]¶¨ Åò1ÍfÙY©¶L²f—H;ÿè\:ëm鬴Ìä<£U7u§7{6ć£aaìðW”C»¹þ/D˜©Ð«Þ‹«ûïcjHËñÕî?I$l{kÃ}¡N#¸îTàͽ}µÏLã£úäÞŠ<4Óõ\VC a0ÊÒküŠ—b' “Ã|0‡ž—%d3œöa+z”Ûºe?þp’õ|›&Š{¦ç8³ÛŒY%([‚V M* žzS6W«që8\˜Æõ.øÌæz2©åKiE¢•¾F-™£—PK¯o ¢<¡¹vD€²5¼:\"”ÔNd;QHc¤ZÒΔì„_e f/D_lIVœòÑA™¬ì%:j¼±,ù(p ©ìæð¬íîŒIwQW»­³™Ç‘B Þ(4v–½‰÷t`Ǧ&%.ÜšÇ{»å½´§¶’îáõ¹CSÔf±5óYÒ-ž¤V ré%z_{ü‡9Î{Œ¼EÐ;*Ë, £ª/D¥T¬D¯OñüñV²mjB€,ã<Õ¢` É)R%ýÚ¤£Š¬ÌTnkÞ‡ë]D£,MW–Qý·)3¡I´uQ§z_x­©×… k|¨ý0y®YÓ 1¬°=60Ž5i"¸&¬Dè¸üB\5¨;¾ˆj!ÚBruUÙÔJ Óµ âú‹&\{Íú-F£V4¯ÈÛ€W|¯ÒïC½§p!Û%Ƽ±•mwCfi @FRr²ò@å«%Ѥ äŽøÀÜÒÄj1‚¢¬)#{w<ª?N“:4db~¯eùî?UÂŒ©oåczåë‡ò)Çx˜D8«f˜ší]ˆ–-ܩߣ*o¥Xñì.6t–·rÇQ€^óQºý7”çÊRÄMÉ~‡”Q³\†‚8¯UŽ îÃ3:®Ç~×hK:Æ ¨Y\O)Å*y %‰dõÃ*Ò]©žr(+æCÀb(‡+ãƒ*gÌÃ#Ð9]¦ž@Û‡ÜÕ³`¹g@5 ¶mÄç^Ç-óx›S÷6¼o{6h9ÅTØ•!ˆ^ÖÀ”%SdW™cgï\ ¶œIˆí6¼©=ÝÇd= £ àž$H|í!þ Wyíª>h83fKx:RÕ…^”jv³£¬çÍ*ÔLòed‰·…‰@²P¿eškÈûK$ImVT=O”Q•öœI™i/æ4]U_“ì¦â¶¤ý°FïXLB¢j€Rʵ\mÓg™¡X  Ž#»ô–e×ðµ_|gÚ5âŒd;*ne¾9º ´¤âŠù ÉM•; gÐ@CuÒBƒfÏèµÿp"Îõ^ïë}'º˜­w% wuÝÍ«‹çª/Û*UnΗE?¶ÄÄ¥ìžÎÈÛwR ùB¹W—Ž¥¯ªýª¡“¸ËËﱌÌZûH5‰#Æ¥@,Aão2ŽÞjbNÆ£SßîY¶ øê­EÉ}ôvjõ7Õު⢡éÉXýõ_fõ«©Â8^VZ«ŸVEÂ×EÞ“"Îsõ+éùÔªätÒx·cõƒMÜ¢lLòc©¢+VüZýv @A7 UãžìËÚúv|0iê 7ub£€;õ°BDG€2R-¢LÚÒo3zŸ¶¢’šTŽ€œXòÚ0?C² ”$ÚÕs2ê\%(³.¿¯{£çpcÓ4a­x ¼üæEú1Í<²×n”˜’ôИ³YIzæÂ­ží¼drnÍ_—™gJ7ª ’}>Ø…ŠÄ¬Ñ Îð² §O*rÞºsWöF¯]Šp#’ºä¥WÆ·t¿(¤ód« ¯ˆ“êâËÑþMTÑ¡I–dÊéàCl“’'àYè Ò;«Ã½2•ÛÜ¥¤\aòÌDR[åÈ"¬˜—&{U²ì˜ù4¾$Cº-Mæ÷½šîŸ7¤Äi÷^ìP+¾ 6ϓ˗ÞÒÅ©­slû‡ï1Ü8œv˜DW;Ùëï÷dÈk™[${W5ºô?* >)9-ŸuùS~,l}˜_榿ÆW{­3óÎAí·Ëí—Œ3ã$ïZ{"«ûwu-×6”díøâŸ“¤ ‚!šÌ›¢ä¡DjiMÏÀÝÉ´˜UkY­ÅG[è¥À ¼E™…$2ôw-~íÏWCçuéGŽD˺fh\ƒ;˜¯Êk(žhwò™æ¶?ªÝ7•1ÃÚ%ÖˆŸ9®¼³T‰Ív $±R»ÏkÓöP•BOÕ‰rt¯JïÚ%bÒˆ@Ÿù$±ü ©”!3ÌŽ`Êöu®„œ¹KΛ¶-»ÄgŸòˆÔÄ¢j­»m“¸ìÒŽVÎoŶ‚Æ`ŠRCœÓ+8sS¢Óô˜½™Í).mEhæ›sW Å„š{:™sÇ d²ÉÙ€]®»¬Š;ííèöð èÃÛ/O>@pW=n¢G§èï*“x‹Xb£HzÖܦ¬¼8fß÷‡Ýàn\ÕË.ñZñd¿G]›[ ‰Š*Þ‡*Oë£]ª•k°ÔòvI¤;à_ù;ÔîT#¹JÚ&•ë•dDÖ¤u5HVÇ)çS@N˾†mwæG›ÓQ¬’$7]P~²FZ™ü,ð%‰ ˜]¥/n°Òß%Eý](Ž`à‘+P¦\‰¸)صޯ&Jž]—6®‡æ«S)IÐ̘ 6ÍÁ¨=“Žm;@‘Ï`NÁé"ŒîÒCâ 9$eõ$m¥dVÊ<ñU}™½zK‰Ëò‰qPÕ6¶À¯­Rs…‚ë[œò¢õ¸öÁ~UË!ÇÑ5’ظi€®TF2øù|wÁ Ì›ˆš?â¢jF‹v Óݬ¨™3–ü³z0 ßœ#oaKBͳ>fGu©ãæÓ¤¡LæO JõÖ¯ ° ³CÛÕdú—p<Ô —? |tò²ð9ãÅ£Ùû·ç& ¬ç>Zù öúmš>OÐyWò{€tCKÚà¼ë†Îe+Úìb…»øBÞzÁZ(e9 ¶˜ò¶ø÷^°~§ÏÞÅ EIs%kí8{/‰K§Ã®×Ny`|_gç1ýV0’¤‘ü¦ìC¼ü~óˆ66|ÔYÕ_M®%Þ ®{½‚z¸ éÃ^¯X¥l†.D]OõukÂêuq³Ï[ªÂ©ºþ¡Fǵ\Šú¸£ëÎ)‚YíIʇh_–ÝàÕ*åí²×b½ìËfºK¶5Éz×ß×—­}´úøääb Q¢½AΕË&Tx0„±€•µ¤˜Þb ólŸ}â’ç*#ÛÙ3 ʉp #j”ÓæñhYw~OUŠv—íPªbEÃ<ÊØüÁvž*¥lã³]¥& ¹‚|ÖÍP²~~^YÃslù¨¬6XˆG›— ~ˆŽjÔñs8³gKz!(ÿÖýá¤"ìàÃêä øYRžM²ÛuWLê»Ó6´ö—÷H¨pLOMW»9®/0+ܪ†)ɱE¡ÝÍñ¾©Üz^¼¿dWC‘:/]LO vurU̶}ƒëDsÄ‹ÿÊC…2XQ¤@3‹ÓK‹‚;š}á²ÜšyaçY@ ×ÓaqÈü1BSs¥ù¡ÒF‰>;#×HqÍ”}i‚;SÄ·ZÝÔS-- Öù̬ï·H¥ifª¦ë4$ÊÝûCZ Ï©"+øÀvÍ1W·`EgÉC1=¯\.ÛÓk}ê 6ÖÝN…}™BTiEØOÀÒH[Ú¥m àªKuÕð4Ýœ7ÌÁèC+]'.&û±HÕö0;ÈÄ0TÚ@娬U[æ“z DÙ˜žÉ.+“]ÒB™8³äj³,›v~tçX#Ç£â!tä×ó kîÌSt]`ÎI¢­ûšR2-ïÉ4ÝÎçrÞ]g¡ÑÅIne]©™z«å²Ž/ŠGb:>gy×]Øœo÷ˆoyì{1W­„¬çkäÏjžq¯ƒÌàcF¯‚Œ.Å"uÌà©ûM5pÝ8Ì–Ò¦Ä F]êÙ‚EHq Ñ)šu}[ ú;INÃà}ØŠÿ½¯MÀJ_½øŒã泓û1Ü‚èZDpeiàT™-‡„¶,†ì;8K|R’|ˆDR=\Y/ٲཔR*Âà8~ÕʉZ7˜‰wîÓq&hu‰sCì²tò`}bG’åë^§ ܸ(JR„>¾H)¡%°¤" ˆ©µ 8ƒK,…EË‹ÁAÖêÙ2e³œ¦,‰‡×/32øþøšb*©  Óæ¥Qµæî©‚VÔ˜ø!¥ÂëCÜ ¬§5Ùtûå&®#­Îm6…rßRýj›:¨gpBz²tš§´:Êv¥“=½µ‹(”í'ÊÔ"ý-åšiq•JB¯Ð«3ÏÝ[ Š·¡߃âQ][® ÝÙ%Rtø(ב—rwí=§êU͉0§J "QkŠ×>´M–ZŽðvY–*A©qd§›kª`î@²?ü±9*¯›T¦+MîöpUïÂ4®­èÔúp™Õ0 9¼‡û‡ eÉä<²÷M.Õ"kð-¶¹d| ceÿñ؇©Ñ”5…S6ÙÖ¹vÎþTjú$ûi/ÊŽšŸŽb­mAe‚ÜÚ#2¿Í Y˜Ë…eÈÆÂXžŽ±Ñ—!s}7dy÷ çiÓâiÈÚ¤O.Û½Z«2ÉÍLnÈDBé§Ñ¹ŽGÜ#¦qÞ¿nØÍߥåCßy-áYÝP.`kAæç*ݳƒm¯Kí2$Bý¥¤oãã‹™_ðx„&mÖý\‡ŽÛà¡ -™M÷±ºñûÞû0Y’­:Œ”Õ‘Fe¬’ÝI.–—“†~s®|ä>.½š]·h´0¸œZšµß–(ð—’7r”(–@¬ýTC¤?µí¦)麤1ߥ©V3¼ã¿ª-©½#¨X¯*«×sRŽª F5\!ØÞ\ 8 o ÏÏ9¾oRt¡Ð,30á/oL=c>FÓ´¶K¦êdH Šö@î®QŒ¶A \Ke£ ƒ21±U…ªpv:&ÐjóÇÒ8i]Æ#ŸZÝ%ìnµ’R«k€u³Â¡v[DMïáÕ žxÊ=p”Ç jNÜÊÑš½¸*ªl«ŽBZy ú,~VöÒɉ2M Ë; pÃù%›{/œÊy•9TR‡È[oG9³'а/}ÿ»F/Q*¼°æ¡x²R#bkÜIù$ëR=§IKqHÁ®©&Òz™®ž£úûPCbã0Apú{æ¤Ý•ꦚ‡¯K“8VÀ›‹[Î,OxbïžÚò.­¿ô#•”ÈôoÞ€V=‚©à«ë(7ï=ÚÜpöZÙaûÆ{"µ¨.2´‰ãçe‡ìº†ï›Oe༃ºL)ˆƒ ©Èâ£ØÛá‘äÄh½gÏ?6uÄ¤É Q"pâP‘sU¤#™4Éa?õ#•N,Ræ°(Lfaº­Q 8 -¹“^åÀL¢m˜á=ýEô‚ì•7U §¼_dÛ ª¹DE|Äuñü÷5¢…ÇPÒ2KóÆË£AcpäŒè´LB¸I亪£Úö¡Â»´]íSÚšú`sö4Æ\3h¦û#ë”%)€ÑGyp*\ÁdOƒ[C6d(ÒDÙc ÖÓ Ô–°MY¼¾‘–¹jÙÇ3ãiäâ1åÈJ.ä=ÚsåœBhÇ|åUÑÑþ&»´É®iÑï¡Yß98Š‘”‚ÔhVø>öl}'¾8ŠÛ·É§­M)µ5dâ†8ç·g´oÀ!CvDÚE^t€'YÝ“ô dcݹéXÊùø]ÅÑÇí&Müë¶„šç8\u}Tð±»>°LyŒU$¿ëBEdWdÙº& ZD·H…mÏt•8m{ž_eÎÒš—6ø+4»1# DUþàVŠQ³øˆ¼yK¸z’Ê b8/Ò„ÝܪXOE©ê «Úºö‰ŽÑDFžå‹¹3!JIÙµ€™ƒÊB:ºvGªEÒuƒ@G3qóS¤:«duٱЗYÂj¿|Ì£i±÷#WkTqäzø‘5¬‡‹“fÃ!ÒX”™‡Ηá­à7I¡‹hË[ÈÖ7#rð3ÎU¾S…/oyÈ­2§Ô˲]Æ­:ЊÖv?ò.pÊøEÅ͇eóv*ÚÜ=Z‹ñµ,âD]ÛWÐ%“ˆ%nP:‘ÑÓæô¶¤>E9.Ÿb[pu¹cù²8CU°¨ADÕÍ_ËYE±Ö$ÝècÅÚ(Ú™j¾-KJ5ªz0†Æ‹MÉ!÷xQÇ0´ÈaN1Jå]´}óçE—¨—æTì¦|ÎjI$(‹›>Oßκ*w3)â1…ZÏæprüðK'²z›MS“ºÙì™v”íÒ~6C5ŠFÙÎ’µ2r‘("ˆ‘cúÜX8XH¾«Å=5Lˆ Ú4+i»n…]«ñE_päØx&Aìq›gç¯^ìÚR»p»æhÙ’‘ÉqôäyÉ5j~¥I–>†Jí‘s®¹‹ûR޵8ænÖúi¾Ú6\Ä=H^ žê~— /]I±m…4]îþ›zƒ¥/5N¼^,Z¼¡|«åõ͉Uö‘¡}ßf᪦iòÎt½ÚÔKZÄÖ7ƶ4˜OúåÓÎ[Aöؾ‚–¥5+:„”µ+_è-½<³#F‡ÒŒ‘ƒ’8Tv zjýÍ48.ýåúÄb”Ç9º¬â˜¡š±l“LC®M<•ŒÒ8-•Æ‹Š¹›†“Ô˜@nˆåøœ …‹ä‹§Y[šOˬ#_²tFǙ˴çpæ3ËßóJ›ûŠ{¾O+zëêÝY[¾Ï½GQV|þ OHºò²ËËóúZÙÙíü`×6¬où¯¦Égä×’p¯äd_º‹6yÛ@ÑU¥dúÍÄ|¦ÉºÎK^•ˤ½jÃÊ¿ÖÎô  †îùOó+"RrËŠ(WèÙø>ý‡—é Ó\:;½´a˜Æ —»³xÏðïÒ:¼ô™kAYâêE“l†RÕ®ïõ“ û׳aå„Û¡½Ž¹üïsuÃÜ&”q/­½ÊÏ"¼À&Uw™8¾¿Xu^ãI/1×6ÌÀÜšÅÛ—¡Œá4vŠ¡ÔÂÜ¿æ¶% Œ ~c;ÔÒ"ÕÒÚÑ;m€ª1‹¶=Ž¢ãƒcÒB-šTi-CjDÔ,;©‚nDÂ2ŠÇÅùÆýàç²D —ÓxVÔšWÔ‚»„«5&»#EÅšOä(¸90×HR×°É«¸9kœ\$5#)u²™6]zNdsÜür Ûœx(GokœAÚ®%ñÝÐ_š6õºÄM;÷"Dºs³v†Ö.*or·´ó4pê_'å8ÅWIý:NhU77¯qca™ØFéÏ î–8Ð/ B™ºÐJQ9¬ŸÚUkâ ·&• û"êbë>mt$•á0*×þ>¶I”ÛÚûÖûèÂÞ}.yÙ+מԃW¬Ç%L¨yÓc¼¬6]þ“9£]t^sÁsr–ƒ ÷Âå%¬²š« i6ôTíåàIØÏÔ>UknË®3ˆæŸF+Ш€wHÓØÆ“5ˆÍ¼XÈj ` ËT§:xÀ* ’™LÑ"œŽîÔ¨'o<©wœ ^¿î¶Ïz_y]3¿K\}åÃûÊ™7\UêðìÉ´‡‡ZíÚ9¾4ŸÒA<·MôNtZ3v°?VLs\.~Ü»Âîä½³3œñääV÷æÓ|bac7÷{¶äÔ¡Q}L³Þ§õÚå½Íí.¬óÚWnÇ×ôÝ–KI""9X1BÖPúl‰ÄÒ‰Èò7C:]b’‚’tÜÙ9>½s<«C¼M9hÚàUå®UM9vÅ 2IZ¶RT„<ÒÐ2îí¶œÉáMê׌ì|ß®1Ku4n èµQSƨä3Éo SóÈÒP ©&—mÏçͦQÜŸç-Y'7WoK¥×_äjtìj— ÞÑ%3ÅïÎÜÍú?ô—¢cnGTÀ5+ïNˆÆy¯hÔõ©¶kÒ´P2z+!mF¿Ç&âl@ŸSe!dônˆWÇBñ1<¼f6’—¥/•’7’×à(¾è?8Їû¦>G):×$½©éÐÊöa„§žDr«fSn¹ŽݱüÚå®&µœ"¶¡X ¨[‡|WoDMWs 7{÷Ï#úŠ ÄÀŠk·®ƒÍÔW·³memà‚1À(Á$Ç0J {ÎÜDÛÖ$Å*àì¼LóŸ[ÐaJ1È#ë“v´z¢N m±kIALɵìÕý$aךú¢³Þ%õp]Ð`{ï6¢»Dõ µ8E1¤jjxmå˜ æôNjWîM*ÉØk% QæÀ„¥Û: ž¬bܦZ6Ý8Ïíp’Ñ“WöbÄ`¿6ä¦÷.•àäj†`5ªÑM™£vÁ“ž -"¥˜¯®vèÁr°–G†–ý‡ œœYºfûCåð—Š¡„®¬o”‡K%î4] .Lð¡ÑÃÙŽ“+¯VÎkØÆz/}ÆpÌG†õ´Õ+¥1v §dUêÞúséß¶ï[ÓÝE¹±làmxÇVøp '¹§xMö,E•îc-ºÝ¾Þ»ß³ç{HàM'xëÖÌÐNbuÑP¥*p ÂEBú‡îŽ oè¶ä‡+£q#q 6sÑÃ¥¦Ç©¿aî«äÙl›“üƒš~Zèâ©…!>YŒjzˆ ˜=éoG-ÛG _Ö5*À§!Ë•%7g\²¥ à¶œèA|87:© Óqï±ÈjçðuMÿ–GõŠEöYÚKá±_q= mäð¤1nðfµ}9)=`Ô ¾ !(Øcþ¬„¶ÈÝ©ÚO—›hð¢i…oƦvàbv&sÙŒ¾ àß*{”èZMiøÃ¢dÑ ž“êûÃY¬vòª´^m0c×êúà¸@,Š_û1ä{pÐazήžóxÙ÷°÷õ¼ÖupkY[êÆ-ó½áôÜE•¹—F¶Z´"Úk/ÄÖÃûQCîQï~¹±rö¡ˆ¾²¶ê‰J !m›M;ý|:Ô>Ù ÿ4ªÎ% CŸ‡Ç–™]J:ø°ÃCŽîÈRi“0Ã| xK²iŽ"x'¡,w$‹º‚Ú¶Ó¼-hÀ\Y*l*­¹j TëÕmN{CwfuP±65w¡†¤™|¨ OôV.\ü$ŽwÕX¼T%þ¨€¹ø^Þ}(ilNtü‰» AÐ~Omé-Õþþ–i0‹,€pù_•§£+ËêÞõÊ>,_¸©1]ò±»ëªÄ’‚cÕ>UŒQÔɽ\šÅóìpyu+Þ!|·Ì^¼ÿŠÈ[–MJÏô°­´ìKT=þás§ú¶IäOõë’š)cµ¯YF Ù%àkþt¢ÿk{y—Ɔ}ù’ŽÞW;~Écq¨}Øs$[‘ ¼6g¸© Ý]ÝVðj›Ë£vîAyÎz¬’Ë® “”ngýeùÒAÞr¼æ½Vg”¿.ñt?ò^“M¾>ËTšªÕxLì³>ò¶à_‹‰j§˜X–WÌòÓ¾;h›nº‹Å,‰ /ÝÔ]"ñî4¿æXï®ÿÞRµåìúF ‹A(êL¹à°©Kµfq’*jÛ†jöÝ-HGe«<¾M)ùFdoV30]ÙÑ–û[väÛ¯kò¢}l ên3Ã=Ã\ò¬ªJ2'!çÜ-¤§´IƒE¹ª²BD@çcn\mõÇ­‡néšUœŽ‘àãjK«ÃاÇÓÿuô»Û\];Ã_YÅXKL/ˆƒ'šÐòŽw?÷ž«zÍ´n…"/•®ÈíCÒÔûü¶£ûq×,ö/ðšékVu·¤›–•ËF1!%õE±ª‰Œ“±Ž9ìuþ«áÓ-ñjœ3ŒiD$¥$ ìiJ…¶53`¶!ô8ZÂðÆï©*nLj~ŒMš¢qxòIrÈ W-Ó8oËUvSM—Ñ“O9ÞŠˆƒ ÃN³j> s º‹j£®«’•.rM(T°"•B¯MD‰ê%\"YÂ>“§‹W69-)áÅŸÐqT¼ì‡˜vn»pé½È²µæÆHžÃ£’o[)›ÇÛ¬("AG]㌺Gb±B/‡ôb hìæ Ï‚Tk"0§™Ý§7ã{úf ¶†5D¼5æXNo:üVo}zœ=ýþhrfÅÉHJ2­'¥Âë¥ °´»­ /MÓ¥ñ^ÏT¡uëÿØmvØ ¹ ›–ûìâ¥[(uÄ«]½ÇÊûå–dºŒßÛȹõœMâm]ÜKõ‰k€q߀™8p‚å²äbÛ*Ç=ÚÒ~ÖáÄA ÑÉèbFzà¡Ô°¡F ‰9J!8K‹ßC¥„‹4ú[éBtÂy-n„íQWy¿ÙæÛbŵ˜M­y 2¸¶ÀŸ÷›©'*ÓôÁ 9x‘Uήm²DØÎ©áŒá£+Ô)Õ(¨T}¾øšNÖLôH3LGçšü¯ÆŠ^óãE.ø³O=Eî5ôËDdM¶òÈSSÍ7„û-öƒ'…lGÈ]³ríƒì4©È@‰™¬AEDÜàTIÊI ìÕ­e ʰ¤ûSñÚÎ<4øUÕ‘ëxTgÃa$Sîù¦˜u•ªNL®· •—êìžIÝ’C—)|Tä:ÍñQ‡V8 EÞÒN<æ¸'f*% ,T^ʱ»q|-§µ ô•õ|Ÿääc(“ôBÄßX„§N–¦bg²…¢@ªcŒ,Xhö˜û³§¥T½uTù©3J¬lv/Ûd·˜ÅU¦] J#±Ei.‚?!´FWíöÈs_«¸vñáÔ•L2?M–ãw60fïAL5©¼$¾ÿC!EÊêóƒ8 ¬uª¦éª¥Ua Ôpdˆ.„³'žP°y†ÐÀU8à¿|ªÙ!JUÄÅ9í 5œÀƒÛdÆ*æxãÈ]FCÎ4¦’‘¨öØÚŠê™EªÍœÌHÓ`hK‚I‚ÒØ;Xm¥€ÒxG ˆºR Pê‡I,2pÓÝO>Е瞰¥N©?ÊÁó‹³Û8èÓ–EBÞ­¡ÜÔË8«ýö½³³"öÂj?¿£r³•ù´’rY]Ù´o!#ϺYȾCÿŸG¸ç—oöÓ“C§뺧2V›ÓÒD‡V¦Ó6]JQuu˜IÌ/1cM=yçµXTyü¡©2!j¥ÈÈ¥_‹³4˸†â#pª’K¡IÛÌV`ôånË×꽬è“âõh>¨+kjÇhι’òˆõœ–ụÝÐ))¢Vÿë:-CÕ«­Úæ$†˜¼câ•ÃCU|r–gm¢»¶Ñ­g^2ûv€ÍÂÅDA£ÝŠþõÓ¯þ‰øõUƒlC3]*zbíÒÎbNQ©‘wSa· P—y€¢ÙI¸“k¤³Æá@ñ-v0^“úX¼¼º“é÷ž•Wc½¸'kd²`%N·Ì« ”£´uÆ–Øtƺ–•ÖT÷®Ï{Ùkqâk í-Jß2¯íä0©ßÅERÅd¥ÏåÝÒšE XÅ.Šç|Éú`¿—xOpU3Zm1'VéH©è4 Ösÿ²çÝ{^´¯XoºVªgv†4¿Û˜Š!§èªvÝ]¥_ÅÌËêÆRIRš šRÓ10†JÕÆ‘êôd޳¨™ƒÇÎ9úìxW@ .L$ìrã®EÊE#+‡5U>Ñ_ïw™î"¶¡m*òY«Ë>,º¯æ»~NN¬/ÿä#Úfì•òö#ã$ì?û„îy‚Z æ¢b¥PHQ';ƒlÉ:]ö³‡-G†ß‰Cg³k¯Èiú`;H cÐäcÎúªtkÇR óÈ5×¥«Ã 3yÐUsáHšÑÕvd]§÷YS#„“ccP¶vùÂ;'I²ã:z/6_Ø1ì7c•vaº±Ë Ü럛™÷wçîo}N"Ìg*X–0ßÒ¬ dßèõ¯Zî—;/j߉¶mÝ4Y¥ò¥`²Ê1S4ìáÓ‰²ZÈW 3+¶‚y*í6zlĈ¢»²wƒ"vI›Ž—H ­«¦×ìÊà2ãz/›èø «JŒÃeHc嵺qF¨}Yøua¤¨û=kޱ†N{#·9Ö9è¶Z«yúHR¥](ú¯vÈ”%Úºb%…4MÚì°Ä6ÅØÈ$Æp@5ëg"ezÏ`knÉ=Q䓤°i ¨ò@t³|ì8È'MŒµ3ÞƒƒÛU5 Á" 3òI\BdyŠÝ`‘q •_;§)g¹¨0=†¶õg¿¥+²ÍÐrASácV$;’Þ"÷«¢–êdœÞ#—”RšLøj Çtt¿• oWZ®/ðÛ¼ÜÒµ„ã¬<Í<Ë4Ý^ÅâG€{oRK//ÇÂþkû5[þß n%)òFnàB3«r͇N)P¯_À$ Œfrhž½5É’¶)—ºwWûoš0ÜõžniçÔ@÷à}§!k¼…³²CÒ€½.Y`8ù øLÅÈYâEËÓõž:0¶3$†Š£/ë÷÷¼ƒwÈõ.>îÕáîÖ Ó*ë°n†W†B-2…ÔáÌ#ûºµÇR‰.MQc` œiÇi!„$eŒŒwÜ34grˆr­]ù‰>‚ÀO3»º B7³IT>9êtA{RsûÛBc½Ùßéšæ7ûÛ ÐrØ_¢v|Ðþ‚÷ Oè'ˆÞìïKÓ›OÓ;TLFlRgqGÄ1ÈÓ`5ì¢3žG -®=‹À:“âWÑú`—­µ«TÝÎèMãÒó ՛ȧšÆ/K— •žXª\j .`µõ q=Hk8 ït–³le’ÅPçÇ{ ¯R¢3H½úì1ñOÃ+]µéDD7¼éjxÕ}0‹Á~Ž ïøA·\àÓð"ÝŠ`ú¯?U› ÉŽL©¡O¶Áà¶ .˜¶2̘ÌÈz\As]¢+Õ1¼¨ŠŠ@ Xe¯×™)´MæXÐÇSJ#× ± \'Ï)GQÊjÔI‹ü$}>ܧâóÕ'®7^b—Ó ,R | «Dù˜‹~j>§=MŠÇeØÞǾu-˜ ÓéQ£‰Uoœø‹Ã^ZÙ‘Õ7|m—;f·¬z 4€p«óÀR4ƸËßtßvîqôÇtÍî—[k¯ÆJû€—*@ŠlwˆüE6ËVø/¡ ˆˆÈ.¸Èa3™À¶°Ì~ö¶ÙÀjúq0 ¬QÊÑÛ2£È½(¸0yœk®5å d°¬1´È¥I^“ž×Æ}e#Yœ8­Î®Õ`kF™›õáûONÛ ÂÙo×§™’P·ØQ†˜”£³ß®wv—¹q¨¡öø—ývŒ¸«“ƒ‘CIXprNâÔ ™ŠV¢’ÈÏ~ðoþñ˯¾zó·ï~ûÍïß½ùòëÿúÇ/¿ý§7¿ûêóï¾{óùwo¾ù»7õù×oúêß|ýÍ÷o¾Åÿîë/Þ}Á7üúÝ?¾ùâÝw_þî럽pÚ¡‚={·Íã³O¸GNtÉãš‚îIlÞˆîeP -¢c­ Ù¾0ÃÔÅŒnGaJí=e:jæ£Mù[ÕŒD¡´HÑÀ…C»b`üóÔ°g¿KC‹Û÷ê>»ZÒ=¯Ö|–žb<8ÇÅCô¥"Ã-"æç¥_‘‡‹ã.¶BÙÒpm7©Ê‹|±%²·~=ohÑcŸýz´úìáí±!̜Ϸ78_˜”Šú·f<)V¨Ÿ–VÆ…ªÛÙÇãtÅÕº½øµØ[ÌŠ±Š„´_Sj˜ g2œys ‡šÂd Òä'Qbj’ Ý*A:šzðFÁb ,Æ,zþtõΩÁxM+· ]4u˜Yô©ÙÊ©î&*¸_¶ i¥£¶Ìâ¹mψÉJ7$àøLF‘£î[@Pn|‰Ã/­‡²X`qÚ!é)šš~TÐ)E`{Ÿð§Vñª)Yƒ8“”X@”}{a„aΙÝ} $0 yø“mª®ãƦxMD±?zÄgL¾‰Þr×iª²ÜéèÈ$‹r¬ñ{I2OTpÒˆ½HŠq"³"'Ç’ô¸Ó$0i²SÑ„xÞCÊFR?€ÐHŸH|Ì“ï@ïŠU¸CEþÇ8SÓœ§¯/e#cn¦øT–ñ©éaCa}¼Ç©“¦¸k•lÏpߨÎz¦7ÎöÜõá•©½Œ:r¸Õs*:þ5ü1Ø.©zï¼d]¦«»ëSt$QКýÌØÉe]O e£mCæÖš.¯{`©×pÅÔ霑¥Ú9Ui5/¢Óf¬ŒÛ„P¹4 xÿ òqœ‡Ï^%RP(CÝQí®Åçtènq#à&Û¨ DE þ$V˜N94 ÓvVgúÔeuKUƾ%3ñ‡ëNSziª;Á÷2§VˆS²=©Ú– Uek8ñ ¡5Sn›s•!6áÓº¹Ã-)¯–"’ûô†ÓׯHÔj„âókÿ%©&‹©çd÷½¿Ôú½³d¯ýHT©œ ‘d˜Ïå;‹›=7cæ"éI¤vùÇyƒÁk®éÖ¯sQVʧ]SW+  ²M®õ°Û£¸н!k8ÂEú¨á YÉ‘f»hL~ yV¤‘2¼QltŸ˜ÜƒÏ¯Sñ6ä¦ãk¹_c[ƒÈ5MÈY¹Û2ñ¹vAŠhES€zuQë6vqi %unßS Ü8´ðÕ‚& ñcÞOàŠê' &µÉTŸãÚE¹ó‘ÏzÄþÏkbÞ]þ1%YÛ™ŠÁ%oÆÃÍ›a`híçÀ ð,$'“@1;H/ÂŽóž'OgUT(/aŒ´™R.H™*"6²È–¼YXJ‚a¹ˆé˜Y~hâ.ÍÀìC¸Ê‹\Ñluœf/ÚŠÞãdÀõx_£`}àr¥?C#R\˜€ïX·ºªkwx'"Ï&ưS%TÚT'xff ˜®ÀbKINòo}Tódk·¯Id©9ÉZgª¹NqGïvd±ê‡bÄ]ëì\¨Ò:ÓDôê“ÐE~ƒ"ØŽËD–Hèæ¤ñ¯—ZgQ¸œ@Ë–èÅ¡uæs(—<ƒÃS–Ë~ó®uö£œDØ;(Àæ§üms•y ªK Š&8—èú& cÀ`Lí²vΛ´ˆcÐå×lˆÒ”¸®cdñ¬ÐÁL:¢-,§ø`ðôÎ ÞÙ2þhU G3š·v>œŒ{²tÛѪ¶f2¤ƒ#á¯-³¾=ä2q“+û4/ï³þprôž(ÝY{R§l ‘Q ¶CíXLÍ•¬·˜ì‚Ó_Þ)½w\§íën_Q*ˆ)žûÈAw…«CR}&»>sçFj2üÅj8ò¶ J…Ó•@É"Ô6¨Ü ’ÿ¸nÕ…?%ZV%òÚ«‚æz·iÒU¥¤:^íÚ»QÕÅr]Ãà»(Ú”ýæÔ8ž78º–’w’§Ö¶ž´¡h ÓD†LäµÂ‹ÕðRrE$¼ás=Dð­Åï9g¿(fü×.}ÞK ,1h©Md âÁ8ª`˜¤W„ññóǵi/“LéC;KPgÈ[—”9ôQ£ùà#UˆÑûNæŠvE¾Ð°oàHAò»²Y)ðpc[ÅÓ|t¯ ÇxQ 7³Š*Œ7Çx:Òx¾Â­?ft©úÖVÖ~‚5¤ŠëzG™KWÄÝ'ó]† íéÛ=*ÜRwyõ½¼d4ê³Êá&w”÷moVÿÔï‚&]n’Þ†Ê$1ÓMòšú‡Õ)~zÌ]F 2gÙe˜|çë¬n/ÐÌfªÂ3#°‹7%_{wUÂî@öû=ŒDÓ©”škîõàM·¦S]ŸM§KLíµ¦Óº‰£5ïi™Ý‡ûIå¹2»‘CS6Ç™¿Cpu½R(ФZô$÷{øq•£êåV•5z•5å£JÃfS8ÕýãIO ÀF•5$Û›‚(1q#=ªNÊSÕ±è¼2·L}`ŒL°-’Ìš”ç¿ ]1€maÝŒNC¨¼„>‡$ðÂxWé6jy=9ÛñPAœùf¼óÕxÇ׌w¾ïqt¿©-ŽÝoI#Ýwã½úlö8wGJÛîTÿZ;·¸êË‘Ç{¦„ÜV¾d:ºŸ»âX¹åÊkû¿Ñ˜w ¦Ò/‚‚CG-?%Š·º¤)ì°…Š5³ÐGdjUÙž·$˜lÔy ¹–ŽËP[œ¡Ô%E„¢£´\Pºë·t×oQŸ€­j‰¿¬nµìxó«ÚòRÖû%Õ~m/2[94sì È«rÍIE`ì´Ì»è¡6öØK6êC÷b¦ÈQ¯\%–l˜¡ÜDzó´©7±Õyôò,iSš÷Ž>¨Pû¤Äé¤>v ‹þä³O<$á±5ß;*k™wš¤\ðìØéHSL’QRii¸h“ý¥!ëH9TÀy\ÌÙ¯fµÀa‰pÜlMÔX/ª{’·p/`U=©ÍƒëºÓW³OôòJrKÝ5wžì§ÉÜoöÝ€>S4‹ ÚNr’âÛ(7/ÆÍc± úeØmçk6uo>ÝiÄìλPˆ:Ë™ÞE€põâº+ô|‡Ï^oÝ^¼-_ϧäpQV­×KÊ+©ËN¨¦Bí;>”>+;¼‚jL¤Q’4±K&嬹‘Ý>·™ª“Õ j[#á°\Aý(1ŠR“ØæLÖÛ*¹pg°{õw™dÙ~Á@Ý>~9Lô5ó!G¤™ÂQãíºëáÍ>y~)÷(›ÄƒZ•àJ%è™kP¯: ×(ìø¢ïÎÇ(æ/¥À1 çñջϿxóÛo¾þþó/¿6„zýôûúûGjK\­£žçKê•Cb>ѲËèF¹¥!1,ÎÖ§ÈÜÁl±2o4ì@¦ç˜û31²4™Æ 3†òÒŽ¨sA Ñ´ šüWpˆ'A‰zœŽ†¼~¨ö–U¢Ä›X=Ê ¤Vˆ¹ì3Èœ*JßD üK1ËÓf®^ÕØßðz™8xÊ©8"%¾ª„\»–dÀ (…õ¶Ö‡óÐ{½I­êA¾³«ú·-~™œ¶„<%”f육íM̘Òd©5@ËÆ£yˆ5?€Ì\©` µž’J3»$ºSÈ\€1cæ™rÇxk^+Öa+2äÛÊ[Q{ÑPwgóv£ŽÖÕ‘U£P«idò¶4©õµÕ«)òlš¡Áõ]ƒ›MG­÷à9Kéìb¿Â˜*|ÙÂèø þÐJÇÚ’Á›YéMYº0{:2-Í!ÝbðŽ.6]µ³i[£E¹NZ‚±¶ÈMm_3§Ô°&#W}UÏF\bL½¾PvC¦IV´,‰ˆÁúÌù5XCõÑC÷°É{^iêzˆVYÅv ²§"2]\¢[‚xÑïfðÞ{oŠÝºÀ½·fÓnÙŒ¤È‰¹_Íc¿oËeÿhóxwyïÚ-›‘¹ˆŸ·ÎøàÍ®žÎÂ6°f±ªD²R†Ã,!ñˆ²Dˆ̨^éãK¡»L–Ñô~²F^¸¥‰ Só ¥V4JÔ®UM ]ë´Þ×+Õ"ÔéÞÔÞj?©xçªGœ4³ -R®ºQ<ýA¨–!)–¹D‰Å¡$A^cêñóR ”3W±qf*K;É[Mù®pä¦Ê>Øö ŸE´±T#cMÊ Av9¡£—f%Q,R80-âHÎ!6(*M в•¨ E}©Z`5¡®c×Qe^xáÏVÖ4$dùºeù³­y{<­áp’›Ô§hÃ}ù=1•ÝÓÕÓ‰ðÉ¿‹¹É2º+k”Ï/Y–²t·ˆ£ªF;Uâ·Ø¨ÝÖ),di²”JI™ÿ™œp¬Ñ9çÍ¥íÙ‡~u“æ-ï..ÊwtÇÔ' W… (öØÌhö Äb-аב„RúqüŠÞ —öñ(­ÚƒXÛÏ- ï$N¬²ýì°© sß¼¸÷˜5°ÇðjëV¼)Û'Ìê"WG˜(|°Û9"±€ÎÜH*6xAöw%¦£agõÄSt‰¾ Œ¿/«÷nxlé¡eq›-Š©d2_–Ò)~‰Ð°;³pîuÓ9ª[Ø9NÂ…‚Ûë0­{÷ŸeQ=Å_Ù@Ⱥr(¸4·°ÓgW1'xÚæU–¤r#bÎôXøÌù°¢®­´¬£k)¯Ñ@íAVÐÙ›M}²-+ÉÓÔÿÚšËë·QÄÙðïe…nžóE›SSçbð{Ìå8ð†7áDÕiS¤»Â®{XѸUvªûr±³¨:oô:··’™NÂ'X…—ä𲢺rœ¾ŽÉ­Èâ~ŸõmŒoC¦2šá³ýœ!tñ®%HÃ'h”‘$‡sããáÑ&®œ\й ’d ³&ØÇ7Û×4þ/h`vÖ#VÔªšˆ»5c -ï)íèR‚iÞû]§;ŸQ%Ý´ÌXä÷Õ`—Õ"§çvÒý†yÑ!RâÝò}WæO»1½{”w¦ì6RcããëÝÄ®òIVaO®nÁ'z >w.àÄ×ìh8áÈåh$VéÇiÿW›ê•ô]œð”B+hÜ0¯óƒÊån1¾ÒAb¤A6OÆ3Ê&êÌR’6P£*Ì’‡aÈó­9ÉÚ6ßdƒwÒ©K¶¦ Eü¨ËÚT×+é½a¨ ')í4Ê®†nAZðæ?Œ¢)äYhžRð™y¤Z˜>¹‘©ì2}¬£HYírð\43¨¥F•`;B˜#C1›šÈ É„' HrrqrE8™2ÚìÒv#x²ô÷Á: ³|Œ™¥=z4÷Hõ˜XHRյ΄ÎaH‚NöÞ„¢ûªºŽ±\ÙX‚s=Ö½ê*‰rÛ‚…29E¦SIJNîtï5ҘƮ' À…¼b¢r(WK/÷ÏÇ’ôTpè™Õ‹ö‚ÞQ(øŒãµ®I(ííMÍÑ …ú¨¸•A߃Â×.72Ö®§¤Iu›ò™¤Ý¯§V¸IU‰EÑ…G[‘¤'n¢A†0]”V³"N—ôyPìARÝä:•ÒôÏei;ÏNӠɧY…˜‘}œxV 2‡¾Bs»­TÐê“_âÞ&yQZ¶}’j•˜†¹§‘†0úXû*A‚¡Vž5IµŸ.ù{™ÕìݬÛ$Õ§½z*bUXe {Ø»¡EÛÇÏ>È7®©œÍ+‰"‘°Í¯¢÷/5uüU£¶Òþ˜_~H ©Æ ¢ÓNº±ª”7Ú`ìѨü[…ëi^¬¡®Kv8lø1Œ¨=,®/`ì¨fø(ûW—=ÿ Àÿ*þöÝןÿþÝo¾ÿæ qçÓÇßüÁýÝ»7ß¾û»wß¾xðÍŸÿùwÿîÝ÷?Û¦¼†Vcþ9 ºÂùE BEW\`Õ£JR·1W ¢ë€©¤R»ýxwËèÑ© ¦¦ú_Ð¥N±vĨcõ¿äæðí}w7˜]§ìEåà3\Q`¼“WbÔÄp÷ž™A4—€ÿŒxjdªï³¾÷–”WJ¯$ۜ޺ ïñ1ùEBiœu“÷™à×È÷*Œêu ¡^v(í,ª tª¯Î>ùÑ“I¶¿ŽB3xðU…úûhúD‰tzÒ×üUd²ýhF¶dJgM\ÿ¤£¦‹£D#4MÃÌu­F>†BwD}è÷aæÚ¤ï¹x"¿ô ¾sÉœŽÙW£-xÔY0÷U9Üt4ª 1£«¶!ÏX{ ^D8»,¤O¢=œþ1~#L˜ƒyãƒ$è%ÓgFæÆÇœã§|À4Gô ¼eSœå&cû:XãO`ý`½”CÄBÚÜf5"ðÄùȸú/Ö]ÒbkÚ„õ½·u‰ýÖÿùÁ mÒ_ÿ§ßüåÿöÙúõÓÿnŸT\ͼ`¤í£uÎêTÄëoùu[GódÉHd)q1ìøÛ÷Æy³Ù a‹ts²ƒ /šLÖUg»`óÓWŽ©tŸ¤“+CìÃ&bûH§pØ=¹Û‚ÌT†W’.Å‹:ãHK‘¤Gä0û»¡ 8Öˆ*©Âö¹ñ‚?Ê)ý·¼ìJñÆ=éõoÿ­>x¹HŸ§0yjpá“7©éÉüêƒnªùveŸ5.¡äDè–<iÛ’„è5&§ÔÀbkn¯¥÷ÂN]³¼c×d0c‚ø¸×b84Àðº±i§Ì|î÷ÈÞ^Ùºx?vƒ;m‰¯jÍÑýu§úôÑ\ÈgjŒŸªÀÉ÷˜ÜÅ>Q÷F*®ß¡ 4*np.pi: m1['angle'] = 315 + 1.5*np.sin(phase) m1a['angle'] = 315 + 1.5*np.sin(phase) else: m2['angle'] = 135 + 1.5*np.sin(phase) m2a['angle'] = 135 + 1.5*np.sin(phase) phase += 0.2 timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(40) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/parallelize.py000066400000000000000000000036341457240071200243560ustar00rootroot00000000000000import time import pyqtgraph as pg import pyqtgraph.multiprocess as mp print( "\n=================\nParallelize") ## Do a simple task: ## for x in range(N): ## sum([x*i for i in range(M)]) ## ## We'll do this three times ## - once without Parallelize ## - once with Parallelize, but forced to use a single worker ## - once with Parallelize automatically determining how many workers to use ## tasks = range(10) results = [None] * len(tasks) results2 = results[:] results3 = results[:] size = 2000000 pg.mkQApp() ### Purely serial processing start = time.time() with pg.ProgressDialog('processing serially..', maximum=len(tasks)) as dlg: for i, x in enumerate(tasks): tot = 0 for j in range(size): tot += j * x results[i] = tot dlg += 1 if dlg.wasCanceled(): raise Exception('processing canceled') print( "Serial time: %0.2f" % (time.time() - start)) ### Use parallelize, but force a single worker ### (this simulates the behavior seen on windows, which lacks os.fork) start = time.time() with mp.Parallelize(enumerate(tasks), results=results2, workers=1, progressDialog='processing serially (using Parallelizer)..') as tasker: for i, x in tasker: tot = 0 for j in range(size): tot += j * x tasker.results[i] = tot print( "\nParallel time, 1 worker: %0.2f" % (time.time() - start)) print( "Results match serial: %s" % str(results2 == results)) ### Use parallelize with multiple workers start = time.time() with mp.Parallelize(enumerate(tasks), results=results3, progressDialog='processing in parallel..') as tasker: for i, x in tasker: tot = 0 for j in range(size): tot += j * x tasker.results[i] = tot print( "\nParallel time, %d workers: %0.2f" % (mp.Parallelize.suggestedWorkerCount(), time.time() - start)) print( "Results match serial: %s" % str(results3 == results)) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/parametertree.py000066400000000000000000000130261457240071200247060ustar00rootroot00000000000000""" This example demonstrates the use of pyqtgraph's parametertree system. This provides a simple way to generate user interfaces that control sets of parameters. The example demonstrates a variety of different parameter types (int, float, list, etc.) as well as some customized parameter types """ # `makeAllParamTypes` creates several parameters from a dictionary of config specs. # This contains information about the options for each parameter so they can be directly # inserted into the example parameter tree. To create your own parameters, simply follow # the guidelines demonstrated by other parameters created here. from _buildParamTypes import makeAllParamTypes import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets app = pg.mkQApp("Parameter Tree Example") import pyqtgraph.parametertree.parameterTypes as pTypes from pyqtgraph.parametertree import Parameter, ParameterTree ## test subclassing parameters ## This parameter automatically generates two child parameters which are always reciprocals of each other class ComplexParameter(pTypes.GroupParameter): def __init__(self, **opts): opts['type'] = 'bool' opts['value'] = True pTypes.GroupParameter.__init__(self, **opts) self.addChild({'name': 'A = 1/B', 'type': 'float', 'value': 7, 'suffix': 'Hz', 'siPrefix': True}) self.addChild({'name': 'B = 1/A', 'type': 'float', 'value': 1/7., 'suffix': 's', 'siPrefix': True}) self.a = self.param('A = 1/B') self.b = self.param('B = 1/A') self.a.sigValueChanged.connect(self.aChanged) self.b.sigValueChanged.connect(self.bChanged) def aChanged(self): self.b.setValue(1.0 / self.a.value(), blockSignal=self.bChanged) def bChanged(self): self.a.setValue(1.0 / self.b.value(), blockSignal=self.aChanged) ## test add/remove ## this group includes a menu allowing the user to add new parameters into its child list class ScalableGroup(pTypes.GroupParameter): def __init__(self, **opts): opts['type'] = 'group' opts['addText'] = "Add" opts['addList'] = ['str', 'float', 'int'] pTypes.GroupParameter.__init__(self, **opts) def addNew(self, typ): val = { 'str': '', 'float': 0.0, 'int': 0 }[typ] self.addChild(dict(name="ScalableParam %d" % (len(self.childs)+1), type=typ, value=val, removable=True, renamable=True)) params = [ makeAllParamTypes(), {'name': 'Save/Restore functionality', 'type': 'group', 'children': [ {'name': 'Save State', 'type': 'action'}, {'name': 'Restore State', 'type': 'action', 'children': [ {'name': 'Add missing items', 'type': 'bool', 'value': True}, {'name': 'Remove extra items', 'type': 'bool', 'value': True}, ]}, ]}, {'name': 'Custom context menu', 'type': 'group', 'children': [ {'name': 'List contextMenu', 'type': 'float', 'value': 0, 'context': [ 'menu1', 'menu2' ]}, {'name': 'Dict contextMenu', 'type': 'float', 'value': 0, 'context': { 'changeName': 'Title', 'internal': 'What the user sees', }}, ]}, ComplexParameter(name='Custom parameter group (reciprocal values)'), ScalableGroup(name="Expandable Parameter Group", tip='Click to add children', children=[ {'name': 'ScalableParam 1', 'type': 'str', 'value': "default param 1"}, {'name': 'ScalableParam 2', 'type': 'str', 'value': "default param 2"}, ]), ] ## Create tree of Parameter objects p = Parameter.create(name='params', type='group', children=params) ## If anything changes in the tree, print a message def change(param, changes): print("tree changes:") for param, change, data in changes: path = p.childPath(param) if path is not None: childName = '.'.join(path) else: childName = param.name() print(' parameter: %s'% childName) print(' change: %s'% change) print(' data: %s'% str(data)) print(' ----------') p.sigTreeStateChanged.connect(change) def valueChanging(param, value): print("Value changing (not finalized): %s %s" % (param, value)) # Only listen for changes of the 'widget' child: for child in p.child('Example Parameters'): if 'widget' in child.names: child.child('widget').sigValueChanging.connect(valueChanging) def save(): global state state = p.saveState() def restore(): global state add = p['Save/Restore functionality', 'Restore State', 'Add missing items'] rem = p['Save/Restore functionality', 'Restore State', 'Remove extra items'] p.restoreState(state, addChildren=add, removeChildren=rem) p.param('Save/Restore functionality', 'Save State').sigActivated.connect(save) p.param('Save/Restore functionality', 'Restore State').sigActivated.connect(restore) ## Create two ParameterTree widgets, both accessing the same data t = ParameterTree() t.setParameters(p, showTop=False) t.setWindowTitle('pyqtgraph example: Parameter Tree') t2 = ParameterTree() t2.setParameters(p, showTop=False) win = QtWidgets.QWidget() layout = QtWidgets.QGridLayout() win.setLayout(layout) layout.addWidget(QtWidgets.QLabel("These are two views of the same data. They should always display the same values."), 0, 0, 1, 2) layout.addWidget(t, 1, 0, 1, 1) layout.addWidget(t2, 1, 1, 1, 1) win.show() ## test save/restore state = p.saveState() p.restoreState(state) compareState = p.saveState() assert pg.eq(compareState, state) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/py2exe/000077500000000000000000000000001457240071200227065ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/py2exe/plotTest.py000066400000000000000000000011021457240071200250700ustar00rootroot00000000000000import sys import pyqtgraph as pg # For packages that require scipy, these may be needed: # from scipy.stats import futil # from scipy.sparse.csgraph import _validation pg.setConfigOption('background','w') pg.setConfigOption('foreground','k') app = QtWidgets.QApplication(sys.argv) pw = pg.plot(x = [0, 1, 2, 4], y = [4, 5, 9, 6]) pw.showGrid(x=True,y=True) text = pg.TextItem(html='
      %s
      ' % "here",anchor=(0.0, 0.0)) text.setPos(1.0, 5.0) pw.addItem(text) status = app.exec_() sys.exit(status) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/py2exe/setup.py000066400000000000000000000021071457240071200244200ustar00rootroot00000000000000import shutil from distutils.core import setup # Remove the build folder shutil.rmtree("build", ignore_errors=True) shutil.rmtree("dist", ignore_errors=True) import sys includes = ['PyQt4', 'PyQt4.QtGui', 'PyQt4.QtSvg', 'sip', 'pyqtgraph.graphicsItems'] excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl', 'Tkconstants', 'Tkinter', 'zmq'] if sys.version[0] == '2': # causes syntax error on py2 excludes.append('PyQt4.uic.port_v3') packages = [] dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll', 'MSVCP90.dll'] icon_resources = [] bitmap_resources = [] other_resources = [] data_files = [] setup( data_files=data_files, console=['plotTest.py'] , options={"py2exe": {"excludes": excludes, "includes": includes, "dll_excludes": dll_excludes, "optimize": 0, "compressed": 2, "bundle_files": 1}}, zipfile=None, ) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/relativity/000077500000000000000000000000001457240071200236665ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/relativity/__init__.py000066400000000000000000000000321457240071200257720ustar00rootroot00000000000000from .relativity import * pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/relativity/presets/000077500000000000000000000000001457240071200253535ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/relativity/presets/Grid Expansion.cfg000066400000000000000000000422711457240071200306540ustar00rootroot00000000000000name: 'params' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'group' children: Load Preset..: name: 'Load Preset..' limits: ['', 'Twin Paradox (grid)', 'Twin Paradox'] strictNaming: False default: None renamable: False enabled: True value: 'Twin Paradox (grid)' visible: True readonly: False values: [] removable: False type: 'list' children: Duration: name: 'Duration' limits: [0.1, None] strictNaming: False default: 10.0 renamable: False enabled: True readonly: False value: 20.0 visible: True step: 0.1 removable: False type: 'float' children: Reference Frame: name: 'Reference Frame' limits: ['Grid00', 'Grid01', 'Grid02', 'Grid03', 'Grid04'] strictNaming: False default: None renamable: False enabled: True value: 'Grid02' visible: True readonly: False values: [] removable: False type: 'list' children: Animate: name: 'Animate' strictNaming: False default: True renamable: False enabled: True value: True visible: True readonly: False removable: False type: 'bool' children: Animation Speed: name: 'Animation Speed' limits: [0.0001, None] strictNaming: False default: 1.0 renamable: False enabled: True readonly: False value: 1.0 visible: True step: 0.1 removable: False dec: True type: 'float' children: Recalculate Worldlines: name: 'Recalculate Worldlines' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'action' children: Save: name: 'Save' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'action' children: Load: name: 'Load' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'action' children: Objects: name: 'Objects' strictNaming: False default: None renamable: False addText: 'Add New..' enabled: True value: None visible: True readonly: False removable: False type: None children: Grid: name: 'Grid' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: 'Grid' autoIncrementName: True children: Number of Clocks: name: 'Number of Clocks' limits: [1, None] strictNaming: False default: 5 renamable: False enabled: True value: 5 visible: True readonly: False removable: False type: 'int' children: Spacing: name: 'Spacing' strictNaming: False default: 1.0 renamable: False enabled: True readonly: False value: 1.0 visible: True step: 0.1 removable: False type: 'float' children: ClockTemplate: name: 'ClockTemplate' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: 'Clock' autoIncrementName: True children: Initial Position: name: 'Initial Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: -2.0 visible: True step: 0.1 removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: None renamable: False addText: 'Add Command..' enabled: True value: None visible: True readonly: False removable: False type: 'AccelerationGroup' children: Command: name: 'Command' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 0.0 renamable: False enabled: True value: 1.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.5 visible: True step: 0.1 removable: False type: 'float' children: Command2: name: 'Command2' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 2.0 renamable: False enabled: True value: 3.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Command3: name: 'Command3' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 4.0 renamable: False enabled: True value: 11.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: -0.5 visible: True step: 0.1 removable: False type: 'float' children: Command4: name: 'Command4' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 8.0 renamable: False enabled: True value: 13.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Rest Mass: name: 'Rest Mass' limits: [1e-09, None] strictNaming: False default: 1.0 renamable: False enabled: True readonly: False value: 1.0 visible: True step: 0.1 removable: False type: 'float' children: Color: name: 'Color' strictNaming: False default: (100, 100, 150) renamable: False enabled: True value: (100, 100, 150, 255) visible: True readonly: False removable: False type: 'color' children: Size: name: 'Size' strictNaming: False default: 0.5 renamable: False enabled: True value: 0.5 visible: True readonly: False removable: False type: 'float' children: Vertical Position: name: 'Vertical Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: addList: ['Clock', 'Grid'] pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/relativity/presets/Twin Paradox (grid).cfg000066400000000000000000000650731457240071200313760ustar00rootroot00000000000000name: 'params' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'group' children: Load Preset..: name: 'Load Preset..' limits: ['', 'Twin Paradox (grid)', 'Twin Paradox'] strictNaming: False default: None renamable: False enabled: True value: 'Twin Paradox (grid)' visible: True readonly: False values: [] removable: False type: 'list' children: Duration: name: 'Duration' limits: [0.1, None] strictNaming: False default: 10.0 renamable: False enabled: True readonly: False value: 27.0 visible: True step: 0.1 removable: False type: 'float' children: Reference Frame: name: 'Reference Frame' limits: ['Grid00', 'Grid01', 'Grid02', 'Grid03', 'Grid04', 'Grid05', 'Grid06', 'Grid07', 'Grid08', 'Grid09', 'Grid10', 'Alice', 'Bob'] strictNaming: False default: None renamable: False enabled: True value: 'Alice' visible: True readonly: False values: [] removable: False type: 'list' children: Animate: name: 'Animate' strictNaming: False default: True renamable: False enabled: True value: True visible: True readonly: False removable: False type: 'bool' children: Animation Speed: name: 'Animation Speed' limits: [0.0001, None] strictNaming: False default: 1.0 renamable: False enabled: True readonly: False value: 1.0 visible: True step: 0.1 removable: False dec: True type: 'float' children: Recalculate Worldlines: name: 'Recalculate Worldlines' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'action' children: Save: name: 'Save' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'action' children: Load: name: 'Load' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'action' children: Objects: name: 'Objects' strictNaming: False default: None renamable: False addText: 'Add New..' enabled: True value: None visible: True readonly: False removable: False type: None children: Grid: name: 'Grid' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: 'Grid' autoIncrementName: True children: Number of Clocks: name: 'Number of Clocks' limits: [1, None] strictNaming: False default: 5 renamable: False enabled: True value: 11 visible: True readonly: False removable: False type: 'int' children: Spacing: name: 'Spacing' strictNaming: False default: 1.0 renamable: False enabled: True readonly: False value: 2.0 visible: True step: 0.1 removable: False type: 'float' children: ClockTemplate: name: 'ClockTemplate' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: 'Clock' autoIncrementName: True children: Initial Position: name: 'Initial Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: -10.0 visible: True step: 0.1 removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: None renamable: False addText: 'Add Command..' enabled: True value: None visible: True readonly: False removable: False type: 'AccelerationGroup' children: Rest Mass: name: 'Rest Mass' limits: [1e-09, None] strictNaming: False default: 1.0 renamable: False enabled: True readonly: False value: 1.0 visible: True step: 0.1 removable: False type: 'float' children: Color: name: 'Color' strictNaming: False default: (100, 100, 150) renamable: False enabled: True value: (77, 77, 77, 255) visible: True readonly: False removable: False type: 'color' children: Size: name: 'Size' strictNaming: False default: 0.5 renamable: False enabled: True value: 1.0 visible: True readonly: False removable: False type: 'float' children: Vertical Position: name: 'Vertical Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: -2.0 visible: True step: 0.1 removable: False type: 'float' children: Alice: name: 'Alice' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: 'Clock' autoIncrementName: True children: Initial Position: name: 'Initial Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: None renamable: False addText: 'Add Command..' enabled: True value: None visible: True readonly: False removable: False type: 'AccelerationGroup' children: Command: name: 'Command' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 0.0 renamable: False enabled: True value: 1.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.5 visible: True step: 0.1 removable: False type: 'float' children: Command2: name: 'Command2' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 2.0 renamable: False enabled: True value: 3.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Command3: name: 'Command3' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 3.0 renamable: False enabled: True value: 8.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: -0.5 visible: True step: 0.1 removable: False type: 'float' children: Command4: name: 'Command4' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 4.0 renamable: False enabled: True value: 12.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Command5: name: 'Command5' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 6.0 renamable: False enabled: True value: 17.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.5 visible: True step: 0.1 removable: False type: 'float' children: Command6: name: 'Command6' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 7.0 renamable: False enabled: True value: 19.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Rest Mass: name: 'Rest Mass' limits: [1e-09, None] strictNaming: False default: 1.0 renamable: False enabled: True readonly: False value: 1.0 visible: True step: 0.1 removable: False type: 'float' children: Color: name: 'Color' strictNaming: False default: (100, 100, 150) renamable: False enabled: True value: (82, 123, 44, 255) visible: True readonly: False removable: False type: 'color' children: Size: name: 'Size' strictNaming: False default: 0.5 renamable: False enabled: True value: 1.5 visible: True readonly: False removable: False type: 'float' children: Vertical Position: name: 'Vertical Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 3.0 visible: True step: 0.1 removable: False type: 'float' children: Bob: name: 'Bob' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: 'Clock' autoIncrementName: True children: Initial Position: name: 'Initial Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: None renamable: False addText: 'Add Command..' enabled: True value: None visible: True readonly: False removable: False type: 'AccelerationGroup' children: Rest Mass: name: 'Rest Mass' limits: [1e-09, None] strictNaming: False default: 1.0 renamable: False enabled: True readonly: False value: 1.0 visible: True step: 0.1 removable: False type: 'float' children: Color: name: 'Color' strictNaming: False default: (100, 100, 150) renamable: False enabled: True value: (69, 69, 126, 255) visible: True readonly: False removable: False type: 'color' children: Size: name: 'Size' strictNaming: False default: 0.5 renamable: False enabled: True value: 1.5 visible: True readonly: False removable: False type: 'float' children: Vertical Position: name: 'Vertical Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: addList: ['Clock', 'Grid'] pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/relativity/presets/Twin Paradox.cfg000066400000000000000000000520311457240071200303350ustar00rootroot00000000000000name: 'params' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'group' children: Load Preset..: name: 'Load Preset..' limits: ['', 'Twin Paradox', 'test'] strictNaming: False default: None renamable: False enabled: True value: 'Twin Paradox' visible: True readonly: False values: [] removable: False type: 'list' children: Duration: name: 'Duration' limits: [0.1, None] strictNaming: False default: 10.0 renamable: False enabled: True readonly: False value: 27.0 visible: True step: 0.1 removable: False type: 'float' children: Reference Frame: name: 'Reference Frame' limits: ['Alice', 'Bob'] strictNaming: False default: None renamable: False enabled: True value: 'Alice' visible: True readonly: False values: [] removable: False type: 'list' children: Animate: name: 'Animate' strictNaming: False default: True renamable: False enabled: True value: True visible: True readonly: False removable: False type: 'bool' children: Animation Speed: name: 'Animation Speed' limits: [0.0001, None] strictNaming: False default: 1.0 renamable: False enabled: True readonly: False value: 1.0 visible: True step: 0.1 removable: False dec: True type: 'float' children: Recalculate Worldlines: name: 'Recalculate Worldlines' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'action' children: Save: name: 'Save' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'action' children: Load: name: 'Load' strictNaming: False default: None renamable: False enabled: True value: None visible: True readonly: False removable: False type: 'action' children: Objects: name: 'Objects' strictNaming: False default: None renamable: False addText: 'Add New..' enabled: True value: None visible: True readonly: False removable: False type: None children: Alice: name: 'Alice' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: 'Clock' autoIncrementName: True children: Initial Position: name: 'Initial Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: None renamable: False addText: 'Add Command..' enabled: True value: None visible: True readonly: False removable: False type: 'AccelerationGroup' children: Command: name: 'Command' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 0.0 renamable: False enabled: True value: 1.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.5 visible: True step: 0.1 removable: False type: 'float' children: Command2: name: 'Command2' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 2.0 renamable: False enabled: True value: 3.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Command3: name: 'Command3' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 3.0 renamable: False enabled: True value: 8.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: -0.5 visible: True step: 0.1 removable: False type: 'float' children: Command4: name: 'Command4' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 4.0 renamable: False enabled: True value: 12.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Command5: name: 'Command5' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 6.0 renamable: False enabled: True value: 17.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.5 visible: True step: 0.1 removable: False type: 'float' children: Command6: name: 'Command6' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: None autoIncrementName: True children: Proper Time: name: 'Proper Time' strictNaming: False default: 7.0 renamable: False enabled: True value: 19.0 visible: True readonly: False removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Rest Mass: name: 'Rest Mass' limits: [1e-09, None] strictNaming: False default: 1.0 renamable: False enabled: True readonly: False value: 1.0 visible: True step: 0.1 removable: False type: 'float' children: Color: name: 'Color' strictNaming: False default: (100, 100, 150) renamable: False enabled: True value: (82, 123, 44, 255) visible: True readonly: False removable: False type: 'color' children: Size: name: 'Size' strictNaming: False default: 0.5 renamable: False enabled: True value: 0.5 visible: True readonly: False removable: False type: 'float' children: Vertical Position: name: 'Vertical Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.5 visible: True step: 0.1 removable: False type: 'float' children: Bob: name: 'Bob' strictNaming: False default: None renamable: True enabled: True value: None visible: True readonly: False removable: True type: 'Clock' autoIncrementName: True children: Initial Position: name: 'Initial Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: Acceleration: name: 'Acceleration' strictNaming: False default: None renamable: False addText: 'Add Command..' enabled: True value: None visible: True readonly: False removable: False type: 'AccelerationGroup' children: Rest Mass: name: 'Rest Mass' limits: [1e-09, None] strictNaming: False default: 1.0 renamable: False enabled: True readonly: False value: 1.0 visible: True step: 0.1 removable: False type: 'float' children: Color: name: 'Color' strictNaming: False default: (100, 100, 150) renamable: False enabled: True value: (69, 69, 126, 255) visible: True readonly: False removable: False type: 'color' children: Size: name: 'Size' strictNaming: False default: 0.5 renamable: False enabled: True value: 0.5 visible: True readonly: False removable: False type: 'float' children: Vertical Position: name: 'Vertical Position' strictNaming: False default: 0.0 renamable: False enabled: True readonly: False value: 0.0 visible: True step: 0.1 removable: False type: 'float' children: addList: ['Clock', 'Grid'] pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/relativity/relativity.py000066400000000000000000000665751457240071200264570ustar00rootroot00000000000000import collections import os import sys from time import perf_counter import numpy as np import pyqtgraph as pg from pyqtgraph import configfile from pyqtgraph.parametertree import Parameter, ParameterTree from pyqtgraph.parametertree import types as pTypes from pyqtgraph.Qt import QtCore, QtGui, QtWidgets class RelativityGUI(QtWidgets.QWidget): def __init__(self): QtWidgets.QWidget.__init__(self) self.animations = [] self.animTimer = QtCore.QTimer() self.animTimer.timeout.connect(self.stepAnimation) self.animTime = 0 self.animDt = .016 self.lastAnimTime = 0 self.setupGUI() self.objectGroup = ObjectGroupParam() self.params = Parameter.create(name='params', type='group', children=[ dict(name='Load Preset..', type='list', limits=[]), #dict(name='Unit System', type='list', limits=['', 'MKS']), dict(name='Duration', type='float', value=10.0, step=0.1, limits=[0.1, None]), dict(name='Reference Frame', type='list', limits=[]), dict(name='Animate', type='bool', value=True), dict(name='Animation Speed', type='float', value=1.0, dec=True, step=0.1, limits=[0.0001, None]), dict(name='Recalculate Worldlines', type='action'), dict(name='Save', type='action'), dict(name='Load', type='action'), self.objectGroup, ]) self.tree.setParameters(self.params, showTop=False) self.params.param('Recalculate Worldlines').sigActivated.connect(self.recalculate) self.params.param('Save').sigActivated.connect(self.save) self.params.param('Load').sigActivated.connect(self.load) self.params.param('Load Preset..').sigValueChanged.connect(self.loadPreset) self.params.sigTreeStateChanged.connect(self.treeChanged) ## read list of preset configs presetDir = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'presets') if os.path.exists(presetDir): presets = [os.path.splitext(p)[0] for p in os.listdir(presetDir)] self.params.param('Load Preset..').setLimits(['']+presets) def setupGUI(self): self.layout = QtWidgets.QVBoxLayout() self.layout.setContentsMargins(0,0,0,0) self.setLayout(self.layout) self.splitter = QtWidgets.QSplitter() self.splitter.setOrientation(QtCore.Qt.Orientation.Horizontal) self.layout.addWidget(self.splitter) self.tree = ParameterTree(showHeader=False) self.splitter.addWidget(self.tree) self.splitter2 = QtWidgets.QSplitter() self.splitter2.setOrientation(QtCore.Qt.Orientation.Vertical) self.splitter.addWidget(self.splitter2) self.worldlinePlots = pg.GraphicsLayoutWidget() self.splitter2.addWidget(self.worldlinePlots) self.animationPlots = pg.GraphicsLayoutWidget() self.splitter2.addWidget(self.animationPlots) self.splitter2.setSizes([int(self.height()*0.8), int(self.height()*0.2)]) self.inertWorldlinePlot = self.worldlinePlots.addPlot() self.refWorldlinePlot = self.worldlinePlots.addPlot() self.inertAnimationPlot = self.animationPlots.addPlot() self.inertAnimationPlot.setAspectLocked(1) self.refAnimationPlot = self.animationPlots.addPlot() self.refAnimationPlot.setAspectLocked(1) self.inertAnimationPlot.setXLink(self.inertWorldlinePlot) self.refAnimationPlot.setXLink(self.refWorldlinePlot) def recalculate(self): ## build 2 sets of clocks clocks1 = collections.OrderedDict() clocks2 = collections.OrderedDict() for cl in self.params.param('Objects'): clocks1.update(cl.buildClocks()) clocks2.update(cl.buildClocks()) ## Inertial simulation dt = self.animDt * self.params['Animation Speed'] sim1 = Simulation(clocks1, ref=None, duration=self.params['Duration'], dt=dt) sim1.run() sim1.plot(self.inertWorldlinePlot) self.inertWorldlinePlot.autoRange(padding=0.1) ## reference simulation ref = self.params['Reference Frame'] dur = clocks1[ref].refData['pt'][-1] ## decide how long to run the reference simulation sim2 = Simulation(clocks2, ref=clocks2[ref], duration=dur, dt=dt) sim2.run() sim2.plot(self.refWorldlinePlot) self.refWorldlinePlot.autoRange(padding=0.1) ## create animations self.refAnimationPlot.clear() self.inertAnimationPlot.clear() self.animTime = 0 self.animations = [Animation(sim1), Animation(sim2)] self.inertAnimationPlot.addItem(self.animations[0]) self.refAnimationPlot.addItem(self.animations[1]) ## create lines representing all that is visible to a particular reference #self.inertSpaceline = Spaceline(sim1, ref) #self.refSpaceline = Spaceline(sim2) self.inertWorldlinePlot.addItem(self.animations[0].items[ref].spaceline()) self.refWorldlinePlot.addItem(self.animations[1].items[ref].spaceline()) def setAnimation(self, a): if a: self.lastAnimTime = perf_counter() self.animTimer.start(int(self.animDt*1000)) else: self.animTimer.stop() def stepAnimation(self): now = perf_counter() dt = (now-self.lastAnimTime) * self.params['Animation Speed'] self.lastAnimTime = now self.animTime += dt if self.animTime > self.params['Duration']: self.animTime = 0 for a in self.animations: a.restart() for a in self.animations: a.stepTo(self.animTime) def treeChanged(self, *args): clocks = [] for c in self.params.param('Objects'): clocks.extend(c.clockNames()) #for param, change, data in args[1]: #if change == 'childAdded': self.params.param('Reference Frame').setLimits(clocks) self.setAnimation(self.params['Animate']) def save(self): filename, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Save State..", "untitled.cfg", "Config Files (*.cfg)") if not filename: return state = self.params.saveState() configfile.writeConfigFile(state, filename) def load(self): filename, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Save State..", "", "Config Files (*.cfg)") if not filename: return state = configfile.readConfigFile(filename) self.loadState(state) def loadPreset(self, param, preset): if preset == '': return path = os.path.abspath(os.path.dirname(__file__)) fn = os.path.join(path, 'presets', preset+".cfg") state = configfile.readConfigFile(fn) self.loadState(state) def loadState(self, state): if 'Load Preset..' in state['children']: del state['children']['Load Preset..']['limits'] del state['children']['Load Preset..']['value'] self.params.param('Objects').clearChildren() self.params.restoreState(state, removeChildren=False) self.recalculate() class ObjectGroupParam(pTypes.GroupParameter): def __init__(self): pTypes.GroupParameter.__init__(self, name="Objects", addText="Add New..", addList=['Clock', 'Grid']) def addNew(self, typ): if typ == 'Clock': self.addChild(ClockParam()) elif typ == 'Grid': self.addChild(GridParam()) class ClockParam(pTypes.GroupParameter): def __init__(self, **kwds): defs = dict(name="Clock", autoIncrementName=True, renamable=True, removable=True, children=[ dict(name='Initial Position', type='float', value=0.0, step=0.1), #dict(name='V0', type='float', value=0.0, step=0.1), AccelerationGroup(), dict(name='Rest Mass', type='float', value=1.0, step=0.1, limits=[1e-9, None]), dict(name='Color', type='color', value=(100,100,150)), dict(name='Size', type='float', value=0.5), dict(name='Vertical Position', type='float', value=0.0, step=0.1), ]) #defs.update(kwds) pTypes.GroupParameter.__init__(self, **defs) self.restoreState(kwds, removeChildren=False) def buildClocks(self): x0 = self['Initial Position'] y0 = self['Vertical Position'] color = self['Color'] m = self['Rest Mass'] size = self['Size'] prog = self.param('Acceleration').generate() c = Clock(x0=x0, m0=m, y0=y0, color=color, prog=prog, size=size) return {self.name(): c} def clockNames(self): return [self.name()] pTypes.registerParameterType('Clock', ClockParam) class GridParam(pTypes.GroupParameter): def __init__(self, **kwds): defs = dict(name="Grid", autoIncrementName=True, renamable=True, removable=True, children=[ dict(name='Number of Clocks', type='int', value=5, limits=[1, None]), dict(name='Spacing', type='float', value=1.0, step=0.1), ClockParam(name='ClockTemplate'), ]) #defs.update(kwds) pTypes.GroupParameter.__init__(self, **defs) self.restoreState(kwds, removeChildren=False) def buildClocks(self): clocks = {} template = self.param('ClockTemplate') spacing = self['Spacing'] for i in range(self['Number of Clocks']): c = list(template.buildClocks().values())[0] c.x0 += i * spacing clocks[self.name() + '%02d' % i] = c return clocks def clockNames(self): return [self.name() + '%02d' % i for i in range(self['Number of Clocks'])] pTypes.registerParameterType('Grid', GridParam) class AccelerationGroup(pTypes.GroupParameter): def __init__(self, **kwds): defs = dict(name="Acceleration", addText="Add Command..") pTypes.GroupParameter.__init__(self, **defs) self.restoreState(kwds, removeChildren=False) def addNew(self): nextTime = 0.0 if self.hasChildren(): nextTime = self.children()[-1]['Proper Time'] + 1 self.addChild(Parameter.create(name='Command', autoIncrementName=True, type=None, renamable=True, removable=True, children=[ dict(name='Proper Time', type='float', value=nextTime), dict(name='Acceleration', type='float', value=0.0, step=0.1), ])) def generate(self): prog = [] for cmd in self: prog.append((cmd['Proper Time'], cmd['Acceleration'])) return prog pTypes.registerParameterType('AccelerationGroup', AccelerationGroup) class Clock(object): nClocks = 0 def __init__(self, x0=0.0, y0=0.0, m0=1.0, v0=0.0, t0=0.0, color=None, prog=None, size=0.5): Clock.nClocks += 1 self.pen = pg.mkPen(color) self.brush = pg.mkBrush(color) self.y0 = y0 self.x0 = x0 self.v0 = v0 self.m0 = m0 self.t0 = t0 self.prog = prog self.size = size def init(self, nPts): ## Keep records of object from inertial frame as well as reference frame self.inertData = np.empty(nPts, dtype=[('x', float), ('t', float), ('v', float), ('pt', float), ('m', float), ('f', float)]) self.refData = np.empty(nPts, dtype=[('x', float), ('t', float), ('v', float), ('pt', float), ('m', float), ('f', float)]) ## Inertial frame variables self.x = self.x0 self.v = self.v0 self.m = self.m0 self.t = 0.0 ## reference clock always starts at 0 self.pt = self.t0 ## proper time starts at t0 ## reference frame variables self.refx = None self.refv = None self.refm = None self.reft = None self.recordFrame(0) def recordFrame(self, i): f = self.force() self.inertData[i] = (self.x, self.t, self.v, self.pt, self.m, f) self.refData[i] = (self.refx, self.reft, self.refv, self.pt, self.refm, f) def force(self, t=None): if len(self.prog) == 0: return 0.0 if t is None: t = self.pt ret = 0.0 for t1,f in self.prog: if t >= t1: ret = f return ret def acceleration(self, t=None): return self.force(t) / self.m0 def accelLimits(self): ## return the proper time values which bound the current acceleration command if len(self.prog) == 0: return -np.inf, np.inf t = self.pt ind = -1 for i, v in enumerate(self.prog): t1,f = v if t >= t1: ind = i if ind == -1: return -np.inf, self.prog[0][0] elif ind == len(self.prog)-1: return self.prog[-1][0], np.inf else: return self.prog[ind][0], self.prog[ind+1][0] def getCurve(self, ref=True): if ref is False: data = self.inertData else: data = self.refData[1:] x = data['x'] y = data['t'] curve = pg.PlotCurveItem(x=x, y=y, pen=self.pen) #x = self.data['x'] - ref.data['x'] #y = self.data['t'] step = 1.0 #mod = self.data['pt'] % step #inds = np.argwhere(abs(mod[1:] - mod[:-1]) > step*0.9) inds = [0] pt = data['pt'] for i in range(1,len(pt)): diff = pt[i] - pt[inds[-1]] if abs(diff) >= step: inds.append(i) inds = np.array(inds) #t = self.data['t'][inds] #x = self.data['x'][inds] pts = [] for i in inds: x = data['x'][i] y = data['t'][i] if i+1 < len(data): dpt = data['pt'][i+1]-data['pt'][i] dt = data['t'][i+1]-data['t'][i] else: dpt = 1 if dpt > 0: c = pg.mkBrush((0,0,0)) else: c = pg.mkBrush((200,200,200)) pts.append({'pos': (x, y), 'brush': c}) points = pg.ScatterPlotItem(pts, pen=self.pen, size=7) return curve, points class Simulation: def __init__(self, clocks, ref, duration, dt): self.clocks = clocks self.ref = ref self.duration = duration self.dt = dt @staticmethod def hypTStep(dt, v0, x0, tau0, g): ## Hyperbolic step. ## If an object has proper acceleration g and starts at position x0 with speed v0 and proper time tau0 ## as seen from an inertial frame, then return the new v, x, tau after time dt has elapsed. if g == 0: return v0, x0 + v0*dt, tau0 + dt * (1. - v0**2)**0.5 v02 = v0**2 g2 = g**2 tinit = v0 / (g * (1 - v02)**0.5) B = (1 + (g2 * (dt+tinit)**2))**0.5 v1 = g * (dt+tinit) / B dtau = (np.arcsinh(g * (dt+tinit)) - np.arcsinh(g * tinit)) / g tau1 = tau0 + dtau x1 = x0 + (1.0 / g) * ( B - 1. / (1.-v02)**0.5 ) return v1, x1, tau1 @staticmethod def tStep(dt, v0, x0, tau0, g): ## Linear step. ## Probably not as accurate as hyperbolic step, but certainly much faster. gamma = (1. - v0**2)**-0.5 dtau = dt / gamma return v0 + dtau * g, x0 + v0*dt, tau0 + dtau @staticmethod def tauStep(dtau, v0, x0, t0, g): ## linear step in proper time of clock. ## If an object has proper acceleration g and starts at position x0 with speed v0 at time t0 ## as seen from an inertial frame, then return the new v, x, t after proper time dtau has elapsed. ## Compute how much t will change given a proper-time step of dtau gamma = (1. - v0**2)**-0.5 if g == 0: dt = dtau * gamma else: v0g = v0 * gamma dt = (np.sinh(dtau * g + np.arcsinh(v0g)) - v0g) / g #return v0 + dtau * g, x0 + v0*dt, t0 + dt v1, x1, t1 = Simulation.hypTStep(dt, v0, x0, t0, g) return v1, x1, t0+dt @staticmethod def hypIntersect(x0r, t0r, vr, x0, t0, v0, g): ## given a reference clock (seen from inertial frame) has rx, rt, and rv, ## and another clock starts at x0, t0, and v0, with acceleration g, ## compute the intersection time of the object clock's hyperbolic path with ## the reference plane. ## I'm sure we can simplify this... if g == 0: ## no acceleration, path is linear (and hyperbola is undefined) #(-t0r + t0 v0 vr - vr x0 + vr x0r)/(-1 + v0 vr) t = (-t0r + t0 *v0 *vr - vr *x0 + vr *x0r)/(-1 + v0 *vr) return t gamma = (1.0-v0**2)**-0.5 sel = (1 if g>0 else 0) + (1 if vr<0 else 0) sel = sel%2 if sel == 0: #(1/(g^2 (-1 + vr^2)))(-g^2 t0r + g gamma vr + g^2 t0 vr^2 - #g gamma v0 vr^2 - g^2 vr x0 + #g^2 vr x0r + \[Sqrt](g^2 vr^2 (1 + gamma^2 (v0 - vr)^2 - vr^2 + #2 g gamma (v0 - vr) (-t0 + t0r + vr (x0 - x0r)) + #g^2 (t0 - t0r + vr (-x0 + x0r))^2))) t = (1./(g**2 *(-1. + vr**2)))*(-g**2 *t0r + g *gamma *vr + g**2 *t0 *vr**2 - g *gamma *v0 *vr**2 - g**2 *vr *x0 + g**2 *vr *x0r + np.sqrt(g**2 *vr**2 *(1. + gamma**2 *(v0 - vr)**2 - vr**2 + 2 *g *gamma *(v0 - vr)* (-t0 + t0r + vr *(x0 - x0r)) + g**2 *(t0 - t0r + vr* (-x0 + x0r))**2))) else: #-(1/(g^2 (-1 + vr^2)))(g^2 t0r - g gamma vr - g^2 t0 vr^2 + #g gamma v0 vr^2 + g^2 vr x0 - #g^2 vr x0r + \[Sqrt](g^2 vr^2 (1 + gamma^2 (v0 - vr)^2 - vr^2 + #2 g gamma (v0 - vr) (-t0 + t0r + vr (x0 - x0r)) + #g^2 (t0 - t0r + vr (-x0 + x0r))^2))) t = -(1./(g**2 *(-1. + vr**2)))*(g**2 *t0r - g *gamma* vr - g**2 *t0 *vr**2 + g *gamma *v0 *vr**2 + g**2* vr* x0 - g**2 *vr *x0r + np.sqrt(g**2* vr**2 *(1. + gamma**2 *(v0 - vr)**2 - vr**2 + 2 *g *gamma *(v0 - vr) *(-t0 + t0r + vr *(x0 - x0r)) + g**2 *(t0 - t0r + vr *(-x0 + x0r))**2))) return t def run(self): nPts = int(self.duration/self.dt)+1 for cl in self.clocks.values(): cl.init(nPts) if self.ref is None: self.runInertial(nPts) else: self.runReference(nPts) def runInertial(self, nPts): clocks = self.clocks dt = self.dt tVals = np.linspace(0, dt*(nPts-1), nPts) for cl in self.clocks.values(): for i in range(1,nPts): nextT = tVals[i] while True: tau1, tau2 = cl.accelLimits() x = cl.x v = cl.v tau = cl.pt g = cl.acceleration() v1, x1, tau1 = self.hypTStep(dt, v, x, tau, g) if tau1 > tau2: dtau = tau2-tau cl.v, cl.x, cl.t = self.tauStep(dtau, v, x, cl.t, g) cl.pt = tau2 else: cl.v, cl.x, cl.pt = v1, x1, tau1 cl.t += dt if cl.t >= nextT: cl.refx = cl.x cl.refv = cl.v cl.reft = cl.t cl.recordFrame(i) break def runReference(self, nPts): clocks = self.clocks ref = self.ref dt = self.dt dur = self.duration ## make sure reference clock is not present in the list of clocks--this will be handled separately. clocks = clocks.copy() for k,v in clocks.items(): if v is ref: del clocks[k] break ref.refx = 0 ref.refv = 0 ref.refm = ref.m0 ## These are the set of proper times (in the reference frame) that will be simulated ptVals = np.linspace(ref.pt, ref.pt + dt*(nPts-1), nPts) for i in range(1,nPts): ## step reference clock ahead one time step in its proper time nextPt = ptVals[i] ## this is where (when) we want to end up while True: tau1, tau2 = ref.accelLimits() dtau = min(nextPt-ref.pt, tau2-ref.pt) ## do not step past the next command boundary g = ref.acceleration() v, x, t = Simulation.tauStep(dtau, ref.v, ref.x, ref.t, g) ref.pt += dtau ref.v = v ref.x = x ref.t = t ref.reft = ref.pt if ref.pt >= nextPt: break #else: #print "Stepped to", tau2, "instead of", nextPt ref.recordFrame(i) ## determine plane visible to reference clock ## this plane goes through the point ref.x, ref.t and has slope = ref.v ## update all other clocks for cl in clocks.values(): while True: g = cl.acceleration() tau1, tau2 = cl.accelLimits() ##Given current position / speed of clock, determine where it will intersect reference plane #t1 = (ref.v * (cl.x - cl.v * cl.t) + (ref.t - ref.v * ref.x)) / (1. - cl.v) t1 = Simulation.hypIntersect(ref.x, ref.t, ref.v, cl.x, cl.t, cl.v, g) dt1 = t1 - cl.t ## advance clock by correct time step v, x, tau = Simulation.hypTStep(dt1, cl.v, cl.x, cl.pt, g) ## check to see whether we have gone past an acceleration command boundary. ## if so, we must instead advance the clock to the boundary and start again if tau < tau1: dtau = tau1 - cl.pt cl.v, cl.x, cl.t = Simulation.tauStep(dtau, cl.v, cl.x, cl.t, g) cl.pt = tau1-0.000001 continue if tau > tau2: dtau = tau2 - cl.pt cl.v, cl.x, cl.t = Simulation.tauStep(dtau, cl.v, cl.x, cl.t, g) cl.pt = tau2 continue ## Otherwise, record the new values and exit the loop cl.v = v cl.x = x cl.pt = tau cl.t = t1 cl.m = None break ## transform position into reference frame x = cl.x - ref.x t = cl.t - ref.t gamma = (1.0 - ref.v**2) ** -0.5 vg = -ref.v * gamma cl.refx = gamma * (x - ref.v * t) cl.reft = ref.pt # + gamma * (t - ref.v * x) # this term belongs here, but it should always be equal to 0. cl.refv = (cl.v - ref.v) / (1.0 - cl.v * ref.v) cl.refm = None cl.recordFrame(i) t += dt def plot(self, plot): plot.clear() for cl in self.clocks.values(): c, p = cl.getCurve() plot.addItem(c) plot.addItem(p) class Animation(pg.ItemGroup): def __init__(self, sim): pg.ItemGroup.__init__(self) self.sim = sim self.clocks = sim.clocks self.items = {} for name, cl in self.clocks.items(): item = ClockItem(cl) self.addItem(item) self.items[name] = item def restart(self): for cl in self.items.values(): cl.reset() def stepTo(self, t): for i in self.items.values(): i.stepTo(t) class ClockItem(pg.ItemGroup): def __init__(self, clock): pg.ItemGroup.__init__(self) self.size = clock.size self.item = QtWidgets.QGraphicsEllipseItem(QtCore.QRectF(0, 0, self.size, self.size)) tr = QtGui.QTransform.fromTranslate(-self.size*0.5, -self.size*0.5) self.item.setTransform(tr) self.item.setPen(pg.mkPen(100,100,100)) self.item.setBrush(clock.brush) self.hand = QtWidgets.QGraphicsLineItem(0, 0, 0, self.size*0.5) self.hand.setPen(pg.mkPen('w')) self.hand.setZValue(10) self.flare = QtWidgets.QGraphicsPolygonItem(QtGui.QPolygonF([ QtCore.QPointF(0, -self.size*0.25), QtCore.QPointF(0, self.size*0.25), QtCore.QPointF(self.size*1.5, 0), QtCore.QPointF(0, -self.size*0.25), ])) self.flare.setPen(pg.mkPen('y')) self.flare.setBrush(pg.mkBrush(255,150,0)) self.flare.setZValue(-10) self.addItem(self.hand) self.addItem(self.item) self.addItem(self.flare) self.clock = clock self.i = 1 self._spaceline = None def spaceline(self): if self._spaceline is None: self._spaceline = pg.InfiniteLine() self._spaceline.setPen(self.clock.pen) return self._spaceline def stepTo(self, t): data = self.clock.refData while self.i < len(data)-1 and data['t'][self.i] < t: self.i += 1 while self.i > 1 and data['t'][self.i-1] >= t: self.i -= 1 self.setPos(data['x'][self.i], self.clock.y0) t = data['pt'][self.i] self.hand.setRotation(-0.25 * t * 360.) v = data['v'][self.i] gam = (1.0 - v**2)**0.5 self.setTransform(QtGui.QTransform.fromScale(gam, 1.0)) f = data['f'][self.i] tr = QtGui.QTransform() if f < 0: tr.translate(self.size*0.4, 0) else: tr.translate(-self.size*0.4, 0) tr.scale(-f * (0.5+np.random.random()*0.1), 1.0) self.flare.setTransform(tr) if self._spaceline is not None: self._spaceline.setPos(pg.Point(data['x'][self.i], data['t'][self.i])) self._spaceline.setAngle(data['v'][self.i] * 45.) def reset(self): self.i = 1 #class Spaceline(pg.InfiniteLine): #def __init__(self, sim, frame): #self.sim = sim #self.frame = frame #pg.InfiniteLine.__init__(self) #self.setPen(sim.clocks[frame].pen) #def stepTo(self, t): #self.setAngle(0) #pass if __name__ == '__main__': app = pg.mkQApp() #import pyqtgraph.console #cw = pyqtgraph.console.ConsoleWidget() #cw.show() #cw.catchNextException() win = RelativityGUI() win.setWindowTitle("Relativity!") win.show() win.resize(1100,700) pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/relativity_demo.py000066400000000000000000000004401457240071200252420ustar00rootroot00000000000000""" Special relativity simulation """ from relativity import RelativityGUI import pyqtgraph as pg pg.mkQApp() win = RelativityGUI() win.setWindowTitle("Relativity!") win.resize(1100,700) win.show() win.loadPreset(None, 'Twin Paradox (grid)') if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/scrollingPlots.py000066400000000000000000000051651457240071200250710ustar00rootroot00000000000000""" Various methods of drawing scrolling plots. """ from time import perf_counter import numpy as np import pyqtgraph as pg win = pg.GraphicsLayoutWidget(show=True) win.setWindowTitle('pyqtgraph example: Scrolling Plots') # 1) Simplest approach -- update data in the array such that plot appears to scroll # In these examples, the array size is fixed. p1 = win.addPlot() p2 = win.addPlot() data1 = np.random.normal(size=300) curve1 = p1.plot(data1) curve2 = p2.plot(data1) ptr1 = 0 def update1(): global data1, ptr1 data1[:-1] = data1[1:] # shift data in the array one sample left # (see also: np.roll) data1[-1] = np.random.normal() curve1.setData(data1) ptr1 += 1 curve2.setData(data1) curve2.setPos(ptr1, 0) # 2) Allow data to accumulate. In these examples, the array doubles in length # whenever it is full. win.nextRow() p3 = win.addPlot() p4 = win.addPlot() # Use automatic downsampling and clipping to reduce the drawing load p3.setDownsampling(mode='peak') p4.setDownsampling(mode='peak') p3.setClipToView(True) p4.setClipToView(True) p3.setRange(xRange=[-100, 0]) p3.setLimits(xMax=0) curve3 = p3.plot() curve4 = p4.plot() data3 = np.empty(100) ptr3 = 0 def update2(): global data3, ptr3 data3[ptr3] = np.random.normal() ptr3 += 1 if ptr3 >= data3.shape[0]: tmp = data3 data3 = np.empty(data3.shape[0] * 2) data3[:tmp.shape[0]] = tmp curve3.setData(data3[:ptr3]) curve3.setPos(-ptr3, 0) curve4.setData(data3[:ptr3]) # 3) Plot in chunks, adding one new plot curve for every 100 samples chunkSize = 100 # Remove chunks after we have 10 maxChunks = 10 startTime = perf_counter() win.nextRow() p5 = win.addPlot(colspan=2) p5.setLabel('bottom', 'Time', 's') p5.setXRange(-10, 0) curves = [] data5 = np.empty((chunkSize+1,2)) ptr5 = 0 def update3(): global p5, data5, ptr5, curves now = perf_counter() for c in curves: c.setPos(-(now-startTime), 0) i = ptr5 % chunkSize if i == 0: curve = p5.plot() curves.append(curve) last = data5[-1] data5 = np.empty((chunkSize+1,2)) data5[0] = last while len(curves) > maxChunks: c = curves.pop(0) p5.removeItem(c) else: curve = curves[-1] data5[i+1,0] = now - startTime data5[i+1,1] = np.random.normal() curve.setData(x=data5[:i+2, 0], y=data5[:i+2, 1]) ptr5 += 1 # update all plots def update(): update1() update2() update3() timer = pg.QtCore.QTimer() timer.timeout.connect(update) timer.start(50) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/syntax.py000066400000000000000000000173751457240071200234070ustar00rootroot00000000000000# based on https://github.com/art1415926535/PyQt5-syntax-highlighting import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui, QtWidgets QRegExp = QtCore.QRegExp QFont = QtGui.QFont QColor = QtGui.QColor QTextCharFormat = QtGui.QTextCharFormat QSyntaxHighlighter = QtGui.QSyntaxHighlighter def format(color, style=''): """ Return a QTextCharFormat with the given attributes. """ _color = pg.functions.mkColor(color) _format = QTextCharFormat() _format.setForeground(_color) if 'bold' in style: _format.setFontWeight(QFont.Weight.Bold) if 'italic' in style: _format.setFontItalic(True) return _format class LightThemeColors: Red = "#B71C1C" Pink = "#FCE4EC" Purple = "#4A148C" DeepPurple = "#311B92" Indigo = "#1A237E" Blue = "#0D47A1" LightBlue = "#01579B" Cyan = "#006064" Teal = "#004D40" Green = "#1B5E20" LightGreen = "#33691E" Lime = "#827717" Yellow = "#F57F17" Amber = "#FF6F00" Orange = "#E65100" DeepOrange = "#BF360C" Brown = "#3E2723" Grey = "#212121" BlueGrey = "#263238" class DarkThemeColors: Red = "#F44336" Pink = "#F48FB1" Purple = "#CE93D8" DeepPurple = "#B39DDB" Indigo = "#9FA8DA" Blue = "#90CAF9" LightBlue = "#81D4FA" Cyan = "#80DEEA" Teal = "#80CBC4" Green = "#A5D6A7" LightGreen = "#C5E1A5" Lime = "#E6EE9C" Yellow = "#FFF59D" Amber = "#FFE082" Orange = "#FFCC80" DeepOrange = "#FFAB91" Brown = "#BCAAA4" Grey = "#EEEEEE" BlueGrey = "#B0BEC5" LIGHT_STYLES = { 'keyword': format(LightThemeColors.Blue, 'bold'), 'operator': format(LightThemeColors.Red, 'bold'), 'brace': format(LightThemeColors.Purple), 'defclass': format(LightThemeColors.Indigo, 'bold'), 'string': format(LightThemeColors.Amber), 'string2': format(LightThemeColors.DeepPurple), 'comment': format(LightThemeColors.Green, 'italic'), 'self': format(LightThemeColors.Blue, 'bold'), 'numbers': format(LightThemeColors.Teal), } DARK_STYLES = { 'keyword': format(DarkThemeColors.Blue, 'bold'), 'operator': format(DarkThemeColors.Red, 'bold'), 'brace': format(DarkThemeColors.Purple), 'defclass': format(DarkThemeColors.Indigo, 'bold'), 'string': format(DarkThemeColors.Amber), 'string2': format(DarkThemeColors.DeepPurple), 'comment': format(DarkThemeColors.Green, 'italic'), 'self': format(DarkThemeColors.Blue, 'bold'), 'numbers': format(DarkThemeColors.Teal), } class PythonHighlighter(QSyntaxHighlighter): """Syntax highlighter for the Python language. """ # Python keywords keywords = [ 'and', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'yield', 'None', 'True', 'False', 'async', 'await', ] # Python operators operators = [ r'=', # Comparison r'==', r'!=', r'<', r'<=', r'>', r'>=', # Arithmetic r'\+', r'-', r'\*', r'/', r'//', r'\%', r'\*\*', # In-place r'\+=', r'-=', r'\*=', r'/=', r'\%=', # Bitwise r'\^', r'\|', r'\&', r'\~', r'>>', r'<<', ] # Python braces braces = [ r'\{', r'\}', r'\(', r'\)', r'\[', r'\]', ] def __init__(self, document): QSyntaxHighlighter.__init__(self, document) # Multi-line strings (expression, flag, style) # FIXME: The triple-quotes in these two lines will mess up the # syntax highlighting from this point onward self.tri_single = (QRegExp("'''"), 1, 'string2') self.tri_double = (QRegExp('"""'), 2, 'string2') rules = [] # Keyword, operator, and brace rules rules += [(r'\b%s\b' % w, 0, 'keyword') for w in PythonHighlighter.keywords] rules += [(r'%s' % o, 0, 'operator') for o in PythonHighlighter.operators] rules += [(r'%s' % b, 0, 'brace') for b in PythonHighlighter.braces] # All other rules rules += [ # 'self' (r'\bself\b', 0, 'self'), # 'def' followed by an identifier (r'\bdef\b\s*(\w+)', 1, 'defclass'), # 'class' followed by an identifier (r'\bclass\b\s*(\w+)', 1, 'defclass'), # Numeric literals (r'\b[+-]?[0-9]+[lL]?\b', 0, 'numbers'), (r'\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\b', 0, 'numbers'), (r'\b[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\b', 0, 'numbers'), # Double-quoted string, possibly containing escape sequences (r'"[^"\\]*(\\.[^"\\]*)*"', 0, 'string'), # Single-quoted string, possibly containing escape sequences (r"'[^'\\]*(\\.[^'\\]*)*'", 0, 'string'), # From '#' until a newline (r'#[^\n]*', 0, 'comment'), ] # Build a QRegExp for each pattern self.rules = [(QRegExp(pat), index, fmt) for (pat, index, fmt) in rules] @property def styles(self): app = QtWidgets.QApplication.instance() return DARK_STYLES if app.property('darkMode') else LIGHT_STYLES def highlightBlock(self, text): """Apply syntax highlighting to the given block of text. """ # Do other syntax formatting for expression, nth, format in self.rules: index = expression.indexIn(text, 0) format = self.styles[format] while index >= 0: # We actually want the index of the nth match index = expression.pos(nth) length = len(expression.cap(nth)) self.setFormat(index, length, format) index = expression.indexIn(text, index + length) self.setCurrentBlockState(0) # Do multi-line strings in_multiline = self.match_multiline(text, *self.tri_single) if not in_multiline: in_multiline = self.match_multiline(text, *self.tri_double) def match_multiline(self, text, delimiter, in_state, style): """Do highlighting of multi-line strings. ``delimiter`` should be a ``QRegExp`` for triple-single-quotes or triple-double-quotes, and ``in_state`` should be a unique integer to represent the corresponding state changes when inside those strings. Returns True if we're still inside a multi-line string when this function is finished. """ # If inside triple-single quotes, start at 0 if self.previousBlockState() == in_state: start = 0 add = 0 # Otherwise, look for the delimiter on this line else: start = delimiter.indexIn(text) # Move past this match add = delimiter.matchedLength() # As long as there's a delimiter match on this line... while start >= 0: # Look for the ending delimiter end = delimiter.indexIn(text, start + add) # Ending delimiter on this line? if end >= add: length = end - start + add + delimiter.matchedLength() self.setCurrentBlockState(0) # No; multi-line string else: self.setCurrentBlockState(in_state) length = len(text) - start + add # Apply formatting self.setFormat(start, length, self.styles[style]) # Look for the next match start = delimiter.indexIn(text, start + length) # Return True if still inside a multi-line string, False otherwise if self.currentBlockState() == in_state: return True else: return False pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/template.py000066400000000000000000000003601457240071200236560ustar00rootroot00000000000000""" Description of example """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui, QtWidgets, mkQApp app = mkQApp() # win.setWindowTitle('pyqtgraph example: ____') if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/test_examples.py000066400000000000000000000137451457240071200247330ustar00rootroot00000000000000import contextlib import errno import importlib import itertools import os import platform import subprocess import sys import time from argparse import Namespace from collections import namedtuple import pytest from pyqtgraph import Qt if __name__ == "__main__" and (__package__ is None or __package__==''): parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, parent_dir) import examples __package__ = "examples" from . import utils def buildFileList(examples, files=None): if files is None: files = [] for key, val in examples.items(): if isinstance(val, dict): buildFileList(val, files) elif isinstance(val, Namespace): files.append((key, val.filename)) else: files.append((key, val)) return files path = os.path.abspath(os.path.dirname(__file__)) files = [("Example App", "RunExampleApp.py")] for ex in [utils.examples_, utils.others]: files = buildFileList(ex, files) files = sorted(set(files)) frontends = { Qt.PYQT5: False, Qt.PYQT6: False, Qt.PYSIDE2: False, Qt.PYSIDE6: False, } # sort out which of the front ends are available for frontend in frontends.keys(): with contextlib.suppress(ImportError): importlib.import_module(frontend) frontends[frontend] = True installedFrontends = sorted([ frontend for frontend, isPresent in frontends.items() if isPresent ]) darwin_opengl_broken = (platform.system() == "Darwin" and tuple(map(int, platform.mac_ver()[0].split("."))) >= (10, 16) and (sys.version_info < (3, 8, 10) or sys.version_info == (3, 9, 0))) darwin_opengl_reason = ("pyopenGL cannot find openGL library on big sur: " "https://github.com/python/cpython/pull/21241") exceptionCondition = namedtuple("exceptionCondition", ["condition", "reason"]) conditionalExamples = { "hdf5.py": exceptionCondition( False, reason="Example requires user interaction" ), "jupyter_console_example.py": exceptionCondition( importlib.util.find_spec("qtconsole") is not None, reason="No need to test with qtconsole not being installed" ), "RemoteSpeedTest.py": exceptionCondition( False, reason="Test is being problematic on CI machines" ), } openglExamples = ['GLViewWidget.py'] openglExamples.extend(utils.examples_['3D Graphics'].values()) for key in openglExamples: conditionalExamples[key] = exceptionCondition( not darwin_opengl_broken, reason=darwin_opengl_reason ) @pytest.mark.skipif( Qt.QT_LIB == "PySide2" and tuple(map(int, Qt.PySide2.__version__.split("."))) >= (5, 14) and tuple(map(int, Qt.PySide2.__version__.split("."))) < (5, 14, 2, 2), reason="new PySide2 doesn't have loadUi functionality" ) @pytest.mark.parametrize( "frontend, f", [ pytest.param( frontend, f, marks=pytest.mark.skipif( conditionalExamples[f[1]].condition is False, reason=conditionalExamples[f[1]].reason ) if f[1] in conditionalExamples.keys() else (), ) for frontend, f, in itertools.product(installedFrontends, files) ], ids = [ " {} - {} ".format(f[1], frontend) for frontend, f in itertools.product( installedFrontends, files ) ] ) def testExamples(frontend, f): name, file = f global path fn = os.path.join(path, file) os.chdir(path) sys.stdout.write(f"{name}") sys.stdout.flush() import1 = "import %s" % frontend if frontend != '' else '' import2 = os.path.splitext(os.path.split(fn)[1])[0] code = """ try: {0} import faulthandler faulthandler.enable() import pyqtgraph as pg import {1} import sys print("test complete") sys.stdout.flush() pg.Qt.QtCore.QTimer.singleShot(1000, pg.Qt.QtWidgets.QApplication.quit) pg.exec() names = [x for x in dir({1}) if not x.startswith('_')] for name in names: delattr({1}, name) except: print("test failed") raise """.format(import1, import2) env = dict(os.environ) example_dir = os.path.abspath(os.path.dirname(__file__)) path = os.path.dirname(os.path.dirname(example_dir)) env['PYTHONPATH'] = f'{path}{os.pathsep}{example_dir}' process = subprocess.Popen([sys.executable], stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, text=True, env=env) process.stdin.write(code) process.stdin.close() output = '' fail = False while True: try: c = process.stdout.read(1) except IOError as err: if err.errno == errno.EINTR: # Interrupted system call; just try again. c = '' else: raise output += c if output.endswith('test complete'): break if output.endswith('test failed'): fail = True break start = time.time() killed = False while process.poll() is None: time.sleep(0.1) if time.time() - start > 2.0 and not killed: process.kill() killed = True stdout, stderr = (process.stdout.read(), process.stderr.read()) process.stdout.close() process.stderr.close() if (fail or 'Exception:' in stderr or 'Error:' in stderr): if (not fail and name == "RemoteGraphicsView" and "pyqtgraph.multiprocess.remoteproxy.ClosedError" in stderr): # This test can intermittently fail when the subprocess is killed return None print(stdout) print(stderr) pytest.fail( f"{stdout}\n{stderr}\nFailed {name} Example Test Located in {file}", pytrace=False ) if __name__ == "__main__": pytest.cmdline.main() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/text.py000066400000000000000000000032161457240071200230320ustar00rootroot00000000000000""" This example shows how to insert text into a scene using TextItem. This class is for displaying text that is anchored to a particular location in the data coordinate system, but which is always displayed unscaled. For text that scales with the data, use QTextItem. For text that can be placed in a layout, use LabelItem. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore x = np.linspace(-20, 20, 1000) y = np.sin(x) / x plot = pg.plot() ## create an empty plot widget plot.setYRange(-1, 2) plot.setWindowTitle('pyqtgraph example: text') curve = plot.plot(x,y) ## add a single curve ## Create text object, use HTML tags to specify color/size text = pg.TextItem(html='
      This is the
      PEAK
      ', anchor=(-0.3,0.5), angle=45, border='w', fill=(0, 0, 255, 100)) plot.addItem(text) text.setPos(0, y.max()) ## Draw an arrowhead next to the text box arrow = pg.ArrowItem(pos=(0, y.max()), angle=-45) plot.addItem(arrow) ## Set up an animated arrow and text that track the curve curvePoint = pg.CurvePoint(curve) plot.addItem(curvePoint) text2 = pg.TextItem("test", anchor=(0.5, -1.0)) text2.setParentItem(curvePoint) arrow2 = pg.ArrowItem(angle=90) arrow2.setParentItem(curvePoint) ## update position every 10ms index = 0 def update(): global curvePoint, index index = (index + 1) % len(x) curvePoint.setPos(float(index)/(len(x)-1)) text2.setText('[%0.1f, %0.1f]' % (x[index], y[index])) timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(10) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/utils.py000066400000000000000000000142251457240071200232100ustar00rootroot00000000000000from argparse import Namespace from collections import OrderedDict from time import perf_counter from pyqtgraph.Qt import QtCore # Avoid clash with module name examples_ = OrderedDict([ ('Command-line usage', 'CLIexample.py'), ('Basic Plotting', Namespace(filename='Plotting.py', recommended=True)), ('ImageView', Namespace(filename='ImageView.py', recommended=True)), ('ParameterTree', Namespace(filename='parametertree.py', recommended=True)), ('Plotting Datasets', 'MultiDataPlot.py'), ('Parameter-Function Interaction', 'InteractiveParameter.py'), ('Crosshair / Mouse interaction', 'crosshair.py'), ('Data Slicing', 'DataSlicing.py'), ('Plot Customization', 'customPlot.py'), ('Timestamps on x axis', 'DateAxisItem.py'), ('Image Analysis', Namespace(filename='imageAnalysis.py', recommended=True)), ('Matrix Display', 'MatrixDisplayExample.py'), ('ViewBox Features', Namespace(filename='ViewBoxFeatures.py', recommended=True)), ('Dock widgets', 'dockarea.py'), ('Console', 'ConsoleWidget.py'), ('Console - Exception inspection', 'console_exception_inspection.py'), ('Rich Jupyter Console', 'jupyter_console_example.py'), ('Histograms', 'histogram.py'), ('Beeswarm plot', 'beeswarm.py'), ('Symbols', 'Symbols.py'), ('Auto-range', 'PlotAutoRange.py'), ('Remote Plotting', 'RemoteSpeedTest.py'), ('Scrolling plots', 'scrollingPlots.py'), ('HDF5 big data', 'hdf5.py'), ('Glow', 'glow.py'), ('Demos', OrderedDict([ ('Optics', 'optics_demos.py'), ('Special relativity', 'relativity_demo.py'), ('Verlet chain', 'verlet_chain_demo.py'), ('Koch Fractal', 'fractal.py'), ])), ('Colors', OrderedDict([ ('Color Maps', 'colorMaps.py'), ('Color Map Linearization', 'colorMapsLinearized.py'), ('Color Gradient Plots', 'ColorGradientPlots.py') ])), ('GraphicsItems', OrderedDict([ ('Scatter Plot', 'ScatterPlot.py'), #('PlotItem', 'PlotItem.py'), ('InfiniteLine', 'InfiniteLine.py'), ('IsocurveItem', 'isocurve.py'), ('GraphItem', 'GraphItem.py'), ('ErrorBarItem', 'ErrorBarItem.py'), ('FillBetweenItem', 'FillBetweenItem.py'), ('ImageItem - video', 'ImageItem.py'), ('ImageItem - draw', 'Draw.py'), ('ColorBarItem','ColorBarItem.py'), ('Non-uniform Image', 'NonUniformImage.py'), ('Region-of-Interest', 'ROIExamples.py'), ('Bar Graph', 'BarGraphItem.py'), ('GraphicsLayout', 'GraphicsLayout.py'), ('LegendItem', 'Legend.py'), ('Text Item', 'text.py'), ('Linked Views', 'linkedViews.py'), ('Arrow', 'Arrow.py'), ('ViewBox', 'ViewBoxFeatures.py'), ('AxisItem - label overlap', 'AxisItem_label_overlap.py'), ('Custom Graphics', 'customGraphicsItem.py'), ('Labeled Graph', 'CustomGraphItem.py'), ('PColorMeshItem', 'PColorMeshItem.py'), ])), ('Benchmarks', OrderedDict([ ('Video speed test', 'VideoSpeedTest.py'), ('Line Plot update', 'PlotSpeedTest.py'), ('Scatter Plot update', 'ScatterPlotSpeedTest.py'), ('Multiple plots', 'MultiPlotSpeedTest.py'), ])), ('3D Graphics', OrderedDict([ ('Volumetric', 'GLVolumeItem.py'), ('Isosurface', 'GLIsosurface.py'), ('Surface Plot', 'GLSurfacePlot.py'), ('Scatter Plot', 'GLScatterPlotItem.py'), ('Shaders', 'GLshaders.py'), ('Line Plot', 'GLLinePlotItem.py'), ('Mesh', 'GLMeshItem.py'), ('Image', 'GLImageItem.py'), ('Text', 'GLTextItem.py'), ('BarGraph', 'GLBarGraphItem.py'), ('Painter', 'GLPainterItem.py'), ('Gradient Legend', 'GLGradientLegendItem.py') ])), ('Widgets', OrderedDict([ ('PlotWidget', 'PlotWidget.py'), ('SpinBox', 'SpinBox.py'), ('ConsoleWidget', 'ConsoleWidget.py'), ('Histogram / lookup table', 'HistogramLUT.py'), ('TreeWidget', 'TreeWidget.py'), ('ScatterPlotWidget', 'ScatterPlotWidget.py'), ('DataTreeWidget', 'DataTreeWidget.py'), ('GradientWidget', 'GradientWidget.py'), ('TableWidget', 'TableWidget.py'), ('ColorButton', 'ColorButton.py'), #('CheckTable', '../widgets/CheckTable.py'), #('VerticalLabel', '../widgets/VerticalLabel.py'), ('JoystickButton', 'JoystickButton.py'), ])), ('Flowcharts', 'Flowchart.py'), ('Custom Flowchart Nodes', 'FlowchartCustomNode.py'), ]) # don't care about ordering # but actually from Python 3.7, dict is ordered others = dict([ ('logAxis', 'logAxis.py'), ('PanningPlot', 'PanningPlot.py'), ('MultiplePlotAxes', 'MultiplePlotAxes.py'), ('ROItypes', 'ROItypes.py'), ('ScaleBar', 'ScaleBar.py'), ('ViewBox', 'ViewBox.py'), ('GradientEditor', 'GradientEditor.py'), ('GLViewWidget', 'GLViewWidget.py'), ('DiffTreeWidget', 'DiffTreeWidget.py'), ('RemoteGraphicsView', 'RemoteGraphicsView.py'), ('contextMenu', 'contextMenu.py'), ('designerExample', 'designerExample.py'), ('DateAxisItem_QtDesigner', 'DateAxisItem_QtDesigner.py'), ('GraphicsScene', 'GraphicsScene.py'), ('MouseSelection', 'MouseSelection.py'), ]) # examples that are subsumed into other examples trivial = dict([ ('SimplePlot', 'SimplePlot.py'), # Plotting.py ('LogPlotTest', 'LogPlotTest.py'), # Plotting.py ('ViewLimits', 'ViewLimits.py'), # ViewBoxFeatures.py ]) # examples that are not suitable for CI testing skiptest = dict([ ('ProgressDialog', 'ProgressDialog.py'), # modal dialog ]) class FrameCounter(QtCore.QObject): sigFpsUpdate = QtCore.Signal(object) def __init__(self, interval=1000): super().__init__() self.count = 0 self.last_update = 0 self.interval = interval def update(self): self.count += 1 if self.last_update == 0: self.last_update = perf_counter() self.startTimer(self.interval) def timerEvent(self, evt): now = perf_counter() elapsed = now - self.last_update fps = self.count / elapsed self.last_update = now self.count = 0 self.sigFpsUpdate.emit(fps) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/verlet_chain/000077500000000000000000000000001457240071200241355ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/verlet_chain/__init__.py000066400000000000000000000000341457240071200262430ustar00rootroot00000000000000from .chain import ChainSim pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/verlet_chain/chain.py000066400000000000000000000070041457240071200255720ustar00rootroot00000000000000import time import numpy as np import pyqtgraph as pg from . import relax class ChainSim(pg.QtCore.QObject): stepped = pg.QtCore.Signal() relaxed = pg.QtCore.Signal() def __init__(self): pg.QtCore.QObject.__init__(self) self.damping = 0.1 # 0=full damping, 1=no damping self.relaxPerStep = 10 self.maxTimeStep = 0.01 self.pos = None # (Npts, 2) float self.mass = None # (Npts) float self.fixed = None # (Npts) bool self.links = None # (Nlinks, 2), uint self.lengths = None # (Nlinks), float self.push = None # (Nlinks), bool self.pull = None # (Nlinks), bool self.initialized = False self.lasttime = None self.lastpos = None def init(self): if self.initialized: return if self.fixed is None: self.fixed = np.zeros(self.pos.shape[0], dtype=bool) if self.push is None: self.push = np.ones(self.links.shape[0], dtype=bool) if self.pull is None: self.pull = np.ones(self.links.shape[0], dtype=bool) # precompute relative masses across links l1 = self.links[:,0] l2 = self.links[:,1] m1 = self.mass[l1] m2 = self.mass[l2] self.mrel1 = (m1 / (m1+m2))[:,np.newaxis] self.mrel1[self.fixed[l1]] = 1 # fixed point constraint self.mrel1[self.fixed[l2]] = 0 self.mrel2 = 1.0 - self.mrel1 for i in range(10): self.relax(n=10) self.initialized = True def makeGraph(self): #g1 = pg.GraphItem(pos=self.pos, adj=self.links[self.rope], pen=0.2, symbol=None) brushes = np.where(self.fixed, pg.mkBrush(0,0,0,255), pg.mkBrush(50,50,200,255)) g2 = pg.GraphItem(pos=self.pos, adj=self.links[self.push & self.pull], pen=0.5, brush=brushes, symbol='o', size=(self.mass**0.33), pxMode=False) p = pg.ItemGroup() #p.addItem(g1) p.addItem(g2) return p def update(self): # approximate physics with verlet integration now = time.perf_counter() if self.lasttime is None: dt = 0 else: dt = now - self.lasttime self.lasttime = now # limit amount of work to be done between frames if not relax.COMPILED: dt = self.maxTimeStep if self.lastpos is None: self.lastpos = self.pos # remember fixed positions fixedpos = self.pos[self.fixed] while dt > 0: dt1 = min(self.maxTimeStep, dt) dt -= dt1 # compute motion since last timestep dx = self.pos - self.lastpos self.lastpos = self.pos # update positions for gravity and inertia acc = np.array([[0, -5]]) * dt1 inertia = dx * (self.damping**(dt1/self.mass))[:,np.newaxis] # with mass-dependent damping self.pos = self.pos + inertia + acc self.pos[self.fixed] = fixedpos # fixed point constraint # correct for link constraints self.relax(self.relaxPerStep) self.stepped.emit() def relax(self, n=50): # speed up with C magic if possible relax.relax(self.pos, self.links, self.mrel1, self.mrel2, self.lengths, self.push, self.pull, n) self.relaxed.emit() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/verlet_chain/make000077500000000000000000000000651457240071200250010ustar00rootroot00000000000000gcc -fPIC -c relax.c gcc -shared -o maths.so relax.o pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/verlet_chain/relax.c000066400000000000000000000023121457240071200254120ustar00rootroot00000000000000#include #include void relax( double* pos, long* links, double* mrel1, double* mrel2, double* lengths, char* push, char* pull, int nlinks, int iters) { int i, l, p1, p2; double x1, x2, y1, y2, dx, dy, dist, change; // printf("%d, %d\n", iters, nlinks); for( i=0; i lengths[l] ) dist = lengths[l]; change = (lengths[l]-dist) / dist; dx *= change; dy *= change; pos[p1] -= mrel2[l] * dx; pos[p1+1] -= mrel2[l] * dy; pos[p2] += mrel1[l] * dx; pos[p2+1] += mrel1[l] * dy; } } } pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/verlet_chain/relax.py000066400000000000000000000041051457240071200256220ustar00rootroot00000000000000import ctypes import os so = os.path.join(os.path.dirname(__file__), 'maths.so') try: lib = ctypes.CDLL(so) COMPILED = True except OSError: COMPILED = False if COMPILED: lib.relax.argtypes = [ ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_int, ] def relax(pos, links, mrel1, mrel2, lengths, push, pull, iters): nlinks = links.shape[0] lib.relax(pos.ctypes, links.ctypes, mrel1.ctypes, mrel2.ctypes, lengths.ctypes, push.ctypes, pull.ctypes, nlinks, iters) else: def relax(pos, links, mrel1, mrel2, lengths, push, pull, iters): lengths2 = lengths**2 for i in range(iters): #p1 = links[:, 0] #p2 = links[:, 1] #x1 = pos[p1] #x2 = pos[p2] #dx = x2 - x1 #dist = (dx**2).sum(axis=1)**0.5 #mask = (npush & (dist < lengths)) | (npull & (dist > lengths)) ##dist[mask] = lengths[mask] #change = (lengths-dist) / dist #change[mask] = 0 #dx *= change[:, np.newaxis] #print dx ##pos[p1] -= mrel2 * dx ##pos[p2] += mrel1 * dx #for j in range(links.shape[0]): #pos[links[j,0]] -= mrel2[j] * dx[j] #pos[links[j,1]] += mrel1[j] * dx[j] for l in range(links.shape[0]): p1, p2 = links[l]; x1 = pos[p1] x2 = pos[p2] dx = x2 - x1 dist2 = (dx**2).sum() if (push[l] and dist2 < lengths2[l]) or (pull[l] and dist2 > lengths2[l]): dist = dist2 ** 0.5 change = (lengths[l]-dist) / dist dx *= change pos[p1] -= mrel2[l] * dx pos[p2] += mrel1[l] * dx pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/examples/verlet_chain_demo.py000066400000000000000000000055561457240071200255260ustar00rootroot00000000000000""" Mechanical simulation of a chain using verlet integration. Use the mouse to interact with one of the chains. By default, this uses a slow, pure-python integrator to solve the chain link positions. Unix users may compile a small math library to speed this up by running the `examples/verlet_chain/make` script. """ import numpy as np import verlet_chain import pyqtgraph as pg sim = verlet_chain.ChainSim() if verlet_chain.relax.COMPILED: # Use more complex chain if compiled mad library is available. chlen1 = 80 chlen2 = 60 linklen = 1 else: chlen1 = 10 chlen2 = 8 linklen = 8 npts = chlen1 + chlen2 sim.mass = np.ones(npts) sim.mass[int(chlen1 * 0.8)] = 100 sim.mass[chlen1-1] = 500 sim.mass[npts-1] = 200 sim.fixed = np.zeros(npts, dtype=bool) sim.fixed[0] = True sim.fixed[chlen1] = True sim.pos = np.empty((npts, 2)) sim.pos[:chlen1, 0] = 0 sim.pos[chlen1:, 0] = 10 sim.pos[:chlen1, 1] = np.arange(chlen1) * linklen sim.pos[chlen1:, 1] = np.arange(chlen2) * linklen # to prevent miraculous balancing acts: sim.pos += np.random.normal(size=sim.pos.shape, scale=1e-3) links1 = [(j, i+j+1) for i in range(chlen1) for j in range(chlen1-i-1)] links2 = [(j, i+j+1) for i in range(chlen2) for j in range(chlen2-i-1)] sim.links = np.concatenate([np.array(links1), np.array(links2)+chlen1, np.array([[chlen1-1, npts-1]])]) p1 = sim.pos[sim.links[:,0]] p2 = sim.pos[sim.links[:,1]] dif = p2-p1 sim.lengths = (dif**2).sum(axis=1) ** 0.5 sim.lengths[(chlen1-1):len(links1)] *= 1.05 # let auxiliary links stretch a little sim.lengths[(len(links1)+chlen2-1):] *= 1.05 sim.lengths[-1] = 7 push1 = np.ones(len(links1), dtype=bool) push1[chlen1:] = False push2 = np.ones(len(links2), dtype=bool) push2[chlen2:] = False sim.push = np.concatenate([push1, push2, np.array([True], dtype=bool)]) sim.pull = np.ones(sim.links.shape[0], dtype=bool) sim.pull[-1] = False # move chain initially just to generate some motion if the mouse is not over the window mousepos = np.array([30, 20]) def display(): global view, sim view.clear() view.addItem(sim.makeGraph()) def relaxed(): global app display() app.processEvents() def mouse(pos): global mousepos pos = view.mapSceneToView(pos) mousepos = np.array([pos.x(), pos.y()]) def update(): global mousepos #sim.pos[0] = sim.pos[0] * 0.9 + mousepos * 0.1 s = 0.9 sim.pos[0] = sim.pos[0] * s + mousepos * (1.0-s) sim.update() app = pg.mkQApp() win = pg.GraphicsLayoutWidget() win.show() view = win.addViewBox() view.setAspectLocked(True) view.setXRange(-100, 100) #view.autoRange() view.scene().sigMouseMoved.connect(mouse) #display() #app.processEvents() sim.relaxed.connect(relaxed) sim.init() sim.relaxed.disconnect(relaxed) sim.stepped.connect(display) timer = pg.QtCore.QTimer() timer.timeout.connect(update) timer.start(16) if __name__ == '__main__': pg.exec() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/exceptionHandling.py000066400000000000000000000144351457240071200237000ustar00rootroot00000000000000"""This module installs a wrapper around sys.excepthook and threading.excepthook that allows multiple new exception handlers to be registered. Optionally, the wrapper also stops exceptions from causing long-term storage of local stack frames. This has two major effects: - Unhandled exceptions will no longer cause memory leaks (If an exception occurs while a lot of data is present on the stack, such as when loading large files, the data would ordinarily be kept until the next exception occurs. We would rather release this memory as soon as possible.) - Some debuggers may have a hard time handling uncaught exceptions """ import sys import threading import time import traceback from types import SimpleNamespace callbacks = [] old_callbacks = [] clear_tracebacks = False def registerCallback(fn): """Register a callable to be invoked when there is an unhandled exception. The callback will be passed an object with attributes: [exc_type, exc_value, exc_traceback, thread] (see threading.excepthook). Multiple callbacks will be invoked in the order they were registered. """ callbacks.append(fn) def unregisterCallback(fn): """Unregister a previously registered callback. """ callbacks.remove(fn) def register(fn): """Deprecated; see registerCallback Register a callable to be invoked when there is an unhandled exception. The callback will be passed the output of sys.exc_info(): (exception type, exception, traceback) Multiple callbacks will be invoked in the order they were registered. """ old_callbacks.append(fn) def unregister(fn): """Deprecated; see unregisterCallback Unregister a previously registered callback. """ old_callbacks.remove(fn) def setTracebackClearing(clear=True): """ Enable or disable traceback clearing. By default, clearing is disabled and Python will indefinitely store unhandled exception stack traces. This function is provided since Python's default behavior can cause unexpected retention of large memory-consuming objects. """ global clear_tracebacks clear_tracebacks = clear class ExceptionHandler(object): def __init__(self): self.orig_sys_excepthook = sys.excepthook self.orig_threading_excepthook = threading.excepthook sys.excepthook = self.sys_excepthook threading.excepthook = self.threading_excepthook def remove(self): """Restore original exception hooks, deactivating this exception handler """ sys.excepthook = self.orig_sys_excepthook threading.excepthook = self.orig_threading_excepthook def sys_excepthook(self, *args): # sys.excepthook signature is (exc_type, exc_value, exc_traceback) args = SimpleNamespace(exc_type=args[0], exc_value=args[1], exc_traceback=args[2], thread=None) return self._excepthook(args, use_thread_hook=False) def threading_excepthook(self, args): # threading.excepthook signature is (namedtuple(exc_type, exc_value, exc_traceback, thread)) return self._excepthook(args, use_thread_hook=True) def _excepthook(self, args, use_thread_hook): ## Start by extending recursion depth just a bit. ## If the error we are catching is due to recursion, we don't want to generate another one here. recursionLimit = sys.getrecursionlimit() try: sys.setrecursionlimit(recursionLimit+100) ## call original exception handler first (prints exception) global callbacks, clear_tracebacks header = "===== %s =====" % str(time.strftime("%Y.%m.%d %H:%m:%S", time.localtime(time.time()))) try: print(header) except Exception: sys.stderr.write("Warning: stdout is broken! Falling back to stderr.\n") sys.stdout = sys.stderr if use_thread_hook: ret = self.orig_threading_excepthook(args) else: ret = self.orig_sys_excepthook(args.exc_type, args.exc_value, args.exc_traceback) for cb in callbacks: try: cb(args) except Exception: print(" --------------------------------------------------------------") print(" Error occurred during exception callback %s" % str(cb)) print(" --------------------------------------------------------------") traceback.print_exception(*sys.exc_info()) # deprecated callback style requiring 3 args for cb in old_callbacks: try: cb(args.exc_type, args.exc_value, args.exc_traceback) except Exception: print(" --------------------------------------------------------------") print(" Error occurred during exception callback %s" % str(cb)) print(" --------------------------------------------------------------") traceback.print_exception(*sys.exc_info()) ## Clear long-term storage of last traceback to prevent memory-hogging. ## (If an exception occurs while a lot of data is present on the stack, ## such as when loading large files, the data would ordinarily be kept ## until the next exception occurs. We would rather release this memory ## as soon as possible.) if clear_tracebacks is True: sys.last_traceback = None return ret finally: sys.setrecursionlimit(recursionLimit) def implements(self, interface=None): ## this just makes it easy for us to detect whether an ExceptionHook is already installed. if interface is None: return ['ExceptionHandler'] else: return interface == 'ExceptionHandler' ## replace built-in excepthook only if this has not already been done # TODO this will never return False; the hook is set to the bound sys_excepthook method, not the instance itself if not (hasattr(sys.excepthook, 'implements') and sys.excepthook.implements('ExceptionHandler')): handler = ExceptionHandler() original_excepthook = handler.orig_sys_excepthook original_threading_excepthook = handler.orig_threading_excepthook pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/exporters/000077500000000000000000000000001457240071200217075ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/exporters/CSVExporter.py000066400000000000000000000107311457240071200244470ustar00rootroot00000000000000import csv import itertools import numpy as np from .. import ErrorBarItem, PlotItem from ..parametertree import Parameter from ..Qt import QtCore from .Exporter import Exporter translate = QtCore.QCoreApplication.translate __all__ = ['CSVExporter'] class CSVExporter(Exporter): Name = "CSV of original plot data" windows = [] def __init__(self, item): Exporter.__init__(self, item) self.params = Parameter.create(name='params', type='group', children=[ {'name': 'separator', 'title': translate("Exporter", 'separator'), 'type': 'list', 'value': 'comma', 'limits': ['comma', 'tab']}, {'name': 'precision', 'title': translate("Exporter", 'precision'), 'type': 'int', 'value': 10, 'limits': [0, None]}, { 'name': 'columnMode', 'title': translate("Exporter", 'columnMode'), 'type': 'list', 'limits': ['(x,y) per plot', '(x,y,y,y) for all plots'], 'value': '(x,y) per plot', } ]) self.index_counter = itertools.count(start=0) self.header = [] self.data = [] def parameters(self): return self.params def _exportErrorBarItem(self, errorBarItem: ErrorBarItem) -> None: error_data = [] index = next(self.index_counter) # make sure the plot actually has data: if errorBarItem.opts['x'] is None or errorBarItem.opts['y'] is None: return None header_naming_map = { "left": "x_min_error", "right": "x_max_error", "bottom": "y_min_error", "top": "y_max_error" } # grab the base-points self.header.extend([f'x{index:04}_error', f'y{index:04}_error']) error_data.extend([errorBarItem.opts['x'], errorBarItem.opts['y']]) # grab the error bars for error_direction, header_label in header_naming_map.items(): if (error := errorBarItem.opts[error_direction]) is not None: self.header.extend([f'{header_label}_{index:04}']) error_data.append(error) self.data.append(tuple(error_data)) return None def _exportPlotDataItem(self, plotDataItem) -> None: if hasattr(plotDataItem, 'getOriginalDataset'): # try to access unmapped, unprocessed data cd = plotDataItem.getOriginalDataset() else: # fall back to earlier access method cd = plotDataItem.getData() if cd[0] is None: # no data found, break out... return None self.data.append(cd) index = next(self.index_counter) if plotDataItem.name() is not None: name = plotDataItem.name().replace('"', '""') + '_' xName = f"{name}x" yName = f"{name}y" else: xName = f'x{index:04}' yName = f'y{index:04}' appendAllX = self.params['columnMode'] == '(x,y) per plot' if appendAllX or index == 0: self.header.extend([xName, yName]) else: self.header.extend([yName]) return None def export(self, fileName=None): if not isinstance(self.item, PlotItem): raise TypeError("Must have a PlotItem selected for CSV export.") if fileName is None: self.fileSaveDialog(filter=["*.csv", "*.tsv"]) return for item in self.item.items: if isinstance(item, ErrorBarItem): self._exportErrorBarItem(item) elif hasattr(item, 'implements') and item.implements('plotData'): self._exportPlotDataItem(item) sep = "," if self.params['separator'] == 'comma' else "\t" # we want to flatten the nested arrays of data into columns columns = [column for dataset in self.data for column in dataset] with open(fileName, 'w', newline='') as csvfile: writer = csv.writer(csvfile, delimiter=sep, quoting=csv.QUOTE_MINIMAL) writer.writerow(self.header) for row in itertools.zip_longest(*columns, fillvalue=""): row_to_write = [ item if isinstance(item, str) else np.format_float_positional( item, precision=self.params['precision'] ) for item in row ] writer.writerow(row_to_write) self.header.clear() self.data.clear() CSVExporter.register() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/exporters/Exporter.py000066400000000000000000000123641457240071200240770ustar00rootroot00000000000000import os import re from ..GraphicsScene import GraphicsScene from ..Qt import QtCore, QtWidgets from ..widgets.FileDialog import FileDialog LastExportDirectory = None class Exporter(object): """ Abstract class used for exporting graphics to file / printer / whatever. """ allowCopy = False # subclasses set this to True if they can use the copy buffer Exporters = [] @classmethod def register(cls): """ Used to register Exporter classes to appear in the export dialog. """ Exporter.Exporters.append(cls) def __init__(self, item): """ Initialize with the item to be exported. Can be an individual graphics item or a scene. """ object.__init__(self) self.item = item def parameters(self): """Return the parameters used to configure this exporter.""" raise Exception("Abstract method must be overridden in subclass.") def export(self, fileName=None, toBytes=False, copy=False): """ If *fileName* is None, pop-up a file dialog. If *toBytes* is True, return a bytes object rather than writing to file. If *copy* is True, export to the copy buffer rather than writing to file. """ raise Exception("Abstract method must be overridden in subclass.") def fileSaveDialog(self, filter=None, opts=None): ## Show a file dialog, call self.export(fileName) when finished. if opts is None: opts = {} self.fileDialog = FileDialog() self.fileDialog.setFileMode(QtWidgets.QFileDialog.FileMode.AnyFile) self.fileDialog.setAcceptMode(QtWidgets.QFileDialog.AcceptMode.AcceptSave) if filter is not None: if isinstance(filter, str): self.fileDialog.setNameFilter(filter) elif isinstance(filter, list): self.fileDialog.setNameFilters(filter) global LastExportDirectory exportDir = LastExportDirectory if exportDir is not None: self.fileDialog.setDirectory(exportDir) self.fileDialog.show() self.fileDialog.opts = opts self.fileDialog.fileSelected.connect(self.fileSaveFinished) return def fileSaveFinished(self, fileName): global LastExportDirectory LastExportDirectory = os.path.split(fileName)[0] ## If file name does not match selected extension, append it now ext = os.path.splitext(fileName)[1].lower().lstrip('.') selectedExt = re.search(r'\*\.(\w+)\b', self.fileDialog.selectedNameFilter()) if selectedExt is not None: selectedExt = selectedExt.groups()[0].lower() if ext != selectedExt: fileName = fileName + '.' + selectedExt.lstrip('.') self.export(fileName=fileName, **self.fileDialog.opts) def getScene(self): if isinstance(self.item, GraphicsScene): return self.item else: return self.item.scene() def getSourceRect(self): if isinstance(self.item, GraphicsScene): w = self.item.getViewWidget() return w.viewportTransform().inverted()[0].mapRect(w.rect()) else: return self.item.sceneBoundingRect() def getTargetRect(self): if isinstance(self.item, GraphicsScene): return self.item.getViewWidget().rect() else: return self.item.mapRectToDevice(self.item.boundingRect()) def setExportMode(self, export, opts=None): """ Call setExportMode(export, opts) on all items that will be painted during the export. This informs the item that it is about to be painted for export, allowing it to alter its appearance temporarily *export* - bool; must be True before exporting and False afterward *opts* - dict; common parameters are 'antialias' and 'background' """ if opts is None: opts = {} for item in self.getPaintItems(): if hasattr(item, 'setExportMode'): item.setExportMode(export, opts) def getPaintItems(self, root=None): """Return a list of all items that should be painted in the correct order.""" if root is None: root = self.item preItems = [] postItems = [] if isinstance(root, QtWidgets.QGraphicsScene): childs = [i for i in root.items() if i.parentItem() is None] rootItem = [] else: childs = root.childItems() rootItem = [root] childs.sort(key=lambda a: a.zValue()) while len(childs) > 0: ch = childs.pop(0) tree = self.getPaintItems(ch) if (ch.flags() & ch.GraphicsItemFlag.ItemStacksBehindParent) or \ (ch.zValue() < 0 and (ch.flags() & ch.GraphicsItemFlag.ItemNegativeZStacksBehindParent)): preItems.extend(tree) else: postItems.extend(tree) return preItems + rootItem + postItems def render(self, painter, targetRect, sourceRect, item=None): self.getScene().render(painter, QtCore.QRectF(targetRect), QtCore.QRectF(sourceRect)) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/exporters/HDF5Exporter.py000066400000000000000000000050121457240071200244760ustar00rootroot00000000000000import importlib.util import numpy from .. import PlotItem from ..parametertree import Parameter from ..Qt import QtCore from .Exporter import Exporter HAVE_HDF5 = importlib.util.find_spec("h5py") is not None translate = QtCore.QCoreApplication.translate __all__ = ['HDF5Exporter'] class HDF5Exporter(Exporter): Name = "HDF5 Export: plot (x,y)" windows = [] allowCopy = False def __init__(self, item): Exporter.__init__(self, item) self.params = Parameter.create(name='params', type='group', children=[ {'name': 'Name', 'title': translate("Exporter", 'Name'), 'type': 'str', 'value': 'Export', }, {'name': 'columnMode', 'title': translate("Exporter", 'columnMode'), 'type': 'list', 'limits': ['(x,y) per plot', '(x,y,y,y) for all plots'], 'value': '(x,y) per plot'}, ]) def parameters(self): return self.params def export(self, fileName=None): if not HAVE_HDF5: raise RuntimeError("This exporter requires the h5py package, " "but it was not importable.") import h5py if not isinstance(self.item, PlotItem): raise Exception("Must have a PlotItem selected for HDF5 export.") if fileName is None: self.fileSaveDialog(filter=["*.h5", "*.hdf", "*.hd5"]) return dsname = self.params['Name'] fd = h5py.File(fileName, 'a') # forces append to file... 'w' doesn't seem to "delete/overwrite" data = [] appendAllX = self.params['columnMode'] == '(x,y) per plot' # Check if the arrays are ragged len_first = len(self.item.curves[0].getData()[0]) if self.item.curves[0] else None ragged = any(len(i.getData()[0]) != len_first for i in self.item.curves) if ragged: dgroup = fd.create_group(dsname) for i, c in enumerate(self.item.curves): d = c.getData() fdata = numpy.array([d[0], d[1]]).astype('double') cname = c.name() if c.name() is not None else str(i) dgroup.create_dataset(cname, data=fdata) else: for i, c in enumerate(self.item.curves): d = c.getData() if appendAllX or i == 0: data.append(d[0]) data.append(d[1]) fdata = numpy.array(data).astype('double') fd.create_dataset(dsname, data=fdata) fd.close() if HAVE_HDF5: HDF5Exporter.register() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/exporters/ImageExporter.py000066400000000000000000000112251457240071200250350ustar00rootroot00000000000000import sys import numpy as np from .. import functions as fn from ..parametertree import Parameter from ..Qt import QtCore, QtGui, QtWidgets from .Exporter import Exporter translate = QtCore.QCoreApplication.translate __all__ = ['ImageExporter'] class ImageExporter(Exporter): Name = "Image File (PNG, TIF, JPG, ...)" allowCopy = True def __init__(self, item): Exporter.__init__(self, item) tr = self.getTargetRect() if isinstance(item, QtWidgets.QGraphicsItem): scene = item.scene() else: scene = item bgbrush = scene.views()[0].backgroundBrush() bg = bgbrush.color() if bgbrush.style() == QtCore.Qt.BrushStyle.NoBrush: bg.setAlpha(0) self.params = Parameter.create(name='params', type='group', children=[ {'name': 'width', 'title': translate("Exporter", 'width'), 'type': 'int', 'value': int(tr.width()), 'limits': (0, None)}, {'name': 'height', 'title': translate("Exporter", 'height'), 'type': 'int', 'value': int(tr.height()), 'limits': (0, None)}, {'name': 'antialias', 'title': translate("Exporter", 'antialias'), 'type': 'bool', 'value': True}, {'name': 'background', 'title': translate("Exporter", 'background'), 'type': 'color', 'value': bg}, {'name': 'invertValue', 'title': translate("Exporter", 'invertValue'), 'type': 'bool', 'value': False} ]) self.params.param('width').sigValueChanged.connect(self.widthChanged) self.params.param('height').sigValueChanged.connect(self.heightChanged) def widthChanged(self): sr = self.getSourceRect() ar = float(sr.height()) / sr.width() self.params.param('height').setValue(int(self.params['width'] * ar), blockSignal=self.heightChanged) def heightChanged(self): sr = self.getSourceRect() ar = float(sr.width()) / sr.height() self.params.param('width').setValue(int(self.params['height'] * ar), blockSignal=self.widthChanged) def parameters(self): return self.params @staticmethod def getSupportedImageFormats(): filter = ["*."+f.data().decode('utf-8') for f in QtGui.QImageWriter.supportedImageFormats()] preferred = ['*.png', '*.tif', '*.jpg'] for p in preferred[::-1]: if p in filter: filter.remove(p) filter.insert(0, p) return filter def export(self, fileName=None, toBytes=False, copy=False): if fileName is None and not toBytes and not copy: filter = self.getSupportedImageFormats() self.fileSaveDialog(filter=filter) return w = int(self.params['width']) h = int(self.params['height']) if w == 0 or h == 0: raise Exception("Cannot export image with size=0 (requested " "export size is %dx%d)" % (w, h)) targetRect = QtCore.QRect(0, 0, w, h) sourceRect = self.getSourceRect() self.png = QtGui.QImage(w, h, QtGui.QImage.Format.Format_ARGB32) self.png.fill(self.params['background']) ## set resolution of image: origTargetRect = self.getTargetRect() resolutionScale = targetRect.width() / origTargetRect.width() #self.png.setDotsPerMeterX(self.png.dotsPerMeterX() * resolutionScale) #self.png.setDotsPerMeterY(self.png.dotsPerMeterY() * resolutionScale) painter = QtGui.QPainter(self.png) #dtr = painter.deviceTransform() try: self.setExportMode(True, { 'antialias': self.params['antialias'], 'background': self.params['background'], 'painter': painter, 'resolutionScale': resolutionScale}) painter.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing, self.params['antialias']) self.getScene().render(painter, QtCore.QRectF(targetRect), QtCore.QRectF(sourceRect)) finally: self.setExportMode(False) painter.end() if self.params['invertValue']: bg = fn.ndarray_from_qimage(self.png) if sys.byteorder == 'little': cv = slice(0, 3) else: cv = slice(1, 4) mn = bg[...,cv].min(axis=2) mx = bg[...,cv].max(axis=2) d = (255 - mx) - mn bg[...,cv] += d[...,np.newaxis] if copy: QtWidgets.QApplication.clipboard().setImage(self.png) elif toBytes: return self.png else: return self.png.save(fileName) ImageExporter.register() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/exporters/Matplotlib.py000066400000000000000000000127371457240071200244020ustar00rootroot00000000000000from .. import PlotItem from .. import functions as fn from ..Qt import QtCore, QtWidgets from .Exporter import Exporter __all__ = ['MatplotlibExporter'] """ It is helpful when using the matplotlib Exporter if your .matplotlib/matplotlibrc file is configured appropriately. The following are suggested for getting usable PDF output that can be edited in Illustrator, etc. backend : Qt4Agg text.usetex : True # Assumes you have a findable LaTeX installation interactive : False font.family : sans-serif font.sans-serif : 'Arial' # (make first in list) mathtext.default : sf figure.facecolor : white # personal preference # next setting allows pdf font to be readable in Adobe Illustrator pdf.fonttype : 42 # set fonts to TrueType (otherwise it will be 3 # and the text will be vectorized. text.dvipnghack : True # primarily to clean up font appearance on Mac The advantage is that there is less to do to get an exported file cleaned and ready for publication. Fonts are not vectorized (outlined), and window colors are white. """ _symbol_pg_to_mpl = { 'o' : 'o', # circle 's' : 's', # square 't' : 'v', # triangle_down 't1' : '^', # triangle_up 't2' : '>', # triangle_right 't3' : '<', # triangle_left 'd' : 'd', # thin_diamond '+' : 'P', # plus (filled) 'x' : 'X', # x (filled) 'p' : 'p', # pentagon 'h' : 'h', # hexagon1 'star' : '*', # star 'arrow_up' : 6, # caretup 'arrow_right' : 5, # caretright 'arrow_down' : 7, # caretdown 'arrow_left' : 4, # caretleft 'crosshair' : 'o', # circle } class MatplotlibExporter(Exporter): Name = "Matplotlib Window" windows = [] def __init__(self, item): Exporter.__init__(self, item) def parameters(self): return None def cleanAxes(self, axl): if type(axl) is not list: axl = [axl] for ax in axl: if ax is None: continue for loc, spine in ax.spines.items(): if loc in ['left', 'bottom']: pass elif loc in ['right', 'top']: spine.set_color('none') # do not draw the spine else: raise ValueError('Unknown spine location: %s' % loc) # turn off ticks when there is no spine ax.xaxis.set_ticks_position('bottom') def export(self, fileName=None): if not isinstance(self.item, PlotItem): raise Exception("MatplotlibExporter currently only works with PlotItem") mpw = MatplotlibWindow() MatplotlibExporter.windows.append(mpw) fig = mpw.getFigure() xax = self.item.getAxis('bottom') yax = self.item.getAxis('left') # get labels from the graphic item xlabel = xax.label.toPlainText() ylabel = yax.label.toPlainText() title = self.item.titleLabel.text # if axes use autoSIPrefix, scale the data so mpl doesn't add its own # scale factor label xscale = yscale = 1.0 if xax.autoSIPrefix: xscale = xax.autoSIPrefixScale if yax.autoSIPrefix: yscale = yax.autoSIPrefixScale ax = fig.add_subplot(111, title=title) ax.clear() self.cleanAxes(ax) for item in self.item.curves: x, y = item.getData() x = x * xscale y = y * yscale opts = item.opts pen = fn.mkPen(opts['pen']) if pen.style() == QtCore.Qt.PenStyle.NoPen: linestyle = '' else: linestyle = '-' color = pen.color().getRgbF() symbol = opts['symbol'] symbol = _symbol_pg_to_mpl.get(symbol, "") symbolPen = fn.mkPen(opts['symbolPen']) symbolBrush = fn.mkBrush(opts['symbolBrush']) markeredgecolor = symbolPen.color().getRgbF() markerfacecolor = symbolBrush.color().getRgbF() markersize = opts['symbolSize'] if opts['fillLevel'] is not None and opts['fillBrush'] is not None: fillBrush = fn.mkBrush(opts['fillBrush']) fillcolor = fillBrush.color().getRgbF() ax.fill_between(x=x, y1=y, y2=opts['fillLevel'], facecolor=fillcolor) ax.plot(x, y, marker=symbol, color=color, linewidth=pen.width(), linestyle=linestyle, markeredgecolor=markeredgecolor, markerfacecolor=markerfacecolor, markersize=markersize) xr, yr = self.item.viewRange() ax.set_xbound(xr[0]*xscale, xr[1]*xscale) ax.set_ybound(yr[0]*yscale, yr[1]*yscale) ax.set_xlabel(xlabel) # place the labels. ax.set_ylabel(ylabel) mpw.draw() MatplotlibExporter.register() class MatplotlibWindow(QtWidgets.QMainWindow): def __init__(self): from ..widgets import MatplotlibWidget QtWidgets.QMainWindow.__init__(self) self.mpl = MatplotlibWidget.MatplotlibWidget() self.setCentralWidget(self.mpl) self.show() def __getattr__(self, attr): return getattr(self.mpl, attr) def closeEvent(self, ev): MatplotlibExporter.windows.remove(self) self.deleteLater() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/exporters/PrintExporter.py000066400000000000000000000050321457240071200251060ustar00rootroot00000000000000from ..parametertree import Parameter from ..Qt import QtCore, QtGui, QtWidgets from .Exporter import Exporter translate = QtCore.QCoreApplication.translate __all__ = ['PrintExporter'] #__all__ = [] ## Printer is disabled for now--does not work very well. class PrintExporter(Exporter): Name = "Printer" def __init__(self, item): Exporter.__init__(self, item) tr = self.getTargetRect() self.params = Parameter.create(name='params', type='group', children=[ {'name': 'width', 'title': translate("Exporter", 'width'), 'type': 'float', 'value': 0.1, 'limits': (0, None), 'suffix': 'm', 'siPrefix': True}, {'name': 'height', 'title': translate("Exporter", 'height'), 'type': 'float', 'value': (0.1 * tr.height()) / tr.width(), 'limits': (0, None), 'suffix': 'm', 'siPrefix': True}, ]) self.params.param('width').sigValueChanged.connect(self.widthChanged) self.params.param('height').sigValueChanged.connect(self.heightChanged) def widthChanged(self): sr = self.getSourceRect() ar = sr.height() / sr.width() self.params.param('height').setValue(self.params['width'] * ar, blockSignal=self.heightChanged) def heightChanged(self): sr = self.getSourceRect() ar = sr.width() / sr.height() self.params.param('width').setValue(self.params['height'] * ar, blockSignal=self.widthChanged) def parameters(self): return self.params def export(self, fileName=None): printer = QtGui.QPrinter(QtGui.QPrinter.HighResolution) dialog = QtGui.QPrintDialog(printer) dialog.setWindowTitle(translate('Exporter', "Print Document")) if dialog.exec_() != QtWidgets.QDialog.DialogCode.Accepted: return res = QtGui.QGuiApplication.primaryScreen().physicalDotsPerInchX() printer.setResolution(res) rect = printer.pageRect() center = rect.center() h = self.params['height'] * res * 100. / 2.54 w = self.params['width'] * res * 100. / 2.54 x = center.x() - w/2. y = center.y() - h/2. targetRect = QtCore.QRect(x, y, w, h) sourceRect = self.getSourceRect() painter = QtGui.QPainter(printer) try: self.setExportMode(True, {'painter': painter}) self.getScene().render(painter, QtCore.QRectF(targetRect), QtCore.QRectF(sourceRect)) finally: self.setExportMode(False) painter.end() #PrintExporter.register() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/exporters/SVGExporter.py000066400000000000000000000505171457240071200244610ustar00rootroot00000000000000__all__ = ['SVGExporter'] import contextlib import re import xml.dom.minidom as xml import numpy as np from .. import debug from .. import functions as fn from ..parametertree import Parameter from ..Qt import QtCore, QtGui, QtSvg, QtWidgets from .Exporter import Exporter translate = QtCore.QCoreApplication.translate class SVGExporter(Exporter): Name = "Scalable Vector Graphics (SVG)" allowCopy=True def __init__(self, item): Exporter.__init__(self, item) tr = self.getTargetRect() scene = item.scene() if isinstance(item, QtWidgets.QGraphicsItem) else item bgbrush = scene.views()[0].backgroundBrush() bg = bgbrush.color() if bgbrush.style() == QtCore.Qt.BrushStyle.NoBrush: bg.setAlpha(0) self.params = Parameter.create(name='params', type='group', children=[ {'name': 'background', 'title': translate("Exporter", 'background'), 'type': 'color', 'value': bg}, {'name': 'width', 'title': translate("Exporter", 'width'), 'type': 'float', 'value': tr.width(), 'limits': (0, None)}, {'name': 'height', 'title': translate("Exporter", 'height'), 'type': 'float', 'value': tr.height(), 'limits': (0, None)}, #{'name': 'viewbox clipping', 'type': 'bool', 'value': True}, #{'name': 'normalize coordinates', 'type': 'bool', 'value': True}, { 'name': 'scaling stroke', 'title': translate("Exporter", 'scaling stroke'), 'type': 'bool', 'value': False, 'tip': "If False, strokes are non-scaling, which means that " "they appear the same width on screen regardless of " "how they are scaled or how the view is zoomed." }, ]) self.params.param('width').sigValueChanged.connect(self.widthChanged) self.params.param('height').sigValueChanged.connect(self.heightChanged) def widthChanged(self): sr = self.getSourceRect() ar = sr.height() / sr.width() self.params.param('height').setValue(self.params['width'] * ar, blockSignal=self.heightChanged) def heightChanged(self): sr = self.getSourceRect() ar = sr.width() / sr.height() self.params.param('width').setValue(self.params['height'] * ar, blockSignal=self.widthChanged) def parameters(self): return self.params def export(self, fileName=None, toBytes=False, copy=False): if toBytes is False and copy is False and fileName is None: self.fileSaveDialog(filter=f"{translate('Exporter', 'Scalable Vector Graphics')} (*.svg)") return ## Qt's SVG generator is not complete. (notably, it lacks clipping) ## Instead, we will use Qt to generate SVG for each item independently, ## then manually reconstruct the entire document. options = {ch.name():ch.value() for ch in self.params.children()} options['background'] = self.params['background'] options['width'] = self.params['width'] options['height'] = self.params['height'] xml = generateSvg(self.item, options) if toBytes: return xml.encode('UTF-8') elif copy: md = QtCore.QMimeData() md.setData('image/svg+xml', QtCore.QByteArray(xml.encode('UTF-8'))) QtWidgets.QApplication.clipboard().setMimeData(md) else: with open(fileName, 'wb') as fh: fh.write(xml.encode('utf-8')) # Includes space for extra attributes xmlHeader = """\ pyqtgraph SVG export Generated with Qt and pyqtgraph """ def generateSvg(item, options=None): if options is None: options = {} global xmlHeader try: node, defs = _generateItemSvg(item, options=options) finally: ## reset export mode for all items in the tree if isinstance(item, QtWidgets.QGraphicsScene): items = item.items() else: items = [item] for i in items: items.extend(i.childItems()) for i in items: if hasattr(i, 'setExportMode'): i.setExportMode(False) cleanXml(node) defsXml = "\n" for d in defs: defsXml += d.toprettyxml(indent=' ') defsXml += "\n" svgAttributes = f' viewBox ="0 0 {int(options["width"])} {int(options["height"])}"' c = options['background'] backgroundtag = f'\n' return (xmlHeader % svgAttributes) + backgroundtag + defsXml + node.toprettyxml(indent=' ') + "\n\n" def _generateItemSvg(item, nodes=None, root=None, options=None): """This function is intended to work around some issues with Qt's SVG generator and SVG in general. .. warning:: This function, while documented, is not considered part of the public API. The reason for its documentation is for ease of referencing by :func:`~pyqtgraph.GraphicsItem.generateSvg`. There should be no need to call this function explicitly. 1. Qt SVG does not implement clipping paths. This is absurd. The solution is to let Qt generate SVG for each item independently, then glue them together manually with clipping. The format Qt generates for all items looks like this: .. code-block:: xml one or more of: or or one or more of: or or . . . 2. There seems to be wide disagreement over whether path strokes should be scaled anisotropically. Given that both inkscape and illustrator seem to prefer isotropic scaling, we will optimize for those cases. .. note:: see: http://web.mit.edu/jonas/www/anisotropy/ 3. Qt generates paths using non-scaling-stroke from SVG 1.2, but inkscape only supports 1.1. Both 2 and 3 can be addressed by drawing all items in world coordinates. Parameters ---------- item : :class:`~pyqtgraph.GraphicsItem` GraphicsItem to generate SVG of nodes : dict of str, optional dictionary keyed on graphics item names, values contains the XML elements, by default None root : :class:`~pyqtgraph.GraphicsItem`, optional root GraphicsItem, if none, assigns to `item`, by default None options : dict of str, optional Options to be applied to the generated XML, by default None Returns ------- tuple tuple where first element is XML element, second element is a list of child GraphicItems XML elements """ profiler = debug.Profiler() if options is None: options = {} if nodes is None: ## nodes maps all node IDs to their XML element. ## this allows us to ensure all elements receive unique names. nodes = {} if root is None: root = item ## Skip hidden items if hasattr(item, 'isVisible') and not item.isVisible(): return None with contextlib.suppress(NotImplementedError, AttributeError): # If this item defines its own SVG generator, use that. return item.generateSvg(nodes) ## Generate SVG text for just this item (exclude its children; we'll handle them later) if isinstance(item, QtWidgets.QGraphicsScene): xmlStr = "\n\n" doc = xml.parseString(xmlStr) childs = [i for i in item.items() if i.parentItem() is None] elif item.__class__.paint == QtWidgets.QGraphicsItem.paint: xmlStr = "\n\n" doc = xml.parseString(xmlStr) childs = item.childItems() else: childs = item.childItems() tr = itemTransform(item, item.scene()) # offset to corner of root item if isinstance(root, QtWidgets.QGraphicsScene): rootPos = QtCore.QPoint(0,0) else: rootPos = root.scenePos() # handle rescaling from the export dialog if hasattr(root, 'boundingRect'): resize_x = options["width"] / root.boundingRect().width() resize_y = options["height"] / root.boundingRect().height() else: resize_x = resize_y = 1 tr2 = QtGui.QTransform(resize_x, 0, 0, resize_y, -rootPos.x(), -rootPos.y()) tr = tr * tr2 # tr = manipulate * tr * tr2 arr = QtCore.QByteArray() buf = QtCore.QBuffer(arr) svg = QtSvg.QSvgGenerator() svg.setOutputDevice(buf) dpi = QtGui.QGuiApplication.primaryScreen().logicalDotsPerInchX() svg.setResolution(int(dpi)) p = QtGui.QPainter() p.begin(svg) if hasattr(item, 'setExportMode'): item.setExportMode(True, {'painter': p}) try: p.setTransform(tr) opt = QtWidgets.QStyleOptionGraphicsItem() if item.flags() & QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemUsesExtendedStyleOption: opt.exposedRect = item.boundingRect() item.paint(p, opt, None) finally: p.end() ## Can't do this here--we need to wait until all children have painted as well. ## this is taken care of in generateSvg instead. # if hasattr(item, 'setExportMode'): # item.setExportMode(False) doc = xml.parseString(arr.data()) try: ## Get top-level group for this item g1 = doc.getElementsByTagName('g')[0] defs = doc.getElementsByTagName('defs') if len(defs) > 0: defs = [n for n in defs[0].childNodes if isinstance(n, xml.Element)] except: print(doc.toxml()) raise profiler('render') ## Get rid of group transformation matrices by applying ## transformation to inner coordinates correctCoordinates(g1, defs, item, options) profiler('correct') ## decide on a name for this item baseName = item.__class__.__name__ i = 1 while True: name = baseName + "_%d" % i if name not in nodes: break i += 1 nodes[name] = g1 g1.setAttribute('id', name) ## If this item clips its children, we need to take care of that. childGroup = g1 ## add children directly to this node unless we are clipping if ( not isinstance(item, QtWidgets.QGraphicsScene) and item.flags() & item.GraphicsItemFlag.ItemClipsChildrenToShape ): ## Generate svg for just the path path = QtWidgets.QGraphicsPathItem(item.mapToScene(item.shape())) item.scene().addItem(path) try: pathNode = _generateItemSvg(path, root=root, options=options)[0].getElementsByTagName('path')[0] # assume for this path is empty.. possibly problematic. finally: item.scene().removeItem(path) ## and for the clipPath element clip = f'{name}_clip' clipNode = g1.ownerDocument.createElement('clipPath') clipNode.setAttribute('id', clip) clipNode.appendChild(pathNode) g1.appendChild(clipNode) childGroup = g1.ownerDocument.createElement('g') childGroup.setAttribute('clip-path', f'url(#{clip})') g1.appendChild(childGroup) profiler('clipping') ## Add all child items as sub-elements. childs.sort(key=lambda c: c.zValue()) for ch in childs: csvg = _generateItemSvg(ch, nodes, root, options=options) if csvg is None: continue cg, cdefs = csvg childGroup.appendChild(cg) ### this isn't quite right--some items draw below their parent (good enough for now) defs.extend(cdefs) profiler('children') return g1, defs def correctCoordinates(node, defs, item, options): # correct the defs in the linearGradient for d in defs: if d.tagName == "linearGradient": # reset "gradientUnits" attribute to SVG default value d.removeAttribute("gradientUnits") # replace with percentages for coord in ("x1", "x2", "y1", "y2"): if coord.startswith("x"): denominator = item.boundingRect().width() else: denominator = item.boundingRect().height() percentage = round(float(d.getAttribute(coord)) * 100 / denominator) d.setAttribute(coord, f"{percentage}%") # replace stops with percentages for child in filter( lambda e: isinstance(e, xml.Element) and e.tagName == "stop", d.childNodes ): offset = child.getAttribute("offset") try: child.setAttribute("offset", f"{round(float(offset) * 100)}%") except ValueError: # offset attribute could not be converted to float # must be one of the other SVG accepted formats continue ## Remove transformation matrices from tags by applying matrix to coordinates inside. ## Each item is represented by a single top-level group with one or more groups inside. ## Each inner group contains one or more drawing primitives, possibly of different types. groups = node.getElementsByTagName('g') ## Since we leave text unchanged, groups which combine text and non-text primitives must be split apart. ## (if at some point we start correcting text transforms as well, then it should be safe to remove this) groups2 = [] for grp in groups: subGroups = [grp.cloneNode(deep=False)] textGroup = None for ch in grp.childNodes[:]: if isinstance(ch, xml.Element): if textGroup is None: textGroup = ch.tagName == 'text' if ch.tagName == 'text': if textGroup is False: subGroups.append(grp.cloneNode(deep=False)) textGroup = True else: if textGroup is True: subGroups.append(grp.cloneNode(deep=False)) textGroup = False subGroups[-1].appendChild(ch) groups2.extend(subGroups) for sg in subGroups: node.insertBefore(sg, grp) node.removeChild(grp) groups = groups2 for grp in groups: matrix = grp.getAttribute('transform') match = re.match(r'matrix\((.*)\)', matrix) if match is None: vals = [1,0,0,1,0,0] else: vals = [float(a) for a in match.groups()[0].split(',')] tr = np.array([[vals[0], vals[2], vals[4]], [vals[1], vals[3], vals[5]]]) removeTransform = False for ch in grp.childNodes: if not isinstance(ch, xml.Element): continue if ch.tagName == 'polyline': removeTransform = True coords = np.array([[float(a) for a in c.split(',')] for c in ch.getAttribute('points').strip().split(' ')]) coords = fn.transformCoordinates(tr, coords, transpose=True) ch.setAttribute('points', ' '.join([','.join([str(a) for a in c]) for c in coords])) elif ch.tagName == 'path': removeTransform = True newCoords = '' oldCoords = ch.getAttribute('d').strip() if oldCoords == '': continue for c in oldCoords.split(' '): x,y = c.split(',') if x[0].isalpha(): t = x[0] x = x[1:] else: t = '' nc = fn.transformCoordinates(tr, np.array([[float(x),float(y)]]), transpose=True) newCoords += t+str(nc[0,0])+','+str(nc[0,1])+' ' # If coords start with L instead of M, then the entire path will not be rendered. # (This can happen if the first point had nan values in it--Qt will skip it on export) if newCoords[0] != 'M': newCoords = f'M{newCoords[1:]}' ch.setAttribute('d', newCoords) elif ch.tagName == 'text': removeTransform = False ## leave text alone for now. Might need this later to correctly render text with outline. # c = np.array([ # [float(ch.getAttribute('x')), float(ch.getAttribute('y'))], # [float(ch.getAttribute('font-size')), 0], # [0,0]]) # c = fn.transformCoordinates(tr, c, transpose=True) # ch.setAttribute('x', str(c[0,0])) # ch.setAttribute('y', str(c[0,1])) # fs = c[1]-c[2] # fs = (fs**2).sum()**0.5 # ch.setAttribute('font-size', str(fs)) ## Correct some font information families = ch.getAttribute('font-family').split(',') if len(families) == 1: font = QtGui.QFont(families[0].strip('" ')) if font.styleHint() == font.StyleHint.SansSerif: families.append('sans-serif') elif font.styleHint() == font.StyleHint.Serif: families.append('serif') elif font.styleHint() == font.StyleHint.Courier: families.append('monospace') ch.setAttribute('font-family', ', '.join([f if ' ' not in f else '"%s"'%f for f in families])) ## correct line widths if needed if removeTransform and ch.getAttribute('vector-effect') != 'non-scaling-stroke' and grp.getAttribute('stroke-width') != '': w = float(grp.getAttribute('stroke-width')) s = fn.transformCoordinates(tr, np.array([[w,0], [0,0]]), transpose=True) w = ((s[0]-s[1])**2).sum()**0.5 ch.setAttribute('stroke-width', str(w)) # Remove non-scaling-stroke if requested if options.get('scaling stroke') is True and ch.getAttribute('vector-effect') == 'non-scaling-stroke': ch.removeAttribute('vector-effect') if removeTransform: grp.removeAttribute('transform') SVGExporter.register() def itemTransform(item, root): ## Return the transformation mapping item to root ## (actually to parent coordinate system of root) if item is root: tr = QtGui.QTransform() tr.translate(*item.pos()) tr = tr * item.transform() return tr if item.flags() & item.GraphicsItemFlag.ItemIgnoresTransformations: pos = item.pos() parent = item.parentItem() if parent is not None: pos = itemTransform(parent, root).map(pos) tr = QtGui.QTransform() tr.translate(pos.x(), pos.y()) tr = item.transform() * tr else: ## find next parent that is either the root item or ## an item that ignores its transformation nextRoot = item while True: nextRoot = nextRoot.parentItem() if nextRoot is None: nextRoot = root break if nextRoot is root or (nextRoot.flags() & nextRoot.GraphicsItemFlag.ItemIgnoresTransformations): break if isinstance(nextRoot, QtWidgets.QGraphicsScene): tr = item.sceneTransform() else: tr = itemTransform(nextRoot, root) * item.itemTransform(nextRoot)[0] return tr def cleanXml(node): ## remove extraneous text; let the xml library do the formatting. hasElement = False nonElement = [] for ch in node.childNodes: if isinstance(ch, xml.Element): hasElement = True cleanXml(ch) else: nonElement.append(ch) if hasElement: for ch in nonElement: node.removeChild(ch) elif node.tagName == 'g': ## remove childless groups node.parentNode.removeChild(node) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/exporters/__init__.py000066400000000000000000000003751457240071200240250ustar00rootroot00000000000000from .CSVExporter import * from .Exporter import Exporter from .HDF5Exporter import * from .ImageExporter import * from .Matplotlib import * from .PrintExporter import * from .SVGExporter import * def listExporters(): return Exporter.Exporters[:] pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/000077500000000000000000000000001457240071200216455ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/Flowchart.py000066400000000000000000001045711457240071200241600ustar00rootroot00000000000000__init__ = ["Flowchart", "FlowchartGraphicsItem", "FlowchartNode"] import importlib import os from collections import OrderedDict from numpy import ndarray from .. import DataTreeWidget, FileDialog from .. import configfile as configfile from .. import dockarea as dockarea from .. import functions as fn from ..debug import printExc from ..graphicsItems.GraphicsObject import GraphicsObject from ..Qt import QtCore, QtWidgets from . import FlowchartCtrlTemplate_generic as FlowchartCtrlTemplate from . import FlowchartGraphicsView from .library import LIBRARY from .Node import Node from .Terminal import Terminal def strDict(d): return dict([(str(k), v) for k, v in d.items()]) class Flowchart(Node): sigFileLoaded = QtCore.Signal(object) sigFileSaved = QtCore.Signal(object) #sigOutputChanged = QtCore.Signal() ## inherited from Node sigChartLoaded = QtCore.Signal() sigStateChanged = QtCore.Signal() # called when output is expected to have changed sigChartChanged = QtCore.Signal(object, object, object) # called when nodes are added, removed, or renamed. # (self, action, node) def __init__(self, terminals=None, name=None, filePath=None, library=None): self.library = library or LIBRARY if name is None: name = "Flowchart" if terminals is None: terminals = {} self.filePath = filePath Node.__init__(self, name, allowAddInput=True, allowAddOutput=True) ## create node without terminals; we'll add these later self.inputWasSet = False ## flag allows detection of changes in the absence of input change. self._nodes = {} self.nextZVal = 10 #self.connects = [] #self._chartGraphicsItem = FlowchartGraphicsItem(self) self._widget = None self._scene = None self.processing = False ## flag that prevents recursive node updates self.widget() self.inputNode = Node('Input', allowRemove=False, allowAddOutput=True) self.outputNode = Node('Output', allowRemove=False, allowAddInput=True) self.addNode(self.inputNode, 'Input', [-150, 0]) self.addNode(self.outputNode, 'Output', [300, 0]) self.outputNode.sigOutputChanged.connect(self.outputChanged) self.outputNode.sigTerminalRenamed.connect(self.internalTerminalRenamed) self.inputNode.sigTerminalRenamed.connect(self.internalTerminalRenamed) self.outputNode.sigTerminalRemoved.connect(self.internalTerminalRemoved) self.inputNode.sigTerminalRemoved.connect(self.internalTerminalRemoved) self.outputNode.sigTerminalAdded.connect(self.internalTerminalAdded) self.inputNode.sigTerminalAdded.connect(self.internalTerminalAdded) self.viewBox.autoRange(padding = 0.04) for name, opts in terminals.items(): self.addTerminal(name, **opts) def setLibrary(self, lib): self.library = lib self.widget().chartWidget.buildMenu() def setInput(self, **args): """Set the input values of the flowchart. This will automatically propagate the new values throughout the flowchart, (possibly) causing the output to change. """ #print "setInput", args #Node.setInput(self, **args) #print " ....." self.inputWasSet = True self.inputNode.setOutput(**args) def outputChanged(self): ## called when output of internal node has changed vals = self.outputNode.inputValues() self.widget().outputChanged(vals) self.setOutput(**vals) #self.sigOutputChanged.emit(self) def output(self): """Return a dict of the values on the Flowchart's output terminals. """ return self.outputNode.inputValues() def nodes(self): return self._nodes def addTerminal(self, name, **opts): term = Node.addTerminal(self, name, **opts) name = term.name() if opts['io'] == 'in': ## inputs to the flowchart become outputs on the input node opts['io'] = 'out' opts['multi'] = False self.inputNode.sigTerminalAdded.disconnect(self.internalTerminalAdded) try: self.inputNode.addTerminal(name, **opts) finally: self.inputNode.sigTerminalAdded.connect(self.internalTerminalAdded) else: opts['io'] = 'in' #opts['multi'] = False self.outputNode.sigTerminalAdded.disconnect(self.internalTerminalAdded) try: self.outputNode.addTerminal(name, **opts) finally: self.outputNode.sigTerminalAdded.connect(self.internalTerminalAdded) return term def removeTerminal(self, name): #print "remove:", name term = self[name] inTerm = self.internalTerminal(term) Node.removeTerminal(self, name) inTerm.node().removeTerminal(inTerm.name()) def internalTerminalRenamed(self, term, oldName): self[oldName].rename(term.name()) def internalTerminalAdded(self, node, term): if term._io == 'in': io = 'out' else: io = 'in' Node.addTerminal(self, term.name(), io=io, renamable=term.isRenamable(), removable=term.isRemovable(), multiable=term.isMultiable()) def internalTerminalRemoved(self, node, term): try: Node.removeTerminal(self, term.name()) except KeyError: pass def terminalRenamed(self, term, oldName): newName = term.name() #print "flowchart rename", newName, oldName #print self.terminals Node.terminalRenamed(self, self[oldName], oldName) #print self.terminals for n in [self.inputNode, self.outputNode]: if oldName in n.terminals: n[oldName].rename(newName) def createNode(self, nodeType, name=None, pos=None): """Create a new Node and add it to this flowchart. """ if name is None: n = 0 while True: name = "%s.%d" % (nodeType, n) if name not in self._nodes: break n += 1 node = self.library.getNodeType(nodeType)(name) self.addNode(node, name, pos) return node def addNode(self, node, name, pos=None): """Add an existing Node to this flowchart. See also: createNode() """ if pos is None: pos = [0, 0] if type(pos) in [QtCore.QPoint, QtCore.QPointF]: pos = [pos.x(), pos.y()] item = node.graphicsItem() item.setZValue(self.nextZVal*2) self.nextZVal += 1 self.viewBox.addItem(item) item.moveBy(*pos) self._nodes[name] = node if node is not self.inputNode and node is not self.outputNode: self.widget().addNode(node) node.sigClosed.connect(self.nodeClosed) node.sigRenamed.connect(self.nodeRenamed) node.sigOutputChanged.connect(self.nodeOutputChanged) self.sigChartChanged.emit(self, 'add', node) def removeNode(self, node): """Remove a Node from this flowchart. """ node.close() def nodeClosed(self, node): del self._nodes[node.name()] self.widget().removeNode(node) for signal, slot in [('sigClosed', self.nodeClosed), ('sigRenamed', self.nodeRenamed), ('sigOutputChanged', self.nodeOutputChanged)]: try: getattr(node, signal).disconnect(slot) except (TypeError, RuntimeError): pass self.sigChartChanged.emit(self, 'remove', node) def nodeRenamed(self, node, oldName): del self._nodes[oldName] self._nodes[node.name()] = node if node is not self.inputNode and node is not self.outputNode: self.widget().nodeRenamed(node, oldName) self.sigChartChanged.emit(self, 'rename', node) def arrangeNodes(self): pass def internalTerminal(self, term): """If the terminal belongs to the external Node, return the corresponding internal terminal""" if term.node() is self: if term.isInput(): return self.inputNode[term.name()] else: return self.outputNode[term.name()] else: return term def connectTerminals(self, term1, term2): """Connect two terminals together within this flowchart.""" term1 = self.internalTerminal(term1) term2 = self.internalTerminal(term2) term1.connectTo(term2) def process(self, **args): """ Process data through the flowchart, returning the output. Keyword arguments must be the names of input terminals. The return value is a dict with one key per output terminal. """ data = {} ## Stores terminal:value pairs ## determine order of operations ## order should look like [('p', node1), ('p', node2), ('d', terminal1), ...] ## Each tuple specifies either (p)rocess this node or (d)elete the result from this terminal order = self.processOrder() #print "ORDER:", order ## Record inputs given to process() for n, t in self.inputNode.outputs().items(): # if n not in args: # raise Exception("Parameter %s required to process this chart." % n) if n in args: data[t] = args[n] ret = {} ## process all in order for c, arg in order: if c == 'p': ## Process a single node #print "===> process:", arg node = arg if node is self.inputNode: continue ## input node has already been processed. ## get input and output terminals for this node outs = list(node.outputs().values()) ins = list(node.inputs().values()) ## construct input value dictionary args = {} for inp in ins: inputs = inp.inputTerminals() if len(inputs) == 0: continue if inp.isMultiValue(): ## multi-input terminals require a dict of all inputs args[inp.name()] = dict([(i, data[i]) for i in inputs if i in data]) else: ## single-inputs terminals only need the single input value available args[inp.name()] = data[inputs[0]] if node is self.outputNode: ret = args ## we now have the return value, but must keep processing in case there are other endpoint nodes in the chart else: try: if node.isBypassed(): result = node.processBypassed(args) else: result = node.process(display=False, **args) except: print("Error processing node %s. Args are: %s" % (str(node), str(args))) raise for out in outs: #print " Output:", out, out.name() #print out.name() try: data[out] = result[out.name()] except KeyError: pass elif c == 'd': ## delete a terminal result (no longer needed; may be holding a lot of memory) #print "===> delete", arg if arg in data: del data[arg] return ret def processOrder(self): """Return the order of operations required to process this chart. The order returned should look like [('p', node1), ('p', node2), ('d', terminal1), ...] where each tuple specifies either (p)rocess this node or (d)elete the result from this terminal """ ## first collect list of nodes/terminals and their dependencies deps = {} tdeps = {} ## {terminal: [nodes that depend on terminal]} for name, node in self._nodes.items(): deps[node] = node.dependentNodes() for t in node.outputs().values(): tdeps[t] = t.dependentNodes() #print "DEPS:", deps ## determine correct node-processing order order = fn.toposort(deps) #print "ORDER1:", order ## construct list of operations ops = [('p', n) for n in order] ## determine when it is safe to delete terminal values dels = [] for t, nodes in tdeps.items(): lastInd = 0 lastNode = None for n in nodes: ## determine which node is the last to be processed according to order if n is self: lastInd = None break else: try: ind = order.index(n) except ValueError: continue if lastNode is None or ind > lastInd: lastNode = n lastInd = ind if lastInd is not None: dels.append((lastInd+1, t)) dels.sort(key=lambda a: a[0], reverse=True) for i, t in dels: ops.insert(i, ('d', t)) return ops def nodeOutputChanged(self, startNode): """Triggered when a node's output values have changed. (NOT called during process()) Propagates new data forward through network.""" ## first collect list of nodes/terminals and their dependencies if self.processing: return self.processing = True try: deps = {} for name, node in self._nodes.items(): deps[node] = [] for t in node.outputs().values(): deps[node].extend(t.dependentNodes()) ## determine order of updates order = fn.toposort(deps, nodes=[startNode]) order.reverse() ## keep track of terminals that have been updated terms = set(startNode.outputs().values()) #print "======= Updating", startNode # print("Order:", order) for node in order[1:]: # print("Processing node", node) update = False for term in list(node.inputs().values()): # print(" checking terminal", term) deps = list(term.connections().keys()) for d in deps: if d in terms: # print(" ..input", d, "changed") update |= True term.inputChanged(d, process=False) if update: # print(" processing..") node.update() terms |= set(node.outputs().values()) finally: self.processing = False if self.inputWasSet: self.inputWasSet = False else: self.sigStateChanged.emit() def chartGraphicsItem(self): """Return the graphicsItem that displays the internal nodes and connections of this flowchart. Note that the similar method `graphicsItem()` is inherited from Node and returns the *external* graphical representation of this flowchart.""" return self.viewBox def widget(self): """Return the control widget for this flowchart. This widget provides GUI access to the parameters for each node and a graphical representation of the flowchart. """ if self._widget is None: self._widget = FlowchartCtrlWidget(self) self.scene = self._widget.scene() self.viewBox = self._widget.viewBox() return self._widget def listConnections(self): conn = set() for n in self._nodes.values(): terms = n.outputs() for t in terms.values(): for c in t.connections(): conn.add((t, c)) return conn def saveState(self): """Return a serializable data structure representing the current state of this flowchart. """ state = Node.saveState(self) state['nodes'] = [] state['connects'] = [] for name, node in self._nodes.items(): cls = type(node) if hasattr(cls, 'nodeName'): clsName = cls.nodeName pos = node.graphicsItem().pos() ns = {'class': clsName, 'name': name, 'pos': (pos.x(), pos.y()), 'state': node.saveState()} state['nodes'].append(ns) conn = self.listConnections() for a, b in conn: state['connects'].append((a.node().name(), a.name(), b.node().name(), b.name())) state['inputNode'] = self.inputNode.saveState() state['outputNode'] = self.outputNode.saveState() return state def restoreState(self, state, clear=False): """Restore the state of this flowchart from a previous call to `saveState()`. """ self.blockSignals(True) try: if clear: self.clear() Node.restoreState(self, state) nodes = state['nodes'] nodes.sort(key=lambda a: a['pos'][0]) for n in nodes: if n['name'] in self._nodes: self._nodes[n['name']].restoreState(n['state']) continue try: node = self.createNode(n['class'], name=n['name']) node.restoreState(n['state']) except: printExc("Error creating node %s: (continuing anyway)" % n['name']) self.inputNode.restoreState(state.get('inputNode', {})) self.outputNode.restoreState(state.get('outputNode', {})) #self.restoreTerminals(state['terminals']) for n1, t1, n2, t2 in state['connects']: try: self.connectTerminals(self._nodes[n1][t1], self._nodes[n2][t2]) except: print(self._nodes[n1].terminals) print(self._nodes[n2].terminals) printExc("Error connecting terminals %s.%s - %s.%s:" % (n1, t1, n2, t2)) finally: self.blockSignals(False) self.outputChanged() self.sigChartLoaded.emit() self.sigStateChanged.emit() def loadFile(self, fileName=None, startDir=None): """Load a flowchart (``*.fc``) file. """ if fileName is None: if startDir is None: startDir = self.filePath if startDir is None: startDir = '.' self.fileDialog = FileDialog(None, "Load Flowchart..", startDir, "Flowchart (*.fc)") self.fileDialog.show() self.fileDialog.fileSelected.connect(self.loadFile) return ## NOTE: was previously using a real widget for the file dialog's parent, but this caused weird mouse event bugs.. state = configfile.readConfigFile(fileName) self.restoreState(state, clear=True) self.viewBox.autoRange() self.sigFileLoaded.emit(fileName) def saveFile(self, fileName=None, startDir=None, suggestedFileName='flowchart.fc'): """Save this flowchart to a .fc file """ if fileName is None: if startDir is None: startDir = self.filePath if startDir is None: startDir = '.' self.fileDialog = FileDialog(None, "Save Flowchart..", startDir, "Flowchart (*.fc)") self.fileDialog.setDefaultSuffix("fc") self.fileDialog.setAcceptMode(QtWidgets.QFileDialog.AcceptMode.AcceptSave) self.fileDialog.show() self.fileDialog.fileSelected.connect(self.saveFile) return configfile.writeConfigFile(self.saveState(), fileName) self.sigFileSaved.emit(fileName) def clear(self): """Remove all nodes from this flowchart except the original input/output nodes. """ for n in list(self._nodes.values()): if n is self.inputNode or n is self.outputNode: continue n.close() ## calls self.nodeClosed(n) by signal #self.clearTerminals() self.widget().clear() def clearTerminals(self): Node.clearTerminals(self) self.inputNode.clearTerminals() self.outputNode.clearTerminals() class FlowchartGraphicsItem(GraphicsObject): def __init__(self, chart): GraphicsObject.__init__(self) self.chart = chart ## chart is an instance of Flowchart() self.updateTerminals() def updateTerminals(self): self.terminals = {} bounds = self.boundingRect() inp = self.chart.inputs() dy = bounds.height() / (len(inp)+1) y = dy for n, t in inp.items(): item = t.graphicsItem() self.terminals[n] = item item.setParentItem(self) item.setAnchor(bounds.width(), y) y += dy out = self.chart.outputs() dy = bounds.height() / (len(out)+1) y = dy for n, t in out.items(): item = t.graphicsItem() self.terminals[n] = item item.setParentItem(self) item.setAnchor(0, y) y += dy def boundingRect(self): #print "FlowchartGraphicsItem.boundingRect" return QtCore.QRectF() def paint(self, p, *args): #print "FlowchartGraphicsItem.paint" pass #p.drawRect(self.boundingRect()) class FlowchartCtrlWidget(QtWidgets.QWidget): """The widget that contains the list of all the nodes in a flowchart and their controls, as well as buttons for loading/saving flowcharts.""" def __init__(self, chart): self.items = {} #self.loadDir = loadDir ## where to look initially for chart files self.currentFileName = None QtWidgets.QWidget.__init__(self) self.chart = chart self.ui = FlowchartCtrlTemplate.Ui_Form() self.ui.setupUi(self) self.ui.ctrlList.setColumnCount(2) #self.ui.ctrlList.setColumnWidth(0, 200) self.ui.ctrlList.setColumnWidth(1, 20) self.ui.ctrlList.setVerticalScrollMode(self.ui.ctrlList.ScrollMode.ScrollPerPixel) self.ui.ctrlList.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.chartWidget = FlowchartWidget(chart, self) #self.chartWidget.viewBox().autoRange() self.cwWin = QtWidgets.QMainWindow() self.cwWin.setWindowTitle('Flowchart') self.cwWin.setCentralWidget(self.chartWidget) self.cwWin.resize(1000,800) h = self.ui.ctrlList.header() h.setSectionResizeMode(0, h.ResizeMode.Stretch) self.ui.ctrlList.itemChanged.connect(self.itemChanged) self.ui.loadBtn.clicked.connect(self.loadClicked) self.ui.saveBtn.clicked.connect(self.saveClicked) self.ui.saveAsBtn.clicked.connect(self.saveAsClicked) self.ui.showChartBtn.toggled.connect(self.chartToggled) self.chart.sigFileLoaded.connect(self.setCurrentFile) self.ui.reloadBtn.clicked.connect(self.reloadClicked) self.chart.sigFileSaved.connect(self.fileSaved) #def resizeEvent(self, ev): #QtWidgets.QWidget.resizeEvent(self, ev) #self.ui.ctrlList.setColumnWidth(0, self.ui.ctrlList.viewport().width()-20) def chartToggled(self, b): if b: self.cwWin.show() else: self.cwWin.hide() def reloadClicked(self): try: self.chartWidget.reloadLibrary() self.ui.reloadBtn.success("Reloaded.") except: self.ui.reloadBtn.success("Error.") raise def loadClicked(self): self.chart.loadFile() def fileSaved(self, fileName): self.setCurrentFile(fileName) self.ui.saveBtn.success("Saved.") def saveClicked(self): if self.currentFileName is None: self.saveAsClicked() else: try: self.chart.saveFile(self.currentFileName) #self.ui.saveBtn.success("Saved.") except: self.ui.saveBtn.failure("Error") raise def saveAsClicked(self): try: if self.currentFileName is None: self.chart.saveFile() else: self.chart.saveFile(suggestedFileName=self.currentFileName) except: self.ui.saveBtn.failure("Error") raise def setCurrentFile(self, fileName): self.currentFileName = fileName if fileName is None: self.ui.fileNameLabel.setText("[ new ]") else: self.ui.fileNameLabel.setText("%s" % os.path.split(self.currentFileName)[1]) self.resizeEvent(None) def itemChanged(self, *args): pass def scene(self): return self.chartWidget.scene() ## returns the GraphicsScene object def viewBox(self): return self.chartWidget.viewBox() def nodeRenamed(self, node, oldName): self.items[node].setText(0, node.name()) def addNode(self, node): ctrl = node.ctrlWidget() #if ctrl is None: #return item = QtWidgets.QTreeWidgetItem([node.name(), '', '']) self.ui.ctrlList.addTopLevelItem(item) byp = QtWidgets.QPushButton('X') byp.setCheckable(True) byp.setFixedWidth(20) item.bypassBtn = byp self.ui.ctrlList.setItemWidget(item, 1, byp) byp.node = node node.bypassButton = byp byp.setChecked(node.isBypassed()) byp.clicked.connect(self.bypassClicked) if ctrl is not None: item2 = QtWidgets.QTreeWidgetItem() item.addChild(item2) self.ui.ctrlList.setItemWidget(item2, 0, ctrl) self.items[node] = item def removeNode(self, node): if node in self.items: item = self.items[node] #self.disconnect(item.bypassBtn, QtCore.SIGNAL('clicked()'), self.bypassClicked) try: item.bypassBtn.clicked.disconnect(self.bypassClicked) except (TypeError, RuntimeError): pass self.ui.ctrlList.removeTopLevelItem(item) def bypassClicked(self): btn = QtCore.QObject.sender(self) btn.node.bypass(btn.isChecked()) def chartWidget(self): return self.chartWidget def outputChanged(self, data): pass #self.ui.outputTree.setData(data, hideRoot=True) def clear(self): self.chartWidget.clear() def select(self, node): item = self.items[node] self.ui.ctrlList.setCurrentItem(item) def clearSelection(self): self.ui.ctrlList.selectionModel().clearSelection() class FlowchartWidget(dockarea.DockArea): """Includes the actual graphical flowchart and debugging interface""" def __init__(self, chart, ctrl): #QtWidgets.QWidget.__init__(self) dockarea.DockArea.__init__(self) self.chart = chart self.ctrl = ctrl self.hoverItem = None #self.setMinimumWidth(250) #self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Expanding)) ## build user interface (it was easier to do it here than via developer) self.view = FlowchartGraphicsView.FlowchartGraphicsView(self) self.viewDock = dockarea.Dock('view', size=(1000,600)) self.viewDock.addWidget(self.view) self.viewDock.hideTitleBar() self.addDock(self.viewDock) self.hoverText = QtWidgets.QTextEdit() self.hoverText.setReadOnly(True) self.hoverDock = dockarea.Dock('Hover Info', size=(1000,20)) self.hoverDock.addWidget(self.hoverText) self.addDock(self.hoverDock, 'bottom') self.selInfo = QtWidgets.QWidget() self.selInfoLayout = QtWidgets.QGridLayout() self.selInfo.setLayout(self.selInfoLayout) self.selDescLabel = QtWidgets.QLabel() self.selNameLabel = QtWidgets.QLabel() self.selDescLabel.setWordWrap(True) self.selectedTree = DataTreeWidget() #self.selectedTree.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAsNeeded) #self.selInfoLayout.addWidget(self.selNameLabel) self.selInfoLayout.addWidget(self.selDescLabel) self.selInfoLayout.addWidget(self.selectedTree) self.selDock = dockarea.Dock('Selected Node', size=(1000,200)) self.selDock.addWidget(self.selInfo) self.addDock(self.selDock, 'bottom') self._scene = self.view.scene() self._viewBox = self.view.viewBox() #self._scene = QtWidgets.QGraphicsScene() #self._scene = FlowchartGraphicsView.FlowchartGraphicsScene() #self.view.setScene(self._scene) self.buildMenu() #self.ui.addNodeBtn.mouseReleaseEvent = self.addNodeBtnReleased self._scene.selectionChanged.connect(self.selectionChanged) self._scene.sigMouseHover.connect(self.hoverOver) #self.view.sigClicked.connect(self.showViewMenu) #self._scene.sigSceneContextMenu.connect(self.showViewMenu) #self._viewBox.sigActionPositionChanged.connect(self.menuPosChanged) def reloadLibrary(self): #QtCore.QObject.disconnect(self.nodeMenu, QtCore.SIGNAL('triggered(QAction*)'), self.nodeMenuTriggered) self.nodeMenu.triggered.disconnect(self.nodeMenuTriggered) self.nodeMenu = None self.subMenus = [] self.chart.library.reload() self.buildMenu() def buildMenu(self, pos=None): def buildSubMenu(node, rootMenu, subMenus, pos=None): for section, node in node.items(): if isinstance(node, OrderedDict): menu = QtWidgets.QMenu(section) rootMenu.addMenu(menu) buildSubMenu(node, menu, subMenus, pos=pos) subMenus.append(menu) else: act = rootMenu.addAction(section) act.nodeType = section act.pos = pos self.nodeMenu = QtWidgets.QMenu() self.subMenus = [] buildSubMenu(self.chart.library.getNodeTree(), self.nodeMenu, self.subMenus, pos=pos) self.nodeMenu.triggered.connect(self.nodeMenuTriggered) return self.nodeMenu def menuPosChanged(self, pos): self.menuPos = pos def showViewMenu(self, ev): #QtWidgets.QPushButton.mouseReleaseEvent(self.ui.addNodeBtn, ev) #if ev.button() == QtCore.Qt.MouseButton.RightButton: #self.menuPos = self.view.mapToScene(ev.pos()) #self.nodeMenu.popup(ev.globalPos()) #print "Flowchart.showViewMenu called" #self.menuPos = ev.scenePos() self.buildMenu(ev.scenePos()) self.nodeMenu.popup(ev.screenPos()) def scene(self): return self._scene ## the GraphicsScene item def viewBox(self): return self._viewBox ## the viewBox that items should be added to def nodeMenuTriggered(self, action): nodeType = action.nodeType if action.pos is not None: pos = action.pos else: pos = self.menuPos pos = self.viewBox().mapSceneToView(pos) self.chart.createNode(nodeType, pos=pos) def selectionChanged(self): #print "FlowchartWidget.selectionChanged called." items = self._scene.selectedItems() #print " scene.selectedItems: ", items if len(items) == 0: data = None else: item = items[0] if hasattr(item, 'node') and isinstance(item.node, Node): n = item.node if n in self.ctrl.items: self.ctrl.select(n) else: self.ctrl.clearSelection() data = {'outputs': n.outputValues(), 'inputs': n.inputValues()} self.selNameLabel.setText(n.name()) if hasattr(n, 'nodeName'): self.selDescLabel.setText("%s: %s" % (n.nodeName, n.__class__.__doc__)) else: self.selDescLabel.setText("") if n.exception is not None: data['exception'] = n.exception else: data = None self.selectedTree.setData(data, hideRoot=True) def hoverOver(self, items): #print "FlowchartWidget.hoverOver called." term = None for item in items: if item is self.hoverItem: return self.hoverItem = item if hasattr(item, 'term') and isinstance(item.term, Terminal): term = item.term break if term is None: self.hoverText.setPlainText("") else: val = term.value() if isinstance(val, ndarray): val = "%s %s %s" % (type(val).__name__, str(val.shape), str(val.dtype)) else: val = str(val) if len(val) > 400: val = val[:400] + "..." self.hoverText.setPlainText("%s.%s = %s" % (term.node().name(), term.name(), val)) #self.hoverLabel.setCursorPosition(0) def clear(self): #self.outputTree.setData(None) self.selectedTree.setData(None) self.hoverText.setPlainText('') self.selNameLabel.setText('') self.selDescLabel.setText('') class FlowchartNode(Node): pass pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/FlowchartCtrlTemplate.ui000066400000000000000000000056451457240071200264700ustar00rootroot00000000000000 Form 0 0 217 499 PyQtGraph 0 0 Load.. Flowchart true false false false false 1 true Qt::AlignCenter TreeWidget QTreeWidget
      ..widgets.TreeWidget
      FeedbackButton QPushButton
      ..widgets.FeedbackButton
      pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/FlowchartCtrlTemplate_generic.py000066400000000000000000000055701457240071200301740ustar00rootroot00000000000000# Form implementation generated from reading ui file '../pyqtgraph/flowchart/FlowchartCtrlTemplate.ui' # # Created by: PyQt6 UI code generator 6.1.0 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. from ..Qt import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(217, 499) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setVerticalSpacing(0) self.gridLayout.setObjectName("gridLayout") self.loadBtn = QtWidgets.QPushButton(Form) self.loadBtn.setObjectName("loadBtn") self.gridLayout.addWidget(self.loadBtn, 1, 0, 1, 1) self.saveBtn = FeedbackButton(Form) self.saveBtn.setObjectName("saveBtn") self.gridLayout.addWidget(self.saveBtn, 1, 1, 1, 2) self.saveAsBtn = FeedbackButton(Form) self.saveAsBtn.setObjectName("saveAsBtn") self.gridLayout.addWidget(self.saveAsBtn, 1, 3, 1, 1) self.reloadBtn = FeedbackButton(Form) self.reloadBtn.setCheckable(False) self.reloadBtn.setFlat(False) self.reloadBtn.setObjectName("reloadBtn") self.gridLayout.addWidget(self.reloadBtn, 4, 0, 1, 2) self.showChartBtn = QtWidgets.QPushButton(Form) self.showChartBtn.setCheckable(True) self.showChartBtn.setObjectName("showChartBtn") self.gridLayout.addWidget(self.showChartBtn, 4, 2, 1, 2) self.ctrlList = TreeWidget(Form) self.ctrlList.setObjectName("ctrlList") self.ctrlList.headerItem().setText(0, "1") self.ctrlList.header().setVisible(False) self.ctrlList.header().setStretchLastSection(False) self.gridLayout.addWidget(self.ctrlList, 3, 0, 1, 4) self.fileNameLabel = QtWidgets.QLabel(Form) font = QtGui.QFont() font.setBold(True) self.fileNameLabel.setFont(font) self.fileNameLabel.setText("") self.fileNameLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.fileNameLabel.setObjectName("fileNameLabel") self.gridLayout.addWidget(self.fileNameLabel, 0, 1, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "PyQtGraph")) self.loadBtn.setText(_translate("Form", "Load..")) self.saveBtn.setText(_translate("Form", "Save")) self.saveAsBtn.setText(_translate("Form", "As..")) self.reloadBtn.setText(_translate("Form", "Reload Libs")) self.showChartBtn.setText(_translate("Form", "Flowchart")) from ..widgets.FeedbackButton import FeedbackButton from ..widgets.TreeWidget import TreeWidget pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/FlowchartGraphicsView.py000066400000000000000000000025651457240071200264740ustar00rootroot00000000000000from ..graphicsItems.ViewBox import ViewBox from ..Qt import QtCore, QtGui, QtWidgets from ..widgets.GraphicsView import GraphicsView translate = QtCore.QCoreApplication.translate class FlowchartGraphicsView(GraphicsView): sigHoverOver = QtCore.Signal(object) sigClicked = QtCore.Signal(object) def __init__(self, widget, *args): GraphicsView.__init__(self, *args, useOpenGL=False) self._vb = FlowchartViewBox(widget, lockAspect=True, invertY=True) self.setCentralItem(self._vb) self.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing, True) def viewBox(self): return self._vb class FlowchartViewBox(ViewBox): def __init__(self, widget, *args, **kwargs): ViewBox.__init__(self, *args, **kwargs) self.widget = widget def getMenu(self, ev): ## called by ViewBox to create a new context menu self._fc_menu = QtWidgets.QMenu() self._subMenus = self.getContextMenus(ev) for menu in self._subMenus: self._fc_menu.addMenu(menu) return self._fc_menu def getContextMenus(self, ev): ## called by scene to add menus on to someone else's context menu menu = self.widget.buildMenu(ev.scenePos()) menu.setTitle(translate("Context Menu", "Add node")) return [menu, ViewBox.getMenu(self, ev)] pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/Node.py000066400000000000000000000636501457240071200231160ustar00rootroot00000000000000__all__ = ["Node", "NodeGraphicsItem"] import sys from collections import OrderedDict from .. import functions as fn from ..debug import printExc from ..graphicsItems.GraphicsObject import GraphicsObject from ..Qt import QtCore, QtGui, QtWidgets from .Terminal import Terminal translate = QtCore.QCoreApplication.translate def strDict(d): return dict([(str(k), v) for k, v in d.items()]) class Node(QtCore.QObject): """ Node represents the basic processing unit of a flowchart. A Node subclass implements at least: 1) A list of input / output terminals and their properties 2) a process() function which takes the names of input terminals as keyword arguments and returns a dict with the names of output terminals as keys. A flowchart thus consists of multiple instances of Node subclasses, each of which is connected to other by wires between their terminals. A flowchart is, itself, also a special subclass of Node. This allows Nodes within the flowchart to connect to the input/output nodes of the flowchart itself. Optionally, a node class can implement the ctrlWidget() method, which must return a QWidget (usually containing other widgets) that will be displayed in the flowchart control panel. Some nodes implement fairly complex control widgets, but most nodes follow a simple form-like pattern: a list of parameter names and a single value (represented as spin box, check box, etc..) for each parameter. To make this easier, the CtrlNode subclass allows you to instead define a simple data structure that CtrlNode will use to automatically generate the control widget. """ sigOutputChanged = QtCore.Signal(object) # self sigClosed = QtCore.Signal(object) sigRenamed = QtCore.Signal(object, object) sigTerminalRenamed = QtCore.Signal(object, object) # term, oldName sigTerminalAdded = QtCore.Signal(object, object) # self, term sigTerminalRemoved = QtCore.Signal(object, object) # self, term def __init__(self, name, terminals=None, allowAddInput=False, allowAddOutput=False, allowRemove=True): """ ============== ============================================================ **Arguments:** name The name of this specific node instance. It can be any string, but must be unique within a flowchart. Usually, we simply let the flowchart decide on a name when calling Flowchart.addNode(...) terminals Dict-of-dicts specifying the terminals present on this Node. Terminal specifications look like:: 'inputTerminalName': {'io': 'in'} 'outputTerminalName': {'io': 'out'} There are a number of optional parameters for terminals: multi, pos, renamable, removable, multiable, bypass. See the Terminal class for more information. allowAddInput bool; whether the user is allowed to add inputs by the context menu. allowAddOutput bool; whether the user is allowed to add outputs by the context menu. allowRemove bool; whether the user is allowed to remove this node by the context menu. ============== ============================================================ """ QtCore.QObject.__init__(self) self._name = name self._bypass = False self.bypassButton = None ## this will be set by the flowchart ctrl widget.. self._graphicsItem = None self.terminals = OrderedDict() self._inputs = OrderedDict() self._outputs = OrderedDict() self._allowAddInput = allowAddInput ## flags to allow the user to add/remove terminals self._allowAddOutput = allowAddOutput self._allowRemove = allowRemove self.exception = None if terminals is None: return for name, opts in terminals.items(): self.addTerminal(name, **opts) def nextTerminalName(self, name): """Return an unused terminal name""" name2 = name i = 1 while name2 in self.terminals: name2 = "%s.%d" % (name, i) i += 1 return name2 def addInput(self, name="Input", **args): """Add a new input terminal to this Node with the given name. Extra keyword arguments are passed to Terminal.__init__. This is a convenience function that just calls addTerminal(io='in', ...)""" #print "Node.addInput called." return self.addTerminal(name, io='in', **args) def addOutput(self, name="Output", **args): """Add a new output terminal to this Node with the given name. Extra keyword arguments are passed to Terminal.__init__. This is a convenience function that just calls addTerminal(io='out', ...)""" return self.addTerminal(name, io='out', **args) def removeTerminal(self, term): """Remove the specified terminal from this Node. May specify either the terminal's name or the terminal itself. Causes sigTerminalRemoved to be emitted.""" if isinstance(term, Terminal): name = term.name() else: name = term term = self.terminals[name] #print "remove", name #term.disconnectAll() term.close() del self.terminals[name] if name in self._inputs: del self._inputs[name] if name in self._outputs: del self._outputs[name] self.graphicsItem().updateTerminals() self.sigTerminalRemoved.emit(self, term) def terminalRenamed(self, term, oldName): """Called after a terminal has been renamed Causes sigTerminalRenamed to be emitted.""" newName = term.name() for d in [self.terminals, self._inputs, self._outputs]: if oldName not in d: continue d[newName] = d[oldName] del d[oldName] self.graphicsItem().updateTerminals() self.sigTerminalRenamed.emit(term, oldName) def addTerminal(self, name, **opts): """Add a new terminal to this Node with the given name. Extra keyword arguments are passed to Terminal.__init__. Causes sigTerminalAdded to be emitted.""" name = self.nextTerminalName(name) term = Terminal(self, name, **opts) self.terminals[name] = term if term.isInput(): self._inputs[name] = term elif term.isOutput(): self._outputs[name] = term self.graphicsItem().updateTerminals() self.sigTerminalAdded.emit(self, term) return term def inputs(self): """Return dict of all input terminals. Warning: do not modify.""" return self._inputs def outputs(self): """Return dict of all output terminals. Warning: do not modify.""" return self._outputs def process(self, **kargs): """Process data through this node. This method is called any time the flowchart wants the node to process data. It will be called with one keyword argument corresponding to each input terminal, and must return a dict mapping the name of each output terminal to its new value. This method is also called with a 'display' keyword argument, which indicates whether the node should update its display (if it implements any) while processing this data. This is primarily used to disable expensive display operations during batch processing. """ return {} def graphicsItem(self): """Return the GraphicsItem for this node. Subclasses may re-implement this method to customize their appearance in the flowchart.""" if self._graphicsItem is None: self._graphicsItem = NodeGraphicsItem(self) return self._graphicsItem def __getitem__(self, item): #return getattr(self, item) """Return the terminal with the given name""" if item not in self.terminals: raise KeyError(item) else: return self.terminals[item] def name(self): """Return the name of this node.""" return self._name def rename(self, name): """Rename this node. This will cause sigRenamed to be emitted.""" oldName = self._name self._name = name #self.emit(QtCore.SIGNAL('renamed'), self, oldName) self.sigRenamed.emit(self, oldName) def dependentNodes(self): """Return the list of nodes which provide direct input to this node""" nodes = set() for t in self.inputs().values(): nodes |= set([i.node() for i in t.inputTerminals()]) return nodes #return set([t.inputTerminals().node() for t in self.listInputs().values()]) def __repr__(self): return "" % (self.name(), id(self)) def ctrlWidget(self): """Return this Node's control widget. By default, Nodes have no control widget. Subclasses may reimplement this method to provide a custom widget. This method is called by Flowcharts when they are constructing their Node list.""" return None def bypass(self, byp): """Set whether this node should be bypassed. When bypassed, a Node's process() method is never called. In some cases, data is automatically copied directly from specific input nodes to output nodes instead (see the bypass argument to Terminal.__init__). This is usually called when the user disables a node from the flowchart control panel. """ self._bypass = byp if self.bypassButton is not None: self.bypassButton.setChecked(byp) self.update() def isBypassed(self): """Return True if this Node is currently bypassed.""" return self._bypass def setInput(self, **args): """Set the values on input terminals. For most nodes, this will happen automatically through Terminal.inputChanged. This is normally only used for nodes with no connected inputs.""" changed = False for k, v in args.items(): term = self._inputs[k] oldVal = term.value() if not fn.eq(oldVal, v): changed = True term.setValue(v, process=False) if changed and '_updatesHandled_' not in args: self.update() def inputValues(self): """Return a dict of all input values currently assigned to this node.""" vals = {} for n, t in self.inputs().items(): vals[n] = t.value() return vals def outputValues(self): """Return a dict of all output values currently generated by this node.""" vals = {} for n, t in self.outputs().items(): vals[n] = t.value() return vals def connected(self, localTerm, remoteTerm): """Called whenever one of this node's terminals is connected elsewhere.""" pass def disconnected(self, localTerm, remoteTerm): """Called whenever one of this node's terminals is disconnected from another.""" pass def update(self, signal=True): """Collect all input values, attempt to process new output values, and propagate downstream. Subclasses should call update() whenever thir internal state has changed (such as when the user interacts with the Node's control widget). Update is automatically called when the inputs to the node are changed. """ vals = self.inputValues() #print " inputs:", vals try: if self.isBypassed(): out = self.processBypassed(vals) else: out = self.process(**strDict(vals)) #print " output:", out if out is not None: if signal: self.setOutput(**out) else: self.setOutputNoSignal(**out) for n,t in self.inputs().items(): t.setValueAcceptable(True) self.clearException() except: #printExc( "Exception while processing %s:" % self.name()) for n,t in self.outputs().items(): t.setValue(None) self.setException(sys.exc_info()) if signal: #self.emit(QtCore.SIGNAL('outputChanged'), self) ## triggers flowchart to propagate new data self.sigOutputChanged.emit(self) ## triggers flowchart to propagate new data def processBypassed(self, args): """Called when the flowchart would normally call Node.process, but this node is currently bypassed. The default implementation looks for output terminals with a bypass connection and returns the corresponding values. Most Node subclasses will _not_ need to reimplement this method.""" result = {} for term in list(self.outputs().values()): byp = term.bypassValue() if byp is None: result[term.name()] = None else: result[term.name()] = args.get(byp, None) return result def setOutput(self, **vals): self.setOutputNoSignal(**vals) #self.emit(QtCore.SIGNAL('outputChanged'), self) ## triggers flowchart to propagate new data self.sigOutputChanged.emit(self) ## triggers flowchart to propagate new data def setOutputNoSignal(self, **vals): for k, v in vals.items(): term = self.outputs()[k] term.setValue(v) #targets = term.connections() #for t in targets: ## propagate downstream #if t is term: #continue #t.inputChanged(term) term.setValueAcceptable(True) def setException(self, exc): self.exception = exc self.recolor() def clearException(self): self.setException(None) def recolor(self): if self.exception is None: self.graphicsItem().setPen(QtGui.QPen(QtGui.QColor(0, 0, 0))) else: self.graphicsItem().setPen(QtGui.QPen(QtGui.QColor(150, 0, 0), 3)) def saveState(self): """Return a dictionary representing the current state of this node (excluding input / output values). This is used for saving/reloading flowcharts. The default implementation returns this Node's position, bypass state, and information about each of its terminals. Subclasses may want to extend this method, adding extra keys to the returned dict.""" pos = self.graphicsItem().pos() state = {'pos': (pos.x(), pos.y()), 'bypass': self.isBypassed()} termsEditable = self._allowAddInput | self._allowAddOutput for term in list(self._inputs.values()) + list(self._outputs.values()): termsEditable |= term._renamable | term._removable | term._multiable if termsEditable: state['terminals'] = self.saveTerminals() return state def restoreState(self, state): """Restore the state of this node from a structure previously generated by saveState(). """ pos = state.get('pos', (0,0)) self.graphicsItem().setPos(*pos) self.bypass(state.get('bypass', False)) if 'terminals' in state: self.restoreTerminals(state['terminals']) def saveTerminals(self): terms = OrderedDict() for n, t in self.terminals.items(): terms[n] = (t.saveState()) return terms def restoreTerminals(self, state): for name in list(self.terminals.keys()): if name not in state: self.removeTerminal(name) for name, opts in state.items(): if name in self.terminals: term = self[name] term.setOpts(**opts) continue try: opts = strDict(opts) self.addTerminal(name, **opts) except: printExc("Error restoring terminal %s (%s):" % (str(name), str(opts))) def clearTerminals(self): for t in self.terminals.values(): t.close() self.terminals = OrderedDict() self._inputs = OrderedDict() self._outputs = OrderedDict() def close(self): """Cleans up after the node--removes terminals, graphicsItem, widget""" self.disconnectAll() self.clearTerminals() item = self.graphicsItem() if item.scene() is not None: item.scene().removeItem(item) self._graphicsItem = None w = self.ctrlWidget() if w is not None: w.setParent(None) #self.emit(QtCore.SIGNAL('closed'), self) self.sigClosed.emit(self) def disconnectAll(self): for t in self.terminals.values(): t.disconnectAll() class TextItem(QtWidgets.QGraphicsTextItem): def __init__(self, text, parent, on_update): super().__init__(text, parent) self.on_update = on_update def focusOutEvent(self, ev): super().focusOutEvent(ev) if self.on_update is not None: self.on_update() def keyPressEvent(self, ev): if ev.key() == QtCore.Qt.Key.Key_Enter or ev.key() == QtCore.Qt.Key.Key_Return: if self.on_update is not None: self.on_update() return super().keyPressEvent(ev) def mousePressEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.LeftButton: self.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.TextEditorInteraction) self.setFocus(QtCore.Qt.FocusReason.MouseFocusReason) # focus text label elif ev.button() == QtCore.Qt.MouseButton.RightButton: self.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.NoTextInteraction) #class NodeGraphicsItem(QtWidgets.QGraphicsItem): class NodeGraphicsItem(GraphicsObject): def __init__(self, node): #QtWidgets.QGraphicsItem.__init__(self) GraphicsObject.__init__(self) #QObjectWorkaround.__init__(self) #self.shadow = QtWidgets.QGraphicsDropShadowEffect() #self.shadow.setOffset(5,5) #self.shadow.setBlurRadius(10) #self.setGraphicsEffect(self.shadow) self.pen = fn.mkPen(0,0,0) self.selectPen = fn.mkPen(200,200,200,width=2) self.brush = fn.mkBrush(200, 200, 200, 150) self.hoverBrush = fn.mkBrush(200, 200, 200, 200) self.selectBrush = fn.mkBrush(200, 200, 255, 200) self.hovered = False self.node = node flags = self.GraphicsItemFlag.ItemIsMovable | self.GraphicsItemFlag.ItemIsSelectable | self.GraphicsItemFlag.ItemIsFocusable | self.GraphicsItemFlag.ItemSendsGeometryChanges #flags = self.ItemIsFocusable |self.ItemSendsGeometryChanges self.setFlags(flags) self.bounds = QtCore.QRectF(0, 0, 100, 100) self.nameItem = TextItem(self.node.name(), self, self.labelChanged) self.nameItem.setDefaultTextColor(QtGui.QColor(50, 50, 50)) self.nameItem.moveBy(self.bounds.width()/2. - self.nameItem.boundingRect().width()/2., 0) self._titleOffset = 25 self._nodeOffset = 12 self.updateTerminals() #self.setZValue(10) self.menu = None self.buildMenu() def setTitleOffset(self, new_offset): """ This method sets the rendering offset introduced after the title of the node. This method automatically updates the terminal labels. The default for this value is 25px. :param new_offset: The new offset to use in pixels at 100% scale. """ self._titleOffset = new_offset self.updateTerminals() def titleOffset(self): """ This method returns the current title offset in use. :returns: The offset in px. """ return self._titleOffset def setTerminalOffset(self, new_offset): """ This method sets the rendering offset introduced after every terminal of the node. This method automatically updates the terminal labels. The default for this value is 12px. :param new_offset: The new offset to use in pixels at 100% scale. """ self._nodeOffset = new_offset self.updateTerminals() def terminalOffset(self): """ This method returns the current terminal offset in use. :returns: The offset in px. """ return self._nodeOffset #self.node.sigTerminalRenamed.connect(self.updateActionMenu) #def setZValue(self, z): #for t, item in self.terminals.values(): #item.setZValue(z+1) #GraphicsObject.setZValue(self, z) def labelChanged(self): newName = self.nameItem.toPlainText() if newName != self.node.name(): self.node.rename(newName) ### re-center the label bounds = self.boundingRect() self.nameItem.setPos(bounds.width()/2. - self.nameItem.boundingRect().width()/2., 0) def setPen(self, *args, **kwargs): self.pen = fn.mkPen(*args, **kwargs) self.update() def setBrush(self, brush): self.brush = brush self.update() def updateTerminals(self): self.terminals = {} inp = self.node.inputs() out = self.node.outputs() maxNode = max(len(inp), len(out)) # calculate new height newHeight = self._titleOffset + maxNode*self._nodeOffset # if current height is not equal to new height, update if not self.bounds.height() == newHeight: self.bounds.setHeight(newHeight) self.update() # Populate inputs y = self._titleOffset for i, t in inp.items(): item = t.graphicsItem() item.setParentItem(self) #item.setZValue(self.zValue()+1) item.setAnchor(0, y) self.terminals[i] = (t, item) y += self._nodeOffset # Populate inputs y = self._titleOffset for i, t in out.items(): item = t.graphicsItem() item.setParentItem(self) item.setZValue(self.zValue()) item.setAnchor(self.bounds.width(), y) self.terminals[i] = (t, item) y += self._nodeOffset #self.buildMenu() def boundingRect(self): return self.bounds.adjusted(-5, -5, 5, 5) def paint(self, p, *args): p.setPen(self.pen) if self.isSelected(): p.setPen(self.selectPen) p.setBrush(self.selectBrush) else: p.setPen(self.pen) if self.hovered: p.setBrush(self.hoverBrush) else: p.setBrush(self.brush) p.drawRect(self.bounds) def mousePressEvent(self, ev): ev.ignore() def mouseClickEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.LeftButton: ev.accept() sel = self.isSelected() self.setSelected(True) if not sel and self.isSelected(): self.update() elif ev.button() == QtCore.Qt.MouseButton.RightButton: ev.accept() self.raiseContextMenu(ev) def mouseDragEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.LeftButton: ev.accept() self.setPos(self.pos()+self.mapToParent(ev.pos())-self.mapToParent(ev.lastPos())) def hoverEvent(self, ev): if not ev.isExit() and ev.acceptClicks(QtCore.Qt.MouseButton.LeftButton): ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton) self.hovered = True else: self.hovered = False self.update() def keyPressEvent(self, ev): if ev.key() == QtCore.Qt.Key.Key_Delete or ev.key() == QtCore.Qt.Key.Key_Backspace: ev.accept() if not self.node._allowRemove: return self.node.close() else: ev.ignore() def itemChange(self, change, val): if change == self.GraphicsItemChange.ItemPositionHasChanged: for k, t in self.terminals.items(): t[1].nodeMoved() return GraphicsObject.itemChange(self, change, val) def getMenu(self): return self.menu def raiseContextMenu(self, ev): menu = self.scene().addParentContextMenus(self, self.getMenu(), ev) pos = ev.screenPos() menu.popup(QtCore.QPoint(int(pos.x()), int(pos.y()))) def buildMenu(self): self.menu = QtWidgets.QMenu() self.menu.setTitle(translate("Context Menu", "Node")) a = self.menu.addAction(translate("Context Menu","Add input"), self.addInputFromMenu) if not self.node._allowAddInput: a.setEnabled(False) a = self.menu.addAction(translate("Context Menu", "Add output"), self.addOutputFromMenu) if not self.node._allowAddOutput: a.setEnabled(False) a = self.menu.addAction(translate("Context Menu", "Remove node"), self.node.close) if not self.node._allowRemove: a.setEnabled(False) def addInputFromMenu(self): ## called when add input is clicked in context menu self.node.addInput(renamable=True, removable=True, multiable=True) def addOutputFromMenu(self): ## called when add output is clicked in context menu self.node.addOutput(renamable=True, removable=True, multiable=False) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/NodeLibrary.py000066400000000000000000000050751457240071200244400ustar00rootroot00000000000000from collections import OrderedDict from .Node import Node def isNodeClass(cls): try: if not issubclass(cls, Node): return False except: return False return hasattr(cls, 'nodeName') class NodeLibrary: """ A library of flowchart Node types. Custom libraries may be built to provide each flowchart with a specific set of allowed Node types. """ def __init__(self): self.nodeList = OrderedDict() self.nodeTree = OrderedDict() def addNodeType(self, nodeClass, paths, override=False): """ Register a new node type. If the type's name is already in use, an exception will be raised (unless override=True). ============== ========================================================= **Arguments:** nodeClass a subclass of Node (must have typ.nodeName) paths list of tuples specifying the location(s) this type will appear in the library tree. override if True, overwrite any class having the same name ============== ========================================================= """ if not isNodeClass(nodeClass): raise Exception("Object %s is not a Node subclass" % str(nodeClass)) name = nodeClass.nodeName if not override and name in self.nodeList: raise Exception("Node type name '%s' is already registered." % name) self.nodeList[name] = nodeClass for path in paths: root = self.nodeTree for n in path: if n not in root: root[n] = OrderedDict() root = root[n] root[name] = nodeClass def getNodeType(self, name): try: return self.nodeList[name] except KeyError: raise Exception("No node type called '%s'" % name) def getNodeTree(self): return self.nodeTree def copy(self): """ Return a copy of this library. """ lib = NodeLibrary() lib.nodeList = self.nodeList.copy() lib.nodeTree = self.treeCopy(self.nodeTree) return lib @staticmethod def treeCopy(tree): copy = OrderedDict() for k,v in tree.items(): if isNodeClass(v): copy[k] = v else: copy[k] = NodeLibrary.treeCopy(v) return copy def reload(self): """ Reload Node classes in this library. """ raise NotImplementedError() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/Terminal.py000066400000000000000000000520561457240071200240020ustar00rootroot00000000000000__all__ = ["Terminal", "TerminalGraphicsItem"] import weakref from .. import functions as fn from ..graphicsItems.GraphicsObject import GraphicsObject from ..Point import Point from ..Qt import QtCore, QtGui, QtWidgets translate = QtCore.QCoreApplication.translate class Terminal(object): def __init__(self, node, name, io, optional=False, multi=False, pos=None, renamable=False, removable=False, multiable=False, bypass=None): """ Construct a new terminal. ============== ================================================================================= **Arguments:** node the node to which this terminal belongs name string, the name of the terminal io 'in' or 'out' optional bool, whether the node may process without connection to this terminal multi bool, for inputs: whether this terminal may make multiple connections for outputs: whether this terminal creates a different value for each connection pos [x, y], the position of the terminal within its node's boundaries renamable (bool) Whether the terminal can be renamed by the user removable (bool) Whether the terminal can be removed by the user multiable (bool) Whether the user may toggle the *multi* option for this terminal bypass (str) Name of the terminal from which this terminal's value is derived when the Node is in bypass mode. ============== ================================================================================= """ self._io = io self._optional = optional self._multi = multi self._node = weakref.ref(node) self._name = name self._renamable = renamable self._removable = removable self._multiable = multiable self._connections = {} self._graphicsItem = TerminalGraphicsItem(self, parent=self._node().graphicsItem()) self._bypass = bypass if multi: self._value = {} ## dictionary of terminal:value pairs. else: self._value = None self.valueOk = None self.recolor() def value(self, term=None): """Return the value this terminal provides for the connected terminal""" if term is None: return self._value if self.isMultiValue(): return self._value.get(term, None) else: return self._value def bypassValue(self): return self._bypass def setValue(self, val, process=True): """If this is a single-value terminal, val should be a single value. If this is a multi-value terminal, val should be a dict of terminal:value pairs""" if not self.isMultiValue(): if fn.eq(val, self._value): return self._value = val else: if not isinstance(self._value, dict): self._value = {} if val is not None: self._value.update(val) self.setValueAcceptable(None) ## by default, input values are 'unchecked' until Node.update(). if self.isInput() and process: self.node().update() self.recolor() def setOpts(self, **opts): self._renamable = opts.get('renamable', self._renamable) self._removable = opts.get('removable', self._removable) self._multiable = opts.get('multiable', self._multiable) if 'multi' in opts: self.setMultiValue(opts['multi']) def connected(self, term): """Called whenever this terminal has been connected to another. (note--this function is called on both terminals)""" if self.isInput() and term.isOutput(): self.inputChanged(term) if self.isOutput() and self.isMultiValue(): self.node().update() self.node().connected(self, term) def disconnected(self, term): """Called whenever this terminal has been disconnected from another. (note--this function is called on both terminals)""" if self.isMultiValue() and term in self._value: del self._value[term] self.node().update() else: if self.isInput(): self.setValue(None) self.node().disconnected(self, term) def inputChanged(self, term, process=True): """Called whenever there is a change to the input value to this terminal. It may often be useful to override this function.""" if self.isMultiValue(): self.setValue({term: term.value(self)}, process=process) else: self.setValue(term.value(self), process=process) def valueIsAcceptable(self): """Returns True->acceptable None->unknown False->Unacceptable""" return self.valueOk def setValueAcceptable(self, v=True): self.valueOk = v self.recolor() def connections(self): return self._connections def node(self): return self._node() def isInput(self): return self._io == 'in' def isMultiValue(self): return self._multi def setMultiValue(self, multi): """Set whether this is a multi-value terminal.""" self._multi = multi if not multi and len(self.inputTerminals()) > 1: self.disconnectAll() for term in self.inputTerminals(): self.inputChanged(term) def isOutput(self): return self._io == 'out' def isRenamable(self): return self._renamable def isRemovable(self): return self._removable def isMultiable(self): return self._multiable def name(self): return self._name def graphicsItem(self): return self._graphicsItem def isConnected(self): return len(self.connections()) > 0 def connectedTo(self, term): return term in self.connections() def hasInput(self): for t in self.connections(): if t.isOutput(): return True return False def inputTerminals(self): """Return the terminal(s) that give input to this one.""" return [t for t in self.connections() if t.isOutput()] def dependentNodes(self): """Return the list of nodes which receive input from this terminal.""" return set([t.node() for t in self.connections() if t.isInput()]) def connectTo(self, term, connectionItem=None): try: if self.connectedTo(term): raise Exception('Already connected') if term is self: raise Exception('Not connecting terminal to self') if term.node() is self.node(): raise Exception("Can't connect to terminal on same node.") for t in [self, term]: if t.isInput() and not t._multi and len(t.connections()) > 0: raise Exception("Cannot connect %s <-> %s: Terminal %s is already connected to %s (and does not allow multiple connections)" % (self, term, t, list(t.connections().keys()))) except: if connectionItem is not None: connectionItem.close() raise if connectionItem is None: connectionItem = ConnectionItem(self.graphicsItem(), term.graphicsItem()) self.graphicsItem().getViewBox().addItem(connectionItem) self._connections[term] = connectionItem term._connections[self] = connectionItem self.recolor() self.connected(term) term.connected(self) return connectionItem def disconnectFrom(self, term): if not self.connectedTo(term): return item = self._connections[term] item.close() del self._connections[term] del term._connections[self] self.recolor() term.recolor() self.disconnected(term) term.disconnected(self) def disconnectAll(self): for t in list(self._connections.keys()): self.disconnectFrom(t) def recolor(self, color=None, recurse=True): if color is None: if not self.isConnected(): ## disconnected terminals are black color = QtGui.QColor(0,0,0) elif self.isInput() and not self.hasInput(): ## input terminal with no connected output terminals color = QtGui.QColor(200,200,0) elif self._value is None or fn.eq(self._value, {}): ## terminal is connected but has no data (possibly due to processing error) color = QtGui.QColor(255,255,255) elif self.valueIsAcceptable() is None: ## terminal has data, but it is unknown if the data is ok color = QtGui.QColor(200, 200, 0) elif self.valueIsAcceptable() is True: ## terminal has good input, all ok color = QtGui.QColor(0, 200, 0) else: ## terminal has bad input color = QtGui.QColor(200, 0, 0) self.graphicsItem().setBrush(QtGui.QBrush(color)) if recurse: for t in self.connections(): t.recolor(color, recurse=False) def rename(self, name): oldName = self._name self._name = name self.node().terminalRenamed(self, oldName) self.graphicsItem().termRenamed(name) def __repr__(self): return "" % (str(self.node().name()), str(self.name())) def __hash__(self): return id(self) def close(self): self.disconnectAll() item = self.graphicsItem() if item.scene() is not None: item.scene().removeItem(item) def saveState(self): return {'io': self._io, 'multi': self._multi, 'optional': self._optional, 'renamable': self._renamable, 'removable': self._removable, 'multiable': self._multiable} def __lt__(self, other): """When the terminal is multi value, the data passed to the DatTreeWidget for each input or output, is {Terminal: value}. To make this sortable, we provide the < operator. """ return self._name < other._name class TextItem(QtWidgets.QGraphicsTextItem): def __init__(self, text, parent, on_update): super().__init__(text, parent) self.on_update = on_update def focusOutEvent(self, ev): super().focusOutEvent(ev) if self.on_update is not None: self.on_update() def keyPressEvent(self, ev): if ev.key() == QtCore.Qt.Key.Key_Enter or ev.key() == QtCore.Qt.Key.Key_Return: if self.on_update is not None: self.on_update() return super().keyPressEvent(ev) class TerminalGraphicsItem(GraphicsObject): def __init__(self, term, parent=None): self.term = term GraphicsObject.__init__(self, parent) self.brush = fn.mkBrush(0,0,0) self.box = QtWidgets.QGraphicsRectItem(0, 0, 10, 10, self) on_update = self.labelChanged if self.term.isRenamable() else None self.label = TextItem(self.term.name(), self, on_update) self.label.setScale(0.7) self.newConnection = None self.setFiltersChildEvents(True) ## to pick up mouse events on the rectitem if self.term.isRenamable(): self.label.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.TextEditorInteraction) self.setZValue(1) self.menu = None def labelChanged(self): newName = self.label.toPlainText() if newName != self.term.name(): self.term.rename(newName) def termRenamed(self, name): self.label.setPlainText(name) def setBrush(self, brush): self.brush = brush self.box.setBrush(brush) def disconnect(self, target): self.term.disconnectFrom(target.term) def boundingRect(self): br = self.box.mapRectToParent(self.box.boundingRect()) lr = self.label.mapRectToParent(self.label.boundingRect()) return br | lr def paint(self, p, *args): pass def setAnchor(self, x, y): pos = QtCore.QPointF(x, y) self.anchorPos = pos br = self.box.mapRectToParent(self.box.boundingRect()) lr = self.label.mapRectToParent(self.label.boundingRect()) if self.term.isInput(): self.box.setPos(pos.x(), pos.y()-br.height()/2.) self.label.setPos(pos.x() + br.width(), pos.y() - lr.height()/2.) else: self.box.setPos(pos.x()-br.width(), pos.y()-br.height()/2.) self.label.setPos(pos.x()-br.width()-lr.width(), pos.y()-lr.height()/2.) self.updateConnections() def updateConnections(self): for t, c in self.term.connections().items(): c.updateLine() def mousePressEvent(self, ev): #ev.accept() ev.ignore() ## necessary to allow click/drag events to process correctly def mouseClickEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.LeftButton: ev.accept() self.label.setFocus(QtCore.Qt.FocusReason.MouseFocusReason) elif ev.button() == QtCore.Qt.MouseButton.RightButton: ev.accept() self.raiseContextMenu(ev) def raiseContextMenu(self, ev): ## only raise menu if this terminal is removable menu = self.getMenu() menu = self.scene().addParentContextMenus(self, menu, ev) pos = ev.screenPos() menu.popup(QtCore.QPoint(int(pos.x()), int(pos.y()))) def getMenu(self): if self.menu is None: self.menu = QtWidgets.QMenu() self.menu.setTitle(translate("Context Menu", "Terminal")) remAct = QtGui.QAction(translate("Context Menu", "Remove terminal"), self.menu) remAct.triggered.connect(self.removeSelf) self.menu.addAction(remAct) self.menu.remAct = remAct if not self.term.isRemovable(): remAct.setEnabled(False) multiAct = QtGui.QAction(translate("Context Menu", "Multi-value"), self.menu) multiAct.setCheckable(True) multiAct.setChecked(self.term.isMultiValue()) multiAct.setEnabled(self.term.isMultiable()) multiAct.triggered.connect(self.toggleMulti) self.menu.addAction(multiAct) self.menu.multiAct = multiAct if self.term.isMultiable(): multiAct.setEnabled = False return self.menu def toggleMulti(self): multi = self.menu.multiAct.isChecked() self.term.setMultiValue(multi) def removeSelf(self): self.term.node().removeTerminal(self.term) def mouseDragEvent(self, ev): if ev.button() != QtCore.Qt.MouseButton.LeftButton: ev.ignore() return ev.accept() if ev.isStart(): if self.newConnection is None: self.newConnection = ConnectionItem(self) #self.scene().addItem(self.newConnection) self.getViewBox().addItem(self.newConnection) #self.newConnection.setParentItem(self.parent().parent()) self.newConnection.setTarget(self.mapToView(ev.pos())) elif ev.isFinish(): if self.newConnection is not None: items = self.scene().items(ev.scenePos()) gotTarget = False for i in items: if isinstance(i, TerminalGraphicsItem): self.newConnection.setTarget(i) try: self.term.connectTo(i.term, self.newConnection) gotTarget = True except: self.scene().removeItem(self.newConnection) self.newConnection = None raise break if not gotTarget: self.newConnection.close() self.newConnection = None else: if self.newConnection is not None: self.newConnection.setTarget(self.mapToView(ev.pos())) def hoverEvent(self, ev): if not ev.isExit() and ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton): ev.acceptClicks(QtCore.Qt.MouseButton.LeftButton) ## we don't use the click, but we also don't want anyone else to use it. ev.acceptClicks(QtCore.Qt.MouseButton.RightButton) self.box.setBrush(fn.mkBrush('w')) else: self.box.setBrush(self.brush) self.update() def connectPoint(self): ## return the connect position of this terminal in view coords return self.mapToView(self.mapFromItem(self.box, self.box.boundingRect().center())) def nodeMoved(self): for t, item in self.term.connections().items(): item.updateLine() class ConnectionItem(GraphicsObject): def __init__(self, source, target=None): GraphicsObject.__init__(self) self.setFlags( self.GraphicsItemFlag.ItemIsSelectable | self.GraphicsItemFlag.ItemIsFocusable ) self.source = source self.target = target self.length = 0 self.hovered = False self.path = None self.shapePath = None self.style = { 'shape': 'line', 'color': (100, 100, 250), 'width': 1.0, 'hoverColor': (150, 150, 250), 'hoverWidth': 1.0, 'selectedColor': (200, 200, 0), 'selectedWidth': 3.0, } self.source.getViewBox().addItem(self) self.updateLine() self.setZValue(0) def close(self): if self.scene() is not None: self.scene().removeItem(self) def setTarget(self, target): self.target = target self.updateLine() def setStyle(self, **kwds): self.style.update(kwds) if 'shape' in kwds: self.updateLine() else: self.update() def updateLine(self): start = Point(self.source.connectPoint()) if isinstance(self.target, TerminalGraphicsItem): stop = Point(self.target.connectPoint()) elif isinstance(self.target, QtCore.QPointF): stop = Point(self.target) else: return self.prepareGeometryChange() self.path = self.generatePath(start, stop) self.shapePath = None self.update() def generatePath(self, start, stop): path = QtGui.QPainterPath() path.moveTo(start) if self.style['shape'] == 'line': path.lineTo(stop) elif self.style['shape'] == 'cubic': path.cubicTo(Point(stop.x(), start.y()), Point(start.x(), stop.y()), Point(stop.x(), stop.y())) else: raise Exception('Invalid shape "%s"; options are "line" or "cubic"' % self.style['shape']) return path def keyPressEvent(self, ev): if not self.isSelected(): ev.ignore() return if ev.key() == QtCore.Qt.Key.Key_Delete or ev.key() == QtCore.Qt.Key.Key_Backspace: self.source.disconnect(self.target) ev.accept() else: ev.ignore() def mousePressEvent(self, ev): ev.ignore() def mouseClickEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.LeftButton: ev.accept() sel = self.isSelected() self.setSelected(True) self.setFocus() if not sel and self.isSelected(): self.update() def hoverEvent(self, ev): if (not ev.isExit()) and ev.acceptClicks(QtCore.Qt.MouseButton.LeftButton): self.hovered = True else: self.hovered = False self.update() def boundingRect(self): return self.shape().boundingRect() def viewRangeChanged(self): self.shapePath = None self.prepareGeometryChange() def shape(self): if self.shapePath is None: if self.path is None: return QtGui.QPainterPath() stroker = QtGui.QPainterPathStroker() px = self.pixelWidth() stroker.setWidth(px*8) self.shapePath = stroker.createStroke(self.path) return self.shapePath def paint(self, p, *args): if self.isSelected(): p.setPen(fn.mkPen(self.style['selectedColor'], width=self.style['selectedWidth'])) else: if self.hovered: p.setPen(fn.mkPen(self.style['hoverColor'], width=self.style['hoverWidth'])) else: p.setPen(fn.mkPen(self.style['color'], width=self.style['width'])) p.drawPath(self.path) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/__init__.py000066400000000000000000000001311457240071200237510ustar00rootroot00000000000000from .Flowchart import * from .library import getNodeTree, getNodeType, registerNodeType pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/library/000077500000000000000000000000001457240071200233115ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/library/Data.py000066400000000000000000000372121457240071200245410ustar00rootroot00000000000000 import numpy as np from ...graphicsItems.LinearRegionItem import LinearRegionItem from ...Qt import QtCore, QtWidgets from ...widgets.TreeWidget import TreeWidget from ..Node import Node from . import functions from .common import CtrlNode class ColumnSelectNode(Node): """Select named columns from a record array or MetaArray.""" nodeName = "ColumnSelect" def __init__(self, name): Node.__init__(self, name, terminals={'In': {'io': 'in'}}) self.columns = set() self.columnList = QtWidgets.QListWidget() self.axis = 0 self.columnList.itemChanged.connect(self.itemChanged) def process(self, In, display=True): if display: self.updateList(In) out = {} if hasattr(In, 'implements') and In.implements('MetaArray'): for c in self.columns: out[c] = In[self.axis:c] elif isinstance(In, np.ndarray) and In.dtype.fields is not None: for c in self.columns: out[c] = In[c] else: self.In.setValueAcceptable(False) raise Exception("Input must be MetaArray or ndarray with named fields") return out def ctrlWidget(self): return self.columnList def updateList(self, data): if hasattr(data, 'implements') and data.implements('MetaArray'): cols = data.listColumns() for ax in cols: ## find first axis with columns if len(cols[ax]) > 0: self.axis = ax cols = set(cols[ax]) break else: cols = list(data.dtype.fields.keys()) rem = set() for c in self.columns: if c not in cols: self.removeTerminal(c) rem.add(c) self.columns -= rem self.columnList.blockSignals(True) self.columnList.clear() for c in cols: item = QtWidgets.QListWidgetItem(c) item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled|QtCore.Qt.ItemFlag.ItemIsUserCheckable) if c in self.columns: item.setCheckState(QtCore.Qt.CheckState.Checked) else: item.setCheckState(QtCore.Qt.CheckState.Unchecked) self.columnList.addItem(item) self.columnList.blockSignals(False) def itemChanged(self, item): col = str(item.text()) if item.checkState() == QtCore.Qt.CheckState.Checked: if col not in self.columns: self.columns.add(col) self.addOutput(col) else: if col in self.columns: self.columns.remove(col) self.removeTerminal(col) self.update() def saveState(self): state = Node.saveState(self) state['columns'] = list(self.columns) return state def restoreState(self, state): Node.restoreState(self, state) self.columns = set(state.get('columns', [])) for c in self.columns: self.addOutput(c) class RegionSelectNode(CtrlNode): """Returns a slice from a 1-D array. Connect the 'widget' output to a plot to display a region-selection widget.""" nodeName = "RegionSelect" uiTemplate = [ ('start', 'spin', {'value': 0, 'step': 0.1}), ('stop', 'spin', {'value': 0.1, 'step': 0.1}), ('display', 'check', {'value': True}), ('movable', 'check', {'value': True}), ] def __init__(self, name): self.items = {} CtrlNode.__init__(self, name, terminals={ 'data': {'io': 'in'}, 'selected': {'io': 'out'}, 'region': {'io': 'out'}, 'widget': {'io': 'out', 'multi': True} }) self.ctrls['display'].toggled.connect(self.displayToggled) self.ctrls['movable'].toggled.connect(self.movableToggled) def displayToggled(self, b): for item in self.items.values(): item.setVisible(b) def movableToggled(self, b): for item in self.items.values(): item.setMovable(b) def process(self, data=None, display=True): #print "process.." s = self.stateGroup.state() region = [s['start'], s['stop']] if display: conn = self['widget'].connections() for c in conn: plot = c.node().getPlot() if plot is None: continue if c in self.items: item = self.items[c] item.setRegion(region) #print " set rgn:", c, region #item.setXVals(events) else: item = LinearRegionItem(values=region) self.items[c] = item #item.connect(item, QtCore.SIGNAL('regionChanged'), self.rgnChanged) item.sigRegionChanged.connect(self.rgnChanged) item.setVisible(s['display']) item.setMovable(s['movable']) #print " new rgn:", c, region #self.items[c].setYRange([0., 0.2], relative=True) if self['selected'].isConnected(): if data is None: sliced = None elif (hasattr(data, 'implements') and data.implements('MetaArray')): sliced = data[0:s['start']:s['stop']] else: mask = (data['time'] >= s['start']) * (data['time'] < s['stop']) sliced = data[mask] else: sliced = None return {'selected': sliced, 'widget': self.items, 'region': region} def rgnChanged(self, item): region = item.getRegion() self.stateGroup.setState({'start': region[0], 'stop': region[1]}) self.update() class TextEdit(QtWidgets.QTextEdit): def __init__(self, on_update): super().__init__() self.on_update = on_update self.lastText = None def focusOutEvent(self, ev): text = self.toPlainText() if text != self.lastText: self.lastText = text self.on_update() super().focusOutEvent(ev) class EvalNode(Node): """Return the output of a string evaluated/executed by the python interpreter. The string may be either an expression or a python script, and inputs are accessed as the name of the terminal. For expressions, a single value may be evaluated for a single output, or a dict for multiple outputs. For a script, the text will be executed as the body of a function.""" nodeName = 'PythonEval' def __init__(self, name): Node.__init__(self, name, terminals = { 'input': {'io': 'in', 'renamable': True, 'multiable': True}, 'output': {'io': 'out', 'renamable': True, 'multiable': True}, }, allowAddInput=True, allowAddOutput=True) self.ui = QtWidgets.QWidget() self.layout = QtWidgets.QGridLayout() self.text = TextEdit(self.update) self.text.setTabStopWidth(30) self.text.setPlainText("# Access inputs as args['input_name']\nreturn {'output': None} ## one key per output terminal") self.layout.addWidget(self.text, 1, 0, 1, 2) self.ui.setLayout(self.layout) def ctrlWidget(self): return self.ui def setCode(self, code): # unindent code; this allows nicer inline code specification when # calling this method. ind = [] lines = code.split('\n') for line in lines: stripped = line.lstrip() if len(stripped) > 0: ind.append(len(line) - len(stripped)) if len(ind) > 0: ind = min(ind) code = '\n'.join([line[ind:] for line in lines]) self.text.clear() self.text.insertPlainText(code) def code(self): return self.text.toPlainText() def process(self, display=True, **args): l = locals() l.update(args) ## try eval first, then exec try: text = self.text.toPlainText().replace('\n', ' ') output = eval(text, globals(), l) except SyntaxError: fn = "def fn(**args):\n" run = "\noutput=fn(**args)\n" text = fn + "\n".join([" "+l for l in self.text.toPlainText().split('\n')]) + run ldict = locals() exec(text, globals(), ldict) output = ldict['output'] except: print(f"Error processing node: {self.name()}") raise return output def saveState(self): state = Node.saveState(self) state['text'] = self.text.toPlainText() #state['terminals'] = self.saveTerminals() return state def restoreState(self, state): Node.restoreState(self, state) self.setCode(state['text']) self.restoreTerminals(state['terminals']) self.update() class ColumnJoinNode(Node): """Concatenates record arrays and/or adds new columns""" nodeName = 'ColumnJoin' def __init__(self, name): Node.__init__(self, name, terminals = { 'output': {'io': 'out'}, }) #self.items = [] self.ui = QtWidgets.QWidget() self.layout = QtWidgets.QGridLayout() self.ui.setLayout(self.layout) self.tree = TreeWidget() self.addInBtn = QtWidgets.QPushButton('+ Input') self.remInBtn = QtWidgets.QPushButton('- Input') self.layout.addWidget(self.tree, 0, 0, 1, 2) self.layout.addWidget(self.addInBtn, 1, 0) self.layout.addWidget(self.remInBtn, 1, 1) self.addInBtn.clicked.connect(self.addInput) self.remInBtn.clicked.connect(self.remInput) self.tree.sigItemMoved.connect(self.update) def ctrlWidget(self): return self.ui def addInput(self): #print "ColumnJoinNode.addInput called." term = Node.addInput(self, 'input', renamable=True, removable=True, multiable=True) #print "Node.addInput returned. term:", term item = QtWidgets.QTreeWidgetItem([term.name()]) item.term = term term.joinItem = item #self.items.append((term, item)) self.tree.addTopLevelItem(item) def remInput(self): sel = self.tree.currentItem() term = sel.term term.joinItem = None sel.term = None self.tree.removeTopLevelItem(sel) self.removeTerminal(term) self.update() def process(self, display=True, **args): order = self.order() vals = [] for name in order: if name not in args: continue val = args[name] if isinstance(val, np.ndarray) and len(val.dtype) > 0: vals.append(val) else: vals.append((name, None, val)) return {'output': functions.concatenateColumns(vals)} def order(self): return [str(self.tree.topLevelItem(i).text(0)) for i in range(self.tree.topLevelItemCount())] def saveState(self): state = Node.saveState(self) state['order'] = self.order() return state def restoreState(self, state): Node.restoreState(self, state) inputs = self.inputs() ## Node.restoreState should have created all of the terminals we need ## However: to maintain support for some older flowchart files, we need ## to manually add any terminals that were not taken care of. for name in [n for n in state['order'] if n not in inputs]: Node.addInput(self, name, renamable=True, removable=True, multiable=True) inputs = self.inputs() order = [name for name in state['order'] if name in inputs] for name in inputs: if name not in order: order.append(name) self.tree.clear() for name in order: term = self[name] item = QtWidgets.QTreeWidgetItem([name]) item.term = term term.joinItem = item #self.items.append((term, item)) self.tree.addTopLevelItem(item) def terminalRenamed(self, term, oldName): Node.terminalRenamed(self, term, oldName) item = term.joinItem item.setText(0, term.name()) self.update() class Mean(CtrlNode): """Calculate the mean of an array across an axis. """ nodeName = 'Mean' uiTemplate = [ ('axis', 'intSpin', {'value': 0, 'min': -1, 'max': 1000000}), ] def processData(self, data): s = self.stateGroup.state() ax = None if s['axis'] == -1 else s['axis'] return data.mean(axis=ax) class Max(CtrlNode): """Calculate the maximum of an array across an axis. """ nodeName = 'Max' uiTemplate = [ ('axis', 'intSpin', {'value': 0, 'min': -1, 'max': 1000000}), ] def processData(self, data): s = self.stateGroup.state() ax = None if s['axis'] == -1 else s['axis'] return data.max(axis=ax) class Min(CtrlNode): """Calculate the minimum of an array across an axis. """ nodeName = 'Min' uiTemplate = [ ('axis', 'intSpin', {'value': 0, 'min': -1, 'max': 1000000}), ] def processData(self, data): s = self.stateGroup.state() ax = None if s['axis'] == -1 else s['axis'] return data.min(axis=ax) class Stdev(CtrlNode): """Calculate the standard deviation of an array across an axis. """ nodeName = 'Stdev' uiTemplate = [ ('axis', 'intSpin', {'value': -0, 'min': -1, 'max': 1000000}), ] def processData(self, data): s = self.stateGroup.state() ax = None if s['axis'] == -1 else s['axis'] return data.std(axis=ax) class Index(CtrlNode): """Select an index from an array axis. """ nodeName = 'Index' uiTemplate = [ ('axis', 'intSpin', {'value': 0, 'min': 0, 'max': 1000000}), ('index', 'intSpin', {'value': 0, 'min': 0, 'max': 1000000}), ] def processData(self, data): s = self.stateGroup.state() ax = s['axis'] ind = s['index'] if ax == 0: # allow support for non-ndarray sequence types return data[ind] else: return data.take(ind, axis=ax) class Slice(CtrlNode): """Select a slice from an array axis. """ nodeName = 'Slice' uiTemplate = [ ('axis', 'intSpin', {'value': 0, 'min': 0, 'max': 1e6}), ('start', 'intSpin', {'value': 0, 'min': -1e6, 'max': 1e6}), ('stop', 'intSpin', {'value': -1, 'min': -1e6, 'max': 1e6}), ('step', 'intSpin', {'value': 1, 'min': -1e6, 'max': 1e6}), ] def processData(self, data): s = self.stateGroup.state() ax = s['axis'] start = s['start'] stop = s['stop'] step = s['step'] if ax == 0: # allow support for non-ndarray sequence types return data[start:stop:step] else: sl = [slice(None) for i in range(data.ndim)] sl[ax] = slice(start, stop, step) return data[sl] class AsType(CtrlNode): """Convert an array to a different dtype. """ nodeName = 'AsType' uiTemplate = [ ('dtype', 'combo', {'values': ['float', 'int', 'float32', 'float64', 'float128', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64'], 'index': 0}), ] def processData(self, data): s = self.stateGroup.state() return data.astype(s['dtype']) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/library/Display.py000066400000000000000000000240561457240071200252770ustar00rootroot00000000000000import numpy as np from ... import ComboBox, PlotDataItem from ...graphicsItems.ScatterPlotItem import ScatterPlotItem from ...Qt import QtCore, QtGui, QtWidgets from ..Node import Node from .common import CtrlNode class PlotWidgetNode(Node): """Connection to PlotWidget. Will plot arrays, metaarrays, and display event lists.""" nodeName = 'PlotWidget' sigPlotChanged = QtCore.Signal(object) def __init__(self, name): Node.__init__(self, name, terminals={'In': {'io': 'in', 'multi': True}}) self.plot = None # currently selected plot self.plots = {} # list of available plots user may select from self.ui = None self.items = {} def disconnected(self, localTerm, remoteTerm): if localTerm is self['In'] and remoteTerm in self.items: self.plot.removeItem(self.items[remoteTerm]) del self.items[remoteTerm] def setPlot(self, plot): #print "======set plot" if plot == self.plot: return # clear data from previous plot if self.plot is not None: for vid in list(self.items.keys()): self.plot.removeItem(self.items[vid]) del self.items[vid] self.plot = plot self.updateUi() self.update() self.sigPlotChanged.emit(self) def getPlot(self): return self.plot def process(self, In, display=True): if display and self.plot is not None: items = set() # Add all new input items to selected plot for name, vals in In.items(): if vals is None: continue if type(vals) is not list: vals = [vals] for val in vals: vid = id(val) if vid in self.items and self.items[vid].scene() is self.plot.scene(): # Item is already added to the correct scene # possible bug: what if two plots occupy the same scene? (should # rarely be a problem because items are removed from a plot before # switching). items.add(vid) else: # Add the item to the plot, or generate a new item if needed. if isinstance(val, QtWidgets.QGraphicsItem): self.plot.addItem(val) item = val else: item = self.plot.plot(val) self.items[vid] = item items.add(vid) # Any left-over items that did not appear in the input must be removed for vid in list(self.items.keys()): if vid not in items: self.plot.removeItem(self.items[vid]) del self.items[vid] def processBypassed(self, args): if self.plot is None: return for item in list(self.items.values()): self.plot.removeItem(item) self.items = {} def ctrlWidget(self): if self.ui is None: self.ui = ComboBox() self.ui.currentIndexChanged.connect(self.plotSelected) self.updateUi() return self.ui def plotSelected(self, index): self.setPlot(self.ui.value()) def setPlotList(self, plots): """ Specify the set of plots (PlotWidget or PlotItem) that the user may select from. *plots* must be a dictionary of {name: plot} pairs. """ self.plots = plots self.updateUi() def updateUi(self): # sets list and automatically preserves previous selection self.ui.setItems(self.plots) try: self.ui.setValue(self.plot) except ValueError: pass class CanvasNode(Node): """Connection to a Canvas widget.""" nodeName = 'CanvasWidget' def __init__(self, name): Node.__init__(self, name, terminals={'In': {'io': 'in', 'multi': True}}) self.canvas = None self.items = {} def disconnected(self, localTerm, remoteTerm): if localTerm is self.In and remoteTerm in self.items: self.canvas.removeItem(self.items[remoteTerm]) del self.items[remoteTerm] def setCanvas(self, canvas): self.canvas = canvas def getCanvas(self): return self.canvas def process(self, In, display=True): if display: items = set() for name, vals in In.items(): if vals is None: continue if type(vals) is not list: vals = [vals] for val in vals: vid = id(val) if vid in self.items: items.add(vid) else: self.canvas.addItem(val) item = val self.items[vid] = item items.add(vid) for vid in list(self.items.keys()): if vid not in items: #print "remove", self.items[vid] self.canvas.removeItem(self.items[vid]) del self.items[vid] class PlotCurve(CtrlNode): """Generates a plot curve from x/y data""" nodeName = 'PlotCurve' uiTemplate = [ ('color', 'color'), ] def __init__(self, name): CtrlNode.__init__(self, name, terminals={ 'x': {'io': 'in'}, 'y': {'io': 'in'}, 'plot': {'io': 'out'} }) self.item = PlotDataItem() def process(self, x, y, display=True): #print "scatterplot process" if not display: return {'plot': None} self.item.setData(x, y, pen=self.ctrls['color'].color()) return {'plot': self.item} class ScatterPlot(CtrlNode): """Generates a scatter plot from a record array or nested dicts""" nodeName = 'ScatterPlot' uiTemplate = [ ('x', 'combo', {'values': [], 'index': 0}), ('y', 'combo', {'values': [], 'index': 0}), ('sizeEnabled', 'check', {'value': False}), ('size', 'combo', {'values': [], 'index': 0}), ('absoluteSize', 'check', {'value': False}), ('colorEnabled', 'check', {'value': False}), ('color', 'colormap', {}), ('borderEnabled', 'check', {'value': False}), ('border', 'colormap', {}), ] def __init__(self, name): CtrlNode.__init__(self, name, terminals={ 'input': {'io': 'in'}, 'plot': {'io': 'out'} }) self.item = ScatterPlotItem() self.keys = [] #self.ui = QtWidgets.QWidget() #self.layout = QtWidgets.QGridLayout() #self.ui.setLayout(self.layout) #self.xCombo = QtWidgets.QComboBox() #self.yCombo = QtWidgets.QComboBox() def process(self, input, display=True): #print "scatterplot process" if not display: return {'plot': None} self.updateKeys(input[0]) x = str(self.ctrls['x'].currentText()) y = str(self.ctrls['y'].currentText()) size = str(self.ctrls['size'].currentText()) pen = QtGui.QPen(QtGui.QColor(0,0,0,0)) points = [] for i in input: pt = {'pos': (i[x], i[y])} if self.ctrls['sizeEnabled'].isChecked(): pt['size'] = i[size] if self.ctrls['borderEnabled'].isChecked(): pt['pen'] = QtGui.QPen(self.ctrls['border'].getColor(i)) else: pt['pen'] = pen if self.ctrls['colorEnabled'].isChecked(): pt['brush'] = QtGui.QBrush(self.ctrls['color'].getColor(i)) points.append(pt) self.item.setPxMode(not self.ctrls['absoluteSize'].isChecked()) self.item.setPoints(points) return {'plot': self.item} def updateKeys(self, data): if isinstance(data, dict): keys = list(data.keys()) elif isinstance(data, list) or isinstance(data, tuple): keys = data elif isinstance(data, np.ndarray) or isinstance(data, np.void): keys = data.dtype.names else: print("Unknown data type:", type(data), data) return for c in self.ctrls.values(): c.blockSignals(True) for c in [self.ctrls['x'], self.ctrls['y'], self.ctrls['size']]: cur = str(c.currentText()) c.clear() for k in keys: c.addItem(k) if k == cur: c.setCurrentIndex(c.count()-1) for c in [self.ctrls['color'], self.ctrls['border']]: c.setArgList(keys) for c in self.ctrls.values(): c.blockSignals(False) self.keys = keys def saveState(self): state = CtrlNode.saveState(self) return {'keys': self.keys, 'ctrls': state} def restoreState(self, state): self.updateKeys(state['keys']) CtrlNode.restoreState(self, state['ctrls']) #class ImageItem(Node): #"""Creates an ImageItem for display in a canvas from a file handle.""" #nodeName = 'Image' #def __init__(self, name): #Node.__init__(self, name, terminals={ #'file': {'io': 'in'}, #'image': {'io': 'out'} #}) #self.imageItem = graphicsItems.ImageItem() #self.handle = None #def process(self, file, display=True): #if not display: #return {'image': None} #if file != self.handle: #self.handle = file #data = file.read() #self.imageItem.updateImage(data) #pos = file. pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/library/Filters.py000066400000000000000000000314211457240071200252740ustar00rootroot00000000000000import numpy as np from ... import Point, PolyLineROI from ... import functions as pgfn from ... import metaarray as metaarray from . import functions from .common import CtrlNode, PlottingCtrlNode, metaArrayWrapper class Downsample(CtrlNode): """Downsample by averaging samples together.""" nodeName = 'Downsample' uiTemplate = [ ('n', 'intSpin', {'min': 1, 'max': 1000000}) ] def processData(self, data): return functions.downsample(data, self.ctrls['n'].value(), axis=0) class Subsample(CtrlNode): """Downsample by selecting every Nth sample.""" nodeName = 'Subsample' uiTemplate = [ ('n', 'intSpin', {'min': 1, 'max': 1000000}) ] def processData(self, data): return data[::self.ctrls['n'].value()] class Bessel(CtrlNode): """Bessel filter. Input data must have time values.""" nodeName = 'BesselFilter' uiTemplate = [ ('band', 'combo', {'values': ['lowpass', 'highpass'], 'index': 0}), ('cutoff', 'spin', {'value': 1000., 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'Hz', 'siPrefix': True}), ('order', 'intSpin', {'value': 4, 'min': 1, 'max': 16}), ('bidir', 'check', {'checked': True}) ] def processData(self, data): s = self.stateGroup.state() if s['band'] == 'lowpass': mode = 'low' else: mode = 'high' return functions.besselFilter(data, bidir=s['bidir'], btype=mode, cutoff=s['cutoff'], order=s['order']) class Butterworth(CtrlNode): """Butterworth filter""" nodeName = 'ButterworthFilter' uiTemplate = [ ('band', 'combo', {'values': ['lowpass', 'highpass'], 'index': 0}), ('wPass', 'spin', {'value': 1000., 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'Hz', 'siPrefix': True}), ('wStop', 'spin', {'value': 2000., 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'Hz', 'siPrefix': True}), ('gPass', 'spin', {'value': 2.0, 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'dB', 'siPrefix': True}), ('gStop', 'spin', {'value': 20.0, 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'dB', 'siPrefix': True}), ('bidir', 'check', {'checked': True}) ] def processData(self, data): s = self.stateGroup.state() if s['band'] == 'lowpass': mode = 'low' else: mode = 'high' ret = functions.butterworthFilter(data, bidir=s['bidir'], btype=mode, wPass=s['wPass'], wStop=s['wStop'], gPass=s['gPass'], gStop=s['gStop']) return ret class ButterworthNotch(CtrlNode): """Butterworth notch filter""" nodeName = 'ButterworthNotchFilter' uiTemplate = [ ('low_wPass', 'spin', {'value': 1000., 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'Hz', 'siPrefix': True}), ('low_wStop', 'spin', {'value': 2000., 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'Hz', 'siPrefix': True}), ('low_gPass', 'spin', {'value': 2.0, 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'dB', 'siPrefix': True}), ('low_gStop', 'spin', {'value': 20.0, 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'dB', 'siPrefix': True}), ('high_wPass', 'spin', {'value': 3000., 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'Hz', 'siPrefix': True}), ('high_wStop', 'spin', {'value': 4000., 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'Hz', 'siPrefix': True}), ('high_gPass', 'spin', {'value': 2.0, 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'dB', 'siPrefix': True}), ('high_gStop', 'spin', {'value': 20.0, 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'dB', 'siPrefix': True}), ('bidir', 'check', {'checked': True}) ] def processData(self, data): s = self.stateGroup.state() low = functions.butterworthFilter(data, bidir=s['bidir'], btype='low', wPass=s['low_wPass'], wStop=s['low_wStop'], gPass=s['low_gPass'], gStop=s['low_gStop']) high = functions.butterworthFilter(data, bidir=s['bidir'], btype='high', wPass=s['high_wPass'], wStop=s['high_wStop'], gPass=s['high_gPass'], gStop=s['high_gStop']) return low + high class Mean(CtrlNode): """Filters data by taking the mean of a sliding window""" nodeName = 'MeanFilter' uiTemplate = [ ('n', 'intSpin', {'min': 1, 'max': 1000000}) ] @metaArrayWrapper def processData(self, data): n = self.ctrls['n'].value() return functions.rollingSum(data, n) / n class Median(CtrlNode): """Filters data by taking the median of a sliding window""" nodeName = 'MedianFilter' uiTemplate = [ ('n', 'intSpin', {'min': 1, 'max': 1000000}) ] @metaArrayWrapper def processData(self, data): try: import scipy.ndimage except ImportError: raise Exception("MedianFilter node requires the package scipy.ndimage.") return scipy.ndimage.median_filter(data, self.ctrls['n'].value()) class Mode(CtrlNode): """Filters data by taking the mode (histogram-based) of a sliding window""" nodeName = 'ModeFilter' uiTemplate = [ ('window', 'intSpin', {'value': 500, 'min': 1, 'max': 1000000}), ] @metaArrayWrapper def processData(self, data): return functions.modeFilter(data, self.ctrls['window'].value()) class Denoise(CtrlNode): """Removes anomalous spikes from data, replacing with nearby values""" nodeName = 'DenoiseFilter' uiTemplate = [ ('radius', 'intSpin', {'value': 2, 'min': 0, 'max': 1000000}), ('threshold', 'doubleSpin', {'value': 4.0, 'min': 0, 'max': 1000}) ] def processData(self, data): #print "DENOISE" s = self.stateGroup.state() return functions.denoise(data, **s) class Gaussian(CtrlNode): """Gaussian smoothing filter.""" nodeName = 'GaussianFilter' uiTemplate = [ ('sigma', 'doubleSpin', {'min': 0, 'max': 1000000}) ] @metaArrayWrapper def processData(self, data): sigma = self.ctrls['sigma'].value() try: import scipy.ndimage return scipy.ndimage.gaussian_filter(data, sigma) except ImportError: return pgfn.gaussianFilter(data, sigma) class Derivative(CtrlNode): """Returns the pointwise derivative of the input""" nodeName = 'DerivativeFilter' def processData(self, data): if hasattr(data, 'implements') and data.implements('MetaArray'): info = data.infoCopy() if 'values' in info[0]: info[0]['values'] = info[0]['values'][:-1] return metaarray.MetaArray(data[1:] - data[:-1], info=info) else: return data[1:] - data[:-1] class Integral(CtrlNode): """Returns the pointwise integral of the input""" nodeName = 'IntegralFilter' @metaArrayWrapper def processData(self, data): data[1:] += data[:-1] return data class Detrend(CtrlNode): """Removes linear trend from the data""" nodeName = 'DetrendFilter' @metaArrayWrapper def processData(self, data): try: from scipy.signal import detrend except ImportError: raise Exception("DetrendFilter node requires the package scipy.signal.") return detrend(data) class RemoveBaseline(PlottingCtrlNode): """Remove an arbitrary, graphically defined baseline from the data.""" nodeName = 'RemoveBaseline' def __init__(self, name): ## define inputs and outputs (one output needs to be a plot) PlottingCtrlNode.__init__(self, name) self.line = PolyLineROI([[0,0],[1,0]]) self.line.sigRegionChanged.connect(self.changed) ## create a PolyLineROI, add it to a plot -- actually, I think we want to do this after the node is connected to a plot (look at EventDetection.ThresholdEvents node for ideas), and possible after there is data. We will need to update the end positions of the line each time the input data changes #self.line = None ## will become a PolyLineROI def connectToPlot(self, node): """Define what happens when the node is connected to a plot""" if node.plot is None: return node.getPlot().addItem(self.line) def disconnectFromPlot(self, plot): """Define what happens when the node is disconnected from a plot""" plot.removeItem(self.line) def processData(self, data): ## get array of baseline (from PolyLineROI) h0 = self.line.getHandles()[0] h1 = self.line.getHandles()[-1] timeVals = data.xvals(0) h0.setPos(timeVals[0], h0.pos()[1]) h1.setPos(timeVals[-1], h1.pos()[1]) pts = self.line.listPoints() ## lists line handles in same coordinates as data pts, indices = self.adjustXPositions(pts, timeVals) ## maxe sure x positions match x positions of data points ## construct an array that represents the baseline arr = np.zeros(len(data), dtype=float) n = 1 arr[0] = pts[0].y() for i in range(len(pts)-1): x1 = pts[i].x() x2 = pts[i+1].x() y1 = pts[i].y() y2 = pts[i+1].y() m = (y2-y1)/(x2-x1) b = y1 times = timeVals[(timeVals > x1)*(timeVals <= x2)] arr[n:n+len(times)] = (m*(times-times[0]))+b n += len(times) return data - arr ## subract baseline from data def adjustXPositions(self, pts, data): """Return a list of Point() where the x position is set to the nearest x value in *data* for each point in *pts*.""" points = [] timeIndices = [] for p in pts: x = np.argwhere(abs(data - p.x()) == abs(data - p.x()).min()) points.append(Point(data[x], p.y())) timeIndices.append(x) return points, timeIndices class AdaptiveDetrend(CtrlNode): """Removes baseline from data, ignoring anomalous events""" nodeName = 'AdaptiveDetrend' uiTemplate = [ ('threshold', 'doubleSpin', {'value': 3.0, 'min': 0, 'max': 1000000}) ] def processData(self, data): return functions.adaptiveDetrend(data, threshold=self.ctrls['threshold'].value()) class HistogramDetrend(CtrlNode): """Removes baseline from data by computing mode (from histogram) of beginning and end of data.""" nodeName = 'HistogramDetrend' uiTemplate = [ ('windowSize', 'intSpin', {'value': 500, 'min': 10, 'max': 1000000, 'suffix': 'pts'}), ('numBins', 'intSpin', {'value': 50, 'min': 3, 'max': 1000000}), ('offsetOnly', 'check', {'checked': False}), ] def processData(self, data): s = self.stateGroup.state() #ws = self.ctrls['windowSize'].value() #bn = self.ctrls['numBins'].value() #offset = self.ctrls['offsetOnly'].checked() return functions.histogramDetrend(data, window=s['windowSize'], bins=s['numBins'], offsetOnly=s['offsetOnly']) class RemovePeriodic(CtrlNode): nodeName = 'RemovePeriodic' uiTemplate = [ #('windowSize', 'intSpin', {'value': 500, 'min': 10, 'max': 1000000, 'suffix': 'pts'}), #('numBins', 'intSpin', {'value': 50, 'min': 3, 'max': 1000000}) ('f0', 'spin', {'value': 60, 'suffix': 'Hz', 'siPrefix': True, 'min': 0, 'max': None}), ('harmonics', 'intSpin', {'value': 30, 'min': 0}), ('samples', 'intSpin', {'value': 1, 'min': 1}), ] def processData(self, data): times = data.xvals('Time') dt = times[1]-times[0] data1 = data.asarray() ft = np.fft.fft(data1) ## determine frequencies in fft data df = 1.0 / (len(data1) * dt) ## flatten spikes at f0 and harmonics f0 = self.ctrls['f0'].value() for i in range(1, self.ctrls['harmonics'].value()+2): f = f0 * i # target frequency ## determine index range to check for this frequency ind1 = int(np.floor(f / df)) ind2 = int(np.ceil(f / df)) + (self.ctrls['samples'].value()-1) if ind1 > len(ft)/2.: break mag = (abs(ft[ind1-1]) + abs(ft[ind2+1])) * 0.5 for j in range(ind1, ind2+1): phase = np.angle(ft[j]) ## Must preserve the phase of each point, otherwise any transients in the trace might lead to large artifacts. re = mag * np.cos(phase) im = mag * np.sin(phase) ft[j] = re + im*1j ft[len(ft)-j] = re - im*1j data2 = np.fft.ifft(ft).real ma = metaarray.MetaArray(data2, info=data.infoCopy()) return ma pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/library/Operators.py000066400000000000000000000062571457240071200256530ustar00rootroot00000000000000from ..Node import Node from .common import CtrlNode class UniOpNode(Node): """Generic node for performing any operation like Out = In.fn()""" def __init__(self, name, fn): self.fn = fn Node.__init__(self, name, terminals={ 'In': {'io': 'in'}, 'Out': {'io': 'out', 'bypass': 'In'} }) def process(self, **args): return {'Out': getattr(args['In'], self.fn)()} class BinOpNode(CtrlNode): """Generic node for performing any operation like A.fn(B)""" _dtypes = [ 'float64', 'float32', 'float16', 'int64', 'int32', 'int16', 'int8', 'uint64', 'uint32', 'uint16', 'uint8' ] uiTemplate = [ ('outputType', 'combo', {'values': ['no change', 'input A', 'input B'] + _dtypes , 'index': 0}) ] def __init__(self, name, fn): self.fn = fn CtrlNode.__init__(self, name, terminals={ 'A': {'io': 'in'}, 'B': {'io': 'in'}, 'Out': {'io': 'out', 'bypass': 'A'} }) def process(self, **args): if isinstance(self.fn, tuple): for name in self.fn: try: fn = getattr(args['A'], name) break except AttributeError as e: pass else: raise e else: fn = getattr(args['A'], self.fn) out = fn(args['B']) if out is NotImplemented: raise Exception("Operation %s not implemented between %s and %s" % (fn, str(type(args['A'])), str(type(args['B'])))) # Coerce dtype if requested typ = self.stateGroup.state()['outputType'] if typ == 'no change': pass elif typ == 'input A': out = out.astype(args['A'].dtype) elif typ == 'input B': out = out.astype(args['B'].dtype) else: out = out.astype(typ) #print " ", fn, out return {'Out': out} class AbsNode(UniOpNode): """Returns abs(Inp). Does not check input types.""" nodeName = 'Abs' def __init__(self, name): UniOpNode.__init__(self, name, '__abs__') class AddNode(BinOpNode): """Returns A + B. Does not check input types.""" nodeName = 'Add' def __init__(self, name): BinOpNode.__init__(self, name, '__add__') class SubtractNode(BinOpNode): """Returns A - B. Does not check input types.""" nodeName = 'Subtract' def __init__(self, name): BinOpNode.__init__(self, name, '__sub__') class MultiplyNode(BinOpNode): """Returns A * B. Does not check input types.""" nodeName = 'Multiply' def __init__(self, name): BinOpNode.__init__(self, name, '__mul__') class DivideNode(BinOpNode): """Returns A / B. Does not check input types.""" nodeName = 'Divide' def __init__(self, name): # try truediv first, followed by div BinOpNode.__init__(self, name, ('__truediv__', '__div__')) class FloorDivideNode(BinOpNode): """Returns A // B. Does not check input types.""" nodeName = 'FloorDivide' def __init__(self, name): BinOpNode.__init__(self, name, '__floordiv__') pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/library/__init__.py000066400000000000000000000012271457240071200254240ustar00rootroot00000000000000from ..NodeLibrary import NodeLibrary, isNodeClass from . import Data, Display, Filters, Operators # Build default library LIBRARY = NodeLibrary() # For backward compatibility, expose the default library's properties here: NODE_LIST = LIBRARY.nodeList NODE_TREE = LIBRARY.nodeTree registerNodeType = LIBRARY.addNodeType getNodeTree = LIBRARY.getNodeTree getNodeType = LIBRARY.getNodeType # Add all nodes to the default library for mod in [Data, Display, Filters, Operators]: nodes = [getattr(mod, name) for name in dir(mod) if isNodeClass(getattr(mod, name))] for node in nodes: LIBRARY.addNodeType(node, [(mod.__name__.split('.')[-1],)]) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/library/common.py000066400000000000000000000136451457240071200251640ustar00rootroot00000000000000__all__ = ["CtrlNode", "PlottingCtrlNode", "metaArrayWrapper"] import numpy as np from ...Qt import QtCore, QtWidgets #from ...SignalProxy import SignalProxy from ...WidgetGroup import WidgetGroup from ...widgets.ColorButton import ColorButton from ...widgets.SpinBox import SpinBox #from ColorMapper import ColorMapper from ..Node import Node try: import metaarray HAVE_METAARRAY = True except: HAVE_METAARRAY = False def generateUi(opts): """Convenience function for generating common UI types""" widget = QtWidgets.QWidget() l = QtWidgets.QFormLayout() l.setSpacing(0) widget.setLayout(l) ctrls = {} row = 0 for opt in opts: if len(opt) == 2: k, t = opt o = {} elif len(opt) == 3: k, t, o = opt else: raise Exception("Widget specification must be (name, type) or (name, type, {opts})") ## clean out these options so they don't get sent to SpinBox hidden = o.pop('hidden', False) tip = o.pop('tip', None) if t == 'intSpin': w = QtWidgets.QSpinBox() if 'max' in o: w.setMaximum(o['max']) if 'min' in o: w.setMinimum(o['min']) if 'value' in o: w.setValue(o['value']) elif t == 'doubleSpin': w = QtWidgets.QDoubleSpinBox() if 'max' in o: w.setMaximum(o['max']) if 'min' in o: w.setMinimum(o['min']) if 'value' in o: w.setValue(o['value']) elif t == 'spin': w = SpinBox() w.setOpts(**o) elif t == 'check': w = QtWidgets.QCheckBox() if 'checked' in o: w.setChecked(o['checked']) elif t == 'combo': w = QtWidgets.QComboBox() for i in o['values']: w.addItem(i) #elif t == 'colormap': #w = ColorMapper() elif t == 'color': w = ColorButton() else: raise Exception("Unknown widget type '%s'" % str(t)) if tip is not None: w.setToolTip(tip) w.setObjectName(k) l.addRow(k, w) if hidden: w.hide() label = l.labelForField(w) label.hide() ctrls[k] = w w.rowNum = row row += 1 group = WidgetGroup(widget) return widget, group, ctrls class CtrlNode(Node): """Abstract class for nodes with auto-generated control UI""" sigStateChanged = QtCore.Signal(object) def __init__(self, name, ui=None, terminals=None): if terminals is None: terminals = {'In': {'io': 'in'}, 'Out': {'io': 'out', 'bypass': 'In'}} Node.__init__(self, name=name, terminals=terminals) if ui is None: if hasattr(self, 'uiTemplate'): ui = self.uiTemplate else: ui = [] self.ui, self.stateGroup, self.ctrls = generateUi(ui) self.stateGroup.sigChanged.connect(self.changed) def ctrlWidget(self): return self.ui def changed(self): self.update() self.sigStateChanged.emit(self) def process(self, In, display=True): out = self.processData(In) return {'Out': out} def saveState(self): state = Node.saveState(self) state['ctrl'] = self.stateGroup.state() return state def restoreState(self, state): Node.restoreState(self, state) if self.stateGroup is not None: self.stateGroup.setState(state.get('ctrl', {})) def hideRow(self, name): w = self.ctrls[name] l = self.ui.layout().labelForField(w) w.hide() l.hide() def showRow(self, name): w = self.ctrls[name] l = self.ui.layout().labelForField(w) w.show() l.show() class PlottingCtrlNode(CtrlNode): """Abstract class for CtrlNodes that can connect to plots.""" def __init__(self, name, ui=None, terminals=None): #print "PlottingCtrlNode.__init__ called." CtrlNode.__init__(self, name, ui=ui, terminals=terminals) self.plotTerminal = self.addOutput('plot', optional=True) def connected(self, term, remote): CtrlNode.connected(self, term, remote) if term is not self.plotTerminal: return node = remote.node() node.sigPlotChanged.connect(self.connectToPlot) self.connectToPlot(node) def disconnected(self, term, remote): CtrlNode.disconnected(self, term, remote) if term is not self.plotTerminal: return remote.node().sigPlotChanged.disconnect(self.connectToPlot) self.disconnectFromPlot(remote.node().getPlot()) def connectToPlot(self, node): """Define what happens when the node is connected to a plot""" raise Exception("Must be re-implemented in subclass") def disconnectFromPlot(self, plot): """Define what happens when the node is disconnected from a plot""" raise Exception("Must be re-implemented in subclass") def process(self, In, display=True): out = CtrlNode.process(self, In, display) out['plot'] = None return out def metaArrayWrapper(fn): def newFn(self, data, *args, **kargs): if HAVE_METAARRAY and (hasattr(data, 'implements') and data.implements('MetaArray')): d1 = fn(self, data.view(np.ndarray), *args, **kargs) info = data.infoCopy() if d1.shape != data.shape: for i in range(data.ndim): if 'values' in info[i]: info[i]['values'] = info[i]['values'][:d1.shape[i]] return metaarray.MetaArray(d1, info=info) else: return fn(self, data, *args, **kargs) return newFn pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/flowchart/library/functions.py000066400000000000000000000266171457240071200257070ustar00rootroot00000000000000import numpy as np from ...metaarray import MetaArray def downsample(data, n, axis=0, xvals='subsample'): """Downsample by averaging points together across axis. If multiple axes are specified, runs once per axis. If a metaArray is given, then the axis values can be either subsampled or downsampled to match. """ ma = None if (hasattr(data, 'implements') and data.implements('MetaArray')): ma = data data = data.view(np.ndarray) if hasattr(axis, '__len__'): if not hasattr(n, '__len__'): n = [n]*len(axis) for i in range(len(axis)): data = downsample(data, n[i], axis[i]) return data nPts = int(data.shape[axis] / n) s = list(data.shape) s[axis] = nPts s.insert(axis+1, n) sl = [slice(None)] * data.ndim sl[axis] = slice(0, nPts*n) d1 = data[tuple(sl)] #print d1.shape, s d1.shape = tuple(s) d2 = d1.mean(axis+1) if ma is None: return d2 else: info = ma.infoCopy() if 'values' in info[axis]: if xvals == 'subsample': info[axis]['values'] = info[axis]['values'][::n][:nPts] elif xvals == 'downsample': info[axis]['values'] = downsample(info[axis]['values'], n) return MetaArray(d2, info=info) def applyFilter(data, b, a, padding=100, bidir=True): """Apply a linear filter with coefficients a, b. Optionally pad the data before filtering and/or run the filter in both directions.""" try: import scipy.signal except ImportError: raise Exception("applyFilter() requires the package scipy.signal.") d1 = data.view(np.ndarray) if padding > 0: d1 = np.hstack([d1[:padding], d1, d1[-padding:]]) if bidir: d1 = scipy.signal.lfilter(b, a, scipy.signal.lfilter(b, a, d1)[::-1])[::-1] else: d1 = scipy.signal.lfilter(b, a, d1) if padding > 0: d1 = d1[padding:-padding] if (hasattr(data, 'implements') and data.implements('MetaArray')): return MetaArray(d1, info=data.infoCopy()) else: return d1 def besselFilter(data, cutoff, order=1, dt=None, btype='low', bidir=True): """return data passed through bessel filter""" try: import scipy.signal except ImportError: raise Exception("besselFilter() requires the package scipy.signal.") if dt is None: try: tvals = data.xvals('Time') dt = (tvals[-1]-tvals[0]) / (len(tvals)-1) except: dt = 1.0 b,a = scipy.signal.bessel(order, cutoff * dt, btype=btype) return applyFilter(data, b, a, bidir=bidir) #base = data.mean() #d1 = scipy.signal.lfilter(b, a, data.view(ndarray)-base) + base #if (hasattr(data, 'implements') and data.implements('MetaArray')): #return MetaArray(d1, info=data.infoCopy()) #return d1 def butterworthFilter(data, wPass, wStop=None, gPass=2.0, gStop=20.0, order=1, dt=None, btype='low', bidir=True): """return data passed through bessel filter""" try: import scipy.signal except ImportError: raise Exception("butterworthFilter() requires the package scipy.signal.") if dt is None: try: tvals = data.xvals('Time') dt = (tvals[-1]-tvals[0]) / (len(tvals)-1) except: dt = 1.0 if wStop is None: wStop = wPass * 2.0 ord, Wn = scipy.signal.buttord(wPass*dt*2., wStop*dt*2., gPass, gStop) #print "butterworth ord %f Wn %f c %f sc %f" % (ord, Wn, cutoff, stopCutoff) b,a = scipy.signal.butter(ord, Wn, btype=btype) return applyFilter(data, b, a, bidir=bidir) def rollingSum(data, n): d1 = data.copy() d1[1:] += d1[:-1] # integrate d2 = np.empty(len(d1) - n + 1, dtype=data.dtype) d2[0] = d1[n-1] # copy first point d2[1:] = d1[n:] - d1[:-n] # subtract return d2 def mode(data, bins=None): """Returns location max value from histogram.""" if bins is None: bins = int(len(data)/10.) if bins < 2: bins = 2 y, x = np.histogram(data, bins=bins) ind = np.argmax(y) mode = 0.5 * (x[ind] + x[ind+1]) return mode def modeFilter(data, window=500, step=None, bins=None): """Filter based on histogram-based mode function""" d1 = data.view(np.ndarray) vals = [] l2 = int(window/2.) if step is None: step = l2 i = 0 while True: if i > len(data)-step: break vals.append(mode(d1[i:i+window], bins)) i += step chunks = [np.linspace(vals[0], vals[0], l2)] for i in range(len(vals)-1): chunks.append(np.linspace(vals[i], vals[i+1], step)) remain = len(data) - step*(len(vals)-1) - l2 chunks.append(np.linspace(vals[-1], vals[-1], remain)) d2 = np.hstack(chunks) if (hasattr(data, 'implements') and data.implements('MetaArray')): return MetaArray(d2, info=data.infoCopy()) return d2 def denoise(data, radius=2, threshold=4): """Very simple noise removal function. Compares a point to surrounding points, replaces with nearby values if the difference is too large.""" r2 = radius * 2 d1 = data.view(np.ndarray) d2 = d1[radius:] - d1[:-radius] #a derivative #d3 = data[r2:] - data[:-r2] #d4 = d2 - d3 stdev = d2.std() #print "denoise: stdev of derivative:", stdev mask1 = d2 > stdev*threshold #where derivative is large and positive mask2 = d2 < -stdev*threshold #where derivative is large and negative maskpos = mask1[:-radius] * mask2[radius:] #both need to be true maskneg = mask1[radius:] * mask2[:-radius] mask = maskpos + maskneg d5 = np.where(mask, d1[:-r2], d1[radius:-radius]) #where both are true replace the value with the value from 2 points before d6 = np.empty(d1.shape, dtype=d1.dtype) #add points back to the ends d6[radius:-radius] = d5 d6[:radius] = d1[:radius] d6[-radius:] = d1[-radius:] if (hasattr(data, 'implements') and data.implements('MetaArray')): return MetaArray(d6, info=data.infoCopy()) return d6 def adaptiveDetrend(data, x=None, threshold=3.0): """Return the signal with baseline removed. Discards outliers from baseline measurement.""" try: import scipy.signal except ImportError: raise Exception("adaptiveDetrend() requires the package scipy.signal.") if x is None: x = data.xvals(0) d = data.view(np.ndarray) d2 = scipy.signal.detrend(d) stdev = d2.std() mask = abs(d2) < stdev*threshold #d3 = where(mask, 0, d2) #d4 = d2 - lowPass(d3, cutoffs[1], dt=dt) lr = scipy.stats.linregress(x[mask], d[mask]) base = lr[1] + lr[0]*x d4 = d - base if (hasattr(data, 'implements') and data.implements('MetaArray')): return MetaArray(d4, info=data.infoCopy()) return d4 def histogramDetrend(data, window=500, bins=50, threshold=3.0, offsetOnly=False): """Linear detrend. Works by finding the most common value at the beginning and end of a trace, excluding outliers. If offsetOnly is True, then only the offset from the beginning of the trace is subtracted. """ d1 = data.view(np.ndarray) d2 = [d1[:window], d1[-window:]] v = [0, 0] for i in [0, 1]: d3 = d2[i] stdev = d3.std() mask = abs(d3-np.median(d3)) < stdev*threshold d4 = d3[mask] y, x = np.histogram(d4, bins=bins) ind = np.argmax(y) v[i] = 0.5 * (x[ind] + x[ind+1]) if offsetOnly: d3 = data.view(np.ndarray) - v[0] else: base = np.linspace(v[0], v[1], len(data)) d3 = data.view(np.ndarray) - base if (hasattr(data, 'implements') and data.implements('MetaArray')): return MetaArray(d3, info=data.infoCopy()) return d3 def concatenateColumns(data): """Returns a single record array with columns taken from the elements in data. data should be a list of elements, which can be either record arrays or tuples (name, type, data) """ ## first determine dtype dtype = [] names = set() maxLen = 0 for element in data: if isinstance(element, np.ndarray): ## use existing columns for i in range(len(element.dtype)): name = element.dtype.names[i] dtype.append((name, element.dtype[i])) maxLen = max(maxLen, len(element)) else: name, type, d = element if type is None: type = suggestDType(d) dtype.append((name, type)) if isinstance(d, list) or isinstance(d, np.ndarray): maxLen = max(maxLen, len(d)) if name in names: raise Exception('Name "%s" repeated' % name) names.add(name) ## create empty array out = np.empty(maxLen, dtype) ## fill columns for element in data: if isinstance(element, np.ndarray): for i in range(len(element.dtype)): name = element.dtype.names[i] try: out[name] = element[name] except: print("Column:", name) print("Input shape:", element.shape, element.dtype) print("Output shape:", out.shape, out.dtype) raise else: name, type, d = element out[name] = d return out def suggestDType(x): """Return a suitable dtype for x""" if isinstance(x, list) or isinstance(x, tuple): if len(x) == 0: raise Exception('can not determine dtype for empty list') x = x[0] if hasattr(x, 'dtype'): return x.dtype elif isinstance(x, float): return float elif isinstance(x, int): return int #elif isinstance(x, str): ## don't try to guess correct string length; use object instead. #return ' len(ft)/2.: break mag = (abs(ft[ind1-1]) + abs(ft[ind2+1])) * 0.5 for j in range(ind1, ind2+1): phase = np.angle(ft[j]) ## Must preserve the phase of each point, otherwise any transients in the trace might lead to large artifacts. re = mag * np.cos(phase) im = mag * np.sin(phase) ft[j] = re + im*1j ft[len(ft)-j] = re - im*1j data2 = np.fft.ifft(ft).real if (hasattr(data, 'implements') and data.implements('MetaArray')): return metaarray.MetaArray(data2, info=data.infoCopy()) else: return data2 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/frozenSupport.py000066400000000000000000000034641457240071200231350ustar00rootroot00000000000000## Definitions helpful in frozen environments (eg py2exe) import os import sys import zipfile def listdir(path): """Replacement for os.listdir that works in frozen environments.""" if not hasattr(sys, 'frozen'): return os.listdir(path) (zipPath, archivePath) = splitZip(path) if archivePath is None: return os.listdir(path) with zipfile.ZipFile(zipPath, "r") as zipobj: contents = zipobj.namelist() results = set() for name in contents: # components in zip archive paths are always separated by forward slash if name.startswith(archivePath) and len(name) > len(archivePath): name = name[len(archivePath):].split('/')[0] results.add(name) return list(results) def isdir(path): """Replacement for os.path.isdir that works in frozen environments.""" if not hasattr(sys, 'frozen'): return os.path.isdir(path) (zipPath, archivePath) = splitZip(path) if archivePath is None: return os.path.isdir(path) with zipfile.ZipFile(zipPath, "r") as zipobj: contents = zipobj.namelist() archivePath = archivePath.rstrip('/') + '/' ## make sure there's exactly one '/' at the end for c in contents: if c.startswith(archivePath): return True return False def splitZip(path): """Splits a path containing a zip file into (zipfile, subpath). If there is no zip file, returns (path, None)""" components = os.path.normpath(path).split(os.sep) for index, component in enumerate(components): if component.endswith('.zip'): zipPath = os.sep.join(components[0:index+1]) archivePath = ''.join([x+'/' for x in components[index+1:]]) return (zipPath, archivePath) else: return (path, None) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/functions.py000066400000000000000000003522301457240071200222430ustar00rootroot00000000000000""" functions.py - Miscellaneous functions with no other home Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. """ from __future__ import division import decimal import math import re import struct import sys import warnings from collections import OrderedDict import numpy as np from . import Qt, debug, getConfigOption, reload from .metaarray import MetaArray from .Qt import QT_LIB, QtCore, QtGui from .util.cupy_helper import getCupy from .util.numba_helper import getNumbaFunctions # in order of appearance in this file. # add new functions to this list only if they are to reside in pg namespace. __all__ = [ 'siScale', 'siFormat', 'siParse', 'siEval', 'siApply', 'Color', 'mkColor', 'mkBrush', 'mkPen', 'hsvColor', 'CIELabColor', 'colorCIELab', 'colorDistance', 'colorTuple', 'colorStr', 'intColor', 'glColor', 'makeArrowPath', 'eq', 'affineSliceCoords', 'affineSlice', 'interweaveArrays', 'interpolateArray', 'subArray', 'transformToArray', 'transformCoordinates', 'solve3DTransform', 'solveBilinearTransform', 'clip_scalar', 'clip_array', 'rescaleData', 'applyLookupTable', 'makeRGBA', 'makeARGB', # 'try_fastpath_argb', 'ndarray_to_qimage', 'makeQImage', # 'ndarray_from_qimage', 'imageToArray', 'colorToAlpha', 'gaussianFilter', 'downsample', 'arrayToQPath', # 'ndarray_from_qpolygonf', 'create_qpolygonf', 'arrayToQPolygonF', 'isocurve', 'traceImage', 'isosurface', 'invertQTransform', 'pseudoScatter', 'toposort', 'disconnect', 'SignalBlock'] Colors = { 'b': QtGui.QColor(0,0,255,255), 'g': QtGui.QColor(0,255,0,255), 'r': QtGui.QColor(255,0,0,255), 'c': QtGui.QColor(0,255,255,255), 'm': QtGui.QColor(255,0,255,255), 'y': QtGui.QColor(255,255,0,255), 'k': QtGui.QColor(0,0,0,255), 'w': QtGui.QColor(255,255,255,255), 'd': QtGui.QColor(150,150,150,255), 'l': QtGui.QColor(200,200,200,255), 's': QtGui.QColor(100,100,150,255), } SI_PREFIXES = 'yzafpnµm kMGTPEZY' SI_PREFIXES_ASCII = 'yzafpnum kMGTPEZY' SI_PREFIX_EXPONENTS = dict([(SI_PREFIXES[i], (i-8)*3) for i in range(len(SI_PREFIXES))]) SI_PREFIX_EXPONENTS['u'] = -6 FLOAT_REGEX = re.compile(r'(?P[+-]?((((\d+(\.\d*)?)|(\d*\.\d+))([eE][+-]?\d+)?)|((?i:nan)|(inf))))\s*((?P[u' + SI_PREFIXES + r']?)(?P\w.*))?$') INT_REGEX = re.compile(r'(?P[+-]?\d+)\s*(?P[u' + SI_PREFIXES + r']?)(?P.*)$') def siScale(x, minVal=1e-25, allowUnicode=True): """ Return the recommended scale factor and SI prefix string for x. Example:: siScale(0.0001) # returns (1e6, 'μ') # This indicates that the number 0.0001 is best represented as 0.0001 * 1e6 = 100 μUnits """ if isinstance(x, decimal.Decimal): x = float(x) try: if not math.isfinite(x): return(1, '') except: raise if abs(x) < minVal: m = 0 else: m = int(clip_scalar(math.floor(math.log(abs(x))/math.log(1000)), -9.0, 9.0)) if m == 0: pref = '' elif m < -8 or m > 8: pref = 'e%d' % (m*3) else: if allowUnicode: pref = SI_PREFIXES[m+8] else: pref = SI_PREFIXES_ASCII[m+8] m1 = -3*m p = 10.**m1 return (p, pref) def siFormat(x, precision=3, suffix='', space=True, error=None, minVal=1e-25, allowUnicode=True): """ Return the number x formatted in engineering notation with SI prefix. Example:: siFormat(0.0001, suffix='V') # returns "100 μV" """ if space is True: space = ' ' if space is False: space = '' (p, pref) = siScale(x, minVal, allowUnicode) if not (len(pref) > 0 and pref[0] == 'e'): pref = space + pref if error is None: fmt = "%." + str(precision) + "g%s%s" return fmt % (x*p, pref, suffix) else: if allowUnicode: plusminus = space + "±" + space else: plusminus = " +/- " fmt = "%." + str(precision) + "g%s%s%s%s" return fmt % (x*p, pref, suffix, plusminus, siFormat(error, precision=precision, suffix=suffix, space=space, minVal=minVal)) def siParse(s, regex=FLOAT_REGEX, suffix=None): """Convert a value written in SI notation to a tuple (number, si_prefix, suffix). Example:: siParse('100 µV") # returns ('100', 'µ', 'V') Note that in the above example, the µ symbol is the "micro sign" (UTF-8 0xC2B5), as opposed to the Greek letter mu (UTF-8 0xCEBC). Parameters ---------- s : str The string to parse. regex : re.Pattern, optional Compiled regular expression object for parsing. The default is a general-purpose regex for parsing floating point expressions, potentially containing an SI prefix and a suffix. suffix : str, optional Suffix to check for in ``s``. The default (None) indicates there may or may not be a suffix contained in the string and it is returned if found. An empty string ``""`` is handled differently: if the string contains a suffix, it is discarded. This enables interpreting characters following the numerical value as an SI prefix. """ s = s.strip() if suffix is not None and len(suffix) > 0: if s[-len(suffix):] != suffix: raise ValueError("String '%s' does not have the expected suffix '%s'" % (s, suffix)) s = s[:-len(suffix)] + 'X' # add a fake suffix so the regex still picks up the si prefix # special case: discard any extra characters if suffix is explicitly empty if suffix == "": s += 'X' m = regex.match(s) if m is None: raise ValueError('Cannot parse number "%s"' % s) try: sip = m.group('siPrefix') except IndexError: sip = '' if suffix is None: try: suf = m.group('suffix') except IndexError: suf = '' else: suf = suffix return m.group('number'), '' if sip is None else sip, '' if suf is None else suf def siEval(s, typ=float, regex=FLOAT_REGEX, suffix=None): """ Convert a value written in SI notation to its equivalent prefixless value. Example:: siEval("100 μV") # returns 0.0001 """ val, siprefix, suffix = siParse(s, regex, suffix=suffix) v = typ(val) return siApply(v, siprefix) def siApply(val, siprefix): """ """ n = SI_PREFIX_EXPONENTS[siprefix] if siprefix != '' else 0 if n > 0: return val * 10**n elif n < 0: # this case makes it possible to use Decimal objects here return val / 10**-n else: return val class Color(QtGui.QColor): def __init__(self, *args): QtGui.QColor.__init__(self, mkColor(*args)) def glColor(self): """Return (r,g,b,a) normalized for use in opengl""" return self.getRgbF() def __getitem__(self, ind): return (self.red, self.green, self.blue, self.alpha)[ind]() def mkColor(*args): """ Convenience function for constructing QColor from a variety of argument types. Accepted arguments are: ================ ================================================ 'c' one of: r, g, b, c, m, y, k, w or an SVG color keyword R, G, B, [A] integers 0-255 (R, G, B, [A]) tuple of integers 0-255 float greyscale, 0.0-1.0 int see :func:`intColor() ` (int, hues) see :func:`intColor() ` "#RGB" "#RGBA" "#RRGGBB" "#RRGGBBAA" QColor QColor instance; makes a copy. ================ ================================================ """ err = 'Not sure how to make a color from "%s"' % str(args) if len(args) == 1: if isinstance(args[0], str): c = args[0] if len(c) == 1: try: return QtGui.QColor(Colors[c]) # return copy except KeyError: raise ValueError('No color named "%s"' % c) from None if c[0] == "#" and len(c) < 10: # match hex color codes c = c[1:] if len(c) < 6: # convert RGBA to RRGGBBAA c = "".join([x + x for x in c]) return QtGui.QColor(*bytes.fromhex(c)) else: # 'c' might be an SVG color keyword qcol = QtGui.QColor(c) if qcol.isValid(): return qcol raise ValueError(f"Unable to convert {c} to QColor") elif isinstance(args[0], QtGui.QColor): return QtGui.QColor(args[0]) elif np.issubdtype(type(args[0]), np.floating): r = g = b = int(args[0] * 255) a = 255 elif hasattr(args[0], '__len__'): if len(args[0]) == 3: r, g, b = args[0] a = 255 elif len(args[0]) == 4: r, g, b, a = args[0] elif len(args[0]) == 2: return intColor(*args[0]) else: raise TypeError(err) elif np.issubdtype(type(args[0]), np.integer): return intColor(args[0]) else: raise TypeError(err) elif len(args) == 3: r, g, b = args a = 255 elif len(args) == 4: r, g, b, a = args else: raise TypeError(err) args = [int(a) if np.isfinite(a) else 0 for a in (r, g, b, a)] return QtGui.QColor(*args) def mkBrush(*args, **kwds): """ | Convenience function for constructing Brush. | This function always constructs a solid brush and accepts the same arguments as :func:`mkColor() ` | Calling mkBrush(None) returns an invisible brush. """ if 'color' in kwds: color = kwds['color'] elif len(args) == 1: arg = args[0] if arg is None: return QtGui.QBrush(QtCore.Qt.BrushStyle.NoBrush) elif isinstance(arg, QtGui.QBrush): return QtGui.QBrush(arg) else: color = arg elif len(args) > 1: color = args return QtGui.QBrush(mkColor(color)) def mkPen(*args, **kargs): """ Convenience function for constructing QPen. Examples:: mkPen(color) mkPen(color, width=2) mkPen(cosmetic=False, width=4.5, color='r') mkPen({'color': "#FF0", width: 2}) mkPen(None) # (no pen) In these examples, *color* may be replaced with any arguments accepted by :func:`mkColor() ` """ color = kargs.get('color', None) width = kargs.get('width', 1) style = kargs.get('style', None) dash = kargs.get('dash', None) cosmetic = kargs.get('cosmetic', True) hsv = kargs.get('hsv', None) if len(args) == 1: arg = args[0] if isinstance(arg, dict): return mkPen(**arg) if isinstance(arg, QtGui.QPen): return QtGui.QPen(arg) ## return a copy of this pen elif arg is None: style = QtCore.Qt.PenStyle.NoPen else: color = arg if len(args) > 1: color = args if color is None: color = mkColor('l') if hsv is not None: color = hsvColor(*hsv) else: color = mkColor(color) pen = QtGui.QPen(QtGui.QBrush(color), width) pen.setCosmetic(cosmetic) if style is not None: pen.setStyle(style) if dash is not None: pen.setDashPattern(dash) # for width > 1.0, we are drawing many short segments to emulate a # single polyline. the default SquareCap style causes artifacts. # these artifacts can be avoided by using RoundCap. # this does have a performance penalty, so enable it only # for thicker line widths where the artifacts are visible. if width > 4.0: pen.setCapStyle(QtCore.Qt.PenCapStyle.RoundCap) return pen def hsvColor(hue, sat=1.0, val=1.0, alpha=1.0): """Generate a QColor from HSVa values. (all arguments are float 0.0-1.0)""" return QtGui.QColor.fromHsvF(hue, sat, val, alpha) # Matrices and math taken from "CIELab Color Space" by Gernot Hoffmann # http://docs-hoffmann.de/cielab03022003.pdf MATRIX_XYZ_FROM_RGB = np.array( ( ( 0.4124, 0.3576, 0.1805), ( 0.2126, 0.7152, 0.0722), ( 0.0193, 0.1192, 0.9505) ) ) MATRIX_RGB_FROM_XYZ = np.array( ( ( 3.2410,-1.5374,-0.4985), (-0.9692, 1.8760, 0.0416), ( 0.0556,-0.2040, 1.0570) ) ) VECTOR_XYZn = np.array( ( 0.9505, 1.0000, 1.0891) ) # white reference at illuminant D65 def CIELabColor(L, a, b, alpha=1.0): """ Generates as QColor from CIE L*a*b* values. Parameters ---------- L: float Lightness value ranging from 0 to 100 a, b: float (green/red) and (blue/yellow) coordinates, typically -127 to +127. alpha: float, optional Opacity, ranging from 0 to 1 Notes ----- The CIE L*a*b* color space parametrizes color in terms of a luminance `L` and the `a` and `b` coordinates that locate the hue in terms of a "green to red" and a "blue to yellow" axis. These coordinates seek to parametrize human color preception in such a way that the Euclidean distance between the coordinates of two colors represents the visual difference between these colors. In particular, the difference ΔE = sqrt( (L1-L2)² + (a1-a2)² + (b1-b2)² ) = 2.3 is considered the smallest "just noticeable difference" between colors. This simple equation represents the CIE76 standard. Later standards CIE94 and CIE2000 refine the difference calculation ΔE, while maintaining the L*a*b* coordinates. Alternative (and arguably more accurate) methods exist to quantify color difference, but the CIELab color space remains a convenient approximation. Under a known illumination, assumed to be white standard illuminant D65 here, a CIELab color induces a response in the human eye that is described by the tristimulus value XYZ. Once this is known, an sRGB color can be calculated to induce the same response. More information and underlying mathematics can be found in e.g. "CIELab Color Space" by Gernot Hoffmann, available at http://docs-hoffmann.de/cielab03022003.pdf . Also see :func:`colorDistance() `. """ # convert to tristimulus XYZ values vec_XYZ = np.full(3, ( L +16)/116 ) # Y1 = (L+16)/116 vec_XYZ[0] += a / 500 # X1 = (L+16)/116 + a/500 vec_XYZ[2] -= b / 200 # Z1 = (L+16)/116 - b/200 for idx, val in enumerate(vec_XYZ): if val > 0.20689: vec_XYZ[idx] = vec_XYZ[idx]**3 else: vec_XYZ[idx] = (vec_XYZ[idx] - 16/116) / 7.787 vec_XYZ = VECTOR_XYZn * vec_XYZ # apply white reference # print(f'XYZ: {vec_XYZ}') # convert XYZ to linear RGB vec_RGB = MATRIX_RGB_FROM_XYZ @ vec_XYZ # gamma-encode linear RGB arr_sRGB = np.zeros(3) for idx, val in enumerate( vec_RGB[:3] ): if val > 0.0031308: # (t) RGB value for linear/exponential transition arr_sRGB[idx] = 1.055 * val**(1/2.4) - 0.055 else: arr_sRGB[idx] = 12.92 * val # (s) arr_sRGB = clip_array( arr_sRGB, 0.0, 1.0 ) # avoid QColor errors return QtGui.QColor.fromRgbF( *arr_sRGB, alpha ) def colorCIELab(qcol): """ Describes a QColor by an array of CIE L*a*b* values. Also see :func:`CIELabColor() ` . Parameters ---------- qcol: QColor QColor to be converted Returns ------- np.ndarray Color coordinates `[L, a, b]`. """ srgb = qcol.getRgbF()[:3] # get sRGB values from QColor # convert gamma-encoded sRGB to linear: vec_RGB = np.zeros(3) for idx, val in enumerate( srgb ): if val > (12.92 * 0.0031308): # coefficients (s) * (t) vec_RGB[idx] = ((val+0.055)/1.055)**2.4 else: vec_RGB[idx] = val / 12.92 # (s) coefficient # converted linear RGB to tristimulus XYZ: vec_XYZ = MATRIX_XYZ_FROM_RGB @ vec_RGB # normalize with white reference and convert to L*a*b* values vec_XYZ1 = vec_XYZ / VECTOR_XYZn for idx, val in enumerate(vec_XYZ1): if val > 0.008856: vec_XYZ1[idx] = vec_XYZ1[idx]**(1/3) else: vec_XYZ1[idx] = 7.787*vec_XYZ1[idx] + 16/116 vec_Lab = np.array([ 116 * vec_XYZ1[1] - 16, # Y1 500 * (vec_XYZ1[0] - vec_XYZ1[1]), # X1 - Y1 200 * (vec_XYZ1[1] - vec_XYZ1[2])] ) # Y1 - Z1 return vec_Lab def colorDistance(colors, metric='CIE76'): """ Returns the perceptual distances between a sequence of QColors. See :func:`CIELabColor() ` for more information. Parameters ---------- colors: list of QColor Two or more colors to calculate the distances between. metric: str, optional Metric used to determined the difference. Only 'CIE76' is supported at this time, where a distance of 2.3 is considered a "just noticeable difference". The default may change as more metrics become available. Returns ------- List The `N-1` sequential distances between `N` colors. """ metric = metric.upper() if len(colors) < 1: return np.array([], dtype=float) if metric == 'CIE76': dist = [] lab1 = None for col in colors: lab2 = colorCIELab(col) if lab1 is None: #initialize on first element lab1 = lab2 continue dE = math.sqrt( np.sum( (lab1-lab2)**2 ) ) dist.append(dE) lab1 = lab2 return np.array(dist) raise ValueError(f'Metric {metric} is not available.') def colorTuple(c): """Return a tuple (R,G,B,A) from a QColor""" return c.getRgb() def colorStr(c): """Generate a hex string code from a QColor""" return ('%02x'*4) % colorTuple(c) def intColor(index, hues=9, values=1, maxValue=255, minValue=150, maxHue=360, minHue=0, sat=255, alpha=255): """ Creates a QColor from a single index. Useful for stepping through a predefined list of colors. The argument *index* determines which color from the set will be returned. All other arguments determine what the set of predefined colors will be Colors are chosen by cycling across hues while varying the value (brightness). By default, this selects from a list of 9 hues.""" hues = int(hues) values = int(values) ind = int(index) % (hues * values) indh = ind % hues indv = ind // hues if values > 1: v = minValue + indv * ((maxValue-minValue) // (values-1)) else: v = maxValue h = minHue + (indh * (maxHue-minHue)) // hues return QtGui.QColor.fromHsv(h, sat, v, alpha) def glColor(*args, **kargs): """ Convert a color to OpenGL color format (r,g,b,a) floats 0.0-1.0 Accepts same arguments as :func:`mkColor `. """ c = mkColor(*args, **kargs) return c.getRgbF() def makeArrowPath(headLen=20, headWidth=None, tipAngle=20, tailLen=20, tailWidth=3, baseAngle=0): """ Construct a path outlining an arrow with the given dimensions. The arrow points in the -x direction with tip positioned at 0,0. If *headWidth* is supplied, it overrides *tipAngle* (in degrees). If *tailLen* is None, no tail will be drawn. """ if headWidth is None: headWidth = headLen * math.tan(math.radians(tipAngle * 0.5)) path = QtGui.QPainterPath() path.moveTo(0,0) path.lineTo(headLen, -headWidth) if tailLen is None: innerY = headLen - headWidth * math.tan(math.radians(baseAngle)) path.lineTo(innerY, 0) else: tailWidth *= 0.5 innerY = headLen - (headWidth-tailWidth) * math.tan(math.radians(baseAngle)) path.lineTo(innerY, -tailWidth) path.lineTo(headLen + tailLen, -tailWidth) path.lineTo(headLen + tailLen, tailWidth) path.lineTo(innerY, tailWidth) path.lineTo(headLen, headWidth) path.lineTo(0,0) return path def eq(a, b): """The great missing equivalence function: Guaranteed evaluation to a single bool value. This function has some important differences from the == operator: 1. Returns True if a IS b, even if a==b still evaluates to False. 2. While a is b will catch the case with np.nan values, special handling is done for distinct float('nan') instances using math.isnan. 3. Tests for equivalence using ==, but silently ignores some common exceptions that can occur (AtrtibuteError, ValueError). 4. When comparing arrays, returns False if the array shapes are not the same. 5. When comparing arrays of the same shape, returns True only if all elements are equal (whereas the == operator would return a boolean array). 6. Collections (dict, list, etc.) must have the same type to be considered equal. One consequence is that comparing a dict to an OrderedDict will always return False. """ if a is b: return True # The above catches np.nan, but not float('nan') if isinstance(a, float) and isinstance(b, float): if math.isnan(a) and math.isnan(b): return True # Avoid comparing large arrays against scalars; this is expensive and we know it should return False. aIsArr = isinstance(a, (np.ndarray, MetaArray)) bIsArr = isinstance(b, (np.ndarray, MetaArray)) if (aIsArr or bIsArr) and type(a) != type(b): return False # If both inputs are arrays, we can speeed up comparison if shapes / dtypes don't match # NOTE: arrays of dissimilar type should be considered unequal even if they are numerically # equal because they may behave differently when computed on. if aIsArr and bIsArr and (a.shape != b.shape or a.dtype != b.dtype): return False # Recursively handle common containers if isinstance(a, dict) and isinstance(b, dict): if type(a) != type(b) or len(a) != len(b): return False if set(a.keys()) != set(b.keys()): return False for k, v in a.items(): if not eq(v, b[k]): return False if isinstance(a, OrderedDict) or sys.version_info >= (3, 7): for a_item, b_item in zip(a.items(), b.items()): if not eq(a_item, b_item): return False return True if isinstance(a, (list, tuple)) and isinstance(b, (list, tuple)): if type(a) != type(b) or len(a) != len(b): return False for v1,v2 in zip(a, b): if not eq(v1, v2): return False return True # Test for equivalence. # If the test raises a recognized exception, then return Falase try: try: # Sometimes running catch_warnings(module=np) generates AttributeError ??? catcher = warnings.catch_warnings(module=np) # ignore numpy futurewarning (numpy v. 1.10) catcher.__enter__() except Exception: catcher = None e = a==b except (ValueError, AttributeError): return False except: print('failed to evaluate equivalence for:') print(" a:", str(type(a)), str(a)) print(" b:", str(type(b)), str(b)) raise finally: if catcher is not None: catcher.__exit__(None, None, None) t = type(e) if t is bool: return e elif t is np.bool_: return bool(e) elif isinstance(e, np.ndarray) or (hasattr(e, 'implements') and e.implements('MetaArray')): try: ## disaster: if a is an empty array and b is not, then e.all() is True if a.shape != b.shape: return False except: return False if (hasattr(e, 'implements') and e.implements('MetaArray')): return e.asarray().all() else: return e.all() else: raise TypeError("== operator returned type %s" % str(type(e))) def affineSliceCoords(shape, origin, vectors, axes): """Return the array of coordinates used to sample data arrays in affineSlice(). """ # sanity check if len(shape) != len(vectors): raise Exception("shape and vectors must have same length.") if len(origin) != len(axes): raise Exception("origin and axes must have same length.") for v in vectors: if len(v) != len(axes): raise Exception("each vector must be same length as axes.") shape = list(map(np.ceil, shape)) ## make sure vectors are arrays if not isinstance(vectors, np.ndarray): vectors = np.array(vectors) if not isinstance(origin, np.ndarray): origin = np.array(origin) origin.shape = (len(axes),) + (1,)*len(shape) ## Build array of sample locations. grid = np.mgrid[tuple([slice(0,x) for x in shape])] ## mesh grid of indexes x = (grid[np.newaxis,...] * vectors.transpose()[(Ellipsis,) + (np.newaxis,)*len(shape)]).sum(axis=1) ## magic x += origin return x def affineSlice(data, shape, origin, vectors, axes, order=1, returnCoords=False, **kargs): """ Take a slice of any orientation through an array. This is useful for extracting sections of multi-dimensional arrays such as MRI images for viewing as 1D or 2D data. The slicing axes are aribtrary; they do not need to be orthogonal to the original data or even to each other. It is possible to use this function to extract arbitrary linear, rectangular, or parallelepiped shapes from within larger datasets. The original data is interpolated onto a new array of coordinates using either interpolateArray if order<2 or scipy.ndimage.map_coordinates otherwise. For a graphical interface to this function, see :func:`ROI.getArrayRegion ` ============== ==================================================================================================== **Arguments:** *data* (ndarray) the original dataset *shape* the shape of the slice to take (Note the return value may have more dimensions than len(shape)) *origin* the location in the original dataset that will become the origin of the sliced data. *vectors* list of unit vectors which point in the direction of the slice axes. Each vector must have the same length as *axes*. If the vectors are not unit length, the result will be scaled relative to the original data. If the vectors are not orthogonal, the result will be sheared relative to the original data. *axes* The axes in the original dataset which correspond to the slice *vectors* *order* The order of spline interpolation. Default is 1 (linear). See scipy.ndimage.map_coordinates for more information. *returnCoords* If True, return a tuple (result, coords) where coords is the array of coordinates used to select values from the original dataset. *All extra keyword arguments are passed to scipy.ndimage.map_coordinates.* -------------------------------------------------------------------------------------------------------------------- ============== ==================================================================================================== Note the following must be true: | len(shape) == len(vectors) | len(origin) == len(axes) == len(vectors[i]) Example: start with a 4D fMRI data set, take a diagonal-planar slice out of the last 3 axes * data = array with dims (time, x, y, z) = (100, 40, 40, 40) * The plane to pull out is perpendicular to the vector (x,y,z) = (1,1,1) * The origin of the slice will be at (x,y,z) = (40, 0, 0) * We will slice a 20x20 plane from each timepoint, giving a final shape (100, 20, 20) The call for this example would look like:: affineSlice(data, shape=(20,20), origin=(40,0,0), vectors=((-1, 1, 0), (-1, 0, 1)), axes=(1,2,3)) """ x = affineSliceCoords(shape, origin, vectors, axes) ## transpose data so slice axes come first trAx = list(range(data.ndim)) for ax in axes: trAx.remove(ax) tr1 = tuple(axes) + tuple(trAx) data = data.transpose(tr1) #print "tr1:", tr1 ## dims are now [(slice axes), (other axes)] if order > 1: try: import scipy.ndimage except ImportError: raise ImportError("Interpolating with order > 1 requires the scipy.ndimage module, but it could not be imported.") # iterate manually over unused axes since map_coordinates won't do it for us extraShape = data.shape[len(axes):] output = np.empty(tuple(shape) + extraShape, dtype=data.dtype) for inds in np.ndindex(*extraShape): ind = (Ellipsis,) + inds output[ind] = scipy.ndimage.map_coordinates(data[ind], x, order=order, **kargs) else: # map_coordinates expects the indexes as the first axis, whereas # interpolateArray expects indexes at the last axis. tr = tuple(range(1, x.ndim)) + (0,) output = interpolateArray(data, x.transpose(tr), order=order) tr = list(range(output.ndim)) trb = [] for i in range(min(axes)): ind = tr1.index(i) + (len(shape)-len(axes)) tr.remove(ind) trb.append(ind) tr2 = tuple(trb+tr) ## Untranspose array before returning output = output.transpose(tr2) if returnCoords: return (output, x) else: return output def interweaveArrays(*args): """ Parameters ---------- args : numpy.ndarray series of 1D numpy arrays of the same length and dtype Returns ------- numpy.ndarray A numpy array with all the input numpy arrays interwoven Examples -------- >>> result = interweaveArrays(numpy.ndarray([0, 2, 4]), numpy.ndarray([1, 3, 5])) >>> result array([0, 1, 2, 3, 4, 5]) """ size = sum(x.size for x in args) result = np.empty((size,), dtype=args[0].dtype) n = len(args) for index, array in enumerate(args): result[index::n] = array return result def interpolateArray(data, x, default=0.0, order=1): """ N-dimensional interpolation similar to scipy.ndimage.map_coordinates. This function returns linearly-interpolated values sampled from a regular grid of data. It differs from `ndimage.map_coordinates` by allowing broadcasting within the input array. ============== =========================================================================================== **Arguments:** *data* Array of any shape containing the values to be interpolated. *x* Array with (shape[-1] <= data.ndim) containing the locations within *data* to interpolate. (note: the axes for this argument are transposed relative to the same argument for `ndimage.map_coordinates`). *default* Value to return for locations in *x* that are outside the bounds of *data*. *order* Order of interpolation: 0=nearest, 1=linear. ============== =========================================================================================== Returns array of shape (x.shape[:-1] + data.shape[x.shape[-1]:]) For example, assume we have the following 2D image data:: >>> data = np.array([[1, 2, 4 ], [10, 20, 40 ], [100, 200, 400]]) To compute a single interpolated point from this data:: >>> x = np.array([(0.5, 0.5)]) >>> interpolateArray(data, x) array([ 8.25]) To compute a 1D list of interpolated locations:: >>> x = np.array([(0.5, 0.5), (1.0, 1.0), (1.0, 2.0), (1.5, 0.0)]) >>> interpolateArray(data, x) array([ 8.25, 20. , 40. , 55. ]) To compute a 2D array of interpolated locations:: >>> x = np.array([[(0.5, 0.5), (1.0, 2.0)], [(1.0, 1.0), (1.5, 0.0)]]) >>> interpolateArray(data, x) array([[ 8.25, 40. ], [ 20. , 55. ]]) ..and so on. The *x* argument may have any shape as long as ```x.shape[-1] <= data.ndim```. In the case that ```x.shape[-1] < data.ndim```, then the remaining axes are simply broadcasted as usual. For example, we can interpolate one location from an entire row of the data:: >>> x = np.array([[0.5]]) >>> interpolateArray(data, x) array([[ 5.5, 11. , 22. ]]) This is useful for interpolating from arrays of colors, vertexes, etc. """ if order not in (0, 1): raise ValueError("interpolateArray requires order=0 or 1 (got %s)" % order) prof = debug.Profiler() nd = data.ndim md = x.shape[-1] if md > nd: raise TypeError("x.shape[-1] must be less than or equal to data.ndim") totalMask = np.ones(x.shape[:-1], dtype=bool) # keep track of out-of-bound indexes if order == 0: xinds = np.round(x).astype(int) # NOTE: for 0.5 this rounds to the nearest *even* number for ax in range(md): mask = (xinds[...,ax] >= 0) & (xinds[...,ax] <= data.shape[ax]-1) xinds[...,ax][~mask] = 0 # keep track of points that need to be set to default totalMask &= mask result = data[tuple([xinds[...,i] for i in range(xinds.shape[-1])])] elif order == 1: # First we generate arrays of indexes that are needed to # extract the data surrounding each point fields = np.mgrid[(slice(0,order+1),) * md] xmin = np.floor(x).astype(int) xmax = xmin + 1 indexes = np.concatenate([xmin[np.newaxis, ...], xmax[np.newaxis, ...]]) fieldInds = [] for ax in range(md): mask = (xmin[...,ax] >= 0) & (x[...,ax] <= data.shape[ax]-1) # keep track of points that need to be set to default totalMask &= mask # ..and keep track of indexes that are out of bounds # (note that when x[...,ax] == data.shape[ax], then xmax[...,ax] will be out # of bounds, but the interpolation will work anyway) mask &= (xmax[...,ax] < data.shape[ax]) axisIndex = indexes[...,ax][fields[ax]] axisIndex[axisIndex < 0] = 0 axisIndex[axisIndex >= data.shape[ax]] = 0 fieldInds.append(axisIndex) prof() # Get data values surrounding each requested point fieldData = data[tuple(fieldInds)] prof() ## Interpolate s = np.empty((md,) + fieldData.shape, dtype=float) dx = x - xmin # reshape fields for arithmetic against dx for ax in range(md): f1 = fields[ax].reshape(fields[ax].shape + (1,)*(dx.ndim-1)) sax = f1 * dx[...,ax] + (1-f1) * (1-dx[...,ax]) sax = sax.reshape(sax.shape + (1,) * (s.ndim-1-sax.ndim)) s[ax] = sax s = np.prod(s, axis=0) result = fieldData * s for i in range(md): result = result.sum(axis=0) prof() if totalMask.ndim > 0: result[~totalMask] = default else: if totalMask is False: result[:] = default prof() return result def subArray(data, offset, shape, stride): """ Unpack a sub-array from *data* using the specified offset, shape, and stride. Note that *stride* is specified in array elements, not bytes. For example, we have a 2x3 array packed in a 1D array as follows:: data = [_, _, 00, 01, 02, _, 10, 11, 12, _] Then we can unpack the sub-array with this call:: subArray(data, offset=2, shape=(2, 3), stride=(4, 1)) ..which returns:: [[00, 01, 02], [10, 11, 12]] This function operates only on the first axis of *data*. So changing the input in the example above to have shape (10, 7) would cause the output to have shape (2, 3, 7). """ data = np.ascontiguousarray(data)[offset:] shape = tuple(shape) extraShape = data.shape[1:] strides = list(data.strides[::-1]) itemsize = strides[-1] for s in stride[1::-1]: strides.append(itemsize * s) strides = tuple(strides[::-1]) return np.ndarray(buffer=data, shape=shape+extraShape, strides=strides, dtype=data.dtype) def transformToArray(tr): """ Given a QTransform, return a 3x3 numpy array. Given a QMatrix4x4, return a 4x4 numpy array. Example: map an array of x,y coordinates through a transform:: ## coordinates to map are (1,5), (2,6), (3,7), and (4,8) coords = np.array([[1,2,3,4], [5,6,7,8], [1,1,1,1]]) # the extra '1' coordinate is needed for translation to work ## Make an example transform tr = QtGui.QTransform() tr.translate(3,4) tr.scale(2, 0.1) ## convert to array m = pg.transformToArray()[:2] # ignore the perspective portion of the transformation ## map coordinates through transform mapped = np.dot(m, coords) """ #return np.array([[tr.m11(), tr.m12(), tr.m13()],[tr.m21(), tr.m22(), tr.m23()],[tr.m31(), tr.m32(), tr.m33()]]) ## The order of elements given by the method names m11..m33 is misleading-- ## It is most common for x,y translation to occupy the positions 1,3 and 2,3 in ## a transformation matrix. However, with QTransform these values appear at m31 and m32. ## So the correct interpretation is transposed: if isinstance(tr, QtGui.QTransform): return np.array([[tr.m11(), tr.m21(), tr.m31()], [tr.m12(), tr.m22(), tr.m32()], [tr.m13(), tr.m23(), tr.m33()]]) elif isinstance(tr, QtGui.QMatrix4x4): return np.array(tr.copyDataTo()).reshape(4,4) else: raise Exception("Transform argument must be either QTransform or QMatrix4x4.") def transformCoordinates(tr, coords, transpose=False): """ Map a set of 2D or 3D coordinates through a QTransform or QMatrix4x4. The shape of coords must be (2,...) or (3,...) The mapping will _ignore_ any perspective transformations. For coordinate arrays with ndim=2, this is basically equivalent to matrix multiplication. Most arrays, however, prefer to put the coordinate axis at the end (eg. shape=(...,3)). To allow this, use transpose=True. """ if transpose: ## move last axis to beginning. This transposition will be reversed before returning the mapped coordinates. coords = coords.transpose((coords.ndim-1,) + tuple(range(0,coords.ndim-1))) nd = coords.shape[0] if isinstance(tr, np.ndarray): m = tr else: m = transformToArray(tr) m = m[:m.shape[0]-1] # remove perspective ## If coords are 3D and tr is 2D, assume no change for Z axis if m.shape == (2,3) and nd == 3: m2 = np.zeros((3,4)) m2[:2, :2] = m[:2,:2] m2[:2, 3] = m[:2,2] m2[2,2] = 1 m = m2 ## if coords are 2D and tr is 3D, ignore Z axis if m.shape == (3,4) and nd == 2: m2 = np.empty((2,3)) m2[:,:2] = m[:2,:2] m2[:,2] = m[:2,3] m = m2 ## reshape tr and coords to prepare for multiplication m = m.reshape(m.shape + (1,)*(coords.ndim-1)) coords = coords[np.newaxis, ...] # separate scale/rotate and translation translate = m[:,-1] m = m[:, :-1] ## map coordinates and return # nan or inf points will not plot, but should not generate warnings with warnings.catch_warnings(): warnings.simplefilter("ignore", RuntimeWarning) mapped = (m*coords).sum(axis=1) ## apply scale/rotate mapped += translate if transpose: ## move first axis to end. mapped = mapped.transpose(tuple(range(1,mapped.ndim)) + (0,)) return mapped def solve3DTransform(points1, points2): """ Find a 3D transformation matrix that maps points1 onto points2. Points must be specified as either lists of 4 Vectors or (4, 3) arrays. """ import numpy.linalg pts = [] for inp in (points1, points2): if isinstance(inp, np.ndarray): A = np.empty((4,4), dtype=float) A[:,:3] = inp[:,:3] A[:,3] = 1.0 else: A = np.array([[inp[i].x(), inp[i].y(), inp[i].z(), 1] for i in range(4)]) pts.append(A) ## solve 3 sets of linear equations to determine transformation matrix elements matrix = np.zeros((4,4)) for i in range(3): ## solve Ax = B; x is one row of the desired transformation matrix matrix[i] = numpy.linalg.solve(pts[0], pts[1][:,i]) return matrix def solveBilinearTransform(points1, points2): """ Find a bilinear transformation matrix (2x4) that maps points1 onto points2. Points must be specified as a list of 4 Vector, Point, QPointF, etc. To use this matrix to map a point [x,y]:: mapped = np.dot(matrix, [x*y, x, y, 1]) """ import numpy.linalg ## A is 4 rows (points) x 4 columns (xy, x, y, 1) ## B is 4 rows (points) x 2 columns (x, y) A = np.array([[points1[i].x()*points1[i].y(), points1[i].x(), points1[i].y(), 1] for i in range(4)]) B = np.array([[points2[i].x(), points2[i].y()] for i in range(4)]) ## solve 2 sets of linear equations to determine transformation matrix elements matrix = np.zeros((2,4)) for i in range(2): matrix[i] = numpy.linalg.solve(A, B[:,i]) ## solve Ax = B; x is one row of the desired transformation matrix return matrix def clip_scalar(val, vmin, vmax): """ convenience function to avoid using np.clip for scalar values """ return vmin if val < vmin else vmax if val > vmax else val def clip_array(arr, vmin, vmax, out=None): # replacement for np.clip due to regression in # performance since numpy 1.17 # https://github.com/numpy/numpy/issues/14281 if vmin is None and vmax is None: # let np.clip handle the error return np.clip(arr, vmin, vmax, out=out) if vmin is None: return np.core.umath.minimum(arr, vmax, out=out) elif vmax is None: return np.core.umath.maximum(arr, vmin, out=out) else: return np.core.umath.clip(arr, vmin, vmax, out=out) if tuple(map(int, np.__version__.split(".")[:2])) >= (1, 25): # The linked issue above has been closed as of 2023/04/25 # and states that the issue has been fixed. # And furthermore, because NumPy 2.0 has made np.core private, # we will just use the native np.clip clip_array = np.clip def _rescaleData_nditer(data_in, scale, offset, work_dtype, out_dtype, clip): """Refer to documentation for rescaleData()""" data_out = np.empty_like(data_in, dtype=out_dtype) # integer clip operations are faster than float clip operations # so test to see if we can perform integer clipping fits_int32 = False if data_in.dtype.kind in 'ui' and out_dtype.kind in 'ui': # estimate whether data range after rescale will fit within an int32. # this means that the input dtype should be an 8-bit or 16-bit integer type. # casting to an int32 will lose the fractional part, therefore the # output dtype must be an integer kind. lim_in = np.iinfo(data_in.dtype) # convert numpy scalar to python scalar to avoid overflow warnings lo = offset.item(0) if isinstance(offset, np.number) else offset dst_bounds = scale * (lim_in.min - lo), scale * (lim_in.max - lo) if dst_bounds[1] < dst_bounds[0]: dst_bounds = dst_bounds[1], dst_bounds[0] lim32 = np.iinfo(np.int32) fits_int32 = lim32.min < dst_bounds[0] and dst_bounds[1] < lim32.max if fits_int32 and clip is not None: # this is for NumPy >= 2.0 # the clip limits should fit within the (integer) dtype # of the data to be clipped clip = [clip_scalar(v, lim32.min, lim32.max) for v in clip] it = np.nditer([data_in, data_out], flags=['external_loop', 'buffered'], op_flags=[['readonly'], ['writeonly', 'no_broadcast']], op_dtypes=[None, work_dtype], casting='unsafe', buffersize=32768) with it: for x, y in it: y[...] = x y -= offset y *= scale # Clip before converting dtype to avoid overflow if clip is not None: if fits_int32: # converts to int32, clips back to float32 yin = y.astype(np.int32) else: yin = y clip_array(yin, clip[0], clip[1], out=y) return data_out def rescaleData(data, scale, offset, dtype=None, clip=None): """Return data rescaled and optionally cast to a new dtype. The scaling operation is:: data => (data-offset) * scale """ if dtype is None: out_dtype = data.dtype else: out_dtype = np.dtype(dtype) if out_dtype.kind in 'ui': lim = np.iinfo(out_dtype) if clip is None: # don't let rescale cause integer overflow clip = lim.min, lim.max clip = max(clip[0], lim.min), min(clip[1], lim.max) # make clip limits integer-valued (no need to cast to int) # this improves performance, especially on Windows clip = [math.trunc(x) for x in clip] if np.can_cast(data, np.float32): work_dtype = np.float32 else: work_dtype = np.float64 cp = getCupy() if cp and cp.get_array_module(data) == cp: # Cupy does not support nditer # https://github.com/cupy/cupy/issues/5021 data_out = data.astype(work_dtype, copy=True) data_out -= offset data_out *= scale # Clip before converting dtype to avoid overflow if clip is not None: clip_array(data_out, clip[0], clip[1], out=data_out) # don't copy if no change in dtype return data_out.astype(out_dtype, copy=False) numba_fn = getNumbaFunctions() if numba_fn and clip is not None: # if we got here by makeARGB(), clip will not be None at this point return numba_fn.rescaleData(data, scale, offset, out_dtype, clip) return _rescaleData_nditer(data, scale, offset, work_dtype, out_dtype, clip) def applyLookupTable(data, lut): """ Uses values in *data* as indexes to select values from *lut*. The returned data has shape data.shape + lut.shape[1:] Note: color gradient lookup tables can be generated using GradientWidget. Parameters ---------- data : np.ndarray lut : np.ndarray Either cupy or numpy arrays are accepted, though this function has only consistently behaved correctly on windows with cuda toolkit version >= 11.1. """ if data.dtype.kind not in ('i', 'u'): data = data.astype(int) cp = getCupy() if cp and cp.get_array_module(data) == cp: # cupy.take only supports "wrap" mode return cp.take(lut, cp.clip(data, 0, lut.shape[0] - 1), axis=0) else: return np.take(lut, data, axis=0, mode='clip') def makeRGBA(*args, **kwds): """Equivalent to makeARGB(..., useRGBA=True)""" kwds['useRGBA'] = True return makeARGB(*args, **kwds) def makeARGB(data, lut=None, levels=None, scale=None, useRGBA=False, maskNans=True, output=None): """ Convert an array of values into an ARGB array suitable for building QImages, OpenGL textures, etc. Returns the ARGB array (unsigned byte) and a boolean indicating whether there is alpha channel data. This is a two stage process: 1) Rescale the data based on the values in the *levels* argument (min, max). 2) Determine the final output by passing the rescaled values through a lookup table. Both stages are optional. ============== ================================================================================== **Arguments:** data numpy array of int/float types. If levels List [min, max]; optionally rescale data before converting through the lookup table. The data is rescaled such that min->0 and max->*scale*:: rescaled = (clip(data, min, max) - min) * (*scale* / (max - min)) It is also possible to use a 2D (N,2) array of values for levels. In this case, it is assumed that each pair of min,max values in the levels array should be applied to a different subset of the input data (for example, the input data may already have RGB values and the levels are used to independently scale each channel). The use of this feature requires that levels.shape[0] == data.shape[-1]. scale The maximum value to which data will be rescaled before being passed through the lookup table (or returned if there is no lookup table). By default this will be set to the length of the lookup table, or 255 if no lookup table is provided. lut Optional lookup table (array with dtype=ubyte). Values in data will be converted to color by indexing directly from lut. The output data shape will be input.shape + lut.shape[1:]. Lookup tables can be built using ColorMap or GradientWidget. useRGBA If True, the data is returned in RGBA order (useful for building OpenGL textures). The default is False, which returns in ARGB order for use with QImage (Note that 'ARGB' is a term used by the Qt documentation; the *actual* order is BGRA). maskNans Enable or disable masking NaNs as transparent. ============== ================================================================================== """ cp = getCupy() xp = cp.get_array_module(data) if cp else np profile = debug.Profiler() if data.ndim not in (2, 3): raise TypeError("data must be 2D or 3D") if data.ndim == 3 and data.shape[2] > 4: raise TypeError("data.shape[2] must be <= 4") if lut is not None and not isinstance(lut, xp.ndarray): lut = xp.array(lut) if levels is None: # automatically decide levels based on data dtype if data.dtype.kind == 'u': levels = xp.array([0, 2**(data.itemsize*8)-1]) elif data.dtype.kind == 'i': s = 2**(data.itemsize*8 - 1) levels = xp.array([-s, s-1]) elif data.dtype.kind == 'b': levels = xp.array([0,1]) else: raise Exception('levels argument is required for float input types') if not isinstance(levels, xp.ndarray): levels = xp.array(levels) levels = levels.astype(xp.float64) if levels.ndim == 1: if levels.shape[0] != 2: raise Exception('levels argument must have length 2') elif levels.ndim == 2: if lut is not None and lut.ndim > 1: raise Exception('Cannot make ARGB data when both levels and lut have ndim > 2') if levels.shape != (data.shape[-1], 2): raise Exception('levels must have shape (data.shape[-1], 2)') else: raise Exception("levels argument must be 1D or 2D (got shape=%s)." % repr(levels.shape)) profile('check inputs') # Decide on maximum scaled value if scale is None: if lut is not None: scale = lut.shape[0] else: scale = 255. # Decide on the dtype we want after scaling if lut is None: dtype = xp.ubyte else: dtype = xp.min_scalar_type(lut.shape[0]-1) # awkward, but fastest numpy native nan evaluation nanMask = None if maskNans and data.dtype.kind == 'f' and xp.isnan(data.min()): nanMask = xp.isnan(data) if data.ndim > 2: nanMask = xp.any(nanMask, axis=-1) # Apply levels if given if levels is not None: if isinstance(levels, xp.ndarray) and levels.ndim == 2: # we are going to rescale each channel independently if levels.shape[0] != data.shape[-1]: raise Exception("When rescaling multi-channel data, there must be the same number of levels as channels (data.shape[-1] == levels.shape[0])") newData = xp.empty(data.shape, dtype=int) for i in range(data.shape[-1]): minVal, maxVal = levels[i] if minVal == maxVal: maxVal = xp.nextafter(maxVal, 2*maxVal) rng = maxVal-minVal rng = 1 if rng == 0 else rng newData[...,i] = rescaleData(data[...,i], scale / rng, minVal, dtype=dtype) data = newData else: # Apply level scaling unless it would have no effect on the data minVal, maxVal = levels if minVal != 0 or maxVal != scale: if minVal == maxVal: maxVal = xp.nextafter(maxVal, 2*maxVal) rng = maxVal-minVal rng = 1 if rng == 0 else rng data = rescaleData(data, scale/rng, minVal, dtype=dtype) profile('apply levels') # apply LUT if given if lut is not None: data = applyLookupTable(data, lut) else: if data.dtype != xp.ubyte: data = xp.clip(data, 0, 255).astype(xp.ubyte) profile('apply lut') # this will be the final image array if output is None: imgData = xp.empty(data.shape[:2]+(4,), dtype=xp.ubyte) else: imgData = output profile('allocate') # decide channel order if useRGBA: dst_order = [0, 1, 2, 3] # R,G,B,A elif sys.byteorder == 'little': dst_order = [2, 1, 0, 3] # B,G,R,A (ARGB32 little endian) else: dst_order = [1, 2, 3, 0] # A,R,G,B (ARGB32 big endian) # copy data into image array fastpath = try_fastpath_argb(xp, data, imgData, useRGBA) if fastpath: pass elif data.ndim == 2: # This is tempting: # imgData[..., :3] = data[..., xp.newaxis] # ..but it turns out this is faster: for i in range(3): imgData[..., dst_order[i]] = data elif data.shape[2] == 1: for i in range(3): imgData[..., dst_order[i]] = data[..., 0] else: for i in range(0, data.shape[2]): imgData[..., dst_order[i]] = data[..., i] profile('reorder channels') # add opaque alpha channel if needed if data.ndim == 3 and data.shape[2] == 4: alpha = True else: alpha = False if not fastpath: # fastpath has already filled it in imgData[..., dst_order[3]] = 255 # apply nan mask through alpha channel if nanMask is not None: alpha = True # Workaround for https://github.com/cupy/cupy/issues/4693, fixed in cupy 10.0.0 if xp == cp and tuple(map(int, cp.__version__.split("."))) < (10, 0): imgData[nanMask, :, dst_order[3]] = 0 else: imgData[nanMask, dst_order[3]] = 0 profile('alpha channel') return imgData, alpha def try_fastpath_argb(xp, ain, aout, useRGBA): # we only optimize for certain cases # return False if we did not handle it can_handle = xp is np and ain.dtype == xp.ubyte and ain.flags['C_CONTIGUOUS'] if not can_handle: return False nrows, ncols = ain.shape[:2] nchans = 1 if ain.ndim == 2 else ain.shape[2] Format = QtGui.QImage.Format if nchans == 1: in_fmt = Format.Format_Grayscale8 elif nchans == 3: in_fmt = Format.Format_RGB888 else: in_fmt = Format.Format_RGBA8888 if useRGBA: out_fmt = Format.Format_RGBA8888 else: out_fmt = Format.Format_ARGB32 if in_fmt == out_fmt: aout[:] = ain return True npixels_chunk = 512*1024 batch = int(npixels_chunk / ncols / nchans) batch = max(1, batch) row_beg = 0 while row_beg < nrows: row_end = min(row_beg + batch, nrows) ain_view = ain[row_beg:row_end, ...] aout_view = aout[row_beg:row_end, ...] qimg = QtGui.QImage(ain_view, ncols, ain_view.shape[0], ain.strides[0], in_fmt) qimg = qimg.convertToFormat(out_fmt) aout_view[:] = imageToArray(qimg, copy=False, transpose=False) row_beg = row_end return True def ndarray_to_qimage(arr, fmt): """ Low level function to encapsulate QImage creation differences between bindings. "arr" is assumed to be C-contiguous. """ # C++ QImage has two kind of constructors # - QImage(const uchar*, ...) # - QImage(uchar*, ...) # If the const constructor is used, subsequently calling any non-const method # will trigger the COW mechanism, i.e. a copy is made under the hood. if QT_LIB.startswith('PyQt'): # PyQt5 -> non-const # PyQt6 >= 6.0.1 -> non-const img_ptr = int(Qt.sip.voidptr(arr)) # or arr.ctypes.data else: # bindings that support ndarray # PyQt5 -> const # PyQt6 >= 6.0.1 -> const # PySide2 -> non-const # PySide6 -> non-const img_ptr = arr h, w = arr.shape[:2] bytesPerLine = arr.strides[0] qimg = QtGui.QImage(img_ptr, w, h, bytesPerLine, fmt) qimg.data = arr return qimg def makeQImage(imgData, alpha=None, copy=True, transpose=True): """ Turn an ARGB array into QImage. By default, the data is copied; changes to the array will not be reflected in the image. The image will be given a 'data' attribute pointing to the array which shares its data to prevent python freeing that memory while the image is in use. ============== =================================================================== **Arguments:** imgData Array of data to convert. Must have shape (height, width), (height, width, 3), or (height, width, 4). If transpose is True, then the first two axes are swapped. The array dtype must be ubyte. For 2D arrays, the value is interpreted as greyscale. For 3D arrays, the order of values in the 3rd axis must be (b, g, r, a). alpha If the input array is 3D and *alpha* is True, the QImage returned will have format ARGB32. If False, the format will be RGB32. By default, _alpha_ is True if array.shape[2] == 4. copy If True, the data is copied before converting to QImage. If False, the new QImage points directly to the data in the array. Note that the array must be contiguous for this to work (see numpy.ascontiguousarray). transpose If True (the default), the array x/y axes are transposed before creating the image. Note that Qt expects the axes to be in (height, width) order whereas pyqtgraph usually prefers the opposite. ============== =================================================================== """ ## create QImage from buffer profile = debug.Profiler() copied = False if imgData.ndim == 2: imgFormat = QtGui.QImage.Format.Format_Grayscale8 elif imgData.ndim == 3: # If we didn't explicitly specify alpha, check the array shape. if alpha is None: alpha = (imgData.shape[2] == 4) if imgData.shape[2] == 3: # need to make alpha channel (even if alpha==False; QImage requires 32 bpp) if copy is True: d2 = np.empty(imgData.shape[:2] + (4,), dtype=imgData.dtype) d2[:,:,:3] = imgData d2[:,:,3] = 255 imgData = d2 copied = True else: raise Exception('Array has only 3 channels; cannot make QImage without copying.') profile("add alpha channel") if alpha: imgFormat = QtGui.QImage.Format.Format_ARGB32 else: imgFormat = QtGui.QImage.Format.Format_RGB32 else: raise TypeError("Image array must have ndim = 2 or 3.") if transpose: imgData = imgData.transpose((1, 0, 2)) # QImage expects row-major order if not imgData.flags['C_CONTIGUOUS']: if copy is False: extra = ' (try setting transpose=False)' if transpose else '' raise Exception('Array is not contiguous; cannot make QImage without copying.'+extra) imgData = np.ascontiguousarray(imgData) copied = True profile("ascontiguousarray") if copy is True and copied is False: imgData = imgData.copy() profile("copy") return ndarray_to_qimage(imgData, imgFormat) def ndarray_from_qimage(qimg): img_ptr = qimg.bits() if img_ptr is None: raise ValueError("Null QImage not supported") h, w = qimg.height(), qimg.width() bpl = qimg.bytesPerLine() depth = qimg.depth() logical_bpl = w * depth // 8 if QT_LIB.startswith('PyQt'): # sizeInBytes() was introduced in Qt 5.10 # however PyQt5 5.12 will fail with: # "TypeError: QImage.sizeInBytes() is a private method" # note that sizeInBytes() works fine with: # PyQt5 5.15, PySide2 5.12, PySide2 5.15 img_ptr.setsize(h * bpl) memory = np.frombuffer(img_ptr, dtype=np.ubyte).reshape((h, bpl)) memory = memory[:, :logical_bpl] if depth in (8, 24, 32): dtype = np.uint8 nchan = depth // 8 elif depth in (16, 64): dtype = np.uint16 nchan = depth // 16 else: raise ValueError("Unsupported Image Type") shape = h, w if nchan != 1: shape = shape + (nchan,) arr = memory.view(dtype).reshape(shape) return arr def imageToArray(img, copy=False, transpose=True): """ Convert a QImage into numpy array. The image must have format RGB32, ARGB32, or ARGB32_Premultiplied. By default, the image is not copied; changes made to the array will appear in the QImage as well (beware: if the QImage is collected before the array, there may be trouble). The array will have shape (width, height, (b,g,r,a)). """ arr = ndarray_from_qimage(img) fmt = img.format() if fmt == img.Format.Format_RGB32: arr[...,3] = 255 if copy: arr = arr.copy() if transpose: return arr.transpose((1,0,2)) else: return arr def colorToAlpha(data, color): """ Given an RGBA image in *data*, convert *color* to be transparent. *data* must be an array (w, h, 3 or 4) of ubyte values and *color* must be an array (3) of ubyte values. This is particularly useful for use with images that have a black or white background. Algorithm is taken from Gimp's color-to-alpha function in plug-ins/common/colortoalpha.c Credit: /* * Color To Alpha plug-in v1.0 by Seth Burgess, sjburges@gimp.org 1999/05/14 * with algorithm by clahey */ """ data = data.astype(float) if data.shape[-1] == 3: ## add alpha channel if needed d2 = np.empty(data.shape[:2]+(4,), dtype=data.dtype) d2[...,:3] = data d2[...,3] = 255 data = d2 color = color.astype(float) alpha = np.zeros(data.shape[:2]+(3,), dtype=float) output = data.copy() for i in [0,1,2]: d = data[...,i] c = color[i] mask = d > c alpha[...,i][mask] = (d[mask] - c) / (255. - c) imask = d < c alpha[...,i][imask] = (c - d[imask]) / c output[...,3] = alpha.max(axis=2) * 255. mask = output[...,3] >= 1.0 ## avoid zero division while processing alpha channel correction = 255. / output[...,3][mask] ## increase value to compensate for decreased alpha for i in [0,1,2]: output[...,i][mask] = ((output[...,i][mask]-color[i]) * correction) + color[i] output[...,3][mask] *= data[...,3][mask] / 255. ## combine computed and previous alpha values #raise Exception() return np.clip(output, 0, 255).astype(np.ubyte) def gaussianFilter(data, sigma): """ Drop-in replacement for scipy.ndimage.gaussian_filter. (note: results are only approximately equal to the output of gaussian_filter) """ cp = getCupy() xp = cp.get_array_module(data) if cp else np if xp.isscalar(sigma): sigma = (sigma,) * data.ndim baseline = data.mean() filtered = data - baseline for ax in range(data.ndim): s = sigma[ax] if s == 0: continue # generate 1D gaussian kernel ksize = int(s * 6) x = xp.arange(-ksize, ksize) kernel = xp.exp(-x**2 / (2*s**2)) kshape = [1,] * data.ndim kshape[ax] = len(kernel) kernel = kernel.reshape(kshape) # convolve as product of FFTs shape = data.shape[ax] + ksize scale = 1.0 / (abs(s) * (2*xp.pi)**0.5) filtered = scale * xp.fft.irfft(xp.fft.rfft(filtered, shape, axis=ax) * xp.fft.rfft(kernel, shape, axis=ax), axis=ax) # clip off extra data sl = [slice(None)] * data.ndim sl[ax] = slice(filtered.shape[ax]-data.shape[ax],None,None) filtered = filtered[tuple(sl)] return filtered + baseline def downsample(data, n, axis=0, xvals='subsample'): """Downsample by averaging points together across axis. If multiple axes are specified, runs once per axis. If a metaArray is given, then the axis values can be either subsampled or downsampled to match. """ ma = None if (hasattr(data, 'implements') and data.implements('MetaArray')): ma = data data = data.view(np.ndarray) if hasattr(axis, '__len__'): if not hasattr(n, '__len__'): n = [n]*len(axis) for i in range(len(axis)): data = downsample(data, n[i], axis[i]) return data if n <= 1: return data nPts = int(data.shape[axis] / n) s = list(data.shape) s[axis] = nPts s.insert(axis+1, n) sl = [slice(None)] * data.ndim sl[axis] = slice(0, nPts*n) d1 = data[tuple(sl)] #print d1.shape, s d1.shape = tuple(s) d2 = d1.mean(axis+1) if ma is None: return d2 else: info = ma.infoCopy() if 'values' in info[axis]: if xvals == 'subsample': info[axis]['values'] = info[axis]['values'][::n][:nPts] elif xvals == 'downsample': info[axis]['values'] = downsample(info[axis]['values'], n) return MetaArray(d2, info=info) def _compute_backfill_indices(isfinite): # the presence of inf/nans result in an empty QPainterPath being generated # this behavior started in Qt 5.12.3 and was introduced in this commit # https://github.com/qt/qtbase/commit/c04bd30de072793faee5166cff866a4c4e0a9dd7 # We therefore replace non-finite values # credit: Divakar https://stackoverflow.com/a/41191127/643629 mask = ~isfinite idx = np.arange(len(isfinite)) idx[mask] = -1 np.maximum.accumulate(idx, out=idx) first = np.searchsorted(idx, 0) if first < len(isfinite): # Replace all non-finite entries from beginning of arr with the first finite one idx[:first] = first return idx else: return None def _arrayToQPath_all(x, y, finiteCheck): n = x.shape[0] if n == 0: return QtGui.QPainterPath() finite_idx = None if finiteCheck: isfinite = np.isfinite(x) & np.isfinite(y) if not isfinite.all(): finite_idx = isfinite.nonzero()[0] n = len(finite_idx) if n < 2: return QtGui.QPainterPath() chunksize = 10000 numchunks = (n + chunksize - 1) // chunksize minchunks = 3 if numchunks < minchunks: # too few chunks, batching would be a pessimization poly = create_qpolygonf(n) arr = ndarray_from_qpolygonf(poly) if finite_idx is None: arr[:, 0] = x arr[:, 1] = y else: arr[:, 0] = x[finite_idx] arr[:, 1] = y[finite_idx] path = QtGui.QPainterPath() if hasattr(path, 'reserve'): # Qt 5.13 path.reserve(n) path.addPolygon(poly) return path # at this point, we have numchunks >= minchunks path = QtGui.QPainterPath() if hasattr(path, 'reserve'): # Qt 5.13 path.reserve(n) subpoly = QtGui.QPolygonF() subpath = None for idx in range(numchunks): sl = slice(idx*chunksize, min((idx+1)*chunksize, n)) currsize = sl.stop - sl.start if currsize != subpoly.size(): if hasattr(subpoly, 'resize'): subpoly.resize(currsize) else: subpoly.fill(QtCore.QPointF(), currsize) subarr = ndarray_from_qpolygonf(subpoly) if finite_idx is None: subarr[:, 0] = x[sl] subarr[:, 1] = y[sl] else: fiv = finite_idx[sl] # view subarr[:, 0] = x[fiv] subarr[:, 1] = y[fiv] if subpath is None: subpath = QtGui.QPainterPath() subpath.addPolygon(subpoly) path.connectPath(subpath) if hasattr(subpath, 'clear'): # Qt 5.13 subpath.clear() else: subpath = None return path def _arrayToQPath_finite(x, y, isfinite=None): n = x.shape[0] if n == 0: return QtGui.QPainterPath() if isfinite is None: isfinite = np.isfinite(x) & np.isfinite(y) path = QtGui.QPainterPath() if hasattr(path, 'reserve'): # Qt 5.13 path.reserve(n) sidx = np.nonzero(~isfinite)[0] + 1 # note: the chunks are views xchunks = np.split(x, sidx) ychunks = np.split(y, sidx) chunks = list(zip(xchunks, ychunks)) # create a single polygon able to hold the largest chunk maxlen = max(len(chunk) for chunk in xchunks) subpoly = create_qpolygonf(maxlen) subarr = ndarray_from_qpolygonf(subpoly) # resize and fill do not change the capacity if hasattr(subpoly, 'resize'): subpoly_resize = subpoly.resize else: # PyQt will be less efficient subpoly_resize = lambda n, v=QtCore.QPointF() : subpoly.fill(v, n) # notes: # - we backfill the non-finite in order to get the same image as the # old codepath on the CI. somehow P1--P2 gets rendered differently # from P1--P2--P2 # - we do not generate MoveTo(s) that are not followed by a LineTo, # thus the QPainterPath can be different from the old codepath's # all chunks except the last chunk have a trailing non-finite for xchunk, ychunk in chunks[:-1]: lc = len(xchunk) if lc <= 1: # len 1 means we have a string of non-finite continue subpoly_resize(lc) subarr[:lc, 0] = xchunk subarr[:lc, 1] = ychunk subarr[lc-1] = subarr[lc-2] # fill non-finite with its neighbour path.addPolygon(subpoly) # handle last chunk, which is either all-finite or empty for xchunk, ychunk in chunks[-1:]: lc = len(xchunk) if lc <= 1: # can't draw a line with just 1 point continue subpoly_resize(lc) subarr[:lc, 0] = xchunk subarr[:lc, 1] = ychunk path.addPolygon(subpoly) return path def arrayToQPath(x, y, connect='all', finiteCheck=True): """ Convert an array of x,y coordinates to QPainterPath as efficiently as possible. The *connect* argument may be 'all', indicating that each point should be connected to the next; 'pairs', indicating that each pair of points should be connected, or an array of int32 values (0 or 1) indicating connections. Parameters ---------- x : np.ndarray x-values to be plotted of shape (N,) y : np.ndarray y-values to be plotted, must be same length as `x` of shape (N,) connect : {'all', 'pairs', 'finite', (N,) ndarray}, optional Argument detailing how to connect the points in the path. `all` will have sequential points being connected. `pairs` generates lines between every other point. `finite` only connects points that are finite. If an ndarray is passed, containing int32 values of 0 or 1, only values with 1 will connect to the previous point. Def finiteCheck : bool, default True When false, the check for finite values will be skipped, which can improve performance. If nonfinite values are present in `x` or `y`, an empty QPainterPath will be generated. Returns ------- QPainterPath QPainterPath object to be drawn Raises ------ ValueError Raised when the connect argument has an invalid value placed within. Notes ----- A QPainterPath is generated through one of two ways. When the connect parameter is 'all', a QPolygonF object is created, and ``QPainterPath.addPolygon()`` is called. For other connect parameters a ``QDataStream`` object is created and the QDataStream >> QPainterPath operator is used to pass the data. The memory format is as follows numVerts(i4) 0(i4) x(f8) y(f8) <-- 0 means this vertex does not connect 1(i4) x(f8) y(f8) <-- 1 means this vertex connects to the previous vertex ... cStart(i4) fillRule(i4) see: https://github.com/qt/qtbase/blob/dev/src/gui/painting/qpainterpath.cpp All values are big endian--pack using struct.pack('>d') or struct.pack('>i') This binary format may change in future versions of Qt """ n = x.shape[0] if n == 0: return QtGui.QPainterPath() connect_array = None if isinstance(connect, np.ndarray): # make connect argument contain only str type connect_array, connect = connect, 'array' isfinite = None if connect == 'finite': if not finiteCheck: # if user specified to skip finite check, then we skip the heuristic return _arrayToQPath_finite(x, y) # otherwise use a heuristic # if non-finite aren't that many, then use_qpolyponf isfinite = np.isfinite(x) & np.isfinite(y) nonfinite_cnt = n - np.sum(isfinite) all_isfinite = nonfinite_cnt == 0 if all_isfinite: # delegate to connect='all' connect = 'all' finiteCheck = False elif nonfinite_cnt / n < 2 / 100: return _arrayToQPath_finite(x, y, isfinite) else: # delegate to connect=ndarray # finiteCheck=True, all_isfinite=False connect = 'array' connect_array = isfinite if connect == 'all': return _arrayToQPath_all(x, y, finiteCheck) path = QtGui.QPainterPath() if hasattr(path, 'reserve'): # Qt 5.13 path.reserve(n) if hasattr(path, 'reserve') and getConfigOption('enableExperimental'): backstore = None arr = Qt.internals.get_qpainterpath_element_array(path, n) else: backstore = QtCore.QByteArray() backstore.resize(4 + n*20 + 8) # contents uninitialized backstore.replace(0, 4, struct.pack('>i', n)) # cStart, fillRule (Qt.FillRule.OddEvenFill) backstore.replace(4+n*20, 8, struct.pack('>ii', 0, 0)) arr = np.frombuffer(backstore, dtype=[('c', '>i4'), ('x', '>f8'), ('y', '>f8')], count=n, offset=4) backfill_idx = None if finiteCheck: if isfinite is None: isfinite = np.isfinite(x) & np.isfinite(y) all_isfinite = np.all(isfinite) if not all_isfinite: backfill_idx = _compute_backfill_indices(isfinite) if backfill_idx is None: arr['x'] = x arr['y'] = y else: arr['x'] = x[backfill_idx] arr['y'] = y[backfill_idx] # decide which points are connected by lines if connect == 'pairs': arr['c'][0::2] = 0 arr['c'][1::2] = 1 # connect every 2nd point to every 1st one elif connect == 'array': # Let's call a point with either x or y being nan is an invalid point. # A point will anyway not connect to an invalid point regardless of the # 'c' value of the invalid point. Therefore, we should set 'c' to 0 for # the next point of an invalid point. arr['c'][:1] = 0 # the first vertex has no previous vertex to connect arr['c'][1:] = connect_array[:-1] else: raise ValueError('connect argument must be "all", "pairs", "finite", or array') if isinstance(backstore, QtCore.QByteArray): ds = QtCore.QDataStream(backstore) ds >> path return path def ndarray_from_qpolygonf(polyline): # polyline.data() will be None if the pointer was null. # voidptr(None) is the same as voidptr(0). vp = Qt.compat.voidptr(polyline.data(), len(polyline)*2*8, True) return np.frombuffer(vp, dtype=np.float64).reshape((-1, 2)) def create_qpolygonf(size): polyline = QtGui.QPolygonF() if hasattr(polyline, 'resize'): # (PySide) and (PyQt6 >= 6.3.1) polyline.resize(size) else: polyline.fill(QtCore.QPointF(), size) return polyline def arrayToQPolygonF(x, y): """ Utility function to convert two 1D-NumPy arrays representing curve data (X-axis, Y-axis data) into a single open polygon (QtGui.PolygonF) object. Thanks to PythonQwt for making this code available License/copyright: MIT License © Pierre Raybaut 2020. Parameters ---------- x : np.array x-axis coordinates for data to be plotted, must have have ndim of 1 y : np.array y-axis coordinates for data to be plotted, must have ndim of 1 and be the same length as x Returns ------- QPolygonF Open QPolygonF object that represents the path looking to be plotted Raises ------ ValueError When xdata or ydata does not meet the required criteria """ if not ( x.size == y.size == x.shape[0] == y.shape[0] ): raise ValueError("Arguments must be 1D and the same size") size = x.size polyline = create_qpolygonf(size) memory = ndarray_from_qpolygonf(polyline) memory[:, 0] = x memory[:, 1] = y return polyline #def isosurface(data, level): #""" #Generate isosurface from volumetric data using marching tetrahedra algorithm. #See Paul Bourke, "Polygonising a Scalar Field Using Tetrahedrons" (http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/) #*data* 3D numpy array of scalar values #*level* The level at which to generate an isosurface #""" #facets = [] ### mark everything below the isosurface level #mask = data < level #### make eight sub-fields #fields = np.empty((2,2,2), dtype=object) #slices = [slice(0,-1), slice(1,None)] #for i in [0,1]: #for j in [0,1]: #for k in [0,1]: #fields[i,j,k] = mask[slices[i], slices[j], slices[k]] ### split each cell into 6 tetrahedra ### these all have the same 'orienation'; points 1,2,3 circle ### clockwise around point 0 #tetrahedra = [ #[(0,1,0), (1,1,1), (0,1,1), (1,0,1)], #[(0,1,0), (0,1,1), (0,0,1), (1,0,1)], #[(0,1,0), (0,0,1), (0,0,0), (1,0,1)], #[(0,1,0), (0,0,0), (1,0,0), (1,0,1)], #[(0,1,0), (1,0,0), (1,1,0), (1,0,1)], #[(0,1,0), (1,1,0), (1,1,1), (1,0,1)] #] ### each tetrahedron will be assigned an index ### which determines how to generate its facets. ### this structure is: ### facets[index][facet1, facet2, ...] ### where each facet is triangular and its points are each ### interpolated between two points on the tetrahedron ### facet = [(p1a, p1b), (p2a, p2b), (p3a, p3b)] ### facet points always circle clockwise if you are looking ### at them from below the isosurface. #indexFacets = [ #[], ## all above #[[(0,1), (0,2), (0,3)]], # 0 below #[[(1,0), (1,3), (1,2)]], # 1 below #[[(0,2), (1,3), (1,2)], [(0,2), (0,3), (1,3)]], # 0,1 below #[[(2,0), (2,1), (2,3)]], # 2 below #[[(0,3), (1,2), (2,3)], [(0,3), (0,1), (1,2)]], # 0,2 below #[[(1,0), (2,3), (2,0)], [(1,0), (1,3), (2,3)]], # 1,2 below #[[(3,0), (3,1), (3,2)]], # 3 above #[[(3,0), (3,2), (3,1)]], # 3 below #[[(1,0), (2,0), (2,3)], [(1,0), (2,3), (1,3)]], # 0,3 below #[[(0,3), (2,3), (1,2)], [(0,3), (1,2), (0,1)]], # 1,3 below #[[(2,0), (2,3), (2,1)]], # 0,1,3 below #[[(0,2), (1,2), (1,3)], [(0,2), (1,3), (0,3)]], # 2,3 below #[[(1,0), (1,2), (1,3)]], # 0,2,3 below #[[(0,1), (0,3), (0,2)]], # 1,2,3 below #[] ## all below #] #for tet in tetrahedra: ### get the 4 fields for this tetrahedron #tetFields = [fields[c] for c in tet] ### generate an index for each grid cell #index = tetFields[0] + tetFields[1]*2 + tetFields[2]*4 + tetFields[3]*8 ### add facets #for i in range(index.shape[0]): # data x-axis #for j in range(index.shape[1]): # data y-axis #for k in range(index.shape[2]): # data z-axis #for f in indexFacets[index[i,j,k]]: # faces to generate for this tet #pts = [] #for l in [0,1,2]: # points in this face #p1 = tet[f[l][0]] # tet corner 1 #p2 = tet[f[l][1]] # tet corner 2 #pts.append([(p1[x]+p2[x])*0.5+[i,j,k][x]+0.5 for x in [0,1,2]]) ## interpolate between tet corners #facets.append(pts) #return facets def isocurve(data, level, connected=False, extendToEdge=False, path=False): """ Generate isocurve from 2D data using marching squares algorithm. ============== ========================================================= **Arguments:** data 2D numpy array of scalar values level The level at which to generate an isosurface connected If False, return a single long list of point pairs If True, return multiple long lists of connected point locations. (This is slower but better for drawing continuous lines) extendToEdge If True, extend the curves to reach the exact edges of the data. path if True, return a QPainterPath rather than a list of vertex coordinates. This forces connected=True. ============== ========================================================= This function is SLOW; plenty of room for optimization here. """ if path is True: connected = True if extendToEdge: d2 = np.empty((data.shape[0]+2, data.shape[1]+2), dtype=data.dtype) d2[1:-1, 1:-1] = data d2[0, 1:-1] = data[0] d2[-1, 1:-1] = data[-1] d2[1:-1, 0] = data[:, 0] d2[1:-1, -1] = data[:, -1] d2[0,0] = d2[0,1] d2[0,-1] = d2[1,-1] d2[-1,0] = d2[-1,1] d2[-1,-1] = d2[-1,-2] data = d2 sideTable = [ [], [0,1], [1,2], [0,2], [0,3], [1,3], [0,1,2,3], [2,3], [2,3], [0,1,2,3], [1,3], [0,3], [0,2], [1,2], [0,1], [] ] edgeKey=[ [(0,1), (0,0)], [(0,0), (1,0)], [(1,0), (1,1)], [(1,1), (0,1)] ] lines = [] ## mark everything below the isosurface level mask = data < level ### make four sub-fields and compute indexes for grid cells index = np.zeros([x-1 for x in data.shape], dtype=np.ubyte) fields = np.empty((2,2), dtype=object) slices = [slice(0,-1), slice(1,None)] for i in [0,1]: for j in [0,1]: fields[i,j] = mask[slices[i], slices[j]] #vertIndex = i - 2*j*i + 3*j + 4*k ## this is just to match Bourk's vertex numbering scheme vertIndex = i+2*j #print i,j,k," : ", fields[i,j,k], 2**vertIndex np.add(index, fields[i,j] * 2**vertIndex, out=index, casting='unsafe') #print index #print index ## add lines for i in range(index.shape[0]): # data x-axis for j in range(index.shape[1]): # data y-axis sides = sideTable[index[i,j]] for l in range(0, len(sides), 2): ## faces for this grid cell edges = sides[l:l+2] pts = [] for m in [0,1]: # points in this face p1 = edgeKey[edges[m]][0] # p1, p2 are points at either side of an edge p2 = edgeKey[edges[m]][1] v1 = data[i+p1[0], j+p1[1]] # v1 and v2 are the values at p1 and p2 v2 = data[i+p2[0], j+p2[1]] f = (level-v1) / (v2-v1) fi = 1.0 - f p = ( ## interpolate between corners p1[0]*fi + p2[0]*f + i + 0.5, p1[1]*fi + p2[1]*f + j + 0.5 ) if extendToEdge: ## check bounds p = ( min(data.shape[0]-2, max(0, p[0]-1)), min(data.shape[1]-2, max(0, p[1]-1)), ) if connected: gridKey = i + (1 if edges[m]==2 else 0), j + (1 if edges[m]==3 else 0), edges[m]%2 pts.append((p, gridKey)) ## give the actual position and a key identifying the grid location (for connecting segments) else: pts.append(p) lines.append(pts) if not connected: return lines ## turn disjoint list of segments into continuous lines #lines = [[2,5], [5,4], [3,4], [1,3], [6,7], [7,8], [8,6], [11,12], [12,15], [11,13], [13,14]] #lines = [[(float(a), a), (float(b), b)] for a,b in lines] points = {} ## maps each point to its connections for a,b in lines: if a[1] not in points: points[a[1]] = [] points[a[1]].append([a,b]) if b[1] not in points: points[b[1]] = [] points[b[1]].append([b,a]) ## rearrange into chains for k in list(points.keys()): try: chains = points[k] except KeyError: ## already used this point elsewhere continue #print "===========", k for chain in chains: #print " chain:", chain x = None while True: if x == chain[-1][1]: break ## nothing left to do on this chain x = chain[-1][1] if x == k: break ## chain has looped; we're done and can ignore the opposite chain y = chain[-2][1] connects = points[x] for conn in connects[:]: if conn[1][1] != y: #print " ext:", conn chain.extend(conn[1:]) #print " del:", x del points[x] if chain[0][1] == chain[-1][1]: # looped chain; no need to continue the other direction chains.pop() break ## extract point locations lines = [] for chain in points.values(): if len(chain) == 2: chain = chain[1][1:][::-1] + chain[0] # join together ends of chain else: chain = chain[0] lines.append([p[0] for p in chain]) if not path: return lines ## a list of pairs of points path = QtGui.QPainterPath() for line in lines: path.moveTo(*line[0]) for p in line[1:]: path.lineTo(*p) return path def traceImage(image, values, smooth=0.5): """ Convert an image to a set of QPainterPath curves. One curve will be generated for each item in *values*; each curve outlines the area of the image that is closer to its value than to any others. If image is RGB or RGBA, then the shape of values should be (nvals, 3/4) The parameter *smooth* is expressed in pixels. """ if values.ndim == 2: values = values.T values = values[np.newaxis, np.newaxis, ...].astype(float) image = image[..., np.newaxis].astype(float) diff = np.abs(image-values) if values.ndim == 4: diff = diff.sum(axis=2) labels = np.argmin(diff, axis=2) paths = [] for i in range(diff.shape[-1]): d = (labels==i).astype(float) d = gaussianFilter(d, (smooth, smooth)) lines = isocurve(d, 0.5, connected=True, extendToEdge=True) path = QtGui.QPainterPath() for line in lines: path.moveTo(*line[0]) for p in line[1:]: path.lineTo(*p) paths.append(path) return paths IsosurfaceDataCache = None def isosurface(data, level): """ Generate isosurface from volumetric data using marching cubes algorithm. See Paul Bourke, "Polygonising a Scalar Field" (http://paulbourke.net/geometry/polygonise/) *data* 3D numpy array of scalar values. Must be contiguous. *level* The level at which to generate an isosurface Returns an array of vertex coordinates (Nv, 3) and an array of per-face vertex indexes (Nf, 3) """ ## For improvement, see: ## ## Efficient implementation of Marching Cubes' cases with topological guarantees. ## Thomas Lewiner, Helio Lopes, Antonio Wilson Vieira and Geovan Tavares. ## Journal of Graphics Tools 8(2): pp. 1-15 (december 2003) ## Precompute lookup tables on the first run global IsosurfaceDataCache if IsosurfaceDataCache is None: ## map from grid cell index to edge index. ## grid cell index tells us which corners are below the isosurface, ## edge index tells us which edges are cut by the isosurface. ## (Data stolen from Bourk; see above.) edgeTable = np.array([ 0x0 , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c, 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c, 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc, 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c, 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc , 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460, 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0, 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230, 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190, 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 ], dtype=np.uint16) ## Table of triangles to use for filling each grid cell. ## Each set of three integers tells us which three edges to ## draw a triangle between. ## (Data stolen from Bourk; see above.) triTable = [ [], [0, 8, 3], [0, 1, 9], [1, 8, 3, 9, 8, 1], [1, 2, 10], [0, 8, 3, 1, 2, 10], [9, 2, 10, 0, 2, 9], [2, 8, 3, 2, 10, 8, 10, 9, 8], [3, 11, 2], [0, 11, 2, 8, 11, 0], [1, 9, 0, 2, 3, 11], [1, 11, 2, 1, 9, 11, 9, 8, 11], [3, 10, 1, 11, 10, 3], [0, 10, 1, 0, 8, 10, 8, 11, 10], [3, 9, 0, 3, 11, 9, 11, 10, 9], [9, 8, 10, 10, 8, 11], [4, 7, 8], [4, 3, 0, 7, 3, 4], [0, 1, 9, 8, 4, 7], [4, 1, 9, 4, 7, 1, 7, 3, 1], [1, 2, 10, 8, 4, 7], [3, 4, 7, 3, 0, 4, 1, 2, 10], [9, 2, 10, 9, 0, 2, 8, 4, 7], [2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4], [8, 4, 7, 3, 11, 2], [11, 4, 7, 11, 2, 4, 2, 0, 4], [9, 0, 1, 8, 4, 7, 2, 3, 11], [4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1], [3, 10, 1, 3, 11, 10, 7, 8, 4], [1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4], [4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3], [4, 7, 11, 4, 11, 9, 9, 11, 10], [9, 5, 4], [9, 5, 4, 0, 8, 3], [0, 5, 4, 1, 5, 0], [8, 5, 4, 8, 3, 5, 3, 1, 5], [1, 2, 10, 9, 5, 4], [3, 0, 8, 1, 2, 10, 4, 9, 5], [5, 2, 10, 5, 4, 2, 4, 0, 2], [2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8], [9, 5, 4, 2, 3, 11], [0, 11, 2, 0, 8, 11, 4, 9, 5], [0, 5, 4, 0, 1, 5, 2, 3, 11], [2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5], [10, 3, 11, 10, 1, 3, 9, 5, 4], [4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10], [5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3], [5, 4, 8, 5, 8, 10, 10, 8, 11], [9, 7, 8, 5, 7, 9], [9, 3, 0, 9, 5, 3, 5, 7, 3], [0, 7, 8, 0, 1, 7, 1, 5, 7], [1, 5, 3, 3, 5, 7], [9, 7, 8, 9, 5, 7, 10, 1, 2], [10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3], [8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2], [2, 10, 5, 2, 5, 3, 3, 5, 7], [7, 9, 5, 7, 8, 9, 3, 11, 2], [9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11], [2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7], [11, 2, 1, 11, 1, 7, 7, 1, 5], [9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11], [5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0], [11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0], [11, 10, 5, 7, 11, 5], [10, 6, 5], [0, 8, 3, 5, 10, 6], [9, 0, 1, 5, 10, 6], [1, 8, 3, 1, 9, 8, 5, 10, 6], [1, 6, 5, 2, 6, 1], [1, 6, 5, 1, 2, 6, 3, 0, 8], [9, 6, 5, 9, 0, 6, 0, 2, 6], [5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8], [2, 3, 11, 10, 6, 5], [11, 0, 8, 11, 2, 0, 10, 6, 5], [0, 1, 9, 2, 3, 11, 5, 10, 6], [5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11], [6, 3, 11, 6, 5, 3, 5, 1, 3], [0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6], [3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9], [6, 5, 9, 6, 9, 11, 11, 9, 8], [5, 10, 6, 4, 7, 8], [4, 3, 0, 4, 7, 3, 6, 5, 10], [1, 9, 0, 5, 10, 6, 8, 4, 7], [10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4], [6, 1, 2, 6, 5, 1, 4, 7, 8], [1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7], [8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6], [7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9], [3, 11, 2, 7, 8, 4, 10, 6, 5], [5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11], [0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6], [9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6], [8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6], [5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11], [0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7], [6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9], [10, 4, 9, 6, 4, 10], [4, 10, 6, 4, 9, 10, 0, 8, 3], [10, 0, 1, 10, 6, 0, 6, 4, 0], [8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10], [1, 4, 9, 1, 2, 4, 2, 6, 4], [3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4], [0, 2, 4, 4, 2, 6], [8, 3, 2, 8, 2, 4, 4, 2, 6], [10, 4, 9, 10, 6, 4, 11, 2, 3], [0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6], [3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10], [6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1], [9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3], [8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1], [3, 11, 6, 3, 6, 0, 0, 6, 4], [6, 4, 8, 11, 6, 8], [7, 10, 6, 7, 8, 10, 8, 9, 10], [0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10], [10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0], [10, 6, 7, 10, 7, 1, 1, 7, 3], [1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7], [2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9], [7, 8, 0, 7, 0, 6, 6, 0, 2], [7, 3, 2, 6, 7, 2], [2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7], [2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7], [1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11], [11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1], [8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6], [0, 9, 1, 11, 6, 7], [7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0], [7, 11, 6], [7, 6, 11], [3, 0, 8, 11, 7, 6], [0, 1, 9, 11, 7, 6], [8, 1, 9, 8, 3, 1, 11, 7, 6], [10, 1, 2, 6, 11, 7], [1, 2, 10, 3, 0, 8, 6, 11, 7], [2, 9, 0, 2, 10, 9, 6, 11, 7], [6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8], [7, 2, 3, 6, 2, 7], [7, 0, 8, 7, 6, 0, 6, 2, 0], [2, 7, 6, 2, 3, 7, 0, 1, 9], [1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6], [10, 7, 6, 10, 1, 7, 1, 3, 7], [10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8], [0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7], [7, 6, 10, 7, 10, 8, 8, 10, 9], [6, 8, 4, 11, 8, 6], [3, 6, 11, 3, 0, 6, 0, 4, 6], [8, 6, 11, 8, 4, 6, 9, 0, 1], [9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6], [6, 8, 4, 6, 11, 8, 2, 10, 1], [1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6], [4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9], [10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3], [8, 2, 3, 8, 4, 2, 4, 6, 2], [0, 4, 2, 4, 6, 2], [1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8], [1, 9, 4, 1, 4, 2, 2, 4, 6], [8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1], [10, 1, 0, 10, 0, 6, 6, 0, 4], [4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3], [10, 9, 4, 6, 10, 4], [4, 9, 5, 7, 6, 11], [0, 8, 3, 4, 9, 5, 11, 7, 6], [5, 0, 1, 5, 4, 0, 7, 6, 11], [11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5], [9, 5, 4, 10, 1, 2, 7, 6, 11], [6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5], [7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2], [3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6], [7, 2, 3, 7, 6, 2, 5, 4, 9], [9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7], [3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0], [6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8], [9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7], [1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4], [4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10], [7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10], [6, 9, 5, 6, 11, 9, 11, 8, 9], [3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5], [0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11], [6, 11, 3, 6, 3, 5, 5, 3, 1], [1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6], [0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10], [11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5], [6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3], [5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2], [9, 5, 6, 9, 6, 0, 0, 6, 2], [1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8], [1, 5, 6, 2, 1, 6], [1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6], [10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0], [0, 3, 8, 5, 6, 10], [10, 5, 6], [11, 5, 10, 7, 5, 11], [11, 5, 10, 11, 7, 5, 8, 3, 0], [5, 11, 7, 5, 10, 11, 1, 9, 0], [10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1], [11, 1, 2, 11, 7, 1, 7, 5, 1], [0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11], [9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7], [7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2], [2, 5, 10, 2, 3, 5, 3, 7, 5], [8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5], [9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2], [9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2], [1, 3, 5, 3, 7, 5], [0, 8, 7, 0, 7, 1, 1, 7, 5], [9, 0, 3, 9, 3, 5, 5, 3, 7], [9, 8, 7, 5, 9, 7], [5, 8, 4, 5, 10, 8, 10, 11, 8], [5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0], [0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5], [10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4], [2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8], [0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11], [0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5], [9, 4, 5, 2, 11, 3], [2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4], [5, 10, 2, 5, 2, 4, 4, 2, 0], [3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9], [5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2], [8, 4, 5, 8, 5, 3, 3, 5, 1], [0, 4, 5, 1, 0, 5], [8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5], [9, 4, 5], [4, 11, 7, 4, 9, 11, 9, 10, 11], [0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11], [1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11], [3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4], [4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2], [9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3], [11, 7, 4, 11, 4, 2, 2, 4, 0], [11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4], [2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9], [9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7], [3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10], [1, 10, 2, 8, 7, 4], [4, 9, 1, 4, 1, 7, 7, 1, 3], [4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1], [4, 0, 3, 7, 4, 3], [4, 8, 7], [9, 10, 8, 10, 11, 8], [3, 0, 9, 3, 9, 11, 11, 9, 10], [0, 1, 10, 0, 10, 8, 8, 10, 11], [3, 1, 10, 11, 3, 10], [1, 2, 11, 1, 11, 9, 9, 11, 8], [3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9], [0, 2, 11, 8, 0, 11], [3, 2, 11], [2, 3, 8, 2, 8, 10, 10, 8, 9], [9, 10, 2, 0, 9, 2], [2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8], [1, 10, 2], [1, 3, 8, 9, 1, 8], [0, 9, 1], [0, 3, 8], [] ] edgeShifts = np.array([ ## maps edge ID (0-11) to (x,y,z) cell offset and edge ID (0-2) [0, 0, 0, 0], [1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 1, 0], [0, 0, 1, 1], [0, 0, 0, 2], [1, 0, 0, 2], [1, 1, 0, 2], [0, 1, 0, 2], #[9, 9, 9, 9] ## fake ], dtype=np.uint16) # don't use ubyte here! This value gets added to cell index later; will need the extra precision. nTableFaces = np.array([len(f)/3 for f in triTable], dtype=np.ubyte) faceShiftTables = [None] for i in range(1,6): ## compute lookup table of index: vertexes mapping faceTableI = np.zeros((len(triTable), i*3), dtype=np.ubyte) faceTableInds = np.argwhere(nTableFaces == i) faceTableI[faceTableInds[:,0]] = np.array([triTable[j[0]] for j in faceTableInds]) faceTableI = faceTableI.reshape((len(triTable), i, 3)) faceShiftTables.append(edgeShifts[faceTableI]) ## Let's try something different: #faceTable = np.empty((256, 5, 3, 4), dtype=np.ubyte) # (grid cell index, faces, vertexes, edge lookup) #for i,f in enumerate(triTable): #f = np.array(f + [12] * (15-len(f))).reshape(5,3) #faceTable[i] = edgeShifts[f] IsosurfaceDataCache = (faceShiftTables, edgeShifts, edgeTable, nTableFaces) else: faceShiftTables, edgeShifts, edgeTable, nTableFaces = IsosurfaceDataCache # We use strides below, which means we need contiguous array input. # Ideally we can fix this just by removing the dependency on strides. if not data.flags['C_CONTIGUOUS']: raise TypeError("isosurface input data must be c-contiguous.") ## mark everything below the isosurface level mask = data < level ### make eight sub-fields and compute indexes for grid cells index = np.zeros([x-1 for x in data.shape], dtype=np.ubyte) fields = np.empty((2,2,2), dtype=object) slices = [slice(0,-1), slice(1,None)] for i in [0,1]: for j in [0,1]: for k in [0,1]: fields[i,j,k] = mask[slices[i], slices[j], slices[k]] vertIndex = i - 2*j*i + 3*j + 4*k ## this is just to match Bourk's vertex numbering scheme np.add(index, fields[i,j,k] * 2**vertIndex, out=index, casting='unsafe') ### Generate table of edges that have been cut cutEdges = np.zeros([x+1 for x in index.shape]+[3], dtype=np.uint32) edges = edgeTable[index] for i, shift in enumerate(edgeShifts[:12]): slices = [slice(shift[j],cutEdges.shape[j]+(shift[j]-1)) for j in range(3)] cutEdges[slices[0], slices[1], slices[2], shift[3]] += edges & 2**i ## for each cut edge, interpolate to see where exactly the edge is cut and generate vertex positions m = cutEdges > 0 vertexInds = np.argwhere(m) ## argwhere is slow! vertexes = vertexInds[:,:3].astype(np.float32) dataFlat = data.reshape(data.shape[0]*data.shape[1]*data.shape[2]) ## re-use the cutEdges array as a lookup table for vertex IDs cutEdges[vertexInds[:,0], vertexInds[:,1], vertexInds[:,2], vertexInds[:,3]] = np.arange(vertexInds.shape[0]) for i in [0,1,2]: vim = vertexInds[:,3] == i vi = vertexInds[vim, :3] viFlat = (vi * (np.array(data.strides[:3]) // data.itemsize)[np.newaxis,:]).sum(axis=1) v1 = dataFlat[viFlat] v2 = dataFlat[viFlat + data.strides[i]//data.itemsize] vertexes[vim,i] += (level-v1) / (v2-v1) ### compute the set of vertex indexes for each face. ## This works, but runs a bit slower. #cells = np.argwhere((index != 0) & (index != 255)) ## all cells with at least one face #cellInds = index[cells[:,0], cells[:,1], cells[:,2]] #verts = faceTable[cellInds] #mask = verts[...,0,0] != 9 #verts[...,:3] += cells[:,np.newaxis,np.newaxis,:] ## we now have indexes into cutEdges #verts = verts[mask] #faces = cutEdges[verts[...,0], verts[...,1], verts[...,2], verts[...,3]] ## and these are the vertex indexes we want. ## To allow this to be vectorized efficiently, we count the number of faces in each ## grid cell and handle each group of cells with the same number together. ## determine how many faces to assign to each grid cell nFaces = nTableFaces[index] totFaces = nFaces.sum() faces = np.empty((totFaces, 3), dtype=np.uint32) ptr = 0 #import debug #p = debug.Profiler() ## this helps speed up an indexing operation later on cs = np.array(cutEdges.strides)//cutEdges.itemsize cutEdges = cutEdges.flatten() ## this, strangely, does not seem to help. #ins = np.array(index.strides)/index.itemsize #index = index.flatten() for i in range(1,6): ### expensive: #profiler() cells = np.argwhere(nFaces == i) ## all cells which require i faces (argwhere is expensive) #profiler() if cells.shape[0] == 0: continue cellInds = index[cells[:,0], cells[:,1], cells[:,2]] ## index values of cells to process for this round #profiler() ### expensive: verts = faceShiftTables[i][cellInds] #profiler() np.add(verts[...,:3], cells[:,np.newaxis,np.newaxis,:], out=verts[...,:3], casting='unsafe') ## we now have indexes into cutEdges verts = verts.reshape((verts.shape[0]*i,)+verts.shape[2:]) #profiler() ### expensive: verts = (verts * cs[np.newaxis, np.newaxis, :]).sum(axis=2) vertInds = cutEdges[verts] #profiler() nv = vertInds.shape[0] #profiler() faces[ptr:ptr+nv] = vertInds #.reshape((nv, 3)) #profiler() ptr += nv return vertexes, faces def _pinv_fallback(tr): arr = np.array([tr.m11(), tr.m12(), tr.m13(), tr.m21(), tr.m22(), tr.m23(), tr.m31(), tr.m32(), tr.m33()]) arr.shape = (3, 3) pinv = np.linalg.pinv(arr) return QtGui.QTransform(*pinv.ravel().tolist()) def invertQTransform(tr): """Return a QTransform that is the inverse of *tr*. A pseudo-inverse is returned if tr is not invertible. Note that this function is preferred over QTransform.inverted() due to bugs in that method. (specifically, Qt has floating-point precision issues when determining whether a matrix is invertible) """ try: det = tr.determinant() detr = 1.0 / det # let singular matrices raise ZeroDivisionError inv = tr.adjoint() inv *= detr return inv except ZeroDivisionError: return _pinv_fallback(tr) def pseudoScatter(data, spacing=None, shuffle=True, bidir=False, method='exact'): """Return an array of position values needed to make beeswarm or column scatter plots. Used for examining the distribution of values in an array. Given an array of x-values, construct an array of y-values such that an x,y scatter-plot will not have overlapping points (it will look similar to a histogram). """ if method == 'exact': return _pseudoScatterExact(data, spacing=spacing, shuffle=shuffle, bidir=bidir) elif method == 'histogram': return _pseudoScatterHistogram(data, spacing=spacing, shuffle=shuffle, bidir=bidir) def _pseudoScatterHistogram(data, spacing=None, shuffle=True, bidir=False): """Works by binning points into a histogram and spreading them out to fill the bin. Faster method, but can produce blocky results. """ inds = np.arange(len(data)) if shuffle: np.random.shuffle(inds) data = data[inds] if spacing is None: spacing = 2.*np.std(data)/len(data)**0.5 yvals = np.empty(len(data)) dmin = data.min() dmax = data.max() nbins = int((dmax-dmin) / spacing) + 1 bins = np.linspace(dmin, dmax, nbins) dx = bins[1] - bins[0] dbins = ((data - bins[0]) / dx).astype(int) binCounts = {} for i,j in enumerate(dbins): c = binCounts.get(j, -1) + 1 binCounts[j] = c yvals[i] = c if bidir is True: for i in range(nbins): yvals[dbins==i] -= binCounts.get(i, 0) * 0.5 return yvals[np.argsort(inds)] ## un-shuffle values before returning def _pseudoScatterExact(data, spacing=None, shuffle=True, bidir=False): """Works by stacking points up one at a time, searching for the lowest position available at each point. This method produces nice, smooth results but can be prohibitively slow for large datasets. """ inds = np.arange(len(data)) if shuffle: np.random.shuffle(inds) data = data[inds] if spacing is None: spacing = 2.*np.std(data)/len(data)**0.5 s2 = spacing**2 yvals = np.empty(len(data)) if len(data) == 0: return yvals yvals[0] = 0 for i in range(1,len(data)): x = data[i] # current x value to be placed x0 = data[:i] # all x values already placed y0 = yvals[:i] # all y values already placed y = 0 dx = (x0-x)**2 # x-distance to each previous point xmask = dx < s2 # exclude anything too far away if xmask.sum() > 0: if bidir: dirs = [-1, 1] else: dirs = [1] yopts = [] for direction in dirs: y = 0 dx2 = dx[xmask] dy = (s2 - dx2)**0.5 limits = np.empty((2,len(dy))) # ranges of y-values to exclude limits[0] = y0[xmask] - dy limits[1] = y0[xmask] + dy while True: # ignore anything below this y-value if direction > 0: mask = limits[1] >= y else: mask = limits[0] <= y limits2 = limits[:,mask] # are we inside an excluded region? mask = (limits2[0] < y) & (limits2[1] > y) if mask.sum() == 0: break if direction > 0: y = limits2[:,mask].max() else: y = limits2[:,mask].min() yopts.append(y) if bidir: y = yopts[0] if -yopts[0] < yopts[1] else yopts[1] else: y = yopts[0] yvals[i] = y return yvals[np.argsort(inds)] ## un-shuffle values before returning def toposort(deps, nodes=None, seen=None, stack=None, depth=0): """Topological sort. Arguments are: deps dictionary describing dependencies where a:[b,c] means "a depends on b and c" nodes optional, specifies list of starting nodes (these should be the nodes which are not depended on by any other nodes). Other candidate starting nodes will be ignored. Example:: # Sort the following graph: # # B ──┬─────> C <── D # │ │ # E <─┴─> A <─┘ # deps = {'a': ['b', 'c'], 'c': ['b', 'd'], 'e': ['b']} toposort(deps) => ['b', 'd', 'c', 'a', 'e'] """ # fill in empty dep lists deps = deps.copy() for k,v in list(deps.items()): for k in v: if k not in deps: deps[k] = [] if nodes is None: ## run through deps to find nodes that are not depended upon rem = set() for dep in deps.values(): rem |= set(dep) nodes = set(deps.keys()) - rem if seen is None: seen = set() stack = [] sorted = [] for n in nodes: if n in stack: raise Exception("Cyclic dependency detected", stack + [n]) if n in seen: continue seen.add(n) sorted.extend( toposort(deps, deps[n], seen, stack+[n], depth=depth+1)) sorted.append(n) return sorted def disconnect(signal, slot): """Disconnect a Qt signal from a slot. This method augments Qt's Signal.disconnect(): * Return bool indicating whether disconnection was successful, rather than raising an exception * Attempt to disconnect prior versions of the slot when using pg.reload """ while True: try: success = signal.disconnect(slot) if success is None: # PyQt success = True except (TypeError, RuntimeError): success = False if success: return True slot = reload.getPreviousVersion(slot) if slot is None: return False class SignalBlock(object): """Class used to temporarily block a Qt signal connection:: with SignalBlock(signal, slot): # do something that emits a signal; it will # not be delivered to slot """ def __init__(self, signal, slot): self.signal = signal self.slot = slot def __enter__(self): self.reconnect = disconnect(self.signal, self.slot) return self def __exit__(self, *args): if self.reconnect: self.signal.connect(self.slot) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/functions_numba.py000066400000000000000000000027021457240071200234210ustar00rootroot00000000000000import numba import numpy as np rescale_functions = {} def rescale_clip_source(xx, scale, offset, vmin, vmax, yy): for i in range(xx.size): val = (xx[i] - offset) * scale yy[i] = min(max(val, vmin), vmax) def rescaleData(data, scale, offset, dtype, clip): data_out = np.empty_like(data, dtype=dtype) key = (data.dtype.name, data_out.dtype.name) func = rescale_functions.get(key) if func is None: func = numba.guvectorize( [f'{key[0]}[:],f8,f8,f8,f8,{key[1]}[:]'], '(n),(),(),(),()->(n)', nopython=True)(rescale_clip_source) rescale_functions[key] = func func(data, scale, offset, clip[0], clip[1], out=data_out) return data_out @numba.jit(nopython=True) def _rescale_and_lookup1d_function(data, scale, offset, lut, out): vmin, vmax = 0, lut.shape[0] - 1 for r in range(data.shape[0]): for c in range(data.shape[1]): val = (data[r, c] - offset) * scale val = min(max(val, vmin), vmax) out[r, c] = lut[int(val)] def rescale_and_lookup1d(data, scale, offset, lut): # data should be floating point and 2d # lut is 1d data_out = np.empty_like(data, dtype=lut.dtype) _rescale_and_lookup1d_function(data, float(scale), float(offset), lut, data_out) return data_out @numba.jit(nopython=True) def numba_take(lut, data): # numba supports only the 1st two arguments of np.take return np.take(lut, data) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/functions_qimage.py000066400000000000000000000233621457240071200235670ustar00rootroot00000000000000import numpy from .Qt import QtGui from . import functions from .util.cupy_helper import getCupy from .util.numba_helper import getNumbaFunctions def _apply_lut_for_uint16_mono(xp, image, lut): # Note: compared to makeARGB(), we have already clipped the data to range augmented_alpha = False # if lut is 1d, then lut[image] is fastest # if lut is 2d, then lut.take(image, axis=0) is faster than lut[image] if not image.flags.c_contiguous: image = lut.take(image, axis=0) # if lut had dimensions (N, 1), then our resultant image would # have dimensions (h, w, 1) if image.ndim == 3 and image.shape[-1] == 1: image = image[..., 0] return image, augmented_alpha # if we are contiguous, we can take a faster codepath where we # ensure that the lut is 1d lut, augmented_alpha = _convert_2dlut_to_1dlut(xp, lut) fn_numba = getNumbaFunctions() if xp == numpy and fn_numba is not None: image = fn_numba.numba_take(lut, image) else: image = lut[image] if image.dtype == xp.uint32: image = image[..., xp.newaxis].view(xp.uint8) return image, augmented_alpha def _convert_2dlut_to_1dlut(xp, lut): # converts: # - uint8 (N, 1) to uint8 (N,) # - uint8 (N, 3) or (N, 4) to uint32 (N,) # this allows faster lookup as 1d lookup is faster augmented_alpha = False if lut.ndim == 1: return lut, augmented_alpha if lut.shape[1] == 3: # rgb # convert rgb lut to rgba so that it is 32-bits lut = xp.column_stack([lut, xp.full(lut.shape[0], 255, dtype=xp.uint8)]) augmented_alpha = True if lut.shape[1] == 4: # rgba lut = lut.view(xp.uint32) lut = lut.ravel() return lut, augmented_alpha def _rescale_float_mono(xp, image, levels, lut): augmented_alpha = False # Decide on maximum scaled value if lut is not None: scale = lut.shape[0] num_colors = lut.shape[0] else: scale = 255.0 num_colors = 256 dtype = xp.min_scalar_type(num_colors - 1) minVal, maxVal = levels rng = maxVal - minVal rng = 1 if rng == 0 else rng fn_numba = getNumbaFunctions() if ( xp == numpy and image.flags.c_contiguous and dtype == xp.uint16 and fn_numba is not None ): lut, augmented_alpha = _convert_2dlut_to_1dlut(xp, lut) image = fn_numba.rescale_and_lookup1d(image, scale / rng, minVal, lut) if image.dtype == xp.uint32: image = image[..., xp.newaxis].view(xp.uint8) return image, None, None, augmented_alpha else: image = functions.rescaleData( image, scale / rng, offset=minVal, dtype=dtype, clip=(0, num_colors - 1) ) levels = None if image.dtype == xp.uint16 and image.ndim == 2: image, augmented_alpha = _apply_lut_for_uint16_mono(xp, image, lut) lut = None # image is now of type uint8 return image, levels, lut, augmented_alpha def _try_combine_lut(xp, image, levels, lut): augmented_alpha = False if ( image.dtype == xp.uint16 and levels is None and image.ndim == 3 and image.shape[2] == 3 ): # uint16 rgb can't be directly displayed, so make it # pass through effective lut processing levels = [0, 65535] if levels is None and lut is None: # nothing to combine return image, levels, lut, augmented_alpha # distinguish between lut for levels and colors levels_lut = None colors_lut = lut eflsize = 2 ** (image.itemsize * 8) if levels is None: info = xp.iinfo(image.dtype) minlev, maxlev = info.min, info.max else: minlev, maxlev = levels levdiff = maxlev - minlev levdiff = 1 if levdiff == 0 else levdiff # don't allow division by 0 if colors_lut is None: if image.dtype == xp.ubyte and image.ndim == 2: # uint8 mono image ind = xp.arange(eflsize) levels_lut = functions.rescaleData( ind, scale=255.0 / levdiff, offset=minlev, dtype=xp.ubyte ) # image data is not scaled. instead, levels_lut is used # as (grayscale) Indexed8 ColorTable to get the same effect. # due to the small size of the input to rescaleData(), we # do not bother caching the result return image, None, levels_lut, augmented_alpha else: # uint16 mono, uint8 rgb, uint16 rgb # rescale image data by computation instead of by memory lookup image = functions.rescaleData( image, scale=255.0 / levdiff, offset=minlev, dtype=xp.ubyte ) return image, None, colors_lut, augmented_alpha else: num_colors = colors_lut.shape[0] effscale = num_colors / levdiff lutdtype = xp.min_scalar_type(num_colors - 1) if image.dtype == xp.ubyte or lutdtype != xp.ubyte: # combine if either: # 1) uint8 mono image # 2) colors_lut has more entries than will fit within 8-bits ind = xp.arange(eflsize) levels_lut = functions.rescaleData( ind, scale=effscale, offset=minlev, dtype=lutdtype, clip=(0, num_colors - 1), ) efflut = colors_lut[levels_lut] # apply the effective lut early for the following types: if image.dtype == xp.uint16 and image.ndim == 2: image, augmented_alpha = _apply_lut_for_uint16_mono(xp, image, efflut) efflut = None return image, None, efflut, augmented_alpha else: # uint16 image with colors_lut <= 256 entries # don't combine, we will use QImage ColorTable image = functions.rescaleData( image, scale=effscale, offset=minlev, dtype=lutdtype, clip=(0, num_colors - 1), ) return image, None, colors_lut, augmented_alpha def try_make_qimage(image, *, levels, lut): """ Internal function to make an QImage from an ndarray without going through the full generality of makeARGB(). Only certain combinations of input arguments are supported. """ # this function assumes that image has no nans. # checking for nans is an expensive operation; it is expected that # the caller would want to cache the result rather than have this # function check for nans unconditionally. cp = getCupy() xp = cp.get_array_module(image) if cp else numpy # float images always need levels if image.dtype.kind == "f" and levels is None: return None # can't handle multi-channel levels if levels is not None: levels = xp.asarray(levels) if levels.ndim != 1: return None if lut is not None and lut.dtype != xp.uint8: raise ValueError("lut dtype must be uint8") augmented_alpha = False if image.dtype.kind == "f": image, levels, lut, augmented_alpha = _rescale_float_mono( xp, image, levels, lut ) # on return, we will have an uint8 image with levels None. # lut if not None will have <= 256 entries # if the image data is a small int, then we can combine levels + lut # into a single lut for better performance elif image.dtype in (xp.ubyte, xp.uint16): image, levels, lut, augmented_alpha = _try_combine_lut(xp, image, levels, lut) ubyte_nolvl = image.dtype == xp.ubyte and levels is None is_passthru8 = ubyte_nolvl and lut is None is_indexed8 = ( ubyte_nolvl and image.ndim == 2 and lut is not None and lut.shape[0] <= 256 ) is_passthru16 = image.dtype == xp.uint16 and levels is None and lut is None can_grayscale16 = ( is_passthru16 and image.ndim == 2 and hasattr(QtGui.QImage.Format, "Format_Grayscale16") ) is_rgba64 = is_passthru16 and image.ndim == 3 and image.shape[2] == 4 # bypass makeARGB for supported combinations supported = is_passthru8 or is_indexed8 or can_grayscale16 or is_rgba64 if not supported: return None if xp == cp: image = image.get() # worthwhile supporting non-contiguous arrays image = numpy.ascontiguousarray(image) fmt = None ctbl = None if is_passthru8: # both levels and lut are None # these images are suitable for display directly if image.ndim == 2: fmt = QtGui.QImage.Format.Format_Grayscale8 elif image.shape[2] == 3: fmt = QtGui.QImage.Format.Format_RGB888 elif image.shape[2] == 4: if augmented_alpha: fmt = QtGui.QImage.Format.Format_RGBX8888 else: fmt = QtGui.QImage.Format.Format_RGBA8888 elif is_indexed8: # levels and/or lut --> lut-only fmt = QtGui.QImage.Format.Format_Indexed8 if lut.ndim == 1 or lut.shape[1] == 1: ctbl = [QtGui.qRgb(x, x, x) for x in lut.ravel().tolist()] elif lut.shape[1] == 3: ctbl = [QtGui.qRgb(*rgb) for rgb in lut.tolist()] elif lut.shape[1] == 4: ctbl = [QtGui.qRgba(*rgba) for rgba in lut.tolist()] elif can_grayscale16: # single channel uint16 # both levels and lut are None fmt = QtGui.QImage.Format.Format_Grayscale16 elif is_rgba64: # uint16 rgba # both levels and lut are None fmt = QtGui.QImage.Format.Format_RGBA64 # endian-independent if fmt is None: raise ValueError("unsupported image type") qimage = functions.ndarray_to_qimage(image, fmt) if ctbl is not None: qimage.setColorTable(ctbl) return qimage pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/000077500000000000000000000000001457240071200224565ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ArrowItem.py000066400000000000000000000124441457240071200247460ustar00rootroot00000000000000from math import hypot from .. import functions as fn from ..Qt import QtGui, QtWidgets __all__ = ['ArrowItem'] class ArrowItem(QtWidgets.QGraphicsPathItem): """ For displaying scale-invariant arrows. For arrows pointing to a location on a curve, see CurveArrow """ def __init__(self, parent=None, **opts): """ Arrows can be initialized with any keyword arguments accepted by the setStyle() method. """ self.opts = {} QtWidgets.QGraphicsPathItem.__init__(self, parent) if 'size' in opts: opts['headLen'] = opts['size'] if 'width' in opts: opts['headWidth'] = opts['width'] pos = opts.pop('pos', (0, 0)) defaultOpts = { 'pxMode': True, 'angle': -150, ## If the angle is 0, the arrow points left 'headLen': 20, 'headWidth': None, 'tipAngle': 25, 'baseAngle': 0, 'tailLen': None, 'tailWidth': 3, 'pen': (200,200,200), 'brush': (50,50,200), } defaultOpts.update(opts) self.setStyle(**defaultOpts) # for backward compatibility self.setPos(*pos) def setStyle(self, **opts): """ Changes the appearance of the arrow. All arguments are optional: ====================== ================================================= **Keyword Arguments:** angle Orientation of the arrow in degrees. Default is 0; arrow pointing to the left. headLen Length of the arrow head, from tip to base. default=20 headWidth Width of the arrow head at its base. If headWidth is specified, it overrides tipAngle. tipAngle Angle of the tip of the arrow in degrees. Smaller values make a 'sharper' arrow. default=25 baseAngle Angle of the base of the arrow head. Default is 0, which means that the base of the arrow head is perpendicular to the arrow tail. tailLen Length of the arrow tail, measured from the base of the arrow head to the end of the tail. If this value is None, no tail will be drawn. default=None tailWidth Width of the tail. default=3 pen The pen used to draw the outline of the arrow. brush The brush used to fill the arrow. pxMode If True, then the arrow is drawn as a fixed size regardless of the scale of its parents (including the ViewBox zoom level). ====================== ================================================= """ arrowOpts = ['headLen', 'tipAngle', 'baseAngle', 'tailLen', 'tailWidth', 'headWidth'] allowedOpts = ['angle', 'pen', 'brush', 'pxMode'] + arrowOpts needUpdate = False for k,v in opts.items(): if k not in allowedOpts: raise KeyError('Invalid arrow style option "%s"' % k) if self.opts.get(k) != v: needUpdate = True self.opts[k] = v if not needUpdate: return opt = dict([(k,self.opts[k]) for k in arrowOpts if k in self.opts]) tr = QtGui.QTransform() tr.rotate(self.opts['angle']) self.path = tr.map(fn.makeArrowPath(**opt)) self.setPath(self.path) self.setPen(fn.mkPen(self.opts['pen'])) self.setBrush(fn.mkBrush(self.opts['brush'])) if self.opts['pxMode']: self.setFlags(self.flags() | self.GraphicsItemFlag.ItemIgnoresTransformations) else: self.setFlags(self.flags() & ~self.GraphicsItemFlag.ItemIgnoresTransformations) def paint(self, p, *args): p.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing) super().paint(p, *args) #p.setPen(fn.mkPen('r')) #p.setBrush(fn.mkBrush(None)) #p.drawRect(self.boundingRect()) def shape(self): #if not self.opts['pxMode']: #return QtWidgets.QGraphicsPathItem.shape(self) return self.path ## dataBounds and pixelPadding methods are provided to ensure ViewBox can ## properly auto-range def dataBounds(self, ax, frac, orthoRange=None): pw = 0 pen = self.pen() if not pen.isCosmetic(): pw = pen.width() * 0.7072 if self.opts['pxMode']: return [0,0] else: br = self.boundingRect() if ax == 0: return [br.left()-pw, br.right()+pw] else: return [br.top()-pw, br.bottom()+pw] def pixelPadding(self): pad = 0 if self.opts['pxMode']: br = self.boundingRect() pad += hypot(br.width(), br.height()) pen = self.pen() if pen.isCosmetic(): pad += max(1, pen.width()) * 0.7072 return pad pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/AxisItem.py000066400000000000000000001542011457240071200245560ustar00rootroot00000000000000import weakref from math import ceil, floor, isfinite, log10, sqrt, frexp, floor import numpy as np from .. import debug as debug from .. import functions as fn from .. import getConfigOption from ..Point import Point from ..Qt import QtCore, QtGui, QtWidgets from .GraphicsWidget import GraphicsWidget __all__ = ['AxisItem'] class AxisItem(GraphicsWidget): """ GraphicsItem showing a single plot axis with ticks, values, and label. Can be configured to fit on any side of a plot, Can automatically synchronize its displayed scale with ViewBox items. Ticks can be extended to draw a grid. If maxTickLength is negative, ticks point into the plot. """ def __init__(self, orientation, pen=None, textPen=None, tickPen = None, linkView=None, parent=None, maxTickLength=-5, showValues=True, text='', units='', unitPrefix='', **args): """ =============== =============================================================== **Arguments:** orientation one of 'left', 'right', 'top', or 'bottom' maxTickLength (px) maximum length of ticks to draw. Negative values draw into the plot, positive values draw outward. linkView (ViewBox) causes the range of values displayed in the axis to be linked to the visible range of a ViewBox. showValues (bool) Whether to display values adjacent to ticks pen (QPen) Pen used when drawing axis and (by default) ticks textPen (QPen) Pen used when drawing tick labels. tickPen (QPen) Pen used when drawing ticks. text The text (excluding units) to display on the label for this axis. units The units for this axis. Units should generally be given without any scaling prefix (eg, 'V' instead of 'mV'). The scaling prefix will be automatically prepended based on the range of data displayed. args All extra keyword arguments become CSS style options for the tag which will surround the axis label and units. =============== =============================================================== """ GraphicsWidget.__init__(self, parent) self.label = QtWidgets.QGraphicsTextItem(self) self.picture = None self.orientation = orientation if orientation not in ['left', 'right', 'top', 'bottom']: raise Exception("Orientation argument must be one of 'left', 'right', 'top', or 'bottom'.") if orientation in ['left', 'right']: self.label.setRotation(-90) hide_overlapping_labels = False # allow labels on vertical axis to extend above and below the length of the axis else: hide_overlapping_labels = True # stop labels on horizontal axis from overlapping so vertical axis labels have room self.style = { 'tickTextOffset': [5, 2], ## (horizontal, vertical) spacing between text and axis 'tickTextWidth': 30, ## space reserved for tick text 'tickTextHeight': 18, 'autoExpandTextSpace': True, ## automatically expand text space if needed 'autoReduceTextSpace': True, 'hideOverlappingLabels': hide_overlapping_labels, 'tickFont': None, 'stopAxisAtTick': (False, False), ## whether axis is drawn to edge of box or to last tick 'textFillLimits': [ ## how much of the axis to fill up with tick text, maximally. (0, 0.8), ## never fill more than 80% of the axis (2, 0.6), ## If we already have 2 ticks with text, fill no more than 60% of the axis (4, 0.4), ## If we already have 4 ticks with text, fill no more than 40% of the axis (6, 0.2), ## If we already have 6 ticks with text, fill no more than 20% of the axis ], 'showValues': showValues, 'tickLength': maxTickLength, 'maxTickLevel': 2, 'maxTextLevel': 2, 'tickAlpha': None, ## If not none, use this alpha for all ticks. } self.textWidth = 30 ## Keeps track of maximum width / height of tick text self.textHeight = 18 # If the user specifies a width / height, remember that setting # indefinitely. self.fixedWidth = None self.fixedHeight = None self.labelText = text self.labelUnits = units self.labelUnitPrefix = unitPrefix self.labelStyle = args self.logMode = False self._tickDensity = 1.0 # used to adjust scale the number of automatically generated ticks self._tickLevels = None # used to override the automatic ticking system with explicit ticks self._tickSpacing = None # used to override default tickSpacing method self.scale = 1.0 self.autoSIPrefix = True self.autoSIPrefixScale = 1.0 self.showLabel(False) self.setRange(0, 1) if pen is None: self.setPen() else: self.setPen(pen) if textPen is None: self.setTextPen() else: self.setTextPen(textPen) if tickPen is None: self.setTickPen() else: self.setTickPen(tickPen) self._linkedView = None if linkView is not None: self._linkToView_internal(linkView) self.grid = False #self.setCacheMode(self.DeviceCoordinateCache) def setStyle(self, **kwds): """ Set various style options. ===================== ======================================================= Keyword Arguments: tickLength (int) The maximum length of ticks in pixels. Positive values point toward the text; negative values point away. tickTextOffset (int) reserved spacing between text and axis in px tickTextWidth (int) Horizontal space reserved for tick text in px tickTextHeight (int) Vertical space reserved for tick text in px autoExpandTextSpace (bool) Automatically expand text space if the tick strings become too long. autoReduceTextSpace (bool) Automatically shrink the axis if necessary hideOverlappingLabels (bool or int) * *True* (default for horizontal axis): Hide tick labels which extend beyond the AxisItem's geometry rectangle. * *False* (default for vertical axis): Labels may be drawn extending beyond the extent of the axis. * *(int)* sets the tolerance limit for how many pixels a label is allowed to extend beyond the axis. Defaults to 15 for `hideOverlappingLabels = False`. tickFont (QFont or None) Determines the font used for tick values. Use None for the default font. stopAxisAtTick (tuple: (bool min, bool max)) If True, the axis line is drawn only as far as the last tick. Otherwise, the line is drawn to the edge of the AxisItem boundary. textFillLimits (list of (tick #, % fill) tuples). This structure determines how the AxisItem decides how many ticks should have text appear next to them. Each tuple in the list specifies what fraction of the axis length may be occupied by text, given the number of ticks that already have text displayed. For example:: [(0, 0.8), # Never fill more than 80% of the axis (2, 0.6), # If we already have 2 ticks with text, # fill no more than 60% of the axis (4, 0.4), # If we already have 4 ticks with text, # fill no more than 40% of the axis (6, 0.2)] # If we already have 6 ticks with text, # fill no more than 20% of the axis showValues (bool) indicates whether text is displayed adjacent to ticks. tickAlpha (float or int or None) If None, pyqtgraph will draw the ticks with the alpha it deems appropriate. Otherwise, the alpha will be fixed at the value passed. With int, accepted values are [0..255]. With value of type float, accepted values are from [0..1]. ===================== ======================================================= Added in version 0.9.9 """ for kwd,value in kwds.items(): if kwd not in self.style: raise NameError("%s is not a valid style argument." % kwd) if kwd in ('tickLength', 'tickTextOffset', 'tickTextWidth', 'tickTextHeight'): if not isinstance(value, int): raise ValueError("Argument '%s' must be int" % kwd) if kwd == 'tickTextOffset': if self.orientation in ('left', 'right'): self.style['tickTextOffset'][0] = value else: self.style['tickTextOffset'][1] = value elif kwd == 'stopAxisAtTick': try: assert len(value) == 2 and isinstance(value[0], bool) and isinstance(value[1], bool) except: raise ValueError("Argument 'stopAxisAtTick' must have type (bool, bool)") self.style[kwd] = value else: self.style[kwd] = value self.picture = None self._adjustSize() self.update() def close(self): self.scene().removeItem(self.label) self.label = None self.scene().removeItem(self) def setGrid(self, grid): """Set the alpha value (0-255) for the grid, or False to disable. When grid lines are enabled, the axis tick lines are extended to cover the extent of the linked ViewBox, if any. """ self.grid = grid self.picture = None self.prepareGeometryChange() self.update() def setLogMode(self, *args, **kwargs): """ Set log scaling for x and/or y axes. If two positional arguments are provided, the first will set log scaling for the x axis and the second for the y axis. If a single positional argument is provided, it will set the log scaling along the direction of the AxisItem. Alternatively, x and y can be passed as keyword arguments. If an axis is set to log scale, ticks are displayed on a logarithmic scale and values are adjusted accordingly. (This is usually accessed by changing the log mode of a :func:`PlotItem `.) The linked ViewBox will be informed of the change. """ if len(args) == 1: self.logMode = args[0] else: if len(args) == 2: x, y = args else: x = kwargs.get('x') y = kwargs.get('y') if x is not None and self.orientation in ('top', 'bottom'): self.logMode = x if y is not None and self.orientation in ('left', 'right'): self.logMode = y if self._linkedView is not None: if self.orientation in ('top', 'bottom'): self._linkedView().setLogMode('x', self.logMode) elif self.orientation in ('left', 'right'): self._linkedView().setLogMode('y', self.logMode) self.picture = None self.update() def setTickFont(self, font): """ (QFont or None) Determines the font used for tick values. Use None for the default font. """ self.style['tickFont'] = font self.picture = None self.prepareGeometryChange() ## Need to re-allocate space depending on font size? self.update() def resizeEvent(self, ev=None): #s = self.size() ## Set the position of the label nudge = 5 if self.label is None: # self.label is set to None on close, but resize events can still occur. self.picture = None return br = self.label.boundingRect() p = QtCore.QPointF(0, 0) if self.orientation == 'left': p.setY(int(self.size().height()/2 + br.width()/2)) p.setX(-nudge) elif self.orientation == 'right': p.setY(int(self.size().height()/2 + br.width()/2)) p.setX(int(self.size().width()-br.height()+nudge)) elif self.orientation == 'top': p.setY(-nudge) p.setX(int(self.size().width()/2. - br.width()/2.)) elif self.orientation == 'bottom': p.setX(int(self.size().width()/2. - br.width()/2.)) p.setY(int(self.size().height()-br.height()+nudge)) self.label.setPos(p) self.picture = None def showLabel(self, show=True): """Show/hide the label text for this axis.""" #self.drawLabel = show self.label.setVisible(show) if self.orientation in ['left', 'right']: self._updateWidth() else: self._updateHeight() if self.autoSIPrefix: self.updateAutoSIPrefix() def setLabel(self, text=None, units=None, unitPrefix=None, **args): """Set the text displayed adjacent to the axis. ============== ============================================================= **Arguments:** text The text (excluding units) to display on the label for this axis. units The units for this axis. Units should generally be given without any scaling prefix (eg, 'V' instead of 'mV'). The scaling prefix will be automatically prepended based on the range of data displayed. args All extra keyword arguments become CSS style options for the tag which will surround the axis label and units. ============== ============================================================= The final text generated for the label will look like:: {text} (prefix{units}) Each extra keyword argument will become a CSS option in the above template. For example, you can set the font size and color of the label:: labelStyle = {'color': '#FFF', 'font-size': '14pt'} axis.setLabel('label text', units='V', **labelStyle) """ # `None` input is kept for backward compatibility! self.labelText = text or "" self.labelUnits = units or "" self.labelUnitPrefix = unitPrefix or "" if len(args) > 0: self.labelStyle = args # Account empty string and `None` for units and text visible = True if (text or units) else False self.showLabel(visible) self._updateLabel() def _updateLabel(self): """Internal method to update the label according to the text""" self.label.setHtml(self.labelString()) self._adjustSize() self.picture = None self.update() def labelString(self): if self.labelUnits == '': if not self.autoSIPrefix or self.autoSIPrefixScale == 1.0: units = '' else: units = '(x%g)' % (1.0/self.autoSIPrefixScale) else: units = '(%s%s)' % (self.labelUnitPrefix, self.labelUnits) s = '%s %s' % (self.labelText, units) style = ';'.join(['%s: %s' % (k, self.labelStyle[k]) for k in self.labelStyle]) return "%s" % (style, s) def _updateMaxTextSize(self, x): ## Informs that the maximum tick size orthogonal to the axis has ## changed; we use this to decide whether the item needs to be resized ## to accomodate. if self.orientation in ['left', 'right']: if self.style["autoReduceTextSpace"]: if x > self.textWidth or x < self.textWidth - 10: self.textWidth = x else: mx = max(self.textWidth, x) if mx > self.textWidth or mx < self.textWidth - 10: self.textWidth = mx if self.style['autoExpandTextSpace']: self._updateWidth() else: if self.style['autoReduceTextSpace']: if x > self.textHeight or x < self.textHeight - 10: self.textHeight = x else: mx = max(self.textHeight, x) if mx > self.textHeight or mx < self.textHeight - 10: self.textHeight = mx if self.style['autoExpandTextSpace']: self._updateHeight() def _adjustSize(self): if self.orientation in ['left', 'right']: self._updateWidth() else: self._updateHeight() def setHeight(self, h=None): """Set the height of this axis reserved for ticks and tick labels. The height of the axis label is automatically added. If *height* is None, then the value will be determined automatically based on the size of the tick text.""" self.fixedHeight = h self._updateHeight() def _updateHeight(self): if not self.isVisible(): h = 0 else: if self.fixedHeight is None: if not self.style['showValues']: h = 0 elif self.style['autoExpandTextSpace']: h = self.textHeight else: h = self.style['tickTextHeight'] h += self.style['tickTextOffset'][1] if self.style['showValues'] else 0 h += max(0, self.style['tickLength']) if self.label.isVisible(): h += self.label.boundingRect().height() * 0.8 else: h = self.fixedHeight self.setMaximumHeight(h) self.setMinimumHeight(h) self.picture = None def setWidth(self, w=None): """Set the width of this axis reserved for ticks and tick labels. The width of the axis label is automatically added. If *width* is None, then the value will be determined automatically based on the size of the tick text.""" self.fixedWidth = w self._updateWidth() def _updateWidth(self): if not self.isVisible(): w = 0 else: if self.fixedWidth is None: if not self.style['showValues']: w = 0 elif self.style['autoExpandTextSpace']: w = self.textWidth else: w = self.style['tickTextWidth'] w += self.style['tickTextOffset'][0] if self.style['showValues'] else 0 w += max(0, self.style['tickLength']) if self.label.isVisible(): w += self.label.boundingRect().height() * 0.8 ## bounding rect is usually an overestimate else: w = self.fixedWidth self.setMaximumWidth(w) self.setMinimumWidth(w) self.picture = None def pen(self): if self._pen is None: return fn.mkPen(getConfigOption('foreground')) return fn.mkPen(self._pen) def setPen(self, *args, **kwargs): """ Set the pen used for drawing text, axes, ticks, and grid lines. If no arguments are given, the default foreground color will be used (see :func:`setConfigOption `). """ self.picture = None if args or kwargs: self._pen = fn.mkPen(*args, **kwargs) else: self._pen = fn.mkPen(getConfigOption('foreground')) self.labelStyle['color'] = self._pen.color().name() # #RRGGBB self._updateLabel() def textPen(self): if self._textPen is None: return fn.mkPen(getConfigOption('foreground')) return fn.mkPen(self._textPen) def setTextPen(self, *args, **kwargs): """ Set the pen used for drawing text. If no arguments are given, the default foreground color will be used. """ self.picture = None if args or kwargs: self._textPen = fn.mkPen(*args, **kwargs) else: self._textPen = fn.mkPen(getConfigOption('foreground')) self.labelStyle['color'] = self._textPen.color().name() # #RRGGBB self._updateLabel() def tickPen(self): if self._tickPen is None: return self.pen() # Default to the main pen else: return fn.mkPen(self._tickPen) def setTickPen(self, *args, **kwargs): """ Set the pen used for drawing tick marks. If no arguments are given, the default pen will be used. """ self.picture = None if args or kwargs: self._tickPen = fn.mkPen(*args, **kwargs) else: self._tickPen = None self._updateLabel() def setScale(self, scale=None): """ Set the value scaling for this axis. Setting this value causes the axis to draw ticks and tick labels as if the view coordinate system were scaled. By default, the axis scaling is 1.0. """ if scale != self.scale: self.scale = scale self._updateLabel() def enableAutoSIPrefix(self, enable=True): """ Enable (or disable) automatic SI prefix scaling on this axis. When enabled, this feature automatically determines the best SI prefix to prepend to the label units, while ensuring that axis values are scaled accordingly. For example, if the axis spans values from -0.1 to 0.1 and has units set to 'V' then the axis would display values -100 to 100 and the units would appear as 'mV' This feature is enabled by default, and is only available when a suffix (unit string) is provided to display on the label. """ self.autoSIPrefix = enable self.updateAutoSIPrefix() def updateAutoSIPrefix(self): if self.label.isVisible(): if self.logMode: _range = 10**np.array(self.range) else: _range = self.range (scale, prefix) = fn.siScale(max(abs(_range[0]*self.scale), abs(_range[1]*self.scale))) if self.labelUnits == '' and prefix in ['k', 'm']: ## If we are not showing units, wait until 1e6 before scaling. scale = 1.0 prefix = '' self.autoSIPrefixScale = scale self.labelUnitPrefix = prefix else: self.autoSIPrefixScale = 1.0 self._updateLabel() def setRange(self, mn, mx): """Set the range of values displayed by the axis. Usually this is handled automatically by linking the axis to a ViewBox with :func:`linkToView `""" if not isfinite(mn) or not isfinite(mx): raise Exception("Not setting range to [%s, %s]" % (str(mn), str(mx))) self.range = [mn, mx] if self.autoSIPrefix: # XXX: Will already update once! self.updateAutoSIPrefix() else: self.picture = None self.update() def linkedView(self): """Return the ViewBox this axis is linked to.""" if self._linkedView is None: return None else: return self._linkedView() def _linkToView_internal(self, view): # We need this code to be available without override, # even though DateAxisItem overrides the user-side linkToView method self.unlinkFromView() self._linkedView = weakref.ref(view) if self.orientation in ['right', 'left']: view.sigYRangeChanged.connect(self.linkedViewChanged) else: view.sigXRangeChanged.connect(self.linkedViewChanged) view.sigResized.connect(self.linkedViewChanged) def linkToView(self, view): """Link this axis to a ViewBox, causing its displayed range to match the visible range of the view.""" self._linkToView_internal(view) def unlinkFromView(self): """Unlink this axis from a ViewBox.""" oldView = self.linkedView() self._linkedView = None if self.orientation in ['right', 'left']: if oldView is not None: oldView.sigYRangeChanged.disconnect(self.linkedViewChanged) else: if oldView is not None: oldView.sigXRangeChanged.disconnect(self.linkedViewChanged) if oldView is not None: oldView.sigResized.disconnect(self.linkedViewChanged) def linkedViewChanged(self, view, newRange=None): if self.orientation in ['right', 'left']: if newRange is None: newRange = view.viewRange()[1] if view.yInverted(): self.setRange(*newRange[::-1]) else: self.setRange(*newRange) else: if newRange is None: newRange = view.viewRange()[0] if view.xInverted(): self.setRange(*newRange[::-1]) else: self.setRange(*newRange) def boundingRect(self): m = 0 hide_overlapping_labels = self.style['hideOverlappingLabels'] if hide_overlapping_labels is True: pass # skip further checks elif hide_overlapping_labels is False: m = 15 else: try: m = int( self.style['hideOverlappingLabels'] ) except ValueError: pass # ignore any non-numeric value linkedView = self.linkedView() if linkedView is None or self.grid is False: rect = self.mapRectFromParent(self.geometry()) ## extend rect if ticks go in negative direction ## also extend to account for text that flows past the edges tl = self.style['tickLength'] if self.orientation == 'left': rect = rect.adjusted(0, -m, -min(0,tl), m) elif self.orientation == 'right': rect = rect.adjusted(min(0,tl), -m, 0, m) elif self.orientation == 'top': rect = rect.adjusted(-m, 0, m, -min(0,tl)) elif self.orientation == 'bottom': rect = rect.adjusted(-m, min(0,tl), m, 0) return rect else: return self.mapRectFromParent(self.geometry()) | linkedView.mapRectToItem(self, linkedView.boundingRect()) def paint(self, p, opt, widget): profiler = debug.Profiler() if self.picture is None: try: picture = QtGui.QPicture() painter = QtGui.QPainter(picture) if self.style["tickFont"]: painter.setFont(self.style["tickFont"]) specs = self.generateDrawSpecs(painter) profiler('generate specs') if specs is not None: self.drawPicture(painter, *specs) profiler('draw picture') finally: painter.end() self.picture = picture #p.setRenderHint(p.RenderHint.Antialiasing, False) ## Sometimes we get a segfault here ??? #p.setRenderHint(p.RenderHint.TextAntialiasing, True) self.picture.play(p) def setTickDensity(self, density=1.0): """ The default behavior is to show at least two major ticks for axes of up to 300 pixels in length, then add additional major ticks, spacing them out further as the available room increases. (Internally, the targeted number of major ticks grows with the square root of the axes length.) Setting a tick density different from the default value of `density = 1.0` scales the number of major ticks that is targeted for display. This only affects the automatic generation of ticks. """ self._tickDensity = density self.picture = None self.update() def setTicks(self, ticks): """Explicitly determine which ticks to display. This overrides the behavior specified by tickSpacing(), tickValues(), and tickStrings() The format for *ticks* looks like:: [ [ (majorTickValue1, majorTickString1), (majorTickValue2, majorTickString2), ... ], [ (minorTickValue1, minorTickString1), (minorTickValue2, minorTickString2), ... ], ... ] The two levels of major and minor ticks are expected. A third tier of additional ticks is optional. If *ticks* is None, then the default tick system will be used instead. """ self._tickLevels = ticks self.picture = None self.update() def setTickSpacing(self, major=None, minor=None, levels=None): """ Explicitly determine the spacing of major and minor ticks. This overrides the default behavior of the tickSpacing method, and disables the effect of setTicks(). Arguments may be either *major* and *minor*, or *levels* which is a list of (spacing, offset) tuples for each tick level desired. If no arguments are given, then the default behavior of tickSpacing is enabled. Examples:: # two levels, all offsets = 0 axis.setTickSpacing(5, 1) # three levels, all offsets = 0 axis.setTickSpacing(levels=[(3, 0), (1, 0), (0.25, 0)]) # reset to default axis.setTickSpacing() """ if levels is None: if major is None: levels = None else: levels = [(major, 0), (minor, 0)] self._tickSpacing = levels self.picture = None self.update() def tickSpacing(self, minVal, maxVal, size): """Return values describing the desired spacing and offset of ticks. This method is called whenever the axis needs to be redrawn and is a good method to override in subclasses that require control over tick locations. The return value must be a list of tuples, one for each set of ticks:: [ (major tick spacing, offset), (minor tick spacing, offset), (sub-minor tick spacing, offset), ... ] """ # First check for override tick spacing if self._tickSpacing is not None: return self._tickSpacing dif = abs(maxVal - minVal) if dif == 0: return [] ref_size = 300. # axes longer than this display more than the minimum number of major ticks minNumberOfIntervals = max( 2.25, # 2.0 ensures two tick marks. Fudged increase to 2.25 allows room for tick labels. 2.25 * self._tickDensity * sqrt(size/ref_size) # sub-linear growth of tick spacing with size ) majorMaxSpacing = dif / minNumberOfIntervals # We want to calculate the power of 10 just below the maximum spacing. # Then divide by ten so that the scale factors for subdivision all become intergers. # p10unit = 10**( floor( log10(majorMaxSpacing) ) ) / 10 # And we want to do it without a log operation: mantissa, exp2 = frexp(majorMaxSpacing) # IEEE 754 float already knows its exponent, no need to calculate p10unit = 10. ** ( # approximate a power of ten base factor just smaller than the given number floor( # int would truncate towards zero to give wrong results for negative exponents (exp2-1) # IEEE 754 exponent is ceiling of true exponent --> estimate floor by subtracting 1 / 3.32192809488736 # division by log2(10)=3.32 converts base 2 exponent to base 10 exponent ) - 1 # subtract one extra power of ten so that we can work with integer scale factors >= 5 ) # neglecting the mantissa can underestimate by one power of 10 when the true value is JUST above the threshold. if 100. * p10unit <= majorMaxSpacing: # Cheaper to check this than to use a more complicated approximation. majorScaleFactor = 10 p10unit *= 10. else: for majorScaleFactor in (50, 20, 10): if majorScaleFactor * p10unit <= majorMaxSpacing: break # find the first value that is smaller or equal majorInterval = majorScaleFactor * p10unit # manual sanity check: print(f"{majorMaxSpacing:.2e} > {majorInterval:.2e} = {majorScaleFactor:.2e} x {p10unit:.2e}") minorMinSpacing = 2 * dif/size # no more than one minor tick per two pixels if majorScaleFactor == 10: trials = (5, 10) # if major interval is 1.0, try minor interval of 0.5, fall back to same as major interval else: trials = (10, 20, 50) # if major interval is 2.0 or 5.0, try minor interval of 1.0, increase as needed for minorScaleFactor in trials: minorInterval = minorScaleFactor * p10unit if minorInterval >= minorMinSpacing: break # find the first value that is larger or equal to allowed minimum of 1 per 2px levels = [ (majorInterval, 0), (minorInterval, 0) ] # extra ticks at 10% of major interval are pretty, but eat up CPU if self.style['maxTickLevel'] >= 2: # consider only when enabled if majorScaleFactor == 10: trials = (1, 2, 5, 10) # start at 10% of major interval, increase if needed elif majorScaleFactor == 20: trials = (2, 5, 10, 20) # start at 10% of major interval, increase if needed elif majorScaleFactor == 50: trials = (5, 10, 50) # start at 10% of major interval, increase if needed else: # invalid value trials = () # skip extra interval extraInterval = minorInterval for extraScaleFactor in trials: extraInterval = extraScaleFactor * p10unit if extraInterval >= minorMinSpacing or extraInterval == minorInterval: break # find the first value that is larger or equal to allowed minimum of 1 per 2px if extraInterval < minorInterval: # add extra interval only if it is visible levels.append((extraInterval, 0)) return levels def tickValues(self, minVal, maxVal, size): """ Return the values and spacing of ticks to draw:: [ (spacing, [major ticks]), (spacing, [minor ticks]), ... ] By default, this method calls tickSpacing to determine the correct tick locations. This is a good method to override in subclasses. """ minVal, maxVal = sorted((minVal, maxVal)) minVal *= self.scale maxVal *= self.scale #size *= self.scale ticks = [] tickLevels = self.tickSpacing(minVal, maxVal, size) allValues = np.array([]) for i in range(len(tickLevels)): spacing, offset = tickLevels[i] ## determine starting tick start = (ceil((minVal-offset) / spacing) * spacing) + offset ## determine number of ticks num = int((maxVal-start) / spacing) + 1 values = (np.arange(num) * spacing + start) / self.scale ## remove any ticks that were present in higher levels ## we assume here that if the difference between a tick value and a previously seen tick value ## is less than spacing/100, then they are 'equal' and we can ignore the new tick. close = np.any( np.isclose(allValues, values[:, np.newaxis], rtol=0, atol=spacing/self.scale*0.01) , axis=-1 ) values = values[~close] allValues = np.concatenate([allValues, values]) ticks.append((spacing/self.scale, values.tolist())) if self.logMode: return self.logTickValues(minVal, maxVal, size, ticks) #nticks = [] #for t in ticks: #nvals = [] #for v in t[1]: #nvals.append(v/self.scale) #nticks.append((t[0]/self.scale,nvals)) #ticks = nticks return ticks def logTickValues(self, minVal, maxVal, size, stdTicks): ## start with the tick spacing given by tickValues(). ## Any level whose spacing is < 1 needs to be converted to log scale ticks = [] for (spacing, t) in stdTicks: if spacing >= 1.0: ticks.append((spacing, t)) if len(ticks) < 3: v1 = int(floor(minVal)) v2 = int(ceil(maxVal)) #major = list(range(v1+1, v2)) minor = [] for v in range(v1, v2): minor.extend(v + np.log10(np.arange(1, 10))) minor = [x for x in minor if x>minVal and x= 10000: vstr = "%g" % vs else: vstr = ("%%0.%df" % places) % vs strings.append(vstr) return strings def logTickStrings(self, values, scale, spacing): estrings = ["%0.1g"%x for x in 10 ** np.array(values).astype(float) * np.array(scale)] convdict = {"0": "â°", "1": "¹", "2": "²", "3": "³", "4": "â´", "5": "âµ", "6": "â¶", "7": "â·", "8": "â¸", "9": "â¹", } dstrings = [] for e in estrings: if e.count("e"): v, p = e.split("e") sign = "â»" if p[0] == "-" else "" pot = "".join([convdict[pp] for pp in p[1:].lstrip("0")]) if v == "1": v = "" else: v = v + "·" dstrings.append(v + "10" + sign + pot) else: dstrings.append(e) return dstrings def generateDrawSpecs(self, p): """ Calls tickValues() and tickStrings() to determine where and how ticks should be drawn, then generates from this a set of drawing commands to be interpreted by drawPicture(). """ profiler = debug.Profiler() if self.style['tickFont'] is not None: p.setFont(self.style['tickFont']) bounds = self.mapRectFromParent(self.geometry()) linkedView = self.linkedView() if linkedView is None or self.grid is False: tickBounds = bounds else: tickBounds = linkedView.mapRectToItem(self, linkedView.boundingRect()) left_offset = -1.0 right_offset = 1.0 top_offset = -1.0 bottom_offset = 1.0 if self.orientation == 'left': span = (bounds.topRight() + Point(left_offset, top_offset), bounds.bottomRight() + Point(left_offset, bottom_offset)) tickStart = tickBounds.right() tickStop = bounds.right() tickDir = -1 axis = 0 elif self.orientation == 'right': span = (bounds.topLeft() + Point(right_offset, top_offset), bounds.bottomLeft() + Point(right_offset, bottom_offset)) tickStart = tickBounds.left() tickStop = bounds.left() tickDir = 1 axis = 0 elif self.orientation == 'top': span = (bounds.bottomLeft() + Point(left_offset, top_offset), bounds.bottomRight() + Point(right_offset, top_offset)) tickStart = tickBounds.bottom() tickStop = bounds.bottom() tickDir = -1 axis = 1 elif self.orientation == 'bottom': span = (bounds.topLeft() + Point(left_offset, bottom_offset), bounds.topRight() + Point(right_offset, bottom_offset)) tickStart = tickBounds.top() tickStop = bounds.top() tickDir = 1 axis = 1 else: raise ValueError("self.orientation must be in ('left', 'right', 'top', 'bottom')") #print tickStart, tickStop, span ## determine size of this item in pixels points = list(map(self.mapToDevice, span)) if None in points: return lengthInPixels = Point(points[1] - points[0]).length() if lengthInPixels == 0: return # Determine major / minor / subminor axis ticks if self._tickLevels is None: tickLevels = self.tickValues(self.range[0], self.range[1], lengthInPixels) tickStrings = None else: ## parse self.tickLevels into the formats returned by tickLevels() and tickStrings() tickLevels = [] tickStrings = [] for level in self._tickLevels: values = [] strings = [] tickLevels.append((None, values)) tickStrings.append(strings) for val, strn in level: values.append(val) strings.append(strn) ## determine mapping between tick values and local coordinates dif = self.range[1] - self.range[0] if dif == 0: xScale = 1 offset = 0 else: if axis == 0: xScale = -bounds.height() / dif offset = self.range[0] * xScale - bounds.height() else: xScale = bounds.width() / dif offset = self.range[0] * xScale xRange = [x * xScale - offset for x in self.range] xMin = min(xRange) xMax = max(xRange) profiler('init') tickPositions = [] # remembers positions of previously drawn ticks ## compute coordinates to draw ticks ## draw three different intervals, long ticks first tickSpecs = [] for i in range(len(tickLevels)): tickPositions.append([]) ticks = tickLevels[i][1] ## length of tick tickLength = self.style['tickLength'] / ((i*0.5)+1.0) lineAlpha = self.style["tickAlpha"] if lineAlpha is None: lineAlpha = 255 / (i+1) if self.grid is not False: lineAlpha *= self.grid/255. * fn.clip_scalar((0.05 * lengthInPixels / (len(ticks)+1)), 0., 1.) elif isinstance(lineAlpha, float): lineAlpha *= 255 lineAlpha = max(0, int(round(lineAlpha))) lineAlpha = min(255, int(round(lineAlpha))) elif isinstance(lineAlpha, int): if (lineAlpha > 255) or (lineAlpha < 0): raise ValueError("lineAlpha should be [0..255]") else: raise TypeError("Line Alpha should be of type None, float or int") tickPen = self.tickPen() if tickPen.brush().style() == QtCore.Qt.BrushStyle.SolidPattern: # only adjust simple color pens tickPen = QtGui.QPen(tickPen) # copy to a new QPen color = QtGui.QColor(tickPen.color()) # copy to a new QColor color.setAlpha(int(lineAlpha)) # adjust opacity tickPen.setColor(color) for v in ticks: ## determine actual position to draw this tick x = (v * xScale) - offset if x < xMin or x > xMax: ## last check to make sure no out-of-bounds ticks are drawn tickPositions[i].append(None) continue tickPositions[i].append(x) p1 = [x, x] p2 = [x, x] p1[axis] = tickStart p2[axis] = tickStop if self.grid is False: p2[axis] += tickLength*tickDir tickSpecs.append((tickPen, Point(p1), Point(p2))) profiler('compute ticks') if self.style['stopAxisAtTick'][0] is True: minTickPosition = min(map(min, tickPositions)) if axis == 0: stop = max(span[0].y(), minTickPosition) span[0].setY(stop) else: stop = max(span[0].x(), minTickPosition) span[0].setX(stop) if self.style['stopAxisAtTick'][1] is True: maxTickPosition = max(map(max, tickPositions)) if axis == 0: stop = min(span[1].y(), maxTickPosition) span[1].setY(stop) else: stop = min(span[1].x(), maxTickPosition) span[1].setX(stop) axisSpec = (self.pen(), span[0], span[1]) textOffset = self.style['tickTextOffset'][axis] ## spacing between axis and text #if self.style['autoExpandTextSpace'] is True: #textWidth = self.textWidth #textHeight = self.textHeight #else: #textWidth = self.style['tickTextWidth'] ## space allocated for horizontal text #textHeight = self.style['tickTextHeight'] ## space allocated for horizontal text textSize2 = 0 lastTextSize2 = 0 textRects = [] textSpecs = [] ## list of draw # If values are hidden, return early if not self.style['showValues']: return (axisSpec, tickSpecs, textSpecs) for i in range(min(len(tickLevels), self.style['maxTextLevel']+1)): ## Get the list of strings to display for this level if tickStrings is None: spacing, values = tickLevels[i] strings = self.tickStrings(values, self.autoSIPrefixScale * self.scale, spacing) else: strings = tickStrings[i] if len(strings) == 0: continue ## ignore strings belonging to ticks that were previously ignored for j in range(len(strings)): if tickPositions[i][j] is None: strings[j] = None ## Measure density of text; decide whether to draw this level rects = [] for s in strings: if s is None: rects.append(None) else: br = p.boundingRect(QtCore.QRectF(0, 0, 100, 100), QtCore.Qt.AlignmentFlag.AlignCenter, s) ## boundingRect is usually just a bit too large ## (but this probably depends on per-font metrics?) br.setHeight(br.height() * 0.8) rects.append(br) textRects.append(rects[-1]) if len(textRects) > 0: ## measure all text, make sure there's enough room if axis == 0: textSize = np.sum([r.height() for r in textRects]) textSize2 = np.max([r.width() for r in textRects]) else: textSize = np.sum([r.width() for r in textRects]) textSize2 = np.max([r.height() for r in textRects]) else: textSize = 0 textSize2 = 0 if i > 0: ## always draw top level ## If the strings are too crowded, stop drawing text now. ## We use three different crowding limits based on the number ## of texts drawn so far. textFillRatio = float(textSize) / lengthInPixels finished = False for nTexts, limit in self.style['textFillLimits']: if len(textSpecs) >= nTexts and textFillRatio >= limit: finished = True break if finished: break lastTextSize2 = textSize2 #spacing, values = tickLevels[best] #strings = self.tickStrings(values, self.scale, spacing) # Determine exactly where tick text should be drawn for j in range(len(strings)): vstr = strings[j] if vstr is None: ## this tick was ignored because it is out of bounds continue x = tickPositions[i][j] #textRect = p.boundingRect(QtCore.QRectF(0, 0, 100, 100), QtCore.Qt.AlignmentFlag.AlignCenter, vstr) textRect = rects[j] height = textRect.height() width = textRect.width() #self.textHeight = height offset = max(0,self.style['tickLength']) + textOffset rect = QtCore.QRectF() if self.orientation == 'left': alignFlags = QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignVCenter rect = QtCore.QRectF(tickStop-offset-width, x-(height/2), width, height) elif self.orientation == 'right': alignFlags = QtCore.Qt.AlignmentFlag.AlignLeft|QtCore.Qt.AlignmentFlag.AlignVCenter rect = QtCore.QRectF(tickStop+offset, x-(height/2), width, height) elif self.orientation == 'top': alignFlags = QtCore.Qt.AlignmentFlag.AlignHCenter|QtCore.Qt.AlignmentFlag.AlignBottom rect = QtCore.QRectF(x-width/2., tickStop-offset-height, width, height) elif self.orientation == 'bottom': alignFlags = QtCore.Qt.AlignmentFlag.AlignHCenter|QtCore.Qt.AlignmentFlag.AlignTop rect = QtCore.QRectF(x-width/2., tickStop+offset, width, height) textFlags = alignFlags | QtCore.Qt.TextFlag.TextDontClip #p.setPen(self.pen()) #p.drawText(rect, textFlags, vstr) br = self.boundingRect() if not br.contains(rect): continue textSpecs.append((rect, textFlags, vstr)) profiler('compute text') ## update max text size if needed. self._updateMaxTextSize(lastTextSize2) return (axisSpec, tickSpecs, textSpecs) def drawPicture(self, p, axisSpec, tickSpecs, textSpecs): profiler = debug.Profiler() p.setRenderHint(p.RenderHint.Antialiasing, False) p.setRenderHint(p.RenderHint.TextAntialiasing, True) ## draw long line along axis pen, p1, p2 = axisSpec p.setPen(pen) p.drawLine(p1, p2) # p.translate(0.5,0) ## resolves some damn pixel ambiguity ## draw ticks for pen, p1, p2 in tickSpecs: p.setPen(pen) p.drawLine(p1, p2) profiler('draw ticks') # Draw all text if self.style['tickFont'] is not None: p.setFont(self.style['tickFont']) p.setPen(self.textPen()) bounding = self.boundingRect().toAlignedRect() p.setClipRect(bounding) for rect, flags, text in textSpecs: p.drawText(rect, int(flags), text) profiler('draw text') def show(self): GraphicsWidget.show(self) if self.orientation in ['left', 'right']: self._updateWidth() else: self._updateHeight() def hide(self): GraphicsWidget.hide(self) if self.orientation in ['left', 'right']: self._updateWidth() else: self._updateHeight() def wheelEvent(self, event): lv = self.linkedView() if lv is None: return # Did the event occur inside the linked ViewBox (and not over the axis iteself)? if lv.sceneBoundingRect().contains(event.scenePos()): event.ignore() return else: # pass event to linked viewbox with appropriate single axis zoom parameter if self.orientation in ['left', 'right']: lv.wheelEvent(event, axis=1) else: lv.wheelEvent(event, axis=0) event.accept() def mouseDragEvent(self, event): lv = self.linkedView() if lv is None: return # Did the mouse down event occur inside the linked ViewBox (and not the axis)? if lv.sceneBoundingRect().contains(event.buttonDownScenePos()): event.ignore() return # otherwise pass event to linked viewbox with appropriate single axis parameter if self.orientation in ['left', 'right']: return lv.mouseDragEvent(event, axis=1) else: return lv.mouseDragEvent(event, axis=0) def mouseClickEvent(self, event): lv = self.linkedView() if lv is None: return return lv.mouseClickEvent(event) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/BarGraphItem.py000066400000000000000000000230461457240071200253420ustar00rootroot00000000000000import numpy as np from .. import functions as fn from .. import getConfigOption from .. import Qt from ..Qt import QtCore, QtGui from .GraphicsObject import GraphicsObject __all__ = ['BarGraphItem'] class BarGraphItem(GraphicsObject): def __init__(self, **opts): """ Valid keyword options are: x, x0, x1, y, y0, y1, width, height, pen, brush x specifies the x-position of the center of the bar. x0, x1 specify left and right edges of the bar, respectively. width specifies distance from x0 to x1. You may specify any combination: x, width x0, width x1, width x0, x1 Likewise y, y0, y1, and height. If only height is specified, then y0 will be set to 0 Example uses: BarGraphItem(x=range(5), height=[1,5,2,4,3], width=0.5) """ GraphicsObject.__init__(self) self.opts = dict( x=None, y=None, x0=None, y0=None, x1=None, y1=None, name=None, height=None, width=None, pen=None, brush=None, pens=None, brushes=None, ) if 'pen' not in opts: opts['pen'] = getConfigOption('foreground') if 'brush' not in opts: opts['brush'] = (128, 128, 128) # the first call to _updateColors() will thus always be an update self._rectarray = Qt.internals.PrimitiveArray(QtCore.QRectF, 4) self._shape = None self.picture = None self.setOpts(**opts) def setOpts(self, **opts): self.opts.update(opts) self.picture = None self._shape = None self._prepareData() self._updateColors(opts) self.prepareGeometryChange() self.update() self.informViewBoundsChanged() def _updatePenWidth(self, pen): no_pen = pen is None or pen.style() == QtCore.Qt.PenStyle.NoPen if no_pen: return idx = pen.isCosmetic() self._penWidth[idx] = max(self._penWidth[idx], pen.widthF()) def _updateColors(self, opts): # the logic here is to permit the user to update only data # without updating pens/brushes # update only if fresh pen/pens supplied if 'pen' in opts or 'pens' in opts: self._penWidth = [0, 0] if self.opts['pens'] is None: # pens not configured, use single pen pen = self.opts['pen'] pen = fn.mkPen(pen) self._updatePenWidth(pen) self._sharedPen = pen self._pens = None else: # pens configured, ignore single pen (if any) pens = [] for pen in self.opts['pens']: if not isinstance(pen, QtGui.QPen): pen = fn.mkPen(pen) pens.append(pen) self._updatePenWidth(pen) self._sharedPen = None self._pens = pens # update only if fresh brush/brushes supplied if 'brush' in opts or 'brushes' in opts: if self.opts['brushes'] is None: # brushes not configured, use single brush brush = self.opts['brush'] self._sharedBrush = fn.mkBrush(brush) self._brushes = None else: # brushes configured, ignore single brush (if any) brushes = [] for brush in self.opts['brushes']: if not isinstance(brush, QtGui.QBrush): brush = fn.mkBrush(brush) brushes.append(brush) self._sharedBrush = None self._brushes = brushes self._singleColor = ( self._sharedPen is not None and self._sharedBrush is not None ) def _getNormalizedCoords(self): def asarray(x): if x is None or np.isscalar(x) or isinstance(x, np.ndarray): return x return np.array(x) x = asarray(self.opts.get('x')) x0 = asarray(self.opts.get('x0')) x1 = asarray(self.opts.get('x1')) width = asarray(self.opts.get('width')) if x0 is None: if width is None: raise Exception('must specify either x0 or width') if x1 is not None: x0 = x1 - width elif x is not None: x0 = x - width/2. else: raise Exception('must specify at least one of x, x0, or x1') if width is None: if x1 is None: raise Exception('must specify either x1 or width') width = x1 - x0 y = asarray(self.opts.get('y')) y0 = asarray(self.opts.get('y0')) y1 = asarray(self.opts.get('y1')) height = asarray(self.opts.get('height')) if y0 is None: if height is None: y0 = 0 elif y1 is not None: y0 = y1 - height elif y is not None: y0 = y - height/2. else: y0 = 0 if height is None: if y1 is None: raise Exception('must specify either y1 or height') height = y1 - y0 # ensure x0 < x1 and y0 < y1 t0, t1 = x0, x0 + width x0 = np.minimum(t0, t1, dtype=np.float64) x1 = np.maximum(t0, t1, dtype=np.float64) t0, t1 = y0, y0 + height y0 = np.minimum(t0, t1, dtype=np.float64) y1 = np.maximum(t0, t1, dtype=np.float64) # here, all of x0, y0, x1, y1 are numpy objects, # BUT could possibly be numpy scalars return x0, y0, x1, y1 def _prepareData(self): x0, y0, x1, y1 = self._getNormalizedCoords() if x0.size == 0 or y0.size == 0: self._dataBounds = (None, None), (None, None) self._rectarray.resize(0) return xmn, xmx = np.min(x0), np.max(x1) ymn, ymx = np.min(y0), np.max(y1) self._dataBounds = (xmn, xmx), (ymn, ymx) self._rectarray.resize(max(x0.size, y0.size)) memory = self._rectarray.ndarray() memory[:, 0] = x0 memory[:, 1] = y0 memory[:, 2] = x1 - x0 memory[:, 3] = y1 - y0 def _render(self, painter): multi_pen = self._pens is not None multi_brush = self._brushes is not None no_pen = ( not multi_pen and self._sharedPen.style() == QtCore.Qt.PenStyle.NoPen ) rects = self._rectarray.instances() if no_pen and multi_brush: for idx, rect in enumerate(rects): painter.fillRect(rect, self._brushes[idx]) else: if not multi_pen: painter.setPen(self._sharedPen) if not multi_brush: painter.setBrush(self._sharedBrush) for idx, rect in enumerate(rects): if multi_pen: painter.setPen(self._pens[idx]) if multi_brush: painter.setBrush(self._brushes[idx]) painter.drawRect(rect) def drawPicture(self): self.picture = QtGui.QPicture() painter = QtGui.QPainter(self.picture) self._render(painter) painter.end() def paint(self, p, *args): if self._singleColor: p.setPen(self._sharedPen) p.setBrush(self._sharedBrush) drawargs = self._rectarray.drawargs() p.drawRects(*drawargs) else: if self.picture is None: self.drawPicture() self.picture.play(p) def shape(self): if self._shape is None: shape = QtGui.QPainterPath() rects = self._rectarray.instances() for rect in rects: shape.addRect(rect) self._shape = shape return self._shape def implements(self, interface=None): ints = ['plotData'] if interface is None: return ints return interface in ints def name(self): return self.opts.get('name', None) def getData(self): return self.opts.get('x'), self.opts.get('height') def dataBounds(self, ax, frac=1.0, orthoRange=None): # _penWidth is available after _updateColors() pw = self._penWidth[0] * 0.5 # _dataBounds is available after _prepareData() bounds = self._dataBounds[ax] if bounds[0] is None or bounds[1] is None: return None, None return (bounds[0] - pw, bounds[1] + pw) def pixelPadding(self): # _penWidth is available after _updateColors() pw = (self._penWidth[1] or 1) * 0.5 return pw def boundingRect(self): xmn, xmx = self.dataBounds(ax=0) if xmn is None or xmx is None: return QtCore.QRectF() ymn, ymx = self.dataBounds(ax=1) if ymn is None or ymx is None: return QtCore.QRectF() px = py = 0 pxPad = self.pixelPadding() if pxPad > 0: # determine length of pixel in local x, y directions px, py = self.pixelVectors() px = 0 if px is None else px.length() py = 0 if py is None else py.length() # return bounds expanded by pixel size px *= pxPad py *= pxPad return QtCore.QRectF(xmn-px, ymn-py, (2*px)+xmx-xmn, (2*py)+ymx-ymn) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ButtonItem.py000066400000000000000000000034251457240071200251260ustar00rootroot00000000000000from ..Qt import QtCore, QtGui from .GraphicsObject import GraphicsObject __all__ = ['ButtonItem'] class ButtonItem(GraphicsObject): """Button graphicsItem displaying an image.""" clicked = QtCore.Signal(object) def __init__(self, imageFile=None, width=None, parentItem=None, pixmap=None): self.enabled = True GraphicsObject.__init__(self) if imageFile is not None: self.setImageFile(imageFile) elif pixmap is not None: self.setPixmap(pixmap) self._width = width if self._width is None: self._width = self.pixmap.width() / self.pixmap.devicePixelRatio() if parentItem is not None: self.setParentItem(parentItem) self.setOpacity(0.7) def setImageFile(self, imageFile): self.setPixmap(QtGui.QPixmap(imageFile)) def setPixmap(self, pixmap): self.pixmap = pixmap self.update() def mouseClickEvent(self, ev): if self.enabled: self.clicked.emit(self) def hoverEvent(self, ev): if not self.enabled: return if ev.isEnter(): self.setOpacity(1.0) elif ev.isExit(): self.setOpacity(0.7) def disable(self): self.enabled = False self.setOpacity(0.4) def enable(self): self.enabled = True self.setOpacity(0.7) def paint(self, p, *args): p.setRenderHint(p.RenderHint.Antialiasing) tgtRect = QtCore.QRectF(0, 0, self._width, self._width) srcRect = QtCore.QRectF(self.pixmap.rect()) p.drawPixmap(tgtRect, self.pixmap, srcRect) def boundingRect(self): return QtCore.QRectF(0, 0, self._width, self._width) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ColorBarItem.py000066400000000000000000000407621457240071200253630ustar00rootroot00000000000000import math import weakref import numpy as np from .. import colormap from .. import functions as fn from ..Qt import QtCore, QtGui, QtWidgets from .LinearRegionItem import LinearRegionItem from .PlotItem import PlotItem __all__ = ['ColorBarItem'] class ColorBarItem(PlotItem): """ **Bases:** :class:`PlotItem ` :class:`ColorBarItem` controls the application of a :ref:`color map ` to one (or more) :class:`~pyqtgraph.ImageItem`. It is a simpler, compact alternative to :class:`~pyqtgraph.HistogramLUTItem`, without histogram or the option to adjust the colors of the look-up table. A labeled axis is displayed directly next to the gradient to help identify values. Handles included in the color bar allow for interactive adjustment. A ColorBarItem can be assigned one or more :class:`~pyqtgraph.ImageItem` s that will be displayed according to the selected color map and levels. The ColorBarItem can be used as a separate element in a :class:`~pyqtgraph.GraphicsLayout` or added to the layout of a :class:`~pyqtgraph.PlotItem` used to display image data with coordinate axes. ============================= ============================================= **Signals:** sigLevelsChanged(self) Emitted when the range sliders are moved sigLevelsChangeFinished(self) Emitted when the range sliders are released ============================= ============================================= """ sigLevelsChanged = QtCore.Signal(object) sigLevelsChangeFinished = QtCore.Signal(object) def __init__(self, values=None, width=25, colorMap=None, label=None, interactive=True, limits=None, rounding=1, orientation='vertical', pen='w', hoverPen='r', hoverBrush='#FF000080' ): """ Creates a new ColorBarItem. Parameters ---------- colorMap: `str` or :class:`~pyqtgraph.ColorMap` Determines the color map displayed and applied to assigned ImageItem(s). values: tuple of float, optional The range of values that will be represented by the color bar, as ``(min, max)``. If no values are supplied, the default is to use user-specified values from an assigned image. If that does not exist, values will default to (0,1). width: float, default=25.0 The width of the displayed color bar. label: str, optional Label applied to the color bar axis. interactive: bool, default=True If `True`, handles are displayed to interactively adjust the level range. limits: `tuple of float`, optional Limits the adjustment range to `(low, high)`, `None` disables the limit. rounding: float, default=1 Adjusted range values are rounded to multiples of this value. orientation: str, default 'vertical' 'horizontal' or 'h' gives a horizontal color bar instead of the default vertical bar pen: :class:`QPen` or color_like Sets the color of adjustment handles in interactive mode. hoverPen: :class:`QPen` or color_like Sets the color of adjustment handles when hovered over. hoverBrush: :class:`QBrush` or color_like Sets the color of movable center region when hovered over. """ super().__init__() self.img_list = [] # list of controlled ImageItems self._actively_adjusted_values = False if values is None: # Use default values # NOTE: User-specified values from the assigned item will be preferred over the default values of ColorBarItem values = (0,1) else: # The user explicitly entered values, prefer these over values from assigned image. self._actively_adjusted_values = True self.values = values self._colorMap = None self.rounding = rounding self.horizontal = bool( orientation in ('h', 'horizontal') ) self.lo_prv, self.hi_prv = self.values # remember previous values while adjusting range self.lo_lim = None self.hi_lim = None if limits is not None: self.lo_lim, self.hi_lim = limits # slightly expand the limits to match the rounding steps: if self.lo_lim is not None: self.lo_lim = self.rounding * math.floor( self.lo_lim/self.rounding ) if self.hi_lim is not None: self.hi_lim = self.rounding * math.ceil( self.hi_lim/self.rounding ) self.disableAutoRange() self.hideButtons() self.setMouseEnabled(x=False, y=False) self.setMenuEnabled( False) if self.horizontal: self.setRange( xRange=(0,256), yRange=(0,1), padding=0 ) self.layout.setRowFixedHeight(2, width) else: self.setRange( xRange=(0,1), yRange=(0,256), padding=0 ) self.layout.setColumnFixedWidth(1, width) # width of color bar for key in ['left','right','top','bottom']: self.showAxis(key) axis = self.getAxis(key) axis.setZValue(0.5) # select main axis: if self.horizontal and key == 'bottom': self.axis = axis elif not self.horizontal and key == 'right': self.axis = axis self.axis.setWidth(45) else: # show other axes to create frame axis.setTicks( [] ) axis.setStyle( showValues=False ) self.axis.setStyle( showValues=True ) self.axis.unlinkFromView() self.axis.setRange( self.values[0], self.values[1] ) if self.horizontal: if label is not None: self.getAxis('bottom').setLabel(label) else: if label is not None: self.getAxis('left').setLabel(label) self.bar = QtWidgets.QGraphicsPixmapItem() self.bar.setShapeMode(self.bar.ShapeMode.BoundingRectShape) self.addItem(self.bar) if colorMap is not None: self.setColorMap(colorMap) self.interactive = interactive if interactive: if self.horizontal: align = 'vertical' else: align = 'horizontal' self.region = LinearRegionItem( [63, 191], align, swapMode='block', # span=(0.15, 0.85), # limited span looks better, but disables grabbing the region pen=pen, brush=fn.mkBrush(None), hoverPen=hoverPen, hoverBrush=hoverBrush ) self.region.setZValue(1000) self.region.lines[0].addMarker('<|>', size=6) self.region.lines[1].addMarker('<|>', size=6) self.region.sigRegionChanged.connect(self._regionChanging) self.region.sigRegionChangeFinished.connect(self._regionChanged) self.addItem(self.region) self.region_changed_enable = True self.region.setRegion( (63, 191) ) # place handles at 25% and 75% locations else: self.region = None self.region_changed_enable = False def setImageItem(self, img, insert_in=None): """ Assigns an item or list of items to be represented and controlled. Supported "image items": class:`~pyqtgraph.ImageItem`, class:`~pyqtgraph.PColorMeshItem` Parameters ---------- image: :class:`~pyqtgraph.ImageItem` or list of :class:`~pyqtgraph.ImageItem` Assigns one or more image items to this ColorBarItem. If a :class:`~pyqtgraph.ColorMap` is defined for ColorBarItem, this will be assigned to the ImageItems. Otherwise, the ColorBarItem will attempt to retrieve a color map from the image items. In interactive mode, ColorBarItem will control the levels of the assigned image items, simultaneously if there is more than one. If the ColorBarItem was initialized without a specified ``values`` parameter, it will attempt to retrieve a set of user-defined ``levels`` from one of the image items. If this fails, the default values of ColorBarItem will be used as the (min, max) levels of the colorbar. Note that, for non-interactive ColorBarItems, levels may be overridden by image items with auto-scaling colors (defined by ``enableAutoLevels``). When using an interactive ColorBarItem in an animated plot, auto-scaling for its assigned image items should be *manually* disabled. insert_in: :class:`~pyqtgraph.PlotItem`, optional If a PlotItem is given, the color bar is inserted on the right or bottom of the plot, depending on the specified orientation. """ try: self.img_list = [ weakref.ref(item) for item in img ] except TypeError: # failed to iterate, make a single-item list self.img_list = [ weakref.ref( img ) ] colormap_is_undefined = self._colorMap is None for img_weakref in self.img_list: img = img_weakref() if img is not None: if hasattr(img, "sigLevelsChanged"): img.sigLevelsChanged.connect(self._levelsChangedHandler) if colormap_is_undefined and hasattr(img, 'getColorMap'): # check if one of the assigned images has a defined color map img_cm = img.getColorMap() if img_cm is not None: self._colorMap = img_cm colormap_is_undefined = False if not self._actively_adjusted_values: # check if one of the assigned images has a non-default set of levels if hasattr(img, 'getLevels'): img_levels = img.getLevels() if img_levels is not None: self.setLevels(img_levels, update_items=False) if insert_in is not None: if self.horizontal: insert_in.layout.addItem( self, 5, 1 ) # insert in layout below bottom axis insert_in.layout.setRowFixedHeight(4, 10) # enforce some space to axis above else: insert_in.layout.addItem( self, 2, 5 ) # insert in layout after right-hand axis insert_in.layout.setColumnFixedWidth(4, 5) # enforce some space to axis on the left self._update_items( update_cmap = True ) def setColorMap(self, colorMap): """ Sets a color map to determine the ColorBarItem's look-up table. The same look-up table is applied to any assigned ImageItem. `colorMap` can be a :class:`~pyqtgraph.ColorMap` or a string argument that is passed to :func:`colormap.get() `. """ if isinstance(colorMap, str): colorMap = colormap.get(colorMap) self._colorMap = colorMap self._update_items( update_cmap = True ) def colorMap(self): """ Returns the assigned ColorMap object. """ return self._colorMap def setLevels(self, values=None, low=None, high=None, update_items=True): """ Sets the displayed range of image levels. Parameters ---------- values: tuple of float Specifies levels as tuple ``(low, high)``. Either value can be `None` to leave the previous value unchanged. Takes precedence over `low` and `high` parameters. low: float Applies a new low level to color bar and assigned images high: float Applies a new high level to color bar and assigned images """ if values is not None: # values setting takes precendence low, high = values lo_new, hi_new = low, high lo_cur, hi_cur = self.values # allow None values to preserve original values: if lo_new is None: lo_new = lo_cur if hi_new is None: hi_new = hi_cur if lo_new > hi_new: # prevent reversal lo_new = hi_new = (lo_new + hi_new) / 2 # clip to limits if set: if self.lo_lim is not None and lo_new < self.lo_lim: lo_new = self.lo_lim if self.hi_lim is not None and hi_new > self.hi_lim: hi_new = self.hi_lim self.values = self.lo_prv, self.hi_prv = (lo_new, hi_new) if update_items: self._update_items() else: # update color bar only: self.axis.setRange( self.values[0], self.values[1] ) def levels(self): """ Returns the currently set levels as the tuple ``(low, high)``. """ return self.values def _update_items(self, update_cmap=False): """ internal: update color maps for bar and assigned ImageItems """ # update color bar: self.axis.setRange( self.values[0], self.values[1] ) if update_cmap and self._colorMap is not None: lut = self._colorMap.getLookupTable(nPts=256, alpha=True) lut = np.expand_dims(lut, axis=0 if self.horizontal else 1) qimg = fn.ndarray_to_qimage(lut, QtGui.QImage.Format.Format_RGBA8888) self.bar.setPixmap(QtGui.QPixmap.fromImage(qimg)) # update assigned ImageItems, too: for img_weakref in self.img_list: img = img_weakref() if img is None: continue # dereference weakref img.setLevels( self.values ) # (min,max) tuple if update_cmap and self._colorMap is not None: img.setColorMap(self._colorMap) def _levelsChangedHandler(self, levels): """ internal: called when child item for some reason decides to update its levels without using ColorBarItem. Will update colormap for the bar based on child items new levels """ if levels != self.values: self.setLevels(levels, update_items=False) def _regionChanged(self): """ internal: snap adjusters back to default positions on release """ self.lo_prv, self.hi_prv = self.values self.region_changed_enable = False # otherwise this affects the region again self.region.setRegion( (63, 191) ) self.region_changed_enable = True self.sigLevelsChangeFinished.emit(self) def _regionChanging(self): """ internal: recalculate levels based on new position of adjusters """ if not self.region_changed_enable: return bot, top = self.region.getRegion() bot = ( (bot - 63) / 64 ) # -1 to +1 over half-bar range top = ( (top - 191) / 64 ) # -1 to +1 over half-bar range bot = math.copysign( bot**2, bot ) # quadratic behaviour for sensitivity to small changes top = math.copysign( top**2, top ) # These are the new values if adjuster is released now, rate of change depends on original separation span_prv = self.hi_prv - self.lo_prv # previous span of values hi_new = self.hi_prv + (span_prv + 2*self.rounding) * top # make sure that we can always lo_new = self.lo_prv + (span_prv + 2*self.rounding) * bot # reach 2x the minimal step # Alternative model with speed depending on level magnitude: # mean_val = abs(self.lo_prv) + abs(self.hi_prv) / 2 # hi_new = self.hi_prv + (mean_val + 2*self.rounding) * top # make sure that we can always # lo_new = self.lo_prv + (mean_val + 2*self.rounding) * bot # reach 2x the minimal step if self.hi_lim is not None: if hi_new > self.hi_lim: # limit maximum value hi_new = self.hi_lim if top!=0 and bot!=0: # moving entire region? lo_new = hi_new - span_prv # avoid collapsing the span against top limit if self.lo_lim is not None: if lo_new < self.lo_lim: # limit minimum value lo_new = self.lo_lim if top!=0 and bot!=0: # moving entire region? hi_new = lo_new + span_prv # avoid collapsing the span against bottom limit if hi_new-lo_new < self.rounding: # do not allow less than one "rounding" unit of span if bot == 0: hi_new = lo_new + self.rounding elif top == 0: lo_new = hi_new - self.rounding else: # this should never happen, but let's try to recover if it does: mid = (hi_new + lo_new) / 2 hi_new = mid + self.rounding / 2 lo_new = mid - self.rounding / 2 lo_new = self.rounding * round( lo_new/self.rounding ) hi_new = self.rounding * round( hi_new/self.rounding ) self.values = (lo_new, hi_new) self._update_items() self.sigLevelsChanged.emit(self) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/CurvePoint.py000066400000000000000000000111211457240071200251220ustar00rootroot00000000000000import weakref from math import atan2, degrees from ..functions import clip_scalar from ..Qt import QtCore, QtWidgets from . import ArrowItem from .GraphicsObject import GraphicsObject __all__ = ['CurvePoint', 'CurveArrow'] class CurvePoint(GraphicsObject): """A GraphicsItem that sets its location to a point on a PlotCurveItem. Also rotates to be tangent to the curve. The position along the curve is a Qt property, and thus can be easily animated. Note: This class does not display anything; see CurveArrow for an applied example """ def __init__(self, curve, index=0, pos=None, rotate=True): """Position can be set either as an index referring to the sample number or the position 0.0 - 1.0 If *rotate* is True, then the item rotates to match the tangent of the curve. """ GraphicsObject.__init__(self) #QObjectWorkaround.__init__(self) self._rotate = rotate self.curve = weakref.ref(curve) self.setParentItem(curve) self.setProperty('position', 0.0) self.setProperty('index', 0) self.setFlags(self.flags() | self.GraphicsItemFlag.ItemHasNoContents) if pos is not None: self.setPos(pos) else: self.setIndex(index) def setPos(self, pos): self.setProperty('position', float(pos))## cannot use numpy types here, MUST be python float. def setIndex(self, index): self.setProperty('index', int(index)) ## cannot use numpy types here, MUST be python int. def event(self, ev): if not isinstance(ev, QtCore.QDynamicPropertyChangeEvent) or self.curve() is None: return False if ev.propertyName() == 'index': index = self.property('index') if 'QVariant' in repr(index): index = index.toInt()[0] elif ev.propertyName() == 'position': index = None else: return False (x, y) = self.curve().getData() if index is None: #print ev.propertyName(), self.property('position').toDouble()[0], self.property('position').typeName() pos = self.property('position') if 'QVariant' in repr(pos): ## need to support 2 APIs :( pos = pos.toDouble()[0] index = (len(x)-1) * clip_scalar(pos, 0.0, 1.0) if index != int(index): ## interpolate floating-point values i1 = int(index) i2 = clip_scalar(i1+1, 0, len(x)-1) s2 = index-i1 s1 = 1.0-s2 newPos = (x[i1]*s1+x[i2]*s2, y[i1]*s1+y[i2]*s2) else: index = int(index) i1 = clip_scalar(index-1, 0, len(x)-1) i2 = clip_scalar(index+1, 0, len(x)-1) newPos = (x[index], y[index]) p1 = self.parentItem().mapToScene(QtCore.QPointF(x[i1], y[i1])) p2 = self.parentItem().mapToScene(QtCore.QPointF(x[i2], y[i2])) rads = atan2(p2.y()-p1.y(), p2.x()-p1.x()) ## returns radians self.resetTransform() if self._rotate: self.setRotation(180 + degrees(rads)) QtWidgets.QGraphicsItem.setPos(self, *newPos) return True def boundingRect(self): return QtCore.QRectF() def paint(self, *args): pass def makeAnimation(self, prop='position', start=0.0, end=1.0, duration=10000, loop=1): # In Python 3, a bytes object needs to be used as a property name in # QPropertyAnimation. PyQt stopped automatically encoding a str when a # QByteArray was expected in v5.5 (see qbytearray.sip). if not isinstance(prop, bytes): prop = prop.encode('latin-1') anim = QtCore.QPropertyAnimation(self, prop) anim.setDuration(duration) anim.setStartValue(start) anim.setEndValue(end) anim.setLoopCount(loop) return anim class CurveArrow(CurvePoint): """Provides an arrow that points to any specific sample on a PlotCurveItem. Provides properties that can be animated.""" def __init__(self, curve, index=0, pos=None, **opts): CurvePoint.__init__(self, curve, index=index, pos=pos) if opts.get('pxMode', True): opts['pxMode'] = False self.setFlags(self.flags() | self.GraphicsItemFlag.ItemIgnoresTransformations) opts['angle'] = 0 self.arrow = ArrowItem.ArrowItem(**opts) self.arrow.setParentItem(self) def setStyle(self, **opts): return self.arrow.setStyle(**opts) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/DateAxisItem.py000066400000000000000000000323401457240071200253530ustar00rootroot00000000000000import sys import time from collections import OrderedDict from datetime import datetime, timedelta, timezone import numpy as np from .AxisItem import AxisItem __all__ = ['DateAxisItem'] MS_SPACING = 1/1000.0 SECOND_SPACING = 1 MINUTE_SPACING = 60 HOUR_SPACING = 3600 DAY_SPACING = 24 * HOUR_SPACING WEEK_SPACING = 7 * DAY_SPACING MONTH_SPACING = 30 * DAY_SPACING YEAR_SPACING = 365 * DAY_SPACING if sys.platform == 'win32': _epoch = datetime.fromtimestamp(0, timezone.utc) def utcfromtimestamp(timestamp): return _epoch + timedelta(seconds=timestamp) else: def utcfromtimestamp(timestamp): return datetime.fromtimestamp(timestamp, timezone.utc) MIN_REGULAR_TIMESTAMP = (datetime(1, 1, 1) - datetime(1970,1,1)).total_seconds() MAX_REGULAR_TIMESTAMP = (datetime(9999, 1, 1) - datetime(1970,1,1)).total_seconds() SEC_PER_YEAR = 365.25*24*3600 # The stepper functions provide # 'first' == True: The first tick value for 'val' being the minimum of the current view. # 'first' == False: The next tick value for 'val' being the previous tick value. def makeMSStepper(stepSize): def stepper(val, n, first: bool): if val < MIN_REGULAR_TIMESTAMP or val > MAX_REGULAR_TIMESTAMP: return np.inf if first: val *= 1000 f = stepSize * 1000 return (val // (n * f) + 1) * (n * f) / 1000.0 else: return val + n * stepSize return stepper def makeSStepper(stepSize): def stepper(val, n, first: bool): if val < MIN_REGULAR_TIMESTAMP or val > MAX_REGULAR_TIMESTAMP: return np.inf if first: return (val // (n * stepSize) + 1) * (n * stepSize) else: return val + n * stepSize return stepper def makeMStepper(stepSize): def stepper(val, n, first: bool): if val < MIN_REGULAR_TIMESTAMP or val > MAX_REGULAR_TIMESTAMP: return np.inf d = utcfromtimestamp(val) base0m = d.month + n * stepSize - 1 d = datetime(d.year + base0m // 12, base0m % 12 + 1, 1) return (d - datetime(1970, 1, 1)).total_seconds() return stepper def makeYStepper(stepSize): def stepper(val, n, first: bool): if val < MIN_REGULAR_TIMESTAMP or val > MAX_REGULAR_TIMESTAMP: return np.inf d = utcfromtimestamp(val) next_year = (d.year // (n * stepSize) + 1) * (n * stepSize) if next_year > 9999: return np.inf next_date = datetime(next_year, 1, 1) return (next_date - datetime(1970, 1, 1)).total_seconds() return stepper class TickSpec: """ Specifies the properties for a set of date ticks and computes ticks within a given utc timestamp range """ def __init__(self, spacing, stepper, format, autoSkip=None): """ ============= ========================================================== Arguments spacing approximate (average) tick spacing stepper a stepper function that takes a utc time stamp and a step steps number n to compute the start of the next unit. You can use the make_X_stepper functions to create common steppers. format a strftime compatible format string which will be used to convert tick locations to date/time strings autoSkip list of step size multipliers to be applied when the tick density becomes too high. The tick spec automatically applies additional powers of 10 (10, 100, ...) to the list if necessary. Set to None to switch autoSkip off ============= ========================================================== """ self.spacing = spacing self.step = stepper self.format = format self.autoSkip = autoSkip def makeTicks(self, minVal, maxVal, minSpc): ticks = [] n = self.skipFactor(minSpc) x = self.step(minVal, n, first=True) while x <= maxVal: ticks.append(x) x = self.step(x, n, first=False) return (np.array(ticks), n) def skipFactor(self, minSpc): if self.autoSkip is None or minSpc < self.spacing: return 1 factors = np.array(self.autoSkip, dtype=np.float64) while True: for f in factors: spc = self.spacing * f if spc > minSpc: return int(f) factors *= 10 class ZoomLevel: """ Generates the ticks which appear in a specific zoom level """ def __init__(self, tickSpecs, exampleText): """ ============= ========================================================== tickSpecs a list of one or more TickSpec objects with decreasing coarseness ============= ========================================================== """ self.tickSpecs = tickSpecs self.utcOffset = 0 self.exampleText = exampleText def tickValues(self, minVal, maxVal, minSpc): # return tick values for this format in the range minVal, maxVal # the return value is a list of tuples (, [tick positions]) # minSpc indicates the minimum spacing (in seconds) between two ticks # to fullfill the maxTicksPerPt constraint of the DateAxisItem at the # current zoom level. This is used for auto skipping ticks. allTicks = np.array([]) valueSpecs = [] # back-project (minVal maxVal) to UTC, compute ticks then offset to # back to local time again utcMin = minVal - self.utcOffset utcMax = maxVal - self.utcOffset for spec in self.tickSpecs: ticks, skipFactor = spec.makeTicks(utcMin, utcMax, minSpc) # reposition tick labels to local time coordinates ticks += self.utcOffset # remove any ticks that were present in higher levels # we assume here that if the difference between a tick value and a previously seen tick value # is less than min-spacing/100, then they are 'equal' and we can ignore the new tick. close = np.any( np.isclose(allTicks, ticks[:, np.newaxis], rtol=0, atol=minSpc * 0.01), axis=-1, ) ticks = ticks[~close] allTicks = np.concatenate([allTicks, ticks]) valueSpecs.append((spec.spacing, ticks.tolist())) # if we're skipping ticks on the current level there's no point in # producing lower level ticks if skipFactor > 1: break return valueSpecs YEAR_MONTH_ZOOM_LEVEL = ZoomLevel([ TickSpec(YEAR_SPACING, makeYStepper(1), '%Y', autoSkip=[1, 5, 10, 25]), TickSpec(MONTH_SPACING, makeMStepper(1), '%b') ], "YYYY") MONTH_DAY_ZOOM_LEVEL = ZoomLevel([ TickSpec(MONTH_SPACING, makeMStepper(1), '%b'), TickSpec(DAY_SPACING, makeSStepper(DAY_SPACING), '%d', autoSkip=[1, 5]) ], "MMM") DAY_HOUR_ZOOM_LEVEL = ZoomLevel([ TickSpec(DAY_SPACING, makeSStepper(DAY_SPACING), '%a %d'), TickSpec(HOUR_SPACING, makeSStepper(HOUR_SPACING), '%H:%M', autoSkip=[1, 6]) ], "MMM 00") HOUR_MINUTE_ZOOM_LEVEL = ZoomLevel([ TickSpec(DAY_SPACING, makeSStepper(DAY_SPACING), '%a %d'), TickSpec(MINUTE_SPACING, makeSStepper(MINUTE_SPACING), '%H:%M', autoSkip=[1, 5, 15]) ], "MMM 00") HMS_ZOOM_LEVEL = ZoomLevel([ TickSpec(SECOND_SPACING, makeSStepper(SECOND_SPACING), '%H:%M:%S', autoSkip=[1, 5, 15, 30]) ], "99:99:99") MS_ZOOM_LEVEL = ZoomLevel([ TickSpec(MINUTE_SPACING, makeSStepper(MINUTE_SPACING), '%H:%M:%S'), TickSpec(MS_SPACING, makeMSStepper(MS_SPACING), '%S.%f', autoSkip=[1, 5, 10, 25]) ], "99:99:99") def getOffsetFromUtc(): """Retrieve the utc offset respecting the daylight saving time""" ts = time.localtime() if ts.tm_isdst: utc_offset = time.altzone else: utc_offset = time.timezone return utc_offset class DateAxisItem(AxisItem): """ **Bases:** :class:`AxisItem ` An AxisItem that displays dates from unix timestamps. The display format is adjusted automatically depending on the current time density (seconds/point) on the axis. For more details on changing this behaviour, see :func:`setZoomLevelForDensity() `. Can be added to an existing plot e.g. via :func:`setAxisItems({'bottom':axis}) `. """ def __init__(self, orientation='bottom', utcOffset=None, **kwargs): """ Create a new DateAxisItem. For `orientation` and `**kwargs`, see :func:`AxisItem.__init__ `. """ super(DateAxisItem, self).__init__(orientation, **kwargs) # Set the zoom level to use depending on the time density on the axis if utcOffset is None: utcOffset = getOffsetFromUtc() self.utcOffset = utcOffset self.zoomLevels = OrderedDict([ (np.inf, YEAR_MONTH_ZOOM_LEVEL), (5 * 3600*24, MONTH_DAY_ZOOM_LEVEL), (6 * 3600, DAY_HOUR_ZOOM_LEVEL), (15 * 60, HOUR_MINUTE_ZOOM_LEVEL), (30, HMS_ZOOM_LEVEL), (1, MS_ZOOM_LEVEL), ]) self.autoSIPrefix = False def tickStrings(self, values, scale, spacing): tickSpecs = self.zoomLevel.tickSpecs tickSpec = next((s for s in tickSpecs if s.spacing == spacing), None) try: dates = [utcfromtimestamp(v - self.utcOffset) for v in values] except (OverflowError, ValueError, OSError): # should not normally happen return ['%g' % ((v-self.utcOffset)//SEC_PER_YEAR + 1970) for v in values] formatStrings = [] for x in dates: try: s = x.strftime(tickSpec.format) if '%f' in tickSpec.format: # we only support ms precision s = s[:-3] elif '%Y' in tickSpec.format: s = s.lstrip('0') formatStrings.append(s) except ValueError: # Windows can't handle dates before 1970 formatStrings.append('') return formatStrings def tickValues(self, minVal, maxVal, size): density = (maxVal - minVal) / size self.setZoomLevelForDensity(density) values = self.zoomLevel.tickValues(minVal, maxVal, minSpc=self.minSpacing) return values def setZoomLevelForDensity(self, density): """ Setting `zoomLevel` and `minSpacing` based on given density of seconds per pixel The display format is adjusted automatically depending on the current time density (seconds/point) on the axis. You can customize the behaviour by overriding this function or setting a different set of zoom levels than the default one. The `zoomLevels` variable is a dictionary with the maximal distance of ticks in seconds which are allowed for each zoom level before the axis switches to the next coarser level. To customize the zoom level selection, override this function. """ padding = 10 # Size in pixels a specific tick label will take if self.orientation in ['bottom', 'top']: def sizeOf(text): return self.fontMetrics.boundingRect(text).width() + padding else: def sizeOf(text): return self.fontMetrics.boundingRect(text).height() + padding # Fallback zoom level: Years/Months self.zoomLevel = YEAR_MONTH_ZOOM_LEVEL for maximalSpacing, zoomLevel in self.zoomLevels.items(): size = sizeOf(zoomLevel.exampleText) # Test if zoom level is too fine grained if maximalSpacing/size < density: break self.zoomLevel = zoomLevel # Set up zoomLevel self.zoomLevel.utcOffset = self.utcOffset # Calculate minimal spacing of items on the axis size = sizeOf(self.zoomLevel.exampleText) self.minSpacing = density*size def linkToView(self, view): """Link this axis to a ViewBox, causing its displayed range to match the visible range of the view.""" self._linkToView_internal(view) # calls original linkToView code # Set default limits _min = MIN_REGULAR_TIMESTAMP _max = MAX_REGULAR_TIMESTAMP if self.orientation in ['right', 'left']: view.setLimits(yMin=_min, yMax=_max) else: view.setLimits(xMin=_min, xMax=_max) def generateDrawSpecs(self, p): # Get font metrics from QPainter # Not happening in "paint", as the QPainter p there is a different one from the one here, # so changing that font could cause unwanted side effects if self.style['tickFont'] is not None: p.setFont(self.style['tickFont']) self.fontMetrics = p.fontMetrics() # Get font scale factor by current window resolution return super(DateAxisItem, self).generateDrawSpecs(p) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ErrorBarItem.py000066400000000000000000000125401457240071200253670ustar00rootroot00000000000000from .. import functions as fn from .. import getConfigOption from ..Qt import QtGui from .GraphicsObject import GraphicsObject __all__ = ['ErrorBarItem'] class ErrorBarItem(GraphicsObject): def __init__(self, **opts): """ All keyword arguments are passed to setData(). """ GraphicsObject.__init__(self) self.opts = dict( x=None, y=None, height=None, width=None, top=None, bottom=None, left=None, right=None, beam=None, pen=None ) self.setVisible(False) self.setData(**opts) def setData(self, **opts): """ Update the data in the item. All arguments are optional. Valid keyword options are: x, y, height, width, top, bottom, left, right, beam, pen * x and y must be numpy arrays specifying the coordinates of data points. * height, width, top, bottom, left, right, and beam may be numpy arrays, single values, or None to disable. All values should be positive. * top, bottom, left, and right specify the lengths of bars extending in each direction. * If height is specified, it overrides top and bottom. * If width is specified, it overrides left and right. * beam specifies the width of the beam at the end of each bar. * pen may be any single argument accepted by pg.mkPen(). This method was added in version 0.9.9. For prior versions, use setOpts. """ self.opts.update(opts) self.setVisible(all(self.opts[ax] is not None for ax in ['x', 'y'])) self.path = None self.update() self.prepareGeometryChange() self.informViewBoundsChanged() def setOpts(self, **opts): # for backward compatibility self.setData(**opts) def drawPath(self): p = QtGui.QPainterPath() x, y = self.opts['x'], self.opts['y'] if x is None or y is None: self.path = p return beam = self.opts['beam'] height, top, bottom = self.opts['height'], self.opts['top'], self.opts['bottom'] if height is not None or top is not None or bottom is not None: ## draw vertical error bars if height is not None: y1 = y - height/2. y2 = y + height/2. else: if bottom is None: y1 = y else: y1 = y - bottom if top is None: y2 = y else: y2 = y + top xs = fn.interweaveArrays(x, x) y1_y2 = fn.interweaveArrays(y1, y2) verticalLines = fn.arrayToQPath(xs, y1_y2, connect="pairs") p.addPath(verticalLines) if beam is not None and beam > 0: x1 = x - beam/2. x2 = x + beam/2. x1_x2 = fn.interweaveArrays(x1, x2) if height is not None or top is not None: y2s = fn.interweaveArrays(y2, y2) topEnds = fn.arrayToQPath(x1_x2, y2s, connect="pairs") p.addPath(topEnds) if height is not None or bottom is not None: y1s = fn.interweaveArrays(y1, y1) bottomEnds = fn.arrayToQPath(x1_x2, y1s, connect="pairs") p.addPath(bottomEnds) width, right, left = self.opts['width'], self.opts['right'], self.opts['left'] if width is not None or right is not None or left is not None: ## draw vertical error bars if width is not None: x1 = x - width/2. x2 = x + width/2. else: if left is None: x1 = x else: x1 = x - left if right is None: x2 = x else: x2 = x + right ys = fn.interweaveArrays(y, y) x1_x2 = fn.interweaveArrays(x1, x2) ends = fn.arrayToQPath(x1_x2, ys, connect='pairs') p.addPath(ends) if beam is not None and beam > 0: y1 = y - beam/2. y2 = y + beam/2. y1_y2 = fn.interweaveArrays(y1, y2) if width is not None or right is not None: x2s = fn.interweaveArrays(x2, x2) rightEnds = fn.arrayToQPath(x2s, y1_y2, connect="pairs") p.addPath(rightEnds) if width is not None or left is not None: x1s = fn.interweaveArrays(x1, x1) leftEnds = fn.arrayToQPath(x1s, y1_y2, connect="pairs") p.addPath(leftEnds) self.path = p self.prepareGeometryChange() def paint(self, p, *args): if self.path is None: self.drawPath() pen = self.opts['pen'] if pen is None: pen = getConfigOption('foreground') p.setPen(fn.mkPen(pen)) p.drawPath(self.path) def boundingRect(self): if self.path is None: self.drawPath() return self.path.boundingRect() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/FillBetweenItem.py000066400000000000000000000055101457240071200260500ustar00rootroot00000000000000from .. import functions as fn from ..Qt import QtGui, QtWidgets from .PlotCurveItem import PlotCurveItem from .PlotDataItem import PlotDataItem __all__ = ['FillBetweenItem'] class FillBetweenItem(QtWidgets.QGraphicsPathItem): """ GraphicsItem filling the space between two PlotDataItems. """ def __init__(self, curve1=None, curve2=None, brush=None, pen=None): QtWidgets.QGraphicsPathItem.__init__(self) self.curves = None if curve1 is not None and curve2 is not None: self.setCurves(curve1, curve2) elif curve1 is not None or curve2 is not None: raise Exception("Must specify two curves to fill between.") if brush is not None: self.setBrush(brush) self.setPen(pen) self.updatePath() def setBrush(self, *args, **kwds): """Change the fill brush. Acceps the same arguments as pg.mkBrush()""" QtWidgets.QGraphicsPathItem.setBrush(self, fn.mkBrush(*args, **kwds)) def setPen(self, *args, **kwds): QtWidgets.QGraphicsPathItem.setPen(self, fn.mkPen(*args, **kwds)) def setCurves(self, curve1, curve2): """Set the curves to fill between. Arguments must be instances of PlotDataItem or PlotCurveItem. Added in version 0.9.9 """ if self.curves is not None: for c in self.curves: try: c.sigPlotChanged.disconnect(self.curveChanged) except (TypeError, RuntimeError): pass curves = [curve1, curve2] for c in curves: if not isinstance(c, PlotDataItem) and not isinstance(c, PlotCurveItem): raise TypeError("Curves must be PlotDataItem or PlotCurveItem.") self.curves = curves curve1.sigPlotChanged.connect(self.curveChanged) curve2.sigPlotChanged.connect(self.curveChanged) self.setZValue(min(curve1.zValue(), curve2.zValue())-1) self.curveChanged() def curveChanged(self): self.updatePath() def updatePath(self): if self.curves is None: self.setPath(QtGui.QPainterPath()) return paths = [] for c in self.curves: if isinstance(c, PlotDataItem): paths.append(c.curve.getPath()) elif isinstance(c, PlotCurveItem): paths.append(c.getPath()) path = QtGui.QPainterPath() transform = QtGui.QTransform() ps1 = paths[0].toSubpathPolygons(transform) ps2 = paths[1].toReversed().toSubpathPolygons(transform) ps2.reverse() if len(ps1) == 0 or len(ps2) == 0: self.setPath(QtGui.QPainterPath()) return for p1, p2 in zip(ps1, ps2): path.addPolygon(p1 + p2) self.setPath(path) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/GradientEditorItem.py000066400000000000000000001127431457240071200265630ustar00rootroot00000000000000import operator import weakref import numpy as np from .. import functions as fn from .. import colormap from ..colormap import ColorMap from ..Qt import QtCore, QtGui, QtWidgets from ..widgets.SpinBox import SpinBox from ..widgets.ColorMapButton import ColorMapMenu from .GraphicsWidget import GraphicsWidget from .GradientPresets import Gradients translate = QtCore.QCoreApplication.translate __all__ = ['TickSliderItem', 'GradientEditorItem', 'addGradientListToDocstring'] def addGradientListToDocstring(): """Decorator to add list of current pre-defined gradients to the end of a function docstring.""" def dec(fn): if fn.__doc__ is not None: fn.__doc__ = fn.__doc__ + str(list(Gradients.keys())).strip('[').strip(']') return fn return dec class TickSliderItem(GraphicsWidget): ## public class """**Bases:** :class:`GraphicsWidget ` A rectangular item with tick marks along its length that can (optionally) be moved by the user.""" sigTicksChanged = QtCore.Signal(object) sigTicksChangeFinished = QtCore.Signal(object) def __init__(self, orientation='bottom', allowAdd=True, allowRemove=True, **kargs): """ ============== ================================================================================= **Arguments:** orientation Set the orientation of the gradient. Options are: 'left', 'right' 'top', and 'bottom'. allowAdd Specifies whether the user can add ticks. allowRemove Specifies whether the user can remove new ticks. tickPen Default is white. Specifies the color of the outline of the ticks. Can be any of the valid arguments for :func:`mkPen ` ============== ================================================================================= """ ## public GraphicsWidget.__init__(self) self.orientation = orientation self.length = 100 self.tickSize = 15 self.ticks = {} self.maxDim = 20 self.allowAdd = allowAdd self.allowRemove = allowRemove if 'tickPen' in kargs: self.tickPen = fn.mkPen(kargs['tickPen']) else: self.tickPen = fn.mkPen('w') self.orientations = { 'left': (90, 1, 1), 'right': (90, 1, 1), 'top': (0, 1, -1), 'bottom': (0, 1, 1) } self.setOrientation(orientation) #self.setFrameStyle(QtWidgets.QFrame.Shape.NoFrame | QtWidgets.QFrame.Shadow.Plain) #self.setBackgroundRole(QtGui.QPalette.ColorRole.NoRole) #self.setMouseTracking(True) #def boundingRect(self): #return self.mapRectFromParent(self.geometry()).normalized() #def shape(self): ## No idea why this is necessary, but rotated items do not receive clicks otherwise. #p = QtGui.QPainterPath() #p.addRect(self.boundingRect()) #return p def paint(self, p, opt, widget): #p.setPen(fn.mkPen('g', width=3)) #p.drawRect(self.boundingRect()) return def keyPressEvent(self, ev): ev.ignore() def setMaxDim(self, mx=None): if mx is None: mx = self.maxDim else: self.maxDim = mx if self.orientation in ['bottom', 'top']: self.setFixedHeight(mx) self.setMaximumWidth(16777215) else: self.setFixedWidth(mx) self.setMaximumHeight(16777215) def setOrientation(self, orientation): ## public """Set the orientation of the TickSliderItem. ============== =================================================================== **Arguments:** orientation Options are: 'left', 'right', 'top', 'bottom' The orientation option specifies which side of the slider the ticks are on, as well as whether the slider is vertical ('right' and 'left') or horizontal ('top' and 'bottom'). ============== =================================================================== """ self.orientation = orientation self.setMaxDim() self.resetTransform() ort = orientation if ort == 'top': transform = QtGui.QTransform.fromScale(1, -1) transform.translate(0, -self.height()) self.setTransform(transform) elif ort == 'left': transform = QtGui.QTransform() transform.rotate(270) transform.scale(1, -1) transform.translate(-self.height(), -self.maxDim) self.setTransform(transform) elif ort == 'right': transform = QtGui.QTransform() transform.rotate(270) transform.translate(-self.height(), 0) self.setTransform(transform) elif ort != 'bottom': raise Exception("%s is not a valid orientation. Options are 'left', 'right', 'top', and 'bottom'" %str(ort)) tr = QtGui.QTransform.fromTranslate(self.tickSize/2., 0) self.setTransform(tr, True) def addTick(self, x, color=None, movable=True, finish=True): ## public """ Add a tick to the item. ============== ================================================================== **Arguments:** x Position where tick should be added. color Color of added tick. If color is not specified, the color will be white. movable Specifies whether the tick is movable with the mouse. ============== ================================================================== """ if color is None: color = QtGui.QColor(255,255,255) tick = Tick([x*self.length, 0], color, movable, self.tickSize, pen=self.tickPen, removeAllowed=self.allowRemove) self.ticks[tick] = x tick.setParentItem(self) tick.sigMoving.connect(self.tickMoved) tick.sigMoved.connect(self.tickMoveFinished) tick.sigClicked.connect(self.tickClicked) self.sigTicksChanged.emit(self) if finish: self.sigTicksChangeFinished.emit(self) return tick def removeTick(self, tick, finish=True): ## public """ Removes the specified tick. """ del self.ticks[tick] tick.setParentItem(None) if self.scene() is not None: self.scene().removeItem(tick) self.sigTicksChanged.emit(self) if finish: self.sigTicksChangeFinished.emit(self) def tickMoved(self, tick, pos): #print "tick changed" ## Correct position of tick if it has left bounds. newX = min(max(0, pos.x()), self.length) pos.setX(newX) tick.setPos(pos) self.ticks[tick] = float(newX) / self.length self.sigTicksChanged.emit(self) def tickMoveFinished(self, tick): self.sigTicksChangeFinished.emit(self) def tickClicked(self, tick, ev): if ev.button() == QtCore.Qt.MouseButton.RightButton and tick.removeAllowed: self.removeTick(tick) def widgetLength(self): if self.orientation in ['bottom', 'top']: return self.width() else: return self.height() def resizeEvent(self, ev): wlen = max(40, self.widgetLength()) self.setLength(wlen-self.tickSize-2) self.setOrientation(self.orientation) #bounds = self.scene().itemsBoundingRect() #bounds.setLeft(min(-self.tickSize*0.5, bounds.left())) #bounds.setRight(max(self.length + self.tickSize, bounds.right())) #self.setSceneRect(bounds) #self.fitInView(bounds, QtCore.Qt.AspectRatioMode.KeepAspectRatio) def setLength(self, newLen): #private for t, x in list(self.ticks.items()): t.setPos(x * newLen + 1, t.pos().y()) self.length = float(newLen) #def mousePressEvent(self, ev): #QtWidgets.QGraphicsView.mousePressEvent(self, ev) #self.ignoreRelease = False #for i in self.items(ev.pos()): #if isinstance(i, Tick): #self.ignoreRelease = True #break ##if len(self.items(ev.pos())) > 0: ## Let items handle their own clicks ##self.ignoreRelease = True #def mouseReleaseEvent(self, ev): #QtWidgets.QGraphicsView.mouseReleaseEvent(self, ev) #if self.ignoreRelease: #return #pos = self.mapToScene(ev.pos()) #if ev.button() == QtCore.Qt.MouseButton.LeftButton and self.allowAdd: #if pos.x() < 0 or pos.x() > self.length: #return #if pos.y() < 0 or pos.y() > self.tickSize: #return #pos.setX(min(max(pos.x(), 0), self.length)) #self.addTick(pos.x()/self.length) #elif ev.button() == QtCore.Qt.MouseButton.RightButton: #self.showMenu(ev) def mouseClickEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.LeftButton and self.allowAdd: pos = ev.pos() if pos.x() < 0 or pos.x() > self.length: return if pos.y() < 0 or pos.y() > self.tickSize: return pos.setX(min(max(pos.x(), 0), self.length)) self.addTick(pos.x()/self.length) elif ev.button() == QtCore.Qt.MouseButton.RightButton: self.showMenu(ev) #if ev.button() == QtCore.Qt.MouseButton.RightButton: #if self.moving: #ev.accept() #self.setPos(self.startPosition) #self.moving = False #self.sigMoving.emit(self) #self.sigMoved.emit(self) #else: #pass #self.view().tickClicked(self, ev) ###remove def hoverEvent(self, ev): if (not ev.isExit()) and ev.acceptClicks(QtCore.Qt.MouseButton.LeftButton): ev.acceptClicks(QtCore.Qt.MouseButton.RightButton) ## show ghost tick #self.currentPen = fn.mkPen(255, 0,0) #else: #self.currentPen = self.pen #self.update() def showMenu(self, ev): pass def setTickColor(self, tick, color): """Set the color of the specified tick. ============== ================================================================== **Arguments:** tick Can be either an integer corresponding to the index of the tick or a Tick object. Ex: if you had a slider with 3 ticks and you wanted to change the middle tick, the index would be 1. color The color to make the tick. Can be any argument that is valid for :func:`mkBrush ` ============== ================================================================== """ tick = self.getTick(tick) tick.color = color tick.update() #tick.setBrush(QtGui.QBrush(QtGui.QColor(tick.color))) self.sigTicksChanged.emit(self) self.sigTicksChangeFinished.emit(self) def setTickValue(self, tick, val): ## public """ Set the position (along the slider) of the tick. ============== ================================================================== **Arguments:** tick Can be either an integer corresponding to the index of the tick or a Tick object. Ex: if you had a slider with 3 ticks and you wanted to change the middle tick, the index would be 1. val The desired position of the tick. If val is < 0, position will be set to 0. If val is > 1, position will be set to 1. ============== ================================================================== """ tick = self.getTick(tick) val = min(max(0.0, val), 1.0) x = val * self.length pos = tick.pos() pos.setX(x) tick.setPos(pos) self.ticks[tick] = val self.update() self.sigTicksChanged.emit(self) self.sigTicksChangeFinished.emit(self) def tickValue(self, tick): ## public """Return the value (from 0.0 to 1.0) of the specified tick. ============== ================================================================== **Arguments:** tick Can be either an integer corresponding to the index of the tick or a Tick object. Ex: if you had a slider with 3 ticks and you wanted the value of the middle tick, the index would be 1. ============== ================================================================== """ tick = self.getTick(tick) return self.ticks[tick] def getTick(self, tick): ## public """Return the Tick object at the specified index. ============== ================================================================== **Arguments:** tick An integer corresponding to the index of the desired tick. If the argument is not an integer it will be returned unchanged. ============== ================================================================== """ if type(tick) is int: tick = self.listTicks()[tick][0] return tick #def mouseMoveEvent(self, ev): #QtWidgets.QGraphicsView.mouseMoveEvent(self, ev) def listTicks(self): """Return a sorted list of all the Tick objects on the slider.""" ## public ticks = sorted(self.ticks.items(), key=operator.itemgetter(1)) return ticks class GradientEditorItem(TickSliderItem): """ **Bases:** :class:`TickSliderItem ` An item that can be used to define a color gradient. Implements common pre-defined gradients that are customizable by the user. :class: `GradientWidget ` provides a widget with a GradientEditorItem that can be added to a GUI. ================================ =========================================================== **Signals:** sigGradientChanged(self) Signal is emitted anytime the gradient changes. The signal is emitted in real time while ticks are being dragged or colors are being changed. sigGradientChangeFinished(self) Signal is emitted when the gradient is finished changing. ================================ =========================================================== """ sigGradientChanged = QtCore.Signal(object) sigGradientChangeFinished = QtCore.Signal(object) def __init__(self, *args, **kargs): """ Create a new GradientEditorItem. All arguments are passed to :func:`TickSliderItem.__init__ ` =============== ================================================================================= **Arguments:** orientation Set the orientation of the gradient. Options are: 'left', 'right' 'top', and 'bottom'. allowAdd Default is True. Specifies whether ticks can be added to the item. tickPen Default is white. Specifies the color of the outline of the ticks. Can be any of the valid arguments for :func:`mkPen ` =============== ================================================================================= """ self.currentTick = None self.currentTickColor = None self.rectSize = 15 self.gradRect = QtWidgets.QGraphicsRectItem(QtCore.QRectF(0, self.rectSize, 100, self.rectSize)) self.backgroundRect = QtWidgets.QGraphicsRectItem(QtCore.QRectF(0, -self.rectSize, 100, self.rectSize)) self.backgroundRect.setBrush(QtGui.QBrush(QtCore.Qt.BrushStyle.DiagCrossPattern)) self.colorMode = 'rgb' TickSliderItem.__init__(self, *args, **kargs) self.colorDialog = QtWidgets.QColorDialog() self.colorDialog.setOption(QtWidgets.QColorDialog.ColorDialogOption.ShowAlphaChannel, True) self.colorDialog.setOption(QtWidgets.QColorDialog.ColorDialogOption.DontUseNativeDialog, True) self.colorDialog.currentColorChanged.connect(self.currentColorChanged) self.colorDialog.rejected.connect(self.currentColorRejected) self.colorDialog.accepted.connect(self.currentColorAccepted) self.backgroundRect.setParentItem(self) self.gradRect.setParentItem(self) self.setMaxDim(self.rectSize + self.tickSize) self.rgbAction = QtGui.QAction(translate("GradiantEditorItem", 'RGB'), self) self.rgbAction.setCheckable(True) self.rgbAction.triggered.connect(self._setColorModeToRGB) self.hsvAction = QtGui.QAction(translate("GradiantEditorItem", 'HSV'), self) self.hsvAction.setCheckable(True) self.hsvAction.triggered.connect(self._setColorModeToHSV) self.menu = ColorMapMenu(showGradientSubMenu=True) self.menu.triggered.connect(self.contextMenuClicked) self.menu.addSeparator() self.menu.addAction(self.rgbAction) self.menu.addAction(self.hsvAction) for t in list(self.ticks.keys()): self.removeTick(t) self.addTick(0, QtGui.QColor(0,0,0), True) self.addTick(1, QtGui.QColor(255,0,0), True) self.setColorMode('rgb') self.updateGradient() self.linkedGradients = {} self.sigTicksChanged.connect(self._updateGradientIgnoreArgs) self.sigTicksChangeFinished.connect(self.sigGradientChangeFinished) def showTicks(self, show=True): for tick in self.ticks.keys(): if show: tick.show() orig = getattr(self, '_allowAdd_backup', None) if orig: self.allowAdd = orig else: self._allowAdd_backup = self.allowAdd self.allowAdd = False #block tick creation tick.hide() def setOrientation(self, orientation): ## public """ Set the orientation of the GradientEditorItem. ============== =================================================================== **Arguments:** orientation Options are: 'left', 'right', 'top', 'bottom' The orientation option specifies which side of the gradient the ticks are on, as well as whether the gradient is vertical ('right' and 'left') or horizontal ('top' and 'bottom'). ============== =================================================================== """ TickSliderItem.setOrientation(self, orientation) tr = QtGui.QTransform.fromTranslate(0, self.rectSize) self.setTransform(tr, True) def showMenu(self, ev): #private self.menu.popup(ev.screenPos().toQPoint()) def contextMenuClicked(self, action): #private # ignore the extra added on actions if action in [self.rgbAction, self.hsvAction]: return name, source = action.data() if source == 'preset-gradient': self.loadPreset(name) else: if name is None: cmap = colormap.ColorMap(None, [0.0, 1.0]) else: cmap = colormap.get(name, source=source) self.setColorMap(cmap) self.showTicks(False) @addGradientListToDocstring() def loadPreset(self, name): """ Load a predefined gradient. Currently defined gradients are: """## TODO: provide image with names of defined gradients #global Gradients self.restoreState(Gradients[name]) def setColorMode(self, cm): """ Set the color mode for the gradient. Options are: 'hsv', 'rgb' """ ## public if cm not in ['rgb', 'hsv']: raise Exception("Unknown color mode %s. Options are 'rgb' and 'hsv'." % str(cm)) try: self.rgbAction.blockSignals(True) self.hsvAction.blockSignals(True) self.rgbAction.setChecked(cm == 'rgb') self.hsvAction.setChecked(cm == 'hsv') finally: self.rgbAction.blockSignals(False) self.hsvAction.blockSignals(False) self.colorMode = cm self.sigTicksChanged.emit(self) self.sigGradientChangeFinished.emit(self) def _setColorModeToRGB(self): self.setColorMode("rgb") def _setColorModeToHSV(self): self.setColorMode("hsv") def colorMap(self): """Return a ColorMap object representing the current state of the editor.""" if self.colorMode == 'hsv': raise NotImplementedError('hsv colormaps not yet supported') pos = [] color = [] for t,x in self.listTicks(): pos.append(x) c = t.color color.append(c.getRgb()) return ColorMap(np.array(pos), np.array(color, dtype=np.ubyte)) def updateGradient(self): #private self.gradient = self.getGradient() self.gradRect.setBrush(QtGui.QBrush(self.gradient)) self.sigGradientChanged.emit(self) def _updateGradientIgnoreArgs(self, *args, **kwargs): self.updateGradient() def setLength(self, newLen): #private (but maybe public) TickSliderItem.setLength(self, newLen) self.backgroundRect.setRect(1, -self.rectSize, newLen, self.rectSize) self.gradRect.setRect(1, -self.rectSize, newLen, self.rectSize) self.sigTicksChanged.emit(self) def currentColorChanged(self, color): #private if color.isValid() and self.currentTick is not None: self.setTickColor(self.currentTick, color) def currentColorRejected(self): #private self.setTickColor(self.currentTick, self.currentTickColor) def currentColorAccepted(self): self.sigGradientChangeFinished.emit(self) def tickClicked(self, tick, ev): #private if ev.button() == QtCore.Qt.MouseButton.LeftButton: self.raiseColorDialog(tick) elif ev.button() == QtCore.Qt.MouseButton.RightButton: self.raiseTickContextMenu(tick, ev) def raiseColorDialog(self, tick): if not tick.colorChangeAllowed: return self.currentTick = tick self.currentTickColor = tick.color self.colorDialog.setCurrentColor(tick.color) self.colorDialog.open() def raiseTickContextMenu(self, tick, ev): self.tickMenu = TickMenu(tick, self) self.tickMenu.popup(ev.screenPos().toQPoint()) def tickMoveFinished(self, tick): self.sigGradientChangeFinished.emit(self) def getGradient(self): """Return a QLinearGradient object.""" g = QtGui.QLinearGradient(QtCore.QPointF(0,0), QtCore.QPointF(self.length,0)) if self.colorMode == 'rgb': ticks = self.listTicks() g.setStops([(x, QtGui.QColor(t.color)) for t,x in ticks]) elif self.colorMode == 'hsv': ## HSV mode is approximated for display by interpolating 10 points between each stop ticks = self.listTicks() stops = [] stops.append((ticks[0][1], ticks[0][0].color)) for i in range(1,len(ticks)): x1 = ticks[i-1][1] x2 = ticks[i][1] dx = (x2-x1) / 10. for j in range(1,10): x = x1 + dx*j stops.append((x, self.getColor(x))) stops.append((x2, self.getColor(x2))) g.setStops(stops) return g def getColor(self, x, toQColor=True): """ Return a color for a given value. ============== ================================================================== **Arguments:** x Value (position on gradient) of requested color. toQColor If true, returns a QColor object, else returns a (r,g,b,a) tuple. ============== ================================================================== """ ticks = self.listTicks() if x <= ticks[0][1]: c = ticks[0][0].color if toQColor: return QtGui.QColor(c) # always copy colors before handing them out else: return c.getRgb() if x >= ticks[-1][1]: c = ticks[-1][0].color if toQColor: return QtGui.QColor(c) # always copy colors before handing them out else: return c.getRgb() x2 = ticks[0][1] for i in range(1,len(ticks)): x1 = x2 x2 = ticks[i][1] if x1 <= x and x2 >= x: break dx = (x2-x1) if dx == 0: f = 0. else: f = (x-x1) / dx c1 = ticks[i-1][0].color c2 = ticks[i][0].color if self.colorMode == 'rgb': r = c1.red() * (1.-f) + c2.red() * f g = c1.green() * (1.-f) + c2.green() * f b = c1.blue() * (1.-f) + c2.blue() * f a = c1.alpha() * (1.-f) + c2.alpha() * f if toQColor: return QtGui.QColor(int(r), int(g), int(b), int(a)) else: return (r,g,b,a) elif self.colorMode == 'hsv': h1,s1,v1,_ = c1.getHsv() h2,s2,v2,_ = c2.getHsv() h = h1 * (1.-f) + h2 * f s = s1 * (1.-f) + s2 * f v = v1 * (1.-f) + v2 * f c = QtGui.QColor.fromHsv(int(h), int(s), int(v)) if toQColor: return c else: return c.getRgb() def getLookupTable(self, nPts, alpha=None): """ Return an RGB(A) lookup table (ndarray). ============== ============================================================================ **Arguments:** nPts The number of points in the returned lookup table. alpha True, False, or None - Specifies whether or not alpha values are included in the table.If alpha is None, alpha will be automatically determined. ============== ============================================================================ """ if alpha is None: alpha = self.usesAlpha() if alpha: table = np.empty((nPts,4), dtype=np.ubyte) else: table = np.empty((nPts,3), dtype=np.ubyte) for i in range(nPts): x = float(i)/(nPts-1) color = self.getColor(x, toQColor=False) table[i] = color[:table.shape[1]] return table def usesAlpha(self): """Return True if any ticks have an alpha < 255""" ticks = self.listTicks() for t in ticks: if t[0].color.alpha() < 255: return True return False def isLookupTrivial(self): """Return True if the gradient has exactly two stops in it: black at 0.0 and white at 1.0""" ticks = self.listTicks() if len(ticks) != 2: return False if ticks[0][1] != 0.0 or ticks[1][1] != 1.0: return False c1 = ticks[0][0].color.getRgb() c2 = ticks[1][0].color.getRgb() if c1 != (0,0,0,255) or c2 != (255,255,255,255): return False return True def addTick(self, x, color=None, movable=True, finish=True): """ Add a tick to the gradient. Return the tick. ============== ================================================================== **Arguments:** x Position where tick should be added. color Color of added tick. If color is not specified, the color will be the color of the gradient at the specified position. movable Specifies whether the tick is movable with the mouse. ============== ================================================================== """ if color is None: color = self.getColor(x) t = TickSliderItem.addTick(self, x, color=color, movable=movable, finish=finish) t.colorChangeAllowed = True return t def saveState(self): """ Return a dictionary with parameters for rebuilding the gradient. Keys will include: - 'mode': hsv or rgb - 'ticks': a list of tuples (pos, (r,g,b,a)) """ ## public ticks = [] for t in self.ticks: c = t.color ticks.append((self.ticks[t], c.getRgb())) state = {'mode': self.colorMode, 'ticks': ticks, 'ticksVisible': next(iter(self.ticks)).isVisible()} return state def restoreState(self, state): """ Restore the gradient specified in state. ============== ==================================================================== **Arguments:** state A dictionary with same structure as those returned by :func:`saveState ` Keys must include: - 'mode': hsv or rgb - 'ticks': a list of tuples (pos, (r,g,b,a)) ============== ==================================================================== """ ## public # Mass edit ticks without graphics update signalsBlocked = self.blockSignals(True) self.setColorMode(state['mode']) for t in list(self.ticks.keys()): self.removeTick(t, finish=False) for t in state['ticks']: c = QtGui.QColor(*t[1]) self.addTick(t[0], c, finish=False) self.showTicks( state.get('ticksVisible', next(iter(self.ticks)).isVisible()) ) # Close with graphics update self.blockSignals(signalsBlocked) self.sigTicksChanged.emit(self) self.sigGradientChangeFinished.emit(self) def setColorMap(self, cm): # Mass edit ticks without graphics update signalsBlocked = self.blockSignals(True) self.setColorMode('rgb') for t in list(self.ticks.keys()): self.removeTick(t, finish=False) colors = cm.getColors(mode='qcolor') for i in range(len(cm.pos)): x = cm.pos[i] c = colors[i] self.addTick(x, c, finish=False) # Close with graphics update self.blockSignals(signalsBlocked) self.sigTicksChanged.emit(self) self.sigGradientChangeFinished.emit(self) def linkGradient(self, slaveGradient, connect=True): if connect: fn = lambda g, slave=slaveGradient:slave.restoreState( g.saveState()) self.linkedGradients[id(slaveGradient)] = fn self.sigGradientChanged.connect(fn) self.sigGradientChanged.emit(self) else: fn = self.linkedGradients.get(id(slaveGradient), None) if fn: self.sigGradientChanged.disconnect(fn) class Tick(QtWidgets.QGraphicsWidget): ## NOTE: Making this a subclass of GraphicsObject instead results in ## activating this bug: https://bugreports.qt-project.org/browse/PYSIDE-86 ## private class # When making Tick a subclass of QtWidgets.QGraphicsObject as origin, # ..GraphicsScene.items(self, *args) will get Tick object as a # class of QtGui.QMultimediaWidgets.QGraphicsVideoItem in python2.7-PyQt5(5.4.0) sigMoving = QtCore.Signal(object, object) sigMoved = QtCore.Signal(object) sigClicked = QtCore.Signal(object, object) def __init__(self, pos, color, movable=True, scale=10, pen='w', removeAllowed=True): self.movable = movable self.moving = False self.scale = scale self.color = color self.pen = fn.mkPen(pen) self.hoverPen = fn.mkPen(255,255,0) self.currentPen = self.pen self.removeAllowed = removeAllowed self.pg = QtGui.QPainterPath(QtCore.QPointF(0,0)) self.pg.lineTo(QtCore.QPointF(-scale/3**0.5, scale)) self.pg.lineTo(QtCore.QPointF(scale/3**0.5, scale)) self.pg.closeSubpath() QtWidgets.QGraphicsWidget.__init__(self) self.setPos(pos[0], pos[1]) if self.movable: self.setZValue(1) else: self.setZValue(0) def boundingRect(self): return self.pg.boundingRect() def shape(self): return self.pg def paint(self, p, *args): p.setRenderHints(QtGui.QPainter.RenderHint.Antialiasing) p.fillPath(self.pg, fn.mkBrush(self.color)) p.setPen(self.currentPen) p.drawPath(self.pg) def mouseDragEvent(self, ev): if self.movable and ev.button() == QtCore.Qt.MouseButton.LeftButton: if ev.isStart(): self.moving = True self.cursorOffset = self.pos() - self.mapToParent(ev.buttonDownPos()) self.startPosition = self.pos() ev.accept() if not self.moving: return newPos = self.cursorOffset + self.mapToParent(ev.pos()) newPos.setY(self.pos().y()) self.setPos(newPos) self.sigMoving.emit(self, newPos) if ev.isFinish(): self.moving = False self.sigMoved.emit(self) def mouseClickEvent(self, ev): ev.accept() if ev.button() == QtCore.Qt.MouseButton.RightButton and self.moving: self.setPos(self.startPosition) self.moving = False self.sigMoving.emit(self, self.startPosition) self.sigMoved.emit(self) else: self.sigClicked.emit(self, ev) def hoverEvent(self, ev): if (not ev.isExit()) and ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton): ev.acceptClicks(QtCore.Qt.MouseButton.LeftButton) ev.acceptClicks(QtCore.Qt.MouseButton.RightButton) self.currentPen = self.hoverPen else: self.currentPen = self.pen self.update() class TickMenu(QtWidgets.QMenu): def __init__(self, tick, sliderItem): QtWidgets.QMenu.__init__(self) self.tick = weakref.ref(tick) self.sliderItem = weakref.ref(sliderItem) self.removeAct = self.addAction(translate("GradientEditorItem", "Remove Tick"), lambda: self.sliderItem().removeTick(tick)) if (not self.tick().removeAllowed) or len(self.sliderItem().ticks) < 3: self.removeAct.setEnabled(False) positionMenu = self.addMenu(translate("GradientEditorItem", "Set Position")) w = QtWidgets.QWidget() l = QtWidgets.QGridLayout() w.setLayout(l) value = sliderItem.tickValue(tick) self.fracPosSpin = SpinBox() self.fracPosSpin.setOpts(value=value, bounds=(0.0, 1.0), step=0.01, decimals=2) #self.dataPosSpin = SpinBox(value=dataVal) #self.dataPosSpin.setOpts(decimals=3, siPrefix=True) l.addWidget(QtWidgets.QLabel(f"{translate('GradiantEditorItem', 'Position')}:"), 0,0) l.addWidget(self.fracPosSpin, 0, 1) #l.addWidget(QtWidgets.QLabel("Position (data units):"), 1, 0) #l.addWidget(self.dataPosSpin, 1,1) #if self.sliderItem().dataParent is None: # self.dataPosSpin.setEnabled(False) a = QtWidgets.QWidgetAction(self) a.setDefaultWidget(w) positionMenu.addAction(a) self.fracPosSpin.sigValueChanging.connect(self.fractionalValueChanged) #self.dataPosSpin.valueChanged.connect(self.dataValueChanged) colorAct = self.addAction(translate("Context Menu", "Set Color"), lambda: self.sliderItem().raiseColorDialog(self.tick())) if not self.tick().colorChangeAllowed: colorAct.setEnabled(False) def fractionalValueChanged(self, x): self.sliderItem().setTickValue(self.tick(), self.fracPosSpin.value()) #if self.sliderItem().dataParent is not None: # self.dataPosSpin.blockSignals(True) # self.dataPosSpin.setValue(self.sliderItem().tickDataValue(self.tick())) # self.dataPosSpin.blockSignals(False) #def dataValueChanged(self, val): # self.sliderItem().setTickValue(self.tick(), val, dataUnits=True) # self.fracPosSpin.blockSignals(True) # self.fracPosSpin.setValue(self.sliderItem().tickValue(self.tick())) # self.fracPosSpin.blockSignals(False) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/GradientLegend.py000066400000000000000000000114751457240071200257140ustar00rootroot00000000000000from .. import functions as fn from ..Qt import QtCore, QtGui from .UIGraphicsItem import UIGraphicsItem __all__ = ['GradientLegend'] class GradientLegend(UIGraphicsItem): """ Draws a color gradient rectangle along with text labels denoting the value at specific points along the gradient. """ def __init__(self, size, offset): self.size = size self.offset = offset UIGraphicsItem.__init__(self) self.setAcceptedMouseButtons(QtCore.Qt.MouseButton.NoButton) self.brush = QtGui.QBrush(QtGui.QColor(255,255,255,100)) # background color self.pen = QtGui.QPen(QtGui.QColor(0,0,0)) self.textPen = QtGui.QPen(QtGui.QColor(0,0,0)) self.labels = {'max': 1, 'min': 0} self.gradient = QtGui.QLinearGradient() self.gradient.setColorAt(0, QtGui.QColor(0,0,0)) self.gradient.setColorAt(1, QtGui.QColor(255,0,0)) self.setZValue(100) # draw on top of ordinary plots def setGradient(self, g): self.gradient = g self.update() def setColorMap(self, colormap): """ Set displayed gradient from a :class:`~pyqtgraph.ColorMap` object. """ self.gradient = colormap.getGradient() def setIntColorScale(self, minVal, maxVal, *args, **kargs): colors = [fn.intColor(i, maxVal-minVal, *args, **kargs) for i in range(minVal, maxVal)] g = QtGui.QLinearGradient() for i in range(len(colors)): x = float(i)/len(colors) g.setColorAt(x, colors[i]) self.setGradient(g) if 'labels' not in kargs: self.setLabels({str(minVal): 0, str(maxVal): 1}) else: self.setLabels({kargs['labels'][0]:0, kargs['labels'][1]:1}) def setLabels(self, l): """Defines labels to appear next to the color scale. Accepts a dict of {text: value} pairs""" self.labels = l self.update() def paint(self, p, opt, widget): UIGraphicsItem.paint(self, p, opt, widget) view = self.getViewBox() if view is None: return p.save() # save painter state before we change transformation trans = view.sceneTransform() p.setTransform( trans ) # draw in ViewBox pixel coordinates rect = view.rect() ## determine max width of all labels labelWidth = 0 labelHeight = 0 for k in self.labels: b = p.boundingRect(QtCore.QRectF(0, 0, 0, 0), QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter, str(k)) labelWidth = max(labelWidth, b.width()) labelHeight = max(labelHeight, b.height()) textPadding = 2 # in px xR = rect.right() xL = rect.left() yT = rect.top() yB = rect.bottom() # coordinates describe edges of text and bar, additional margins will be added for background if self.offset[0] < 0: x3 = xR + self.offset[0] # right edge from right edge of view, offset is negative! x2 = x3 - labelWidth - 2*textPadding # right side of color bar x1 = x2 - self.size[0] # left side of color bar else: x1 = xL + self.offset[0] # left edge from left edge of view x2 = x1 + self.size[0] x3 = x2 + labelWidth + 2*textPadding # leave room for 2x textpadding between bar and text if self.offset[1] < 0: y2 = yB + self.offset[1] # bottom edge from bottom of view, offset is negative! y1 = y2 - self.size[1] else: y1 = yT + self.offset[1] # top edge from top of view y2 = y1 + self.size[1] self.b = [x1,x2,x3,y1,y2,labelWidth] ## Draw background p.setPen(self.pen) p.setBrush(self.brush) # background color rect = QtCore.QRectF( QtCore.QPointF(x1 - textPadding, y1-labelHeight/2 - textPadding), # extra left/top padding QtCore.QPointF(x3 + textPadding, y2+labelHeight/2 + textPadding) # extra bottom/right padding ) p.drawRect(rect) ## Draw color bar self.gradient.setStart(0, y2) self.gradient.setFinalStop(0, y1) p.setBrush(self.gradient) rect = QtCore.QRectF( QtCore.QPointF(x1, y1), QtCore.QPointF(x2, y2) ) p.drawRect(rect) ## draw labels p.setPen(self.textPen) tx = x2 + 2 * textPadding # margin between bar and text lh = labelHeight lw = labelWidth for k in self.labels: y = y2 - self.labels[k] * (y2-y1) p.drawText(QtCore.QRectF(tx, y - lh/2, lw, lh), QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter, str(k)) p.restore() # restore QPainter transform to original state pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/GradientPresets.py000066400000000000000000000045251457240071200261410ustar00rootroot00000000000000__all__ = ['Gradients'] Gradients = dict([ ('thermal', {'ticks': [(0.3333, (185, 0, 0, 255)), (0.6666, (255, 220, 0, 255)), (1, (255, 255, 255, 255)), (0, (0, 0, 0, 255))], 'mode': 'rgb'}), ('flame', {'ticks': [(0.2, (7, 0, 220, 255)), (0.5, (236, 0, 134, 255)), (0.8, (246, 246, 0, 255)), (1.0, (255, 255, 255, 255)), (0.0, (0, 0, 0, 255))], 'mode': 'rgb'}), ('yellowy', {'ticks': [(0.0, (0, 0, 0, 255)), (0.2328863796753704, (32, 0, 129, 255)), (0.8362738179251941, (255, 255, 0, 255)), (0.5257586450247, (115, 15, 255, 255)), (1.0, (255, 255, 255, 255))], 'mode': 'rgb'} ), ('bipolar', {'ticks': [(0.0, (0, 255, 255, 255)), (1.0, (255, 255, 0, 255)), (0.5, (0, 0, 0, 255)), (0.25, (0, 0, 255, 255)), (0.75, (255, 0, 0, 255))], 'mode': 'rgb'}), ('spectrum', {'ticks': [(1.0, (255, 0, 255, 255)), (0.0, (255, 0, 0, 255))], 'mode': 'hsv'}), ('cyclic', {'ticks': [(0.0, (255, 0, 4, 255)), (1.0, (255, 0, 0, 255))], 'mode': 'hsv'}), ('greyclip', {'ticks': [(0.0, (0, 0, 0, 255)), (0.99, (255, 255, 255, 255)), (1.0, (255, 0, 0, 255))], 'mode': 'rgb'}), ('grey', {'ticks': [(0.0, (0, 0, 0, 255)), (1.0, (255, 255, 255, 255))], 'mode': 'rgb'}), # Perceptually uniform sequential colormaps from Matplotlib 2.0 ('viridis', {'ticks': [(0.0, (68, 1, 84, 255)), (0.25, (58, 82, 139, 255)), (0.5, (32, 144, 140, 255)), (0.75, (94, 201, 97, 255)), (1.0, (253, 231, 36, 255))], 'mode': 'rgb'}), ('inferno', {'ticks': [(0.0, (0, 0, 3, 255)), (0.25, (87, 15, 109, 255)), (0.5, (187, 55, 84, 255)), (0.75, (249, 142, 8, 255)), (1.0, (252, 254, 164, 255))], 'mode': 'rgb'}), ('plasma', {'ticks': [(0.0, (12, 7, 134, 255)), (0.25, (126, 3, 167, 255)), (0.5, (203, 71, 119, 255)), (0.75, (248, 149, 64, 255)), (1.0, (239, 248, 33, 255))], 'mode': 'rgb'}), ('magma', {'ticks': [(0.0, (0, 0, 3, 255)), (0.25, (80, 18, 123, 255)), (0.5, (182, 54, 121, 255)), (0.75, (251, 136, 97, 255)), (1.0, (251, 252, 191, 255))], 'mode': 'rgb'}), # turbo from https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html ('turbo', {'ticks': [(0.0, (51, 27, 61, 255)), (0.125, (77, 110, 223, 255)), (0.25, (61, 185, 233, 255)), (0.375, (68, 238, 154, 255)), (0.5, (164, 250, 80, 255)), (0.625, (235, 206, 76, 255)), (0.75, (247, 129, 55, 255)), (0.875, (206, 58, 32, 255)), (1.0, (119, 21, 19, 255))], 'mode': 'rgb'}), ]) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/GraphItem.py000066400000000000000000000132331457240071200247120ustar00rootroot00000000000000import numpy as np from .. import functions as fn from .. import getConfigOption from ..Qt import QtCore, QtGui from .GraphicsObject import GraphicsObject from .ScatterPlotItem import ScatterPlotItem __all__ = ['GraphItem'] class GraphItem(GraphicsObject): """A GraphItem displays graph information as a set of nodes connected by lines (as in 'graph theory', not 'graphics'). Useful for drawing networks, trees, etc. """ def __init__(self, **kwds): GraphicsObject.__init__(self) self.scatter = ScatterPlotItem() self.scatter.setParentItem(self) self.adjacency = None self.pos = None self.picture = None self.pen = 'default' self.setData(**kwds) def setData(self, **kwds): """ Change the data displayed by the graph. ============== ======================================================================= **Arguments:** pos (N,2) array of the positions of each node in the graph. adj (M,2) array of connection data. Each row contains indexes of two nodes that are connected or None to hide lines pen The pen to use when drawing lines between connected nodes. May be one of: * QPen * a single argument to pass to pg.mkPen * a record array of length M with fields (red, green, blue, alpha, width). Note that using this option may have a significant performance cost. * None (to disable connection drawing) * 'default' to use the default foreground color. symbolPen The pen(s) used for drawing nodes. symbolBrush The brush(es) used for drawing nodes. ``**opts`` All other keyword arguments are given to :func:`ScatterPlotItem.setData() ` to affect the appearance of nodes (symbol, size, brush, etc.) ============== ======================================================================= """ if 'adj' in kwds: self.adjacency = kwds.pop('adj') if hasattr(self.adjacency, '__len__') and len(self.adjacency) == 0: self.adjacency = None elif self.adjacency is not None and self.adjacency.dtype.kind not in 'iu': raise Exception("adjacency must be None or an array of either int or unsigned type.") self._update() if 'pos' in kwds: self.pos = kwds['pos'] self._update() if 'pen' in kwds: self.setPen(kwds.pop('pen')) self._update() if 'symbolPen' in kwds: kwds['pen'] = kwds.pop('symbolPen') if 'symbolBrush' in kwds: kwds['brush'] = kwds.pop('symbolBrush') self.scatter.setData(**kwds) self.informViewBoundsChanged() def _update(self): self.picture = None self.prepareGeometryChange() self.update() def setPen(self, *args, **kwargs): """ Set the pen used to draw graph lines. May be: * None to disable line drawing * Record array with fields (red, green, blue, alpha, width) * Any set of arguments and keyword arguments accepted by :func:`mkPen `. * 'default' to use the default foreground color. """ if len(args) == 1 and len(kwargs) == 0: self.pen = args[0] else: self.pen = fn.mkPen(*args, **kwargs) self.picture = None self.update() def generatePicture(self): self.picture = QtGui.QPicture() if self.pen is None or self.pos is None or self.adjacency is None: return p = QtGui.QPainter(self.picture) try: pts = self.pos[self.adjacency] pen = self.pen if isinstance(pen, np.ndarray): lastPen = None for i in range(pts.shape[0]): pen = self.pen[i] if lastPen is None or np.any(pen != lastPen): lastPen = pen if pen.dtype.fields is None: p.setPen(fn.mkPen(color=(pen[0], pen[1], pen[2], pen[3]), width=1)) else: p.setPen(fn.mkPen(color=(pen['red'], pen['green'], pen['blue'], pen['alpha']), width=pen['width'])) p.drawLine(QtCore.QPointF(*pts[i][0]), QtCore.QPointF(*pts[i][1])) else: if pen == 'default': pen = getConfigOption('foreground') p.setPen(fn.mkPen(pen)) pts = pts.reshape((pts.shape[0]*pts.shape[1], pts.shape[2])) path = fn.arrayToQPath(x=pts[:,0], y=pts[:,1], connect='pairs') p.drawPath(path) finally: p.end() def paint(self, p, *args): if self.picture is None: self.generatePicture() if getConfigOption('antialias') is True: p.setRenderHint(p.RenderHint.Antialiasing) self.picture.play(p) def boundingRect(self): return self.scatter.boundingRect() def dataBounds(self, *args, **kwds): return self.scatter.dataBounds(*args, **kwds) def pixelPadding(self): return self.scatter.pixelPadding() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/GraphicsItem.py000066400000000000000000000603351457240071200254160ustar00rootroot00000000000000__all__ = ['GraphicsItem'] import operator import weakref from collections import OrderedDict from functools import reduce from math import hypot from typing import Optional from xml.etree.ElementTree import Element from .. import functions as fn from ..GraphicsScene import GraphicsScene from ..Point import Point from ..Qt import QtCore, QtWidgets, isQObjectAlive # Recipe from https://docs.python.org/3.8/library/collections.html#collections.OrderedDict # slightly adapted for Python 3.7 compatibility class LRU(OrderedDict): 'Limit size, evicting the least recently looked-up key when full' def __init__(self, maxsize=128, *args, **kwds): self.maxsize = maxsize super().__init__(*args, **kwds) def __getitem__(self, key): value = super().__getitem__(key) self.move_to_end(key) return value def __setitem__(self, key, value): if key in self: self.move_to_end(key) super().__setitem__(key, value) if len(self) > self.maxsize: oldest = next(iter(self)) del self[oldest] class GraphicsItem(object): """ **Bases:** :class:`object` Abstract class providing useful methods to GraphicsObject and GraphicsWidget. (This is required because we cannot have multiple inheritance with QObject subclasses.) A note about Qt's GraphicsView framework: The GraphicsView system places a lot of emphasis on the notion that the graphics within the scene should be device independent--you should be able to take the same graphics and display them on screens of different resolutions, printers, export to SVG, etc. This is nice in principle, but causes me a lot of headache in practice. It means that I have to circumvent all the device-independent expectations any time I want to operate in pixel coordinates rather than arbitrary scene coordinates. A lot of the code in GraphicsItem is devoted to this task--keeping track of view widgets and device transforms, computing the size and shape of a pixel in local item coordinates, etc. Note that in item coordinates, a pixel does not have to be square or even rectangular, so just asking how to increase a bounding rect by 2px can be a rather complex task. """ _pixelVectorGlobalCache = LRU(100) def __init__(self): if not hasattr(self, '_qtBaseClass'): for b in self.__class__.__bases__: if issubclass(b, QtWidgets.QGraphicsItem): self.__class__._qtBaseClass = b break if not hasattr(self, '_qtBaseClass'): raise Exception('Could not determine Qt base class for GraphicsItem: %s' % str(self)) self._pixelVectorCache = [None, None] self._viewWidget = None self._viewBox = None self._connectedView = None self._exportOpts = False ## If False, not currently exporting. Otherwise, contains dict of export options. self._cachedView = None def getViewWidget(self): """ Return the view widget for this item. If the scene has multiple views, only the first view is returned. The return value is cached; clear the cached value with forgetViewWidget(). If the view has been deleted by Qt, return None. """ if self._viewWidget is None: scene = self.scene() if scene is None: return None views = scene.views() if len(views) < 1: return None self._viewWidget = weakref.ref(self.scene().views()[0]) v = self._viewWidget() if v is not None and not isQObjectAlive(v): return None return v def forgetViewWidget(self): self._viewWidget = None def getViewBox(self): """ Return the first ViewBox or GraphicsView which bounds this item's visible space. If this item is not contained within a ViewBox, then the GraphicsView is returned. If the item is contained inside nested ViewBoxes, then the inner-most ViewBox is returned. The result is cached; clear the cache with forgetViewBox() """ if self._viewBox is None: p = self while True: try: p = p.parentItem() except RuntimeError: ## sometimes happens as items are being removed from a scene and collected. return None if p is None: vb = self.getViewWidget() if vb is None: return None else: self._viewBox = weakref.ref(vb) break if hasattr(p, 'implements') and p.implements('ViewBox'): self._viewBox = weakref.ref(p) break return self._viewBox() ## If we made it this far, _viewBox is definitely not None def forgetViewBox(self): self._viewBox = None def deviceTransform(self, viewportTransform=None): """ Return the transform that converts local item coordinates to device coordinates (usually pixels). Extends deviceTransform to automatically determine the viewportTransform. """ if viewportTransform is None: view = self.getViewWidget() if view is None: return None viewportTransform = view.viewportTransform() dt = self._qtBaseClass.deviceTransform(self, viewportTransform) #xmag = abs(dt.m11())+abs(dt.m12()) #ymag = abs(dt.m21())+abs(dt.m22()) #if xmag * ymag == 0: if dt.determinant() == 0: ## occurs when deviceTransform is invalid because widget has not been displayed return None else: return dt def viewTransform(self): """Return the transform that maps from local coordinates to the item's ViewBox coordinates If there is no ViewBox, return the scene transform. Returns None if the item does not have a view.""" view = self.getViewBox() if view is None: return None if hasattr(view, 'implements') and view.implements('ViewBox'): return self.itemTransform(view.innerSceneItem())[0] else: return self.sceneTransform() #return self.deviceTransform(view.viewportTransform()) def getBoundingParents(self): """Return a list of parents to this item that have child clipping enabled.""" p = self parents = [] while True: p = p.parentItem() if p is None: break if p.flags() & self.GraphicsItemFlag.ItemClipsChildrenToShape: parents.append(p) return parents def viewRect(self): """Return the visible bounds of this item's ViewBox or GraphicsWidget, in the local coordinate system of the item.""" if self._cachedView is not None: return self._cachedView # Note that in cases of early returns here, the view cache stays empty (None). view = self.getViewBox() if view is None: return None bounds = self.mapRectFromView(view.viewRect()) if bounds is None: return None bounds = bounds.normalized() self._cachedView = bounds ## nah. #for p in self.getBoundingParents(): #bounds &= self.mapRectFromScene(p.sceneBoundingRect()) return bounds def pixelVectors(self, direction=None): """Return vectors in local coordinates representing the width and height of a view pixel. If direction is specified, then return vectors parallel and orthogonal to it. Return (None, None) if pixel size is not yet defined (usually because the item has not yet been displayed) or if pixel size is below floating-point precision limit. """ ## This is an expensive function that gets called very frequently. ## We have two levels of cache to try speeding things up. dt = self.deviceTransform() if dt is None: return None, None ## Ignore translation. If the translation is much larger than the scale ## (such as when looking at unix timestamps), we can get floating-point errors. dt.setMatrix(dt.m11(), dt.m12(), 0, dt.m21(), dt.m22(), 0, 0, 0, 1) if direction is None: direction = QtCore.QPointF(1, 0) elif direction.manhattanLength() == 0: raise Exception("Cannot compute pixel length for 0-length vector.") key = (dt.m11(), dt.m21(), dt.m12(), dt.m22(), direction.x(), direction.y()) ## check local cache if key == self._pixelVectorCache[0]: return tuple(map(Point, self._pixelVectorCache[1])) ## return a *copy* ## check global cache pv = self._pixelVectorGlobalCache.get(key, None) if pv is not None: self._pixelVectorCache = [key, pv] return tuple(map(Point,pv)) ## return a *copy* ## attempt to re-scale direction vector to fit within the precision of the coordinate system ## Here's the problem: we need to map the vector 'direction' from the item to the device, via transform 'dt'. ## In some extreme cases, this mapping can fail unless the length of 'direction' is cleverly chosen. ## Example: ## dt = [ 1, 0, 2 ## 0, 2, 1e20 ## 0, 0, 1 ] ## Then we map the origin (0,0) and direction (0,1) and get: ## o' = 2,1e20 ## d' = 2,1e20 <-- should be 1e20+2, but this can't be represented with a 32-bit float ## ## |o' - d'| == 0 <-- this is the problem. ## Perhaps the easiest solution is to exclude the transformation column from dt. Does this cause any other problems? #if direction.x() == 0: #r = abs(dt.m32())/(abs(dt.m12()) + abs(dt.m22())) ##r = 1.0/(abs(dt.m12()) + abs(dt.m22())) #elif direction.y() == 0: #r = abs(dt.m31())/(abs(dt.m11()) + abs(dt.m21())) ##r = 1.0/(abs(dt.m11()) + abs(dt.m21())) #else: #r = ((abs(dt.m32())/(abs(dt.m12()) + abs(dt.m22()))) * (abs(dt.m31())/(abs(dt.m11()) + abs(dt.m21()))))**0.5 #if r == 0: #r = 1. ## shouldn't need to do this; probably means the math above is wrong? #directionr = direction * r directionr = direction ## map direction vector onto device #viewDir = Point(dt.map(directionr) - dt.map(Point(0,0))) #mdirection = dt.map(directionr) dirLine = QtCore.QLineF(QtCore.QPointF(0,0), directionr) viewDir = dt.map(dirLine) if viewDir.length() == 0: return None, None ## pixel size cannot be represented on this scale ## get unit vector and orthogonal vector (length of pixel) #orthoDir = Point(viewDir[1], -viewDir[0]) ## orthogonal to line in pixel-space try: normView = viewDir.unitVector() #normView = viewDir.norm() ## direction of one pixel orthogonal to line normOrtho = normView.normalVector() #normOrtho = orthoDir.norm() except: raise Exception("Invalid direction %s" %directionr) ## map back to item dti = fn.invertQTransform(dt) #pv = Point(dti.map(normView)-dti.map(Point(0,0))), Point(dti.map(normOrtho)-dti.map(Point(0,0))) pv = Point(dti.map(normView).p2()), Point(dti.map(normOrtho).p2()) self._pixelVectorCache[1] = pv self._pixelVectorCache[0] = key self._pixelVectorGlobalCache[key] = pv return self._pixelVectorCache[1] def pixelLength(self, direction, ortho=False): """Return the length of one pixel in the direction indicated (in local coordinates) If ortho=True, then return the length of one pixel orthogonal to the direction indicated. Return None if pixel size is not yet defined (usually because the item has not yet been displayed). """ normV, orthoV = self.pixelVectors(direction) if normV is None or orthoV is None: return None if ortho: return orthoV.length() return normV.length() def pixelSize(self): ## deprecated v = self.pixelVectors() if v == (None, None): return None, None return (hypot(v[0].x(), v[0].y()), hypot(v[1].x(), v[1].y())) # lengths def pixelWidth(self): ## deprecated vt = self.deviceTransform() if vt is None: return 0 vt = fn.invertQTransform(vt) return vt.map(QtCore.QLineF(0, 0, 1, 0)).length() def pixelHeight(self): ## deprecated vt = self.deviceTransform() if vt is None: return 0 vt = fn.invertQTransform(vt) return vt.map(QtCore.QLineF(0, 0, 0, 1)).length() #return Point(vt.map(QtCore.QPointF(0, 1))-vt.map(QtCore.QPointF(0, 0))).length() def mapToDevice(self, obj): """ Return *obj* mapped from local coordinates to device coordinates (pixels). If there is no device mapping available, return None. """ vt = self.deviceTransform() if vt is None: return None return vt.map(obj) def mapFromDevice(self, obj): """ Return *obj* mapped from device coordinates (pixels) to local coordinates. If there is no device mapping available, return None. """ vt = self.deviceTransform() if vt is None: return None if isinstance(obj, QtCore.QPoint): obj = QtCore.QPointF(obj) vt = fn.invertQTransform(vt) return vt.map(obj) def mapRectToDevice(self, rect): """ Return *rect* mapped from local coordinates to device coordinates (pixels). If there is no device mapping available, return None. """ vt = self.deviceTransform() if vt is None: return None return vt.mapRect(rect) def mapRectFromDevice(self, rect): """ Return *rect* mapped from device coordinates (pixels) to local coordinates. If there is no device mapping available, return None. """ vt = self.deviceTransform() if vt is None: return None vt = fn.invertQTransform(vt) return vt.mapRect(rect) def mapToView(self, obj): vt = self.viewTransform() if vt is None: return None return vt.map(obj) def mapRectToView(self, obj): vt = self.viewTransform() if vt is None: return None return vt.mapRect(obj) def mapFromView(self, obj): vt = self.viewTransform() if vt is None: return None vt = fn.invertQTransform(vt) return vt.map(obj) def mapRectFromView(self, obj): vt = self.viewTransform() if vt is None: return None vt = fn.invertQTransform(vt) return vt.mapRect(obj) def pos(self): return Point(self._qtBaseClass.pos(self)) def viewPos(self): return self.mapToView(self.mapFromParent(self.pos())) def parentItem(self): return self._qtBaseClass.parentItem(self) def setParentItem(self, parent): ## Workaround for Qt bug: https://bugreports.qt-project.org/browse/QTBUG-18616 if parent is not None: pscene = parent.scene() if pscene is not None and self.scene() is not pscene: pscene.addItem(self) return self._qtBaseClass.setParentItem(self, parent) def childItems(self): return self._qtBaseClass.childItems(self) def sceneTransform(self): ## Qt bug: do no allow access to sceneTransform() until ## the item has a scene. if self.scene() is None: return self.transform() else: return self._qtBaseClass.sceneTransform(self) def transformAngle(self, relativeItem=None): """Return the rotation produced by this item's transform (this assumes there is no shear in the transform) If relativeItem is given, then the angle is determined relative to that item. """ if relativeItem is None: relativeItem = self.parentItem() tr = self.itemTransform(relativeItem)[0] vec = tr.map(QtCore.QLineF(0,0,1,0)) return vec.angleTo(QtCore.QLineF(vec.p1(), vec.p1()+QtCore.QPointF(1,0))) #def itemChange(self, change, value): #ret = self._qtBaseClass.itemChange(self, change, value) #if change == self.GraphicsItemChange.ItemParentHasChanged or change == self.ItemSceneHasChanged: #print "Item scene changed:", self #self.setChildScene(self) ## This is bizarre. #return ret #def setChildScene(self, ch): #scene = self.scene() #for ch2 in ch.childItems(): #if ch2.scene() is not scene: #print "item", ch2, "has different scene:", ch2.scene(), scene #scene.addItem(ch2) #QtWidgets.QApplication.processEvents() #print " --> ", ch2.scene() #self.setChildScene(ch2) def changeParent(self): """Called when the item's parent has changed. This method handles connecting / disconnecting from ViewBox signals to make sure viewRangeChanged works properly. It should generally be extended, not overridden.""" self._updateView() def parentChanged(self): # deprecated version of changeParent() GraphicsItem.changeParent(self) def _updateView(self): ## called to see whether this item has a new view to connect to ## NOTE: This is called from GraphicsObject.itemChange or GraphicsWidget.itemChange. if not hasattr(self, '_connectedView'): # Happens when Python is shutting down. return ## It is possible this item has moved to a different ViewBox or widget; ## clear out previously determined references to these. self.forgetViewBox() self.forgetViewWidget() ## check for this item's current viewbox or view widget view = self.getViewBox() #if view is None: ##print " no view" #return oldView = None if self._connectedView is not None: oldView = self._connectedView() if view is oldView: #print " already have view", view return ## disconnect from previous view if oldView is not None: Device = 'Device' if hasattr(oldView, 'sigDeviceRangeChanged') else '' for signal, slot in [(f'sig{Device}RangeChanged', self.viewRangeChanged), (f'sig{Device}TransformChanged', self.viewTransformChanged)]: try: getattr(oldView, signal).disconnect(slot) except (TypeError, AttributeError, RuntimeError): # TypeError and RuntimeError are from pyqt and pyside, respectively pass self._connectedView = None ## connect to new view if view is not None: #print "connect:", self, view if hasattr(view, 'sigDeviceRangeChanged'): # connect signals from GraphicsView view.sigDeviceRangeChanged.connect(self.viewRangeChanged) view.sigDeviceTransformChanged.connect(self.viewTransformChanged) else: # connect signals from ViewBox view.sigRangeChanged.connect(self.viewRangeChanged) view.sigTransformChanged.connect(self.viewTransformChanged) self._connectedView = weakref.ref(view) self.viewRangeChanged() self.viewTransformChanged() ## inform children that their view might have changed self._replaceView(oldView) self.viewChanged(view, oldView) def viewChanged(self, view, oldView): """Called when this item's view has changed (ie, the item has been added to or removed from a ViewBox)""" def _replaceView(self, oldView, item=None): if item is None: item = self for child in item.childItems(): if isinstance(child, GraphicsItem): if child.getViewBox() is oldView: child._updateView() #self._replaceView(oldView, child) else: self._replaceView(oldView, child) def viewRangeChanged(self): """ Called whenever the view coordinates of the ViewBox containing this item have changed. """ # when this is called, _cachedView is not invalidated. # this means that for functions overriding viewRangeChanged, viewRect() may be stale. def viewTransformChanged(self): """ Called whenever the transformation matrix of the view has changed. (eg, the view range has changed or the view was resized) Invalidates the viewRect cache. """ self._cachedView = None #def prepareGeometryChange(self): #self._qtBaseClass.prepareGeometryChange(self) #self.informViewBoundsChanged() def informViewBoundsChanged(self): """ Inform this item's container ViewBox that the bounds of this item have changed. This is used by ViewBox to react if auto-range is enabled. """ view = self.getViewBox() if view is not None and hasattr(view, 'implements') and view.implements('ViewBox'): view.itemBoundsChanged(self) ## inform view so it can update its range if it wants def childrenShape(self): """Return the union of the shapes of all descendants of this item in local coordinates.""" shapes = [self.mapFromItem(c, c.shape()) for c in self.allChildItems()] return reduce(operator.add, shapes) def allChildItems(self, root=None): """Return list of the entire item tree descending from this item.""" if root is None: root = self tree = [] for ch in root.childItems(): tree.append(ch) tree.extend(self.allChildItems(ch)) return tree def setExportMode(self, export, opts=None): """ This method is called by exporters to inform items that they are being drawn for export with a specific set of options. Items access these via self._exportOptions. When exporting is complete, _exportOptions is set to False. """ if opts is None: opts = {} if export: self._exportOpts = opts #if 'antialias' not in opts: #self._exportOpts['antialias'] = True else: self._exportOpts = False #def update(self): #self._qtBaseClass.update(self) #print "Update:", self def getContextMenus(self, event): return [self.getMenu()] if hasattr(self, "getMenu") else [] def generateSvg( self, nodes: dict[str, Element] ) -> Optional[tuple[Element, list[Element]]]: """Method to override to manually specify the SVG writer mechanism. Parameters ---------- nodes Dictionary keyed by the name of graphics items and the XML representation of the the item that can be written as valid SVG. Returns ------- tuple First element is the top level group for this item. The second element is a list of xml Elements corresponding to the child nodes of the item. None Return None if no XML is needed for rendering Raises ------ NotImplementedError override method to implement in subclasses of GraphicsItem See Also -------- pyqtgraph.exporters.SVGExporter._generateItemSvg The generic and default implementation """ raise NotImplementedError pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/GraphicsLayout.py000066400000000000000000000173031457240071200257720ustar00rootroot00000000000000from .. import functions as fn from ..Qt import QtWidgets from .GraphicsWidget import GraphicsWidget from .LabelItem import LabelItem from .PlotItem import PlotItem ## Must be imported at the end to avoid cyclic-dependency hell: from .ViewBox import ViewBox __all__ = ['GraphicsLayout'] class GraphicsLayout(GraphicsWidget): """ Used for laying out GraphicsWidgets in a grid. This is usually created automatically as part of a :class:`GraphicsLayoutWidget `. """ def __init__(self, parent=None, border=None): GraphicsWidget.__init__(self, parent) if border is True: border = (100,100,100) elif border is False: border = None self.border = border self.layout = QtWidgets.QGraphicsGridLayout() self.setLayout(self.layout) self.items = {} ## item: [(row, col), (row, col), ...] lists all cells occupied by the item self.rows = {} ## row: {col1: item1, col2: item2, ...} maps cell location to item self.itemBorders = {} ## {item1: QtWidgets.QGraphicsRectItem, ...} border rects self.currentRow = 0 self.currentCol = 0 self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)) #def resizeEvent(self, ev): #ret = GraphicsWidget.resizeEvent(self, ev) #print self.pos(), self.mapToDevice(self.rect().topLeft()) #return ret def setBorder(self, *args, **kwds): """ Set the pen used to draw border between cells. See :func:`mkPen ` for arguments. """ self.border = fn.mkPen(*args, **kwds) for borderRect in self.itemBorders.values(): borderRect.setPen(self.border) def nextRow(self): """Advance to next row for automatic item placement""" self.currentRow += 1 self.currentCol = -1 self.nextColumn() def nextColumn(self): """Advance to next available column (generally only for internal use--called by addItem)""" self.currentCol += 1 while self.getItem(self.currentRow, self.currentCol) is not None: self.currentCol += 1 def nextCol(self, *args, **kargs): """Alias of nextColumn""" return self.nextColumn(*args, **kargs) def addPlot(self, row=None, col=None, rowspan=1, colspan=1, **kargs): """ Create a PlotItem and place it in the next available cell (or in the cell specified) All extra keyword arguments are passed to :func:`PlotItem.__init__ ` Returns the created item. """ plot = PlotItem(**kargs) self.addItem(plot, row, col, rowspan, colspan) return plot def addViewBox(self, row=None, col=None, rowspan=1, colspan=1, **kargs): """ Create a ViewBox and place it in the next available cell (or in the cell specified) All extra keyword arguments are passed to :func:`ViewBox.__init__ ` Returns the created item. """ vb = ViewBox(**kargs) self.addItem(vb, row, col, rowspan, colspan) return vb def addLabel(self, text=' ', row=None, col=None, rowspan=1, colspan=1, **kargs): """ Create a LabelItem with *text* and place it in the next available cell (or in the cell specified) All extra keyword arguments are passed to :func:`LabelItem.__init__ ` Returns the created item. To create a vertical label, use *angle* = -90. """ text = LabelItem(text, **kargs) self.addItem(text, row, col, rowspan, colspan) return text def addLayout(self, row=None, col=None, rowspan=1, colspan=1, **kargs): """ Create an empty GraphicsLayout and place it in the next available cell (or in the cell specified) All extra keyword arguments are passed to :func:`GraphicsLayout.__init__ ` Returns the created item. """ layout = GraphicsLayout(**kargs) self.addItem(layout, row, col, rowspan, colspan) return layout def addItem(self, item, row=None, col=None, rowspan=1, colspan=1): """ Add an item to the layout and place it in the next available cell (or in the cell specified). The item must be an instance of a QGraphicsWidget subclass. """ if row is None: row = self.currentRow if col is None: col = self.currentCol self.items[item] = [] for i in range(rowspan): for j in range(colspan): row2 = row + i col2 = col + j if row2 not in self.rows: self.rows[row2] = {} self.rows[row2][col2] = item self.items[item].append((row2, col2)) borderRect = QtWidgets.QGraphicsRectItem() borderRect.setParentItem(self) borderRect.setZValue(1e3) borderRect.setPen(fn.mkPen(self.border)) self.itemBorders[item] = borderRect item.geometryChanged.connect(self._updateItemBorder) self.layout.addItem(item, row, col, rowspan, colspan) self.layout.activate() # Update layout, recalculating bounds. # Allows some PyQtGraph features to also work without Qt event loop. self.nextColumn() def getItem(self, row, col): """Return the item in (*row*, *col*). If the cell is empty, return None.""" return self.rows.get(row, {}).get(col, None) def boundingRect(self): return self.rect() def itemIndex(self, item): """Return the numerical index of GraphicsItem object passed in Parameters ---------- item : QGraphicsLayoutItem Item to query the index position of Returns ------- int Index of the item within the graphics layout Raises ------ ValueError Raised if item could not be found inside the GraphicsLayout instance. """ for i in range(self.layout.count()): if self.layout.itemAt(i).graphicsItem() is item: return i raise ValueError(f"Could not determine index of item {item}") def removeItem(self, item): """Remove *item* from the layout.""" ind = self.itemIndex(item) self.layout.removeAt(ind) self.scene().removeItem(item) for r, c in self.items[item]: del self.rows[r][c] del self.items[item] item.geometryChanged.disconnect(self._updateItemBorder) itemBorder = self.itemBorders.pop(item) self.scene().removeItem(itemBorder) self.update() def clear(self): """Remove all items from the layout and set the current row and column to 0 """ for i in list(self.items.keys()): self.removeItem(i) self.currentRow = 0 self.currentCol = 0 def setContentsMargins(self, *args): # Wrap calls to layout. This should happen automatically, but there # seems to be a Qt bug: # http://stackoverflow.com/questions/27092164/margins-in-pyqtgraphs-graphicslayout self.layout.setContentsMargins(*args) def setSpacing(self, *args): self.layout.setSpacing(*args) def _updateItemBorder(self): if self.border is None: return item = self.sender() if item is None: return r = item.mapRectToParent(item.boundingRect()) self.itemBorders[item].setRect(r) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/GraphicsObject.py000066400000000000000000000043601457240071200257220ustar00rootroot00000000000000import warnings from ..Qt import QT_LIB, QtCore, QtWidgets from .GraphicsItem import GraphicsItem __all__ = ['GraphicsObject'] class GraphicsObject(GraphicsItem, QtWidgets.QGraphicsObject): """ **Bases:** :class:`GraphicsItem `, :class:`QtWidgets.QGraphicsObject` Extension of QGraphicsObject with some useful methods (provided by :class:`GraphicsItem `) """ _qtBaseClass = QtWidgets.QGraphicsObject def __init__(self, *args): self.__inform_view_on_changes = True QtWidgets.QGraphicsObject.__init__(self, *args) self.setFlag(self.GraphicsItemFlag.ItemSendsGeometryChanges) GraphicsItem.__init__(self) def itemChange(self, change, value): ret = super().itemChange(change, value) if change in [self.GraphicsItemChange.ItemParentHasChanged, self.GraphicsItemChange.ItemSceneHasChanged]: if self.__class__.__dict__.get('parentChanged') is not None: # user's GraphicsObject subclass has a parentChanged() method warnings.warn( "parentChanged() is deprecated and will be removed in the future. " "Use changeParent() instead.", DeprecationWarning, stacklevel=2 ) if QT_LIB == 'PySide6' and QtCore.__version_info__ == (6, 2, 2): # workaround PySide6 6.2.2 issue https://bugreports.qt.io/browse/PYSIDE-1730 # note that the bug exists also in PySide6 6.2.2.1 / Qt 6.2.2 getattr(self.__class__, 'parentChanged')(self) else: self.parentChanged() else: self.changeParent() try: inform_view_on_change = self.__inform_view_on_changes except AttributeError: # It's possible that the attribute was already collected when the itemChange happened # (if it was triggered during the gc of the object). pass else: if inform_view_on_change and change in [self.GraphicsItemChange.ItemPositionHasChanged, self.GraphicsItemChange.ItemTransformHasChanged]: self.informViewBoundsChanged() return ret pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/GraphicsWidget.py000066400000000000000000000051741457240071200257430ustar00rootroot00000000000000from ..Qt import QtCore, QtGui, QtWidgets from .GraphicsItem import GraphicsItem __all__ = ['GraphicsWidget'] class GraphicsWidget(GraphicsItem, QtWidgets.QGraphicsWidget): _qtBaseClass = QtWidgets.QGraphicsWidget def __init__(self, *args, **kwargs): """ **Bases:** :class:`GraphicsItem `, :class:`QtWidgets.QGraphicsWidget` Extends QGraphicsWidget with several helpful methods and workarounds for PyQt bugs. Most of the extra functionality is inherited from :class:`GraphicsItem `. """ QtWidgets.QGraphicsWidget.__init__(self, *args, **kwargs) GraphicsItem.__init__(self) # cache bounding rect and geometry self._boundingRectCache = self._previousGeometry = None self._painterPathCache = None self.geometryChanged.connect(self._resetCachedProperties) # done by GraphicsItem init # GraphicsScene.registerObject(self) # workaround for pyqt bug in GraphicsScene.items() # Removed due to https://bugreports.qt-project.org/browse/PYSIDE-86 # def itemChange(self, change, value): # # BEWARE: Calling QGraphicsWidget.itemChange can lead to crashing! # # ret = QtWidgets.QGraphicsWidget.itemChange(self, change, value) # segv occurs here # # The default behavior is just to return the value argument, so we'll do that # # without calling the original method. # ret = value # if change in [self.ItemParentHasChanged, self.ItemSceneHasChanged]: # self._updateView() # return ret def _resetCachedProperties(self): self._boundingRectCache = self._previousGeometry = None self._painterPathCache = None def setFixedHeight(self, h): self.setMaximumHeight(h) self.setMinimumHeight(h) def setFixedWidth(self, h): self.setMaximumWidth(h) self.setMinimumWidth(h) def height(self): return self.geometry().height() def width(self): return self.geometry().width() def boundingRect(self): geometry = self.geometry() if geometry != self._previousGeometry: self._painterPathCache = None br = self.mapRectFromParent(geometry).normalized() self._boundingRectCache = br self._previousGeometry = geometry else: br = self._boundingRectCache return QtCore.QRectF(br) def shape(self): p = self._painterPathCache if p is None: self._painterPathCache = p = QtGui.QPainterPath() p.addRect(self.boundingRect()) return p pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/GraphicsWidgetAnchor.py000066400000000000000000000077651457240071200271060ustar00rootroot00000000000000from ..Point import Point __all__ = ['GraphicsWidgetAnchor'] class GraphicsWidgetAnchor(object): """ Class used to allow GraphicsWidgets to anchor to a specific position on their parent. The item will be automatically repositioned if the parent is resized. This is used, for example, to anchor a LegendItem to a corner of its parent PlotItem. """ def __init__(self): self.__parent = None self.__parentAnchor = None self.__itemAnchor = None self.__offset = (0,0) if hasattr(self, 'geometryChanged'): self.geometryChanged.connect(self.__geometryChanged) def anchor(self, itemPos, parentPos, offset=(0,0)): """ Anchors the item at its local itemPos to the item's parent at parentPos. Both positions are expressed in values relative to the size of the item or parent; a value of 0 indicates left or top edge, while 1 indicates right or bottom edge. Optionally, offset may be specified to introduce an absolute offset. Example: anchor a box such that its upper-right corner is fixed 10px left and 10px down from its parent's upper-right corner:: box.anchor(itemPos=(1,0), parentPos=(1,0), offset=(-10,10)) """ parent = self.parentItem() if parent is None: raise Exception("Cannot anchor; parent is not set.") if self.__parent is not parent: if self.__parent is not None: self.__parent.geometryChanged.disconnect(self.__geometryChanged) self.__parent = parent parent.geometryChanged.connect(self.__geometryChanged) self.__itemAnchor = itemPos self.__parentAnchor = parentPos self.__offset = offset self.__geometryChanged() def autoAnchor(self, pos, relative=True): """ Set the position of this item relative to its parent by automatically choosing appropriate anchor settings. If relative is True, one corner of the item will be anchored to the appropriate location on the parent with no offset. The anchored corner will be whichever is closest to the parent's boundary. If relative is False, one corner of the item will be anchored to the same corner of the parent, with an absolute offset to achieve the correct position. """ pos = Point(pos) br = self.mapRectToParent(self.boundingRect()).translated(pos - self.pos()) pbr = self.parentItem().boundingRect() anchorPos = [0,0] parentPos = Point() itemPos = Point() if abs(br.left() - pbr.left()) < abs(br.right() - pbr.right()): anchorPos[0] = 0 parentPos[0] = pbr.left() itemPos[0] = br.left() else: anchorPos[0] = 1 parentPos[0] = pbr.right() itemPos[0] = br.right() if abs(br.top() - pbr.top()) < abs(br.bottom() - pbr.bottom()): anchorPos[1] = 0 parentPos[1] = pbr.top() itemPos[1] = br.top() else: anchorPos[1] = 1 parentPos[1] = pbr.bottom() itemPos[1] = br.bottom() if relative: relPos = [(itemPos[0]-pbr.left()) / pbr.width(), (itemPos[1]-pbr.top()) / pbr.height()] self.anchor(anchorPos, relPos) else: offset = itemPos - parentPos self.anchor(anchorPos, anchorPos, offset) def __geometryChanged(self): if self.__parent is None: return if self.__itemAnchor is None: return o = self.mapToParent(Point(0,0)) a = self.boundingRect().bottomRight() * Point(self.__itemAnchor) a = self.mapToParent(a) p = self.__parent.boundingRect().bottomRight() * Point(self.__parentAnchor) off = Point(self.__offset) pos = p + (o-a) + off self.setPos(pos) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/GridItem.py000066400000000000000000000155211457240071200245400ustar00rootroot00000000000000import numpy as np from .. import functions as fn from .. import getConfigOption from ..Point import Point from ..Qt import QtCore, QtGui from .UIGraphicsItem import UIGraphicsItem __all__ = ['GridItem'] class GridItem(UIGraphicsItem): """ **Bases:** :class:`UIGraphicsItem ` Displays a rectangular grid of lines indicating major divisions within a coordinate system. Automatically determines what divisions to use. """ def __init__(self, pen='default', textPen='default'): UIGraphicsItem.__init__(self) #QtWidgets.QGraphicsItem.__init__(self, *args) #self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemClipsToShape) #self.setCacheMode(QtWidgets.QGraphicsItem.CacheMode.DeviceCoordinateCache) self.opts = {} self.setPen(pen) self.setTextPen(textPen) self.setTickSpacing(x=[None, None, None], y=[None, None, None]) def setPen(self, *args, **kwargs): """Set the pen used to draw the grid.""" if kwargs == {} and (args == () or args == ('default',)): self.opts['pen'] = fn.mkPen(getConfigOption('foreground')) else: self.opts['pen'] = fn.mkPen(*args, **kwargs) self.picture = None self.update() def setTextPen(self, *args, **kwargs): """Set the pen used to draw the texts.""" if kwargs == {} and (args == () or args == ('default',)): self.opts['textPen'] = fn.mkPen(getConfigOption('foreground')) else: if args == (None,): self.opts['textPen'] = None else: self.opts['textPen'] = fn.mkPen(*args, **kwargs) self.picture = None self.update() def setTickSpacing(self, x=None, y=None): """ Set the grid tick spacing to use. Tick spacing for each axis shall be specified as an array of descending values, one for each tick scale. When the value is set to None, grid line distance is chosen automatically for this particular level. Example: Default setting of 3 scales for each axis: setTickSpacing(x=[None, None, None], y=[None, None, None]) Single scale with distance of 1.0 for X axis, Two automatic scales for Y axis: setTickSpacing(x=[1.0], y=[None, None]) Single scale with distance of 1.0 for X axis, Two scales for Y axis, one with spacing of 1.0, other one automatic: setTickSpacing(x=[1.0], y=[1.0, None]) """ self.opts['tickSpacing'] = (x or self.opts['tickSpacing'][0], y or self.opts['tickSpacing'][1]) self.grid_depth = max([len(s) for s in self.opts['tickSpacing']]) self.picture = None self.update() def viewRangeChanged(self): UIGraphicsItem.viewRangeChanged(self) self.picture = None #UIGraphicsItem.viewRangeChanged(self) #self.update() def paint(self, p, opt, widget): #p.setPen(QtGui.QPen(QtGui.QColor(100, 100, 100))) #p.drawRect(self.boundingRect()) #UIGraphicsItem.paint(self, p, opt, widget) ### draw picture if self.picture is None: #print "no pic, draw.." self.generatePicture() p.drawPicture(QtCore.QPointF(0, 0), self.picture) #p.setPen(QtGui.QPen(QtGui.QColor(255,0,0))) #p.drawLine(0, -100, 0, 100) #p.drawLine(-100, 0, 100, 0) #print "drawing Grid." def generatePicture(self): self.picture = QtGui.QPicture() p = QtGui.QPainter() p.begin(self.picture) vr = self.getViewWidget().rect() unit = self.pixelWidth(), self.pixelHeight() dim = [vr.width(), vr.height()] lvr = self.boundingRect() ul = np.array([lvr.left(), lvr.top()]) br = np.array([lvr.right(), lvr.bottom()]) texts = [] if ul[1] > br[1]: x = ul[1] ul[1] = br[1] br[1] = x lastd = [None, None] for i in range(self.grid_depth - 1, -1, -1): dist = br-ul nlTarget = 10.**i d = 10. ** np.floor(np.log10(np.abs(dist/nlTarget))+0.5) for ax in range(0,2): ts = self.opts['tickSpacing'][ax] try: if ts[i] is not None: d[ax] = ts[i] except IndexError: pass lastd[ax] = d[ax] ul1 = np.floor(ul / d) * d br1 = np.ceil(br / d) * d dist = br1-ul1 nl = (dist / d) + 0.5 for ax in range(0,2): ## Draw grid for both axes if i >= len(self.opts['tickSpacing'][ax]): continue if d[ax] < lastd[ax]: continue ppl = dim[ax] / nl[ax] c = int(fn.clip_scalar(5 * (ppl-3), 0, 50)) linePen = self.opts['pen'] lineColor = self.opts['pen'].color() lineColor.setAlpha(c) linePen.setColor(lineColor) textPen = self.opts['textPen'] if textPen is not None: textColor = self.opts['textPen'].color() textColor.setAlpha(c * 2) textPen.setColor(textColor) bx = (ax+1) % 2 for x in range(0, int(nl[ax])): linePen.setCosmetic(True) p.setPen(linePen) p1 = np.array([0.,0.]) p2 = np.array([0.,0.]) p1[ax] = ul1[ax] + x * d[ax] p2[ax] = p1[ax] p1[bx] = ul[bx] p2[bx] = br[bx] ## don't draw lines that are out of bounds. if p1[ax] < min(ul[ax], br[ax]) or p1[ax] > max(ul[ax], br[ax]): continue p.drawLine(QtCore.QPointF(p1[0], p1[1]), QtCore.QPointF(p2[0], p2[1])) if i < 2 and textPen is not None: if ax == 0: x = p1[0] + unit[0] y = ul[1] + unit[1] * 8. else: x = ul[0] + unit[0]*3 y = p1[1] + unit[1] texts.append((QtCore.QPointF(x, y), "%g"%p1[ax])) tr = self.deviceTransform() p.setWorldTransform(fn.invertQTransform(tr)) if textPen is not None and len(texts) > 0: # if there is at least one text, then c is set textColor.setAlpha(c * 2) p.setPen(QtGui.QPen(textColor)) for t in texts: x = tr.map(t[0]) + Point(0.5, 0.5) p.drawText(x, t[1]) p.end() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/HistogramLUTItem.py000066400000000000000000000446571457240071200262110ustar00rootroot00000000000000""" GraphicsWidget displaying an image histogram along with gradient editor. Can be used to adjust the appearance of images. """ import weakref import numpy as np from .. import debug as debug from .. import functions as fn from ..Point import Point from ..Qt import QtCore, QtGui, QtWidgets from .AxisItem import AxisItem from .GradientEditorItem import GradientEditorItem from .GraphicsWidget import GraphicsWidget from .LinearRegionItem import LinearRegionItem from .PlotCurveItem import PlotCurveItem from .ViewBox import ViewBox __all__ = ['HistogramLUTItem'] class HistogramLUTItem(GraphicsWidget): """ :class:`~pyqtgraph.GraphicsWidget` with controls for adjusting the display of an :class:`~pyqtgraph.ImageItem`. Includes: - Image histogram - Movable region over the histogram to select black/white levels - Gradient editor to define color lookup table for single-channel images Parameters ---------- image : pyqtgraph.ImageItem, optional If provided, control will be automatically linked to the image and changes to the control will be reflected in the image's appearance. This may also be set via :meth:`setImageItem`. fillHistogram : bool, optional By default, the histogram is rendered with a fill. Performance may be improved by disabling the fill. Additional control over the fill is provided by :meth:`fillHistogram`. levelMode : str, optional 'mono' (default) One histogram with a :class:`~pyqtgraph.LinearRegionItem` is displayed to control the black/white levels of the image. This option may be used for color images, in which case the histogram and levels correspond to all channels of the image. 'rgba' A histogram and level control pair is provided for each image channel. The alpha channel histogram and level control are only shown if the image contains an alpha channel. gradientPosition : str, optional Position of the gradient editor relative to the histogram. Must be one of {'right', 'left', 'top', 'bottom'}. 'right' and 'left' options should be used with a 'vertical' orientation; 'top' and 'bottom' options are for 'horizontal' orientation. orientation : str, optional The orientation of the axis along which the histogram is displayed. Either 'vertical' (default) or 'horizontal'. Attributes ---------- sigLookupTableChanged : QtCore.Signal Emits the HistogramLUTItem itself when the gradient changes sigLevelsChanged : QtCore.Signal Emits the HistogramLUTItem itself while the movable region is changing sigLevelChangeFinished : QtCore.Signal Emits the HistogramLUTItem itself when the movable region is finished changing See Also -------- :class:`~pyqtgraph.ImageItem` HistogramLUTItem is most useful when paired with an ImageItem. :class:`~pyqtgraph.ImageView` Widget containing a paired ImageItem and HistogramLUTItem. :class:`~pyqtgraph.HistogramLUTWidget` QWidget containing a HistogramLUTItem for widget-based layouts. """ sigLookupTableChanged = QtCore.Signal(object) sigLevelsChanged = QtCore.Signal(object) sigLevelChangeFinished = QtCore.Signal(object) def __init__(self, image=None, fillHistogram=True, levelMode='mono', gradientPosition='right', orientation='vertical'): GraphicsWidget.__init__(self) self.lut = None self.imageItem = lambda: None # fake a dead weakref self.levelMode = levelMode self.orientation = orientation self.gradientPosition = gradientPosition if orientation == 'vertical' and gradientPosition not in {'right', 'left'}: self.gradientPosition = 'right' elif orientation == 'horizontal' and gradientPosition not in {'top', 'bottom'}: self.gradientPosition = 'bottom' self.layout = QtWidgets.QGraphicsGridLayout() self.setLayout(self.layout) self.layout.setContentsMargins(1, 1, 1, 1) self.layout.setSpacing(0) self.vb = ViewBox(parent=self) if self.orientation == 'vertical': self.vb.setMaximumWidth(152) self.vb.setMinimumWidth(45) self.vb.setMouseEnabled(x=False, y=True) else: self.vb.setMaximumHeight(152) self.vb.setMinimumHeight(45) self.vb.setMouseEnabled(x=True, y=False) self.gradient = GradientEditorItem(orientation=self.gradientPosition) self.gradient.loadPreset('grey') # LinearRegionItem orientation refers to the bounding lines regionOrientation = 'horizontal' if self.orientation == 'vertical' else 'vertical' self.regions = [ # single region for mono levelMode LinearRegionItem([0, 1], regionOrientation, swapMode='block'), # r/g/b/a regions for rgba levelMode LinearRegionItem([0, 1], regionOrientation, swapMode='block', pen='r', brush=fn.mkBrush((255, 50, 50, 50)), span=(0., 1/3.)), LinearRegionItem([0, 1], regionOrientation, swapMode='block', pen='g', brush=fn.mkBrush((50, 255, 50, 50)), span=(1/3., 2/3.)), LinearRegionItem([0, 1], regionOrientation, swapMode='block', pen='b', brush=fn.mkBrush((50, 50, 255, 80)), span=(2/3., 1.)), LinearRegionItem([0, 1], regionOrientation, swapMode='block', pen='w', brush=fn.mkBrush((255, 255, 255, 50)), span=(2/3., 1.)) ] self.region = self.regions[0] # for backward compatibility. for region in self.regions: region.setZValue(1000) self.vb.addItem(region) region.lines[0].addMarker('<|', 0.5) region.lines[1].addMarker('|>', 0.5) region.sigRegionChanged.connect(self.regionChanging) region.sigRegionChangeFinished.connect(self.regionChanged) # gradient position to axis orientation ax = {'left': 'right', 'right': 'left', 'top': 'bottom', 'bottom': 'top'}[self.gradientPosition] self.axis = AxisItem(ax, linkView=self.vb, maxTickLength=-10, parent=self) # axis / viewbox / gradient order in the grid avg = (0, 1, 2) if self.gradientPosition in {'right', 'bottom'} else (2, 1, 0) if self.orientation == 'vertical': self.layout.addItem(self.axis, 0, avg[0]) self.layout.addItem(self.vb, 0, avg[1]) self.layout.addItem(self.gradient, 0, avg[2]) else: self.layout.addItem(self.axis, avg[0], 0) self.layout.addItem(self.vb, avg[1], 0) self.layout.addItem(self.gradient, avg[2], 0) self.gradient.setFlag(self.gradient.GraphicsItemFlag.ItemStacksBehindParent) self.vb.setFlag(self.gradient.GraphicsItemFlag.ItemStacksBehindParent) self.gradient.sigGradientChanged.connect(self.gradientChanged) self.vb.sigRangeChanged.connect(self.viewRangeChanged) comp = QtGui.QPainter.CompositionMode.CompositionMode_Plus self.plots = [ PlotCurveItem(pen=(200, 200, 200, 100)), # mono PlotCurveItem(pen=(255, 0, 0, 100), compositionMode=comp), # r PlotCurveItem(pen=(0, 255, 0, 100), compositionMode=comp), # g PlotCurveItem(pen=(0, 0, 255, 100), compositionMode=comp), # b PlotCurveItem(pen=(200, 200, 200, 100), compositionMode=comp), # a ] self.plot = self.plots[0] # for backward compatibility. for plot in self.plots: if self.orientation == 'vertical': plot.setRotation(90) self.vb.addItem(plot) self.fillHistogram(fillHistogram) self._showRegions() self.autoHistogramRange() if image is not None: self.setImageItem(image) def fillHistogram(self, fill=True, level=0.0, color=(100, 100, 200)): """Control fill of the histogram curve(s). Parameters ---------- fill : bool, optional Set whether or not the histogram should be filled. level : float, optional Set the fill level. See :meth:`PlotCurveItem.setFillLevel `. Only used if ``fill`` is True. color : color_like, optional Color to use for the fill when the histogram ``levelMode == "mono"``. See :meth:`PlotCurveItem.setBrush `. """ colors = [color, (255, 0, 0, 50), (0, 255, 0, 50), (0, 0, 255, 50), (255, 255, 255, 50)] for color, plot in zip(colors, self.plots): if fill: plot.setFillLevel(level) plot.setBrush(color) else: plot.setFillLevel(None) def paint(self, p, *args): # paint the bounding edges of the region item and gradient item with lines # connecting them if self.levelMode != 'mono' or not self.region.isVisible(): return pen = self.region.lines[0].pen mn, mx = self.getLevels() vbc = self.vb.viewRect().center() gradRect = self.gradient.mapRectToParent(self.gradient.gradRect.rect()) if self.orientation == 'vertical': p1mn = self.vb.mapFromViewToItem(self, Point(vbc.x(), mn)) + Point(0, 5) p1mx = self.vb.mapFromViewToItem(self, Point(vbc.x(), mx)) - Point(0, 5) if self.gradientPosition == 'right': p2mn = gradRect.bottomLeft() p2mx = gradRect.topLeft() else: p2mn = gradRect.bottomRight() p2mx = gradRect.topRight() else: p1mn = self.vb.mapFromViewToItem(self, Point(mn, vbc.y())) - Point(5, 0) p1mx = self.vb.mapFromViewToItem(self, Point(mx, vbc.y())) + Point(5, 0) if self.gradientPosition == 'bottom': p2mn = gradRect.topLeft() p2mx = gradRect.topRight() else: p2mn = gradRect.bottomLeft() p2mx = gradRect.bottomRight() p.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing) for pen in [fn.mkPen((0, 0, 0, 100), width=3), pen]: p.setPen(pen) # lines from the linear region item bounds to the gradient item bounds p.drawLine(p1mn, p2mn) p.drawLine(p1mx, p2mx) # lines bounding the edges of the gradient item if self.orientation == 'vertical': p.drawLine(gradRect.topLeft(), gradRect.topRight()) p.drawLine(gradRect.bottomLeft(), gradRect.bottomRight()) else: p.drawLine(gradRect.topLeft(), gradRect.bottomLeft()) p.drawLine(gradRect.topRight(), gradRect.bottomRight()) def setHistogramRange(self, mn, mx, padding=0.1): """Set the X/Y range on the histogram plot, depending on the orientation. This disables auto-scaling.""" if self.orientation == 'vertical': self.vb.enableAutoRange(self.vb.YAxis, False) self.vb.setYRange(mn, mx, padding) else: self.vb.enableAutoRange(self.vb.XAxis, False) self.vb.setXRange(mn, mx, padding) def getHistogramRange(self): """Returns range on the histogram plot.""" if self.orientation == 'vertical': return self.vb.viewRange()[1] else: return self.vb.viewRange()[0] def autoHistogramRange(self): """Enable auto-scaling on the histogram plot.""" self.vb.enableAutoRange(self.vb.XYAxes) def disableAutoHistogramRange(self): """Disable auto-scaling on the histogram plot.""" self.vb.disableAutoRange(self.vb.XYAxes) def setImageItem(self, img): """Set an ImageItem to have its levels and LUT automatically controlled by this HistogramLUTItem. """ self.imageItem = weakref.ref(img) if hasattr(img, 'sigImageChanged'): img.sigImageChanged.connect(self.imageChanged) self._setImageLookupTable() self.regionChanged() self.imageChanged(autoLevel=True) def viewRangeChanged(self): self.update() def gradientChanged(self): if self.imageItem() is not None: self._setImageLookupTable() self.lut = None self.sigLookupTableChanged.emit(self) def _setImageLookupTable(self): if self.gradient.isLookupTrivial(): self.imageItem().setLookupTable(None) else: self.imageItem().setLookupTable(self.getLookupTable) def getLookupTable(self, img=None, n=None, alpha=None): """Return a lookup table from the color gradient defined by this HistogramLUTItem. """ if self.levelMode != 'mono': return None if n is None: if img.dtype == np.uint8: n = 256 else: n = 512 if self.lut is None: self.lut = self.gradient.getLookupTable(n, alpha=alpha) return self.lut def regionChanged(self): if self.imageItem() is not None: self.imageItem().setLevels(self.getLevels()) self.sigLevelChangeFinished.emit(self) def regionChanging(self): if self.imageItem() is not None: self.imageItem().setLevels(self.getLevels()) self.update() self.sigLevelsChanged.emit(self) def imageChanged(self, autoLevel=False, autoRange=False): if self.imageItem() is None: return if self.levelMode == 'mono': for plt in self.plots[1:]: plt.setVisible(False) self.plots[0].setVisible(True) # plot one histogram for all image data profiler = debug.Profiler() h = self.imageItem().getHistogram() profiler('get histogram') if h[0] is None: return self.plot.setData(*h) profiler('set plot') if autoLevel: mn = h[0][0] mx = h[0][-1] self.region.setRegion([mn, mx]) profiler('set region') else: mn, mx = self.imageItem().getLevels() self.region.setRegion([mn, mx]) else: # plot one histogram for each channel self.plots[0].setVisible(False) ch = self.imageItem().getHistogram(perChannel=True) if ch[0] is None: return for i in range(1, 5): if len(ch) >= i: h = ch[i-1] self.plots[i].setVisible(True) self.plots[i].setData(*h) if autoLevel: mn = h[0][0] mx = h[0][-1] self.regions[i].setRegion([mn, mx]) else: # hide channels not present in image data self.plots[i].setVisible(False) # make sure we are displaying the correct number of channels self._showRegions() def getLevels(self): """Return the min and max levels. For rgba mode, this returns a list of the levels for each channel. """ if self.levelMode == 'mono': return self.region.getRegion() else: nch = self.imageItem().channels() if nch is None: nch = 3 return [r.getRegion() for r in self.regions[1:nch+1]] def setLevels(self, min=None, max=None, rgba=None): """Set the min/max (bright and dark) levels. Parameters ---------- min : float, optional Minimum level. max : float, optional Maximum level. rgba : list, optional Sequence of (min, max) pairs for each channel for 'rgba' mode. """ if None in {min, max} and (rgba is None or None in rgba[0]): raise ValueError("Must specify min and max levels") if self.levelMode == 'mono': if min is None: min, max = rgba[0] self.region.setRegion((min, max)) else: if rgba is None: rgba = 4*[(min, max)] for levels, region in zip(rgba, self.regions[1:]): region.setRegion(levels) def setLevelMode(self, mode): """Set the method of controlling the image levels offered to the user. Options are 'mono' or 'rgba'. """ if mode not in {'mono', 'rgba'}: raise ValueError(f"Level mode must be one of {{'mono', 'rgba'}}, got {mode}") if mode == self.levelMode: return oldLevels = self.getLevels() self.levelMode = mode self._showRegions() # do our best to preserve old levels if mode == 'mono': levels = np.array(oldLevels).mean(axis=0) self.setLevels(*levels) else: levels = [oldLevels] * 4 self.setLevels(rgba=levels) # force this because calling self.setLevels might not set the imageItem # levels if there was no change to the region item if self.imageItem() is not None: self.imageItem().setLevels(self.getLevels()) self.imageChanged() self.update() def _showRegions(self): for i in range(len(self.regions)): self.regions[i].setVisible(False) if self.levelMode == 'rgba': nch = 4 if self.imageItem() is not None: # Only show rgb channels if connected image lacks alpha. nch = self.imageItem().channels() if nch is None: nch = 3 xdif = 1.0 / nch for i in range(1, nch+1): self.regions[i].setVisible(True) self.regions[i].setSpan((i-1) * xdif, i * xdif) self.gradient.hide() elif self.levelMode == 'mono': self.regions[0].setVisible(True) self.gradient.show() else: raise ValueError(f"Unknown level mode {self.levelMode}") def saveState(self): return { 'gradient': self.gradient.saveState(), 'levels': self.getLevels(), 'mode': self.levelMode, } def restoreState(self, state): if 'mode' in state: self.setLevelMode(state['mode']) self.gradient.restoreState(state['gradient']) self.setLevels(*state['levels']) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ImageItem.py000066400000000000000000001026001457240071200246700ustar00rootroot00000000000000import warnings from collections.abc import Callable import numpy from .. import colormap from .. import debug as debug from .. import functions as fn from .. import functions_qimage from .. import getConfigOption from ..Point import Point from ..Qt import QtCore, QtGui, QtWidgets from ..util.cupy_helper import getCupy from .GraphicsObject import GraphicsObject translate = QtCore.QCoreApplication.translate __all__ = ['ImageItem'] class ImageItem(GraphicsObject): """ **Bases:** :class:`GraphicsObject ` """ # Overall description of ImageItem (including examples) moved to documentation text sigImageChanged = QtCore.Signal() sigRemoveRequested = QtCore.Signal(object) # self; emitted when 'remove' is selected from context menu def __init__(self, image=None, **kargs): """ See :func:`~pyqtgraph.ImageItem.setOpts` for further keyword arguments and and :func:`~pyqtgraph.ImageItem.setImage` for information on supported formats. Parameters ---------- image: np.ndarray, optional Image data """ GraphicsObject.__init__(self) self.menu = None self.image = None ## original image data self.qimage = None ## rendered image for display self.paintMode = None self.levels = None ## [min, max] or [[redMin, redMax], ...] self.lut = None self.autoDownsample = False self._colorMap = None # This is only set if a color map is assigned directly self._lastDownsample = (1, 1) self._processingBuffer = None self._displayBuffer = None self._renderRequired = True self._unrenderable = False self._xp = None # either numpy or cupy, to match the image data self._defferedLevels = None self._imageHasNans = None # None : not yet known self.axisOrder = getConfigOption('imageAxisOrder') self._dataTransform = self._inverseDataTransform = None self._update_data_transforms( self.axisOrder ) # install initial transforms self.drawKernel = None self.border = None self.removable = False if image is not None: self.setImage(image, **kargs) else: self.setOpts(**kargs) def setCompositionMode(self, mode): """ Change the composition mode of the item. This is useful when overlaying multiple items. Parameters ---------- mode : ``QtGui.QPainter.CompositionMode`` Composition of the item, often used when overlaying items. Common options include: ``QPainter.CompositionMode.CompositionMode_SourceOver`` (Default) Image replaces the background if it is opaque. Otherwise, it uses the alpha channel to blend the image with the background. ``QPainter.CompositionMode.CompositionMode_Overlay`` Image color is mixed with the background color to reflect the lightness or darkness of the background ``QPainter.CompositionMode.CompositionMode_Plus`` Both the alpha and color of the image and background pixels are added together. ``QPainter.CompositionMode.CompositionMode_Plus`` The output is the image color multiplied by the background. See ``QPainter::CompositionMode`` in the Qt Documentation for more options and details """ self.paintMode = mode self.update() def setBorder(self, b): """ Defines the border drawn around the image. Accepts all arguments supported by :func:`~pyqtgraph.mkPen`. """ self.border = fn.mkPen(b) self.update() def width(self): if self.image is None: return None axis = 0 if self.axisOrder == 'col-major' else 1 return self.image.shape[axis] def height(self): if self.image is None: return None axis = 1 if self.axisOrder == 'col-major' else 0 return self.image.shape[axis] def channels(self): if self.image is None: return None return self.image.shape[2] if self.image.ndim == 3 else 1 def boundingRect(self): if self.image is None: return QtCore.QRectF(0., 0., 0., 0.) return QtCore.QRectF(0., 0., float(self.width()), float(self.height())) def setLevels(self, levels, update=True): """ Sets image scaling levels. See :func:`makeARGB ` for more details on how levels are applied. Parameters ---------- levels: array_like - ``[blackLevel, whiteLevel]`` sets black and white levels for monochrome data and can be used with a lookup table. - ``[[minR, maxR], [minG, maxG], [minB, maxB]]`` sets individual scaling for RGB values. Not compatible with lookup tables. update: bool, optional Controls if image immediately updates to reflect the new levels. """ if self._xp is None: self.levels = levels self._defferedLevels = levels return if levels is not None: levels = self._xp.asarray(levels) self.levels = levels if update: self.updateImage() def getLevels(self): """ Returns the list representing the current level settings. See :func:`~setLevels`. When ``autoLevels`` is active, the format is ``[blackLevel, whiteLevel]``. """ return self.levels def setColorMap(self, colorMap): """ Sets a color map for false color display of a monochrome image. Parameters ---------- colorMap : :class:`~pyqtgraph.ColorMap` or `str` A string argument will be passed to :func:`colormap.get() ` """ if isinstance(colorMap, colormap.ColorMap): self._colorMap = colorMap elif isinstance(colorMap, str): self._colorMap = colormap.get(colorMap) else: raise TypeError("'colorMap' argument must be ColorMap or string") self.setLookupTable( self._colorMap.getLookupTable(nPts=256) ) def getColorMap(self): """ Returns the assigned :class:`pyqtgraph.ColorMap`, or `None` if not available """ return self._colorMap def setLookupTable(self, lut, update=True): """ Sets lookup table ``lut`` to use for false color display of a monochrome image. See :func:`makeARGB ` for more information on how this is used. Optionally, `lut` can be a callable that accepts the current image as an argument and returns the lookup table to use. Ordinarily, this table is supplied by a :class:`~pyqtgraph.HistogramLUTItem`, :class:`~pyqtgraph.GradientEditorItem` or :class:`~pyqtgraph.ColorBarItem`. Setting ``update = False`` avoids an immediate image update. """ if lut is not self.lut: if self._xp is not None: lut = self._ensure_proper_substrate(lut, self._xp) self.lut = lut if update: self.updateImage() @staticmethod def _ensure_proper_substrate(data, substrate): if data is None or isinstance(data, Callable) or isinstance(data, substrate.ndarray): return data cupy = getCupy() if substrate == cupy and not isinstance(data, cupy.ndarray): data = cupy.asarray(data) elif substrate == numpy: if cupy is not None and isinstance(data, cupy.ndarray): data = data.get() else: data = numpy.asarray(data) return data def setAutoDownsample(self, active=True): """ Controls automatic downsampling for this ImageItem. If `active` is `True`, the image is automatically downsampled to match the screen resolution. This improves performance for large images and reduces aliasing. If `autoDownsample` is not specified, then ImageItem will choose whether to downsample the image based on its size. `False` disables automatic downsampling. """ self.autoDownsample = active self._renderRequired = True self.update() def setOpts(self, update=True, **kargs): """ Sets display and processing options for this ImageItem. :func:`~pyqtgraph.ImageItem.__init__` and :func:`~pyqtgraph.ImageItem.setImage` support all keyword arguments listed here. Parameters ---------- autoDownsample: bool See :func:`~pyqtgraph.ImageItem.setAutoDownsample`. axisOrder: str | `'col-major'`: The shape of the array represents (width, height) of the image. This is the default. | `'row-major'`: The shape of the array represents (height, width). border: bool Sets a pen to draw to draw an image border. See :func:`~pyqtgraph.ImageItem.setBorder`. compositionMode: See :func:`~pyqtgraph.ImageItem.setCompositionMode` colorMap: :class:`~pyqtgraph.ColorMap` or `str` Sets a color map. A string will be passed to :func:`colormap.get() ` lut: array_like Sets a color lookup table to use when displaying the image. See :func:`~pyqtgraph.ImageItem.setLookupTable`. levels: array_like Shape of (min, max). Sets minimum and maximum values to use when rescaling the image data. By default, these will be set to the estimated minimum and maximum values in the image. If the image array has dtype uint8, no rescaling is necessary. See :func:`~pyqtgraph.ImageItem.setLevels`. opacity: float Overall opacity for an RGB image. Between 0.0-1.0. rect: :class:`QRectF`, :class:`QRect` or array_like Displays the current image within the specified rectangle in plot coordinates. If ``array_like``, should be of the of ``floats (`x`,`y`,`w`,`h`)`` . See :func:`~pyqtgraph.ImageItem.setRect`. update : bool, optional Controls if image immediately updates to reflect the new options. """ if 'axisOrder' in kargs: val = kargs['axisOrder'] if val not in ('row-major', 'col-major'): raise ValueError("axisOrder must be either 'row-major' or 'col-major'") self.axisOrder = val self._update_data_transforms(self.axisOrder) # update cached transforms if 'colorMap' in kargs: self.setColorMap(kargs['colorMap']) if 'lut' in kargs: self.setLookupTable(kargs['lut'], update=update) if 'levels' in kargs: self.setLevels(kargs['levels'], update=update) #if 'clipLevel' in kargs: #self.setClipLevel(kargs['clipLevel']) if 'opacity' in kargs: self.setOpacity(kargs['opacity']) if 'compositionMode' in kargs: self.setCompositionMode(kargs['compositionMode']) if 'border' in kargs: self.setBorder(kargs['border']) if 'removable' in kargs: self.removable = kargs['removable'] self.menu = None if 'autoDownsample' in kargs: self.setAutoDownsample(kargs['autoDownsample']) if 'rect' in kargs: self.setRect(kargs['rect']) if update: self.update() def setRect(self, *args): """ setRect(rect) or setRect(x,y,w,h) Sets translation and scaling of this ImageItem to display the current image within the rectangle given as ``rect`` (:class:`QtCore.QRect` or :class:`QtCore.QRectF`), or described by parameters `x, y, w, h`, defining starting position, width and height. This method cannot be used before an image is assigned. See the :ref:`examples ` for how to manually set transformations. """ if len(args) == 0: self.resetTransform() # reset scaling and rotation when called without argument return if isinstance(args[0], (QtCore.QRectF, QtCore.QRect)): rect = args[0] # use QRectF or QRect directly else: if hasattr(args[0],'__len__'): args = args[0] # promote tuple or list of values rect = QtCore.QRectF( *args ) # QRectF(x,y,w,h), but also accepts other initializers tr = QtGui.QTransform() tr.translate(rect.left(), rect.top()) tr.scale(rect.width() / self.width(), rect.height() / self.height()) self.setTransform(tr) def clear(self): """ Clears the assigned image. """ self.image = None self.prepareGeometryChange() self.informViewBoundsChanged() self.update() def _buildQImageBuffer(self, shape): self._displayBuffer = numpy.empty(shape[:2] + (4,), dtype=numpy.ubyte) if self._xp == getCupy(): self._processingBuffer = self._xp.empty(shape[:2] + (4,), dtype=self._xp.ubyte) else: self._processingBuffer = self._displayBuffer self.qimage = None def setImage(self, image=None, autoLevels=None, **kargs): """ Updates the image displayed by this ImageItem. For more information on how the image is processed before displaying, see :func:`~pyqtgraph.makeARGB`. For backward compatibility, image data is assumed to be in column-major order (column, row) by default. However, most data is stored in row-major order (row, column). It can either be transposed before assignment:: imageitem.setImage(imagedata.T) or the interpretation of the data can be changed locally through the ``axisOrder`` keyword or by changing the `imageAxisOrder` :ref:`global configuration option ` All keywords supported by :func:`~pyqtgraph.ImageItem.setOpts` are also allowed here. Parameters ---------- image: np.ndarray, optional Image data given as NumPy array with an integer or floating point dtype of any bit depth. A 2-dimensional array describes single-valued (monochromatic) data. A 3-dimensional array is used to give individual color components. The third dimension must be of length 3 (RGB) or 4 (RGBA). rect: QRectF or QRect or array_like, optional If given, sets translation and scaling to display the image within the specified rectangle. If ``array_like`` should be the form of floats ``[x, y, w, h]`` See :func:`~pyqtgraph.ImageItem.setRect` autoLevels: bool, optional If `True`, ImageItem will automatically select levels based on the maximum and minimum values encountered in the data. For performance reasons, this search subsamples the images and may miss individual bright or or dark points in the data set. If `False`, the search will be omitted. The default is `False` if a ``levels`` keyword argument is given, and `True` otherwise. levelSamples: int, default 65536 When determining minimum and maximum values, ImageItem only inspects a subset of pixels no larger than this number. Setting this larger than the total number of pixels considers all values. """ profile = debug.Profiler() gotNewData = False if image is None: if self.image is None: return else: old_xp = self._xp cp = getCupy() self._xp = cp.get_array_module(image) if cp else numpy gotNewData = True processingSubstrateChanged = old_xp != self._xp if processingSubstrateChanged: self._processingBuffer = None shapeChanged = (processingSubstrateChanged or self.image is None or image.shape != self.image.shape) image = image.view() self.image = image self._imageHasNans = None if self.image.shape[0] > 2**15-1 or self.image.shape[1] > 2**15-1: if 'autoDownsample' not in kargs: kargs['autoDownsample'] = True if shapeChanged: self.prepareGeometryChange() self.informViewBoundsChanged() profile() if autoLevels is None: if 'levels' in kargs: autoLevels = False else: autoLevels = True if autoLevels: level_samples = kargs.pop('levelSamples', 2**16) mn, mx = self.quickMinMax( targetSize=level_samples ) # mn and mx can still be NaN if the data is all-NaN if mn == mx or self._xp.isnan(mn) or self._xp.isnan(mx): mn = 0 mx = 255 kargs['levels'] = [mn,mx] profile() self.setOpts(update=False, **kargs) profile() self._renderRequired = True self.update() profile() if gotNewData: self.sigImageChanged.emit() if self._defferedLevels is not None: levels = self._defferedLevels self._defferedLevels = None self.setLevels((levels)) def _update_data_transforms(self, axisOrder='col-major'): """ Sets up the transforms needed to map between input array and display """ self._dataTransform = QtGui.QTransform() self._inverseDataTransform = QtGui.QTransform() if self.axisOrder == 'row-major': # transpose both self._dataTransform.scale(1, -1) self._dataTransform.rotate(-90) self._inverseDataTransform.scale(1, -1) self._inverseDataTransform.rotate(-90) def dataTransform(self): """ Returns the transform that maps from this image's input array to its local coordinate system. This transform corrects for the transposition that occurs when image data is interpreted in row-major order. :meta private: """ # Might eventually need to account for downsampling / clipping here # transforms are updated in setOpts call. return self._dataTransform def inverseDataTransform(self): """Return the transform that maps from this image's local coordinate system to its input array. See dataTransform() for more information. :meta private: """ # transforms are updated in setOpts call. return self._inverseDataTransform def mapToData(self, obj): return self._inverseDataTransform.map(obj) def mapFromData(self, obj): return self._dataTransform.map(obj) def quickMinMax(self, targetSize=1e6): """ Estimates the min/max values of the image data by subsampling. Subsampling is performed at regular strides chosen to evaluate a number of samples equal to or less than `targetSize`. Returns (`min`, `max`). """ data = self.image if targetSize < 2: # keep at least two pixels targetSize = 2 while True: h, w = data.shape[:2] if h * w <= targetSize: break if h > w: data = data[::2, ::] # downsample first axis else: data = data[::, ::2] # downsample second axis return self._xp.nanmin(data), self._xp.nanmax(data) def updateImage(self, *args, **kargs): ## used for re-rendering qimage from self.image. ## can we make any assumptions here that speed things up? ## dtype, range, size are all the same? defaults = { 'autoLevels': False, } defaults.update(kargs) return self.setImage(*args, **defaults) def render(self): # Convert data to QImage for display. self._unrenderable = True if self.image is None or self.image.size == 0: return # Request a lookup table if this image has only one channel if self.image.ndim == 2 or self.image.shape[2] == 1: self.lut = self._ensure_proper_substrate(self.lut, self._xp) if isinstance(self.lut, Callable): lut = self._ensure_proper_substrate(self.lut(self.image, 256), self._xp) else: lut = self.lut else: lut = None if self.autoDownsample: xds, yds = self._computeDownsampleFactors() if xds is None: return axes = [1, 0] if self.axisOrder == 'row-major' else [0, 1] image = fn.downsample(self.image, xds, axis=axes[0]) image = fn.downsample(image, yds, axis=axes[1]) self._lastDownsample = (xds, yds) # Check if downsampling reduced the image size to zero due to inf values. if image.size == 0: return else: image = self.image # Convert single-channel image to 2D array if image.ndim == 3 and image.shape[-1] == 1: image = image[..., 0] # Assume images are in column-major order for backward compatibility # (most images are in row-major order) if self.axisOrder == 'col-major': image = image.swapaxes(0, 1) levels = self.levels if self._imageHasNans is None: # awkward, but fastest numpy native nan evaluation self._imageHasNans = ( image.dtype.kind == 'f' and self._xp.isnan(image.min()) ) qimage = None if lut is not None and lut.dtype != self._xp.uint8: # Both _rescale_float_mono() and _try_combine_lut() assume that # lut is of type uint8. It is considered a usage error if that # is not the case. # However, the makeARGB() codepath has previously allowed such # a usage to work. Rather than fail outright, we delegate this # case to makeARGB(). warnings.warn( "Using non-uint8 LUTs is an undocumented accidental feature and may " "be removed at some point in the future. Please open an issue if you " "instead believe this to be worthy of protected inclusion in pyqtgraph.", DeprecationWarning, stacklevel=2) elif not self._imageHasNans: qimage = functions_qimage.try_make_qimage(image, levels=levels, lut=lut) if qimage is not None: self._processingBuffer = None self._displayBuffer = None self.qimage = qimage self._renderRequired = False self._unrenderable = False return if self._processingBuffer is None or self._processingBuffer.shape[:2] != image.shape[:2]: self._buildQImageBuffer(image.shape) fn.makeARGB(image, lut=lut, levels=levels, output=self._processingBuffer) if self._xp == getCupy(): self._processingBuffer.get(out=self._displayBuffer) self.qimage = fn.ndarray_to_qimage(self._displayBuffer, QtGui.QImage.Format.Format_ARGB32) self._renderRequired = False self._unrenderable = False def paint(self, p, *args): profile = debug.Profiler() if self.image is None: return if self._renderRequired: self.render() if self._unrenderable: return profile('render QImage') if self.paintMode is not None: p.setCompositionMode(self.paintMode) profile('set comp mode') shape = self.image.shape[:2] if self.axisOrder == 'col-major' else self.image.shape[:2][::-1] p.drawImage(QtCore.QRectF(0,0,*shape), self.qimage) profile('p.drawImage') if self.border is not None: p.setPen(self.border) p.drawRect(self.boundingRect()) def save(self, fileName, *args): """ Saves this image to file. Note that this saves the visible image (after scale/color changes), not the original data. """ if self._renderRequired: self.render() self.qimage.save(fileName, *args) def getHistogram(self, bins='auto', step='auto', perChannel=False, targetImageSize=200, targetHistogramSize=500, **kwds): """ Returns `x` and `y` arrays containing the histogram values for the current image. For an explanation of the return format, see :func:`numpy.histogram()`. The `step` argument causes pixels to be skipped when computing the histogram to save time. If `step` is 'auto', then a step is chosen such that the analyzed data has dimensions approximating `targetImageSize` for each axis. The `bins` argument and any extra keyword arguments are passed to :func:`numpy.histogram()`. If `bins` is `auto`, a bin number is automatically chosen based on the image characteristics: * Integer images will have approximately `targetHistogramSize` bins, with each bin having an integer width. * All other types will have `targetHistogramSize` bins. If `perChannel` is `True`, then a histogram is computed for each channel, and the output is a list of the results. """ # This method is also used when automatically computing levels. if self.image is None or self.image.size == 0: return None, None if step == 'auto': step = (max(1, int(self._xp.ceil(self.image.shape[0] / targetImageSize))), max(1, int(self._xp.ceil(self.image.shape[1] / targetImageSize)))) if self._xp.isscalar(step): step = (step, step) stepData = self.image[::step[0], ::step[1]] if isinstance(bins, str) and bins == 'auto': mn = self._xp.nanmin(stepData).item() mx = self._xp.nanmax(stepData).item() if mx == mn: # degenerate image, arange will fail mx += 1 if self._xp.isnan(mn) or self._xp.isnan(mx): # the data are all-nan return None, None if stepData.dtype.kind in "ui": # For integer data, we select the bins carefully to avoid aliasing step = int(self._xp.ceil((mx - mn) / 500.)) bins = [] if step > 0.0: bins = self._xp.arange(mn, mx + 1.01 * step, step, dtype=int) else: # for float data, let numpy select the bins. bins = self._xp.linspace(mn, mx, 500) if len(bins) == 0: bins = self._xp.asarray((mn, mx)) kwds['bins'] = bins cp = getCupy() if perChannel: hist = [] for i in range(stepData.shape[-1]): stepChan = stepData[..., i] stepChan = stepChan[self._xp.isfinite(stepChan)] h = self._xp.histogram(stepChan, **kwds) if cp: hist.append((cp.asnumpy(h[1][:-1]), cp.asnumpy(h[0]))) else: hist.append((h[1][:-1], h[0])) return hist else: stepData = stepData[self._xp.isfinite(stepData)] hist = self._xp.histogram(stepData, **kwds) if cp: return cp.asnumpy(hist[1][:-1]), cp.asnumpy(hist[0]) else: return hist[1][:-1], hist[0] def setPxMode(self, b): """ Sets whether the item ignores transformations and draws directly to screen pixels. If `True`, the item will not inherit any scale or rotation transformations from its parent items, but its position will be transformed as usual. (see ``GraphicsItem::ItemIgnoresTransformations`` in the Qt documentation) """ self.setFlag(self.GraphicsItemFlag.ItemIgnoresTransformations, b) def setScaledMode(self): self.setPxMode(False) def getPixmap(self): if self._renderRequired: self.render() if self._unrenderable: return None return QtGui.QPixmap.fromImage(self.qimage) def pixelSize(self): """ Returns the scene-size of a single pixel in the image """ br = self.sceneBoundingRect() if self.image is None: return 1,1 return br.width()/self.width(), br.height()/self.height() def viewTransformChanged(self): if self.autoDownsample: xds, yds = self._computeDownsampleFactors() if xds is None: self._renderRequired = True self._unrenderable = True return if (xds, yds) != self._lastDownsample: self._renderRequired = True self.update() def _computeDownsampleFactors(self): # reduce dimensions of image based on screen resolution o = self.mapToDevice(QtCore.QPointF(0, 0)) x = self.mapToDevice(QtCore.QPointF(1, 0)) y = self.mapToDevice(QtCore.QPointF(0, 1)) # scene may not be available yet if o is None: return None, None w = Point(x - o).length() h = Point(y - o).length() if w == 0 or h == 0: return None, None return max(1, int(1.0 / w)), max(1, int(1.0 / h)) def mouseDragEvent(self, ev): if ev.button() != QtCore.Qt.MouseButton.LeftButton: ev.ignore() return elif self.drawKernel is not None: ev.accept() self.drawAt(ev.pos(), ev) def mouseClickEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.RightButton: if self.raiseContextMenu(ev): ev.accept() if self.drawKernel is not None and ev.button() == QtCore.Qt.MouseButton.LeftButton: self.drawAt(ev.pos(), ev) def raiseContextMenu(self, ev): menu = self.getMenu() if menu is None: return False menu = self.scene().addParentContextMenus(self, menu, ev) pos = ev.screenPos() menu.popup(QtCore.QPoint(int(pos.x()), int(pos.y()))) return True def getMenu(self): if self.menu is None: if not self.removable: return None self.menu = QtWidgets.QMenu() self.menu.setTitle(translate("ImageItem", "Image")) remAct = QtGui.QAction(translate("ImageItem", "Remove image"), self.menu) remAct.triggered.connect(self.removeClicked) self.menu.addAction(remAct) self.menu.remAct = remAct return self.menu def hoverEvent(self, ev): if not ev.isExit() and self.drawKernel is not None and ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton): ev.acceptClicks(QtCore.Qt.MouseButton.LeftButton) ## we don't use the click, but we also don't want anyone else to use it. ev.acceptClicks(QtCore.Qt.MouseButton.RightButton) elif not ev.isExit() and self.removable: ev.acceptClicks(QtCore.Qt.MouseButton.RightButton) ## accept context menu clicks def tabletEvent(self, ev): pass #print(ev.device()) #print(ev.pointerType()) #print(ev.pressure()) def drawAt(self, pos, ev=None): if self.axisOrder == "col-major": pos = [int(pos.x()), int(pos.y())] else: pos = [int(pos.y()), int(pos.x())] dk = self.drawKernel kc = self.drawKernelCenter sx = [0,dk.shape[0]] sy = [0,dk.shape[1]] tx = [pos[0] - kc[0], pos[0] - kc[0]+ dk.shape[0]] ty = [pos[1] - kc[1], pos[1] - kc[1]+ dk.shape[1]] for i in [0,1]: dx1 = -min(0, tx[i]) dx2 = min(0, self.image.shape[0]-tx[i]) tx[i] += dx1+dx2 sx[i] += dx1+dx2 dy1 = -min(0, ty[i]) dy2 = min(0, self.image.shape[1]-ty[i]) ty[i] += dy1+dy2 sy[i] += dy1+dy2 ts = (slice(tx[0],tx[1]), slice(ty[0],ty[1])) ss = (slice(sx[0],sx[1]), slice(sy[0],sy[1])) mask = self.drawMask src = dk if isinstance(self.drawMode, Callable): self.drawMode(dk, self.image, mask, ss, ts, ev) else: src = src[ss] if self.drawMode == 'set': if mask is not None: mask = mask[ss] self.image[ts] = self.image[ts] * (1-mask) + src * mask else: self.image[ts] = src elif self.drawMode == 'add': self.image[ts] += src else: raise Exception("Unknown draw mode '%s'" % self.drawMode) self.updateImage() def setDrawKernel(self, kernel=None, mask=None, center=(0,0), mode='set'): self.drawKernel = kernel self.drawKernelCenter = center self.drawMode = mode self.drawMask = mask def removeClicked(self): ## Send remove event only after we have exited the menu event handler self.removeTimer = QtCore.QTimer() self.removeTimer.timeout.connect(self.emitRemoveRequested) self.removeTimer.start(0) def emitRemoveRequested(self): self.removeTimer.timeout.disconnect(self.emitRemoveRequested) self.sigRemoveRequested.emit(self) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/InfiniteLine.py000066400000000000000000000557171457240071200254240ustar00rootroot00000000000000from math import atan2, degrees import numpy as np from .. import functions as fn from ..Point import Point from ..Qt import QtCore, QtGui from .GraphicsItem import GraphicsItem from .GraphicsObject import GraphicsObject from .TextItem import TextItem from .ViewBox import ViewBox __all__ = ['InfiniteLine', 'InfLineLabel'] class InfiniteLine(GraphicsObject): """ **Bases:** :class:`GraphicsObject ` Displays a line of infinite length. This line may be dragged to indicate a position in data coordinates. =============================== =================================================== **Signals:** sigDragged(self) sigPositionChangeFinished(self) sigPositionChanged(self) sigClicked(self, ev) =============================== =================================================== """ sigDragged = QtCore.Signal(object) sigPositionChangeFinished = QtCore.Signal(object) sigPositionChanged = QtCore.Signal(object) sigClicked = QtCore.Signal(object, object) def __init__(self, pos=None, angle=90, pen=None, movable=False, bounds=None, hoverPen=None, label=None, labelOpts=None, span=(0, 1), markers=None, name=None): """ =============== ================================================================== **Arguments:** pos Position of the line. This can be a QPointF or a single value for vertical/horizontal lines. angle Angle of line in degrees. 0 is horizontal, 90 is vertical. pen Pen to use when drawing line. Can be any arguments that are valid for :func:`mkPen `. Default pen is transparent yellow. hoverPen Pen to use when the mouse cursor hovers over the line. Only used when movable=True. movable If True, the line can be dragged to a new position by the user. bounds Optional [min, max] bounding values. Bounds are only valid if the line is vertical or horizontal. hoverPen Pen to use when drawing line when hovering over it. Can be any arguments that are valid for :func:`mkPen `. Default pen is red. label Text to be displayed in a label attached to the line, or None to show no label (default is None). May optionally include formatting strings to display the line value. labelOpts A dict of keyword arguments to use when constructing the text label. See :class:`InfLineLabel `. span Optional tuple (min, max) giving the range over the view to draw the line. For example, with a vertical line, use span=(0.5, 1) to draw only on the top half of the view. markers List of (marker, position, size) tuples, one per marker to display on the line. See the addMarker method. name Name of the item =============== ================================================================== """ self._boundingRect = None self._name = name GraphicsObject.__init__(self) if bounds is None: ## allowed value boundaries for orthogonal lines self.maxRange = [None, None] else: self.maxRange = bounds self.moving = False self.setMovable(movable) self.mouseHovering = False self.p = [0, 0] self.setAngle(angle) if pos is None: pos = Point(0,0) self.setPos(pos) if pen is None: pen = (200, 200, 100) self.setPen(pen) if hoverPen is None: self.setHoverPen(color=(255,0,0), width=self.pen.width()) else: self.setHoverPen(hoverPen) self.span = span self.currentPen = self.pen self.markers = [] self._maxMarkerSize = 0 if markers is not None: for m in markers: self.addMarker(*m) # Cache variables for managing bounds self._endPoints = [0, 1] # self._bounds = None self._lastViewSize = None if label is not None: labelOpts = {} if labelOpts is None else labelOpts self.label = InfLineLabel(self, text=label, **labelOpts) def setMovable(self, m): """Set whether the line is movable by the user.""" self.movable = m self.setAcceptHoverEvents(m) def setBounds(self, bounds): """Set the (minimum, maximum) allowable values when dragging.""" self.maxRange = bounds self.setValue(self.value()) def bounds(self): """Return the (minimum, maximum) values allowed when dragging. """ return self.maxRange[:] def setPen(self, *args, **kwargs): """Set the pen for drawing the line. Allowable arguments are any that are valid for :func:`mkPen `.""" self.pen = fn.mkPen(*args, **kwargs) if not self.mouseHovering: self.currentPen = self.pen self.update() def setHoverPen(self, *args, **kwargs): """Set the pen for drawing the line while the mouse hovers over it. Allowable arguments are any that are valid for :func:`mkPen `. If the line is not movable, then hovering is also disabled. Added in version 0.9.9.""" # If user did not supply a width, then copy it from pen widthSpecified = ((len(args) == 1 and (isinstance(args[0], QtGui.QPen) or (isinstance(args[0], dict) and 'width' in args[0])) ) or 'width' in kwargs) self.hoverPen = fn.mkPen(*args, **kwargs) if not widthSpecified: self.hoverPen.setWidth(self.pen.width()) if self.mouseHovering: self.currentPen = self.hoverPen self.update() def addMarker(self, marker, position=0.5, size=10.0): """Add a marker to be displayed on the line. ============= ========================================================= **Arguments** marker String indicating the style of marker to add: ``'<|'``, ``'|>'``, ``'>|'``, ``'|<'``, ``'<|>'``, ``'>|<'``, ``'^'``, ``'v'``, ``'o'`` position Position (0.0-1.0) along the visible extent of the line to place the marker. Default is 0.5. size Size of the marker in pixels. Default is 10.0. ============= ========================================================= """ path = QtGui.QPainterPath() if marker == 'o': path.addEllipse(QtCore.QRectF(-0.5, -0.5, 1, 1)) if '<|' in marker: p = QtGui.QPolygonF([Point(0.5, 0), Point(0, -0.5), Point(-0.5, 0)]) path.addPolygon(p) path.closeSubpath() if '|>' in marker: p = QtGui.QPolygonF([Point(0.5, 0), Point(0, 0.5), Point(-0.5, 0)]) path.addPolygon(p) path.closeSubpath() if '>|' in marker: p = QtGui.QPolygonF([Point(0.5, -0.5), Point(0, 0), Point(-0.5, -0.5)]) path.addPolygon(p) path.closeSubpath() if '|<' in marker: p = QtGui.QPolygonF([Point(0.5, 0.5), Point(0, 0), Point(-0.5, 0.5)]) path.addPolygon(p) path.closeSubpath() if '^' in marker: p = QtGui.QPolygonF([Point(0, -0.5), Point(0.5, 0), Point(0, 0.5)]) path.addPolygon(p) path.closeSubpath() if 'v' in marker: p = QtGui.QPolygonF([Point(0, -0.5), Point(-0.5, 0), Point(0, 0.5)]) path.addPolygon(p) path.closeSubpath() self.markers.append((path, position, size)) self._maxMarkerSize = max([m[2] / 2. for m in self.markers]) self.update() def clearMarkers(self): """ Remove all markers from this line. """ self.markers = [] self._maxMarkerSize = 0 self.update() def setAngle(self, angle): """ Takes angle argument in degrees. 0 is horizontal; 90 is vertical. Note that the use of value() and setValue() changes if the line is not vertical or horizontal. """ self.angle = angle #((angle+45) % 180) - 45 ## -45 <= angle < 135 self.resetTransform() self.setRotation(self.angle) self.update() def setPos(self, pos): if isinstance(pos, (list, tuple, np.ndarray)) and not np.ndim(pos) == 0: newPos = list(pos) elif isinstance(pos, QtCore.QPointF): newPos = [pos.x(), pos.y()] else: if self.angle == 90: newPos = [pos, 0] elif self.angle == 0: newPos = [0, pos] else: raise Exception("Must specify 2D coordinate for non-orthogonal lines.") ## check bounds (only works for orthogonal lines) if self.angle == 90: if self.maxRange[0] is not None: newPos[0] = max(newPos[0], self.maxRange[0]) if self.maxRange[1] is not None: newPos[0] = min(newPos[0], self.maxRange[1]) elif self.angle == 0: if self.maxRange[0] is not None: newPos[1] = max(newPos[1], self.maxRange[0]) if self.maxRange[1] is not None: newPos[1] = min(newPos[1], self.maxRange[1]) if self.p != newPos: self.p = newPos self.viewTransformChanged() GraphicsObject.setPos(self, Point(self.p)) self.sigPositionChanged.emit(self) def getXPos(self): return self.p[0] def getYPos(self): return self.p[1] def getPos(self): return self.p def value(self): """Return the value of the line. Will be a single number for horizontal and vertical lines, and a list of [x,y] values for diagonal lines.""" if self.angle%180 == 0: return self.getYPos() elif self.angle%180 == 90: return self.getXPos() else: return self.getPos() def setValue(self, v): """Set the position of the line. If line is horizontal or vertical, v can be a single value. Otherwise, a 2D coordinate must be specified (list, tuple and QPointF are all acceptable).""" self.setPos(v) ## broken in 4.7 #def itemChange(self, change, val): #if change in [self.GraphicsItemChange.ItemScenePositionHasChanged, self.GraphicsItemChange.ItemSceneHasChanged]: #self.updateLine() #print "update", change #print self.getBoundingParents() #else: #print "ignore", change #return GraphicsObject.itemChange(self, change, val) def setSpan(self, mn, mx): if self.span != (mn, mx): self.span = (mn, mx) self.update() def _computeBoundingRect(self): #br = UIGraphicsItem.boundingRect(self) vr = self.viewRect() # bounds of containing ViewBox mapped to local coords. if vr is None: return QtCore.QRectF() # compute the pixel size orthogonal to the line # this is more complicated than it seems, maybe it can be simplified _, ortho = self.pixelVectors(direction=Point(1, 0)) px = 0 if ortho is None else ortho.y() pw = max(self.pen.width() / 2, self.hoverPen.width() / 2) w = (self._maxMarkerSize + pw + 1) * px br = QtCore.QRectF(vr) br.setBottom(-w) br.setTop(w) length = br.width() left = br.left() + length * self.span[0] right = br.left() + length * self.span[1] br.setLeft(left) br.setRight(right) br = br.normalized() vs = self.getViewBox().size() if self._bounds != br or self._lastViewSize != vs: self._bounds = br self._lastViewSize = vs self.prepareGeometryChange() self._endPoints = (left, right) self._lastViewRect = vr return self._bounds def boundingRect(self): if self._boundingRect is None: self._boundingRect = self._computeBoundingRect() return self._boundingRect def paint(self, p, *args): if self.angle % 180 not in (0, 90): p.setRenderHint(p.RenderHint.Antialiasing) left, right = self._endPoints pen = self.currentPen pen.setJoinStyle(QtCore.Qt.PenJoinStyle.MiterJoin) p.setPen(pen) p.drawLine(Point(left, 0), Point(right, 0)) if len(self.markers) == 0: return # paint markers in native coordinate system tr = p.transform() p.resetTransform() start = tr.map(Point(left, 0)) end = tr.map(Point(right, 0)) up = tr.map(Point(left, 1)) dif = end - start length = Point(dif).length() angle = degrees(atan2(dif.y(), dif.x())) p.translate(start) p.rotate(angle) up = up - start det = up.x() * dif.y() - dif.x() * up.y() p.scale(1, 1 if det > 0 else -1) p.setBrush(fn.mkBrush(self.currentPen.color())) #p.setPen(fn.mkPen(None)) tr = p.transform() for path, pos, size in self.markers: p.setTransform(tr) x = length * pos p.translate(x, 0) p.scale(size, size) p.drawPath(path) def dataBounds(self, axis, frac=1.0, orthoRange=None): if axis == 0: return None ## x axis should never be auto-scaled else: return (0,0) def mouseDragEvent(self, ev): if self.movable and ev.button() == QtCore.Qt.MouseButton.LeftButton: if ev.isStart(): self.moving = True self.cursorOffset = self.pos() - self.mapToParent(ev.buttonDownPos()) self.startPosition = self.pos() ev.accept() if not self.moving: return self.setPos(self.cursorOffset + self.mapToParent(ev.pos())) self.sigDragged.emit(self) if ev.isFinish(): self.moving = False self.sigPositionChangeFinished.emit(self) def mouseClickEvent(self, ev): self.sigClicked.emit(self, ev) if self.moving and ev.button() == QtCore.Qt.MouseButton.RightButton: ev.accept() self.setPos(self.startPosition) self.moving = False self.sigDragged.emit(self) self.sigPositionChangeFinished.emit(self) def hoverEvent(self, ev): if (not ev.isExit()) and self.movable and ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton): self.setMouseHover(True) else: self.setMouseHover(False) def setMouseHover(self, hover): ## Inform the item that the mouse is (not) hovering over it if self.mouseHovering == hover: return self.mouseHovering = hover if hover: self.currentPen = self.hoverPen else: self.currentPen = self.pen self.update() def viewTransformChanged(self): """ Called whenever the transformation matrix of the view has changed. (eg, the view range has changed or the view was resized) """ self._boundingRect = None GraphicsItem.viewTransformChanged(self) def setName(self, name): self._name = name def name(self): return self._name class InfLineLabel(TextItem): """ A TextItem that attaches itself to an InfiniteLine. This class extends TextItem with the following features: * Automatically positions adjacent to the line at a fixed position along the line and within the view box. * Automatically reformats text when the line value has changed. * Can optionally be dragged to change its location along the line. * Optionally aligns to its parent line. =============== ================================================================== **Arguments:** line The InfiniteLine to which this label will be attached. text String to display in the label. May contain a {value} formatting string to display the current value of the line. movable Bool; if True, then the label can be dragged along the line. position Relative position (0.0-1.0) within the view to position the label along the line. anchors List of (x,y) pairs giving the text anchor positions that should be used when the line is moved to one side of the view or the other. This allows text to switch to the opposite side of the line as it approaches the edge of the view. These are automatically selected for some common cases, but may be specified if the default values give unexpected results. =============== ================================================================== All extra keyword arguments are passed to TextItem. A particularly useful option here is to use `rotateAxis=(1, 0)`, which will cause the text to be automatically rotated parallel to the line. """ def __init__(self, line, text="", movable=False, position=0.5, anchors=None, **kwds): self.line = line self.movable = movable self.moving = False self.orthoPos = position # text will always be placed on the line at a position relative to view bounds self.format = text self.line.sigPositionChanged.connect(self.valueChanged) self._endpoints = (None, None) if anchors is None: # automatically pick sensible anchors rax = kwds.get('rotateAxis', None) if rax is not None: if tuple(rax) == (1,0): anchors = [(0.5, 0), (0.5, 1)] else: anchors = [(0, 0.5), (1, 0.5)] else: if line.angle % 180 == 0: anchors = [(0.5, 0), (0.5, 1)] else: anchors = [(0, 0.5), (1, 0.5)] self.anchors = anchors TextItem.__init__(self, **kwds) self.setParentItem(line) self.valueChanged() def valueChanged(self): if not self.isVisible(): return value = self.line.value() self.setText(self.format.format(value=value)) self.updatePosition() def getEndpoints(self): # calculate points where line intersects view box # (in line coordinates) if self._endpoints[0] is None: lr = self.line.boundingRect() pt1 = Point(lr.left(), 0) pt2 = Point(lr.right(), 0) if self.line.angle % 90 != 0: # more expensive to find text position for oblique lines. view = self.getViewBox() if not self.isVisible() or not isinstance(view, ViewBox): # not in a viewbox, skip update return (None, None) p = QtGui.QPainterPath() p.moveTo(pt1) p.lineTo(pt2) p = self.line.itemTransform(view)[0].map(p) vr = QtGui.QPainterPath() vr.addRect(view.boundingRect()) paths = vr.intersected(p).toSubpathPolygons(QtGui.QTransform()) if len(paths) > 0: l = list(paths[0]) pt1 = self.line.mapFromItem(view, l[0]) pt2 = self.line.mapFromItem(view, l[1]) self._endpoints = (pt1, pt2) return self._endpoints def updatePosition(self): # update text position to relative view location along line self._endpoints = (None, None) pt1, pt2 = self.getEndpoints() if pt1 is None: return pt = pt2 * self.orthoPos + pt1 * (1-self.orthoPos) self.setPos(pt) # update anchor to keep text visible as it nears the view box edge vr = self.line.viewRect() if vr is not None: self.setAnchor(self.anchors[0 if vr.center().y() < 0 else 1]) def setVisible(self, v): TextItem.setVisible(self, v) if v: self.valueChanged() def setMovable(self, m): """Set whether this label is movable by dragging along the line. """ self.movable = m self.setAcceptHoverEvents(m) def setPosition(self, p): """Set the relative position (0.0-1.0) of this label within the view box and along the line. For horizontal (angle=0) and vertical (angle=90) lines, a value of 0.0 places the text at the bottom or left of the view, respectively. """ self.orthoPos = p self.updatePosition() def setFormat(self, text): """Set the text format string for this label. May optionally contain "{value}" to include the lines current value (the text will be reformatted whenever the line is moved). """ self.format = text self.valueChanged() def mouseDragEvent(self, ev): if self.movable and ev.button() == QtCore.Qt.MouseButton.LeftButton: if ev.isStart(): self._moving = True self._cursorOffset = self._posToRel(ev.buttonDownPos()) self._startPosition = self.orthoPos ev.accept() if not self._moving: return rel = self._posToRel(ev.pos()) self.orthoPos = fn.clip_scalar(self._startPosition + rel - self._cursorOffset, 0., 1.) self.updatePosition() if ev.isFinish(): self._moving = False def mouseClickEvent(self, ev): if self.moving and ev.button() == QtCore.Qt.MouseButton.RightButton: ev.accept() self.orthoPos = self._startPosition self.moving = False def hoverEvent(self, ev): if not ev.isExit() and self.movable: ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton) def viewTransformChanged(self): GraphicsItem.viewTransformChanged(self) self.updatePosition() TextItem.viewTransformChanged(self) def _posToRel(self, pos): # convert local position to relative position along line between view bounds pt1, pt2 = self.getEndpoints() if pt1 is None: return 0 pos = self.mapToParent(pos) return (pos.x() - pt1.x()) / (pt2.x()-pt1.x()) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/IsocurveItem.py000066400000000000000000000077231457240071200254570ustar00rootroot00000000000000from .. import functions as fn from .. import getConfigOption from ..Qt import QtCore, QtGui from .GraphicsObject import GraphicsObject __all__ = ['IsocurveItem'] class IsocurveItem(GraphicsObject): """ **Bases:** :class:`GraphicsObject ` Item displaying an isocurve of a 2D array. To align this item correctly with an ImageItem, call ``isocurve.setParentItem(image)``. """ def __init__(self, data=None, level=0, pen='w', axisOrder=None): """ Create a new isocurve item. ============== =============================================================== **Arguments:** data A 2-dimensional ndarray. Can be initialized as None, and set later using :func:`setData ` level The cutoff value at which to draw the isocurve. pen The color of the curve item. Can be anything valid for :func:`mkPen ` axisOrder May be either 'row-major' or 'col-major'. By default this uses the ``imageAxisOrder`` :ref:`global configuration option `. ============== =============================================================== """ GraphicsObject.__init__(self) self.level = level self.data = None self.path = None self.axisOrder = getConfigOption('imageAxisOrder') if axisOrder is None else axisOrder self.setPen(pen) self.setData(data, level) def setData(self, data, level=None): """ Set the data/image to draw isocurves for. ============== ======================================================================== **Arguments:** data A 2-dimensional ndarray. level The cutoff value at which to draw the curve. If level is not specified, the previously set level is used. ============== ======================================================================== """ if level is None: level = self.level self.level = level self.data = data self.path = None self.prepareGeometryChange() self.update() def setLevel(self, level): """Set the level at which the isocurve is drawn.""" self.level = level self.path = None self.prepareGeometryChange() self.update() def setPen(self, *args, **kwargs): """Set the pen used to draw the isocurve. Arguments can be any that are valid for :func:`mkPen `""" self.pen = fn.mkPen(*args, **kwargs) self.update() def setBrush(self, *args, **kwargs): """Set the brush used to draw the isocurve. Arguments can be any that are valid for :func:`mkBrush `""" self.brush = fn.mkBrush(*args, **kwargs) self.update() def updateLines(self, data, level): self.setData(data, level) def boundingRect(self): if self.data is None: return QtCore.QRectF() if self.path is None: self.generatePath() return self.path.boundingRect() def generatePath(self): if self.data is None: self.path = None return if self.axisOrder == 'row-major': data = self.data.T else: data = self.data lines = fn.isocurve(data, self.level, connected=True, extendToEdge=True) self.path = QtGui.QPainterPath() for line in lines: self.path.moveTo(*line[0]) for p in line[1:]: self.path.lineTo(*p) def paint(self, p, *args): if self.data is None: return if self.path is None: self.generatePath() p.setPen(self.pen) p.drawPath(self.path) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ItemGroup.py000066400000000000000000000007701457240071200247470ustar00rootroot00000000000000from ..Qt import QtCore from .GraphicsObject import GraphicsObject __all__ = ['ItemGroup'] class ItemGroup(GraphicsObject): """ Replacement for QGraphicsItemGroup """ def __init__(self, *args): GraphicsObject.__init__(self, *args) self.setFlag(self.GraphicsItemFlag.ItemHasNoContents) def boundingRect(self): return QtCore.QRectF() def paint(self, *args): pass def addItem(self, item): item.setParentItem(self) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/LabelItem.py000066400000000000000000000123701457240071200246710ustar00rootroot00000000000000from .. import functions as fn from .. import getConfigOption from ..Qt import QtCore, QtWidgets, QtGui from .GraphicsWidget import GraphicsWidget from .GraphicsWidgetAnchor import GraphicsWidgetAnchor __all__ = ['LabelItem'] class LabelItem(GraphicsWidgetAnchor, GraphicsWidget): """ GraphicsWidget displaying text. Used mainly as axis labels, titles, etc. Note: To display text inside a scaled view (ViewBox, PlotWidget, etc) use TextItem """ def __init__(self, text=' ', parent=None, angle=0, **args): GraphicsWidget.__init__(self, parent) GraphicsWidgetAnchor.__init__(self) self.item = QtWidgets.QGraphicsTextItem(self) self.opts = { 'color': None, 'justify': 'center' } self.opts.update(args) self._sizeHint = {} self.setText(text) self.setAngle(angle) def setAttr(self, attr, value): """Set default text properties. See setText() for accepted parameters.""" self.opts[attr] = value def setText(self, text, **args): """Set the text and text properties in the label. Accepts optional arguments for auto-generating a CSS style string: ==================== ============================== **Style Arguments:** family (str) example: 'Cantarell' color (str) example: '#CCFF00' size (str) example: '8pt' bold (bool) italic (bool) ==================== ============================== """ self.text = text opts = self.opts for k in args: opts[k] = args[k] optlist = [] color = self.opts['color'] if color is None: color = getConfigOption('foreground') color = fn.mkColor(color) optlist.append('color: ' + color.name(QtGui.QColor.NameFormat.HexArgb)) if 'family' in opts: optlist.append('font-family: ' + opts['family']) if 'size' in opts: optlist.append('font-size: ' + opts['size']) if 'bold' in opts and opts['bold'] in [True, False]: optlist.append('font-weight: ' + {True:'bold', False:'normal'}[opts['bold']]) if 'italic' in opts and opts['italic'] in [True, False]: optlist.append('font-style: ' + {True:'italic', False:'normal'}[opts['italic']]) full = "%s" % ('; '.join(optlist), text) #print full self.item.setHtml(full) self.updateMin() self.resizeEvent(None) self.updateGeometry() def resizeEvent(self, ev): #c1 = self.boundingRect().center() #c2 = self.item.mapToParent(self.item.boundingRect().center()) # + self.item.pos() #dif = c1 - c2 #self.item.moveBy(dif.x(), dif.y()) #print c1, c2, dif, self.item.pos() self.item.setPos(0,0) bounds = self.itemRect() left = self.mapFromItem(self.item, QtCore.QPointF(0,0)) - self.mapFromItem(self.item, QtCore.QPointF(1,0)) rect = self.rect() if self.opts['justify'] == 'left': if left.x() != 0: bounds.moveLeft(rect.left()) if left.y() < 0: bounds.moveTop(rect.top()) elif left.y() > 0: bounds.moveBottom(rect.bottom()) elif self.opts['justify'] == 'center': bounds.moveCenter(rect.center()) #bounds = self.itemRect() #self.item.setPos(self.width()/2. - bounds.width()/2., 0) elif self.opts['justify'] == 'right': if left.x() != 0: bounds.moveRight(rect.right()) if left.y() < 0: bounds.moveBottom(rect.bottom()) elif left.y() > 0: bounds.moveTop(rect.top()) #bounds = self.itemRect() #self.item.setPos(self.width() - bounds.width(), 0) self.item.setPos(bounds.topLeft() - self.itemRect().topLeft()) self.updateMin() def setAngle(self, angle): self.angle = angle self.item.resetTransform() self.item.setRotation(angle) self.updateMin() def updateMin(self): bounds = self.itemRect() self.setMinimumWidth(bounds.width()) self.setMinimumHeight(bounds.height()) self._sizeHint = { QtCore.Qt.SizeHint.MinimumSize: (bounds.width(), bounds.height()), QtCore.Qt.SizeHint.PreferredSize: (bounds.width(), bounds.height()), QtCore.Qt.SizeHint.MaximumSize: (-1, -1), #bounds.width()*2, bounds.height()*2), QtCore.Qt.SizeHint.MinimumDescent: (0, 0) ##?? what is this? } self.updateGeometry() def sizeHint(self, hint, constraint): if hint not in self._sizeHint: return QtCore.QSizeF(0, 0) return QtCore.QSizeF(*self._sizeHint[hint]) def itemRect(self): return self.item.mapRectToParent(self.item.boundingRect()) #def paint(self, p, *args): #p.setPen(fn.mkPen('r')) #p.drawRect(self.rect()) #p.setPen(fn.mkPen('g')) #p.drawRect(self.itemRect()) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/LegendItem.py000066400000000000000000000351261457240071200250540ustar00rootroot00000000000000import math from .. import functions as fn from ..icons import invisibleEye from ..Point import Point from ..Qt import QtCore, QtGui, QtWidgets from .BarGraphItem import BarGraphItem from .GraphicsWidget import GraphicsWidget from .GraphicsWidgetAnchor import GraphicsWidgetAnchor from .LabelItem import LabelItem from .PlotDataItem import PlotDataItem from .ScatterPlotItem import ScatterPlotItem, drawSymbol __all__ = ['LegendItem', 'ItemSample'] class LegendItem(GraphicsWidgetAnchor, GraphicsWidget): """ Displays a legend used for describing the contents of a plot. LegendItems are most commonly created by calling :meth:`PlotItem.addLegend `. Note that this item should *not* be added directly to a PlotItem (via :meth:`PlotItem.addItem `). Instead, make it a direct descendant of the PlotItem:: legend.setParentItem(plotItem) """ def __init__(self, size=None, offset=None, horSpacing=25, verSpacing=0, pen=None, brush=None, labelTextColor=None, frame=True, labelTextSize='9pt', colCount=1, sampleType=None, **kwargs): """ ============== =============================================================== **Arguments:** size Specifies the fixed size (width, height) of the legend. If this argument is omitted, the legend will automatically resize to fit its contents. offset Specifies the offset position relative to the legend's parent. Positive values offset from the left or top; negative values offset from the right or bottom. If offset is None, the legend must be anchored manually by calling anchor() or positioned by calling setPos(). horSpacing Specifies the spacing between the line symbol and the label. verSpacing Specifies the spacing between individual entries of the legend vertically. (Can also be negative to have them really close) pen Pen to use when drawing legend border. Any single argument accepted by :func:`mkPen ` is allowed. brush QBrush to use as legend background filling. Any single argument accepted by :func:`mkBrush ` is allowed. labelTextColor Pen to use when drawing legend text. Any single argument accepted by :func:`mkPen ` is allowed. labelTextSize Size to use when drawing legend text. Accepts CSS style string arguments, e.g. '9pt'. colCount Specifies the integer number of columns that the legend should be divided into. The number of rows will be calculated based on this argument. This is useful for plots with many curves displayed simultaneously. Default: 1 column. sampleType Customizes the item sample class of the `LegendItem`. ============== =============================================================== """ GraphicsWidget.__init__(self) GraphicsWidgetAnchor.__init__(self) self.setFlag(self.GraphicsItemFlag.ItemIgnoresTransformations) self.layout = QtWidgets.QGraphicsGridLayout() self.layout.setVerticalSpacing(verSpacing) self.layout.setHorizontalSpacing(horSpacing) self.setLayout(self.layout) self.items = [] self.size = size self.offset = offset self.frame = frame self.columnCount = colCount self.rowCount = 1 if size is not None: self.setGeometry(QtCore.QRectF(0, 0, self.size[0], self.size[1])) if sampleType is not None: if not issubclass(sampleType, GraphicsWidget): raise RuntimeError("Only classes of type `GraphicsWidgets` " "are allowed as `sampleType`") self.sampleType = sampleType else: self.sampleType = ItemSample self.opts = { 'pen': fn.mkPen(pen), 'brush': fn.mkBrush(brush), 'labelTextColor': labelTextColor, 'labelTextSize': labelTextSize, 'offset': offset, } self.opts.update(kwargs) def setSampleType(self, sample): """Set the new sample item claspes""" if sample is self.sampleType: return # Clear the legend, but before create a list of items items = list(self.items) self.sampleType = sample self.clear() # Refill the legend with the item list and new sample item for sample, label in items: plot_item = sample.item plot_name = label.text self.addItem(plot_item, plot_name) self.updateSize() def offset(self): """Get the offset position relative to the parent.""" return self.opts['offset'] def setOffset(self, offset): """Set the offset position relative to the parent.""" self.opts['offset'] = offset offset = Point(self.opts['offset']) anchorx = 1 if offset[0] <= 0 else 0 anchory = 1 if offset[1] <= 0 else 0 anchor = (anchorx, anchory) self.anchor(itemPos=anchor, parentPos=anchor, offset=offset) def pen(self): """Get the QPen used to draw the border around the legend.""" return self.opts['pen'] def setPen(self, *args, **kargs): """Set the pen used to draw a border around the legend. Accepts the same arguments as :func:`~pyqtgraph.mkPen`. """ pen = fn.mkPen(*args, **kargs) self.opts['pen'] = pen self.update() def brush(self): """Get the QBrush used to draw the legend background.""" return self.opts['brush'] def setBrush(self, *args, **kargs): """Set the brush used to draw the legend background. Accepts the same arguments as :func:`~pyqtgraph.mkBrush`. """ brush = fn.mkBrush(*args, **kargs) if self.opts['brush'] == brush: return self.opts['brush'] = brush self.update() def labelTextColor(self): """Get the QColor used for the item labels.""" return self.opts['labelTextColor'] def setLabelTextColor(self, *args, **kargs): """Set the color of the item labels. Accepts the same arguments as :func:`~pyqtgraph.mkColor`. """ self.opts['labelTextColor'] = fn.mkColor(*args, **kargs) for sample, label in self.items: label.setAttr('color', self.opts['labelTextColor']) self.update() def labelTextSize(self): """Get the `labelTextSize` used for the item labels.""" return self.opts['labelTextSize'] def setLabelTextSize(self, size): """Set the `size` of the item labels. Accepts the CSS style string arguments, e.g. '8pt'. """ self.opts['labelTextSize'] = size for _, label in self.items: label.setAttr('size', self.opts['labelTextSize']) self.update() def setParentItem(self, p): """Set the parent.""" ret = GraphicsWidget.setParentItem(self, p) if self.opts['offset'] is not None: offset = Point(self.opts['offset']) anchorx = 1 if offset[0] <= 0 else 0 anchory = 1 if offset[1] <= 0 else 0 anchor = (anchorx, anchory) self.anchor(itemPos=anchor, parentPos=anchor, offset=offset) return ret def addItem(self, item, name): """ Add a new entry to the legend. ============== ======================================================== **Arguments:** item A :class:`~pyqtgraph.PlotDataItem` from which the line and point style of the item will be determined or an instance of ItemSample (or a subclass), allowing the item display to be customized. title The title to display for this item. Simple HTML allowed. ============== ======================================================== """ label = LabelItem(name, color=self.opts['labelTextColor'], justify='left', size=self.opts['labelTextSize']) if isinstance(item, self.sampleType): sample = item else: sample = self.sampleType(item) self.items.append((sample, label)) self._addItemToLayout(sample, label) self.updateSize() def _addItemToLayout(self, sample, label): col = self.layout.columnCount() row = self.layout.rowCount() if row: row -= 1 nCol = self.columnCount * 2 # FIRST ROW FULL if col == nCol: for col in range(0, nCol, 2): # FIND RIGHT COLUMN if not self.layout.itemAt(row, col): break else: if col + 2 == nCol: # MAKE NEW ROW col = 0 row += 1 self.layout.addItem(sample, row, col) self.layout.addItem(label, row, col + 1) # Keep rowCount in sync with the number of rows if items are added self.rowCount = max(self.rowCount, row + 1) def setColumnCount(self, columnCount): """change the orientation of all items of the legend """ if columnCount != self.columnCount: self.columnCount = columnCount self.rowCount = math.ceil(len(self.items) / columnCount) for i in range(self.layout.count() - 1, -1, -1): self.layout.removeAt(i) # clear layout for sample, label in self.items: self._addItemToLayout(sample, label) self.updateSize() def getLabel(self, plotItem): """Return the labelItem inside the legend for a given plotItem The label-text can be changed via labelItem.setText """ out = [(it, lab) for it, lab in self.items if it.item == plotItem] try: return out[0][1] except IndexError: return None def _removeItemFromLayout(self, *args): for item in args: self.layout.removeItem(item) item.close() # Normally, the item is automatically removed from # its scene when it gets destroyed. # this doesn't happen on current versions of # PySide (5.15.x, 6.3.x) and results in a leak. scene = item.scene() if scene: scene.removeItem(item) def removeItem(self, item): """Removes one item from the legend. ============== ======================================================== **Arguments:** item The item to remove or its name. ============== ======================================================== """ for sample, label in self.items: if sample.item is item or label.text == item: self.items.remove((sample, label)) # remove from itemlist self._removeItemFromLayout(sample, label) self.updateSize() # redraw box return # return after first match def clear(self): """Remove all items from the legend.""" for sample, label in self.items: self._removeItemFromLayout(sample, label) self.items = [] self.updateSize() def updateSize(self): if self.size is not None: return height = 0 width = 0 for row in range(self.layout.rowCount()): row_height = 0 col_width = 0 for col in range(self.layout.columnCount()): item = self.layout.itemAt(row, col) if item: col_width += item.width() + 3 row_height = max(row_height, item.height()) width = max(width, col_width) height += row_height self.setGeometry(0, 0, width, height) return def boundingRect(self): return QtCore.QRectF(0, 0, self.width(), self.height()) def paint(self, p, *args): if self.frame: p.setPen(self.opts['pen']) p.setBrush(self.opts['brush']) p.drawRect(self.boundingRect()) def hoverEvent(self, ev): ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton) def mouseDragEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.LeftButton: ev.accept() dpos = ev.pos() - ev.lastPos() self.autoAnchor(self.pos() + dpos) class ItemSample(GraphicsWidget): """Class responsible for drawing a single item in a LegendItem (sans label) """ def __init__(self, item): GraphicsWidget.__init__(self) self.item = item def boundingRect(self): return QtCore.QRectF(0, 0, 20, 20) def paint(self, p, *args): opts = self.item.opts if opts.get('antialias'): p.setRenderHint(p.RenderHint.Antialiasing) visible = self.item.isVisible() if not visible: icon = invisibleEye.qicon p.drawPixmap(QtCore.QPoint(1, 1), icon.pixmap(18, 18)) return if not isinstance(self.item, ScatterPlotItem): p.setPen(fn.mkPen(opts['pen'])) p.drawLine(0, 11, 20, 11) if (opts.get('fillLevel', None) is not None and opts.get('fillBrush', None) is not None): p.setBrush(fn.mkBrush(opts['fillBrush'])) p.setPen(fn.mkPen(opts['pen'])) p.drawPolygon(QtGui.QPolygonF( [QtCore.QPointF(2, 18), QtCore.QPointF(18, 2), QtCore.QPointF(18, 18)])) symbol = opts.get('symbol', None) if symbol is not None: if isinstance(self.item, PlotDataItem): opts = self.item.scatter.opts p.translate(10, 10) drawSymbol(p, symbol, opts['size'], fn.mkPen(opts['pen']), fn.mkBrush(opts['brush'])) if isinstance(self.item, BarGraphItem): p.setBrush(fn.mkBrush(opts['brush'])) p.drawRect(QtCore.QRectF(2, 2, 18, 18)) def mouseClickEvent(self, event): """Use the mouseClick event to toggle the visibility of the plotItem """ if event.button() == QtCore.Qt.MouseButton.LeftButton: visible = self.item.isVisible() self.item.setVisible(not visible) event.accept() self.update() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/LinearRegionItem.py000066400000000000000000000333701457240071200262330ustar00rootroot00000000000000from .. import debug from .. import functions as fn from ..Qt import QtCore, QtGui from .GraphicsObject import GraphicsObject from .InfiniteLine import InfiniteLine __all__ = ['LinearRegionItem'] class LinearRegionItem(GraphicsObject): """ **Bases:** :class:`GraphicsObject ` Used for marking a horizontal or vertical region in plots. The region can be dragged and is bounded by lines which can be dragged individually. =============================== ============================================================================= **Signals:** sigRegionChangeFinished(self) Emitted when the user has finished dragging the region (or one of its lines) and when the region is changed programatically. sigRegionChanged(self) Emitted while the user is dragging the region (or one of its lines) and when the region is changed programatically. =============================== ============================================================================= """ sigRegionChangeFinished = QtCore.Signal(object) sigRegionChanged = QtCore.Signal(object) Vertical = 0 Horizontal = 1 _orientation_axis = { Vertical: 0, Horizontal: 1, 'vertical': 0, 'horizontal': 1, } def __init__(self, values=(0, 1), orientation='vertical', brush=None, pen=None, hoverBrush=None, hoverPen=None, movable=True, bounds=None, span=(0, 1), swapMode='sort', clipItem=None): """Create a new LinearRegionItem. ============== ===================================================================== **Arguments:** values A list of the positions of the lines in the region. These are not limits; limits can be set by specifying bounds. orientation Options are 'vertical' or 'horizontal' The default is 'vertical', indicating that the region is bounded by vertical lines. brush Defines the brush that fills the region. Can be any arguments that are valid for :func:`mkBrush `. Default is transparent blue. pen The pen to use when drawing the lines that bound the region. hoverBrush The brush to use when the mouse is hovering over the region. hoverPen The pen to use when the mouse is hovering over the region. movable If True, the region and individual lines are movable by the user; if False, they are static. bounds Optional [min, max] bounding values for the region span Optional [min, max] giving the range over the view to draw the region. For example, with a vertical line, use ``span=(0.5, 1)`` to draw only on the top half of the view. swapMode Sets the behavior of the region when the lines are moved such that their order reverses: * "block" means the user cannot drag one line past the other * "push" causes both lines to be moved if one would cross the other * "sort" means that lines may trade places, but the output of getRegion always gives the line positions in ascending order. * None means that no attempt is made to handle swapped line positions. The default is "sort". clipItem An item whose bounds will be used to limit the region bounds. This is useful when a LinearRegionItem is added on top of an :class:`~pyqtgraph.ImageItem` or :class:`~pyqtgraph.PlotDataItem` and the visual region should not extend beyond its range. This overrides ``bounds``. ============== ===================================================================== """ GraphicsObject.__init__(self) self.orientation = orientation self.blockLineSignal = False self.moving = False self.mouseHovering = False self.span = span self.swapMode = swapMode self.clipItem = clipItem self._boundingRectCache = None self._clipItemBoundsCache = None # note LinearRegionItem.Horizontal and LinearRegionItem.Vertical # are kept for backward compatibility. lineKwds = dict( movable=movable, bounds=bounds, span=span, pen=pen, hoverPen=hoverPen, ) if orientation in ('horizontal', LinearRegionItem.Horizontal): self.lines = [ # rotate lines to 180 to preserve expected line orientation # with respect to region. This ensures that placing a '<|' # marker on lines[0] causes it to point left in vertical mode # and down in horizontal mode. InfiniteLine(QtCore.QPointF(0, values[0]), angle=0, **lineKwds), InfiniteLine(QtCore.QPointF(0, values[1]), angle=0, **lineKwds)] tr = QtGui.QTransform.fromScale(1, -1) self.lines[0].setTransform(tr, True) self.lines[1].setTransform(tr, True) elif orientation in ('vertical', LinearRegionItem.Vertical): self.lines = [ InfiniteLine(QtCore.QPointF(values[0], 0), angle=90, **lineKwds), InfiniteLine(QtCore.QPointF(values[1], 0), angle=90, **lineKwds)] else: raise Exception("Orientation must be 'vertical' or 'horizontal'.") for l in self.lines: l.setParentItem(self) l.sigPositionChangeFinished.connect(self.lineMoveFinished) self.lines[0].sigPositionChanged.connect(self._line0Moved) self.lines[1].sigPositionChanged.connect(self._line1Moved) if brush is None: brush = QtGui.QBrush(QtGui.QColor(0, 0, 255, 50)) self.setBrush(brush) if hoverBrush is None: c = self.brush.color() c.setAlpha(min(c.alpha() * 2, 255)) hoverBrush = fn.mkBrush(c) self.setHoverBrush(hoverBrush) self.setMovable(movable) def getRegion(self): """Return the values at the edges of the region.""" r = (self.lines[0].value(), self.lines[1].value()) if self.swapMode == 'sort': return (min(r), max(r)) else: return r def setRegion(self, rgn): """Set the values for the edges of the region. ============== ============================================== **Arguments:** rgn A list or tuple of the lower and upper values. ============== ============================================== """ if self.lines[0].value() == rgn[0] and self.lines[1].value() == rgn[1]: return self.blockLineSignal = True self.lines[0].setValue(rgn[0]) self.blockLineSignal = False self.lines[1].setValue(rgn[1]) #self.blockLineSignal = False self.lineMoved(0) self.lineMoved(1) self.lineMoveFinished() def setBrush(self, *br, **kargs): """Set the brush that fills the region. Can have any arguments that are valid for :func:`mkBrush `. """ self.brush = fn.mkBrush(*br, **kargs) self.currentBrush = self.brush def setHoverBrush(self, *br, **kargs): """Set the brush that fills the region when the mouse is hovering over. Can have any arguments that are valid for :func:`mkBrush `. """ self.hoverBrush = fn.mkBrush(*br, **kargs) def setBounds(self, bounds): """Set ``(min, max)`` bounding values for the region. The current position is only affected it is outside the new bounds. See :func:`~pyqtgraph.LinearRegionItem.setRegion` to set the position of the region. Use ``(None, None)`` to disable bounds. """ if self.clipItem is not None: self.setClipItem(None) self._setBounds(bounds) def _setBounds(self, bounds): # internal impl so user-facing setBounds can clear clipItem and clipItem can # set bounds without clearing itself for line in self.lines: line.setBounds(bounds) def setMovable(self, m=True): """Set lines to be movable by the user, or not. If lines are movable, they will also accept HoverEvents.""" for line in self.lines: line.setMovable(m) self.movable = m self.setAcceptHoverEvents(m) def setSpan(self, mn, mx): if self.span == (mn, mx): return self.span = (mn, mx) for line in self.lines: line.setSpan(mn, mx) self.update() def setClipItem(self, item=None): """Set an item to which the region is bounded. If ``None``, bounds are disabled. """ self.clipItem = item self._clipItemBoundsCache = None if item is None: self._setBounds((None, None)) if item is not None: self._updateClipItemBounds() def _updateClipItemBounds(self): # set region bounds corresponding to clipItem item_vb = self.clipItem.getViewBox() if item_vb is None: return item_bounds = item_vb.childrenBounds(items=(self.clipItem,)) if item_bounds == self._clipItemBoundsCache or None in item_bounds: return self._clipItemBoundsCache = item_bounds if self.orientation in ('horizontal', LinearRegionItem.Horizontal): self._setBounds(item_bounds[1]) else: self._setBounds(item_bounds[0]) def boundingRect(self): br = QtCore.QRectF(self.viewRect()) # bounds of containing ViewBox mapped to local coords. if self.clipItem is not None: self._updateClipItemBounds() rng = self.getRegion() if self.orientation in ('vertical', LinearRegionItem.Vertical): br.setLeft(rng[0]) br.setRight(rng[1]) length = br.height() br.setBottom(br.top() + length * self.span[1]) br.setTop(br.top() + length * self.span[0]) else: br.setTop(rng[0]) br.setBottom(rng[1]) length = br.width() br.setRight(br.left() + length * self.span[1]) br.setLeft(br.left() + length * self.span[0]) br = br.normalized() if self._boundingRectCache != br: self._boundingRectCache = br self.prepareGeometryChange() return br def paint(self, p, *args): profiler = debug.Profiler() # noqa: profiler does prints on GC p.setBrush(self.currentBrush) p.setPen(fn.mkPen(None)) p.drawRect(self.boundingRect()) def dataBounds(self, axis, frac=1.0, orthoRange=None): if axis == self._orientation_axis[self.orientation]: return self.getRegion() else: return None def lineMoved(self, i): if self.blockLineSignal: return # lines swapped if self.lines[0].value() > self.lines[1].value(): if self.swapMode == 'block': self.lines[i].setValue(self.lines[1-i].value()) elif self.swapMode == 'push': self.lines[1-i].setValue(self.lines[i].value()) self.prepareGeometryChange() self.sigRegionChanged.emit(self) def _line0Moved(self): self.lineMoved(0) def _line1Moved(self): self.lineMoved(1) def lineMoveFinished(self): self.sigRegionChangeFinished.emit(self) def mouseDragEvent(self, ev): if not self.movable or ev.button() != QtCore.Qt.MouseButton.LeftButton: return ev.accept() if ev.isStart(): bdp = ev.buttonDownPos() self.cursorOffsets = [l.pos() - bdp for l in self.lines] self.startPositions = [l.pos() for l in self.lines] self.moving = True if not self.moving: return self.lines[0].blockSignals(True) # only want to update once for i, l in enumerate(self.lines): l.setPos(self.cursorOffsets[i] + ev.pos()) self.lines[0].blockSignals(False) self.prepareGeometryChange() if ev.isFinish(): self.moving = False self.sigRegionChangeFinished.emit(self) else: self.sigRegionChanged.emit(self) def mouseClickEvent(self, ev): if self.moving and ev.button() == QtCore.Qt.MouseButton.RightButton: ev.accept() for i, l in enumerate(self.lines): l.setPos(self.startPositions[i]) self.moving = False self.sigRegionChanged.emit(self) self.sigRegionChangeFinished.emit(self) def hoverEvent(self, ev): if self.movable and (not ev.isExit()) and ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton): self.setMouseHover(True) else: self.setMouseHover(False) def setMouseHover(self, hover): ## Inform the item that the mouse is(not) hovering over it if self.mouseHovering == hover: return self.mouseHovering = hover if hover: self.currentBrush = self.hoverBrush else: self.currentBrush = self.brush self.update() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/MultiPlotItem.py000066400000000000000000000045541457240071200256100ustar00rootroot00000000000000""" MultiPlotItem.py - Graphics item used for displaying an array of PlotItems Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. """ from . import GraphicsLayout __all__ = ['MultiPlotItem'] class MultiPlotItem(GraphicsLayout.GraphicsLayout): """ :class:`~pyqtgraph.GraphicsLayout` that automatically generates a grid of plots from a MetaArray. .. seealso:: :class:`~pyqtgraph.MultiPlotWidget`: Widget containing a MultiPlotItem """ def __init__(self, *args, **kwds): GraphicsLayout.GraphicsLayout.__init__(self, *args, **kwds) self.plots = [] def plot(self, data, **plotArgs): """Plot the data from a MetaArray with each array column as a separate :class:`~pyqtgraph.PlotItem`. Axis labels are automatically extracted from the array info. ``plotArgs`` are passed to :meth:`PlotItem.plot `. """ #self.layout.clear() if hasattr(data, 'implements') and data.implements('MetaArray'): if data.ndim != 2: raise Exception("MultiPlot currently only accepts 2D MetaArray.") ic = data.infoCopy() ax = 0 for i in [0, 1]: if 'cols' in ic[i]: ax = i break #print "Plotting using axis %d as columns (%d plots)" % (ax, data.shape[ax]) for i in range(data.shape[ax]): pi = self.addPlot() self.nextRow() sl = [slice(None)] * 2 sl[ax] = i pi.plot(data[tuple(sl)], **plotArgs) #self.layout.addItem(pi, i, 0) self.plots.append((pi, i, 0)) info = ic[ax]['cols'][i] title = info.get('title', info.get('name', None)) units = info.get('units', None) pi.setLabel('left', text=title, units=units) info = ic[1-ax] title = info.get('title', info.get('name', None)) units = info.get('units', None) pi.setLabel('bottom', text=title, units=units) else: raise Exception("Data type %s not (yet?) supported for MultiPlot." % type(data)) def close(self): for p in self.plots: p[0].close() self.plots = None self.clear() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/NonUniformImage.py000066400000000000000000000135631457240071200260750ustar00rootroot00000000000000import warnings import numpy as np from .. import functions as fn from ..colormap import ColorMap from .. import Qt from ..Qt import QtCore, QtGui from .GraphicsObject import GraphicsObject from .HistogramLUTItem import HistogramLUTItem __all__ = ['NonUniformImage'] class NonUniformImage(GraphicsObject): """ **Bases:** :class:`GraphicsObject ` GraphicsObject displaying an image with non-uniform sample points. It's commonly used to display 2-d or slices of higher dimensional data that have a regular but non-uniform grid e.g. measurements or simulation results. """ def __init__(self, x, y, z, border=None): GraphicsObject.__init__(self) # convert to numpy arrays x = np.asarray(x, dtype=np.float64) y = np.asarray(y, dtype=np.float64) z = np.asarray(z, dtype=np.float64) if x.ndim != 1 or y.ndim != 1: raise Exception("x and y must be 1-d arrays.") if np.any(np.diff(x) < 0) or np.any(np.diff(y) < 0): raise Exception("The values in x and y must be monotonically increasing.") if len(z.shape) != 2 or z.shape != (x.size, y.size): raise Exception("The length of x and y must match the shape of z.") # default colormap (black - white) self.cmap = ColorMap(None, [0.0, 1.0]) self.lut = self.cmap.getLookupTable(nPts=256) self.data = (x, y, z) self.levels = None self.border = border self.picture = None self.update() def setLookupTable(self, lut, update=True, **kwargs): # backwards compatibility hack if isinstance(lut, HistogramLUTItem): warnings.warn( "NonUniformImage::setLookupTable(HistogramLUTItem) is deprecated " "and will be removed in a future version of PyQtGraph. " "use HistogramLUTItem::setImageItem(NonUniformImage) instead", DeprecationWarning, stacklevel=2 ) lut.setImageItem(self) return self.cmap = None # invalidate since no longer consistent with lut self.lut = lut self.picture = None if update: self.update() def setColorMap(self, cmap): self.setLookupTable(cmap.getLookupTable(nPts=256), update=True) self.cmap = cmap def getHistogram(self, **kwds): """Returns x and y arrays containing the histogram values for the current image. For an explanation of the return format, see numpy.histogram(). """ z = self.data[2] z = z[np.isfinite(z)] hist = np.histogram(z, **kwds) return hist[1][:-1], hist[0] def setLevels(self, levels): self.levels = levels self.picture = None self.update() def getLevels(self): if self.levels is None: z = self.data[2] z = z[np.isfinite(z)] self.levels = z.min(), z.max() return self.levels def generatePicture(self): x, y, z = self.data # pad x and y so that we don't need to special-case the edges x = np.pad(x, 1, mode='edge') y = np.pad(y, 1, mode='edge') x = (x[:-1] + x[1:]) / 2 y = (y[:-1] + y[1:]) / 2 X, Y = np.meshgrid(x[:-1], y[:-1], indexing='ij') W, H = np.meshgrid(np.diff(x), np.diff(y), indexing='ij') Z = z # get colormap if callable(self.lut): lut = self.lut(z) else: lut = self.lut if lut is None: # lut can be None for a few reasons: # 1) self.lut(z) can also return None on error # 2) if a trivial gradient is being used, HistogramLUTItem calls # setLookupTable(None) as an optimization for ImageItem cmap = ColorMap(None, [0.0, 1.0]) lut = cmap.getLookupTable(nPts=256) # normalize and quantize mn, mx = self.getLevels() rng = mx - mn if rng == 0: rng = 1 scale = len(lut) / rng Z = fn.rescaleData(Z, scale, mn, dtype=int, clip=(0, len(lut)-1)) # replace nans positions with invalid lut index invalid_coloridx = len(lut) Z[np.isnan(z)] = invalid_coloridx # pre-allocate to the largest array needed color_indices, counts = np.unique(Z, return_counts=True) rectarray = Qt.internals.PrimitiveArray(QtCore.QRectF, 4) rectarray.resize(counts.max()) # sorted_indices effectively groups together the # (flattened) indices of the same coloridx together. sorted_indices = np.argsort(Z, axis=None) for arr in X, Y, W, H: arr.shape = -1 # in-place unravel self.picture = QtGui.QPicture() painter = QtGui.QPainter(self.picture) painter.setPen(fn.mkPen(None)) # draw the tiles grouped by coloridx offset = 0 for coloridx, cnt in zip(color_indices, counts): if coloridx == invalid_coloridx: continue indices = sorted_indices[offset:offset+cnt] offset += cnt rectarray.resize(cnt) memory = rectarray.ndarray() memory[:,0] = X[indices] memory[:,1] = Y[indices] memory[:,2] = W[indices] memory[:,3] = H[indices] brush = fn.mkBrush(lut[coloridx]) painter.setBrush(brush) painter.drawRects(*rectarray.drawargs()) if self.border is not None: painter.setPen(self.border) painter.setBrush(fn.mkBrush(None)) painter.drawRect(self.boundingRect()) painter.end() def paint(self, p, *args): if self.picture is None: self.generatePicture() p.drawPicture(0, 0, self.picture) def boundingRect(self): x, y, _ = self.data return QtCore.QRectF(x[0], y[0], x[-1]-x[0], y[-1]-y[0]) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/PColorMeshItem.py000066400000000000000000000330401457240071200256620ustar00rootroot00000000000000import numpy as np from .. import Qt, colormap from .. import functions as fn from ..Qt import QtCore, QtGui from .GraphicsObject import GraphicsObject __all__ = ['PColorMeshItem'] class QuadInstances: def __init__(self): self.nrows = -1 self.ncols = -1 self.pointsarray = Qt.internals.PrimitiveArray(QtCore.QPointF, 2) self.resize(0, 0) def resize(self, nrows, ncols): if nrows == self.nrows and ncols == self.ncols: return self.nrows = nrows self.ncols = ncols # (nrows + 1) * (ncols + 1) vertices, (x, y) self.pointsarray.resize((nrows+1)*(ncols+1)) points = self.pointsarray.instances() # points is a flattened list of a 2d array of # QPointF(s) of shape (nrows+1, ncols+1) # pre-create quads from those instances of QPointF(s). # store the quads as a flattened list of a 2d array # of polygons of shape (nrows, ncols) polys = [] for r in range(nrows): for c in range(ncols): bl = points[(r+0)*(ncols+1)+(c+0)] tl = points[(r+0)*(ncols+1)+(c+1)] br = points[(r+1)*(ncols+1)+(c+0)] tr = points[(r+1)*(ncols+1)+(c+1)] poly = (bl, br, tr, tl) polys.append(poly) self.polys = polys def ndarray(self): return self.pointsarray.ndarray() def instances(self): return self.polys class PColorMeshItem(GraphicsObject): """ **Bases:** :class:`GraphicsObject ` """ sigLevelsChanged = QtCore.Signal(object) # emits tuple with levels (low,high) when color levels are changed. def __init__(self, *args, **kwargs): """ Create a pseudocolor plot with convex polygons. Call signature: ``PColorMeshItem([x, y,] z, **kwargs)`` x and y can be used to specify the corners of the quadrilaterals. z must be used to specified to color of the quadrilaterals. Parameters ---------- x, y : np.ndarray, optional, default None 2D array containing the coordinates of the polygons z : np.ndarray 2D array containing the value which will be mapped into the polygons colors. If x and y is None, the polygons will be displaced on a grid otherwise x and y will be used as polygons vertices coordinates as:: (x[i+1, j], y[i+1, j]) (x[i+1, j+1], y[i+1, j+1]) +---------+ | z[i, j] | +---------+ (x[i, j], y[i, j]) (x[i, j+1], y[i, j+1]) "ASCII from: ". colorMap : pyqtgraph.ColorMap Colormap used to map the z value to colors. default ``pyqtgraph.colormap.get('viridis')`` levels: tuple, optional, default None Sets the minimum and maximum values to be represented by the colormap (min, max). Values outside this range will be clipped to the colors representing min or max. ``None`` disables the limits, meaning that the colormap will autoscale the next time ``setData()`` is called with new data. enableAutoLevels: bool, optional, default True Causes the colormap levels to autoscale whenever ``setData()`` is called. It is possible to override this value on a per-change-basis by using the ``autoLevels`` keyword argument when calling ``setData()``. If ``enableAutoLevels==False`` and ``levels==None``, autoscaling will be performed once when the first z data is supplied. edgecolors : dict, optional The color of the edges of the polygons. Default None means no edges. Only cosmetic pens are supported. The dict may contains any arguments accepted by :func:`mkColor() `. Example: ``mkPen(color='w', width=2)`` antialiasing : bool, default False Whether to draw edgelines with antialiasing. Note that if edgecolors is None, antialiasing is always False. """ GraphicsObject.__init__(self) self.qpicture = None ## rendered picture for display self.x = None self.y = None self.z = None self._dataBounds = None self.edgecolors = kwargs.get('edgecolors', None) if self.edgecolors is not None: self.edgecolors = fn.mkPen(self.edgecolors) # force the pen to be cosmetic. see discussion in # https://github.com/pyqtgraph/pyqtgraph/pull/2586 self.edgecolors.setCosmetic(True) self.antialiasing = kwargs.get('antialiasing', False) self.levels = kwargs.get('levels', None) self._defaultAutoLevels = kwargs.get('enableAutoLevels', True) if 'colorMap' in kwargs: cmap = kwargs.get('colorMap') if not isinstance(cmap, colormap.ColorMap): raise ValueError('colorMap argument must be a ColorMap instance') self.cmap = cmap else: self.cmap = colormap.get('viridis') self.lut_qcolor = self.cmap.getLookupTable(nPts=256, mode=self.cmap.QCOLOR) self.quads = QuadInstances() # If some data have been sent we directly display it if len(args)>0: self.setData(*args) def _prepareData(self, args): """ Check the shape of the data. Return a set of 2d array x, y, z ready to be used to draw the picture. """ # User didn't specified data if len(args)==0: self.x = None self.y = None self.z = None self._dataBounds = None # User only specified z elif len(args)==1: # If x and y is None, the polygons will be displaced on a grid x = np.arange(0, args[0].shape[0]+1, 1) y = np.arange(0, args[0].shape[1]+1, 1) self.x, self.y = np.meshgrid(x, y, indexing='ij') self.z = args[0] self._dataBounds = ((x[0], x[-1]), (y[0], y[-1])) # User specified x, y, z elif len(args)==3: # Shape checking if args[0].shape[0] != args[2].shape[0]+1 or args[0].shape[1] != args[2].shape[1]+1: raise ValueError('The dimension of x should be one greater than the one of z') if args[1].shape[0] != args[2].shape[0]+1 or args[1].shape[1] != args[2].shape[1]+1: raise ValueError('The dimension of y should be one greater than the one of z') self.x = args[0] self.y = args[1] self.z = args[2] xmn, xmx = np.min(self.x), np.max(self.x) ymn, ymx = np.min(self.y), np.max(self.y) self._dataBounds = ((xmn, xmx), (ymn, ymx)) else: raise ValueError('Data must been sent as (z) or (x, y, z)') def setData(self, *args, **kwargs): """ Set the data to be drawn. Parameters ---------- x, y : np.ndarray, optional, default None 2D array containing the coordinates of the polygons z : np.ndarray 2D array containing the value which will be mapped into the polygons colors. If x and y is None, the polygons will be displaced on a grid otherwise x and y will be used as polygons vertices coordinates as:: (x[i+1, j], y[i+1, j]) (x[i+1, j+1], y[i+1, j+1]) +---------+ | z[i, j] | +---------+ (x[i, j], y[i, j]) (x[i, j+1], y[i, j+1]) "ASCII from: ". autoLevels: bool, optional If set, overrides the value of ``enableAutoLevels`` """ old_bounds = self._dataBounds self._prepareData(args) boundsChanged = old_bounds != self._dataBounds self._rerender( autoLevels=kwargs.get('autoLevels', self._defaultAutoLevels) ) if boundsChanged: self.prepareGeometryChange() self.informViewBoundsChanged() self.update() def _rerender(self, *, autoLevels): self.qpicture = None if self.z is not None: if (self.levels is None) or autoLevels: # Autoscale colormap z_min = self.z.min() z_max = self.z.max() self.setLevels( (z_min, z_max), update=False) self.qpicture = self._drawPicture() def _drawPicture(self) -> QtGui.QPicture: # on entry, the following members are all valid: x, y, z, levels # this function does not alter any state (besides using self.quads) picture = QtGui.QPicture() painter = QtGui.QPainter(picture) # We set the pen of all polygons once if self.edgecolors is None: painter.setPen(QtCore.Qt.PenStyle.NoPen) else: painter.setPen(self.edgecolors) if self.antialiasing: painter.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing) ## Prepare colormap # First we get the LookupTable lut = self.lut_qcolor # Second we associate each z value, that we normalize, to the lut scale = len(lut) - 1 lo, hi = self.levels[0], self.levels[1] rng = hi - lo if rng == 0: rng = 1 norm = fn.rescaleData(self.z, scale / rng, lo, dtype=int, clip=(0, len(lut)-1)) if Qt.QT_LIB.startswith('PyQt'): drawConvexPolygon = lambda x : painter.drawConvexPolygon(*x) else: drawConvexPolygon = painter.drawConvexPolygon self.quads.resize(self.z.shape[0], self.z.shape[1]) memory = self.quads.ndarray() memory[..., 0] = self.x.ravel() memory[..., 1] = self.y.ravel() polys = self.quads.instances() # group indices of same coloridx together color_indices, counts = np.unique(norm, return_counts=True) sorted_indices = np.argsort(norm, axis=None) offset = 0 for coloridx, cnt in zip(color_indices, counts): indices = sorted_indices[offset:offset+cnt] offset += cnt painter.setBrush(lut[coloridx]) for idx in indices: drawConvexPolygon(polys[idx]) painter.end() return picture def setLevels(self, levels, update=True): """ Sets color-scaling levels for the mesh. Parameters ---------- levels: tuple ``(low, high)`` sets the range for which values can be represented in the colormap. update: bool, optional Controls if mesh immediately updates to reflect the new color levels. """ self.levels = levels self.sigLevelsChanged.emit(levels) if update: self._rerender(autoLevels=False) self.update() def getLevels(self): """ Returns a tuple containing the current level settings. See :func:`~setLevels`. The format is ``(low, high)``. """ return self.levels def setLookupTable(self, lut, update=True): self.cmap = None # invalidate since no longer consistent with lut self.lut_qcolor = lut[:] if update: self._rerender(autoLevels=False) self.update() def getColorMap(self): return self.cmap def setColorMap(self, cmap): self.setLookupTable(cmap.getLookupTable(nPts=256, mode=cmap.QCOLOR), update=True) self.cmap = cmap def enableAutoLevels(self): self._defaultAutoLevels = True def disableAutoLevels(self): self._defaultAutoLevels = False def paint(self, p, *args): if self.qpicture is not None: p.drawPicture(0, 0, self.qpicture) def width(self): if self._dataBounds is None: return 0 bounds = self._dataBounds[0] return bounds[1]-bounds[0] def height(self): if self._dataBounds is None: return 0 bounds = self._dataBounds[1] return bounds[1]-bounds[0] def dataBounds(self, ax, frac=1.0, orthoRange=None): if self._dataBounds is None: return (None, None) return self._dataBounds[ax] def pixelPadding(self): # pen is known to be cosmetic pen = self.edgecolors no_pen = (pen is None) or (pen.style() == QtCore.Qt.PenStyle.NoPen) return 0 if no_pen else (pen.widthF() or 1) * 0.5 def boundingRect(self): xmn, xmx = self.dataBounds(ax=0) if xmn is None or xmx is None: return QtCore.QRectF() ymn, ymx = self.dataBounds(ax=1) if ymn is None or ymx is None: return QtCore.QRectF() px = py = 0 pxPad = self.pixelPadding() if pxPad > 0: # determine length of pixel in local x, y directions px, py = self.pixelVectors() px = 0 if px is None else px.length() py = 0 if py is None else py.length() # return bounds expanded by pixel size px *= pxPad py *= pxPad return QtCore.QRectF(xmn-px, ymn-py, (2*px)+xmx-xmn, (2*py)+ymx-ymn) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/PlotCurveItem.py000066400000000000000000001132201457240071200255710ustar00rootroot00000000000000from ..Qt import QtCore, QtGui, QtWidgets HAVE_OPENGL = hasattr(QtWidgets, 'QOpenGLWidget') import math import sys import warnings import numpy as np from .. import Qt, debug from .. import functions as fn from .. import getConfigOption from .GraphicsObject import GraphicsObject __all__ = ['PlotCurveItem'] def arrayToLineSegments(x, y, connect, finiteCheck, out=None): if out is None: out = Qt.internals.PrimitiveArray(QtCore.QLineF, 4) # analogue of arrayToQPath taking the same parameters if len(x) < 2: out.resize(0) return out connect_array = None if isinstance(connect, np.ndarray): # the last element is not used connect_array, connect = np.asarray(connect[:-1], dtype=bool), 'array' all_finite = True if finiteCheck or connect == 'finite': mask = np.isfinite(x) & np.isfinite(y) all_finite = np.all(mask) if connect == 'all': if not all_finite: # remove non-finite points, if any x = x[mask] y = y[mask] elif connect == 'finite': if all_finite: connect = 'all' else: # each non-finite point affects the segment before and after connect_array = mask[:-1] & mask[1:] elif connect in ['pairs', 'array']: if not all_finite: # replicate the behavior of arrayToQPath backfill_idx = fn._compute_backfill_indices(mask) x = x[backfill_idx] y = y[backfill_idx] if connect == 'all': nsegs = len(x) - 1 out.resize(nsegs) if nsegs: memory = out.ndarray() memory[:, 0] = x[:-1] memory[:, 2] = x[1:] memory[:, 1] = y[:-1] memory[:, 3] = y[1:] elif connect == 'pairs': nsegs = len(x) // 2 out.resize(nsegs) if nsegs: memory = out.ndarray() memory = memory.reshape((-1, 2)) memory[:, 0] = x[:nsegs * 2] memory[:, 1] = y[:nsegs * 2] elif connect_array is not None: # the following are handled here # - 'array' # - 'finite' with non-finite elements nsegs = np.count_nonzero(connect_array) out.resize(nsegs) if nsegs: memory = out.ndarray() memory[:, 0] = x[:-1][connect_array] memory[:, 2] = x[1:][connect_array] memory[:, 1] = y[:-1][connect_array] memory[:, 3] = y[1:][connect_array] else: nsegs = 0 out.resize(nsegs) return out class PlotCurveItem(GraphicsObject): """ Class representing a single plot curve. Instances of this class are created automatically as part of :class:`PlotDataItem `; these rarely need to be instantiated directly. Features: - Fast data update - Fill under curve - Mouse interaction ===================== =============================================== **Signals:** sigPlotChanged(self) Emitted when the data being plotted has changed sigClicked(self, ev) Emitted when the curve is clicked ===================== =============================================== """ sigPlotChanged = QtCore.Signal(object) sigClicked = QtCore.Signal(object, object) def __init__(self, *args, **kargs): """ Forwards all arguments to :func:`setData `. Some extra arguments are accepted as well: ============== ======================================================= **Arguments:** parent The parent GraphicsObject (optional) clickable If `True`, the item will emit ``sigClicked`` when it is clicked on. Defaults to `False`. ============== ======================================================= """ GraphicsObject.__init__(self, kargs.get('parent', None)) self.clear() ## this is disastrous for performance. #self.setCacheMode(QtWidgets.QGraphicsItem.CacheMode.DeviceCoordinateCache) self.metaData = {} self.opts = { 'shadowPen': None, 'fillLevel': None, 'fillOutline': False, 'brush': None, 'stepMode': None, 'name': None, 'antialias': getConfigOption('antialias'), 'connect': 'all', 'mouseWidth': 8, # width of shape responding to mouse click 'compositionMode': None, 'skipFiniteCheck': False, 'segmentedLineMode': getConfigOption('segmentedLineMode'), } if 'pen' not in kargs: self.opts['pen'] = fn.mkPen('w') self.setClickable(kargs.get('clickable', False)) self.setData(*args, **kargs) def implements(self, interface=None): ints = ['plotData'] if interface is None: return ints return interface in ints def name(self): return self.opts.get('name', None) def setClickable(self, s, width=None): """Sets whether the item responds to mouse clicks. The `width` argument specifies the width in pixels orthogonal to the curve that will respond to a mouse click. """ self.clickable = s if width is not None: self.opts['mouseWidth'] = width self._mouseShape = None self._boundingRect = None def setCompositionMode(self, mode): """ Change the composition mode of the item. This is useful when overlaying multiple items. Parameters ---------- mode : ``QtGui.QPainter.CompositionMode`` Composition of the item, often used when overlaying items. Common options include: ``QPainter.CompositionMode.CompositionMode_SourceOver`` (Default) Image replaces the background if it is opaque. Otherwise, it uses the alpha channel to blend the image with the background. ``QPainter.CompositionMode.CompositionMode_Overlay`` Image color is mixed with the background color to reflect the lightness or darkness of the background ``QPainter.CompositionMode.CompositionMode_Plus`` Both the alpha and color of the image and background pixels are added together. ``QPainter.CompositionMode.CompositionMode_Plus`` The output is the image color multiplied by the background. See ``QPainter::CompositionMode`` in the Qt Documentation for more options and details """ self.opts['compositionMode'] = mode self.update() def getData(self): return self.xData, self.yData def dataBounds(self, ax, frac=1.0, orthoRange=None): ## Need this to run as fast as possible. ## check cache first: cache = self._boundsCache[ax] if cache is not None and cache[0] == (frac, orthoRange): return cache[1] (x, y) = self.getData() if x is None or len(x) == 0: return (None, None) if ax == 0: d = x d2 = y elif ax == 1: d = y d2 = x else: raise ValueError("Invalid axis value") ## If an orthogonal range is specified, mask the data now if orthoRange is not None: mask = (d2 >= orthoRange[0]) * (d2 <= orthoRange[1]) if self.opts.get("stepMode", None) == "center": mask = mask[:-1] # len(y) == len(x) - 1 when stepMode is center d = d[mask] #d2 = d2[mask] if len(d) == 0: return (None, None) ## Get min/max (or percentiles) of the requested data range if frac >= 1.0: # include complete data range # first try faster nanmin/max function, then cut out infs if needed. with warnings.catch_warnings(): # All-NaN data is acceptable; Explicit numpy warning is not needed. warnings.simplefilter("ignore") b = ( float(np.nanmin(d)), float(np.nanmax(d)) ) # enforce float format for bounds, even if data format is different if math.isinf(b[0]) or math.isinf(b[1]): mask = np.isfinite(d) d = d[mask] if len(d) == 0: return (None, None) b = ( float(d.min()), float(d.max()) ) # enforce float format for bounds, even if data format is different elif frac <= 0.0: raise Exception("Value for parameter 'frac' must be > 0. (got %s)" % str(frac)) else: # include a percentile of data range mask = np.isfinite(d) d = d[mask] if len(d) == 0: return (None, None) b = np.percentile(d, [50 * (1 - frac), 50 * (1 + frac)]) # percentile result is always float64 or larger ## adjust for fill level if ax == 1 and self.opts['fillLevel'] not in [None, 'enclosed']: b = ( float( min(b[0], self.opts['fillLevel']) ), float( max(b[1], self.opts['fillLevel']) ) ) # enforce float format for bounds, even if data format is different ## Add pen width only if it is non-cosmetic. pen = self.opts['pen'] spen = self.opts['shadowPen'] if pen is not None and not pen.isCosmetic() and pen.style() != QtCore.Qt.PenStyle.NoPen: b = (b[0] - pen.widthF()*0.7072, b[1] + pen.widthF()*0.7072) if spen is not None and not spen.isCosmetic() and spen.style() != QtCore.Qt.PenStyle.NoPen: b = (b[0] - spen.widthF()*0.7072, b[1] + spen.widthF()*0.7072) self._boundsCache[ax] = [(frac, orthoRange), b] return b def pixelPadding(self): pen = self.opts['pen'] spen = self.opts['shadowPen'] w = 0 if pen is not None and pen.isCosmetic() and pen.style() != QtCore.Qt.PenStyle.NoPen: w += pen.widthF()*0.7072 if spen is not None and spen.isCosmetic() and spen.style() != QtCore.Qt.PenStyle.NoPen: w = max(w, spen.widthF()*0.7072) if self.clickable: w = max(w, self.opts['mouseWidth']//2 + 1) return w def boundingRect(self): if self._boundingRect is None: (xmn, xmx) = self.dataBounds(ax=0) if xmn is None or xmx is None: return QtCore.QRectF() (ymn, ymx) = self.dataBounds(ax=1) if ymn is None or ymx is None: return QtCore.QRectF() px = py = 0.0 pxPad = self.pixelPadding() if pxPad > 0: # determine length of pixel in local x, y directions px, py = self.pixelVectors() try: px = 0 if px is None else px.length() except OverflowError: px = 0 try: py = 0 if py is None else py.length() except OverflowError: py = 0 # return bounds expanded by pixel size px *= pxPad py *= pxPad #px += self._maxSpotWidth * 0.5 #py += self._maxSpotWidth * 0.5 self._boundingRect = QtCore.QRectF(xmn-px, ymn-py, (2*px)+xmx-xmn, (2*py)+ymx-ymn) return self._boundingRect def viewTransformChanged(self): self.invalidateBounds() self.prepareGeometryChange() #def boundingRect(self): #if self._boundingRect is None: #(x, y) = self.getData() #if x is None or y is None or len(x) == 0 or len(y) == 0: #return QtCore.QRectF() #if self.opts['shadowPen'] is not None: #lineWidth = (max(self.opts['pen'].width(), self.opts['shadowPen'].width()) + 1) #else: #lineWidth = (self.opts['pen'].width()+1) #pixels = self.pixelVectors() #if pixels == (None, None): #pixels = [Point(0,0), Point(0,0)] #xmin = x.min() #xmax = x.max() #ymin = y.min() #ymax = y.max() #if self.opts['fillLevel'] is not None: #ymin = min(ymin, self.opts['fillLevel']) #ymax = max(ymax, self.opts['fillLevel']) #xmin -= pixels[0].x() * lineWidth #xmax += pixels[0].x() * lineWidth #ymin -= abs(pixels[1].y()) * lineWidth #ymax += abs(pixels[1].y()) * lineWidth #self._boundingRect = QtCore.QRectF(xmin, ymin, xmax-xmin, ymax-ymin) #return self._boundingRect def invalidateBounds(self): self._boundingRect = None self._boundsCache = [None, None] def setPen(self, *args, **kargs): """Set the pen used to draw the curve.""" if args and args[0] is None: self.opts['pen'] = None else: self.opts['pen'] = fn.mkPen(*args, **kargs) self.invalidateBounds() self.update() def setShadowPen(self, *args, **kargs): """ Set the shadow pen used to draw behind the primary pen. This pen must have a larger width than the primary pen to be visible. Arguments are passed to :func:`mkPen ` """ if args and args[0] is None: self.opts['shadowPen'] = None else: self.opts['shadowPen'] = fn.mkPen(*args, **kargs) self.invalidateBounds() self.update() def setBrush(self, *args, **kargs): """ Sets the brush used when filling the area under the curve. All arguments are passed to :func:`mkBrush `. """ if args and args[0] is None: self.opts['brush'] = None else: self.opts['brush'] = fn.mkBrush(*args, **kargs) self.invalidateBounds() self.update() def setFillLevel(self, level): """Sets the level filled to when filling under the curve""" self.opts['fillLevel'] = level self.fillPath = None self._fillPathList = None self.invalidateBounds() self.update() def setSkipFiniteCheck(self, skipFiniteCheck): """ When it is known that the plot data passed to ``PlotCurveItem`` contains only finite numerical values, the `skipFiniteCheck` property can help speed up plotting. If this flag is set and the data contains any non-finite values (such as `NaN` or `Inf`), unpredictable behavior will occur. The data might not be plotted, or there migth be significant performance impact. """ self.opts['skipFiniteCheck'] = bool(skipFiniteCheck) def setData(self, *args, **kargs): """ =============== ================================================================= **Arguments:** x, y (numpy arrays) Data to display pen Pen to use when drawing. Any single argument accepted by :func:`mkPen ` is allowed. shadowPen Pen for drawing behind the primary pen. Usually this is used to emphasize the curve by providing a high-contrast border. Any single argument accepted by :func:`mkPen ` is allowed. fillLevel (float or None) Fill the area under the curve to the specified value. fillOutline (bool) If True, an outline surrounding the `fillLevel` area is drawn. brush Brush to use when filling. Any single argument accepted by :func:`mkBrush ` is allowed. antialias (bool) Whether to use antialiasing when drawing. This is disabled by default because it decreases performance. stepMode (str or None) If 'center', a step is drawn using the `x` values as boundaries and the given `y` values are associated to the mid-points between the boundaries of each step. This is commonly used when drawing histograms. Note that in this case, ``len(x) == len(y) + 1`` If 'left' or 'right', the step is drawn assuming that the `y` value is associated to the left or right boundary, respectively. In this case ``len(x) == len(y)`` If not passed or an empty string or `None` is passed, the step mode is not enabled. connect Argument specifying how vertexes should be connected by line segments. | 'all' (default) indicates full connection. | 'pairs' draws one separate line segment for each two points given. | 'finite' omits segments attached to `NaN` or `Inf` values. | For any other connectivity, specify an array of boolean values. compositionMode See :func:`setCompositionMode `. skipFiniteCheck (bool, defaults to `False`) Optimization flag that can speed up plotting by not checking and compensating for `NaN` values. If set to `True`, and `NaN` values exist, the data may not be displayed or the plot may take a significant performance hit. =============== ================================================================= If non-keyword arguments are used, they will be interpreted as ``setData(y)`` for a single argument and ``setData(x, y)`` for two arguments. **Notes on performance:** Line widths greater than 1 pixel affect the performance as discussed in the documentation of :class:`PlotDataItem `. """ self.updateData(*args, **kargs) def updateData(self, *args, **kargs): profiler = debug.Profiler() if 'compositionMode' in kargs: self.setCompositionMode(kargs['compositionMode']) if len(args) == 1: kargs['y'] = args[0] elif len(args) == 2: kargs['x'] = args[0] kargs['y'] = args[1] if 'y' not in kargs or kargs['y'] is None: kargs['y'] = np.array([]) if 'x' not in kargs or kargs['x'] is None: kargs['x'] = np.arange(len(kargs['y'])) for k in ['x', 'y']: data = kargs[k] if isinstance(data, list): data = np.array(data) kargs[k] = data if not isinstance(data, np.ndarray) or data.ndim > 1: raise Exception("Plot data must be 1D ndarray.") if data.dtype.kind == 'c': raise Exception("Can not plot complex data types.") profiler("data checks") #self.setCacheMode(QtWidgets.QGraphicsItem.CacheMode.NoCache) ## Disabling and re-enabling the cache works around a bug in Qt 4.6 causing the cached results to display incorrectly ## Test this bug with test_PlotWidget and zoom in on the animated plot self.yData = kargs['y'].view(np.ndarray) self.xData = kargs['x'].view(np.ndarray) self.invalidateBounds() self.prepareGeometryChange() self.informViewBoundsChanged() profiler('copy') if 'stepMode' in kargs: self.opts['stepMode'] = kargs['stepMode'] if self.opts['stepMode'] in ("center", True): ## check against True for backwards compatibility if self.opts['stepMode'] is True: warnings.warn( 'stepMode=True is deprecated and will result in an error after October 2022. Use stepMode="center" instead.', DeprecationWarning, stacklevel=3 ) if len(self.xData) != len(self.yData)+1: ## allow difference of 1 for step mode plots raise Exception("len(X) must be len(Y)+1 since stepMode=True (got %s and %s)" % (self.xData.shape, self.yData.shape)) else: if self.xData.shape != self.yData.shape: ## allow difference of 1 for step mode plots raise Exception("X and Y arrays must be the same shape--got %s and %s." % (self.xData.shape, self.yData.shape)) self.path = None self.fillPath = None self._fillPathList = None self._mouseShape = None self._lineSegmentsRendered = False if 'name' in kargs: self.opts['name'] = kargs['name'] if 'connect' in kargs: self.opts['connect'] = kargs['connect'] if 'pen' in kargs: self.setPen(kargs['pen']) if 'shadowPen' in kargs: self.setShadowPen(kargs['shadowPen']) if 'fillLevel' in kargs: self.setFillLevel(kargs['fillLevel']) if 'fillOutline' in kargs: self.opts['fillOutline'] = kargs['fillOutline'] if 'brush' in kargs: self.setBrush(kargs['brush']) if 'antialias' in kargs: self.opts['antialias'] = kargs['antialias'] if 'skipFiniteCheck' in kargs: self.opts['skipFiniteCheck'] = kargs['skipFiniteCheck'] profiler('set') self.update() profiler('update') self.sigPlotChanged.emit(self) profiler('emit') @staticmethod def _generateStepModeData(stepMode, x, y, baseline): ## each value in the x/y arrays generates 2 points. if stepMode == "right": x2 = np.empty((len(x) + 1, 2), dtype=x.dtype) x2[:-1] = x[:, np.newaxis] x2[-1] = x2[-2] elif stepMode == "left": x2 = np.empty((len(x) + 1, 2), dtype=x.dtype) x2[1:] = x[:, np.newaxis] x2[0] = x2[1] elif stepMode in ("center", True): ## support True for back-compat x2 = np.empty((len(x),2), dtype=x.dtype) x2[:] = x[:, np.newaxis] else: raise ValueError("Unsupported stepMode %s" % stepMode) if baseline is None: x = x2.reshape(x2.size)[1:-1] y2 = np.empty((len(y),2), dtype=y.dtype) y2[:] = y[:,np.newaxis] y = y2.reshape(y2.size) else: # if baseline is provided, add vertical lines to left/right ends x = x2.reshape(x2.size) y2 = np.empty((len(y)+2,2), dtype=y.dtype) y2[1:-1] = y[:,np.newaxis] y = y2.reshape(y2.size)[1:-1] y[[0, -1]] = baseline return x, y def generatePath(self, x, y): if self.opts['stepMode']: x, y = self._generateStepModeData( self.opts['stepMode'], x, y, baseline=self.opts['fillLevel'] ) return fn.arrayToQPath( x, y, connect=self.opts['connect'], finiteCheck=not self.opts['skipFiniteCheck'] ) def getPath(self): if self.path is None: x,y = self.getData() if x is None or len(x) == 0 or y is None or len(y) == 0: self.path = QtGui.QPainterPath() else: self.path = self.generatePath(*self.getData()) self.fillPath = None self._fillPathList = None self._mouseShape = None return self.path def setSegmentedLineMode(self, mode): """ Sets the mode that decides whether or not lines are drawn as segmented lines. Drawing lines as segmented lines is more performant than the standard drawing method with continuous lines. Parameters ---------- mode : str ``'auto'`` (default) segmented lines are drawn if the pen's width > 1, pen style is a solid line, the pen color is opaque and anti-aliasing is not enabled. ``'on'`` lines are always drawn as segmented lines ``'off'`` lines are never drawn as segmented lines, i.e. the drawing method with continuous lines is used """ if mode not in ('auto', 'on', 'off'): raise ValueError(f'segmentedLineMode must be "auto", "on" or "off", got {mode} instead') self.opts['segmentedLineMode'] = mode self.invalidateBounds() self.update() def _shouldUseDrawLineSegments(self, pen): mode = self.opts['segmentedLineMode'] if mode in ('on',): return True if mode in ('off',): return False return ( pen.widthF() > 1.0 # non-solid pen styles need single polyline to be effective and pen.style() == QtCore.Qt.PenStyle.SolidLine # segmenting the curve slows gradient brushes, and is expected # to do the same for other patterns and pen.isSolid() # pen.brush().style() == Qt.BrushStyle.SolidPattern # ends of adjacent line segments overlapping is visible when not opaque and pen.color().alphaF() == 1.0 # anti-aliasing introduces transparent pixels and therefore also causes visible overlaps # for adjacent line segments and not self.opts['antialias'] ) def _getLineSegments(self): if not self._lineSegmentsRendered: x, y = self.getData() if self.opts['stepMode']: x, y = self._generateStepModeData( self.opts['stepMode'], x, y, baseline=self.opts['fillLevel'] ) self._lineSegments = arrayToLineSegments( x, y, connect=self.opts['connect'], finiteCheck=not self.opts['skipFiniteCheck'], out=self._lineSegments ) self._lineSegmentsRendered = True return self._lineSegments.drawargs() def _getClosingSegments(self): # this is only used for fillOutline # no point caching with so few elements generated segments = [] if self.opts['fillLevel'] == 'enclosed': return segments baseline = self.opts['fillLevel'] x, y = self.getData() lx, rx = x[[0, -1]] ly, ry = y[[0, -1]] if ry != baseline: segments.append(QtCore.QLineF(rx, ry, rx, baseline)) segments.append(QtCore.QLineF(rx, baseline, lx, baseline)) if ly != baseline: segments.append(QtCore.QLineF(lx, baseline, lx, ly)) return segments def _getFillPath(self): if self.fillPath is not None: return self.fillPath path = QtGui.QPainterPath(self.getPath()) self.fillPath = path if self.opts['fillLevel'] == 'enclosed': return path baseline = self.opts['fillLevel'] x, y = self.getData() lx, rx = x[[0, -1]] ly, ry = y[[0, -1]] if ry != baseline: path.lineTo(rx, baseline) path.lineTo(lx, baseline) if ly != baseline: path.lineTo(lx, ly) return path def _shouldUseFillPathList(self): connect = self.opts['connect'] return ( # not meaningful to fill disjoint lines isinstance(connect, str) and connect == 'all' # guard against odd-ball argument 'enclosed' and isinstance(self.opts['fillLevel'], (int, float)) ) def _getFillPathList(self, widget): if self._fillPathList is not None: return self._fillPathList x, y = self.getData() if self.opts['stepMode']: x, y = self._generateStepModeData( self.opts['stepMode'], x, y, # note that left/right vertical lines can be omitted here baseline=None ) if not self.opts['skipFiniteCheck']: mask = np.isfinite(x) & np.isfinite(y) if not mask.all(): # we are only supporting connect='all', # so remove non-finite values x = x[mask] y = y[mask] if len(x) < 2: return [] # Set suitable chunk size for current configuration: # * Without OpenGL split in small chunks # * With OpenGL split in rather big chunks # Note, the present code is used only if config option 'enableExperimental' is False, # otherwise the 'paintGL' method is used. # Values were found using 'PlotSpeedTest.py' example, see #2257. chunksize = 50 if not isinstance(widget, QtWidgets.QOpenGLWidget) else 5000 paths = self._fillPathList = [] offset = 0 xybuf = np.empty((chunksize+3, 2)) baseline = self.opts['fillLevel'] while offset < len(x) - 1: subx = x[offset:offset + chunksize] suby = y[offset:offset + chunksize] size = len(subx) xyview = xybuf[:size+3] xyview[:-3, 0] = subx xyview[:-3, 1] = suby xyview[-3:, 0] = subx[[-1, 0, 0]] xyview[-3:, 1] = [baseline, baseline, suby[0]] offset += size - 1 # last point is re-used for next chunk # data was either declared to be all-finite OR was sanitized path = fn._arrayToQPath_all(xyview[:, 0], xyview[:, 1], finiteCheck=False) paths.append(path) return paths @debug.warnOnException ## raising an exception here causes crash def paint(self, p, opt, widget): profiler = debug.Profiler() if self.xData is None or len(self.xData) == 0: return if getConfigOption('enableExperimental'): if HAVE_OPENGL and isinstance(widget, QtWidgets.QOpenGLWidget): self.paintGL(p, opt, widget) return if self._exportOpts is not False: aa = self._exportOpts.get('antialias', True) else: aa = self.opts['antialias'] p.setRenderHint(p.RenderHint.Antialiasing, aa) cmode = self.opts['compositionMode'] if cmode is not None: p.setCompositionMode(cmode) do_fill = self.opts['brush'] is not None and self.opts['fillLevel'] is not None do_fill_outline = do_fill and self.opts['fillOutline'] if do_fill: if self._shouldUseFillPathList(): paths = self._getFillPathList(widget) else: paths = [self._getFillPath()] profiler('generate fill path') for path in paths: p.fillPath(path, self.opts['brush']) profiler('draw fill path') # Avoid constructing a shadow pen if it's not used. if self.opts.get('shadowPen') is not None: if isinstance(self.opts.get('shadowPen'), QtGui.QPen): sp = self.opts['shadowPen'] else: sp = fn.mkPen(self.opts['shadowPen']) if sp.style() != QtCore.Qt.PenStyle.NoPen: p.setPen(sp) if self._shouldUseDrawLineSegments(sp): p.drawLines(*self._getLineSegments()) if do_fill_outline: p.drawLines(self._getClosingSegments()) else: if do_fill_outline: p.drawPath(self._getFillPath()) else: p.drawPath(self.getPath()) cp = self.opts['pen'] if not isinstance(cp, QtGui.QPen): cp = fn.mkPen(cp) p.setPen(cp) if self._shouldUseDrawLineSegments(cp): p.drawLines(*self._getLineSegments()) if do_fill_outline: p.drawLines(self._getClosingSegments()) else: if do_fill_outline: p.drawPath(self._getFillPath()) else: p.drawPath(self.getPath()) profiler('drawPath') def paintGL(self, p, opt, widget): p.beginNativePainting() import OpenGL.GL as gl if sys.platform == 'win32': # If Qt is built to dynamically load OpenGL, then the projection and # modelview matrices are not setup. # https://doc.qt.io/qt-6/windows-graphics.html # https://code.woboq.org/qt6/qtbase/src/opengl/qopenglpaintengine.cpp.html # Technically, we could enable it for all platforms, but for now, just # enable it where it is required, i.e. Windows gl.glMatrixMode(gl.GL_PROJECTION) gl.glLoadIdentity() gl.glOrtho(0, widget.width(), widget.height(), 0, -999999, 999999) gl.glMatrixMode(gl.GL_MODELVIEW) mat = QtGui.QMatrix4x4(self.sceneTransform()) gl.glLoadMatrixf(np.array(mat.data(), dtype=np.float32)) ## set clipping viewport view = self.getViewBox() if view is not None: rect = view.mapRectToItem(self, view.boundingRect()) #gl.glViewport(int(rect.x()), int(rect.y()), int(rect.width()), int(rect.height())) #gl.glTranslate(-rect.x(), -rect.y(), 0) gl.glEnable(gl.GL_STENCIL_TEST) gl.glColorMask(gl.GL_FALSE, gl.GL_FALSE, gl.GL_FALSE, gl.GL_FALSE) # disable drawing to frame buffer gl.glDepthMask(gl.GL_FALSE) # disable drawing to depth buffer gl.glStencilFunc(gl.GL_NEVER, 1, 0xFF) gl.glStencilOp(gl.GL_REPLACE, gl.GL_KEEP, gl.GL_KEEP) ## draw stencil pattern gl.glStencilMask(0xFF) gl.glClear(gl.GL_STENCIL_BUFFER_BIT) gl.glBegin(gl.GL_TRIANGLES) gl.glVertex2f(rect.x(), rect.y()) gl.glVertex2f(rect.x()+rect.width(), rect.y()) gl.glVertex2f(rect.x(), rect.y()+rect.height()) gl.glVertex2f(rect.x()+rect.width(), rect.y()+rect.height()) gl.glVertex2f(rect.x()+rect.width(), rect.y()) gl.glVertex2f(rect.x(), rect.y()+rect.height()) gl.glEnd() gl.glColorMask(gl.GL_TRUE, gl.GL_TRUE, gl.GL_TRUE, gl.GL_TRUE) gl.glDepthMask(gl.GL_TRUE) gl.glStencilMask(0x00) gl.glStencilFunc(gl.GL_EQUAL, 1, 0xFF) try: x, y = self.getData() pos = np.empty((len(x), 2), dtype=np.float32) pos[:,0] = x pos[:,1] = y gl.glEnableClientState(gl.GL_VERTEX_ARRAY) try: gl.glVertexPointerf(pos) pen = fn.mkPen(self.opts['pen']) gl.glColor4f(*pen.color().getRgbF()) width = pen.width() if pen.isCosmetic() and width < 1: width = 1 gl.glPointSize(width) gl.glLineWidth(width) # enable antialiasing if requested if self._exportOpts is not False: aa = self._exportOpts.get('antialias', True) else: aa = self.opts['antialias'] if aa: gl.glEnable(gl.GL_LINE_SMOOTH) gl.glEnable(gl.GL_BLEND) gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA) gl.glHint(gl.GL_LINE_SMOOTH_HINT, gl.GL_NICEST) else: gl.glDisable(gl.GL_LINE_SMOOTH) gl.glDrawArrays(gl.GL_LINE_STRIP, 0, pos.shape[0]) finally: gl.glDisableClientState(gl.GL_VERTEX_ARRAY) finally: p.endNativePainting() def clear(self): self.xData = None ## raw values self.yData = None self._lineSegments = None self._lineSegmentsRendered = False self.path = None self.fillPath = None self._fillPathList = None self._mouseShape = None self._mouseBounds = None self._boundsCache = [None, None] #del self.xData, self.yData, self.xDisp, self.yDisp, self.path def mouseShape(self): """ Return a QPainterPath representing the clickable shape of the curve """ if self._mouseShape is None: view = self.getViewBox() if view is None: return QtGui.QPainterPath() stroker = QtGui.QPainterPathStroker() path = self.getPath() path = self.mapToItem(view, path) stroker.setWidth(self.opts['mouseWidth']) mousePath = stroker.createStroke(path) self._mouseShape = self.mapFromItem(view, mousePath) return self._mouseShape def mouseClickEvent(self, ev): if not self.clickable or ev.button() != QtCore.Qt.MouseButton.LeftButton: return if self.mouseShape().contains(ev.pos()): ev.accept() self.sigClicked.emit(self, ev) class ROIPlotItem(PlotCurveItem): """Plot curve that monitors an ROI and image for changes to automatically replot.""" def __init__(self, roi, data, img, axes=(0,1), xVals=None, color=None): self.roi = roi self.roiData = data self.roiImg = img self.axes = axes self.xVals = xVals PlotCurveItem.__init__(self, self.getRoiData(), x=self.xVals, color=color) #roi.connect(roi, QtCore.SIGNAL('regionChanged'), self.roiChangedEvent) roi.sigRegionChanged.connect(self.roiChangedEvent) #self.roiChangedEvent() def getRoiData(self): d = self.roi.getArrayRegion(self.roiData, self.roiImg, axes=self.axes) if d is None: return while d.ndim > 1: d = d.mean(axis=1) return d def roiChangedEvent(self): d = self.getRoiData() self.updateData(d, self.xVals) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/PlotDataItem.py000066400000000000000000001603261457240071200253670ustar00rootroot00000000000000import math import warnings import bisect import numpy as np from .. import debug as debug from .. import functions as fn from .. import getConfigOption from ..Qt import QtCore from .GraphicsObject import GraphicsObject from .PlotCurveItem import PlotCurveItem from .ScatterPlotItem import ScatterPlotItem __all__ = ['PlotDataItem'] class PlotDataset(object): """ :orphan: .. warning:: This class is intended for internal use. The interface may change without warning. Holds collected information for a plotable dataset. Numpy arrays containing x and y coordinates are available as ``dataset.x`` and ``dataset.y``. After a search has been performed, typically during a call to :func:`dataRect() `, ``dataset.containsNonfinite`` is `True` if any coordinate values are nonfinite (e.g. NaN or inf) or `False` if all values are finite. If no search has been performed yet, ``dataset.containsNonfinite`` is `None`. For internal use in :class:`PlotDataItem `, this class should not be instantiated when no data is available. """ def __init__(self, x, y, xAllFinite=None, yAllFinite=None): """ Parameters ---------- x: array x coordinates of data points. y: array y coordinates of data points. """ super().__init__() self.x = x self.y = y self.xAllFinite = xAllFinite self.yAllFinite = yAllFinite self._dataRect = None if isinstance(x, np.ndarray) and x.dtype.kind in 'iu': self.xAllFinite = True if isinstance(y, np.ndarray) and y.dtype.kind in 'iu': self.yAllFinite = True @property def containsNonfinite(self): if self.xAllFinite is None or self.yAllFinite is None: # don't know for sure yet return None return not (self.xAllFinite and self.yAllFinite) def _updateDataRect(self): """ Finds bounds of plotable data and stores them as ``dataset._dataRect``, stores information about the presence of nonfinite data points. """ if self.y is None or self.x is None: return None xmin, xmax, self.xAllFinite = self._getArrayBounds(self.x, self.xAllFinite) ymin, ymax, self.yAllFinite = self._getArrayBounds(self.y, self.yAllFinite) self._dataRect = QtCore.QRectF( QtCore.QPointF(xmin,ymin), QtCore.QPointF(xmax,ymax) ) def _getArrayBounds(self, arr, all_finite): # here all_finite could be [None, False, True] if not all_finite: # This may contain NaN values and infinites. selection = np.isfinite(arr) # We are looking for the bounds of the plottable data set. Infinite and Nan are ignored. all_finite = selection.all() # True if all values are finite, False if there are any non-finites if not all_finite: arr = arr[selection] # here all_finite could be [False, True] try: amin = np.min( arr ) # find minimum of all finite values amax = np.max( arr ) # find maximum of all finite values except ValueError: # is raised when there are no finite values amin = np.nan amax = np.nan return amin, amax, all_finite def dataRect(self): """ Returns a bounding rectangle (as :class:`QtCore.QRectF`) for the finite subset of data. If there is an active mapping function, such as logarithmic scaling, then bounds represent the mapped data. Will return `None` if there is no data or if all values (`x` or `y`) are NaN. """ if self._dataRect is None: self._updateDataRect() return self._dataRect def applyLogMapping(self, logMode): """ Applies a logarithmic mapping transformation (base 10) if requested for the respective axis. This replaces the internal data. Values of ``-inf`` resulting from zeros in the original dataset are replaced by ``np.nan``. Parameters ---------- logmode: tuple or list of two bool A `True` value requests log-scale mapping for the x and y axis (in this order). """ if logMode[0]: with warnings.catch_warnings(): warnings.simplefilter("ignore", RuntimeWarning) self.x = np.log10(self.x) nonfinites = ~np.isfinite( self.x ) if nonfinites.any(): self.x[nonfinites] = np.nan # set all non-finite values to NaN all_x_finite = False else: all_x_finite = True self.xAllFinite = all_x_finite if logMode[1]: with warnings.catch_warnings(): warnings.simplefilter("ignore", RuntimeWarning) self.y = np.log10(self.y) nonfinites = ~np.isfinite( self.y ) if nonfinites.any(): self.y[nonfinites] = np.nan # set all non-finite values to NaN all_y_finite = False else: all_y_finite = True self.yAllFinite = all_y_finite class PlotDataItem(GraphicsObject): """ **Bases:** :class:`GraphicsObject ` :class:`PlotDataItem` provides a unified interface for displaying plot curves, scatter plots, or both. It also contains methods to transform or decimate the original data before it is displayed. As pyqtgraph's standard plotting object, ``plot()`` methods such as :func:`pyqtgraph.plot` and :func:`PlotItem.plot() ` create instances of :class:`PlotDataItem`. While it is possible to use :class:`PlotCurveItem ` or :class:`ScatterPlotItem ` individually, this is recommended only where performance is critical and the limited functionality of these classes is sufficient. ================================== ============================================== **Signals:** sigPlotChanged(self) Emitted when the data in this item is updated. sigClicked(self, ev) Emitted when the item is clicked. sigPointsClicked(self, points, ev) Emitted when a plot point is clicked Sends the list of points under the mouse. sigPointsHovered(self, points, ev) Emitted when a plot point is hovered over. Sends the list of points under the mouse. ================================== ============================================== """ sigPlotChanged = QtCore.Signal(object) sigClicked = QtCore.Signal(object, object) sigPointsClicked = QtCore.Signal(object, object, object) sigPointsHovered = QtCore.Signal(object, object, object) # **(x,y data only)** def __init__(self, *args, **kargs): """ There are many different ways to create a PlotDataItem. **Data initialization arguments:** (x,y data only) ========================== ========================================= PlotDataItem(x, y) x, y: array_like coordinate values PlotDataItem(y) y values only -- x will be automatically set to ``range(len(y))`` PlotDataItem(x=x, y=y) x and y given by keyword arguments PlotDataItem(ndarray(N,2)) single numpy array with shape (N, 2), where ``x=data[:,0]`` and ``y=data[:,1]`` ========================== ========================================= **Data initialization arguments:** (x,y data AND may include spot style) ============================ =============================================== PlotDataItem(recarray) numpy record array with ``dtype=[('x', float), ('y', float), ...]`` PlotDataItem(list-of-dicts) ``[{'x': x, 'y': y, ...}, ...]`` PlotDataItem(dict-of-lists) ``{'x': [...], 'y': [...], ...}`` ============================ =============================================== **Line style keyword arguments:** ============ ============================================================================== connect Specifies how / whether vertexes should be connected. See below for details. pen Pen to use for drawing the lines between points. Default is solid grey, 1px width. Use None to disable line drawing. May be a ``QPen`` or any single argument accepted by :func:`mkPen() ` shadowPen Pen for secondary line to draw behind the primary line. Disabled by default. May be a ``QPen`` or any single argument accepted by :func:`mkPen() ` fillLevel If specified, the area between the curve and fillLevel is filled. fillOutline (bool) If True, an outline surrounding the *fillLevel* area is drawn. fillBrush Fill to use in the *fillLevel* area. May be any single argument accepted by :func:`mkBrush() ` stepMode (str or None) If specified and not None, a stepped curve is drawn. For 'left' the specified points each describe the left edge of a step. For 'right', they describe the right edge. For 'center', the x coordinates specify the location of the step boundaries. This mode is commonly used for histograms. Note that it requires an additional x value, such that len(x) = len(y) + 1 . ============ ============================================================================== ``connect`` supports the following arguments: - 'all' connects all points. - 'pairs' generates lines between every other point. - 'finite' creates a break when a nonfinite points is encountered. - If an ndarray is passed, it should contain `N` int32 values of 0 or 1. Values of 1 indicate that the respective point will be connected to the next. - In the default 'auto' mode, PlotDataItem will normally use 'all', but if any nonfinite data points are detected, it will automatically switch to 'finite'. See :func:`arrayToQPath() ` for more details. **Point style keyword arguments:** (see :func:`ScatterPlotItem.setData() ` for more information) ============ ====================================================== symbol Symbol to use for drawing points, or a list of symbols for each. The default is no symbol. symbolPen Outline pen for drawing points, or a list of pens, one per point. May be any single argument accepted by :func:`mkPen() `. symbolBrush Brush for filling points, or a list of brushes, one per point. May be any single argument accepted by :func:`mkBrush() `. symbolSize Diameter of symbols, or list of diameters. pxMode (bool) If True, then symbolSize is specified in pixels. If False, then symbolSize is specified in data coordinates. ============ ====================================================== Any symbol recognized by :class:`ScatterPlotItem ` can be specified, including 'o' (circle), 's' (square), 't', 't1', 't2', 't3' (triangles of different orientation), 'd' (diamond), '+' (plus sign), 'x' (x mark), 'p' (pentagon), 'h' (hexagon) and 'star'. Symbols can also be directly given in the form of a :class:`QtGui.QPainterPath` instance. **Optimization keyword arguments:** ================= ======================================================================= useCache (bool) By default, generated point graphics items are cached to improve performance. Setting this to False can improve image quality in certain situations. antialias (bool) By default, antialiasing is disabled to improve performance. Note that in some cases (in particular, when ``pxMode=True``), points will be rendered antialiased even if this is set to `False`. downsample (int) Reduce the number of samples displayed by the given factor. downsampleMethod 'subsample': Downsample by taking the first of N samples. This method is fastest and least accurate. 'mean': Downsample by taking the mean of N samples. 'peak': Downsample by drawing a saw wave that follows the min and max of the original data. This method produces the best visual representation of the data but is slower. autoDownsample (bool) If `True`, resample the data before plotting to avoid plotting multiple line segments per pixel. This can improve performance when viewing very high-density data, but increases the initial overhead and memory usage. clipToView (bool) If `True`, only data visible within the X range of the containing :class:`ViewBox` is plotted. This can improve performance when plotting very large data sets where only a fraction of the data is visible at any time. dynamicRangeLimit (float or `None`) Limit off-screen y positions of data points. `None` disables the limiting. This can increase performance but may cause plots to disappear at high levels of magnification. The default of 1e6 limits data to approximately 1,000,000 times the :class:`ViewBox` height. dynamicRangeHyst (float) Permits changes in vertical zoom up to the given hysteresis factor (the default is 3.0) before the limit calculation is repeated. skipFiniteCheck (bool, default `False`) Optimization flag that can speed up plotting by not checking and compensating for NaN values. If set to `True`, and NaN values exist, unpredictable behavior will occur. The data may not be displayed or the plot may take a significant performance hit. In the default 'auto' connect mode, `PlotDataItem` will automatically override this setting. ================= ======================================================================= **Meta-info keyword arguments:** ========== ================================================ name (string) Name of item for use in the plot legend ========== ================================================ **Notes on performance:** Plotting lines with the default single-pixel width is the fastest available option. For such lines, translucent colors (`alpha` < 1) do not result in a significant slowdown. Wider lines increase the complexity due to the overlap of individual line segments. Translucent colors require merging the entire plot into a single entity before the alpha value can be applied. For plots with more than a few hundred points, this can result in excessive slowdown. Since version 0.12.4, this slowdown is automatically avoided by an algorithm that draws line segments separately for fully opaque lines. Setting `alpha` < 1 reverts to the previous, slower drawing method. For lines with a width of more than 4 pixels, :func:`pyqtgraph.mkPen() ` will automatically create a ``QPen`` with `Qt.PenCapStyle.RoundCap` to ensure a smooth connection of line segments. This incurs a small performance penalty. """ GraphicsObject.__init__(self) self.setFlag(self.GraphicsItemFlag.ItemHasNoContents) # Original data, mapped data, and data processed for display is now all held in PlotDataset objects. # The convention throughout PlotDataItem is that a PlotDataset is only instantiated if valid data is available. self._dataset = None # will hold a PlotDataset for the original data, accessed by getOriginalData() self._datasetMapped = None # will hold a PlotDataset for data after mapping transforms (e.g. log scale) self._datasetDisplay = None # will hold a PlotDataset for data downsampled and limited for display, accessed by getData() self.curve = PlotCurveItem() self.scatter = ScatterPlotItem() self.curve.setParentItem(self) self.scatter.setParentItem(self) self.curve.sigClicked.connect(self.curveClicked) self.scatter.sigClicked.connect(self.scatterClicked) self.scatter.sigHovered.connect(self.scatterHovered) # self._xViewRangeWasChanged = False # self._yViewRangeWasChanged = False # self._styleWasChanged = True # force initial update # update-required notifications are handled through properties to allow future management through # the QDynamicPropertyChangeEvent sent on any change. self.setProperty('xViewRangeWasChanged', False) self.setProperty('yViewRangeWasChanged', False) self.setProperty('styleWasChanged', True) # force initial update self._drlLastClip = (0.0, 0.0) # holds last clipping points of dynamic range limiter #self.clear() self.opts = { 'connect': 'auto', # defaults to 'all', unless overridden to 'finite' for log-scaling 'skipFiniteCheck': False, 'fftMode': False, 'logMode': [False, False], 'derivativeMode': False, 'phasemapMode': False, 'alphaHint': 1.0, 'alphaMode': False, 'pen': (200,200,200), 'shadowPen': None, 'fillLevel': None, 'fillOutline': False, 'fillBrush': None, 'stepMode': None, 'symbol': None, 'symbolSize': 10, 'symbolPen': (200,200,200), 'symbolBrush': (50, 50, 150), 'pxMode': True, 'antialias': getConfigOption('antialias'), 'pointMode': None, 'useCache': True, 'downsample': 1, 'autoDownsample': False, 'downsampleMethod': 'peak', 'autoDownsampleFactor': 5., # draw ~5 samples per pixel 'clipToView': False, 'dynamicRangeLimit': 1e6, 'dynamicRangeHyst': 3.0, 'data': None, } self.setCurveClickable(kargs.get('clickable', False)) self.setData(*args, **kargs) # Compatibility with direct property access to previous xData and yData structures: @property def xData(self): if self._dataset is None: return None return self._dataset.x @property def yData(self): if self._dataset is None: return None return self._dataset.y def implements(self, interface=None): ints = ['plotData'] if interface is None: return ints return interface in ints def name(self): """ Returns the name that represents this item in the legend. """ return self.opts.get('name', None) def setCurveClickable(self, state, width=None): """ ``state=True`` sets the curve to be clickable, with a tolerance margin represented by `width`. """ self.curve.setClickable(state, width) def curveClickable(self): """ Returns `True` if the curve is set to be clickable. """ return self.curve.clickable def boundingRect(self): return QtCore.QRectF() ## let child items handle this def setPos(self, x, y): GraphicsObject.setPos(self, x, y) # to update viewRect: self.viewTransformChanged() # to update displayed point sets, e.g. when clipping (which uses viewRect): self.viewRangeChanged() def setAlpha(self, alpha, auto): if self.opts['alphaHint'] == alpha and self.opts['alphaMode'] == auto: return self.opts['alphaHint'] = alpha self.opts['alphaMode'] = auto self.setOpacity(alpha) #self.update() def setFftMode(self, state): """ ``state = True`` enables mapping the data by a fast Fourier transform. If the `x` values are not equidistant, the data set is resampled at equal intervals. """ if self.opts['fftMode'] == state: return self.opts['fftMode'] = state self._datasetMapped = None self._datasetDisplay = None self.updateItems(styleUpdate=False) self.informViewBoundsChanged() def setLogMode(self, xState, yState): """ When log mode is enabled for the respective axis by setting ``xState`` or ``yState`` to `True`, a mapping according to ``mapped = np.log10( value )`` is applied to the data. For negative or zero values, this results in a `NaN` value. """ if self.opts['logMode'] == [xState, yState]: return self.opts['logMode'] = [xState, yState] self._datasetMapped = None # invalidate mapped data self._datasetDisplay = None # invalidate display data self._adsLastValue = 1 # reset auto-downsample value self.updateItems(styleUpdate=False) self.informViewBoundsChanged() def setDerivativeMode(self, state): """ ``state = True`` enables derivative mode, where a mapping according to ``y_mapped = dy / dx`` is applied, with `dx` and `dy` representing the differences between adjacent `x` and `y` values. """ if self.opts['derivativeMode'] == state: return self.opts['derivativeMode'] = state self._datasetMapped = None # invalidate mapped data self._datasetDisplay = None # invalidate display data self._adsLastValue = 1 # reset auto-downsample value self.updateItems(styleUpdate=False) self.informViewBoundsChanged() def setPhasemapMode(self, state): """ ``state = True`` enables phase map mode, where a mapping according to ``x_mappped = y`` and ``y_mapped = dy / dx`` is applied, plotting the numerical derivative of the data over the original `y` values. """ if self.opts['phasemapMode'] == state: return self.opts['phasemapMode'] = state self._datasetMapped = None # invalidate mapped data self._datasetDisplay = None # invalidate display data self._adsLastValue = 1 # reset auto-downsample value self.updateItems(styleUpdate=False) self.informViewBoundsChanged() def setPen(self, *args, **kargs): """ Sets the pen used to draw lines between points. The argument can be a :class:`QtGui.QPen` or any combination of arguments accepted by :func:`pyqtgraph.mkPen() `. """ pen = fn.mkPen(*args, **kargs) self.opts['pen'] = pen #self.curve.setPen(pen) #for c in self.curves: #c.setPen(pen) #self.update() self.updateItems(styleUpdate=True) def setShadowPen(self, *args, **kargs): """ Sets the shadow pen used to draw lines between points (this is for enhancing contrast or emphasizing data). This line is drawn behind the primary pen and should generally be assigned greater width than the primary pen. The argument can be a :class:`QtGui.QPen` or any combination of arguments accepted by :func:`pyqtgraph.mkPen() `. """ if args and args[0] is None: pen = None else: pen = fn.mkPen(*args, **kargs) self.opts['shadowPen'] = pen #for c in self.curves: #c.setPen(pen) #self.update() self.updateItems(styleUpdate=True) def setFillBrush(self, *args, **kargs): """ Sets the :class:`QtGui.QBrush` used to fill the area under the curve. See :func:`mkBrush() `) for arguments. """ if args and args[0] is None: brush = None else: brush = fn.mkBrush(*args, **kargs) if self.opts['fillBrush'] == brush: return self.opts['fillBrush'] = brush self.updateItems(styleUpdate=True) def setBrush(self, *args, **kargs): """ See :func:`~pyqtgraph.PlotDataItem.setFillBrush` """ return self.setFillBrush(*args, **kargs) def setFillLevel(self, level): """ Enables filling the area under the curve towards the value specified by `level`. `None` disables the filling. """ if self.opts['fillLevel'] == level: return self.opts['fillLevel'] = level self.updateItems(styleUpdate=True) def setSymbol(self, symbol): """ `symbol` can be any string recognized by :class:`ScatterPlotItem ` or a list that specifies a symbol for each point. """ if self.opts['symbol'] == symbol: return self.opts['symbol'] = symbol #self.scatter.setSymbol(symbol) self.updateItems(styleUpdate=True) def setSymbolPen(self, *args, **kargs): """ Sets the :class:`QtGui.QPen` used to draw symbol outlines. See :func:`mkPen() `) for arguments. """ pen = fn.mkPen(*args, **kargs) if self.opts['symbolPen'] == pen: return self.opts['symbolPen'] = pen #self.scatter.setSymbolPen(pen) self.updateItems(styleUpdate=True) def setSymbolBrush(self, *args, **kargs): """ Sets the :class:`QtGui.QBrush` used to fill symbols. See :func:`mkBrush() `) for arguments. """ brush = fn.mkBrush(*args, **kargs) if self.opts['symbolBrush'] == brush: return self.opts['symbolBrush'] = brush #self.scatter.setSymbolBrush(brush) self.updateItems(styleUpdate=True) def setSymbolSize(self, size): """ Sets the symbol size. """ if self.opts['symbolSize'] == size: return self.opts['symbolSize'] = size #self.scatter.setSymbolSize(symbolSize) self.updateItems(styleUpdate=True) def setDownsampling(self, ds=None, auto=None, method=None): """ Sets the downsampling mode of this item. Downsampling reduces the number of samples drawn to increase performance. ============== ================================================================= **Arguments:** ds (int) Reduce visible plot samples by this factor. To disable, set ds=1. auto (bool) If True, automatically pick *ds* based on visible range mode 'subsample': Downsample by taking the first of N samples. This method is fastest and least accurate. 'mean': Downsample by taking the mean of N samples. 'peak': Downsample by drawing a saw wave that follows the min and max of the original data. This method produces the best visual representation of the data but is slower. ============== ================================================================= """ changed = False if ds is not None: if self.opts['downsample'] != ds: changed = True self.opts['downsample'] = ds if auto is not None and self.opts['autoDownsample'] != auto: self.opts['autoDownsample'] = auto changed = True if method is not None: if self.opts['downsampleMethod'] != method: changed = True self.opts['downsampleMethod'] = method if changed: self._datasetMapped = None # invalidata mapped data self._datasetDisplay = None # invalidate display data self._adsLastValue = 1 # reset auto-downsample value self.updateItems(styleUpdate=False) def setClipToView(self, state): """ ``state=True`` enables clipping the displayed data set to the visible x-axis range. """ if self.opts['clipToView'] == state: return self.opts['clipToView'] = state self._datasetDisplay = None # invalidate display data self.updateItems(styleUpdate=False) def setDynamicRangeLimit(self, limit=1e06, hysteresis=3.): """ Limit the off-screen positions of data points at large magnification This avoids errors with plots not displaying because their visibility is incorrectly determined. The default setting repositions far-off points to be within ±10^6 times the viewport height. =============== ================================================================ **Arguments:** limit (float or None) Any data outside the range of limit * hysteresis will be constrained to the limit value limit. All values are relative to the viewport height. 'None' disables the check for a minimal increase in performance. Default is 1E+06. hysteresis (float) Hysteresis factor that controls how much change in zoom level (vertical height) is allowed before recalculating Default is 3.0 =============== ================================================================ """ if hysteresis < 1.0: hysteresis = 1.0 self.opts['dynamicRangeHyst'] = hysteresis if limit == self.opts['dynamicRangeLimit']: return # avoid update if there is no change self.opts['dynamicRangeLimit'] = limit # can be None self._datasetDisplay = None # invalidate display data self.updateItems(styleUpdate=False) def setSkipFiniteCheck(self, skipFiniteCheck): """ When it is known that the plot data passed to ``PlotDataItem`` contains only finite numerical values, the ``skipFiniteCheck`` property can help speed up plotting. If this flag is set and the data contains any non-finite values (such as `NaN` or `Inf`), unpredictable behavior will occur. The data might not be plotted, or there migth be significant performance impact. In the default 'auto' connect mode, ``PlotDataItem`` will apply this setting automatically. """ self.opts['skipFiniteCheck'] = bool(skipFiniteCheck) def setData(self, *args, **kargs): """ Clear any data displayed by this item and display new data. See :func:`__init__() ` for details; it accepts the same arguments. """ #self.clear() if kargs.get("stepMode", None) is True: warnings.warn( 'stepMode=True is deprecated and will result in an error after October 2022. Use stepMode="center" instead.', DeprecationWarning, stacklevel=3 ) if 'decimate' in kargs.keys(): warnings.warn( 'The decimate keyword has been deprecated. It has no effect and may result in an error in releases after October 2022. ', DeprecationWarning, stacklevel=2 ) if 'identical' in kargs.keys(): warnings.warn( 'The identical keyword has been deprecated. It has no effect may result in an error in releases after October 2022. ', DeprecationWarning, stacklevel=2 ) profiler = debug.Profiler() y = None x = None if len(args) == 1: data = args[0] dt = dataType(data) if dt == 'empty': pass elif dt == 'listOfValues': y = np.array(data) elif dt == 'Nx2array': x = data[:,0] y = data[:,1] elif dt == 'recarray' or dt == 'dictOfLists': if 'x' in data: x = np.array(data['x']) if 'y' in data: y = np.array(data['y']) elif dt == 'listOfDicts': if 'x' in data[0]: x = np.array([d.get('x',None) for d in data]) if 'y' in data[0]: y = np.array([d.get('y',None) for d in data]) for k in ['data', 'symbolSize', 'symbolPen', 'symbolBrush', 'symbolShape']: if k in data: kargs[k] = [d.get(k, None) for d in data] elif dt == 'MetaArray': y = data.view(np.ndarray) x = data.xvals(0).view(np.ndarray) else: raise TypeError('Invalid data type %s' % type(data)) elif len(args) == 2: seq = ('listOfValues', 'MetaArray', 'empty') dtyp = dataType(args[0]), dataType(args[1]) if dtyp[0] not in seq or dtyp[1] not in seq: raise TypeError('When passing two unnamed arguments, both must be a list or array of values. (got %s, %s)' % (str(type(args[0])), str(type(args[1])))) if not isinstance(args[0], np.ndarray): #x = np.array(args[0]) if dtyp[0] == 'MetaArray': x = args[0].asarray() else: x = np.array(args[0]) else: x = args[0].view(np.ndarray) if not isinstance(args[1], np.ndarray): #y = np.array(args[1]) if dtyp[1] == 'MetaArray': y = args[1].asarray() else: y = np.array(args[1]) else: y = args[1].view(np.ndarray) if 'x' in kargs: x = kargs['x'] if dataType(x) == 'MetaArray': x = x.asarray() if 'y' in kargs: y = kargs['y'] if dataType(y) == 'MetaArray': y = y.asarray() profiler('interpret data') ## pull in all style arguments. ## Use self.opts to fill in anything not present in kargs. if 'name' in kargs: self.opts['name'] = kargs['name'] self.setProperty('styleWasChanged', True) if 'connect' in kargs: self.opts['connect'] = kargs['connect'] self.setProperty('styleWasChanged', True) if 'skipFiniteCheck' in kargs: self.opts['skipFiniteCheck'] = kargs['skipFiniteCheck'] ## if symbol pen/brush are given with no previously set symbol, then assume symbol is 'o' if 'symbol' not in kargs and ('symbolPen' in kargs or 'symbolBrush' in kargs or 'symbolSize' in kargs): if self.opts['symbol'] is None: kargs['symbol'] = 'o' if 'brush' in kargs: kargs['fillBrush'] = kargs['brush'] for k in list(self.opts.keys()): if k in kargs: self.opts[k] = kargs[k] self.setProperty('styleWasChanged', True) #curveArgs = {} #for k in ['pen', 'shadowPen', 'fillLevel', 'brush']: #if k in kargs: #self.opts[k] = kargs[k] #curveArgs[k] = self.opts[k] #scatterArgs = {} #for k,v in [('symbolPen','pen'), ('symbolBrush','brush'), ('symbol','symbol')]: #if k in kargs: #self.opts[k] = kargs[k] #scatterArgs[v] = self.opts[k] if y is None or len(y) == 0: # empty data is represented as None yData = None else: # actual data is represented by ndarray if not isinstance(y, np.ndarray): y = np.array(y) yData = y.view(np.ndarray) if x is None: x = np.arange(len(y)) if x is None or len(x)==0: # empty data is represented as None xData = None else: # actual data is represented by ndarray if not isinstance(x, np.ndarray): x = np.array(x) xData = x.view(np.ndarray) # one last check to make sure there are no MetaArrays getting by if xData is None or yData is None: self._dataset = None else: self._dataset = PlotDataset( xData, yData ) self._datasetMapped = None # invalidata mapped data , will be generated in getData() / _getDisplayDataset() self._datasetDisplay = None # invalidate display data, will be generated in getData() / _getDisplayDataset() self._adsLastValue = 1 # reset auto-downsample value profiler('set data') self.updateItems( styleUpdate = self.property('styleWasChanged') ) self.setProperty('styleWasChanged', False) # items have been updated profiler('update items') self.informViewBoundsChanged() self.sigPlotChanged.emit(self) profiler('emit') def updateItems(self, styleUpdate=True): # override styleUpdate request and always enforce update until we have a better solution for # - ScatterPlotItem losing per-point style information # - PlotDataItem performing multiple unnecessary setData calls on initialization styleUpdate=True curveArgs = {} scatterArgs = {} if styleUpdate: # repeat style arguments only when changed for k, v in [ ('pen','pen'), ('shadowPen','shadowPen'), ('fillLevel','fillLevel'), ('fillOutline', 'fillOutline'), ('fillBrush', 'brush'), ('antialias', 'antialias'), ('connect', 'connect'), ('stepMode', 'stepMode'), ('skipFiniteCheck', 'skipFiniteCheck') ]: if k in self.opts: curveArgs[v] = self.opts[k] for k, v in [ ('symbolPen','pen'), ('symbolBrush','brush'), ('symbol','symbol'), ('symbolSize', 'size'), ('data', 'data'), ('pxMode', 'pxMode'), ('antialias', 'antialias'), ('useCache', 'useCache') ]: if k in self.opts: scatterArgs[v] = self.opts[k] dataset = self._getDisplayDataset() if dataset is None: # then we have nothing to show self.curve.hide() self.scatter.hide() return x = dataset.x y = dataset.y #scatterArgs['mask'] = self.dataMask if( self.opts['pen'] is not None or (self.opts['fillBrush'] is not None and self.opts['fillLevel'] is not None) ): # draw if visible... # auto-switch to indicate non-finite values as interruptions in the curve: if isinstance(curveArgs['connect'], str) and curveArgs['connect'] == 'auto': # connect can also take a boolean array if dataset.containsNonfinite is False: # all points can be connected, and no further check is needed. curveArgs['connect'] = 'all' curveArgs['skipFiniteCheck'] = True else: # True or None # True: (we checked and found non-finites) # don't connect non-finites # None: (we haven't performed a check for non-finites yet) # use connect='finite' in case there are non-finites. curveArgs['connect'] = 'finite' curveArgs['skipFiniteCheck'] = False self.curve.setData(x=x, y=y, **curveArgs) self.curve.show() else: # ...hide if not. self.curve.hide() if self.opts['symbol'] is not None: # draw if visible... ## check against `True` too for backwards compatibility if self.opts.get('stepMode', False) in ("center", True): x = 0.5 * (x[:-1] + x[1:]) self.scatter.setData(x=x, y=y, **scatterArgs) self.scatter.show() else: # ...hide if not. self.scatter.hide() def getOriginalDataset(self): """ Returns the original, unmapped data as the tuple (`xData`, `yData`). """ dataset = self._dataset if dataset is None: return (None, None) return dataset.x, dataset.y def _getDisplayDataset(self): """ Returns a :class:`~.PlotDataset` object that contains data suitable for display (after mapping and data reduction) as ``dataset.x`` and ``dataset.y``. Intended for internal use. """ if self._dataset is None: return None # Return cached processed dataset if available and still valid: if( self._datasetDisplay is not None and not (self.property('xViewRangeWasChanged') and self.opts['clipToView']) and not (self.property('xViewRangeWasChanged') and self.opts['autoDownsample']) and not (self.property('yViewRangeWasChanged') and self.opts['dynamicRangeLimit'] is not None) ): return self._datasetDisplay # Apply data mapping functions if mapped dataset is not yet available: if self._datasetMapped is None: x = self._dataset.x y = self._dataset.y if y.dtype == bool: y = y.astype(np.uint8) if x.dtype == bool: x = x.astype(np.uint8) if self.opts['fftMode']: x,y = self._fourierTransform(x, y) # Ignore the first bin for fft data if we have a logx scale if self.opts['logMode'][0]: x=x[1:] y=y[1:] if self.opts['derivativeMode']: # plot dV/dt y = np.diff(self._dataset.y)/np.diff(self._dataset.x) x = x[:-1] if self.opts['phasemapMode']: # plot dV/dt vs V x = self._dataset.y[:-1] y = np.diff(self._dataset.y)/np.diff(self._dataset.x) dataset = PlotDataset(x, y, self._dataset.xAllFinite, self._dataset.yAllFinite) if True in self.opts['logMode']: dataset.applyLogMapping( self.opts['logMode'] ) # Apply log scaling for x and/or y axis self._datasetMapped = dataset # apply processing that affects the on-screen display of data: x = self._datasetMapped.x y = self._datasetMapped.y xAllFinite = self._datasetMapped.xAllFinite yAllFinite = self._datasetMapped.yAllFinite view = self.getViewBox() if view is None: view_range = None else: view_range = view.viewRect() # this is always up-to-date if view_range is None: view_range = self.viewRect() ds = self.opts['downsample'] if not isinstance(ds, int): ds = 1 if self.opts['autoDownsample']: # this option presumes that x-values have uniform spacing if xAllFinite: finite_x = x else: # False: (we checked and found non-finites) # None : (we haven't performed a check for non-finites yet) finite_x = x[np.isfinite(x)] # ignore infinite and nan values if view_range is not None and len(finite_x) > 1: dx = float(finite_x[-1]-finite_x[0]) / (len(finite_x)-1) if dx != 0.0: width = self.getViewBox().width() if width != 0.0: # autoDownsampleFactor _should_ be > 1.0 ds_float = max(1.0, abs(view_range.width() / dx / (width * self.opts['autoDownsampleFactor']))) if math.isfinite(ds_float): ds = int(ds_float) ## downsampling is expensive; delay until after clipping. # use the last computed value if our new value is not too different. # this guards against an infinite cycle where the plot never stabilizes. if math.isclose(ds, self._adsLastValue, rel_tol=0.01): ds = self._adsLastValue self._adsLastValue = ds if self.opts['clipToView']: if view is None or view.autoRangeEnabled()[0]: pass # no ViewBox to clip to, or view will autoscale to data range. else: # clip-to-view always presumes that x-values are in increasing order if view_range is not None and len(x) > 1: # find first in-view value (left edge) and first out-of-view value (right edge) # since we want the curve to go to the edge of the screen, we need to preserve # one down-sampled point on the left and one of the right, so we extend the interval x0 = bisect.bisect_left(x, view_range.left()) - ds x0 = fn.clip_scalar(x0, 0, len(x)) # workaround # x0 = np.searchsorted(x, view_range.left()) - ds # x0 = np.clip(x0, 0, len(x)) x1 = bisect.bisect_left(x, view_range.right()) + ds x1 = fn.clip_scalar(x1, x0, len(x)) # x1 = np.searchsorted(x, view_range.right()) + ds # x1 = np.clip(x1, 0, len(x)) x = x[x0:x1] y = y[x0:x1] if ds > 1: if self.opts['downsampleMethod'] == 'subsample': x = x[::ds] y = y[::ds] elif self.opts['downsampleMethod'] == 'mean': n = len(x) // ds stx = ds//2 # start of x-values; try to select a somewhat centered point x = x[stx:stx+n*ds:ds] y = y[:n*ds].reshape(n,ds).mean(axis=1) elif self.opts['downsampleMethod'] == 'peak': n = len(x) // ds x1 = np.empty((n,2)) stx = ds//2 # start of x-values; try to select a somewhat centered point x1[:] = x[stx:stx+n*ds:ds,np.newaxis] x = x1.reshape(n*2) y1 = np.empty((n,2)) y2 = y[:n*ds].reshape((n, ds)) y1[:,0] = y2.max(axis=1) y1[:,1] = y2.min(axis=1) y = y1.reshape(n*2) if self.opts['dynamicRangeLimit'] is not None: if view_range is not None: data_range = self._datasetMapped.dataRect() if data_range is not None: view_height = view_range.height() limit = self.opts['dynamicRangeLimit'] hyst = self.opts['dynamicRangeHyst'] # never clip data if it fits into +/- (extended) limit * view height if ( # note that "bottom" is the larger number, and "top" is the smaller one. view_height > 0 # never clip if the view does not show anything and would cause division by zero and not data_range.bottom() < view_range.top() # never clip if all data is too small to see and not data_range.top() > view_range.bottom() # never clip if all data is too large to see and data_range.height() > 2 * hyst * limit * view_height ): cache_is_good = False # check if cached display data can be reused: if self._datasetDisplay is not None: # top is minimum value, bottom is maximum value # how many multiples of the current view height does the clipped plot extend to the top and bottom? top_exc =-(self._drlLastClip[0]-view_range.bottom()) / view_height bot_exc = (self._drlLastClip[1]-view_range.top() ) / view_height # print(top_exc, bot_exc, hyst) if ( top_exc >= limit / hyst and top_exc <= limit * hyst and bot_exc >= limit / hyst and bot_exc <= limit * hyst ): # restore cached values x = self._datasetDisplay.x y = self._datasetDisplay.y cache_is_good = True if not cache_is_good: min_val = view_range.bottom() - limit * view_height max_val = view_range.top() + limit * view_height # print('alloc:', end='') # workaround for slowdown from numpy deprecation issues in 1.17 to 1.20+ : # y = np.clip(y, a_min=min_val, a_max=max_val) y = fn.clip_array(y, min_val, max_val) self._drlLastClip = (min_val, max_val) self._datasetDisplay = PlotDataset(x, y, xAllFinite, yAllFinite) self.setProperty('xViewRangeWasChanged', False) self.setProperty('yViewRangeWasChanged', False) return self._datasetDisplay def getData(self): """ Returns the displayed data as the tuple (`xData`, `yData`) after mapping and data reduction. """ dataset = self._getDisplayDataset() if dataset is None: return (None, None) return dataset.x, dataset.y # compatbility method for access to dataRect for full dataset: def dataRect(self): """ Returns a bounding rectangle (as :class:`QtCore.QRectF`) for the full set of data. Will return `None` if there is no data or if all values (x or y) are NaN. """ if self._dataset is None: return None return self._dataset.dataRect() def dataBounds(self, ax, frac=1.0, orthoRange=None): """ Returns the range occupied by the data (along a specific axis) in this item. This method is called by :class:`ViewBox` when auto-scaling. =============== ==================================================================== **Arguments:** ax (0 or 1) the axis for which to return this item's data range frac (float 0.0-1.0) Specifies what fraction of the total data range to return. By default, the entire range is returned. This allows the :class:`ViewBox` to ignore large spikes in the data when auto-scaling. orthoRange ([min,max] or None) Specifies that only the data within the given range (orthogonal to *ax*) should me measured when returning the data range. (For example, a ViewBox might ask what is the y-range of all data with x-values between min and max) =============== ==================================================================== """ range = [None, None] if self.curve.isVisible(): range = self.curve.dataBounds(ax, frac, orthoRange) elif self.scatter.isVisible(): r2 = self.scatter.dataBounds(ax, frac, orthoRange) range = [ r2[0] if range[0] is None else (range[0] if r2[0] is None else min(r2[0], range[0])), r2[1] if range[1] is None else (range[1] if r2[1] is None else min(r2[1], range[1])) ] return range def pixelPadding(self): """ Returns the size in pixels that this item may draw beyond the values returned by dataBounds(). This method is called by :class:`ViewBox` when auto-scaling. """ pad = 0 if self.curve.isVisible(): pad = max(pad, self.curve.pixelPadding()) elif self.scatter.isVisible(): pad = max(pad, self.scatter.pixelPadding()) return pad def clear(self): self._dataset = None self._datasetMapped = None self._datasetDisplay = None self.curve.clear() self.scatter.clear() def appendData(self, *args, **kargs): pass def curveClicked(self, curve, ev): self.sigClicked.emit(self, ev) def scatterClicked(self, plt, points, ev): self.sigClicked.emit(self, ev) self.sigPointsClicked.emit(self, points, ev) def scatterHovered(self, plt, points, ev): self.sigPointsHovered.emit(self, points, ev) # def viewTransformChanged(self): # """ view transform (and thus range) has changed, replot if needed """ # viewTransformChanged is only called when the cached viewRect of GraphicsItem # has already been invalidated. However, responding here will make PlotDataItem # update curve and scatter later than intended. # super().viewTransformChanged() # this invalidates the viewRect() cache! def viewRangeChanged(self, vb=None, ranges=None, changed=None): # view range has changed; re-plot if needed update_needed = False if changed is None or changed[0]: # if ranges is not None: # print('hor:', ranges[0]) self.setProperty('xViewRangeWasChanged', True) if( self.opts['clipToView'] or self.opts['autoDownsample'] ): self._datasetDisplay = None update_needed = True if changed is None or changed[1]: # if ranges is not None: # print('ver:', ranges[1]) self.setProperty('yViewRangeWasChanged', True) if self.opts['dynamicRangeLimit'] is not None: # update, but do not discard cached display data update_needed = True if update_needed: self.updateItems(styleUpdate=False) def _fourierTransform(self, x, y): ## Perform Fourier transform. If x values are not sampled uniformly, ## then use np.interp to resample before taking fft. dx = np.diff(x) uniform = not np.any(np.abs(dx-dx[0]) > (abs(dx[0]) / 1000.)) if not uniform: x2 = np.linspace(x[0], x[-1], len(x)) y = np.interp(x2, x, y) x = x2 n = y.size f = np.fft.rfft(y) / n d = float(x[-1]-x[0]) / (len(x)-1) x = np.fft.rfftfreq(n, d) y = np.abs(f) return x, y # helper functions: def dataType(obj): if hasattr(obj, '__len__') and len(obj) == 0: return 'empty' if isinstance(obj, dict): return 'dictOfLists' elif isSequence(obj): first = obj[0] if (hasattr(obj, 'implements') and obj.implements('MetaArray')): return 'MetaArray' elif isinstance(obj, np.ndarray): if obj.ndim == 1: if obj.dtype.names is None: return 'listOfValues' else: return 'recarray' elif obj.ndim == 2 and obj.dtype.names is None and obj.shape[1] == 2: return 'Nx2array' else: raise ValueError('array shape must be (N,) or (N,2); got %s instead' % str(obj.shape)) elif isinstance(first, dict): return 'listOfDicts' else: return 'listOfValues' def isSequence(obj): return hasattr(obj, '__iter__') or isinstance(obj, np.ndarray) or (hasattr(obj, 'implements') and obj.implements('MetaArray')) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/PlotItem/000077500000000000000000000000001457240071200242135ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/PlotItem/PlotItem.py000066400000000000000000001501711457240071200263270ustar00rootroot00000000000000import collections.abc import os import warnings import weakref import numpy as np from ... import functions as fn from ... import icons from ...Qt import QtCore, QtWidgets from ...WidgetGroup import WidgetGroup from ...widgets.FileDialog import FileDialog from ..AxisItem import AxisItem from ..ButtonItem import ButtonItem from ..GraphicsWidget import GraphicsWidget from ..InfiniteLine import InfiniteLine from ..LabelItem import LabelItem from ..LegendItem import LegendItem from ..PlotCurveItem import PlotCurveItem from ..PlotDataItem import PlotDataItem from ..ScatterPlotItem import ScatterPlotItem from ..ViewBox import ViewBox translate = QtCore.QCoreApplication.translate from . import plotConfigTemplate_generic as ui_template __all__ = ['PlotItem'] class PlotItem(GraphicsWidget): """GraphicsWidget implementing a standard 2D plotting area with axes. **Bases:** :class:`GraphicsWidget ` This class provides the ViewBox-plus-axes that appear when using :func:`pg.plot() `, :class:`PlotWidget `, and :func:`GraphicsLayout.addPlot() `. It's main functionality is: - Manage placement of ViewBox, AxisItems, and LabelItems - Create and manage a list of PlotDataItems displayed inside the ViewBox - Implement a context menu with commonly used display and analysis options Use :func:`plot() ` to create a new PlotDataItem and add it to the view. Use :func:`addItem() ` to add any QGraphicsItem to the view. This class wraps several methods from its internal ViewBox: - :func:`setXRange ` - :func:`setYRange ` - :func:`setRange ` - :func:`autoRange ` - :func:`setDefaultPadding ` - :func:`setXLink ` - :func:`setYLink ` - :func:`setAutoPan ` - :func:`setAutoVisible ` - :func:`setLimits ` - :func:`viewRect ` - :func:`viewRange ` - :func:`setMouseEnabled ` - :func:`enableAutoRange ` - :func:`disableAutoRange ` - :func:`setAspectLocked ` - :func:`invertY ` - :func:`invertX ` - :func:`register ` - :func:`unregister ` The ViewBox itself can be accessed by calling :func:`getViewBox() ` ==================== ======================================================================= **Signals:** sigYRangeChanged wrapped from :class:`ViewBox ` sigXRangeChanged wrapped from :class:`ViewBox ` sigRangeChanged wrapped from :class:`ViewBox ` ==================== ======================================================================= """ sigRangeChanged = QtCore.Signal(object, object) ## Emitted when the ViewBox range has changed sigYRangeChanged = QtCore.Signal(object, object) ## Emitted when the ViewBox Y range has changed sigXRangeChanged = QtCore.Signal(object, object) ## Emitted when the ViewBox X range has changed lastFileDir = None def __init__(self, parent=None, name=None, labels=None, title=None, viewBox=None, axisItems=None, enableMenu=True, **kargs): """ Create a new PlotItem. All arguments are optional. Any extra keyword arguments are passed to :func:`PlotItem.plot() `. ============== ========================================================================================== **Arguments:** *title* Title to display at the top of the item. Html is allowed. *labels* A dictionary specifying the axis labels to display:: {'left': (args), 'bottom': (args), ...} The name of each axis and the corresponding arguments are passed to :func:`PlotItem.setLabel() ` Optionally, PlotItem my also be initialized with the keyword arguments left, right, top, or bottom to achieve the same effect. *name* Registers a name for this view so that others may link to it *viewBox* If specified, the PlotItem will be constructed with this as its ViewBox. *axisItems* Optional dictionary instructing the PlotItem to use pre-constructed items for its axes. The dict keys must be axis names ('left', 'bottom', 'right', 'top') and the values must be instances of AxisItem (or at least compatible with AxisItem). ============== ========================================================================================== """ GraphicsWidget.__init__(self, parent) self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) ## Set up control buttons self.autoBtn = ButtonItem(icons.getGraphPixmap('auto'), 14, self) self.autoBtn.mode = 'auto' self.autoBtn.clicked.connect(self.autoBtnClicked) self.buttonsHidden = False ## whether the user has requested buttons to be hidden self.mouseHovering = False self.layout = QtWidgets.QGraphicsGridLayout() self.layout.setContentsMargins(1,1,1,1) self.setLayout(self.layout) self.layout.setHorizontalSpacing(0) self.layout.setVerticalSpacing(0) if viewBox is None: viewBox = ViewBox(parent=self, enableMenu=enableMenu) self.vb = viewBox self.vb.sigStateChanged.connect(self.viewStateChanged) # Enable or disable plotItem menu self.setMenuEnabled(enableMenu, None) if name is not None: self.vb.register(name) self.vb.sigRangeChanged.connect(self.sigRangeChanged) self.vb.sigXRangeChanged.connect(self.sigXRangeChanged) self.vb.sigYRangeChanged.connect(self.sigYRangeChanged) self.layout.addItem(self.vb, 2, 1) self.alpha = 1.0 self.autoAlpha = True self.spectrumMode = False self.legend = None # Initialize axis items self.axes = {} self.setAxisItems(axisItems) self.titleLabel = LabelItem('', size='11pt', parent=self) self.layout.addItem(self.titleLabel, 0, 1) self.setTitle(None) ## hide for i in range(4): self.layout.setRowPreferredHeight(i, 0) self.layout.setRowMinimumHeight(i, 0) self.layout.setRowSpacing(i, 0) self.layout.setRowStretchFactor(i, 1) for i in range(3): self.layout.setColumnPreferredWidth(i, 0) self.layout.setColumnMinimumWidth(i, 0) self.layout.setColumnSpacing(i, 0) self.layout.setColumnStretchFactor(i, 1) self.layout.setRowStretchFactor(2, 100) self.layout.setColumnStretchFactor(1, 100) self.items = [] self.curves = [] self.itemMeta = weakref.WeakKeyDictionary() self.dataItems = [] self.paramList = {} self.avgCurves = {} # Change these properties to adjust the appearance of the averged curve: self.avgPen = fn.mkPen([0, 200, 0]) self.avgShadowPen = fn.mkPen([0, 0, 0], width=4) # the previous default of [0,0,0,100] prevent fast drawing of the wide shadow line ### Set up context menu w = QtWidgets.QWidget() self.ctrl = c = ui_template.Ui_Form() c.setupUi(w) menuItems = [ (translate("PlotItem", 'Transforms'), c.transformGroup), (translate("PlotItem", 'Downsample'), c.decimateGroup), (translate("PlotItem", 'Average'), c.averageGroup), (translate("PlotItem", 'Alpha'), c.alphaGroup), (translate("PlotItem", 'Grid'), c.gridGroup), (translate("PlotItem", 'Points'), c.pointsGroup), ] self.ctrlMenu = QtWidgets.QMenu(translate("PlotItem", 'Plot Options')) for name, grp in menuItems: sm = self.ctrlMenu.addMenu(name) act = QtWidgets.QWidgetAction(self) act.setDefaultWidget(grp) sm.addAction(act) self.stateGroup = WidgetGroup() for name, w in menuItems: self.stateGroup.autoAdd(w) self.fileDialog = None c.alphaGroup.toggled.connect(self.updateAlpha) c.alphaSlider.valueChanged.connect(self.updateAlpha) c.autoAlphaCheck.toggled.connect(self.updateAlpha) c.xGridCheck.toggled.connect(self.updateGrid) c.yGridCheck.toggled.connect(self.updateGrid) c.gridAlphaSlider.valueChanged.connect(self.updateGrid) c.fftCheck.toggled.connect(self.updateSpectrumMode) c.logXCheck.toggled.connect(self.updateLogMode) c.logYCheck.toggled.connect(self.updateLogMode) c.derivativeCheck.toggled.connect(self.updateDerivativeMode) c.phasemapCheck.toggled.connect(self.updatePhasemapMode) c.downsampleSpin.valueChanged.connect(self.updateDownsampling) c.downsampleCheck.toggled.connect(self.updateDownsampling) c.autoDownsampleCheck.toggled.connect(self.updateDownsampling) c.subsampleRadio.toggled.connect(self.updateDownsampling) c.meanRadio.toggled.connect(self.updateDownsampling) c.clipToViewCheck.toggled.connect(self.updateDownsampling) self.ctrl.avgParamList.itemClicked.connect(self.avgParamListClicked) self.ctrl.averageGroup.toggled.connect(self.avgToggled) self.ctrl.maxTracesCheck.toggled.connect(self._handle_max_traces_toggle) self.ctrl.forgetTracesCheck.toggled.connect(self.updateDecimation) self.ctrl.maxTracesSpin.valueChanged.connect(self.updateDecimation) if labels is None: labels = {} for label in list(self.axes.keys()): if label in kargs: labels[label] = kargs[label] del kargs[label] for k in labels: if isinstance(labels[k], str): labels[k] = (labels[k],) self.setLabel(k, *labels[k]) if title is not None: self.setTitle(title) if len(kargs) > 0: self.plot(**kargs) def implements(self, interface=None): return interface in ['ViewBoxWrapper'] def getViewBox(self): """Return the :class:`ViewBox ` contained within.""" return self.vb ## Wrap a few methods from viewBox. #Important: don't use a settattr(m, getattr(self.vb, m)) as we'd be leaving the viebox alive #because we had a reference to an instance method (creating wrapper methods at runtime instead). for m in ['setXRange', 'setYRange', 'setXLink', 'setYLink', 'setAutoPan', # NOTE: 'setAutoVisible', 'setDefaultPadding', 'setRange', 'autoRange', 'viewRect', 'viewRange', # If you update this list, please 'setMouseEnabled', 'setLimits', 'enableAutoRange', 'disableAutoRange', # update the class docstring 'setAspectLocked', 'invertY', 'invertX', 'register', 'unregister']: # as well. def _create_method(name): def method(self, *args, **kwargs): return getattr(self.vb, name)(*args, **kwargs) method.__name__ = name return method locals()[m] = _create_method(m) del _create_method def setAxisItems(self, axisItems=None): """ Place axis items as given by `axisItems`. Initializes non-existing axis items. ============== ========================================================================================== **Arguments:** *axisItems* Optional dictionary instructing the PlotItem to use pre-constructed items for its axes. The dict keys must be axis names ('left', 'bottom', 'right', 'top') and the values must be instances of AxisItem (or at least compatible with AxisItem). ============== ========================================================================================== """ if axisItems is None: axisItems = {} # Array containing visible axis items # Also containing potentially hidden axes, but they are not touched so it does not matter visibleAxes = ['left', 'bottom'] visibleAxes.extend(axisItems.keys()) # Note that it does not matter that this adds # some values to visibleAxes a second time for k, pos in (('top', (1,1)), ('bottom', (3,1)), ('left', (2,0)), ('right', (2,2))): if k in self.axes: if k not in axisItems: continue # Nothing to do here # Remove old axis oldAxis = self.axes[k]['item'] self.layout.removeItem(oldAxis) oldAxis.scene().removeItem(oldAxis) oldAxis.unlinkFromView() # Create new axis if k in axisItems: axis = axisItems[k] if axis.scene() is not None: if k not in self.axes or axis != self.axes[k]["item"]: raise RuntimeError( "Can't add an axis to multiple plots. Shared axes" " can be achieved with multiple AxisItem instances" " and set[X/Y]Link.") else: axis = AxisItem(orientation=k, parent=self) # Set up new axis axis.linkToView(self.vb) self.axes[k] = {'item': axis, 'pos': pos} self.layout.addItem(axis, *pos) # place axis above images at z=0, items that want to draw over the axes should be placed at z>=1: axis.setZValue(0.5) axis.setFlag(axis.GraphicsItemFlag.ItemNegativeZStacksBehindParent) axisVisible = k in visibleAxes self.showAxis(k, axisVisible) def setLogMode(self, x=None, y=None): """ Set log scaling for `x` and/or `y` axes. This informs PlotDataItems to transform logarithmically and switches the axes to use log ticking. Note that *no other items* in the scene will be affected by this; there is (currently) no generic way to redisplay a GraphicsItem with log coordinates. """ if x is not None: self.ctrl.logXCheck.setChecked(x) if y is not None: self.ctrl.logYCheck.setChecked(y) def showGrid(self, x=None, y=None, alpha=None): """ Show or hide the grid for either axis. ============== ===================================== **Arguments:** x (bool) Whether to show the X grid y (bool) Whether to show the Y grid alpha (0.0-1.0) Opacity of the grid ============== ===================================== """ if x is None and y is None and alpha is None: raise Exception("Must specify at least one of x, y, or alpha.") ## prevent people getting confused if they just call showGrid() if x is not None: self.ctrl.xGridCheck.setChecked(x) if y is not None: self.ctrl.yGridCheck.setChecked(y) if alpha is not None: v = fn.clip_scalar(alpha, 0, 1) * self.ctrl.gridAlphaSlider.maximum() # slider range 0 to 255 self.ctrl.gridAlphaSlider.setValue( int(v) ) def close(self): ## Most of this crap is needed to avoid PySide trouble. ## The problem seems to be whenever scene.clear() leads to deletion of widgets (either through proxies or qgraphicswidgets) ## the solution is to manually remove all widgets before scene.clear() is called if self.ctrlMenu is None: ## already shut down return self.ctrlMenu.setParent(None) self.ctrlMenu = None self.autoBtn.setParent(None) self.autoBtn = None for k in self.axes: i = self.axes[k]['item'] i.close() self.axes = None self.scene().removeItem(self.vb) self.vb = None def registerPlot(self, name): ## for backward compatibility self.vb.register(name) def updateGrid(self, *args): alpha = self.ctrl.gridAlphaSlider.value() x = alpha if self.ctrl.xGridCheck.isChecked() else False y = alpha if self.ctrl.yGridCheck.isChecked() else False self.getAxis('top').setGrid(x) self.getAxis('bottom').setGrid(x) self.getAxis('left').setGrid(y) self.getAxis('right').setGrid(y) def viewGeometry(self): """Return the screen geometry of the viewbox""" v = self.scene().views()[0] b = self.vb.mapRectToScene(self.vb.boundingRect()) wr = v.mapFromScene(b).boundingRect() pos = v.mapToGlobal(v.pos()) wr.adjust(pos.x(), pos.y(), pos.x(), pos.y()) return wr def avgToggled(self, b): if b: self.recomputeAverages() for k in self.avgCurves: self.avgCurves[k][1].setVisible(b) def avgParamListClicked(self, item): name = str(item.text()) self.paramList[name] = (item.checkState() == QtCore.Qt.CheckState.Checked) self.recomputeAverages() def recomputeAverages(self): if not self.ctrl.averageGroup.isChecked(): return for k in self.avgCurves: self.removeItem(self.avgCurves[k][1]) self.avgCurves = {} for c in self.curves: self.addAvgCurve(c) self.replot() def addAvgCurve(self, curve): ## Add a single curve into the pool of curves averaged together ## If there are plot parameters, then we need to determine which to average together. remKeys = [] addKeys = [] if self.ctrl.avgParamList.count() > 0: ### First determine the key of the curve to which this new data should be averaged for i in range(self.ctrl.avgParamList.count()): item = self.ctrl.avgParamList.item(i) if item.checkState() == QtCore.Qt.CheckState.Checked: remKeys.append(str(item.text())) else: addKeys.append(str(item.text())) if len(remKeys) < 1: ## In this case, there would be 1 average plot for each data plot; not useful. return p = self.itemMeta.get(curve,{}).copy() for k in p: if type(k) is tuple: p['.'.join(k)] = p[k] del p[k] for rk in remKeys: if rk in p: del p[rk] for ak in addKeys: if ak not in p: p[ak] = None key = tuple(p.items()) ### Create a new curve if needed if key not in self.avgCurves: plot = PlotDataItem() plot.setPen( self.avgPen ) plot.setShadowPen( self.avgShadowPen ) plot.setAlpha(1.0, False) plot.setZValue(100) self.addItem(plot, skipAverage=True) self.avgCurves[key] = [0, plot] self.avgCurves[key][0] += 1 (n, plot) = self.avgCurves[key] ### Average data together (x, y) = curve.getData() stepMode = curve.opts['stepMode'] if plot.yData is not None and y.shape == plot.yData.shape: # note that if shapes do not match, then the average resets. newData = plot.yData * (n-1) / float(n) + y * 1.0 / float(n) plot.setData(plot.xData, newData, stepMode=stepMode) else: plot.setData(x, y, stepMode=stepMode) def autoBtnClicked(self): if self.autoBtn.mode == 'auto': self.enableAutoRange() self.autoBtn.hide() else: self.disableAutoRange() def viewStateChanged(self): self.updateButtons() def addItem(self, item, *args, **kargs): """ Add a graphics item to the view box. If the item has plot data (:class:`PlotDataItem ` , :class:`~pyqtgraph.PlotCurveItem` , :class:`~pyqtgraph.ScatterPlotItem` ), it may be included in analysis performed by the PlotItem. """ if item in self.items: warnings.warn('Item already added to PlotItem, ignoring.') return self.items.append(item) vbargs = {} if 'ignoreBounds' in kargs: vbargs['ignoreBounds'] = kargs['ignoreBounds'] self.vb.addItem(item, *args, **vbargs) name = None if hasattr(item, 'implements') and item.implements('plotData'): name = item.name() self.dataItems.append(item) #self.plotChanged() params = kargs.get('params', {}) self.itemMeta[item] = params #item.setMeta(params) self.curves.append(item) #self.addItem(c) if hasattr(item, 'setLogMode'): item.setLogMode(self.ctrl.logXCheck.isChecked(), self.ctrl.logYCheck.isChecked()) if isinstance(item, PlotDataItem): ## configure curve for this plot (alpha, auto) = self.alphaState() item.setAlpha(alpha, auto) item.setFftMode(self.ctrl.fftCheck.isChecked()) item.setDownsampling(*self.downsampleMode()) item.setClipToView(self.clipToViewMode()) ## Hide older plots if needed self.updateDecimation() ## Add to average if needed self.updateParamList() if self.ctrl.averageGroup.isChecked() and 'skipAverage' not in kargs: self.addAvgCurve(item) #c.connect(c, QtCore.SIGNAL('plotChanged'), self.plotChanged) #item.sigPlotChanged.connect(self.plotChanged) #self.plotChanged() #name = kargs.get('name', getattr(item, 'opts', {}).get('name', None)) if name is not None and hasattr(self, 'legend') and self.legend is not None: self.legend.addItem(item, name=name) def listDataItems(self): """Return a list of all data items (:class:`PlotDataItem `, :class:`~pyqtgraph.PlotCurveItem` , :class:`~pyqtgraph.ScatterPlotItem` , etc) contained in this PlotItem.""" return self.dataItems[:] def addLine(self, x=None, y=None, z=None, **kwds): """ Create an :class:`~pyqtgraph.InfiniteLine` and add to the plot. If `x` is specified, the line will be vertical. If `y` is specified, the line will be horizontal. All extra keyword arguments are passed to :func:`InfiniteLine.__init__() `. Returns the item created. """ kwds['pos'] = kwds.get('pos', x if x is not None else y) kwds['angle'] = kwds.get('angle', 0 if x is None else 90) line = InfiniteLine(**kwds) self.addItem(line) if z is not None: line.setZValue(z) return line def removeItem(self, item): """ Remove an item from the PlotItem's :class:`~pyqtgraph.ViewBox`. """ if not item in self.items: return self.items.remove(item) if item in self.dataItems: self.dataItems.remove(item) self.vb.removeItem(item) if item in self.curves: self.curves.remove(item) self.updateDecimation() self.updateParamList() if self.legend is not None: self.legend.removeItem(item) def clear(self): """ Remove all items from the PlotItem's :class:`~pyqtgraph.ViewBox`. """ for i in self.items[:]: self.removeItem(i) self.avgCurves = {} def clearPlots(self): for i in self.curves[:]: self.removeItem(i) self.avgCurves = {} def plot(self, *args, **kargs): # **Additional arguments:** """ Add and return a new plot. See :func:`PlotDataItem.__init__ ` for data arguments **Additional allowed arguments** ========= ================================================================= `clear` clears all plots before displaying new data `params` sets meta-parameters to associate with this data ========= ================================================================= """ clear = kargs.get('clear', False) params = kargs.get('params', None) if clear: self.clear() item = PlotDataItem(*args, **kargs) if params is None: params = {} self.addItem(item, params=params) return item def addLegend(self, offset=(30, 30), **kwargs): """ Create a new :class:`~pyqtgraph.LegendItem` and anchor it over the internal :class:`~pyqtgraph.ViewBox`. Plots added after this will be automatically displayed in the legend if they are created with a 'name' argument. If a :class:`~pyqtgraph.LegendItem` has already been created using this method, that item will be returned rather than creating a new one. Accepts the same arguments as :func:`~pyqtgraph.LegendItem.__init__`. """ if self.legend is None: self.legend = LegendItem(offset=offset, **kwargs) self.legend.setParentItem(self.vb) return self.legend def addColorBar(self, image, **kargs): """ Adds a color bar linked to the ImageItem specified by `image`. AAdditional parameters will be passed to the `pyqtgraph.ColorBarItem`. A call like `plot.addColorBar(img, colorMap='viridis')` is a convenient method to assign and show a color map. """ from ..ColorBarItem import ColorBarItem # avoid circular import bar = ColorBarItem(**kargs) bar.setImageItem( image, insert_in=self ) return bar def multiDataPlot(self, *, x=None, y=None, constKwargs=None, **kwargs): """ Allow plotting multiple curves on the same plot, changing some kwargs per curve. Parameters ---------- x, y: array_like can be in the following formats: - {x or y} = [n1, n2, n3, ...]: The named argument iterates through ``n`` curves, while the unspecified argument is range(len(n)) for each curve. - x, [y1, y2, y3, ...] - [x1, x2, x3, ...], [y1, y2, y3, ...] - [x1, x2, x3, ...], y where ``x_n`` and ``y_n`` are ``ndarray`` data for each curve. Since ``x`` and ``y`` values are matched using ``zip``, unequal lengths mean the longer array will be truncated. Note that 2D matrices for either x or y are considered lists of curve data. constKwargs: dict, optional A dict of {str: value} passed to each curve during ``plot()``. kwargs: dict, optional A dict of {str: iterable} where the str is the name of a kwarg and the iterable is a list of values, one for each plotted curve. """ if (x is not None and not len(x)) or (y is not None and not len(y)): # Nothing to plot -- either x or y array will bail out early from # zip() below. return [] def scalarOrNone(val): return val is None or (len(val) and np.isscalar(val[0])) if scalarOrNone(x) and scalarOrNone(y): raise ValueError( "If both `x` and `y` represent single curves, use `plot` instead " "of `multiPlot`." ) curves = [] constKwargs = constKwargs or {} xy: 'dict[str, list | None]' = dict(x=x, y=y) for key, oppositeVal in zip(('x', 'y'), [y, x]): oppositeVal: 'Iterable | None' val = xy[key] if val is None: # Other curve has all data, make range that supports longest chain val = range(max(len(curveN) for curveN in oppositeVal)) if np.isscalar(val[0]): # x, [y1, y2, y3, ...] or [x1, x2, x3, ...], y # Repeat the single curve to match length of opposite list val = [val] * len(oppositeVal) xy[key] = val for ii, (xi, yi) in enumerate(zip(xy['x'], xy['y'])): for kk in kwargs: if len(kwargs[kk]) <= ii: raise ValueError( f"Not enough values for kwarg `{kk}`. " f"Expected {ii + 1:d} (number of curves to plot), got" f" {len(kwargs[kk]):d}" ) kwargsi = {kk: kwargs[kk][ii] for kk in kwargs} constKwargs.update(kwargsi) curves.append(self.plot(xi, yi, **constKwargs)) return curves def scatterPlot(self, *args, **kargs): if 'pen' in kargs: kargs['symbolPen'] = kargs['pen'] kargs['pen'] = None if 'brush' in kargs: kargs['symbolBrush'] = kargs['brush'] del kargs['brush'] if 'size' in kargs: kargs['symbolSize'] = kargs['size'] del kargs['size'] return self.plot(*args, **kargs) def replot(self): self.update() def updateParamList(self): self.ctrl.avgParamList.clear() ## Check to see that each parameter for each curve is present in the list for c in self.curves: for p in list(self.itemMeta.get(c, {}).keys()): if type(p) is tuple: p = '.'.join(p) ## If the parameter is not in the list, add it. matches = self.ctrl.avgParamList.findItems(p, QtCore.Qt.MatchFlag.MatchExactly) if len(matches) == 0: i = QtWidgets.QListWidgetItem(p) if p in self.paramList and self.paramList[p] is True: i.setCheckState(QtCore.Qt.CheckState.Checked) else: i.setCheckState(QtCore.Qt.CheckState.Unchecked) self.ctrl.avgParamList.addItem(i) else: i = matches[0] self.paramList[p] = (i.checkState() == QtCore.Qt.CheckState.Checked) def writeSvg(self, fileName=None): if fileName is None: self._chooseFilenameDialog(handler=self.writeSvg) return fileName = str(fileName) PlotItem.lastFileDir = os.path.dirname(fileName) from ...exporters import SVGExporter ex = SVGExporter(self) ex.export(fileName) def writeImage(self, fileName=None): if fileName is None: self._chooseFilenameDialog(handler=self.writeImage) return from ...exporters import ImageExporter ex = ImageExporter(self) ex.export(fileName) def writeCsv(self, fileName=None): if fileName is None: self._chooseFilenameDialog(handler=self.writeCsv) return fileName = str(fileName) PlotItem.lastFileDir = os.path.dirname(fileName) data = [c.getData() for c in self.curves] with open(fileName, 'w') as fd: i = 0 while True: done = True for d in data: if i < len(d[0]): fd.write('%g,%g,' % (d[0][i], d[1][i])) done = False else: fd.write(' , ,') fd.write('\n') if done: break i += 1 def saveState(self): state = self.stateGroup.state() state['paramList'] = self.paramList.copy() state['view'] = self.vb.getState() return state def restoreState(self, state): if 'paramList' in state: self.paramList = state['paramList'].copy() self.stateGroup.setState(state) self.updateSpectrumMode() self.updateDownsampling() self.updateAlpha() self.updateDecimation() if 'powerSpectrumGroup' in state: state['fftCheck'] = state['powerSpectrumGroup'] if 'gridGroup' in state: state['xGridCheck'] = state['gridGroup'] state['yGridCheck'] = state['gridGroup'] self.stateGroup.setState(state) self.updateParamList() if 'view' not in state: r = [[float(state['xMinText']), float(state['xMaxText'])], [float(state['yMinText']), float(state['yMaxText'])]] state['view'] = { 'autoRange': [state['xAutoRadio'], state['yAutoRadio']], 'linkedViews': [state['xLinkCombo'], state['yLinkCombo']], 'targetRange': r, 'viewRange': r, } self.vb.setState(state['view']) def widgetGroupInterface(self): return (None, PlotItem.saveState, PlotItem.restoreState) def updateSpectrumMode(self, b=None): if b is None: b = self.ctrl.fftCheck.isChecked() for c in self.curves: c.setFftMode(b) self.enableAutoRange() self.recomputeAverages() def updateLogMode(self): x = self.ctrl.logXCheck.isChecked() y = self.ctrl.logYCheck.isChecked() for i in self.items: if hasattr(i, 'setLogMode'): i.setLogMode(x,y) self.getAxis('bottom').setLogMode(x, y) self.getAxis('top').setLogMode(x, y) self.getAxis('left').setLogMode(x, y) self.getAxis('right').setLogMode(x, y) self.enableAutoRange() self.recomputeAverages() def updateDerivativeMode(self): d = self.ctrl.derivativeCheck.isChecked() for i in self.items: if hasattr(i, 'setDerivativeMode'): i.setDerivativeMode(d) self.enableAutoRange() self.recomputeAverages() def updatePhasemapMode(self): d = self.ctrl.phasemapCheck.isChecked() for i in self.items: if hasattr(i, 'setPhasemapMode'): i.setPhasemapMode(d) self.enableAutoRange() self.recomputeAverages() def setDownsampling(self, ds=None, auto=None, mode=None): """ Changes the default downsampling mode for all :class:`~pyqtgraph.PlotDataItem` managed by this plot. =============== ==================================================================== **Arguments:** ds (int) Reduce visible plot samples by this factor, or (bool) To enable/disable downsampling without changing the value. auto (bool) If `True`, automatically pick ``ds`` based on visible range mode 'subsample': Downsample by taking the first of N samples. This method is fastest but least accurate. 'mean': Downsample by taking the mean of N samples. 'peak': Downsample by drawing a saw wave that follows the min and max of the original data. This method produces the best visual representation of the data but is slower. =============== ==================================================================== """ if ds is not None: if ds is False: self.ctrl.downsampleCheck.setChecked(False) elif ds is True: self.ctrl.downsampleCheck.setChecked(True) else: self.ctrl.downsampleCheck.setChecked(True) self.ctrl.downsampleSpin.setValue(ds) if auto is not None: if auto and ds is not False: self.ctrl.downsampleCheck.setChecked(True) self.ctrl.autoDownsampleCheck.setChecked(auto) if mode is not None: if mode == 'subsample': self.ctrl.subsampleRadio.setChecked(True) elif mode == 'mean': self.ctrl.meanRadio.setChecked(True) elif mode == 'peak': self.ctrl.peakRadio.setChecked(True) else: raise ValueError("mode argument must be 'subsample', 'mean', or 'peak'.") def updateDownsampling(self): ds, auto, method = self.downsampleMode() clip = self.ctrl.clipToViewCheck.isChecked() for c in self.curves: c.setDownsampling(ds, auto, method) c.setClipToView(clip) self.recomputeAverages() def downsampleMode(self): if self.ctrl.downsampleCheck.isChecked(): ds = self.ctrl.downsampleSpin.value() else: ds = 1 auto = self.ctrl.downsampleCheck.isChecked() and self.ctrl.autoDownsampleCheck.isChecked() if self.ctrl.subsampleRadio.isChecked(): method = 'subsample' elif self.ctrl.meanRadio.isChecked(): method = 'mean' elif self.ctrl.peakRadio.isChecked(): method = 'peak' else: raise ValueError("one of the method radios must be selected for: 'subsample', 'mean', or 'peak'.") return ds, auto, method def setClipToView(self, clip): """Set the default clip-to-view mode for all :class:`~pyqtgraph.PlotDataItem` s managed by this plot. If *clip* is `True`, then PlotDataItems will attempt to draw only points within the visible range of the ViewBox.""" self.ctrl.clipToViewCheck.setChecked(clip) def clipToViewMode(self): return self.ctrl.clipToViewCheck.isChecked() def _handle_max_traces_toggle(self, check_state): if check_state: self.updateDecimation() else: for curve in self.curves: curve.show() def updateDecimation(self): """ Reduce or increase number of visible curves according to value set by the `Max Traces` spinner, if `Max Traces` is checked in the context menu. Destroy curves that are not visible if `forget traces` is checked. In most cases, this function is called automaticaly when the `Max Traces` GUI elements are triggered. It is also alled when the state of PlotItem is updated, its state is restored, or new items added added/removed. This can cause an unexpected or conflicting state of curve visibility (or destruction) if curve visibilities are controlled externally. In the case of external control it is advised to disable the `Max Traces` checkbox (or context menu) to prevent unexpected curve state changes. """ if not self.ctrl.maxTracesCheck.isChecked(): return else: numCurves = self.ctrl.maxTracesSpin.value() if self.ctrl.forgetTracesCheck.isChecked(): for curve in self.curves[:-numCurves]: curve.clear() self.removeItem(curve) for i, curve in enumerate(reversed(self.curves)): if i < numCurves: curve.show() else: curve.hide() def updateAlpha(self, *args): (alpha, auto) = self.alphaState() for c in self.curves: c.setAlpha(alpha**2, auto) def alphaState(self): enabled = self.ctrl.alphaGroup.isChecked() auto = self.ctrl.autoAlphaCheck.isChecked() alpha = float(self.ctrl.alphaSlider.value()) / self.ctrl.alphaSlider.maximum() if auto: alpha = 1.0 ## should be 1/number of overlapping plots if not enabled: auto = False alpha = 1.0 return (alpha, auto) def pointMode(self): if self.ctrl.pointsGroup.isChecked(): if self.ctrl.autoPointsCheck.isChecked(): mode = None else: mode = True else: mode = False return mode def resizeEvent(self, ev): if self.autoBtn is None: ## already closed down return btnRect = self.mapRectFromItem(self.autoBtn, self.autoBtn.boundingRect()) y = self.size().height() - btnRect.height() self.autoBtn.setPos(0, y) def getMenu(self): return self.ctrlMenu def getContextMenus(self, event): ## called when another item is displaying its context menu; we get to add extras to the end of the menu. if self.menuEnabled(): return self.ctrlMenu else: return None def setMenuEnabled(self, enableMenu=True, enableViewBoxMenu='same'): """ Enable or disable the context menu for this PlotItem. By default, the ViewBox's context menu will also be affected. (use ``enableViewBoxMenu=None`` to leave the ViewBox unchanged) """ self._menuEnabled = enableMenu if enableViewBoxMenu is None: return if enableViewBoxMenu == 'same': enableViewBoxMenu = enableMenu self.vb.setMenuEnabled(enableViewBoxMenu) def menuEnabled(self): return self._menuEnabled def setContextMenuActionVisible(self, name : str, visible : bool) -> None: """ Changes the context menu action visibility Parameters ---------- name: str Action name must be one of 'Transforms', 'Downsample', 'Average','Alpha', 'Grid', or 'Points' visible: bool Determines if action will be display True action is visible False action is invisible. """ translated_name = translate("PlotItem", name) for action in self.ctrlMenu.actions(): if action.text() == translated_name: action.setVisible(visible) break def hoverEvent(self, ev): if ev.enter: self.mouseHovering = True if ev.exit: self.mouseHovering = False self.updateButtons() def getLabel(self, key): pass def _checkScaleKey(self, key): if key not in self.axes: raise Exception("Scale '%s' not found. Scales are: %s" % (key, str(list(self.axes.keys())))) def getScale(self, key): return self.getAxis(key) def getAxis(self, name): """Return the specified AxisItem. *name* should be 'left', 'bottom', 'top', or 'right'.""" self._checkScaleKey(name) return self.axes[name]['item'] def setLabel(self, axis, text=None, units=None, unitPrefix=None, **args): """ Sets the label for an axis. Basic HTML formatting is allowed. ============== ================================================================= **Arguments:** axis must be one of 'left', 'bottom', 'right', or 'top' text text to display along the axis. HTML allowed. units units to display after the title. If units are given, then an SI prefix will be automatically appended and the axis values will be scaled accordingly. (ie, use 'V' instead of 'mV'; 'm' will be added automatically) ============== ================================================================= """ self.getAxis(axis).setLabel(text=text, units=units, **args) self.showAxis(axis) def setLabels(self, **kwds): """ Convenience function allowing multiple labels and/or title to be set in one call. Keyword arguments can be 'title', 'left', 'bottom', 'right', or 'top'. Values may be strings or a tuple of arguments to pass to :func:`setLabel`. """ for k,v in kwds.items(): if k == 'title': self.setTitle(v) else: if isinstance(v, str): v = (v,) self.setLabel(k, *v) def showLabel(self, axis, show=True): """ Show or hide one of the plot's axis labels (the axis itself will be unaffected). axis must be one of 'left', 'bottom', 'right', or 'top' """ self.getScale(axis).showLabel(show) def setTitle(self, title=None, **args): """ Set the title of the plot. Basic HTML formatting is allowed. If title is None, then the title will be hidden. """ if title is None: self.titleLabel.setVisible(False) self.layout.setRowFixedHeight(0, 0) self.titleLabel.setMaximumHeight(0) else: self.titleLabel.setMaximumHeight(30) self.layout.setRowFixedHeight(0, 30) self.titleLabel.setVisible(True) self.titleLabel.setText(title, **args) def showAxis(self, axis, show=True): """ Show or hide one of the plot's axes. axis must be one of 'left', 'bottom', 'right', or 'top' """ s = self.getScale(axis) if show: s.show() else: s.hide() def hideAxis(self, axis): """Hide one of the PlotItem's axes. ('left', 'bottom', 'right', or 'top')""" self.showAxis(axis, False) def showAxes(self, selection, showValues=True, size=False): """ Convenience method for quickly configuring axis settings. Parameters ---------- selection: bool or tuple of bool Determines which AxisItems will be displayed. If in tuple form, order is (left, top, right, bottom) A single boolean value will set all axes, so that ``showAxes(True)`` configures the axes to draw a frame. showValues: bool or tuple of bool, optional Determines if values will be displayed for the ticks of each axis. True value shows values for left and bottom axis (default). False shows no values. If in tuple form, order is (left, top, right, bottom) None leaves settings unchanged. If not specified, left and bottom axes will be drawn with values. size: float or tuple of float, optional Reserves as fixed amount of space (width for vertical axis, height for horizontal axis) for each axis where tick values are enabled. If only a single float value is given, it will be applied for both width and height. If `None` is given instead of a float value, the axis reverts to automatic allocation of space. If in tuple form, order is (width, height) """ if selection is True: # shortcut: enable all axes, creating a frame selection = (True, True, True, True) elif selection is False: # shortcut: disable all axes selection = (False, False, False, False) if showValues is True: # shortcut: defaults arrangement with labels at left and bottom showValues = (True, False, False, True) elif showValues is False: # shortcut: disable all labels showValues = (False, False, False, False) elif showValues is None: # leave labelling untouched showValues = (None, None, None, None) if size is not False and not isinstance(size, collections.abc.Sized): size = (size, size) # make sure that size is either False or a full set of (width, height) all_axes = ('left','top','right','bottom') for show_axis, show_value, axis_key in zip(selection, showValues, all_axes): if show_axis is None: pass # leave axis display as it is. else: if show_axis: self.showAxis(axis_key) else : self.hideAxis(axis_key) if show_value is None: pass # leave value display as it is. else: ax = self.getAxis(axis_key) ax.setStyle(showValues=show_value) if size is not False: # size adjustment is requested if axis_key in ('left','right'): if show_value: ax.setWidth(size[0]) else : ax.setWidth( None ) elif axis_key in ('top', 'bottom'): if show_value: ax.setHeight(size[1]) else : ax.setHeight( None ) def hideButtons(self): """Causes auto-scale button ('A' in lower-left corner) to be hidden for this PlotItem""" #self.ctrlBtn.hide() self.buttonsHidden = True self.updateButtons() def showButtons(self): """Causes auto-scale button ('A' in lower-left corner) to be visible for this PlotItem""" #self.ctrlBtn.hide() self.buttonsHidden = False self.updateButtons() def updateButtons(self): try: if self._exportOpts is False and self.mouseHovering and not self.buttonsHidden and not all(self.vb.autoRangeEnabled()): self.autoBtn.show() else: self.autoBtn.hide() except RuntimeError: pass # this can happen if the plot has been deleted. def _plotArray(self, arr, x=None, **kargs): if arr.ndim != 1: raise Exception("Array must be 1D to plot (shape is %s)" % arr.shape) if x is None: x = np.arange(arr.shape[0]) if x.ndim != 1: raise Exception("X array must be 1D to plot (shape is %s)" % x.shape) c = PlotCurveItem(arr, x=x, **kargs) return c def _plotMetaArray(self, arr, x=None, autoLabel=True, **kargs): if arr.ndim != 1: raise Exception('can only automatically plot 1 dimensional arrays.') ## create curve try: xv = arr.xvals(0) except: if x is None: xv = np.arange(arr.shape[0]) else: xv = x c = PlotCurveItem(**kargs) c.setData(x=xv, y=arr.view(np.ndarray)) if autoLabel: name = arr._info[0].get('name', None) units = arr._info[0].get('units', None) self.setLabel('bottom', text=name, units=units) name = arr._info[1].get('name', None) units = arr._info[1].get('units', None) self.setLabel('left', text=name, units=units) return c def setExportMode(self, export, opts=None): GraphicsWidget.setExportMode(self, export, opts) self.updateButtons() def _chooseFilenameDialog(self, handler): self.fileDialog = FileDialog() if PlotItem.lastFileDir is not None: self.fileDialog.setDirectory(PlotItem.lastFileDir) self.fileDialog.setFileMode(QtWidgets.QFileDialog.FileMode.AnyFile) self.fileDialog.setAcceptMode(QtWidgets.QFileDialog.AcceptMode.AcceptSave) self.fileDialog.show() self.fileDialog.fileSelected.connect(handler) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/PlotItem/__init__.py000066400000000000000000000000671457240071200263270ustar00rootroot00000000000000from .PlotItem import PlotItem __all__ = ['PlotItem'] pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/PlotItem/plotConfigTemplate.ui000066400000000000000000000240031457240071200303510ustar00rootroot00000000000000 Form 0 0 481 840 PyQtGraph 0 640 242 182 Display averages of the curves displayed in this plot. The parameter list allows you to choose parameters to average over (if any are available). Average true false 0 0 10 140 191 171 0 0 Plot only the portion of each curve that is visible. This assumes X values are uniformly spaced. Clip to View If multiple curves are displayed in this plot, check this box to limit the number of traces that are displayed. Max Traces: Downsample Downsample by drawing a saw wave that follows the min and max of the original data. This method produces the best visual representation of the data but is slower. Peak true If multiple curves are displayed in this plot, check "Max Traces" and set this value to limit the number of traces that are displayed. If MaxTraces is checked, remove curves from memory after they are hidden (saves memory, but traces can not be un-hidden). Forget hidden traces Downsample by taking the mean of N samples. Mean Downsample by taking the first of N samples. This method is fastest and least accurate. Subsample Automatically downsample data based on the visible range. This assumes X values are uniformly spaced. Auto true Qt::Horizontal QSizePolicy::Maximum 30 20 Downsample data before plotting. (plot every Nth sample) x 1 100000 1 10 10 171 101 0 0 Log Y Log X Power Spectrum (FFT) dy/dx Y vs. Y' 10 550 234 58 Points true Auto true 10 460 221 81 Show X Grid Show Y Grid 255 128 Qt::Horizontal Opacity 10 390 234 60 Alpha true Auto false 1000 1000 Qt::Horizontal pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/PlotItem/plotConfigTemplate_generic.py000066400000000000000000000261541457240071200320710ustar00rootroot00000000000000# Form implementation generated from reading ui file '../pyqtgraph/graphicsItems/PlotItem/plotConfigTemplate.ui' # # Created by: PyQt6 UI code generator 6.1.0 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. from ...Qt import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(481, 840) self.averageGroup = QtWidgets.QGroupBox(Form) self.averageGroup.setGeometry(QtCore.QRect(0, 640, 242, 182)) self.averageGroup.setCheckable(True) self.averageGroup.setChecked(False) self.averageGroup.setObjectName("averageGroup") self.gridLayout_5 = QtWidgets.QGridLayout(self.averageGroup) self.gridLayout_5.setContentsMargins(0, 0, 0, 0) self.gridLayout_5.setSpacing(0) self.gridLayout_5.setObjectName("gridLayout_5") self.avgParamList = QtWidgets.QListWidget(self.averageGroup) self.avgParamList.setObjectName("avgParamList") self.gridLayout_5.addWidget(self.avgParamList, 0, 0, 1, 1) self.decimateGroup = QtWidgets.QFrame(Form) self.decimateGroup.setGeometry(QtCore.QRect(10, 140, 191, 171)) self.decimateGroup.setObjectName("decimateGroup") self.gridLayout_4 = QtWidgets.QGridLayout(self.decimateGroup) self.gridLayout_4.setContentsMargins(0, 0, 0, 0) self.gridLayout_4.setSpacing(0) self.gridLayout_4.setObjectName("gridLayout_4") self.clipToViewCheck = QtWidgets.QCheckBox(self.decimateGroup) self.clipToViewCheck.setObjectName("clipToViewCheck") self.gridLayout_4.addWidget(self.clipToViewCheck, 7, 0, 1, 3) self.maxTracesCheck = QtWidgets.QCheckBox(self.decimateGroup) self.maxTracesCheck.setObjectName("maxTracesCheck") self.gridLayout_4.addWidget(self.maxTracesCheck, 8, 0, 1, 2) self.downsampleCheck = QtWidgets.QCheckBox(self.decimateGroup) self.downsampleCheck.setObjectName("downsampleCheck") self.gridLayout_4.addWidget(self.downsampleCheck, 0, 0, 1, 3) self.peakRadio = QtWidgets.QRadioButton(self.decimateGroup) self.peakRadio.setChecked(True) self.peakRadio.setObjectName("peakRadio") self.gridLayout_4.addWidget(self.peakRadio, 6, 1, 1, 2) self.maxTracesSpin = QtWidgets.QSpinBox(self.decimateGroup) self.maxTracesSpin.setObjectName("maxTracesSpin") self.gridLayout_4.addWidget(self.maxTracesSpin, 8, 2, 1, 1) self.forgetTracesCheck = QtWidgets.QCheckBox(self.decimateGroup) self.forgetTracesCheck.setObjectName("forgetTracesCheck") self.gridLayout_4.addWidget(self.forgetTracesCheck, 9, 0, 1, 3) self.meanRadio = QtWidgets.QRadioButton(self.decimateGroup) self.meanRadio.setObjectName("meanRadio") self.gridLayout_4.addWidget(self.meanRadio, 3, 1, 1, 2) self.subsampleRadio = QtWidgets.QRadioButton(self.decimateGroup) self.subsampleRadio.setObjectName("subsampleRadio") self.gridLayout_4.addWidget(self.subsampleRadio, 2, 1, 1, 2) self.autoDownsampleCheck = QtWidgets.QCheckBox(self.decimateGroup) self.autoDownsampleCheck.setChecked(True) self.autoDownsampleCheck.setObjectName("autoDownsampleCheck") self.gridLayout_4.addWidget(self.autoDownsampleCheck, 1, 2, 1, 1) spacerItem = QtWidgets.QSpacerItem(30, 20, QtWidgets.QSizePolicy.Policy.Maximum, QtWidgets.QSizePolicy.Policy.Minimum) self.gridLayout_4.addItem(spacerItem, 2, 0, 1, 1) self.downsampleSpin = QtWidgets.QSpinBox(self.decimateGroup) self.downsampleSpin.setMinimum(1) self.downsampleSpin.setMaximum(100000) self.downsampleSpin.setProperty("value", 1) self.downsampleSpin.setObjectName("downsampleSpin") self.gridLayout_4.addWidget(self.downsampleSpin, 1, 1, 1, 1) self.transformGroup = QtWidgets.QFrame(Form) self.transformGroup.setGeometry(QtCore.QRect(10, 10, 171, 101)) self.transformGroup.setObjectName("transformGroup") self.gridLayout = QtWidgets.QGridLayout(self.transformGroup) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.logYCheck = QtWidgets.QCheckBox(self.transformGroup) self.logYCheck.setObjectName("logYCheck") self.gridLayout.addWidget(self.logYCheck, 2, 0, 1, 1) self.logXCheck = QtWidgets.QCheckBox(self.transformGroup) self.logXCheck.setObjectName("logXCheck") self.gridLayout.addWidget(self.logXCheck, 1, 0, 1, 1) self.fftCheck = QtWidgets.QCheckBox(self.transformGroup) self.fftCheck.setObjectName("fftCheck") self.gridLayout.addWidget(self.fftCheck, 0, 0, 1, 1) self.derivativeCheck = QtWidgets.QCheckBox(self.transformGroup) self.derivativeCheck.setObjectName("derivativeCheck") self.gridLayout.addWidget(self.derivativeCheck, 3, 0, 1, 1) self.phasemapCheck = QtWidgets.QCheckBox(self.transformGroup) self.phasemapCheck.setObjectName("phasemapCheck") self.gridLayout.addWidget(self.phasemapCheck, 4, 0, 1, 1) self.pointsGroup = QtWidgets.QGroupBox(Form) self.pointsGroup.setGeometry(QtCore.QRect(10, 550, 234, 58)) self.pointsGroup.setCheckable(True) self.pointsGroup.setObjectName("pointsGroup") self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.pointsGroup) self.verticalLayout_5.setObjectName("verticalLayout_5") self.autoPointsCheck = QtWidgets.QCheckBox(self.pointsGroup) self.autoPointsCheck.setChecked(True) self.autoPointsCheck.setObjectName("autoPointsCheck") self.verticalLayout_5.addWidget(self.autoPointsCheck) self.gridGroup = QtWidgets.QFrame(Form) self.gridGroup.setGeometry(QtCore.QRect(10, 460, 221, 81)) self.gridGroup.setObjectName("gridGroup") self.gridLayout_2 = QtWidgets.QGridLayout(self.gridGroup) self.gridLayout_2.setObjectName("gridLayout_2") self.xGridCheck = QtWidgets.QCheckBox(self.gridGroup) self.xGridCheck.setObjectName("xGridCheck") self.gridLayout_2.addWidget(self.xGridCheck, 0, 0, 1, 2) self.yGridCheck = QtWidgets.QCheckBox(self.gridGroup) self.yGridCheck.setObjectName("yGridCheck") self.gridLayout_2.addWidget(self.yGridCheck, 1, 0, 1, 2) self.gridAlphaSlider = QtWidgets.QSlider(self.gridGroup) self.gridAlphaSlider.setMaximum(255) self.gridAlphaSlider.setProperty("value", 128) self.gridAlphaSlider.setOrientation(QtCore.Qt.Orientation.Horizontal) self.gridAlphaSlider.setObjectName("gridAlphaSlider") self.gridLayout_2.addWidget(self.gridAlphaSlider, 2, 1, 1, 1) self.label = QtWidgets.QLabel(self.gridGroup) self.label.setObjectName("label") self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1) self.alphaGroup = QtWidgets.QGroupBox(Form) self.alphaGroup.setGeometry(QtCore.QRect(10, 390, 234, 60)) self.alphaGroup.setCheckable(True) self.alphaGroup.setObjectName("alphaGroup") self.horizontalLayout = QtWidgets.QHBoxLayout(self.alphaGroup) self.horizontalLayout.setObjectName("horizontalLayout") self.autoAlphaCheck = QtWidgets.QCheckBox(self.alphaGroup) self.autoAlphaCheck.setChecked(False) self.autoAlphaCheck.setObjectName("autoAlphaCheck") self.horizontalLayout.addWidget(self.autoAlphaCheck) self.alphaSlider = QtWidgets.QSlider(self.alphaGroup) self.alphaSlider.setMaximum(1000) self.alphaSlider.setProperty("value", 1000) self.alphaSlider.setOrientation(QtCore.Qt.Orientation.Horizontal) self.alphaSlider.setObjectName("alphaSlider") self.horizontalLayout.addWidget(self.alphaSlider) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "PyQtGraph")) self.averageGroup.setToolTip(_translate("Form", "Display averages of the curves displayed in this plot. The parameter list allows you to choose parameters to average over (if any are available).")) self.averageGroup.setTitle(_translate("Form", "Average")) self.clipToViewCheck.setToolTip(_translate("Form", "Plot only the portion of each curve that is visible. This assumes X values are uniformly spaced.")) self.clipToViewCheck.setText(_translate("Form", "Clip to View")) self.maxTracesCheck.setToolTip(_translate("Form", "If multiple curves are displayed in this plot, check this box to limit the number of traces that are displayed.")) self.maxTracesCheck.setText(_translate("Form", "Max Traces:")) self.downsampleCheck.setText(_translate("Form", "Downsample")) self.peakRadio.setToolTip(_translate("Form", "Downsample by drawing a saw wave that follows the min and max of the original data. This method produces the best visual representation of the data but is slower.")) self.peakRadio.setText(_translate("Form", "Peak")) self.maxTracesSpin.setToolTip(_translate("Form", "If multiple curves are displayed in this plot, check \"Max Traces\" and set this value to limit the number of traces that are displayed.")) self.forgetTracesCheck.setToolTip(_translate("Form", "If MaxTraces is checked, remove curves from memory after they are hidden (saves memory, but traces can not be un-hidden).")) self.forgetTracesCheck.setText(_translate("Form", "Forget hidden traces")) self.meanRadio.setToolTip(_translate("Form", "Downsample by taking the mean of N samples.")) self.meanRadio.setText(_translate("Form", "Mean")) self.subsampleRadio.setToolTip(_translate("Form", "Downsample by taking the first of N samples. This method is fastest and least accurate.")) self.subsampleRadio.setText(_translate("Form", "Subsample")) self.autoDownsampleCheck.setToolTip(_translate("Form", "Automatically downsample data based on the visible range. This assumes X values are uniformly spaced.")) self.autoDownsampleCheck.setText(_translate("Form", "Auto")) self.downsampleSpin.setToolTip(_translate("Form", "Downsample data before plotting. (plot every Nth sample)")) self.downsampleSpin.setSuffix(_translate("Form", "x")) self.logYCheck.setText(_translate("Form", "Log Y")) self.logXCheck.setText(_translate("Form", "Log X")) self.fftCheck.setText(_translate("Form", "Power Spectrum (FFT)")) self.derivativeCheck.setText(_translate("Form", "dy/dx")) self.phasemapCheck.setText(_translate("Form", "Y vs. Y\'")) self.pointsGroup.setTitle(_translate("Form", "Points")) self.autoPointsCheck.setText(_translate("Form", "Auto")) self.xGridCheck.setText(_translate("Form", "Show X Grid")) self.yGridCheck.setText(_translate("Form", "Show Y Grid")) self.label.setText(_translate("Form", "Opacity")) self.alphaGroup.setTitle(_translate("Form", "Alpha")) self.autoAlphaCheck.setText(_translate("Form", "Auto")) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ROI.py000066400000000000000000002765551457240071200235050ustar00rootroot00000000000000""" ROI.py - Interactive graphics items for GraphicsView (ROI widgets) Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. Implements a series of graphics items which display movable/scalable/rotatable shapes for use as region-of-interest markers. ROI class automatically handles extraction of array data from ImageItems. The ROI class is meant to serve as the base for more specific types; see several examples of how to build an ROI at the bottom of the file. """ import sys from math import atan2, cos, degrees, hypot, sin import numpy as np from .. import functions as fn #from numpy.linalg import norm from ..Point import Point from ..Qt import QtCore, QtGui, QtWidgets from ..SRTTransform import SRTTransform from .GraphicsObject import GraphicsObject from .UIGraphicsItem import UIGraphicsItem translate = QtCore.QCoreApplication.translate __all__ = [ 'ROI', 'TestROI', 'RectROI', 'EllipseROI', 'CircleROI', 'LineROI', 'MultiLineROI', 'MultiRectROI', 'LineSegmentROI', 'PolyLineROI', 'CrosshairROI','TriangleROI' ] def rectStr(r): return "[%f, %f] + [%f, %f]" % (r.x(), r.y(), r.width(), r.height()) class ROI(GraphicsObject): """ Generic region-of-interest widget. Can be used for implementing many types of selection box with rotate/translate/scale handles. ROIs can be customized to have a variety of shapes (by subclassing or using any of the built-in subclasses) and any combination of draggable handles that allow the user to manipulate the ROI. Default mouse interaction: * Left drag moves the ROI * Left drag + Ctrl moves the ROI with position snapping * Left drag + Alt rotates the ROI * Left drag + Alt + Ctrl rotates the ROI with angle snapping * Left drag + Shift scales the ROI * Left drag + Shift + Ctrl scales the ROI with size snapping In addition to the above interaction modes, it is possible to attach any number of handles to the ROI that can be dragged to change the ROI in various ways (see the ROI.add____Handle methods). ================ =========================================================== **Arguments** pos (length-2 sequence) Indicates the position of the ROI's origin. For most ROIs, this is the lower-left corner of its bounding rectangle. size (length-2 sequence) Indicates the width and height of the ROI. angle (float) The rotation of the ROI in degrees. Default is 0. invertible (bool) If True, the user may resize the ROI to have negative width or height (assuming the ROI has scale handles). Default is False. maxBounds (QRect, QRectF, or None) Specifies boundaries that the ROI cannot be dragged outside of by the user. Default is None. snapSize (float) The spacing of snap positions used when *scaleSnap* or *translateSnap* are enabled. Default is 1.0. scaleSnap (bool) If True, the width and height of the ROI are forced to be integer multiples of *snapSize* when being resized by the user. Default is False. translateSnap (bool) If True, the x and y positions of the ROI are forced to be integer multiples of *snapSize* when being resized by the user. Default is False. rotateSnap (bool) If True, the ROI angle is forced to a multiple of the ROI's snap angle (default is 15 degrees) when rotated by the user. Default is False. parent (QGraphicsItem) The graphics item parent of this ROI. It is generally not necessary to specify the parent. pen (QPen or argument to pg.mkPen) The pen to use when drawing the shape of the ROI. hoverPen (QPen or argument to mkPen) The pen to use while the mouse is hovering over the ROI shape. handlePen (QPen or argument to mkPen) The pen to use when drawing the ROI handles. handleHoverPen (QPen or argument to mkPen) The pen to use while the mouse is hovering over an ROI handle. movable (bool) If True, the ROI can be moved by dragging anywhere inside the ROI. Default is True. rotatable (bool) If True, the ROI can be rotated by mouse drag + ALT resizable (bool) If True, the ROI can be resized by mouse drag + SHIFT removable (bool) If True, the ROI will be given a context menu with an option to remove the ROI. The ROI emits sigRemoveRequested when this menu action is selected. Default is False. ================ =========================================================== ======================= ==================================================== **Signals** sigRegionChangeFinished Emitted when the user stops dragging the ROI (or one of its handles) or if the ROI is changed programatically. sigRegionChangeStarted Emitted when the user starts dragging the ROI (or one of its handles). sigRegionChanged Emitted any time the position of the ROI changes, including while it is being dragged by the user. sigHoverEvent Emitted when the mouse hovers over the ROI. sigClicked Emitted when the user clicks on the ROI. Note that clicking is disabled by default to prevent stealing clicks from objects behind the ROI. To enable clicking, call roi.setAcceptedMouseButtons(QtCore.Qt.MouseButton.LeftButton). See QtWidgets.QGraphicsItem documentation for more details. sigRemoveRequested Emitted when the user selects 'remove' from the ROI's context menu (if available). ======================= ==================================================== """ sigRegionChangeFinished = QtCore.Signal(object) sigRegionChangeStarted = QtCore.Signal(object) sigRegionChanged = QtCore.Signal(object) sigHoverEvent = QtCore.Signal(object) sigClicked = QtCore.Signal(object, object) sigRemoveRequested = QtCore.Signal(object) def __init__(self, pos, size=Point(1, 1), angle=0.0, invertible=False, maxBounds=None, snapSize=1.0, scaleSnap=False, translateSnap=False, rotateSnap=False, parent=None, pen=None, hoverPen=None, handlePen=None, handleHoverPen=None, movable=True, rotatable=True, resizable=True, removable=False, aspectLocked=False): GraphicsObject.__init__(self, parent) self.setAcceptedMouseButtons(QtCore.Qt.MouseButton.NoButton) pos = Point(pos) size = Point(size) self.aspectLocked = aspectLocked self.translatable = movable self.rotatable = rotatable self.resizable = resizable self.removable = removable self.menu = None self.freeHandleMoved = False ## keep track of whether free handles have moved since last change signal was emitted. self.mouseHovering = False if pen is None: pen = (255, 255, 255) self.setPen(pen) if hoverPen is None: hoverPen = (255, 255, 0) self.hoverPen = fn.mkPen(hoverPen) if handlePen is None: handlePen = (150, 255, 255) self.handlePen = fn.mkPen(handlePen) if handleHoverPen is None: handleHoverPen = (255, 255, 0) self.handleHoverPen = handleHoverPen self.handles = [] self.state = {'pos': Point(0,0), 'size': Point(1,1), 'angle': 0} ## angle is in degrees for ease of Qt integration self.lastState = None self.setPos(pos) self.setAngle(angle) self.setSize(size) self.setZValue(10) self.isMoving = False self.handleSize = 5 self.invertible = invertible self.maxBounds = maxBounds self.snapSize = snapSize self.translateSnap = translateSnap self.rotateSnap = rotateSnap self.rotateSnapAngle = 15.0 self.scaleSnap = scaleSnap self.scaleSnapSize = snapSize # Implement mouse handling in a separate class to allow easier customization self.mouseDragHandler = MouseDragHandler(self) def getState(self): return self.stateCopy() def stateCopy(self): sc = {} sc['pos'] = Point(self.state['pos']) sc['size'] = Point(self.state['size']) sc['angle'] = self.state['angle'] return sc def saveState(self): """Return the state of the widget in a format suitable for storing to disk. (Points are converted to tuple) Combined with setState(), this allows ROIs to be easily saved and restored.""" state = {} state['pos'] = tuple(self.state['pos']) state['size'] = tuple(self.state['size']) state['angle'] = self.state['angle'] return state def setState(self, state, update=True): """ Set the state of the ROI from a structure generated by saveState() or getState(). """ self.setPos(state['pos'], update=False) self.setSize(state['size'], update=False) self.setAngle(state['angle'], update=update) def setZValue(self, z): QtWidgets.QGraphicsItem.setZValue(self, z) for h in self.handles: h['item'].setZValue(z+1) def parentBounds(self): """ Return the bounding rectangle of this ROI in the coordinate system of its parent. """ return self.mapToParent(self.boundingRect()).boundingRect() def setPen(self, *args, **kwargs): """ Set the pen to use when drawing the ROI shape. For arguments, see :func:`mkPen `. """ self.pen = fn.mkPen(*args, **kwargs) self.currentPen = self.pen self.update() def size(self): """Return the size (w,h) of the ROI.""" return self.getState()['size'] def pos(self): """Return the position (x,y) of the ROI's origin. For most ROIs, this will be the lower-left corner.""" return self.getState()['pos'] def angle(self): """Return the angle of the ROI in degrees.""" return self.getState()['angle'] def setPos(self, pos, y=None, update=True, finish=True): """Set the position of the ROI (in the parent's coordinate system). Accepts either separate (x, y) arguments or a single :class:`Point` or ``QPointF`` argument. By default, this method causes both ``sigRegionChanged`` and ``sigRegionChangeFinished`` to be emitted. If *finish* is False, then ``sigRegionChangeFinished`` will not be emitted. You can then use stateChangeFinished() to cause the signal to be emitted after a series of state changes. If *update* is False, the state change will be remembered but not processed and no signals will be emitted. You can then use stateChanged() to complete the state change. This allows multiple change functions to be called sequentially while minimizing processing overhead and repeated signals. Setting ``update=False`` also forces ``finish=False``. """ if update not in (True, False): raise TypeError("update argument must be bool") if y is None: pos = Point(pos) else: # avoid ambiguity where update is provided as a positional argument if isinstance(y, bool): raise TypeError("Positional arguments to setPos() must be numerical.") pos = Point(pos, y) self.state['pos'] = pos QtWidgets.QGraphicsItem.setPos(self, pos) if update: self.stateChanged(finish=finish) def setSize(self, size, center=None, centerLocal=None, snap=False, update=True, finish=True): """ Set the ROI's size. =============== ========================================================================== **Arguments** size (Point | QPointF | sequence) The final size of the ROI center (None | Point) Optional center point around which the ROI is scaled, expressed as [0-1, 0-1] over the size of the ROI. centerLocal (None | Point) Same as *center*, but the position is expressed in the local coordinate system of the ROI snap (bool) If True, the final size is snapped to the nearest increment (see ROI.scaleSnapSize) update (bool) See setPos() finish (bool) See setPos() =============== ========================================================================== """ if update not in (True, False): raise TypeError("update argument must be bool") size = Point(size) if snap: size[0] = round(size[0] / self.scaleSnapSize) * self.scaleSnapSize size[1] = round(size[1] / self.scaleSnapSize) * self.scaleSnapSize if centerLocal is not None: oldSize = Point(self.state['size']) oldSize[0] = 1 if oldSize[0] == 0 else oldSize[0] oldSize[1] = 1 if oldSize[1] == 0 else oldSize[1] center = Point(centerLocal) / oldSize if center is not None: center = Point(center) c = self.mapToParent(Point(center) * self.state['size']) c1 = self.mapToParent(Point(center) * size) newPos = self.state['pos'] + c - c1 self.setPos(newPos, update=False, finish=False) self.prepareGeometryChange() self.state['size'] = size if update: self.stateChanged(finish=finish) def setAngle(self, angle, center=None, centerLocal=None, snap=False, update=True, finish=True): """ Set the ROI's rotation angle. =============== ========================================================================== **Arguments** angle (float) The final ROI angle in degrees center (None | Point) Optional center point around which the ROI is rotated, expressed as [0-1, 0-1] over the size of the ROI. centerLocal (None | Point) Same as *center*, but the position is expressed in the local coordinate system of the ROI snap (bool) If True, the final ROI angle is snapped to the nearest increment (default is 15 degrees; see ROI.rotateSnapAngle) update (bool) See setPos() finish (bool) See setPos() =============== ========================================================================== """ if update not in (True, False): raise TypeError("update argument must be bool") if snap is True: angle = round(angle / self.rotateSnapAngle) * self.rotateSnapAngle self.state['angle'] = angle tr = QtGui.QTransform() # note: only rotation is contained in the transform tr.rotate(angle) if center is not None: centerLocal = Point(center) * self.state['size'] if centerLocal is not None: centerLocal = Point(centerLocal) # rotate to new angle, keeping a specific point anchored as the center of rotation cc = self.mapToParent(centerLocal) - (tr.map(centerLocal) + self.state['pos']) self.translate(cc, update=False) self.setTransform(tr) if update: self.stateChanged(finish=finish) def scale(self, s, center=None, centerLocal=None, snap=False, update=True, finish=True): """ Resize the ROI by scaling relative to *center*. See setPos() for an explanation of the *update* and *finish* arguments. """ newSize = self.state['size'] * s self.setSize(newSize, center=center, centerLocal=centerLocal, snap=snap, update=update, finish=finish) def translate(self, *args, **kargs): """ Move the ROI to a new position. Accepts either (x, y, snap) or ([x,y], snap) as arguments If the ROI is bounded and the move would exceed boundaries, then the ROI is moved to the nearest acceptable position instead. *snap* can be: =============== ========================================================================== None (default) use self.translateSnap and self.snapSize to determine whether/how to snap False do not snap Point(w,h) snap to rectangular grid with spacing (w,h) True snap using self.snapSize (and ignoring self.translateSnap) =============== ========================================================================== Also accepts *update* and *finish* arguments (see setPos() for a description of these). """ if len(args) == 1: pt = args[0] else: pt = args newState = self.stateCopy() newState['pos'] = newState['pos'] + pt snap = kargs.get('snap', None) if snap is None: snap = self.translateSnap if snap is not False: newState['pos'] = self.getSnapPosition(newState['pos'], snap=snap) if self.maxBounds is not None: r = self.stateRect(newState) d = Point(0,0) if self.maxBounds.left() > r.left(): d[0] = self.maxBounds.left() - r.left() elif self.maxBounds.right() < r.right(): d[0] = self.maxBounds.right() - r.right() if self.maxBounds.top() > r.top(): d[1] = self.maxBounds.top() - r.top() elif self.maxBounds.bottom() < r.bottom(): d[1] = self.maxBounds.bottom() - r.bottom() newState['pos'] += d update = kargs.get('update', True) finish = kargs.get('finish', True) self.setPos(newState['pos'], update=update, finish=finish) def rotate(self, angle, center=None, snap=False, update=True, finish=True): """ Rotate the ROI by *angle* degrees. =============== ========================================================================== **Arguments** angle (float) The angle in degrees to rotate center (None | Point) Optional center point around which the ROI is rotated, in the local coordinate system of the ROI snap (bool) If True, the final ROI angle is snapped to the nearest increment (default is 15 degrees; see ROI.rotateSnapAngle) update (bool) See setPos() finish (bool) See setPos() =============== ========================================================================== """ self.setAngle(self.angle()+angle, center=center, snap=snap, update=update, finish=finish) def handleMoveStarted(self): self.preMoveState = self.getState() self.sigRegionChangeStarted.emit(self) def addTranslateHandle(self, pos, axes=None, item=None, name=None, index=None): """ Add a new translation handle to the ROI. Dragging the handle will move the entire ROI without changing its angle or shape. Note that, by default, ROIs may be moved by dragging anywhere inside the ROI. However, for larger ROIs it may be desirable to disable this and instead provide one or more translation handles. =================== ==================================================== **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the upper-right corner, regardless of the ROI's size. item The Handle instance to add. If None, a new handle will be created. name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. =================== ==================================================== """ pos = Point(pos) return self.addHandle({'name': name, 'type': 't', 'pos': pos, 'item': item}, index=index) def addFreeHandle(self, pos=None, axes=None, item=None, name=None, index=None): """ Add a new free handle to the ROI. Dragging free handles has no effect on the position or shape of the ROI. =================== ==================================================== **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the upper-right corner, regardless of the ROI's size. item The Handle instance to add. If None, a new handle will be created. name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. =================== ==================================================== """ if pos is not None: pos = Point(pos) return self.addHandle({'name': name, 'type': 'f', 'pos': pos, 'item': item}, index=index) def addScaleHandle(self, pos, center, axes=None, item=None, name=None, lockAspect=False, index=None): """ Add a new scale handle to the ROI. Dragging a scale handle allows the user to change the height and/or width of the ROI. =================== ==================================================== **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the upper-right corner, regardless of the ROI's size. center (length-2 sequence) The center point around which scaling takes place. If the center point has the same x or y value as the handle position, then scaling will be disabled for that axis. item The Handle instance to add. If None, a new handle will be created. name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. =================== ==================================================== """ pos = Point(pos) center = Point(center) info = {'name': name, 'type': 's', 'center': center, 'pos': pos, 'item': item, 'lockAspect': lockAspect} if pos.x() == center.x(): info['xoff'] = True if pos.y() == center.y(): info['yoff'] = True return self.addHandle(info, index=index) def addRotateHandle(self, pos, center, item=None, name=None, index=None): """ Add a new rotation handle to the ROI. Dragging a rotation handle allows the user to change the angle of the ROI. =================== ==================================================== **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the upper-right corner, regardless of the ROI's size. center (length-2 sequence) The center point around which rotation takes place. item The Handle instance to add. If None, a new handle will be created. name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. =================== ==================================================== """ pos = Point(pos) center = Point(center) return self.addHandle({'name': name, 'type': 'r', 'center': center, 'pos': pos, 'item': item}, index=index) def addScaleRotateHandle(self, pos, center, item=None, name=None, index=None): """ Add a new scale+rotation handle to the ROI. When dragging a handle of this type, the user can simultaneously rotate the ROI around an arbitrary center point as well as scale the ROI by dragging the handle toward or away from the center point. =================== ==================================================== **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the upper-right corner, regardless of the ROI's size. center (length-2 sequence) The center point around which scaling and rotation take place. item The Handle instance to add. If None, a new handle will be created. name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. =================== ==================================================== """ pos = Point(pos) center = Point(center) if pos[0] == center[0] and pos[1] == center[1]: raise Exception("Scale/rotate handles cannot be at their center point.") return self.addHandle({'name': name, 'type': 'sr', 'center': center, 'pos': pos, 'item': item}, index=index) def addRotateFreeHandle(self, pos, center, axes=None, item=None, name=None, index=None): """ Add a new rotation+free handle to the ROI. When dragging a handle of this type, the user can rotate the ROI around an arbitrary center point, while moving toward or away from the center point has no effect on the shape of the ROI. =================== ==================================================== **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the upper-right corner, regardless of the ROI's size. center (length-2 sequence) The center point around which rotation takes place. item The Handle instance to add. If None, a new handle will be created. name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. =================== ==================================================== """ pos = Point(pos) center = Point(center) return self.addHandle({'name': name, 'type': 'rf', 'center': center, 'pos': pos, 'item': item}, index=index) def addHandle(self, info, index=None): ## If a Handle was not supplied, create it now if 'item' not in info or info['item'] is None: h = Handle(self.handleSize, typ=info['type'], pen=self.handlePen, hoverPen=self.handleHoverPen, parent=self) info['item'] = h else: h = info['item'] if info['pos'] is None: info['pos'] = h.pos() h.setPos(info['pos'] * self.state['size']) ## connect the handle to this ROI #iid = len(self.handles) h.connectROI(self) if index is None: self.handles.append(info) else: self.handles.insert(index, info) h.setZValue(self.zValue()+1) self.stateChanged() return h def indexOfHandle(self, handle): """ Return the index of *handle* in the list of this ROI's handles. """ if isinstance(handle, Handle): index = [i for i, info in enumerate(self.handles) if info['item'] is handle] if len(index) == 0: raise Exception("Cannot return handle index; not attached to this ROI") return index[0] else: return handle def removeHandle(self, handle): """Remove a handle from this ROI. Argument may be either a Handle instance or the integer index of the handle.""" index = self.indexOfHandle(handle) handle = self.handles[index]['item'] self.handles.pop(index) handle.disconnectROI(self) if len(handle.rois) == 0 and self.scene() is not None: self.scene().removeItem(handle) self.stateChanged() def replaceHandle(self, oldHandle, newHandle): """Replace one handle in the ROI for another. This is useful when connecting multiple ROIs together. *oldHandle* may be a Handle instance or the index of a handle to be replaced.""" index = self.indexOfHandle(oldHandle) info = self.handles[index] self.removeHandle(index) info['item'] = newHandle info['pos'] = newHandle.pos() self.addHandle(info, index=index) def checkRemoveHandle(self, handle): ## This is used when displaying a Handle's context menu to determine ## whether removing is allowed. ## Subclasses may wish to override this to disable the menu entry. ## Note: by default, handles are not user-removable even if this method returns True. return True def getLocalHandlePositions(self, index=None): """Returns the position of handles in the ROI's coordinate system. The format returned is a list of (name, pos) tuples. """ if index is None: positions = [] for h in self.handles: positions.append((h['name'], h['pos'])) return positions else: return (self.handles[index]['name'], self.handles[index]['pos']) def getSceneHandlePositions(self, index=None): """Returns the position of handles in the scene coordinate system. The format returned is a list of (name, pos) tuples. """ if index is None: positions = [] for h in self.handles: positions.append((h['name'], h['item'].scenePos())) return positions else: return (self.handles[index]['name'], self.handles[index]['item'].scenePos()) def getHandles(self): """ Return a list of this ROI's Handles. """ return [h['item'] for h in self.handles] def mapSceneToParent(self, pt): return self.mapToParent(self.mapFromScene(pt)) def setSelected(self, s): QtWidgets.QGraphicsItem.setSelected(self, s) #print "select", self, s if s: for h in self.handles: h['item'].show() else: for h in self.handles: h['item'].hide() def hoverEvent(self, ev): hover = False if not ev.isExit(): if self.translatable and ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton): hover=True for btn in [QtCore.Qt.MouseButton.LeftButton, QtCore.Qt.MouseButton.RightButton, QtCore.Qt.MouseButton.MiddleButton]: if (self.acceptedMouseButtons() & btn) and ev.acceptClicks(btn): hover=True if self.contextMenuEnabled(): ev.acceptClicks(QtCore.Qt.MouseButton.RightButton) if hover: self.setMouseHover(True) ev.acceptClicks(QtCore.Qt.MouseButton.LeftButton) ## If the ROI is hilighted, we should accept all clicks to avoid confusion. ev.acceptClicks(QtCore.Qt.MouseButton.RightButton) ev.acceptClicks(QtCore.Qt.MouseButton.MiddleButton) self.sigHoverEvent.emit(self) else: self.setMouseHover(False) def setMouseHover(self, hover): ## Inform the ROI that the mouse is(not) hovering over it if self.mouseHovering == hover: return self.mouseHovering = hover self._updateHoverColor() def _updateHoverColor(self): pen = self._makePen() if self.currentPen != pen: self.currentPen = pen self.update() def _makePen(self): # Generate the pen color for this ROI based on its current state. if self.mouseHovering: return self.hoverPen else: return self.pen def contextMenuEnabled(self): return self.removable or self.menu and len(self.menu.children()) > 1 def raiseContextMenu(self, ev): if not self.contextMenuEnabled(): return menu = self.getMenu() menu = self.scene().addParentContextMenus(self, menu, ev) pos = ev.screenPos() menu.popup(QtCore.QPoint(int(pos.x()), int(pos.y()))) def getMenu(self): if self.menu is None: self.menu = QtWidgets.QMenu() self.menu.setTitle(translate("ROI", "ROI")) if self.removable: remAct = QtGui.QAction(translate("ROI", "Remove ROI"), self.menu) remAct.triggered.connect(self.removeClicked) self.menu.addAction(remAct) self.menu.remAct = remAct return self.menu def removeClicked(self): ## Send remove event only after we have exited the menu event handler QtCore.QTimer.singleShot(0, self._emitRemoveRequest) def _emitRemoveRequest(self): self.sigRemoveRequested.emit(self) def mouseDragEvent(self, ev): self.mouseDragHandler.mouseDragEvent(ev) def mouseClickEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.RightButton and self.isMoving: ev.accept() self.cancelMove() if ev.button() == QtCore.Qt.MouseButton.RightButton and self.contextMenuEnabled(): self.raiseContextMenu(ev) ev.accept() elif self.acceptedMouseButtons() & ev.button(): ev.accept() self.sigClicked.emit(self, ev) else: ev.ignore() def _moveStarted(self): self.isMoving = True self.preMoveState = self.getState() self.sigRegionChangeStarted.emit(self) def _moveFinished(self): if self.isMoving: self.stateChangeFinished() self.isMoving = False def cancelMove(self): self.isMoving = False self.setState(self.preMoveState) def checkPointMove(self, handle, pos, modifiers): """When handles move, they must ask the ROI if the move is acceptable. By default, this always returns True. Subclasses may wish override. """ return True def movePoint(self, handle, pos, modifiers=None, finish=True, coords='parent'): ## called by Handles when they are moved. ## pos is the new position of the handle in scene coords, as requested by the handle. if modifiers is None: modifiers = QtCore.Qt.KeyboardModifier.NoModifier newState = self.stateCopy() index = self.indexOfHandle(handle) h = self.handles[index] p0 = self.mapToParent(h['pos'] * self.state['size']) p1 = Point(pos) if coords == 'parent': pass elif coords == 'scene': p1 = self.mapSceneToParent(p1) else: raise Exception("New point location must be given in either 'parent' or 'scene' coordinates.") ## Handles with a 'center' need to know their local position relative to the center point (lp0, lp1) if 'center' in h: c = h['center'] cs = c * self.state['size'] lp0 = self.mapFromParent(p0) - cs lp1 = self.mapFromParent(p1) - cs if h['type'] == 't': snap = True if (modifiers & QtCore.Qt.KeyboardModifier.ControlModifier) else None self.translate(p1-p0, snap=snap, update=False) elif h['type'] == 'f': newPos = self.mapFromParent(p1) h['item'].setPos(newPos) h['pos'] = newPos self.freeHandleMoved = True elif h['type'] == 's': ## If a handle and its center have the same x or y value, we can't scale across that axis. if h['center'][0] == h['pos'][0]: lp1[0] = 0 if h['center'][1] == h['pos'][1]: lp1[1] = 0 ## snap if self.scaleSnap or (modifiers & QtCore.Qt.KeyboardModifier.ControlModifier): lp1[0] = round(lp1[0] / self.scaleSnapSize) * self.scaleSnapSize lp1[1] = round(lp1[1] / self.scaleSnapSize) * self.scaleSnapSize ## preserve aspect ratio (this can override snapping) if h['lockAspect'] or (modifiers & QtCore.Qt.KeyboardModifier.AltModifier): #arv = Point(self.preMoveState['size']) - lp1 = lp1.proj(lp0) ## determine scale factors and new size of ROI hs = h['pos'] - c if hs[0] == 0: hs[0] = 1 if hs[1] == 0: hs[1] = 1 newSize = lp1 / hs ## Perform some corrections and limit checks if newSize[0] == 0: newSize[0] = newState['size'][0] if newSize[1] == 0: newSize[1] = newState['size'][1] if not self.invertible: if newSize[0] < 0: newSize[0] = newState['size'][0] if newSize[1] < 0: newSize[1] = newState['size'][1] if self.aspectLocked: newSize[0] = newSize[1] ## Move ROI so the center point occupies the same scene location after the scale s0 = c * self.state['size'] s1 = c * newSize cc = self.mapToParent(s0 - s1) - self.mapToParent(Point(0, 0)) ## update state, do more boundary checks newState['size'] = newSize newState['pos'] = newState['pos'] + cc if self.maxBounds is not None: r = self.stateRect(newState) if not self.maxBounds.contains(r): return self.setPos(newState['pos'], update=False) self.setSize(newState['size'], update=False) elif h['type'] in ['r', 'rf']: if h['type'] == 'rf': self.freeHandleMoved = True if not self.rotatable: return ## If the handle is directly over its center point, we can't compute an angle. try: if lp1.length() == 0 or lp0.length() == 0: return except OverflowError: return ## determine new rotation angle, constrained if necessary ang = newState['angle'] - lp0.angle(lp1) if ang is None: ## this should never happen.. return if self.rotateSnap or (modifiers & QtCore.Qt.KeyboardModifier.ControlModifier): ang = round(ang / self.rotateSnapAngle) * self.rotateSnapAngle ## create rotation transform tr = QtGui.QTransform() tr.rotate(ang) ## move ROI so that center point remains stationary after rotate cc = self.mapToParent(cs) - (tr.map(cs) + self.state['pos']) newState['angle'] = ang newState['pos'] = newState['pos'] + cc ## check boundaries, update if self.maxBounds is not None: r = self.stateRect(newState) if not self.maxBounds.contains(r): return self.setPos(newState['pos'], update=False) self.setAngle(ang, update=False) ## If this is a free-rotate handle, its distance from the center may change. if h['type'] == 'rf': h['item'].setPos(self.mapFromScene(p1)) ## changes ROI coordinates of handle h['pos'] = self.mapFromParent(p1) elif h['type'] == 'sr': try: if lp1.length() == 0 or lp0.length() == 0: return except OverflowError: return ang = newState['angle'] - lp0.angle(lp1) if ang is None: return if self.rotateSnap or (modifiers & QtCore.Qt.KeyboardModifier.ControlModifier): ang = round(ang / self.rotateSnapAngle) * self.rotateSnapAngle if self.aspectLocked or h['center'][0] != h['pos'][0]: newState['size'][0] = self.state['size'][0] * lp1.length() / lp0.length() if self.scaleSnap: # use CTRL only for angular snap here. newState['size'][0] = round(newState['size'][0] / self.snapSize) * self.snapSize if self.aspectLocked or h['center'][1] != h['pos'][1]: newState['size'][1] = self.state['size'][1] * lp1.length() / lp0.length() if self.scaleSnap: # use CTRL only for angular snap here. newState['size'][1] = round(newState['size'][1] / self.snapSize) * self.snapSize if newState['size'][0] == 0: newState['size'][0] = 1 if newState['size'][1] == 0: newState['size'][1] = 1 c1 = c * newState['size'] tr = QtGui.QTransform() tr.rotate(ang) cc = self.mapToParent(cs) - (tr.map(c1) + self.state['pos']) newState['angle'] = ang newState['pos'] = newState['pos'] + cc if self.maxBounds is not None: r = self.stateRect(newState) if not self.maxBounds.contains(r): return self.setState(newState, update=False) self.stateChanged(finish=finish) def stateChanged(self, finish=True): """Process changes to the state of the ROI. If there are any changes, then the positions of handles are updated accordingly and sigRegionChanged is emitted. If finish is True, then sigRegionChangeFinished will also be emitted.""" changed = False if self.lastState is None: changed = True else: state = self.getState() for k in list(state.keys()): if state[k] != self.lastState[k]: changed = True self.prepareGeometryChange() if changed: ## Move all handles to match the current configuration of the ROI for h in self.handles: if h['item'] in self.childItems(): h['item'].setPos(h['pos'] * self.state['size']) self.update() self.sigRegionChanged.emit(self) elif self.freeHandleMoved: self.sigRegionChanged.emit(self) self.freeHandleMoved = False self.lastState = self.getState() if finish: self.stateChangeFinished() self.informViewBoundsChanged() def stateChangeFinished(self): self.sigRegionChangeFinished.emit(self) def stateRect(self, state): r = QtCore.QRectF(0, 0, state['size'][0], state['size'][1]) tr = QtGui.QTransform() tr.rotate(-state['angle']) r = tr.mapRect(r) return r.adjusted(state['pos'][0], state['pos'][1], state['pos'][0], state['pos'][1]) def getSnapPosition(self, pos, snap=None): ## Given that pos has been requested, return the nearest snap-to position ## optionally, snap may be passed in to specify a rectangular snap grid. ## override this function for more interesting snap functionality.. if snap is None or snap is True: if self.snapSize is None: return pos snap = Point(self.snapSize, self.snapSize) return Point( round(pos[0] / snap[0]) * snap[0], round(pos[1] / snap[1]) * snap[1] ) def boundingRect(self): return QtCore.QRectF(0, 0, self.state['size'][0], self.state['size'][1]).normalized() def paint(self, p, opt, widget): # Note: don't use self.boundingRect here, because subclasses may need to redefine it. r = QtCore.QRectF(0, 0, self.state['size'][0], self.state['size'][1]).normalized() p.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing) p.setPen(self.currentPen) p.translate(r.left(), r.top()) p.scale(r.width(), r.height()) p.drawRect(0, 0, 1, 1) def getArraySlice(self, data, img, axes=(0,1), returnSlice=True): """Return a tuple of slice objects that can be used to slice the region from *data* that is covered by the bounding rectangle of this ROI. Also returns the transform that maps the ROI into data coordinates. If returnSlice is set to False, the function returns a pair of tuples with the values that would have been used to generate the slice objects. ((ax0Start, ax0Stop), (ax1Start, ax1Stop)) If the slice cannot be computed (usually because the scene/transforms are not properly constructed yet), then the method returns None. """ ## Determine shape of array along ROI axes dShape = (data.shape[axes[0]], data.shape[axes[1]]) ## Determine transform that maps ROI bounding box to image coordinates try: tr = self.sceneTransform() * fn.invertQTransform(img.sceneTransform()) except np.linalg.linalg.LinAlgError: return None ## Modify transform to scale from image coords to data coords axisOrder = img.axisOrder if axisOrder == 'row-major': tr.scale(float(dShape[1]) / img.width(), float(dShape[0]) / img.height()) else: tr.scale(float(dShape[0]) / img.width(), float(dShape[1]) / img.height()) ## Transform ROI bounds into data bounds dataBounds = tr.mapRect(self.boundingRect()) ## Intersect transformed ROI bounds with data bounds if axisOrder == 'row-major': intBounds = dataBounds.intersected(QtCore.QRectF(0, 0, dShape[1], dShape[0])) else: intBounds = dataBounds.intersected(QtCore.QRectF(0, 0, dShape[0], dShape[1])) ## Determine index values to use when referencing the array. bounds = ( (int(min(intBounds.left(), intBounds.right())), int(1+max(intBounds.left(), intBounds.right()))), (int(min(intBounds.bottom(), intBounds.top())), int(1+max(intBounds.bottom(), intBounds.top()))) ) if axisOrder == 'row-major': bounds = bounds[::-1] if returnSlice: ## Create slice objects sl = [slice(None)] * data.ndim sl[axes[0]] = slice(*bounds[0]) sl[axes[1]] = slice(*bounds[1]) return tuple(sl), tr else: return bounds, tr def getArrayRegion(self, data, img, axes=(0,1), returnMappedCoords=False, **kwds): r"""Use the position and orientation of this ROI relative to an imageItem to pull a slice from an array. =================== ==================================================== **Arguments** data The array to slice from. Note that this array does *not* have to be the same data that is represented in *img*. img (ImageItem or other suitable QGraphicsItem) Used to determine the relationship between the ROI and the boundaries of *data*. axes (length-2 tuple) Specifies the axes in *data* that correspond to the (x, y) axes of *img*. If the image's axis order is set to 'row-major', then the axes are instead specified in (y, x) order. returnMappedCoords (bool) If True, the array slice is returned along with a corresponding array of coordinates that were used to extract data from the original array. \**kwds All keyword arguments are passed to :func:`affineSlice `. =================== ==================================================== This method uses :func:`affineSlice ` to generate the slice from *data* and uses :func:`getAffineSliceParams ` to determine the parameters to pass to :func:`affineSlice `. If *returnMappedCoords* is True, then the method returns a tuple (result, coords) such that coords is the set of coordinates used to interpolate values from the original data, mapped into the parent coordinate system of the image. This is useful, when slicing data from images that have been transformed, for determining the location of each value in the sliced data. All extra keyword arguments are passed to :func:`affineSlice `. """ # this is a hidden argument for internal use fromBR = kwds.pop('fromBoundingRect', False) # Automaticaly compute missing parameters _shape, _vectors, _origin = self.getAffineSliceParams(data, img, axes, fromBoundingRect=fromBR) # Replace them with user defined parameters if defined shape = kwds.pop('shape', _shape) vectors = kwds.pop('vectors', _vectors) origin = kwds.pop('origin', _origin) if not returnMappedCoords: rgn = fn.affineSlice(data, shape=shape, vectors=vectors, origin=origin, axes=axes, **kwds) return rgn else: kwds['returnCoords'] = True result, coords = fn.affineSlice(data, shape=shape, vectors=vectors, origin=origin, axes=axes, **kwds) ### map coordinates and return mapped = fn.transformCoordinates(img.transform(), coords) return result, mapped def _getArrayRegionForArbitraryShape(self, data, img, axes=(0,1), returnMappedCoords=False, **kwds): """ Return the result of :meth:`~pyqtgraph.ROI.getArrayRegion`, masked by the shape of the ROI. Values outside the ROI shape are set to 0. See :meth:`~pyqtgraph.ROI.getArrayRegion` for a description of the arguments. """ if returnMappedCoords: sliced, mappedCoords = ROI.getArrayRegion( self, data, img, axes, returnMappedCoords, fromBoundingRect=True, **kwds) else: sliced = ROI.getArrayRegion( self, data, img, axes, returnMappedCoords, fromBoundingRect=True, **kwds) if img.axisOrder == 'col-major': mask = self.renderShapeMask(sliced.shape[axes[0]], sliced.shape[axes[1]]) else: mask = self.renderShapeMask(sliced.shape[axes[1]], sliced.shape[axes[0]]) mask = mask.T # reshape mask to ensure it is applied to the correct data axes shape = [1] * data.ndim shape[axes[0]] = sliced.shape[axes[0]] shape[axes[1]] = sliced.shape[axes[1]] mask = mask.reshape(shape) if returnMappedCoords: return sliced * mask, mappedCoords else: return sliced * mask def getAffineSliceParams(self, data, img, axes=(0,1), fromBoundingRect=False): """ Returns the parameters needed to use :func:`affineSlice ` (shape, vectors, origin) to extract a subset of *data* using this ROI and *img* to specify the subset. If *fromBoundingRect* is True, then the ROI's bounding rectangle is used rather than the shape of the ROI. See :func:`getArrayRegion ` for more information. """ if self.scene() is not img.scene(): raise Exception("ROI and target item must be members of the same scene.") origin = img.mapToData(self.mapToItem(img, QtCore.QPointF(0, 0))) ## vx and vy point in the directions of the slice axes, but must be scaled properly vx = img.mapToData(self.mapToItem(img, QtCore.QPointF(1, 0))) - origin vy = img.mapToData(self.mapToItem(img, QtCore.QPointF(0, 1))) - origin lvx = hypot(vx.x(), vx.y()) # length lvy = hypot(vy.x(), vy.y()) # length ##img.width is number of pixels, not width of item. ##need pxWidth and pxHeight instead of pxLen ? sx = 1.0 / lvx sy = 1.0 / lvy vectors = ((vx.x()*sx, vx.y()*sx), (vy.x()*sy, vy.y()*sy)) if fromBoundingRect is True: shape = self.boundingRect().width(), self.boundingRect().height() origin = img.mapToData(self.mapToItem(img, self.boundingRect().topLeft())) origin = (origin.x(), origin.y()) else: shape = self.state['size'] origin = (origin.x(), origin.y()) shape = [abs(shape[0]/sx), abs(shape[1]/sy)] if img.axisOrder == 'row-major': # transpose output vectors = vectors[::-1] shape = shape[::-1] return shape, vectors, origin def renderShapeMask(self, width, height): """Return an array of 0.0-1.0 into which the shape of the item has been drawn. This can be used to mask array selections. """ if width == 0 or height == 0: return np.empty((width, height), dtype=float) im = QtGui.QImage(width, height, QtGui.QImage.Format.Format_ARGB32) im.fill(QtCore.Qt.GlobalColor.transparent) p = QtGui.QPainter(im) p.setPen(fn.mkPen(None)) p.setBrush(fn.mkBrush('w')) shape = self.shape() bounds = shape.boundingRect() p.scale(im.width() / bounds.width(), im.height() / bounds.height()) p.translate(-bounds.topLeft()) p.drawPath(shape) p.end() cidx = 0 if sys.byteorder == 'little' else 3 mask = fn.ndarray_from_qimage(im)[...,cidx].T return mask.astype(float) / 255 def getGlobalTransform(self, relativeTo=None): """Return global transformation (rotation angle+translation) required to move from relative state to current state. If relative state isn't specified, then we use the state of the ROI when mouse is pressed.""" if relativeTo is None: relativeTo = self.preMoveState st = self.getState() ## this is only allowed because we will be comparing the two relativeTo['scale'] = relativeTo['size'] st['scale'] = st['size'] t1 = SRTTransform(relativeTo) t2 = SRTTransform(st) return t2/t1 def applyGlobalTransform(self, tr): st = self.getState() st['scale'] = st['size'] st = SRTTransform(st) st = (st * tr).saveState() st['size'] = st['scale'] self.setState(st) class Handle(UIGraphicsItem): """ Handle represents a single user-interactable point attached to an ROI. They are usually created by a call to one of the ROI.add___Handle() methods. Handles are represented as a square, diamond, or circle, and are drawn with fixed pixel size regardless of the scaling of the view they are displayed in. Handles may be dragged to change the position, size, orientation, or other properties of the ROI they are attached to. """ types = { ## defines number of sides, start angle for each handle type 't': (4, np.pi/4), 'f': (4, np.pi/4), 's': (4, 0), 'r': (12, 0), 'sr': (12, 0), 'rf': (12, 0), } sigClicked = QtCore.Signal(object, object) # self, event sigRemoveRequested = QtCore.Signal(object) # self def __init__(self, radius, typ=None, pen=(200, 200, 220), hoverPen=(255, 255, 0), parent=None, deletable=False): self.rois = [] self.radius = radius self.typ = typ self.pen = fn.mkPen(pen) self.hoverPen = fn.mkPen(hoverPen) self.currentPen = self.pen self.pen.setWidth(0) self.pen.setCosmetic(True) self.isMoving = False self.sides, self.startAng = self.types[typ] self.buildPath() self._shape = None self.menu = self.buildMenu() UIGraphicsItem.__init__(self, parent=parent) self.setAcceptedMouseButtons(QtCore.Qt.MouseButton.NoButton) self.deletable = deletable if deletable: self.setAcceptedMouseButtons(QtCore.Qt.MouseButton.RightButton) self.setZValue(11) def connectROI(self, roi): ### roi is the "parent" roi, i is the index of the handle in roi.handles self.rois.append(roi) def disconnectROI(self, roi): self.rois.remove(roi) def setDeletable(self, b): self.deletable = b if b: self.setAcceptedMouseButtons(self.acceptedMouseButtons() | QtCore.Qt.MouseButton.RightButton) else: self.setAcceptedMouseButtons(self.acceptedMouseButtons() & ~QtCore.Qt.MouseButton.RightButton) def removeClicked(self): self.sigRemoveRequested.emit(self) def hoverEvent(self, ev): hover = False if not ev.isExit(): if ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton): hover=True for btn in [QtCore.Qt.MouseButton.LeftButton, QtCore.Qt.MouseButton.RightButton, QtCore.Qt.MouseButton.MiddleButton]: if (self.acceptedMouseButtons() & btn) and ev.acceptClicks(btn): hover=True if hover: self.currentPen = self.hoverPen else: self.currentPen = self.pen self.update() def mouseClickEvent(self, ev): ## right-click cancels drag if ev.button() == QtCore.Qt.MouseButton.RightButton and self.isMoving: self.isMoving = False ## prevents any further motion self.movePoint(self.startPos, finish=True) ev.accept() elif self.acceptedMouseButtons() & ev.button(): ev.accept() if ev.button() == QtCore.Qt.MouseButton.RightButton and self.deletable: self.raiseContextMenu(ev) self.sigClicked.emit(self, ev) else: ev.ignore() def buildMenu(self): menu = QtWidgets.QMenu() menu.setTitle(translate("ROI", "Handle")) self.removeAction = menu.addAction(translate("ROI", "Remove handle"), self.removeClicked) return menu def getMenu(self): return self.menu def raiseContextMenu(self, ev): menu = self.scene().addParentContextMenus(self, self.getMenu(), ev) ## Make sure it is still ok to remove this handle removeAllowed = all(r.checkRemoveHandle(self) for r in self.rois) self.removeAction.setEnabled(removeAllowed) pos = ev.screenPos() menu.popup(QtCore.QPoint(int(pos.x()), int(pos.y()))) def mouseDragEvent(self, ev): if ev.button() != QtCore.Qt.MouseButton.LeftButton: return ev.accept() ## Inform ROIs that a drag is happening ## note: the ROI is informed that the handle has moved using ROI.movePoint ## this is for other (more nefarious) purposes. #for r in self.roi: #r[0].pointDragEvent(r[1], ev) if ev.isFinish(): if self.isMoving: for r in self.rois: r.stateChangeFinished() self.isMoving = False self.currentPen = self.pen self.update() elif ev.isStart(): for r in self.rois: r.handleMoveStarted() self.isMoving = True self.startPos = self.scenePos() self.cursorOffset = self.scenePos() - ev.buttonDownScenePos() self.currentPen = self.hoverPen if self.isMoving: ## note: isMoving may become False in mid-drag due to right-click. pos = ev.scenePos() + self.cursorOffset self.currentPen = self.hoverPen self.movePoint(pos, ev.modifiers(), finish=False) def movePoint(self, pos, modifiers=None, finish=True): if modifiers is None: modifiers = QtCore.Qt.KeyboardModifier.NoModifier for r in self.rois: if not r.checkPointMove(self, pos, modifiers): return #print "point moved; inform %d ROIs" % len(self.roi) # A handle can be used by multiple ROIs; tell each to update its handle position for r in self.rois: r.movePoint(self, pos, modifiers, finish=finish, coords='scene') def buildPath(self): size = self.radius self.path = QtGui.QPainterPath() ang = self.startAng dt = 2 * np.pi / self.sides for i in range(0, self.sides): x = size * cos(ang) y = size * sin(ang) ang += dt if i == 0: self.path.moveTo(x, y) else: self.path.lineTo(x, y) self.path.closeSubpath() def paint(self, p, opt, widget): p.setRenderHints(p.RenderHint.Antialiasing, True) p.setPen(self.currentPen) p.drawPath(self.shape()) def shape(self): if self._shape is None: s = self.generateShape() if s is None: return self.path self._shape = s self.prepareGeometryChange() ## beware--this can cause the view to adjust, which would immediately invalidate the shape. return self._shape def boundingRect(self): s1 = self.shape() # noqa: avoid problems with shape invalidation return self.shape().boundingRect() def generateShape(self): dt = self.deviceTransform() if dt is None: self._shape = self.path return None v = dt.map(QtCore.QPointF(1, 0)) - dt.map(QtCore.QPointF(0, 0)) va = atan2(v.y(), v.x()) dti = fn.invertQTransform(dt) devPos = dt.map(QtCore.QPointF(0,0)) tr = QtGui.QTransform() tr.translate(devPos.x(), devPos.y()) tr.rotateRadians(va) return dti.map(tr.map(self.path)) def viewTransformChanged(self): GraphicsObject.viewTransformChanged(self) self._shape = None ## invalidate shape, recompute later if requested. self.update() class MouseDragHandler(object): """Implements default mouse drag behavior for ROI (not for ROI handles). """ def __init__(self, roi): self.roi = roi self.dragMode = None self.startState = None self.snapModifier = QtCore.Qt.KeyboardModifier.ControlModifier self.translateModifier = QtCore.Qt.KeyboardModifier.NoModifier self.rotateModifier = QtCore.Qt.KeyboardModifier.AltModifier self.scaleModifier = QtCore.Qt.KeyboardModifier.ShiftModifier self.rotateSpeed = 0.5 self.scaleSpeed = 1.01 def mouseDragEvent(self, ev): roi = self.roi if ev.isStart(): if ev.button() == QtCore.Qt.MouseButton.LeftButton: roi.setSelected(True) mods = ev.modifiers() try: mods &= ~self.snapModifier except ValueError: # workaround bug in Python 3.11.4 that affects PyQt if mods & self.snapModifier: mods ^= self.snapModifier if roi.translatable and mods == self.translateModifier: self.dragMode = 'translate' elif roi.rotatable and mods == self.rotateModifier: self.dragMode = 'rotate' elif roi.resizable and mods == self.scaleModifier: self.dragMode = 'scale' else: self.dragMode = None if self.dragMode is not None: roi._moveStarted() self.startPos = roi.mapToParent(ev.buttonDownPos()) self.startState = roi.saveState() self.cursorOffset = roi.pos() - self.startPos ev.accept() else: ev.ignore() else: self.dragMode = None ev.ignore() if ev.isFinish() and self.dragMode is not None: roi._moveFinished() return # roi.isMoving becomes False if the move was cancelled by right-click if not roi.isMoving or self.dragMode is None: return snap = True if (ev.modifiers() & self.snapModifier) else None pos = roi.mapToParent(ev.pos()) if self.dragMode == 'translate': newPos = pos + self.cursorOffset roi.translate(newPos - roi.pos(), snap=snap, finish=False) elif self.dragMode == 'rotate': diff = self.rotateSpeed * (ev.scenePos() - ev.buttonDownScenePos()).x() angle = self.startState['angle'] - diff roi.setAngle(angle, centerLocal=ev.buttonDownPos(), snap=snap, finish=False) elif self.dragMode == 'scale': diff = self.scaleSpeed ** -(ev.scenePos() - ev.buttonDownScenePos()).y() roi.setSize(Point(self.startState['size']) * diff, centerLocal=ev.buttonDownPos(), snap=snap, finish=False) class TestROI(ROI): def __init__(self, pos, size, **args): ROI.__init__(self, pos, size, **args) self.addTranslateHandle([0.5, 0.5]) self.addScaleHandle([1, 1], [0, 0]) self.addScaleHandle([0, 0], [1, 1]) self.addScaleRotateHandle([1, 0.5], [0.5, 0.5]) self.addScaleHandle([0.5, 1], [0.5, 0.5]) self.addRotateHandle([1, 0], [0, 0]) self.addRotateHandle([0, 1], [1, 1]) class RectROI(ROI): r""" Rectangular ROI subclass with a single scale handle at the top-right corner. ============== ============================================================= **Arguments** pos (length-2 sequence) The position of the ROI origin. See ROI(). size (length-2 sequence) The size of the ROI. See ROI(). centered (bool) If True, scale handles affect the ROI relative to its center, rather than its origin. sideScalers (bool) If True, extra scale handles are added at the top and right edges. \**args All extra keyword arguments are passed to ROI() ============== ============================================================= """ def __init__(self, pos, size, centered=False, sideScalers=False, **args): ROI.__init__(self, pos, size, **args) if centered: center = [0.5, 0.5] else: center = [0, 0] self.addScaleHandle([1, 1], center) if sideScalers: self.addScaleHandle([1, 0.5], [center[0], 0.5]) self.addScaleHandle([0.5, 1], [0.5, center[1]]) class LineROI(ROI): r""" Rectangular ROI subclass with scale-rotate handles on either side. This allows the ROI to be positioned as if moving the ends of a line segment. A third handle controls the width of the ROI orthogonal to its "line" axis. ============== ============================================================= **Arguments** pos1 (length-2 sequence) The position of the center of the ROI's left edge. pos2 (length-2 sequence) The position of the center of the ROI's right edge. width (float) The width of the ROI. \**args All extra keyword arguments are passed to ROI() ============== ============================================================= """ def __init__(self, pos1, pos2, width, **args): pos1 = Point(pos1) pos2 = Point(pos2) d = pos2-pos1 l = d.length() ra = d.angle(Point(1, 0), units="radians") c = Point(width/2. * sin(ra), -width/2. * cos(ra)) pos1 = pos1 + c ROI.__init__(self, pos1, size=Point(l, width), angle=degrees(ra), **args) self.addScaleRotateHandle([0, 0.5], [1, 0.5]) self.addScaleRotateHandle([1, 0.5], [0, 0.5]) self.addScaleHandle([0.5, 1], [0.5, 0.5]) class MultiRectROI(QtWidgets.QGraphicsObject): r""" Chain of rectangular ROIs connected by handles. This is generally used to mark a curved path through an image similarly to PolyLineROI. It differs in that each segment of the chain is rectangular instead of linear and thus has width. ============== ============================================================= **Arguments** points (list of length-2 sequences) The list of points in the path. width (float) The width of the ROIs orthogonal to the path. \**args All extra keyword arguments are passed to ROI() ============== ============================================================= """ sigRegionChangeFinished = QtCore.Signal(object) sigRegionChangeStarted = QtCore.Signal(object) sigRegionChanged = QtCore.Signal(object) def __init__(self, points, width, pen=None, **args): QtWidgets.QGraphicsObject.__init__(self) self.pen = pen self.roiArgs = args self.lines = [] if len(points) < 2: raise Exception("Must start with at least 2 points") ## create first segment self.addSegment(points[1], connectTo=points[0], scaleHandle=True) ## create remaining segments for p in points[2:]: self.addSegment(p) def paint(self, *args): pass def boundingRect(self): return QtCore.QRectF() def roiChangedEvent(self): w = self.lines[0].state['size'][1] for l in self.lines[1:]: w0 = l.state['size'][1] if w == w0: continue l.scale([1.0, w/w0], center=[0.5,0.5]) self.sigRegionChanged.emit(self) def roiChangeStartedEvent(self): self.sigRegionChangeStarted.emit(self) def roiChangeFinishedEvent(self): self.sigRegionChangeFinished.emit(self) def getHandlePositions(self): """Return the positions of all handles in local coordinates.""" pos = [self.mapFromScene(self.lines[0].getHandles()[0].scenePos())] for l in self.lines: pos.append(self.mapFromScene(l.getHandles()[1].scenePos())) return pos def getArrayRegion(self, arr, img=None, axes=(0,1), **kwds): """ Return the result of :meth:`~pyqtgraph.ROI.getArrayRegion` for each rect in the chain concatenated into a single ndarray. See :meth:`~pyqtgraph.ROI.getArrayRegion` for a description of the arguments. Note: ``returnMappedCoords`` is not yet supported for this ROI type. """ rgns = [] for l in self.lines: rgn = l.getArrayRegion(arr, img, axes=axes, **kwds) if rgn is None: continue rgns.append(rgn) #print l.state['size'] ## make sure orthogonal axis is the same size ## (sometimes fp errors cause differences) if img.axisOrder == 'row-major': axes = axes[::-1] ms = min([r.shape[axes[1]] for r in rgns]) sl = [slice(None)] * rgns[0].ndim sl[axes[1]] = slice(0,ms) rgns = [r[tuple(sl)] for r in rgns] #print [r.shape for r in rgns], axes return np.concatenate(rgns, axis=axes[0]) def addSegment(self, pos=(0,0), scaleHandle=False, connectTo=None): """ Add a new segment to the ROI connecting from the previous endpoint to *pos*. (pos is specified in the parent coordinate system of the MultiRectROI) """ ## by default, connect to the previous endpoint if connectTo is None: connectTo = self.lines[-1].getHandles()[1] ## create new ROI newRoi = ROI((0,0), [1, 5], parent=self, pen=self.pen, **self.roiArgs) self.lines.append(newRoi) ## Add first SR handle if isinstance(connectTo, Handle): self.lines[-1].addScaleRotateHandle([0, 0.5], [1, 0.5], item=connectTo) newRoi.movePoint(connectTo, connectTo.scenePos(), coords='scene') else: h = self.lines[-1].addScaleRotateHandle([0, 0.5], [1, 0.5]) newRoi.movePoint(h, connectTo, coords='scene') ## add second SR handle h = self.lines[-1].addScaleRotateHandle([1, 0.5], [0, 0.5]) newRoi.movePoint(h, pos) ## optionally add scale handle (this MUST come after the two SR handles) if scaleHandle: newRoi.addScaleHandle([0.5, 1], [0.5, 0.5]) newRoi.translatable = False newRoi.sigRegionChanged.connect(self.roiChangedEvent) newRoi.sigRegionChangeStarted.connect(self.roiChangeStartedEvent) newRoi.sigRegionChangeFinished.connect(self.roiChangeFinishedEvent) self.sigRegionChanged.emit(self) def removeSegment(self, index=-1): """Remove a segment from the ROI.""" roi = self.lines[index] self.lines.pop(index) self.scene().removeItem(roi) roi.sigRegionChanged.disconnect(self.roiChangedEvent) roi.sigRegionChangeStarted.disconnect(self.roiChangeStartedEvent) roi.sigRegionChangeFinished.disconnect(self.roiChangeFinishedEvent) self.sigRegionChanged.emit(self) class MultiLineROI(MultiRectROI): def __init__(self, *args, **kwds): MultiRectROI.__init__(self, *args, **kwds) print("Warning: MultiLineROI has been renamed to MultiRectROI. (and MultiLineROI may be redefined in the future)") class EllipseROI(ROI): r""" Elliptical ROI subclass with one scale handle and one rotation handle. ============== ============================================================= **Arguments** pos (length-2 sequence) The position of the ROI's origin. size (length-2 sequence) The size of the ROI's bounding rectangle. \**args All extra keyword arguments are passed to ROI() ============== ============================================================= """ def __init__(self, pos, size, **args): self.path = None ROI.__init__(self, pos, size, **args) self.sigRegionChanged.connect(self._clearPath) self._addHandles() def _addHandles(self): self.addRotateHandle([1.0, 0.5], [0.5, 0.5]) self.addScaleHandle([0.5*2.**-0.5 + 0.5, 0.5*2.**-0.5 + 0.5], [0.5, 0.5]) def _clearPath(self): self.path = None def paint(self, p, opt, widget): r = self.boundingRect() p.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing) p.setPen(self.currentPen) p.scale(r.width(), r.height())## workaround for GL bug r = QtCore.QRectF(r.x()/r.width(), r.y()/r.height(), 1,1) p.drawEllipse(r) def getArrayRegion(self, arr, img=None, axes=(0, 1), returnMappedCoords=False, **kwds): """ Return the result of :meth:`~pyqtgraph.ROI.getArrayRegion` masked by the elliptical shape of the ROI. Regions outside the ellipse are set to 0. See :meth:`~pyqtgraph.ROI.getArrayRegion` for a description of the arguments. Note: ``returnMappedCoords`` is not yet supported for this ROI type. """ # Note: we could use the same method as used by PolyLineROI, but this # implementation produces a nicer mask. if returnMappedCoords: arr, mappedCoords = ROI.getArrayRegion(self, arr, img, axes, returnMappedCoords, **kwds) else: arr = ROI.getArrayRegion(self, arr, img, axes, returnMappedCoords, **kwds) if arr is None or arr.shape[axes[0]] == 0 or arr.shape[axes[1]] == 0: if returnMappedCoords: return arr, mappedCoords else: return arr w = arr.shape[axes[0]] h = arr.shape[axes[1]] ## generate an ellipsoidal mask mask = np.fromfunction(lambda x,y: np.hypot(((x+0.5)/(w/2.)-1), ((y+0.5)/(h/2.)-1)) < 1, (w, h)) # reshape to match array axes if axes[0] > axes[1]: mask = mask.T shape = [(n if i in axes else 1) for i,n in enumerate(arr.shape)] mask = mask.reshape(shape) if returnMappedCoords: return arr * mask, mappedCoords else: return arr * mask def shape(self): if self.path is None: path = QtGui.QPainterPath() # Note: Qt has a bug where very small ellipses (radius <0.001) do # not correctly intersect with mouse position (upper-left and # lower-right quadrants are not clickable). #path.addEllipse(self.boundingRect()) # Workaround: manually draw the path. br = self.boundingRect() center = br.center() r1 = br.width() / 2. r2 = br.height() / 2. theta = np.linspace(0, 2 * np.pi, 24) x = center.x() + r1 * np.cos(theta) y = center.y() + r2 * np.sin(theta) path.moveTo(x[0], y[0]) for i in range(1, len(x)): path.lineTo(x[i], y[i]) self.path = path return self.path class CircleROI(EllipseROI): r""" Circular ROI subclass. Behaves exactly as EllipseROI, but may only be scaled proportionally to maintain its aspect ratio. ============== ============================================================= **Arguments** pos (length-2 sequence) The position of the ROI's origin. size (length-2 sequence) The size of the ROI's bounding rectangle. \**args All extra keyword arguments are passed to ROI() ============== ============================================================= """ def __init__(self, pos, size=None, radius=None, **args): if size is None: if radius is None: raise TypeError("Must provide either size or radius.") size = (radius*2, radius*2) EllipseROI.__init__(self, pos, size, aspectLocked=True, **args) def _addHandles(self): self.addScaleHandle([0.5*2.**-0.5 + 0.5, 0.5*2.**-0.5 + 0.5], [0.5, 0.5]) class PolyLineROI(ROI): r""" Container class for multiple connected LineSegmentROIs. This class allows the user to draw paths of multiple line segments. ============== ============================================================= **Arguments** positions (list of length-2 sequences) The list of points in the path. Note that, unlike the handle positions specified in other ROIs, these positions must be expressed in the normal coordinate system of the ROI, rather than (0 to 1) relative to the size of the ROI. closed (bool) if True, an extra LineSegmentROI is added connecting the beginning and end points. \**args All extra keyword arguments are passed to ROI() ============== ============================================================= """ def __init__(self, positions, closed=False, pos=None, **args): if pos is None: pos = [0,0] self.closed = closed self.segments = [] ROI.__init__(self, pos, size=[1,1], **args) self.setPoints(positions) def setPoints(self, points, closed=None): """ Set the complete sequence of points displayed by this ROI. ============= ========================================================= **Arguments** points List of (x,y) tuples specifying handle locations to set. closed If bool, then this will set whether the ROI is closed (the last point is connected to the first point). If None, then the closed mode is left unchanged. ============= ========================================================= """ if closed is not None: self.closed = closed self.clearPoints() for p in points: self.addFreeHandle(p) start = -1 if self.closed else 0 for i in range(start, len(self.handles)-1): self.addSegment(self.handles[i]['item'], self.handles[i+1]['item']) def clearPoints(self): """ Remove all handles and segments. """ while len(self.handles) > 0: self.removeHandle(self.handles[0]['item']) def getState(self): state = ROI.getState(self) state['closed'] = self.closed state['points'] = [Point(h.pos()) for h in self.getHandles()] return state def saveState(self): state = ROI.saveState(self) state['closed'] = self.closed state['points'] = [tuple(h.pos()) for h in self.getHandles()] return state def setState(self, state): ROI.setState(self, state) self.setPoints(state['points'], closed=state['closed']) def addSegment(self, h1, h2, index=None): seg = _PolyLineSegment(handles=(h1, h2), pen=self.pen, hoverPen=self.hoverPen, parent=self, movable=False) if index is None: self.segments.append(seg) else: self.segments.insert(index, seg) seg.sigClicked.connect(self.segmentClicked) seg.setAcceptedMouseButtons(QtCore.Qt.MouseButton.LeftButton) seg.setZValue(self.zValue()+1) for h in seg.handles: h['item'].setDeletable(True) h['item'].setAcceptedMouseButtons(h['item'].acceptedMouseButtons() | QtCore.Qt.MouseButton.LeftButton) ## have these handles take left clicks too, so that handles cannot be added on top of other handles def setMouseHover(self, hover): ## Inform all the ROI's segments that the mouse is(not) hovering over it ROI.setMouseHover(self, hover) for s in self.segments: s.setParentHover(hover) def addHandle(self, info, index=None): h = ROI.addHandle(self, info, index=index) h.sigRemoveRequested.connect(self.removeHandle) self.stateChanged(finish=True) return h def segmentClicked(self, segment, ev=None, pos=None): ## pos should be in this item's coordinate system if ev is not None: pos = segment.mapToParent(ev.pos()) elif pos is None: raise Exception("Either an event or a position must be given.") h2 = segment.handles[1]['item'] i = self.segments.index(segment) h3 = self.addFreeHandle(pos, index=self.indexOfHandle(h2)) self.addSegment(h3, h2, index=i+1) segment.replaceHandle(h2, h3) def removeHandle(self, handle, updateSegments=True): ROI.removeHandle(self, handle) handle.sigRemoveRequested.disconnect(self.removeHandle) if not updateSegments: return segments = handle.rois[:] if len(segments) == 1: self.removeSegment(segments[0]) elif len(segments) > 1: handles = [h['item'] for h in segments[1].handles] handles.remove(handle) segments[0].replaceHandle(handle, handles[0]) self.removeSegment(segments[1]) self.stateChanged(finish=True) def removeSegment(self, seg): for handle in seg.handles[:]: seg.removeHandle(handle['item']) self.segments.remove(seg) seg.sigClicked.disconnect(self.segmentClicked) self.scene().removeItem(seg) def checkRemoveHandle(self, h): ## called when a handle is about to display its context menu if self.closed: return len(self.handles) > 3 else: return len(self.handles) > 2 def paint(self, p, *args): pass def boundingRect(self): return self.shape().boundingRect() def shape(self): p = QtGui.QPainterPath() if len(self.handles) == 0: return p p.moveTo(self.handles[0]['item'].pos()) for i in range(len(self.handles)): p.lineTo(self.handles[i]['item'].pos()) p.lineTo(self.handles[0]['item'].pos()) return p def getArrayRegion(self, *args, **kwds): return self._getArrayRegionForArbitraryShape(*args, **kwds) def setPen(self, *args, **kwds): ROI.setPen(self, *args, **kwds) for seg in self.segments: seg.setPen(*args, **kwds) class LineSegmentROI(ROI): r""" ROI subclass with two freely-moving handles defining a line. ============== ============================================================= **Arguments** positions (list of two length-2 sequences) The endpoints of the line segment. Note that, unlike the handle positions specified in other ROIs, these positions must be expressed in the normal coordinate system of the ROI, rather than (0 to 1) relative to the size of the ROI. \**args All extra keyword arguments are passed to ROI() ============== ============================================================= """ def __init__(self, positions=(None, None), pos=None, handles=(None,None), **args): if pos is None: pos = [0,0] ROI.__init__(self, pos, [1,1], **args) if len(positions) > 2: raise Exception("LineSegmentROI must be defined by exactly 2 positions. For more points, use PolyLineROI.") for i, p in enumerate(positions): self.addFreeHandle(p, item=handles[i]) @property def endpoints(self): # must not be cached because self.handles may change. return [h['item'] for h in self.handles] def listPoints(self): return [p['item'].pos() for p in self.handles] def getState(self): state = ROI.getState(self) state['points'] = [Point(h.pos()) for h in self.getHandles()] return state def saveState(self): state = ROI.saveState(self) state['points'] = [tuple(h.pos()) for h in self.getHandles()] return state def setState(self, state): ROI.setState(self, state) p1 = [state['points'][0][0]+state['pos'][0], state['points'][0][1]+state['pos'][1]] p2 = [state['points'][1][0]+state['pos'][0], state['points'][1][1]+state['pos'][1]] self.movePoint(self.getHandles()[0], p1, finish=False) self.movePoint(self.getHandles()[1], p2) def paint(self, p, *args): p.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing) p.setPen(self.currentPen) h1 = self.endpoints[0].pos() h2 = self.endpoints[1].pos() p.drawLine(h1, h2) def boundingRect(self): return self.shape().boundingRect() def shape(self): p = QtGui.QPainterPath() h1 = self.endpoints[0].pos() h2 = self.endpoints[1].pos() dh = h2-h1 if dh.length() == 0: return p pxv = self.pixelVectors(dh)[1] if pxv is None: return p pxv *= 4 p.moveTo(h1+pxv) p.lineTo(h2+pxv) p.lineTo(h2-pxv) p.lineTo(h1-pxv) p.lineTo(h1+pxv) return p def getArrayRegion(self, data, img, axes=(0,1), order=1, returnMappedCoords=False, **kwds): """ Use the position of this ROI relative to an imageItem to pull a slice from an array. Since this pulls 1D data from a 2D coordinate system, the return value will have ndim = data.ndim-1 See :meth:`~pyqtgraph.ROI.getArrayRegion` for a description of the arguments. """ imgPts = [self.mapToItem(img, h.pos()) for h in self.endpoints] d = Point(imgPts[1] - imgPts[0]) o = Point(imgPts[0]) rgn = fn.affineSlice(data, shape=(int(d.length()),), vectors=[Point(d.norm())], origin=o, axes=axes, order=order, returnCoords=returnMappedCoords, **kwds) return rgn class _PolyLineSegment(LineSegmentROI): # Used internally by PolyLineROI def __init__(self, *args, **kwds): self._parentHovering = False LineSegmentROI.__init__(self, *args, **kwds) def setParentHover(self, hover): # set independently of own hover state if self._parentHovering != hover: self._parentHovering = hover self._updateHoverColor() def _makePen(self): if self.mouseHovering or self._parentHovering: return self.hoverPen else: return self.pen def hoverEvent(self, ev): # accept drags even though we discard them to prevent competition with parent ROI # (unless parent ROI is not movable) if self.parentItem().translatable: ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton) return LineSegmentROI.hoverEvent(self, ev) class CrosshairROI(ROI): """A crosshair ROI whose position is at the center of the crosshairs. By default, it is scalable, rotatable and translatable.""" def __init__(self, pos=None, size=None, **kargs): if size is None: size=[1,1] if pos is None: pos = [0,0] self._shape = None ROI.__init__(self, pos, size, aspectLocked=True, **kargs) self.sigRegionChanged.connect(self.invalidate) self.addScaleRotateHandle(Point(1, 0), Point(0, 0)) def invalidate(self): self._shape = None self.prepareGeometryChange() def boundingRect(self): return self.shape().boundingRect() def shape(self): if self._shape is None: radius = self.getState()['size'][1] p = QtGui.QPainterPath() p.moveTo(Point(0, -radius)) p.lineTo(Point(0, radius)) p.moveTo(Point(-radius, 0)) p.lineTo(Point(radius, 0)) p = self.mapToDevice(p) stroker = QtGui.QPainterPathStroker() stroker.setWidth(10) outline = stroker.createStroke(p) self._shape = self.mapFromDevice(outline) return self._shape def paint(self, p, *args): radius = self.getState()['size'][1] p.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing) p.setPen(self.currentPen) p.drawLine(Point(0, -radius), Point(0, radius)) p.drawLine(Point(-radius, 0), Point(radius, 0)) class RulerROI(LineSegmentROI): def paint(self, p, *args): LineSegmentROI.paint(self, p, *args) h1 = self.handles[0]['item'].pos() h2 = self.handles[1]['item'].pos() p1 = p.transform().map(h1) p2 = p.transform().map(h2) vec = Point(h2) - Point(h1) length = vec.length() angle = vec.angle(Point(1, 0)) pvec = p2 - p1 pvecT = Point(pvec.y(), -pvec.x()) pos = 0.5 * (p1 + p2) + pvecT * 40 / pvecT.length() p.resetTransform() txt = fn.siFormat(length, suffix='m') + '\n%0.1f deg' % angle p.drawText(QtCore.QRectF(pos.x()-50, pos.y()-50, 100, 100), QtCore.Qt.AlignmentFlag.AlignCenter, txt) def boundingRect(self): r = LineSegmentROI.boundingRect(self) pxl = self.pixelLength(Point([1, 0])) if pxl is None: return r pxw = 50 * pxl return r.adjusted(-50, -50, 50, 50) class TriangleROI(ROI): r""" Equilateral triangle ROI subclass with one scale handle and one rotation handle. Arguments pos (length-2 sequence) The position of the ROI's origin. size (float) The length of an edge of the triangle. \**args All extra keyword arguments are passed to ROI() ============== ============================================================= """ def __init__(self, pos, size, **args): ROI.__init__(self, pos, [size, size], aspectLocked=True, **args) angles = np.linspace(0, np.pi * 4 / 3, 3) verticies = (np.array((np.sin(angles), np.cos(angles))).T + 1.0) / 2.0 self.poly = QtGui.QPolygonF() for pt in verticies: self.poly.append(QtCore.QPointF(*pt)) self.addRotateHandle(verticies[0], [0.5, 0.5]) self.addScaleHandle(verticies[1], [0.5, 0.5]) def paint(self, p, *args): r = self.boundingRect() p.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing) p.scale(r.width(), r.height()) p.setPen(self.currentPen) p.drawPolygon(self.poly) def shape(self): self.path = QtGui.QPainterPath() r = self.boundingRect() # scale the path to match whats on the screen t = QtGui.QTransform() t.scale(r.width(), r.height()) self.path.addPolygon(self.poly) return t.map(self.path) def getArrayRegion(self, *args, **kwds): return self._getArrayRegionForArbitraryShape(*args, **kwds) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ScaleBar.py000066400000000000000000000044361457240071200245130ustar00rootroot00000000000000from .. import functions as fn from .. import getConfigOption from ..Point import Point from ..Qt import QtCore, QtWidgets from .GraphicsObject import GraphicsObject from .GraphicsWidgetAnchor import GraphicsWidgetAnchor from .TextItem import TextItem __all__ = ['ScaleBar'] class ScaleBar(GraphicsWidgetAnchor, GraphicsObject): """ Displays a rectangular bar to indicate the relative scale of objects on the view. """ def __init__(self, size, width=5, brush=None, pen=None, suffix='m', offset=None): GraphicsObject.__init__(self) GraphicsWidgetAnchor.__init__(self) self.setFlag(self.GraphicsItemFlag.ItemHasNoContents) self.setAcceptedMouseButtons(QtCore.Qt.MouseButton.NoButton) if brush is None: brush = getConfigOption('foreground') self.brush = fn.mkBrush(brush) self.pen = fn.mkPen(pen) self._width = width self.size = size if offset is None: offset = (0,0) self.offset = offset self.bar = QtWidgets.QGraphicsRectItem() self.bar.setPen(self.pen) self.bar.setBrush(self.brush) self.bar.setParentItem(self) self.text = TextItem(text=fn.siFormat(size, suffix=suffix), anchor=(0.5,1)) self.text.setParentItem(self) def changeParent(self): view = self.parentItem() if view is None: return view.sigRangeChanged.connect(self.updateBar) self.updateBar() def updateBar(self): view = self.parentItem() if view is None: return p1 = view.mapFromViewToItem(self, QtCore.QPointF(0,0)) p2 = view.mapFromViewToItem(self, QtCore.QPointF(self.size,0)) w = (p2-p1).x() self.bar.setRect(QtCore.QRectF(-w, 0, w, self._width)) self.text.setPos(-w/2., 0) def boundingRect(self): return QtCore.QRectF() def setParentItem(self, p): ret = GraphicsObject.setParentItem(self, p) if self.offset is not None: offset = Point(self.offset) anchorx = 1 if offset[0] <= 0 else 0 anchory = 1 if offset[1] <= 0 else 0 anchor = (anchorx, anchory) self.anchor(itemPos=anchor, parentPos=anchor, offset=offset) return ret pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ScatterPlotItem.py000066400000000000000000001316671457240071200261310ustar00rootroot00000000000000import itertools import math import weakref from collections import OrderedDict import numpy as np from .. import Qt, debug from .. import functions as fn from .. import getConfigOption from ..Point import Point from ..Qt import QtCore, QtGui from .GraphicsObject import GraphicsObject __all__ = ['ScatterPlotItem', 'SpotItem'] ## Build all symbol paths name_list = ['o', 's', 't', 't1', 't2', 't3', 'd', '+', 'x', 'p', 'h', 'star', 'arrow_up', 'arrow_right', 'arrow_down', 'arrow_left', 'crosshair'] Symbols = OrderedDict([(name, QtGui.QPainterPath()) for name in name_list]) Symbols['o'].addEllipse(QtCore.QRectF(-0.5, -0.5, 1, 1)) Symbols['s'].addRect(QtCore.QRectF(-0.5, -0.5, 1, 1)) def makeCrosshair(r=0.5, w=1, h=1): path = QtGui.QPainterPath() rect = QtCore.QRectF(-r, -r, r * 2, r * 2) path.addEllipse(rect) path.moveTo(-w, 0) path.lineTo(w, 0) path.moveTo(0, -h) path.lineTo(0, h) return path Symbols['crosshair'] = makeCrosshair() coords = { 't': [(-0.5, -0.5), (0, 0.5), (0.5, -0.5)], 't1': [(-0.5, 0.5), (0, -0.5), (0.5, 0.5)], 't2': [(-0.5, -0.5), (-0.5, 0.5), (0.5, 0)], 't3': [(0.5, 0.5), (0.5, -0.5), (-0.5, 0)], 'd': [(0., -0.5), (-0.4, 0.), (0, 0.5), (0.4, 0)], '+': [ (-0.5, -0.1), (-0.5, 0.1), (-0.1, 0.1), (-0.1, 0.5), (0.1, 0.5), (0.1, 0.1), (0.5, 0.1), (0.5, -0.1), (0.1, -0.1), (0.1, -0.5), (-0.1, -0.5), (-0.1, -0.1) ], 'p': [(0, -0.5), (-0.4755, -0.1545), (-0.2939, 0.4045), (0.2939, 0.4045), (0.4755, -0.1545)], 'h': [(0.433, 0.25), (0., 0.5), (-0.433, 0.25), (-0.433, -0.25), (0, -0.5), (0.433, -0.25)], 'star': [(0, -0.5), (-0.1123, -0.1545), (-0.4755, -0.1545), (-0.1816, 0.059), (-0.2939, 0.4045), (0, 0.1910), (0.2939, 0.4045), (0.1816, 0.059), (0.4755, -0.1545), (0.1123, -0.1545)], 'arrow_up': [ (-0.125, 0.125), (0, 0), (0.125, 0.125), (0.05, 0.125), (0.05, 0.5), (-0.05, 0.5), (-0.05, 0.125) ] } for k, c in coords.items(): Symbols[k].moveTo(*c[0]) for x,y in c[1:]: Symbols[k].lineTo(x, y) Symbols[k].closeSubpath() tr = QtGui.QTransform() tr.rotate(45) Symbols['x'] = tr.map(Symbols['+']) tr.rotate(45) Symbols['arrow_right'] = tr.map(Symbols['arrow_up']) Symbols['arrow_down'] = tr.map(Symbols['arrow_right']) Symbols['arrow_left'] = tr.map(Symbols['arrow_down']) _DEFAULT_STYLE = {'symbol': None, 'size': -1, 'pen': None, 'brush': None, 'visible': True} def drawSymbol(painter, symbol, size, pen, brush): if symbol is None: return painter.scale(size, size) painter.setPen(pen) painter.setBrush(brush) if isinstance(symbol, str): symbol = Symbols[symbol] if np.isscalar(symbol): symbol = list(Symbols.values())[symbol % len(Symbols)] painter.drawPath(symbol) def renderSymbol(symbol, size, pen, brush, device=None, dpr=1.0): """ Render a symbol specification to QImage. Symbol may be either a QPainterPath or one of the keys in the Symbols dict. If *device* is None, a new QPixmap will be returned. Otherwise, the symbol will be rendered into the device specified (See QPainter documentation for more information). """ ## Render a spot with the given parameters to a pixmap penPxWidth = max(math.ceil(pen.widthF()), 1) if device is None: side = int(math.ceil(dpr*(size+penPxWidth))) device = QtGui.QImage(side, side, QtGui.QImage.Format.Format_ARGB32_Premultiplied) device.setDevicePixelRatio(dpr) device.fill(QtCore.Qt.GlobalColor.transparent) p = QtGui.QPainter(device) try: p.setRenderHint(p.RenderHint.Antialiasing) p.translate(device.width()/dpr*0.5, device.height()/dpr*0.5) drawSymbol(p, symbol, size, pen, brush) finally: p.end() return device def _mkPen(*args, **kwargs): """ Wrapper for fn.mkPen which avoids creating a new QPen object if passed one as its sole argument. This is used to avoid unnecessary cache misses in SymbolAtlas which uses the QPen object id in its key. """ if len(args) == 1 and isinstance(args[0], QtGui.QPen): return args[0] else: return fn.mkPen(*args, **kwargs) def _mkBrush(*args, **kwargs): """ Wrapper for fn.mkBrush which avoids creating a new QBrush object if passed one as its sole argument. This is used to avoid unnecessary cache misses in SymbolAtlas which uses the QBrush object id in its key. """ if len(args) == 1 and isinstance(args[0], QtGui.QBrush): return args[0] else: return fn.mkBrush(*args, **kwargs) class SymbolAtlas(object): """ Used to efficiently construct a single QPixmap containing all rendered symbols for a ScatterPlotItem. This is required for fragment rendering. Use example: atlas = SymbolAtlas() sc1 = atlas[[('o', 5, QPen(..), QBrush(..))]] sc2 = atlas[[('t', 10, QPen(..), QBrush(..))]] pm = atlas.pixmap """ _idGenerator = itertools.count() def __init__(self): self._dpr = 1.0 self.clear() def __getitem__(self, styles): """ Given a list of tuples, (symbol, size, pen, brush), return a list of coordinates of corresponding symbols within the atlas. Note that these coordinates may change if the atlas is rebuilt. """ keys = self._keys(styles) new = {key: style for key, style in zip(keys, styles) if key not in self._coords} if new: self._extend(new) return list(map(self._coords.__getitem__, keys)) def __len__(self): return len(self._coords) def devicePixelRatio(self): return self._dpr def setDevicePixelRatio(self, dpr): self._dpr = dpr @property def pixmap(self): if self._pixmap is None: self._pixmap = self._createPixmap() return self._pixmap @property def maxWidth(self): # return the max logical width return self._maxWidth / self._dpr def rebuild(self, styles=None): profiler = debug.Profiler() # noqa: profiler prints on GC if styles is None: data = [] else: keys = set(self._keys(styles)) data = list(self._itemData(keys)) self.clear() if data: self._extendFromData(data) def clear(self): self._data = np.zeros((0, 0, 4), dtype=np.ubyte) # numpy array of atlas image self._coords = {} self._pixmap = None self._maxWidth = 0 self._totalWidth = 0 self._totalArea = 0 self._pos = (0, 0) self._rowShape = (0, 0) def diagnostics(self): n = len(self) w, h, _ = self._data.shape a = self._totalArea return dict(count=n, width=w, height=h, area=w * h, area_used=1.0 if n == 0 else a / (w * h), squareness=1.0 if n == 0 else 2 * w * h / (w**2 + h**2)) def _keys(self, styles): def getId(obj): try: return obj._id except AttributeError: obj._id = next(SymbolAtlas._idGenerator) return obj._id return [ (symbol if isinstance(symbol, (str, int)) else getId(symbol), size, getId(pen), getId(brush)) for symbol, size, pen, brush in styles ] def _itemData(self, keys): for key in keys: y, x, h, w = self._coords[key] yield key, self._data[x:x + w, y:y + h] def _extend(self, styles): profiler = debug.Profiler() images = [] data = [] for key, style in styles.items(): img = renderSymbol(*style, dpr=self._dpr) arr = fn.ndarray_from_qimage(img) images.append(img) # keep these to delay garbage collection data.append((key, arr)) profiler('render') self._extendFromData(data) profiler('insert') def _extendFromData(self, data): self._pack(data) # expand array if necessary wNew, hNew = self._minDataShape() wOld, hOld, _ = self._data.shape if (wNew > wOld) or (hNew > hOld): arr = np.zeros((wNew, hNew, 4), dtype=np.ubyte) arr[:wOld, :hOld] = self._data self._data = arr # insert data into array for key, arr in data: y, x, h, w = self._coords[key] self._data[x:x+w, y:y+h] = arr self._pixmap = None def _pack(self, data): # pack each item rectangle as efficiently as possible into a larger, expanding, approximate square n = len(self) wMax = self._maxWidth wSum = self._totalWidth aSum = self._totalArea x, y = self._pos wRow, hRow = self._rowShape # update packing statistics for _, arr in data: w, h, _ = arr.shape wMax = max(w, wMax) wSum += w aSum += w * h n += len(data) # maybe expand row width for squareness and to accommodate largest width wRowEst = int(wSum / (n ** 0.5)) if wRowEst > 2 * wRow: wRow = wRowEst wRow = max(wMax, wRow) # set coordinates by packing along rows # sort by rectangle height first to improve packing density for key, arr in sorted(data, key=lambda data: data[1].shape[1]): w, h, _ = arr.shape if x + w > wRow: # move up a row x = 0 y += hRow hRow = h hRow = max(h, hRow) self._coords[key] = (y, x, h, w) x += w self._maxWidth = wMax self._totalWidth = wSum self._totalArea = aSum self._pos = (x, y) self._rowShape = (wRow, hRow) def _minDataShape(self): x, y = self._pos w, h = self._rowShape return int(w), int(y + h) def _createPixmap(self): profiler = debug.Profiler() # noqa: profiler prints on GC if self._data.size == 0: pm = QtGui.QPixmap(0, 0) else: img = fn.ndarray_to_qimage(self._data, QtGui.QImage.Format.Format_ARGB32_Premultiplied) pm = QtGui.QPixmap(img) return pm class ScatterPlotItem(GraphicsObject): """ Displays a set of x/y points. Instances of this class are created automatically as part of PlotDataItem; these rarely need to be instantiated directly. The size, shape, pen, and fill brush may be set for each point individually or for all points. ============================ =============================================== **Signals:** sigPlotChanged(self) Emitted when the data being plotted has changed sigClicked(self, points, ev) Emitted when points are clicked. Sends a list of all the points under the mouse pointer. sigHovered(self, points, ev) Emitted when the item is hovered. Sends a list of all the points under the mouse pointer. ============================ =============================================== """ #sigPointClicked = QtCore.Signal(object, object) sigClicked = QtCore.Signal(object, object, object) sigHovered = QtCore.Signal(object, object, object) sigPlotChanged = QtCore.Signal(object) def __init__(self, *args, **kargs): """ Accepts the same arguments as setData() """ profiler = debug.Profiler() GraphicsObject.__init__(self) self.picture = None # QPicture used for rendering when pxmode==False self.fragmentAtlas = SymbolAtlas() dtype = [ ('x', float), ('y', float), ('size', float), ('symbol', object), ('pen', object), ('brush', object), ('visible', bool), ('data', object), ('hovered', bool), ('item', object), ('sourceRect', [ ('x', int), ('y', int), ('w', int), ('h', int) ]) ] self.data = np.empty(0, dtype=dtype) self.bounds = [None, None] ## caches data bounds self._maxSpotWidth = 0 ## maximum size of the scale-variant portion of all spots self._maxSpotPxWidth = 0 ## maximum size of the scale-invariant portion of all spots self._pixmapFragments = Qt.internals.PrimitiveArray(QtGui.QPainter.PixmapFragment, 10) self.opts = { 'pxMode': True, 'useCache': True, ## If useCache is False, symbols are re-drawn on every paint. 'antialias': getConfigOption('antialias'), 'compositionMode': None, 'name': None, 'symbol': 'o', 'size': 7, 'pen': fn.mkPen(getConfigOption('foreground')), 'brush': fn.mkBrush(100, 100, 150), 'hoverable': False, 'tip': 'x: {x:.3g}\ny: {y:.3g}\ndata={data}'.format, } self.opts.update( {'hover' + opt.title(): _DEFAULT_STYLE[opt] for opt in ['symbol', 'size', 'pen', 'brush']} ) profiler() self.setData(*args, **kargs) profiler('setData') #self.setCacheMode(self.DeviceCoordinateCache) # track when the tooltip is cleared so we only clear it once # this allows another item in the VB to set the tooltip self._toolTipCleared = True def setData(self, *args, **kargs): """ **Ordered Arguments:** * If there is only one unnamed argument, it will be interpreted like the 'spots' argument. * If there are two unnamed arguments, they will be interpreted as sequences of x and y values. ====================== =============================================================================================== **Keyword Arguments:** *spots* Optional list of dicts. Each dict specifies parameters for a single spot: {'pos': (x,y), 'size', 'pen', 'brush', 'symbol'}. This is just an alternate method of passing in data for the corresponding arguments. *x*,*y* 1D arrays of x,y values. *pos* 2D structure of x,y pairs (such as Nx2 array or list of tuples) *pxMode* If True, spots are always the same size regardless of scaling, and size is given in px. Otherwise, size is in scene coordinates and the spots scale with the view. To ensure effective caching, QPen and QBrush objects should be reused as much as possible. Default is True *symbol* can be one (or a list) of symbols. For a list of supported symbols, see :func:`~ScatterPlotItem.setSymbol`. QPainterPath is also supported to specify custom symbol shapes. To properly obey the position and size, custom symbols should be centered at (0,0) and width and height of 1.0. Note that it is also possible to 'install' custom shapes by setting ScatterPlotItem.Symbols[key] = shape. *pen* The pen (or list of pens) to use for drawing spot outlines. *brush* The brush (or list of brushes) to use for filling spots. *size* The size (or list of sizes) of spots. If *pxMode* is True, this value is in pixels. Otherwise, it is in the item's local coordinate system. *data* a list of python objects used to uniquely identify each spot. *hoverable* If True, sigHovered is emitted with a list of hovered points, a tool tip is shown containing information about them, and an optional separate style for them is used. Default is False. *tip* A string-valued function of a spot's (x, y, data) values. Set to None to prevent a tool tip from being shown. *hoverSymbol* A single symbol to use for hovered spots. Set to None to keep symbol unchanged. Default is None. *hoverSize* A single size to use for hovered spots. Set to -1 to keep size unchanged. Default is -1. *hoverPen* A single pen to use for hovered spots. Set to None to keep pen unchanged. Default is None. *hoverBrush* A single brush to use for hovered spots. Set to None to keep brush unchanged. Default is None. *useCache* (bool) By default, generated point graphics items are cached to improve performance. Setting this to False can improve image quality in certain situations. *antialias* Whether to draw symbols with antialiasing. Note that if pxMode is True, symbols are always rendered with antialiasing (since the rendered symbols can be cached, this incurs very little performance cost) *compositionMode* If specified, this sets the composition mode used when drawing the scatter plot (see QPainter::CompositionMode in the Qt documentation). *name* The name of this item. Names are used for automatically generating LegendItem entries and by some exporters. ====================== =============================================================================================== """ oldData = self.data ## this causes cached pixmaps to be preserved while new data is registered. self.clear() ## clear out all old data self.addPoints(*args, **kargs) def addPoints(self, *args, **kargs): """ Add new points to the scatter plot. Arguments are the same as setData() """ ## deal with non-keyword arguments if len(args) == 1: kargs['spots'] = args[0] elif len(args) == 2: kargs['x'] = args[0] kargs['y'] = args[1] elif len(args) > 2: raise Exception('Only accepts up to two non-keyword arguments.') ## convert 'pos' argument to 'x' and 'y' if 'pos' in kargs: pos = kargs['pos'] if isinstance(pos, np.ndarray): kargs['x'] = pos[:,0] kargs['y'] = pos[:,1] else: x = [] y = [] for p in pos: if isinstance(p, QtCore.QPointF): x.append(p.x()) y.append(p.y()) else: x.append(p[0]) y.append(p[1]) kargs['x'] = x kargs['y'] = y ## determine how many spots we have if 'spots' in kargs: numPts = len(kargs['spots']) elif 'y' in kargs and kargs['y'] is not None: numPts = len(kargs['y']) else: kargs['x'] = [] kargs['y'] = [] numPts = 0 ## Clear current SpotItems since the data references they contain will no longer be current self.data['item'][...] = None ## Extend record array oldData = self.data self.data = np.empty(len(oldData)+numPts, dtype=self.data.dtype) ## note that np.empty initializes object fields to None and string fields to '' self.data[:len(oldData)] = oldData #for i in range(len(oldData)): #oldData[i]['item']._data = self.data[i] ## Make sure items have proper reference to new array newData = self.data[len(oldData):] newData['size'] = -1 ## indicates to use default size newData['visible'] = True if 'spots' in kargs: spots = kargs['spots'] for i in range(len(spots)): spot = spots[i] for k in spot: if k == 'pos': pos = spot[k] if isinstance(pos, QtCore.QPointF): x,y = pos.x(), pos.y() else: x,y = pos[0], pos[1] newData[i]['x'] = x newData[i]['y'] = y elif k == 'pen': newData[i][k] = _mkPen(spot[k]) elif k == 'brush': newData[i][k] = _mkBrush(spot[k]) elif k in ['x', 'y', 'size', 'symbol', 'data']: newData[i][k] = spot[k] else: raise Exception("Unknown spot parameter: %s" % k) elif 'y' in kargs: newData['x'] = kargs['x'] newData['y'] = kargs['y'] if 'name' in kargs: self.opts['name'] = kargs['name'] if 'pxMode' in kargs: self.setPxMode(kargs['pxMode']) if 'antialias' in kargs: self.opts['antialias'] = kargs['antialias'] if 'hoverable' in kargs: self.opts['hoverable'] = bool(kargs['hoverable']) if 'tip' in kargs: self.opts['tip'] = kargs['tip'] if 'useCache' in kargs: self.opts['useCache'] = kargs['useCache'] ## Set any extra parameters provided in keyword arguments for k in ['pen', 'brush', 'symbol', 'size']: if k in kargs: setMethod = getattr(self, 'set' + k[0].upper() + k[1:]) setMethod(kargs[k], update=False, dataSet=newData, mask=kargs.get('mask', None)) kh = 'hover' + k.title() if kh in kargs: vh = kargs[kh] if k == 'pen': vh = _mkPen(vh) elif k == 'brush': vh = _mkBrush(vh) self.opts[kh] = vh if 'data' in kargs: self.setPointData(kargs['data'], dataSet=newData) self.prepareGeometryChange() self.informViewBoundsChanged() self.bounds = [None, None] self.invalidate() self.updateSpots(newData) self.sigPlotChanged.emit(self) def invalidate(self): ## clear any cached drawing state self.picture = None self.update() def getData(self): return self.data['x'], self.data['y'] def implements(self, interface=None): ints = ['plotData'] if interface is None: return ints return interface in ints def name(self): return self.opts.get('name', None) def setPen(self, *args, **kargs): """Set the pen(s) used to draw the outline around each spot. If a list or array is provided, then the pen for each spot will be set separately. Otherwise, the arguments are passed to pg.mkPen and used as the default pen for all spots which do not have a pen explicitly set.""" update = kargs.pop('update', True) dataSet = kargs.pop('dataSet', self.data) if len(args) == 1 and (isinstance(args[0], np.ndarray) or isinstance(args[0], list)): pens = args[0] if 'mask' in kargs and kargs['mask'] is not None: pens = pens[kargs['mask']] if len(pens) != len(dataSet): raise Exception("Number of pens does not match number of points (%d != %d)" % (len(pens), len(dataSet))) dataSet['pen'] = list(map(_mkPen, pens)) else: self.opts['pen'] = _mkPen(*args, **kargs) dataSet['sourceRect'] = 0 if update: self.updateSpots(dataSet) def setBrush(self, *args, **kargs): """Set the brush(es) used to fill the interior of each spot. If a list or array is provided, then the brush for each spot will be set separately. Otherwise, the arguments are passed to pg.mkBrush and used as the default brush for all spots which do not have a brush explicitly set.""" update = kargs.pop('update', True) dataSet = kargs.pop('dataSet', self.data) if len(args) == 1 and (isinstance(args[0], np.ndarray) or isinstance(args[0], list)): brushes = args[0] if 'mask' in kargs and kargs['mask'] is not None: brushes = brushes[kargs['mask']] if len(brushes) != len(dataSet): raise Exception("Number of brushes does not match number of points (%d != %d)" % (len(brushes), len(dataSet))) dataSet['brush'] = list(map(_mkBrush, brushes)) else: self.opts['brush'] = _mkBrush(*args, **kargs) dataSet['sourceRect'] = 0 if update: self.updateSpots(dataSet) def setSymbol(self, symbol, update=True, dataSet=None, mask=None): """Set the symbol(s) used to draw each spot. If a list or array is provided, then the symbol for each spot will be set separately. Otherwise, the argument will be used as the default symbol for all spots which do not have a symbol explicitly set. **Supported symbols:** * 'o' circle (default) * 's' square * 't' triangle * 'd' diamond * '+' plus * 't1' triangle pointing upwards * 't2' triangle pointing right side * 't3' triangle pointing left side * 'p' pentagon * 'h' hexagon * 'star' * 'x' cross * 'arrow_up' * 'arrow_right' * 'arrow_down' * 'arrow_left' * 'crosshair' * any QPainterPath to specify custom symbol shapes. """ if dataSet is None: dataSet = self.data if isinstance(symbol, np.ndarray) or isinstance(symbol, list): symbols = symbol if mask is not None: symbols = symbols[mask] if len(symbols) != len(dataSet): raise Exception("Number of symbols does not match number of points (%d != %d)" % (len(symbols), len(dataSet))) dataSet['symbol'] = symbols else: self.opts['symbol'] = symbol self._spotPixmap = None dataSet['sourceRect'] = 0 if update: self.updateSpots(dataSet) def setSize(self, size, update=True, dataSet=None, mask=None): """Set the size(s) used to draw each spot. If a list or array is provided, then the size for each spot will be set separately. Otherwise, the argument will be used as the default size for all spots which do not have a size explicitly set.""" if dataSet is None: dataSet = self.data if isinstance(size, np.ndarray) or isinstance(size, list): sizes = size if mask is not None: sizes = sizes[mask] if len(sizes) != len(dataSet): raise Exception("Number of sizes does not match number of points (%d != %d)" % (len(sizes), len(dataSet))) dataSet['size'] = sizes else: self.opts['size'] = size self._spotPixmap = None dataSet['sourceRect'] = 0 if update: self.updateSpots(dataSet) def setPointsVisible(self, visible, update=True, dataSet=None, mask=None): """Set whether or not each spot is visible. If a list or array is provided, then the visibility for each spot will be set separately. Otherwise, the argument will be used for all spots.""" if dataSet is None: dataSet = self.data if isinstance(visible, np.ndarray) or isinstance(visible, list): visibilities = visible if mask is not None: visibilities = visibilities[mask] if len(visibilities) != len(dataSet): raise Exception("Number of visibilities does not match number of points (%d != %d)" % (len(visibilities), len(dataSet))) dataSet['visible'] = visibilities else: dataSet['visible'] = visible dataSet['sourceRect'] = 0 if update: self.updateSpots(dataSet) def setPointData(self, data, dataSet=None, mask=None): if dataSet is None: dataSet = self.data if isinstance(data, np.ndarray) or isinstance(data, list): if mask is not None: data = data[mask] if len(data) != len(dataSet): raise Exception("Length of meta data does not match number of points (%d != %d)" % (len(data), len(dataSet))) ## Bug: If data is a numpy record array, then items from that array must be copied to dataSet one at a time. ## (otherwise they are converted to tuples and thus lose their field names. if isinstance(data, np.ndarray) and (data.dtype.fields is not None)and len(data.dtype.fields) > 1: for i, rec in enumerate(data): dataSet['data'][i] = rec else: dataSet['data'] = data def setPxMode(self, mode): if self.opts['pxMode'] == mode: return self.opts['pxMode'] = mode self.invalidate() def updateSpots(self, dataSet=None): profiler = debug.Profiler() # noqa: profiler prints on GC if dataSet is None: dataSet = self.data invalidate = False if self.opts['pxMode'] and self.opts['useCache']: mask = dataSet['sourceRect']['w'] == 0 if np.any(mask): invalidate = True coords = self.fragmentAtlas[ list(zip(*self._style(['symbol', 'size', 'pen', 'brush'], data=dataSet, idx=mask))) ] dataSet['sourceRect'][mask] = coords self._maybeRebuildAtlas() else: invalidate = True self._updateMaxSpotSizes(data=dataSet) if invalidate: self.invalidate() def _maybeRebuildAtlas(self, threshold=4, minlen=1000): n = len(self.fragmentAtlas) if (n > minlen) and (n > threshold * len(self.data)): self.fragmentAtlas.rebuild( list(zip(*self._style(['symbol', 'size', 'pen', 'brush']))) ) self.data['sourceRect'] = 0 self.updateSpots() def _style(self, opts, data=None, idx=None, scale=None): if data is None: data = self.data if idx is None: idx = np.s_[:] for opt in opts: col = data[opt][idx] if col.base is not None: col = col.copy() if self.opts['hoverable']: val = self.opts['hover' + opt.title()] if val != _DEFAULT_STYLE[opt]: col[data['hovered'][idx]] = val col[np.equal(col, _DEFAULT_STYLE[opt])] = self.opts[opt] if opt == 'size' and scale is not None: col *= scale yield col def _updateMaxSpotSizes(self, **kwargs): if self.opts['pxMode'] and self.opts['useCache']: w, pw = 0, self.fragmentAtlas.maxWidth else: w, pw = max(itertools.chain([(self._maxSpotWidth, self._maxSpotPxWidth)], self._measureSpotSizes(**kwargs))) self._maxSpotWidth = w self._maxSpotPxWidth = pw self.bounds = [None, None] def _measureSpotSizes(self, **kwargs): """Generate pairs (width, pxWidth) for spots in data""" styles = zip(*self._style(['size', 'pen'], **kwargs)) if self.opts['pxMode']: for size, pen in styles: yield 0, size + pen.widthF() else: for size, pen in styles: if pen.isCosmetic(): yield size, pen.widthF() else: yield size + pen.widthF(), 0 def clear(self): """Remove all spots from the scatter plot""" #self.clearItems() self._maxSpotWidth = 0 self._maxSpotPxWidth = 0 self.data = np.empty(0, dtype=self.data.dtype) self.bounds = [None, None] self.invalidate() def dataBounds(self, ax, frac=1.0, orthoRange=None): if frac >= 1.0 and orthoRange is None and self.bounds[ax] is not None: return self.bounds[ax] #self.prepareGeometryChange() if self.data is None or len(self.data) == 0: return (None, None) if ax == 0: d = self.data['x'] d2 = self.data['y'] elif ax == 1: d = self.data['y'] d2 = self.data['x'] else: raise ValueError("Invalid axis value") if orthoRange is not None: mask = (d2 >= orthoRange[0]) * (d2 <= orthoRange[1]) d = d[mask] if d.size == 0: return (None, None) if frac >= 1.0: self.bounds[ax] = (np.nanmin(d) - self._maxSpotWidth*0.7072, np.nanmax(d) + self._maxSpotWidth*0.7072) return self.bounds[ax] elif frac <= 0.0: raise Exception("Value for parameter 'frac' must be > 0. (got %s)" % str(frac)) else: mask = np.isfinite(d) d = d[mask] return np.percentile(d, [50 * (1 - frac), 50 * (1 + frac)]) def pixelPadding(self): return self._maxSpotPxWidth*0.7072 def boundingRect(self): (xmn, xmx) = self.dataBounds(ax=0) (ymn, ymx) = self.dataBounds(ax=1) if xmn is None or xmx is None: xmn = 0 xmx = 0 if ymn is None or ymx is None: ymn = 0 ymx = 0 px = py = 0.0 pxPad = self.pixelPadding() if pxPad > 0: # determine length of pixel in local x, y directions px, py = self.pixelVectors() try: px = 0 if px is None else px.length() except OverflowError: px = 0 try: py = 0 if py is None else py.length() except OverflowError: py = 0 # return bounds expanded by pixel size px *= pxPad py *= pxPad return QtCore.QRectF(xmn-px, ymn-py, (2*px)+xmx-xmn, (2*py)+ymx-ymn) def viewTransformChanged(self): self.prepareGeometryChange() GraphicsObject.viewTransformChanged(self) self.bounds = [None, None] def setExportMode(self, *args, **kwds): GraphicsObject.setExportMode(self, *args, **kwds) self.invalidate() @debug.warnOnException ## raising an exception here causes crash def paint(self, p, option, widget): profiler = debug.Profiler() cmode = self.opts.get('compositionMode', None) if cmode is not None: p.setCompositionMode(cmode) #p.setPen(fn.mkPen('r')) #p.drawRect(self.boundingRect()) if self._exportOpts is not False: aa = self._exportOpts.get('antialias', True) scale = self._exportOpts.get('resolutionScale', 1.0) ## exporting to image; pixel resolution may have changed else: aa = self.opts['antialias'] scale = 1.0 if self.opts['pxMode'] is True: # Cull points that are outside view viewMask = self._maskAt(self.viewRect()) # Map points using painter's world transform so they are drawn with pixel-valued sizes pts = np.vstack([self.data['x'], self.data['y']]) pts = fn.transformCoordinates(p.transform(), pts) pts = fn.clip_array(pts, -2 ** 30, 2 ** 30) # prevent Qt segmentation fault. p.resetTransform() if self.opts['useCache'] and self._exportOpts is False: # Draw symbols from pre-rendered atlas dpr = self.fragmentAtlas.devicePixelRatio() if widget is not None and (dpr_new := widget.devicePixelRatioF()) != dpr: # force a re-render if dpr changed dpr = dpr_new self.fragmentAtlas.setDevicePixelRatio(dpr) self.fragmentAtlas.clear() self.data['sourceRect'] = 0 self.updateSpots() # x, y is the center of the target rect xy = pts[:, viewMask].T sr = self.data['sourceRect'][viewMask] self._pixmapFragments.resize(sr.size) frags = self._pixmapFragments.ndarray() frags[:, 0:2] = xy frags[:, 2:6] = np.frombuffer(sr, dtype=int).reshape((-1, 4)) # sx, sy, sw, sh frags[:, 6:10] = [1/dpr, 1/dpr, 0.0, 1.0] # scaleX, scaleY, rotation, opacity profiler('prep') drawargs = self._pixmapFragments.drawargs() p.drawPixmapFragments(*drawargs, self.fragmentAtlas.pixmap) profiler('draw') else: # render each symbol individually p.setRenderHint(p.RenderHint.Antialiasing, aa) for pt, style in zip( pts[:, viewMask].T, zip(*(self._style(['symbol', 'size', 'pen', 'brush'], idx=viewMask, scale=scale))) ): p.resetTransform() p.translate(*pt) drawSymbol(p, *style) else: if self.picture is None: self.picture = QtGui.QPicture() p2 = QtGui.QPainter(self.picture) for x, y, style in zip( self.data['x'], self.data['y'], zip(*self._style(['symbol', 'size', 'pen', 'brush'], scale=scale)) ): p2.resetTransform() p2.translate(x, y) drawSymbol(p2, *style) p2.end() p.setRenderHint(p.RenderHint.Antialiasing, aa) self.picture.play(p) def points(self): m = np.equal(self.data['item'], None) for i in np.argwhere(m)[:, 0]: rec = self.data[i] if rec['item'] is None: rec['item'] = SpotItem(rec, self, i) return self.data['item'] def pointsAt(self, pos): return self.points()[self._maskAt(pos)][::-1] def _maskAt(self, obj): """ Return a boolean mask indicating all points that overlap obj, a QPointF or QRectF. """ if isinstance(obj, QtCore.QPointF): l = r = obj.x() t = b = obj.y() elif isinstance(obj, QtCore.QRectF): l = obj.left() r = obj.right() t = obj.top() b = obj.bottom() else: raise TypeError if self.opts['pxMode'] and self.opts['useCache']: w = self.data['sourceRect']['w'] h = self.data['sourceRect']['h'] else: s, = self._style(['size']) w = h = s w = w / 2 h = h / 2 if self.opts['pxMode']: # determine length of pixel in local x, y directions px, py = self.pixelVectors() try: px = 0 if px is None else px.length() except OverflowError: px = 0 try: py = 0 if py is None else py.length() except OverflowError: py = 0 w *= px h *= py return (self.data['visible'] & (self.data['x'] + w > l) & (self.data['x'] - w < r) & (self.data['y'] + h > t) & (self.data['y'] - h < b)) def mouseClickEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.LeftButton: pts = self.pointsAt(ev.pos()) if len(pts) > 0: self.ptsClicked = pts ev.accept() self.sigClicked.emit(self, self.ptsClicked, ev) else: #print "no spots" ev.ignore() else: ev.ignore() def hoverEvent(self, ev): if self.opts['hoverable']: old = self.data['hovered'] if ev.exit: new = np.zeros_like(self.data['hovered']) else: new = self._maskAt(ev.pos()) if self._hasHoverStyle(): self.data['sourceRect'][old ^ new] = 0 self.data['hovered'] = new self.updateSpots() points = self.points()[new][::-1] # Show information about hovered points in a tool tip vb = self.getViewBox() if vb is not None and self.opts['tip'] is not None: if len(points) > 0: cutoff = 3 tip = [self.opts['tip'](x=pt.pos().x(), y=pt.pos().y(), data=pt.data()) for pt in points[:cutoff]] if len(points) > cutoff: tip.append('({} others...)'.format(len(points) - cutoff)) vb.setToolTip('\n\n'.join(tip)) self._toolTipCleared = False elif not self._toolTipCleared: vb.setToolTip("") self._toolTipCleared = True self.sigHovered.emit(self, points, ev) def _hasHoverStyle(self): return any(self.opts['hover' + opt.title()] != _DEFAULT_STYLE[opt] for opt in ['symbol', 'size', 'pen', 'brush']) class SpotItem(object): """ Class referring to individual spots in a scatter plot. These can be retrieved by calling ScatterPlotItem.points() or by connecting to the ScatterPlotItem's click signals. """ def __init__(self, data, plot, index): self._data = data self._index = index # SpotItems are kept in plot.data["items"] numpy object array which # does not support cyclic garbage collection (numpy issue 6581). # Keeping a strong ref to plot here would leak the cycle self.__plot_ref = weakref.ref(plot) @property def _plot(self): return self.__plot_ref() def data(self): """Return the user data associated with this spot.""" return self._data['data'] def index(self): """Return the index of this point as given in the scatter plot data.""" return self._index def size(self): """Return the size of this spot. If the spot has no explicit size set, then return the ScatterPlotItem's default size instead.""" if self._data['size'] == -1: return self._plot.opts['size'] else: return self._data['size'] def pos(self): return Point(self._data['x'], self._data['y']) def viewPos(self): return self._plot.mapToView(self.pos()) def setSize(self, size): """Set the size of this spot. If the size is set to -1, then the ScatterPlotItem's default size will be used instead.""" self._data['size'] = size self.updateItem() def symbol(self): """Return the symbol of this spot. If the spot has no explicit symbol set, then return the ScatterPlotItem's default symbol instead. """ symbol = self._data['symbol'] if symbol is None: symbol = self._plot.opts['symbol'] try: n = int(symbol) symbol = list(Symbols.keys())[n % len(Symbols)] except: pass return symbol def setSymbol(self, symbol): """Set the symbol for this spot. If the symbol is set to '', then the ScatterPlotItem's default symbol will be used instead.""" self._data['symbol'] = symbol self.updateItem() def pen(self): pen = self._data['pen'] if pen is None: pen = self._plot.opts['pen'] return fn.mkPen(pen) def setPen(self, *args, **kargs): """Set the outline pen for this spot""" self._data['pen'] = _mkPen(*args, **kargs) self.updateItem() def resetPen(self): """Remove the pen set for this spot; the scatter plot's default pen will be used instead.""" self._data['pen'] = None ## Note this is NOT the same as calling setPen(None) self.updateItem() def brush(self): brush = self._data['brush'] if brush is None: brush = self._plot.opts['brush'] return fn.mkBrush(brush) def setBrush(self, *args, **kargs): """Set the fill brush for this spot""" self._data['brush'] = _mkBrush(*args, **kargs) self.updateItem() def resetBrush(self): """Remove the brush set for this spot; the scatter plot's default brush will be used instead.""" self._data['brush'] = None ## Note this is NOT the same as calling setBrush(None) self.updateItem() def isVisible(self): return self._data['visible'] def setVisible(self, visible): """Set whether or not this spot is visible.""" self._data['visible'] = visible self.updateItem() def setData(self, data): """Set the user-data associated with this spot""" self._data['data'] = data def updateItem(self): self._data['sourceRect'] = (0, 0, 0, 0) # numpy <=1.13.1 won't let us set this with a single zero self._plot.updateSpots(self._data.reshape(1)) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/TargetItem.py000066400000000000000000000366171457240071200251120ustar00rootroot00000000000000import string from math import atan2 from .. import functions as fn from ..Point import Point from ..Qt import QtCore, QtGui from .GraphicsObject import GraphicsObject from .ScatterPlotItem import Symbols from .TextItem import TextItem from .UIGraphicsItem import UIGraphicsItem from .ViewBox import ViewBox __all__ = ['TargetItem', 'TargetLabel'] class TargetItem(UIGraphicsItem): """Draws a draggable target symbol (circle plus crosshair). The size of TargetItem will remain fixed on screen even as the view is zoomed. Includes an optional text label. """ sigPositionChanged = QtCore.Signal(object) sigPositionChangeFinished = QtCore.Signal(object) def __init__( self, pos=None, size=10, symbol="crosshair", pen=None, hoverPen=None, brush=None, hoverBrush=None, movable=True, label=None, labelOpts=None, ): r""" Parameters ---------- pos : list, tuple, QPointF, QPoint, Optional Initial position of the symbol. Default is (0, 0) size : int Size of the symbol in pixels. Default is 10. pen : QPen, tuple, list or str Pen to use when drawing line. Can be any arguments that are valid for :func:`~pyqtgraph.mkPen`. Default pen is transparent yellow. brush : QBrush, tuple, list, or str Defines the brush that fill the symbol. Can be any arguments that is valid for :func:`~pyqtgraph.mkBrush`. Default is transparent blue. movable : bool If True, the symbol can be dragged to a new position by the user. hoverPen : QPen, tuple, list, or str Pen to use when drawing symbol when hovering over it. Can be any arguments that are valid for :func:`~pyqtgraph.mkPen`. Default pen is red. hoverBrush : QBrush, tuple, list or str Brush to use to fill the symbol when hovering over it. Can be any arguments that is valid for :func:`~pyqtgraph.mkBrush`. Default is transparent blue. symbol : QPainterPath or str QPainterPath to use for drawing the target, should be centered at ``(0, 0)`` with ``max(width, height) == 1.0``. Alternatively a string which can be any symbol accepted by :func:`~pyqtgraph.ScatterPlotItem.setSymbol` label : bool, str or callable, optional Text to be displayed in a label attached to the symbol, or None to show no label (default is None). May optionally include formatting strings to display the symbol value, or a callable that accepts x and y as inputs. If True, the label is ``x = {: >.3n}\ny = {: >.3n}`` False or None will result in no text being displayed labelOpts : dict A dict of keyword arguments to use when constructing the text label. See :class:`TargetLabel` and :class:`~pyqtgraph.TextItem` """ super().__init__() self.movable = movable self.moving = False self._label = None self.mouseHovering = False if pen is None: pen = (255, 255, 0) self.setPen(pen) if hoverPen is None: hoverPen = (255, 0, 255) self.setHoverPen(hoverPen) if brush is None: brush = (0, 0, 255, 50) self.setBrush(brush) if hoverBrush is None: hoverBrush = (0, 255, 255, 100) self.setHoverBrush(hoverBrush) self.currentPen = self.pen self.currentBrush = self.brush self._shape = None self._pos = Point(0, 0) if pos is None: pos = Point(0, 0) self.setPos(pos) if isinstance(symbol, str): try: self._path = Symbols[symbol] except KeyError: raise KeyError("symbol name found in available Symbols") elif isinstance(symbol, QtGui.QPainterPath): self._path = symbol else: raise TypeError("Unknown type provided as symbol") self.scale = size self.setPath(self._path) self.setLabel(label, labelOpts) def setPos(self, *args): """Method to set the position to ``(x, y)`` within the plot view Parameters ---------- args : tuple or list or QtCore.QPointF or QtCore.QPoint or Point or float Two float values or a container that specifies ``(x, y)`` position where the TargetItem should be placed Raises ------ TypeError If args cannot be used to instantiate a Point """ try: newPos = Point(*args) except TypeError: raise except Exception: raise TypeError(f"Could not make Point from arguments: {args!r}") if self._pos != newPos: self._pos = newPos super().setPos(self._pos) self.sigPositionChanged.emit(self) def setBrush(self, *args, **kwargs): """Set the brush that fills the symbol. Allowable arguments are any that are valid for :func:`~pyqtgraph.mkBrush`. """ self.brush = fn.mkBrush(*args, **kwargs) if not self.mouseHovering: self.currentBrush = self.brush self.update() def setHoverBrush(self, *args, **kwargs): """Set the brush that fills the symbol when hovering over it. Allowable arguments are any that are valid for :func:`~pyqtgraph.mkBrush`. """ self.hoverBrush = fn.mkBrush(*args, **kwargs) if self.mouseHovering: self.currentBrush = self.hoverBrush self.update() def setPen(self, *args, **kwargs): """Set the pen for drawing the symbol. Allowable arguments are any that are valid for :func:`~pyqtgraph.mkPen`.""" self.pen = fn.mkPen(*args, **kwargs) if not self.mouseHovering: self.currentPen = self.pen self.update() def setHoverPen(self, *args, **kwargs): """Set the pen for drawing the symbol when hovering over it. Allowable arguments are any that are valid for :func:`~pyqtgraph.mkPen`.""" self.hoverPen = fn.mkPen(*args, **kwargs) if self.mouseHovering: self.currentPen = self.hoverPen self.update() def boundingRect(self): return self.shape().boundingRect() def paint(self, p, *_): p.setPen(self.currentPen) p.setBrush(self.currentBrush) p.drawPath(self.shape()) def setPath(self, path): if path != self._path: self._path = path self._shape = None return None def shape(self): if self._shape is None: s = self.generateShape() if s is None: return self._path self._shape = s # beware--this can cause the view to adjust # which would immediately invalidate the shape. self.prepareGeometryChange() return self._shape def generateShape(self): dt = self.deviceTransform() if dt is None: self._shape = self._path return None v = dt.map(QtCore.QPointF(1, 0)) - dt.map(QtCore.QPointF(0, 0)) dti = fn.invertQTransform(dt) devPos = dt.map(QtCore.QPointF(0, 0)) tr = QtGui.QTransform() tr.translate(devPos.x(), devPos.y()) va = atan2(v.y(), v.x()) tr.rotateRadians(va) tr.scale(self.scale, self.scale) return dti.map(tr.map(self._path)) def mouseDragEvent(self, ev): if not self.movable or ev.button() != QtCore.Qt.MouseButton.LeftButton: return ev.accept() if ev.isStart(): self.symbolOffset = self.pos() - self.mapToView(ev.buttonDownPos()) self.moving = True if not self.moving: return self.setPos(self.symbolOffset + self.mapToView(ev.pos())) if ev.isFinish(): self.moving = False self.sigPositionChangeFinished.emit(self) def mouseClickEvent(self, ev): if self.moving and ev.button() == QtCore.Qt.MouseButton.RightButton: ev.accept() self.moving = False self.sigPositionChanged.emit(self) self.sigPositionChangeFinished.emit(self) def setMouseHover(self, hover): # Inform the item that the mouse is(not) hovering over it if self.mouseHovering is hover: return self.mouseHovering = hover if hover: self.currentBrush = self.hoverBrush self.currentPen = self.hoverPen else: self.currentBrush = self.brush self.currentPen = self.pen self.update() def hoverEvent(self, ev): if self.movable and (not ev.isExit()) and ev.acceptDrags(QtCore.Qt.MouseButton.LeftButton): self.setMouseHover(True) else: self.setMouseHover(False) def viewTransformChanged(self): GraphicsObject.viewTransformChanged(self) self._shape = None # invalidate shape, recompute later if requested. self.update() def pos(self): """Provides the current position of the TargetItem Returns ------- Point pg.Point of the current position of the TargetItem """ return self._pos def label(self): """Provides the TargetLabel if it exists Returns ------- TargetLabel or None If a TargetLabel exists for this TargetItem, return that, otherwise return None """ return self._label def setLabel(self, text=None, labelOpts=None): """Method to call to enable or disable the TargetLabel for displaying text Parameters ---------- text : Callable or str, optional Details how to format the text, by default None If None, do not show any text next to the TargetItem If Callable, then the label will display the result of ``text(x, y)`` If a fromatted string, then the output of ``text.format(x, y)`` will be displayed If a non-formatted string, then the text label will display ``text``, by default None labelOpts : dict, optional These arguments are passed on to :class:`~pyqtgraph.TextItem` """ if not text: if self._label is not None and self._label.scene() is not None: # remove the label if it's already added self._label.scene().removeItem(self._label) self._label = None else: # provide default text if text is True if text is True: # convert to default value or empty string text = "x = {: .3n}\ny = {: .3n}" labelOpts = {} if labelOpts is None else labelOpts if self._label is not None: self._label.scene().removeItem(self._label) self._label = TargetLabel(self, text=text, **labelOpts) class TargetLabel(TextItem): """A TextItem that attaches itself to a TargetItem. This class extends TextItem with the following features : * Automatically positions adjacent to the symbol at a fixed position. * Automatically reformats text when the symbol location has changed. Parameters ---------- target : TargetItem The TargetItem to which this label will be attached to. text : str or callable, Optional Governs the text displayed, can be a fixed string or a format string that accepts the x, and y position of the target item; or be a callable method that accepts a tuple (x, y) and returns a string to be displayed. If None, an empty string is used. Default is None offset : tuple or list or QPointF or QPoint Position to set the anchor of the TargetLabel away from the center of the target in pixels, by default it is (20, 0). anchor : tuple or list or QPointF or QPoint Position to rotate the TargetLabel about, and position to set the offset value to see :class:`~pyqtgraph.TextItem` for more information. kwargs : dict kwargs contains arguments that are passed onto :class:`~pyqtgraph.TextItem` constructor, excluding text parameter """ def __init__( self, target, text="", offset=(20, 0), anchor=(0, 0.5), **kwargs, ): if isinstance(offset, Point): self.offset = offset elif isinstance(offset, (tuple, list)): self.offset = Point(*offset) elif isinstance(offset, (QtCore.QPoint, QtCore.QPointF)): self.offset = Point(offset.x(), offset.y()) else: raise TypeError("Offset parameter is the wrong data type") super().__init__(anchor=anchor, **kwargs) self.setParentItem(target) self.target = target self.setFormat(text) self.target.sigPositionChanged.connect(self.valueChanged) self.valueChanged() def format(self): return self._format def setFormat(self, text): """Method to set how the TargetLabel should display the text. This method should be called from TargetItem.setLabel directly. Parameters ---------- text : Callable or str Details how to format the text. If Callable, then the label will display the result of ``text(x, y)`` If a fromatted string, then the output of ``text.format(x, y)`` will be displayed If a non-formatted string, then the text label will display ``text`` """ if not callable(text): parsed = list(string.Formatter().parse(text)) if parsed and parsed[0][1] is not None: self.setProperty("formattableText", True) else: self.setText(text) self.setProperty("formattableText", False) else: self.setProperty("formattableText", False) self._format = text self.valueChanged() def valueChanged(self): x, y = self.target.pos() if self.property("formattableText"): self.setText(self._format.format(float(x), float(y))) elif callable(self._format): self.setText(self._format(x, y)) def viewTransformChanged(self): viewbox = self.getViewBox() if isinstance(viewbox, ViewBox): viewPixelSize = viewbox.viewPixelSize() scaledOffset = QtCore.QPointF( self.offset.x() * viewPixelSize[0], self.offset.y() * viewPixelSize[1] ) self.setPos(scaledOffset) return super().viewTransformChanged() def mouseClickEvent(self, ev): return self.parentItem().mouseClickEvent(ev) def mouseDragEvent(self, ev): targetItem = self.parentItem() if not targetItem.movable or ev.button() != QtCore.Qt.MouseButton.LeftButton: return ev.accept() if ev.isStart(): targetItem.symbolOffset = targetItem.pos() - self.mapToView( ev.buttonDownPos() ) targetItem.moving = True if not targetItem.moving: return targetItem.setPos(targetItem.symbolOffset + self.mapToView(ev.pos())) if ev.isFinish(): targetItem.moving = False targetItem.sigPositionChangeFinished.emit(self) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/TextItem.py000066400000000000000000000222241457240071200245750ustar00rootroot00000000000000from math import atan2, degrees from .. import functions as fn from ..Point import Point from ..Qt import QtCore, QtGui, QtWidgets from .GraphicsObject import GraphicsObject __all__ = ['TextItem'] class TextItem(GraphicsObject): """ GraphicsItem displaying unscaled text (the text will always appear normal even inside a scaled ViewBox). """ def __init__(self, text='', color=(200,200,200), html=None, anchor=(0,0), border=None, fill=None, angle=0, rotateAxis=None, ensureInBounds=False): """ ================ ================================================================================= **Arguments:** *text* The text to display *color* The color of the text (any format accepted by pg.mkColor) *html* If specified, this overrides both *text* and *color* *anchor* A QPointF or (x,y) sequence indicating what region of the text box will be anchored to the item's position. A value of (0,0) sets the upper-left corner of the text box to be at the position specified by setPos(), while a value of (1,1) sets the lower-right corner. *border* A pen to use when drawing the border *fill* A brush to use when filling within the border *angle* Angle in degrees to rotate text. Default is 0; text will be displayed upright. *rotateAxis* If None, then a text angle of 0 always points along the +x axis of the scene. If a QPointF or (x,y) sequence is given, then it represents a vector direction in the parent's coordinate system that the 0-degree line will be aligned to. This Allows text to follow both the position and orientation of its parent while still discarding any scale and shear factors. *ensureInBounds* Ensures that the entire TextItem will be visible when using autorange, but may produce runaway scaling in certain circumstances (See issue #2642). Setting to "True" retains legacy behavior. ================ ================================================================================= The effects of the `rotateAxis` and `angle` arguments are added independently. So for example: * rotateAxis=None, angle=0 -> normal horizontal text * rotateAxis=None, angle=90 -> normal vertical text * rotateAxis=(1, 0), angle=0 -> text aligned with x axis of its parent * rotateAxis=(0, 1), angle=0 -> text aligned with y axis of its parent * rotateAxis=(1, 0), angle=90 -> text orthogonal to x axis of its parent """ self.anchor = Point(anchor) self.rotateAxis = None if rotateAxis is None else Point(rotateAxis) #self.angle = 0 GraphicsObject.__init__(self) self.textItem = QtWidgets.QGraphicsTextItem() self.textItem.setParentItem(self) self._lastTransform = None self._lastScene = None # Note: The following is pretty scuffed; ideally there would likely be # some inheritance changes, But this is the least-intrusive thing that # works for now if ensureInBounds: self.dataBounds = None self._bounds = QtCore.QRectF() if html is None: self.setColor(color) self.setText(text) else: self.setHtml(html) self.fill = fn.mkBrush(fill) self.border = fn.mkPen(border) self.setAngle(angle) def setText(self, text, color=None): """ Set the text of this item. This method sets the plain text of the item; see also setHtml(). """ if color is not None: self.setColor(color) self.setPlainText(text) def setPlainText(self, text): """ Set the plain text to be rendered by this item. See QtWidgets.QGraphicsTextItem.setPlainText(). """ if text != self.toPlainText(): self.textItem.setPlainText(text) self.updateTextPos() def toPlainText(self): return self.textItem.toPlainText() def setHtml(self, html): """ Set the HTML code to be rendered by this item. See QtWidgets.QGraphicsTextItem.setHtml(). """ if self.toHtml() != html: self.textItem.setHtml(html) self.updateTextPos() def toHtml(self): return self.textItem.toHtml() def setTextWidth(self, *args): """ Set the width of the text. If the text requires more space than the width limit, then it will be wrapped into multiple lines. See QtWidgets.QGraphicsTextItem.setTextWidth(). """ self.textItem.setTextWidth(*args) self.updateTextPos() def setFont(self, *args): """ Set the font for this text. See QtWidgets.QGraphicsTextItem.setFont(). """ self.textItem.setFont(*args) self.updateTextPos() def setAngle(self, angle): """ Set the angle of the text in degrees. This sets the rotation angle of the text as a whole, measured counter-clockwise from the x axis of the parent. Note that this rotation angle does not depend on horizontal/vertical scaling of the parent. """ self.angle = angle self.updateTransform(force=True) def setAnchor(self, anchor): self.anchor = Point(anchor) self.updateTextPos() def setColor(self, color): """ Set the color for this text. See QtWidgets.QGraphicsItem.setDefaultTextColor(). """ self.color = fn.mkColor(color) self.textItem.setDefaultTextColor(self.color) def updateTextPos(self): # update text position to obey anchor r = self.textItem.boundingRect() tl = self.textItem.mapToParent(r.topLeft()) br = self.textItem.mapToParent(r.bottomRight()) offset = (br - tl) * self.anchor self.textItem.setPos(-offset) def dataBounds(self, ax, frac=1.0, orthoRange=None): """ Returns only the anchor point for when calulating view ranges. Sacrifices some visual polish for fixing issue #2642. """ if orthoRange: range_min, range_max = orthoRange[0], orthoRange[1] if not range_min <= self.anchor[ax] <= range_max: return [None, None] return [self.anchor[ax], self.anchor[ax]] def boundingRect(self): return self.textItem.mapRectToParent(self.textItem.boundingRect()) def viewTransformChanged(self): # called whenever view transform has changed. # Do this here to avoid double-updates when view changes. self.updateTransform() def paint(self, p, *args): # this is not ideal because it requires the transform to be updated at every draw. # ideally, we would have a sceneTransformChanged event to react to.. s = self.scene() ls = self._lastScene if s is not ls: if ls is not None: ls.sigPrepareForPaint.disconnect(self.updateTransform) self._lastScene = s if s is not None: s.sigPrepareForPaint.connect(self.updateTransform) self.updateTransform() p.setTransform(self.sceneTransform()) if self.border.style() != QtCore.Qt.PenStyle.NoPen or self.fill.style() != QtCore.Qt.BrushStyle.NoBrush: p.setPen(self.border) p.setBrush(self.fill) p.setRenderHint(p.RenderHint.Antialiasing, True) p.drawPolygon(self.textItem.mapToParent(self.textItem.boundingRect())) def setVisible(self, v): GraphicsObject.setVisible(self, v) if v: self.updateTransform() def updateTransform(self, force=False): if not self.isVisible(): return # update transform such that this item has the correct orientation # and scaling relative to the scene, but inherits its position from its # parent. # This is similar to setting ItemIgnoresTransformations = True, but # does not break mouse interaction and collision detection. p = self.parentItem() if p is None: pt = QtGui.QTransform() else: pt = p.sceneTransform() if not force and pt == self._lastTransform: return t = fn.invertQTransform(pt) # reset translation t.setMatrix(t.m11(), t.m12(), t.m13(), t.m21(), t.m22(), t.m23(), 0, 0, t.m33()) # apply rotation angle = -self.angle if self.rotateAxis is not None: d = pt.map(self.rotateAxis) - pt.map(Point(0, 0)) a = degrees(atan2(d.y(), d.x())) angle += a t.rotate(angle) self.setTransform(t) self._lastTransform = pt self.updateTextPos() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/UIGraphicsItem.py000066400000000000000000000104051457240071200256450ustar00rootroot00000000000000from ..Qt import QtCore, QtGui from .GraphicsObject import GraphicsObject __all__ = ['UIGraphicsItem'] class UIGraphicsItem(GraphicsObject): """ Base class for graphics items with boundaries relative to a GraphicsView or ViewBox. The purpose of this class is to allow the creation of GraphicsItems which live inside a scalable view, but whose boundaries will always stay fixed relative to the view's boundaries. For example: GridItem, InfiniteLine The view can be specified on initialization or it can be automatically detected when the item is painted. NOTE: Only the item's boundingRect is affected; the item is not transformed in any way. Use viewRangeChanged to respond to changes in the view. """ #sigViewChanged = QtCore.Signal(object) ## emitted whenever the viewport coords have changed def __init__(self, bounds=None, parent=None): """ ============== ============================================================================= **Arguments:** bounds QRectF with coordinates relative to view box. The default is QRectF(0,0,1,1), which means the item will have the same bounds as the view. ============== ============================================================================= """ GraphicsObject.__init__(self, parent) self.setFlag(self.GraphicsItemFlag.ItemSendsScenePositionChanges) if bounds is None: self._bounds = QtCore.QRectF(0, 0, 1, 1) else: self._bounds = bounds self._boundingRect = None self._updateView() def paint(self, *args): ## check for a new view object every time we paint. #self.updateView() pass def itemChange(self, change, value): ret = GraphicsObject.itemChange(self, change, value) if change == self.GraphicsItemChange.ItemScenePositionHasChanged: self.setNewBounds() return ret #def updateView(self): ### called to see whether this item has a new view to connect to ### check for this item's current viewbox or view widget #view = self.getViewBox() #if view is None: ##print " no view" #return #if self._connectedView is not None and view is self._connectedView(): ##print " already have view", view #return ### disconnect from previous view #if self._connectedView is not None: #cv = self._connectedView() #if cv is not None: ##print "disconnect:", self #cv.sigRangeChanged.disconnect(self.viewRangeChanged) ### connect to new view ##print "connect:", self #view.sigRangeChanged.connect(self.viewRangeChanged) #self._connectedView = weakref.ref(view) #self.setNewBounds() def boundingRect(self): if self._boundingRect is None: br = self.viewRect() if br is None: return QtCore.QRectF() else: self._boundingRect = br return QtCore.QRectF(self._boundingRect) def dataBounds(self, axis, frac=1.0, orthoRange=None): """Called by ViewBox for determining the auto-range bounds. By default, UIGraphicsItems are excluded from autoRange.""" return None def viewRangeChanged(self): """Called when the view widget/viewbox is resized/rescaled""" self.setNewBounds() self.update() def setNewBounds(self): """Update the item's bounding rect to match the viewport""" self._boundingRect = None ## invalidate bounding rect, regenerate later if needed. self.prepareGeometryChange() def setPos(self, *args): GraphicsObject.setPos(self, *args) self.setNewBounds() def mouseShape(self): """Return the shape of this item after expanding by 2 pixels""" shape = self.shape() ds = self.mapToDevice(shape) stroker = QtGui.QPainterPathStroker() stroker.setWidh(2) ds2 = stroker.createStroke(ds).united(ds) return self.mapFromDevice(ds2) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/VTickGroup.py000066400000000000000000000066411457240071200250740ustar00rootroot00000000000000if __name__ == '__main__': import os import sys path = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, os.path.join(path, '..', '..')) from .. import functions as fn from ..Qt import QtGui, QtWidgets from .UIGraphicsItem import UIGraphicsItem __all__ = ['VTickGroup'] class VTickGroup(UIGraphicsItem): """ **Bases:** :class:`UIGraphicsItem ` Draws a set of tick marks which always occupy the same vertical range of the view, but have x coordinates relative to the data within the view. """ def __init__(self, xvals=None, yrange=None, pen=None): """ ============== =================================================================== **Arguments:** xvals A list of x values (in data coordinates) at which to draw ticks. yrange A list of [low, high] limits for the tick. 0 is the bottom of the view, 1 is the top. [0.8, 1] would draw ticks in the top fifth of the view. pen The pen to use for drawing ticks. Default is grey. Can be specified as any argument valid for :func:`mkPen` ============== =================================================================== """ if yrange is None: yrange = [0, 1] if xvals is None: xvals = [] UIGraphicsItem.__init__(self) if pen is None: pen = (200, 200, 200) self.path = QtWidgets.QGraphicsPathItem() self.ticks = [] self.xvals = [] self.yrange = [0,1] self.setPen(pen) self.setYRange(yrange) self.setXVals(xvals) def setPen(self, *args, **kwargs): """Set the pen to use for drawing ticks. Can be specified as any arguments valid for :func:`mkPen`""" self.pen = fn.mkPen(*args, **kwargs) def setXVals(self, vals): """Set the x values for the ticks. ============== ===================================================================== **Arguments:** vals A list of x values (in data/plot coordinates) at which to draw ticks. ============== ===================================================================== """ self.xvals = vals self.rebuildTicks() #self.valid = False def setYRange(self, vals): """Set the y range [low, high] that the ticks are drawn on. 0 is the bottom of the view, 1 is the top.""" self.yrange = vals self.rebuildTicks() def dataBounds(self, *args, **kargs): return None ## item should never affect view autoscaling def yRange(self): return self.yrange def rebuildTicks(self): self.path = QtGui.QPainterPath() for x in self.xvals: self.path.moveTo(x, 0.) self.path.lineTo(x, 1.) def paint(self, p, *args): UIGraphicsItem.paint(self, p, *args) br = self.boundingRect() h = br.height() br.setY(br.y() + self.yrange[0] * h) br.setHeight((self.yrange[1] - self.yrange[0]) * h) p.translate(0, br.y()) p.scale(1.0, br.height()) p.setPen(self.pen) p.drawPath(self.path) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ViewBox/000077500000000000000000000000001457240071200240415ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ViewBox/ViewBox.py000066400000000000000000002230671457240071200260100ustar00rootroot00000000000000import math import sys import weakref from copy import deepcopy import numpy as np from ... import debug as debug from ... import functions as fn from ... import getConfigOption from ...Point import Point from ...Qt import QtCore, QtGui, QtWidgets, isQObjectAlive, QT_LIB from ..GraphicsWidget import GraphicsWidget from ..ItemGroup import ItemGroup __all__ = ['ViewBox'] class WeakList(object): def __init__(self): self._items = [] def append(self, obj): #Add backwards to iterate backwards (to make iterating more efficient on removal). self._items.insert(0, weakref.ref(obj)) def __iter__(self): i = len(self._items)-1 while i >= 0: ref = self._items[i] d = ref() if d is None: del self._items[i] else: yield d i -= 1 class ChildGroup(ItemGroup): def __init__(self, parent): ItemGroup.__init__(self, parent) # Used as callback to inform ViewBox when items are added/removed from # the group. # Note 1: We would prefer to override itemChange directly on the # ViewBox, but this causes crashes on PySide. # Note 2: We might also like to use a signal rather than this callback # mechanism, but this causes a different PySide crash. self.itemsChangedListeners = WeakList() # exempt from telling view when transform changes self._GraphicsObject__inform_view_on_change = False def itemChange(self, change, value): ret = ItemGroup.itemChange(self, change, value) if change in [ self.GraphicsItemChange.ItemChildAddedChange, self.GraphicsItemChange.ItemChildRemovedChange, ]: try: itemsChangedListeners = self.itemsChangedListeners except AttributeError: # It's possible that the attribute was already collected when the itemChange happened # (if it was triggered during the gc of the object). pass else: for listener in itemsChangedListeners: listener.itemsChanged() return ret class ViewBox(GraphicsWidget): """ **Bases:** :class:`GraphicsWidget ` Box that allows internal scaling/panning of children by mouse drag. This class is usually created automatically as part of a :class:`PlotItem ` or :ref:`Canvas ` or with :func:`GraphicsLayout.addViewBox() `. Features: * Scaling contents by mouse or auto-scale when contents change * View linking--multiple views display the same data ranges * Configurable by context menu * Item coordinate mapping methods """ sigYRangeChanged = QtCore.Signal(object, object) sigXRangeChanged = QtCore.Signal(object, object) sigRangeChangedManually = QtCore.Signal(object) sigRangeChanged = QtCore.Signal(object, object, object) sigStateChanged = QtCore.Signal(object) sigTransformChanged = QtCore.Signal(object) sigResized = QtCore.Signal(object) ## mouse modes PanMode = 3 RectMode = 1 ## axes XAxis = 0 YAxis = 1 XYAxes = 2 ## for linking views together NamedViews = weakref.WeakValueDictionary() # name: ViewBox AllViews = weakref.WeakKeyDictionary() # ViewBox: None def __init__(self, parent=None, border=None, lockAspect=False, enableMouse=True, invertY=False, enableMenu=True, name=None, invertX=False, defaultPadding=0.02): """ ================= ============================================================= **Arguments:** *parent* (QGraphicsWidget) Optional parent widget *border* (QPen) Do draw a border around the view, give any single argument accepted by :func:`mkPen ` *lockAspect* (False or float) The aspect ratio to lock the view coorinates to. (or False to allow the ratio to change) *enableMouse* (bool) Whether mouse can be used to scale/pan the view *invertY* (bool) See :func:`invertY ` *invertX* (bool) See :func:`invertX ` *enableMenu* (bool) Whether to display a context menu when right-clicking on the ViewBox background. *name* (str) Used to register this ViewBox so that it appears in the "Link axis" dropdown inside other ViewBox context menus. This allows the user to manually link the axes of any other view to this one. *defaultPadding* (float) fraction of the data range that will be added as padding by default ================= ============================================================= """ GraphicsWidget.__init__(self, parent) self.name = None self.linksBlocked = False self.addedItems = [] self._matrixNeedsUpdate = True ## indicates that range has changed, but matrix update was deferred self._autoRangeNeedsUpdate = True ## indicates auto-range needs to be recomputed. self._lastScene = None ## stores reference to the last known scene this view was a part of. self.state = { ## separating targetRange and viewRange allows the view to be resized ## while keeping all previously viewed contents visible 'targetRange': [[0,1], [0,1]], ## child coord. range visible [[xmin, xmax], [ymin, ymax]] 'viewRange': [[0,1], [0,1]], ## actual range viewed 'yInverted': invertY, 'xInverted': invertX, 'aspectLocked': False, ## False if aspect is unlocked, otherwise float specifies the locked ratio. 'autoRange': [True, True], ## False if auto range is disabled, ## otherwise float gives the fraction of data that is visible 'autoPan': [False, False], ## whether to only pan (do not change scaling) when auto-range is enabled 'autoVisibleOnly': [False, False], ## whether to auto-range only to the visible portion of a plot 'linkedViews': [None, None], ## may be None, "viewName", or weakref.ref(view) ## a name string indicates that the view *should* link to another, but no view with that name exists yet. 'defaultPadding': defaultPadding, 'mouseEnabled': [enableMouse, enableMouse], 'mouseMode': ViewBox.PanMode if getConfigOption('leftButtonPan') else ViewBox.RectMode, 'enableMenu': enableMenu, 'wheelScaleFactor': -1.0 / 8.0, 'background': None, 'logMode': [False, False], # Limits # maximum value of double float is 1.7E+308, but internal caluclations exceed this limit before the range reaches it. 'limits': { 'xLimits': [-1E307, +1E307], # Maximum and minimum visible X values 'yLimits': [-1E307, +1E307], # Maximum and minimum visible Y values 'xRange': [None, None], # Maximum and minimum X range 'yRange': [None, None], # Maximum and minimum Y range } } self._updatingRange = False ## Used to break recursive loops. See updateAutoRange. self._itemBoundsCache = weakref.WeakKeyDictionary() self.locateGroup = None ## items displayed when using ViewBox.locate(item) self.setFlag(self.GraphicsItemFlag.ItemClipsChildrenToShape) self.setFlag(self.GraphicsItemFlag.ItemIsFocusable, True) ## so we can receive key presses ## childGroup is required so that ViewBox has local coordinates similar to device coordinates. ## this is a workaround for a Qt + OpenGL bug that causes improper clipping ## https://bugreports.qt.nokia.com/browse/QTBUG-23723 self.childGroup = ChildGroup(self) self.childGroup.itemsChangedListeners.append(self) self.background = QtWidgets.QGraphicsRectItem(self.rect()) self.background.setParentItem(self) self.background.setZValue(-1e6) self.background.setPen(fn.mkPen(None)) self.updateBackground() self.border = fn.mkPen(border) self.borderRect = QtWidgets.QGraphicsRectItem(self.rect()) self.borderRect.setParentItem(self) self.borderRect.setZValue(1e3) self.borderRect.setPen(self.border) self._rbScaleBox = None ## show target rect for debugging self.target = QtWidgets.QGraphicsRectItem(0, 0, 1, 1) self.target.setPen(fn.mkPen('r')) self.target.setParentItem(self) self.target.hide() self.axHistory = [] # maintain a history of zoom locations self.axHistoryPointer = -1 # pointer into the history. Allows forward/backward movement, not just "undo" self.setZValue(-100) self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)) self.setAspectLocked(lockAspect) if enableMenu: self.menu = ViewBoxMenu(self) else: self.menu = None self.register(name) if name is None: self.updateViewLists() self._viewPixelSizeCache = None @property def rbScaleBox(self): if self._rbScaleBox is None: # call the setter with the default value scaleBox = QtWidgets.QGraphicsRectItem(0, 0, 1, 1) scaleBox.setPen(fn.mkPen((255, 255, 100), width=1)) scaleBox.setBrush(fn.mkBrush(255, 255, 0, 100)) scaleBox.setZValue(1e9) scaleBox.hide() self._rbScaleBox = scaleBox self.addItem(scaleBox, ignoreBounds=True) return self._rbScaleBox @rbScaleBox.setter def rbScaleBox(self, scaleBox): if self._rbScaleBox is not None: self.removeItem(self._rbScaleBox) self._rbScaleBox = scaleBox if scaleBox is None: return None scaleBox.setZValue(1e9) scaleBox.hide() self.addItem(scaleBox, ignoreBounds=True) return None def getAspectRatio(self): """return the current aspect ratio""" rect = self.rect() vr = self.viewRect() if rect.height() == 0 or vr.width() == 0 or vr.height() == 0: currentRatio = 1.0 else: currentRatio = (rect.width()/float(rect.height())) / ( vr.width()/vr.height()) return currentRatio def register(self, name): """ Add this ViewBox to the registered list of views. This allows users to manually link the axes of any other ViewBox to this one. The specified *name* will appear in the drop-down lists for axis linking in the context menus of all other views. The same can be accomplished by initializing the ViewBox with the *name* attribute. """ ViewBox.AllViews[self] = None if self.name is not None: del ViewBox.NamedViews[self.name] self.name = name if name is not None: ViewBox.NamedViews[name] = self ViewBox.updateAllViewLists() sid = id(self) self.destroyed.connect(lambda: ViewBox.forgetView(sid, name) if (ViewBox is not None and 'sid' in locals() and 'name' in locals()) else None) def unregister(self): """ Remove this ViewBox from the list of linkable views. (see :func:`register() `) """ del ViewBox.AllViews[self] if self.name is not None: del ViewBox.NamedViews[self.name] def close(self): self.clear() self.unregister() def implements(self, interface): return interface == 'ViewBox' def itemChange(self, change, value): ret = super().itemChange(change, value) if change == self.GraphicsItemChange.ItemSceneChange: scene = self.scene() if scene is not None and hasattr(scene, 'sigPrepareForPaint'): scene.sigPrepareForPaint.disconnect(self.prepareForPaint) elif change == self.GraphicsItemChange.ItemSceneHasChanged: scene = self.scene() if scene is not None and hasattr(scene, 'sigPrepareForPaint'): scene.sigPrepareForPaint.connect(self.prepareForPaint) return ret def prepareForPaint(self): #autoRangeEnabled = (self.state['autoRange'][0] is not False) or (self.state['autoRange'][1] is not False) # don't check whether auto range is enabled here--only check when setting dirty flag. if self._autoRangeNeedsUpdate: # and autoRangeEnabled: self.updateAutoRange() self.updateMatrix() def getState(self, copy=True): """Return the current state of the ViewBox. Linked views are always converted to view names in the returned state.""" state = self.state.copy() views = [] for v in state['linkedViews']: if isinstance(v, weakref.ref): v = v() if v is None or isinstance(v, str): views.append(v) else: views.append(v.name) state['linkedViews'] = views if copy: return deepcopy(state) else: return state def setState(self, state): """Restore the state of this ViewBox. (see also getState)""" state = state.copy() self.setXLink(state['linkedViews'][0]) self.setYLink(state['linkedViews'][1]) del state['linkedViews'] self.state.update(state) self._applyMenuEnabled() self.updateViewRange() self.sigStateChanged.emit(self) def setBackgroundColor(self, color): """ Set the background color of the ViewBox. If color is None, then no background will be drawn. Added in version 0.9.9 """ self.background.setVisible(color is not None) self.state['background'] = color self.updateBackground() def setMouseMode(self, mode): """ Set the mouse interaction mode. *mode* must be either ViewBox.PanMode or ViewBox.RectMode. In PanMode, the left mouse button pans the view and the right button scales. In RectMode, the left button draws a rectangle which updates the visible region (this mode is more suitable for single-button mice) """ if mode not in [ViewBox.PanMode, ViewBox.RectMode]: raise Exception("Mode must be ViewBox.PanMode or ViewBox.RectMode") if mode == ViewBox.PanMode: self._rbScaleBox = None self.state['mouseMode'] = mode self.sigStateChanged.emit(self) def setLeftButtonAction(self, mode='rect'): ## for backward compatibility if mode.lower() == 'rect': self.setMouseMode(ViewBox.RectMode) elif mode.lower() == 'pan': self.setMouseMode(ViewBox.PanMode) else: raise Exception('graphicsItems:ViewBox:setLeftButtonAction: unknown mode = %s (Options are "pan" and "rect")' % mode) def innerSceneItem(self): return self.childGroup def setMouseEnabled(self, x=None, y=None): """ Set whether each axis is enabled for mouse interaction. *x*, *y* arguments must be True or False. This allows the user to pan/scale one axis of the view while leaving the other axis unchanged. """ if x is not None: self.state['mouseEnabled'][0] = x if y is not None: self.state['mouseEnabled'][1] = y self.sigStateChanged.emit(self) def mouseEnabled(self): return self.state['mouseEnabled'][:] def setMenuEnabled(self, enableMenu=True): self.state['enableMenu'] = enableMenu self._applyMenuEnabled() self.sigStateChanged.emit(self) def menuEnabled(self): return self.state.get('enableMenu', True) def _applyMenuEnabled(self): enableMenu = self.state.get("enableMenu", True) if enableMenu and self.menu is None: self.menu = ViewBoxMenu(self) self.updateViewLists() elif not enableMenu and self.menu is not None: self.menu.setParent(None) self.menu = None def addItem(self, item, ignoreBounds=False): """ Add a QGraphicsItem to this view. The view will include this item when determining how to set its range automatically unless *ignoreBounds* is True. """ if item.zValue() < self.zValue(): item.setZValue(self.zValue()+1) scene = self.scene() if scene is not None and scene is not item.scene(): scene.addItem(item) ## Necessary due to Qt bug: https://bugreports.qt-project.org/browse/QTBUG-18616 item.setParentItem(self.childGroup) if not ignoreBounds: self.addedItems.append(item) self.updateAutoRange() def removeItem(self, item): """Remove an item from this view.""" try: self.addedItems.remove(item) except: pass scene = self.scene() if scene is not None: scene.removeItem(item) item.setParentItem(None) self.updateAutoRange() def clear(self): for i in self.addedItems[:]: self.removeItem(i) for ch in self.childGroup.childItems(): ch.setParentItem(None) def resizeEvent(self, ev): if ev.oldSize() != ev.newSize(): self._viewPixelSizeCache = None self._matrixNeedsUpdate = True self.linkedXChanged() self.linkedYChanged() self.updateAutoRange() self.updateViewRange() # self._matrixNeedsUpdate = True self.background.setRect(self.rect()) self.borderRect.setRect(self.rect()) self.sigStateChanged.emit(self) self.sigResized.emit(self) def boundingRect(self): br = super().boundingRect() return br.adjusted(0, 0, +0.5, +0.5) def viewRange(self): """Return a the view's visible range as a list: [[xmin, xmax], [ymin, ymax]]""" return [x[:] for x in self.state['viewRange']] ## return copy def viewRect(self): """Return a QRectF bounding the region visible within the ViewBox""" try: vr0 = self.state['viewRange'][0] vr1 = self.state['viewRange'][1] return QtCore.QRectF(vr0[0], vr1[0], vr0[1]-vr0[0], vr1[1] - vr1[0]) except: print("make qrectf failed:", self.state['viewRange']) raise def targetRange(self): return [x[:] for x in self.state['targetRange']] ## return copy def targetRect(self): """ Return the region which has been requested to be visible. (this is not necessarily the same as the region that is *actually* visible-- resizing and aspect ratio constraints can cause targetRect() and viewRect() to differ) """ try: tr0 = self.state['targetRange'][0] tr1 = self.state['targetRange'][1] return QtCore.QRectF(tr0[0], tr1[0], tr0[1]-tr0[0], tr1[1] - tr1[0]) except: print("make qrectf failed:", self.state['targetRange']) raise def _resetTarget(self, force: bool = False): # Reset target range to exactly match current view range. # This is used during mouse interaction to prevent unpredictable # behavior (because the user is unaware of targetRange). if self.state['aspectLocked'] is False or force: # (interferes with aspect locking) self.state['targetRange'] = [self.state['viewRange'][0][:], self.state['viewRange'][1][:]] def _effectiveLimits(self): # Determines restricted effective scaling range when in log mapping mode if self.state['logMode'][0]: xlimits = (# constrain to the +1.7E308 to 2.2E-308 range of double float values max( self.state['limits']['xLimits'][0], -307.6 ), min( self.state['limits']['xLimits'][1], +308.2 ) ) else: xlimits = self.state['limits']['xLimits'] if self.state['logMode'][1]: ylimits = (# constrain to the +1.7E308 to 2.2E-308 range of double float values max( self.state['limits']['yLimits'][0], -307.6 ), min( self.state['limits']['yLimits'][1], +308.2 ) ) else: ylimits = self.state['limits']['yLimits'] # print('limits ', xlimits, ylimits) # diagnostic output should reflect additional limit in log mode return (xlimits, ylimits) def setRange(self, rect=None, xRange=None, yRange=None, padding=None, update=True, disableAutoRange=True): """ Set the visible range of the ViewBox. Must specify at least one of *rect*, *xRange*, or *yRange*. ================== ===================================================================== **Arguments:** *rect* (QRectF) The full range that should be visible in the view box. *xRange* (min,max) The range that should be visible along the x-axis. *yRange* (min,max) The range that should be visible along the y-axis. *padding* (float) Expand the view by a fraction of the requested range. By default, this value is set between the default padding value and 0.1 depending on the size of the ViewBox. *update* (bool) If True, update the range of the ViewBox immediately. Otherwise, the update is deferred until before the next render. *disableAutoRange* (bool) If True, auto-ranging is diabled. Otherwise, it is left unchanged. ================== ===================================================================== """ self._viewPixelSizeCache = None changes = {} # axes setRequested = [False, False] if rect is not None: changes = {0: [rect.left(), rect.right()], 1: [rect.top(), rect.bottom()]} setRequested = [True, True] if xRange is not None: changes[0] = xRange setRequested[0] = True if yRange is not None: changes[1] = yRange setRequested[1] = True if len(changes) == 0: raise Exception("Must specify at least one of rect, xRange, or yRange. (gave rect=%s)" % str(type(rect))) # Update axes one at a time changed = [False, False] # Disable auto-range for each axis that was requested to be set if disableAutoRange: xOff = False if setRequested[0] else None yOff = False if setRequested[1] else None self.enableAutoRange(x=xOff, y=yOff) changed.append(True) limits = self._effectiveLimits() # print('rng:limits ', limits) # diagnostic output should reflect additional limit in log mode # limits = (self.state['limits']['xLimits'], self.state['limits']['yLimits']) minRng = [self.state['limits']['xRange'][0], self.state['limits']['yRange'][0]] maxRng = [self.state['limits']['xRange'][1], self.state['limits']['yRange'][1]] for ax, range in changes.items(): mn = min(range) mx = max(range) # If we requested 0 range, try to preserve previous scale. # Otherwise just pick an arbitrary scale. preserve = False if mn == mx: preserve = True dy = self.state['viewRange'][ax][1] - self.state['viewRange'][ax][0] if dy == 0: dy = 1 mn -= dy*0.5 mx += dy*0.5 # Make sure that the range includes a usable number of quantization steps: # approx. eps : 3e-16 # * min. steps : 10 # * mean value : (mn+mx)*0.5 quantization_limit = (mn+mx) * 1.5e-15 # +/-10 discrete steps of double resolution if mx-mn < 2*quantization_limit: mn -= quantization_limit mx += quantization_limit # Make sure no nan/inf get through if not math.isfinite(mn) or not math.isfinite(mx): raise Exception("Cannot set range [%s, %s]" % (str(mn), str(mx))) # Apply padding if not preserve: if padding is None: xpad = self.suggestPadding(ax) else: xpad = padding p = (mx-mn) * xpad mn -= p mx += p # max range cannot be larger than bounds, if they are given if limits[ax][0] is not None and limits[ax][1] is not None: if maxRng[ax] is not None: maxRng[ax] = min(maxRng[ax], limits[ax][1] - limits[ax][0]) else: maxRng[ax] = limits[ax][1] - limits[ax][0] # If we have limits, we will have at least a max range as well if maxRng[ax] is not None or minRng[ax] is not None: diff = mx - mn if maxRng[ax] is not None and diff > maxRng[ax]: delta = maxRng[ax] - diff elif minRng[ax] is not None and diff < minRng[ax]: delta = minRng[ax] - diff else: delta = 0 mn -= delta / 2. mx += delta / 2. # Make sure our requested area is within limits, if any if limits[ax][0] is not None or limits[ax][1] is not None: lmn, lmx = limits[ax] if lmn is not None and mn < lmn: delta = lmn - mn # Shift the requested view to match our lower limit mn = lmn mx += delta elif lmx is not None and mx > lmx: delta = lmx - mx mx = lmx mn += delta # Set target range if self.state['targetRange'][ax] != [mn, mx]: self.state['targetRange'][ax] = [mn, mx] changed[ax] = True # Update viewRange to match targetRange as closely as possible while # accounting for aspect ratio constraint lockX, lockY = setRequested if lockX and lockY: lockX = False lockY = False self.updateViewRange(lockX, lockY) # If nothing has changed, we are done. if any(changed): # Update target rect for debugging if self.target.isVisible(): self.target.setRect(self.mapRectFromItem(self.childGroup, self.targetRect())) # If ortho axes have auto-visible-only, update them now # Note that aspect ratio constraints and auto-visible probably do not work together.. if changed[0] and self.state['autoVisibleOnly'][1] and (self.state['autoRange'][0] is not False): self._autoRangeNeedsUpdate = True elif changed[1] and self.state['autoVisibleOnly'][0] and (self.state['autoRange'][1] is not False): self._autoRangeNeedsUpdate = True self.sigStateChanged.emit(self) def setYRange(self, min, max, padding=None, update=True): """ Set the visible Y range of the view to [*min*, *max*]. The *padding* argument causes the range to be set larger by the fraction specified. (by default, this value is between the default padding and 0.1 depending on the size of the ViewBox) """ self.setRange(yRange=[min, max], update=update, padding=padding) def setXRange(self, min, max, padding=None, update=True): """ Set the visible X range of the view to [*min*, *max*]. The *padding* argument causes the range to be set larger by the fraction specified. (by default, this value is between the default padding and 0.1 depending on the size of the ViewBox) """ self.setRange(xRange=[min, max], update=update, padding=padding) def autoRange(self, padding=None, items=None, item=None): """ Set the range of the view box to make all children visible. Note that this is not the same as enableAutoRange, which causes the view to automatically auto-range whenever its contents are changed. ============== ============================================================= **Arguments:** padding The fraction of the total data range to add on to the final visible range. By default, this value is set between the default padding and 0.1 depending on the size of the ViewBox. items If specified, this is a list of items to consider when determining the visible range. ============== ============================================================= """ if item is None: bounds = self.childrenBoundingRect(items=items) else: bounds = self.mapFromItemToView(item, item.boundingRect()).boundingRect() if bounds is not None: self.setRange(bounds, padding=padding) def suggestPadding(self, axis): l = self.width() if axis==0 else self.height() def_pad = self.state['defaultPadding'] if def_pad == 0.: return def_pad # respect requested zero padding max_pad = max(0.1, def_pad) # don't shrink a large default padding if l > 0: padding = fn.clip_scalar( 50*def_pad / (l**0.5), def_pad, max_pad) else: padding = def_pad return padding def setLimits(self, **kwds): """ Set limits that constrain the possible view ranges. **Panning limits**. The following arguments define the region within the viewbox coordinate system that may be accessed by panning the view. =========== ============================================================ xMin Minimum allowed x-axis value xMax Maximum allowed x-axis value yMin Minimum allowed y-axis value yMax Maximum allowed y-axis value =========== ============================================================ **Scaling limits**. These arguments prevent the view being zoomed in or out too far. =========== ============================================================ minXRange Minimum allowed left-to-right span across the view. maxXRange Maximum allowed left-to-right span across the view. minYRange Minimum allowed top-to-bottom span across the view. maxYRange Maximum allowed top-to-bottom span across the view. =========== ============================================================ Added in version 0.9.9 """ update = False allowed = ['xMin', 'xMax', 'yMin', 'yMax', 'minXRange', 'maxXRange', 'minYRange', 'maxYRange'] for kwd in kwds: if kwd not in allowed: raise ValueError("Invalid keyword argument '%s'." % kwd) for axis in [0,1]: for mnmx in [0,1]: kwd = [['xMin', 'xMax'], ['yMin', 'yMax']][axis][mnmx] lname = ['xLimits', 'yLimits'][axis] if kwd in kwds and self.state['limits'][lname][mnmx] != kwds[kwd]: self.state['limits'][lname][mnmx] = kwds[kwd] update = True kwd = [['minXRange', 'maxXRange'], ['minYRange', 'maxYRange']][axis][mnmx] lname = ['xRange', 'yRange'][axis] if kwd in kwds and self.state['limits'][lname][mnmx] != kwds[kwd]: self.state['limits'][lname][mnmx] = kwds[kwd] update = True if update: self.updateViewRange() def scaleBy(self, s=None, center=None, x=None, y=None): """ Scale by *s* around given center point (or center of view). *s* may be a Point or tuple (x, y). Optionally, x or y may be specified individually. This allows the other axis to be left unaffected (note that using a scale factor of 1.0 may cause slight changes due to floating-point error). """ if s is not None: x, y = s[0], s[1] affect = [x is not None, y is not None] if not any(affect): return scale = Point([1.0 if x is None else x, 1.0 if y is None else y]) if self.state['aspectLocked'] is not False: scale[0] = scale[1] vr = self.targetRect() if center is None: center = Point(vr.center()) else: center = Point(center) tl = center + (vr.topLeft()-center) * scale br = center + (vr.bottomRight()-center) * scale if not affect[0]: self.setYRange(tl.y(), br.y(), padding=0) elif not affect[1]: self.setXRange(tl.x(), br.x(), padding=0) else: self.setRange(QtCore.QRectF(tl, br), padding=0) def translateBy(self, t=None, x=None, y=None): """ Translate the view by *t*, which may be a Point or tuple (x, y). Alternately, x or y may be specified independently, leaving the other axis unchanged (note that using a translation of 0 may still cause small changes due to floating-point error). """ vr = self.targetRect() if t is not None: t = Point(t) self.setRange(vr.translated(t), padding=0) else: if x is not None: x = vr.left()+x, vr.right()+x if y is not None: y = vr.top()+y, vr.bottom()+y if x is not None or y is not None: self.setRange(xRange=x, yRange=y, padding=0) def enableAutoRange(self, axis=None, enable=True, x=None, y=None): """ Enable (or disable) auto-range for *axis*, which may be ViewBox.XAxis, ViewBox.YAxis, or ViewBox.XYAxes for both (if *axis* is omitted, both axes will be changed). When enabled, the axis will automatically rescale when items are added/removed or change their shape. The argument *enable* may optionally be a float (0.0-1.0) which indicates the fraction of the data that should be visible (this only works with items implementing a dataBounds method, such as PlotDataItem). """ # support simpler interface: if x is not None or y is not None: if x is not None: self.enableAutoRange(ViewBox.XAxis, x) if y is not None: self.enableAutoRange(ViewBox.YAxis, y) return if enable is True: enable = 1.0 if axis is None: axis = ViewBox.XYAxes if axis == ViewBox.XYAxes or axis == 'xy': axes = [0, 1] elif axis == ViewBox.XAxis or axis == 'x': axes = [0] elif axis == ViewBox.YAxis or axis == 'y': axes = [1] else: raise Exception('axis argument must be ViewBox.XAxis, ViewBox.YAxis, or ViewBox.XYAxes.') for ax in axes: if self.state['autoRange'][ax] != enable: # If we are disabling, do one last auto-range to make sure that # previously scheduled auto-range changes are enacted if enable is False and self._autoRangeNeedsUpdate: self.updateAutoRange() self.state['autoRange'][ax] = enable self._autoRangeNeedsUpdate |= (enable is not False) self.update() self.sigStateChanged.emit(self) def disableAutoRange(self, axis=None): """Disables auto-range. (See enableAutoRange)""" self.enableAutoRange(axis, enable=False) def autoRangeEnabled(self): return self.state['autoRange'][:] def setAutoPan(self, x=None, y=None): """Set whether automatic range will only pan (not scale) the view. """ if x is not None: self.state['autoPan'][0] = x if y is not None: self.state['autoPan'][1] = y if None not in [x,y]: self.updateAutoRange() def setAutoVisible(self, x=None, y=None): """Set whether automatic range uses only visible data when determining the range to show. """ if x is not None: self.state['autoVisibleOnly'][0] = x if x is True: self.state['autoVisibleOnly'][1] = False if y is not None: self.state['autoVisibleOnly'][1] = y if y is True: self.state['autoVisibleOnly'][0] = False if x is not None or y is not None: self.updateAutoRange() def updateAutoRange(self): ## Break recursive loops when auto-ranging. ## This is needed because some items change their size in response ## to a view change. if self._updatingRange: return self._updatingRange = True try: if not any(self.state['autoRange']): return targetRect = self.viewRange() fractionVisible = self.state['autoRange'][:] for i in [0,1]: if type(fractionVisible[i]) is bool: fractionVisible[i] = 1.0 childRange = None order = [0,1] if self.state['autoVisibleOnly'][0] is True: order = [1,0] args = {} for ax in order: if self.state['autoRange'][ax] is False: continue if self.state['autoVisibleOnly'][ax]: oRange = [None, None] oRange[ax] = targetRect[1-ax] childRange = self.childrenBounds(frac=fractionVisible, orthoRange=oRange) else: if childRange is None: childRange = self.childrenBounds(frac=fractionVisible) ## Make corrections to range xr = childRange[ax] if xr is not None: if self.state['autoPan'][ax]: x = sum(xr) * 0.5 w2 = (targetRect[ax][1]-targetRect[ax][0]) / 2. childRange[ax] = [x-w2, x+w2] else: padding = self.suggestPadding(ax) wp = (xr[1] - xr[0]) * padding childRange[ax][0] -= wp childRange[ax][1] += wp targetRect[ax] = childRange[ax] args['xRange' if ax == 0 else 'yRange'] = targetRect[ax] # check for and ignore bad ranges for k in ['xRange', 'yRange']: if k in args: if not math.isfinite(args[k][0]) or not math.isfinite(args[k][1]): _ = args.pop(k) #print("Warning: %s is invalid: %s" % (k, str(r)) if len(args) == 0: return args['padding'] = 0.0 args['disableAutoRange'] = False self.setRange(**args) finally: self._autoRangeNeedsUpdate = False self._updatingRange = False def setXLink(self, view): """Link this view's X axis to another view. (see LinkView)""" self.linkView(self.XAxis, view) def setYLink(self, view): """Link this view's Y axis to another view. (see LinkView)""" self.linkView(self.YAxis, view) def setLogMode(self, axis, logMode): """Informs ViewBox that log mode is active for the specified axis, so that the view range cen be restricted""" if axis == 'x': self.state['logMode'][0] = bool(logMode) # print('x log mode', self.state['logMode'][0] ) elif axis == 'y': self.state['logMode'][1] = bool(logMode) # print('x log mode', self.state['logMode'][0] ) def linkView(self, axis, view): """ Link X or Y axes of two views and unlink any previously connected axes. *axis* must be ViewBox.XAxis or ViewBox.YAxis. If view is None, the axis is left unlinked. """ if isinstance(view, str): if view == '': view = None else: view = ViewBox.NamedViews.get(view, view) ## convert view name to ViewBox if possible if hasattr(view, 'implements') and view.implements('ViewBoxWrapper'): view = view.getViewBox() ## used to connect/disconnect signals between a pair of views if axis == ViewBox.XAxis: signal = 'sigXRangeChanged' slot = self.linkedXChanged else: signal = 'sigYRangeChanged' slot = self.linkedYChanged oldLink = self.linkedView(axis) if oldLink is not None: try: getattr(oldLink, signal).disconnect(slot) oldLink.sigResized.disconnect(slot) except (TypeError, RuntimeError): ## This can occur if the view has been deleted already pass if view is None or isinstance(view, str): self.state['linkedViews'][axis] = view else: self.state['linkedViews'][axis] = weakref.ref(view) getattr(view, signal).connect(slot) view.sigResized.connect(slot) if view.autoRangeEnabled()[axis] is not False: self.enableAutoRange(axis, False) slot() else: if self.autoRangeEnabled()[axis] is False: slot() self.sigStateChanged.emit(self) def blockLink(self, b): self.linksBlocked = b ## prevents recursive plot-change propagation def linkedXChanged(self): ## called when x range of linked view has changed view = self.linkedView(0) self.linkedViewChanged(view, ViewBox.XAxis) def linkedYChanged(self): ## called when y range of linked view has changed view = self.linkedView(1) self.linkedViewChanged(view, ViewBox.YAxis) def linkedView(self, ax): ## Return the linked view for axis *ax*. ## this method _always_ returns either a ViewBox or None. v = self.state['linkedViews'][ax] if v is None or isinstance(v, str): return None else: return v() ## dereference weakref pointer. If the reference is dead, this returns None def linkedViewChanged(self, view, axis): if self.linksBlocked or view is None: return #print self.name, "ViewBox.linkedViewChanged", axis, view.viewRange()[axis] vr = view.viewRect() vg = view.screenGeometry() sg = self.screenGeometry() if vg is None or sg is None: return view.blockLink(True) try: if axis == ViewBox.XAxis: overlap = min(sg.right(), vg.right()) - max(sg.left(), vg.left()) if overlap < min(vg.width()/3, sg.width()/3): ## if less than 1/3 of views overlap, ## then just replicate the view x1 = vr.left() x2 = vr.right() else: ## views overlap; line them up upp = float(vr.width()) / vg.width() if self.xInverted(): x1 = vr.left() + (sg.right()-vg.right()) * upp else: x1 = vr.left() + (sg.x()-vg.x()) * upp x2 = x1 + sg.width() * upp self.enableAutoRange(ViewBox.XAxis, False) self.setXRange(x1, x2, padding=0) else: overlap = min(sg.bottom(), vg.bottom()) - max(sg.top(), vg.top()) if overlap < min(vg.height()/3, sg.height()/3): ## if less than 1/3 of views overlap, ## then just replicate the view y1 = vr.top() y2 = vr.bottom() else: ## views overlap; line them up upp = float(vr.height()) / vg.height() if self.yInverted(): y2 = vr.bottom() + (sg.bottom()-vg.bottom()) * upp else: y2 = vr.bottom() + (sg.top()-vg.top()) * upp y1 = y2 - sg.height() * upp self.enableAutoRange(ViewBox.YAxis, False) self.setYRange(y1, y2, padding=0) finally: view.blockLink(False) def screenGeometry(self): """return the screen geometry of the viewbox""" v = self.getViewWidget() if v is None: return None b = self.sceneBoundingRect() wr = v.mapFromScene(b).boundingRect() pos = v.mapToGlobal(v.pos()) wr.adjust(pos.x(), pos.y(), pos.x(), pos.y()) return wr def itemsChanged(self): ## called when items are added/removed from self.childGroup self.updateAutoRange() def itemBoundsChanged(self, item): self._itemBoundsCache.pop(item, None) if (self.state['autoRange'][0] is not False) or (self.state['autoRange'][1] is not False): self._autoRangeNeedsUpdate = True self.update() def _invertAxis(self, ax, inv): key = 'xy'[ax] + 'Inverted' if self.state[key] == inv: return self.state[key] = inv self._matrixNeedsUpdate = True # updateViewRange won't detect this for us self.updateViewRange() self.update() self.sigStateChanged.emit(self) if ax: self.sigYRangeChanged.emit(self, tuple(self.state['viewRange'][ax])) else: self.sigXRangeChanged.emit(self, tuple(self.state['viewRange'][ax])) def invertY(self, b=True): """ By default, the positive y-axis points upward on the screen. Use invertY(True) to reverse the y-axis. """ self._invertAxis(1, b) def yInverted(self): return self.state['yInverted'] def invertX(self, b=True): """ By default, the positive x-axis points rightward on the screen. Use invertX(True) to reverse the x-axis. """ self._invertAxis(0, b) def xInverted(self): return self.state['xInverted'] def setBorder(self, *args, **kwds): """ Set the pen used to draw border around the view If border is None, then no border will be drawn. Added in version 0.9.10 See :func:`mkPen ` for arguments. """ self.border = fn.mkPen(*args, **kwds) self.borderRect.setPen(self.border) def setDefaultPadding(self, padding=0.02): """ Sets the fraction of the data range that is used to pad the view range in when auto-ranging. By default, this fraction is 0.02. """ self.state['defaultPadding'] = padding def setAspectLocked(self, lock=True, ratio=1): """ If the aspect ratio is locked, view scaling must always preserve the aspect ratio. By default, the ratio is set to 1; x and y both have the same scaling. This ratio can be overridden (xScale/yScale), or use None to lock in the current ratio. """ if not lock: if self.state['aspectLocked'] == False: return self.state['aspectLocked'] = False else: currentRatio = self.getAspectRatio() if ratio is None: ratio = currentRatio if self.state['aspectLocked'] == ratio: # nothing to change return self.state['aspectLocked'] = ratio if ratio != currentRatio: ## If this would change the current range, do that now self.updateViewRange() self.updateAutoRange() self.updateViewRange() self.sigStateChanged.emit(self) def childTransform(self): """ Return the transform that maps from child(item in the childGroup) coordinates to local coordinates. (This maps from inside the viewbox to outside) """ self.updateMatrix() m = self.childGroup.transform() return m def mapToView(self, obj): """Maps from the local coordinates of the ViewBox to the coordinate system displayed inside the ViewBox""" self.updateMatrix() m = fn.invertQTransform(self.childTransform()) return m.map(obj) def mapFromView(self, obj): """Maps from the coordinate system displayed inside the ViewBox to the local coordinates of the ViewBox""" self.updateMatrix() m = self.childTransform() return m.map(obj) def mapSceneToView(self, obj): """Maps from scene coordinates to the coordinate system displayed inside the ViewBox""" self.updateMatrix() return self.mapToView(self.mapFromScene(obj)) def mapViewToScene(self, obj): """Maps from the coordinate system displayed inside the ViewBox to scene coordinates""" self.updateMatrix() return self.mapToScene(self.mapFromView(obj)) def mapFromItemToView(self, item, obj): """Maps *obj* from the local coordinate system of *item* to the view coordinates""" self.updateMatrix() return self.childGroup.mapFromItem(item, obj) def mapFromViewToItem(self, item, obj): """Maps *obj* from view coordinates to the local coordinate system of *item*.""" self.updateMatrix() return self.childGroup.mapToItem(item, obj) def mapViewToDevice(self, obj): self.updateMatrix() return self.mapToDevice(self.mapFromView(obj)) def mapDeviceToView(self, obj): self.updateMatrix() return self.mapToView(self.mapFromDevice(obj)) def viewPixelSize(self): """Return the (width, height) of a screen pixel in view coordinates.""" if self._viewPixelSizeCache is None: o = self.mapToView(Point(0, 0)) px, py = [Point(self.mapToView(v) - o) for v in self.pixelVectors()] self._viewPixelSizeCache = (px.length(), py.length()) return self._viewPixelSizeCache def itemBoundingRect(self, item): """Return the bounding rect of the item in view coordinates""" return self.mapSceneToView(item.sceneBoundingRect()).boundingRect() def wheelEvent(self, ev, axis=None): if axis in (0, 1): mask = [False, False] mask[axis] = self.state['mouseEnabled'][axis] else: mask = self.state['mouseEnabled'][:] s = 1.02 ** (ev.delta() * self.state['wheelScaleFactor']) # actual scaling factor s = [(None if m is False else s) for m in mask] center = Point(fn.invertQTransform(self.childGroup.transform()).map(ev.pos())) self._resetTarget() self.scaleBy(s, center) ev.accept() self.sigRangeChangedManually.emit(mask) def mouseClickEvent(self, ev): if ev.button() == QtCore.Qt.MouseButton.RightButton and self.menuEnabled(): ev.accept() self.raiseContextMenu(ev) def raiseContextMenu(self, ev): menu = self.getMenu(ev) if menu is not None: self.scene().addParentContextMenus(self, menu, ev) menu.popup(ev.screenPos().toPoint()) def getMenu(self, ev): return self.menu def getContextMenus(self, event): return self.menu.actions() if self.menuEnabled() else [] def mouseDragEvent(self, ev, axis=None): ## if axis is specified, event will only affect that axis. ev.accept() ## we accept all buttons pos = ev.pos() lastPos = ev.lastPos() dif = pos - lastPos dif = dif * -1 ## Ignore axes if mouse is disabled mouseEnabled = np.array(self.state['mouseEnabled'], dtype=np.float64) mask = mouseEnabled.copy() if axis is not None: mask[1-axis] = 0.0 ## Scale or translate based on mouse button if ev.button() in [QtCore.Qt.MouseButton.LeftButton, QtCore.Qt.MouseButton.MiddleButton]: if self.state['mouseMode'] == ViewBox.RectMode and axis is None: if ev.isFinish(): ## This is the final move in the drag; change the view scale now #print "finish" self.rbScaleBox.hide() ax = QtCore.QRectF(Point(ev.buttonDownPos(ev.button())), Point(pos)) ax = self.childGroup.mapRectFromParent(ax) self.showAxRect(ax) self.axHistoryPointer += 1 self.axHistory = self.axHistory[:self.axHistoryPointer] + [ax] else: ## update shape of scale box self.updateScaleBox(ev.buttonDownPos(), ev.pos()) else: tr = self.childGroup.transform() tr = fn.invertQTransform(tr) tr = tr.map(dif*mask) - tr.map(Point(0,0)) x = tr.x() if mask[0] == 1 else None y = tr.y() if mask[1] == 1 else None self._resetTarget() if x is not None or y is not None: self.translateBy(x=x, y=y) self.sigRangeChangedManually.emit(self.state['mouseEnabled']) elif ev.button() & QtCore.Qt.MouseButton.RightButton: #print "vb.rightDrag" if self.state['aspectLocked'] is not False: mask[0] = 0 dif = ev.screenPos() - ev.lastScreenPos() dif = np.array([dif.x(), dif.y()]) dif[0] *= -1 s = ((mask * 0.02) + 1) ** dif tr = self.childGroup.transform() tr = fn.invertQTransform(tr) x = s[0] if mouseEnabled[0] == 1 else None y = s[1] if mouseEnabled[1] == 1 else None center = Point(tr.map(ev.buttonDownPos(QtCore.Qt.MouseButton.RightButton))) self._resetTarget() self.scaleBy(x=x, y=y, center=center) self.sigRangeChangedManually.emit(self.state['mouseEnabled']) def keyPressEvent(self, ev): """ This routine should capture key presses in the current view box. Key presses are used only when mouse mode is RectMode The following events are implemented: ctrl-A : zooms out to the default "full" view of the plot ctrl-+ : moves forward in the zooming stack (if it exists) ctrl-- : moves backward in the zooming stack (if it exists) """ ev.accept() if ev.text() == '-': self.scaleHistory(-1) elif ev.text() in ['+', '=']: self.scaleHistory(1) elif ev.key() == QtCore.Qt.Key.Key_Backspace: self.scaleHistory(len(self.axHistory)) else: ev.ignore() def scaleHistory(self, d): if len(self.axHistory) == 0: return ptr = max(0, min(len(self.axHistory)-1, self.axHistoryPointer+d)) if ptr != self.axHistoryPointer: self.axHistoryPointer = ptr self.showAxRect(self.axHistory[ptr]) def updateScaleBox(self, p1, p2): r = QtCore.QRectF(p1, p2) r = self.childGroup.mapRectFromParent(r) self.rbScaleBox.setPos(r.topLeft()) tr = QtGui.QTransform.fromScale(r.width(), r.height()) self.rbScaleBox.setTransform(tr) self.rbScaleBox.show() def showAxRect(self, ax, **kwargs): """Set the visible range to the given rectangle Passes keyword arguments to setRange """ self.setRange(ax.normalized(), **kwargs) # be sure w, h are correct coordinates self.sigRangeChangedManually.emit(self.state['mouseEnabled']) def allChildren(self, item=None): """Return a list of all children and grandchildren of this ViewBox""" if item is None: item = self.childGroup children = [item] for ch in item.childItems(): children.extend(self.allChildren(ch)) return children def childrenBounds(self, frac=None, orthoRange=(None,None), items=None): """Return the bounding range of all children. [[xmin, xmax], [ymin, ymax]] Values may be None if there are no specific bounds for an axis. """ profiler = debug.Profiler() if items is None: items = self.addedItems ## First collect all boundary information itemBounds = [] for item in items: if not item.isVisible() or not item.scene() is self.scene(): continue useX = True useY = True if hasattr(item, 'dataBounds') and item.dataBounds is not None: if frac is None: frac = (1.0, 1.0) xr = item.dataBounds(0, frac=frac[0], orthoRange=orthoRange[0]) yr = item.dataBounds(1, frac=frac[1], orthoRange=orthoRange[1]) pxPad = 0 if not hasattr(item, 'pixelPadding') else item.pixelPadding() if ( xr is None or (xr[0] is None and xr[1] is None) or not math.isfinite(xr[0]) or not math.isfinite(xr[1]) ): useX = False xr = (0,0) if ( yr is None or (yr[0] is None and yr[1] is None) or not math.isfinite(yr[0]) or not math.isfinite(yr[1]) ): useY = False yr = (0,0) bounds = QtCore.QRectF(xr[0], yr[0], xr[1]-xr[0], yr[1]-yr[0]) bounds = self.mapFromItemToView(item, bounds).boundingRect() if not any([useX, useY]): continue ## If we are ignoring only one axis, we need to check for rotations if useX != useY: ## != means xor ang = round(item.transformAngle()) if ang == 0 or ang == 180: pass elif ang == 90 or ang == 270: useX, useY = useY, useX else: ## Item is rotated at non-orthogonal angle, ignore bounds entirely. ## Not really sure what is the expected behavior in this case. continue ## need to check for item rotations and decide how best to apply this boundary. itemBounds.append((bounds, useX, useY, pxPad)) else: if item.flags() & item.GraphicsItemFlag.ItemHasNoContents: continue bounds = self.mapFromItemToView(item, item.boundingRect()).boundingRect() itemBounds.append((bounds, True, True, 0)) ## determine tentative new range range = [None, None] for bounds, useX, useY, px in itemBounds: if useY: if range[1] is not None: range[1] = [min(bounds.top(), range[1][0]), max(bounds.bottom(), range[1][1])] else: range[1] = [bounds.top(), bounds.bottom()] if useX: if range[0] is not None: range[0] = [min(bounds.left(), range[0][0]), max(bounds.right(), range[0][1])] else: range[0] = [bounds.left(), bounds.right()] profiler() ## Now expand any bounds that have a pixel margin ## This must be done _after_ we have a good estimate of the new range ## to ensure that the pixel size is roughly accurate. w = self.width() h = self.height() if w > 0 and range[0] is not None: pxSize = (range[0][1] - range[0][0]) / w for bounds, useX, useY, px in itemBounds: if px == 0 or not useX: continue range[0][0] = min(range[0][0], bounds.left() - px*pxSize) range[0][1] = max(range[0][1], bounds.right() + px*pxSize) if h > 0 and range[1] is not None: pxSize = (range[1][1] - range[1][0]) / h for bounds, useX, useY, px in itemBounds: if px == 0 or not useY: continue range[1][0] = min(range[1][0], bounds.top() - px*pxSize) range[1][1] = max(range[1][1], bounds.bottom() + px*pxSize) return range def childrenBoundingRect(self, *args, **kwds): range = self.childrenBounds(*args, **kwds) tr = self.targetRange() if range[0] is None: range[0] = tr[0] if range[1] is None: range[1] = tr[1] bounds = QtCore.QRectF(range[0][0], range[1][0], range[0][1]-range[0][0], range[1][1]-range[1][0]) return bounds # Including a prepareForPaint call is part of the Qt strategy to # defer expensive redraw opertions until requested by a 'sigPrepareForPaint' signal # # However, as currently implemented, a call to prepareForPaint as part of the regular # 'update' call results in an undesired reset of pan/zoom: # https://github.com/pyqtgraph/pyqtgraph/issues/2029 # # def update(self, *args, **kwargs): # self.prepareForPaint() # GraphicsWidget.update(self, *args, **kwargs) def updateViewRange(self, forceX=False, forceY=False): ## Update viewRange to match targetRange as closely as possible, given ## aspect ratio constraints. The *force* arguments are used to indicate ## which axis (if any) should be unchanged when applying constraints. viewRange = [self.state['targetRange'][0][:], self.state['targetRange'][1][:]] changed = [False, False] #-------- Make correction for aspect ratio constraint ---------- # aspect is (widget w/h) / (view range w/h) aspect = self.state['aspectLocked'] # size ratio / view ratio tr = self.targetRect() bounds = self.rect() limits = self._effectiveLimits() # print('upd:limits ', limits) # diagnostic output should reflect additional limit in log mode minRng = [self.state['limits']['xRange'][0], self.state['limits']['yRange'][0]] maxRng = [self.state['limits']['xRange'][1], self.state['limits']['yRange'][1]] for axis in [0, 1]: if limits[axis][0] is None and limits[axis][1] is None and minRng[axis] is None and maxRng[axis] is None: continue # max range cannot be larger than bounds, if they are given if limits[axis][0] is not None and limits[axis][1] is not None: if maxRng[axis] is not None: maxRng[axis] = min(maxRng[axis], limits[axis][1] - limits[axis][0]) else: maxRng[axis] = limits[axis][1] - limits[axis][0] if aspect is not False and 0 not in [aspect, tr.height(), bounds.height(), bounds.width()]: ## This is the view range aspect ratio we have requested targetRatio = tr.width() / tr.height() if tr.height() != 0 else 1 ## This is the view range aspect ratio we need to obey aspect constraint viewRatio = (bounds.width() / bounds.height() if bounds.height() != 0 else 1) / aspect viewRatio = 1 if viewRatio == 0 else viewRatio # Calculate both the x and y ranges that would be needed to obtain the desired aspect ratio dy = 0.5 * (tr.width() / viewRatio - tr.height()) dx = 0.5 * (tr.height() * viewRatio - tr.width()) rangeY = [self.state['targetRange'][1][0] - dy, self.state['targetRange'][1][1] + dy] rangeX = [self.state['targetRange'][0][0] - dx, self.state['targetRange'][0][1] + dx] canidateRange = [rangeX, rangeY] # Decide which range to try to keep unchanged #print self.name, "aspect:", aspect, "changed:", changed, "auto:", self.state['autoRange'] if forceX: ax = 0 elif forceY: ax = 1 else: # if we are not required to keep a particular axis unchanged, # then try to make the entire target range visible ax = 0 if targetRatio > viewRatio else 1 target = 0 if ax == 1 else 1 # See if this choice would cause out-of-range issues if maxRng is not None or minRng is not None: diff = canidateRange[target][1] - canidateRange[target][0] if maxRng[target] is not None and diff > maxRng[target] or \ minRng[target] is not None and diff < minRng[target]: # tweak the target range down so we can still pan properly viewRange[ax] = canidateRange[ax] self.state['viewRange'][ax] = viewRange[ax] self._resetTarget(force=True) ax = target # Switch the "fixed" axes if ax == 0: ## view range needs to be taller than target if dy != 0: changed[1] = True viewRange[1] = rangeY else: ## view range needs to be wider than target if dx != 0: changed[0] = True viewRange[0] = rangeX # Ensure, that the new viewRange obeys all the limits for axis in [0, 1]: range = viewRange[axis][1] - viewRange[axis][0] if minRng[axis] is not None and minRng[axis] > range: viewRange[axis][1] = viewRange[axis][0] + minRng[axis] self.state["targetRange"][axis] = viewRange[axis] if maxRng[axis] is not None and maxRng[axis] < range: viewRange[axis][1] = viewRange[axis][0] + maxRng[axis] self.state["targetRange"][axis] = viewRange[axis] if limits[axis][0] is not None and viewRange[axis][0] < limits[axis][0]: delta = limits[axis][0] - viewRange[axis][0] viewRange[axis][0] += delta viewRange[axis][1] += delta self.state["targetRange"][axis] = viewRange[axis] if limits[axis][1] is not None and viewRange[axis][1] > limits[axis][1]: delta = viewRange[axis][1] - limits[axis][1] viewRange[axis][0] -= delta viewRange[axis][1] -= delta self.state["targetRange"][axis] = viewRange[axis] # Consider only as 'changed' if the differences are larger than floating point inaccuracies, # which regularly appear in magnitude of around 1e-15. Therefore, 1e-9 as factor was chosen # more or less arbitrarily. thresholds = [(viewRange[axis][1] - viewRange[axis][0]) * 1.0e-9 for axis in (0,1)] changed = [ (abs(viewRange[axis][0] - self.state["viewRange"][axis][0]) > thresholds[axis]) or (abs(viewRange[axis][1] - self.state["viewRange"][axis][1]) > thresholds[axis]) for axis in (0, 1) ] self.state['viewRange'] = viewRange if any(changed): self._matrixNeedsUpdate = True self.update() # Inform linked views that the range has changed for ax in [0, 1]: if not changed[ax]: continue link = self.linkedView(ax) if link is not None: link.linkedViewChanged(self, ax) # emit range change signals # print('announcing view range changes:',self.state['viewRange'] ) if changed[0]: self.sigXRangeChanged.emit(self, tuple(self.state['viewRange'][0])) if changed[1]: self.sigYRangeChanged.emit(self, tuple(self.state['viewRange'][1])) self.sigRangeChanged.emit(self, self.state['viewRange'], changed) def updateMatrix(self, changed=None): if not self._matrixNeedsUpdate: return ## Make the childGroup's transform match the requested viewRange. bounds = self.rect() vr = self.viewRect() if vr.height() == 0 or vr.width() == 0: return scale = Point(bounds.width()/vr.width(), bounds.height()/vr.height()) if not self.state['yInverted']: scale = scale * Point(1, -1) if self.state['xInverted']: scale = scale * Point(-1, 1) m = QtGui.QTransform() ## First center the viewport at 0 center = bounds.center() m.translate(center.x(), center.y()) ## Now scale and translate properly m.scale(scale[0], scale[1]) st = Point(vr.center()) m.translate(-st[0], -st[1]) self.childGroup.setTransform(m) self._matrixNeedsUpdate = False self.sigTransformChanged.emit(self) ## segfaults here: 1 def paint(self, p, opt, widget): if self.border is not None: bounds = self.shape() p.setPen(self.border) #p.fillRect(bounds, QtGui.QColor(0, 0, 0)) p.drawPath(bounds) #p.setPen(fn.mkPen('r')) #path = QtGui.QPainterPath() #path.addRect(self.targetRect()) #tr = self.mapFromView(path) #p.drawPath(tr) def updateBackground(self): bg = self.state['background'] if bg is None: self.background.hide() else: self.background.show() self.background.setBrush(fn.mkBrush(bg)) def updateViewLists(self): try: self.window() except RuntimeError: ## this view has already been deleted; it will probably be collected shortly. return def view_key(view): return (view.window() is self.window(), view.name) ## make a sorted list of all named views nv = sorted(ViewBox.NamedViews.values(), key=view_key) if self in nv: nv.remove(self) if self.menu is not None: self.menu.setViewList(nv) for ax in [0,1]: link = self.state['linkedViews'][ax] if isinstance(link, str): ## axis has not been linked yet; see if it's possible now for v in nv: if link == v.name: self.linkView(ax, v) @staticmethod def updateAllViewLists(): for v in ViewBox.AllViews: v.updateViewLists() @staticmethod def forgetView(vid, name): if ViewBox is None: ## can happen as python is shutting down return if QtWidgets.QApplication.instance() is None: return ## Called with ID and name of view (the view itself is no longer available) for v in list(ViewBox.AllViews.keys()): if id(v) == vid: ViewBox.AllViews.pop(v) break ViewBox.NamedViews.pop(name, None) ViewBox.updateAllViewLists() @staticmethod def quit(): ## called when the application is about to exit. ## this disables all callbacks, which might otherwise generate errors if invoked during exit. for k in ViewBox.AllViews: if isQObjectAlive(k) and getConfigOption('crashWarning'): sys.stderr.write('Warning: ViewBox should be closed before application exit.\n') # PySide >= 6.7 prints a warning if we attempt to disconnect # a signal that isn't connected. if ( QT_LIB == 'PySide6' and isQObjectAlive(k) and k.receivers(QtCore.SIGNAL("destroyed()")) == 0 ): continue try: k.destroyed.disconnect() except RuntimeError: ## signal is already disconnected. pass except TypeError: ## view has already been deleted (?) pass except AttributeError: # PySide has deleted signal pass def locate(self, item, timeout=3.0, children=False): """ Temporarily display the bounding rect of an item and lines connecting to the center of the view. This is useful for determining the location of items that may be out of the range of the ViewBox. if allChildren is True, then the bounding rect of all item's children will be shown instead. """ self.clearLocate() if item.scene() is not self.scene(): raise Exception("Item does not share a scene with this ViewBox.") c = self.viewRect().center() if children: br = self.mapFromItemToView(item, item.childrenBoundingRect()).boundingRect() else: br = self.mapFromItemToView(item, item.boundingRect()).boundingRect() g = ItemGroup() g.setParentItem(self.childGroup) self.locateGroup = g g.box = QtWidgets.QGraphicsRectItem(br) g.box.setParentItem(g) g.lines = [] for p in (br.topLeft(), br.bottomLeft(), br.bottomRight(), br.topRight()): line = QtWidgets.QGraphicsLineItem(c.x(), c.y(), p.x(), p.y()) line.setParentItem(g) g.lines.append(line) for item in g.childItems(): item.setPen(fn.mkPen(color='y', width=3)) g.setZValue(1000000) if children: g.path = QtWidgets.QGraphicsPathItem(g.childrenShape()) else: g.path = QtWidgets.QGraphicsPathItem(g.shape()) g.path.setParentItem(g) g.path.setPen(fn.mkPen('g')) g.path.setZValue(100) QtCore.QTimer.singleShot(timeout*1000, self.clearLocate) def clearLocate(self): if self.locateGroup is None: return self.scene().removeItem(self.locateGroup) self.locateGroup = None from .ViewBoxMenu import ViewBoxMenu pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ViewBox/ViewBoxMenu.py000066400000000000000000000211731457240071200266270ustar00rootroot00000000000000from ...Qt import QtCore, QtGui, QtWidgets from ...WidgetGroup import WidgetGroup from . import axisCtrlTemplate_generic as ui_template import weakref translate = QtCore.QCoreApplication.translate class ViewBoxMenu(QtWidgets.QMenu): def __init__(self, view): QtWidgets.QMenu.__init__(self) self.view = weakref.ref(view) ## keep weakref to view to avoid circular reference (don't know why, but this prevents the ViewBox from being collected) self.valid = False ## tells us whether the ui needs to be updated self.viewMap = weakref.WeakValueDictionary() ## weakrefs to all views listed in the link combos self.setTitle(translate("ViewBox", "ViewBox options")) self.viewAll = QtGui.QAction(translate("ViewBox", "View All"), self) self.viewAll.triggered.connect(self.autoRange) self.addAction(self.viewAll) self.ctrl = [] self.widgetGroups = [] self.dv = QtGui.QDoubleValidator(self) for axis in 'XY': m = self.addMenu(f"{axis} {translate('ViewBox', 'axis')}") w = QtWidgets.QWidget() ui = ui_template.Ui_Form() ui.setupUi(w) a = QtWidgets.QWidgetAction(self) a.setDefaultWidget(w) m.addAction(a) self.ctrl.append(ui) wg = WidgetGroup(w) self.widgetGroups.append(wg) connects = [ (ui.mouseCheck.toggled, 'MouseToggled'), (ui.manualRadio.clicked, 'ManualClicked'), (ui.minText.editingFinished, 'RangeTextChanged'), (ui.maxText.editingFinished, 'RangeTextChanged'), (ui.autoRadio.clicked, 'AutoClicked'), (ui.autoPercentSpin.valueChanged, 'AutoSpinChanged'), (ui.linkCombo.currentIndexChanged, 'LinkComboChanged'), (ui.autoPanCheck.toggled, 'AutoPanToggled'), (ui.visibleOnlyCheck.toggled, 'VisibleOnlyToggled') ] for sig, fn in connects: sig.connect(getattr(self, axis.lower()+fn)) self.ctrl[0].invertCheck.toggled.connect(self.xInvertToggled) self.ctrl[1].invertCheck.toggled.connect(self.yInvertToggled) leftMenu = self.addMenu(translate("ViewBox", "Mouse Mode")) group = QtGui.QActionGroup(self) group.triggered.connect(self.setMouseMode) pan = QtGui.QAction(translate("ViewBox", "3 button"), group) zoom = QtGui.QAction(translate("ViewBox", "1 button"), group) pan.setCheckable(True) zoom.setCheckable(True) leftMenu.addActions(group.actions()) self.mouseModes = [pan, zoom] self.view().sigStateChanged.connect(self.viewStateChanged) self.updateState() def viewStateChanged(self): self.valid = False if self.ctrl[0].minText.isVisible() or self.ctrl[1].minText.isVisible(): self.updateState() def updateState(self): ## Something about the viewbox has changed; update the menu GUI state = self.view().getState(copy=False) if state['mouseMode'] == ViewBox.PanMode: self.mouseModes[0].setChecked(True) else: self.mouseModes[1].setChecked(True) for i in [0,1]: # x, y tr = state['targetRange'][i] self.ctrl[i].minText.setText("%0.5g" % tr[0]) self.ctrl[i].maxText.setText("%0.5g" % tr[1]) if state['autoRange'][i] is not False: self.ctrl[i].autoRadio.setChecked(True) if state['autoRange'][i] is not True: self.ctrl[i].autoPercentSpin.setValue(int(state['autoRange'][i] * 100)) else: self.ctrl[i].manualRadio.setChecked(True) self.ctrl[i].mouseCheck.setChecked(state['mouseEnabled'][i]) ## Update combo to show currently linked view c = self.ctrl[i].linkCombo c.blockSignals(True) try: view = state['linkedViews'][i] ## will always be string or None if view is None: view = '' ind = c.findText(view) if ind == -1: ind = 0 c.setCurrentIndex(ind) finally: c.blockSignals(False) self.ctrl[i].autoPanCheck.setChecked(state['autoPan'][i]) self.ctrl[i].visibleOnlyCheck.setChecked(state['autoVisibleOnly'][i]) xy = ['x', 'y'][i] self.ctrl[i].invertCheck.setChecked(state.get(xy+'Inverted', False)) self.valid = True def popup(self, *args): if not self.valid: self.updateState() QtWidgets.QMenu.popup(self, *args) def autoRange(self): self.view().autoRange() ## don't let signal call this directly--it'll add an unwanted argument def xMouseToggled(self, b): self.view().setMouseEnabled(x=b) def xManualClicked(self): self.view().enableAutoRange(ViewBox.XAxis, False) def xRangeTextChanged(self): self.ctrl[0].manualRadio.setChecked(True) self.view().setXRange(*self._validateRangeText(0), padding=0) def xAutoClicked(self): val = self.ctrl[0].autoPercentSpin.value() * 0.01 self.view().enableAutoRange(ViewBox.XAxis, val) def xAutoSpinChanged(self, val): self.ctrl[0].autoRadio.setChecked(True) self.view().enableAutoRange(ViewBox.XAxis, val*0.01) def xLinkComboChanged(self, ind): self.view().setXLink(str(self.ctrl[0].linkCombo.currentText())) def xAutoPanToggled(self, b): self.view().setAutoPan(x=b) def xVisibleOnlyToggled(self, b): self.view().setAutoVisible(x=b) def yMouseToggled(self, b): self.view().setMouseEnabled(y=b) def yManualClicked(self): self.view().enableAutoRange(ViewBox.YAxis, False) def yRangeTextChanged(self): self.ctrl[1].manualRadio.setChecked(True) self.view().setYRange(*self._validateRangeText(1), padding=0) def yAutoClicked(self): val = self.ctrl[1].autoPercentSpin.value() * 0.01 self.view().enableAutoRange(ViewBox.YAxis, val) def yAutoSpinChanged(self, val): self.ctrl[1].autoRadio.setChecked(True) self.view().enableAutoRange(ViewBox.YAxis, val*0.01) def yLinkComboChanged(self, ind): self.view().setYLink(str(self.ctrl[1].linkCombo.currentText())) def yAutoPanToggled(self, b): self.view().setAutoPan(y=b) def yVisibleOnlyToggled(self, b): self.view().setAutoVisible(y=b) def yInvertToggled(self, b): self.view().invertY(b) def xInvertToggled(self, b): self.view().invertX(b) def setMouseMode(self, action): mode = None if action == self.mouseModes[0]: mode = 'pan' elif action == self.mouseModes[1]: mode = 'rect' if mode is not None: self.view().setLeftButtonAction(mode) def setViewList(self, views): names = [''] self.viewMap.clear() ## generate list of views to show in the link combo for v in views: name = v.name if name is None: ## unnamed views do not show up in the view list (although they are linkable) continue names.append(name) self.viewMap[name] = v for i in [0,1]: c = self.ctrl[i].linkCombo current = c.currentText() c.blockSignals(True) changed = True try: c.clear() for name in names: c.addItem(name) if name == current: changed = False c.setCurrentIndex(c.count()-1) finally: c.blockSignals(False) if changed: c.setCurrentIndex(0) c.currentIndexChanged.emit(c.currentIndex()) def _validateRangeText(self, axis): """Validate range text inputs. Return current value(s) if invalid.""" inputs = (self.ctrl[axis].minText.text(), self.ctrl[axis].maxText.text()) vals = self.view().viewRange()[axis] for i, text in enumerate(inputs): try: vals[i] = float(text) except ValueError: # could not convert string to float pass return vals from .ViewBox import ViewBox pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ViewBox/__init__.py000066400000000000000000000000641457240071200261520ustar00rootroot00000000000000from .ViewBox import ViewBox __all__ = ['ViewBox'] pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ViewBox/axisCtrlTemplate.ui000066400000000000000000000130051457240071200276640ustar00rootroot00000000000000 Form 0 0 186 154 200 16777215 PyQtGraph 0 0 Link Axis: <html><head/><body><p>Links this axis with another view. When linked, both views will display the same data range.</p></body></html> QComboBox::AdjustToContents true <html><head/><body><p>Percent of data to be visible when auto-scaling. It may be useful to decrease this value for data with spiky noise.</p></body></html> % 1 100 1 100 <html><head/><body><p>Automatically resize this axis whenever the displayed data is changed.</p></body></html> Auto true <html><head/><body><p>Set the range for this axis manually. This disables automatic scaling. </p></body></html> Manual <html><head/><body><p>Minimum value to display for this axis.</p></body></html> 0 <html><head/><body><p>Maximum value to display for this axis.</p></body></html> 0 <html><head/><body><p>Inverts the display of this axis. (+y points downward instead of upward)</p></body></html> Invert Axis <html><head/><body><p>Enables mouse interaction (panning, scaling) for this axis.</p></body></html> Mouse Enabled true <html><head/><body><p>When checked, the axis will only auto-scale to data that is visible along the orthogonal axis.</p></body></html> Visible Data Only <html><head/><body><p>When checked, the axis will automatically pan to center on the current data, but the scale along this axis will not change.</p></body></html> Auto Pan Only pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/ViewBox/axisCtrlTemplate_generic.py000066400000000000000000000130061457240071200313740ustar00rootroot00000000000000# Form implementation generated from reading ui file '../pyqtgraph/graphicsItems/ViewBox/axisCtrlTemplate.ui' # # Created by: PyQt6 UI code generator 6.1.0 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. from ...Qt import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(186, 154) Form.setMaximumSize(QtCore.QSize(200, 16777215)) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(Form) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 7, 0, 1, 2) self.linkCombo = QtWidgets.QComboBox(Form) self.linkCombo.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToContents) self.linkCombo.setObjectName("linkCombo") self.gridLayout.addWidget(self.linkCombo, 7, 2, 1, 2) self.autoPercentSpin = QtWidgets.QSpinBox(Form) self.autoPercentSpin.setEnabled(True) self.autoPercentSpin.setMinimum(1) self.autoPercentSpin.setMaximum(100) self.autoPercentSpin.setSingleStep(1) self.autoPercentSpin.setProperty("value", 100) self.autoPercentSpin.setObjectName("autoPercentSpin") self.gridLayout.addWidget(self.autoPercentSpin, 2, 2, 1, 2) self.autoRadio = QtWidgets.QRadioButton(Form) self.autoRadio.setChecked(True) self.autoRadio.setObjectName("autoRadio") self.gridLayout.addWidget(self.autoRadio, 2, 0, 1, 2) self.manualRadio = QtWidgets.QRadioButton(Form) self.manualRadio.setObjectName("manualRadio") self.gridLayout.addWidget(self.manualRadio, 1, 0, 1, 2) self.minText = QtWidgets.QLineEdit(Form) self.minText.setObjectName("minText") self.gridLayout.addWidget(self.minText, 1, 2, 1, 1) self.maxText = QtWidgets.QLineEdit(Form) self.maxText.setObjectName("maxText") self.gridLayout.addWidget(self.maxText, 1, 3, 1, 1) self.invertCheck = QtWidgets.QCheckBox(Form) self.invertCheck.setObjectName("invertCheck") self.gridLayout.addWidget(self.invertCheck, 5, 0, 1, 4) self.mouseCheck = QtWidgets.QCheckBox(Form) self.mouseCheck.setChecked(True) self.mouseCheck.setObjectName("mouseCheck") self.gridLayout.addWidget(self.mouseCheck, 6, 0, 1, 4) self.visibleOnlyCheck = QtWidgets.QCheckBox(Form) self.visibleOnlyCheck.setObjectName("visibleOnlyCheck") self.gridLayout.addWidget(self.visibleOnlyCheck, 3, 2, 1, 2) self.autoPanCheck = QtWidgets.QCheckBox(Form) self.autoPanCheck.setObjectName("autoPanCheck") self.gridLayout.addWidget(self.autoPanCheck, 4, 2, 1, 2) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "PyQtGraph")) self.label.setText(_translate("Form", "Link Axis:")) self.linkCombo.setToolTip(_translate("Form", "

      Links this axis with another view. When linked, both views will display the same data range.

      ")) self.autoPercentSpin.setToolTip(_translate("Form", "

      Percent of data to be visible when auto-scaling. It may be useful to decrease this value for data with spiky noise.

      ")) self.autoPercentSpin.setSuffix(_translate("Form", "%")) self.autoRadio.setToolTip(_translate("Form", "

      Automatically resize this axis whenever the displayed data is changed.

      ")) self.autoRadio.setText(_translate("Form", "Auto")) self.manualRadio.setToolTip(_translate("Form", "

      Set the range for this axis manually. This disables automatic scaling.

      ")) self.manualRadio.setText(_translate("Form", "Manual")) self.minText.setToolTip(_translate("Form", "

      Minimum value to display for this axis.

      ")) self.minText.setText(_translate("Form", "0")) self.maxText.setToolTip(_translate("Form", "

      Maximum value to display for this axis.

      ")) self.maxText.setText(_translate("Form", "0")) self.invertCheck.setToolTip(_translate("Form", "

      Inverts the display of this axis. (+y points downward instead of upward)

      ")) self.invertCheck.setText(_translate("Form", "Invert Axis")) self.mouseCheck.setToolTip(_translate("Form", "

      Enables mouse interaction (panning, scaling) for this axis.

      ")) self.mouseCheck.setText(_translate("Form", "Mouse Enabled")) self.visibleOnlyCheck.setToolTip(_translate("Form", "

      When checked, the axis will only auto-scale to data that is visible along the orthogonal axis.

      ")) self.visibleOnlyCheck.setText(_translate("Form", "Visible Data Only")) self.autoPanCheck.setToolTip(_translate("Form", "

      When checked, the axis will automatically pan to center on the current data, but the scale along this axis will not change.

      ")) self.autoPanCheck.setText(_translate("Form", "Auto Pan Only")) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/graphicsItems/__init__.py000066400000000000000000000011111457240071200245610ustar00rootroot00000000000000### just import everything from sub-modules #import os #d = os.path.split(__file__)[0] #files = [] #for f in os.listdir(d): #if os.path.isdir(os.path.join(d, f)): #files.append(f) #elif f[-3:] == '.py' and f != '__init__.py': #files.append(f[:-3]) #for modName in files: #mod = __import__(modName, globals(), locals(), fromlist=['*']) #if hasattr(mod, '__all__'): #names = mod.__all__ #else: #names = [n for n in dir(mod) if n[0] != '_'] #for k in names: ##print modName, k #globals()[k] = getattr(mod, k) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/icons/000077500000000000000000000000001457240071200207675ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/icons/__init__.py000066400000000000000000000031031457240071200230750ustar00rootroot00000000000000import os.path as op import warnings from ..Qt import QtGui, QtWidgets __all__ = ['getGraphIcon', 'getGraphPixmap'] _ICON_REGISTRY = {} class GraphIcon: """An icon place holder for lazy loading of QIcons The icon must reside in the icons folder and the path refers to the full name including suffix of the icon file, e.g.: tiny = GraphIcon("tiny.png") Icons can be later retrieved via the function `getGraphIcon` and providing the name: tiny = getGraphIcon("tiny") """ def __init__(self, path): self._path = path name = path.split('.')[0] _ICON_REGISTRY[name] = self self._icon = None def _build_qicon(self): icon = QtGui.QIcon(op.join(op.dirname(__file__), self._path)) name = self._path.split('.')[0] _ICON_REGISTRY[name] = icon self._icon = icon @property def qicon(self): if self._icon is None: self._build_qicon() return self._icon def getGraphIcon(name): """Return a `PyQtGraph` icon from the registry by `name`""" icon = _ICON_REGISTRY[name] if isinstance(icon, GraphIcon): icon = icon.qicon _ICON_REGISTRY[name] = icon return icon def getGraphPixmap(name, size=(20, 20)): """Return a `QPixmap` from the registry by `name`""" icon = getGraphIcon(name) return icon.pixmap(*size) # Note: List all graph icons here ... auto = GraphIcon("auto.png") ctrl = GraphIcon("ctrl.png") default = GraphIcon("default.png") invisibleEye = GraphIcon("invisibleEye.svg") lock = GraphIcon("lock.png") pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/icons/auto.png000066400000000000000000000017761457240071200224600ustar00rootroot00000000000000‰PNG  IHDR szzôsBIT|dˆ pHYsKg<tEXtSoftwarewww.inkscape.org›î<{IDATX…Í—¿OãHÇ¿Cbóc«]$+HV€¯ º"Š˜ âGþ­îÊЀ´ÅvÛR¸!D6:èø!$t,‡¶B–¨ˆ"íV!ȱ½kä‰qlV9q¯ò|ß¼yŸñ›ÑÌÃ0`š$Io ÃøÀF¼Bs¬à+€3BÈgA¾›bH’ôÁ0Œ/Þ4)©“ý „|¡øP,³„‚µ—¦i¨V«MÉ …àóù(’¡H¶¶¶ºjµÚ7¯àúú¢(BQ¨ªÚ†aÀqr¹úúúLù!äÙÜÜüLùËLžÏç¡iZÃãñ8†‡‡)íôôggg ã|>VWW­Ÿü„Q³%Š¢krX[[C$¡´óós$“Ɇqš¦AE¬¬¬˜ßà½éTÅ59Ïó¶ä022‚h4ê¯(Šu’£-øµÕªÕª§šÏÏÏ;ú]ãUUµ.îW-® ‡ÃH¥RŽþééiç ‰g¤Ói°,ûØ®Õj6Àt:ýß,,,PííímÛºñR†ßˆÅbˆÅb”&IŠÅ"¥ app°ùõ³/•J899,˶­»´´Ô\–emµ•e†a \.ãèèˆòMMM! 5 •J!Sš$Ißõeƒ˜™™i@ýÞ¿¸¸ ßÞÞ*• ÕÇëbtˆD"àyžÒ¬³€ûû{ìîîRZ4µ¿P¿øTUÅÎÎŽ­_}oÁßÈÙÚÚŠL&Ci„ìïï» “““X^^¶•Ç3ÀÄÄ:::è¿===žX–… X__wìÓ°¯æVÇ?ÐÛÛ‹x!~ …B[ ÂPU5lšæoÀw6}IY!ÄÏ¡P(YH&“…Ÿª½ à ŸÏÛQ’$œNç›âc(JŠƒƒƒïÓ@ÀÕÕŠ¢ iÅbÑ·ÛÏçC–ez{{-sVñƒsjjjI1a_XXàöö–R©dKp€R©D6›åää„@ @{{;@Pr!‚–£¢(†Qs¦§§éêêªÄ0 E©6õ;€­FMÓ^ì¶ô÷÷sxxHggç³¶ÑÑÑÊsSSÓÛtwwÓ××G"‘xár¹{âר\µŒgggÜßßã÷ûI$ìïï322Âðð0Ï¿‡¥¥%2™ §§§uÔ\»»;VVVðûý•¬¯å-ØÚÚb||Ü^€ÝÝ]¢Ñ(××ׯÐ(Ä«Çðøø˜‰‰ Âá0³³³Äb1l…¨™Õ* \\\TÞonnØÙÙ¡µµµ&D4ý¦œøê‘¥T*E$±m%¾Ànˆºì„¨À.ˆ†ì€hà%ˆL&C,css“xÆ÷Òàõ•™8XûügVf90ÛyÆX“Na Ã*0Lp` m<¦bÁ0úÁH˜o?9K²PœÇbbpra ±*ñ-‚奱hÐ+£@?º¡0˜®ñ•Àd%N&i¾«i(‹…>°¤ˆØë¿ åI»Wñ[œ š°@÷æ èF"`a8&[ØÐ[Æ2'Ù¯VÞ§5=O&«2ã˜kOcèÆYÁÁõÅžðÍÅž0hÈò7‰Rˆb¢1ß~y®ë,|‘]€¯#çáƒÜ4/YPËwXÆ'\üõgöŠRE©ž«öŸ›o 6ô7 îã„$“®-`ÿè«pÞTÔxoŽ65©:=LcÍ.’4r—}Í1 ¤Ù6Šé·†Oâ“RuYÀÌ£xrÝl´b60€?†°°`pQEO£c*›âkól+Ò˜¹šqÛ¥à‘HžAÑsn³Éߟ›/[}&¥Íe&Nò‰ë˜daY[‘„· &s(4ñx£!É^â†p‘…)­æ"]g³ð]‰mÈD= "Ÿ$Pbœnà2Ò‘y¹£ŽÒýTSÞ®=ŠJw¶ú…³¯¦œ€%A}lBÊïÒtXào)[Q ÙÈ2+ÛŽ e›75Þ|x§ªî€›Zäì¡yÆrÝ£ßÂ嫿óâ_ëöCo»|)e‹—¦ÖÃV^ìbWyN3gÁ?ѼòCªjWšVèŒT\kÇ*ø/~žjºW ÈIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/icons/icons.svg000066400000000000000000000143501457240071200226260ustar00rootroot00000000000000 image/svg+xml A pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/icons/invisibleEye.svg000066400000000000000000000061451457240071200241450ustar00rootroot00000000000000 pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/icons/lock.png000066400000000000000000000016211457240071200224250ustar00rootroot00000000000000‰PNG  IHDR szzôsBIT|dˆ pHYsKg<tEXtSoftwarewww.inkscape.org›î<IDATX…í—½k#GÆ£Ý#V²” „Œ· *‚V‰]šü q‡1u*æ8T-&Æ X\¥NU‹áJ…­þîŠ@‹68*¬ó¢F»RŠÜîÉ­|>%Ná§š÷cžy–™Ùy_1™Lð`šæ×“Éä5ð= QƒÀ;à­â—\.÷§žÓ4_L&“7@|A‹ÎB_ñc.—køÆK!ÄoÓY®ëbÛöBVTUI’îù„/s¹\Cœœœ¬:ŽóðÀåå%õz˲F  ( š¦‘ÏçY[[óÜ}!Ä7ÒöööOBˆ¼Å Ãàææ†ñx<—xii Y–q'0o<Óï÷9??'“É‹ÅÂÀ8$„Èz‰õz×uɉ´Z-:N‡V«E¥Rauu5p®ëºÔëõi×w!à[/hYV Áîî.gggäóyÒé4²,#Ë2étšB¡@»Ýfgg'ò¬é̆øxÕlÛÜóB¡Àáá!ªªú¾n·K·ÛõíH$ÂÑÑ…Ba&Ïh4š>ÜÑP ÜH&“†áÛÍf]×Éf³d³Yt]§ÙlúqÃ0H&“¡æAJ¥ápÓ4)‹ôz=?Þëõ(‹˜¦ @8¦T*-N€®ë8ŽC¹\ž™W.—ýáÍùbÑh”T*ÀÅŃÁ`fî`0 ÓéJ¥ˆFçÿÉç H$þøúúz.áÕÕÕ?Î}´!Ä\’/™û 3ðoB nmm±··çÛ›››œžž®¯¯ûãýý}Ži·ÛŸ/@QªÕ*ñø§×yyy™L&(`T«Ut]Ÿù“›¹±XìÞâE<÷ŸÏð_áYÀ³€g!þnPUEQüÀp8\HU<‡¾­(ÊtUõ!$„ø@’$4MómÛ¦V«Í­xƒà8µZí^¡iÚtð^4_Wð©,Ÿ®ŒWVVˆD"pwwÇíí­oK’D¥R™î ~~òÆäé[³ÿEsêá)Úó¿ZMMä»R0ÙIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/imageview/000077500000000000000000000000001457240071200216315ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/imageview/ImageView.py000066400000000000000000001022411457240071200240600ustar00rootroot00000000000000""" ImageView.py - Widget for basic image dispay and analysis Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. Widget used for displaying 2D or 3D data. Features: - float or int (including 16-bit int) image display via ImageItem - zoom/pan via GraphicsView - black/white level controls - time slider for 3D data sets - ROI plotting - Image normalization through a variety of methods """ import os from math import log10 from time import perf_counter import numpy as np from .. import debug as debug from .. import functions as fn from .. import getConfigOption from ..graphicsItems.GradientEditorItem import addGradientListToDocstring from ..graphicsItems.ImageItem import ImageItem from ..graphicsItems.InfiniteLine import InfiniteLine from ..graphicsItems.LinearRegionItem import LinearRegionItem from ..graphicsItems.ROI import ROI from ..graphicsItems.ViewBox import ViewBox from ..graphicsItems.VTickGroup import VTickGroup from ..Qt import QtCore, QtGui, QtWidgets from ..SignalProxy import SignalProxy from . import ImageViewTemplate_generic as ui_template try: from bottleneck import nanmax, nanmin except ImportError: from numpy import nanmax, nanmin translate = QtCore.QCoreApplication.translate class PlotROI(ROI): def __init__(self, size): ROI.__init__(self, pos=[0,0], size=size) #, scaleSnap=True, translateSnap=True) self.addScaleHandle([1, 1], [0, 0]) self.addRotateHandle([0, 0], [0.5, 0.5]) class ImageView(QtWidgets.QWidget): """ Widget used for display and analysis of image data. Implements many features: * Displays 2D and 3D image data. For 3D data, a z-axis slider is displayed allowing the user to select which frame is displayed. * Displays histogram of image data with movable region defining the dark/light levels * Editable gradient provides a color lookup table * Frame slider may also be moved using left/right arrow keys as well as pgup, pgdn, home, and end. * Basic analysis features including: * ROI and embedded plot for measuring image values across frames * Image normalization / background subtraction Basic Usage:: imv = pg.ImageView() imv.show() imv.setImage(data) **Keyboard interaction** * left/right arrows step forward/backward 1 frame when pressed, seek at 20fps when held. * up/down arrows seek at 100fps * pgup/pgdn seek at 1000fps * home/end seek immediately to the first/last frame * space begins playing frames. If time values (in seconds) are given for each frame, then playback is in realtime. """ sigTimeChanged = QtCore.Signal(object, object) sigProcessingChanged = QtCore.Signal(object) def __init__( self, parent=None, name="ImageView", view=None, imageItem=None, levelMode='mono', discreteTimeLine=False, roi=None, normRoi=None, *args, ): """ By default, this class creates an :class:`ImageItem ` to display image data and a :class:`ViewBox ` to contain the ImageItem. Parameters ---------- parent : QWidget Specifies the parent widget to which this ImageView will belong. If None, then the ImageView is created with no parent. name : str The name used to register both the internal ViewBox and the PlotItem used to display ROI data. See the *name* argument to :func:`ViewBox.__init__() `. view : ViewBox or PlotItem If specified, this will be used as the display area that contains the displayed image. Any :class:`ViewBox `, :class:`PlotItem `, or other compatible object is acceptable. Note: to display axis ticks inside the ImageView, instantiate it with a PlotItem instance as its view:: pg.ImageView(view=pg.PlotItem()) imageItem : ImageItem If specified, this object will be used to display the image. Must be an instance of ImageItem or other compatible object. levelMode : str See the *levelMode* argument to :func:`HistogramLUTItem.__init__() ` discreteTimeLine : bool Whether to snap to xvals / frame numbers when interacting with the timeline position. roi : ROI If specified, this object is used as ROI for the plot feature. Must be an instance of ROI. normRoi : ROI If specified, this object is used as ROI for the normalization feature. Must be an instance of ROI. """ QtWidgets.QWidget.__init__(self, parent, *args) self._imageLevels = None # [(min, max), ...] per channel image metrics self.levelMin = None # min / max levels across all channels self.levelMax = None self.name = name self.image = None self.axes = {} self.imageDisp = None self.ui = ui_template.Ui_Form() self.ui.setupUi(self) self.scene = self.ui.graphicsView.scene() self.discreteTimeLine = discreteTimeLine self.ui.histogram.setLevelMode(levelMode) self.ignoreTimeLine = False if view is None: self.view = ViewBox() else: self.view = view self.ui.graphicsView.setCentralItem(self.view) self.view.setAspectLocked(True) self.view.invertY() self.menu = None self.ui.normGroup.hide() if roi is None: self.roi = PlotROI(10) else: self.roi = roi self.roi.setZValue(20) self.view.addItem(self.roi) self.roi.hide() if normRoi is None: self.normRoi = PlotROI(10) self.normRoi.setPen('y') else: self.normRoi = normRoi self.normRoi.setZValue(20) self.view.addItem(self.normRoi) self.normRoi.hide() self.roiCurves = [] self.timeLine = InfiniteLine(0, movable=True) if getConfigOption('background')=='w': self.timeLine.setPen((20, 80,80, 200)) else: self.timeLine.setPen((255, 255, 0, 200)) self.timeLine.setZValue(1) self.ui.roiPlot.addItem(self.timeLine) self.ui.splitter.setSizes([self.height()-35, 35]) # init imageItem and histogram if imageItem is None: self.imageItem = ImageItem() else: self.imageItem = imageItem self.setImage(imageItem.image, autoRange=False, autoLevels=False, transform=imageItem.transform()) self.view.addItem(self.imageItem) self.currentIndex = 0 self.ui.histogram.setImageItem(self.imageItem) self.ui.histogram.setLevelMode(levelMode) # make splitter an unchangeable small grey line: s = self.ui.splitter s.handle(1).setEnabled(False) s.setStyleSheet("QSplitter::handle{background-color: grey}") s.setHandleWidth(2) self.ui.roiPlot.hideAxis('left') self.frameTicks = VTickGroup(yrange=[0.8, 1], pen=0.4) self.ui.roiPlot.addItem(self.frameTicks, ignoreBounds=True) self.keysPressed = {} self.playTimer = QtCore.QTimer() self.playRate = 0 self._pausedPlayRate = None self.fps = 1 # 1 Hz by default self.lastPlayTime = 0 self.normRgn = LinearRegionItem() self.normRgn.setZValue(0) self.ui.roiPlot.addItem(self.normRgn) self.normRgn.hide() ## wrap functions from view box for fn in ['addItem', 'removeItem']: setattr(self, fn, getattr(self.view, fn)) ## wrap functions from histogram for fn in ['setHistogramRange', 'autoHistogramRange', 'getLookupTable', 'getLevels']: setattr(self, fn, getattr(self.ui.histogram, fn)) self.timeLine.sigPositionChanged.connect(self.timeLineChanged) self.ui.roiBtn.clicked.connect(self.roiClicked) self.roi.sigRegionChanged.connect(self.roiChanged) #self.ui.normBtn.toggled.connect(self.normToggled) self.ui.menuBtn.clicked.connect(self.menuClicked) self.ui.normDivideRadio.clicked.connect(self.normRadioChanged) self.ui.normSubtractRadio.clicked.connect(self.normRadioChanged) self.ui.normOffRadio.clicked.connect(self.normRadioChanged) self.ui.normROICheck.clicked.connect(self.updateNorm) self.ui.normFrameCheck.clicked.connect(self.updateNorm) self.ui.normTimeRangeCheck.clicked.connect(self.updateNorm) self.playTimer.timeout.connect(self.timeout) self.normProxy = SignalProxy( self.normRgn.sigRegionChanged, slot=self.updateNorm, threadSafe=False, ) self.normRoi.sigRegionChangeFinished.connect(self.updateNorm) self.ui.roiPlot.registerPlot(self.name + '_ROI') self.view.register(self.name) self.noRepeatKeys = [ QtCore.Qt.Key.Key_Right, QtCore.Qt.Key.Key_Left, QtCore.Qt.Key.Key_Up, QtCore.Qt.Key.Key_Down, QtCore.Qt.Key.Key_PageUp, QtCore.Qt.Key.Key_PageDown, ] self.roiClicked() ## initialize roi plot to correct shape / visibility def setImage( self, img, autoRange=True, autoLevels=True, levels=None, axes=None, xvals=None, pos=None, scale=None, transform=None, autoHistogramRange=True, levelMode=None, ): """ Set the image to be displayed in the widget. Parameters ---------- img : np.ndarray The image to be displayed. See :func:`ImageItem.setImage` and *notes* below. autoRange : bool Whether to scale/pan the view to fit the image. autoLevels : bool Whether to update the white/black levels to fit the image. levels : tuple (min, max) white and black level values to use. axes : dict Dictionary indicating the interpretation for each axis. This is only needed to override the default guess. Format is:: {'t':0, 'x':1, 'y':2, 'c':3}; xvals : np.ndarray 1D array of values corresponding to the first axis in a 3D image. For video, this array should contain the time of each frame. pos Change the position of the displayed image scale Change the scale of the displayed image transform Set the transform of the displayed image. This option overrides *pos* and *scale*. autoHistogramRange : bool If True, the histogram y-range is automatically scaled to fit the image data. levelMode : str If specified, this sets the user interaction mode for setting image levels. Options are 'mono', which provides a single level control for all image channels, and 'rgb' or 'rgba', which provide individual controls for each channel. Notes ----- For backward compatibility, image data is assumed to be in column-major order (column, row). However, most image data is stored in row-major order (row, column) and will need to be transposed before calling setImage():: imageview.setImage(imagedata.T) This requirement can be changed by the ``imageAxisOrder`` :ref:`global configuration option `. """ profiler = debug.Profiler() if hasattr(img, 'implements') and img.implements('MetaArray'): img = img.asarray() if not isinstance(img, np.ndarray): required = ['dtype', 'max', 'min', 'ndim', 'shape', 'size'] if not all(hasattr(img, attr) for attr in required): raise TypeError("Image must be NumPy array or any object " "that provides compatible attributes/methods:\n" " %s" % str(required)) self.image = img self.imageDisp = None if levelMode is not None: self.ui.histogram.setLevelMode(levelMode) profiler() if axes is None: x,y = (0, 1) if self.imageItem.axisOrder == 'col-major' else (1, 0) if img.ndim == 2: self.axes = {'t': None, 'x': x, 'y': y, 'c': None} elif img.ndim == 3: # Ambiguous case; make a guess if img.shape[2] <= 4: self.axes = {'t': None, 'x': x, 'y': y, 'c': 2} else: self.axes = {'t': 0, 'x': x+1, 'y': y+1, 'c': None} elif img.ndim == 4: # Even more ambiguous; just assume the default self.axes = {'t': 0, 'x': x+1, 'y': y+1, 'c': 3} else: raise Exception("Can not interpret image with dimensions %s" % (str(img.shape))) elif isinstance(axes, dict): self.axes = axes.copy() elif isinstance(axes, list) or isinstance(axes, tuple): self.axes = {} for i in range(len(axes)): self.axes[axes[i]] = i else: raise Exception("Can not interpret axis specification %s. Must be like {'t': 2, 'x': 0, 'y': 1} or ('t', 'x', 'y', 'c')" % (str(axes))) for x in ['t', 'x', 'y', 'c']: self.axes[x] = self.axes.get(x, None) axes = self.axes if xvals is not None: self.tVals = xvals elif axes['t'] is not None: if hasattr(img, 'xvals'): try: self.tVals = img.xvals(axes['t']) except: self.tVals = np.arange(img.shape[axes['t']]) else: self.tVals = np.arange(img.shape[axes['t']]) profiler() self.currentIndex = 0 self.updateImage(autoHistogramRange=autoHistogramRange) if levels is None and autoLevels: self.autoLevels() if levels is not None: ## this does nothing since getProcessedImage sets these values again. self.setLevels(*levels) if self.ui.roiBtn.isChecked(): self.roiChanged() profiler() if self.axes['t'] is not None: self.ui.roiPlot.setXRange(self.tVals.min(), self.tVals.max()) self.frameTicks.setXVals(self.tVals) self.timeLine.setValue(0) if len(self.tVals) > 1: start = self.tVals.min() stop = self.tVals.max() + abs(self.tVals[-1] - self.tVals[0]) * 0.02 elif len(self.tVals) == 1: start = self.tVals[0] - 0.5 stop = self.tVals[0] + 0.5 else: start = 0 stop = 1 for s in [self.timeLine, self.normRgn]: s.setBounds([start, stop]) profiler() if transform is None: transform = QtGui.QTransform() # note that the order of transform is # scale followed by translate if pos is not None: transform.translate(*pos) if scale is not None: transform.scale(*scale) self.imageItem.setTransform(transform) profiler() if autoRange: self.autoRange() self.roiClicked() profiler() def clear(self): self.image = None self.imageItem.clear() def play(self, rate=None): """Begin automatically stepping frames forward at the given rate (in fps). This can also be accessed by pressing the spacebar.""" if rate is None: rate = self._pausedPlayRate or self.fps if rate == 0 and self.playRate not in (None, 0): self._pausedPlayRate = self.playRate self.playRate = rate if rate == 0: self.playTimer.stop() return self.lastPlayTime = perf_counter() if not self.playTimer.isActive(): self.playTimer.start(abs(int(1000/rate))) def togglePause(self): if self.playTimer.isActive(): self.play(0) elif self.playRate == 0: if self._pausedPlayRate is not None: fps = self._pausedPlayRate else: fps = (self.nframes() - 1) / (self.tVals[-1] - self.tVals[0]) self.play(fps) else: self.play(self.playRate) def setHistogramLabel(self, text=None, **kwargs): """ Set the label text of the histogram axis similar to :func:`AxisItem.setLabel() ` """ a = self.ui.histogram.axis a.setLabel(text, **kwargs) if text == '': a.showLabel(False) self.ui.histogram.setMinimumWidth(135) def nframes(self): """ Returns ------- int The number of frames in the image data. """ if self.image is None: return 0 elif self.axes['t'] is not None: return self.image.shape[self.axes['t']] return 1 def autoLevels(self): """Set the min/max intensity levels automatically to match the image data.""" self.setLevels(rgba=self._imageLevels) def setLevels(self, *args, **kwds): """Set the min/max (bright and dark) levels. See :func:`HistogramLUTItem.setLevels `. """ self.ui.histogram.setLevels(*args, **kwds) def autoRange(self): """Auto scale and pan the view around the image such that the image fills the view.""" self.getProcessedImage() self.view.autoRange() def getProcessedImage(self): """Returns the image data after it has been processed by any normalization options in use. """ if self.imageDisp is None: image = self.normalize(self.image) self.imageDisp = image self._imageLevels = self.quickMinMax(self.imageDisp) self.levelMin = min([level[0] for level in self._imageLevels]) self.levelMax = max([level[1] for level in self._imageLevels]) return self.imageDisp def close(self): """Closes the widget nicely, making sure to clear the graphics scene and release memory.""" self.clear() self.imageDisp = None self.imageItem.setParent(None) super(ImageView, self).close() self.setParent(None) def keyPressEvent(self, ev): if not self.hasTimeAxis(): super().keyPressEvent(ev) return if ev.key() == QtCore.Qt.Key.Key_Space: self.togglePause() ev.accept() elif ev.key() == QtCore.Qt.Key.Key_Home: self.setCurrentIndex(0) self.play(0) ev.accept() elif ev.key() == QtCore.Qt.Key.Key_End: self.setCurrentIndex(self.nframes()-1) self.play(0) ev.accept() elif ev.key() in self.noRepeatKeys: ev.accept() if ev.isAutoRepeat(): return self.keysPressed[ev.key()] = 1 self.evalKeyState() else: super().keyPressEvent(ev) def keyReleaseEvent(self, ev): if not self.hasTimeAxis(): super().keyReleaseEvent(ev) return if ev.key() in [QtCore.Qt.Key.Key_Space, QtCore.Qt.Key.Key_Home, QtCore.Qt.Key.Key_End]: ev.accept() elif ev.key() in self.noRepeatKeys: ev.accept() if ev.isAutoRepeat(): return try: del self.keysPressed[ev.key()] except: self.keysPressed = {} self.evalKeyState() else: super().keyReleaseEvent(ev) def evalKeyState(self): if len(self.keysPressed) == 1: key = list(self.keysPressed.keys())[0] if key == QtCore.Qt.Key.Key_Right: self.play(20) self.jumpFrames(1) # effectively pause playback for 0.2 s self.lastPlayTime = perf_counter() + 0.2 elif key == QtCore.Qt.Key.Key_Left: self.play(-20) self.jumpFrames(-1) self.lastPlayTime = perf_counter() + 0.2 elif key == QtCore.Qt.Key.Key_Up: self.play(-100) elif key == QtCore.Qt.Key.Key_Down: self.play(100) elif key == QtCore.Qt.Key.Key_PageUp: self.play(-1000) elif key == QtCore.Qt.Key.Key_PageDown: self.play(1000) else: self.play(0) def timeout(self): now = perf_counter() dt = now - self.lastPlayTime if dt < 0: return n = int(self.playRate * dt) if n != 0: self.lastPlayTime += (float(n)/self.playRate) if self.currentIndex+n > self.image.shape[self.axes['t']]: self.play(0) self.jumpFrames(n) def setCurrentIndex(self, ind): """Set the currently displayed frame index.""" index = fn.clip_scalar(ind, 0, self.nframes()-1) self.currentIndex = index self.updateImage() self.ignoreTimeLine = True # Implicitly call timeLineChanged self.timeLine.setValue(self.tVals[index]) self.ignoreTimeLine = False def jumpFrames(self, n): """Move video frame ahead n frames (may be negative)""" if self.axes['t'] is not None: self.setCurrentIndex(self.currentIndex + n) def normRadioChanged(self): self.imageDisp = None self.updateImage() self.autoLevels() self.roiChanged() self.sigProcessingChanged.emit(self) def updateNorm(self): if self.ui.normTimeRangeCheck.isChecked(): self.normRgn.show() else: self.normRgn.hide() if self.ui.normROICheck.isChecked(): self.normRoi.show() else: self.normRoi.hide() if not self.ui.normOffRadio.isChecked(): self.imageDisp = None self.updateImage() self.autoLevels() self.roiChanged() self.sigProcessingChanged.emit(self) def normToggled(self, b): self.ui.normGroup.setVisible(b) self.normRoi.setVisible(b and self.ui.normROICheck.isChecked()) self.normRgn.setVisible(b and self.ui.normTimeRangeCheck.isChecked()) def hasTimeAxis(self): return 't' in self.axes and self.axes['t'] is not None def roiClicked(self): showRoiPlot = False if self.ui.roiBtn.isChecked(): showRoiPlot = True self.roi.show() self.ui.roiPlot.setMouseEnabled(True, True) self.ui.splitter.setSizes([int(self.height()*0.6), int(self.height()*0.4)]) self.ui.splitter.handle(1).setEnabled(True) self.roiChanged() for c in self.roiCurves: c.show() self.ui.roiPlot.showAxis('left') else: self.roi.hide() self.ui.roiPlot.setMouseEnabled(False, False) for c in self.roiCurves: c.hide() self.ui.roiPlot.hideAxis('left') if self.hasTimeAxis(): showRoiPlot = True mn = self.tVals.min() mx = self.tVals.max() self.ui.roiPlot.setXRange(mn, mx, padding=0.01) self.timeLine.show() self.timeLine.setBounds([mn, mx]) if not self.ui.roiBtn.isChecked(): self.ui.splitter.setSizes([self.height()-35, 35]) self.ui.splitter.handle(1).setEnabled(False) else: self.timeLine.hide() self.ui.roiPlot.setVisible(showRoiPlot) def roiChanged(self): # Extract image data from ROI if self.image is None: return image = self.getProcessedImage() # getArrayRegion axes should be (x, y) of data array for col-major, # (y, x) for row-major # can't just transpose input because ROI is axisOrder aware colmaj = self.imageItem.axisOrder == 'col-major' if colmaj: axes = (self.axes['x'], self.axes['y']) else: axes = (self.axes['y'], self.axes['x']) data, coords = self.roi.getArrayRegion( image.view(np.ndarray), img=self.imageItem, axes=axes, returnMappedCoords=True) if data is None: return # Convert extracted data into 1D plot data if self.axes['t'] is None: # Average across y-axis of ROI data = data.mean(axis=self.axes['y']) # get coordinates along x axis of ROI mapped to range (0, roiwidth) if colmaj: coords = coords[:, :, 0] - coords[:, 0:1, 0] else: coords = coords[:, 0, :] - coords[:, 0, 0:1] xvals = (coords**2).sum(axis=0) ** 0.5 else: # Average data within entire ROI for each frame data = data.mean(axis=axes) xvals = self.tVals # Handle multi-channel data if data.ndim == 1: plots = [(xvals, data, 'w')] if data.ndim == 2: if data.shape[1] == 1: colors = 'w' else: colors = 'rgbw' plots = [] for i in range(data.shape[1]): d = data[:,i] plots.append((xvals, d, colors[i])) # Update plot line(s) while len(plots) < len(self.roiCurves): c = self.roiCurves.pop() c.scene().removeItem(c) while len(plots) > len(self.roiCurves): self.roiCurves.append(self.ui.roiPlot.plot()) for i in range(len(plots)): x, y, p = plots[i] self.roiCurves[i].setData(x, y, pen=p) def quickMinMax(self, data): """ Estimate the min/max values of *data* by subsampling. Returns [(min, max), ...] with one item per channel """ while data.size > 1e6: ax = np.argmax(data.shape) sl = [slice(None)] * data.ndim sl[ax] = slice(None, None, 2) data = data[tuple(sl)] cax = self.axes['c'] if cax is None: if data.size == 0: return [(0, 0)] return [(float(nanmin(data)), float(nanmax(data)))] else: if data.size == 0: return [(0, 0)] * data.shape[-1] return [(float(nanmin(data.take(i, axis=cax))), float(nanmax(data.take(i, axis=cax)))) for i in range(data.shape[-1])] def normalize(self, image): """ Process *image* using the normalization options configured in the control panel. This can be repurposed to process any data through the same filter. """ if self.ui.normOffRadio.isChecked(): return image div = self.ui.normDivideRadio.isChecked() norm = image.view(np.ndarray).copy() #if div: #norm = ones(image.shape) #else: #norm = zeros(image.shape) if div: norm = norm.astype(np.float32) if self.ui.normTimeRangeCheck.isChecked() and image.ndim == 3: (sind, start) = self.timeIndex(self.normRgn.lines[0]) (eind, end) = self.timeIndex(self.normRgn.lines[1]) #print start, end, sind, eind n = image[sind:eind+1].mean(axis=0) n.shape = (1,) + n.shape if div: norm /= n else: norm -= n if self.ui.normFrameCheck.isChecked() and image.ndim == 3: n = image.mean(axis=1).mean(axis=1) n.shape = n.shape + (1, 1) if div: norm /= n else: norm -= n if self.ui.normROICheck.isChecked() and image.ndim == 3: n = self.normRoi.getArrayRegion(norm, self.imageItem, (1, 2)).mean(axis=1).mean(axis=1) n = n[:,np.newaxis,np.newaxis] #print start, end, sind, eind if div: norm /= n else: norm -= n return norm def timeLineChanged(self): if not self.ignoreTimeLine: self.play(0) (ind, time) = self.timeIndex(self.timeLine) if ind != self.currentIndex: self.currentIndex = ind self.updateImage() if self.discreteTimeLine: with fn.SignalBlock(self.timeLine.sigPositionChanged, self.timeLineChanged): if self.tVals is not None: self.timeLine.setPos(self.tVals[ind]) else: self.timeLine.setPos(ind) self.sigTimeChanged.emit(ind, time) def updateImage(self, autoHistogramRange=True): ## Redraw image on screen if self.image is None: return image = self.getProcessedImage() if autoHistogramRange: self.ui.histogram.setHistogramRange(self.levelMin, self.levelMax) # Transpose image into order expected by ImageItem if self.imageItem.axisOrder == 'col-major': axorder = ['t', 'x', 'y', 'c'] else: axorder = ['t', 'y', 'x', 'c'] axorder = [self.axes[ax] for ax in axorder if self.axes[ax] is not None] image = image.transpose(axorder) # Select time index if self.axes['t'] is not None: self.ui.roiPlot.show() image = image[self.currentIndex] self.imageItem.updateImage(image) def timeIndex(self, slider): """ Returns ------- int The index of the frame closest to the timeline slider. float The time value of the slider. """ if not self.hasTimeAxis(): return 0, 0.0 t = slider.value() xv = self.tVals if xv is None: ind = int(t) else: if len(xv) < 2: return 0, 0.0 inds = np.argwhere(xv <= t) if len(inds) < 1: return 0, t ind = inds[-1, 0] return ind, t def getView(self): """Return the ViewBox (or other compatible object) which displays the ImageItem""" return self.view def getImageItem(self): """Return the ImageItem for this ImageView.""" return self.imageItem def getRoiPlot(self): """Return the ROI PlotWidget for this ImageView""" return self.ui.roiPlot def getHistogramWidget(self): """Return the HistogramLUTWidget for this ImageView""" return self.ui.histogram def export(self, fileName): """ Export data from the ImageView to a file, or to a stack of files if the data is 3D. Saving an image stack will result in index numbers being added to the file name. Images are saved as they would appear onscreen, with levels and lookup table applied. """ img = self.getProcessedImage() if self.hasTimeAxis(): base, ext = os.path.splitext(fileName) fmt = "%%s%%0%dd%%s" % int(log10(img.shape[0])+1) for i in range(img.shape[0]): self.imageItem.setImage(img[i], autoLevels=False) self.imageItem.save(fmt % (base, i, ext)) self.updateImage() else: self.imageItem.save(fileName) def exportClicked(self): fileName, _ = QtWidgets.QFileDialog.getSaveFileName() if not fileName: return self.export(fileName) def buildMenu(self): self.menu = QtWidgets.QMenu() self.normAction = QtGui.QAction(translate("ImageView", "Normalization"), self.menu) self.normAction.setCheckable(True) self.normAction.toggled.connect(self.normToggled) self.menu.addAction(self.normAction) self.exportAction = QtGui.QAction(translate("ImageView", "Export"), self.menu) self.exportAction.triggered.connect(self.exportClicked) self.menu.addAction(self.exportAction) def menuClicked(self): if self.menu is None: self.buildMenu() self.menu.popup(QtGui.QCursor.pos()) def setColorMap(self, colormap): """Set the color map. Parameters ---------- colormap : ColorMap The ColorMap to use for coloring images. """ self.ui.histogram.gradient.setColorMap(colormap) @addGradientListToDocstring() def setPredefinedGradient(self, name): """Set one of the gradients defined in :class:`GradientEditorItem`. Currently available gradients are: """ self.ui.histogram.gradient.loadPreset(name) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/imageview/ImageViewTemplate.ui000066400000000000000000000156031457240071200255460ustar00rootroot00000000000000 Form 0 0 726 588 PyQtGraph 0 0 Qt::Vertical 0 0 1 ROI true 0 1 Menu 0 0 0 40 Normalization 0 0 Subtract Divide false true Operation: true Mean: true Blur: ROI X Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter Y Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter T Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter Off true Time range Frame PlotWidget QWidget
      ..widgets.PlotWidget
      1
      GraphicsView QGraphicsView
      ..widgets.GraphicsView
      HistogramLUTWidget QGraphicsView
      ..widgets.HistogramLUTWidget
      pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/imageview/ImageViewTemplate_generic.py000066400000000000000000000202671457240071200272570ustar00rootroot00000000000000# Form implementation generated from reading ui file '../pyqtgraph/imageview/ImageViewTemplate.ui' # # Created by: PyQt6 UI code generator 6.1.0 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. from ..Qt import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(726, 588) self.gridLayout_3 = QtWidgets.QGridLayout(Form) self.gridLayout_3.setContentsMargins(0, 0, 0, 0) self.gridLayout_3.setSpacing(0) self.gridLayout_3.setObjectName("gridLayout_3") self.splitter = QtWidgets.QSplitter(Form) self.splitter.setOrientation(QtCore.Qt.Orientation.Vertical) self.splitter.setObjectName("splitter") self.layoutWidget = QtWidgets.QWidget(self.splitter) self.layoutWidget.setObjectName("layoutWidget") self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.graphicsView = GraphicsView(self.layoutWidget) self.graphicsView.setObjectName("graphicsView") self.gridLayout.addWidget(self.graphicsView, 0, 0, 2, 1) self.histogram = HistogramLUTWidget(self.layoutWidget) self.histogram.setObjectName("histogram") self.gridLayout.addWidget(self.histogram, 0, 1, 1, 2) self.roiBtn = QtWidgets.QPushButton(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.roiBtn.sizePolicy().hasHeightForWidth()) self.roiBtn.setSizePolicy(sizePolicy) self.roiBtn.setCheckable(True) self.roiBtn.setObjectName("roiBtn") self.gridLayout.addWidget(self.roiBtn, 1, 1, 1, 1) self.menuBtn = QtWidgets.QPushButton(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.menuBtn.sizePolicy().hasHeightForWidth()) self.menuBtn.setSizePolicy(sizePolicy) self.menuBtn.setObjectName("menuBtn") self.gridLayout.addWidget(self.menuBtn, 1, 2, 1, 1) self.roiPlot = PlotWidget(self.splitter) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.roiPlot.sizePolicy().hasHeightForWidth()) self.roiPlot.setSizePolicy(sizePolicy) self.roiPlot.setMinimumSize(QtCore.QSize(0, 40)) self.roiPlot.setObjectName("roiPlot") self.gridLayout_3.addWidget(self.splitter, 0, 0, 1, 1) self.normGroup = QtWidgets.QGroupBox(Form) self.normGroup.setObjectName("normGroup") self.gridLayout_2 = QtWidgets.QGridLayout(self.normGroup) self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.gridLayout_2.setSpacing(0) self.gridLayout_2.setObjectName("gridLayout_2") self.normSubtractRadio = QtWidgets.QRadioButton(self.normGroup) self.normSubtractRadio.setObjectName("normSubtractRadio") self.gridLayout_2.addWidget(self.normSubtractRadio, 0, 2, 1, 1) self.normDivideRadio = QtWidgets.QRadioButton(self.normGroup) self.normDivideRadio.setChecked(False) self.normDivideRadio.setObjectName("normDivideRadio") self.gridLayout_2.addWidget(self.normDivideRadio, 0, 1, 1, 1) self.label_5 = QtWidgets.QLabel(self.normGroup) font = QtGui.QFont() font.setBold(True) self.label_5.setFont(font) self.label_5.setObjectName("label_5") self.gridLayout_2.addWidget(self.label_5, 0, 0, 1, 1) self.label_3 = QtWidgets.QLabel(self.normGroup) font = QtGui.QFont() font.setBold(True) self.label_3.setFont(font) self.label_3.setObjectName("label_3") self.gridLayout_2.addWidget(self.label_3, 1, 0, 1, 1) self.label_4 = QtWidgets.QLabel(self.normGroup) font = QtGui.QFont() font.setBold(True) self.label_4.setFont(font) self.label_4.setObjectName("label_4") self.gridLayout_2.addWidget(self.label_4, 2, 0, 1, 1) self.normROICheck = QtWidgets.QCheckBox(self.normGroup) self.normROICheck.setObjectName("normROICheck") self.gridLayout_2.addWidget(self.normROICheck, 1, 1, 1, 1) self.normXBlurSpin = QtWidgets.QDoubleSpinBox(self.normGroup) self.normXBlurSpin.setObjectName("normXBlurSpin") self.gridLayout_2.addWidget(self.normXBlurSpin, 2, 2, 1, 1) self.label_8 = QtWidgets.QLabel(self.normGroup) self.label_8.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter) self.label_8.setObjectName("label_8") self.gridLayout_2.addWidget(self.label_8, 2, 1, 1, 1) self.label_9 = QtWidgets.QLabel(self.normGroup) self.label_9.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter) self.label_9.setObjectName("label_9") self.gridLayout_2.addWidget(self.label_9, 2, 3, 1, 1) self.normYBlurSpin = QtWidgets.QDoubleSpinBox(self.normGroup) self.normYBlurSpin.setObjectName("normYBlurSpin") self.gridLayout_2.addWidget(self.normYBlurSpin, 2, 4, 1, 1) self.label_10 = QtWidgets.QLabel(self.normGroup) self.label_10.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter) self.label_10.setObjectName("label_10") self.gridLayout_2.addWidget(self.label_10, 2, 5, 1, 1) self.normOffRadio = QtWidgets.QRadioButton(self.normGroup) self.normOffRadio.setChecked(True) self.normOffRadio.setObjectName("normOffRadio") self.gridLayout_2.addWidget(self.normOffRadio, 0, 3, 1, 1) self.normTimeRangeCheck = QtWidgets.QCheckBox(self.normGroup) self.normTimeRangeCheck.setObjectName("normTimeRangeCheck") self.gridLayout_2.addWidget(self.normTimeRangeCheck, 1, 3, 1, 1) self.normFrameCheck = QtWidgets.QCheckBox(self.normGroup) self.normFrameCheck.setObjectName("normFrameCheck") self.gridLayout_2.addWidget(self.normFrameCheck, 1, 2, 1, 1) self.normTBlurSpin = QtWidgets.QDoubleSpinBox(self.normGroup) self.normTBlurSpin.setObjectName("normTBlurSpin") self.gridLayout_2.addWidget(self.normTBlurSpin, 2, 6, 1, 1) self.gridLayout_3.addWidget(self.normGroup, 1, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "PyQtGraph")) self.roiBtn.setText(_translate("Form", "ROI")) self.menuBtn.setText(_translate("Form", "Menu")) self.normGroup.setTitle(_translate("Form", "Normalization")) self.normSubtractRadio.setText(_translate("Form", "Subtract")) self.normDivideRadio.setText(_translate("Form", "Divide")) self.label_5.setText(_translate("Form", "Operation:")) self.label_3.setText(_translate("Form", "Mean:")) self.label_4.setText(_translate("Form", "Blur:")) self.normROICheck.setText(_translate("Form", "ROI")) self.label_8.setText(_translate("Form", "X")) self.label_9.setText(_translate("Form", "Y")) self.label_10.setText(_translate("Form", "T")) self.normOffRadio.setText(_translate("Form", "Off")) self.normTimeRangeCheck.setText(_translate("Form", "Time range")) self.normFrameCheck.setText(_translate("Form", "Frame")) from ..widgets.GraphicsView import GraphicsView from ..widgets.HistogramLUTWidget import HistogramLUTWidget from ..widgets.PlotWidget import PlotWidget pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/imageview/__init__.py000066400000000000000000000002721457240071200237430ustar00rootroot00000000000000""" Widget used for display and analysis of 2D and 3D image data. Includes ROI plotting over time and image normalization. """ from .ImageView import ImageView __all__ = ['ImageView'] pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/jupyter/000077500000000000000000000000001457240071200213565ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/jupyter/GraphicsView.py000066400000000000000000000151021457240071200243220ustar00rootroot00000000000000import jupyter_rfb import numpy as np from .. import functions as fn from .. import graphicsItems, widgets from ..Qt import QtCore, QtGui __all__ = ['GraphicsLayoutWidget', 'PlotWidget'] KMLUT = { x : getattr(QtCore.Qt.KeyboardModifier, x + "Modifier") for x in ["Shift", "Control", "Alt", "Meta"] } MBLUT = { k : getattr(QtCore.Qt.MouseButton, v + "Button") for (k, v) in zip( range(6), ["No", "Left", "Right", "Middle", "Back", "Forward"] ) } TYPLUT = { "pointer_down" : QtCore.QEvent.Type.MouseButtonPress, "pointer_up" : QtCore.QEvent.Type.MouseButtonRelease, "pointer_move" : QtCore.QEvent.Type.MouseMove, } def get_buttons(evt_buttons): NoButton = QtCore.Qt.MouseButton.NoButton btns = NoButton for x in evt_buttons: btns |= MBLUT.get(x, NoButton) return btns def get_modifiers(evt_modifiers): NoModifier = QtCore.Qt.KeyboardModifier.NoModifier mods = NoModifier for x in evt_modifiers: mods |= KMLUT.get(x, NoModifier) return mods class GraphicsView(jupyter_rfb.RemoteFrameBuffer): """jupyter_rfb.RemoteFrameBuffer sub-class that wraps around :class:`GraphicsView `. Generally speaking, there is no Qt event loop running. The implementation works by requesting a render() of the scene. Thus things that would work for exporting purposes would be expected to work here. Things that are not part of the scene would not work, e.g. context menus, tooltips. This class should not be used directly. Its corresponding sub-classes :class:`GraphicsLayoutWidget ` and :class:`PlotWidget ` should be used instead.""" def __init__(self, **kwds): super().__init__(**kwds) self.gfxView = widgets.GraphicsView.GraphicsView() self.logical_size = int(self.css_width[:-2]), int(self.css_height[:-2]) self.pixel_ratio = 1.0 # self.gfxView.resize(*self.logical_size) # self.gfxView.show() # self.gfxView.resizeEvent(None) def get_frame(self): w, h = self.logical_size dpr = self.pixel_ratio buf = np.empty((int(h * dpr), int(w * dpr), 4), dtype=np.uint8) qimg = fn.ndarray_to_qimage(buf, QtGui.QImage.Format.Format_RGBX8888) qimg.fill(QtCore.Qt.GlobalColor.transparent) qimg.setDevicePixelRatio(dpr) painter = QtGui.QPainter(qimg) self.gfxView.render(painter, self.gfxView.viewRect(), self.gfxView.rect()) painter.end() return buf def handle_event(self, event): event_type = event["event_type"] if event_type == "resize": oldSize = QtCore.QSize(*self.logical_size) self.logical_size = int(event["width"]), int(event["height"]) self.pixel_ratio = event["pixel_ratio"] self.gfxView.resize(*self.logical_size) newSize = QtCore.QSize(*self.logical_size) self.gfxView.resizeEvent(QtGui.QResizeEvent(newSize, oldSize)) elif event_type in ["pointer_down", "pointer_up", "pointer_move"]: btn = MBLUT.get(event["button"], None) if btn is None: # ignore unsupported buttons return pos = QtCore.QPointF(event["x"], event["y"]) btns = get_buttons(event["buttons"]) mods = get_modifiers(event["modifiers"]) typ = TYPLUT[event_type] evt = QtGui.QMouseEvent(typ, pos, pos, btn, btns, mods) QtCore.QCoreApplication.sendEvent(self.gfxView.viewport(), evt) self.request_draw() elif event_type == "wheel": pos = QtCore.QPointF(event["x"], event["y"]) pixdel = QtCore.QPoint() scale = -1.0 # map JavaScript wheel to Qt wheel angdel = QtCore.QPoint(int(event["dx"] * scale), int(event["dy"] * scale)) btns = get_buttons([]) mods = get_modifiers(event["modifiers"]) phase = QtCore.Qt.ScrollPhase.NoScrollPhase inverted = False evt = QtGui.QWheelEvent(pos, pos, pixdel, angdel, btns, mods, phase, inverted) QtCore.QCoreApplication.sendEvent(self.gfxView.viewport(), evt) def connect_viewbox_redraw(vb, request_draw): # connecting these signals is enough to support zoom/pan # but not enough to support the various graphicsItems # that react to mouse events vb.sigRangeChanged.connect(request_draw) # zoom / pan vb.sigRangeChangedManually.connect(request_draw) # needed for "auto" button vb.sigStateChanged.connect(request_draw) # note that all cases of sig{X,Y}RangeChanged being emitted # are also followed by sigRangeChanged or sigStateChanged vb.sigTransformChanged.connect(request_draw) class GraphicsLayoutWidget(GraphicsView): """jupyter_rfb analogue of :class:`GraphicsLayoutWidget `.""" def __init__(self, **kwds): super().__init__(**kwds) self.gfxLayout = graphicsItems.GraphicsLayout.GraphicsLayout() for n in [ 'nextRow', 'nextCol', 'nextColumn', 'addItem', 'getItem', 'addLayout', 'addLabel', 'removeItem', 'itemIndex', 'clear' ]: setattr(self, n, getattr(self.gfxLayout, n)) self.gfxView.setCentralItem(self.gfxLayout) def addPlot(self, *args, **kwds): kwds["enableMenu"] = False plotItem = self.gfxLayout.addPlot(*args, **kwds) connect_viewbox_redraw(plotItem.getViewBox(), self.request_draw) return plotItem def addViewBox(self, *args, **kwds): kwds["enableMenu"] = False vb = self.gfxLayout.addViewBox(*args, **kwds) connect_viewbox_redraw(vb, self.request_draw) return vb class PlotWidget(GraphicsView): """jupyter_rfb analogue of :class:`PlotWidget `.""" def __init__(self, **kwds): super().__init__(**kwds) plotItem = graphicsItems.PlotItem.PlotItem(enableMenu=False) self.gfxView.setCentralItem(plotItem) connect_viewbox_redraw(plotItem.getViewBox(), self.request_draw) self.plotItem = plotItem def getPlotItem(self): return self.plotItem def __getattr__(self, attr): # kernel crashes if we don't skip attributes starting with '_' if attr.startswith('_'): return super().__getattr__(attr) # implicitly wrap methods from plotItem if hasattr(self.plotItem, attr): m = getattr(self.plotItem, attr) if hasattr(m, '__call__'): return m raise AttributeError(attr) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/jupyter/__init__.py000066400000000000000000000001251457240071200234650ustar00rootroot00000000000000from .GraphicsView import GraphicsLayoutWidget from .GraphicsView import PlotWidget pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/metaarray/000077500000000000000000000000001457240071200216415ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/metaarray/MetaArray.py000066400000000000000000001351471457240071200241130ustar00rootroot00000000000000""" MetaArray.py - Class encapsulating ndarray with meta data Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. MetaArray is an array class based on numpy.ndarray that allows storage of per-axis meta data such as axis values, names, units, column names, etc. It also enables several new methods for slicing and indexing the array based on this meta data. More info at http://www.scipy.org/Cookbook/MetaArray """ import copy import os import pickle import warnings import numpy as np ## By default, the library will use HDF5 when writing files. ## This can be overridden by setting USE_HDF5 = False USE_HDF5 = True try: import h5py # Older h5py versions tucked Group and Dataset deeper inside the library: if not hasattr(h5py, 'Group'): import h5py.highlevel h5py.Group = h5py.highlevel.Group h5py.Dataset = h5py.highlevel.Dataset HAVE_HDF5 = True except: USE_HDF5 = False HAVE_HDF5 = False def axis(name=None, cols=None, values=None, units=None): """Convenience function for generating axis descriptions when defining MetaArrays""" ax = {} cNameOrder = ['name', 'units', 'title'] if name is not None: ax['name'] = name if values is not None: ax['values'] = values if units is not None: ax['units'] = units if cols is not None: ax['cols'] = [] for c in cols: if type(c) != list and type(c) != tuple: c = [c] col = {} for i in range(0,len(c)): col[cNameOrder[i]] = c[i] ax['cols'].append(col) return ax class sliceGenerator(object): """Just a compact way to generate tuples of slice objects.""" def __getitem__(self, arg): return arg def __getslice__(self, arg): return arg SLICER = sliceGenerator() class MetaArray(object): """N-dimensional array with meta data such as axis titles, units, and column names. May be initialized with a file name, a tuple representing the dimensions of the array, or any arguments that could be passed on to numpy.array() The info argument sets the metadata for the entire array. It is composed of a list of axis descriptions where each axis may have a name, title, units, and a list of column descriptions. An additional dict at the end of the axis list may specify parameters that apply to values in the entire array. For example: A 2D array of altitude values for a topographical map might look like info=[ {'name': 'lat', 'title': 'Lattitude'}, {'name': 'lon', 'title': 'Longitude'}, {'title': 'Altitude', 'units': 'm'} ] In this case, every value in the array represents the altitude in feet at the lat, lon position represented by the array index. All of the following return the value at lat=10, lon=5: array[10, 5] array['lon':5, 'lat':10] array['lat':10][5] Now suppose we want to combine this data with another array of equal dimensions that represents the average rainfall for each location. We could easily store these as two separate arrays or combine them into a 3D array with this description: info=[ {'name': 'vals', 'cols': [ {'name': 'altitude', 'units': 'm'}, {'name': 'rainfall', 'units': 'cm/year'} ]}, {'name': 'lat', 'title': 'Lattitude'}, {'name': 'lon', 'title': 'Longitude'} ] We can now access the altitude values with array[0] or array['altitude'], and the rainfall values with array[1] or array['rainfall']. All of the following return the rainfall value at lat=10, lon=5: array[1, 10, 5] array['lon':5, 'lat':10, 'val': 'rainfall'] array['rainfall', 'lon':5, 'lat':10] Notice that in the second example, there is no need for an extra (4th) axis description since the actual values are described (name and units) in the column info for the first axis. """ version = u'2' # Default hdf5 compression to use when writing # 'gzip' is widely available and somewhat slow # 'lzf' is faster, but generally not available outside h5py # 'szip' is also faster, but lacks write support on windows # (so by default, we use no compression) # May also be a tuple (filter, opts), such as ('gzip', 3) defaultCompression = None ## Types allowed as axis or column names nameTypes = [str, tuple] @staticmethod def isNameType(var): return any(isinstance(var, t) for t in MetaArray.nameTypes) ## methods to wrap from embedded ndarray / HDF5 wrapMethods = set(['__eq__', '__ne__', '__le__', '__lt__', '__ge__', '__gt__']) def __init__(self, data=None, info=None, dtype=None, file=None, copy=False, **kwargs): object.__init__(self) warnings.warn( 'MetaArray is deprecated and will be removed in 0.14. ' 'Available though https://pypi.org/project/MetaArray/ as its own package.', DeprecationWarning, stacklevel=2 ) self._isHDF = False if file is not None: self._data = None self.readFile(file, **kwargs) if kwargs.get("readAllData", True) and self._data is None: raise Exception("File read failed: %s" % file) else: self._info = info if (hasattr(data, 'implements') and data.implements('MetaArray')): self._info = data._info self._data = data.asarray() elif isinstance(data, tuple): ## create empty array with specified shape self._data = np.empty(data, dtype=dtype) else: self._data = np.array(data, dtype=dtype, copy=copy) ## run sanity checks on info structure self.checkInfo() def checkInfo(self): info = self._info if info is None: if self._data is None: return else: self._info = [{} for i in range(self.ndim + 1)] return else: try: info = list(info) except: raise Exception("Info must be a list of axis specifications") if len(info) < self.ndim+1: info.extend([{}]*(self.ndim+1-len(info))) elif len(info) > self.ndim+1: raise Exception("Info parameter must be list of length ndim+1 or less.") for i in range(len(info)): if not isinstance(info[i], dict): if info[i] is None: info[i] = {} else: raise Exception("Axis specification must be Dict or None") if i < self.ndim and 'values' in info[i]: if type(info[i]['values']) is list: info[i]['values'] = np.array(info[i]['values']) elif type(info[i]['values']) is not np.ndarray: raise Exception("Axis values must be specified as list or ndarray") if info[i]['values'].ndim != 1 or info[i]['values'].shape[0] != self.shape[i]: raise Exception("Values array for axis %d has incorrect shape. (given %s, but should be %s)" % (i, str(info[i]['values'].shape), str((self.shape[i],)))) if i < self.ndim and 'cols' in info[i]: if not isinstance(info[i]['cols'], list): info[i]['cols'] = list(info[i]['cols']) if len(info[i]['cols']) != self.shape[i]: raise Exception('Length of column list for axis %d does not match data. (given %d, but should be %d)' % (i, len(info[i]['cols']), self.shape[i])) self._info = info def implements(self, name=None): ## Rather than isinstance(obj, MetaArray) use object.implements('MetaArray') if name is None: return ['MetaArray'] else: return name == 'MetaArray' def __getitem__(self, ind): nInd = self._interpretIndexes(ind) a = self._data[nInd] if len(nInd) == self.ndim: if np.all([not isinstance(ind, (slice, np.ndarray)) for ind in nInd]): ## no slices; we have requested a single value from the array return a ## indexing returned a sub-array; generate new info array to go with it info = [] extraInfo = self._info[-1].copy() for i in range(0, len(nInd)): ## iterate over all axes if type(nInd[i]) in [slice, list] or isinstance(nInd[i], np.ndarray): ## If the axis is sliced, keep the info but chop if necessary info.append(self._axisSlice(i, nInd[i])) else: ## If the axis is indexed, then move the information from that single index to the last info dictionary newInfo = self._axisSlice(i, nInd[i]) name = None colName = None for k in newInfo: if k == 'cols': if 'cols' not in extraInfo: extraInfo['cols'] = [] extraInfo['cols'].append(newInfo[k]) if 'units' in newInfo[k]: extraInfo['units'] = newInfo[k]['units'] if 'name' in newInfo[k]: colName = newInfo[k]['name'] elif k == 'name': name = newInfo[k] else: if k not in extraInfo: extraInfo[k] = newInfo[k] extraInfo[k] = newInfo[k] if 'name' not in extraInfo: if name is None: if colName is not None: extraInfo['name'] = colName else: if colName is not None: extraInfo['name'] = str(name) + ': ' + str(colName) else: extraInfo['name'] = name info.append(extraInfo) return MetaArray(a, info=info) @property def ndim(self): return len(self.shape) ## hdf5 objects do not have ndim property. @property def shape(self): return self._data.shape @property def dtype(self): return self._data.dtype def __len__(self): return len(self._data) def __getslice__(self, *args): return self.__getitem__(slice(*args)) def __setitem__(self, ind, val): nInd = self._interpretIndexes(ind) try: self._data[nInd] = val except: print(self, nInd, val) raise def __getattr__(self, attr): if attr in self.wrapMethods: return getattr(self._data, attr) else: raise AttributeError(attr) def __eq__(self, b): return self._binop('__eq__', b) def __ne__(self, b): return self._binop('__ne__', b) def __sub__(self, b): return self._binop('__sub__', b) def __add__(self, b): return self._binop('__add__', b) def __mul__(self, b): return self._binop('__mul__', b) def __div__(self, b): return self._binop('__div__', b) def __truediv__(self, b): return self._binop('__truediv__', b) def _binop(self, op, b): if isinstance(b, MetaArray): b = b.asarray() a = self.asarray() c = getattr(a, op)(b) if c.shape != a.shape: raise Exception("Binary operators with MetaArray must return an array of the same shape (this shape is %s, result shape was %s)" % (a.shape, c.shape)) return MetaArray(c, info=self.infoCopy()) def asarray(self): if isinstance(self._data, np.ndarray): return self._data else: return np.array(self._data) def __array__(self, dtype=None): ## supports np.array(metaarray_instance) if dtype is None: return self.asarray() else: return self.asarray().astype(dtype) def axisValues(self, axis): """Return the list of values for an axis""" ax = self._interpretAxis(axis) if 'values' in self._info[ax]: return self._info[ax]['values'] else: raise Exception('Array axis %s (%d) has no associated values.' % (str(axis), ax)) def xvals(self, axis): """Synonym for axisValues()""" return self.axisValues(axis) def axisHasValues(self, axis): ax = self._interpretAxis(axis) return 'values' in self._info[ax] def axisHasColumns(self, axis): ax = self._interpretAxis(axis) return 'cols' in self._info[ax] def axisUnits(self, axis): """Return the units for axis""" ax = self._info[self._interpretAxis(axis)] if 'units' in ax: return ax['units'] def hasColumn(self, axis, col): ax = self._info[self._interpretAxis(axis)] if 'cols' in ax: for c in ax['cols']: if c['name'] == col: return True return False def listColumns(self, axis=None): """Return a list of column names for axis. If axis is not specified, then return a dict of {axisName: (column names), ...}.""" if axis is None: ret = {} for i in range(self.ndim): if 'cols' in self._info[i]: cols = [c['name'] for c in self._info[i]['cols']] else: cols = [] ret[self.axisName(i)] = cols return ret else: axis = self._interpretAxis(axis) return [c['name'] for c in self._info[axis]['cols']] def columnName(self, axis, col): ax = self._info[self._interpretAxis(axis)] return ax['cols'][col]['name'] def axisName(self, n): return self._info[n].get('name', n) def columnUnits(self, axis, column): """Return the units for column in axis""" ax = self._info[self._interpretAxis(axis)] if 'cols' in ax: for c in ax['cols']: if c['name'] == column: return c['units'] raise Exception("Axis %s has no column named %s" % (str(axis), str(column))) else: raise Exception("Axis %s has no column definitions" % str(axis)) def rowsort(self, axis, key=0): """Return this object with all records sorted along axis using key as the index to the values to compare. Does not yet modify meta info.""" ## make sure _info is copied locally before modifying it! keyList = self[key] order = keyList.argsort() if type(axis) == int: ind = [slice(None)]*axis ind.append(order) elif isinstance(axis, str): ind = (slice(axis, order),) else: raise TypeError("axis must be type (int, str)") return self[tuple(ind)] def append(self, val, axis): """Return this object with val appended along axis. Does not yet combine meta info.""" ## make sure _info is copied locally before modifying it! s = list(self.shape) axis = self._interpretAxis(axis) s[axis] += 1 n = MetaArray(tuple(s), info=self._info, dtype=self.dtype) ind = [slice(None)]*self.ndim ind[axis] = slice(None,-1) n[tuple(ind)] = self ind[axis] = -1 n[tuple(ind)] = val return n def extend(self, val, axis): """Return the concatenation along axis of this object and val. Does not yet combine meta info.""" ## make sure _info is copied locally before modifying it! axis = self._interpretAxis(axis) return MetaArray(np.concatenate(self, val, axis), info=self._info) def infoCopy(self, axis=None): """Return a deep copy of the axis meta info for this object""" if axis is None: return copy.deepcopy(self._info) else: return copy.deepcopy(self._info[self._interpretAxis(axis)]) def copy(self): return MetaArray(self._data.copy(), info=self.infoCopy()) def _interpretIndexes(self, ind): #print "interpret", ind if not isinstance(ind, tuple): ## a list of slices should be interpreted as a tuple of slices. if isinstance(ind, list) and len(ind) > 0 and isinstance(ind[0], slice): ind = tuple(ind) ## everything else can just be converted to a length-1 tuple else: ind = (ind,) nInd = [slice(None)]*self.ndim numOk = True ## Named indices not started yet; numbered sill ok for i in range(0,len(ind)): (axis, index, isNamed) = self._interpretIndex(ind[i], i, numOk) nInd[axis] = index if isNamed: numOk = False return tuple(nInd) def _interpretAxis(self, axis): if isinstance(axis, (str, tuple)): return self._getAxis(axis) else: return axis def _interpretIndex(self, ind, pos, numOk): #print "Interpreting index", ind, pos, numOk ## should probably check for int first to speed things up.. if type(ind) is int: if not numOk: raise Exception("string and integer indexes may not follow named indexes") #print " normal numerical index" return (pos, ind, False) if MetaArray.isNameType(ind): if not numOk: raise Exception("string and integer indexes may not follow named indexes") #print " String index, column is ", self._getIndex(pos, ind) return (pos, self._getIndex(pos, ind), False) elif type(ind) is slice: #print " Slice index" if MetaArray.isNameType(ind.start) or MetaArray.isNameType(ind.stop): ## Not an actual slice! #print " ..not a real slice" axis = self._interpretAxis(ind.start) #print " axis is", axis ## x[Axis:Column] if MetaArray.isNameType(ind.stop): #print " column name, column is ", self._getIndex(axis, ind.stop) index = self._getIndex(axis, ind.stop) ## x[Axis:min:max] elif (isinstance(ind.stop, float) or isinstance(ind.step, float)) and ('values' in self._info[axis]): #print " axis value range" if ind.stop is None: mask = self.xvals(axis) < ind.step elif ind.step is None: mask = self.xvals(axis) >= ind.stop else: mask = (self.xvals(axis) >= ind.stop) * (self.xvals(axis) < ind.step) ##print "mask:", mask index = mask ## x[Axis:columnIndex] elif isinstance(ind.stop, int) or isinstance(ind.step, int): #print " normal slice after named axis" if ind.step is None: index = ind.stop else: index = slice(ind.stop, ind.step) ## x[Axis: [list]] elif type(ind.stop) is list: #print " list of indexes from named axis" index = [] for i in ind.stop: if type(i) is int: index.append(i) elif MetaArray.isNameType(i): index.append(self._getIndex(axis, i)) else: ## unrecognized type, try just passing on to array index = ind.stop break else: #print " other type.. forward on to array for handling", type(ind.stop) index = ind.stop #print "Axis %s (%s) : %s" % (ind.start, str(axis), str(type(index))) #if type(index) is np.ndarray: #print " ", index.shape return (axis, index, True) else: #print " Looks like a real slice, passing on to array" return (pos, ind, False) elif type(ind) is list: #print " List index., interpreting each element individually" indList = [self._interpretIndex(i, pos, numOk)[1] for i in ind] return (pos, indList, False) else: if not numOk: raise Exception("string and integer indexes may not follow named indexes") #print " normal numerical index" return (pos, ind, False) def _getAxis(self, name): for i in range(0, len(self._info)): axis = self._info[i] if 'name' in axis and axis['name'] == name: return i raise Exception("No axis named %s.\n info=%s" % (name, self._info)) def _getIndex(self, axis, name): ax = self._info[axis] if ax is not None and 'cols' in ax: for i in range(0, len(ax['cols'])): if 'name' in ax['cols'][i] and ax['cols'][i]['name'] == name: return i raise Exception("Axis %d has no column named %s.\n info=%s" % (axis, name, self._info)) def _axisCopy(self, i): return copy.deepcopy(self._info[i]) def _axisSlice(self, i, cols): #print "axisSlice", i, cols if 'cols' in self._info[i] or 'values' in self._info[i]: ax = self._axisCopy(i) if 'cols' in ax: #print " slicing columns..", array(ax['cols']), cols sl = np.array(ax['cols'])[cols] if isinstance(sl, np.ndarray): sl = list(sl) ax['cols'] = sl #print " result:", ax['cols'] if 'values' in ax: ax['values'] = np.array(ax['values'])[cols] else: ax = self._info[i] #print " ", ax return ax def prettyInfo(self): s = '' titles = [] maxl = 0 for i in range(len(self._info)-1): ax = self._info[i] axs = '' if 'name' in ax: axs += '"%s"' % str(ax['name']) else: axs += "%d" % i if 'units' in ax: axs += " (%s)" % str(ax['units']) titles.append(axs) if len(axs) > maxl: maxl = len(axs) for i in range(min(self.ndim, len(self._info) - 1)): ax = self._info[i] axs = titles[i] axs += '%s[%d] :' % (' ' * (maxl - len(axs) + 5 - len(str(self.shape[i]))), self.shape[i]) if 'values' in ax: if self.shape[i] > 0: v0 = ax['values'][0] axs += " values: [%g" % (v0) if self.shape[i] > 1: v1 = ax['values'][-1] axs += " ... %g] (step %g)" % (v1, (v1 - v0) / (self.shape[i] - 1)) else: axs += "]" else: axs += " values: []" if 'cols' in ax: axs += " columns: " colstrs = [] for c in range(len(ax['cols'])): col = ax['cols'][c] cs = str(col.get('name', c)) if 'units' in col: cs += " (%s)" % col['units'] colstrs.append(cs) axs += '[' + ', '.join(colstrs) + ']' s += axs + "\n" s += str(self._info[-1]) return s def __repr__(self): return "%s\n-----------------------------------------------\n%s" % (self.view(np.ndarray).__repr__(), self.prettyInfo()) def __str__(self): return self.__repr__() def axisCollapsingFn(self, fn, axis=None, *args, **kargs): fn = getattr(self._data, fn) if axis is None: return fn(axis, *args, **kargs) else: info = self.infoCopy() axis = self._interpretAxis(axis) info.pop(axis) return MetaArray(fn(axis, *args, **kargs), info=info) def mean(self, axis=None, *args, **kargs): return self.axisCollapsingFn('mean', axis, *args, **kargs) def min(self, axis=None, *args, **kargs): return self.axisCollapsingFn('min', axis, *args, **kargs) def max(self, axis=None, *args, **kargs): return self.axisCollapsingFn('max', axis, *args, **kargs) def transpose(self, *args): if len(args) == 1 and hasattr(args[0], '__iter__'): order = args[0] else: order = args order = [self._interpretAxis(ax) for ax in order] infoOrder = order + list(range(len(order), len(self._info))) info = [self._info[i] for i in infoOrder] order = order + list(range(len(order), self.ndim)) try: if self._isHDF: return MetaArray(np.array(self._data).transpose(order), info=info) else: return MetaArray(self._data.transpose(order), info=info) except: print(order) raise #### File I/O Routines def readFile(self, filename, **kwargs): """Load the data and meta info stored in *filename* Different arguments are allowed depending on the type of file. For HDF5 files: *writable* (bool) if True, then any modifications to data in the array will be stored to disk. *readAllData* (bool) if True, then all data in the array is immediately read from disk and the file is closed (this is the default for files < 500MB). Otherwise, the file will be left open and data will be read only as requested (this is the default for files >= 500MB). """ ## decide which read function to use with open(filename, 'rb') as fd: magic = fd.read(8) if magic == b'\x89HDF\r\n\x1a\n': fd.close() self._readHDF5(filename, **kwargs) self._isHDF = True else: fd.seek(0) meta = MetaArray._readMeta(fd) if not kwargs.get("readAllData", True): self._data = np.empty(meta['shape'], dtype=meta['type']) if 'version' in meta: ver = meta['version'] else: ver = 1 rFuncName = '_readData%s' % str(ver) if not hasattr(MetaArray, rFuncName): raise Exception("This MetaArray library does not support array version '%s'" % ver) rFunc = getattr(self, rFuncName) rFunc(fd, meta, **kwargs) self._isHDF = False @staticmethod def _readMeta(fd): """Read meta array from the top of a file. Read lines until a blank line is reached. This function should ideally work for ALL versions of MetaArray. """ meta = u'' ## Read meta information until the first blank line while True: line = fd.readline().strip() if line == '': break meta += line ret = eval(meta) #print ret return ret def _readData1(self, fd, meta, mmap=False, **kwds): ## Read array data from the file descriptor for MetaArray v1 files ## read in axis values for any axis that specifies a length frameSize = 1 for ax in meta['info']: if 'values_len' in ax: ax['values'] = np.frombuffer(fd.read(ax['values_len']), dtype=ax['values_type']) frameSize *= ax['values_len'] del ax['values_len'] del ax['values_type'] self._info = meta['info'] if not kwds.get("readAllData", True): return ## the remaining data is the actual array if mmap: subarr = np.memmap(fd, dtype=meta['type'], mode='r', shape=meta['shape']) else: subarr = np.frombuffer(fd.read(), dtype=meta['type']) subarr.shape = meta['shape'] self._data = subarr def _readData2(self, fd, meta, mmap=False, subset=None, **kwds): ## read in axis values dynAxis = None frameSize = 1 ## read in axis values for any axis that specifies a length for i in range(len(meta['info'])): ax = meta['info'][i] if 'values_len' in ax: if ax['values_len'] == 'dynamic': if dynAxis is not None: raise Exception("MetaArray has more than one dynamic axis! (this is not allowed)") dynAxis = i else: ax['values'] = np.frombuffer(fd.read(ax['values_len']), dtype=ax['values_type']) frameSize *= ax['values_len'] del ax['values_len'] del ax['values_type'] self._info = meta['info'] if not kwds.get("readAllData", True): return ## No axes are dynamic, just read the entire array in at once if dynAxis is None: if meta['type'] == 'object': if mmap: raise Exception('memmap not supported for arrays with dtype=object') subarr = pickle.loads(fd.read()) else: if mmap: subarr = np.memmap(fd, dtype=meta['type'], mode='r', shape=meta['shape']) else: subarr = np.frombuffer(fd.read(), dtype=meta['type']) subarr.shape = meta['shape'] ## One axis is dynamic, read in a frame at a time else: if mmap: raise Exception('memmap not supported for non-contiguous arrays. Use rewriteContiguous() to convert.') ax = meta['info'][dynAxis] xVals = [] frames = [] frameShape = list(meta['shape']) frameShape[dynAxis] = 1 frameSize = np.prod(frameShape) n = 0 while True: ## Extract one non-blank line while True: line = fd.readline() if line != '\n': break if line == '': break ## evaluate line inf = eval(line) ## read data block #print "read %d bytes as %s" % (inf['len'], meta['type']) if meta['type'] == 'object': data = pickle.loads(fd.read(inf['len'])) else: data = np.frombuffer(fd.read(inf['len']), dtype=meta['type']) if data.size != frameSize * inf['numFrames']: #print data.size, frameSize, inf['numFrames'] raise Exception("Wrong frame size in MetaArray file! (frame %d)" % n) ## read in data block shape = list(frameShape) shape[dynAxis] = inf['numFrames'] data.shape = shape if subset is not None: dSlice = subset[dynAxis] if dSlice.start is None: dStart = 0 else: dStart = max(0, dSlice.start - n) if dSlice.stop is None: dStop = data.shape[dynAxis] else: dStop = min(data.shape[dynAxis], dSlice.stop - n) newSubset = list(subset[:]) newSubset[dynAxis] = slice(dStart, dStop) if dStop > dStart: frames.append(data[tuple(newSubset)].copy()) else: frames.append(data) n += inf['numFrames'] if 'xVals' in inf: xVals.extend(inf['xVals']) subarr = np.concatenate(frames, axis=dynAxis) if len(xVals)> 0: ax['values'] = np.array(xVals, dtype=ax['values_type']) del ax['values_len'] del ax['values_type'] self._info = meta['info'] self._data = subarr def _readHDF5(self, fileName, readAllData=None, writable=False, **kargs): if 'close' in kargs and readAllData is None: ## for backward compatibility readAllData = kargs['close'] if readAllData is True and writable is True: raise Exception("Incompatible arguments: readAllData=True and writable=True") if not HAVE_HDF5: try: assert writable==False assert readAllData != False self._readHDF5Remote(fileName) return except: raise Exception("The file '%s' is HDF5-formatted, but the HDF5 library (h5py) was not found." % fileName) ## by default, readAllData=True for files < 500MB if readAllData is None: size = os.stat(fileName).st_size readAllData = (size < 500e6) if writable is True: mode = 'r+' else: mode = 'r' f = h5py.File(fileName, mode) ver = f.attrs['MetaArray'] try: ver = ver.decode('utf-8') except: pass if ver > MetaArray.version: print("Warning: This file was written with MetaArray version %s, but you are using version %s. (Will attempt to read anyway)" % (str(ver), str(MetaArray.version))) meta = MetaArray.readHDF5Meta(f['info']) self._info = meta if writable or not readAllData: ## read all data, convert to ndarray, close file self._data = f['data'] self._openFile = f else: self._data = f['data'][:] f.close() def _readHDF5Remote(self, fileName): ## Used to read HDF5 files via remote process. ## This is needed in the case that HDF5 is not importable due to the use of python-dbg. proc = getattr(MetaArray, '_hdf5Process', None) if proc == False: raise Exception('remote read failed') if proc is None: from .. import multiprocess as mp #print "new process" proc = mp.Process(executable='/usr/bin/python') proc.setProxyOptions(deferGetattr=True) MetaArray._hdf5Process = proc MetaArray._h5py_metaarray = proc._import('pyqtgraph.metaarray') ma = MetaArray._h5py_metaarray.MetaArray(file=fileName) self._data = ma.asarray()._getValue() self._info = ma._info._getValue() @staticmethod def mapHDF5Array(data, writable=False): off = data.id.get_offset() if writable: mode = 'r+' else: mode = 'r' if off is None: raise Exception("This dataset uses chunked storage; it can not be memory-mapped. (store using mappable=True)") return np.memmap(filename=data.file.filename, offset=off, dtype=data.dtype, shape=data.shape, mode=mode) @staticmethod def readHDF5Meta(root, mmap=False): data = {} ## Pull list of values from attributes and child objects for k in root.attrs: val = root.attrs[k] if isinstance(val, bytes): val = val.decode() if isinstance(val, str): ## strings need to be re-evaluated to their original types try: val = eval(val) except: raise Exception('Can not evaluate string: "%s"' % val) data[k] = val for k in root: obj = root[k] if isinstance(obj, h5py.Group): val = MetaArray.readHDF5Meta(obj) elif isinstance(obj, h5py.Dataset): if mmap: val = MetaArray.mapHDF5Array(obj) else: val = obj[:] else: raise Exception("Don't know what to do with type '%s'" % str(type(obj))) data[k] = val typ = root.attrs['_metaType_'] try: typ = typ.decode('utf-8') except: pass del data['_metaType_'] if typ == 'dict': return data elif typ == 'list' or typ == 'tuple': d2 = [None]*len(data) for k in data: d2[int(k)] = data[k] if typ == 'tuple': d2 = tuple(d2) return d2 else: raise Exception("Don't understand metaType '%s'" % typ) def write(self, fileName, **opts): """Write this object to a file. The object can be restored by calling MetaArray(file=fileName) opts: appendAxis: the name (or index) of the appendable axis. Allows the array to grow. appendKeys: a list of keys (other than "values") for metadata to append to on the appendable axis. compression: None, 'gzip' (good compression), 'lzf' (fast compression), etc. chunks: bool or tuple specifying chunk shape """ if USE_HDF5 is False: return self.writeMa(fileName, **opts) elif HAVE_HDF5 is True: return self.writeHDF5(fileName, **opts) else: raise Exception("h5py is required for writing .ma hdf5 files, but it could not be imported.") def writeMeta(self, fileName): """Used to re-write meta info to the given file. This feature is only available for HDF5 files.""" f = h5py.File(fileName, 'r+') if f.attrs['MetaArray'] != MetaArray.version: raise Exception("The file %s was created with a different version of MetaArray. Will not modify." % fileName) del f['info'] self.writeHDF5Meta(f, 'info', self._info) f.close() def writeHDF5(self, fileName, **opts): ## default options for writing datasets comp = self.defaultCompression if isinstance(comp, tuple): comp, copts = comp else: copts = None dsOpts = { 'compression': comp, 'chunks': True, } if copts is not None: dsOpts['compression_opts'] = copts ## if there is an appendable axis, then we can guess the desired chunk shape (optimized for appending) appAxis = opts.get('appendAxis', None) if appAxis is not None: appAxis = self._interpretAxis(appAxis) cs = [min(100000, x) for x in self.shape] cs[appAxis] = 1 dsOpts['chunks'] = tuple(cs) ## if there are columns, then we can guess a different chunk shape ## (read one column at a time) else: cs = [min(100000, x) for x in self.shape] for i in range(self.ndim): if 'cols' in self._info[i]: cs[i] = 1 dsOpts['chunks'] = tuple(cs) ## update options if they were passed in for k in dsOpts: if k in opts: dsOpts[k] = opts[k] ## If mappable is in options, it disables chunking/compression if opts.get('mappable', False): dsOpts = { 'chunks': None, 'compression': None } ## set maximum shape to allow expansion along appendAxis append = False if appAxis is not None: maxShape = list(self.shape) ax = self._interpretAxis(appAxis) maxShape[ax] = None if os.path.exists(fileName): append = True dsOpts['maxshape'] = tuple(maxShape) else: dsOpts['maxshape'] = None if append: f = h5py.File(fileName, 'r+') if f.attrs['MetaArray'] != MetaArray.version: raise Exception("The file %s was created with a different version of MetaArray. Will not modify." % fileName) ## resize data and write in new values data = f['data'] shape = list(data.shape) shape[ax] += self.shape[ax] data.resize(tuple(shape)) sl = [slice(None)] * len(data.shape) sl[ax] = slice(-self.shape[ax], None) data[tuple(sl)] = self.view(np.ndarray) ## add axis values if they are present. axKeys = ["values"] axKeys.extend(opts.get("appendKeys", [])) axInfo = f['info'][str(ax)] for key in axKeys: if key in axInfo: v = axInfo[key] v2 = self._info[ax][key] shape = list(v.shape) shape[0] += v2.shape[0] v.resize(shape) v[-v2.shape[0]:] = v2 else: raise TypeError('Cannot append to axis info key "%s"; this key is not present in the target file.' % key) f.close() else: f = h5py.File(fileName, 'w') f.attrs['MetaArray'] = MetaArray.version #print dsOpts f.create_dataset('data', data=self.view(np.ndarray), **dsOpts) ## dsOpts is used when storing meta data whenever an array is encountered ## however, 'chunks' will no longer be valid for these arrays if it specifies a chunk shape. ## 'maxshape' is right-out. if isinstance(dsOpts['chunks'], tuple): dsOpts['chunks'] = True if 'maxshape' in dsOpts: del dsOpts['maxshape'] self.writeHDF5Meta(f, 'info', self._info, **dsOpts) f.close() def writeHDF5Meta(self, root, name, data, **dsOpts): if isinstance(data, np.ndarray): dsOpts['maxshape'] = (None,) + data.shape[1:] root.create_dataset(name, data=data, **dsOpts) elif isinstance(data, list) or isinstance(data, tuple): gr = root.create_group(name) if isinstance(data, list): gr.attrs['_metaType_'] = 'list' else: gr.attrs['_metaType_'] = 'tuple' #n = int(np.log10(len(data))) + 1 for i in range(len(data)): self.writeHDF5Meta(gr, str(i), data[i], **dsOpts) elif isinstance(data, dict): gr = root.create_group(name) gr.attrs['_metaType_'] = 'dict' for k, v in data.items(): self.writeHDF5Meta(gr, k, v, **dsOpts) elif isinstance(data, int) or isinstance(data, float) or isinstance(data, np.integer) or isinstance(data, np.floating): root.attrs[name] = data else: try: ## strings, bools, None are stored as repr() strings root.attrs[name] = repr(data) except: print("Can not store meta data of type '%s' in HDF5. (key is '%s')" % (str(type(data)), str(name))) raise def writeMa(self, fileName, appendAxis=None, newFile=False): """Write an old-style .ma file""" meta = {'shape':self.shape, 'type':str(self.dtype), 'info':self.infoCopy(), 'version':MetaArray.version} axstrs = [] ## copy out axis values for dynamic axis if requested if appendAxis is not None: if MetaArray.isNameType(appendAxis): appendAxis = self._interpretAxis(appendAxis) ax = meta['info'][appendAxis] ax['values_len'] = 'dynamic' if 'values' in ax: ax['values_type'] = str(ax['values'].dtype) dynXVals = ax['values'] del ax['values'] else: dynXVals = None ## Generate axis data string, modify axis info so we know how to read it back in later for ax in meta['info']: if 'values' in ax: axstrs.append(ax['values'].tostring()) ax['values_len'] = len(axstrs[-1]) ax['values_type'] = str(ax['values'].dtype) del ax['values'] ## Decide whether to output the meta block for a new file if not newFile: ## If the file does not exist or its size is 0, then we must write the header newFile = (not os.path.exists(fileName)) or (os.stat(fileName).st_size == 0) ## write data to file if appendAxis is None or newFile: fd = open(fileName, 'wb') fd.write(str(meta) + '\n\n') for ax in axstrs: fd.write(ax) else: fd = open(fileName, 'ab') if self.dtype != object: dataStr = self.view(np.ndarray).tostring() else: dataStr = pickle.dumps(self.view(np.ndarray)) #print self.size, len(dataStr), self.dtype if appendAxis is not None: frameInfo = {'len':len(dataStr), 'numFrames':self.shape[appendAxis]} if dynXVals is not None: frameInfo['xVals'] = list(dynXVals) fd.write('\n'+str(frameInfo)+'\n') fd.write(dataStr) fd.close() def writeCsv(self, fileName=None): """Write 2D array to CSV file or return the string if no filename is given""" if self.ndim > 2: raise Exception("CSV Export is only for 2D arrays") if fileName is not None: file = open(fileName, 'w') ret = '' if 'cols' in self._info[0]: s = ','.join([x['name'] for x in self._info[0]['cols']]) + '\n' if fileName is not None: file.write(s) else: ret += s for row in range(0, self.shape[1]): s = ','.join(["%g" % x for x in self[:, row]]) + '\n' if fileName is not None: file.write(s) else: ret += s if fileName is not None: file.close() else: return ret pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/metaarray/__init__.py000066400000000000000000000000311457240071200237440ustar00rootroot00000000000000from .MetaArray import * pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/metaarray/license.txt000066400000000000000000000021331457240071200240230ustar00rootroot00000000000000Copyright (c) 2010 Luke Campagnola ('luke.campagnola@%s.com' % 'gmail') The MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/metaarray/readMeta.m000066400000000000000000000031771457240071200235510ustar00rootroot00000000000000function f = readMeta(file) info = hdf5info(file); f = readMetaRecursive(info.GroupHierarchy.Groups(1)); end function f = readMetaRecursive(root) typ = 0; for i = 1:length(root.Attributes) if strcmp(root.Attributes(i).Shortname, '_metaType_') typ = root.Attributes(i).Value.Data; break end end if typ == 0 printf('group has no _metaType_') typ = 'dict'; end list = 0; if strcmp(typ, 'list') || strcmp(typ, 'tuple') data = {}; list = 1; elseif strcmp(typ, 'dict') data = struct(); else printf('Unrecognized meta type %s', typ); data = struct(); end for i = 1:length(root.Attributes) name = root.Attributes(i).Shortname; if strcmp(name, '_metaType_') continue end val = root.Attributes(i).Value; if isa(val, 'hdf5.h5string') val = val.Data; end if list ind = str2num(name)+1; data{ind} = val; else data.(name) = val; end end for i = 1:length(root.Datasets) fullName = root.Datasets(i).Name; name = stripName(fullName); file = root.Datasets(i).Filename; data2 = hdf5read(file, fullName); if list ind = str2num(name)+1; data{ind} = data2; else data.(name) = data2; end end for i = 1:length(root.Groups) name = stripName(root.Groups(i).Name); data2 = readMetaRecursive(root.Groups(i)); if list ind = str2num(name)+1; data{ind} = data2; else data.(name) = data2; end end f = data; return; end function f = stripName(str) inds = strfind(str, '/'); if isempty(inds) f = str; else f = str(inds(length(inds))+1:length(str)); end end pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/multiprocess/000077500000000000000000000000001457240071200224055ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/multiprocess/__init__.py000066400000000000000000000016311457240071200245170ustar00rootroot00000000000000""" Multiprocessing utility library (parallelization done the way I like it) Luke Campagnola 2012.06.10 This library provides: - simple mechanism for starting a new python interpreter process that can be controlled from the original process (this allows, for example, displaying and manipulating plots in a remote process while the parent process is free to do other work) - proxy system that allows objects hosted in the remote process to be used as if they were local - Qt signal connection between processes - very simple in-line parallelization (fork only; does not work on windows) for number-crunching TODO: allow remote processes to serve as rendering engines that pass pixmaps back to the parent process for display (RemoteGraphicsView class) """ from .parallelizer import CanceledError, Parallelize from .processes import * from .remoteproxy import ClosedError, NoResultError, proxy pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/multiprocess/bootstrap.py000066400000000000000000000025021457240071200247730ustar00rootroot00000000000000"""For starting up remote processes""" import importlib import os import pickle import sys if __name__ == '__main__': if hasattr(os, 'setpgrp'): os.setpgrp() ## prevents signals (notably keyboard interrupt) being forwarded from parent to this process #name, port, authkey, ppid, targetStr, path, pyside = pickle.load(sys.stdin.buffer) opts = pickle.load(sys.stdin.buffer) #print "key:", ' '.join([str(ord(x)) for x in authkey]) path = opts.pop('path', None) if path is not None: if isinstance(path, str): # if string, just insert this into the path sys.path.insert(0, path) else: # if list, then replace the entire sys.path ## modify sys.path in place--no idea who already has a reference to the existing list. while len(sys.path) > 0: sys.path.pop() sys.path.extend(path) qt_lib = opts.pop('qt_lib', None) if qt_lib is not None: globals()[qt_lib] = importlib.import_module(qt_lib) targetStr = opts.pop('targetStr') try: target = pickle.loads(targetStr) ## unpickling the target should import everything we need except: print("Current sys.path:", sys.path) raise target(**opts) ## Send all other options to the target function sys.exit(0) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/multiprocess/parallelizer.py000066400000000000000000000302341457240071200254470ustar00rootroot00000000000000import multiprocessing import os import re import sys import time from .processes import ForkedProcess from .remoteproxy import ClosedError class CanceledError(Exception): """Raised when the progress dialog is canceled during a processing operation.""" pass class Parallelize(object): """ Class for ultra-simple inline parallelization on multi-core CPUs Example:: ## Here is the serial (single-process) task: tasks = [1, 2, 4, 8] results = [] for task in tasks: result = processTask(task) results.append(result) print(results) ## Here is the parallelized version: tasks = [1, 2, 4, 8] results = [] with Parallelize(tasks, workers=4, results=results) as tasker: for task in tasker: result = processTask(task) tasker.results.append(result) print(results) The only major caveat is that *result* in the example above must be picklable, since it is automatically sent via pipe back to the parent process. """ def __init__(self, tasks=None, workers=None, block=True, progressDialog=None, randomReseed=True, **kwds): """ =============== =================================================================== **Arguments:** tasks list of objects to be processed (Parallelize will determine how to distribute the tasks). If unspecified, then each worker will receive a single task with a unique id number. workers number of worker processes or None to use number of CPUs in the system progressDialog optional dict of arguments for ProgressDialog to update while tasks are processed randomReseed If True, each forked process will reseed its random number generator to ensure independent results. Works with the built-in random and numpy.random. kwds objects to be shared by proxy with child processes (they will appear as attributes of the tasker) =============== =================================================================== """ ## Generate progress dialog. ## Note that we want to avoid letting forked child processes play with progress dialogs.. self.showProgress = False if progressDialog is not None: self.showProgress = True if isinstance(progressDialog, str): progressDialog = {'labelText': progressDialog} from ..widgets.ProgressDialog import ProgressDialog self.progressDlg = ProgressDialog(**progressDialog) if workers is None: workers = self.suggestedWorkerCount() if not hasattr(os, 'fork'): workers = 1 self.workers = workers if tasks is None: tasks = range(workers) self.tasks = list(tasks) self.reseed = randomReseed self.kwds = kwds.copy() self.kwds['_taskStarted'] = self._taskStarted def __enter__(self): self.proc = None if self.workers == 1: return self.runSerial() else: return self.runParallel() def __exit__(self, *exc_info): if self.proc is not None: ## worker exceptOccurred = exc_info[0] is not None ## hit an exception during processing. try: if exceptOccurred: sys.excepthook(*exc_info) finally: #print os.getpid(), 'exit' os._exit(1 if exceptOccurred else 0) else: ## parent if self.showProgress: try: self.progressDlg.__exit__(None, None, None) except Exception: pass def runSerial(self): if self.showProgress: self.progressDlg.__enter__() self.progressDlg.setMaximum(len(self.tasks)) self.progress = {os.getpid(): []} return Tasker(self, None, self.tasks, self.kwds) def runParallel(self): self.childs = [] ## break up tasks into one set per worker workers = self.workers chunks = [[] for i in range(workers)] i = 0 for i in range(len(self.tasks)): chunks[i%workers].append(self.tasks[i]) ## fork and assign tasks to each worker for i in range(workers): proc = ForkedProcess(target=None, preProxy=self.kwds, randomReseed=self.reseed) if not proc.isParent: self.proc = proc return Tasker(self, proc, chunks[i], proc.forkedProxies) else: self.childs.append(proc) ## Keep track of the progress of each worker independently. self.progress = dict([(ch.childPid, []) for ch in self.childs]) ## for each child process, self.progress[pid] is a list ## of task indexes. The last index is the task currently being ## processed; all others are finished. try: if self.showProgress: self.progressDlg.__enter__() self.progressDlg.setMaximum(len(self.tasks)) ## process events from workers until all have exited. activeChilds = self.childs[:] self.exitCodes = [] pollInterval = 0.01 while len(activeChilds) > 0: waitingChildren = 0 rem = [] for ch in activeChilds: try: n = ch.processRequests() if n > 0: waitingChildren += 1 except ClosedError: #print ch.childPid, 'process finished' rem.append(ch) if self.showProgress: self.progressDlg += 1 #print "remove:", [ch.childPid for ch in rem] for ch in rem: activeChilds.remove(ch) while True: try: pid, exitcode = os.waitpid(ch.childPid, 0) self.exitCodes.append(exitcode) break except OSError as ex: if ex.errno == 4: ## If we get this error, just try again continue #print "Ignored system call interruption" else: raise #print [ch.childPid for ch in activeChilds] if self.showProgress and self.progressDlg.wasCanceled(): for ch in activeChilds: ch.kill() raise CanceledError() ## adjust polling interval--prefer to get exactly 1 event per poll cycle. if waitingChildren > 1: pollInterval *= 0.7 elif waitingChildren == 0: pollInterval /= 0.7 pollInterval = max(min(pollInterval, 0.5), 0.0005) ## but keep it within reasonable limits time.sleep(pollInterval) finally: if self.showProgress: self.progressDlg.__exit__(None, None, None) for ch in self.childs: ch.join() if len(self.exitCodes) < len(self.childs): raise Exception("Parallelizer started %d processes but only received exit codes from %d." % (len(self.childs), len(self.exitCodes))) for code in self.exitCodes: if code != 0: raise Exception("Error occurred in parallel-executed subprocess (console output may have more information).") return [] ## no tasks for parent process. @staticmethod def suggestedWorkerCount(): if 'linux' in sys.platform: ## I think we can do a little better here.. ## cpu_count does not consider that there is little extra benefit to using hyperthreaded cores. try: cores = {} pid = None with open('/proc/cpuinfo') as fd: for line in fd: m = re.match(r'physical id\s+:\s+(\d+)', line) if m is not None: pid = m.groups()[0] m = re.match(r'cpu cores\s+:\s+(\d+)', line) if m is not None: cores[pid] = int(m.groups()[0]) return sum(cores.values()) except: return multiprocessing.cpu_count() else: return multiprocessing.cpu_count() def _taskStarted(self, pid, i, **kwds): ## called remotely by tasker to indicate it has started working on task i #print pid, 'reported starting task', i if self.showProgress: if len(self.progress[pid]) > 0: self.progressDlg += 1 if pid == os.getpid(): ## single-worker process if self.progressDlg.wasCanceled(): raise CanceledError() self.progress[pid].append(i) class Tasker(object): def __init__(self, parallelizer, process, tasks, kwds): self.proc = process self.par = parallelizer self.tasks = tasks for k, v in kwds.items(): setattr(self, k, v) def __iter__(self): ## we could fix this up such that tasks are retrieved from the parent process one at a time.. for i, task in enumerate(self.tasks): self.index = i #print os.getpid(), 'starting task', i self._taskStarted(os.getpid(), i, _callSync='off') yield task if self.proc is not None: #print os.getpid(), 'no more tasks' self.proc.close() def process(self): """ Process requests from parent. Usually it is not necessary to call this unless you would like to receive messages (such as exit requests) during an iteration. """ if self.proc is not None: self.proc.processRequests() def numWorkers(self): """ Return the number of parallel workers """ return self.par.workers #class Parallelizer: #""" #Use:: #p = Parallelizer() #with p(4) as i: #p.finish(do_work(i)) #print p.results() #""" #def __init__(self): #pass #def __call__(self, n): #self.replies = [] #self.conn = None ## indicates this is the parent process #return Session(self, n) #def finish(self, data): #if self.conn is None: #self.replies.append((self.i, data)) #else: ##print "send", self.i, data #self.conn.send((self.i, data)) #os._exit(0) #def result(self): #print self.replies #class Session: #def __init__(self, par, n): #self.par = par #self.n = n #def __enter__(self): #self.childs = [] #for i in range(1, self.n): #c1, c2 = multiprocessing.Pipe() #pid = os.fork() #if pid == 0: ## child #self.par.i = i #self.par.conn = c2 #self.childs = None #c1.close() #return i #else: #self.childs.append(c1) #c2.close() #self.par.i = 0 #return 0 #def __exit__(self, *exc_info): #if exc_info[0] is not None: #sys.excepthook(*exc_info) #if self.childs is not None: #self.par.replies.extend([conn.recv() for conn in self.childs]) #else: #self.par.finish(None) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/multiprocess/processes.py000066400000000000000000000553441457240071200250000ustar00rootroot00000000000000import atexit import inspect import multiprocessing.connection import os import signal import subprocess import sys import time import pickle from ..Qt import QT_LIB, mkQApp from ..util import cprint # color printing for debugging from .remoteproxy import ( ClosedError, LocalObjectProxy, NoResultError, ObjectProxy, RemoteEventHandler, ) __all__ = ['Process', 'QtProcess', 'ForkedProcess', 'ClosedError', 'NoResultError'] class Process(RemoteEventHandler): """ Bases: RemoteEventHandler This class is used to spawn and control a new python interpreter. It uses subprocess.Popen to start the new process and communicates with it using multiprocessing.Connection objects over a network socket. By default, the remote process will immediately enter an event-processing loop that carries out requests send from the parent process. Remote control works mainly through proxy objects:: proc = Process() ## starts process, returns handle rsys = proc._import('sys') ## asks remote process to import 'sys', returns ## a proxy which references the imported module rsys.stdout.write('hello\n') ## This message will be printed from the remote ## process. Proxy objects can usually be used ## exactly as regular objects are. proc.close() ## Request the remote process shut down Requests made via proxy objects may be synchronous or asynchronous and may return objects either by proxy or by value (if they are picklable). See ProxyObject for more information. """ _process_count = 1 # just used for assigning colors to each process for debugging def __init__(self, name=None, target=None, executable=None, copySysPath=True, debug=False, timeout=20, wrapStdout=None, pyqtapis=None): """ ============== ============================================================= **Arguments:** name Optional name for this process used when printing messages from the remote process. target Optional function to call after starting remote process. By default, this is startEventLoop(), which causes the remote process to handle requests from the parent process until it is asked to quit. If you wish to specify a different target, it must be picklable (bound methods are not). copySysPath If True, copy the contents of sys.path to the remote process. If False, then only the path required to import pyqtgraph is added. debug If True, print detailed information about communication with the child process. wrapStdout If True (default on windows) then stdout and stderr from the child process will be caught by the parent process and forwarded to its stdout/stderr. This provides a workaround for a python bug: http://bugs.python.org/issue3905 but has the side effect that child output is significantly delayed relative to the parent output. pyqtapis Formerly optional dictionary of PyQt API version numbers to set before importing pyqtgraph in the remote process. No longer has any effect. ============== ============================================================= """ if target is None: target = startEventLoop if name is None: name = str(self) if executable is None: executable = sys.executable self.debug = 7 if debug is True else False # 7 causes printing in white ## random authentication key authkey = os.urandom(20) ## Listen for connection from remote process (and find free port number) l = multiprocessing.connection.Listener(('localhost', 0), authkey=authkey) port = l.address[1] ## start remote process, instruct it to run target function if copySysPath: sysPath = sys.path else: # what path do we need to make target importable? mod = inspect.getmodule(target) modroot = sys.modules[mod.__name__.split('.')[0]] sysPath = os.path.abspath(os.path.join(os.path.dirname(modroot.__file__), '..')) bootstrap = os.path.abspath(os.path.join(os.path.dirname(__file__), 'bootstrap.py')) self.debugMsg('Starting child process (%s %s)' % (executable, bootstrap)) # Decide on printing color for this process if debug: procDebug = (Process._process_count%6) + 1 # pick a color for this process to print in Process._process_count += 1 else: procDebug = False if wrapStdout is None: wrapStdout = sys.platform.startswith('win') if wrapStdout: ## note: we need all three streams to have their own PIPE due to this bug: ## http://bugs.python.org/issue3905 stdout = subprocess.PIPE stderr = subprocess.PIPE self.proc = subprocess.Popen((executable, bootstrap), stdin=subprocess.PIPE, stdout=stdout, stderr=stderr) ## to circumvent the bug and still make the output visible, we use ## background threads to pass data from pipes to stdout/stderr self._stdoutForwarder = FileForwarder(self.proc.stdout, "stdout", procDebug) self._stderrForwarder = FileForwarder(self.proc.stderr, "stderr", procDebug) else: self.proc = subprocess.Popen((executable, bootstrap), stdin=subprocess.PIPE) targetStr = pickle.dumps(target) ## double-pickle target so that child has a chance to ## set its sys.path properly before unpickling the target pid = os.getpid() # we must send pid to child because windows does not have getppid # When running in a venv on Windows platform, since Python >= 3.7.3, the launched # subprocess is a grandchild instead of a child, leading to self.proc.pid not being # the pid of the launched subprocess. # https://bugs.python.org/issue38905 # # As a workaround, when we detect such a situation, we perform exchange of pids via # the multiprocessing connection. Technically, only the launched subprocess needs to # send its pid back. Practically, we hijack the ppid parameter to indicate to the # subprocess that pid exchange is needed. # # We detect a virtual environment using sys.base_prefix, see https://docs.python.org/3/library/sys.html#sys.base_prefix # See https://github.com/pyqtgraph/pyqtgraph/pull/2566 and https://github.com/spyder-ide/spyder/issues/20273 xchg_pids = sys.platform == 'win32' and sys.prefix != sys.base_prefix ## Send everything the remote process needs to start correctly data = dict( name=name+'_child', port=port, authkey=authkey, ppid=pid if not xchg_pids else None, targetStr=targetStr, path=sysPath, qt_lib=QT_LIB, debug=procDebug, ) pickle.dump(data, self.proc.stdin) self.proc.stdin.close() ## open connection for remote process self.debugMsg('Listening for child process on port %d, authkey=%s..' % (port, repr(authkey))) while True: try: conn = l.accept() break except IOError as err: if err.errno == 4: # interrupted; try again continue else: raise child_pid = self.proc.pid if xchg_pids: # corresponding code is in: # remoteproxy.py::RemoteEventHandler.__init__() conn.send(pid) child_pid = conn.recv() RemoteEventHandler.__init__(self, conn, name+'_parent', pid=child_pid, debug=self.debug) self.debugMsg('Connected to child process.') atexit.register(self.join) def join(self, timeout=10): self.debugMsg('Joining child process..') if self.proc.poll() is None: self.close() start = time.time() while self.proc.poll() is None: if timeout is not None and time.time() - start > timeout: raise Exception('Timed out waiting for remote process to end.') time.sleep(0.05) self.conn.close() # Close remote polling threads, otherwise they will spin continuously if hasattr(self, "_stdoutForwarder"): self._stdoutForwarder.finish.set() self._stderrForwarder.finish.set() self._stdoutForwarder.join() self._stderrForwarder.join() self.debugMsg('Child process exited. (%d)' % self.proc.returncode) def debugMsg(self, msg, *args): if hasattr(self, '_stdoutForwarder'): ## Lock output from subprocess to make sure we do not get line collisions with self._stdoutForwarder.lock: with self._stderrForwarder.lock: RemoteEventHandler.debugMsg(self, msg, *args) else: RemoteEventHandler.debugMsg(self, msg, *args) def startEventLoop(name, port, authkey, ppid, debug=False): if debug: import os cprint.cout(debug, '[%d] connecting to server at port localhost:%d, authkey=%s..\n' % (os.getpid(), port, repr(authkey)), -1) conn = multiprocessing.connection.Client(('localhost', int(port)), authkey=authkey) if debug: cprint.cout(debug, '[%d] connected; starting remote proxy.\n' % os.getpid(), -1) global HANDLER #ppid = 0 if not hasattr(os, 'getppid') else os.getppid() HANDLER = RemoteEventHandler(conn, name, ppid, debug=debug) while True: try: HANDLER.processRequests() # exception raised when the loop should exit time.sleep(0.01) except ClosedError: HANDLER.debugMsg('Exiting server loop.') sys.exit(0) class ForkedProcess(RemoteEventHandler): """ ForkedProcess is a substitute for Process that uses os.fork() to generate a new process. This is much faster than starting a completely new interpreter and child processes automatically have a copy of the entire program state from before the fork. This makes it an appealing approach when parallelizing expensive computations. (see also Parallelizer) However, fork() comes with some caveats and limitations: - fork() is not available on Windows. - It is not possible to have a QApplication in both parent and child process (unless both QApplications are created _after_ the call to fork()) Attempts by the forked process to access Qt GUI elements created by the parent will most likely cause the child to crash. - Likewise, database connections are unlikely to function correctly in a forked child. - Threads are not copied by fork(); the new process will have only one thread that starts wherever fork() was called in the parent process. - Forked processes are unceremoniously terminated when join() is called; they are not given any opportunity to clean up. (This prevents them calling any cleanup code that was only intended to be used by the parent process) - Normally when fork()ing, open file handles are shared with the parent process, which is potentially dangerous. ForkedProcess is careful to close all file handles that are not explicitly needed--stdout, stderr, and a single pipe to the parent process. """ def __init__(self, name=None, target=0, preProxy=None, randomReseed=True): """ When initializing, an optional target may be given. If no target is specified, self.eventLoop will be used. If None is given, no target will be called (and it will be up to the caller to properly shut down the forked process) preProxy may be a dict of values that will appear as ObjectProxy in the remote process (but do not need to be sent explicitly since they are available immediately before the call to fork(). Proxies will be availabe as self.proxies[name]. If randomReseed is True, the built-in random and numpy.random generators will be reseeded in the child process. """ self.hasJoined = False if target == 0: target = self.eventLoop if name is None: name = str(self) conn, remoteConn = multiprocessing.Pipe() proxyIDs = {} if preProxy is not None: for k, v in preProxy.items(): proxyId = LocalObjectProxy.registerObject(v) proxyIDs[k] = proxyId ppid = os.getpid() # write this down now; windows doesn't have getppid pid = os.fork() if pid == 0: self.isParent = False ## We are now in the forked process; need to be extra careful what we touch while here. ## - no reading/writing file handles/sockets owned by parent process (stdout is ok) ## - don't touch QtGui or QApplication at all; these are landmines. ## - don't let the process call exit handlers os.setpgrp() ## prevents signals (notably keyboard interrupt) being forwarded from parent to this process ## close all file handles we do not want shared with parent conn.close() sys.stdin.close() ## otherwise we screw with interactive prompts. fid = remoteConn.fileno() os.closerange(3, fid) os.closerange(fid+1, 4096) ## just guessing on the maximum descriptor count.. ## Override any custom exception hooks def excepthook(*args): import traceback traceback.print_exception(*args) sys.excepthook = excepthook ## Make it harder to access QApplication instance for qtlib in ('PyQt4', 'PySide', 'PyQt5'): if qtlib in sys.modules: sys.modules[qtlib+'.QtGui'].QApplication = None sys.modules.pop(qtlib+'.QtGui', None) sys.modules.pop(qtlib+'.QtCore', None) ## sabotage atexit callbacks atexit._exithandlers = [] atexit.register(lambda: os._exit(0)) if randomReseed: if 'numpy.random' in sys.modules: sys.modules['numpy.random'].seed(os.getpid() ^ int(time.time()*10000%10000)) if 'random' in sys.modules: sys.modules['random'].seed(os.getpid() ^ int(time.time()*10000%10000)) #ppid = 0 if not hasattr(os, 'getppid') else os.getppid() RemoteEventHandler.__init__(self, remoteConn, name+'_child', pid=ppid) self.forkedProxies = {} for name, proxyId in proxyIDs.items(): self.forkedProxies[name] = ObjectProxy(ppid, proxyId=proxyId, typeStr=repr(preProxy[name])) if target is not None: target() else: self.isParent = True self.childPid = pid remoteConn.close() RemoteEventHandler.handlers = {} ## don't want to inherit any of this from the parent. RemoteEventHandler.__init__(self, conn, name+'_parent', pid=pid) atexit.register(self.join) def eventLoop(self): while True: try: self.processRequests() # exception raised when the loop should exit time.sleep(0.01) except ClosedError: break except: print("Error occurred in forked event loop:") sys.excepthook(*sys.exc_info()) sys.exit(0) def join(self, timeout=10): if self.hasJoined: return #os.kill(pid, 9) try: self.close(callSync='sync', timeout=timeout, noCleanup=True) ## ask the child process to exit and require that it return a confirmation. except IOError: ## probably remote process has already quit pass try: os.waitpid(self.childPid, 0) except OSError: ## probably remote process has already quit pass self.conn.close() # don't leak file handles! self.hasJoined = True def kill(self): """Immediately kill the forked remote process. This is generally safe because forked processes are already expected to _avoid_ any cleanup at exit.""" os.kill(self.childPid, signal.SIGKILL) self.hasJoined = True ##Special set of subclasses that implement a Qt event loop instead. class RemoteQtEventHandler(RemoteEventHandler): def __init__(self, *args, **kwds): RemoteEventHandler.__init__(self, *args, **kwds) def startEventTimer(self): from ..Qt import QtCore self.timer = QtCore.QTimer() self.timer.timeout.connect(self.processRequests) self.timer.start(10) def processRequests(self): try: RemoteEventHandler.processRequests(self) except ClosedError: from ..Qt import QtWidgets QtWidgets.QApplication.instance().quit() self.timer.stop() #raise SystemExit class QtProcess(Process): """ QtProcess is essentially the same as Process, with two major differences: - The remote process starts by running startQtEventLoop() which creates a QApplication in the remote process and uses a QTimer to trigger remote event processing. This allows the remote process to have its own GUI. - A QTimer is also started on the parent process which polls for requests from the child process. This allows Qt signals emitted within the child process to invoke slots on the parent process and vice-versa. This can be disabled using processRequests=False in the constructor. Example:: proc = QtProcess() rQtGui = proc._import('PyQt4.QtGui') btn = rQtWidgets.QPushButton('button on child process') btn.show() def slot(): print('slot invoked on parent process') btn.clicked.connect(proxy(slot)) # be sure to send a proxy of the slot """ def __init__(self, **kwds): if 'target' not in kwds: kwds['target'] = startQtEventLoop from ..Qt import ( # # avoid module-level import to keep bootstrap snappy. QtWidgets, ) self._processRequests = kwds.pop('processRequests', True) if self._processRequests and QtWidgets.QApplication.instance() is None: raise Exception("Must create QApplication before starting QtProcess, or use QtProcess(processRequests=False)") Process.__init__(self, **kwds) self.startEventTimer() def startEventTimer(self): from ..Qt import QtCore # # avoid module-level import to keep bootstrap snappy. self.timer = QtCore.QTimer() if self._processRequests: self.startRequestProcessing() def startRequestProcessing(self, interval=0.01): """Start listening for requests coming from the child process. This allows signals to be connected from the child process to the parent. """ self.timer.timeout.connect(self.processRequests) self.timer.start(int(interval*1000)) def stopRequestProcessing(self): self.timer.stop() def processRequests(self): try: Process.processRequests(self) except ClosedError: self.timer.stop() def startQtEventLoop(name, port, authkey, ppid, debug=False): if debug: import os cprint.cout(debug, '[%d] connecting to server at port localhost:%d, authkey=%s..\n' % (os.getpid(), port, repr(authkey)), -1) conn = multiprocessing.connection.Client(('localhost', int(port)), authkey=authkey) if debug: cprint.cout(debug, '[%d] connected; starting remote proxy.\n' % os.getpid(), -1) from ..Qt import QtWidgets app = QtWidgets.QApplication.instance() #print app if app is None: app = mkQApp() app.setQuitOnLastWindowClosed(False) ## generally we want the event loop to stay open ## until it is explicitly closed by the parent process. global HANDLER HANDLER = RemoteQtEventHandler(conn, name, ppid, debug=debug) HANDLER.startEventTimer() app.exec() if hasattr(app, 'exec') else app.exec_() import threading class FileForwarder(threading.Thread): """ Background thread that forwards data from one pipe to another. This is used to catch data from stdout/stderr of the child process and print it back out to stdout/stderr. We need this because this bug: http://bugs.python.org/issue3905 _requires_ us to catch stdout/stderr. *output* may be a file or 'stdout' or 'stderr'. In the latter cases, sys.stdout/stderr are retrieved once for every line that is output, which ensures that the correct behavior is achieved even if sys.stdout/stderr are replaced at runtime. """ def __init__(self, input, output, color): threading.Thread.__init__(self) self.input = input self.output = output self.lock = threading.Lock() self.daemon = True self.color = color self.finish = threading.Event() self.start() def run(self): if self.output == 'stdout' and self.color is not False: while not self.finish.is_set(): line = self.input.readline() with self.lock: cprint.cout(self.color, line.decode('utf8'), -1) elif self.output == 'stderr' and self.color is not False: while not self.finish.is_set(): line = self.input.readline() with self.lock: cprint.cerr(self.color, line.decode('utf8'), -1) else: if isinstance(self.output, str): self.output = getattr(sys, self.output) while not self.finish.is_set(): line = self.input.readline() with self.lock: self.output.write(line.decode('utf8')) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/multiprocess/remoteproxy.py000066400000000000000000001374251457240071200253700ustar00rootroot00000000000000import os import sys import threading import time import traceback import warnings import weakref import builtins import pickle import numpy as np # color printing for debugging from ..util import cprint class ClosedError(Exception): """Raised when an event handler receives a request to close the connection or discovers that the connection has been closed.""" pass class NoResultError(Exception): """Raised when a request for the return value of a remote call fails because the call has not yet returned.""" pass class RemoteExceptionWarning(UserWarning): """Emitted when a request to a remote object results in an Exception """ pass class RemoteEventHandler(object): """ This class handles communication between two processes. One instance is present on each process and listens for communication from the other process. This enables (amongst other things) ObjectProxy instances to look up their attributes and call their methods. This class is responsible for carrying out actions on behalf of the remote process. Each instance holds one end of a Connection which allows python objects to be passed between processes. For the most common operations, see _import(), close(), and transfer() To handle and respond to incoming requests, RemoteEventHandler requires that its processRequests method is called repeatedly (this is usually handled by the Process classes defined in multiprocess.processes). """ handlers = {} ## maps {process ID : handler}. This allows unpickler to determine which process ## an object proxy belongs to def __init__(self, connection, name, pid, debug=False): self.debug = debug self.conn = connection self.name = name self.results = {} ## reqId: (status, result); cache of request results received from the remote process ## status is either 'result' or 'error' ## if 'error', then result will be (exception, formatted exceprion) ## where exception may be None if it could not be passed through the Connection. self.resultLock = threading.RLock() self.proxies = {} ## maps {weakref(proxy): proxyId}; used to inform the remote process when a proxy has been deleted. self.proxyLock = threading.RLock() ## attributes that affect the behavior of the proxy. ## See ObjectProxy._setProxyOptions for description self.proxyOptions = { 'callSync': 'sync', ## 'sync', 'async', 'off' 'timeout': 10, ## float 'returnType': 'auto', ## 'proxy', 'value', 'auto' 'autoProxy': False, ## bool 'deferGetattr': False, ## True, False 'noProxyTypes': [ type(None), str, bytes, int, float, tuple, list, dict, LocalObjectProxy, ObjectProxy, ], } self.optsLock = threading.RLock() self.nextRequestId = 0 self.exited = False # Mutexes to help prevent issues when multiple threads access the same RemoteEventHandler self.processLock = threading.RLock() self.sendLock = threading.RLock() # parent sent us None as its pid, wants us to exchange pids # corresponding code is in: # processes.py::Process.__init__() if pid is None: connection.send(os.getpid()) pid = connection.recv() RemoteEventHandler.handlers[pid] = self ## register this handler as the one communicating with pid @classmethod def getHandler(cls, pid): try: return cls.handlers[pid] except: print(pid, cls.handlers) raise def debugMsg(self, msg, *args): if not self.debug: return cprint.cout(self.debug, "[%d] %s\n" % (os.getpid(), str(msg)%args), -1) def getProxyOption(self, opt): with self.optsLock: return self.proxyOptions[opt] def setProxyOptions(self, **kwds): """ Set the default behavior options for object proxies. See ObjectProxy._setProxyOptions for more info. """ with self.optsLock: self.proxyOptions.update(kwds) def processRequests(self): """Process all pending requests from the pipe, return after no more events are immediately available. (non-blocking) Returns the number of events processed. """ with self.processLock: if self.exited: self.debugMsg(' processRequests: exited already; raise ClosedError.') raise ClosedError() numProcessed = 0 while self.conn.poll(): #try: #poll = self.conn.poll() #if not poll: #break #except IOError: # this can happen if the remote process dies. ## might it also happen in other circumstances? #raise ClosedError() try: self.handleRequest() numProcessed += 1 except ClosedError: self.debugMsg('processRequests: got ClosedError from handleRequest; setting exited=True.') self.exited = True raise #except IOError as err: ## let handleRequest take care of this. #self.debugMsg(' got IOError from handleRequest; try again.') #if err.errno == 4: ## interrupted system call; try again #continue #else: #raise except: print("Error in process %s" % self.name) sys.excepthook(*sys.exc_info()) if numProcessed > 0: self.debugMsg('processRequests: finished %d requests', numProcessed) return numProcessed def handleRequest(self): """Handle a single request from the remote process. Blocks until a request is available.""" result = None while True: try: ## args, kwds are double-pickled to ensure this recv() call never fails cmd, reqId, nByteMsgs, optStr = self.conn.recv() break except EOFError: self.debugMsg(' handleRequest: got EOFError from recv; raise ClosedError.') ## remote process has shut down; end event loop raise ClosedError() except IOError as err: if err.errno == 4: ## interrupted system call; try again self.debugMsg(' handleRequest: got IOError 4 from recv; try again.') continue else: self.debugMsg(' handleRequest: got IOError %d from recv (%s); raise ClosedError.', err.errno, err.strerror) raise ClosedError() self.debugMsg(" handleRequest: received %s %s", cmd, reqId) ## read byte messages following the main request byteData = [] if nByteMsgs > 0: self.debugMsg(" handleRequest: reading %d byte messages", nByteMsgs) for i in range(nByteMsgs): while True: try: byteData.append(self.conn.recv_bytes()) break except EOFError: self.debugMsg(" handleRequest: got EOF while reading byte messages; raise ClosedError.") raise ClosedError() except IOError as err: if err.errno == 4: self.debugMsg(" handleRequest: got IOError 4 while reading byte messages; try again.") continue else: self.debugMsg(" handleRequest: got IOError while reading byte messages; raise ClosedError.") raise ClosedError() try: if cmd == 'result' or cmd == 'error': resultId = reqId reqId = None ## prevents attempt to return information from this request ## (this is already a return from a previous request) opts = pickle.loads(optStr) self.debugMsg(" handleRequest: id=%s opts=%s", reqId, opts) #print os.getpid(), "received request:", cmd, reqId, opts returnType = opts.get('returnType', 'auto') if cmd == 'result': with self.resultLock: self.results[resultId] = ('result', opts['result']) elif cmd == 'error': with self.resultLock: self.results[resultId] = ('error', (opts['exception'], opts['excString'])) elif cmd == 'getObjAttr': result = getattr(opts['obj'], opts['attr']) elif cmd == 'callObj': obj = opts['obj'] fnargs = opts['args'] fnkwds = opts['kwds'] ## If arrays were sent as byte messages, they must be re-inserted into the ## arguments if len(byteData) > 0: for i,arg in enumerate(fnargs): if isinstance(arg, tuple) and len(arg) > 0 and arg[0] == '__byte_message__': ind = arg[1] dtype, shape = arg[2] fnargs[i] = np.frombuffer(byteData[ind], dtype=dtype).reshape(shape) for k,arg in fnkwds.items(): if isinstance(arg, tuple) and len(arg) > 0 and arg[0] == '__byte_message__': ind = arg[1] dtype, shape = arg[2] fnkwds[k] = np.frombuffer(byteData[ind], dtype=dtype).reshape(shape) if len(fnkwds) == 0: ## need to do this because some functions do not allow keyword arguments. try: result = obj(*fnargs) except: print("Failed to call object %s: %d, %s" % (obj, len(fnargs), fnargs[1:])) raise else: result = obj(*fnargs, **fnkwds) elif cmd == 'getObjValue': result = opts['obj'] ## has already been unpickled into its local value returnType = 'value' elif cmd == 'transfer': result = opts['obj'] returnType = 'proxy' elif cmd == 'transferArray': ## read array data from next message: result = np.frombuffer(byteData[0], dtype=opts['dtype']).reshape(opts['shape']) returnType = 'proxy' elif cmd == 'import': name = opts['module'] fromlist = opts.get('fromlist', []) mod = builtins.__import__(name, fromlist=fromlist) if len(fromlist) == 0: parts = name.lstrip('.').split('.') result = mod for part in parts[1:]: result = getattr(result, part) else: result = map(mod.__getattr__, fromlist) elif cmd == 'del': LocalObjectProxy.releaseProxyId(opts['proxyId']) #del self.proxiedObjects[opts['objId']] elif cmd == 'close': if reqId is not None: result = True returnType = 'value' exc = None except: exc = sys.exc_info() if reqId is not None: if exc is None: self.debugMsg(" handleRequest: sending return value for %d: %s", reqId, result) #print "returnValue:", returnValue, result if returnType == 'auto': with self.optsLock: noProxyTypes = self.proxyOptions['noProxyTypes'] result = self.autoProxy(result, noProxyTypes) elif returnType == 'proxy': result = LocalObjectProxy(result) try: self.replyResult(reqId, result) except: sys.excepthook(*sys.exc_info()) self.replyError(reqId, *sys.exc_info()) else: self.debugMsg(" handleRequest: returning exception for %d", reqId) self.replyError(reqId, *exc) elif exc is not None: sys.excepthook(*exc) if cmd == 'close': if opts.get('noCleanup', False) is True: os._exit(0) ## exit immediately, do not pass GO, do not collect $200. ## (more importantly, do not call any code that would ## normally be invoked at exit) else: raise ClosedError() def replyResult(self, reqId, result): self.send(request='result', reqId=reqId, callSync='off', opts=dict(result=result)) def replyError(self, reqId, *exc): # print("error: %s %s %s" % (self.name, str(reqId), str(exc[1]))) excStr = traceback.format_exception(*exc) try: self.send(request='error', reqId=reqId, callSync='off', opts=dict(exception=exc[1], excString=excStr)) except: self.send(request='error', reqId=reqId, callSync='off', opts=dict(exception=None, excString=excStr)) def send(self, request, opts=None, reqId=None, callSync='sync', timeout=10, returnType=None, byteData=None, **kwds): """Send a request or return packet to the remote process. Generally it is not necessary to call this method directly; it is for internal use. (The docstring has information that is nevertheless useful to the programmer as it describes the internal protocol used to communicate between processes) ============== ==================================================================== **Arguments:** request String describing the type of request being sent (see below) reqId Integer uniquely linking a result back to the request that generated it. (most requests leave this blank) callSync 'sync': return the actual result of the request 'async': return a Request object which can be used to look up the result later 'off': return no result timeout Time in seconds to wait for a response when callSync=='sync' opts Extra arguments sent to the remote process that determine the way the request will be handled (see below) returnType 'proxy', 'value', or 'auto' byteData If specified, this is a list of objects to be sent as byte messages to the remote process. This is used to send large arrays without the cost of pickling. ============== ==================================================================== Description of request strings and options allowed for each: ============= ============= ======================================================== request option description ------------- ------------- -------------------------------------------------------- getObjAttr Request the remote process return (proxy to) an attribute of an object. obj reference to object whose attribute should be returned attr string name of attribute to return returnValue bool or 'auto' indicating whether to return a proxy or the actual value. callObj Request the remote process call a function or method. If a request ID is given, then the call's return value will be sent back (or information about the error that occurred while running the function) obj the (reference to) object to call args tuple of arguments to pass to callable kwds dict of keyword arguments to pass to callable returnValue bool or 'auto' indicating whether to return a proxy or the actual value. getObjValue Request the remote process return the value of a proxied object (must be picklable) obj reference to object whose value should be returned transfer Copy an object to the remote process and request it return a proxy for the new object. obj The object to transfer. import Request the remote process import new symbols and return proxy(ies) to the imported objects module the string name of the module to import fromlist optional list of string names to import from module del Inform the remote process that a proxy has been released (thus the remote process may be able to release the original object) proxyId id of proxy which is no longer referenced by remote host close Instruct the remote process to stop its event loop and exit. Optionally, this request may return a confirmation. result Inform the remote process that its request has been processed result return value of a request error Inform the remote process that its request failed exception the Exception that was raised (or None if the exception could not be pickled) excString string-formatted version of the exception and traceback ============= ===================================================================== """ if self.exited: self.debugMsg(' send: exited already; raise ClosedError.') raise ClosedError() with self.sendLock: #if len(kwds) > 0: #print "Warning: send() ignored args:", kwds if opts is None: opts = {} assert callSync in ['off', 'sync', 'async'], 'callSync must be one of "off", "sync", or "async" (got %r)' % callSync if reqId is None: if callSync != 'off': ## requested return value; use the next available request ID reqId = self.nextRequestId self.nextRequestId += 1 else: ## If requestId is provided, this _must_ be a response to a previously received request. assert request in ['result', 'error'] if returnType is not None: opts['returnType'] = returnType #print os.getpid(), "send request:", request, reqId, opts ## double-pickle args to ensure that at least status and request ID get through try: optStr = pickle.dumps(opts) except: print("==== Error pickling this object: ====") print(opts) print("=======================================") raise nByteMsgs = 0 if byteData is not None: nByteMsgs = len(byteData) ## Send primary request request = (request, reqId, nByteMsgs, optStr) self.debugMsg('send request: cmd=%s nByteMsgs=%d id=%s opts=%s', request[0], nByteMsgs, reqId, opts) self.conn.send(request) ## follow up by sending byte messages if byteData is not None: for obj in byteData: ## Remote process _must_ be prepared to read the same number of byte messages! self.conn.send_bytes(bytes(obj)) self.debugMsg(' sent %d byte messages', len(byteData)) self.debugMsg(' call sync: %s', callSync) if callSync == 'off': return req = Request(self, reqId, description=str(request), timeout=timeout) if callSync == 'async': return req if callSync == 'sync': return req.result() def close(self, callSync='off', noCleanup=False, **kwds): try: self.send(request='close', opts=dict(noCleanup=noCleanup), callSync=callSync, **kwds) self.exited = True except ClosedError: pass def getResult(self, reqId): ## raises NoResultError if the result is not available yet #print self.results.keys(), os.getpid() with self.resultLock: haveResult = reqId in self.results if not haveResult: try: self.processRequests() except ClosedError: ## even if remote connection has closed, we may have ## received new data during this call to processRequests() pass with self.resultLock: if reqId not in self.results: raise NoResultError() status, result = self.results.pop(reqId) if status == 'result': return result elif status == 'error': #print ''.join(result) exc, excStr = result if exc is not None: # PySide6 6.1.0 does an attribute lookup for feature testing # in such a case, failure is normal normal = ["AttributeError"] if not any(excStr[-1].startswith(x) for x in normal): warnings.warn("===== Remote process raised exception on request: =====", RemoteExceptionWarning) warnings.warn(''.join(excStr), RemoteExceptionWarning) warnings.warn("===== Local Traceback to request follows: =====", RemoteExceptionWarning) raise exc else: print(''.join(excStr)) raise Exception("Error getting result. See above for exception from remote process.") else: raise Exception("Internal error.") def _import(self, mod, **kwds): """ Request the remote process import a module (or symbols from a module) and return the proxied results. Uses built-in __import__() function, but adds a bit more processing: _import('module') => returns module _import('module.submodule') => returns submodule (note this differs from behavior of __import__) _import('module', fromlist=[name1, name2, ...]) => returns [module.name1, module.name2, ...] (this also differs from behavior of __import__) """ return self.send(request='import', callSync='sync', opts=dict(module=mod), **kwds) def getObjAttr(self, obj, attr, **kwds): return self.send(request='getObjAttr', opts=dict(obj=obj, attr=attr), **kwds) def getObjValue(self, obj, **kwds): return self.send(request='getObjValue', opts=dict(obj=obj), **kwds) def callObj(self, obj, args, kwds, **opts): opts = opts.copy() args = list(args) ## Decide whether to send arguments by value or by proxy with self.optsLock: noProxyTypes = opts.pop('noProxyTypes', None) if noProxyTypes is None: noProxyTypes = self.proxyOptions['noProxyTypes'] autoProxy = opts.pop('autoProxy', self.proxyOptions['autoProxy']) if autoProxy is True: args = [self.autoProxy(v, noProxyTypes) for v in args] for k, v in kwds.items(): opts[k] = self.autoProxy(v, noProxyTypes) byteMsgs = [] ## If there are arrays in the arguments, send those as byte messages. ## We do this because pickling arrays is too expensive. for i,arg in enumerate(args): if arg.__class__ == np.ndarray: args[i] = ("__byte_message__", len(byteMsgs), (arg.dtype, arg.shape)) byteMsgs.append(arg) for k,v in kwds.items(): if v.__class__ == np.ndarray: kwds[k] = ("__byte_message__", len(byteMsgs), (v.dtype, v.shape)) byteMsgs.append(v) return self.send(request='callObj', opts=dict(obj=obj, args=args, kwds=kwds), byteData=byteMsgs, **opts) def registerProxy(self, proxy): with self.proxyLock: ref = weakref.ref(proxy, self.deleteProxy) self.proxies[ref] = proxy._proxyId def deleteProxy(self, ref): if self.send is None: # this can happen during shutdown return with self.proxyLock: proxyId = self.proxies.pop(ref) try: self.send(request='del', opts=dict(proxyId=proxyId), callSync='off') except ClosedError: ## if remote process has closed down, there is no need to send delete requests anymore pass def transfer(self, obj, **kwds): """ Transfer an object by value to the remote host (the object must be picklable) and return a proxy for the new remote object. """ if obj.__class__ is np.ndarray: opts = {'dtype': obj.dtype, 'shape': obj.shape} return self.send(request='transferArray', opts=opts, byteData=[obj], **kwds) else: return self.send(request='transfer', opts=dict(obj=obj), **kwds) def autoProxy(self, obj, noProxyTypes): ## Return object wrapped in LocalObjectProxy _unless_ its type is in noProxyTypes. for typ in noProxyTypes: if isinstance(obj, typ): return obj return LocalObjectProxy(obj) class Request(object): """ Request objects are returned when calling an ObjectProxy in asynchronous mode or if a synchronous call has timed out. Use hasResult() to ask whether the result of the call has been returned yet. Use result() to get the returned value. """ def __init__(self, process, reqId, description=None, timeout=10): self.proc = process self.description = description self.reqId = reqId self.gotResult = False self._result = None self.timeout = timeout def result(self, block=True, timeout=None): """ Return the result for this request. If block is True, wait until the result has arrived or *timeout* seconds passes. If the timeout is reached, raise NoResultError. (use timeout=None to disable) If block is False, raise NoResultError immediately if the result has not arrived yet. If the process's connection has closed before the result arrives, raise ClosedError. """ if self.gotResult: return self._result if timeout is None: timeout = self.timeout if block: start = time.time() while not self.hasResult(): if self.proc.exited: raise ClosedError() time.sleep(0.005) if timeout >= 0 and time.time() - start > timeout: print("Request timed out: %s" % self.description) import traceback traceback.print_stack() raise NoResultError() return self._result else: self._result = self.proc.getResult(self.reqId) ## raises NoResultError if result is not available yet self.gotResult = True return self._result def hasResult(self): """Returns True if the result for this request has arrived.""" try: self.result(block=False) except NoResultError: pass return self.gotResult class LocalObjectProxy(object): """ Used for wrapping local objects to ensure that they are send by proxy to a remote host. Note that 'proxy' is just a shorter alias for LocalObjectProxy. For example:: data = [1,2,3,4,5] remotePlot.plot(data) ## by default, lists are pickled and sent by value remotePlot.plot(proxy(data)) ## force the object to be sent by proxy """ nextProxyId = 0 proxiedObjects = {} ## maps {proxyId: object} @classmethod def registerObject(cls, obj): ## assign it a unique ID so we can keep a reference to the local object pid = cls.nextProxyId cls.nextProxyId += 1 cls.proxiedObjects[pid] = obj #print "register:", cls.proxiedObjects return pid @classmethod def lookupProxyId(cls, pid): return cls.proxiedObjects[pid] @classmethod def releaseProxyId(cls, pid): del cls.proxiedObjects[pid] #print "release:", cls.proxiedObjects def __init__(self, obj, **opts): """ Create a 'local' proxy object that, when sent to a remote host, will appear as a normal ObjectProxy to *obj*. Any extra keyword arguments are passed to proxy._setProxyOptions() on the remote side. """ self.processId = os.getpid() #self.objectId = id(obj) self.typeStr = repr(obj) #self.handler = handler self.obj = obj self.opts = opts def __reduce__(self): ## a proxy is being pickled and sent to a remote process. ## every time this happens, a new proxy will be generated in the remote process, ## so we keep a new ID so we can track when each is released. pid = LocalObjectProxy.registerObject(self.obj) return (unpickleObjectProxy, (self.processId, pid, self.typeStr, None, self.opts)) ## alias proxy = LocalObjectProxy def unpickleObjectProxy(processId, proxyId, typeStr, attributes=None, opts=None): if processId == os.getpid(): obj = LocalObjectProxy.lookupProxyId(proxyId) if attributes is not None: for attr in attributes: obj = getattr(obj, attr) return obj else: proxy = ObjectProxy(processId, proxyId=proxyId, typeStr=typeStr) if opts is not None: proxy._setProxyOptions(**opts) return proxy class ObjectProxy(object): """ Proxy to an object stored by the remote process. Proxies are created by calling Process._import(), Process.transfer(), or by requesting/calling attributes on existing proxy objects. For the most part, this object can be used exactly as if it were a local object:: rsys = proc._import('sys') # returns proxy to sys module on remote process rsys.stdout # proxy to remote sys.stdout rsys.stdout.write # proxy to remote sys.stdout.write rsys.stdout.write('hello') # calls sys.stdout.write('hello') on remote machine # and returns the result (None) When calling a proxy to a remote function, the call can be made synchronous (result of call is returned immediately), asynchronous (result is returned later), or return can be disabled entirely:: ros = proc._import('os') ## synchronous call; result is returned immediately pid = ros.getpid() ## asynchronous call request = ros.getpid(_callSync='async') while not request.hasResult(): time.sleep(0.01) pid = request.result() ## disable return when we know it isn't needed rsys.stdout.write('hello', _callSync='off') Additionally, values returned from a remote function call are automatically returned either by value (must be picklable) or by proxy. This behavior can be forced:: rnp = proc._import('numpy') arrProxy = rnp.array([1,2,3,4], _returnType='proxy') arrValue = rnp.array([1,2,3,4], _returnType='value') The default callSync and returnType behaviors (as well as others) can be set for each proxy individually using ObjectProxy._setProxyOptions() or globally using proc.setProxyOptions(). """ def __init__(self, processId, proxyId, typeStr='', parent=None): object.__init__(self) ## can't set attributes directly because setattr is overridden. self.__dict__['_processId'] = processId self.__dict__['_typeStr'] = typeStr self.__dict__['_proxyId'] = proxyId self.__dict__['_attributes'] = () ## attributes that affect the behavior of the proxy. ## in all cases, a value of None causes the proxy to ask ## its parent event handler to make the decision self.__dict__['_proxyOptions'] = { 'callSync': None, ## 'sync', 'async', None 'timeout': None, ## float, None 'returnType': None, ## 'proxy', 'value', 'auto', None 'deferGetattr': None, ## True, False, None 'noProxyTypes': None, ## list of types to send by value instead of by proxy 'autoProxy': None, } self.__dict__['_handler'] = RemoteEventHandler.getHandler(processId) self.__dict__['_handler'].registerProxy(self) ## handler will watch proxy; inform remote process when the proxy is deleted. def _setProxyOptions(self, **kwds): """ Change the behavior of this proxy. For all options, a value of None will cause the proxy to instead use the default behavior defined by its parent Process. Options are: ============= ============================================================= callSync 'sync', 'async', 'off', or None. If 'async', then calling methods will return a Request object which can be used to inquire later about the result of the method call. If 'sync', then calling a method will block until the remote process has returned its result or the timeout has elapsed (in this case, a Request object is returned instead). If 'off', then the remote process is instructed _not_ to reply and the method call will return None immediately. returnType 'auto', 'proxy', 'value', or None. If 'proxy', then the value returned when calling a method will be a proxy to the object on the remote process. If 'value', then attempt to pickle the returned object and send it back. If 'auto', then the decision is made by consulting the 'noProxyTypes' option. autoProxy bool or None. If True, arguments to __call__ are automatically converted to proxy unless their type is listed in noProxyTypes (see below). If False, arguments are left untouched. Use proxy(obj) to manually convert arguments before sending. timeout float or None. Length of time to wait during synchronous requests before returning a Request object instead. deferGetattr True, False, or None. If False, all attribute requests will be sent to the remote process immediately and will block until a response is received (or timeout has elapsed). If True, requesting an attribute from the proxy returns a new proxy immediately. The remote process is _not_ contacted to make this request. This is faster, but it is possible to request an attribute that does not exist on the proxied object. In this case, AttributeError will not be raised until an attempt is made to look up the attribute on the remote process. noProxyTypes List of object types that should _not_ be proxied when sent to the remote process. ============= ============================================================= """ for k in kwds: if k not in self._proxyOptions: raise KeyError("Unrecognized proxy option '%s'" % k) self._proxyOptions.update(kwds) def _getValue(self): """ Return the value of the proxied object (the remote object must be picklable) """ return self._handler.getObjValue(self) def _getProxyOption(self, opt): val = self._proxyOptions[opt] if val is None: return self._handler.getProxyOption(opt) return val def _getProxyOptions(self): return dict([(k, self._getProxyOption(k)) for k in self._proxyOptions]) def __reduce__(self): return (unpickleObjectProxy, (self._processId, self._proxyId, self._typeStr, self._attributes)) def __repr__(self): #objRepr = self.__getattr__('__repr__')(callSync='value') return "" % (self._processId, self._proxyId, self._typeStr) def __getattr__(self, attr, **kwds): """ Calls __getattr__ on the remote object and returns the attribute by value or by proxy depending on the options set (see ObjectProxy._setProxyOptions and RemoteEventHandler.setProxyOptions) If the option 'deferGetattr' is True for this proxy, then a new proxy object is returned _without_ asking the remote object whether the named attribute exists. This can save time when making multiple chained attribute requests, but may also defer a possible AttributeError until later, making them more difficult to debug. """ opts = self._getProxyOptions() for k in opts: if '_'+k in kwds: opts[k] = kwds.pop('_'+k) if opts['deferGetattr'] is True: return self._deferredAttr(attr) else: #opts = self._getProxyOptions() return self._handler.getObjAttr(self, attr, **opts) def _deferredAttr(self, attr): return DeferredObjectProxy(self, attr) def __call__(self, *args, **kwds): """ Attempts to call the proxied object from the remote process. Accepts extra keyword arguments: _callSync 'off', 'sync', or 'async' _returnType 'value', 'proxy', or 'auto' If the remote call raises an exception on the remote process, it will be re-raised on the local process. """ opts = self._getProxyOptions() for k in opts: if '_'+k in kwds: opts[k] = kwds.pop('_'+k) return self._handler.callObj(obj=self, args=args, kwds=kwds, **opts) ## Explicitly proxy special methods. Is there a better way to do this?? def _getSpecialAttr(self, attr): ## this just gives us an easy way to change the behavior of the special methods return self._deferredAttr(attr) def __getitem__(self, *args): return self._getSpecialAttr('__getitem__')(*args) def __setitem__(self, *args): return self._getSpecialAttr('__setitem__')(*args, _callSync='off') def __setattr__(self, *args): return self._getSpecialAttr('__setattr__')(*args, _callSync='off') def __str__(self, *args): return self._getSpecialAttr('__str__')(*args, _returnType='value') def __len__(self, *args): return self._getSpecialAttr('__len__')(*args) def __add__(self, *args): return self._getSpecialAttr('__add__')(*args) def __sub__(self, *args): return self._getSpecialAttr('__sub__')(*args) def __div__(self, *args): return self._getSpecialAttr('__div__')(*args) def __truediv__(self, *args): return self._getSpecialAttr('__truediv__')(*args) def __floordiv__(self, *args): return self._getSpecialAttr('__floordiv__')(*args) def __mul__(self, *args): return self._getSpecialAttr('__mul__')(*args) def __pow__(self, *args): return self._getSpecialAttr('__pow__')(*args) def __iadd__(self, *args): return self._getSpecialAttr('__iadd__')(*args, _callSync='off') def __isub__(self, *args): return self._getSpecialAttr('__isub__')(*args, _callSync='off') def __idiv__(self, *args): return self._getSpecialAttr('__idiv__')(*args, _callSync='off') def __itruediv__(self, *args): return self._getSpecialAttr('__itruediv__')(*args, _callSync='off') def __ifloordiv__(self, *args): return self._getSpecialAttr('__ifloordiv__')(*args, _callSync='off') def __imul__(self, *args): return self._getSpecialAttr('__imul__')(*args, _callSync='off') def __ipow__(self, *args): return self._getSpecialAttr('__ipow__')(*args, _callSync='off') def __rshift__(self, *args): return self._getSpecialAttr('__rshift__')(*args) def __lshift__(self, *args): return self._getSpecialAttr('__lshift__')(*args) def __irshift__(self, *args): return self._getSpecialAttr('__irshift__')(*args, _callSync='off') def __ilshift__(self, *args): return self._getSpecialAttr('__ilshift__')(*args, _callSync='off') def __eq__(self, *args): return self._getSpecialAttr('__eq__')(*args) def __ne__(self, *args): return self._getSpecialAttr('__ne__')(*args) def __lt__(self, *args): return self._getSpecialAttr('__lt__')(*args) def __gt__(self, *args): return self._getSpecialAttr('__gt__')(*args) def __le__(self, *args): return self._getSpecialAttr('__le__')(*args) def __ge__(self, *args): return self._getSpecialAttr('__ge__')(*args) def __and__(self, *args): return self._getSpecialAttr('__and__')(*args) def __or__(self, *args): return self._getSpecialAttr('__or__')(*args) def __xor__(self, *args): return self._getSpecialAttr('__xor__')(*args) def __iand__(self, *args): return self._getSpecialAttr('__iand__')(*args, _callSync='off') def __ior__(self, *args): return self._getSpecialAttr('__ior__')(*args, _callSync='off') def __ixor__(self, *args): return self._getSpecialAttr('__ixor__')(*args, _callSync='off') def __mod__(self, *args): return self._getSpecialAttr('__mod__')(*args) def __radd__(self, *args): return self._getSpecialAttr('__radd__')(*args) def __rsub__(self, *args): return self._getSpecialAttr('__rsub__')(*args) def __rdiv__(self, *args): return self._getSpecialAttr('__rdiv__')(*args) def __rfloordiv__(self, *args): return self._getSpecialAttr('__rfloordiv__')(*args) def __rtruediv__(self, *args): return self._getSpecialAttr('__rtruediv__')(*args) def __rmul__(self, *args): return self._getSpecialAttr('__rmul__')(*args) def __rpow__(self, *args): return self._getSpecialAttr('__rpow__')(*args) def __rrshift__(self, *args): return self._getSpecialAttr('__rrshift__')(*args) def __rlshift__(self, *args): return self._getSpecialAttr('__rlshift__')(*args) def __rand__(self, *args): return self._getSpecialAttr('__rand__')(*args) def __ror__(self, *args): return self._getSpecialAttr('__ror__')(*args) def __rxor__(self, *args): return self._getSpecialAttr('__ror__')(*args) def __rmod__(self, *args): return self._getSpecialAttr('__rmod__')(*args) def __hash__(self): ## Required for python3 since __eq__ is defined. return id(self) class DeferredObjectProxy(ObjectProxy): """ This class represents an attribute (or sub-attribute) of a proxied object. It is used to speed up attribute requests. Take the following scenario:: rsys = proc._import('sys') rsys.stdout.write('hello') For this simple example, a total of 4 synchronous requests are made to the remote process: 1) import sys 2) getattr(sys, 'stdout') 3) getattr(stdout, 'write') 4) write('hello') This takes a lot longer than running the equivalent code locally. To speed things up, we can 'defer' the two attribute lookups so they are only carried out when neccessary:: rsys = proc._import('sys') rsys._setProxyOptions(deferGetattr=True) rsys.stdout.write('hello') This example only makes two requests to the remote process; the two attribute lookups immediately return DeferredObjectProxy instances immediately without contacting the remote process. When the call to write() is made, all attribute requests are processed at the same time. Note that if the attributes requested do not exist on the remote object, making the call to write() will raise an AttributeError. """ def __init__(self, parentProxy, attribute): ## can't set attributes directly because setattr is overridden. for k in ['_processId', '_typeStr', '_proxyId', '_handler']: self.__dict__[k] = getattr(parentProxy, k) self.__dict__['_parent'] = parentProxy ## make sure parent stays alive self.__dict__['_attributes'] = parentProxy._attributes + (attribute,) self.__dict__['_proxyOptions'] = parentProxy._proxyOptions.copy() def __repr__(self): return ObjectProxy.__repr__(self) + '.' + '.'.join(self._attributes) def _undefer(self): """ Return a non-deferred ObjectProxy referencing the same object """ return self._parent.__getattr__(self._attributes[-1], _deferGetattr=False) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/000077500000000000000000000000001457240071200211405ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/GLGraphicsItem.py000066400000000000000000000237711457240071200243260ustar00rootroot00000000000000from OpenGL.GL import * # noqa from OpenGL import GL from .. import Transform3D from ..Qt import QtCore GLOptions = { 'opaque': { GL_DEPTH_TEST: True, GL_BLEND: False, GL_ALPHA_TEST: False, GL_CULL_FACE: False, }, 'translucent': { GL_DEPTH_TEST: True, GL_BLEND: True, GL_ALPHA_TEST: False, GL_CULL_FACE: False, 'glBlendFunc': (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), }, 'additive': { GL_DEPTH_TEST: False, GL_BLEND: True, GL_ALPHA_TEST: False, GL_CULL_FACE: False, 'glBlendFunc': (GL_SRC_ALPHA, GL_ONE), }, } class GLGraphicsItem(QtCore.QObject): _nextId = 0 def __init__(self, parentItem: 'GLGraphicsItem' = None): super().__init__() self._id = GLGraphicsItem._nextId GLGraphicsItem._nextId += 1 self.__parent: GLGraphicsItem | None = None self.__view = None self.__children: set[GLGraphicsItem] = set() self.__transform = Transform3D() self.__visible = True self.__initialized = False self.setParentItem(parentItem) self.setDepthValue(0) self.__glOpts = {} def setParentItem(self, item): """Set this item's parent in the scenegraph hierarchy.""" if self.__parent is not None: self.__parent.__children.remove(self) if item is not None: item.__children.add(self) self.__parent = item if self.__parent is not None and self.view() is not self.__parent.view(): if self.view() is not None: self.view().removeItem(self) self.__parent.view().addItem(self) def setGLOptions(self, opts): """ Set the OpenGL state options to use immediately before drawing this item. (Note that subclasses must call setupGLState before painting for this to work) The simplest way to invoke this method is to pass in the name of a predefined set of options (see the GLOptions variable): ============= ====================================================== opaque Enables depth testing and disables blending translucent Enables depth testing and blending Elements must be drawn sorted back-to-front for translucency to work correctly. additive Disables depth testing, enables blending. Colors are added together, so sorting is not required. ============= ====================================================== It is also possible to specify any arbitrary settings as a dictionary. This may consist of {'functionName': (args...)} pairs where functionName must be a callable attribute of OpenGL.GL, or {GL_STATE_VAR: bool} pairs which will be interpreted as calls to glEnable or glDisable(GL_STATE_VAR). For example:: { GL_ALPHA_TEST: True, GL_CULL_FACE: False, 'glBlendFunc': (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), } """ if isinstance(opts, str): opts = GLOptions[opts] self.__glOpts = opts.copy() self.update() def updateGLOptions(self, opts): """ Modify the OpenGL state options to use immediately before drawing this item. *opts* must be a dictionary as specified by setGLOptions. Values may also be None, in which case the key will be ignored. """ self.__glOpts.update(opts) def parentItem(self): """Return a this item's parent in the scenegraph hierarchy.""" return self.__parent def childItems(self): """Return a list of this item's children in the scenegraph hierarchy.""" return list(self.__children) def _setView(self, v): self.__view = v def view(self): return self.__view def setDepthValue(self, value): """ Sets the depth value of this item. Default is 0. This controls the order in which items are drawn--those with a greater depth value will be drawn later. Items with negative depth values are drawn before their parent. (This is analogous to QGraphicsItem.zValue) The depthValue does NOT affect the position of the item or the values it imparts to the GL depth buffer. """ self.__depthValue = value def depthValue(self): """Return the depth value of this item. See setDepthValue for more information.""" return self.__depthValue def setTransform(self, tr): """Set the local transform for this object. Parameters ---------- tr : pyqtgraph.Transform3D Tranformation from the local coordinate system to the parent's. """ self.__transform = Transform3D(tr) self.update() def resetTransform(self): """Reset this item's transform to an identity transformation.""" self.__transform.setToIdentity() self.update() def applyTransform(self, tr, local): """ Multiply this object's transform by *tr*. If local is True, then *tr* is multiplied on the right of the current transform:: newTransform = transform * tr If local is False, then *tr* is instead multiplied on the left:: newTransform = tr * transform """ if local: self.setTransform(self.transform() * tr) else: self.setTransform(tr * self.transform()) def transform(self): """Return this item's transform object.""" return self.__transform def viewTransform(self): """Return the transform mapping this item's local coordinate system to the view coordinate system.""" tr = self.__transform p = self while True: p = p.parentItem() if p is None: break tr = p.transform() * tr return Transform3D(tr) def translate(self, dx, dy, dz, local=False): """ Translate the object by (*dx*, *dy*, *dz*) in its parent's coordinate system. If *local* is True, then translation takes place in local coordinates. """ tr = Transform3D() tr.translate(dx, dy, dz) self.applyTransform(tr, local=local) def rotate(self, angle, x, y, z, local=False): """ Rotate the object around the axis specified by (x,y,z). *angle* is in degrees. """ tr = Transform3D() tr.rotate(angle, x, y, z) self.applyTransform(tr, local=local) def scale(self, x, y, z, local=True): """ Scale the object by (*dx*, *dy*, *dz*) in its local coordinate system. If *local* is False, then scale takes place in the parent's coordinates. """ tr = Transform3D() tr.scale(x, y, z) self.applyTransform(tr, local=local) def hide(self): """Hide this item. This is equivalent to setVisible(False).""" self.setVisible(False) def show(self): """Make this item visible if it was previously hidden. This is equivalent to setVisible(True).""" self.setVisible(True) def setVisible(self, vis): """Set the visibility of this item.""" self.__visible = vis self.update() def visible(self): """Return True if the item is currently set to be visible. Note that this does not guarantee that the item actually appears in the view, as it may be obscured or outside of the current view area.""" return self.__visible def initialize(self): self.initializeGL() self.__initialized = True def isInitialized(self): return self.__initialized def initializeGL(self): """ Called after an item is added to a GLViewWidget. The widget's GL context is made current before this method is called. (So this would be an appropriate time to generate lists, upload textures, etc.) """ pass def setupGLState(self): """ This method is responsible for preparing the GL state options needed to render this item (blending, depth testing, etc). The method is called immediately before painting the item. """ for k,v in self.__glOpts.items(): if v is None: continue if isinstance(k, str): func = getattr(GL, k) func(*v) else: if v is True: glEnable(k) else: glDisable(k) def paint(self): """ Called by the GLViewWidget to draw this item. It is the responsibility of the item to set up its own modelview matrix, but the caller will take care of pushing/popping. """ self.setupGLState() def update(self): """ Indicates that this item needs to be redrawn, and schedules an update with the view it is displayed in. """ v = self.view() if v is None: return v.update() def mapToParent(self, point): tr = self.transform() if tr is None: return point return tr.map(point) def mapFromParent(self, point): tr = self.transform() if tr is None: return point return tr.inverted()[0].map(point) def mapToView(self, point): tr = self.viewTransform() if tr is None: return point return tr.map(point) def mapFromView(self, point): tr = self.viewTransform() if tr is None: return point return tr.inverted()[0].map(point) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/GLViewWidget.py000066400000000000000000000576631457240071200240340ustar00rootroot00000000000000from OpenGL.GL import * # noqa import OpenGL.GL.framebufferobjects as glfbo # noqa from math import cos, radians, sin, tan import numpy as np from .. import Vector from .. import functions as fn from .. import getConfigOption from ..Qt import QtCore, QtGui, QtWidgets class GLViewMixin: def __init__(self, *args, rotationMethod='euler', **kwargs): """ Mixin class providing functionality for GLViewWidget ================ ============================================================== **Arguments:** rotationMethod (str): Mechanism to drive the rotation method, options are 'euler' and 'quaternion'. Defaults to 'euler'. ================ ============================================================== """ super().__init__(*args, **kwargs) if rotationMethod not in ["euler", "quaternion"]: raise ValueError("Rotation method should be either 'euler' or 'quaternion'") self.opts = { 'center': Vector(0,0,0), ## will always appear at the center of the widget 'rotation' : QtGui.QQuaternion(1,0,0,0), ## camera rotation (quaternion:wxyz) 'distance': 10.0, ## distance of camera from center 'fov': 60, ## horizontal field of view in degrees 'elevation': 30, ## camera's angle of elevation in degrees 'azimuth': 45, ## camera's azimuthal angle in degrees ## (rotation around z-axis 0 points along x-axis) 'viewport': None, ## glViewport params; None == whole widget ## note that 'viewport' is in device pixels 'rotationMethod': rotationMethod } self.reset() self.items = [] self.noRepeatKeys = [QtCore.Qt.Key.Key_Right, QtCore.Qt.Key.Key_Left, QtCore.Qt.Key.Key_Up, QtCore.Qt.Key.Key_Down, QtCore.Qt.Key.Key_PageUp, QtCore.Qt.Key.Key_PageDown] self.keysPressed = {} self.keyTimer = QtCore.QTimer() self.keyTimer.timeout.connect(self.evalKeyState) def deviceWidth(self): dpr = self.devicePixelRatioF() return int(self.width() * dpr) def deviceHeight(self): dpr = self.devicePixelRatioF() return int(self.height() * dpr) def reset(self): """ Initialize the widget state or reset the current state to the original state. """ self.opts['center'] = Vector(0,0,0) ## will always appear at the center of the widget self.opts['distance'] = 10.0 ## distance of camera from center self.opts['fov'] = 60 ## horizontal field of view in degrees self.opts['elevation'] = 30 ## camera's angle of elevation in degrees self.opts['azimuth'] = 45 ## camera's azimuthal angle in degrees ## (rotation around z-axis 0 points along x-axis) self.opts['viewport'] = None ## glViewport params; None == whole widget self.setBackgroundColor(getConfigOption('background')) def addItem(self, item): self.items.append(item) if self.isValid(): item.initialize() item._setView(self) self.update() def removeItem(self, item): """ Remove the item from the scene. """ self.items.remove(item) item._setView(None) self.update() def clear(self): """ Remove all items from the scene. """ for item in self.items: item._setView(None) self.items = [] self.update() def initializeGL(self): """ Initialize items that were not initialized during addItem(). """ ctx = self.context() fmt = ctx.format() if ctx.isOpenGLES() or fmt.version() < (2, 0): verString = glGetString(GL_VERSION) raise RuntimeError( "pyqtgraph.opengl: Requires >= OpenGL 2.0 (not ES); Found %s" % verString ) for item in self.items: if not item.isInitialized(): item.initialize() def setBackgroundColor(self, *args, **kwds): """ Set the background color of the widget. Accepts the same arguments as :func:`~pyqtgraph.mkColor`. """ self.opts['bgcolor'] = fn.mkColor(*args, **kwds).getRgbF() self.update() def getViewport(self): vp = self.opts['viewport'] if vp is None: return (0, 0, self.deviceWidth(), self.deviceHeight()) else: return vp def setProjection(self, region=None): m = self.projectionMatrix(region) glMatrixMode(GL_PROJECTION) glLoadMatrixf(np.array(m.data(), dtype=np.float32)) def projectionMatrix(self, region=None): if region is None: region = (0, 0, self.deviceWidth(), self.deviceHeight()) x0, y0, w, h = self.getViewport() dist = self.opts['distance'] fov = self.opts['fov'] nearClip = dist * 0.001 farClip = dist * 1000. r = nearClip * tan(0.5 * radians(fov)) t = r * h / w ## Note that X0 and width in these equations must be the values used in viewport left = r * ((region[0]-x0) * (2.0/w) - 1) right = r * ((region[0]+region[2]-x0) * (2.0/w) - 1) bottom = t * ((region[1]-y0) * (2.0/h) - 1) top = t * ((region[1]+region[3]-y0) * (2.0/h) - 1) tr = QtGui.QMatrix4x4() tr.frustum(left, right, bottom, top, nearClip, farClip) return tr def setModelview(self): m = self.viewMatrix() glMatrixMode(GL_MODELVIEW) glLoadMatrixf(np.array(m.data(), dtype=np.float32)) def viewMatrix(self): tr = QtGui.QMatrix4x4() tr.translate( 0.0, 0.0, -self.opts['distance']) if self.opts['rotationMethod'] == 'quaternion': tr.rotate(self.opts['rotation']) else: # default rotation method tr.rotate(self.opts['elevation']-90, 1, 0, 0) tr.rotate(self.opts['azimuth']+90, 0, 0, -1) center = self.opts['center'] tr.translate(-center.x(), -center.y(), -center.z()) return tr def itemsAt(self, region=None): """ Return a list of the items displayed in the region (x, y, w, h) relative to the widget. """ region = (region[0], self.deviceHeight()-(region[1]+region[3]), region[2], region[3]) #buf = np.zeros(100000, dtype=np.uint) buf = glSelectBuffer(100000) try: glRenderMode(GL_SELECT) glInitNames() glPushName(0) self._itemNames = {} self.paintGL(region=region, useItemNames=True) finally: hits = glRenderMode(GL_RENDER) items = [(h.near, h.names[0]) for h in hits] items.sort(key=lambda i: i[0]) return [self._itemNames[i[1]] for i in items] def paintGL(self, region=None, viewport=None, useItemNames=False): """ viewport specifies the arguments to glViewport. If None, then we use self.opts['viewport'] region specifies the sub-region of self.opts['viewport'] that should be rendered. Note that we may use viewport != self.opts['viewport'] when exporting. """ if viewport is None: glViewport(*self.getViewport()) else: glViewport(*viewport) self.setProjection(region=region) self.setModelview() bgcolor = self.opts['bgcolor'] glClearColor(*bgcolor) glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT ) self.drawItemTree(useItemNames=useItemNames) def drawItemTree(self, item=None, useItemNames=False): if item is None: items = [x for x in self.items if x.parentItem() is None] else: items = item.childItems() items.append(item) items.sort(key=lambda a: a.depthValue()) for i in items: if not i.visible(): continue if i is item: try: glPushAttrib(GL_ALL_ATTRIB_BITS) if useItemNames: glLoadName(i._id) self._itemNames[i._id] = i i.paint() except: from .. import debug debug.printExc() print("Error while drawing item %s." % str(item)) finally: glPopAttrib() else: glMatrixMode(GL_MODELVIEW) glPushMatrix() try: tr = i.transform() glMultMatrixf(np.array(tr.data(), dtype=np.float32)) self.drawItemTree(i, useItemNames=useItemNames) finally: glMatrixMode(GL_MODELVIEW) glPopMatrix() def setCameraPosition(self, pos=None, distance=None, elevation=None, azimuth=None, rotation=None): if rotation is not None: # Alternatively, we could define that rotation overrides elevation and azimuth if elevation is not None: raise ValueError("cannot set both rotation and elevation") if azimuth is not None: raise ValueError("cannot set both rotation and azimuth") if pos is not None: self.opts['center'] = pos if distance is not None: self.opts['distance'] = distance if self.opts['rotationMethod'] == "quaternion": # note that "quaternion" mode modifies only opts['rotation'] if elevation is not None or azimuth is not None: eu = self.opts['rotation'].toEulerAngles() if azimuth is not None: eu.setZ(-azimuth-90) if elevation is not None: eu.setX(elevation-90) self.opts['rotation'] = QtGui.QQuaternion.fromEulerAngles(eu) if rotation is not None: self.opts['rotation'] = rotation else: # note that "euler" mode modifies only opts['elevation'] and opts['azimuth'] if elevation is not None: self.opts['elevation'] = elevation if azimuth is not None: self.opts['azimuth'] = azimuth if rotation is not None: eu = rotation.toEulerAngles() self.opts['elevation'] = eu.x() + 90 self.opts['azimuth'] = -eu.z() - 90 self.update() def cameraPosition(self): """Return current position of camera based on center, dist, elevation, and azimuth""" center = self.opts['center'] dist = self.opts['distance'] if self.opts['rotationMethod'] == "quaternion": pos = Vector(center - self.opts['rotation'].rotatedVector(Vector(0,0,dist) )) else: # using 'euler' rotation method elev = radians(self.opts['elevation']) azim = radians(self.opts['azimuth']) pos = Vector( center.x() + dist * cos(elev) * cos(azim), center.y() + dist * cos(elev) * sin(azim), center.z() + dist * sin(elev) ) return pos def setCameraParams(self, **kwds): valid_keys = {'center', 'rotation', 'distance', 'fov', 'elevation', 'azimuth'} if not valid_keys.issuperset(kwds): raise ValueError(f'valid keywords are {valid_keys}') self.setCameraPosition(pos=kwds.get('center'), distance=kwds.get('distance'), elevation=kwds.get('elevation'), azimuth=kwds.get('azimuth'), rotation=kwds.get('rotation')) if 'fov' in kwds: self.opts['fov'] = kwds['fov'] def cameraParams(self): valid_keys = {'center', 'rotation', 'distance', 'fov', 'elevation', 'azimuth'} return { k : self.opts[k] for k in valid_keys } def orbit(self, azim, elev): """Orbits the camera around the center position. *azim* and *elev* are given in degrees.""" if self.opts['rotationMethod'] == 'quaternion': q = QtGui.QQuaternion.fromEulerAngles( elev, -azim, 0 ) # rx-ry-rz q *= self.opts['rotation'] self.opts['rotation'] = q else: # default euler rotation method self.opts['azimuth'] += azim self.opts['elevation'] = fn.clip_scalar(self.opts['elevation'] + elev, -90., 90.) self.update() def pan(self, dx, dy, dz, relative='global'): """ Moves the center (look-at) position while holding the camera in place. ============== ======================================================= **Arguments:** *dx* Distance to pan in x direction *dy* Distance to pan in y direction *dz* Distance to pan in z direction *relative* String that determines the direction of dx,dy,dz. If "global", then the global coordinate system is used. If "view", then the z axis is aligned with the view direction, and x and y axes are in the plane of the view: +x points right, +y points up. If "view-upright", then x is in the global xy plane and points to the right side of the view, y is in the global xy plane and orthogonal to x, and z points in the global z direction. ============== ======================================================= Distances are scaled roughly such that a value of 1.0 moves by one pixel on screen. """ if relative == 'global': self.opts['center'] += QtGui.QVector3D(dx, dy, dz) elif relative == 'view-upright': cPos = self.cameraPosition() cVec = self.opts['center'] - cPos dist = cVec.length() ## distance from camera to center xDist = dist * 2. * tan(0.5 * radians(self.opts['fov'])) ## approx. width of view at distance of center point xScale = xDist / self.width() zVec = QtGui.QVector3D(0,0,1) xVec = QtGui.QVector3D.crossProduct(zVec, cVec).normalized() yVec = QtGui.QVector3D.crossProduct(xVec, zVec).normalized() self.opts['center'] = self.opts['center'] + xVec * xScale * dx + yVec * xScale * dy + zVec * xScale * dz elif relative == 'view': # pan in plane of camera if self.opts['rotationMethod'] == 'quaternion': # obtain basis vectors qc = self.opts['rotation'].conjugated() xv = qc.rotatedVector( Vector(1,0,0) ) yv = qc.rotatedVector( Vector(0,1,0) ) zv = qc.rotatedVector( Vector(0,0,1) ) scale_factor = self.pixelSize( self.opts['center'] ) # apply translation self.opts['center'] += scale_factor * (xv*-dx + yv*dy + zv*dz) else: # use default euler rotation method elev = radians(self.opts['elevation']) azim = radians(self.opts['azimuth']) fov = radians(self.opts['fov']) dist = (self.opts['center'] - self.cameraPosition()).length() fov_factor = tan(fov / 2) * 2 scale_factor = dist * fov_factor / self.width() z = scale_factor * cos(elev) * dy x = scale_factor * (sin(azim) * dx - sin(elev) * cos(azim) * dy) y = scale_factor * (cos(azim) * dx + sin(elev) * sin(azim) * dy) self.opts['center'] += QtGui.QVector3D(x, -y, z) else: raise ValueError("relative argument must be global, view, or view-upright") self.update() def pixelSize(self, pos): """ Return the approximate size of a screen pixel at the location pos Pos may be a Vector or an (N,3) array of locations """ cam = self.cameraPosition() if isinstance(pos, np.ndarray): cam = np.array(cam).reshape((1,)*(pos.ndim-1)+(3,)) dist = ((pos-cam)**2).sum(axis=-1)**0.5 else: dist = (pos-cam).length() xDist = dist * 2. * tan(0.5 * radians(self.opts['fov'])) return xDist / self.width() def mousePressEvent(self, ev): lpos = ev.position() if hasattr(ev, 'position') else ev.localPos() self.mousePos = lpos def mouseMoveEvent(self, ev): lpos = ev.position() if hasattr(ev, 'position') else ev.localPos() if not hasattr(self, 'mousePos'): self.mousePos = lpos diff = lpos - self.mousePos self.mousePos = lpos if ev.buttons() == QtCore.Qt.MouseButton.LeftButton: if (ev.modifiers() & QtCore.Qt.KeyboardModifier.ControlModifier): self.pan(diff.x(), diff.y(), 0, relative='view') else: self.orbit(-diff.x(), diff.y()) elif ev.buttons() == QtCore.Qt.MouseButton.MiddleButton: if (ev.modifiers() & QtCore.Qt.KeyboardModifier.ControlModifier): self.pan(diff.x(), 0, diff.y(), relative='view-upright') else: self.pan(diff.x(), diff.y(), 0, relative='view-upright') def mouseReleaseEvent(self, ev): pass # Example item selection code: #region = (ev.pos().x()-5, ev.pos().y()-5, 10, 10) #print(self.itemsAt(region)) ## debugging code: draw the picking region #glViewport(*self.getViewport()) #glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT ) #region = (region[0], self.height()-(region[1]+region[3]), region[2], region[3]) #self.paintGL(region=region) #self.swapBuffers() def wheelEvent(self, ev): delta = ev.angleDelta().x() if delta == 0: delta = ev.angleDelta().y() if (ev.modifiers() & QtCore.Qt.KeyboardModifier.ControlModifier): self.opts['fov'] *= 0.999**delta else: self.opts['distance'] *= 0.999**delta self.update() def keyPressEvent(self, ev): if ev.key() in self.noRepeatKeys: ev.accept() if ev.isAutoRepeat(): return self.keysPressed[ev.key()] = 1 self.evalKeyState() def keyReleaseEvent(self, ev): if ev.key() in self.noRepeatKeys: ev.accept() if ev.isAutoRepeat(): return try: del self.keysPressed[ev.key()] except KeyError: self.keysPressed = {} self.evalKeyState() def evalKeyState(self): speed = 2.0 if len(self.keysPressed) > 0: for key in self.keysPressed: if key == QtCore.Qt.Key.Key_Right: self.orbit(azim=-speed, elev=0) elif key == QtCore.Qt.Key.Key_Left: self.orbit(azim=speed, elev=0) elif key == QtCore.Qt.Key.Key_Up: self.orbit(azim=0, elev=-speed) elif key == QtCore.Qt.Key.Key_Down: self.orbit(azim=0, elev=speed) elif key == QtCore.Qt.Key.Key_PageUp: pass elif key == QtCore.Qt.Key.Key_PageDown: pass self.keyTimer.start(16) else: self.keyTimer.stop() def readQImage(self): """ Read the current buffer pixels out as a QImage. """ return self.grabFramebuffer() def renderToArray(self, size, format=GL_BGRA, type=GL_UNSIGNED_BYTE, textureSize=1024, padding=256): w,h = map(int, size) self.makeCurrent() tex = None fb = None depth_buf = None try: output = np.empty((h, w, 4), dtype=np.ubyte) fb = glfbo.glGenFramebuffers(1) glfbo.glBindFramebuffer(glfbo.GL_FRAMEBUFFER, fb ) glEnable(GL_TEXTURE_2D) tex = glGenTextures(1) glBindTexture(GL_TEXTURE_2D, tex) texwidth = textureSize data = np.zeros((texwidth,texwidth,4), dtype=np.ubyte) ## Test texture dimensions first glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, texwidth, texwidth, 0, GL_RGBA, GL_UNSIGNED_BYTE, None) if glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH) == 0: raise RuntimeError("OpenGL failed to create 2D texture (%dx%d); too large for this hardware." % data.shape[:2]) ## create texture glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texwidth, texwidth, 0, GL_RGBA, GL_UNSIGNED_BYTE, data) # Create depth buffer depth_buf = glGenRenderbuffers(1) glBindRenderbuffer(GL_RENDERBUFFER, depth_buf) glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, texwidth, texwidth) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth_buf) self.opts['viewport'] = (0, 0, w, h) # viewport is the complete image; this ensures that paintGL(region=...) # is interpreted correctly. p2 = 2 * padding for x in range(-padding, w-padding, texwidth-p2): for y in range(-padding, h-padding, texwidth-p2): x2 = min(x+texwidth, w+padding) y2 = min(y+texwidth, h+padding) w2 = x2-x h2 = y2-y ## render to texture glfbo.glFramebufferTexture2D(glfbo.GL_FRAMEBUFFER, glfbo.GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0) self.paintGL(region=(x, h-y-h2, w2, h2), viewport=(0, 0, w2, h2)) # only render sub-region glBindTexture(GL_TEXTURE_2D, tex) # fixes issue #366 ## read texture back to array data = glGetTexImage(GL_TEXTURE_2D, 0, format, type) data = np.frombuffer(data, dtype=np.ubyte).reshape(texwidth,texwidth,4)[::-1, ...] output[y+padding:y2-padding, x+padding:x2-padding] = data[-(h2-padding):-padding, padding:w2-padding] finally: self.opts['viewport'] = None glfbo.glBindFramebuffer(glfbo.GL_FRAMEBUFFER, 0) glBindTexture(GL_TEXTURE_2D, 0) if tex is not None: glDeleteTextures([tex]) if fb is not None: glfbo.glDeleteFramebuffers([fb]) if depth_buf is not None: glDeleteRenderbuffers(1, [depth_buf]) return output class GLViewWidget(GLViewMixin, QtWidgets.QOpenGLWidget): def __init__(self, *args, devicePixelRatio=None, **kwargs): """ Basic widget for displaying 3D data - Rotation/scale controls - Axis/grid display - Export options ================ ============================================================== **Arguments:** parent (QObject, optional): Parent QObject. Defaults to None. devicePixelRatio No longer in use. High-DPI displays should automatically detect the correct resolution. rotationMethod (str): Mechanism to drive the rotation method, options are 'euler' and 'quaternion'. Defaults to 'euler'. ================ ============================================================== """ super().__init__(*args, **kwargs) self.setFocusPolicy(QtCore.Qt.FocusPolicy.ClickFocus) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/MeshData.py000066400000000000000000000535731457240071200232150ustar00rootroot00000000000000import numpy as np from ..Qt import QtGui class MeshData(object): """ Class for storing and operating on 3D mesh data. May contain: - list of vertex locations - list of edges - list of triangles - colors per vertex, edge, or tri - normals per vertex or tri This class handles conversion between the standard [list of vertexes, list of faces] format (suitable for use with glDrawElements) and 'indexed' [list of vertexes] format (suitable for use with glDrawArrays). It will automatically compute face normal vectors as well as averaged vertex normal vectors. The class attempts to be as efficient as possible in caching conversion results and avoiding unnecessary conversions. """ def __init__(self, vertexes=None, faces=None, edges=None, vertexColors=None, faceColors=None): """ ============== ===================================================== **Arguments:** vertexes (Nv, 3) array of vertex coordinates. If faces is not specified, then this will instead be interpreted as (Nf, 3, 3) array of coordinates. faces (Nf, 3) array of indexes into the vertex array. edges [not available yet] vertexColors (Nv, 4) array of vertex colors. If faces is not specified, then this will instead be interpreted as (Nf, 3, 4) array of colors. faceColors (Nf, 4) array of face colors. ============== ===================================================== All arguments are optional. """ self._vertexes = None # (Nv,3) array of vertex coordinates self._vertexesIndexedByFaces = None # (Nf, 3, 3) array of vertex coordinates self._vertexesIndexedByEdges = None # (Ne, 2, 3) array of vertex coordinates ## mappings between vertexes, faces, and edges self._faces = None # Nx3 array of indexes into self._vertexes specifying three vertexes for each face self._edges = None # Nx2 array of indexes into self._vertexes specifying two vertexes per edge self._vertexFaces = None ## maps vertex ID to a list of face IDs (inverse mapping of _faces) self._vertexEdges = None ## maps vertex ID to a list of edge IDs (inverse mapping of _edges) ## Per-vertex data self._vertexNormals = None # (Nv, 3) array of normals, one per vertex self._vertexNormalsIndexedByFaces = None # (Nf, 3, 3) array of normals self._vertexColors = None # (Nv, 3) array of colors self._vertexColorsIndexedByFaces = None # (Nf, 3, 4) array of colors self._vertexColorsIndexedByEdges = None # (Nf, 2, 4) array of colors ## Per-face data self._faceNormals = None # (Nf, 3) array of face normals self._faceNormalsIndexedByFaces = None # (Nf, 3, 3) array of face normals self._faceColors = None # (Nf, 4) array of face colors self._faceColorsIndexedByFaces = None # (Nf, 3, 4) array of face colors self._faceColorsIndexedByEdges = None # (Ne, 2, 4) array of face colors ## Per-edge data self._edgeColors = None # (Ne, 4) array of edge colors self._edgeColorsIndexedByEdges = None # (Ne, 2, 4) array of edge colors #self._meshColor = (1, 1, 1, 0.1) # default color to use if no face/edge/vertex colors are given if vertexes is not None: if faces is None: self.setVertexes(vertexes, indexed='faces') if vertexColors is not None: self.setVertexColors(vertexColors, indexed='faces') if faceColors is not None: self.setFaceColors(faceColors, indexed='faces') else: self.setVertexes(vertexes) self.setFaces(faces) if vertexColors is not None: self.setVertexColors(vertexColors) if faceColors is not None: self.setFaceColors(faceColors) def faces(self): """Return an array (Nf, 3) of vertex indexes, three per triangular face in the mesh. If faces have not been computed for this mesh, the function returns None. """ return self._faces def edges(self): """Return an array (Nf, 3) of vertex indexes, two per edge in the mesh.""" if self._edges is None: self._computeEdges() return self._edges def setFaces(self, faces): """Set the (Nf, 3) array of faces. Each rown in the array contains three indexes into the vertex array, specifying the three corners of a triangular face.""" self._faces = faces self._edges = None self._vertexFaces = None self._vertexesIndexedByFaces = None self.resetNormals() self._vertexColorsIndexedByFaces = None self._faceColorsIndexedByFaces = None def vertexes(self, indexed=None): """Return an array (N,3) of the positions of vertexes in the mesh. By default, each unique vertex appears only once in the array. If indexed is 'faces', then the array will instead contain three vertexes per face in the mesh (and a single vertex may appear more than once in the array).""" if indexed is None: if self._vertexes is None and self._vertexesIndexedByFaces is not None: self._computeUnindexedVertexes() return self._vertexes elif indexed == 'faces': if self._vertexesIndexedByFaces is None and self._vertexes is not None: self._vertexesIndexedByFaces = self._vertexes[self.faces()] return self._vertexesIndexedByFaces else: raise Exception("Invalid indexing mode. Accepts: None, 'faces'") def setVertexes(self, verts=None, indexed=None, resetNormals=True): """ Set the array (Nv, 3) of vertex coordinates. If indexed=='faces', then the data must have shape (Nf, 3, 3) and is assumed to be already indexed as a list of faces. This will cause any pre-existing normal vectors to be cleared unless resetNormals=False. """ if indexed is None: if verts is not None: self._vertexes = np.ascontiguousarray(verts, dtype=np.float32) self._vertexesIndexedByFaces = None elif indexed=='faces': self._vertexes = None if verts is not None: self._vertexesIndexedByFaces = np.ascontiguousarray(verts, dtype=np.float32) else: raise Exception("Invalid indexing mode. Accepts: None, 'faces'") if resetNormals: self.resetNormals() def resetNormals(self): self._vertexNormals = None self._vertexNormalsIndexedByFaces = None self._faceNormals = None self._faceNormalsIndexedByFaces = None def hasFaceIndexedData(self): """Return True if this object already has vertex positions indexed by face""" return self._vertexesIndexedByFaces is not None def hasEdgeIndexedData(self): return self._vertexesIndexedByEdges is not None def hasVertexColor(self): """Return True if this data set has vertex color information""" for v in (self._vertexColors, self._vertexColorsIndexedByFaces, self._vertexColorsIndexedByEdges): if v is not None: return True return False def hasFaceColor(self): """Return True if this data set has face color information""" for v in (self._faceColors, self._faceColorsIndexedByFaces, self._faceColorsIndexedByEdges): if v is not None: return True return False def faceNormals(self, indexed=None): """ Return an array (Nf, 3) of normal vectors for each face. If indexed='faces', then instead return an indexed array (Nf, 3, 3) (this is just the same array with each vector copied three times). """ if self._faceNormals is None: v = self.vertexes(indexed='faces') self._faceNormals = np.cross(v[:,1]-v[:,0], v[:,2]-v[:,0]) if indexed is None: return self._faceNormals elif indexed == 'faces': if self._faceNormalsIndexedByFaces is None: norms = np.empty((self._faceNormals.shape[0], 3, 3), dtype=np.float32) norms[:] = self._faceNormals[:,np.newaxis,:] self._faceNormalsIndexedByFaces = norms return self._faceNormalsIndexedByFaces else: raise Exception("Invalid indexing mode. Accepts: None, 'faces'") def vertexNormals(self, indexed=None): """ Return an array of normal vectors. By default, the array will be (N, 3) with one entry per unique vertex in the mesh. If indexed is 'faces', then the array will contain three normal vectors per face (and some vertexes may be repeated). """ if self._vertexNormals is None: faceNorms = self.faceNormals() vertFaces = self.vertexFaces() self._vertexNormals = np.empty(self._vertexes.shape, dtype=np.float32) for vindex in range(self._vertexes.shape[0]): faces = vertFaces[vindex] if len(faces) == 0: self._vertexNormals[vindex] = (0,0,0) continue norms = faceNorms[faces] ## get all face normals norm = norms.sum(axis=0) ## sum normals norm /= (norm**2).sum()**0.5 ## and re-normalize self._vertexNormals[vindex] = norm if indexed is None: return self._vertexNormals elif indexed == 'faces': return self._vertexNormals[self.faces()] else: raise Exception("Invalid indexing mode. Accepts: None, 'faces'") def vertexColors(self, indexed=None): """ Return an array (Nv, 4) of vertex colors. If indexed=='faces', then instead return an indexed array (Nf, 3, 4). """ if indexed is None: return self._vertexColors elif indexed == 'faces': if self._vertexColorsIndexedByFaces is None: self._vertexColorsIndexedByFaces = self._vertexColors[self.faces()] return self._vertexColorsIndexedByFaces else: raise Exception("Invalid indexing mode. Accepts: None, 'faces'") def setVertexColors(self, colors, indexed=None): """ Set the vertex color array (Nv, 4). If indexed=='faces', then the array will be interpreted as indexed and should have shape (Nf, 3, 4) """ if indexed is None: self._vertexColors = np.ascontiguousarray(colors, dtype=np.float32) self._vertexColorsIndexedByFaces = None elif indexed == 'faces': self._vertexColors = None self._vertexColorsIndexedByFaces = np.ascontiguousarray(colors, dtype=np.float32) else: raise Exception("Invalid indexing mode. Accepts: None, 'faces'") def faceColors(self, indexed=None): """ Return an array (Nf, 4) of face colors. If indexed=='faces', then instead return an indexed array (Nf, 3, 4) (note this is just the same array with each color repeated three times). """ if indexed is None: return self._faceColors elif indexed == 'faces': if self._faceColorsIndexedByFaces is None and self._faceColors is not None: Nf = self._faceColors.shape[0] self._faceColorsIndexedByFaces = np.empty((Nf, 3, 4), dtype=self._faceColors.dtype) self._faceColorsIndexedByFaces[:] = self._faceColors.reshape(Nf, 1, 4) return self._faceColorsIndexedByFaces else: raise Exception("Invalid indexing mode. Accepts: None, 'faces'") def setFaceColors(self, colors, indexed=None): """ Set the face color array (Nf, 4). If indexed=='faces', then the array will be interpreted as indexed and should have shape (Nf, 3, 4) """ if indexed is None: self._faceColors = np.ascontiguousarray(colors, dtype=np.float32) self._faceColorsIndexedByFaces = None elif indexed == 'faces': self._faceColors = None self._faceColorsIndexedByFaces = np.ascontiguousarray(colors, dtype=np.float32) else: raise Exception("Invalid indexing mode. Accepts: None, 'faces'") def faceCount(self): """ Return the number of faces in the mesh. """ if self._faces is not None: return self._faces.shape[0] elif self._vertexesIndexedByFaces is not None: return self._vertexesIndexedByFaces.shape[0] def edgeColors(self): return self._edgeColors #def _setIndexedFaces(self, faces, vertexColors=None, faceColors=None): #self._vertexesIndexedByFaces = faces #self._vertexColorsIndexedByFaces = vertexColors #self._faceColorsIndexedByFaces = faceColors def _computeUnindexedVertexes(self): ## Given (Nv, 3, 3) array of vertexes-indexed-by-face, convert backward to unindexed vertexes ## This is done by collapsing into a list of 'unique' vertexes (difference < 1e-14) ## I think generally this should be discouraged.. faces = self._vertexesIndexedByFaces verts = {} ## used to remember the index of each vertex position self._faces = np.empty(faces.shape[:2], dtype=np.uint) self._vertexes = [] self._vertexFaces = [] self._faceNormals = None self._vertexNormals = None for i in range(faces.shape[0]): face = faces[i] for j in range(face.shape[0]): pt = face[j] pt2 = tuple([round(x*1e14) for x in pt]) ## quantize to be sure that nearly-identical points will be merged index = verts.get(pt2, None) if index is None: #self._vertexes.append(QtGui.QVector3D(*pt)) self._vertexes.append(pt) self._vertexFaces.append([]) index = len(self._vertexes)-1 verts[pt2] = index self._vertexFaces[index].append(i) # keep track of which vertexes belong to which faces self._faces[i,j] = index self._vertexes = np.array(self._vertexes, dtype=np.float32) #def _setUnindexedFaces(self, faces, vertexes, vertexColors=None, faceColors=None): #self._vertexes = vertexes #[QtGui.QVector3D(*v) for v in vertexes] #self._faces = faces.astype(np.uint) #self._edges = None #self._vertexFaces = None #self._faceNormals = None #self._vertexNormals = None #self._vertexColors = vertexColors #self._faceColors = faceColors def vertexFaces(self): """ Return list mapping each vertex index to a list of face indexes that use the vertex. """ if self._vertexFaces is None: self._vertexFaces = [[] for i in range(len(self.vertexes()))] for i in range(self._faces.shape[0]): face = self._faces[i] for ind in face: self._vertexFaces[ind].append(i) return self._vertexFaces #def reverseNormals(self): #""" #Reverses the direction of all normal vectors. #""" #pass #def generateEdgesFromFaces(self): #""" #Generate a set of edges by listing all the edges of faces and removing any duplicates. #Useful for displaying wireframe meshes. #""" #pass def _computeEdges(self): if not self.hasFaceIndexedData(): ## generate self._edges from self._faces nf = len(self._faces) edges = np.empty(nf*3, dtype=[('i', np.uint, 2)]) edges['i'][0:nf] = self._faces[:,:2] edges['i'][nf:2*nf] = self._faces[:,1:3] edges['i'][-nf:,0] = self._faces[:,2] edges['i'][-nf:,1] = self._faces[:,0] # sort per-edge mask = edges['i'][:,0] > edges['i'][:,1] edges['i'][mask] = edges['i'][mask][:,::-1] # remove duplicate entries self._edges = np.unique(edges)['i'] #print self._edges elif self._vertexesIndexedByFaces is not None: verts = self._vertexesIndexedByFaces edges = np.empty((verts.shape[0], 3, 2), dtype=np.uint) nf = verts.shape[0] edges[:,0,0] = np.arange(nf) * 3 edges[:,0,1] = edges[:,0,0] + 1 edges[:,1,0] = edges[:,0,1] edges[:,1,1] = edges[:,1,0] + 1 edges[:,2,0] = edges[:,1,1] edges[:,2,1] = edges[:,0,0] self._edges = edges else: raise Exception("MeshData cannot generate edges--no faces in this data.") def save(self): """Serialize this mesh to a string appropriate for disk storage""" import pickle if self._faces is not None: names = ['_vertexes', '_faces'] else: names = ['_vertexesIndexedByFaces'] if self._vertexColors is not None: names.append('_vertexColors') elif self._vertexColorsIndexedByFaces is not None: names.append('_vertexColorsIndexedByFaces') if self._faceColors is not None: names.append('_faceColors') elif self._faceColorsIndexedByFaces is not None: names.append('_faceColorsIndexedByFaces') state = dict([(n,getattr(self, n)) for n in names]) return pickle.dumps(state) def restore(self, state): """Restore the state of a mesh previously saved using save()""" import pickle state = pickle.loads(state) for k in state: if isinstance(state[k], list): if isinstance(state[k][0], QtGui.QVector3D): state[k] = [[v.x(), v.y(), v.z()] for v in state[k]] state[k] = np.array(state[k]) setattr(self, k, state[k]) @staticmethod def sphere(rows, cols, radius=1.0, offset=True): """ Return a MeshData instance with vertexes and faces computed for a spherical surface. """ verts = np.empty((rows+1, cols, 3), dtype=float) ## compute vertexes phi = (np.arange(rows+1) * np.pi / rows).reshape(rows+1, 1) s = radius * np.sin(phi) verts[...,2] = radius * np.cos(phi) th = ((np.arange(cols) * 2 * np.pi / cols).reshape(1, cols)) if offset: th = th + ((np.pi / cols) * np.arange(rows+1).reshape(rows+1,1)) ## rotate each row by 1/2 column verts[...,0] = s * np.cos(th) verts[...,1] = s * np.sin(th) verts = verts.reshape((rows+1)*cols, 3)[cols-1:-(cols-1)] ## remove redundant vertexes from top and bottom ## compute faces faces = np.empty((rows*cols*2, 3), dtype=np.uint) rowtemplate1 = ((np.arange(cols).reshape(cols, 1) + np.array([[0, 1, 0]])) % cols) + np.array([[0, 0, cols]]) rowtemplate2 = ((np.arange(cols).reshape(cols, 1) + np.array([[0, 1, 1]])) % cols) + np.array([[cols, 0, cols]]) for row in range(rows): start = row * cols * 2 faces[start:start+cols] = rowtemplate1 + row * cols faces[start+cols:start+(cols*2)] = rowtemplate2 + row * cols faces = faces[cols:-cols] ## cut off zero-area triangles at top and bottom ## adjust for redundant vertexes that were removed from top and bottom vmin = cols-1 faces[facesvmax] = vmax return MeshData(vertexes=verts, faces=faces) @staticmethod def cylinder(rows, cols, radius=[1.0, 1.0], length=1.0, offset=False): """ Return a MeshData instance with vertexes and faces computed for a cylindrical surface. The cylinder may be tapered with different radii at each end (truncated cone) """ verts = np.empty((rows+1, cols, 3), dtype=float) if isinstance(radius, int): radius = [radius, radius] # convert to list ## compute vertexes th = np.linspace(2 * np.pi, (2 * np.pi)/cols, cols).reshape(1, cols) r = np.linspace(radius[0],radius[1],num=rows+1, endpoint=True).reshape(rows+1, 1) # radius as a function of z verts[...,2] = np.linspace(0, length, num=rows+1, endpoint=True).reshape(rows+1, 1) # z if offset: th = th + ((np.pi / cols) * np.arange(rows+1).reshape(rows+1,1)) ## rotate each row by 1/2 column verts[...,0] = r * np.cos(th) # x = r cos(th) verts[...,1] = r * np.sin(th) # y = r sin(th) verts = verts.reshape((rows+1)*cols, 3) # just reshape: no redundant vertices... ## compute faces faces = np.empty((rows*cols*2, 3), dtype=np.uint) rowtemplate1 = ((np.arange(cols).reshape(cols, 1) + np.array([[0, 1, 0]])) % cols) + np.array([[0, 0, cols]]) rowtemplate2 = ((np.arange(cols).reshape(cols, 1) + np.array([[0, 1, 1]])) % cols) + np.array([[cols, 0, cols]]) for row in range(rows): start = row * cols * 2 faces[start:start+cols] = rowtemplate1 + row * cols faces[start+cols:start+(cols*2)] = rowtemplate2 + row * cols return MeshData(vertexes=verts, faces=faces) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/__init__.py000066400000000000000000000013421457240071200232510ustar00rootroot00000000000000from . import shaders from .GLViewWidget import GLViewWidget from .items.GLAxisItem import * from .items.GLBarGraphItem import * from .items.GLBoxItem import * from .items.GLGradientLegendItem import * from .items.GLGraphItem import * from .items.GLGridItem import * from .items.GLImageItem import * from .items.GLLinePlotItem import * from .items.GLMeshItem import * from .items.GLScatterPlotItem import * from .items.GLSurfacePlotItem import * from .items.GLTextItem import * from .items.GLVolumeItem import * from .MeshData import MeshData ## dynamic imports cause too many problems. #from .. import importAll #importAll('items', globals(), locals()) ## for backward compatibility: #MeshData.MeshData = MeshData ## breaks autodoc. pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/000077500000000000000000000000001457240071200222615ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLAxisItem.py000066400000000000000000000034611457240071200246050ustar00rootroot00000000000000from OpenGL.GL import * # noqa from ... import QtGui from ..GLGraphicsItem import GLGraphicsItem __all__ = ['GLAxisItem'] class GLAxisItem(GLGraphicsItem): """ **Bases:** :class:`GLGraphicsItem ` Displays three lines indicating origin and orientation of local coordinate system. """ def __init__(self, size=None, antialias=True, glOptions='translucent', parentItem=None): super().__init__(parentItem=parentItem) if size is None: size = QtGui.QVector3D(1,1,1) self.antialias = antialias self.setSize(size=size) self.setGLOptions(glOptions) def setSize(self, x=None, y=None, z=None, size=None): """ Set the size of the axes (in its local coordinate system; this does not affect the transform) Arguments can be x,y,z or size=QVector3D(). """ if size is not None: x = size.x() y = size.y() z = size.z() self.__size = [x,y,z] self.update() def size(self): return self.__size[:] def paint(self): #glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) #glEnable( GL_BLEND ) #glEnable( GL_ALPHA_TEST ) self.setupGLState() if self.antialias: glEnable(GL_LINE_SMOOTH) glHint(GL_LINE_SMOOTH_HINT, GL_NICEST) glBegin( GL_LINES ) x,y,z = self.size() glColor4f(0, 1, 0, .6) # z is green glVertex3f(0, 0, 0) glVertex3f(0, 0, z) glColor4f(1, 1, 0, .6) # y is yellow glVertex3f(0, 0, 0) glVertex3f(0, y, 0) glColor4f(0, 0, 1, .6) # x is blue glVertex3f(0, 0, 0) glVertex3f(x, 0, 0) glEnd() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLBarGraphItem.py000066400000000000000000000020651457240071200253660ustar00rootroot00000000000000__all__ = ["GLBarGraphItem"] import numpy as np from ..MeshData import MeshData from .GLMeshItem import GLMeshItem class GLBarGraphItem(GLMeshItem): def __init__(self, pos, size, parentItem=None): """ pos is (...,3) array of the bar positions (the corner of each bar) size is (...,3) array of the sizes of each bar """ nCubes = np.prod(pos.shape[:-1]) cubeVerts = np.mgrid[0:2,0:2,0:2].reshape(3,8).transpose().reshape(1,8,3) cubeFaces = np.array([ [0,1,2], [3,2,1], [4,5,6], [7,6,5], [0,1,4], [5,4,1], [2,3,6], [7,6,3], [0,2,4], [6,4,2], [1,3,5], [7,5,3]]).reshape(1,12,3) size = size.reshape((nCubes, 1, 3)) pos = pos.reshape((nCubes, 1, 3)) verts = cubeVerts * size + pos faces = cubeFaces + (np.arange(nCubes) * 8).reshape(nCubes,1,1) md = MeshData(verts.reshape(nCubes*8,3), faces.reshape(nCubes*12,3)) super().__init__(meshdata=md, shader='shaded', smooth=False, parentItem=parentItem) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLBoxItem.py000066400000000000000000000046711457240071200244350ustar00rootroot00000000000000from OpenGL.GL import * # noqa from ... import functions as fn from ...Qt import QtGui from ..GLGraphicsItem import GLGraphicsItem __all__ = ['GLBoxItem'] class GLBoxItem(GLGraphicsItem): """ **Bases:** :class:`GLGraphicsItem ` Displays a wire-frame box. """ def __init__(self, size=None, color=None, glOptions='translucent', parentItem=None): super().__init__(parentItem=parentItem) if size is None: size = QtGui.QVector3D(1,1,1) self.setSize(size=size) if color is None: color = (255,255,255,80) self.setColor(color) self.setGLOptions(glOptions) def setSize(self, x=None, y=None, z=None, size=None): """ Set the size of the box (in its local coordinate system; this does not affect the transform) Arguments can be x,y,z or size=QVector3D(). """ if size is not None: x = size.x() y = size.y() z = size.z() self.__size = [x,y,z] self.update() def size(self): return self.__size[:] def setColor(self, *args): """Set the color of the box. Arguments are the same as those accepted by functions.mkColor()""" self.__color = fn.mkColor(*args) def color(self): return self.__color def paint(self): #glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) #glEnable( GL_BLEND ) #glEnable( GL_ALPHA_TEST ) ##glAlphaFunc( GL_ALWAYS,0.5 ) #glEnable( GL_POINT_SMOOTH ) #glDisable( GL_DEPTH_TEST ) self.setupGLState() glBegin( GL_LINES ) glColor4f(*self.color().getRgbF()) x,y,z = self.size() glVertex3f(0, 0, 0) glVertex3f(0, 0, z) glVertex3f(x, 0, 0) glVertex3f(x, 0, z) glVertex3f(0, y, 0) glVertex3f(0, y, z) glVertex3f(x, y, 0) glVertex3f(x, y, z) glVertex3f(0, 0, 0) glVertex3f(0, y, 0) glVertex3f(x, 0, 0) glVertex3f(x, y, 0) glVertex3f(0, 0, z) glVertex3f(0, y, z) glVertex3f(x, 0, z) glVertex3f(x, y, z) glVertex3f(0, 0, 0) glVertex3f(x, 0, 0) glVertex3f(0, y, 0) glVertex3f(x, y, 0) glVertex3f(0, 0, z) glVertex3f(x, 0, z) glVertex3f(0, y, z) glVertex3f(x, y, z) glEnd() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLGradientLegendItem.py000066400000000000000000000056601457240071200265600ustar00rootroot00000000000000from ... import functions as fn from ...colormap import ColorMap from ...Qt import QtCore, QtGui from ..GLGraphicsItem import GLGraphicsItem __all__ = ['GLGradientLegendItem'] class GLGradientLegendItem(GLGraphicsItem): """ Displays legend colorbar on the screen. """ def __init__(self, parentItem=None, **kwds): """ Arguments: pos: position of the colorbar on the screen, from the top left corner, in pixels size: size of the colorbar without the text, in pixels gradient: a pg.ColorMap used to color the colorbar labels: a dict of "text":value to display next to the colorbar. The value corresponds to a position in the gradient from 0 to 1. fontColor: sets the color of the texts. Accepts any single argument accepted by :func:`~pyqtgraph.mkColor` #Todo: size as percentage legend title """ super().__init__(parentItem=parentItem) glopts = kwds.pop("glOptions", "additive") self.setGLOptions(glopts) self.pos = (10, 10) self.size = (10, 100) self.fontColor = QtGui.QColor(QtCore.Qt.GlobalColor.white) # setup a default trivial gradient stops = (0.0, 1.0) self.gradient = ColorMap(pos=stops, color=(0.0, 1.0)) self._gradient = None self.labels = {str(x) : x for x in stops} self.setData(**kwds) def setData(self, **kwds): args = ["size", "pos", "gradient", "labels", "fontColor"] for k in kwds.keys(): if k not in args: raise Exception( "Invalid keyword argument: %s (allowed arguments are %s)" % (k, str(args)) ) self.antialias = False for key in kwds: value = kwds[key] if key == 'fontColor': value = fn.mkColor(value) elif key == 'gradient': self._gradient = None setattr(self, key, value) ##todo: add title ##todo: take more gradient types self.update() def paint(self): self.setupGLState() if self._gradient is None: self._gradient = self.gradient.getGradient() barRect = QtCore.QRectF(self.pos[0], self.pos[1], self.size[0], self.size[1]) self._gradient.setStart(barRect.bottomLeft()) self._gradient.setFinalStop(barRect.topLeft()) painter = QtGui.QPainter(self.view()) painter.fillRect(barRect, self._gradient) painter.setPen(self.fontColor) for labelText, labelPosition in self.labels.items(): ## todo: draw ticks, position text properly x = 1.1 * self.size[0] + self.pos[0] y = self.size[1] - labelPosition * self.size[1] + self.pos[1] + 8 ##todo: fonts painter.drawText(QtCore.QPointF(x, y), labelText) painter.end() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLGraphItem.py000066400000000000000000000075331457240071200247460ustar00rootroot00000000000000from OpenGL.GL import * # noqa import numpy as np from ... import functions as fn from ...Qt import QtCore, QtGui from ..GLGraphicsItem import GLGraphicsItem from .GLScatterPlotItem import GLScatterPlotItem __all__ = ['GLGraphItem'] class GLGraphItem(GLGraphicsItem): """A GLGraphItem displays graph information as a set of nodes connected by lines (as in 'graph theory', not 'graphics'). Useful for drawing networks, trees, etc. """ def __init__(self, parentItem=None, **kwds): super().__init__(parentItem=parentItem) self.edges = None self.edgeColor = QtGui.QColor(QtCore.Qt.GlobalColor.white) self.edgeWidth = 1.0 self.scatter = GLScatterPlotItem() self.scatter.setParentItem(self) self.setData(**kwds) def setData(self, **kwds): """ Change the data displayed by the graph. Parameters ---------- edges : np.ndarray 2D array of shape (M, 2) of connection data, each row contains indexes of two nodes that are connected. Dtype must be integer or unsigned. edgeColor: color_like, optional The color to draw edges. Accepts the same arguments as :func:`~pyqtgraph.mkColor()`. If None, no edges will be drawn. Default is (1.0, 1.0, 1.0, 0.5). edgeWidth: float, optional Value specifying edge width. Default is 1.0 nodePositions : np.ndarray 2D array of shape (N, 3), where each row represents the x, y, z coordinates for each node nodeColor : np.ndarray or float or color_like, optional 2D array of shape (N, 4) of dtype float32, where each row represents the R, G, B, A values in range of 0-1, or for the same color for all nodes, provide either QColor type or input for :func:`~pyqtgraph.mkColor()` nodeSize : np.ndarray or float or int Either 2D numpy array of shape (N, 1) where each row represents the size of each node, or if a scalar, apply the same size to all nodes **kwds All other keyword arguments are given to :meth:`GLScatterPlotItem.setData() ` to affect the appearance of nodes (pos, color, size, pxMode, etc.) Raises ------ TypeError When dtype of edges dtype is not unisnged or integer dtype """ if 'edges' in kwds: self.edges = kwds.pop('edges') if self.edges.dtype.kind not in 'iu': raise TypeError("edges array must have int or unsigned dtype.") if 'edgeColor' in kwds: edgeColor = kwds.pop('edgeColor') self.edgeColor = fn.mkColor(edgeColor) if edgeColor is not None else None if 'edgeWidth' in kwds: self.edgeWidth = kwds.pop('edgeWidth') if 'nodePositions' in kwds: kwds['pos'] = kwds.pop('nodePositions') if 'nodeColor' in kwds: kwds['color'] = kwds.pop('nodeColor') if 'nodeSize' in kwds: kwds['size'] = kwds.pop('nodeSize') self.scatter.setData(**kwds) self.update() def initializeGL(self): self.scatter.initializeGL() def paint(self): if self.scatter.pos is None \ or self.edges is None \ or self.edgeColor is None: return None verts = self.scatter.pos edges = self.edges.astype(np.uint32).flatten() glEnableClientState(GL_VERTEX_ARRAY) try: glColor4f(*self.edgeColor.getRgbF()) glLineWidth(self.edgeWidth) glVertexPointerf(verts) glDrawElements(GL_LINES, edges.shape[0], GL_UNSIGNED_INT, edges) finally: glDisableClientState(GL_VERTEX_ARRAY) return None pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLGridItem.py000066400000000000000000000051511457240071200245640ustar00rootroot00000000000000from OpenGL.GL import * # noqa import numpy as np from ... import QtGui from ... import functions as fn from ..GLGraphicsItem import GLGraphicsItem __all__ = ['GLGridItem'] class GLGridItem(GLGraphicsItem): """ **Bases:** :class:`GLGraphicsItem ` Displays a wire-frame grid. """ def __init__(self, size=None, color=(255, 255, 255, 76.5), antialias=True, glOptions='translucent', parentItem=None): super().__init__(parentItem=parentItem) self.setGLOptions(glOptions) self.antialias = antialias if size is None: size = QtGui.QVector3D(20,20,1) self.setSize(size=size) self.setSpacing(1, 1, 1) self.setColor(color) def setSize(self, x=None, y=None, z=None, size=None): """ Set the size of the axes (in its local coordinate system; this does not affect the transform) Arguments can be x,y,z or size=QVector3D(). """ if size is not None: x = size.x() y = size.y() z = size.z() self.__size = [x,y,z] self.update() def size(self): return self.__size[:] def setSpacing(self, x=None, y=None, z=None, spacing=None): """ Set the spacing between grid lines. Arguments can be x,y,z or spacing=QVector3D(). """ if spacing is not None: x = spacing.x() y = spacing.y() z = spacing.z() self.__spacing = [x,y,z] self.update() def spacing(self): return self.__spacing[:] def setColor(self, color): """Set the color of the grid. Arguments are the same as those accepted by functions.mkColor()""" self.__color = fn.mkColor(color) self.update() def color(self): return self.__color def paint(self): self.setupGLState() if self.antialias: glEnable(GL_LINE_SMOOTH) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glHint(GL_LINE_SMOOTH_HINT, GL_NICEST) glBegin( GL_LINES ) x,y,z = self.size() xs,ys,zs = self.spacing() xvals = np.arange(-x/2., x/2. + xs*0.001, xs) yvals = np.arange(-y/2., y/2. + ys*0.001, ys) glColor4f(*self.color().getRgbF()) for x in xvals: glVertex3f(x, yvals[0], 0) glVertex3f(x, yvals[-1], 0) for y in yvals: glVertex3f(xvals[0], y, 0) glVertex3f(xvals[-1], y, 0) glEnd() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLImageItem.py000066400000000000000000000074151457240071200247260ustar00rootroot00000000000000from OpenGL.GL import * # noqa import numpy as np from ..GLGraphicsItem import GLGraphicsItem __all__ = ['GLImageItem'] class GLImageItem(GLGraphicsItem): """ **Bases:** :class:`GLGraphicsItem ` Displays image data as a textured quad. """ def __init__(self, data, smooth=False, glOptions='translucent', parentItem=None): """ ============== ======================================================================================= **Arguments:** data Volume data to be rendered. *Must* be 3D numpy array (x, y, RGBA) with dtype=ubyte. (See functions.makeRGBA) smooth (bool) If True, the volume slices are rendered with linear interpolation ============== ======================================================================================= """ self.smooth = smooth self._needUpdate = False super().__init__(parentItem=parentItem) self.setData(data) self.setGLOptions(glOptions) self.texture = None def initializeGL(self): if self.texture is not None: return glEnable(GL_TEXTURE_2D) self.texture = glGenTextures(1) def setData(self, data): self.data = data self._needUpdate = True self.update() def _updateTexture(self): glBindTexture(GL_TEXTURE_2D, self.texture) if self.smooth: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) else: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER) #glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER) shape = self.data.shape ## Test texture dimensions first glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, shape[0], shape[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, None) if glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH) == 0: raise Exception("OpenGL failed to create 2D texture (%dx%d); too large for this hardware." % shape[:2]) data = np.ascontiguousarray(self.data.transpose((1,0,2))) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, shape[0], shape[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, data) glDisable(GL_TEXTURE_2D) #self.lists = {} #for ax in [0,1,2]: #for d in [-1, 1]: #l = glGenLists(1) #self.lists[(ax,d)] = l #glNewList(l, GL_COMPILE) #self.drawVolume(ax, d) #glEndList() def paint(self): if self._needUpdate: self._updateTexture() self._needUpdate = False glEnable(GL_TEXTURE_2D) glBindTexture(GL_TEXTURE_2D, self.texture) self.setupGLState() #glEnable(GL_DEPTH_TEST) ##glDisable(GL_CULL_FACE) #glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) #glEnable( GL_BLEND ) #glEnable( GL_ALPHA_TEST ) glColor4f(1,1,1,1) glBegin(GL_QUADS) glTexCoord2f(0,0) glVertex3f(0,0,0) glTexCoord2f(1,0) glVertex3f(self.data.shape[0], 0, 0) glTexCoord2f(1,1) glVertex3f(self.data.shape[0], self.data.shape[1], 0) glTexCoord2f(0,1) glVertex3f(0, self.data.shape[1], 0) glEnd() glDisable(GL_TEXTURE_2D) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLLinePlotItem.py000066400000000000000000000075301457240071200254300ustar00rootroot00000000000000from OpenGL.GL import * # noqa import numpy as np from ... import QtGui from ... import functions as fn from ..GLGraphicsItem import GLGraphicsItem __all__ = ['GLLinePlotItem'] class GLLinePlotItem(GLGraphicsItem): """Draws line plots in 3D.""" def __init__(self, parentItem=None, **kwds): """All keyword arguments are passed to setData()""" super().__init__(parentItem=parentItem) glopts = kwds.pop('glOptions', 'additive') self.setGLOptions(glopts) self.pos = None self.mode = 'line_strip' self.width = 1. self.color = (1.0,1.0,1.0,1.0) self.setData(**kwds) def setData(self, **kwds): """ Update the data displayed by this item. All arguments are optional; for example it is allowed to update vertex positions while leaving colors unchanged, etc. ==================== ================================================== **Arguments:** ------------------------------------------------------------------------ pos (N,3) array of floats specifying point locations. color (N,4) array of floats (0.0-1.0) or tuple of floats specifying a single color for the entire item. width float specifying line width antialias enables smooth line drawing mode 'lines': Each pair of vertexes draws a single line segment. 'line_strip': All vertexes are drawn as a continuous set of line segments. ==================== ================================================== """ args = ['pos', 'color', 'width', 'mode', 'antialias'] for k in kwds.keys(): if k not in args: raise Exception('Invalid keyword argument: %s (allowed arguments are %s)' % (k, str(args))) self.antialias = False if 'pos' in kwds: pos = kwds.pop('pos') self.pos = np.ascontiguousarray(pos, dtype=np.float32) if 'color' in kwds: color = kwds.pop('color') if isinstance(color, np.ndarray): color = np.ascontiguousarray(color, dtype=np.float32) self.color = color for k, v in kwds.items(): setattr(self, k, v) self.update() def paint(self): if self.pos is None: return self.setupGLState() glEnableClientState(GL_VERTEX_ARRAY) try: glVertexPointerf(self.pos) if isinstance(self.color, np.ndarray): glEnableClientState(GL_COLOR_ARRAY) glColorPointerf(self.color) else: color = self.color if isinstance(color, str): color = fn.mkColor(color) if isinstance(color, QtGui.QColor): color = color.getRgbF() glColor4f(*color) glLineWidth(self.width) if self.antialias: glEnable(GL_LINE_SMOOTH) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glHint(GL_LINE_SMOOTH_HINT, GL_NICEST) if self.mode == 'line_strip': glDrawArrays(GL_LINE_STRIP, 0, self.pos.shape[0]) elif self.mode == 'lines': glDrawArrays(GL_LINES, 0, self.pos.shape[0]) else: raise Exception("Unknown line mode '%s'. (must be 'lines' or 'line_strip')" % self.mode) finally: glDisableClientState(GL_COLOR_ARRAY) glDisableClientState(GL_VERTEX_ARRAY) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLMeshItem.py000066400000000000000000000206631457240071200246000ustar00rootroot00000000000000from OpenGL.GL import * # noqa import numpy as np from ...Qt import QtGui from .. import shaders from ..GLGraphicsItem import GLGraphicsItem from ..MeshData import MeshData __all__ = ['GLMeshItem'] class GLMeshItem(GLGraphicsItem): """ **Bases:** :class:`GLGraphicsItem ` Displays a 3D triangle mesh. """ def __init__(self, parentItem=None, **kwds): """ ============== ===================================================== **Arguments:** meshdata MeshData object from which to determine geometry for this item. color Default face color used if no vertex or face colors are specified. edgeColor Default edge color to use if no edge colors are specified in the mesh data. drawEdges If True, a wireframe mesh will be drawn. (default=False) drawFaces If True, mesh faces are drawn. (default=True) shader Name of shader program to use when drawing faces. (None for no shader) smooth If True, normal vectors are computed for each vertex and interpolated within each face. computeNormals If False, then computation of normal vectors is disabled. This can provide a performance boost for meshes that do not make use of normals. ============== ===================================================== """ self.opts = { 'meshdata': None, 'color': (1., 1., 1., 1.), 'drawEdges': False, 'drawFaces': True, 'edgeColor': (0.5, 0.5, 0.5, 1.0), 'shader': None, 'smooth': True, 'computeNormals': True, } super().__init__(parentItem=parentItem) glopts = kwds.pop('glOptions', 'opaque') self.setGLOptions(glopts) shader = kwds.pop('shader', None) self.setShader(shader) self.setMeshData(**kwds) ## storage for data compiled from MeshData object self.vertexes = None self.normals = None self.colors = None self.faces = None def setShader(self, shader): """Set the shader used when rendering faces in the mesh. (see the GL shaders example)""" self.opts['shader'] = shader self.update() def shader(self): shader = self.opts['shader'] if isinstance(shader, shaders.ShaderProgram): return shader else: return shaders.getShaderProgram(shader) def setColor(self, c): """Set the default color to use when no vertex or face colors are specified.""" self.opts['color'] = c self.update() def setMeshData(self, **kwds): """ Set mesh data for this item. This can be invoked two ways: 1. Specify *meshdata* argument with a new MeshData object 2. Specify keyword arguments to be passed to MeshData(..) to create a new instance. """ md = kwds.get('meshdata', None) if md is None: opts = {} for k in ['vertexes', 'faces', 'edges', 'vertexColors', 'faceColors']: try: opts[k] = kwds.pop(k) except KeyError: pass md = MeshData(**opts) self.opts['meshdata'] = md self.opts.update(kwds) self.meshDataChanged() self.update() def meshDataChanged(self): """ This method must be called to inform the item that the MeshData object has been altered. """ self.vertexes = None self.faces = None self.normals = None self.colors = None self.edges = None self.edgeColors = None self.update() def parseMeshData(self): ## interpret vertex / normal data before drawing ## This can: ## - automatically generate normals if they were not specified ## - pull vertexes/noormals/faces from MeshData if that was specified if self.vertexes is not None and self.normals is not None: return #if self.opts['normals'] is None: #if self.opts['meshdata'] is None: #self.opts['meshdata'] = MeshData(vertexes=self.opts['vertexes'], faces=self.opts['faces']) if self.opts['meshdata'] is not None: md = self.opts['meshdata'] if self.opts['smooth'] and not md.hasFaceIndexedData(): self.vertexes = md.vertexes() if self.opts['computeNormals']: self.normals = md.vertexNormals() self.faces = md.faces() if md.hasVertexColor(): self.colors = md.vertexColors() if md.hasFaceColor(): self.colors = md.faceColors() else: self.vertexes = md.vertexes(indexed='faces') if self.opts['computeNormals']: if self.opts['smooth']: self.normals = md.vertexNormals(indexed='faces') else: self.normals = md.faceNormals(indexed='faces') self.faces = None if md.hasVertexColor(): self.colors = md.vertexColors(indexed='faces') elif md.hasFaceColor(): self.colors = md.faceColors(indexed='faces') if self.opts['drawEdges']: if not md.hasFaceIndexedData(): self.edges = md.edges() self.edgeVerts = md.vertexes() else: self.edges = md.edges() self.edgeVerts = md.vertexes(indexed='faces') return def paint(self): self.setupGLState() self.parseMeshData() if self.opts['drawFaces']: with self.shader(): verts = self.vertexes norms = self.normals color = self.colors faces = self.faces if verts is None: return glEnableClientState(GL_VERTEX_ARRAY) try: glVertexPointerf(verts) if self.colors is None: color = self.opts['color'] if isinstance(color, QtGui.QColor): glColor4f(*color.getRgbF()) else: glColor4f(*color) else: glEnableClientState(GL_COLOR_ARRAY) glColorPointerf(color) if norms is not None: glEnableClientState(GL_NORMAL_ARRAY) glNormalPointerf(norms) if faces is None: glDrawArrays(GL_TRIANGLES, 0, np.prod(verts.shape[:-1])) else: faces = faces.astype(np.uint32).flatten() glDrawElements(GL_TRIANGLES, faces.shape[0], GL_UNSIGNED_INT, faces) finally: glDisableClientState(GL_NORMAL_ARRAY) glDisableClientState(GL_VERTEX_ARRAY) glDisableClientState(GL_COLOR_ARRAY) if self.opts['drawEdges']: verts = self.edgeVerts edges = self.edges glEnableClientState(GL_VERTEX_ARRAY) try: glVertexPointerf(verts) if self.edgeColors is None: color = self.opts['edgeColor'] if isinstance(color, QtGui.QColor): glColor4f(*color.getRgbF()) else: glColor4f(*color) else: glEnableClientState(GL_COLOR_ARRAY) glColorPointerf(color) edges = edges.flatten() glDrawElements(GL_LINES, edges.shape[0], GL_UNSIGNED_INT, edges) finally: glDisableClientState(GL_VERTEX_ARRAY) glDisableClientState(GL_COLOR_ARRAY) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLScatterPlotItem.py000066400000000000000000000172771457240071200261570ustar00rootroot00000000000000from OpenGL.GL import * # noqa import numpy as np from ... import functions as fn from ...Qt import QtGui from .. import shaders from ..GLGraphicsItem import GLGraphicsItem __all__ = ['GLScatterPlotItem'] class GLScatterPlotItem(GLGraphicsItem): """Draws points at a list of 3D positions.""" def __init__(self, parentItem=None, **kwds): super().__init__(parentItem=parentItem) glopts = kwds.pop('glOptions', 'additive') self.setGLOptions(glopts) self.pos = None self.size = 10 self.color = [1.0,1.0,1.0,0.5] self.pxMode = True self.setData(**kwds) self.shader = None def setData(self, **kwds): """ Update the data displayed by this item. All arguments are optional; for example it is allowed to update spot positions while leaving colors unchanged, etc. ==================== ================================================== **Arguments:** pos (N,3) array of floats specifying point locations. color (N,4) array of floats (0.0-1.0) specifying spot colors OR a tuple of floats specifying a single color for all spots. size (N,) array of floats specifying spot sizes or a single value to apply to all spots. pxMode If True, spot sizes are expressed in pixels. Otherwise, they are expressed in item coordinates. ==================== ================================================== """ args = ['pos', 'color', 'size', 'pxMode'] for k in kwds.keys(): if k not in args: raise Exception('Invalid keyword argument: %s (allowed arguments are %s)' % (k, str(args))) if 'pos' in kwds: pos = kwds.pop('pos') self.pos = np.ascontiguousarray(pos, dtype=np.float32) if 'color' in kwds: color = kwds.pop('color') if isinstance(color, np.ndarray): color = np.ascontiguousarray(color, dtype=np.float32) self.color = color if 'size' in kwds: size = kwds.pop('size') if isinstance(size, np.ndarray): size = np.ascontiguousarray(size, dtype=np.float32) self.size = size self.pxMode = kwds.get('pxMode', self.pxMode) self.update() def initializeGL(self): if self.shader is not None: return ## Generate texture for rendering points w = 64 def genTexture(x,y): r = np.hypot((x-(w-1)/2.), (y-(w-1)/2.)) return 255 * (w / 2 - fn.clip_array(r, w / 2 - 1, w / 2)) pData = np.empty((w, w, 4)) pData[:] = 255 pData[:,:,3] = np.fromfunction(genTexture, pData.shape[:2]) pData = pData.astype(np.ubyte) if getattr(self, "pointTexture", None) is None: self.pointTexture = glGenTextures(1) glActiveTexture(GL_TEXTURE0) glEnable(GL_TEXTURE_2D) glBindTexture(GL_TEXTURE_2D, self.pointTexture) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pData.shape[0], pData.shape[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, pData) self.shader = shaders.getShaderProgram('pointSprite') #def setupGLState(self): #"""Prepare OpenGL state for drawing. This function is called immediately before painting.""" ##glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ## requires z-sorting to render properly. #glBlendFunc(GL_SRC_ALPHA, GL_ONE) #glEnable( GL_BLEND ) #glEnable( GL_ALPHA_TEST ) #glDisable( GL_DEPTH_TEST ) ##glEnable( GL_POINT_SMOOTH ) ##glHint(GL_POINT_SMOOTH_HINT, GL_NICEST) ##glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, (0, 0, -1e-3)) ##glPointParameterfv(GL_POINT_SIZE_MAX, (65500,)) ##glPointParameterfv(GL_POINT_SIZE_MIN, (0,)) def paint(self): if self.pos is None: return self.setupGLState() glEnable(GL_POINT_SPRITE) glActiveTexture(GL_TEXTURE0) glEnable( GL_TEXTURE_2D ) glBindTexture(GL_TEXTURE_2D, self.pointTexture) glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE) #glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE) ## use texture color exactly #glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ) ## texture modulates current color glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) glEnable(GL_PROGRAM_POINT_SIZE) with self.shader: #glUniform1i(self.shader.uniform('texture'), 0) ## inform the shader which texture to use glEnableClientState(GL_VERTEX_ARRAY) try: pos = self.pos #if pos.ndim > 2: #pos = pos.reshape((-1, pos.shape[-1])) glVertexPointerf(pos) if isinstance(self.color, np.ndarray): glEnableClientState(GL_COLOR_ARRAY) glColorPointerf(self.color) else: color = self.color if isinstance(color, QtGui.QColor): color = color.getRgbF() glColor4f(*color) if not self.pxMode or isinstance(self.size, np.ndarray): glEnableClientState(GL_NORMAL_ARRAY) norm = np.zeros(pos.shape, dtype=np.float32) if self.pxMode: norm[...,0] = self.size else: gpos = self.mapToView(pos.transpose()).transpose() if self.view(): pxSize = self.view().pixelSize(gpos) else: pxSize = self.parentItem().view().pixelSize(gpos) norm[...,0] = self.size / pxSize glNormalPointerf(norm) else: glNormal3f(self.size, 0, 0) ## vertex shader uses norm.x to determine point size #glPointSize(self.size) glDrawArrays(GL_POINTS, 0, pos.shape[0]) finally: glDisableClientState(GL_NORMAL_ARRAY) glDisableClientState(GL_VERTEX_ARRAY) glDisableClientState(GL_COLOR_ARRAY) #posVBO.unbind() ##fixes #145 glDisable( GL_TEXTURE_2D ) #for i in range(len(self.pos)): #pos = self.pos[i] #if isinstance(self.color, np.ndarray): #color = self.color[i] #else: #color = self.color #if isinstance(self.color, QtGui.QColor): #color = fn.glColor(self.color) #if isinstance(self.size, np.ndarray): #size = self.size[i] #else: #size = self.size #pxSize = self.view().pixelSize(QtGui.QVector3D(*pos)) #glPointSize(size / pxSize) #glBegin( GL_POINTS ) #glColor4f(*color) # x is blue ##glNormal3f(size, 0, 0) #glVertex3f(*pos) #glEnd() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLSurfacePlotItem.py000066400000000000000000000121411457240071200261230ustar00rootroot00000000000000from OpenGL.GL import * # noqa import numpy as np from ..MeshData import MeshData from .GLMeshItem import GLMeshItem __all__ = ['GLSurfacePlotItem'] class GLSurfacePlotItem(GLMeshItem): """ **Bases:** :class:`GLMeshItem ` Displays a surface plot on a regular x,y grid """ def __init__(self, x=None, y=None, z=None, colors=None, parentItem=None, **kwds): """ The x, y, z, and colors arguments are passed to setData(). All other keyword arguments are passed to GLMeshItem.__init__(). """ self._x = None self._y = None self._z = None self._color = None self._vertexes = None self._meshdata = MeshData() super().__init__(parentItem=parentItem, meshdata=self._meshdata, **kwds) self.setData(x, y, z, colors) def setData(self, x=None, y=None, z=None, colors=None): """ Update the data in this surface plot. ============== ===================================================================== **Arguments:** x,y 1D arrays of values specifying the x,y positions of vertexes in the grid. If these are omitted, then the values will be assumed to be integers. z 2D array of height values for each grid vertex. colors (width, height, 4) array of vertex colors. ============== ===================================================================== All arguments are optional. Note that if vertex positions are updated, the normal vectors for each triangle must be recomputed. This is somewhat expensive if the surface was initialized with smooth=False and very expensive if smooth=True. For faster performance, initialize with computeNormals=False and use per-vertex colors or a normal-independent shader program. """ if x is not None: if self._x is None or len(x) != len(self._x): self._vertexes = None self._x = x if y is not None: if self._y is None or len(y) != len(self._y): self._vertexes = None self._y = y if z is not None: #if self._x is None: #self._x = np.arange(z.shape[0]) #self._vertexes = None #if self._y is None: #self._y = np.arange(z.shape[1]) #self._vertexes = None if self._x is not None and z.shape[0] != len(self._x): raise Exception('Z values must have shape (len(x), len(y))') if self._y is not None and z.shape[1] != len(self._y): raise Exception('Z values must have shape (len(x), len(y))') self._z = z if self._vertexes is not None and self._z.shape != self._vertexes.shape[:2]: self._vertexes = None if colors is not None: self._colors = colors self._meshdata.setVertexColors(colors) if self._z is None: return updateMesh = False newVertexes = False ## Generate vertex and face array if self._vertexes is None: newVertexes = True self._vertexes = np.empty((self._z.shape[0], self._z.shape[1], 3), dtype=float) self.generateFaces() self._meshdata.setFaces(self._faces) updateMesh = True ## Copy x, y, z data into vertex array if newVertexes or x is not None: if x is None: if self._x is None: x = np.arange(self._z.shape[0]) else: x = self._x self._vertexes[:, :, 0] = x.reshape(len(x), 1) updateMesh = True if newVertexes or y is not None: if y is None: if self._y is None: y = np.arange(self._z.shape[1]) else: y = self._y self._vertexes[:, :, 1] = y.reshape(1, len(y)) updateMesh = True if newVertexes or z is not None: self._vertexes[...,2] = self._z updateMesh = True ## Update MeshData if updateMesh: self._meshdata.setVertexes(self._vertexes.reshape(self._vertexes.shape[0]*self._vertexes.shape[1], 3)) self.meshDataChanged() def generateFaces(self): cols = self._z.shape[1]-1 rows = self._z.shape[0]-1 faces = np.empty((cols*rows*2, 3), dtype=np.uint) rowtemplate1 = np.arange(cols).reshape(cols, 1) + np.array([[0, 1, cols+1]]) rowtemplate2 = np.arange(cols).reshape(cols, 1) + np.array([[cols+1, 1, cols+2]]) for row in range(rows): start = row * cols * 2 faces[start:start+cols] = rowtemplate1 + row * (cols+1) faces[start+cols:start+(cols*2)] = rowtemplate2 + row * (cols+1) self._faces = faces pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLTextItem.py000066400000000000000000000071421457240071200246250ustar00rootroot00000000000000from OpenGL.GL import * # noqa import numpy as np from ... import functions as fn from ...Qt import QtCore, QtGui from ..GLGraphicsItem import GLGraphicsItem __all__ = ['GLTextItem'] class GLTextItem(GLGraphicsItem): """Draws text in 3D.""" def __init__(self, parentItem=None, **kwds): """All keyword arguments are passed to setData()""" super().__init__(parentItem=parentItem) glopts = kwds.pop('glOptions', 'additive') self.setGLOptions(glopts) self.pos = np.array([0.0, 0.0, 0.0]) self.color = QtCore.Qt.GlobalColor.white self.text = '' self.font = QtGui.QFont('Helvetica', 16) self.setData(**kwds) def setData(self, **kwds): """ Update the data displayed by this item. All arguments are optional; for example it is allowed to update text while leaving colors unchanged, etc. ==================== ================================================== **Arguments:** ------------------------------------------------------------------------ pos (3,) array of floats specifying text location. color QColor or array of ints [R,G,B] or [R,G,B,A]. (Default: Qt.white) text String to display. font QFont (Default: QFont('Helvetica', 16)) ==================== ================================================== """ args = ['pos', 'color', 'text', 'font'] for k in kwds.keys(): if k not in args: raise ValueError('Invalid keyword argument: %s (allowed arguments are %s)' % (k, str(args))) for arg in args: if arg in kwds: value = kwds[arg] if arg == 'pos': if isinstance(value, np.ndarray): if value.shape != (3,): raise ValueError('"pos.shape" must be (3,).') elif isinstance(value, (tuple, list)): if len(value) != 3: raise ValueError('"len(pos)" must be 3.') elif arg == 'color': value = fn.mkColor(value) elif arg == 'font': if isinstance(value, QtGui.QFont) is False: raise TypeError('"font" must be QFont.') setattr(self, arg, value) self.update() def paint(self): if len(self.text) < 1: return self.setupGLState() modelview = glGetDoublev(GL_MODELVIEW_MATRIX) projection = glGetDoublev(GL_PROJECTION_MATRIX) viewport = [0, 0, self.view().width(), self.view().height()] text_pos = self.__project(self.pos, modelview, projection, viewport) text_pos.setY(viewport[3] - text_pos.y()) painter = QtGui.QPainter(self.view()) painter.setPen(self.color) painter.setFont(self.font) painter.setRenderHints(QtGui.QPainter.RenderHint.Antialiasing | QtGui.QPainter.RenderHint.TextAntialiasing) painter.drawText(text_pos, self.text) painter.end() def __project(self, obj_pos, modelview, projection, viewport): obj_vec = np.append(np.array(obj_pos), [1.0]) view_vec = np.matmul(modelview.T, obj_vec) proj_vec = np.matmul(projection.T, view_vec) if proj_vec[3] == 0.0: return QtCore.QPointF(0, 0) proj_vec[0:3] /= proj_vec[3] return QtCore.QPointF( viewport[0] + (1.0 + proj_vec[0]) * viewport[2] / 2, viewport[1] + (1.0 + proj_vec[1]) * viewport[3] / 2 ) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/GLVolumeItem.py000066400000000000000000000170301457240071200251450ustar00rootroot00000000000000from OpenGL.GL import * # noqa import numpy as np from ...Qt import QtGui from ..GLGraphicsItem import GLGraphicsItem __all__ = ['GLVolumeItem'] class GLVolumeItem(GLGraphicsItem): """ **Bases:** :class:`GLGraphicsItem ` Displays volumetric data. """ def __init__(self, data, sliceDensity=1, smooth=True, glOptions='translucent', parentItem=None): """ ============== ======================================================================================= **Arguments:** data Volume data to be rendered. *Must* be 4D numpy array (x, y, z, RGBA) with dtype=ubyte. sliceDensity Density of slices to render through the volume. A value of 1 means one slice per voxel. smooth (bool) If True, the volume slices are rendered with linear interpolation ============== ======================================================================================= """ self.sliceDensity = sliceDensity self.smooth = smooth self.data = None self._needUpload = False self.texture = None super().__init__(parentItem=parentItem) self.setGLOptions(glOptions) self.setData(data) def setData(self, data): self.data = data self._needUpload = True self.update() def _uploadData(self): glEnable(GL_TEXTURE_3D) if self.texture is None: self.texture = glGenTextures(1) glBindTexture(GL_TEXTURE_3D, self.texture) if self.smooth: glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) else: glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER) glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER) glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER) shape = self.data.shape ## Test texture dimensions first glTexImage3D(GL_PROXY_TEXTURE_3D, 0, GL_RGBA, shape[0], shape[1], shape[2], 0, GL_RGBA, GL_UNSIGNED_BYTE, None) if glGetTexLevelParameteriv(GL_PROXY_TEXTURE_3D, 0, GL_TEXTURE_WIDTH) == 0: raise Exception("OpenGL failed to create 3D texture (%dx%dx%d); too large for this hardware." % shape[:3]) data = np.ascontiguousarray(self.data.transpose((2,1,0,3))) glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, shape[0], shape[1], shape[2], 0, GL_RGBA, GL_UNSIGNED_BYTE, data) glDisable(GL_TEXTURE_3D) self.lists = {} for ax in [0,1,2]: for d in [-1, 1]: l = glGenLists(1) self.lists[(ax,d)] = l glNewList(l, GL_COMPILE) self.drawVolume(ax, d) glEndList() self._needUpload = False def paint(self): if self.data is None: return if self._needUpload: self._uploadData() self.setupGLState() glEnable(GL_TEXTURE_3D) glBindTexture(GL_TEXTURE_3D, self.texture) #glEnable(GL_DEPTH_TEST) #glDisable(GL_CULL_FACE) #glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) #glEnable( GL_BLEND ) #glEnable( GL_ALPHA_TEST ) glColor4f(1,1,1,1) view = self.view() center = QtGui.QVector3D(*[x/2. for x in self.data.shape[:3]]) cam = self.mapFromParent(view.cameraPosition()) - center #print "center", center, "cam", view.cameraPosition(), self.mapFromParent(view.cameraPosition()), "diff", cam cam = np.array([cam.x(), cam.y(), cam.z()]) ax = np.argmax(abs(cam)) d = 1 if cam[ax] > 0 else -1 glCallList(self.lists[(ax,d)]) ## draw axes glDisable(GL_TEXTURE_3D) def drawVolume(self, ax, d): imax = [0,1,2] imax.remove(ax) tp = [[0,0,0],[0,0,0],[0,0,0],[0,0,0]] vp = [[0,0,0],[0,0,0],[0,0,0],[0,0,0]] nudge = [0.5/x for x in self.data.shape] tp[0][imax[0]] = 0+nudge[imax[0]] tp[0][imax[1]] = 0+nudge[imax[1]] tp[1][imax[0]] = 1-nudge[imax[0]] tp[1][imax[1]] = 0+nudge[imax[1]] tp[2][imax[0]] = 1-nudge[imax[0]] tp[2][imax[1]] = 1-nudge[imax[1]] tp[3][imax[0]] = 0+nudge[imax[0]] tp[3][imax[1]] = 1-nudge[imax[1]] vp[0][imax[0]] = 0 vp[0][imax[1]] = 0 vp[1][imax[0]] = self.data.shape[imax[0]] vp[1][imax[1]] = 0 vp[2][imax[0]] = self.data.shape[imax[0]] vp[2][imax[1]] = self.data.shape[imax[1]] vp[3][imax[0]] = 0 vp[3][imax[1]] = self.data.shape[imax[1]] slices = self.data.shape[ax] * self.sliceDensity r = list(range(slices)) if d == -1: r = r[::-1] glBegin(GL_QUADS) tzVals = np.linspace(nudge[ax], 1.0-nudge[ax], slices) vzVals = np.linspace(0, self.data.shape[ax], slices) for i in r: z = tzVals[i] w = vzVals[i] tp[0][ax] = z tp[1][ax] = z tp[2][ax] = z tp[3][ax] = z vp[0][ax] = w vp[1][ax] = w vp[2][ax] = w vp[3][ax] = w glTexCoord3f(*tp[0]) glVertex3f(*vp[0]) glTexCoord3f(*tp[1]) glVertex3f(*vp[1]) glTexCoord3f(*tp[2]) glVertex3f(*vp[2]) glTexCoord3f(*tp[3]) glVertex3f(*vp[3]) glEnd() ## Interesting idea: ## remove projection/modelview matrixes, recreate in texture coords. ## it _sorta_ works, but needs tweaking. #mvm = glGetDoublev(GL_MODELVIEW_MATRIX) #pm = glGetDoublev(GL_PROJECTION_MATRIX) #m = QtGui.QMatrix4x4(mvm.flatten()).inverted()[0] #p = QtGui.QMatrix4x4(pm.flatten()).inverted()[0] #glMatrixMode(GL_PROJECTION) #glPushMatrix() #glLoadIdentity() #N=1 #glOrtho(-N,N,-N,N,-100,100) #glMatrixMode(GL_MODELVIEW) #glLoadIdentity() #glMatrixMode(GL_TEXTURE) #glLoadIdentity() #glMultMatrixf(m.copyDataTo()) #view = self.view() #w = view.width() #h = view.height() #dist = view.opts['distance'] #fov = view.opts['fov'] #nearClip = dist * .1 #farClip = dist * 5. #r = nearClip * np.tan(fov) #t = r * h / w #p = QtGui.QMatrix4x4() #p.frustum( -r, r, -t, t, nearClip, farClip) #glMultMatrixf(p.inverted()[0].copyDataTo()) #glBegin(GL_QUADS) #M=1 #for i in range(500): #z = i/500. #w = -i/500. #glTexCoord3f(-M, -M, z) #glVertex3f(-N, -N, w) #glTexCoord3f(M, -M, z) #glVertex3f(N, -N, w) #glTexCoord3f(M, M, z) #glVertex3f(N, N, w) #glTexCoord3f(-M, M, z) #glVertex3f(-N, N, w) #glEnd() #glDisable(GL_TEXTURE_3D) #glMatrixMode(GL_PROJECTION) #glPopMatrix() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/items/__init__.py000066400000000000000000000000001457240071200243600ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/opengl/shaders.py000066400000000000000000000373101457240071200231470ustar00rootroot00000000000000from OpenGL.GL import * # noqa from OpenGL.GL import shaders # noqa try: from OpenGL import NullFunctionError except ImportError: from OpenGL.error import NullFunctionError import numpy as np import re ## For centralizing and managing vertex/fragment shader programs. def initShaders(): global Shaders Shaders = [ ShaderProgram(None, []), ## increases fragment alpha as the normal turns orthogonal to the view ## this is useful for viewing shells that enclose a volume (such as isosurfaces) ShaderProgram('balloon', [ VertexShader(""" varying vec3 normal; void main() { // compute here for use in fragment shader normal = normalize(gl_NormalMatrix * gl_Normal); gl_FrontColor = gl_Color; gl_BackColor = gl_Color; gl_Position = ftransform(); } """), FragmentShader(""" varying vec3 normal; void main() { vec4 color = gl_Color; color.w = min(color.w + 2.0 * color.w * pow(normal.x*normal.x + normal.y*normal.y, 5.0), 1.0); gl_FragColor = color; } """) ]), ## colors fragments based on face normals relative to view ## This means that the colors will change depending on how the view is rotated ShaderProgram('viewNormalColor', [ VertexShader(""" varying vec3 normal; void main() { // compute here for use in fragment shader normal = normalize(gl_NormalMatrix * gl_Normal); gl_FrontColor = gl_Color; gl_BackColor = gl_Color; gl_Position = ftransform(); } """), FragmentShader(""" varying vec3 normal; void main() { vec4 color = gl_Color; color.x = (normal.x + 1.0) * 0.5; color.y = (normal.y + 1.0) * 0.5; color.z = (normal.z + 1.0) * 0.5; gl_FragColor = color; } """) ]), ## colors fragments based on absolute face normals. ShaderProgram('normalColor', [ VertexShader(""" varying vec3 normal; void main() { // compute here for use in fragment shader normal = normalize(gl_Normal); gl_FrontColor = gl_Color; gl_BackColor = gl_Color; gl_Position = ftransform(); } """), FragmentShader(""" varying vec3 normal; void main() { vec4 color = gl_Color; color.x = (normal.x + 1.0) * 0.5; color.y = (normal.y + 1.0) * 0.5; color.z = (normal.z + 1.0) * 0.5; gl_FragColor = color; } """) ]), ## very simple simulation of lighting. ## The light source position is always relative to the camera. ShaderProgram('shaded', [ VertexShader(""" varying vec3 normal; void main() { // compute here for use in fragment shader normal = normalize(gl_NormalMatrix * gl_Normal); gl_FrontColor = gl_Color; gl_BackColor = gl_Color; gl_Position = ftransform(); } """), FragmentShader(""" varying vec3 normal; void main() { float p = dot(normal, normalize(vec3(1.0, -1.0, -1.0))); p = p < 0. ? 0. : p * 0.8; vec4 color = gl_Color; color.x = color.x * (0.2 + p); color.y = color.y * (0.2 + p); color.z = color.z * (0.2 + p); gl_FragColor = color; } """) ]), ## colors get brighter near edges of object ShaderProgram('edgeHilight', [ VertexShader(""" varying vec3 normal; void main() { // compute here for use in fragment shader normal = normalize(gl_NormalMatrix * gl_Normal); gl_FrontColor = gl_Color; gl_BackColor = gl_Color; gl_Position = ftransform(); } """), FragmentShader(""" varying vec3 normal; void main() { vec4 color = gl_Color; float s = pow(normal.x*normal.x + normal.y*normal.y, 2.0); color.x = color.x + s * (1.0-color.x); color.y = color.y + s * (1.0-color.y); color.z = color.z + s * (1.0-color.z); gl_FragColor = color; } """) ]), ## colors fragments by z-value. ## This is useful for coloring surface plots by height. ## This shader uses a uniform called "colorMap" to determine how to map the colors: ## red = pow(colorMap[0]*(z + colorMap[1]), colorMap[2]) ## green = pow(colorMap[3]*(z + colorMap[4]), colorMap[5]) ## blue = pow(colorMap[6]*(z + colorMap[7]), colorMap[8]) ## (set the values like this: shader['uniformMap'] = array([...]) ShaderProgram('heightColor', [ VertexShader(""" varying vec4 pos; void main() { gl_FrontColor = gl_Color; gl_BackColor = gl_Color; pos = gl_Vertex; gl_Position = ftransform(); } """), FragmentShader(""" uniform float colorMap[9]; varying vec4 pos; //out vec4 gl_FragColor; // only needed for later glsl versions //in vec4 gl_Color; void main() { vec4 color = gl_Color; color.x = colorMap[0] * (pos.z + colorMap[1]); if (colorMap[2] != 1.0) color.x = pow(color.x, colorMap[2]); color.x = color.x < 0. ? 0. : (color.x > 1. ? 1. : color.x); color.y = colorMap[3] * (pos.z + colorMap[4]); if (colorMap[5] != 1.0) color.y = pow(color.y, colorMap[5]); color.y = color.y < 0. ? 0. : (color.y > 1. ? 1. : color.y); color.z = colorMap[6] * (pos.z + colorMap[7]); if (colorMap[8] != 1.0) color.z = pow(color.z, colorMap[8]); color.z = color.z < 0. ? 0. : (color.z > 1. ? 1. : color.z); color.w = 1.0; gl_FragColor = color; } """), ], uniforms={'colorMap': [1, 1, 1, 1, 0.5, 1, 1, 0, 1]}), ShaderProgram('pointSprite', [ ## allows specifying point size using normal.x ## See: ## ## http://stackoverflow.com/questions/9609423/applying-part-of-a-texture-sprite-sheet-texture-map-to-a-point-sprite-in-ios ## http://stackoverflow.com/questions/3497068/textured-points-in-opengl-es-2-0 ## ## VertexShader(""" void main() { gl_FrontColor=gl_Color; gl_PointSize = gl_Normal.x; gl_Position = ftransform(); } """), #FragmentShader(""" ##version 120 #uniform sampler2D texture; #void main ( ) #{ #gl_FragColor = texture2D(texture, gl_PointCoord) * gl_Color; #} #""") ]), ] CompiledShaderPrograms = {} def getShaderProgram(name): return ShaderProgram.names[name] class Shader(object): def __init__(self, shaderType, code): self.shaderType = shaderType self.code = code self.compiled = None def shader(self): if self.compiled is None: try: self.compiled = shaders.compileShader(self.code, self.shaderType) except NullFunctionError: raise Exception("This OpenGL implementation does not support shader programs; many OpenGL features in pyqtgraph will not work.") except RuntimeError as exc: ## Format compile errors a bit more nicely if len(exc.args) == 3: err, code, typ = exc.args if not err.startswith('Shader compile failure'): raise code = code[0].decode('utf_8').split('\n') err, c, msgs = err.partition(':') err = err + '\n' msgs = re.sub('b\'','',msgs) msgs = re.sub('\'$','',msgs) msgs = re.sub('\\\\n','\n',msgs) msgs = msgs.split('\n') errNums = [()] * len(code) for i, msg in enumerate(msgs): msg = msg.strip() if msg == '': continue m = re.match(r'(\d+\:)?\d+\((\d+)\)', msg) if m is not None: line = int(m.groups()[1]) errNums[line-1] = errNums[line-1] + (str(i+1),) #code[line-1] = '%d\t%s' % (i+1, code[line-1]) err = err + "%d %s\n" % (i+1, msg) errNums = [','.join(n) for n in errNums] maxlen = max(map(len, errNums)) code = [errNums[i] + " "*(maxlen-len(errNums[i])) + line for i, line in enumerate(code)] err = err + '\n'.join(code) raise Exception(err) else: raise return self.compiled class VertexShader(Shader): def __init__(self, code): Shader.__init__(self, GL_VERTEX_SHADER, code) class FragmentShader(Shader): def __init__(self, code): Shader.__init__(self, GL_FRAGMENT_SHADER, code) class ShaderProgram(object): names = {} def __init__(self, name, shaders, uniforms=None): self.name = name ShaderProgram.names[name] = self self.shaders = shaders self.prog = None self.blockData = {} self.uniformData = {} ## parse extra options from the shader definition if uniforms is not None: for k,v in uniforms.items(): self[k] = v def setBlockData(self, blockName, data): if data is None: del self.blockData[blockName] else: self.blockData[blockName] = data def setUniformData(self, uniformName, data): if data is None: del self.uniformData[uniformName] else: self.uniformData[uniformName] = data def __setitem__(self, item, val): self.setUniformData(item, val) def __delitem__(self, item): self.setUniformData(item, None) def program(self): if self.prog is None: try: compiled = [s.shader() for s in self.shaders] ## compile all shaders self.prog = shaders.compileProgram(*compiled) ## compile program except: self.prog = -1 raise return self.prog def __enter__(self): if len(self.shaders) > 0 and self.program() != -1: glUseProgram(self.program()) try: ## load uniform values into program for uniformName, data in self.uniformData.items(): loc = self.uniform(uniformName) if loc == -1: raise Exception('Could not find uniform variable "%s"' % uniformName) glUniform1fv(loc, len(data), np.array(data, dtype=np.float32)) ### bind buffer data to program blocks #if len(self.blockData) > 0: #bindPoint = 1 #for blockName, data in self.blockData.items(): ### Program should have a uniform block declared: ### ### layout (std140) uniform blockName { ### vec4 diffuse; ### }; ### pick any-old binding point. (there are a limited number of these per-program #bindPoint = 1 ### get the block index for a uniform variable in the shader #blockIndex = glGetUniformBlockIndex(self.program(), blockName) ### give the shader block a binding point #glUniformBlockBinding(self.program(), blockIndex, bindPoint) ### create a buffer #buf = glGenBuffers(1) #glBindBuffer(GL_UNIFORM_BUFFER, buf) #glBufferData(GL_UNIFORM_BUFFER, size, data, GL_DYNAMIC_DRAW) ### also possible to use glBufferSubData to fill parts of the buffer ### bind buffer to the same binding point #glBindBufferBase(GL_UNIFORM_BUFFER, bindPoint, buf) except: glUseProgram(0) raise def __exit__(self, *args): if len(self.shaders) > 0: glUseProgram(0) def uniform(self, name): """Return the location integer for a uniform variable in this program""" return glGetUniformLocation(self.program(), name.encode('utf_8')) #def uniformBlockInfo(self, blockName): #blockIndex = glGetUniformBlockIndex(self.program(), blockName) #count = glGetActiveUniformBlockiv(self.program(), blockIndex, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS) #indices = [] #for i in range(count): #indices.append(glGetActiveUniformBlockiv(self.program(), blockIndex, GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)) class HeightColorShader(ShaderProgram): def __enter__(self): ## Program should have a uniform block declared: ## ## layout (std140) uniform blockName { ## vec4 diffuse; ## vec4 ambient; ## }; ## pick any-old binding point. (there are a limited number of these per-program bindPoint = 1 ## get the block index for a uniform variable in the shader blockIndex = glGetUniformBlockIndex(self.program(), "blockName") ## give the shader block a binding point glUniformBlockBinding(self.program(), blockIndex, bindPoint) ## create a buffer buf = glGenBuffers(1) glBindBuffer(GL_UNIFORM_BUFFER, buf) glBufferData(GL_UNIFORM_BUFFER, size, data, GL_DYNAMIC_DRAW) ## also possible to use glBufferSubData to fill parts of the buffer ## bind buffer to the same binding point glBindBufferBase(GL_UNIFORM_BUFFER, bindPoint, buf) initShaders() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/000077500000000000000000000000001457240071200225145ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/Parameter.py000066400000000000000000001105451457240071200250140ustar00rootroot00000000000000import re import warnings import weakref from collections import OrderedDict from .. import functions as fn from ..Qt import QtCore from .ParameterItem import ParameterItem PARAM_TYPES = {} PARAM_NAMES = {} _PARAM_ITEM_TYPES = {} def registerParameterItemType(name, itemCls, parameterCls=None, override=False): """ Similar to :func:`registerParameterType`, but works on ParameterItems. This is useful for Parameters where the `itemClass` does all the heavy lifting, and a redundant Parameter class must be defined just to house `itemClass`. Instead, use `registerParameterItemType`. If this should belong to a subclass of `Parameter`, specify which one in `parameterCls`. """ global _PARAM_ITEM_TYPES if name in _PARAM_ITEM_TYPES and not override: raise ValueError( f"Parameter item type '{name}' already exists (use override=True to replace)" ) parameterCls = parameterCls or Parameter _PARAM_ITEM_TYPES[name] = itemCls registerParameterType(name, parameterCls, override) def registerParameterType(name, cls, override=False): """Register a parameter type in the parametertree system. This enables construction of custom Parameter classes by name in :meth:`~pyqtgraph.parametertree.Parameter.create`. """ global PARAM_TYPES if name in PARAM_TYPES and not override: raise ValueError(f"Parameter type '{name}' already exists (use override=True to replace)") PARAM_TYPES[name] = cls PARAM_NAMES[cls] = name def __reload__(old): PARAM_TYPES.update(old.get('PARAM_TYPES', {})) PARAM_NAMES.update(old.get('PARAM_NAMES', {})) class Parameter(QtCore.QObject): """ A Parameter is the basic unit of data in a parameter tree. Each parameter has a name, a type, a value, and several other properties that modify the behavior of the Parameter. Parameters may have parent / child / sibling relationships to construct organized hierarchies. Parameters generally do not have any inherent GUI or visual interpretation; instead they manage ParameterItem instances which take care of display and user interaction. Note: It is fairly uncommon to use the Parameter class directly; mostly you will use subclasses which provide specialized type and data handling. The static method Parameter.create(...) is an easy way to generate instances of these subclasses. For more Parameter types, see ParameterTree.parameterTypes module. =================================== ========================================================= **Signals:** sigStateChanged(self, change, info) Emitted when anything changes about this parameter at all. The second argument is a string indicating what changed ('value', 'childAdded', etc..) The third argument can be any extra information about the change sigTreeStateChanged(self, changes) Emitted when any child in the tree changes state (but only if monitorChildren() is called) the format of *changes* is [(param, change, info), ...] sigValueChanged(self, value) Emitted when value is finished changing sigValueChanging(self, value) Emitted immediately for all value changes, including during editing. sigChildAdded(self, child, index) Emitted when a child is added sigChildRemoved(self, child) Emitted when a child is removed sigRemoved(self) Emitted when this parameter is removed sigParentChanged(self, parent) Emitted when this parameter's parent has changed sigLimitsChanged(self, limits) Emitted when this parameter's limits have changed sigDefaultChanged(self, default) Emitted when this parameter's default value has changed sigNameChanged(self, name) Emitted when this parameter's name has changed sigOptionsChanged(self, opts) Emitted when any of this parameter's options have changed sigContextMenu(self, name) Emitted when a context menu was clicked =================================== ========================================================= """ ## name, type, limits, etc. ## can also carry UI hints (slider vs spinbox, etc.) sigValueChanged = QtCore.Signal(object, object) ## self, value emitted when value is finished being edited sigValueChanging = QtCore.Signal(object, object) ## self, value emitted as value is being edited sigChildAdded = QtCore.Signal(object, object, object) ## self, child, index sigChildRemoved = QtCore.Signal(object, object) ## self, child sigRemoved = QtCore.Signal(object) ## self sigParentChanged = QtCore.Signal(object, object) ## self, parent sigLimitsChanged = QtCore.Signal(object, object) ## self, limits sigDefaultChanged = QtCore.Signal(object, object) ## self, default sigNameChanged = QtCore.Signal(object, object) ## self, name sigOptionsChanged = QtCore.Signal(object, object) ## self, {opt:val, ...} ## Emitted when anything changes about this parameter at all. ## The second argument is a string indicating what changed ('value', 'childAdded', etc..) ## The third argument can be any extra information about the change sigStateChanged = QtCore.Signal(object, object, object) ## self, change, info ## emitted when any child in the tree changes state ## (but only if monitorChildren() is called) sigTreeStateChanged = QtCore.Signal(object, object) # self, changes # changes = [(param, change, info), ...] sigContextMenu = QtCore.Signal(object, object) # self, name # bad planning. #def __new__(cls, *args, **opts): #try: #cls = PARAM_TYPES[opts['type']] #except KeyError: #pass #return QtCore.QObject.__new__(cls, *args, **opts) @staticmethod def create(**opts): """ Static method that creates a new Parameter (or subclass) instance using opts['type'] to select the appropriate class. All options are passed directly to the new Parameter's __init__ method. Use registerParameterType() to add new class types. """ typ = opts.get('type', None) if typ is None: cls = Parameter else: cls = PARAM_TYPES[opts['type']] return cls(**opts) def __init__(self, **opts): """ Initialize a Parameter object. Although it is rare to directly create a Parameter instance, the options available to this method are also allowed by most Parameter subclasses. ======================= ========================================================= **Keyword Arguments:** name The name to give this Parameter. This is the name that will appear in the left-most column of a ParameterTree for this Parameter. value The value to initially assign to this Parameter. default The default value for this Parameter (most Parameters provide an option to 'reset to default'). children A list of children for this Parameter. Children may be given either as a Parameter instance or as a dictionary to pass to Parameter.create(). In this way, it is possible to specify complex hierarchies of Parameters from a single nested data structure. readonly If True, the user will not be allowed to edit this Parameter. (default=False) enabled If False, any widget(s) for this parameter will appear disabled. (default=True) visible If False, the Parameter will not appear when displayed in a ParameterTree. (default=True) renamable If True, the user may rename this Parameter. (default=False) removable If True, the user may remove this Parameter. (default=False) expanded If True, the Parameter will initially be expanded in ParameterTrees: Its children will be visible. (default=True) syncExpanded If True, the `expanded` state of this Parameter is synchronized with all ParameterTrees it is displayed in. (default=False) title (str or None) If specified, then the parameter will be displayed to the user using this string as its name. However, the parameter will still be referred to internally using the *name* specified above. Note that this option is not compatible with renamable=True. (default=None; added in version 0.9.9) ======================= ========================================================= """ QtCore.QObject.__init__(self) self.opts = { 'type': None, 'readonly': False, 'visible': True, 'enabled': True, 'renamable': False, 'removable': False, 'strictNaming': False, # forces name to be usable as a python variable 'expanded': True, 'syncExpanded': False, 'title': None, # The following intentionally excluded; each parameter type may have a different data type for limits. # 'limits': None, } name = opts.get('name', None) if not isinstance(name, str): raise TypeError("Parameter must have a string name specified in opts.") self.opts.update(opts) self.opts['name'] = None self.childs = [] self.names = {} ## map name:child self.items = weakref.WeakKeyDictionary() ## keeps track of tree items representing this parameter self._parent = None self.treeStateChanges = [] ## cache of tree state changes to be delivered on next emit self.blockTreeChangeEmit = 0 self.setName(name) self.addChildren(self.opts.pop('children', [])) if 'value' in self.opts and 'default' not in self.opts: warnings.warn( "Parameter has no default value. Pass a default, or use setDefault(). This will no longer set " "an implicit default after January 2025.", DeprecationWarning, stacklevel=2, ) self.opts['default'] = self.opts['value'] value = self.opts.get('value', self.opts.get('default', None)) modified = 'value' in self.opts if value is not None: self.setValue(value) self._modifiedSinceReset = modified # Connect all state changed signals to the general sigStateChanged self.sigValueChanged.connect(self._emitValueChanged) self.sigChildAdded.connect(self._emitChildAddedChanged) self.sigChildRemoved.connect(self._emitChildRemovedChanged) self.sigParentChanged.connect(self._emitParentChanged) self.sigLimitsChanged.connect(self._emitLimitsChanged) self.sigDefaultChanged.connect(self._emitDefaultChanged) self.sigNameChanged.connect(self._emitNameChanged) self.sigOptionsChanged.connect(self._emitOptionsChanged) self.sigContextMenu.connect(self._emitContextMenuChanged) @property def itemClass(self): """ The class of ParameterItem to use when displaying this parameter in a ParameterTree. """ return ParameterItem def name(self): """Return the name of this Parameter.""" return self.opts['name'] def title(self): """Return the title of this Parameter. By default, the title is the same as the name unless it has been explicitly specified otherwise.""" title = self.opts.get('title', None) if title is None: title = self.name() return title def contextMenu(self, name): """"A context menu entry was clicked""" self.sigContextMenu.emit(self, name) def setName(self, name): """Attempt to change the name of this parameter; return the actual name. (The parameter may reject the name change or automatically pick a different name)""" if self.opts['strictNaming'] and (len(name) < 1 or re.search(r'\W', name) or re.match(r'\d', name[0])): raise ValueError( f"Parameter name '{name}' is invalid. (Must contain only alphanumeric and underscore characters and " f"may not start with a number)") parent = self.parent() if parent is not None: name = parent._renameChild(self, name) # first ask parent if it's ok to rename if self.opts['name'] != name: self.opts['name'] = name self.sigNameChanged.emit(self, name) return name def type(self): """Return the type string for this Parameter.""" return self.opts['type'] def isType(self, typ): """ Return True if this parameter type matches the name *typ*. This can occur either of two ways: - If self.type() == *typ* - If this parameter's class is registered with the name *typ* """ if self.type() == typ: return True global PARAM_TYPES cls = PARAM_TYPES.get(typ, None) if cls is None: raise ValueError(f"Type name '{typ}' is not registered.") return self.__class__ is cls def childPath(self, child): """ Return the path of parameter names from self to child. If child is not a (grand)child of self, return None. """ path = [] while child is not self: path.insert(0, child.name()) child = child.parent() if child is None: return None return path def setValue(self, value, blockSignal=None): """ Set the value of this Parameter; return the actual value that was set. (this may be different from the value that was requested) """ try: if blockSignal is not None: self.sigValueChanged.disconnect(blockSignal) value = self._interpretValue(value) if fn.eq(self.opts.get('value', None), value): return value self._modifiedSinceReset = True self.opts['value'] = value self.sigValueChanged.emit(self, value) # value might change after signal is received by tree item finally: if blockSignal is not None: self.sigValueChanged.connect(blockSignal) return self.opts['value'] def _interpretValue(self, v): return v def hasValue(self): """Return True if this Parameter has a value set.""" return 'value' in self.opts def value(self): """ Return the value of this Parameter. Raises ValueError if no value has been set. """ if 'value' not in self.opts: warnings.warn( "Parameter has no value set. Pass an initial value or default, or use setValue() or setDefault(). " "This will be an error after January 2025.", DeprecationWarning, stacklevel=2, ) return self.opts.get('value') def getValues(self): """ Return a tree of all values that are children of this parameter. Raises ValueError if any child has no value. """ vals = OrderedDict() for ch in self: vals[ch.name()] = (ch.value(), ch.getValues()) return vals def saveState(self, filter=None): """ Return a structure representing the entire state of the parameter tree. The tree state may be restored from this structure using restoreState(). If *filter* is set to 'user', then only user-settable data will be included in the returned state. """ if filter is None: state = self.opts.copy() if state['type'] is None: global PARAM_NAMES state['type'] = PARAM_NAMES.get(type(self), None) elif filter == 'user': if self.hasValue(): state = {'value': self.value()} else: state = {} else: raise ValueError(f"Unrecognized filter argument: '{filter}'") ch = OrderedDict([(ch.name(), ch.saveState(filter=filter)) for ch in self]) if len(ch) > 0: state['children'] = ch return state def restoreState(self, state, recursive=True, addChildren=True, removeChildren=True, blockSignals=True): """ Restore the state of this parameter and its children from a structure generated using saveState() If recursive is True, then attempt to restore the state of child parameters as well. If addChildren is True, then any children which are referenced in the state object will be created if they do not already exist. If removeChildren is True, then any children which are not referenced in the state object will be removed. If blockSignals is True, no signals will be emitted until the tree has been completely restored. This prevents signal handlers from responding to a partially-rebuilt network. """ state = state.copy() childState = state.pop('children', []) ## list of children may be stored either as list or dict. if isinstance(childState, dict): cs = [] for k,v in childState.items(): cs.append(v.copy()) cs[-1].setdefault('name', k) childState = cs if blockSignals: self.blockTreeChangeSignal() try: self.setOpts(**state) if not recursive: return ptr = 0 ## pointer to first child that has not been restored yet foundChilds = set() #print "==============", self.name() for ch in childState: name = ch['name'] #typ = ch.get('type', None) #print('child: %s, %s' % (self.name()+'.'+name, typ)) ## First, see if there is already a child with this name gotChild = False for i, ch2 in enumerate(self.childs[ptr:]): #print " ", ch2.name(), ch2.type() if ch2.name() != name: # or not ch2.isType(typ): continue gotChild = True #print " found it" if i != 0: ## move parameter to next position #self.removeChild(ch2) self.insertChild(ptr, ch2) #print " moved to position", ptr ch2.restoreState(ch, recursive=recursive, addChildren=addChildren, removeChildren=removeChildren) foundChilds.add(ch2) break if not gotChild: if not addChildren: #print " ignored child" continue #print " created new" ch2 = Parameter.create(**ch) self.insertChild(ptr, ch2) foundChilds.add(ch2) ptr += 1 if removeChildren: for ch in self.childs[:]: if ch not in foundChilds: #print " remove:", ch self.removeChild(ch) finally: if blockSignals: self.unblockTreeChangeSignal() def valueModifiedSinceResetToDefault(self): """Return True if this parameter's value has been changed since the last time it was reset to its default value.""" return self._modifiedSinceReset def defaultValue(self): """Return the default value for this parameter. Raises ValueError if no default.""" if 'default' not in self.opts: warnings.warn("Parameter has no default value. This will be a ValueError after January 2025.", DeprecationWarning, stacklevel=2) return self.opts.get('default') def setDefault(self, val, updatePristineValues=False): """Set the default value for this parameter. If updatePristineValues is True, then any values that haven't been modified since the last time they were reset to default will be updated to the new default value (default: False).""" if self.opts.get('default', None) == val: return self.opts['default'] = val if 'value' not in self.opts or (updatePristineValues and not self.valueModifiedSinceResetToDefault()): self.setToDefault() if not self.valueIsDefault(): self._modifiedSinceReset = True self.sigDefaultChanged.emit(self, val) def setToDefault(self): """Set this parameter's value to the default. Raises ValueError if no default is set.""" with self.treeChangeBlocker(): self.setValue(self.defaultValue()) self._modifiedSinceReset = False def hasDefault(self): """Returns True if this parameter has a default value.""" return self.opts.get('default', None) is not None def valueIsDefault(self): """Returns True if this parameter's value is equal to the default value.""" if not self.hasValue() or not self.hasDefault(): return False return fn.eq(self.value(), self.defaultValue()) def setLimits(self, limits): """Set limits on the acceptable values for this parameter. The format of limits depends on the type of the parameter and some parameters do not make use of limits at all.""" if 'limits' in self.opts and fn.eq(self.opts['limits'], limits): return self.opts['limits'] = limits self.sigLimitsChanged.emit(self, limits) return limits def writable(self): """ Returns True if this parameter's value can be changed by the user. Note that the value of the parameter can *always* be changed by calling setValue(). """ return not self.readonly() def setWritable(self, writable=True): """Set whether this Parameter should be editable by the user. (This is exactly the opposite of setReadonly).""" self.setOpts(readonly=not writable) def readonly(self): """ Return True if this parameter is read-only. (this is the opposite of writable()) """ return self.opts.get('readonly', False) def setReadonly(self, readonly=True): """Set whether this Parameter's value may be edited by the user (this is the opposite of setWritable()).""" self.setOpts(readonly=readonly) def setOpts(self, **opts): """ Set any arbitrary options on this parameter. The exact behavior of this function will depend on the parameter type, but most parameters will accept a common set of options: value, name, limits, default, readonly, removable, renamable, visible, enabled, expanded and syncExpanded. See :func:`Parameter.__init__ ` for more information on default options. """ changed = OrderedDict() for k in opts: if k == 'value': self.setValue(opts[k]) elif k == 'name': self.setName(opts[k]) elif k == 'limits': self.setLimits(opts[k]) elif k == 'default': self.setDefault(opts[k]) elif k not in self.opts or not fn.eq(self.opts[k], opts[k]): self.opts[k] = opts[k] changed[k] = opts[k] if len(changed) > 0: self.sigOptionsChanged.emit(self, changed) def emitStateChanged(self, changeDesc, data): ## Emits stateChanged signal and ## requests emission of new treeStateChanged signal self.sigStateChanged.emit(self, changeDesc, data) #self.treeStateChanged(self, changeDesc, data) self.treeStateChanges.append((self, changeDesc, data)) self.emitTreeChanges() def _emitValueChanged(self, param, data): self.emitStateChanged("value", data) def _emitChildAddedChanged(self, param, *data): self.emitStateChanged("childAdded", data) def _emitChildRemovedChanged(self, param, data): self.emitStateChanged("childRemoved", data) def _emitParentChanged(self, param, data): self.emitStateChanged("parent", data) def _emitLimitsChanged(self, param, data): self.emitStateChanged("limits", data) def _emitDefaultChanged(self, param, data): self.emitStateChanged("default", data) def _emitNameChanged(self, param, data): self.emitStateChanged("name", data) def _emitOptionsChanged(self, param, data): self.emitStateChanged("options", data) def _emitContextMenuChanged(self, param, data): self.emitStateChanged("contextMenu", data) def makeTreeItem(self, depth): """ Return a TreeWidgetItem suitable for displaying/controlling the content of this parameter. This is called automatically when a ParameterTree attempts to display this Parameter. Most subclasses will want to override this function. """ # Default to user-specified itemClass. If not present, check for a registered item class. Finally, # revert to ParameterItem if both fail itemClass = self.itemClass or _PARAM_ITEM_TYPES.get(self.opts['type'], ParameterItem) return itemClass(self, depth) def addChild(self, child, autoIncrementName=None, existOk=False): """ Add another parameter to the end of this parameter's child list. See insertChild() for a description of the *autoIncrementName* and *existOk* arguments. """ return self.insertChild(len(self.childs), child, autoIncrementName=autoIncrementName, existOk=existOk) def addChildren(self, children): """ Add a list or dict of children to this parameter. This method calls addChild once for each value in *children*. """ ## If children was specified as dict, then assume keys are the names. if isinstance(children, dict): ch2 = [] for name, opts in children.items(): if isinstance(opts, dict) and 'name' not in opts: opts = opts.copy() opts['name'] = name ch2.append(opts) children = ch2 for chOpts in children: #print self, "Add child:", type(chOpts), id(chOpts) self.addChild(chOpts) def insertChild(self, pos, child, autoIncrementName=None, existOk=False): """ Insert a new child at pos. If pos is a Parameter, then insert at the position of that Parameter. If child is a dict, then a parameter is constructed using :func:`Parameter.create `. By default, the child's 'autoIncrementName' option determines whether the name will be adjusted to avoid prior name collisions. This behavior may be overridden by specifying the *autoIncrementName* argument. This argument was added in version 0.9.9. If 'autoIncrementName' is *False*, an error is raised when the inserted child already exists. However, if 'existOk' is *True*, the existing child will be returned instead, and this child will *not* be inserted. """ if isinstance(child, dict): child = Parameter.create(**child) name = child.name() if name in self.names and child is not self.names[name]: if autoIncrementName is True or (autoIncrementName is None and child.opts.get('autoIncrementName', False)): name = self.incrementName(name) child.setName(name) elif existOk: return self.names[name] else: raise ValueError("Already have child named %s" % str(name)) if isinstance(pos, Parameter): pos = self.childs.index(pos) with self.treeChangeBlocker(): if child.parent() is not None: child.remove() self.names[name] = child self.childs.insert(pos, child) child.parentChanged(self) child.sigTreeStateChanged.connect(self.treeStateChanged) self.sigChildAdded.emit(self, child, pos) return child def removeChild(self, child): """Remove a child parameter.""" name = child.name() if name not in self.names or self.names[name] is not child: raise Exception("Parameter %s is not my child; can't remove." % str(child)) del self.names[name] self.childs.pop(self.childs.index(child)) child.parentChanged(None) try: child.sigTreeStateChanged.disconnect(self.treeStateChanged) except (TypeError, RuntimeError): ## already disconnected pass self.sigChildRemoved.emit(self, child) def clearChildren(self): """Remove all child parameters.""" for ch in self.childs[:]: self.removeChild(ch) def children(self): """Return a list of this parameter's children. Warning: this overrides QObject.children """ return self.childs[:] def hasChildren(self): """Return True if this Parameter has children.""" return len(self.childs) > 0 def parentChanged(self, parent): """This method is called when the parameter's parent has changed. It may be useful to extend this method in subclasses.""" self._parent = parent self.sigParentChanged.emit(self, parent) def parent(self): """Return the parent of this parameter.""" return self._parent def remove(self): """Remove this parameter from its parent's child list""" parent = self.parent() if parent is None: raise Exception("Cannot remove; no parent.") parent.removeChild(self) self.sigRemoved.emit(self) def incrementName(self, name): ## return an unused name by adding a number to the name given base, num = re.match(r'([^\d]*)(\d*)', name).groups() numLen = len(num) if numLen == 0: num = 2 numLen = 1 else: num = int(num) while True: newName = base + ("%%0%dd"%numLen) % num if newName not in self.names: return newName num += 1 def __iter__(self): yield from self.childs def __getitem__(self, names): """Get the value of a child parameter. The name may also be a tuple giving the path to a sub-parameter:: value = param[('child', 'grandchild')] Raises ValueError if the child value is not set. """ if not isinstance(names, tuple): names = (names,) return self.param(*names).value() def __setitem__(self, names, value): """Set the value of a child parameter. The name may also be a tuple giving the path to a sub-parameter:: param[('child', 'grandchild')] = value """ if isinstance(names, str): names = (names,) return self.param(*names).setValue(value) def keys(self): return self.names def child(self, *names): """Return a child parameter. Accepts the name of the child or a tuple (path, to, child) Added in version 0.9.9. Earlier versions used the 'param' method, which is still implemented for backward compatibility. """ try: param = self.names[names[0]] except KeyError as e: raise KeyError(f"Parameter {self.name()} has no child named {names[0]}") from e if len(names) > 1: return param.child(*names[1:]) else: return param def param(self, *names): # for backward compatibility. return self.child(*names) def __repr__(self): return "<%s '%s' at 0x%x>" % (self.__class__.__name__, self.name(), id(self)) def _renameChild(self, child, name): ## Only to be called from Parameter.rename if name in self.names: return child.name() self.names[name] = child del self.names[child.name()] return name def registerItem(self, item): self.items[item] = None def hide(self): """Hide this parameter. It and its children will no longer be visible in any ParameterTree widgets it is connected to.""" self.show(False) def show(self, s=True): """Show this parameter. """ self.opts['visible'] = s self.sigOptionsChanged.emit(self, {'visible': s}) def treeChangeBlocker(self): """ Return an object that can be used to temporarily block and accumulate sigTreeStateChanged signals. This is meant to be used when numerous changes are about to be made to the tree and only one change signal should be emitted at the end. Example:: with param.treeChangeBlocker(): param.addChild(...) param.removeChild(...) param.setValue(...) """ return SignalBlocker(self.blockTreeChangeSignal, self.unblockTreeChangeSignal) def blockTreeChangeSignal(self): """ Used to temporarily block and accumulate tree change signals. *You must remember to unblock*, so it is advisable to use treeChangeBlocker() instead. """ self.blockTreeChangeEmit += 1 def unblockTreeChangeSignal(self): """Unblocks enission of sigTreeStateChanged and flushes the changes out through a single signal.""" self.blockTreeChangeEmit -= 1 self.emitTreeChanges() def treeStateChanged(self, param, changes): """ Called when the state of any sub-parameter has changed. ============== ================================================================ **Arguments:** param The immediate child whose tree state has changed. note that the change may have originated from a grandchild. changes List of tuples describing all changes that have been made in this event: (param, changeDescr, data) ============== ================================================================ This function can be extended to react to tree state changes. """ self.treeStateChanges.extend(changes) self.emitTreeChanges() def emitTreeChanges(self): if self.blockTreeChangeEmit == 0: changes = self.treeStateChanges self.treeStateChanges = [] if len(changes) > 0: self.sigTreeStateChanged.emit(self, changes) class SignalBlocker(object): def __init__(self, enterFn, exitFn): self.enterFn = enterFn self.exitFn = exitFn def __enter__(self): self.enterFn() def __exit__(self, exc_type, exc_value, tb): self.exitFn() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/ParameterItem.py000066400000000000000000000202731457240071200256310ustar00rootroot00000000000000from ..Qt import QtCore, QtGui, QtWidgets translate = QtCore.QCoreApplication.translate class ParameterItem(QtWidgets.QTreeWidgetItem): """ Abstract ParameterTree item. Used to represent the state of a Parameter from within a ParameterTree. - Sets first column of item to name - generates context menu if item is renamable or removable - handles child added / removed events - provides virtual functions for handling changes from parameter For more ParameterItem types, see ParameterTree.parameterTypes module. """ def __init__(self, param, depth=0): QtWidgets.QTreeWidgetItem.__init__(self, [param.title(), '']) self.param = param self.param.registerItem(self) ## let parameter know this item is connected to it (for debugging) self.depth = depth param.sigValueChanged.connect(self.valueChanged) param.sigChildAdded.connect(self.childAdded) param.sigChildRemoved.connect(self.childRemoved) param.sigNameChanged.connect(self.nameChanged) param.sigLimitsChanged.connect(self.limitsChanged) param.sigDefaultChanged.connect(self.defaultChanged) param.sigOptionsChanged.connect(self.optsChanged) param.sigParentChanged.connect(self.parentChanged) self.updateFlags() ## flag used internally during name editing self.ignoreNameColumnChange = False def updateFlags(self): ## called when Parameter opts changed opts = self.param.opts flags = QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled if opts.get('renamable', False): if opts.get('title', None) is not None: raise Exception("Cannot make parameter with both title != None and renamable == True.") flags |= QtCore.Qt.ItemFlag.ItemIsEditable ## handle movable / dropEnabled options if opts.get('movable', False): flags |= QtCore.Qt.ItemFlag.ItemIsDragEnabled if opts.get('dropEnabled', False): flags |= QtCore.Qt.ItemFlag.ItemIsDropEnabled self.setFlags(flags) def valueChanged(self, param, val): ## called when the parameter's value has changed pass def isFocusable(self): """Return True if this item should be included in the tab-focus order""" return False def setFocus(self): """Give input focus to this item. Can be reimplemented to display editor widgets, etc. """ pass def focusNext(self, forward=True): """Give focus to the next (or previous) focusable item in the parameter tree""" self.treeWidget().focusNext(self, forward=forward) def treeWidgetChanged(self): """Called when this item is added or removed from a tree. Expansion, visibility, and column widgets must all be configured AFTER the item is added to a tree, not during __init__. """ self.setHidden(not self.param.opts.get('visible', True)) self.setExpanded(self.param.opts.get('expanded', True)) def childAdded(self, param, child, pos): item = child.makeTreeItem(depth=self.depth+1) self.insertChild(pos, item) item.treeWidgetChanged() for i, ch in enumerate(child): item.childAdded(child, ch, i) def childRemoved(self, param, child): for i in range(self.childCount()): item = self.child(i) if item.param is child: self.takeChild(i) break def parentChanged(self, param, parent): ## called when the parameter's parent has changed. pass def contextMenuEvent(self, ev): opts = self.param.opts if not opts.get('removable', False) and not opts.get('renamable', False)\ and "context" not in opts: return ## Generate context menu for renaming/removing parameter self.contextMenu = QtWidgets.QMenu() # Put in global name space to prevent garbage collection self.contextMenu.addSeparator() if opts.get('renamable', False): self.contextMenu.addAction(translate("ParameterItem", 'Rename')).triggered.connect(self.editName) if opts.get('removable', False): self.contextMenu.addAction(translate("ParameterItem", "Remove")).triggered.connect(self.requestRemove) # context menu context = opts.get('context', None) if isinstance(context, list): for name in context: self.contextMenu.addAction(name).triggered.connect( self.contextMenuTriggered(name)) elif isinstance(context, dict): for name, title in context.items(): self.contextMenu.addAction(title).triggered.connect( self.contextMenuTriggered(name)) self.contextMenu.popup(ev.globalPos()) def columnChangedEvent(self, col): """Called when the text in a column has been edited (or otherwise changed). By default, we only use changes to column 0 to rename the parameter. """ if col == 0 and (self.param.opts.get('title', None) is None): if self.ignoreNameColumnChange: return try: newName = self.param.setName(self.text(col)) except Exception: self.setText(0, self.param.name()) raise try: self.ignoreNameColumnChange = True self.nameChanged(self, newName) ## If the parameter rejects the name change, we need to set it back. finally: self.ignoreNameColumnChange = False def expandedChangedEvent(self, expanded): if self.param.opts['syncExpanded']: self.param.setOpts(expanded=expanded) def nameChanged(self, param, name): ## called when the parameter's name has changed. if self.param.opts.get('title', None) is None: self.titleChanged() def titleChanged(self): # called when the user-visble title has changed (either opts['title'], or name if title is None) title = self.param.title() # This makes sure that items without a title or the title 'params' remain invisible if not title or title == 'params': return self.setText(0, title) fm = QtGui.QFontMetrics(self.font(0)) textFlags = QtCore.Qt.TextFlag.TextSingleLine size = fm.size(textFlags, self.text(0)) size.setHeight(int(size.height() * 1.35)) size.setWidth(int(size.width() * 1.15)) self.setSizeHint(0, size) def limitsChanged(self, param, limits): """Called when the parameter's limits have changed""" pass def defaultChanged(self, param, default): """Called when the parameter's default value has changed""" pass def optsChanged(self, param, opts): """Called when any options are changed that are not name, value, default, or limits""" if 'visible' in opts: self.setHidden(not opts['visible']) if 'expanded' in opts: if self.isExpanded() != opts['expanded']: self.setExpanded(opts['expanded']) if 'title' in opts: self.titleChanged() self.updateFlags() def contextMenuTriggered(self, name): def trigger(): self.param.contextMenu(name) return trigger def editName(self): self.treeWidget().editItem(self, 0) def selected(self, sel): """Called when this item has been selected (sel=True) OR deselected (sel=False)""" pass def requestRemove(self): ## called when remove is selected from the context menu. ## we need to delay removal until the action is complete ## since destroying the menu in mid-action will cause a crash. QtCore.QTimer.singleShot(0, self.param.remove) ## for python 3 support, we need to redefine hash and eq methods. def __hash__(self): return id(self) def __eq__(self, x): return x is self pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/ParameterSystem.py000066400000000000000000000103241457240071200262130ustar00rootroot00000000000000__all__ = ["ParameterSystem", "SystemSolver"] from .. import functions as fn from .parameterTypes import GroupParameter from .SystemSolver import SystemSolver class ParameterSystem(GroupParameter): """ ParameterSystem is a subclass of GroupParameter that manages a tree of sub-parameters with a set of interdependencies--changing any one parameter may affect other parameters in the system. See parametertree/SystemSolver for more information. NOTE: This API is experimental and may change substantially across minor version numbers. """ def __init__(self, *args, **kwds): GroupParameter.__init__(self, *args, **kwds) self._system = None self._fixParams = [] # all auto-generated 'fixed' params sys = kwds.pop('system', None) if sys is not None: self.setSystem(sys) self._ignoreChange = [] # params whose changes should be ignored temporarily self.sigTreeStateChanged.connect(self.updateSystem) def setSystem(self, sys): self._system = sys # auto-generate defaults to match child parameters defaults = {} vals = {} for param in self: name = param.name() constraints = '' if hasattr(sys, '_' + name): constraints += 'n' if not param.readonly(): constraints += 'f' if 'n' in constraints: ch = param.addChild(dict(name='fixed', type='bool', value=False)) self._fixParams.append(ch) param.setReadonly(True) param.setOpts(expanded=False) else: vals[name] = param.value() ch = param.addChild(dict(name='fixed', type='bool', value=True, readonly=True)) #self._fixParams.append(ch) defaults[name] = [None, param.type(), None, constraints] sys.defaultState.update(defaults) sys.reset() for name, value in vals.items(): setattr(sys, name, value) self.updateAllParams() def updateSystem(self, param, changes): changes = [ch for ch in changes if ch[0] not in self._ignoreChange] sets = [ch[0] for ch in changes if ch[1] == 'value'] for param in sets: if param in self._fixParams: parent = param.parent() setattr(self._system, parent.name(), parent.value() if parent.hasValue() else None) else: setattr(self._system, param.name(), param.value()) self.updateAllParams() def updateAllParams(self): try: self.sigTreeStateChanged.disconnect(self.updateSystem) for name, state in self._system._vars.items(): param = self.child(name) try: v = getattr(self._system, name) if self._system._vars[name][2] is None: self.updateParamState(self.child(name), 'autoSet') param.setValue(v) else: self.updateParamState(self.child(name), 'fixed') except RuntimeError: self.updateParamState(param, 'autoUnset') finally: self.sigTreeStateChanged.connect(self.updateSystem) def updateParamState(self, param, state): if state == 'autoSet': bg = fn.mkBrush((200, 255, 200, 255)) bold = False readonly = True elif state == 'autoUnset': bg = fn.mkBrush(None) bold = False readonly = False elif state == 'fixed': bg = fn.mkBrush('y') bold = True readonly = False else: raise ValueError("'state' must be one of 'autoSet', 'autoUnset', or 'fixed'") param.setReadonly(readonly) #for item in param.items: #item.setBackground(0, bg) #f = item.font(0) #f.setWeight(f.Bold if bold else f.Normal) #item.setFont(0, f) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/ParameterTree.py000066400000000000000000000167711457240071200256420ustar00rootroot00000000000000from .parameterTypes import GroupParameterItem from ..Qt import QtCore, QtWidgets, mkQApp from ..widgets.TreeWidget import TreeWidget from .ParameterItem import ParameterItem class ParameterTree(TreeWidget): """Widget used to display or control data from a hierarchy of Parameters""" def __init__(self, parent=None, showHeader=True): """ ============== ======================================================== **Arguments:** parent (QWidget) An optional parent widget showHeader (bool) If True, then the QTreeView header is displayed. ============== ======================================================== """ TreeWidget.__init__(self, parent) self.setVerticalScrollMode(self.ScrollMode.ScrollPerPixel) self.setHorizontalScrollMode(self.ScrollMode.ScrollPerPixel) self.setAnimated(False) self.setColumnCount(2) self.setHeaderLabels(["Parameter", "Value"]) self.setAlternatingRowColors(True) self.paramSet = None self.header().setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.ResizeToContents) self.setHeaderHidden(not showHeader) self.itemChanged.connect(self.itemChangedEvent) self.itemExpanded.connect(self.itemExpandedEvent) self.itemCollapsed.connect(self.itemCollapsedEvent) self.lastSel = None self.setRootIsDecorated(False) app = mkQApp() app.paletteChanged.connect(self.updatePalette) def setParameters(self, param, showTop=True): """ Set the top-level :class:`Parameter ` to be displayed in this ParameterTree. If *showTop* is False, then the top-level parameter is hidden and only its children will be visible. This is a convenience method equivalent to:: tree.clear() tree.addParameters(param, showTop) """ self.clear() self.addParameters(param, showTop=showTop) def addParameters(self, param, root=None, depth=0, showTop=True): """ Adds one top-level :class:`Parameter ` to the view. ============== ========================================================== **Arguments:** param The :class:`Parameter ` to add. root The item within the tree to which *param* should be added. By default, *param* is added as a top-level item. showTop If False, then *param* will be hidden, and only its children will be visible in the tree. ============== ========================================================== """ item = param.makeTreeItem(depth=depth) if root is None: root = self.invisibleRootItem() ## Hide top-level item if not showTop: item.setText(0, '') item.setSizeHint(0, QtCore.QSize(1,1)) item.setSizeHint(1, QtCore.QSize(1,1)) depth -= 1 root.addChild(item) item.treeWidgetChanged() for ch in param: self.addParameters(ch, root=item, depth=depth+1) def clear(self): """ Remove all parameters from the tree. """ self.invisibleRootItem().takeChildren() def focusNext(self, item, forward=True): """Give input focus to the next (or previous) item after *item* """ while True: parent = item.parent() if parent is None: return nextItem = self.nextFocusableChild(parent, item, forward=forward) if nextItem is not None: nextItem.setFocus() self.setCurrentItem(nextItem) return item = parent def focusPrevious(self, item): self.focusNext(item, forward=False) def nextFocusableChild(self, root, startItem=None, forward=True): if startItem is None: if forward: index = 0 else: index = root.childCount()-1 else: if forward: index = root.indexOfChild(startItem) + 1 else: index = root.indexOfChild(startItem) - 1 if forward: inds = list(range(index, root.childCount())) else: inds = list(range(index, -1, -1)) for i in inds: item = root.child(i) if hasattr(item, 'isFocusable') and item.isFocusable(): return item else: item = self.nextFocusableChild(item, forward=forward) if item is not None: return item return None def contextMenuEvent(self, ev): item = self.currentItem() if hasattr(item, 'contextMenuEvent'): item.contextMenuEvent(ev) def updatePalette(self): """ called when application palette changes This should ensure that the color theme of the OS is applied to the GroupParameterItems should the theme chang while the application is running. """ for item in self.listAllItems(): if isinstance(item, GroupParameterItem): item.updateDepth(item.depth) def itemChangedEvent(self, item, col): if hasattr(item, 'columnChangedEvent'): item.columnChangedEvent(col) def itemExpandedEvent(self, item): if hasattr(item, 'expandedChangedEvent'): item.expandedChangedEvent(True) def itemCollapsedEvent(self, item): if hasattr(item, 'expandedChangedEvent'): item.expandedChangedEvent(False) def selectionChanged(self, *args): sel = self.selectedItems() if len(sel) != 1: sel = None if self.lastSel is not None and isinstance(self.lastSel, ParameterItem): self.lastSel.selected(False) if sel is None: self.lastSel = None return self.lastSel = sel[0] if hasattr(sel[0], 'selected'): sel[0].selected(True) return super().selectionChanged(*args) # commented out due to being unreliable # def wheelEvent(self, ev): # self.clearSelection() # return super().wheelEvent(ev) def sizeHint(self): w, h = 0, 0 ind = self.indentation() for x in self.listAllItems(): if x.isHidden(): continue try: depth = x.depth except AttributeError: depth = 0 s0 = x.sizeHint(0) s1 = x.sizeHint(1) w = max(w, depth * ind + max(0, s0.width()) + max(0, s1.width())) h += max(0, s0.height(), s1.height()) # typ = x.param.opts['type'] if isinstance(x, ParameterItem) else x # print(typ, depth * ind, (s0.width(), s0.height()), (s1.width(), s1.height()), (w, h)) # todo: find out if this alternative can be made to work (currently fails when color or colormap are present) # print('custom', (w, h)) # w = self.sizeHintForColumn(0) + self.sizeHintForColumn(1) # h = self.viewportSizeHint().height() # print('alternative', (w, h)) if not self.header().isHidden(): h += self.header().height() return QtCore.QSize(w, h) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/SystemSolver.py000066400000000000000000000426131457240071200255530ustar00rootroot00000000000000import copy from collections import OrderedDict from math import log2 import numpy as np from .. import functions as fn class SystemSolver(object): """ This abstract class is used to formalize and manage user interaction with a complex system of equations (related to "constraint satisfaction problems"). It is often the case that devices must be controlled through a large number of free variables, and interactions between these variables make the system difficult to manage and conceptualize as a user interface. This class does _not_ attempt to numerically solve the system of equations. Rather, it provides a framework for subdividing the system into manageable pieces and specifying closed-form solutions to these small pieces. For an example, see the simple Camera class below. Theory of operation: Conceptualize the system as 1) a set of variables whose values may be either user-specified or automatically generated, and 2) a set of functions that define *how* each variable should be generated. When a variable is accessed (as an instance attribute), the solver first checks to see if it already has a value (either user-supplied, or cached from a previous calculation). If it does not, then the solver calls a method on itself (the method must be named `_variableName`) that will either return the calculated value (which usually involves acccessing other variables in the system), or raise RuntimeError if it is unable to calculate the value (usually because the user has not provided sufficient input to fully constrain the system). Each method that calculates a variable value may include multiple try/except blocks, so that if one method generates a RuntimeError, it may fall back on others. In this way, the system may be solved by recursively searching the tree of possible relationships between variables. This allows the user flexibility in deciding which variables are the most important to specify, while avoiding the apparent combinatorial explosion of calculation pathways that must be considered by the developer. Solved values are cached for efficiency, and automatically cleared when a state change invalidates the cache. The rules for this are simple: any time a value is set, it invalidates the cache *unless* the previous value was None (which indicates that no other variable has yet requested that value). More complex cache management may be defined in subclasses. Subclasses must define: 1) The *defaultState* class attribute: This is a dict containing a description of the variables in the system--their default values, data types, and the ways they can be constrained. The format is:: { name: [value, type, constraint, allowed_constraints], ...} Where: * *value* is the default value. May be None if it has not been specified yet. * *type* may be float, int, bool, np.ndarray, ... * *constraint* may be None, single value, or (min, max) * None indicates that the value is not constrained--it may be automatically generated if the value is requested. * *allowed_constraints* is a string composed of (n)one, (f)ixed, and (r)ange. Note: do not put mutable objects inside defaultState! 2) For each variable that may be automatically determined, a method must be defined with the name `_variableName`. This method may either return the """ defaultState = OrderedDict() def __init__(self): self.__dict__['_vars'] = OrderedDict() self.__dict__['_currentGets'] = set() self.reset() def copy(self): sys = type(self)() sys.__dict__['_vars'] = copy.deepcopy(self.__dict__['_vars']) sys.__dict__['_currentGets'] = copy.deepcopy(self.__dict__['_currentGets']) return sys def reset(self): """ Reset all variables in the solver to their default state. """ self._currentGets.clear() for k in self.defaultState: self._vars[k] = self.defaultState[k][:] def __getattr__(self, name): if name in self._vars: return self.get(name) raise AttributeError(name) def __setattr__(self, name, value): """ Set the value of a state variable. If None is given for the value, then the constraint will also be set to None. If a tuple is given for a scalar variable, then the tuple is used as a range constraint instead of a value. Otherwise, the constraint is set to 'fixed'. """ # First check this is a valid attribute if name in self._vars: if value is None: self.set(name, value, None) elif isinstance(value, tuple) and self._vars[name][1] is not np.ndarray: self.set(name, None, value) else: self.set(name, value, 'fixed') else: # also allow setting any other pre-existing attribute if hasattr(self, name): object.__setattr__(self, name, value) else: raise AttributeError(name) def get(self, name): """ Return the value for parameter *name*. If the value has not been specified, then attempt to compute it from other interacting parameters. If no value can be determined, then raise RuntimeError. """ if name in self._currentGets: raise RuntimeError("Cyclic dependency while calculating '%s'." % name) self._currentGets.add(name) try: v = self._vars[name][0] if v is None: cfunc = getattr(self, '_' + name, None) if cfunc is None: v = None else: v = cfunc() if v is None: raise RuntimeError("Parameter '%s' is not specified." % name) v = self.set(name, v) finally: self._currentGets.remove(name) return v def set(self, name, value=None, constraint=True): """ Set a variable *name* to *value*. The actual set value is returned (in some cases, the value may be cast into another type). If *value* is None, then the value is left to be determined in the future. At any time, the value may be re-assigned arbitrarily unless a constraint is given. If *constraint* is True (the default), then supplying a value that violates a previously specified constraint will raise an exception. If *constraint* is 'fixed', then the value is set (if provided) and the variable will not be updated automatically in the future. If *constraint* is a tuple, then the value is constrained to be within the given (min, max). Either constraint may be None to disable it. In some cases, a constraint cannot be satisfied automatically, and the user will be forced to resolve the constraint manually. If *constraint* is None, then any constraints are removed for the variable. """ var = self._vars[name] if constraint is None: if 'n' not in var[3]: raise TypeError("Empty constraints not allowed for '%s'" % name) var[2] = constraint elif constraint == 'fixed': if 'f' not in var[3]: raise TypeError("Fixed constraints not allowed for '%s'" % name) # This is nice, but not reliable because sometimes there is 1 DOF but we set 2 # values simultaneously. # if var[2] is None: # try: # self.get(name) # # has already been computed by the system; adding a fixed constraint # # would overspecify the system. # raise ValueError("Cannot fix parameter '%s'; system would become overconstrained." % name) # except RuntimeError: # pass var[2] = constraint elif isinstance(constraint, tuple): if 'r' not in var[3]: raise TypeError("Range constraints not allowed for '%s'" % name) assert len(constraint) == 2 var[2] = constraint elif constraint is not True: raise TypeError("constraint must be None, True, 'fixed', or tuple. (got %s)" % constraint) # type checking / massaging if var[1] is np.ndarray and value is not None: value = np.array(value, dtype=float) elif var[1] in (int, float, tuple) and value is not None: value = var[1](value) # constraint checks if constraint is True and not self.check_constraint(name, value): raise ValueError("Setting %s = %s violates constraint %s" % (name, value, var[2])) # invalidate other dependent values if var[0] is not None or value is None: # todo: we can make this more clever..(and might need to) # we just know that a value of None cannot have dependencies # (because if anyone else had asked for this value, it wouldn't be # None anymore) self.resetUnfixed() var[0] = value return value def check_constraint(self, name, value): c = self._vars[name][2] if c is None or value is None: return True if isinstance(c, tuple): return ((c[0] is None or c[0] <= value) and (c[1] is None or c[1] >= value)) else: return value == c def saveState(self): """ Return a serializable description of the solver's current state. """ state = OrderedDict() for name, var in self._vars.items(): state[name] = (var[0], var[2]) return state def restoreState(self, state): """ Restore the state of all values and constraints in the solver. """ self.reset() for name, var in state.items(): self.set(name, var[0], var[1]) def resetUnfixed(self): """ For any variable that does not have a fixed value, reset its value to None. """ for var in self._vars.values(): if var[2] != 'fixed': var[0] = None def solve(self): for k in self._vars: getattr(self, k) def checkOverconstraint(self): """Check whether the system is overconstrained. If so, return the name of the first overconstrained parameter. Overconstraints occur when any fixed parameter can be successfully computed by the system. (Ideally, all parameters are either fixed by the user or constrained by the system, but never both). """ for k,v in self._vars.items(): if v[2] == 'fixed' and 'n' in v[3]: oldval = v[:] self.set(k, None, None) try: self.get(k) return k except RuntimeError: pass finally: self._vars[k] = oldval return False def __repr__(self): state = OrderedDict() for name, var in self._vars.items(): if var[2] == 'fixed': state[name] = var[0] state = ', '.join(["%s=%s" % (n, v) for n,v in state.items()]) return "<%s %s>" % (self.__class__.__name__, state) if __name__ == '__main__': class Camera(SystemSolver): """ Consider a simple SLR camera. The variables we will consider that affect the camera's behavior while acquiring a photo are aperture, shutter speed, ISO, and flash (of course there are many more, but let's keep the example simple). In rare cases, the user wants to manually specify each of these variables and no more work needs to be done to take the photo. More often, the user wants to specify more interesting constraints like depth of field, overall exposure, or maximum allowed ISO value. If we add a simple light meter measurement into this system and an 'exposure' variable that indicates the desired exposure (0 is "perfect", -1 is one stop darker, etc), then the system of equations governing the camera behavior would have the following variables: aperture, shutter, iso, flash, exposure, light meter The first four variables are the "outputs" of the system (they directly drive the camera), the last is a constant (the camera itself cannot affect the reading on the light meter), and 'exposure' specifies a desired relationship between other variables in the system. So the question is: how can I formalize a system like this as a user interface? Typical cameras have a fairly limited approach: provide the user with a list of modes, each of which defines a particular set of constraints. For example: manual: user provides aperture, shutter, iso, and flash aperture priority: user provides aperture and exposure, camera selects iso, shutter, and flash automatically shutter priority: user provides shutter and exposure, camera selects iso, aperture, and flash program: user specifies exposure, camera selects all other variables automatically action: camera selects all variables while attempting to maximize shutter speed portrait: camera selects all variables while attempting to minimize aperture A more general approach might allow the user to provide more explicit constraints on each variable (for example: I want a shutter speed of 1/30 or slower, an ISO no greater than 400, an exposure between -1 and 1, and the smallest aperture possible given all other constraints) and have the camera solve the system of equations, with a warning if no solution is found. This is exactly what we will implement in this example class. """ defaultState = OrderedDict([ # Field stop aperture ('aperture', [None, float, None, 'nf']), # Duration that shutter is held open. ('shutter', [None, float, None, 'nf']), # ISO (sensitivity) value. 100, 200, 400, 800, 1600.. ('iso', [None, int, None, 'nf']), # Flash is a value indicating the brightness of the flash. A table # is used to decide on "balanced" settings for each flash level: # 0: no flash # 1: s=1/60, a=2.0, iso=100 # 2: s=1/60, a=4.0, iso=100 ..and so on.. ('flash', [None, float, None, 'nf']), # exposure is a value indicating how many stops brighter (+1) or # darker (-1) the photographer would like the photo to appear from # the 'balanced' settings indicated by the light meter (see below). ('exposure', [None, float, None, 'f']), # Let's define this as an external light meter (not affected by # aperture) with logarithmic output. We arbitrarily choose the # following settings as "well balanced" for each light meter value: # -1: s=1/60, a=2.0, iso=100 # 0: s=1/60, a=4.0, iso=100 # 1: s=1/120, a=4.0, iso=100 ..and so on.. # Note that the only allowed constraint mode is (f)ixed, since the # camera never _computes_ the light meter value, it only reads it. ('lightMeter', [None, float, None, 'f']), # Indicates the camera's final decision on how it thinks the photo will # look, given the chosen settings. This value is _only_ determined # automatically. ('balance', [None, float, None, 'n']), ]) def _aperture(self): """ Determine aperture automatically under a variety of conditions. """ iso = self.iso exp = self.exposure light = self.lightMeter try: # shutter-priority mode sh = self.shutter # this raises RuntimeError if shutter has not # been specified ap = 4.0 * (sh / (1./60.)) * (iso / 100.) * (2 ** exp) * (2 ** light) ap = fn.clip_scalar(ap, 2.0, 16.0) except RuntimeError: # program mode; we can select a suitable shutter # value at the same time. sh = (1./60.) raise return ap def _balance(self): iso = self.iso light = self.lightMeter sh = self.shutter ap = self.aperture bal = (4.0 / ap) * (sh / (1./60.)) * (iso / 100.) * (2 ** light) return log2(bal) camera = Camera() camera.iso = 100 camera.exposure = 0 camera.lightMeter = 2 camera.shutter = 1./60. camera.flash = 0 camera.solve() print(camera.saveState()) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/__init__.py000066400000000000000000000005251457240071200246270ustar00rootroot00000000000000from . import parameterTypes as types from .Parameter import Parameter, registerParameterItemType, registerParameterType from .ParameterItem import ParameterItem from .ParameterSystem import ParameterSystem, SystemSolver from .ParameterTree import ParameterTree from .interactive import RunOptions, interact, InteractiveFunction, Interactor pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/interactive.py000066400000000000000000000610411457240071200254050ustar00rootroot00000000000000import contextlib import functools import inspect import pydoc from .. import functions as fn from . import Parameter from .parameterTypes import ActionGroupParameter class PARAM_UNSET: """Sentinel value for detecting parameters with unset values""" class RunOptions: ON_ACTION = "action" """ Indicator for ``interactive`` parameter which adds an ``action`` parameter and runs when ``sigActivated`` is emitted. """ ON_CHANGED = "changed" """ Indicator for ``interactive`` parameter which runs the function every time one ``sigValueChanged`` is emitted from any of the parameters """ ON_CHANGING = "changing" """ Indicator for ``interactive`` parameter which runs the function every time one ``sigValueChanging`` is emitted from any of the parameters """ class InteractiveFunction: """ ``interact`` can be used with regular functions. However, when they are connected to changed or changing signals, there is no way to access these connections later to i.e. disconnect them temporarily. This utility class wraps a normal function but can provide an external scope for accessing the hooked up parameter signals. """ # Attributes below are populated by `update_wrapper` but aren't detected by linters __name__: str __qualname__: str def __init__(self, function, *, closures=None, **extra): """ Wraps a callable function in a way that forwards Parameter arguments as keywords Parameters ---------- function: callable Function to wrap closures: dict[str, callable] Arguments that shouldn't be constant, but can't be represented as a parameter. See the rst docs for more information. extra: dict extra keyword arguments to pass to ``function`` when this wrapper is called """ super().__init__() self.parameters = {} self.extra = extra self.function = function if closures is None: closures = {} self.closures = closures self._disconnected = False self.parametersNeedRunKwargs = False self.parameterCache = {} # No need for wrapper __dict__ to function as function.__dict__, since # Only __doc__, __name__, etc. attributes are required functools.update_wrapper(self, function, updated=()) def __call__(self, **kwargs): """ Calls ``self.function``. Extra, closures, and parameter keywords as defined on init and through :func:`InteractiveFunction.setParams` are forwarded during the call. """ if self.parametersNeedRunKwargs: self._updateParametersFromRunKwargs(**kwargs) runKwargs = self.extra.copy() runKwargs.update(self.parameterCache) for kk, vv in self.closures.items(): runKwargs[kk] = vv() runKwargs.update(**kwargs) return self.function(**runKwargs) def updateCachedParameterValues(self, param, value): """ This function is connected to ``sigChanged`` of every parameter associated with it. This way, those parameters don't have to be queried for their value every time InteractiveFunction is __call__'ed """ self.parameterCache[param.name()] = value def _updateParametersFromRunKwargs(self, **kwargs): """ Updates attached params from __call__ without causing additional function runs """ # Ensure updates don't cause firing of self's function wasDisconnected = self.disconnect() try: for kwarg in set(kwargs).intersection(self.parameters): self.parameters[kwarg].setValue(kwargs[kwarg]) finally: if not wasDisconnected: self.reconnect() for extraKey in set(kwargs) & set(self.extra): self.extra[extraKey] = kwargs[extraKey] def _disconnectParameter(self, param): param.sigValueChanged.disconnect(self.updateCachedParameterValues) for signal in (param.sigValueChanging, param.sigValueChanged): fn.disconnect(signal, self.runFromChangedOrChanging) def hookupParameters(self, params=None, clearOld=True): """ Binds a new set of parameters to this function. If ``clearOld`` is *True* ( default), previously bound parameters are disconnected. Parameters ---------- params: Sequence[Parameter] New parameters to listen for updates and optionally propagate keywords passed to :meth:`__call__` clearOld: bool If ``True``, previously hooked up parameters will be removed first """ if clearOld: self.removeParameters() for param in params: self.parameters[param.name()] = param param.sigValueChanged.connect(self.updateCachedParameterValues) # Populate initial values self.parameterCache[param.name()] = param.value() if param.hasValue() else None def removeParameters(self, clearCache=True): """ Disconnects from all signals of parameters in ``self.parameters``. Also, optionally clears the old cache of param values """ for p in self.parameters.values(): self._disconnectParameter(p) # Disconnected all old signals, clear out and get ready for new ones self.parameters.clear() if clearCache: self.parameterCache.clear() def runFromChangedOrChanging(self, param, value): if self._disconnected: return None # Since this request came from a parameter, ensure it's not propagated back # for efficiency and to avoid ``changing`` signals causing ``changed`` values oldPropagate = self.parametersNeedRunKwargs self.parametersNeedRunKwargs = False try: ret = self(**{param.name(): value}) finally: self.parametersNeedRunKwargs = oldPropagate return ret def runFromAction(self, **kwargs): if self._disconnected: return None return self(**kwargs) def disconnect(self): """ Simulates disconnecting the runnable by turning ``runFrom*`` functions into no-ops """ oldDisconnect = self._disconnected self._disconnected = True return oldDisconnect def setDisconnected(self, disconnected): """ Sets the disconnected state of the runnable, see :meth:`disconnect` and :meth:`reconnect` for more information """ oldDisconnect = self._disconnected self._disconnected = disconnected return oldDisconnect def reconnect(self): """Simulates reconnecting the runnable by re-enabling ``runFrom*`` functions""" oldDisconnect = self._disconnected self._disconnected = False return oldDisconnect def __str__(self): return f"{type(self).__name__}(`<{self.function.__name__}>`) at {hex(id(self))}" def __repr__(self): return ( str(self) + " with keys:\n" f"parameters={list(self.parameters)}, " f"extra={list(self.extra)}, " f"closures={list(self.closures)}" ) class Interactor: runOptions = RunOptions.ON_ACTION parent = None titleFormat = None nest = True existOk = True runActionTemplate = dict(type="action", defaultName="Run") _optionNames = [ "runOptions", "parent", "titleFormat", "nest", "existOk", "runActionTemplate", ] def __init__(self, **kwargs): """ Initializes an Interactor with initial keyword arguments which can be anything accepted by :meth:`setOpts` """ self.setOpts(**kwargs) def setOpts(self, **opts): """ Overrides the default options for this interactor. Note! This method should only be used if you spawn your own Interactor; do not call it on ``defaultInteractor``. Instead, use ``defaultInteractor.optsContext``, which is guaranteed to revert to the default options when the context expires. Parameters ---------- opts Keyword arguments to override the default options Returns ------- dict of previous options that were overridden. This is useful for resetting the options afterward. """ oldOpts = self.getOpts() allowed = set(oldOpts) errors = set(opts).difference(allowed) if errors: raise KeyError(f"Unrecognized options: {errors}. Must be one of: {allowed}") toReturn = {} toUse = {} for kk, vv in opts.items(): toReturn[kk] = oldOpts[kk] toUse[kk] = vv self.__dict__.update(toUse) return toReturn @contextlib.contextmanager def optsContext(self, **opts): """ Creates a new context for ``opts``, where each is reset to the old value when the context expires Parameters ---------- opts: Options to set, must be one of the keys in :attr:`_optNames` """ oldOpts = self.setOpts(**opts) yield self.setOpts(**oldOpts) def interact( self, function, *, ignores=None, runOptions=PARAM_UNSET, parent=PARAM_UNSET, titleFormat=PARAM_UNSET, nest=PARAM_UNSET, runActionTemplate=PARAM_UNSET, existOk=PARAM_UNSET, **overrides, ): """ Interacts with a function by making Parameters for each argument. There are several potential use cases and argument handling possibilities depending on which values are passed to this function, so a more detailed explanation of several use cases is provided in the "Interactive Parameters" doc. if any non-defaults exist, a value must be provided for them in ``overrides``. If this value should *not* be made into a parameter, include its name in ``ignores``. Parameters ---------- function: Callable function with which to interact. Can also be a :class:`InteractiveFunction`, if a reference to the bound signals is required. runOptions: ``GroupParameter.`` value How the function should be run, i.e. when pressing an action, on sigValueChanged, and/or on sigValueChanging ignores: Sequence Names of function arguments which shouldn't have parameters created parent: GroupParameter Parent in which to add argument Parameters. If *None*, a new group parameter is created. titleFormat: str or Callable title of the group sub-parameter if one must be created (see ``nest`` behavior). If a function is supplied, it must be of the form (str) -> str and will be passed the function name as an input nest: bool If *True*, the interacted function is given its own GroupParameter, and arguments to that function are 'nested' inside as its children. If *False*, function arguments are directly added to this parameter instead of being placed inside a child GroupParameter runActionTemplate: dict Template for the action parameter which runs the function, used if ``runOptions`` is set to ``GroupParameter.RUN_ACTION``. Note that if keys like "name" or "type" are not included, they are inferred from the previous / default ``runActionTemplate``. This allows items that should only be set per-function to exist here, like a ``shortcut`` or ``icon``. existOk: bool Whether it is OK for existing parameter names to bind to this function. See behavior during 'Parameter.insertChild' overrides: Override descriptions to provide additional parameter options for each argument. Moreover, extra parameters can be defined here if the original function uses ``**`` to consume additional keyword arguments. Each override can be a value (e.g. 5) or a dict specification of a parameter (e.g. dict(type='list', limits=[0, 10, 20])) """ # Special case: runActionTemplate can be overridden to specify action if runActionTemplate is not PARAM_UNSET: runActionTemplate = {**self.runActionTemplate, **runActionTemplate} # Get every overridden default locs = locals() # Everything until action template opts = {kk: locs[kk] for kk in self._optionNames if locs[kk] is not PARAM_UNSET} oldOpts = self.setOpts(**opts) # Delete explicitly since correct values are now ``self`` attributes del runOptions, titleFormat, nest, existOk, parent, runActionTemplate function = self._toInteractiveFunction(function) funcDict = self.functionToParameterDict(function.function, **overrides) children = funcDict.pop("children", []) # type: list[dict] chNames = [ch["name"] for ch in children] funcGroup = self._resolveFunctionGroup(funcDict, function) # Values can't come both from closures and overrides/params, so ensure they don't # get created if ignores is None: ignores = [] ignores = list(ignores) + list(function.closures) # Recycle ignored content that is needed as a value recycleNames = set(ignores) & set(chNames) for name in recycleNames: value = children[chNames.index(name)]["value"] if name not in function.extra and value is not PARAM_UNSET: function.extra[name] = value missingChildren = [ ch["name"] for ch in children if ch["value"] is PARAM_UNSET and ch["name"] not in function.closures and ch["name"] not in function.extra ] if missingChildren: # setOpts will not be called due to the value error, so reset here. # This only matters to restore Interactor state in an outer try-except # block self.setOpts(**oldOpts) raise ValueError( f"Cannot interact with `{function}` since it has required parameters " f"{missingChildren} with no default or closure values provided." ) useParams = [] checkNames = [n for n in chNames if n not in ignores] for name in checkNames: childOpts = children[chNames.index(name)] child = self.resolveAndHookupParameterChild(funcGroup, childOpts, function) if child is not None: useParams.append(child) function.hookupParameters(useParams) if RunOptions.ON_ACTION in self.runOptions: # Add an extra action child which can activate the function action = self._resolveRunAction(function, funcGroup, funcDict.get("tip")) if action: useParams.append(action) retValue = funcGroup if self.nest else useParams self.setOpts(**oldOpts) # Return either the parent which contains all added options, or the list # of created children (if no parent was created) return retValue @functools.wraps(interact) def __call__(self, function, **kwargs): return self.interact(function, **kwargs) def decorate(self, **kwargs): """ Calls :meth:`interact` and returns the :class:`InteractiveFunction`. Parameters ---------- kwargs Keyword arguments to pass to :meth:`interact` """ def decorator(function): if not isinstance(function, InteractiveFunction): function = InteractiveFunction(function) self.interact(function, **kwargs) return function return decorator def _nameToTitle(self, name, forwardStringTitle=False): """ Converts a function name to a title based on ``self.titleFormat``. Parameters ---------- name: str Name of the function forwardStringTitle: bool If ``self.titleFormat`` is a string and ``forwardStrTitle`` is True, ``self.titleFormat`` will be used as the title. Otherwise, if ``self.titleFormat`` is *None*, the name will be returned unchanged. Finally, if ``self.titleFormat`` is a callable, it will be called with the name as an input and the output will be returned """ titleFormat = self.titleFormat isString = isinstance(titleFormat, str) if titleFormat is None or (isString and not forwardStringTitle): return name elif isString: return titleFormat # else: titleFormat should be callable return titleFormat(name) def _resolveFunctionGroup(self, functionDict, interactiveFunction): """ Returns parent parameter that holds function children. May be ``None`` if no top parent is provided and nesting is disabled. """ funcGroup = self.parent if self.nest: funcGroup = Parameter.create(**functionDict) if self.parent: funcGroup = self.parent.addChild(funcGroup, existOk=self.existOk) funcGroup.sigActivated.connect(interactiveFunction.runFromAction) return funcGroup @staticmethod def _toInteractiveFunction(function): if isinstance(function, InteractiveFunction): # Nothing to do return function # If a reference isn't captured somewhere, garbage collection of the newly created # "InteractiveFunction" instance prevents connected signals from firing # Use a list in case multiple interact() calls are made with the same function interactive = InteractiveFunction(function) refOwner = function if not inspect.ismethod(function) else function.__func__ if hasattr(refOwner, "interactiveRefs"): refOwner.interactiveRefs.append(interactive) else: refOwner.interactiveRefs = [interactive] return interactive def resolveAndHookupParameterChild( self, functionGroup, childOpts, interactiveFunction ): if not functionGroup: child = Parameter.create(**childOpts) else: child = functionGroup.addChild(childOpts, existOk=self.existOk) if RunOptions.ON_CHANGED in self.runOptions: child.sigValueChanged.connect(interactiveFunction.runFromChangedOrChanging) if RunOptions.ON_CHANGING in self.runOptions: child.sigValueChanging.connect(interactiveFunction.runFromChangedOrChanging) return child def _resolveRunAction(self, interactiveFunction, functionGroup, functionTip): if isinstance(functionGroup, ActionGroupParameter): functionGroup.setButtonOpts(visible=True) child = None else: # Add an extra action child which can activate the function createOpts = self._makePopulatedActionTemplate( interactiveFunction.__name__, functionTip ) child = Parameter.create(**createOpts) child.sigActivated.connect(interactiveFunction.runFromAction) if functionGroup: functionGroup.addChild(child, existOk=self.existOk) return child def _makePopulatedActionTemplate(self, functionName="", functionTip=None): createOpts = self.runActionTemplate.copy() defaultName = createOpts.get("defaultName", "Run") name = defaultName if self.nest else functionName createOpts.setdefault("name", name) if functionTip: createOpts.setdefault("tip", functionTip) return createOpts def functionToParameterDict(self, function, **overrides): """ Converts a function into a list of child parameter dicts """ children = [] name = function.__name__ btnOpts = dict(**self._makePopulatedActionTemplate(name), visible=False) out = dict(name=name, type="_actiongroup", children=children, button=btnOpts) if self.titleFormat is not None: out["title"] = self._nameToTitle(name, forwardStringTitle=True) funcParams = inspect.signature(function).parameters if function.__doc__: # Reasonable "tip" default is the brief docstring description if it exists synopsis, _ = pydoc.splitdoc(function.__doc__) if synopsis: out.setdefault("tip", synopsis) out["button"].setdefault("tip", synopsis) # Make pyqtgraph parameter dicts from each parameter # Use list instead of funcParams.items() so kwargs can add to the iterable checkNames = list(funcParams) parameterKinds = [p.kind for p in funcParams.values()] _positional = inspect.Parameter.VAR_POSITIONAL _keyword = inspect.Parameter.VAR_KEYWORD if _keyword in parameterKinds: # Function accepts kwargs, so any overrides not already present as a function # parameter should be accepted # Remove the keyword parameter since it can't be parsed properly # Kwargs must appear at the end of the parameter list del checkNames[-1] notInSignature = [n for n in overrides if n not in checkNames] checkNames.extend(notInSignature) if _positional in parameterKinds: # *args is also difficult to handle for key-value paradigm # and will mess with the logic for detecting whether any parameter # is left unfilled del checkNames[parameterKinds.index(_positional)] for name in checkNames: # May be none if this is an override name after function accepted kwargs param = funcParams.get(name) pgDict = self.createFunctionParameter(name, param, overrides.get(name, {})) children.append(pgDict) return out def createFunctionParameter(self, name, signatureParameter, overridesInfo): """ Constructs a dict ready for insertion into a group parameter based on the provided information in the ``inspect.signature`` parameter, user-specified overrides, and true parameter name. Parameter signature information is considered the most "overridable", followed by documentation specifications. User overrides should be given the highest priority, i.e. not usurped by parameter default information. Parameters ---------- name : str Name of the parameter, comes from function signature signatureParameter : inspect.Parameter Information from the function signature, parsed by ``inspect`` overridesInfo : dict User-specified overrides for this parameter. Can be a dict of options accepted by :class:`~pyqtgraph.parametertree.Parameter` or a value """ if ( signatureParameter is not None and signatureParameter.default is not signatureParameter.empty ): # Maybe the user never specified type and value, since they can come # directly from the default Also, maybe override was a value without a # type, so give a sensible default default = signatureParameter.default signatureDict = {"value": default, "type": type(default).__name__} else: signatureDict = {} # Doc takes precedence over signature for any value information pgDict = signatureDict.copy() if not isinstance(overridesInfo, dict): overridesInfo = {"value": overridesInfo} # Overrides take precedence over doc and signature pgDict.update(overridesInfo) # Name takes the highest precedence since it must be bindable to a function # argument pgDict["name"] = name # Required function arguments with any override specifications can still be # unfilled at this point pgDict.setdefault("value", PARAM_UNSET) # Anywhere a title is specified should take precedence over the default factory if self.titleFormat is not None: pgDict.setdefault("title", self._nameToTitle(name)) pgDict.setdefault("type", type(pgDict["value"]).__name__) return pgDict def __str__(self): return f"Interactor with opts: {self.getOpts()}" def __repr__(self): return str(self) def getOpts(self): return {attr: getattr(self, attr) for attr in self._optionNames} interact = Interactor() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/000077500000000000000000000000001457240071200255215ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/__init__.py000066400000000000000000000051551457240071200276400ustar00rootroot00000000000000from ..Parameter import registerParameterType from .action import ActionParameter, ActionParameterItem from .actiongroup import ActionGroup, ActionGroupParameter, ActionGroupParameterItem from .basetypes import ( GroupParameter, GroupParameterItem, SimpleParameter, WidgetParameterItem, ) from .bool import BoolParameterItem from .calendar import CalendarParameter, CalendarParameterItem from .checklist import ChecklistParameter, ChecklistParameterItem from .color import ColorParameter, ColorParameterItem from .colormap import ColorMapParameter, ColorMapParameterItem from .colormaplut import ColorMapLutParameter, ColorMapLutParameterItem from .file import FileParameter, FileParameterItem from .font import FontParameter, FontParameterItem from .list import ListParameter, ListParameterItem from .numeric import NumericParameterItem from .pen import PenParameter, PenParameterItem from .progress import ProgressBarParameter, ProgressBarParameterItem from .qtenum import QtEnumParameter from .slider import SliderParameter, SliderParameterItem from .str import StrParameterItem from .text import TextParameter, TextParameterItem registerParameterType('group', GroupParameter, override=True) # Keep actiongroup private for now, mainly useful for Interactor but not externally registerParameterType('_actiongroup', ActionGroupParameter, override=True) registerParameterType('action', ActionParameter, override=True) registerParameterType('bool', SimpleParameter, override=True) registerParameterType('calendar', CalendarParameter, override=True) registerParameterType('checklist', ChecklistParameter, override=True) registerParameterType('cmaplut', ColorMapLutParameter, override=True) registerParameterType('color', ColorParameter, override=True) registerParameterType('colormap', ColorMapParameter, override=True) registerParameterType('file', FileParameter, override=True) registerParameterType('float', SimpleParameter, override=True) registerParameterType('font', FontParameter, override=True) registerParameterType('int', SimpleParameter, override=True) registerParameterType('list', ListParameter, override=True) registerParameterType('pen', PenParameter, override=True) registerParameterType('progress', ProgressBarParameter, override=True) # qtenum is a bit specific, hold off on registering for now registerParameterType('slider', SliderParameter, override=True) registerParameterType('str', SimpleParameter, override=True) registerParameterType('text', TextParameter, override=True) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/action.py000066400000000000000000000067311457240071200273570ustar00rootroot00000000000000from ...Qt import QtCore, QtWidgets, QtGui from ..Parameter import Parameter from ..ParameterItem import ParameterItem class ParameterControlledButton(QtWidgets.QPushButton): settableAttributes = { "title", "tip", "icon", "shortcut", "enabled", "visible" } def __init__(self, parameter=None, parent=None): super().__init__(parent) if not parameter: return parameter.sigNameChanged.connect(self.onNameChange) parameter.sigOptionsChanged.connect(self.updateOpts) self.clicked.connect(parameter.activate) self.updateOpts(parameter, parameter.opts) def updateOpts(self, param, opts): # Of the attributes that can be set on a QPushButton, only the text # and tooltip attributes are different from standard pushbutton names nameMap = dict(title="text", tip="toolTip") # Special case: "title" could be none, in which case make it something # readable by the simple copy-paste logic later opts = opts.copy() if "name" in opts: opts.setdefault("title", opts["name"]) if "title" in opts and opts["title"] is None: opts["title"] = param.title() # Another special case: icons should be loaded from data before # being passed to the button if "icon" in opts: opts["icon"] = QtGui.QIcon(opts["icon"]) for attr in self.settableAttributes.intersection(opts): buttonAttr = nameMap.get(attr, attr) capitalized = buttonAttr[0].upper() + buttonAttr[1:] setter = getattr(self, f"set{capitalized}") setter(opts[attr]) def onNameChange(self, param, name): self.updateOpts(param, dict(title=param.title())) class ActionParameterItem(ParameterItem): """ParameterItem displaying a clickable button.""" def __init__(self, param, depth): ParameterItem.__init__(self, param, depth) self.layoutWidget = QtWidgets.QWidget() self.layout = QtWidgets.QHBoxLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.layoutWidget.setLayout(self.layout) self.button = ParameterControlledButton(param, self.layoutWidget) #self.layout.addSpacing(100) self.layout.addWidget(self.button) self.layout.addStretch() self.titleChanged() def treeWidgetChanged(self): ParameterItem.treeWidgetChanged(self) tree = self.treeWidget() if tree is None: return self.setFirstColumnSpanned(True) tree.setItemWidget(self, 0, self.layoutWidget) def titleChanged(self): self.setSizeHint(0, self.button.sizeHint()) class ActionParameter(Parameter): """ Used for displaying a button within the tree. ``sigActivated(self)`` is emitted when the button is clicked. Parameters ---------- icon: str Icon to display in the button. Can be any argument accepted by :class:`QIcon `. shortcut: str Key sequence to use as a shortcut for the button. Note that this shortcut is associated with spawned parameters, i.e. the shortcut will only work when this parameter has an item in a tree that is visible. Can be set to any string accepted by :class:`QKeySequence `. """ itemClass = ActionParameterItem sigActivated = QtCore.Signal(object) def activate(self): self.sigActivated.emit(self) self.emitStateChanged('activated', None) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/actiongroup.py000066400000000000000000000046231457240071200304320ustar00rootroot00000000000000import warnings from ...Qt import QtCore from .action import ParameterControlledButton from .basetypes import GroupParameter, GroupParameterItem from ..ParameterItem import ParameterItem from ...Qt import QtCore, QtWidgets class ActionGroupParameterItem(GroupParameterItem): """ Wraps a :class:`GroupParameterItem` to manage function parameters created by an interactor. Provies a button widget which mimics an ``action`` parameter. """ def __init__(self, param, depth): self.itemWidget = QtWidgets.QWidget() self.button = ParameterControlledButton(parent=self.itemWidget) self.button.clicked.connect(param.activate) self.itemWidget.setLayout(layout := QtWidgets.QHBoxLayout()) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.button) super().__init__(param, depth) def treeWidgetChanged(self): ParameterItem.treeWidgetChanged(self) tw = self.treeWidget() if tw is None: return tw.setItemWidget(self, 1, self.itemWidget) def optsChanged(self, param, opts): if "button" in opts: buttonOpts = opts["button"] or dict(visible=False) self.button.updateOpts(param, buttonOpts) super().optsChanged(param, opts) class ActionGroupParameter(GroupParameter): itemClass = ActionGroupParameterItem sigActivated = QtCore.Signal(object) def __init__(self, **opts): opts.setdefault("button", {}) super().__init__(**opts) def activate(self): self.sigActivated.emit(self) self.emitStateChanged('activated', None) def setButtonOpts(self, **opts): """ Update individual button options without replacing the entire button definition. """ buttonOpts = self.opts.get("button", {}).copy() buttonOpts.update(opts) self.setOpts(button=buttonOpts) class ActionGroup(ActionGroupParameter): sigActivated = QtCore.Signal() def __init__(self, **opts): warnings.warn( "`ActionGroup` is deprecated and will be removed in the first release after " "January 2023. Use `ActionGroupParameter` instead. See " "https://github.com/pyqtgraph/pyqtgraph/pull/2505 for details.", DeprecationWarning, stacklevel=2, ) super().__init__(**opts) def activate(self): self.sigActivated.emit() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/basetypes.py000066400000000000000000000367361457240071200301110ustar00rootroot00000000000000import builtins from ... import functions as fn from ... import icons from ...Qt import QtCore, QtWidgets from ..Parameter import Parameter from ..ParameterItem import ParameterItem class WidgetParameterItem(ParameterItem): """ ParameterTree item with: * label in second column for displaying value * simple widget for editing value (displayed instead of label when item is selected) * button that resets value to default This class can be subclassed by overriding makeWidget() to provide a custom widget. """ def __init__(self, param, depth): ParameterItem.__init__(self, param, depth) self.asSubItem = False # place in a child item's column 0 instead of column 1 self.hideWidget = True ## hide edit widget, replace with label when not selected ## set this to False to keep the editor widget always visible # build widget with a display label and default button w = self.makeWidget() self.widget = w self.eventProxy = EventProxy(w, self.widgetEventFilter) if self.asSubItem: self.subItem = QtWidgets.QTreeWidgetItem() self.subItem.depth = self.depth + 1 self.subItem.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) self.addChild(self.subItem) self.defaultBtn = self.makeDefaultButton() self.displayLabel = QtWidgets.QLabel() layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(2) if not self.asSubItem: layout.addWidget(w, 1) layout.addWidget(self.displayLabel, 1) layout.addStretch(0) layout.addWidget(self.defaultBtn) self.layoutWidget = QtWidgets.QWidget() self.layoutWidget.setLayout(layout) if w.sigChanged is not None: w.sigChanged.connect(self.widgetValueChanged) if hasattr(w, 'sigChanging'): w.sigChanging.connect(self.widgetValueChanging) ## update value shown in widget. opts = self.param.opts if opts.get('value', None) is not None: self.valueChanged(self, opts['value'], force=True) else: ## no starting value was given; use whatever the widget has self.widgetValueChanged() self.updateDefaultBtn() self.optsChanged(self.param, self.param.opts) # set size hints sw = self.widget.sizeHint() sb = self.defaultBtn.sizeHint() # shrink row heights a bit for more compact look sw.setHeight(int(sw.height() * 0.9)) sb.setHeight(int(sb.height() * 0.9)) if self.asSubItem: self.setSizeHint(1, sb) self.subItem.setSizeHint(0, sw) else: w = sw.width() + sb.width() h = max(sw.height(), sb.height()) self.setSizeHint(1, QtCore.QSize(w, h)) def makeWidget(self): """ Return a single widget whose position in the tree is determined by the value of self.asSubItem. If True, it will be placed in the second tree column, and if False, the first tree column of a child item. The widget must be given three attributes: ========== ============================================================ sigChanged a signal that is emitted when the widget's value is changed value a function that returns the value setValue a function that sets the value ========== ============================================================ This function must be overridden by a subclass. """ raise NotImplementedError def widgetEventFilter(self, obj, ev): ## filter widget's events ## catch TAB to change focus ## catch focusOut to hide editor if ev.type() == ev.Type.KeyPress: if ev.key() == QtCore.Qt.Key.Key_Tab: self.focusNext(forward=True) return True ## don't let anyone else see this event elif ev.key() == QtCore.Qt.Key.Key_Backtab: self.focusNext(forward=False) return True ## don't let anyone else see this event return False def makeDefaultButton(self): defaultBtn = QtWidgets.QPushButton() defaultBtn.setAutoDefault(False) defaultBtn.setFixedWidth(20) defaultBtn.setFixedHeight(20) defaultBtn.setIcon(icons.getGraphIcon('default')) defaultBtn.clicked.connect(self.defaultClicked) return defaultBtn def setFocus(self): self.showEditor() def isFocusable(self): return self.param.opts['visible'] and self.param.opts['enabled'] and self.param.writable() def valueChanged(self, param, val, force=False): ## called when the parameter's value has changed ParameterItem.valueChanged(self, param, val) if force or not fn.eq(val, self.widget.value()): try: if self.widget.sigChanged is not None: self.widget.sigChanged.disconnect(self.widgetValueChanged) self.param.sigValueChanged.disconnect(self.valueChanged) self.widget.setValue(val) self.param.setValue(self.widget.value()) finally: if self.widget.sigChanged is not None: self.widget.sigChanged.connect(self.widgetValueChanged) self.param.sigValueChanged.connect(self.valueChanged) self.updateDisplayLabel() ## always make sure label is updated, even if values match! self.updateDefaultBtn() def updateDefaultBtn(self): self.defaultBtn.setEnabled( self.param.valueModifiedSinceResetToDefault() and self.param.opts['enabled'] and self.param.writable()) self.defaultBtn.setVisible(self.param.hasDefault() and not self.param.readonly()) def updateDisplayLabel(self, value=None): """Update the display label to reflect the value of the parameter.""" if value is None: value = self.param.value() self.displayLabel.setText(str(value)) def widgetValueChanged(self): ## called when the widget's value has been changed by the user val = self.widget.value() self.param.setValue(val) def widgetValueChanging(self, *args): """ Called when the widget's value is changing, but not finalized. For example: editing text before pressing enter or changing focus. """ self.param.sigValueChanging.emit(self.param, self.widget.value()) def selected(self, sel): """Called when this item has been selected (sel=True) OR deselected (sel=False)""" ParameterItem.selected(self, sel) if self.widget is None: return if sel and self.param.writable(): self.showEditor() elif self.hideWidget: self.hideEditor() def showEditor(self): self.widget.show() self.displayLabel.hide() self.widget.setFocus(QtCore.Qt.FocusReason.OtherFocusReason) def hideEditor(self): self.widget.hide() self.displayLabel.show() def limitsChanged(self, param, limits): """Called when the parameter's limits have changed""" ParameterItem.limitsChanged(self, param, limits) def defaultChanged(self, param, value): self.updateDefaultBtn() def treeWidgetChanged(self): """Called when this item is added or removed from a tree.""" ParameterItem.treeWidgetChanged(self) ## add all widgets for this item into the tree if self.widget is not None: tree = self.treeWidget() if tree is None: return if self.asSubItem: self.subItem.setFirstColumnSpanned(True) tree.setItemWidget(self.subItem, 0, self.widget) tree.setItemWidget(self, 1, self.layoutWidget) self.displayLabel.hide() self.selected(False) def defaultClicked(self): self.param.setToDefault() self.updateDefaultBtn() def optsChanged(self, param, opts): """Called when any options are changed that are not name, value, default, or limits""" ParameterItem.optsChanged(self, param, opts) if 'enabled' in opts: self.updateDefaultBtn() self.widget.setEnabled(opts['enabled']) if 'readonly' in opts: self.updateDefaultBtn() if opts['readonly']: self.displayLabel.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.TextSelectableByMouse) else: self.displayLabel.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.LinksAccessibleByMouse) if hasattr(self.widget, 'setReadOnly'): self.widget.setReadOnly(opts['readonly']) else: self.widget.setEnabled(self.param.opts['enabled'] and not opts['readonly']) if 'tip' in opts: self.widget.setToolTip(opts['tip']) class EventProxy(QtCore.QObject): def __init__(self, qobj, callback): QtCore.QObject.__init__(self) self.callback = callback qobj.installEventFilter(self) def eventFilter(self, obj, ev): return self.callback(obj, ev) class SimpleParameter(Parameter): """ Parameter representing a single value. This parameter is backed by :class:`~pyqtgraph.parametertree.parameterTypes.basetypes.WidgetParameterItem` to represent the following parameter names through various subclasses: - 'int' - 'float' - 'bool' - 'str' - 'color' - 'colormap' """ @property def itemClass(self): from .bool import BoolParameterItem from .numeric import NumericParameterItem from .str import StrParameterItem return { 'bool': BoolParameterItem, 'int': NumericParameterItem, 'float': NumericParameterItem, 'str': StrParameterItem, }[self.opts['type']] def _interpretValue(self, v): typ = self.opts['type'] def _missing_interp(v): # Assume raw interpretation return v # Or: # raise TypeError(f'No interpreter found for type {typ}') interpreter = getattr(builtins, typ, _missing_interp) return interpreter(v) class GroupParameterItem(ParameterItem): """ Group parameters are used mainly as a generic parent item that holds (and groups!) a set of child parameters. It also provides a simple mechanism for displaying a button or combo that can be used to add new parameters to the group. """ def __init__(self, param, depth): ParameterItem.__init__(self, param, depth) self._initialFontPointSize = self.font(0).pointSize() self.updateDepth(depth) self.addItem = None if 'addText' in param.opts: addText = param.opts['addText'] if 'addList' in param.opts: self.addWidget = QtWidgets.QComboBox() self.addWidget.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToContents) self.updateAddList() self.addWidget.currentIndexChanged.connect(self.addChanged) else: self.addWidget = QtWidgets.QPushButton(addText) self.addWidget.clicked.connect(self.addClicked) w = QtWidgets.QWidget() l = QtWidgets.QHBoxLayout() l.setContentsMargins(0, 0, 0, 0) w.setLayout(l) l.addWidget(self.addWidget) l.addStretch() self.addWidgetBox = w self.addItem = QtWidgets.QTreeWidgetItem([]) self.addItem.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.addItem.depth = self.depth + 1 ParameterItem.addChild(self, self.addItem) self.addItem.setSizeHint(0, self.addWidgetBox.sizeHint()) self.optsChanged(self.param, self.param.opts) def pointSize(self): return self._initialFontPointSize def updateDepth(self, depth): """ Change set the item font to bold and increase the font size on outermost groups. """ for c in [0, 1]: font = self.font(c) font.setBold(True) if depth == 0: font.setPointSize(self.pointSize() + 1) self.setFont(c, font) self.titleChanged() # sets the size hint for column 0 which is based on the new font def addClicked(self): """Called when "add new" button is clicked The parameter MUST have an 'addNew' method defined. """ self.param.addNew() def addChanged(self): """Called when "add new" combo is changed The parameter MUST have an 'addNew' method defined. """ if self.addWidget.currentIndex() == 0: return typ = self.addWidget.currentText() self.param.addNew(typ) self.addWidget.setCurrentIndex(0) def treeWidgetChanged(self): ParameterItem.treeWidgetChanged(self) tw = self.treeWidget() if tw is None: return self.setFirstColumnSpanned(True) if self.addItem is not None: tw.setItemWidget(self.addItem, 0, self.addWidgetBox) self.addItem.setFirstColumnSpanned(True) def addChild(self, child): ## make sure added childs are actually inserted before add btn if self.addItem is not None: ParameterItem.insertChild(self, self.childCount() - 1, child) else: ParameterItem.addChild(self, child) def optsChanged(self, param, opts): ParameterItem.optsChanged(self, param, opts) if 'addList' in opts: self.updateAddList() if hasattr(self, 'addWidget'): if 'enabled' in opts: self.addWidget.setEnabled(opts['enabled']) if 'tip' in opts: self.addWidget.setToolTip(opts['tip']) def updateAddList(self): self.addWidget.blockSignals(True) try: self.addWidget.clear() self.addWidget.addItem(self.param.opts['addText']) for t in self.param.opts['addList']: self.addWidget.addItem(t) finally: self.addWidget.blockSignals(False) class GroupParameter(Parameter): """ Group parameters are used mainly as a generic parent item that holds (and groups!) a set of child parameters. It also provides a simple mechanism for displaying a button or combo that can be used to add new parameters to the group. To enable this, the group must be initialized with the 'addText' option (the text will be displayed on a button which, when clicked, will cause addNew() to be called). If the 'addList' option is specified as well, then a dropdown-list of addable items will be displayed instead of a button. """ itemClass = GroupParameterItem sigAddNew = QtCore.Signal(object, object) # self, type def addNew(self, typ=None): """ This method is called when the user has requested to add a new item to the group. By default, it emits ``sigAddNew(self, typ)``. """ self.sigAddNew.emit(self, typ) def setAddList(self, vals): """Change the list of options available for the user to add to the group.""" self.setOpts(addList=vals) class Emitter(QtCore.QObject): """ WidgetParameterItem is not a QObject, so create a QObject wrapper that items can use for emitting """ sigChanging = QtCore.Signal(object, object) sigChanged = QtCore.Signal(object, object) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/bool.py000066400000000000000000000006161457240071200270310ustar00rootroot00000000000000from ...Qt import QtWidgets from .basetypes import WidgetParameterItem class BoolParameterItem(WidgetParameterItem): """ Registered parameter type which displays a QCheckBox """ def makeWidget(self): w = QtWidgets.QCheckBox() w.sigChanged = w.toggled w.value = w.isChecked w.setValue = w.setChecked self.hideWidget = False return w pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/calendar.py000066400000000000000000000037041457240071200276500ustar00rootroot00000000000000from ...Qt import QtCore, QtWidgets from ..Parameter import Parameter from .basetypes import WidgetParameterItem class CalendarParameterItem(WidgetParameterItem): def makeWidget(self): self.asSubItem = True w = QtWidgets.QCalendarWidget() w.setMaximumHeight(200) w.sigChanged = w.selectionChanged w.value = w.selectedDate w.setValue = w.setSelectedDate self.hideWidget = False self.param.opts.setdefault('default', QtCore.QDate.currentDate()) return w class CalendarParameter(Parameter): """ Displays a Qt calendar whose date is specified by a 'format' option. ============== ======================================================== **Options:** format Format for displaying the date and converting from a string. Can be any value accepted by `QDate.toString` and `fromString`, or a stringified version of a QDateFormat enum, i.e. 'ISODate', 'TextDate' (default), etc. ============== ======================================================== """ itemClass = CalendarParameterItem def __init__(self, **opts): opts.setdefault('format', 'TextDate') super().__init__(**opts) def _interpretFormat(self, fmt=None): fmt = fmt or self.opts.get('format') if hasattr(QtCore.Qt.DateFormat, fmt): fmt = getattr(QtCore.Qt.DateFormat, fmt) return fmt def _interpretValue(self, v): if isinstance(v, str): fmt = self._interpretFormat() if fmt is None: raise ValueError('Cannot parse date string without a set format') v = QtCore.QDate.fromString(v, fmt) return v def saveState(self, filter=None): state = super().saveState(filter) fmt = self._interpretFormat() if state.get('value', None) is not None: state['value'] = state['value'].toString(fmt) return state pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/checklist.py000066400000000000000000000272571457240071200300610ustar00rootroot00000000000000from ... import functions as fn from ...Qt import QtWidgets from ...SignalProxy import SignalProxy from ..ParameterItem import ParameterItem from . import BoolParameterItem, SimpleParameter from .basetypes import Emitter, GroupParameter, GroupParameterItem, WidgetParameterItem from .list import ListParameter class ChecklistParameterItem(GroupParameterItem): """ Wraps a :class:`GroupParameterItem` to manage ``bool`` parameter children. Also provides convenience buttons to select or clear all values at once. Note these conveniences are disabled when ``exclusive`` is *True*. """ def __init__(self, param, depth): self.btnGrp = QtWidgets.QButtonGroup() self.btnGrp.setExclusive(False) self._constructMetaBtns() super().__init__(param, depth) def _constructMetaBtns(self): self.metaBtnWidget = QtWidgets.QWidget() self.metaBtnLayout = lay = QtWidgets.QHBoxLayout(self.metaBtnWidget) lay.setContentsMargins(0, 0, 0, 0) lay.setSpacing(2) self.metaBtns = {} lay.addStretch(0) for title in 'Clear', 'Select': self.metaBtns[title] = btn = QtWidgets.QPushButton(f'{title} All') self.metaBtnLayout.addWidget(btn) btn.clicked.connect(getattr(self, f'{title.lower()}AllClicked')) self.metaBtns['default'] = self.makeDefaultButton() self.metaBtnLayout.addWidget(self.metaBtns['default']) def treeWidgetChanged(self): ParameterItem.treeWidgetChanged(self) tw = self.treeWidget() if tw is None: return tw.setItemWidget(self, 1, self.metaBtnWidget) def selectAllClicked(self): # timer stop: see explanation on param.setToDefault() self.param.valChangingProxy.timer.stop() self.param.setValue(self.param.reverse[0]) def clearAllClicked(self): # timer stop: see explanation on param.setToDefault() self.param.valChangingProxy.timer.stop() self.param.setValue([]) def insertChild(self, pos, item): ret = super().insertChild(pos, item) self.btnGrp.addButton(item.widget) return ret def addChild(self, item): ret = super().addChild(item) self.btnGrp.addButton(item.widget) return ret def takeChild(self, i): child = super().takeChild(i) self.btnGrp.removeButton(child.widget) def optsChanged(self, param, opts): super().optsChanged(param, opts) if 'expanded' in opts: for btn in self.metaBtns.values(): btn.setVisible(opts['expanded']) exclusive = opts.get('exclusive', param.opts['exclusive']) enabled = opts.get('enabled', param.opts['enabled']) for name, btn in self.metaBtns.items(): if name != 'default': btn.setDisabled(exclusive or (not enabled)) self.btnGrp.setExclusive(exclusive) # "Limits" will force update anyway, no need to duplicate if it's present if 'limits' not in opts and ('enabled' in opts or 'readonly' in opts): self.updateDefaultBtn() def expandedChangedEvent(self, expanded): for btn in self.metaBtns.values(): btn.setVisible(expanded) def valueChanged(self, param, val): self.updateDefaultBtn() def updateDefaultBtn(self): self.metaBtns["default"].setEnabled( not self.param.valueIsDefault() and self.param.opts["enabled"] and self.param.writable() ) return makeDefaultButton = WidgetParameterItem.makeDefaultButton defaultClicked = WidgetParameterItem.defaultClicked class RadioParameterItem(BoolParameterItem): """ Allows radio buttons to function as booleans when `exclusive` is *True* """ def __init__(self, param, depth): self.emitter = Emitter() super().__init__(param, depth) def makeWidget(self): w = QtWidgets.QRadioButton() w.value = w.isChecked # Since these are only used during exclusive operations, only fire a signal when "True" # to avoid a double-fire w.setValue = w.setChecked w.sigChanged = self.emitter.sigChanged w.toggled.connect(self.maybeSigChanged) self.hideWidget = False return w def maybeSigChanged(self, val): """ Make sure to only activate on a "true" value, since an exclusive button group fires once to deactivate the old option and once to activate the new selection """ if not val: return self.emitter.sigChanged.emit(self, val) # Proxy around radio/bool type so the correct item class gets instantiated class BoolOrRadioParameter(SimpleParameter): @property def itemClass(self): if self.opts.get('type') == 'bool': return BoolParameterItem else: return RadioParameterItem class ChecklistParameter(GroupParameter): """ Can be set just like a :class:`ListParameter`, but allows for multiple values to be selected simultaneously. ============== ======================================================== **Options** exclusive When *False*, any number of options can be selected. The resulting ``value()`` is a list of all checked values. When *True*, it behaves like a ``list`` type -- only one value can be selected. If no values are selected and ``exclusive`` is set to *True*, the first available limit is selected. The return value of an ``exclusive`` checklist is a single value rather than a list with one element. delay Controls the wait time between editing the checkboxes/radio button children and firing a "value changed" signal. This allows users to edit multiple boxes at once for a single value update. ============== ======================================================== """ itemClass = ChecklistParameterItem def __init__(self, **opts): # Child options are populated through values, not explicit "children" if 'children' in opts: raise ValueError( "Cannot pass 'children' to ChecklistParameter. Pass a 'value' key only." ) self.targetValue = None limits = opts.setdefault('limits', []) self.forward, self.reverse = ListParameter.mapping(limits) value = opts.setdefault('value', limits) opts.setdefault('exclusive', False) super().__init__(**opts) # Force 'exclusive' to trigger by making sure value is not the same self.sigLimitsChanged.connect(self.updateLimits) self.sigOptionsChanged.connect(self.optsChanged) if len(limits): # Since update signal wasn't hooked up until after parameter construction, need to fire manually self.updateLimits(self, limits) # Also, value calculation will be incorrect until children are added, so make sure to recompute self.setValue(value) self.valChangingProxy = SignalProxy( self.sigValueChanging, delay=opts.get('delay', 1.0), slot=self._finishChildChanges, threadSafe=False, ) def childrenValue(self): vals = [self.forward[p.name()] for p in self.children() if p.value()] exclusive = self.opts['exclusive'] if not vals and exclusive: return None elif exclusive: return vals[0] else: return vals def _onChildChanging(self, child, value): # When exclusive, ensure only this value is True if self.opts['exclusive'] and value: value = self.forward[child.name()] else: value = self.childrenValue() self.sigValueChanging.emit(self, value) def updateLimits(self, _param, limits): oldOpts = self.names val = self.opts.get('value', None) # Make sure adding and removing children don't cause tree state changes self.blockTreeChangeSignal() self.clearChildren() self.forward, self.reverse = ListParameter.mapping(limits) if self.opts.get('exclusive'): typ = 'radio' else: typ = 'bool' for chName in self.forward: # Recycle old values if they match the new limits newVal = bool(oldOpts.get(chName, False)) child = BoolOrRadioParameter(type=typ, name=chName, value=newVal, default=None) self.addChild(child) # Prevent child from broadcasting tree state changes, since this is handled by self child.blockTreeChangeSignal() child.sigValueChanged.connect(self._onChildChanging) # Purge child changes before unblocking self.treeStateChanges.clear() self.unblockTreeChangeSignal() self.setValue(val) def _finishChildChanges(self, paramAndValue): param, value = paramAndValue # Interpret value, fire sigValueChanged return self.setValue(value) def optsChanged(self, param, opts): if 'exclusive' in opts: self.updateLimits(None, self.opts.get('limits', [])) if 'delay' in opts: self.valChangingProxy.setDelay(opts['delay']) def setValue(self, value, blockSignal=None): self.targetValue = value if not isinstance(value, list): value = [value] names, values = self._intersectionWithLimits(value) valueToSet = values if self.opts['exclusive']: if len(self.forward): # Exclusive means at least one entry must exist, grab from limits # if they exist names.append(self.reverse[1][0]) if len(names) > 1: names = names[:1] if not len(names): valueToSet = None else: valueToSet = self.forward[names[0]] for chParam in self: checked = chParam.name() in names # Will emit at the end, so no problem discarding existing changes chParam.setValue(checked, self._onChildChanging) super().setValue(valueToSet, blockSignal) def _intersectionWithLimits(self, values: list): """ Returns the (names, values) from limits that intersect with ``values``. """ allowedNames = [] allowedValues = [] # Could be replaced by "value in self.reverse[0]" and "reverse[0].index", # but this allows for using pg.eq to cover more diverse value options for val in values: for limitName, limitValue in zip(*self.reverse): if fn.eq(limitValue, val): allowedNames.append(limitName) allowedValues.append(val) break return allowedNames, allowedValues def setToDefault(self): # Since changing values are covered by a proxy, this method must be overridden # to flush changes. Otherwise, setting to default while waiting for changes # to finalize will override the request to take default values self.valChangingProxy.timer.stop() super().setToDefault() def saveState(self, filter=None): # Unlike the normal GroupParameter, child states shouldn't be separately # preserved state = super().saveState(filter) state.pop("children", None) return state def restoreState( self, state, recursive=True, addChildren=True, removeChildren=True, blockSignals=True ): # Child management shouldn't happen through state return super().restoreState( state, recursive, addChildren=False, removeChildren=False, blockSignals=blockSignals ) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/color.py000066400000000000000000000017241457240071200272150ustar00rootroot00000000000000from ... import functions as fn from ...widgets.ColorButton import ColorButton from .basetypes import SimpleParameter, WidgetParameterItem class ColorParameterItem(WidgetParameterItem): """Registered parameter type which displays a :class:`ColorButton ` """ def makeWidget(self): w = ColorButton() w.sigChanged = w.sigColorChanged w.sigChanging = w.sigColorChanging w.value = w.color w.setValue = w.setColor self.hideWidget = False w.setFlat(True) return w class ColorParameter(SimpleParameter): itemClass = ColorParameterItem def _interpretValue(self, v): return fn.mkColor(v) def value(self): value = super().value() if value is None: return None return fn.mkColor(value) def saveState(self, filter=None): state = super().saveState(filter) state['value'] = self.value().getRgb() return state pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/colormap.py000066400000000000000000000017041457240071200277110ustar00rootroot00000000000000from ...colormap import ColorMap from ...Qt import QtCore from ...widgets.GradientWidget import GradientWidget from .basetypes import SimpleParameter, WidgetParameterItem class ColorMapParameterItem(WidgetParameterItem): """Registered parameter type which displays a :class:`GradientWidget `""" def makeWidget(self): w = GradientWidget(orientation='bottom') w.sizeHint = lambda: QtCore.QSize(300, 35) w.sigChanged = w.sigGradientChangeFinished w.sigChanging = w.sigGradientChanged w.value = w.colorMap w.setValue = w.setColorMap self.hideWidget = False self.asSubItem = True return w class ColorMapParameter(SimpleParameter): itemClass = ColorMapParameterItem def _interpretValue(self, v): if v is not None and not isinstance(v, ColorMap): raise TypeError("Cannot set colormap parameter from object %r" % v) return v pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/colormaplut.py000066400000000000000000000013471457240071200304410ustar00rootroot00000000000000from ... import colormap from ...widgets.ColorMapButton import ColorMapButton from .basetypes import Parameter, WidgetParameterItem class ColorMapLutParameterItem(WidgetParameterItem): def makeWidget(self): w = ColorMapButton() w.sigChanged = w.sigColorMapChanged w.value = w.colorMap w.setValue = w.setColorMap self.hideWidget = False return w class ColorMapLutParameter(Parameter): itemClass = ColorMapLutParameterItem def _interpretValue(self, v): if isinstance(v, str): v = colormap.get(v) if v is not None and not isinstance(v, colormap.ColorMap): raise TypeError("Cannot set colormap parameter from object %r" % v) return v pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/file.py000066400000000000000000000176251457240071200270250ustar00rootroot00000000000000import os import re from ...Qt import QtCore, QtGui, QtWidgets from ..Parameter import Parameter from .str import StrParameterItem def _set_filepicker_kwargs(fileDlg, **kwargs): """Applies a dict of enum/flag kwarg opts to a file dialog""" NO_MATCH = object() for kk, vv in kwargs.items(): # Convert string or list representations into true flags # 'fileMode' -> 'FileMode' formattedName = kk[0].upper() + kk[1:] # Edge case: "Options" has enum "Option" if formattedName == 'Options': enumCls = fileDlg.Option else: enumCls = getattr(fileDlg, formattedName, NO_MATCH) setFunc = getattr(fileDlg, f'set{formattedName}', NO_MATCH) if enumCls is NO_MATCH or setFunc is NO_MATCH: continue if enumCls is fileDlg.Option: builder = fileDlg.Option(0) # This is the only flag enum, all others can only take one value if isinstance(vv, str): vv = [vv] for flag in vv: curVal = getattr(enumCls, flag) builder |= curVal # Some Qt implementations turn into ints by this point outEnum = enumCls(builder) else: outEnum = getattr(enumCls, vv) setFunc(outEnum) def popupFilePicker(parent=None, windowTitle='', nameFilter='', directory=None, selectFile=None, relativeTo=None, **kwargs): """ Thin wrapper around Qt file picker dialog. Used internally so all options are consistent among all requests for external file information ============== ======================================================== **Arguments:** parent Dialog parent windowTitle Title of dialog window nameFilter File filter as required by the Qt dialog directory Where in the file system to open this dialog selectFile File to preselect relativeTo Parent directory that, if provided, will be removed from the prefix of all returned paths. So, if '/my/text/file.txt' was selected, and `relativeTo='/my/text/'`, the return value would be 'file.txt'. This uses os.path.relpath under the hood, so expect that behavior. kwargs Any enum value accepted by a QFileDialog and its value. Values can be a string or list of strings, i.e. fileMode='AnyFile', options=['ShowDirsOnly', 'DontResolveSymlinks'], acceptMode='AcceptSave' ============== ======================================================== """ fileDlg = QtWidgets.QFileDialog(parent) _set_filepicker_kwargs(fileDlg, **kwargs) fileDlg.setModal(True) if directory is not None: fileDlg.setDirectory(directory) fileDlg.setNameFilter(nameFilter) if selectFile is not None: fileDlg.selectFile(selectFile) fileDlg.setWindowTitle(windowTitle) if fileDlg.exec(): # Append filter type singleExtReg = r'(\.\w+)' # Extensions of type 'myfile.ext.is.multi.part' need to capture repeating pattern of singleExt suffMatch = re.search(rf'({singleExtReg}+)', fileDlg.selectedNameFilter()) if suffMatch: # Strip leading '.' if it exists ext = suffMatch.group(1) if ext.startswith('.'): ext = ext[1:] fileDlg.setDefaultSuffix(ext) fList = fileDlg.selectedFiles() else: fList = [] if relativeTo is not None: fList = [os.path.relpath(file, relativeTo) for file in fList] # Make consistent to os flavor fList = [os.path.normpath(file) for file in fList] if fileDlg.fileMode() == fileDlg.FileMode.ExistingFiles: return fList elif len(fList) > 0: return fList[0] else: return None class FileParameterItem(StrParameterItem): def __init__(self, param, depth): self._value = None super().__init__(param, depth) button = QtWidgets.QPushButton('...') button.setFixedWidth(25) button.setContentsMargins(0, 0, 0, 0) button.clicked.connect(self._retrieveFileSelection_gui) self.layoutWidget.layout().insertWidget(2, button) self.displayLabel.resizeEvent = self._newResizeEvent # self.layoutWidget.layout().insertWidget(3, self.defaultBtn) def makeWidget(self): w = super().makeWidget() w.setValue = self.setValue w.value = self.value # Doesn't make much sense to have a 'changing' signal since filepaths should be complete before value # is emitted delattr(w, 'sigChanging') return w def _newResizeEvent(self, ev): ret = type(self.displayLabel).resizeEvent(self.displayLabel, ev) self.updateDisplayLabel() return ret def setValue(self, value): self._value = value self.widget.setText(str(value)) def value(self): return self._value def _retrieveFileSelection_gui(self): curVal = self.param.value() if self.param.hasValue() else None if isinstance(curVal, list) and len(curVal): # All files should be from the same directory, in principle # Since no mechanism exists for preselecting multiple, the most sensible # thing is to select nothing in the preview dialog curVal = curVal[0] if os.path.isfile(curVal): curVal = os.path.dirname(curVal) opts = self.param.opts.copy() useDir = curVal or opts.get('directory') or os.getcwd() startDir = os.path.abspath(useDir) if os.path.isfile(startDir): opts['selectFile'] = os.path.basename(startDir) startDir = os.path.dirname(startDir) if os.path.exists(startDir): opts['directory'] = startDir if opts.get('windowTitle') is None: opts['windowTitle'] = self.param.title() if fname := popupFilePicker(None, **opts): self.param.setValue(fname) def updateDefaultBtn(self): # Override since a readonly label should still allow reverting to default ## enable/disable default btn self.defaultBtn.setEnabled( not self.param.valueIsDefault() and self.param.opts['enabled']) # hide / show self.defaultBtn.setVisible(self.param.hasDefault()) def updateDisplayLabel(self, value=None): lbl = self.displayLabel if value is None: value = self.param.value() value = str(value) font = lbl.font() metrics = QtGui.QFontMetricsF(font) value = metrics.elidedText(value, QtCore.Qt.TextElideMode.ElideLeft, lbl.width()-5) return super().updateDisplayLabel(value) class FileParameter(Parameter): """ Interfaces with the myriad of file options available from a QFileDialog. Note that the output can either be a single file string or list of files, depending on whether `fileMode='ExistingFiles'` is specified. Note that in all cases, absolute file paths are returned unless `relativeTo` is specified as elaborated below. ============== ======================================================== **Options:** parent Dialog parent winTitle Title of dialog window nameFilter File filter as required by the Qt dialog directory Where in the file system to open this dialog selectFile File to preselect relativeTo Parent directory that, if provided, will be removed from the prefix of all returned paths. So, if '/my/text/file.txt' was selected, and `relativeTo='my/text/'`, the return value would be 'file.txt'. This uses os.path.relpath under the hood, so expect that behavior. kwargs Any enum value accepted by a QFileDialog and its value. Values can be a string or list of strings, i.e. fileMode='AnyFile', options=['ShowDirsOnly', 'DontResolveSymlinks'] ============== ======================================================== """ itemClass = FileParameterItem def __init__(self, **opts): opts.setdefault('readonly', True) super().__init__(**opts) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/font.py000066400000000000000000000022731457240071200270450ustar00rootroot00000000000000from ...Qt import QtGui, QtWidgets from ..Parameter import Parameter from .basetypes import WidgetParameterItem class FontParameterItem(WidgetParameterItem): def makeWidget(self): w = QtWidgets.QFontComboBox() w.setMaximumHeight(20) w.sigChanged = w.currentFontChanged w.value = w.currentFont w.setValue = w.setCurrentFont self.hideWidget = False return w def updateDisplayLabel(self, value=None): if value is None: value = self.widget.currentText() super().updateDisplayLabel(value) class FontParameter(Parameter): """ Creates and controls a QFont value. Be careful when selecting options from the font dropdown. since not all fonts are available on all systems """ itemClass = FontParameterItem def _interpretValue(self, v): if isinstance(v, str): newVal = QtGui.QFont() if not newVal.fromString(v): raise ValueError(f'Error parsing font "{v}"') v = newVal return v def saveState(self, filter=None): state = super().saveState(filter) state['value'] = state['value'].toString() return state pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/list.py000066400000000000000000000104171457240071200270510ustar00rootroot00000000000000import warnings from collections import OrderedDict from ... import functions as fn from ...Qt import QtWidgets from ..Parameter import Parameter from .basetypes import WidgetParameterItem class ListParameterItem(WidgetParameterItem): """ WidgetParameterItem subclass providing comboBox that lets the user select from a list of options. """ def __init__(self, param, depth): self.targetValue = None WidgetParameterItem.__init__(self, param, depth) def makeWidget(self): w = QtWidgets.QComboBox() w.setMaximumHeight(20) ## set to match height of spin box and line edit w.sigChanged = w.currentIndexChanged w.value = self.value w.setValue = self.setValue self.widget = w ## needs to be set before limits are changed self.limitsChanged(self.param, self.param.opts['limits']) if len(self.forward) > 0 and self.param.hasValue(): self.setValue(self.param.value()) return w def value(self): key = self.widget.currentText() return self.forward.get(key, None) def setValue(self, val): self.targetValue = val match = [fn.eq(val, limVal) for limVal in self.reverse[0]] if not any(match): self.widget.setCurrentIndex(0) else: idx = match.index(True) key = self.reverse[1][idx] ind = self.widget.findText(key) self.widget.setCurrentIndex(ind) def limitsChanged(self, param, limits): # set up forward / reverse mappings for name:value if len(limits) == 0: limits = [''] ## Can never have an empty list--there is always at least a singhe blank item. self.forward, self.reverse = ListParameter.mapping(limits) try: self.widget.blockSignals(True) val = self.targetValue self.widget.clear() for k in self.forward: self.widget.addItem(k) if k == val: self.widget.setCurrentIndex(self.widget.count()-1) self.updateDisplayLabel() finally: self.widget.blockSignals(False) def updateDisplayLabel(self, value=None): if value is None: value = self.widget.currentText() super().updateDisplayLabel(value) class ListParameter(Parameter): """Parameter with a list of acceptable values. By default, this parameter is represtented by a :class:`ListParameterItem`, displaying a combo box to select a value from the list. In addition to the generic :class:`~pyqtgraph.parametertree.Parameter` options, this parameter type accepts a ``limits`` argument specifying the list of allowed values. The values may generally be of any data type, as long as they can be represented as a string. If the string representation provided is undesirable, the values may be given as a dictionary mapping the desired string representation to the value. """ itemClass = ListParameterItem def __init__(self, **opts): self.forward = OrderedDict() ## {name: value, ...} self.reverse = ([], []) ## ([value, ...], [name, ...]) if opts.get('limits', None) is None: opts['limits'] = [] Parameter.__init__(self, **opts) self.setLimits(opts['limits']) def setLimits(self, limits): """Change the list of allowed values.""" self.forward, self.reverse = self.mapping(limits) Parameter.setLimits(self, limits) if self.hasValue(): # 'value in limits' expression will break when reverse contains numpy array curVal = self.value() if len(self.reverse[0]) > 0 and not any(fn.eq(curVal, limVal) for limVal in self.reverse[0]): self.setValue(self.reverse[0][0]) @staticmethod def mapping(limits): # Return forward and reverse mapping objects given a limit specification forward = OrderedDict() ## {name: value, ...} reverse = ([], []) ## ([value, ...], [name, ...]) if not isinstance(limits, dict): limits = {str(l): l for l in limits} for k, v in limits.items(): forward[k] = v reverse[0].append(v) reverse[1].append(k) return forward, reverse pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/numeric.py000066400000000000000000000040621457240071200275370ustar00rootroot00000000000000from ...widgets.SpinBox import SpinBox from .basetypes import WidgetParameterItem class NumericParameterItem(WidgetParameterItem): """ Subclasses `WidgetParameterItem` to provide the following types: ========================== ============================================================= **Registered Types:** int Displays a :class:`SpinBox ` in integer mode. float Displays a :class:`SpinBox `. ========================== ============================================================= """ def makeWidget(self): opts = self.param.opts t = opts['type'] defs = { 'value': 0, 'min': None, 'max': None, 'step': 1.0, 'dec': False, 'siPrefix': False, 'suffix': '', 'decimals': 3, } if t == 'int': defs['int'] = True defs['minStep'] = 1.0 for k in defs: if k in opts: defs[k] = opts[k] if opts.get('limits') is not None: defs['min'], defs['max'] = opts['limits'] w = SpinBox() w.setOpts(**defs) w.sigChanged = w.sigValueChanged w.sigChanging = w.sigValueChanging return w def updateDisplayLabel(self, value=None): if value is None: value = self.widget.lineEdit().text() super().updateDisplayLabel(value) def showEditor(self): super().showEditor() self.widget.selectNumber() # select the numerical portion of the text for quick editing def limitsChanged(self, param, limits): self.widget.setOpts(bounds=limits) def optsChanged(self, param, opts): super().optsChanged(param, opts) sbOpts = {} if 'units' in opts and 'suffix' not in opts: sbOpts['suffix'] = opts['units'] for k, v in opts.items(): if k in self.widget.opts: sbOpts[k] = v self.widget.setOpts(**sbOpts) self.updateDisplayLabel() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/pen.py000066400000000000000000000226001457240071200266550ustar00rootroot00000000000000import re from contextlib import ExitStack from ... import functions as fn from ...Qt import QtCore, QtWidgets from ...SignalProxy import SignalProxy from ...widgets.PenPreviewLabel import PenPreviewLabel from . import GroupParameterItem, WidgetParameterItem from .basetypes import GroupParameter, Parameter, ParameterItem from .qtenum import QtEnumParameter class PenParameterItem(GroupParameterItem): def __init__(self, param, depth): self.defaultBtn = self.makeDefaultButton() super().__init__(param, depth) self.itemWidget = QtWidgets.QWidget() layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(2) self.penLabel = PenPreviewLabel(param) for child in self.penLabel, self.defaultBtn: layout.addWidget(child) self.itemWidget.setLayout(layout) def optsChanged(self, param, opts): if "enabled" in opts or "readonly" in opts: self.updateDefaultBtn() def treeWidgetChanged(self): ParameterItem.treeWidgetChanged(self) tw = self.treeWidget() if tw is None: return tw.setItemWidget(self, 1, self.itemWidget) defaultClicked = WidgetParameterItem.defaultClicked makeDefaultButton = WidgetParameterItem.makeDefaultButton def valueChanged(self, param, val): self.updateDefaultBtn() def updateDefaultBtn(self): self.defaultBtn.setEnabled( not self.param.valueIsDefault() and self.param.opts["enabled"] and self.param.writable() ) def cap_first(s: str): if not s: return s return s[0].upper() + s[1:] class PenParameter(GroupParameter): """ Controls the appearance of a QPen value. When `saveState` is called, the value is encoded as (color, width, style, capStyle, joinStyle, cosmetic) ============== ======================================================== **Options:** color pen color, can be any argument accepted by :func:`~pyqtgraph.mkColor` (defaults to black) width integer width >= 0 (defaults to 1) style String version of QPenStyle enum, i.e. 'SolidLine' (default), 'DashLine', etc. capStyle String version of QPenCapStyle enum, i.e. 'SquareCap' (default), 'RoundCap', etc. joinStyle String version of QPenJoinStyle enum, i.e. 'BevelJoin' (default), 'RoundJoin', etc. cosmetic Boolean, whether or not the pen is cosmetic (defaults to True) ============== ======================================================== """ itemClass = PenParameterItem def __init__(self, **opts): self.pen = fn.mkPen(**opts) children = self._makeChildren(self.pen) if 'children' in opts: raise KeyError('Cannot set "children" argument in Pen Parameter opts') super().__init__(**opts, children=list(children)) self.valChangingProxy = SignalProxy( self.sigValueChanging, delay=1.0, slot=self._childrenFinishedChanging, threadSafe=False, ) def _childrenFinishedChanging(self, paramAndValue): self.setValue(self.pen) def setDefault(self, val, **kwargs): pen = self._interpretValue(val) with self.treeChangeBlocker(): # Block changes until all are finalized for opt in self.names: # Booleans have different naming convention if isinstance(self[opt], bool): attrName = f'is{opt.title()}' else: attrName = opt self.child(opt).setDefault(getattr(pen, attrName)(), **kwargs) out = super().setDefault(val, **kwargs) return out def saveState(self, filter=None): state = super().saveState(filter) opts = state.pop('children') state['value'] = tuple(o['value'] for o in opts.values()) if 'default' not in state: state['default'] = state['value'] # TODO remove this after January 2025 return state def restoreState(self, state, recursive=True, addChildren=True, removeChildren=True, blockSignals=True): return super().restoreState(state, recursive=False, addChildren=False, removeChildren=False, blockSignals=blockSignals) def _interpretValue(self, v): return self.mkPen(v) def setValue(self, value, blockSignal=None): if not fn.eq(value, self.pen): value = self.mkPen(value) self.updateFromPen(self, value) return super().setValue(self.pen, blockSignal) def applyOptsToPen(self, **opts): # Transform opts into a value for the current pen paramNames = set(opts).intersection(self.names) # Value should be overridden by opts with self.treeChangeBlocker(): if 'value' in opts: pen = self.mkPen(opts.pop('value')) if not fn.eq(pen, self.pen): self.updateFromPen(self, pen) penOpts = {} for kk in paramNames: penOpts[kk] = opts[kk] self[kk] = opts[kk] return penOpts def setOpts(self, **opts): # Transform opts into a value if self.applyOptsToPen(**opts): self.setValue(self.pen) return super().setOpts(**opts) def mkPen(self, *args, **kwargs): """Thin wrapper around fn.mkPen which accepts the serialized state from saveState""" if len(args) == 1 and isinstance(args[0], tuple) and len(args[0]) == len(self.childs): opts = dict(zip(self.names, args[0])) self.applyOptsToPen(**opts) args = (self.pen,) kwargs = {} return fn.mkPen(*args, **kwargs) def _makeChildren(self, boundPen=None): cs = QtCore.Qt.PenCapStyle js = QtCore.Qt.PenJoinStyle ps = QtCore.Qt.PenStyle param = Parameter.create( name='Params', type='group', children=[ dict(name='color', type='color', value='k'), dict(name='width', value=1, type='int', limits=[0, None]), QtEnumParameter(ps, name='style', value='SolidLine'), QtEnumParameter(cs, name='capStyle'), QtEnumParameter(js, name='joinStyle'), dict(name='cosmetic', type='bool', value=True) ] ) optsPen = boundPen or fn.mkPen() for p in param: name = p.name() # Qt naming scheme uses isXxx for booleans if p.type() == 'bool': attrName = f'is{name.title()}' else: attrName = name default = getattr(optsPen, attrName)() replace = r'\1 \2' name = re.sub(r'(\w)([A-Z])', replace, name) name = name.title().strip() p.setOpts(title=name, default=default) if boundPen is not None: self.updateFromPen(param, boundPen) for p in param: setName = f'set{cap_first(p.name())}' # Instead, set the parameter which will signal the old setter setattr(boundPen, setName, p.setValue) newSetter = self.penPropertySetter # Edge case: color picker uses a dialog with user interaction, so wait until full change there if p.type() != 'color': p.sigValueChanging.connect(newSetter) # Force children to emulate self's value instead of being part of a tree like normal try: p.sigValueChanged.disconnect(p._emitValueChanged) except RuntimeError: # workaround https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2487 # that affects PySide 6.5.3 # Since the child param was freshly created by us, there can only have been one slot # connected. So we can just disconnect all the slots without specifying which one. assert p.receivers(QtCore.SIGNAL("sigValueChanged(PyObject,PyObject)")) == 1 p.sigValueChanged.disconnect() # Some widgets (e.g. checkbox, combobox) don't emit 'changing' signals, so tie to 'changed' as well p.sigValueChanged.connect(newSetter) return param def penPropertySetter(self, p, value): boundPen = self.pen setName = f'set{cap_first(p.name())}' # boundPen.setName has been monkey-patched # so we get the original setter from the class getattr(boundPen.__class__, setName)(boundPen, value) self.sigValueChanging.emit(self, boundPen) @staticmethod def updateFromPen(param, pen): """ Applies settings from a pen to either a Parameter or dict. The Parameter or dict must already be populated with the relevant keys that can be found in `PenSelectorDialog.mkParam`. """ stack = ExitStack() if isinstance(param, Parameter): names = param.names # Block changes until all are finalized stack.enter_context(param.treeChangeBlocker()) else: names = param for opt in names: # Booleans have different naming convention if isinstance(param[opt], bool): attrName = f'is{opt.title()}' else: attrName = opt param[opt] = getattr(pen, attrName)() stack.close() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/progress.py000066400000000000000000000007741457240071200277470ustar00rootroot00000000000000from ...Qt import QtWidgets from ..Parameter import Parameter from .basetypes import WidgetParameterItem class ProgressBarParameterItem(WidgetParameterItem): def makeWidget(self): w = QtWidgets.QProgressBar() w.setMaximumHeight(20) w.sigChanged = w.valueChanged self.hideWidget = False return w class ProgressBarParameter(Parameter): """ Displays a progress bar whose value can be set between 0 and 100 """ itemClass = ProgressBarParameterItem pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/qtenum.py000066400000000000000000000050761457240071200274140ustar00rootroot00000000000000from enum import Enum from ...Qt import QT_LIB, QtCore from .list import ListParameter class QtEnumParameter(ListParameter): def __init__(self, enum, searchObj=QtCore.Qt, **opts): """ Constructs a list of allowed enum values from the enum class provided `searchObj` is only needed for PyQt5 compatibility, where it must be the module holding the enum. For instance, if making a QtEnumParameter out of QtWidgets.QFileDialog.Option, `searchObj` would be QtWidgets.QFileDialog """ self.enum = enum self.searchObj = searchObj opts.setdefault('name', enum.__name__) self.enumMap = self._getAllowedEnums(enum) opts.update(limits=self.formattedLimits()) super().__init__(**opts) def setValue(self, value, blockSignal=None): if isinstance(value, str): value = self.enumMap[value] super().setValue(value, blockSignal) def formattedLimits(self): # Title-cased words without the ending substring for brevity mapping = self.enumMap shortestName = min(len(name) for name in mapping) names = list(mapping) cmpName, *names = names substringEnd = next( ( ii + 1 for ii in range(-1, -shortestName - 1, -1) if any(cmpName[ii] != curName[ii] for curName in names) ), None, ) # Special case of 0: Set to None to avoid null string if substringEnd == 0: substringEnd = None return {kk[:substringEnd]: vv for kk, vv in self.enumMap.items()} def saveState(self, filter=None): state = super().saveState(filter) reverseMap = dict(zip(self.enumMap.values(), self.enumMap)) state['value'] = reverseMap[state['value']] return state def _getAllowedEnums(self, enum): """Pyside provides a dict for easy evaluation""" if issubclass(enum, Enum): # PyQt6 and PySide6 (opt-in in 6.3.1) use python enums vals = {e.name: e for e in enum} elif 'PySide' in QT_LIB: vals = enum.values elif 'PyQt5' in QT_LIB: vals = {} for key in dir(self.searchObj): value = getattr(self.searchObj, key) if isinstance(value, enum): vals[key] = value else: raise RuntimeError(f'Cannot find associated enum values for qt lib {QT_LIB}') # Remove "M" since it's not a real option vals.pop(f'M{enum.__name__}', None) return vals pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/slider.py000066400000000000000000000110421457240071200273530ustar00rootroot00000000000000import numpy as np from ...Qt import QtCore, QtWidgets from ..Parameter import Parameter from .basetypes import Emitter, WidgetParameterItem class SliderParameterItem(WidgetParameterItem): slider: QtWidgets.QSlider span: np.ndarray charSpan: np.ndarray def __init__(self, param, depth): # Bind emitter to self to avoid garbage collection self.emitter = Emitter() self.sigChanging = self.emitter.sigChanging self._suffix = None super().__init__(param, depth) def updateDisplayLabel(self, value=None): if value is None: value = self.param.value() self.sliderLabel.setText(self.prettyTextValue(self.slider.value())) value = str(value) if self._suffix is None: suffixTxt = '' else: suffixTxt = f' {self._suffix}' self.displayLabel.setText(value + suffixTxt) def setSuffix(self, suffix): self._suffix = suffix # This may be called during widget construction in which case there is no # displayLabel yet if hasattr(self, 'displayLabel'): self.updateDisplayLabel(self.slider.value()) def makeWidget(self): param = self.param opts = param.opts opts.setdefault('limits', [0, 0]) self._suffix = opts.get('suffix') self.slider = QtWidgets.QSlider() self.slider.setOrientation(QtCore.Qt.Orientation.Horizontal) lbl = self.sliderLabel = QtWidgets.QLabel() lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) w = QtWidgets.QWidget() layout = QtWidgets.QHBoxLayout() w.setLayout(layout) layout.addWidget(lbl) layout.addWidget(self.slider) def setValue(v): self.slider.setValue(self.spanToSliderValue(v)) def getValue(): return self.span[self.slider.value()].item() self.slider.valueChanged.connect(self.updateDisplayLabel) def onMove(pos): self.sigChanging.emit(self, self.span[pos].item()) self.slider.sliderMoved.connect(onMove) w.setValue = setValue w.value = getValue w.sigChanged = self.slider.valueChanged w.sigChanging = self.sigChanging self.optsChanged(param, opts) return w def spanToSliderValue(self, v): return int(np.argmin(np.abs(self.span - v))) def prettyTextValue(self, v): if self._suffix is None: suffixTxt = '' else: suffixTxt = f' {self._suffix}' format_ = self.param.opts.get('format', None) cspan = self.charSpan if format_ is None: format_ = f'{{0:>{cspan.dtype.itemsize}}}{suffixTxt}' return format_.format(cspan[v].decode()) def optsChanged(self, param, opts): try: super().optsChanged(param, opts) except AttributeError: # This may trigger while building the parameter before the widget is fully constructed. # This is fine, since errors are from the parent scope which will stabilize after the widget is # constructed anyway pass span = opts.get('span', None) if span is None: step = opts.get('step', 1) start, stop = opts.get('limits', param.opts['limits']) # Add a bit to 'stop' since python slicing excludes the last value span = np.arange(start, stop + step, step) precision = opts.get('precision', 2) if precision is not None: span = span.round(precision) self.span = span self.charSpan = np.char.array(span) w = self.slider w.setMinimum(0) w.setMaximum(len(span) - 1) if 'suffix' in opts: self.setSuffix(opts['suffix']) def limitsChanged(self, param, limits): self.optsChanged(param, dict(limits=limits)) class SliderParameter(Parameter): """ ============== ======================================================== **Options** limits [start, stop] numbers step: Defaults to 1, the spacing between each slider tick span: Instead of limits + step, span can be set to specify the range of slider options (e.g. np.linspace(-pi, pi, 100)) format: Format string to determine number of decimals to show, etc. Defaults to display based on span dtype precision: int number of decimals to keep for float tick spaces ============== ======================================================== """ itemClass = SliderParameterItem pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/str.py000066400000000000000000000006611457240071200267060ustar00rootroot00000000000000from ...Qt import QtWidgets from .basetypes import WidgetParameterItem class StrParameterItem(WidgetParameterItem): """Registered parameter type which displays a QLineEdit""" def makeWidget(self): w = QtWidgets.QLineEdit() w.setStyleSheet('border: 0px') w.sigChanged = w.editingFinished w.value = w.text w.setValue = w.setText w.sigChanging = w.textChanged return w pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/parametertree/parameterTypes/text.py000066400000000000000000000012301457240071200270530ustar00rootroot00000000000000from ...Qt import QtCore, QtWidgets from ..Parameter import Parameter from .basetypes import WidgetParameterItem class TextParameterItem(WidgetParameterItem): """ParameterItem displaying a QTextEdit widget.""" def makeWidget(self): self.hideWidget = False self.asSubItem = True self.textBox = w = QtWidgets.QTextEdit() w.sizeHint = lambda: QtCore.QSize(300, 100) w.value = w.toPlainText w.setValue = w.setPlainText w.sigChanged = w.textChanged return w class TextParameter(Parameter): """Editable string, displayed as large text box in the tree.""" itemClass = TextParameterItem pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/reload.py000066400000000000000000000277701457240071200215110ustar00rootroot00000000000000""" Magic Reload Library Luke Campagnola 2010 Python reload function that actually works (the way you expect it to) - No re-importing necessary - Modules can be reloaded in any order - Replaces functions and methods with their updated code - Changes instances to use updated classes - Automatically decides which modules to update by comparing file modification times Does NOT: - re-initialize exting instances, even if __init__ changes - update references to any module-level objects ie, this does not reload correctly: from module import someObject print someObject ..but you can use this instead: (this works even for the builtin reload) import module print module.someObject """ from __future__ import print_function import gc import inspect import os import sys import traceback import types from .debug import printExc try: from importlib import reload as orig_reload except ImportError: orig_reload = reload def reloadAll(prefix=None, debug=False): """Automatically reload all modules whose __file__ begins with *prefix*. Skips reload if the file has not been updated (if .pyc is newer than .py) If *prefix* is None, then all loaded modules are checked. Returns a dictionary {moduleName: (reloaded, reason)} describing actions taken for each module. """ failed = [] changed = [] ret = {} for modName, mod in list(sys.modules.items()): if not inspect.ismodule(mod): ret[modName] = (False, 'not a module') continue if modName == '__main__': ret[modName] = (False, 'ignored __main__') continue # Ignore modules without a __file__ that is .py or .pyc if getattr(mod, '__file__', None) is None: ret[modName] = (False, 'module has no __file__') continue if os.path.splitext(mod.__file__)[1] not in ['.py', '.pyc']: ret[modName] = (False, '%s not a .py/pyc file' % str(mod.__file__)) continue # Ignore if the file name does not start with prefix if prefix is not None and mod.__file__[:len(prefix)] != prefix: ret[modName] = (False, 'file %s not in prefix %s' % (mod.__file__, prefix)) continue py = os.path.splitext(mod.__file__)[0] + '.py' if py in changed: # already processed this module continue if not os.path.isfile(py): # skip modules that lie about their __file__ ret[modName] = (False, '.py does not exist: %s' % py) continue # if source file is newer than cache file, then it needs to be reloaded. pyc = getattr(mod, '__cached__', py + 'c') if not os.path.isfile(pyc): ret[modName] = (False, 'code has no pyc file to compare') continue if os.stat(pyc).st_mtime > os.stat(py).st_mtime: ret[modName] = (False, 'code has not changed since compile') continue # keep track of which modules have changed to ensure that duplicate-import modules get reloaded. changed.append(py) try: reload(mod, debug=debug) ret[modName] = (True, None) except Exception as exc: printExc("Error while reloading module %s, skipping\n" % mod) failed.append(mod.__name__) ret[modName] = (False, 'reload failed: %s' % traceback.format_exception_only(type(exc), exc)) if len(failed) > 0: raise Exception("Some modules failed to reload: %s" % ', '.join(failed)) return ret def reload(module, debug=False, lists=False, dicts=False): """Replacement for the builtin reload function: - Reloads the module as usual - Updates all old functions and class methods to use the new code - Updates all instances of each modified class to use the new class - Can update lists and dicts, but this is disabled by default - Requires that class and function names have not changed """ if debug: print("Reloading %s" % str(module)) ## make a copy of the old module dictionary, reload, then grab the new module dictionary for comparison oldDict = module.__dict__.copy() orig_reload(module) newDict = module.__dict__ ## Allow modules access to the old dictionary after they reload if hasattr(module, '__reload__'): module.__reload__(oldDict) ## compare old and new elements from each dict; update where appropriate for k in oldDict: old = oldDict[k] new = newDict.get(k, None) if old is new or new is None: continue if inspect.isclass(old): if debug: print(" Updating class %s.%s (0x%x -> 0x%x)" % (module.__name__, k, id(old), id(new))) updateClass(old, new, debug) # don't put this inside updateClass because it is reentrant. new.__previous_reload_version__ = old elif inspect.isfunction(old): depth = updateFunction(old, new, debug) if debug: extra = "" if depth > 0: extra = " (and %d previous versions)" % depth print(" Updating function %s.%s%s" % (module.__name__, k, extra)) elif lists and isinstance(old, list): l = old.len() old.extend(new) for i in range(l): old.pop(0) elif dicts and isinstance(old, dict): old.update(new) for j in old: if j not in new: del old[j] ## For functions: ## 1) update the code and defaults to new versions. ## 2) keep a reference to the previous version so ALL versions get updated for every reload def updateFunction(old, new, debug, depth=0, visited=None): #if debug and depth > 0: #print " -> also updating previous version", old, " -> ", new old.__code__ = new.__code__ old.__defaults__ = new.__defaults__ if hasattr(old, '__kwdefaults'): old.__kwdefaults__ = new.__kwdefaults__ old.__doc__ = new.__doc__ if visited is None: visited = [] if old in visited: return visited.append(old) ## finally, update any previous versions still hanging around.. if hasattr(old, '__previous_reload_version__'): maxDepth = updateFunction(old.__previous_reload_version__, new, debug, depth=depth+1, visited=visited) else: maxDepth = depth ## We need to keep a pointer to the previous version so we remember to update BOTH ## when the next reload comes around. if depth == 0: new.__previous_reload_version__ = old return maxDepth ## For classes: ## 1) find all instances of the old class and set instance.__class__ to the new class ## 2) update all old class methods to use code from the new class methods def updateClass(old, new, debug): ## Track town all instances and subclasses of old refs = gc.get_referrers(old) for ref in refs: try: if isinstance(ref, old) and ref.__class__ is old: ref.__class__ = new if debug: print(" Changed class for %s" % safeStr(ref)) elif inspect.isclass(ref) and issubclass(ref, old) and old in ref.__bases__: ind = ref.__bases__.index(old) ## Does not work: #ref.__bases__ = ref.__bases__[:ind] + (new,) + ref.__bases__[ind+1:] ## reason: Even though we change the code on methods, they remain bound ## to their old classes (changing im_class is not allowed). Instead, ## we have to update the __bases__ such that this class will be allowed ## as an argument to older methods. ## This seems to work. Is there any reason not to? ## Note that every time we reload, the class hierarchy becomes more complex. ## (and I presume this may slow things down?) newBases = ref.__bases__[:ind] + (new,old) + ref.__bases__[ind+1:] try: ref.__bases__ = newBases except TypeError: print(" Error setting bases for class %s" % ref) print(" old bases: %s" % repr(ref.__bases__)) print(" new bases: %s" % repr(newBases)) raise if debug: print(" Changed superclass for %s" % safeStr(ref)) #else: #if debug: #print " Ignoring reference", type(ref) except Exception: print("Error updating reference (%s) for class change (%s -> %s)" % (safeStr(ref), safeStr(old), safeStr(new))) raise ## update all class methods to use new code. ## Generally this is not needed since instances already know about the new class, ## but it fixes a few specific cases (pyqt signals, for one) for attr in dir(old): oa = getattr(old, attr) if inspect.isfunction(oa) or inspect.ismethod(oa): # note python2 has unbound methods, whereas python3 just uses plain functions try: na = getattr(new, attr) except AttributeError: if debug: print(" Skipping method update for %s; new class does not have this attribute" % attr) continue ofunc = getattr(oa, '__func__', oa) # in py2 we have to get the __func__ from unbound method, nfunc = getattr(na, '__func__', na) # in py3 the attribute IS the function if ofunc is not nfunc: depth = updateFunction(ofunc, nfunc, debug) if not hasattr(nfunc, '__previous_reload_method__'): nfunc.__previous_reload_method__ = oa # important for managing signal connection #oa.__class__ = new ## bind old method to new class ## not allowed if debug: extra = "" if depth > 0: extra = " (and %d previous versions)" % depth print(" Updating method %s%s" % (attr, extra)) ## And copy in new functions that didn't exist previously for attr in dir(new): if attr == '__previous_reload_version__': continue if not hasattr(old, attr): if debug: print(" Adding missing attribute %s" % attr) setattr(old, attr, getattr(new, attr)) ## finally, update any previous versions still hanging around.. if hasattr(old, '__previous_reload_version__'): updateClass(old.__previous_reload_version__, new, debug) ## It is possible to build classes for which str(obj) just causes an exception. ## Avoid thusly: def safeStr(obj): try: s = str(obj) except Exception: try: s = repr(obj) except Exception: s = "" % (safeStr(type(obj)), id(obj)) return s def getPreviousVersion(obj): """Return the previous version of *obj*, or None if this object has not been reloaded. """ if isinstance(obj, type) or inspect.isfunction(obj): return getattr(obj, '__previous_reload_version__', None) elif inspect.ismethod(obj): if obj.__self__ is None: # unbound method return getattr(obj.__func__, '__previous_reload_method__', None) else: oldmethod = getattr(obj.__func__, '__previous_reload_method__', None) if oldmethod is None: return None self = obj.__self__ oldfunc = getattr(oldmethod, '__func__', oldmethod) if hasattr(oldmethod, 'im_class'): # python 2 cls = oldmethod.im_class return types.MethodType(oldfunc, self, cls) else: # python 3 return types.MethodType(oldfunc, self) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/units.py000066400000000000000000000031401457240071200213660ustar00rootroot00000000000000# Very simple unit support: # - creates variable names like 'mV' and 'kHz' # - the value assigned to the variable corresponds to the scale prefix # (mV = 0.001) # - the actual units are purely cosmetic for making code clearer: # # x = 20*pA is identical to x = 20*1e-12 # # No unicode variable names (μ,Ω) allowed until python 3, but just assigning # them to the globals dict doesn't error in python 2. import unicodedata # All unicode identifiers get normalized automatically SI_PREFIXES = unicodedata.normalize("NFKC", u"yzafpnµm kMGTPEZY") UNITS = unicodedata.normalize("NFKC", u"m,s,g,W,J,V,A,F,T,Hz,Ohm,Ω,S,N,C,px,b,B,Pa").split(",") allUnits = {} def addUnit(prefix, val): g = globals() for u in UNITS: g[prefix + u] = val allUnits[prefix + u] = val for pre in SI_PREFIXES: v = SI_PREFIXES.index(pre) - 8 if pre == " ": pre = "" addUnit(pre, 1000 ** v) addUnit("c", 0.01) addUnit("d", 0.1) addUnit("da", 10) addUnit("h", 100) # py2 compatibility addUnit("u", 1e-6) def evalUnits(unitStr): """ Evaluate a unit string into ([numerators,...], [denominators,...]) Examples: N m/s^2 => ([N, m], [s, s]) A*s / V => ([A, s], [V,]) """ pass def formatUnits(units): """ Format a unit specification ([numerators,...], [denominators,...]) into a string (this is the inverse of evalUnits) """ pass def simplify(units): """ Cancel units that appear in both numerator and denominator, then attempt to replace groups of units with single units where possible (ie, J/s => W) """ pass pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/000077500000000000000000000000001457240071200206315ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/__init__.py000066400000000000000000000000001457240071200227300ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/colorama/000077500000000000000000000000001457240071200224265ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/colorama/LICENSE.txt000066400000000000000000000027231457240071200242550ustar00rootroot00000000000000Copyright (c) 2010 Jonathan Hartley All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holders, nor those of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/colorama/README.txt000066400000000000000000000242341457240071200241310ustar00rootroot00000000000000Download and docs: http://pypi.python.org/pypi/colorama Development: http://code.google.com/p/colorama Discussion group: https://groups.google.com/forum/#!forum/python-colorama Description =========== Makes ANSI escape character sequences for producing colored terminal text and cursor positioning work under MS Windows. ANSI escape character sequences have long been used to produce colored terminal text and cursor positioning on Unix and Macs. Colorama makes this work on Windows, too, by wrapping stdout, stripping ANSI sequences it finds (which otherwise show up as gobbledygook in your output), and converting them into the appropriate win32 calls to modify the state of the terminal. On other platforms, Colorama does nothing. Colorama also provides some shortcuts to help generate ANSI sequences but works fine in conjunction with any other ANSI sequence generation library, such as Termcolor (http://pypi.python.org/pypi/termcolor.) This has the upshot of providing a simple cross-platform API for printing colored terminal text from Python, and has the happy side-effect that existing applications or libraries which use ANSI sequences to produce colored output on Linux or Macs can now also work on Windows, simply by calling ``colorama.init()``. An alternative approach is to install 'ansi.sys' on Windows machines, which provides the same behaviour for all applications running in terminals. Colorama is intended for situations where that isn't easy (e.g. maybe your app doesn't have an installer.) Demo scripts in the source code repository prints some colored text using ANSI sequences. Compare their output under Gnome-terminal's built in ANSI handling, versus on Windows Command-Prompt using Colorama: .. image:: http://colorama.googlecode.com/hg/screenshots/ubuntu-demo.png :width: 661 :height: 357 :alt: ANSI sequences on Ubuntu under gnome-terminal. .. image:: http://colorama.googlecode.com/hg/screenshots/windows-demo.png :width: 668 :height: 325 :alt: Same ANSI sequences on Windows, using Colorama. These screengrabs show that Colorama on Windows does not support ANSI 'dim text': it looks the same as 'normal text'. License ======= Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. Dependencies ============ None, other than Python. Tested on Python 2.5.5, 2.6.5, 2.7, 3.1.2, and 3.2 Usage ===== Initialisation -------------- Applications should initialise Colorama using:: from colorama import init init() If you are on Windows, the call to ``init()`` will start filtering ANSI escape sequences out of any text sent to stdout or stderr, and will replace them with equivalent Win32 calls. Calling ``init()`` has no effect on other platforms (unless you request other optional functionality, see keyword args below.) The intention is that applications can call ``init()`` unconditionally on all platforms, after which ANSI output should just work. To stop using colorama before your program exits, simply call ``deinit()``. This will restore stdout and stderr to their original values, so that Colorama is disabled. To start using Colorama again, call ``reinit()``, which wraps stdout and stderr again, but is cheaper to call than doing ``init()`` all over again. Colored Output -------------- Cross-platform printing of colored text can then be done using Colorama's constant shorthand for ANSI escape sequences:: from colorama import Fore, Back, Style print(Fore.RED + 'some red text') print(Back.GREEN + 'and with a green background') print(Style.DIM + 'and in dim text') print(Fore.RESET + Back.RESET + Style.RESET_ALL) print('back to normal now') or simply by manually printing ANSI sequences from your own code:: print('/033[31m' + 'some red text') print('/033[30m' # and reset to default color) or Colorama can be used happily in conjunction with existing ANSI libraries such as Termcolor:: from colorama import init from termcolor import colored # use Colorama to make Termcolor work on Windows too init() # then use Termcolor for all colored text output print(colored('Hello, World!', 'green', 'on_red')) Available formatting constants are:: Fore: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. Style: DIM, NORMAL, BRIGHT, RESET_ALL Style.RESET_ALL resets foreground, background and brightness. Colorama will perform this reset automatically on program exit. Cursor Positioning ------------------ ANSI codes to reposition the cursor are supported. See demos/demo06.py for an example of how to generate them. Init Keyword Args ----------------- ``init()`` accepts some kwargs to override default behaviour. init(autoreset=False): If you find yourself repeatedly sending reset sequences to turn off color changes at the end of every print, then ``init(autoreset=True)`` will automate that:: from colorama import init init(autoreset=True) print(Fore.RED + 'some red text') print('automatically back to default color again') init(strip=None): Pass ``True`` or ``False`` to override whether ansi codes should be stripped from the output. The default behaviour is to strip if on Windows. init(convert=None): Pass ``True`` or ``False`` to override whether to convert ansi codes in the output into win32 calls. The default behaviour is to convert if on Windows and output is to a tty (terminal). init(wrap=True): On Windows, colorama works by replacing ``sys.stdout`` and ``sys.stderr`` with proxy objects, which override the .write() method to do their work. If this wrapping causes you problems, then this can be disabled by passing ``init(wrap=False)``. The default behaviour is to wrap if autoreset or strip or convert are True. When wrapping is disabled, colored printing on non-Windows platforms will continue to work as normal. To do cross-platform colored output, you can use Colorama's ``AnsiToWin32`` proxy directly:: import sys from colorama import init, AnsiToWin32 init(wrap=False) stream = AnsiToWin32(sys.stderr).stream # Python 2 print >>stream, Fore.BLUE + 'blue text on stderr' # Python 3 print(Fore.BLUE + 'blue text on stderr', file=stream) Status & Known Problems ======================= I've personally only tested it on WinXP (CMD, Console2), Ubuntu (gnome-terminal, xterm), and OSX. Some presumably valid ANSI sequences aren't recognised (see details below) but to my knowledge nobody has yet complained about this. Puzzling. See outstanding issues and wishlist at: http://code.google.com/p/colorama/issues/list If anything doesn't work for you, or doesn't do what you expected or hoped for, I'd love to hear about it on that issues list, would be delighted by patches, and would be happy to grant commit access to anyone who submits a working patch or two. Recognised ANSI Sequences ========================= ANSI sequences generally take the form: ESC [ ; ... Where is an integer, and is a single letter. Zero or more params are passed to a . If no params are passed, it is generally synonymous with passing a single zero. No spaces exist in the sequence, they have just been inserted here to make it easy to read. The only ANSI sequences that colorama converts into win32 calls are:: ESC [ 0 m # reset all (colors and brightness) ESC [ 1 m # bright ESC [ 2 m # dim (looks same as normal brightness) ESC [ 22 m # normal brightness # FOREGROUND: ESC [ 30 m # black ESC [ 31 m # red ESC [ 32 m # green ESC [ 33 m # yellow ESC [ 34 m # blue ESC [ 35 m # magenta ESC [ 36 m # cyan ESC [ 37 m # white ESC [ 39 m # reset # BACKGROUND ESC [ 40 m # black ESC [ 41 m # red ESC [ 42 m # green ESC [ 43 m # yellow ESC [ 44 m # blue ESC [ 45 m # magenta ESC [ 46 m # cyan ESC [ 47 m # white ESC [ 49 m # reset # cursor positioning ESC [ y;x H # position cursor at x across, y down # clear the screen ESC [ mode J # clear the screen. Only mode 2 (clear entire screen) # is supported. It should be easy to add other modes, # let me know if that would be useful. Multiple numeric params to the 'm' command can be combined into a single sequence, eg:: ESC [ 36 ; 45 ; 1 m # bright cyan text on magenta background All other ANSI sequences of the form ``ESC [ ; ... `` are silently stripped from the output on Windows. Any other form of ANSI sequence, such as single-character codes or alternative initial characters, are not recognised nor stripped. It would be cool to add them though. Let me know if it would be useful for you, via the issues on google code. Development =========== Help and fixes welcome! Ask Jonathan for commit rights, you'll get them. Running tests requires: - Michael Foord's 'mock' module to be installed. - Tests are written using the 2010 era updates to 'unittest', and require to be run either using Python2.7 or greater, or else to have Michael Foord's 'unittest2' module installed. unittest2 test discovery doesn't work for colorama, so I use 'nose':: nosetests -s The -s is required because 'nosetests' otherwise applies a proxy of its own to stdout, which confuses the unit tests. Contact ======= Created by Jonathan Hartley, tartley@tartley.com Thanks ====== | Ben Hoyt, for a magnificent fix under 64-bit Windows. | Jesse@EmptySquare for submitting a fix for examples in the README. | User 'jamessp', an observant documentation fix for cursor positioning. | User 'vaal1239', Dave Mckee & Lackner Kristof for a tiny but much-needed Win7 fix. | Julien Stuyck, for wisely suggesting Python3 compatible updates to README. | Daniel Griffith for multiple fabulous patches. | Oscar Lesta for valuable fix to stop ANSI chars being sent to non-tty output. | Roger Binns, for many suggestions, valuable feedback, & bug reports. | Tim Golden for thought and much appreciated feedback on the initial idea. pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/colorama/__init__.py000066400000000000000000000000001457240071200245250ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/colorama/win32.py000066400000000000000000000114451457240071200237470ustar00rootroot00000000000000# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. # from winbase.h STDOUT = -11 STDERR = -12 try: from ctypes import windll from ctypes import wintypes except ImportError: windll = None SetConsoleTextAttribute = lambda *_: None else: from ctypes import ( byref, Structure, c_char, c_short, c_int, c_uint32, c_ushort, c_void_p, POINTER ) class CONSOLE_SCREEN_BUFFER_INFO(Structure): """struct in wincon.h.""" _fields_ = [ ("dwSize", wintypes._COORD), ("dwCursorPosition", wintypes._COORD), ("wAttributes", wintypes.WORD), ("srWindow", wintypes.SMALL_RECT), ("dwMaximumWindowSize", wintypes._COORD), ] def __str__(self): return '(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)' % ( self.dwSize.Y, self.dwSize.X , self.dwCursorPosition.Y, self.dwCursorPosition.X , self.wAttributes , self.srWindow.Top, self.srWindow.Left, self.srWindow.Bottom, self.srWindow.Right , self.dwMaximumWindowSize.Y, self.dwMaximumWindowSize.X ) _GetStdHandle = windll.kernel32.GetStdHandle _GetStdHandle.argtypes = [ wintypes.DWORD, ] _GetStdHandle.restype = wintypes.HANDLE _GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo _GetConsoleScreenBufferInfo.argtypes = [ wintypes.HANDLE, c_void_p, #POINTER(CONSOLE_SCREEN_BUFFER_INFO), ] _GetConsoleScreenBufferInfo.restype = wintypes.BOOL _SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute _SetConsoleTextAttribute.argtypes = [ wintypes.HANDLE, wintypes.WORD, ] _SetConsoleTextAttribute.restype = wintypes.BOOL _SetConsoleCursorPosition = windll.kernel32.SetConsoleCursorPosition _SetConsoleCursorPosition.argtypes = [ wintypes.HANDLE, c_int, #wintypes._COORD, ] _SetConsoleCursorPosition.restype = wintypes.BOOL _FillConsoleOutputCharacterA = windll.kernel32.FillConsoleOutputCharacterA _FillConsoleOutputCharacterA.argtypes = [ wintypes.HANDLE, c_char, wintypes.DWORD, wintypes._COORD, POINTER(wintypes.DWORD), ] _FillConsoleOutputCharacterA.restype = wintypes.BOOL _FillConsoleOutputAttribute = windll.kernel32.FillConsoleOutputAttribute _FillConsoleOutputAttribute.argtypes = [ wintypes.HANDLE, wintypes.WORD, wintypes.DWORD, c_int, #wintypes._COORD, POINTER(wintypes.DWORD), ] _FillConsoleOutputAttribute.restype = wintypes.BOOL handles = { STDOUT: _GetStdHandle(STDOUT), STDERR: _GetStdHandle(STDERR), } def GetConsoleScreenBufferInfo(stream_id=STDOUT): handle = handles[stream_id] csbi = CONSOLE_SCREEN_BUFFER_INFO() success = _GetConsoleScreenBufferInfo( handle, byref(csbi)) return csbi def SetConsoleTextAttribute(stream_id, attrs): handle = handles[stream_id] return _SetConsoleTextAttribute(handle, attrs) def SetConsoleCursorPosition(stream_id, position): position = wintypes._COORD(*position) # If the position is out of range, do nothing. if position.Y <= 0 or position.X <= 0: return # Adjust for Windows' SetConsoleCursorPosition: # 1. being 0-based, while ANSI is 1-based. # 2. expecting (x,y), while ANSI uses (y,x). adjusted_position = wintypes._COORD(position.Y - 1, position.X - 1) # Adjust for viewport's scroll position sr = GetConsoleScreenBufferInfo(STDOUT).srWindow adjusted_position.Y += sr.Top adjusted_position.X += sr.Left # Resume normal processing handle = handles[stream_id] return _SetConsoleCursorPosition(handle, adjusted_position) def FillConsoleOutputCharacter(stream_id, char, length, start): handle = handles[stream_id] char = c_char(char) length = wintypes.DWORD(length) num_written = wintypes.DWORD(0) # Note that this is hard-coded for ANSI (vs wide) bytes. success = _FillConsoleOutputCharacterA( handle, char, length, start, byref(num_written)) return num_written.value def FillConsoleOutputAttribute(stream_id, attr, length, start): ''' FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )''' handle = handles[stream_id] attribute = wintypes.WORD(attr) length = wintypes.DWORD(length) num_written = wintypes.DWORD(0) # Note that this is hard-coded for ANSI (vs wide) bytes. return _FillConsoleOutputAttribute( handle, attribute, length, start, byref(num_written)) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/colorama/winterm.py000066400000000000000000000101551457240071200244670ustar00rootroot00000000000000# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. from . import win32 # from wincon.h class WinColor(object): BLACK = 0 BLUE = 1 GREEN = 2 CYAN = 3 RED = 4 MAGENTA = 5 YELLOW = 6 GREY = 7 # from wincon.h class WinStyle(object): NORMAL = 0x00 # dim text, dim background BRIGHT = 0x08 # bright text, dim background class WinTerm(object): def __init__(self): self._default = win32.GetConsoleScreenBufferInfo(win32.STDOUT).wAttributes self.set_attrs(self._default) self._default_fore = self._fore self._default_back = self._back self._default_style = self._style def get_attrs(self): return self._fore + self._back * 16 + self._style def set_attrs(self, value): self._fore = value & 7 self._back = (value >> 4) & 7 self._style = value & WinStyle.BRIGHT def reset_all(self, on_stderr=None): self.set_attrs(self._default) self.set_console(attrs=self._default) def fore(self, fore=None, on_stderr=False): if fore is None: fore = self._default_fore self._fore = fore self.set_console(on_stderr=on_stderr) def back(self, back=None, on_stderr=False): if back is None: back = self._default_back self._back = back self.set_console(on_stderr=on_stderr) def style(self, style=None, on_stderr=False): if style is None: style = self._default_style self._style = style self.set_console(on_stderr=on_stderr) def set_console(self, attrs=None, on_stderr=False): if attrs is None: attrs = self.get_attrs() handle = win32.STDOUT if on_stderr: handle = win32.STDERR win32.SetConsoleTextAttribute(handle, attrs) def get_position(self, handle): position = win32.GetConsoleScreenBufferInfo(handle).dwCursorPosition # Because Windows coordinates are 0-based, # and win32.SetConsoleCursorPosition expects 1-based. position.X += 1 position.Y += 1 return position def set_cursor_position(self, position=None, on_stderr=False): if position is None: #I'm not currently tracking the position, so there is no default. #position = self.get_position() return handle = win32.STDOUT if on_stderr: handle = win32.STDERR win32.SetConsoleCursorPosition(handle, position) def cursor_up(self, num_rows=0, on_stderr=False): if num_rows == 0: return handle = win32.STDOUT if on_stderr: handle = win32.STDERR position = self.get_position(handle) adjusted_position = (position.Y - num_rows, position.X) self.set_cursor_position(adjusted_position, on_stderr) def erase_data(self, mode=0, on_stderr=False): # 0 (or None) should clear from the cursor to the end of the screen. # 1 should clear from the cursor to the beginning of the screen. # 2 should clear the entire screen. (And maybe move cursor to (1,1)?) # # At the moment, I only support mode 2. From looking at the API, it # should be possible to calculate a different number of bytes to clear, # and to do so relative to the cursor position. if mode[0] not in (2,): return handle = win32.STDOUT if on_stderr: handle = win32.STDERR # here's where we'll home the cursor coord_screen = win32.COORD(0,0) csbi = win32.GetConsoleScreenBufferInfo(handle) # get the number of character cells in the current buffer dw_con_size = csbi.dwSize.X * csbi.dwSize.Y # fill the entire screen with blanks win32.FillConsoleOutputCharacter(handle, ' ', dw_con_size, coord_screen) # now set the buffer's attributes accordingly win32.FillConsoleOutputAttribute(handle, self.get_attrs(), dw_con_size, coord_screen ) # put the cursor at (0, 0) win32.SetConsoleCursorPosition(handle, (coord_screen.X, coord_screen.Y)) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/cprint.py000066400000000000000000000056171457240071200225130ustar00rootroot00000000000000""" Cross-platform color text printing Based on colorama (see pyqtgraph/util/colorama/README.txt) """ import sys from .colorama.win32 import windll from .colorama.winterm import WinColor, WinStyle, WinTerm _WIN = sys.platform.startswith('win') if windll is not None: winterm = WinTerm() else: _WIN = False def winset(reset=False, fore=None, back=None, style=None, stderr=False): if reset: winterm.reset_all() if fore is not None: winterm.fore(fore, stderr) if back is not None: winterm.back(back, stderr) if style is not None: winterm.style(style, stderr) ANSI = {} WIN = {} for i,color in enumerate(['BLACK', 'RED', 'GREEN', 'YELLOW', 'BLUE', 'MAGENTA', 'CYAN', 'WHITE']): globals()[color] = i globals()['BR_' + color] = i + 8 globals()['BACK_' + color] = i + 40 ANSI[i] = "\033[%dm" % (30+i) ANSI[i+8] = "\033[2;%dm" % (30+i) ANSI[i+40] = "\033[%dm" % (40+i) color = 'GREY' if color == 'WHITE' else color WIN[i] = {'fore': getattr(WinColor, color), 'style': WinStyle.NORMAL} WIN[i+8] = {'fore': getattr(WinColor, color), 'style': WinStyle.BRIGHT} WIN[i+40] = {'back': getattr(WinColor, color)} RESET = -1 ANSI[RESET] = "\033[0m" WIN[RESET] = {'reset': True} def cprint(stream, *args, **kwds): """ Print with color. Examples:: # colors are BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE cprint('stdout', RED, 'This is in red. ', RESET, 'and this is normal\n') # Adding BR_ before the color manes it bright cprint('stdout', BR_GREEN, 'This is bright green.\n', RESET) # Adding BACK_ changes background color cprint('stderr', BACK_BLUE, WHITE, 'This is white-on-blue.', -1) # Integers 0-7 for normal, 8-15 for bright, and 40-47 for background. # -1 to reset. cprint('stderr', 1, 'This is in red.', -1) """ if isinstance(stream, str): stream = kwds.get('stream', 'stdout') err = stream == 'stderr' stream = getattr(sys, stream) else: err = kwds.get('stderr', False) if hasattr(stream, 'isatty') and stream.isatty(): if _WIN: # convert to win32 calls for arg in args: if isinstance(arg, str): stream.write(arg) else: kwds = WIN[arg] winset(stderr=err, **kwds) else: # convert to ANSI for arg in args: if isinstance(arg, str): stream.write(arg) else: stream.write(ANSI[arg]) else: # ignore colors for arg in args: if isinstance(arg, str): stream.write(arg) def cout(*args): """Shorthand for cprint('stdout', ...)""" cprint('stdout', *args) def cerr(*args): """Shorthand for cprint('stderr', ...)""" cprint('stderr', *args) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/cupy_helper.py000066400000000000000000000010131457240071200235150ustar00rootroot00000000000000import os from warnings import warn from .. import getConfigOption def getCupy(): if getConfigOption("useCupy"): try: import cupy except ImportError: warn("cupy library could not be loaded, but 'useCupy' is set.") return None if os.name == "nt" and cupy.cuda.runtime.runtimeGetVersion() < 11000: warn("In Windows, CUDA toolkit should be version 11 or higher, or some functions may misbehave.") return cupy else: return None pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/garbage_collector.py000066400000000000000000000031051457240071200246400ustar00rootroot00000000000000import gc from ..Qt import QtCore class GarbageCollector(object): ''' Disable automatic garbage collection and instead collect manually on a timer. This is done to ensure that garbage collection only happens in the GUI thread, as otherwise Qt can crash. Credit: Erik Janssens Source: http://pydev.blogspot.com/2014/03/should-python-garbage-collector-be.html ''' def __init__(self, interval=1.0, debug=False): self.debug = debug if debug: gc.set_debug(gc.DEBUG_LEAK) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.check) self.threshold = gc.get_threshold() gc.disable() self.timer.start(int(interval * 1000)) def check(self): #return self.debug_cycles() # uncomment to just debug cycles l0, l1, l2 = gc.get_count() if self.debug: print('gc_check called:', l0, l1, l2) if l0 > self.threshold[0]: num = gc.collect(0) if self.debug: print('collecting gen 0, found: %d unreachable' % num) if l1 > self.threshold[1]: num = gc.collect(1) if self.debug: print('collecting gen 1, found: %d unreachable' % num) if l2 > self.threshold[2]: num = gc.collect(2) if self.debug: print('collecting gen 2, found: %d unreachable' % num) def debug_cycles(self): gc.collect() for obj in gc.garbage: print(obj, repr(obj), type(obj)) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/get_resolution.py000066400000000000000000000012221457240071200242420ustar00rootroot00000000000000from .. import mkQApp from ..Qt import QtGui def test_screenInformation(): # a qApp is still needed, otherwise screen is None qApp = mkQApp() # noqa screen = QtGui.QGuiApplication.primaryScreen() screens = QtGui.QGuiApplication.screens() resolution = screen.size() availableResolution = screen.availableSize() print("Screen resolution: {}x{}".format(resolution.width(), resolution.height())) print("Available geometry: {}x{}".format(availableResolution.width(), availableResolution.height())) print("Number of Screens: {}".format(len(screens))) return None if __name__ == "__main__": test_screenInformation() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/glinfo.py000066400000000000000000000022501457240071200224600ustar00rootroot00000000000000import importlib from ..Qt import QT_LIB, QtGui GL_VENDOR = 7936 GL_RENDERER = 7937 GL_VERSION = 7938 def print_version(funcs): glGetString = funcs.glGetString print('VENDOR:', glGetString(GL_VENDOR)) print('RENDERER:', glGetString(GL_RENDERER)) print('VERSION:', glGetString(GL_VERSION)) def print_extensions(ctx): extensions = sorted([ext.data().decode() for ext in ctx.extensions()]) print("Extensions:") for ext in extensions: print(f" {ext}") app = QtGui.QGuiApplication([]) surf = QtGui.QOffscreenSurface() surf.create() ctx = QtGui.QOpenGLContext() ctx.create() ctx.makeCurrent(surf) if QT_LIB == 'PySide2': funcs = ctx.functions() elif QT_LIB == 'PyQt5': profile = QtGui.QOpenGLVersionProfile() profile.setVersion(2, 0) funcs = ctx.versionFunctions(profile) elif QT_LIB in ['PyQt6', 'PySide6']: QtOpenGL = importlib.import_module(f'{QT_LIB}.QtOpenGL') profile = QtOpenGL.QOpenGLVersionProfile() profile.setVersion(2, 0) funcs_factory = QtOpenGL.QOpenGLVersionFunctionsFactory() funcs = funcs_factory.get(profile, ctx) print('isOpenGLES:', ctx.isOpenGLES()) print_version(funcs) print_extensions(ctx) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/mutex.py000066400000000000000000000065621457240071200223560ustar00rootroot00000000000000import traceback from ..Qt import QtCore class Mutex(QtCore.QMutex): """ Subclass of QMutex that provides useful debugging information during deadlocks--tracebacks are printed for both the code location that is attempting to lock the mutex as well as the location that has already acquired the lock. Also provides __enter__ and __exit__ methods for use in "with" statements. """ def __init__(self, *args, **kargs): if kargs.get('recursive', False): args = (QtCore.QMutex.Recursive,) QtCore.QMutex.__init__(self, *args) self.l = QtCore.QMutex() ## for serializing access to self.tb self.tb = [] self.debug = kargs.pop('debug', False) ## True to enable debugging functions def tryLock(self, timeout=None, id=None): if timeout is None: locked = QtCore.QMutex.tryLock(self) else: locked = QtCore.QMutex.tryLock(self, timeout) if self.debug and locked: self.l.lock() try: if id is None: self.tb.append(''.join(traceback.format_stack()[:-1])) else: self.tb.append(" " + str(id)) #print 'trylock', self, len(self.tb) finally: self.l.unlock() return locked def lock(self, id=None): c = 0 waitTime = 5000 # in ms while True: if self.tryLock(waitTime, id): break c += 1 if self.debug: self.l.lock() try: print("Waiting for mutex lock (%0.1f sec). Traceback follows:" % (c*waitTime/1000.)) traceback.print_stack() if len(self.tb) > 0: print("Mutex is currently locked from:\n") print(self.tb[-1]) else: print("Mutex is currently locked from [???]") finally: self.l.unlock() #print 'lock', self, len(self.tb) def unlock(self): QtCore.QMutex.unlock(self) if self.debug: self.l.lock() try: #print 'unlock', self, len(self.tb) if len(self.tb) > 0: self.tb.pop() else: raise Exception("Attempt to unlock mutex before it has been locked") finally: self.l.unlock() def acquire(self, blocking=True): """Mimics threading.Lock.acquire() to allow this class as a drop-in replacement. """ return self.tryLock() def release(self): """Mimics threading.Lock.release() to allow this class as a drop-in replacement. """ self.unlock() def depth(self): self.l.lock() n = len(self.tb) self.l.unlock() return n def traceback(self): self.l.lock() try: ret = self.tb[:] finally: self.l.unlock() return ret def __exit__(self, *args): self.unlock() def __enter__(self): self.lock() return self class RecursiveMutex(Mutex): """Mimics threading.RLock class. """ def __init__(self, **kwds): kwds['recursive'] = True Mutex.__init__(self, **kwds) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/util/numba_helper.py000066400000000000000000000006161457240071200236470ustar00rootroot00000000000000from warnings import warn from .. import getConfigOption def getNumbaFunctions(): if getConfigOption("useNumba"): try: import numba # noqa except ImportError: warn("numba library could not be loaded, but 'useNumba' is set.") return None from .. import functions_numba return functions_numba else: return None pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/000077500000000000000000000000001457240071200213225ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/BusyCursor.py000066400000000000000000000024561457240071200240230ustar00rootroot00000000000000from contextlib import contextmanager from ..Qt import QtCore, QtGui, QtWidgets __all__ = ["BusyCursor"] @contextmanager def BusyCursor(): """ Display a busy mouse cursor during long operations. Usage:: with BusyCursor(): doLongOperation() May be nested. If called from a non-gui thread, then the cursor will not be affected. """ app = QtCore.QCoreApplication.instance() in_gui_thread = (app is not None) and (QtCore.QThread.currentThread() == app.thread()) try: if in_gui_thread: guard = QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CursorShape.WaitCursor)) # on PySide6 6.3.0, setOverrideCursor() returns a QOverrideCursorGuard object # that, on its destruction, calls restoreOverrideCursor() if the user had not # already done so. # if the user wants to call it manually, they must do it via the returned object, # and not via the QtWidgets.QApplication static method; otherwise the restore # would get called twice. yield finally: if in_gui_thread: if hasattr(guard, 'restoreOverrideCursor'): guard.restoreOverrideCursor() else: QtWidgets.QApplication.restoreOverrideCursor() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/CheckTable.py000066400000000000000000000064451457240071200236720ustar00rootroot00000000000000from ..Qt import QtCore, QtWidgets from . import VerticalLabel __all__ = ['CheckTable'] class CheckTable(QtWidgets.QWidget): sigStateChanged = QtCore.Signal(object, object, object) # (row, col, state) def __init__(self, columns): QtWidgets.QWidget.__init__(self) self.layout = QtWidgets.QGridLayout() self.layout.setSpacing(0) self.setLayout(self.layout) self.headers = [] self.columns = columns col = 1 for c in columns: label = VerticalLabel.VerticalLabel(c, orientation='vertical') self.headers.append(label) self.layout.addWidget(label, 0, col) col += 1 self.rowNames = [] self.rowWidgets = [] self.oldRows = {} ## remember settings from removed rows; reapply if they reappear. def updateRows(self, rows): for r in self.rowNames[:]: if r not in rows: self.removeRow(r) for r in rows: if r not in self.rowNames: self.addRow(r) def addRow(self, name): label = QtWidgets.QLabel(name) row = len(self.rowNames)+1 self.layout.addWidget(label, row, 0) checks = [] col = 1 for c in self.columns: check = QtWidgets.QCheckBox('') check.col = c check.row = name self.layout.addWidget(check, row, col) checks.append(check) if name in self.oldRows: check.setChecked(self.oldRows[name][col]) col += 1 #QtCore.QObject.connect(check, QtCore.SIGNAL('stateChanged(int)'), self.checkChanged) check.stateChanged.connect(self.checkChanged) self.rowNames.append(name) self.rowWidgets.append([label] + checks) def removeRow(self, name): row = self.rowNames.index(name) self.oldRows[name] = self.saveState()['rows'][row] ## save for later self.rowNames.pop(row) for w in self.rowWidgets[row]: w.setParent(None) #QtCore.QObject.disconnect(w, QtCore.SIGNAL('stateChanged(int)'), self.checkChanged) if isinstance(w, QtWidgets.QCheckBox): w.stateChanged.disconnect(self.checkChanged) self.rowWidgets.pop(row) for i in range(row, len(self.rowNames)): widgets = self.rowWidgets[i] for j in range(len(widgets)): widgets[j].setParent(None) self.layout.addWidget(widgets[j], i+1, j) def checkChanged(self, state): check = QtCore.QObject.sender(self) #self.emit(QtCore.SIGNAL('stateChanged'), check.row, check.col, state) self.sigStateChanged.emit(check.row, check.col, state) def saveState(self): rows = [] for i in range(len(self.rowNames)): row = [self.rowNames[i]] + [c.isChecked() for c in self.rowWidgets[i][1:]] rows.append(row) return {'cols': self.columns, 'rows': rows} def restoreState(self, state): rows = [r[0] for r in state['rows']] self.updateRows(rows) for r in state['rows']: rowNum = self.rowNames.index(r[0]) for i in range(1, len(r)): self.rowWidgets[rowNum][i].setChecked(r[i]) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/ColorButton.py000066400000000000000000000073331457240071200241540ustar00rootroot00000000000000from .. import functions as functions from ..Qt import QtCore, QtGui, QtWidgets __all__ = ['ColorButton'] class ColorButton(QtWidgets.QPushButton): """ **Bases:** QtWidgets.QPushButton Button displaying a color and allowing the user to select a new color. ====================== ============================================================ **Signals:** sigColorChanging(self) emitted whenever a new color is picked in the color dialog sigColorChanged(self) emitted when the selected color is accepted (user clicks OK) ====================== ============================================================ """ sigColorChanging = QtCore.Signal(object) ## emitted whenever a new color is picked in the color dialog sigColorChanged = QtCore.Signal(object) ## emitted when the selected color is accepted (user clicks OK) def __init__(self, parent=None, color=(128,128,128), padding=6): QtWidgets.QPushButton.__init__(self, parent) self.padding = (padding, padding, -padding, -padding) if isinstance(padding, (int, float)) else padding self.setColor(color) self.colorDialog = QtWidgets.QColorDialog() self.colorDialog.setOption(QtWidgets.QColorDialog.ColorDialogOption.ShowAlphaChannel, True) self.colorDialog.setOption(QtWidgets.QColorDialog.ColorDialogOption.DontUseNativeDialog, True) self.colorDialog.currentColorChanged.connect(self.dialogColorChanged) self.colorDialog.rejected.connect(self.colorRejected) self.colorDialog.colorSelected.connect(self.colorSelected) #QtCore.QObject.connect(self.colorDialog, QtCore.SIGNAL('currentColorChanged(const QColor&)'), self.currentColorChanged) #QtCore.QObject.connect(self.colorDialog, QtCore.SIGNAL('rejected()'), self.currentColorRejected) self.clicked.connect(self.selectColor) self.setMinimumHeight(15) self.setMinimumWidth(15) def paintEvent(self, ev): super().paintEvent(ev) p = QtGui.QPainter(self) rect = self.rect().adjusted(*self.padding) ## draw white base, then texture for indicating transparency, then actual color p.setBrush(functions.mkBrush('w')) p.drawRect(rect) p.setBrush(QtGui.QBrush(QtCore.Qt.BrushStyle.DiagCrossPattern)) p.drawRect(rect) p.setBrush(functions.mkBrush(self._color)) p.drawRect(rect) p.end() def setColor(self, color, finished=True): """Sets the button's color and emits both sigColorChanged and sigColorChanging.""" self._color = functions.mkColor(color) self.update() if finished: self.sigColorChanged.emit(self) else: self.sigColorChanging.emit(self) def selectColor(self): self.origColor = self.color() self.colorDialog.setCurrentColor(self.color()) self.colorDialog.open() def dialogColorChanged(self, color): if color.isValid(): self.setColor(color, finished=False) def colorRejected(self): self.setColor(self.origColor, finished=False) def colorSelected(self, color): self.setColor(self._color, finished=True) def saveState(self): return self._color.getRgb() def restoreState(self, state): self.setColor(state) def color(self, mode='qcolor'): color = functions.mkColor(self._color) if mode == 'qcolor': return color elif mode == 'byte': return color.getRgb() elif mode == 'float': return color.getRgbF() def widgetGroupInterface(self): return (self.sigColorChanged, ColorButton.saveState, ColorButton.restoreState) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/ColorMapButton.py000066400000000000000000000214131457240071200246050ustar00rootroot00000000000000import importlib.util import re import numpy as np from .. import colormap from .. import functions as fn from ..graphicsItems.GradientPresets import Gradients from ..Qt import QtCore, QtGui, QtWidgets __all__ = ['ColorMapButton'] def buildMenuEntryWidget(cmap, text): lut = cmap.getLookupTable(nPts=32, alpha=True) qimg = QtGui.QImage(lut, len(lut), 1, QtGui.QImage.Format.Format_RGBA8888) pixmap = QtGui.QPixmap.fromImage(qimg) widget = QtWidgets.QWidget() layout = QtWidgets.QHBoxLayout(widget) layout.setContentsMargins(1,1,1,1) label1 = QtWidgets.QLabel() label1.setScaledContents(True) label1.setPixmap(pixmap) label2 = QtWidgets.QLabel(text) layout.addWidget(label1, 0) layout.addWidget(label2, 1) return widget def preset_gradient_to_colormap(name): # generate the hsv two gradients using makeHslCycle if name == 'spectrum': # steps=30 for 300 degrees gives the same density as # the default steps=36 for 360 degrees cmap = colormap.makeHslCycle((0, 300/360), steps=30) elif name == 'cyclic': cmap = colormap.makeHslCycle((1, 0)) else: cmap = colormap.ColorMap(*zip(*Gradients[name]["ticks"]), name=name) return cmap class ColorMapMenu(QtWidgets.QMenu): def __init__(self, showGradientSubMenu=False): super().__init__() topmenu = self act = topmenu.addAction('None') act.setData((None, None)) topmenu.addSeparator() if showGradientSubMenu: submenu = topmenu.addMenu('preset gradient') submenu.aboutToShow.connect(self.buildGradientSubMenu) submenu = topmenu.addMenu('local') submenu.aboutToShow.connect(self.buildLocalSubMenu) # render the submenus only if the user actually clicks on it have_colorcet = importlib.util.find_spec('colorcet') is not None # the local cet files are a subset of the colorcet module. # expose just one of them. if not have_colorcet: submenu = topmenu.addMenu('cet (local)') submenu.aboutToShow.connect(self.buildCetLocalSubMenu) else: submenu = topmenu.addMenu('cet (external)') submenu.aboutToShow.connect(self.buildCetExternalSubMenu) if importlib.util.find_spec('matplotlib') is not None: submenu = topmenu.addMenu('matplotlib') submenu.aboutToShow.connect(self.buildMatplotlibSubMenu) if have_colorcet: submenu = topmenu.addMenu('colorcet') submenu.aboutToShow.connect(self.buildColorcetSubMenu) def buildGradientSubMenu(self): source = 'preset-gradient' names = list(Gradients.keys()) self.buildSubMenu(names, source, sort=False) def buildLocalSubMenu(self): source = None names = colormap.listMaps(source=source) names = [x for x in names if not x.startswith('CET')] self.buildSubMenu(names, source) def buildCetLocalSubMenu(self): source = None names = colormap.listMaps(source=source) names = [x for x in names if x.startswith('CET')] self.buildSubMenu(names, source) def buildCetExternalSubMenu(self): source = 'colorcet' names = colormap.listMaps(source=source) names = [x for x in names if x.startswith('CET')] self.buildSubMenu(names, source) def buildMatplotlibSubMenu(self): source = 'matplotlib' names = colormap.listMaps(source=source) # remove entries registered by colorcet names = [x for x in names if not x.startswith('cet_')] # remove the reversed colormaps names = [x for x in names if not x.endswith('_r')] self.buildSubMenu(names, source) def buildColorcetSubMenu(self): # colorcet colormaps with shorter/simpler aliases source = 'colorcet' import colorcet names = list(colorcet.palette_n.keys()) self.buildSubMenu(names, source) def buildSubMenu(self, names, source, sort=True): # in Qt6 we could have used Qt.ConnectionType.SingleShotConnection menu = self.sender() menu.aboutToShow.disconnect() if sort: pattern = re.compile(r'(\d+)') key = lambda x: [int(c) if c.isdigit() else c for c in pattern.split(x)] names = sorted(names, key=key) for name in names: if source == 'preset-gradient': cmap = preset_gradient_to_colormap(name) else: cmap = colormap.get(name, source=source) act = QtWidgets.QWidgetAction(menu) act.setData((name, source)) act.setDefaultWidget(buildMenuEntryWidget(cmap, name)) menu.addAction(act) class ColorMapDisplayMixin: # Note that this Mixin attempts to be safe for inheritance # on either the lhs or rhs. To this end: # 1) the __init__ is safe to be called more than once # 2) it does not override any main class virtual methods def __init__(self, *, orientation): self.horizontal = orientation == 'horizontal' self._menu = None self._setColorMap(None) def setMaximumThickness(self, val): # calls main class methods Thickness = 'Height' if self.horizontal else 'Width' getattr(self, f'setMaximum{Thickness}')(val) def _setColorMap(self, cmap): if isinstance(cmap, str): try: cmap = colormap.get(cmap) except FileNotFoundError: cmap = None if cmap is None: cmap = colormap.ColorMap(None, [0.0, 1.0]) self._cmap = cmap self._image = None def setColorMap(self, cmap): # calls main class methods self._setColorMap(cmap) self.colorMapChanged() def colorMap(self): return self._cmap def getImage(self): if self._image is None: lut = self._cmap.getLookupTable(nPts=256, alpha=True) lut = np.expand_dims(lut, axis=0 if self.horizontal else 1) qimg = fn.ndarray_to_qimage(lut, QtGui.QImage.Format.Format_RGBA8888) self._image = qimg if self.horizontal else qimg.mirrored() return self._image def getMenu(self): if self._menu is None: self._menu = ColorMapMenu() self._menu.triggered.connect(self.menuTriggered) return self._menu def menuTriggered(self, action): name, source = action.data() if name is None: cmap = None elif source == 'preset-gradient': cmap = preset_gradient_to_colormap(name) else: # colormap module maintains a cache keyed by name only. # thus if a colormap has the same name in two different sources, # we will end up getting whatever was already cached. cmap = colormap.get(name, source=source) self.setColorMap(cmap) def paintColorMap(self, painter, rect): painter.save() image = self.getImage() painter.drawImage(rect, image) if not self.horizontal: painter.translate(rect.center()) painter.rotate(-90) painter.translate(-rect.center()) text = self.colorMap().name wpen = QtGui.QPen(QtCore.Qt.GlobalColor.white) bpen = QtGui.QPen(QtCore.Qt.GlobalColor.black) # get an estimate of the lightness of the colormap # from its center element lightness = image.pixelColor(image.rect().center()).lightnessF() if lightness >= 0.5: # light: draw text with dark pen pens = [wpen, bpen] else: # dark: draw text with light pen pens = [bpen, wpen] AF = QtCore.Qt.AlignmentFlag trect = painter.boundingRect(rect, AF.AlignCenter, text) # draw a background shadow painter.setPen(pens[0]) painter.drawText(trect, 0, text) # draw the foreground text painter.setPen(pens[1]) painter.drawText(trect.adjusted(1,0,1,0), 0, text) painter.restore() class ColorMapButton(ColorMapDisplayMixin, QtWidgets.QWidget): sigColorMapChanged = QtCore.Signal(object) def __init__(self): QtWidgets.QWidget.__init__(self) ColorMapDisplayMixin.__init__(self, orientation='horizontal') def colorMapChanged(self): cmap = self.colorMap() self.sigColorMapChanged.emit(cmap) self.update() def paintEvent(self, evt): painter = QtGui.QPainter(self) self.paintColorMap(painter, self.contentsRect()) painter.end() def mouseReleaseEvent(self, evt): if evt.button() != QtCore.Qt.MouseButton.LeftButton: return # position the menu below the widget pos = self.mapToGlobal(self.pos()) pos.setY(pos.y() + self.height()) self.getMenu().popup(pos) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/ColorMapWidget.py000066400000000000000000000251611457240071200245610ustar00rootroot00000000000000from collections import OrderedDict import numpy as np from .. import functions as fn from .. import parametertree as ptree from ..Qt import QtCore __all__ = ['ColorMapWidget', 'ColorMapParameter'] class ColorMapWidget(ptree.ParameterTree): """ This class provides a widget allowing the user to customize color mapping for multi-column data. Given a list of field names, the user may specify multiple criteria for assigning colors to each record in a numpy record array. Multiple criteria are evaluated and combined into a single color for each record by user-defined compositing methods. For simpler color mapping using a single gradient editor, see :class:`GradientWidget ` """ sigColorMapChanged = QtCore.Signal(object) def __init__(self, parent=None): ptree.ParameterTree.__init__(self, parent=parent, showHeader=False) self.params = ColorMapParameter() self.setParameters(self.params) self.params.sigTreeStateChanged.connect(self.mapChanged) ## wrap a couple methods self.setFields = self.params.setFields self.map = self.params.map def mapChanged(self): self.sigColorMapChanged.emit(self) def widgetGroupInterface(self): return (self.sigColorMapChanged, self.saveState, self.restoreState) def saveState(self): return self.params.saveState() def restoreState(self, state): self.params.restoreState(state) def addColorMap(self, name): """Add a new color mapping and return the created parameter. """ return self.params.addNew(name) class ColorMapParameter(ptree.types.GroupParameter): sigColorMapChanged = QtCore.Signal(object) def __init__(self): self.fields = {} ptree.types.GroupParameter.__init__(self, name='Color Map', addText='Add Mapping..', addList=[]) self.sigTreeStateChanged.connect(self.mapChanged) def mapChanged(self): self.sigColorMapChanged.emit(self) def addNew(self, name): fieldSpec = self.fields[name] mode = fieldSpec.get('mode', 'range') if mode == 'range': item = RangeColorMapItem(name, self.fields[name]) elif mode == 'enum': item = EnumColorMapItem(name, self.fields[name]) defaults = fieldSpec.get('defaults', {}) for k, v in defaults.items(): if k == 'colormap': if mode == 'range': item.setValue(v) elif mode == 'enum': children = item.param('Values').children() for i, child in enumerate(children): try: child.setValue(v[i]) except IndexError: continue else: item[k] = v self.addChild(item) return item def fieldNames(self): return list(self.fields.keys()) def setFields(self, fields): """ Set the list of fields to be used by the mapper. The format of *fields* is:: [ (fieldName, {options}), ... ] ============== ============================================================ Field Options: mode Either 'range' or 'enum' (default is range). For 'range', The user may specify a gradient of colors to be applied linearly across a specific range of values. For 'enum', the user specifies a single color for each unique value (see *values* option). units String indicating the units of the data for this field. values List of unique values for which the user may assign a color when mode=='enum'. Optionally may specify a dict instead {value: name}. defaults Dict of default values to apply to color map items when they are created. Valid keys are 'colormap' to provide a default color map, or otherwise they a string or tuple indicating the parameter to be set, such as 'Operation' or ('Channels..', 'Red'). ============== ============================================================ """ self.fields = OrderedDict(fields) #self.fields = fields #self.fields.sort() names = self.fieldNames() self.setAddList(names) def map(self, data, mode='byte'): """ Return an array of colors corresponding to *data*. ============== ================================================================= **Arguments:** data A numpy record array where the fields in data.dtype match those defined by a prior call to setFields(). mode Either 'byte' or 'float'. For 'byte', the method returns an array of dtype ubyte with values scaled 0-255. For 'float', colors are returned as 0.0-1.0 float values. ============== ================================================================= """ if isinstance(data, dict): data = np.array([tuple(data.values())], dtype=[(k, float) for k in data.keys()]) colors = np.zeros((len(data),4)) for item in self.children(): if not item['Enabled']: continue chans = item.param('Channels..') mask = np.empty((len(data), 4), dtype=bool) for i,f in enumerate(['Red', 'Green', 'Blue', 'Alpha']): mask[:,i] = chans[f] colors2 = item.map(data) op = item['Operation'] if op == 'Add': colors[mask] = colors[mask] + colors2[mask] elif op == 'Multiply': colors[mask] *= colors2[mask] elif op == 'Overlay': a = colors2[:,3:4] c3 = colors * (1-a) + colors2 * a c3[:,3:4] = colors[:,3:4] + (1-colors[:,3:4]) * a colors = c3 elif op == 'Set': colors[mask] = colors2[mask] colors = fn.clip_array(colors, 0., 1.) if mode == 'byte': colors = (colors * 255).astype(np.ubyte) return colors def saveState(self): items = OrderedDict() for item in self: itemState = item.saveState(filter='user') itemState['field'] = item.fieldName items[item.name()] = itemState state = {'fields': self.fields, 'items': items} return state def restoreState(self, state): if 'fields' in state: self.setFields(state['fields']) for name, itemState in state['items'].items(): item = self.addNew(itemState['field']) item.restoreState(itemState) class RangeColorMapItem(ptree.types.ColorMapParameter): mapType = 'range' def __init__(self, name, opts): self.fieldName = name units = opts.get('units', '') ptree.types.ColorMapParameter.__init__(self, name=name, autoIncrementName=True, type='colormap', removable=True, renamable=True, children=[ #dict(name="Field", type='list', value=name, limits=fields), dict(name='Min', type='float', value=0.0, suffix=units, siPrefix=True), dict(name='Max', type='float', value=1.0, suffix=units, siPrefix=True), dict(name='Operation', type='list', value='Overlay', limits=['Overlay', 'Add', 'Multiply', 'Set']), dict(name='Channels..', type='group', expanded=False, children=[ dict(name='Red', type='bool', value=True), dict(name='Green', type='bool', value=True), dict(name='Blue', type='bool', value=True), dict(name='Alpha', type='bool', value=True), ]), dict(name='Enabled', type='bool', value=True), dict(name='NaN', type='color'), ]) def map(self, data): data = data[self.fieldName] scaled = fn.clip_array((data-self['Min']) / (self['Max']-self['Min']), 0, 1) cmap = self.value() colors = cmap.map(scaled, mode='float') mask = np.invert(np.isfinite(data)) nanColor = self['NaN'] nanColor = nanColor.getRgbF() colors[mask] = nanColor return colors class EnumColorMapItem(ptree.types.GroupParameter): mapType = 'enum' def __init__(self, name, opts): self.fieldName = name vals = opts.get('values', []) if isinstance(vals, list): vals = OrderedDict([(v,str(v)) for v in vals]) childs = [] for val,vname in vals.items(): ch = ptree.Parameter.create(name=vname, type='color') ch.maskValue = val childs.append(ch) ptree.types.GroupParameter.__init__(self, name=name, autoIncrementName=True, removable=True, renamable=True, children=[ dict(name='Values', type='group', children=childs), dict(name='Operation', type='list', value='Overlay', limits=['Overlay', 'Add', 'Multiply', 'Set']), dict(name='Channels..', type='group', expanded=False, children=[ dict(name='Red', type='bool', value=True), dict(name='Green', type='bool', value=True), dict(name='Blue', type='bool', value=True), dict(name='Alpha', type='bool', value=True), ]), dict(name='Enabled', type='bool', value=True), dict(name='Default', type='color'), ]) def map(self, data): data = data[self.fieldName] colors = np.empty((len(data), 4)) default = np.array(self['Default'].getRgbF()) colors[:] = default for v in self.param('Values'): mask = data == v.maskValue c = np.array(v.value().getRgbF()) colors[mask] = c #scaled = np.clip((data-self['Min']) / (self['Max']-self['Min']), 0, 1) #cmap = self.value() #colors = cmap.map(scaled, mode='float') #mask = np.isnan(data) | np.isinf(data) #nanColor = self['NaN'] #nanColor = nanColor.getRgbF() #colors[mask] = nanColor return colors pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/ComboBox.py000066400000000000000000000170761457240071200234170ustar00rootroot00000000000000import sys from collections import OrderedDict from ..Qt import QtWidgets __all__ = ['ComboBox'] class ComboBox(QtWidgets.QComboBox): """Extends QComboBox to add extra functionality. * Handles dict mappings -- user selects a text key, and the ComboBox indicates the selected value. * Requires item strings to be unique * Remembers selected value if list is cleared and subsequently repopulated * setItems() replaces the items in the ComboBox and blocks signals if the value ultimately does not change. """ def __init__(self, parent=None, items=None, default=None): QtWidgets.QComboBox.__init__(self, parent) self.currentIndexChanged.connect(self.indexChanged) self._ignoreIndexChange = False #self.value = default if 'darwin' in sys.platform: ## because MacOSX can show names that are wider than the comboBox self.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToContents) #self.setMinimumContentsLength(10) self._chosenText = None self._items = OrderedDict() if items is not None: self.setItems(items) if default is not None: self.setValue(default) def setValue(self, value): """Set the selected item to the first one having the given value.""" text = None for k,v in self._items.items(): if v == value: text = k break if text is None: raise ValueError(value) self.setText(text) def setText(self, text): """Set the selected item to the first one having the given text.""" ind = self.findText(text) if ind == -1: raise ValueError(text) #self.value = value self.setCurrentIndex(ind) def value(self): """ If items were given as a list of strings, then return the currently selected text. If items were given as a dict, then return the value corresponding to the currently selected key. If the combo list is empty, return None. """ if self.count() == 0: return None text = self.currentText() return self._items[text] def ignoreIndexChange(func): # Decorator that prevents updates to self._chosenText def fn(self, *args, **kwds): prev = self._ignoreIndexChange self._ignoreIndexChange = True try: ret = func(self, *args, **kwds) finally: self._ignoreIndexChange = prev return ret return fn def blockIfUnchanged(func): # decorator that blocks signal emission during complex operations # and emits currentIndexChanged only if the value has actually # changed at the end. def fn(self, *args, **kwds): prevVal = self.value() blocked = self.signalsBlocked() self.blockSignals(True) try: ret = func(self, *args, **kwds) finally: self.blockSignals(blocked) # only emit if the value has changed if self.value() != prevVal: self.currentIndexChanged.emit(self.currentIndex()) return ret return fn @ignoreIndexChange @blockIfUnchanged def setItems(self, items): """ *items* may be a list, a tuple, or a dict. If a dict is given, then the keys are used to populate the combo box and the values will be used for both value() and setValue(). """ self.clear() self.addItems(items) def items(self): return self.items.copy() def updateList(self, items): # for backward compatibility return self.setItems(items) def indexChanged(self, index): # current index has changed; need to remember new 'chosen text' if self._ignoreIndexChange: return self._chosenText = self.currentText() def setCurrentIndex(self, index): QtWidgets.QComboBox.setCurrentIndex(self, index) def itemsChanged(self): # try to set the value to the last one selected, if it is available. if self._chosenText is not None: try: self.setText(self._chosenText) except ValueError: pass @ignoreIndexChange def insertItem(self, *args): raise NotImplementedError() #QtWidgets.QComboBox.insertItem(self, *args) #self.itemsChanged() @ignoreIndexChange def insertItems(self, *args): raise NotImplementedError() #QtWidgets.QComboBox.insertItems(self, *args) #self.itemsChanged() @ignoreIndexChange def addItem(self, *args, **kwds): # Need to handle two different function signatures for QComboBox.addItem try: if isinstance(args[0], str): text = args[0] if len(args) == 2: value = args[1] else: value = kwds.get('value', text) else: text = args[1] if len(args) == 3: value = args[2] else: value = kwds.get('value', text) except IndexError: raise TypeError("First or second argument of addItem must be a string.") if text in self._items: raise Exception('ComboBox already has item named "%s".' % text) self._items[text] = value QtWidgets.QComboBox.addItem(self, *args) self.itemsChanged() def setItemValue(self, name, value): if name not in self._items: self.addItem(name, value) else: self._items[name] = value @ignoreIndexChange @blockIfUnchanged def addItems(self, items): if isinstance(items, list) or isinstance(items, tuple): texts = items items = dict([(x, x) for x in items]) elif isinstance(items, dict): texts = list(items.keys()) else: raise TypeError("items argument must be list or dict or tuple (got %s)." % type(items)) for t in texts: if t in self._items: raise Exception('ComboBox already has item named "%s".' % t) for k,v in items.items(): self._items[k] = v QtWidgets.QComboBox.addItems(self, list(texts)) self.itemsChanged() @ignoreIndexChange def clear(self): self._items = OrderedDict() QtWidgets.QComboBox.clear(self) self.itemsChanged() def saveState(self): ind = self.currentIndex() data = self.itemData(ind) #if not data.isValid(): if data is not None: try: if not data.isValid(): data = None else: data = data.toInt()[0] except AttributeError: pass if data is None: return self.itemText(ind) else: return data def restoreState(self, v): if type(v) is int: ind = self.findData(v) if ind > -1: self.setCurrentIndex(ind) return self.setCurrentIndex(self.findText(str(v))) def widgetGroupInterface(self): return (self.currentIndexChanged, self.saveState, self.restoreState) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/DataFilterWidget.py000066400000000000000000000167651457240071200250760ustar00rootroot00000000000000from collections import OrderedDict import numpy as np from .. import functions as fn from .. import parametertree as ptree from ..Qt import QtCore __all__ = ['DataFilterWidget'] class DataFilterWidget(ptree.ParameterTree): """ This class allows the user to filter multi-column data sets by specifying multiple criteria Wraps methods from DataFilterParameter: setFields, generateMask, filterData, and describe. """ sigFilterChanged = QtCore.Signal(object) def __init__(self): ptree.ParameterTree.__init__(self, showHeader=False) self.params = DataFilterParameter() self.setParameters(self.params) self.params.sigFilterChanged.connect(self.sigFilterChanged) self.setFields = self.params.setFields self.generateMask = self.params.generateMask self.filterData = self.params.filterData self.describe = self.params.describe def parameters(self): return self.params def addFilter(self, name): """Add a new filter and return the created parameter item. """ return self.params.addNew(name) class DataFilterParameter(ptree.types.GroupParameter): """A parameter group that specifies a set of filters to apply to tabular data. """ sigFilterChanged = QtCore.Signal(object) def __init__(self): self.fields = {} ptree.types.GroupParameter.__init__(self, name='Data Filter', addText='Add filter..', addList=[]) self.sigTreeStateChanged.connect(self.filterChanged) def filterChanged(self): self.sigFilterChanged.emit(self) def addNew(self, name): mode = self.fields[name].get('mode', 'range') if mode == 'range': child = self.addChild(RangeFilterItem(name, self.fields[name])) elif mode == 'enum': child = self.addChild(EnumFilterItem(name, self.fields[name])) else: raise ValueError("field mode must be 'range' or 'enum'") return child def fieldNames(self): return self.fields.keys() def setFields(self, fields): """Set the list of fields that are available to be filtered. *fields* must be a dict or list of tuples that maps field names to a specification describing the field. Each specification is itself a dict with either ``'mode':'range'`` or ``'mode':'enum'``:: filter.setFields([ ('field1', {'mode': 'range'}), ('field2', {'mode': 'enum', 'values': ['val1', 'val2', 'val3']}), ('field3', {'mode': 'enum', 'values': {'val1':True, 'val2':False, 'val3':True}}), ]) """ with fn.SignalBlock(self.sigTreeStateChanged, self.filterChanged): self.fields = OrderedDict(fields) names = self.fieldNames() self.setAddList(names) # update any existing filters for ch in self.children(): name = ch.fieldName if name in fields: ch.updateFilter(fields[name]) self.sigFilterChanged.emit(self) def filterData(self, data): if len(data) == 0: return data return data[self.generateMask(data)] def generateMask(self, data): """Return a boolean mask indicating whether each item in *data* passes the filter critera. """ mask = np.ones(len(data), dtype=bool) if len(data) == 0: return mask for fp in self: if fp.value() is False: continue mask &= fp.generateMask(data, mask.copy()) #key, mn, mx = fp.fieldName, fp['Min'], fp['Max'] #vals = data[key] #mask &= (vals >= mn) #mask &= (vals < mx) ## Use inclusive minimum and non-inclusive maximum. This makes it easier to create non-overlapping selections return mask def describe(self): """Return a list of strings describing the currently enabled filters.""" desc = [] for fp in self: if fp.value() is False: continue desc.append(fp.describe()) return desc class RangeFilterItem(ptree.types.SimpleParameter): def __init__(self, name, opts): self.fieldName = name units = opts.get('units', '') self.units = units ptree.types.SimpleParameter.__init__(self, name=name, autoIncrementName=True, type='bool', value=True, removable=True, renamable=True, children=[ #dict(name="Field", type='list', value=name, limits=fields), dict(name='Min', type='float', value=0.0, suffix=units, siPrefix=True), dict(name='Max', type='float', value=1.0, suffix=units, siPrefix=True), ]) def generateMask(self, data, mask): vals = data[self.fieldName][mask] mask[mask] = (vals >= self['Min']) & (vals < self['Max']) ## Use inclusive minimum and non-inclusive maximum. This makes it easier to create non-overlapping selections return mask def describe(self): return "%s < %s < %s" % (fn.siFormat(self['Min'], suffix=self.units), self.fieldName, fn.siFormat(self['Max'], suffix=self.units)) def updateFilter(self, opts): pass class EnumFilterItem(ptree.types.SimpleParameter): def __init__(self, name, opts): self.fieldName = name ptree.types.SimpleParameter.__init__(self, name=name, autoIncrementName=True, type='bool', value=True, removable=True, renamable=True) self.setEnumVals(opts) def generateMask(self, data, startMask): vals = data[self.fieldName][startMask] mask = np.ones(len(vals), dtype=bool) otherMask = np.ones(len(vals), dtype=bool) for c in self: key = c.maskValue if key == '__other__': m = ~otherMask else: m = vals != key otherMask &= m if c.value() is False: mask &= m startMask[startMask] = mask return startMask def describe(self): vals = [ch.name() for ch in self if ch.value() is True] return "%s: %s" % (self.fieldName, ', '.join(vals)) def updateFilter(self, opts): self.setEnumVals(opts) def setEnumVals(self, opts): vals = opts.get('values', {}) prevState = {} for ch in self.children(): prevState[ch.name()] = ch.value() self.removeChild(ch) if not isinstance(vals, dict): vals = OrderedDict([(v,(str(v), True)) for v in vals]) # Each filterable value can come with either (1) a string name, (2) a bool # indicating whether the value is enabled by default, or (3) a tuple providing # both. for val,valopts in vals.items(): if isinstance(valopts, bool): enabled = valopts vname = str(val) elif isinstance(valopts, str): enabled = True vname = valopts elif isinstance(valopts, tuple): vname, enabled = valopts ch = ptree.Parameter.create(name=vname, type='bool', value=prevState.get(vname, enabled)) ch.maskValue = val self.addChild(ch) ch = ptree.Parameter.create(name='(other)', type='bool', value=prevState.get('(other)', True)) ch.maskValue = '__other__' self.addChild(ch) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/DataTreeWidget.py000066400000000000000000000107301457240071200245320ustar00rootroot00000000000000import traceback import types from collections import OrderedDict import numpy as np from ..Qt import QtWidgets from .TableWidget import TableWidget try: import metaarray # noqa HAVE_METAARRAY = True except: HAVE_METAARRAY = False __all__ = ['DataTreeWidget'] class DataTreeWidget(QtWidgets.QTreeWidget): """ Widget for displaying hierarchical python data structures (eg, nested dicts, lists, and arrays) """ def __init__(self, parent=None, data=None): QtWidgets.QTreeWidget.__init__(self, parent) self.setVerticalScrollMode(self.ScrollMode.ScrollPerPixel) self.setData(data) self.setColumnCount(3) self.setHeaderLabels(['key / index', 'type', 'value']) self.setAlternatingRowColors(True) def setData(self, data, hideRoot=False): """data should be a dictionary.""" self.clear() self.widgets = [] self.nodes = {} self.buildTree(data, self.invisibleRootItem(), hideRoot=hideRoot) self.expandToDepth(3) self.resizeColumnToContents(0) def buildTree(self, data, parent, name='', hideRoot=False, path=()): if hideRoot: node = parent else: node = QtWidgets.QTreeWidgetItem([name, "", ""]) parent.addChild(node) # record the path to the node so it can be retrieved later # (this is used by DiffTreeWidget) self.nodes[path] = node typeStr, desc, childs, widget = self.parse(data) # Truncate description and add text box if needed if len(desc) > 100: desc = desc[:97] + '...' if widget is None: widget = QtWidgets.QPlainTextEdit(str(data)) widget.setMaximumHeight(200) widget.setReadOnly(True) node.setText(1, typeStr) node.setText(2, desc) # Add widget to new subnode if widget is not None: self.widgets.append(widget) subnode = QtWidgets.QTreeWidgetItem(["", "", ""]) node.addChild(subnode) self.setItemWidget(subnode, 0, widget) subnode.setFirstColumnSpanned(True) # recurse to children for key, data in childs.items(): self.buildTree(data, node, str(key), path=path+(key,)) def parse(self, data): """ Given any python object, return: * type * a short string representation * a dict of sub-objects to be parsed * optional widget to display as sub-node """ # defaults for all objects typeStr = type(data).__name__ if typeStr == 'instance': typeStr += ": " + data.__class__.__name__ widget = None desc = "" childs = {} # type-specific changes if isinstance(data, dict): desc = "length=%d" % len(data) if isinstance(data, OrderedDict): childs = data else: try: childs = OrderedDict(sorted(data.items())) except TypeError: # if sorting falls childs = OrderedDict(data.items()) elif isinstance(data, (list, tuple)): desc = "length=%d" % len(data) childs = OrderedDict(enumerate(data)) elif HAVE_METAARRAY and (hasattr(data, 'implements') and data.implements('MetaArray')): childs = OrderedDict([ ('data', data.view(np.ndarray)), ('meta', data.infoCopy()) ]) elif isinstance(data, np.ndarray): desc = "shape=%s dtype=%s" % (data.shape, data.dtype) table = TableWidget() table.setData(data) table.setMaximumHeight(200) widget = table elif isinstance(data, types.TracebackType): ## convert traceback to a list of strings frames = list(map(str.strip, traceback.format_list(traceback.extract_tb(data)))) #childs = OrderedDict([ #(i, {'file': child[0], 'line': child[1], 'function': child[2], 'code': child[3]}) #for i, child in enumerate(frames)]) #childs = OrderedDict([(i, ch) for i,ch in enumerate(frames)]) widget = QtWidgets.QPlainTextEdit('\n'.join(frames)) widget.setMaximumHeight(200) widget.setReadOnly(True) else: desc = str(data) return typeStr, desc, childs, widget pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/DiffTreeWidget.py000066400000000000000000000133101457240071200245260ustar00rootroot00000000000000import numpy as np from .. import functions as fn from ..Qt import QtWidgets from .DataTreeWidget import DataTreeWidget __all__ = ['DiffTreeWidget'] class DiffTreeWidget(QtWidgets.QWidget): """ Widget for displaying differences between hierarchical python data structures (eg, nested dicts, lists, and arrays) """ def __init__(self, parent=None, a=None, b=None): QtWidgets.QWidget.__init__(self, parent) self.layout = QtWidgets.QHBoxLayout() self.setLayout(self.layout) self.trees = [DataTreeWidget(self), DataTreeWidget(self)] for t in self.trees: self.layout.addWidget(t) if a is not None: self.setData(a, b) def setData(self, a, b): """ Set the data to be compared in this widget. """ self.data = (a, b) self.trees[0].setData(a) self.trees[1].setData(b) return self.compare(a, b) def compare(self, a, b, path=()): """ Compare data structure *a* to structure *b*. Return True if the objects match completely. Otherwise, return a structure that describes the differences: { 'type': bool 'len': bool, 'str': bool, 'shape': bool, 'dtype': bool, 'mask': array, } """ bad = (255, 200, 200) # generate typestr, desc, childs for each object typeA, descA, childsA, _ = self.trees[0].parse(a) typeB, descB, childsB, _ = self.trees[1].parse(b) if typeA != typeB: self.setColor(path, 1, bad) if descA != descB: self.setColor(path, 2, bad) if isinstance(a, dict) and isinstance(b, dict): keysA = set(a.keys()) keysB = set(b.keys()) for key in keysA - keysB: self.setColor(path+(key,), 0, bad, tree=0) for key in keysB - keysA: self.setColor(path+(key,), 0, bad, tree=1) for key in keysA & keysB: self.compare(a[key], b[key], path+(key,)) elif isinstance(a, (list, tuple)) and isinstance(b, (list, tuple)): for i in range(max(len(a), len(b))): if len(a) <= i: self.setColor(path+(i,), 0, bad, tree=1) elif len(b) <= i: self.setColor(path+(i,), 0, bad, tree=0) else: self.compare(a[i], b[i], path+(i,)) elif isinstance(a, np.ndarray) and isinstance(b, np.ndarray) and a.shape == b.shape: tableNodes = [tree.nodes[path].child(0) for tree in self.trees] if a.dtype.fields is None and b.dtype.fields is None: eq = self.compareArrays(a, b) if not np.all(eq): for n in tableNodes: n.setBackground(0, fn.mkBrush(bad)) #for i in np.argwhere(~eq): else: if a.dtype == b.dtype: for i,k in enumerate(a.dtype.fields.keys()): eq = self.compareArrays(a[k], b[k]) if not np.all(eq): for n in tableNodes: n.setBackground(0, fn.mkBrush(bad)) #for j in np.argwhere(~eq): # dict: compare keys, then values where keys match # list: # array: compare elementwise for same shape def compareArrays(self, a, b): intnan = -9223372036854775808 # happens when np.nan is cast to int anans = np.isnan(a) | (a == intnan) bnans = np.isnan(b) | (b == intnan) eq = anans == bnans mask = ~anans eq[mask] = np.allclose(a[mask], b[mask]) return eq def setColor(self, path, column, color, tree=None): brush = fn.mkBrush(color) # Color only one tree if specified. if tree is None: trees = self.trees else: trees = [self.trees[tree]] for tree in trees: item = tree.nodes[path] item.setBackground(column, brush) def _compare(self, a, b): """ Compare data structure *a* to structure *b*. """ # Check test structures are the same assert type(info) is type(expect) if hasattr(info, '__len__'): assert len(info) == len(expect) if isinstance(info, dict): for k in info: assert k in expect for k in expect: assert k in info self.compare_results(info[k], expect[k]) elif isinstance(info, list): for i in range(len(info)): self.compare_results(info[i], expect[i]) elif isinstance(info, np.ndarray): assert info.shape == expect.shape assert info.dtype == expect.dtype if info.dtype.fields is None: intnan = -9223372036854775808 # happens when np.nan is cast to int inans = np.isnan(info) | (info == intnan) enans = np.isnan(expect) | (expect == intnan) assert np.all(inans == enans) mask = ~inans assert np.allclose(info[mask], expect[mask]) else: for k in info.dtype.fields.keys(): self.compare_results(info[k], expect[k]) else: try: assert info == expect except Exception: raise NotImplementedError("Cannot compare objects of type %s" % type(info)) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/FeedbackButton.py000066400000000000000000000134321457240071200245570ustar00rootroot00000000000000from ..Qt import QtCore, QtWidgets __all__ = ['FeedbackButton'] class FeedbackButton(QtWidgets.QPushButton): """ QPushButton which flashes success/failure indication for slow or asynchronous procedures. """ ### For thread-safetyness sigCallSuccess = QtCore.Signal(object, object, object) sigCallFailure = QtCore.Signal(object, object, object) sigCallProcess = QtCore.Signal(object, object, object) sigReset = QtCore.Signal() def __init__(self, *args): QtWidgets.QPushButton.__init__(self, *args) self.origStyle = None self.origText = self.text() self.origStyle = self.styleSheet() self.origTip = self.toolTip() self.limitedTime = True #self.textTimer = QtCore.QTimer() #self.tipTimer = QtCore.QTimer() #self.textTimer.timeout.connect(self.setText) #self.tipTimer.timeout.connect(self.setToolTip) self.sigCallSuccess.connect(self.success) self.sigCallFailure.connect(self.failure) self.sigCallProcess.connect(self.processing) self.sigReset.connect(self.reset) def feedback(self, success, message=None, tip="", limitedTime=True): """Calls success() or failure(). If you want the message to be displayed until the user takes an action, set limitedTime to False. Then call self.reset() after the desired action.Threadsafe.""" if success: self.success(message, tip, limitedTime=limitedTime) else: self.failure(message, tip, limitedTime=limitedTime) def success(self, message=None, tip="", limitedTime=True): """Displays specified message on button and flashes button green to let user know action was successful. If you want the success to be displayed until the user takes an action, set limitedTime to False. Then call self.reset() after the desired action. Threadsafe.""" isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread() if isGuiThread: self.setEnabled(True) #print "success" self.startBlink("#0F0", message, tip, limitedTime=limitedTime) else: self.sigCallSuccess.emit(message, tip, limitedTime) def failure(self, message=None, tip="", limitedTime=True): """Displays specified message on button and flashes button red to let user know there was an error. If you want the error to be displayed until the user takes an action, set limitedTime to False. Then call self.reset() after the desired action. Threadsafe. """ isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread() if isGuiThread: self.setEnabled(True) #print "fail" self.startBlink("#F00", message, tip, limitedTime=limitedTime) else: self.sigCallFailure.emit(message, tip, limitedTime) def processing(self, message="Processing..", tip="", processEvents=True): """Displays specified message on button to let user know the action is in progress. Threadsafe. """ isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread() if isGuiThread: self.setEnabled(False) self.setText(message, temporary=True) self.setToolTip(tip, temporary=True) if processEvents: QtWidgets.QApplication.processEvents() else: self.sigCallProcess.emit(message, tip, processEvents) def reset(self): """Resets the button to its original text and style. Threadsafe.""" isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread() if isGuiThread: self.limitedTime = True self.setText() self.setToolTip() self.setStyleSheet() else: self.sigReset.emit() def startBlink(self, color, message=None, tip="", limitedTime=True): #if self.origStyle is None: #self.origStyle = self.styleSheet() #self.origText = self.text() self.setFixedHeight(self.height()) if message is not None: self.setText(message, temporary=True) self.setToolTip(tip, temporary=True) self.count = 0 #self.indStyle = "QPushButton {border: 2px solid %s; border-radius: 5px}" % color self.indStyle = "QPushButton {background-color: %s}" % color self.limitedTime = limitedTime self.borderOn() if limitedTime: QtCore.QTimer.singleShot(2000, self.setText) QtCore.QTimer.singleShot(10000, self.setToolTip) def borderOn(self): self.setStyleSheet(self.indStyle, temporary=True) if self.limitedTime or self.count <=2: QtCore.QTimer.singleShot(100, self.borderOff) def borderOff(self): self.setStyleSheet() self.count += 1 if self.count >= 2: if self.limitedTime: return QtCore.QTimer.singleShot(30, self.borderOn) def setText(self, text=None, temporary=False): if text is None: text = self.origText #print text QtWidgets.QPushButton.setText(self, text) if not temporary: self.origText = text def setToolTip(self, text=None, temporary=False): if text is None: text = self.origTip QtWidgets.QPushButton.setToolTip(self, text) if not temporary: self.origTip = text def setStyleSheet(self, style=None, temporary=False): if style is None: style = self.origStyle QtWidgets.QPushButton.setStyleSheet(self, style) if not temporary: self.origStyle = style pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/FileDialog.py000066400000000000000000000007571457240071200237040ustar00rootroot00000000000000import sys from ..Qt import QtWidgets __all__ = ['FileDialog'] class FileDialog(QtWidgets.QFileDialog): ## Compatibility fix for OSX: ## For some reason the native dialog doesn't show up when you set AcceptMode to AcceptSave on OS X, so we don't use the native dialog def __init__(self, *args): QtWidgets.QFileDialog.__init__(self, *args) if sys.platform == 'darwin': self.setOption(QtWidgets.QFileDialog.Option.DontUseNativeDialog) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/GradientWidget.py000066400000000000000000000061221457240071200245760ustar00rootroot00000000000000from ..graphicsItems.GradientEditorItem import GradientEditorItem from ..Qt import QtCore, QtGui, QtWidgets from .GraphicsView import GraphicsView __all__ = ['GradientWidget'] class GradientWidget(GraphicsView): """ Widget displaying an editable color gradient. The user may add, move, recolor, or remove colors from the gradient. Additionally, a context menu allows the user to select from pre-defined gradients. """ sigGradientChanged = QtCore.Signal(object) sigGradientChangeFinished = QtCore.Signal(object) def __init__(self, parent=None, orientation='bottom', *args, **kargs): """ The *orientation* argument may be 'bottom', 'top', 'left', or 'right' indicating whether the gradient is displayed horizontally (top, bottom) or vertically (left, right) and on what side of the gradient the editable ticks will appear. All other arguments are passed to :func:`GradientEditorItem.__init__ `. Note: For convenience, this class wraps methods from :class:`GradientEditorItem `. """ GraphicsView.__init__(self, parent, useOpenGL=False, background=None) self.maxDim = 31 kargs['tickPen'] = 'k' self.item = GradientEditorItem(*args, **kargs) self.item.sigGradientChanged.connect(self.sigGradientChanged) self.item.sigGradientChangeFinished.connect(self.sigGradientChangeFinished) self.setCentralItem(self.item) self.setOrientation(orientation) self.setCacheMode(self.CacheModeFlag.CacheNone) self.setRenderHints(QtGui.QPainter.RenderHint.Antialiasing | QtGui.QPainter.RenderHint.TextAntialiasing) frame_style = QtWidgets.QFrame.Shape.NoFrame | QtWidgets.QFrame.Shadow.Plain self.setFrameStyle(frame_style) #self.setBackgroundRole(QtGui.QPalette.ColorRole.NoRole) #self.setBackgroundBrush(QtGui.QBrush(QtCore.Qt.BrushStyle.NoBrush)) #self.setAutoFillBackground(False) #self.setAttribute(QtCore.Qt.WindowType.WindowType.WidgetAttribute.WA_PaintOnScreen, False) #self.setAttribute(QtCore.Qt.WindowType.WindowType.WidgetAttribute.WA_OpaquePaintEvent, True) def setOrientation(self, ort): """Set the orientation of the widget. May be one of 'bottom', 'top', 'left', or 'right'.""" self.item.setOrientation(ort) self.orientation = ort self.setMaxDim() def setMaxDim(self, mx=None): if mx is None: mx = self.maxDim else: self.maxDim = mx if self.orientation in ['bottom', 'top']: self.setFixedHeight(mx) self.setMaximumWidth(16777215) else: self.setFixedWidth(mx) self.setMaximumHeight(16777215) def __getattr__(self, attr): ### wrap methods from GradientEditorItem return getattr(self.item, attr) def widgetGroupInterface(self): return (self.sigGradientChanged, self.saveState, self.restoreState) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/GraphicsLayoutWidget.py000066400000000000000000000054371457240071200260070ustar00rootroot00000000000000from ..graphicsItems.GraphicsLayout import GraphicsLayout from ..Qt import mkQApp from .GraphicsView import GraphicsView __all__ = ['GraphicsLayoutWidget'] class GraphicsLayoutWidget(GraphicsView): """ Convenience class consisting of a :class:`GraphicsView ` with a single :class:`GraphicsLayout ` as its central item. This widget is an easy starting point for generating multi-panel figures. Example:: w = pg.GraphicsLayoutWidget() p1 = w.addPlot(row=0, col=0) p2 = w.addPlot(row=0, col=1) v = w.addViewBox(row=1, col=0, colspan=2) ========= ================================================================= parent (QWidget or None) The parent widget. show (bool) If True, then immediately show the widget after it is created. If the widget has no parent, then it will be shown inside a new window. size (width, height) tuple. Optionally resize the widget. Note: if this widget is placed inside a layout, then this argument has no effect. title (str or None) If specified, then set the window title for this widget. kargs All extra arguments are passed to :meth:`GraphicsLayout.__init__ ` ========= ================================================================= This class wraps several methods from its internal GraphicsLayout: :func:`nextRow ` :func:`nextColumn ` :func:`addPlot ` :func:`addViewBox ` :func:`addItem ` :func:`getItem ` :func:`addLabel ` :func:`addLayout ` :func:`removeItem ` :func:`itemIndex ` :func:`clear ` """ def __init__(self, parent=None, show=False, size=None, title=None, **kargs): mkQApp() GraphicsView.__init__(self, parent) self.ci = GraphicsLayout(**kargs) for n in ['nextRow', 'nextCol', 'nextColumn', 'addPlot', 'addViewBox', 'addItem', 'getItem', 'addLayout', 'addLabel', 'removeItem', 'itemIndex', 'clear']: setattr(self, n, getattr(self.ci, n)) self.setCentralItem(self.ci) if size is not None: self.resize(*size) if title is not None: self.setWindowTitle(title) if show is True: self.show() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/GraphicsView.py000066400000000000000000000360551457240071200243000ustar00rootroot00000000000000""" GraphicsView.py - Extension of QGraphicsView Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. """ from .. import functions as fn from .. import getConfigOption from ..GraphicsScene import GraphicsScene from ..Point import Point from ..Qt import QT_LIB, QtCore, QtGui, QtWidgets __all__ = ['GraphicsView'] class GraphicsView(QtWidgets.QGraphicsView): """Re-implementation of QGraphicsView that removes scrollbars and allows unambiguous control of the viewed coordinate range. Also automatically creates a GraphicsScene and a central QGraphicsWidget that is automatically scaled to the full view geometry. This widget is the basis for :class:`PlotWidget `, :class:`GraphicsLayoutWidget `, and the view widget in :class:`ImageView `. By default, the view coordinate system matches the widget's pixel coordinates and automatically updates when the view is resized. This can be overridden by setting autoPixelRange=False. The exact visible range can be set with setRange(). The view can be panned using the middle mouse button and scaled using the right mouse button if enabled via enableMouse() (but ordinarily, we use ViewBox for this functionality).""" sigDeviceRangeChanged = QtCore.Signal(object, object) sigDeviceTransformChanged = QtCore.Signal(object) sigMouseReleased = QtCore.Signal(object) sigSceneMouseMoved = QtCore.Signal(object) #sigRegionChanged = QtCore.Signal(object) sigScaleChanged = QtCore.Signal(object) lastFileDir = None def __init__(self, parent=None, useOpenGL=None, background='default'): """ ============== ============================================================ **Arguments:** parent Optional parent widget useOpenGL If True, the GraphicsView will use OpenGL to do all of its rendering. This can improve performance on some systems, but may also introduce bugs (the combination of QGraphicsView and QOpenGLWidget is still an 'experimental' feature of Qt) background Set the background color of the GraphicsView. Accepts any single argument accepted by :func:`mkColor `. By default, the background color is determined using the 'backgroundColor' configuration option (see :func:`setConfigOptions `). ============== ============================================================ """ self.closed = False QtWidgets.QGraphicsView.__init__(self, parent) # This connects a cleanup function to QApplication.aboutToQuit. It is # called from here because we have no good way to react when the # QApplication is created by the user. # See pyqtgraph.__init__.py from .. import _connectCleanup _connectCleanup() if useOpenGL is None: useOpenGL = getConfigOption('useOpenGL') self.useOpenGL(useOpenGL) self.setCacheMode(self.CacheModeFlag.CacheBackground) ## This might help, but it's probably dangerous in the general case.. #self.setOptimizationFlag(self.DontSavePainterState, True) self.setBackgroundRole(QtGui.QPalette.ColorRole.NoRole) self.setBackground(background) self.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus) self.setFrameShape(QtWidgets.QFrame.Shape.NoFrame) self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.setTransformationAnchor(QtWidgets.QGraphicsView.ViewportAnchor.NoAnchor) self.setResizeAnchor(QtWidgets.QGraphicsView.ViewportAnchor.AnchorViewCenter) self.setViewportUpdateMode(QtWidgets.QGraphicsView.ViewportUpdateMode.MinimalViewportUpdate) self.lockedViewports = [] self.lastMousePos = None self.setMouseTracking(True) self.aspectLocked = False self.range = QtCore.QRectF(0, 0, 1, 1) self.autoPixelRange = True self.currentItem = None self.clearMouse() self.updateMatrix() # GraphicsScene must have parent or expect crashes! self.sceneObj = GraphicsScene(parent=self) self.setScene(self.sceneObj) ## by default we set up a central widget with a grid layout. ## this can be replaced if needed. self.centralWidget = None self.setCentralItem(QtWidgets.QGraphicsWidget()) self.centralLayout = QtWidgets.QGraphicsGridLayout() self.centralWidget.setLayout(self.centralLayout) self.mouseEnabled = False self.scaleCenter = False ## should scaling center around view center (True) or mouse click (False) self.clickAccepted = False def setAntialiasing(self, aa): """Enable or disable default antialiasing. Note that this will only affect items that do not specify their own antialiasing options.""" if aa: self.setRenderHints(self.renderHints() | QtGui.QPainter.RenderHint.Antialiasing) else: self.setRenderHints(self.renderHints() & ~QtGui.QPainter.RenderHint.Antialiasing) def setBackground(self, background): """ Set the background color of the GraphicsView. To use the defaults specified py pyqtgraph.setConfigOption, use background='default'. To make the background transparent, use background=None. """ self._background = background if background == 'default': background = getConfigOption('background') brush = fn.mkBrush(background) self.setBackgroundBrush(brush) def paintEvent(self, ev): self.scene().prepareForPaint() return super().paintEvent(ev) def render(self, *args, **kwds): self.scene().prepareForPaint() return super().render(*args, **kwds) def close(self): self.centralWidget = None self.scene().clear() self.currentItem = None self.sceneObj = None self.closed = True self.setViewport(None) super(GraphicsView, self).close() def useOpenGL(self, b=True): if b: HAVE_OPENGL = hasattr(QtWidgets, 'QOpenGLWidget') if not HAVE_OPENGL: raise Exception("Requested to use OpenGL with QGraphicsView, but QOpenGLWidget is not available.") v = QtWidgets.QOpenGLWidget() else: v = QtWidgets.QWidget() self.setViewport(v) def keyPressEvent(self, ev): self.scene().keyPressEvent(ev) ## bypass view, hand event directly to scene ## (view likes to eat arrow key events) def setCentralItem(self, item): return self.setCentralWidget(item) def setCentralWidget(self, item): """Sets a QGraphicsWidget to automatically fill the entire view (the item will be automatically resize whenever the GraphicsView is resized).""" if self.centralWidget is not None: self.scene().removeItem(self.centralWidget) self.centralWidget = item if item is not None: self.sceneObj.addItem(item) self.resizeEvent(None) def addItem(self, *args): return self.scene().addItem(*args) def removeItem(self, *args): return self.scene().removeItem(*args) def enableMouse(self, b=True): self.mouseEnabled = b self.autoPixelRange = (not b) def clearMouse(self): self.mouseTrail = [] self.lastButtonReleased = None def resizeEvent(self, ev): if self.closed: return if self.autoPixelRange: self.range = QtCore.QRectF(0, 0, self.size().width(), self.size().height()) GraphicsView.setRange(self, self.range, padding=0, disableAutoPixel=False) ## we do this because some subclasses like to redefine setRange in an incompatible way. self.updateMatrix() def updateMatrix(self, propagate=True): self.setSceneRect(self.range) if self.autoPixelRange: self.resetTransform() else: if self.aspectLocked: self.fitInView(self.range, QtCore.Qt.AspectRatioMode.KeepAspectRatio) else: self.fitInView(self.range, QtCore.Qt.AspectRatioMode.IgnoreAspectRatio) if propagate: for v in self.lockedViewports: v.setXRange(self.range, padding=0) self.sigDeviceRangeChanged.emit(self, self.range) self.sigDeviceTransformChanged.emit(self) def viewRect(self): """Return the boundaries of the view in scene coordinates""" ## easier to just return self.range ? r = QtCore.QRectF(self.rect()) return self.viewportTransform().inverted()[0].mapRect(r) def visibleRange(self): ## for backward compatibility return self.viewRect() def translate(self, dx, dy): self.range.adjust(dx, dy, dx, dy) self.updateMatrix() def scale(self, sx, sy, center=None): scale = [sx, sy] if self.aspectLocked: scale[0] = scale[1] if self.scaleCenter: center = None if center is None: center = self.range.center() w = self.range.width() / scale[0] h = self.range.height() / scale[1] self.range = QtCore.QRectF(center.x() - (center.x()-self.range.left()) / scale[0], center.y() - (center.y()-self.range.top()) /scale[1], w, h) self.updateMatrix() self.sigScaleChanged.emit(self) def setRange(self, newRect=None, padding=0.05, lockAspect=None, propagate=True, disableAutoPixel=True): if disableAutoPixel: self.autoPixelRange=False if newRect is None: newRect = self.visibleRange() padding = 0 padding = Point(padding) newRect = QtCore.QRectF(newRect) pw = newRect.width() * padding[0] ph = newRect.height() * padding[1] newRect = newRect.adjusted(-pw, -ph, pw, ph) scaleChanged = False if self.range.width() != newRect.width() or self.range.height() != newRect.height(): scaleChanged = True self.range = newRect #print "New Range:", self.range if self.centralWidget is not None: self.centralWidget.setGeometry(self.range) self.updateMatrix(propagate) if scaleChanged: self.sigScaleChanged.emit(self) def scaleToImage(self, image): """Scales such that pixels in image are the same size as screen pixels. This may result in a significant performance increase.""" pxSize = image.pixelSize() image.setPxMode(True) try: self.sigScaleChanged.disconnect(image.setScaledMode) except (TypeError, RuntimeError): pass tl = image.sceneBoundingRect().topLeft() w = self.size().width() * pxSize[0] h = self.size().height() * pxSize[1] range = QtCore.QRectF(tl.x(), tl.y(), w, h) GraphicsView.setRange(self, range, padding=0) self.sigScaleChanged.connect(image.setScaledMode) def lockXRange(self, v1): if not v1 in self.lockedViewports: self.lockedViewports.append(v1) def setXRange(self, r, padding=0.05): r1 = QtCore.QRectF(self.range) r1.setLeft(r.left()) r1.setRight(r.right()) GraphicsView.setRange(self, r1, padding=[padding, 0], propagate=False) def setYRange(self, r, padding=0.05): r1 = QtCore.QRectF(self.range) r1.setTop(r.top()) r1.setBottom(r.bottom()) GraphicsView.setRange(self, r1, padding=[0, padding], propagate=False) def wheelEvent(self, ev): super().wheelEvent(ev) if not self.mouseEnabled: return delta = ev.angleDelta().x() if delta == 0: delta = ev.angleDelta().y() sc = 1.001 ** delta #self.scale *= sc #self.updateMatrix() self.scale(sc, sc) def setAspectLocked(self, s): self.aspectLocked = s def leaveEvent(self, ev): self.scene().leaveEvent(ev) ## inform scene when mouse leaves def mousePressEvent(self, ev): super().mousePressEvent(ev) if not self.mouseEnabled: return lpos = ev.position() if hasattr(ev, 'position') else ev.localPos() self.lastMousePos = lpos self.mousePressPos = lpos self.clickAccepted = ev.isAccepted() if not self.clickAccepted: self.scene().clearSelection() return ## Everything below disabled for now.. def mouseReleaseEvent(self, ev): super().mouseReleaseEvent(ev) if not self.mouseEnabled: return self.sigMouseReleased.emit(ev) self.lastButtonReleased = ev.button() return ## Everything below disabled for now.. def mouseMoveEvent(self, ev): lpos = ev.position() if hasattr(ev, 'position') else ev.localPos() if self.lastMousePos is None: self.lastMousePos = lpos delta = Point(lpos - self.lastMousePos) self.lastMousePos = lpos super().mouseMoveEvent(ev) if not self.mouseEnabled: return self.sigSceneMouseMoved.emit(self.mapToScene(lpos.toPoint())) if self.clickAccepted: ## Ignore event if an item in the scene has already claimed it. return if ev.buttons() == QtCore.Qt.MouseButton.RightButton: delta = Point(fn.clip_scalar(delta[0], -50, 50), fn.clip_scalar(-delta[1], -50, 50)) scale = 1.01 ** delta self.scale(scale[0], scale[1], center=self.mapToScene(self.mousePressPos.toPoint())) self.sigDeviceRangeChanged.emit(self, self.range) elif ev.buttons() in [QtCore.Qt.MouseButton.MiddleButton, QtCore.Qt.MouseButton.LeftButton]: ## Allow panning by left or mid button. px = self.pixelSize() tr = -delta * px self.translate(tr[0], tr[1]) self.sigDeviceRangeChanged.emit(self, self.range) def pixelSize(self): """Return vector with the length and width of one view pixel in scene coordinates""" p0 = Point(0,0) p1 = Point(1,1) tr = self.transform().inverted()[0] p01 = tr.map(p0) p11 = tr.map(p1) return Point(p11 - p01) def dragEnterEvent(self, ev): ev.ignore() ## not sure why, but for some reason this class likes to consume drag events pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/GroupBox.py000066400000000000000000000061611457240071200234450ustar00rootroot00000000000000from ..Qt import QtCore, QtGui, QtWidgets from .PathButton import PathButton __all__ = ['GroupBox'] class GroupBox(QtWidgets.QGroupBox): """Subclass of QGroupBox that implements collapse handle. """ sigCollapseChanged = QtCore.Signal(object) def __init__(self, *args): QtWidgets.QGroupBox.__init__(self, *args) self._collapsed = False # We modify the size policy when the group box is collapsed, so # keep track of the last requested policy: self._lastSizePlocy = self.sizePolicy() self.closePath = QtGui.QPainterPath() self.closePath.moveTo(0, -1) self.closePath.lineTo(0, 1) self.closePath.lineTo(1, 0) self.closePath.lineTo(0, -1) self.openPath = QtGui.QPainterPath() self.openPath.moveTo(-1, 0) self.openPath.lineTo(1, 0) self.openPath.lineTo(0, 1) self.openPath.lineTo(-1, 0) self.collapseBtn = PathButton(path=self.openPath, size=(12, 12), margin=0) self.collapseBtn.setStyleSheet(""" border: none; """) self.collapseBtn.setPen('k') self.collapseBtn.setBrush('w') self.collapseBtn.setParent(self) self.collapseBtn.move(3, 3) self.collapseBtn.setFlat(True) self.collapseBtn.clicked.connect(self.toggleCollapsed) if len(args) > 0 and isinstance(args[0], str): self.setTitle(args[0]) def toggleCollapsed(self): self.setCollapsed(not self._collapsed) def collapsed(self): return self._collapsed def setCollapsed(self, c): if c == self._collapsed: return if c is True: self.collapseBtn.setPath(self.closePath) self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred, closing=True) elif c is False: self.collapseBtn.setPath(self.openPath) self.setSizePolicy(self._lastSizePolicy) else: raise TypeError("Invalid argument %r; must be bool." % c) for ch in self.children(): if isinstance(ch, QtWidgets.QWidget) and ch is not self.collapseBtn: ch.setVisible(not c) self._collapsed = c self.sigCollapseChanged.emit(c) def setSizePolicy(self, *args, **kwds): QtWidgets.QGroupBox.setSizePolicy(self, *args) if kwds.pop('closing', False) is True: self._lastSizePolicy = self.sizePolicy() def setHorizontalPolicy(self, *args): QtWidgets.QGroupBox.setHorizontalPolicy(self, *args) self._lastSizePolicy = self.sizePolicy() def setVerticalPolicy(self, *args): QtWidgets.QGroupBox.setVerticalPolicy(self, *args) self._lastSizePolicy = self.sizePolicy() def setTitle(self, title): # Leave room for button QtWidgets.QGroupBox.setTitle(self, " " + title) def widgetGroupInterface(self): return (self.sigCollapseChanged, GroupBox.collapsed, GroupBox.setCollapsed, True) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/HistogramLUTWidget.py000066400000000000000000000026711457240071200253700ustar00rootroot00000000000000""" Widget displaying an image histogram along with gradient editor. Can be used to adjust the appearance of images. This is a wrapper around HistogramLUTItem """ from ..graphicsItems.HistogramLUTItem import HistogramLUTItem from ..Qt import QtCore, QtWidgets from .GraphicsView import GraphicsView __all__ = ['HistogramLUTWidget'] class HistogramLUTWidget(GraphicsView): """QWidget wrapper for :class:`~pyqtgraph.HistogramLUTItem`. All parameters are passed along in creating the HistogramLUTItem. """ def __init__(self, parent=None, *args, **kargs): background = kargs.pop('background', 'default') GraphicsView.__init__(self, parent, useOpenGL=False, background=background) self.item = HistogramLUTItem(*args, **kargs) self.setCentralItem(self.item) self.orientation = kargs.get('orientation', 'vertical') if self.orientation == 'vertical': self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Expanding) self.setMinimumWidth(95) else: self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred) self.setMinimumHeight(95) def sizeHint(self): if self.orientation == 'vertical': return QtCore.QSize(115, 200) else: return QtCore.QSize(200, 115) def __getattr__(self, attr): return getattr(self.item, attr) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/JoystickButton.py000066400000000000000000000044101457240071200246660ustar00rootroot00000000000000from math import hypot from ..Qt import QtCore, QtGui, QtWidgets __all__ = ['JoystickButton'] class JoystickButton(QtWidgets.QPushButton): sigStateChanged = QtCore.Signal(object, object) ## self, state def __init__(self, parent=None): QtWidgets.QPushButton.__init__(self, parent) self.radius = 200 self.setCheckable(True) self.state = None self.setState(0, 0) self.setFixedWidth(50) self.setFixedHeight(50) def mousePressEvent(self, ev): self.setChecked(True) lpos = ev.position() if hasattr(ev, 'position') else ev.localPos() self.pressPos = lpos ev.accept() def mouseMoveEvent(self, ev): lpos = ev.position() if hasattr(ev, 'position') else ev.localPos() dif = lpos - self.pressPos self.setState(dif.x(), -dif.y()) def mouseReleaseEvent(self, ev): self.setChecked(False) self.setState(0,0) def wheelEvent(self, ev): ev.accept() def doubleClickEvent(self, ev): ev.accept() def getState(self): return self.state def setState(self, *xy): xy = list(xy) d = hypot(xy[0], xy[1]) # length nxy = [0, 0] for i in [0,1]: if xy[i] == 0: nxy[i] = 0 else: nxy[i] = xy[i] / d if d > self.radius: d = self.radius d = (d / self.radius) ** 2 xy = [nxy[0] * d, nxy[1] * d] w2 = self.width() / 2 h2 = self.height() / 2 self.spotPos = QtCore.QPoint( int(w2 * (1 + xy[0])), int(h2 * (1 - xy[1])) ) self.update() if self.state == xy: return self.state = xy self.sigStateChanged.emit(self, self.state) def paintEvent(self, ev): super().paintEvent(ev) p = QtGui.QPainter(self) p.setBrush(QtGui.QBrush(QtGui.QColor(0,0,0))) p.drawEllipse( self.spotPos.x() - 3, self.spotPos.y() - 3, 6, 6 ) p.end() def resizeEvent(self, ev): self.setState(*self.state) super().resizeEvent(ev) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/LayoutWidget.py000066400000000000000000000065601457240071200243240ustar00rootroot00000000000000from ..Qt import QtWidgets __all__ = ['LayoutWidget'] class LayoutWidget(QtWidgets.QWidget): """ Convenience class used for laying out QWidgets in a grid. (It's just a little less effort to use than QGridLayout) """ def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) self.layout = QtWidgets.QGridLayout() self.setLayout(self.layout) self.items = {} self.rows = {} self.currentRow = 0 self.currentCol = 0 def nextRow(self): """Advance to next row for automatic widget placement""" self.currentRow += 1 self.currentCol = 0 def nextColumn(self, colspan=1): """Advance to next column, while returning the current column number (generally only for internal use--called by addWidget)""" self.currentCol += colspan return self.currentCol-colspan def nextCol(self, *args, **kargs): """Alias of nextColumn""" return self.nextColumn(*args, **kargs) def addLabel(self, text=' ', row=None, col=None, rowspan=1, colspan=1, **kargs): """ Create a QLabel with *text* and place it in the next available cell (or in the cell specified) All extra keyword arguments are passed to QLabel(). Returns the created widget. """ text = QtWidgets.QLabel(text, **kargs) self.addWidget(text, row, col, rowspan, colspan) return text def addLayout(self, row=None, col=None, rowspan=1, colspan=1, **kargs): """ Create an empty LayoutWidget and place it in the next available cell (or in the cell specified) All extra keyword arguments are passed to :func:`LayoutWidget.__init__ ` Returns the created widget. """ layout = LayoutWidget(**kargs) self.addWidget(layout, row, col, rowspan, colspan) return layout def addWidget(self, item, row=None, col=None, rowspan=1, colspan=1): """ Add a widget to the layout and place it in the next available cell (or in the cell specified). """ if row == 'next': self.nextRow() row = self.currentRow elif row is None: row = self.currentRow if col is None: col = self.nextCol(colspan) if row not in self.rows: self.rows[row] = {} self.rows[row][col] = item self.items[item] = (row, col) self.layout.addWidget(item, row, col, rowspan, colspan) def getWidget(self, row, col): """Return the widget in (*row*, *col*)""" return self.rows[row][col] #def itemIndex(self, item): #for i in range(self.layout.count()): #if self.layout.itemAt(i).graphicsItem() is item: #return i #raise Exception("Could not determine index of item " + str(item)) #def removeItem(self, item): #"""Remove *item* from the layout.""" #ind = self.itemIndex(item) #self.layout.removeAt(ind) #self.scene().removeItem(item) #r,c = self.items[item] #del self.items[item] #del self.rows[r][c] #self.update() #def clear(self): #items = [] #for i in list(self.items.keys()): #self.removeItem(i) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/MatplotlibWidget.py000066400000000000000000000042421457240071200251510ustar00rootroot00000000000000from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qtagg import NavigationToolbar2QT as NavigationToolbar from matplotlib.figure import Figure from ..Qt import QtWidgets import typing __all__ = ['MatplotlibWidget'] class MatplotlibWidget(QtWidgets.QWidget): """ Implements a Matplotlib figure inside a QWidget. Use getFigure() and redraw() to interact with matplotlib. Example:: mw = MatplotlibWidget() subplot = mw.getFigure().add_subplot(111) subplot.plot(x,y) mw.draw() """ parent_default = None figsize_default = (5.0, 4.0) dpi_default = 100 @typing.overload def __init__(self, figsize=(5.0, 4.0), dpi=100, parent=None): pass @typing.overload def __init__(self, parent=None, figsize=(5.0, 4.0), dpi=100): pass def __init__(self, *args, **kwargs): if (args and not isinstance(args[0], QtWidgets.QWidget)): figsize = args[0] if len(args) > 0 \ else kwargs.get("figsize", MatplotlibWidget.figsize_default) dpi = args[1] if len(args) > 1 \ else kwargs.get("dpi", MatplotlibWidget.dpi_default) parent = args[2] if len(args) > 2 \ else kwargs.get("parent", MatplotlibWidget.parent_default) else: parent = args[0] if len(args) > 0 \ else kwargs.get("parent", MatplotlibWidget.parent_default) figsize = args[1] if len(args) > 1 \ else kwargs.get("figsize", MatplotlibWidget.figsize_default) dpi = args[2] if len(args) > 2 \ else kwargs.get("dpi", MatplotlibWidget.dpi_default) super().__init__(parent) self.fig = Figure(figsize, dpi=dpi) self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self) self.toolbar = NavigationToolbar(self.canvas, self) self.vbox = QtWidgets.QVBoxLayout() self.vbox.addWidget(self.toolbar) self.vbox.addWidget(self.canvas) self.setLayout(self.vbox) def getFigure(self): return self.fig def draw(self): self.canvas.draw() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/MultiPlotWidget.py000066400000000000000000000057361457240071200250040ustar00rootroot00000000000000""" MultiPlotWidget.py - Convenience class--GraphicsView widget displaying a MultiPlotItem Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. """ from ..graphicsItems import MultiPlotItem as MultiPlotItem from ..Qt import QtCore from .GraphicsView import GraphicsView __all__ = ['MultiPlotWidget'] class MultiPlotWidget(GraphicsView): """Widget implementing a :class:`~pyqtgraph.GraphicsView` with a single :class:`~pyqtgraph.MultiPlotItem` inside.""" def __init__(self, parent=None): self.minPlotHeight = 50 self.mPlotItem = MultiPlotItem.MultiPlotItem() GraphicsView.__init__(self, parent) self.enableMouse(False) self.setCentralItem(self.mPlotItem) ## Explicitly wrap methods from mPlotItem #for m in ['setData']: #setattr(self, m, getattr(self.mPlotItem, m)) self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAsNeeded) self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAsNeeded) def __getattr__(self, attr): ## implicitly wrap methods from plotItem if hasattr(self.mPlotItem, attr): m = getattr(self.mPlotItem, attr) if hasattr(m, '__call__'): return m raise AttributeError(attr) def setMinimumPlotHeight(self, min): """Set the minimum height for each sub-plot displayed. If the total height of all plots is greater than the height of the widget, then a scroll bar will appear to provide access to the entire set of plots. Added in version 0.9.9 """ self.minPlotHeight = min self.resizeEvent(None) def widgetGroupInterface(self): return (None, MultiPlotWidget.saveState, MultiPlotWidget.restoreState) def saveState(self): return {} #return self.plotItem.saveState() def restoreState(self, state): pass #return self.plotItem.restoreState(state) def close(self): self.mPlotItem.close() self.mPlotItem = None self.setParent(None) GraphicsView.close(self) def setRange(self, *args, **kwds): GraphicsView.setRange(self, *args, **kwds) if self.centralWidget is not None: r = self.range minHeight = len(self.mPlotItem.plots) * self.minPlotHeight if r.height() < minHeight: r.setHeight(minHeight) r.setWidth(r.width() - self.verticalScrollBar().width()) self.centralWidget.setGeometry(r) def resizeEvent(self, ev): if self.closed: return if self.autoPixelRange: self.range = QtCore.QRectF(0, 0, self.size().width(), self.size().height()) MultiPlotWidget.setRange(self, self.range, padding=0, disableAutoPixel=False) ## we do this because some subclasses like to redefine setRange in an incompatible way. self.updateMatrix() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/PathButton.py000066400000000000000000000031241457240071200237640ustar00rootroot00000000000000from .. import functions as fn from ..Qt import QtCore, QtGui, QtWidgets __all__ = ['PathButton'] class PathButton(QtWidgets.QPushButton): """Simple PushButton extension that paints a QPainterPath centered on its face. """ def __init__(self, parent=None, path=None, pen='default', brush=None, size=(30,30), margin=7): QtWidgets.QPushButton.__init__(self, parent) self.margin = margin self.path = None if pen == 'default': pen = 'k' self.setPen(pen) self.setBrush(brush) if path is not None: self.setPath(path) if size is not None: self.setFixedWidth(size[0]) self.setFixedHeight(size[1]) def setBrush(self, brush): self.brush = fn.mkBrush(brush) def setPen(self, *args, **kwargs): self.pen = fn.mkPen(*args, **kwargs) def setPath(self, path): self.path = path self.update() def paintEvent(self, ev): super().paintEvent(ev) margin = self.margin geom = QtCore.QRectF(0, 0, self.width(), self.height()).adjusted(margin, margin, -margin, -margin) rect = self.path.boundingRect() scale = min(geom.width() / float(rect.width()), geom.height() / float(rect.height())) p = QtGui.QPainter(self) p.setRenderHint(p.RenderHint.Antialiasing) p.translate(geom.center()) p.scale(scale, scale) p.translate(-rect.center()) p.setPen(self.pen) p.setBrush(self.brush) p.drawPath(self.path) p.end() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/PenPreviewLabel.py000066400000000000000000000021221457240071200247150ustar00rootroot00000000000000from ..Qt import QtWidgets, QtGui, QtCore from ..functions import mkPen class PenPreviewLabel(QtWidgets.QLabel): def __init__(self, param): super().__init__() self.param = param self.pen = QtGui.QPen(self.param.pen) param.sigValueChanging.connect(self.onPenChanging) def onPenChanging(self, param, val): self.pen = QtGui.QPen(val) self.update() def paintEvent(self, ev): path = QtGui.QPainterPath() displaySize = self.size() w, h = displaySize.width(), displaySize.height() # draw a squiggle with the pen path.moveTo(w * .2, h * .2) path.lineTo(w * .4, h * .8) path.cubicTo(w * .5, h * .1, w * .7, h * .1, w * .8, h * .8) painter = QtGui.QPainter(self) painter.setPen(self.pen) painter.drawPath(path) # No indication of "cosmetic" from just the paint path, so add something extra in that case if self.pen.isCosmetic(): painter.setPen(mkPen('k')) painter.drawText(QtCore.QPointF(w * 0.81, 12), 'C') painter.end() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/PlotWidget.py000066400000000000000000000105371457240071200237640ustar00rootroot00000000000000""" PlotWidget.py - Convenience class--GraphicsView widget displaying a single PlotItem Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. """ from ..graphicsItems.PlotItem import PlotItem from ..Qt import QtCore, QtWidgets from .GraphicsView import GraphicsView __all__ = ['PlotWidget'] class PlotWidget(GraphicsView): # signals wrapped from PlotItem / ViewBox sigRangeChanged = QtCore.Signal(object, object) sigTransformChanged = QtCore.Signal(object) """ :class:`GraphicsView ` widget with a single :class:`PlotItem ` inside. The following methods are wrapped directly from PlotItem: :func:`addItem `, :func:`removeItem `, :func:`clear `, :func:`setAxisItems `, :func:`setXRange `, :func:`setYRange `, :func:`setRange `, :func:`autoRange `, :func:`setXLink `, :func:`setYLink `, :func:`viewRect `, :func:`setMouseEnabled `, :func:`enableAutoRange `, :func:`disableAutoRange `, :func:`setAspectLocked `, :func:`setLimits `, :func:`register `, :func:`unregister ` For all other methods, use :func:`getPlotItem `. """ def __init__(self, parent=None, background='default', plotItem=None, **kargs): ## start by instantiating the plotItem attribute in order to avoid recursive ## calls of PlotWidget.__getattr__ - which access self.plotItem! self.plotItem = None """When initializing PlotWidget, *parent* and *background* are passed to :func:`GraphicsWidget.__init__() ` and all others are passed to :func:`PlotItem.__init__() `.""" GraphicsView.__init__(self, parent, background=background) self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) self.enableMouse(False) if plotItem is None: self.plotItem = PlotItem(**kargs) else: self.plotItem = plotItem self.setCentralItem(self.plotItem) ## Explicitly wrap methods from plotItem ## NOTE: If you change this list, update the documentation above as well. for m in ['addItem', 'removeItem', 'autoRange', 'clear', 'setAxisItems', 'setXRange', 'setYRange', 'setRange', 'setAspectLocked', 'setMouseEnabled', 'setXLink', 'setYLink', 'enableAutoRange', 'disableAutoRange', 'setLimits', 'register', 'unregister', 'viewRect']: setattr(self, m, getattr(self.plotItem, m)) #QtCore.QObject.connect(self.plotItem, QtCore.SIGNAL('viewChanged'), self.viewChanged) self.plotItem.sigRangeChanged.connect(self.viewRangeChanged) def close(self): self.plotItem.close() self.plotItem = None #self.scene().clear() #self.mPlotItem.close() self.setParent(None) super(PlotWidget, self).close() def __getattr__(self, attr): ## implicitly wrap methods from plotItem if hasattr(self.plotItem, attr): m = getattr(self.plotItem, attr) if hasattr(m, '__call__'): return m raise AttributeError(attr) def viewRangeChanged(self, view, range): #self.emit(QtCore.SIGNAL('viewChanged'), *args) self.sigRangeChanged.emit(self, range) def widgetGroupInterface(self): return (None, PlotWidget.saveState, PlotWidget.restoreState) def saveState(self): return self.plotItem.saveState() def restoreState(self, state): return self.plotItem.restoreState(state) def getPlotItem(self): """Return the PlotItem contained within.""" return self.plotItem pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/ProgressDialog.py000066400000000000000000000226331457240071200246260ustar00rootroot00000000000000from time import perf_counter from ..Qt import QtCore, QtGui, QtWidgets __all__ = ['ProgressDialog'] class ProgressDialog(QtWidgets.QProgressDialog): """ Extends QProgressDialog: * Adds context management so the dialog may be used in `with` statements * Allows nesting multiple progress dialogs Example:: with ProgressDialog("Processing..", minVal, maxVal) as dlg: # do stuff dlg.setValue(i) ## could also use dlg += 1 if dlg.wasCanceled(): raise Exception("Processing canceled by user") """ allDialogs = [] def __init__(self, labelText, minimum=0, maximum=100, cancelText='Cancel', parent=None, wait=250, busyCursor=False, disable=False, nested=False): """ ============== ================================================================ **Arguments:** labelText (required) cancelText Text to display on cancel button, or None to disable it. minimum maximum parent wait Length of time (im ms) to wait before displaying dialog busyCursor If True, show busy cursor until dialog finishes disable If True, the progress dialog will not be displayed and calls to wasCanceled() will always return False. If ProgressDialog is entered from a non-gui thread, it will always be disabled. nested (bool) If True, then this progress bar will be displayed inside any pre-existing progress dialogs that also allow nesting. ============== ================================================================ """ # attributes used for nesting dialogs self.nestedLayout = None self._nestableWidgets = None self._nestingReady = False self._topDialog = None self._subBars = [] self.nested = nested # for rate-limiting Qt event processing during progress bar update self._lastProcessEvents = None isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread() self.disabled = disable or (not isGuiThread) if self.disabled: return noCancel = False if cancelText is None: cancelText = '' noCancel = True self.busyCursor = busyCursor QtWidgets.QProgressDialog.__init__(self, labelText, cancelText, minimum, maximum, parent) # If this will be a nested dialog, then we ignore the wait time if nested is True and len(ProgressDialog.allDialogs) > 0: self.setMinimumDuration(2**30) else: self.setMinimumDuration(wait) self.setWindowModality(QtCore.Qt.WindowModality.WindowModal) self.setValue(self.minimum()) if noCancel: self.setCancelButton(None) def __enter__(self): if self.disabled: return self if self.busyCursor: QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CursorShape.WaitCursor)) if self.nested and len(ProgressDialog.allDialogs) > 0: topDialog = ProgressDialog.allDialogs[0] topDialog._addSubDialog(self) self._topDialog = topDialog topDialog.canceled.connect(self.cancel) ProgressDialog.allDialogs.append(self) return self def __exit__(self, exType, exValue, exTrace): if self.disabled: return if self.busyCursor: QtWidgets.QApplication.restoreOverrideCursor() if self._topDialog is not None: self._topDialog._removeSubDialog(self) ProgressDialog.allDialogs.pop(-1) self.setValue(self.maximum()) def __iadd__(self, val): """Use inplace-addition operator for easy incrementing.""" if self.disabled: return self self.setValue(self.value()+val) return self def _addSubDialog(self, dlg): # insert widgets from another dialog into this one. # set a new layout and arrange children into it (if needed). self._prepareNesting() bar, btn = dlg._extractWidgets() # where should we insert this widget? Find the first slot with a # "removed" widget (that was left as a placeholder) inserted = False for i,bar2 in enumerate(self._subBars): if bar2.hidden: self._subBars.pop(i) bar2.hide() bar2.setParent(None) self._subBars.insert(i, bar) inserted = True break if not inserted: self._subBars.append(bar) # reset the layout while self.nestedLayout.count() > 0: self.nestedLayout.takeAt(0) for b in self._subBars: self.nestedLayout.addWidget(b) def _removeSubDialog(self, dlg): # don't remove the widget just yet; instead we hide it and leave it in # as a placeholder. bar, btn = dlg._extractWidgets() bar.hide() def _prepareNesting(self): # extract all child widgets and place into a new layout that we can add to if self._nestingReady is False: # top layout contains progress bars + cancel button at the bottom self._topLayout = QtWidgets.QGridLayout() self.setLayout(self._topLayout) self._topLayout.setContentsMargins(0, 0, 0, 0) # A vbox to contain all progress bars self.nestedVBox = QtWidgets.QWidget() self._topLayout.addWidget(self.nestedVBox, 0, 0, 1, 2) self.nestedLayout = QtWidgets.QVBoxLayout() self.nestedVBox.setLayout(self.nestedLayout) # re-insert all widgets bar, btn = self._extractWidgets() self.nestedLayout.addWidget(bar) self._subBars.append(bar) self._topLayout.addWidget(btn, 1, 1, 1, 1) self._topLayout.setColumnStretch(0, 100) self._topLayout.setColumnStretch(1, 1) self._topLayout.setRowStretch(0, 100) self._topLayout.setRowStretch(1, 1) self._nestingReady = True def _extractWidgets(self): # return: # 1. a single widget containing the label and progress bar # 2. the cancel button if self._nestableWidgets is None: label = [ch for ch in self.children() if isinstance(ch, QtWidgets.QLabel)][0] bar = [ch for ch in self.children() if isinstance(ch, QtWidgets.QProgressBar)][0] btn = [ch for ch in self.children() if isinstance(ch, QtWidgets.QPushButton)][0] sw = ProgressWidget(label, bar) self._nestableWidgets = (sw, btn) return self._nestableWidgets def resizeEvent(self, ev): if self._nestingReady: # don't let progress dialog manage widgets anymore. return return super().resizeEvent(ev) ## wrap all other functions to make sure they aren't being called from non-gui threads def setValue(self, val): if self.disabled: return QtWidgets.QProgressDialog.setValue(self, val) # Qt docs say this should happen automatically, but that doesn't seem # to be the case. if self.windowModality() == QtCore.Qt.WindowModality.WindowModal: now = perf_counter() if self._lastProcessEvents is None or (now - self._lastProcessEvents) > 0.2: QtWidgets.QApplication.processEvents() self._lastProcessEvents = now def setLabelText(self, val): if self.disabled: return QtWidgets.QProgressDialog.setLabelText(self, val) def setMaximum(self, val): if self.disabled: return QtWidgets.QProgressDialog.setMaximum(self, val) def setMinimum(self, val): if self.disabled: return QtWidgets.QProgressDialog.setMinimum(self, val) def wasCanceled(self): if self.disabled: return False return QtWidgets.QProgressDialog.wasCanceled(self) def maximum(self): if self.disabled: return 0 return QtWidgets.QProgressDialog.maximum(self) def minimum(self): if self.disabled: return 0 return QtWidgets.QProgressDialog.minimum(self) class ProgressWidget(QtWidgets.QWidget): """Container for a label + progress bar that also allows its child widgets to be hidden without changing size. """ def __init__(self, label, bar): QtWidgets.QWidget.__init__(self) self.hidden = False self.layout = QtWidgets.QVBoxLayout() self.setLayout(self.layout) self.label = label self.bar = bar self.layout.addWidget(label) self.layout.addWidget(bar) def eventFilter(self, obj, ev): return ev.type() == QtCore.QEvent.Type.Paint def hide(self): # hide label and bar, but continue occupying the same space in the layout for widget in (self.label, self.bar): widget.installEventFilter(self) widget.update() self.hidden = True pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/RawImageWidget.py000066400000000000000000000154761457240071200245510ustar00rootroot00000000000000""" RawImageWidget.py Copyright 2010-2016 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. """ import numpy from .. import functions as fn from .. import functions_qimage from .. import getConfigOption, getCupy from ..Qt import QtCore, QtGui, QtWidgets try: QOpenGLWidget = QtWidgets.QOpenGLWidget from OpenGL.GL import * # noqa HAVE_OPENGL = True except (ImportError, AttributeError): # Would prefer `except ImportError` here, but some versions of pyopengl generate # AttributeError upon import HAVE_OPENGL = False __all__ = ['RawImageWidget'] class RawImageWidget(QtWidgets.QWidget): """ Widget optimized for very fast video display. Generally using an ImageItem inside GraphicsView is fast enough. On some systems this may provide faster video. See the VideoSpeedTest example for benchmarking. """ def __init__(self, parent=None, scaled=False): """ Setting scaled=True will cause the entire image to be displayed within the boundaries of the widget. This also greatly reduces the speed at which it will draw frames. """ QtWidgets.QWidget.__init__(self, parent) self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)) self.scaled = scaled self.opts = None self.image = None self._cp = getCupy() def setImage(self, img, *args, **kargs): """ img must be ndarray of shape (x,y), (x,y,3), or (x,y,4). Extra arguments are sent to functions.makeARGB """ if getConfigOption('imageAxisOrder') == 'col-major': img = img.swapaxes(0, 1) self.opts = (img, args, kargs) self.image = None self.update() def paintEvent(self, ev): if self.opts is None: return if self.image is None: img = self.opts[0] xp = self._cp.get_array_module(img) if self._cp else numpy qimage = None if ( not self.opts[1] # no positional arguments and {"levels", "lut"}.issuperset(self.opts[2]) # no kwargs besides levels and lut and not (img.dtype.kind == "f" and xp.isnan(img.min())) ): qimage = functions_qimage.try_make_qimage( img, levels=self.opts[2].get("levels"), lut=self.opts[2].get("lut"), ) if qimage is None: argb, alpha = fn.makeARGB(self.opts[0], *self.opts[1], **self.opts[2]) if self._cp and self._cp.get_array_module(argb) == self._cp: argb = argb.get() # transfer GPU data back to the CPU qimage = fn.ndarray_to_qimage(argb, QtGui.QImage.Format.Format_ARGB32) self.image = qimage self.opts = () # if self.pixmap is None: # self.pixmap = QtGui.QPixmap.fromImage(self.image) p = QtGui.QPainter(self) if self.scaled: rect = self.rect() ar = rect.width() / float(rect.height()) imar = self.image.width() / float(self.image.height()) if ar > imar: rect.setWidth(int(rect.width() * imar / ar)) else: rect.setHeight(int(rect.height() * ar / imar)) p.drawImage(rect, self.image) else: p.drawImage(QtCore.QPointF(), self.image) # p.drawPixmap(self.rect(), self.pixmap) p.end() if HAVE_OPENGL: __all__.append('RawImageGLWidget') class RawImageGLWidget(QOpenGLWidget): """ Similar to RawImageWidget, but uses a GL widget to do all drawing. Performance varies between platforms; see examples/VideoSpeedTest for benchmarking. Checks if setConfigOptions(imageAxisOrder='row-major') was set. """ def __init__(self, parent=None, scaled=False): QOpenGLWidget.__init__(self, parent) self.scaled = scaled self.image = None self.uploaded = False self.smooth = False self.opts = None def setImage(self, img, *args, **kargs): """ img must be ndarray of shape (x,y), (x,y,3), or (x,y,4). Extra arguments are sent to functions.makeARGB """ if getConfigOption('imageAxisOrder') == 'col-major': img = img.swapaxes(0, 1) self.opts = (img, args, kargs) self.image = None self.uploaded = False self.update() def initializeGL(self): self.texture = glGenTextures(1) def uploadTexture(self): glEnable(GL_TEXTURE_2D) glBindTexture(GL_TEXTURE_2D, self.texture) if self.smooth: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) else: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER) # glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER) ## Test texture dimensions first # shape = self.image.shape # glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, shape[0], shape[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, None) # if glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH) == 0: # raise Exception("OpenGL failed to create 2D texture (%dx%d); too large for this hardware." % shape[:2]) h, w = self.image.shape[:2] glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, self.image) glDisable(GL_TEXTURE_2D) self.uploaded = True def paintGL(self): glClear(GL_COLOR_BUFFER_BIT) if self.image is None: if self.opts is None: return img, args, kwds = self.opts kwds['useRGBA'] = True self.image, _ = fn.makeARGB(img, *args, **kwds) if not self.uploaded: self.uploadTexture() glEnable(GL_TEXTURE_2D) glBindTexture(GL_TEXTURE_2D, self.texture) glColor4f(1, 1, 1, 1) glBegin(GL_QUADS) glTexCoord2f(0, 1) glVertex3f(-1, -1, 0) glTexCoord2f(1, 1) glVertex3f(1, -1, 0) glTexCoord2f(1, 0) glVertex3f(1, 1, 0) glTexCoord2f(0, 0) glVertex3f(-1, 1, 0) glEnd() glDisable(GL_TEXTURE_2D) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/RemoteGraphicsView.py000066400000000000000000000276431457240071200254570ustar00rootroot00000000000000from ..Qt import QT_LIB, QtCore, QtGui, QtWidgets import atexit import enum import mmap import os import sys import tempfile from .. import Qt from .. import CONFIG_OPTIONS from .. import multiprocess as mp from .GraphicsView import GraphicsView __all__ = ['RemoteGraphicsView'] def serialize_mouse_enum(*args): # PySide6 (opt-in in 6.3.1) and PyQt6 # - implemented as python enums # - can pickle enums and flags # - PyQt6 cannot cast to int # PyQt5 5.12, PyQt5 5.15, PySide2 5.15, PySide6 can pickle enums but not flags # PySide2 5.12 cannot pickle enums nor flags # MouseButtons and KeyboardModifiers are flags return [x if isinstance(x, enum.Enum) else int(x) for x in args] class MouseEvent(QtGui.QMouseEvent): @staticmethod def get_state(obj, picklable=False): typ = obj.type() if isinstance(typ, int): # PyQt6 returns an int here instead of QEvent.Type, # but its QtGui.QMouseEvent constructor takes only QEvent.Type. # Note however that its QtCore.QEvent constructor accepts both # QEvent.Type and int. typ = QtCore.QEvent.Type(typ) lpos = obj.position() if hasattr(obj, 'position') else obj.localPos() gpos = obj.globalPosition() if hasattr(obj, 'globalPosition') else obj.screenPos() btn, btns, mods = obj.button(), obj.buttons(), obj.modifiers() if picklable: typ, btn, btns, mods = serialize_mouse_enum(typ, btn, btns, mods) return typ, lpos, gpos, btn, btns, mods def __init__(self, rhs): super().__init__(*self.get_state(rhs)) def __getstate__(self): return self.get_state(self, picklable=True) def __setstate__(self, state): typ, lpos, gpos, btn, btns, mods = state typ = QtCore.QEvent.Type(typ) btn = QtCore.Qt.MouseButton(btn) if not isinstance(btns, enum.Enum): btns = QtCore.Qt.MouseButtons(btns) if not isinstance(mods, enum.Enum): mods = QtCore.Qt.KeyboardModifiers(mods) super().__init__(typ, lpos, gpos, btn, btns, mods) class WheelEvent(QtGui.QWheelEvent): @staticmethod def get_state(obj, picklable=False): # {PyQt6, PySide6} have position() # {PyQt5, PySide2} 5.15 have position() # {PyQt5, PySide2} 5.15 have posF() (contrary to C++ docs) # {PyQt5, PySide2} 5.12 have posF() lpos = obj.position() if hasattr(obj, 'position') else obj.posF() gpos = obj.globalPosition() if hasattr(obj, 'globalPosition') else obj.globalPosF() pixdel, angdel, btns = obj.pixelDelta(), obj.angleDelta(), obj.buttons() mods, phase, inverted = obj.modifiers(), obj.phase(), obj.inverted() if picklable: btns, mods, phase = serialize_mouse_enum(btns, mods, phase) return lpos, gpos, pixdel, angdel, btns, mods, phase, inverted def __init__(self, rhs): items = list(self.get_state(rhs)) items[1] = items[0] # gpos = lpos super().__init__(*items) def __getstate__(self): return self.get_state(self, picklable=True) def __setstate__(self, state): pos, gpos, pixdel, angdel, btns, mods, phase, inverted = state if not isinstance(btns, enum.Enum): btns = QtCore.Qt.MouseButtons(btns) if not isinstance(mods, enum.Enum): mods = QtCore.Qt.KeyboardModifiers(mods) phase = QtCore.Qt.ScrollPhase(phase) super().__init__(pos, gpos, pixdel, angdel, btns, mods, phase, inverted) class EnterEvent(QtGui.QEnterEvent): @staticmethod def get_state(obj): lpos = obj.position() if hasattr(obj, 'position') else obj.localPos() wpos = obj.scenePosition() if hasattr(obj, 'scenePosition') else obj.windowPos() gpos = obj.globalPosition() if hasattr(obj, 'globalPosition') else obj.screenPos() return lpos, wpos, gpos def __init__(self, rhs): super().__init__(*self.get_state(rhs)) def __getstate__(self): return self.get_state(self) def __setstate__(self, state): super().__init__(*state) class LeaveEvent(QtCore.QEvent): @staticmethod def get_state(obj, picklable=False): typ = obj.type() if picklable: typ, = serialize_mouse_enum(typ) return typ, def __init__(self, rhs): super().__init__(*self.get_state(rhs)) def __getstate__(self): return self.get_state(self, picklable=True) def __setstate__(self, state): typ, = state typ = QtCore.QEvent.Type(typ) super().__init__(typ) class RemoteGraphicsView(QtWidgets.QWidget): """ Replacement for GraphicsView that does all scene management and rendering on a remote process, while displaying on the local widget. GraphicsItems must be created by proxy to the remote process. """ def __init__(self, parent=None, *args, **kwds): """ The keyword arguments 'useOpenGL' and 'backgound', if specified, are passed to the remote GraphicsView.__init__(). All other keyword arguments are passed to multiprocess.QtProcess.__init__(). """ self._img = None self._imgReq = None self._sizeHint = (640,480) ## no clue why this is needed, but it seems to be the default sizeHint for GraphicsView. ## without it, the widget will not compete for space against another GraphicsView. QtWidgets.QWidget.__init__(self) # separate local keyword arguments from remote. remoteKwds = {} for kwd in ['useOpenGL', 'background']: if kwd in kwds: remoteKwds[kwd] = kwds.pop(kwd) self._proc = mp.QtProcess(**kwds) self.pg = self._proc._import('pyqtgraph') self.pg.setConfigOptions(**CONFIG_OPTIONS) rpgRemote = self._proc._import('pyqtgraph.widgets.RemoteGraphicsView') self._view = rpgRemote.Renderer(*args, **remoteKwds) self._view._setProxyOptions(deferGetattr=True) self.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus) self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) self.setMouseTracking(True) self.shm = None shmFileName = self._view.shmFileName() if sys.platform == 'win32': opener = lambda path, flags: os.open(path, flags | os.O_TEMPORARY) else: opener = None self.shmFile = open(shmFileName, 'rb', opener=opener) self._view.sceneRendered.connect(mp.proxy(self.remoteSceneChanged)) #, callSync='off')) ## Note: we need synchronous signals ## even though there is no return value-- ## this informs the renderer that it is ## safe to begin rendering again. for method in ['scene', 'setCentralItem']: setattr(self, method, getattr(self._view, method)) def resizeEvent(self, ev): ret = super().resizeEvent(ev) self._view.resize(self.size(), _callSync='off') return ret def sizeHint(self): return QtCore.QSize(*self._sizeHint) def remoteSceneChanged(self, data): w, h, size = data if self.shm is None or self.shm.size != size: if self.shm is not None: self.shm.close() self.shm = mmap.mmap(self.shmFile.fileno(), size, access=mmap.ACCESS_READ) self._img = QtGui.QImage(self.shm, w, h, QtGui.QImage.Format.Format_RGB32).copy() self.update() def paintEvent(self, ev): if self._img is None: return p = QtGui.QPainter(self) p.drawImage(self.rect(), self._img, self._img.rect()) p.end() def mousePressEvent(self, ev): self._view.mousePressEvent(MouseEvent(ev), _callSync='off') ev.accept() return super().mousePressEvent(ev) def mouseReleaseEvent(self, ev): self._view.mouseReleaseEvent(MouseEvent(ev), _callSync='off') ev.accept() return super().mouseReleaseEvent(ev) def mouseMoveEvent(self, ev): self._view.mouseMoveEvent(MouseEvent(ev), _callSync='off') ev.accept() return super().mouseMoveEvent(ev) def wheelEvent(self, ev): self._view.wheelEvent(WheelEvent(ev), _callSync='off') ev.accept() return super().wheelEvent(ev) def enterEvent(self, ev): self._view.enterEvent(EnterEvent(ev), _callSync='off') return super().enterEvent(ev) def leaveEvent(self, ev): self._view.leaveEvent(LeaveEvent(ev), _callSync='off') return super().leaveEvent(ev) def remoteProcess(self): """Return the remote process handle. (see multiprocess.remoteproxy.RemoteEventHandler)""" return self._proc def close(self): """Close the remote process. After this call, the widget will no longer be updated.""" self._view.sceneRendered.disconnect() self._proc.close() class Renderer(GraphicsView): ## Created by the remote process to handle render requests sceneRendered = QtCore.Signal(object) def __init__(self, *args, **kwds): ## Create shared memory for rendered image self.shmFile = tempfile.NamedTemporaryFile(prefix='pyqtgraph_shmem_') size = mmap.PAGESIZE self.shmFile.write(b'\x00' * size) self.shmFile.flush() self.shm = mmap.mmap(self.shmFile.fileno(), size, access=mmap.ACCESS_WRITE) atexit.register(self.close) GraphicsView.__init__(self, *args, **kwds) self.scene().changed.connect(self.update) self.img = None self.renderTimer = QtCore.QTimer() self.renderTimer.timeout.connect(self.renderView) self.renderTimer.start(16) def close(self): self.shm.close() self.shmFile.close() def shmFileName(self): return self.shmFile.name def update(self): self.img = None return super().update() def resize(self, size): oldSize = self.size() super().resize(size) self.resizeEvent(QtGui.QResizeEvent(size, oldSize)) self.update() def renderView(self): if self.img is None: ## make sure shm is large enough and get its address if self.width() == 0 or self.height() == 0: return dpr = self.devicePixelRatioF() iwidth = int(self.width() * dpr) iheight = int(self.height() * dpr) size = iwidth * iheight * 4 if size > self.shm.size(): try: self.shm.resize(size) except SystemError: # actually, the platforms on which resize() _does_ work # can also take this codepath self.shm.close() fd = self.shmFile.fileno() os.ftruncate(fd, size) self.shm = mmap.mmap(fd, size, access=mmap.ACCESS_WRITE) ## render the scene directly to shared memory # see functions.py::ndarray_to_qimage() for rationale if QT_LIB.startswith('PyQt'): # PyQt5, PyQt6 >= 6.0.1 img_ptr = int(Qt.sip.voidptr(self.shm)) else: # PySide2, PySide6 img_ptr = self.shm self.img = QtGui.QImage(img_ptr, iwidth, iheight, QtGui.QImage.Format.Format_RGB32) self.img.setDevicePixelRatio(dpr) self.img.fill(0xffffffff) p = QtGui.QPainter(self.img) self.render(p, self.viewRect(), self.rect()) p.end() self.sceneRendered.emit((iwidth, iheight, self.shm.size())) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/ScatterPlotWidget.py000066400000000000000000000263331457240071200253130ustar00rootroot00000000000000from collections import OrderedDict import numpy as np from .. import functions as fn from .. import getConfigOption from .. import parametertree as ptree from ..graphicsItems.TextItem import TextItem from ..Qt import QtCore, QtWidgets from .ColorMapWidget import ColorMapParameter from .DataFilterWidget import DataFilterParameter from .PlotWidget import PlotWidget __all__ = ['ScatterPlotWidget'] class ScatterPlotWidget(QtWidgets.QSplitter): """ This is a high-level widget for exploring relationships in tabular data. Given a multi-column record array, the widget displays a scatter plot of a specific subset of the data. Includes controls for selecting the columns to plot, filtering data, and determining symbol color and shape. The widget consists of four components: 1) A list of column names from which the user may select 1 or 2 columns to plot. If one column is selected, the data for that column will be plotted in a histogram-like manner by using :func:`pseudoScatter() `. If two columns are selected, then the scatter plot will be generated with x determined by the first column that was selected and y by the second. 2) A DataFilter that allows the user to select a subset of the data by specifying multiple selection criteria. 3) A ColorMap that allows the user to determine how points are colored by specifying multiple criteria. 4) A PlotWidget for displaying the data. """ sigScatterPlotClicked = QtCore.Signal(object, object, object) sigScatterPlotHovered = QtCore.Signal(object, object, object) def __init__(self, parent=None): QtWidgets.QSplitter.__init__(self, QtCore.Qt.Orientation.Horizontal) self.ctrlPanel = QtWidgets.QSplitter(QtCore.Qt.Orientation.Vertical) self.addWidget(self.ctrlPanel) self.fieldList = QtWidgets.QListWidget() self.fieldList.setSelectionMode(self.fieldList.SelectionMode.ExtendedSelection) self.ptree = ptree.ParameterTree(showHeader=False) self.filter = DataFilterParameter() self.colorMap = ColorMapParameter() self.params = ptree.Parameter.create(name='params', type='group', children=[self.filter, self.colorMap]) self.ptree.setParameters(self.params, showTop=False) self.plot = PlotWidget() self.ctrlPanel.addWidget(self.fieldList) self.ctrlPanel.addWidget(self.ptree) self.addWidget(self.plot) fg = fn.mkColor(getConfigOption('foreground')) fg.setAlpha(150) self.filterText = TextItem(border=getConfigOption('foreground'), color=fg) self.filterText.setPos(60,20) self.filterText.setParentItem(self.plot.plotItem) self.data = None self.indices = None self.mouseOverField = None self.scatterPlot = None self.selectionScatter = None self.selectedIndices = [] self.style = dict(pen=None, symbol='o') self._visibleXY = None # currently plotted points self._visibleData = None # currently plotted records self._visibleIndices = None self._indexMap = None self.fieldList.itemSelectionChanged.connect(self.fieldSelectionChanged) self.filter.sigFilterChanged.connect(self.filterChanged) self.colorMap.sigColorMapChanged.connect(self.updatePlot) def setFields(self, fields, mouseOverField=None): """ Set the list of field names/units to be processed. The format of *fields* is the same as used by :meth:`~pyqtgraph.widgets.ColorMapWidget.ColorMapParameter.setFields` """ self.fields = OrderedDict(fields) self.mouseOverField = mouseOverField self.fieldList.clear() for f,opts in fields: item = QtWidgets.QListWidgetItem(f) item.opts = opts item = self.fieldList.addItem(item) self.filter.setFields(fields) self.colorMap.setFields(fields) def setSelectedFields(self, *fields): self.fieldList.itemSelectionChanged.disconnect(self.fieldSelectionChanged) try: self.fieldList.clearSelection() for f in fields: i = list(self.fields.keys()).index(f) item = self.fieldList.item(i) item.setSelected(True) finally: self.fieldList.itemSelectionChanged.connect(self.fieldSelectionChanged) self.fieldSelectionChanged() def setData(self, data): """ Set the data to be processed and displayed. Argument must be a numpy record array. """ self.data = data self.indices = np.arange(len(data)) self.filtered = None self.filteredIndices = None self.updatePlot() def setSelectedIndices(self, inds): """Mark the specified indices as selected. Must be a sequence of integers that index into the array given in setData(). """ self.selectedIndices = inds self.updateSelected() def setSelectedPoints(self, points): """Mark the specified points as selected. Must be a list of points as generated by the sigScatterPlotClicked signal. """ self.setSelectedIndices([pt.originalIndex for pt in points]) def fieldSelectionChanged(self): sel = self.fieldList.selectedItems() if len(sel) > 2: self.fieldList.blockSignals(True) try: for item in sel[1:-1]: item.setSelected(False) finally: self.fieldList.blockSignals(False) self.updatePlot() def filterChanged(self, f): self.filtered = None self.updatePlot() desc = self.filter.describe() if len(desc) == 0: self.filterText.setVisible(False) else: self.filterText.setText('\n'.join(desc)) self.filterText.setVisible(True) def updatePlot(self): self.plot.clear() if self.data is None or len(self.data) == 0: return if self.filtered is None: mask = self.filter.generateMask(self.data) self.filtered = self.data[mask] self.filteredIndices = self.indices[mask] data = self.filtered if len(data) == 0: return colors = np.array([fn.mkBrush(*x) for x in self.colorMap.map(data)]) style = self.style.copy() ## Look up selected columns and units sel = list([str(item.text()) for item in self.fieldList.selectedItems()]) units = list([item.opts.get('units', '') for item in self.fieldList.selectedItems()]) if len(sel) == 0: self.plot.setTitle('') return if len(sel) == 1: self.plot.setLabels(left=('N', ''), bottom=(sel[0], units[0]), title='') if len(data) == 0: return #x = data[sel[0]] #y = None xy = [data[sel[0]], None] elif len(sel) == 2: self.plot.setLabels(left=(sel[1],units[1]), bottom=(sel[0],units[0])) if len(data) == 0: return xy = [data[sel[0]], data[sel[1]]] #xydata = [] #for ax in [0,1]: #d = data[sel[ax]] ### scatter catecorical values just a bit so they show up better in the scatter plot. ##if sel[ax] in ['MorphologyBSMean', 'MorphologyTDMean', 'FIType']: ##d += np.random.normal(size=len(cells), scale=0.1) #xydata.append(d) #x,y = xydata ## convert enum-type fields to float, set axis labels enum = [False, False] for i in [0,1]: axis = self.plot.getAxis(['bottom', 'left'][i]) if xy[i] is not None and (self.fields[sel[i]].get('mode', None) == 'enum' or xy[i].dtype.kind in ('S', 'O')): vals = self.fields[sel[i]].get('values', list(set(xy[i]))) xy[i] = np.array([vals.index(x) if x in vals else len(vals) for x in xy[i]], dtype=float) axis.setTicks([list(enumerate(vals))]) enum[i] = True else: axis.setTicks(None) # reset to automatic ticking ## mask out any nan values mask = np.ones(len(xy[0]), dtype=bool) if xy[0].dtype.kind == 'f': mask &= np.isfinite(xy[0]) if xy[1] is not None and xy[1].dtype.kind == 'f': mask &= np.isfinite(xy[1]) xy[0] = xy[0][mask] style['symbolBrush'] = colors[mask] data = data[mask] indices = self.filteredIndices[mask] ## Scatter y-values for a histogram-like appearance if xy[1] is None: ## column scatter plot xy[1] = fn.pseudoScatter(xy[0]) else: ## beeswarm plots xy[1] = xy[1][mask] for ax in [0,1]: if not enum[ax]: continue imax = int(xy[ax].max()) if len(xy[ax]) > 0 else 0 for i in range(imax+1): keymask = xy[ax] == i scatter = fn.pseudoScatter(xy[1-ax][keymask], bidir=True) if len(scatter) == 0: continue smax = np.abs(scatter).max() if smax != 0: scatter *= 0.2 / smax xy[ax][keymask] += scatter if self.scatterPlot is not None: try: self.scatterPlot.sigPointsClicked.disconnect(self.plotClicked) except: pass self._visibleXY = xy self._visibleData = data self._visibleIndices = indices self._indexMap = None self.scatterPlot = self.plot.plot(xy[0], xy[1], data=data, **style) self.scatterPlot.sigPointsClicked.connect(self.plotClicked) self.scatterPlot.sigPointsHovered.connect(self.plotHovered) self.updateSelected() def updateSelected(self): if self._visibleXY is None: return # map from global index to visible index indMap = self._getIndexMap() inds = [indMap[i] for i in self.selectedIndices if i in indMap] x,y = self._visibleXY[0][inds], self._visibleXY[1][inds] if self.selectionScatter is not None: self.plot.plotItem.removeItem(self.selectionScatter) if len(x) == 0: return self.selectionScatter = self.plot.plot(x, y, pen=None, symbol='s', symbolSize=12, symbolBrush=None, symbolPen='y') def _getIndexMap(self): # mapping from original data index to visible point index if self._indexMap is None: self._indexMap = {j:i for i,j in enumerate(self._visibleIndices)} return self._indexMap def plotClicked(self, plot, points, ev): # Tag each point with its index into the original dataset for pt in points: pt.originalIndex = self._visibleIndices[pt.index()] self.sigScatterPlotClicked.emit(self, points, ev) def plotHovered(self, plot, points, ev): self.sigScatterPlotHovered.emit(self, points, ev) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/SpinBox.py000066400000000000000000000630601457240071200232630ustar00rootroot00000000000000import decimal import re import warnings from math import isinf, isnan from .. import functions as fn from ..Qt import QtCore, QtGui, QtWidgets from ..SignalProxy import SignalProxy __all__ = ['SpinBox'] class SpinBox(QtWidgets.QAbstractSpinBox): """ **Bases:** QtWidgets.QAbstractSpinBox Extension of QSpinBox widget for selection of a numerical value. Adds many extra features: * SI prefix notation (eg, automatically display "300 mV" instead of "0.003 V") * Float values with linear and decimal stepping (1-9, 10-90, 100-900, etc.) * Option for unbounded values * Delayed signals (allows multiple rapid changes with only one change signal) * Customizable text formatting ============================= ============================================== **Signals:** valueChanged(value) Same as QSpinBox; emitted every time the value has changed. sigValueChanged(self) Emitted when value has changed, but also combines multiple rapid changes into one signal (eg, when rolling the mouse wheel). sigValueChanging(self, value) Emitted immediately for all value changes. ============================= ============================================== """ ## There's a PyQt bug that leaks a reference to the ## QLineEdit returned from QAbstractSpinBox.lineEdit() ## This makes it possible to crash the entire program ## by making accesses to the LineEdit after the spinBox has been deleted. ## I have no idea how to get around this.. valueChanged = QtCore.Signal(object) # (value) for compatibility with QSpinBox sigValueChanged = QtCore.Signal(object) # (self) sigValueChanging = QtCore.Signal(object, object) # (self, value) sent immediately; no delay. def __init__(self, parent=None, value=0.0, **kwargs): """ ============== ======================================================================== **Arguments:** parent Sets the parent widget for this SpinBox (optional). Default is None. value (float/int) initial value. Default is 0.0. ============== ======================================================================== All keyword arguments are passed to :func:`setOpts`. """ QtWidgets.QAbstractSpinBox.__init__(self, parent) self.lastValEmitted = None self.lastText = '' self.textValid = True ## If false, we draw a red border self.setMinimumWidth(0) self._lastFontHeight = None self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred) self.errorBox = ErrorBox(self.lineEdit()) self.opts = { 'bounds': [None, None], 'wrapping': False, ## normal arithmetic step 'step': decimal.Decimal('0.01'), ## if 'dec' is false, the spinBox steps by 'step' every time ## if 'dec' is True, the step size is relative to the value ## 'step' needs to be an integral divisor of ten, ie 'step'*n=10 for some integer value of n (but only if dec is True) 'dec': False, ## if true, does decimal stepping. ie from 1-10 it steps by 'step', from 10 to 100 it steps by 10*'step', etc. ## if true, minStep must be set in order to cross zero. 'int': False, ## Set True to force value to be integer. If True, 'step' is rounded to the nearest integer or defaults to 1. 'finite': True, 'prefix': '', ## string to be prepended to spin box value 'suffix': '', 'siPrefix': False, ## Set to True to display numbers with SI prefix (ie, 100pA instead of 1e-10A) 'scaleAtZero': None, 'delay': 0.3, ## delay sending wheel update signals for 300ms 'delayUntilEditFinished': True, ## do not send signals until text editing has finished 'decimals': 6, 'format': "{prefix}{prefixGap}{scaledValue:.{decimals}g}{suffixGap}{siPrefix}{suffix}", 'regex': fn.FLOAT_REGEX, 'evalFunc': decimal.Decimal, 'compactHeight': True, # manually remove extra margin outside of text } if kwargs.get('int', False): self.opts['step'] = 1 self.decOpts = ['step', 'minStep'] self.val = decimal.Decimal(str(value)) ## Value is precise decimal. Ordinary math not allowed. self.updateText() self.skipValidate = False self.setCorrectionMode(self.CorrectionMode.CorrectToPreviousValue) self.setKeyboardTracking(False) self.proxy = SignalProxy( self.sigValueChanging, delay=self.opts['delay'], slot=self.delayedChange, threadSafe=False, ) self.setOpts(**kwargs) self._updateHeight() self.editingFinished.connect(self.editingFinishedEvent) def setOpts(self, **opts): """Set options affecting the behavior of the SpinBox. ============== ======================================================================== **Arguments:** bounds (min,max) Minimum and maximum values allowed in the SpinBox. Either may be None to leave the value unbounded. By default, values are unbounded. suffix (str) suffix (units) to display after the numerical value. By default, suffix is an empty str. siPrefix (bool) If True, then an SI prefix is automatically prepended to the units and the value is scaled accordingly. For example, if value=0.003 and suffix='V', then the SpinBox will display "300 mV" (but a call to SpinBox.value will still return 0.003). In case the value represents a dimensionless quantity that might span many orders of magnitude, such as a Reynolds number, an SI prefix is allowed with no suffix. Default is False. prefix (str) String to be prepended to the spin box value. Default is an empty string. scaleAtZero (float) If siPrefix is also True, this option then sets the default SI prefix that a value of 0 will have applied (and thus the default scale of the first number the user types in after the SpinBox has been zeroed out). step (float) The size of a single step. This is used when clicking the up/ down arrows, when rolling the mouse wheel, or when pressing keyboard arrows while the widget has keyboard focus. Note that the interpretation of this value is different when specifying the 'dec' argument. If 'int' is True, 'step' is rounded to the nearest integer. Default is 0.01 if 'int' is False and 1 otherwise. dec (bool) If True, then the step value will be adjusted to match the current size of the variable (for example, a value of 15 might step in increments of 1 whereas a value of 1500 would step in increments of 100). In this case, the 'step' argument is interpreted *relative* to the current value. The most common 'step' values when dec=True are 0.1, 0.2, 0.5, and 1.0. Default is False. minStep (float) When dec=True, this specifies the minimum allowable step size. int (bool) If True, the value is forced to integer type. If True, 'step' is rounded to the nearest integer or defaults to 1. Default is False finite (bool) When False and int=False, infinite values (nan, inf, -inf) are permitted. Default is True. wrapping (bool) If True and both bounds are not None, spin box has circular behavior. decimals (int) Number of decimal values to display. Default is 6. format (str) Formatting string used to generate the text shown. Formatting is done with ``str.format()`` and makes use of several arguments: * *value* - the unscaled value of the spin box * *prefix* - the prefix string * *prefixGap* - a single space if a prefix is present, or an empty string otherwise * *suffix* - the suffix string * *scaledValue* - the scaled value to use when an SI prefix is present * *siPrefix* - the SI prefix string (if any), or an empty string if this feature has been disabled * *suffixGap* - a single space if a suffix is present, or an empty string otherwise. regex (str or RegexObject) Regular expression used to parse the spinbox text. May contain the following group names: * *number* - matches the numerical portion of the string (mandatory) * *siPrefix* - matches the SI prefix string * *suffix* - matches the suffix string Default is defined in ``pyqtgraph.functions.FLOAT_REGEX``. evalFunc (callable) Fucntion that converts a numerical string to a number, preferrably a Decimal instance. This function handles only the numerical of the text; it does not have access to the suffix or SI prefix. compactHeight (bool) if True, then set the maximum height of the spinbox based on the height of its font. This allows more compact packing on platforms with excessive widget decoration. Default is True. ============== ======================================================================== """ #print opts for k,v in opts.items(): if k == 'bounds': self.setMinimum(v[0], update=False) self.setMaximum(v[1], update=False) elif k == 'min': self.setMinimum(v, update=False) elif k == 'max': self.setMaximum(v, update=False) elif k in ['step', 'minStep']: self.opts[k] = decimal.Decimal(str(v)) elif k == 'value': pass ## don't set value until bounds have been set elif k == 'format': self.opts[k] = str(v) elif k == 'regex' and isinstance(v, str): self.opts[k] = re.compile(v) elif k in self.opts: self.opts[k] = v else: raise TypeError("Invalid keyword argument '%s'." % k) if 'value' in opts: self.setValue(opts['value']) ## If bounds have changed, update value to match if 'bounds' in opts and 'value' not in opts: self.setValue() ## sanity checks: if self.opts['int']: self.opts['step'] = round(self.opts.get('step', 1)) if 'minStep' in opts: step = opts['minStep'] if int(step) != step: raise Exception('Integer SpinBox must have integer minStep size.') else: ms = int(self.opts.get('minStep', 1)) if ms < 1: ms = 1 self.opts['minStep'] = ms if 'format' not in opts: self.opts['format'] = "{prefix}{prefixGap}{value:d}{suffixGap}{suffix}" if self.opts['dec']: if self.opts.get('minStep') is None: self.opts['minStep'] = self.opts['step'] if 'delay' in opts: self.proxy.setDelay(opts['delay']) self.updateText() def setMaximum(self, m, update=True): """Set the maximum allowed value (or None for no limit)""" if m is not None: m = decimal.Decimal(str(m)) self.opts['bounds'][1] = m if update: self.setValue() def setMinimum(self, m, update=True): """Set the minimum allowed value (or None for no limit)""" if m is not None: m = decimal.Decimal(str(m)) self.opts['bounds'][0] = m if update: self.setValue() def wrapping(self): """Return whether or not the spin box is circular.""" return self.opts['wrapping'] def setWrapping(self, s): """Set whether spin box is circular. Both bounds must be set for this to have an effect.""" self.opts['wrapping'] = s def setPrefix(self, p): """Set a string prefix. """ self.setOpts(prefix=p) def setRange(self, r0, r1): """Set the upper and lower limits for values in the spinbox. """ self.setOpts(bounds = [r0,r1]) def setProperty(self, prop, val): ## for QSpinBox compatibility if prop == 'value': #if type(val) is QtCore.QVariant: #val = val.toDouble()[0] self.setValue(val) else: print("Warning: SpinBox.setProperty('%s', ..) not supported." % prop) def setSuffix(self, suf): """Set the string suffix appended to the spinbox text. """ self.setOpts(suffix=suf) def setSingleStep(self, step): """Set the step size used when responding to the mouse wheel, arrow buttons, or arrow keys. """ self.setOpts(step=step) def setDecimals(self, decimals): """Set the number of decimals to be displayed when formatting numeric values. """ self.setOpts(decimals=decimals) def selectNumber(self): """ Select the numerical portion of the text to allow quick editing by the user. """ le = self.lineEdit() text = le.text() m = self.opts['regex'].match(text) if m is None: return s,e = m.start('number'), m.end('number') le.setSelection(s, e-s) def focusInEvent(self, ev): super(SpinBox, self).focusInEvent(ev) self.selectNumber() def value(self): """ Return the value of this SpinBox. """ if self.opts['int']: return int(self.val) else: return float(self.val) def setValue(self, value=None, update=True, delaySignal=False): """Set the value of this SpinBox. If the value is out of bounds, it will be clipped to the nearest boundary or wrapped if wrapping is enabled. If the spin is integer type, the value will be coerced to int. Returns the actual value set. If value is None, then the current value is used (this is for resetting the value after bounds, etc. have changed) """ if value is None: value = self.value() bounded = True if not isnan(value): bounds = self.opts['bounds'] if None not in bounds and self.opts['wrapping'] is True: bounded = False if isinf(value): value = self.val else: # Casting of Decimals to floats required to avoid unexpected behavior of remainder operator value = float(value) l, u = float(bounds[0]), float(bounds[1]) value = (value - l) % (u - l) + l else: if bounds[0] is not None and value < bounds[0]: bounded = False value = bounds[0] if bounds[1] is not None and value > bounds[1]: bounded = False value = bounds[1] if self.opts['int']: value = int(value) if not isinstance(value, decimal.Decimal): value = decimal.Decimal(str(value)) prev, self.val = self.val, value changed = not fn.eq(value, prev) # use fn.eq to handle nan if update and (changed or not bounded): self.updateText() if changed: self.sigValueChanging.emit(self, float(self.val)) ## change will be emitted in 300ms if there are no subsequent changes. if not delaySignal: self.emitChanged() return value def emitChanged(self): self.lastValEmitted = self.val self.valueChanged.emit(float(self.val)) self.sigValueChanged.emit(self) def delayedChange(self): try: if not fn.eq(self.val, self.lastValEmitted): # use fn.eq to handle nan self.emitChanged() except RuntimeError: pass ## This can happen if we try to handle a delayed signal after someone else has already deleted the underlying C++ object. def widgetGroupInterface(self): return (self.valueChanged, SpinBox.value, SpinBox.setValue) def sizeHint(self): return QtCore.QSize(120, 0) def stepEnabled(self): return self.StepEnabledFlag.StepUpEnabled | self.StepEnabledFlag.StepDownEnabled def stepBy(self, n): ## note all steps (arrow buttons, wheel, up/down keys..) emit delayed signals only. self.setValue(self._stepByValue(n), delaySignal=True) def _stepByValue(self, steps): if isinf(self.val) or isnan(self.val): return self.val steps = int(steps) sign = [decimal.Decimal(-1), decimal.Decimal(1)][steps >= 0] val = self.val for i in range(int(abs(steps))): if self.opts['dec']: if val == 0: step = self.opts['minStep'] exp = None else: vs = [decimal.Decimal(-1), decimal.Decimal(1)][val >= 0] ## fudge factor. at some places, the step size depends on the step sign. fudge = decimal.Decimal('1.01') ** (sign * vs) exp = abs(val * fudge).log10().quantize(1, decimal.ROUND_FLOOR) step = self.opts['step'] * decimal.Decimal(10) ** exp if 'minStep' in self.opts: step = max(step, self.opts['minStep']) val += sign * step else: val += sign * self.opts['step'] if 'minStep' in self.opts and abs(val) < self.opts['minStep']: val = decimal.Decimal(0) return val def valueInRange(self, value): if not isnan(value): bounds = self.opts['bounds'] if bounds[0] is not None and value < bounds[0]: return False if bounds[1] is not None and value > bounds[1]: return False if self.opts.get('int', False): if int(value) != value: return False return True def updateText(self, **kwargs): # temporarily disable validation self.skipValidate = True txt = self.formatText(**kwargs) # actually set the text self.lineEdit().setText(txt) self.lastText = txt # re-enable the validation self.skipValidate = False def formatText(self, **kwargs): if 'prev' in kwargs: warnings.warn( "updateText and formatText no longer take prev argument. This will error after January 2025.", DeprecationWarning, stacklevel=2 ) # TODO remove all kwargs handling here and updateText after January 2025 # get the number of decimal places to print decimals = self.opts['decimals'] suffix = self.opts['suffix'] prefix = self.opts['prefix'] # format the string val = self.value() if self.opts['siPrefix'] is True: # SI prefix was requested, so scale the value accordingly if self.val == 0: if self.opts['scaleAtZero'] is not None: (s, p) = fn.siScale(self.opts['scaleAtZero']) else: (s, p) = fn.siScale(self._stepByValue(1)) else: (s, p) = fn.siScale(val) parts = {'value': val, 'suffix': suffix, 'decimals': decimals, 'siPrefix': p, 'scaledValue': s*val, 'prefix':prefix} else: # no SI prefix /suffix requested; scale is 1 parts = {'value': val, 'suffix': suffix, 'decimals': decimals, 'siPrefix': '', 'scaledValue': val, 'prefix':prefix} parts['prefixGap'] = '' if parts['prefix'] == '' else ' ' parts['suffixGap'] = '' if (parts['suffix'] == '' and parts['siPrefix'] == '') else ' ' return self.opts['format'].format(**parts) def validate(self, strn, pos): if self.skipValidate: ret = QtGui.QValidator.State.Acceptable else: try: val = self.interpret() if val is False: ret = QtGui.QValidator.State.Intermediate else: if self.valueInRange(val): if not self.opts['delayUntilEditFinished']: self.setValue(val, update=False) ret = QtGui.QValidator.State.Acceptable else: ret = QtGui.QValidator.State.Intermediate except: import sys sys.excepthook(*sys.exc_info()) ret = QtGui.QValidator.State.Intermediate ## draw / clear border if ret == QtGui.QValidator.State.Intermediate: self.textValid = False elif ret == QtGui.QValidator.State.Acceptable: self.textValid = True ## note: if text is invalid, we don't change the textValid flag ## since the text will be forced to its previous state anyway self.update() self.errorBox.setVisible(not self.textValid) return (ret, strn, pos) def fixup(self, strn): # fixup is called when the spinbox loses focus with an invalid or intermediate string self.updateText() return self.lineEdit().text() def interpret(self): """Return value of text or False if text is invalid.""" strn = self.lineEdit().text() # strip prefix try: strn = strn.removeprefix(self.opts['prefix']) except AttributeError: strn = strn[len(self.opts['prefix']):] # tokenize into numerical value, si prefix, and suffix try: val, siprefix, suffix = fn.siParse(strn, self.opts['regex'], suffix=self.opts['suffix']) except Exception: return False # check suffix if suffix != self.opts['suffix']: return False # generate value val = self.opts['evalFunc'](val) if (self.opts['int'] or self.opts['finite']) and (isinf(val) or isnan(val)): return False if self.opts['int']: val = int(fn.siApply(val, siprefix)) else: try: val = fn.siApply(val, siprefix) except Exception: import sys sys.excepthook(*sys.exc_info()) return False return val def editingFinishedEvent(self): """Edit has finished; set value.""" if self.lineEdit().text() == self.lastText: return try: val = self.interpret() except Exception: return if val is False: return if val == self.val: return self.setValue(val, delaySignal=False) ## allow text update so that values are reformatted pretty-like def _updateHeight(self): # SpinBox has very large margins on some platforms; this is a hack to remove those # margins and allow more compact packing of controls. if not self.opts['compactHeight']: self.setMaximumHeight(1000000) return h = QtGui.QFontMetrics(self.font()).height() if self._lastFontHeight != h: self._lastFontHeight = h self.setMaximumHeight(h) def paintEvent(self, ev): self._updateHeight() super().paintEvent(ev) class ErrorBox(QtWidgets.QWidget): """Red outline to draw around lineedit when value is invalid. (for some reason, setting border from stylesheet does not work) """ def __init__(self, parent): QtWidgets.QWidget.__init__(self, parent) parent.installEventFilter(self) self.setAttribute(QtCore.Qt.WidgetAttribute.WA_TransparentForMouseEvents) self._resize() self.setVisible(False) def eventFilter(self, obj, ev): if ev.type() == QtCore.QEvent.Type.Resize: self._resize() return False def _resize(self): self.setGeometry(0, 0, self.parent().width(), self.parent().height()) def paintEvent(self, ev): p = QtGui.QPainter(self) p.setPen(fn.mkPen(color='r', width=2)) p.drawRect(self.rect()) p.end() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/TableWidget.py000066400000000000000000000427251457240071200241010ustar00rootroot00000000000000import numpy as np from ..Qt import QtCore, QtGui, QtWidgets translate = QtCore.QCoreApplication.translate __all__ = ['TableWidget'] def _defersort(fn): def defersort(self, *args, **kwds): # may be called recursively; only the first call needs to block sorting setSorting = False if self._sorting is None: self._sorting = self.isSortingEnabled() setSorting = True self.setSortingEnabled(False) try: return fn(self, *args, **kwds) finally: if setSorting: self.setSortingEnabled(self._sorting) self._sorting = None return defersort class TableWidget(QtWidgets.QTableWidget): """Extends QTableWidget with some useful functions for automatic data handling and copy / export context menu. Can automatically format and display a variety of data types (see :func:`setData() ` for more information. """ def __init__(self, *args, **kwds): """ All positional arguments are passed to QTableWidget.__init__(). ===================== ================================================= **Keyword Arguments** editable (bool) If True, cells in the table can be edited by the user. Default is False. sortable (bool) If True, the table may be soted by clicking on column headers. Note that this also causes rows to appear initially shuffled until a sort column is selected. Default is True. *(added in version 0.9.9)* ===================== ================================================= """ QtWidgets.QTableWidget.__init__(self, *args) self.itemClass = TableWidgetItem self.setVerticalScrollMode(self.ScrollMode.ScrollPerPixel) self.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ContiguousSelection) self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) self.clear() kwds.setdefault('sortable', True) kwds.setdefault('editable', False) self.setEditable(kwds.pop('editable')) self.setSortingEnabled(kwds.pop('sortable')) if len(kwds) > 0: raise TypeError("Invalid keyword arguments '%s'" % list(kwds.keys())) self._sorting = None # used when temporarily disabling sorting self._formats = {None: None} # stores per-column formats and entire table format self.sortModes = {} # stores per-column sort mode self.itemChanged.connect(self.handleItemChanged) self.contextMenu = QtWidgets.QMenu() self.contextMenu.addAction(translate("TableWidget", 'Copy Selection')).triggered.connect(self.copySel) self.contextMenu.addAction(translate("TableWidget", 'Copy All')).triggered.connect(self.copyAll) self.contextMenu.addAction(translate("TableWidget", 'Save Selection')).triggered.connect(self.saveSel) self.contextMenu.addAction(translate("TableWidget", 'Save All')).triggered.connect(self.saveAll) def clear(self): """Clear all contents from the table.""" QtWidgets.QTableWidget.clear(self) self.verticalHeadersSet = False self.horizontalHeadersSet = False self.items = [] self.setRowCount(0) self.setColumnCount(0) self.sortModes = {} def setData(self, data): """Set the data displayed in the table. Allowed formats are: * numpy arrays * numpy record arrays * metaarrays * list-of-lists [[1,2,3], [4,5,6]] * dict-of-lists {'x': [1,2,3], 'y': [4,5,6]} * list-of-dicts [{'x': 1, 'y': 4}, {'x': 2, 'y': 5}, ...] """ self.clear() self.appendData(data) self.resizeColumnsToContents() @_defersort def appendData(self, data): """ Add new rows to the table. See :func:`setData() ` for accepted data types. """ startRow = self.rowCount() fn0, header0 = self.iteratorFn(data) if fn0 is None: self.clear() return it0 = fn0(data) try: first = next(it0) except StopIteration: return fn1, header1 = self.iteratorFn(first) if fn1 is None: self.clear() return firstVals = [x for x in fn1(first)] self.setColumnCount(len(firstVals)) if not self.verticalHeadersSet and header0 is not None: labels = [self.verticalHeaderItem(i).text() for i in range(self.rowCount())] self.setRowCount(startRow + len(header0)) self.setVerticalHeaderLabels(labels + header0) self.verticalHeadersSet = True if not self.horizontalHeadersSet and header1 is not None: self.setHorizontalHeaderLabels(header1) self.horizontalHeadersSet = True i = startRow self.setRow(i, firstVals) for row in it0: i += 1 self.setRow(i, [x for x in fn1(row)]) if (self._sorting and self.horizontalHeadersSet and self.horizontalHeader().sortIndicatorSection() >= self.columnCount()): self.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder) def setEditable(self, editable=True): self.editable = editable for item in self.items: item.setEditable(editable) def setFormat(self, format, column=None): """ Specify the default text formatting for the entire table, or for a single column if *column* is specified. If a string is specified, it is used as a format string for converting float values (and all other types are converted using str). If a function is specified, it will be called with the item as its only argument and must return a string. Setting format = None causes the default formatter to be used instead. Added in version 0.9.9. """ if format is not None and not isinstance(format, str) and not callable(format): raise ValueError("Format argument must string, callable, or None. (got %s)" % format) self._formats[column] = format if column is None: # update format of all items that do not have a column format # specified for c in range(self.columnCount()): if self._formats.get(c, None) is None: for r in range(self.rowCount()): item = self.item(r, c) if item is None: continue item.setFormat(format) else: # set all items in the column to use this format, or the default # table format if None was specified. if format is None: format = self._formats[None] for r in range(self.rowCount()): item = self.item(r, column) if item is None: continue item.setFormat(format) def iteratorFn(self, data): ## Return 1) a function that will provide an iterator for data and 2) a list of header strings if isinstance(data, list) or isinstance(data, tuple): return lambda d: d.__iter__(), None elif isinstance(data, dict): return lambda d: iter(d.values()), list(map(str, data.keys())) elif (hasattr(data, 'implements') and data.implements('MetaArray')): if data.axisHasColumns(0): header = [str(data.columnName(0, i)) for i in range(data.shape[0])] elif data.axisHasValues(0): header = list(map(str, data.xvals(0))) else: header = None return self.iterFirstAxis, header elif isinstance(data, np.ndarray): return self.iterFirstAxis, None elif isinstance(data, np.void): return self.iterate, list(map(str, data.dtype.names)) elif data is None: return (None,None) elif np.isscalar(data): return self.iterateScalar, None else: msg = "Don't know how to iterate over data type: {!s}".format(type(data)) raise TypeError(msg) def iterFirstAxis(self, data): for i in range(data.shape[0]): yield data[i] def iterate(self, data): # for numpy.void, which can be iterated but mysteriously # has no __iter__ (??) for x in data: yield x def iterateScalar(self, data): yield data def appendRow(self, data): self.appendData([data]) @_defersort def addRow(self, vals): row = self.rowCount() self.setRowCount(row + 1) self.setRow(row, vals) @_defersort def setRow(self, row, vals): if row > self.rowCount() - 1: self.setRowCount(row + 1) for col in range(len(vals)): val = vals[col] item = self.itemClass(val, row) item.setEditable(self.editable) sortMode = self.sortModes.get(col, None) if sortMode is not None: item.setSortMode(sortMode) format = self._formats.get(col, self._formats[None]) item.setFormat(format) self.items.append(item) self.setItem(row, col, item) item.setValue(val) # Required--the text-change callback is invoked # when we call setItem. def setSortMode(self, column, mode): """ Set the mode used to sort *column*. ============== ======================================================== **Sort Modes** value Compares item.value if available; falls back to text comparison. text Compares item.text() index Compares by the order in which items were inserted. ============== ======================================================== Added in version 0.9.9 """ for r in range(self.rowCount()): item = self.item(r, column) if hasattr(item, 'setSortMode'): item.setSortMode(mode) self.sortModes[column] = mode def sizeHint(self): # based on http://stackoverflow.com/a/7195443/54056 width = sum(self.columnWidth(i) for i in range(self.columnCount())) width += self.verticalHeader().sizeHint().width() width += self.verticalScrollBar().sizeHint().width() width += self.frameWidth() * 2 height = sum(self.rowHeight(i) for i in range(self.rowCount())) height += self.verticalHeader().sizeHint().height() height += self.horizontalScrollBar().sizeHint().height() return QtCore.QSize(width, height) def serialize(self, useSelection=False): """Convert entire table (or just selected area) into tab-separated text values""" if useSelection: selection = self.selectedRanges()[0] rows = list(range(selection.topRow(), selection.bottomRow() + 1)) columns = list(range(selection.leftColumn(), selection.rightColumn() + 1)) else: rows = list(range(self.rowCount())) columns = list(range(self.columnCount())) data = [] if self.horizontalHeadersSet: row = [] if self.verticalHeadersSet: row.append('') for c in columns: row.append(self.horizontalHeaderItem(c).text()) data.append(row) for r in rows: row = [] if self.verticalHeadersSet: row.append(self.verticalHeaderItem(r).text()) for c in columns: item = self.item(r, c) if item is not None: row.append(str(item.value)) else: row.append('') data.append(row) s = '' for row in data: s += ('\t'.join(row) + '\n') return s def copySel(self): """Copy selected data to clipboard.""" QtWidgets.QApplication.clipboard().setText(self.serialize(useSelection=True)) def copyAll(self): """Copy all data to clipboard.""" QtWidgets.QApplication.clipboard().setText(self.serialize(useSelection=False)) def saveSel(self): """Save selected data to file.""" self.save(self.serialize(useSelection=True)) def saveAll(self): """Save all data to file.""" self.save(self.serialize(useSelection=False)) def save(self, data): fileName, _ = QtWidgets.QFileDialog.getSaveFileName( self, f"{translate('TableWidget', 'Save As')}...", "", f"{translate('TableWidget', 'Tab-separated values')} (*.tsv)" ) if not fileName: return with open(fileName, 'w') as fd: fd.write(data) def contextMenuEvent(self, ev): self.contextMenu.popup(ev.globalPos()) def keyPressEvent(self, ev): if ev.matches(QtGui.QKeySequence.StandardKey.Copy): ev.accept() self.copySel() else: super().keyPressEvent(ev) def handleItemChanged(self, item): item.itemChanged() class TableWidgetItem(QtWidgets.QTableWidgetItem): def __init__(self, val, index, format=None): QtWidgets.QTableWidgetItem.__init__(self, '') self._blockValueChange = False self._format = None self._defaultFormat = '%0.3g' self.sortMode = 'value' self.index = index flags = QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled self.setFlags(flags) self.setValue(val) self.setFormat(format) def setEditable(self, editable): """ Set whether this item is user-editable. """ if editable: self.setFlags(self.flags() | QtCore.Qt.ItemFlag.ItemIsEditable) else: self.setFlags(self.flags() & ~QtCore.Qt.ItemFlag.ItemIsEditable) def setSortMode(self, mode): """ Set the mode used to sort this item against others in its column. ============== ======================================================== **Sort Modes** value Compares item.value if available; falls back to text comparison. text Compares item.text() index Compares by the order in which items were inserted. ============== ======================================================== """ modes = ('value', 'text', 'index', None) if mode not in modes: raise ValueError('Sort mode must be one of %s' % str(modes)) self.sortMode = mode def setFormat(self, fmt): """Define the conversion from item value to displayed text. If a string is specified, it is used as a format string for converting float values (and all other types are converted using str). If a function is specified, it will be called with the item as its only argument and must return a string. Added in version 0.9.9. """ if fmt is not None and not isinstance(fmt, str) and not callable(fmt): raise ValueError("Format argument must string, callable, or None. (got %s)" % fmt) self._format = fmt self._updateText() def _updateText(self): self._blockValueChange = True try: self._text = self.format() self.setText(self._text) finally: self._blockValueChange = False def setValue(self, value): self.value = value self._updateText() def itemChanged(self): """Called when the data of this item has changed.""" if self.text() != self._text: self.textChanged() def textChanged(self): """Called when this item's text has changed for any reason.""" self._text = self.text() if self._blockValueChange: # text change was result of value or format change; do not # propagate. return try: self.value = type(self.value)(self.text()) except ValueError: self.value = str(self.text()) def format(self): if callable(self._format): return self._format(self) if isinstance(self.value, (float, np.floating)): if self._format is None: return self._defaultFormat % self.value else: return self._format % self.value else: return str(self.value) def __lt__(self, other): if self.sortMode == 'index' and hasattr(other, 'index'): return self.index < other.index if self.sortMode == 'value' and hasattr(other, 'value'): return self.value < other.value else: return self.text() < other.text() pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/TreeWidget.py000066400000000000000000000343261457240071200237470ustar00rootroot00000000000000from ..Qt import QtCore, QtWidgets __all__ = ['TreeWidget', 'TreeWidgetItem'] class TreeWidget(QtWidgets.QTreeWidget): """Extends QTreeWidget to allow internal drag/drop with widgets in the tree. Also maintains the expanded state of subtrees as they are moved. This class demonstrates the absurd lengths one must go to to make drag/drop work.""" sigItemMoved = QtCore.Signal(object, object, object) # (item, parent, index) sigItemCheckStateChanged = QtCore.Signal(object, object) sigItemTextChanged = QtCore.Signal(object, object) sigColumnCountChanged = QtCore.Signal(object, object) # self, count def __init__(self, parent=None): QtWidgets.QTreeWidget.__init__(self, parent) # wrap this item so that we can propagate tree change information # to children. self._invRootItem = InvisibleRootItem(QtWidgets.QTreeWidget.invisibleRootItem(self)) self.setAcceptDrops(True) self.setDragEnabled(True) self.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.EditKeyPressed|QtWidgets.QAbstractItemView.EditTrigger.SelectedClicked) self.placeholders = [] self.childNestingLimit = None self.itemClicked.connect(self._itemClicked) def setItemWidget(self, item, col, wid): """ Overrides QTreeWidget.setItemWidget such that widgets are added inside an invisible wrapper widget. This makes it possible to move the item in and out of the tree without its widgets being automatically deleted. """ w = QtWidgets.QWidget() ## foster parent / surrogate child widget l = QtWidgets.QVBoxLayout() l.setContentsMargins(0,0,0,0) w.setLayout(l) w.setSizePolicy(wid.sizePolicy()) w.setMinimumHeight(wid.minimumHeight()) w.setMinimumWidth(wid.minimumWidth()) l.addWidget(wid) w.realChild = wid self.placeholders.append(w) QtWidgets.QTreeWidget.setItemWidget(self, item, col, w) def itemWidget(self, item, col): w = QtWidgets.QTreeWidget.itemWidget(self, item, col) if w is not None and hasattr(w, 'realChild'): w = w.realChild return w def dropMimeData(self, parent, index, data, action): item = self.currentItem() p = parent #print "drop", item, "->", parent, index while True: if p is None: break if p is item: return False #raise Exception("Can not move item into itself.") p = p.parent() if not self.itemMoving(item, parent, index): return False currentParent = item.parent() if currentParent is None: currentParent = self.invisibleRootItem() if parent is None: parent = self.invisibleRootItem() if currentParent is parent and index > parent.indexOfChild(item): index -= 1 self.prepareMove(item) currentParent.removeChild(item) #print " insert child to index", index parent.insertChild(index, item) ## index will not be correct self.setCurrentItem(item) self.recoverMove(item) #self.emit(QtCore.SIGNAL('itemMoved'), item, parent, index) self.sigItemMoved.emit(item, parent, index) return True def itemMoving(self, item, parent, index): """Called when item has been dropped elsewhere in the tree. Return True to accept the move, False to reject.""" return True def prepareMove(self, item): item.__widgets = [] item.__expanded = item.isExpanded() for i in range(self.columnCount()): w = self.itemWidget(item, i) item.__widgets.append(w) if w is None: continue w.setParent(None) for i in range(item.childCount()): self.prepareMove(item.child(i)) def recoverMove(self, item): for i in range(self.columnCount()): w = item.__widgets[i] if w is None: continue self.setItemWidget(item, i, w) for i in range(item.childCount()): self.recoverMove(item.child(i)) item.setExpanded(False) ## Items do not re-expand correctly unless they are collapsed first. QtWidgets.QApplication.instance().processEvents() item.setExpanded(item.__expanded) def collapseTree(self, item): item.setExpanded(False) for i in range(item.childCount()): self.collapseTree(item.child(i)) def removeTopLevelItem(self, item): for i in range(self.topLevelItemCount()): if self.topLevelItem(i) is item: self.takeTopLevelItem(i) return raise Exception("Item '%s' not in top-level items." % str(item)) def listAllItems(self, item=None): items = [] if item is not None: items.append(item) else: item = self.invisibleRootItem() for cindex in range(item.childCount()): foundItems = self.listAllItems(item=item.child(cindex)) for f in foundItems: items.append(f) return items def dropEvent(self, ev): super().dropEvent(ev) self.updateDropFlags() def updateDropFlags(self): ### intended to put a limit on how deep nests of children can go. ### self.childNestingLimit is upheld when moving items without children, but if the item being moved has children/grandchildren, the children/grandchildren ### can end up over the childNestingLimit. if self.childNestingLimit is None: pass # enable drops in all items (but only if there are drops that aren't enabled? for performance...) else: items = self.listAllItems() for item in items: parentCount = 0 p = item.parent() while p is not None: parentCount += 1 p = p.parent() if parentCount >= self.childNestingLimit: item.setFlags(item.flags() & (~QtCore.Qt.ItemFlag.ItemIsDropEnabled)) else: item.setFlags(item.flags() | QtCore.Qt.ItemFlag.ItemIsDropEnabled) @staticmethod def informTreeWidgetChange(item): if hasattr(item, 'treeWidgetChanged'): item.treeWidgetChanged() for i in range(item.childCount()): TreeWidget.informTreeWidgetChange(item.child(i)) def addTopLevelItem(self, item): QtWidgets.QTreeWidget.addTopLevelItem(self, item) self.informTreeWidgetChange(item) def addTopLevelItems(self, items): QtWidgets.QTreeWidget.addTopLevelItems(self, items) for item in items: self.informTreeWidgetChange(item) def insertTopLevelItem(self, index, item): QtWidgets.QTreeWidget.insertTopLevelItem(self, index, item) self.informTreeWidgetChange(item) def insertTopLevelItems(self, index, items): QtWidgets.QTreeWidget.insertTopLevelItems(self, index, items) for item in items: self.informTreeWidgetChange(item) def takeTopLevelItem(self, index): item = self.topLevelItem(index) if item is not None: self.prepareMove(item) item = QtWidgets.QTreeWidget.takeTopLevelItem(self, index) self.prepareMove(item) self.informTreeWidgetChange(item) return item def topLevelItems(self): return [self.topLevelItem(i) for i in range(self.topLevelItemCount())] def clear(self): items = self.topLevelItems() for item in items: self.prepareMove(item) QtWidgets.QTreeWidget.clear(self) ## Why do we want to do this? It causes RuntimeErrors. #for item in items: #self.informTreeWidgetChange(item) def invisibleRootItem(self): return self._invRootItem def itemFromIndex(self, index): """Return the item and column corresponding to a QModelIndex. """ col = index.column() rows = [] while index.row() >= 0: rows.insert(0, index.row()) index = index.parent() item = self.topLevelItem(rows[0]) for row in rows[1:]: item = item.child(row) return item, col def setColumnCount(self, c): QtWidgets.QTreeWidget.setColumnCount(self, c) self.sigColumnCountChanged.emit(self, c) def _itemClicked(self, item, col): if hasattr(item, 'itemClicked'): item.itemClicked(col) class TreeWidgetItem(QtWidgets.QTreeWidgetItem): """ TreeWidgetItem that keeps track of its own widgets and expansion state. * Widgets may be added to columns before the item is added to a tree. * Expanded state may be set before item is added to a tree. * Adds setCheked and isChecked methods. * Adds addChildren, insertChildren, and takeChildren methods. """ def __init__(self, *args): QtWidgets.QTreeWidgetItem.__init__(self, *args) self._widgets = {} # col: widget self._tree = None self._expanded = False def setChecked(self, column, checked): self.setCheckState(column, QtCore.Qt.CheckState.Checked if checked else QtCore.Qt.CheckState.Unchecked) def isChecked(self, col): return self.checkState(col) == QtCore.Qt.CheckState.Checked def setExpanded(self, exp): self._expanded = exp QtWidgets.QTreeWidgetItem.setExpanded(self, exp) def isExpanded(self): return self._expanded def setWidget(self, column, widget): if column in self._widgets: self.removeWidget(column) self._widgets[column] = widget tree = self.treeWidget() if tree is None: return else: tree.setItemWidget(self, column, widget) def removeWidget(self, column): del self._widgets[column] tree = self.treeWidget() if tree is None: return tree.removeItemWidget(self, column) def treeWidgetChanged(self): tree = self.treeWidget() if self._tree is tree: return self._tree = self.treeWidget() if tree is None: return for col, widget in self._widgets.items(): tree.setItemWidget(self, col, widget) QtWidgets.QTreeWidgetItem.setExpanded(self, self._expanded) def childItems(self): return [self.child(i) for i in range(self.childCount())] def addChild(self, child): QtWidgets.QTreeWidgetItem.addChild(self, child) TreeWidget.informTreeWidgetChange(child) def addChildren(self, childs): QtWidgets.QTreeWidgetItem.addChildren(self, childs) for child in childs: TreeWidget.informTreeWidgetChange(child) def insertChild(self, index, child): QtWidgets.QTreeWidgetItem.insertChild(self, index, child) TreeWidget.informTreeWidgetChange(child) def insertChildren(self, index, childs): QtWidgets.QTreeWidgetItem.addChildren(self, index, childs) for child in childs: TreeWidget.informTreeWidgetChange(child) def removeChild(self, child): QtWidgets.QTreeWidgetItem.removeChild(self, child) TreeWidget.informTreeWidgetChange(child) def takeChild(self, index): child = QtWidgets.QTreeWidgetItem.takeChild(self, index) TreeWidget.informTreeWidgetChange(child) return child def takeChildren(self): childs = QtWidgets.QTreeWidgetItem.takeChildren(self) for child in childs: TreeWidget.informTreeWidgetChange(child) return childs def setData(self, column, role, value): # credit: ekhumoro # http://stackoverflow.com/questions/13662020/how-to-implement-itemchecked-and-itemunchecked-signals-for-qtreewidget-in-pyqt4 checkstate = self.checkState(column) text = self.text(column) QtWidgets.QTreeWidgetItem.setData(self, column, role, value) treewidget = self.treeWidget() if treewidget is None: return if (role == QtCore.Qt.ItemDataRole.CheckStateRole and checkstate != self.checkState(column)): treewidget.sigItemCheckStateChanged.emit(self, column) elif (role in (QtCore.Qt.ItemDataRole.DisplayRole, QtCore.Qt.ItemDataRole.EditRole) and text != self.text(column)): treewidget.sigItemTextChanged.emit(self, column) def itemClicked(self, col): """Called when this item is clicked on. Override this method to react to user clicks. """ class InvisibleRootItem(object): """Wrapper around a TreeWidget's invisible root item that calls TreeWidget.informTreeWidgetChange when child items are added/removed. """ def __init__(self, item): self._real_item = item def addChild(self, child): self._real_item.addChild(child) TreeWidget.informTreeWidgetChange(child) def addChildren(self, childs): self._real_item.addChildren(childs) for child in childs: TreeWidget.informTreeWidgetChange(child) def insertChild(self, index, child): self._real_item.insertChild(index, child) TreeWidget.informTreeWidgetChange(child) def insertChildren(self, index, childs): self._real_item.addChildren(index, childs) for child in childs: TreeWidget.informTreeWidgetChange(child) def removeChild(self, child): self._real_item.removeChild(child) TreeWidget.informTreeWidgetChange(child) def takeChild(self, index): child = self._real_item.takeChild(index) TreeWidget.informTreeWidgetChange(child) return child def takeChildren(self): childs = self._real_item.takeChildren() for child in childs: TreeWidget.informTreeWidgetChange(child) return childs def __getattr__(self, attr): return getattr(self._real_item, attr) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/ValueLabel.py000066400000000000000000000055021457240071200237120ustar00rootroot00000000000000from time import perf_counter from .. import functions as fn from ..Qt import QtWidgets __all__ = ['ValueLabel'] class ValueLabel(QtWidgets.QLabel): """ QLabel specifically for displaying numerical values. Extends QLabel adding some extra functionality: - displaying units with si prefix - built-in exponential averaging """ def __init__(self, parent=None, suffix='', siPrefix=False, averageTime=0, formatStr=None): """ ============== ================================================================================== **Arguments:** suffix (str or None) The suffix to place after the value siPrefix (bool) Whether to add an SI prefix to the units and display a scaled value averageTime (float) The length of time in seconds to average values. If this value is 0, then no averaging is performed. As this value increases the display value will appear to change more slowly and smoothly. formatStr (str) Optionally, provide a format string to use when displaying text. The text will be generated by calling formatStr.format(value=, avgValue=, suffix=) (see Python documentation on str.format) This option is not compatible with siPrefix ============== ================================================================================== """ QtWidgets.QLabel.__init__(self, parent) self.values = [] self.averageTime = averageTime ## no averaging by default self.suffix = suffix self.siPrefix = siPrefix if formatStr is None: formatStr = '{avgValue:0.2g} {suffix}' self.formatStr = formatStr def setValue(self, value): now = perf_counter() self.values.append((now, value)) cutoff = now - self.averageTime while len(self.values) > 0 and self.values[0][0] < cutoff: self.values.pop(0) self.update() def setFormatStr(self, text): self.formatStr = text self.update() def setAverageTime(self, t): self.averageTime = t def averageValue(self): return sum(v[1] for v in self.values) / float(len(self.values)) def paintEvent(self, ev): self.setText(self.generateText()) return super().paintEvent(ev) def generateText(self): if len(self.values) == 0: return '' avg = self.averageValue() val = self.values[-1][1] if self.siPrefix: return fn.siFormat(avg, suffix=self.suffix) else: return self.formatStr.format(value=val, avgValue=avg, suffix=self.suffix) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/VerticalLabel.py000066400000000000000000000057011457240071200244100ustar00rootroot00000000000000import warnings from ..Qt import QtCore, QtGui, QtWidgets __all__ = ['VerticalLabel'] #class VerticalLabel(QtWidgets.QLabel): #def paintEvent(self, ev): #p = QtGui.QPainter(self) #p.rotate(-90) #self.hint = p.drawText(QtCore.QRect(-self.height(), 0, self.height(), self.width()), QtCore.Qt.AlignmentFlag.AlignLeft|QtCore.Qt.AlignmentFlag.AlignVCenter, self.text()) #p.end() #self.setMinimumWidth(self.hint.height()) #self.setMinimumHeight(self.hint.width()) #def sizeHint(self): #if hasattr(self, 'hint'): #return QtCore.QSize(self.hint.height(), self.hint.width()) #else: #return QtCore.QSize(16, 50) class VerticalLabel(QtWidgets.QLabel): def __init__(self, text, orientation='vertical', forceWidth=True): QtWidgets.QLabel.__init__(self, text) self.forceWidth = forceWidth self.orientation = None self.setOrientation(orientation) def setOrientation(self, o): if self.orientation == o: return self.orientation = o self.update() self.updateGeometry() def paintEvent(self, ev): p = QtGui.QPainter(self) #p.setBrush(QtGui.QBrush(QtGui.QColor(100, 100, 200))) #p.setPen(QtGui.QPen(QtGui.QColor(50, 50, 100))) #p.drawRect(self.rect().adjusted(0, 0, -1, -1)) #p.setPen(QtGui.QPen(QtGui.QColor(255, 255, 255))) if self.orientation == 'vertical': p.rotate(-90) rgn = QtCore.QRect(-self.height(), 0, self.height(), self.width()) else: rgn = self.contentsRect() align = self.alignment() #align = QtCore.Qt.AlignmentFlag.AlignTop|QtCore.Qt.AlignmentFlag.AlignHCenter with warnings.catch_warnings(): warnings.simplefilter("ignore") self.hint = p.drawText(rgn, align, self.text()) p.end() if self.orientation == 'vertical': self.setMaximumWidth(self.hint.height()) self.setMinimumWidth(0) self.setMaximumHeight(16777215) if self.forceWidth: self.setMinimumHeight(self.hint.width()) else: self.setMinimumHeight(0) else: self.setMaximumHeight(self.hint.height()) self.setMinimumHeight(0) self.setMaximumWidth(16777215) if self.forceWidth: self.setMinimumWidth(self.hint.width()) else: self.setMinimumWidth(0) def sizeHint(self): if self.orientation == 'vertical': if hasattr(self, 'hint'): return QtCore.QSize(self.hint.height(), self.hint.width()) else: return QtCore.QSize(19, 50) else: if hasattr(self, 'hint'): return QtCore.QSize(self.hint.width(), self.hint.height()) else: return QtCore.QSize(50, 19) pyqtgraph-pyqtgraph-0.13.4/pyqtgraph/widgets/__init__.py000066400000000000000000000000001457240071200234210ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/pytest.ini000066400000000000000000000025101457240071200176640ustar00rootroot00000000000000[pytest] xvfb_width = 1920 xvfb_height = 1080 # use this due to some issues with ndarray reshape errors on CI systems xvfb_colordepth = 24 xvfb_args=-ac +extension GLX +render faulthandler_timeout = 60 filterwarnings = error # re-enable standard library warnings once::DeprecationWarning once::PendingDeprecationWarning # comfortable skipping these warnings runtime warnings # https://stackoverflow.com/questions/40845304/runtimewarning-numpy-dtype-size-changed-may-indicate-binary-incompatibility ignore:numpy.ufunc size changed, may indicate binary incompatibility.*:RuntimeWarning # pyside2_512 specific issue ignore:This method will be removed in future versions. Use 'tree.iter\(\)' or 'list\(tree.iter\(\)\)' instead.:PendingDeprecationWarning # pyqtgraph specific warning we want to ignore during testing ignore:Visible window deleted. To prevent this, store a reference to the window object. # xvfb warnings on non-linux systems ignore:Unknown config option:pytest.PytestConfigWarning # pyreadline windows warning ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working:DeprecationWarning:pyreadline:8 # conda pyside2 bindings ignore:an integer is required \(got type PySide2. pyqtgraph-pyqtgraph-0.13.4/setup.py000066400000000000000000000112601457240071200173470ustar00rootroot00000000000000DESCRIPTION = """\ PyQtGraph is a pure-python graphics and GUI library built on PyQt5/PySide2 and numpy. It is intended for use in mathematics / scientific / engineering applications. Despite being written entirely in python, the library is very fast due to its heavy leverage of numpy for number crunching, Qt's GraphicsView framework for 2D display, and OpenGL for 3D display. """ setupOpts = dict( name='pyqtgraph', description='Scientific Graphics and GUI Library for Python', long_description=DESCRIPTION, license = 'MIT', url='http://www.pyqtgraph.org', project_urls={ 'Documentation': 'https://pyqtgraph.readthedocs.io', 'Source': 'https://github.com/pyqtgraph/pyqtgraph', }, author='Luke Campagnola', author_email='luke.campagnola@gmail.com', classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Development Status :: 4 - Beta", "Environment :: Other Environment", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Scientific/Engineering :: Visualization", "Topic :: Software Development :: User Interfaces", ], ) import distutils.dir_util import os import re import sys from distutils.command import build from setuptools import find_namespace_packages, setup from setuptools.command import install path = os.path.split(__file__)[0] sys.path.append(path) import tools.setupHelpers as helpers ## Decide what version string to use in the build version, forcedVersion, gitVersion, initVersion = helpers.getVersionStrings(pkg='pyqtgraph') class Build(build.build): """ * Clear build path before building """ def run(self): global path ## Make sure build directory is clean buildPath = os.path.join(path, self.build_lib) if os.path.isdir(buildPath): distutils.dir_util.remove_tree(buildPath) build.build.run(self) class Install(install.install): """ * Check for previously-installed version before installing * Set version string in __init__ after building. This helps to ensure that we know when an installation came from a non-release code base. """ def run(self): global path, version, initVersion, forcedVersion, installVersion name = self.config_vars['dist_name'] path = os.path.join(self.install_libbase, 'pyqtgraph') if os.path.exists(path): raise Exception("It appears another version of %s is already " "installed at %s; remove this before installing." % (name, path)) print("Installing to %s" % path) rval = install.install.run(self) # If the version in __init__ is different from the automatically-generated # version string, then we will update __init__ in the install directory if initVersion == version: return rval try: initfile = os.path.join(path, '__init__.py') with open(initfile, "r") as file_: data = file_.read() with open(initfile, "w") as file_: file_.write(re.sub(r"__version__ = .*", "__version__ = '%s'" % version, data)) installVersion = version except: sys.stderr.write("Warning: Error occurred while setting version string in build path. " "Installation will use the original version string " "%s instead.\n" % (initVersion) ) if forcedVersion: raise installVersion = initVersion sys.excepthook(*sys.exc_info()) return rval setup( version=version, cmdclass={ 'build': Build, 'install': Install, 'deb': helpers.DebCommand, 'test': helpers.TestCommand, 'debug': helpers.DebugCommand, 'mergetest': helpers.MergeTestCommand, 'asv_config': helpers.ASVConfigCommand, 'style': helpers.StyleCommand }, packages=find_namespace_packages(include=['pyqtgraph', 'pyqtgraph.*']), python_requires=">=3.9", package_dir={"pyqtgraph": "pyqtgraph"}, package_data={ 'pyqtgraph.examples': ['optics/*.gz', 'relativity/presets/*.cfg'], "pyqtgraph.icons": ["*.svg", "*.png"], "pyqtgraph": [ "colors/maps/*.csv", "colors/maps/*.txt", "colors/maps/*.hex", ], }, install_requires = [ 'numpy>=1.22.0', ], **setupOpts ) pyqtgraph-pyqtgraph-0.13.4/test.py000066400000000000000000000007101457240071200171640ustar00rootroot00000000000000""" Script for invoking pytest with options to select Qt library """ import sys import pytest args = sys.argv[1:] if '--pyqt5' in args: args.remove('--pyqt5') import PyQt5 elif '--pyside2' in args: args.remove('--pyside2') import PySide2 elif '--pyside6' in args: args.remove('--pyside6') import PySide6 elif '--pyqt6' in args: args.remove('--pyqt6') import PyQt6 import pyqtgraph as pg pg.systemInfo() pytest.main(args) pyqtgraph-pyqtgraph-0.13.4/tests/000077500000000000000000000000001457240071200167775ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/__init__.py000066400000000000000000000003021457240071200211030ustar00rootroot00000000000000from .image_testing import TransposedImageItem, assertImageApproved from .ui_testing import ( mouseClick, mouseDrag, mouseMove, mousePress, mouseRelease, resizeWindow, ) pyqtgraph-pyqtgraph-0.13.4/tests/conftest.py000066400000000000000000000003231457240071200211740ustar00rootroot00000000000000import os import sys import pytest @pytest.fixture def tmp_module(tmp_path): module_path = os.fsdecode(tmp_path) sys.path.insert(0, module_path) yield module_path sys.path.remove(module_path) pyqtgraph-pyqtgraph-0.13.4/tests/dockarea/000077500000000000000000000000001457240071200205505ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/dockarea/test_dock.py000066400000000000000000000013701457240071200231020ustar00rootroot00000000000000import pytest import pyqtgraph as pg pg.mkQApp() import pyqtgraph.dockarea as da def test_dock(): name = "évènts_zàhéér" dock = da.Dock(name=name) # make sure unicode names work correctly assert dock.name() == name # no surprises in return type. assert type(dock.name()) == type(name) def test_closable_dock(): name = "Test close dock" dock = da.Dock(name=name, closable=True) assert dock.label.closeButton is not None def test_hide_title_dock(): name = "Test hide title dock" dock = da.Dock(name=name, hideTitle=True) assert dock.labelHidden == True def test_close(): name = "Test close dock" dock = da.Dock(name=name, hideTitle=True) with pytest.warns(Warning): dock.close() pyqtgraph-pyqtgraph-0.13.4/tests/dockarea/test_dockarea.py000066400000000000000000000141061457240071200237340ustar00rootroot00000000000000import pytest import pyqtgraph as pg import pyqtgraph.dockarea as da pg.mkQApp() def test_dockarea(): a = da.DockArea() d1 = da.Dock("dock 1") a.addDock(d1, 'left') assert a.topContainer is d1.container() assert d1.container().container() is a assert d1.area is a assert a.topContainer.widget(0) is d1 d2 = da.Dock("dock 2") a.addDock(d2, 'right') assert a.topContainer is d1.container() assert a.topContainer is d2.container() assert d1.container().container() is a assert d2.container().container() is a assert d2.area is a assert a.topContainer.widget(0) is d1 assert a.topContainer.widget(1) is d2 d3 = da.Dock("dock 3") a.addDock(d3, 'bottom') assert a.topContainer is d3.container() assert d2.container().container() is d3.container() assert d1.container().container() is d3.container() assert d1.container().container().container() is a assert d2.container().container().container() is a assert d3.container().container() is a assert d3.area is a assert d2.area is a assert a.topContainer.widget(0) is d1.container() assert a.topContainer.widget(1) is d3 d4 = da.Dock("dock 4") a.addDock(d4, 'below', d3) assert d4.container().type() == 'tab' assert d4.container() is d3.container() assert d3.container().container() is d2.container().container() assert d4.area is a a.printState() # layout now looks like: # vcontainer # hcontainer # dock 1 # dock 2 # tcontainer # dock 3 # dock 4 # test save/restore state state = a.saveState() a2 = da.DockArea() # default behavior is to raise exception if docks are missing with pytest.raises(Exception): a2.restoreState(state) # test restore with ignore missing a2.restoreState(state, missing='ignore') assert a2.topContainer is None # test restore with auto-create a2.restoreState(state, missing='create') assert a2.saveState() == state a2.printState() # double-check that state actually matches the output of saveState() c1 = a2.topContainer assert c1.type() == 'vertical' c2 = c1.widget(0) c3 = c1.widget(1) assert c2.type() == 'horizontal' assert c2.widget(0).name() == 'dock 1' assert c2.widget(1).name() == 'dock 2' assert c3.type() == 'tab' assert c3.widget(0).name() == 'dock 3' assert c3.widget(1).name() == 'dock 4' # test restore with docks already present a3 = da.DockArea() a3docks = [] for i in range(1, 5): dock = da.Dock('dock %d' % i) a3docks.append(dock) a3.addDock(dock, 'right') a3.restoreState(state) assert a3.saveState() == state # test restore with extra docks present a3 = da.DockArea() a3docks = [] for i in [1, 2, 5, 4, 3]: dock = da.Dock('dock %d' % i) a3docks.append(dock) a3.addDock(dock, 'left') a3.restoreState(state) a3.printState() # test a more complex restore a4 = da.DockArea() state1 = {'float': [], 'main': ('horizontal', [ ('vertical', [ ('horizontal', [ ('tab', [ ('dock', 'dock1', {}), ('dock', 'dock2', {}), ('dock', 'dock3', {}), ('dock', 'dock4', {}) ], {'index': 1}), ('vertical', [ ('dock', 'dock5', {}), ('horizontal', [ ('dock', 'dock6', {}), ('dock', 'dock7', {}) ], {'sizes': [184, 363]}) ], {'sizes': [355, 120]}) ], {'sizes': [9, 552]}) ], {'sizes': [480]}), ('dock', 'dock8', {}) ], {'sizes': [566, 69]}) } state2 = {'float': [], 'main': ('horizontal', [ ('vertical', [ ('horizontal', [ ('dock', 'dock2', {}), ('vertical', [ ('dock', 'dock5', {}), ('horizontal', [ ('dock', 'dock6', {}), ('dock', 'dock7', {}) ], {'sizes': [492, 485]}) ], {'sizes': [936, 0]}) ], {'sizes': [172, 982]}) ], {'sizes': [941]}), ('vertical', [ ('dock', 'dock8', {}), ('dock', 'dock4', {}), ('dock', 'dock1', {}) ], {'sizes': [681, 225, 25]}) ], {'sizes': [1159, 116]})} a4.restoreState(state1, missing='create') # dock3 not mentioned in restored state; stays in dockarea by default c, d = a4.findAll() assert d['dock3'].area is a4 a4.restoreState(state2, missing='ignore', extra='float') a4.printState() c, d = a4.findAll() # dock3 not mentioned in restored state; goes to float due to `extra` argument assert d['dock3'].area is not a4 assert d['dock1'].container() is d['dock4'].container() is d['dock8'].container() assert d['dock6'].container() is d['dock7'].container() assert a4 is d['dock2'].area is d['dock2'].container().container().container() assert a4 is d['dock5'].area is d['dock5'].container().container().container().container() # States should be the same with two exceptions: # dock3 is in a float because it does not appear in state2 # a superfluous vertical splitter in state2 has been removed state4 = a4.saveState() state4['main'][1][0] = state4['main'][1][0][1][0] with pytest.raises(AssertionError): # this test doesn't work, likely due to clean_state not working as intended assert clean_state(state4['main']) == clean_state(state2['main']) def clean_state(state): # return state dict with sizes removed ch = [clean_state(x) for x in state[1]] if isinstance(state[1], list) else state[1] state = (state[0], ch, {}) return state pyqtgraph-pyqtgraph-0.13.4/tests/exporters/000077500000000000000000000000001457240071200210325ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/exporters/__init__.py000066400000000000000000000000001457240071200231310ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/exporters/test_csv.py000066400000000000000000000054331457240071200232430ustar00rootroot00000000000000""" CSV export test """ import csv import tempfile import numpy as np import pytest import pyqtgraph as pg app = pg.mkQApp() def approxeq(a, b): return (a-b) <= ((a + b) * 1e-6) def test_CSVExporter(): plt = pg.PlotWidget() plt.show() y1 = [1,3,2,3,1,6,9,8,4,2] plt.plot(y=y1, name='myPlot') y2 = [3,4,6,1,2,4,2,3,5,3,5,1,3] x2 = np.linspace(0, 1.0, len(y2)) plt.plot(x=x2, y=y2) y3 = [1,5,2,3,4,6,1,2,4,2,3,5,3] x3 = np.linspace(0, 1.0, len(y3)+1) plt.plot(x=x3, y=y3, stepMode="center") for log_mapping in (False, True): if log_mapping: print('testing original data export in log mapped mode') else: print('testing data export in unmapped mode') plt.setLogMode(x=log_mapping, y=log_mapping) ex = pg.exporters.CSVExporter(plt.plotItem) with tempfile.NamedTemporaryFile(mode="w+t", suffix='.csv', encoding="utf-8", delete=False) as tf: print(" using %s as a temporary file" % tf.name) ex.export(fileName=tf.name) lines = [line for line in csv.reader(tf)] header = lines.pop(0) assert header == ['myPlot_x', 'myPlot_y', 'x0001', 'y0001', 'x0002', 'y0002'] for i, vals in enumerate(lines): vals = list(map(str.strip, vals)) assert (i >= len(y1) and vals[0] == '') or approxeq(float(vals[0]), i) assert (i >= len(y1) and vals[1] == '') or approxeq(float(vals[1]), y1[i]) assert (i >= len(x2) and vals[2] == '') or approxeq(float(vals[2]), x2[i]) assert (i >= len(y2) and vals[3] == '') or approxeq(float(vals[3]), y2[i]) assert (i >= len(x3) and vals[4] == '') or approxeq(float(vals[4]), x3[i]) assert (i >= len(y3) and vals[5] == '') or approxeq(float(vals[5]), y3[i]) def test_CSVExporter_with_ErrorBarItem(): plt = pg.PlotWidget() plt.show() x=np.arange(5) y=np.array([1, 2, 3, 2, 1]) top_error = np.array([2, 3, 3, 3, 2]) bottom_error = np.array([-2.5, -2.5, -2.5, -2.5, -1.5]) err = pg.ErrorBarItem( x=x, y=y, top=top_error, bottom=bottom_error ) plt.addItem(err) ex = pg.exporters.CSVExporter(plt.plotItem) with tempfile.NamedTemporaryFile(mode="w+t", suffix='.csv', encoding="utf-8", delete=False) as tf: ex.export(fileName=tf.name) lines = [line for line in csv.reader(tf)] header = lines.pop(0) assert header == ['x0000_error', 'y0000_error', 'y_min_error_0000', 'y_max_error_0000'] for i, values in enumerate(lines): assert pytest.approx(float(values[0])) == x[i] assert pytest.approx(float(values[1])) == y[i] assert pytest.approx(float(values[2])) == bottom_error[i] assert pytest.approx(float(values[3])) == top_error[i] pyqtgraph-pyqtgraph-0.13.4/tests/exporters/test_exporter_dialog.py000066400000000000000000000012461457240071200256350ustar00rootroot00000000000000import pyqtgraph as pg from tests.ui_testing import mouseClick app = pg.mkQApp() def test_export_dialog(): plt = pg.PlotWidget() y1 = [1,3,2,3,1,6,9,8,4,2] plt.plot(y=y1) plt.show() # # export dialog doesn't exist assert plt.scene().exportDialog is None mouseClick( plt, pos=pg.Qt.QtCore.QPointF(plt.mapFromGlobal(plt.geometry().center())), button=pg.Qt.QtCore.Qt.MouseButton.RightButton ) plt.scene().contextMenu[0].trigger() # show show dialog plt.scene().showExportDialog() assert plt.scene().exportDialog.isVisible() plt.scene().exportDialog.close() app.processEvents() plt.close() pyqtgraph-pyqtgraph-0.13.4/tests/exporters/test_hdf5.py000066400000000000000000000040531457240071200232730ustar00rootroot00000000000000import numpy as np import pytest from numpy.testing import assert_equal import pyqtgraph as pg from pyqtgraph.exporters import HDF5Exporter h5py = pytest.importorskip("h5py") @pytest.fixture def tmp_h5(tmp_path): yield tmp_path / "data.h5" @pytest.mark.parametrize("combine", [False, True]) def test_HDF5Exporter(tmp_h5, combine): # Basic test of functionality: multiple curves with shared x array. Tests # both options for stacking the data (columnMode). x = np.linspace(0, 1, 100) y1 = np.sin(x) y2 = np.cos(x) plt = pg.PlotWidget() plt.show() plt.plot(x=x, y=y1) plt.plot(x=x, y=y2) ex = HDF5Exporter(plt.plotItem) if combine: ex.parameters()['columnMode'] = '(x,y,y,y) for all plots' ex.export(fileName=tmp_h5) with h5py.File(tmp_h5, 'r') as f: # should be a single dataset with the name of the exporter dset = f[ex.parameters()['Name']] assert isinstance(dset, h5py.Dataset) if combine: assert_equal(np.array([x, y1, y2]), dset) else: assert_equal(np.array([x, y1, x, y2]), dset) def test_HDF5Exporter_unequal_lengths(tmp_h5): # Test export with multiple curves of different size. The exporter should # detect this and create multiple hdf5 datasets under a group. x1 = np.linspace(0, 1, 10) y1 = np.sin(x1) x2 = np.linspace(0, 1, 100) y2 = np.cos(x2) plt = pg.PlotWidget() plt.show() plt.plot(x=x1, y=y1, name='plot0') plt.plot(x=x2, y=y2) ex = HDF5Exporter(plt.plotItem) ex.export(fileName=tmp_h5) with h5py.File(tmp_h5, 'r') as f: # should be a group with the name of the exporter group = f[ex.parameters()['Name']] assert isinstance(group, h5py.Group) # should be a dataset under the group with the name of the PlotItem assert_equal(np.array([x1, y1]), group['plot0']) # should be a dataset under the group with a default name that's the # index of the curve in the PlotItem assert_equal(np.array([x2, y2]), group['1']) pyqtgraph-pyqtgraph-0.13.4/tests/exporters/test_image.py000066400000000000000000000014771457240071200235360ustar00rootroot00000000000000import numpy as np import pyqtgraph as pg import pyqtgraph.functions as fn from pyqtgraph.exporters import ImageExporter from pyqtgraph.Qt import QtGui app = pg.mkQApp() def test_ImageExporter_filename_dialog(): """Tests ImageExporter code path that opens a file dialog. Regression test for pull request 1133.""" p = pg.PlotWidget() p.show() exp = ImageExporter(p.getPlotItem()) exp.export() def test_ImageExporter_toBytes(): p = pg.PlotWidget() p.show() p.hideAxis('bottom') p.hideAxis('left') exp = ImageExporter(p.getPlotItem()) qimg = exp.export(toBytes=True) qimg = qimg.convertToFormat(QtGui.QImage.Format.Format_RGBA8888) data = fn.ndarray_from_qimage(qimg) black = (0, 0, 0, 255) assert np.all(data == black), "Exported image should be entirely black." pyqtgraph-pyqtgraph-0.13.4/tests/exporters/test_matplotlib.py000066400000000000000000000043061457240071200246150ustar00rootroot00000000000000from importlib.metadata import version import pytest import pyqtgraph as pg from pyqtgraph.exporters import MatplotlibExporter pytest.importorskip("matplotlib") import matplotlib app = pg.mkQApp() skip_qt6 = pytest.mark.skipif( # availability of QtAgg signifies Qt6 support pg.Qt.QT_LIB in ["PySide6", "PyQt6"] and "QtAgg" not in matplotlib.rcsetup.interactive_bk, reason= ( "installed version of Matplotlib does not support Qt6, " "see https://github.com/matplotlib/matplotlib/pull/19255" ) ) # see https://github.com/matplotlib/matplotlib/pull/24172 if ( pg.Qt.QT_LIB == "PySide6" and tuple(map(int, pg.Qt.PySide6.__version__.split("."))) > (6, 4) and tuple(map(int, version("matplotlib").split("."))) < (3, 6, 2) ): pytest.skip( "matplotlib + PySide6 6.4 bug", allow_module_level=True ) @skip_qt6 def test_MatplotlibExporter(): plt = pg.PlotWidget() plt.show() # curve item plt.plot([0, 1, 2], [0, 1, 2]) # scatter item plt.plot([0, 1, 2], [1, 2, 3], pen=None, symbolBrush='r') # curve + scatter plt.plot([0, 1, 2], [2, 3, 4], pen='k', symbolBrush='r') exp = MatplotlibExporter(plt.getPlotItem()) exp.export() @skip_qt6 def test_MatplotlibExporter_nonplotitem(): # attempting to export something other than a PlotItem raises an exception plt = pg.PlotWidget() plt.show() plt.plot([0, 1, 2], [2, 3, 4]) exp = MatplotlibExporter(plt.getPlotItem().getViewBox()) with pytest.raises(Exception): exp.export() @skip_qt6 @pytest.mark.parametrize('scale', [1e10, 1e-9]) def test_MatplotlibExporter_siscale(scale): # coarse test to verify that plot data is scaled before export when # autoSIPrefix is in effect (so mpl doesn't add its own multiplier label) plt = pg.PlotWidget() plt.show() plt.plot([0, 1, 2], [(i+1)*scale for i in range(3)]) # set the label so autoSIPrefix works plt.setLabel('left', 'magnitude') exp = MatplotlibExporter(plt.getPlotItem()) exp.export() mpw = MatplotlibExporter.windows[-1] fig = mpw.getFigure() ymin, ymax = fig.axes[0].get_ylim() if scale < 1: assert ymax > scale else: assert ymax < scale pyqtgraph-pyqtgraph-0.13.4/tests/exporters/test_svg.py000066400000000000000000000037701457240071200232510ustar00rootroot00000000000000import pyqtgraph as pg app = pg.mkQApp() def test_plotscene(tmpdir): pg.setConfigOption('foreground', (0,0,0)) w = pg.GraphicsLayoutWidget() w.show() p1 = w.addPlot() p2 = w.addPlot() p1.plot([1,3,2,3,1,6,9,8,4,2,3,5,3], pen={'color':'k'}) p1.setXRange(0,5) p2.plot([1,5,2,3,4,6,1,2,4,2,3,5,3], pen={'color':'k', 'cosmetic':False, 'width': 0.3}) app.processEvents() app.processEvents() ex = pg.exporters.SVGExporter(w.scene()) tf = tmpdir.join("expot.svg") ex.export(fileName=tf) # clean up after the test is done w.close() def test_simple(tmpdir): view = pg.GraphicsView() view.show() scene = view.sceneObj rect = pg.QtWidgets.QGraphicsRectItem(0, 0, 100, 100) scene.addItem(rect) rect.setPos(20,20) tr = pg.QtGui.QTransform() rect.setTransform(tr.translate(50, 50).rotate(30).scale(0.5, 0.5)) rect1 = pg.QtWidgets.QGraphicsRectItem(0, 0, 100, 100) rect1.setParentItem(rect) rect1.setFlag(rect1.GraphicsItemFlag.ItemIgnoresTransformations) rect1.setPos(20, 20) rect1.setScale(2) el1 = pg.QtWidgets.QGraphicsEllipseItem(0, 0, 100, 100) el1.setParentItem(rect1) grp = pg.ItemGroup() grp.setParentItem(rect) tr = pg.QtGui.QTransform() grp.setTransform(tr.translate(200, 0).rotate(30)) rect2 = pg.QtWidgets.QGraphicsRectItem(0, 0, 100, 25) rect2.setFlag(rect2.GraphicsItemFlag.ItemClipsChildrenToShape) rect2.setParentItem(grp) rect2.setPos(0,25) rect2.setRotation(30) el = pg.QtWidgets.QGraphicsEllipseItem(0, 0, 100, 50) tr = pg.QtGui.QTransform() el.setTransform(tr.translate(10, -5).scale(0.5, 2)) el.setParentItem(rect2) grp2 = pg.ItemGroup() scene.addItem(grp2) grp2.setScale(100) rect3 = pg.QtWidgets.QGraphicsRectItem(0,0,2,2) rect3.setPen(pg.mkPen(width=1, cosmetic=False)) grp2.addItem(rect3) ex = pg.exporters.SVGExporter(scene) tf = tmpdir.join("expot.svg") ex.export(fileName=tf) pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/000077500000000000000000000000001457240071200216015ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/PlotItem/000077500000000000000000000000001457240071200233365ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/PlotItem/test_PlotItem.py000066400000000000000000000105641457240071200265120ustar00rootroot00000000000000import numpy as np import pytest import pyqtgraph as pg app = pg.mkQApp() rng = np.random.default_rng(1001) def sorted_randint(low, high, size): return np.sort(rng.integers(low, high, size)) def is_none_or_scalar(value): return value is None or np.isscalar(value[0]) multi_data_plot_values = [ None, sorted_randint(0, 20, 15), [ sorted_randint(0, 20, 15), *[sorted_randint(0, 20, 15) for _ in range(4)], ], np.vstack([sorted_randint(20, 40, 15) for _ in range(6)]), ] @pytest.mark.parametrize("orientation", ["left", "right", "top", "bottom"]) def test_PlotItem_shared_axis_items(orientation): """Adding an AxisItem to multiple plots raises RuntimeError""" ax1 = pg.AxisItem(orientation) ax2 = pg.AxisItem(orientation) layout = pg.GraphicsLayoutWidget() _ = layout.addPlot(axisItems={orientation: ax1}) pi2 = layout.addPlot() # left or bottom replaces, right or top adds new pi2.setAxisItems({orientation: ax2}) with pytest.raises(RuntimeError): pi2.setAxisItems({orientation: ax1}) def test_PlotItem_maxTraces(): item = pg.PlotItem() curve1 = pg.PlotDataItem(np.random.normal(size=10)) item.addItem(curve1) assert curve1.isVisible(), "curve1 should be visible" item.ctrl.maxTracesCheck.setChecked(True) item.ctrl.maxTracesSpin.setValue(0) assert not curve1.isVisible(), "curve1 should not be visible" item.ctrl.maxTracesCheck.setChecked(False) assert curve1.isVisible(), "curve1 should be visible" curve2 = pg.PlotDataItem(np.random.normal(size=10)) item.addItem(curve2) assert curve2.isVisible(), "curve2 should be visible" item.ctrl.maxTracesCheck.setChecked(True) item.ctrl.maxTracesSpin.setValue(1) assert curve2.isVisible(), "curve2 should be visible" assert not curve1.isVisible(), "curve1 should not be visible" assert curve1 in item.curves, "curve1 should be in the item's curves" item.ctrl.forgetTracesCheck.setChecked(True) assert curve2 in item.curves, "curve2 should be in the item's curves" assert curve1 not in item.curves, "curve1 should not be in the item's curves" @pytest.mark.parametrize("xvalues", multi_data_plot_values) @pytest.mark.parametrize("yvalues", multi_data_plot_values) def test_PlotItem_multi_data_plot(xvalues, yvalues): item = pg.PlotItem() if is_none_or_scalar(xvalues) and is_none_or_scalar(yvalues): with pytest.raises(ValueError): item.multiDataPlot(x=xvalues, y=yvalues) return else: curves = item.multiDataPlot(x=xvalues, y=yvalues, constKwargs={"pen": "r"}) check_idx = None if xvalues is None: check_idx = 0 elif yvalues is None: check_idx = 1 if check_idx is not None: for curve in curves: data = curve.getData() opposite_idx = 1 - check_idx assert np.array_equal( data[check_idx], np.arange(len(data[opposite_idx])) ) assert curve.opts["pen"] == "r" def test_PlotItem_preserve_external_visibility_control(): item = pg.PlotItem() curve1 = pg.PlotDataItem(np.random.normal(size=10)) curve2 = pg.PlotDataItem(np.random.normal(size=10)) item.addItem(curve1) curve1.hide() item.addItem(curve2) assert not curve1.isVisible() item.removeItem(curve2) assert not curve1.isVisible() def test_plotitem_menu_initialize(): """Test the menu initialization of the plotitem""" item = pg.PlotItem() assert item.menuEnabled() is True viewbox = item.vb assert viewbox is not None assert viewbox.menu is not None assert viewbox.menuEnabled() is True item = pg.PlotItem(enableMenu=False) assert item.menuEnabled() is False viewbox = item.vb assert viewbox is not None assert viewbox.menu is None assert viewbox.menuEnabled() is False viewbox = pg.ViewBox() item = pg.PlotItem(viewBox=viewbox, enableMenu=False) assert item.menuEnabled() is False viewbox = item.vb assert viewbox is not None assert viewbox.menu is not None assert viewbox.menuEnabled() is True viewbox = pg.ViewBox(enableMenu=False) item = pg.PlotItem(viewBox=viewbox) assert item.menuEnabled() is True viewbox = item.vb assert viewbox is not None assert viewbox.menu is None assert viewbox.menuEnabled() is False pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/ViewBox/000077500000000000000000000000001457240071200231645ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/ViewBox/test_ViewBox.py000066400000000000000000000051211457240071200261570ustar00rootroot00000000000000#import PySide import pytest import pyqtgraph as pg app = pg.mkQApp() qtest = pg.Qt.QtTest.QTest QRectF = pg.QtCore.QRectF def assertMapping(vb, r1, r2): assert vb.mapFromView(r1.topLeft()) == r2.topLeft() assert vb.mapFromView(r1.bottomLeft()) == r2.bottomLeft() assert vb.mapFromView(r1.topRight()) == r2.topRight() assert vb.mapFromView(r1.bottomRight()) == r2.bottomRight() def init_viewbox(): """Helper function to init the ViewBox """ global win, vb win = pg.GraphicsLayoutWidget() win.ci.layout.setContentsMargins(0,0,0,0) win.resize(200, 200) win.show() vb = win.addViewBox() # set range before viewbox is shown vb.setRange(xRange=[0, 10], yRange=[0, 10], padding=0) # required to make mapFromView work properly. qtest.qWaitForWindowExposed(win) g = pg.GridItem() vb.addItem(g) app.processEvents() def test_ViewBox(): init_viewbox() w = vb.geometry().width() h = vb.geometry().height() view1 = QRectF(0, 0, 10, 10) size1 = QRectF(0, h, w, -h) assertMapping(vb, view1, size1) # test resize win.resize(400, 400) app.processEvents() w = vb.geometry().width() h = vb.geometry().height() size1 = QRectF(0, h, w, -h) assertMapping(vb, view1, size1) # now lock aspect vb.setAspectLocked() # test wide resize win.resize(800, 400) app.processEvents() w = vb.geometry().width() h = vb.geometry().height() view1 = QRectF(-5, 0, 20, 10) size1 = QRectF(0, h, w, -h) assertMapping(vb, view1, size1) # test tall resize win.resize(200, 400) app.processEvents() w = vb.geometry().width() h = vb.geometry().height() view1 = QRectF(0, -5, 10, 20) size1 = QRectF(0, h, w, -h) assertMapping(vb, view1, size1) win.close() def test_ViewBox_setMenuEnabled(): init_viewbox() vb.setMenuEnabled(True) assert vb.menu is not None vb.setMenuEnabled(False) assert vb.menu is None skipreason = "Skipping this test until someone has time to fix it." @pytest.mark.skipif(True, reason=skipreason) def test_limits_and_resize(): init_viewbox() # now lock aspect vb.setAspectLocked() # test limits + resize (aspect ratio constraint has priority over limits win.resize(400, 400) app.processEvents() vb.setLimits(xMin=0, xMax=10, yMin=0, yMax=10) win.resize(800, 400) app.processEvents() w = vb.geometry().width() h = vb.geometry().height() view1 = QRectF(-5, 0, 20, 10) size1 = QRectF(0, h, w, -h) assertMapping(vb, view1, size1) pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/ViewBox/test_ViewBoxZoom.py000066400000000000000000000143221457240071200270270ustar00rootroot00000000000000import pyqtgraph as pg app = pg.mkQApp() def test_zoom_normal(): vb = pg.ViewBox() testRange = pg.QtCore.QRect(0, 0, 10, 20) vb.setRange(testRange, padding=0) vbViewRange = vb.getState()['viewRange'] assert vbViewRange == [[testRange.left(), testRange.right()], [testRange.top(), testRange.bottom()]] def test_zoom_limit(): """Test zooming with X and Y limits set""" vb = pg.ViewBox() vb.setLimits(xMin=0, xMax=10, yMin=0, yMax=10) # Try zooming within limits. Should return unmodified testRange = pg.QtCore.QRect(0, 0, 9, 9) vb.setRange(testRange, padding=0) vbViewRange = vb.getState()['viewRange'] assert vbViewRange == [[testRange.left(), testRange.right()], [testRange.top(), testRange.bottom()]] # And outside limits. both view range and targetRange should be set to limits testRange = pg.QtCore.QRect(-5, -5, 16, 20) vb.setRange(testRange, padding=0) expected = [[0, 10], [0, 10]] vbState = vb.getState() assert vbState['targetRange'] == expected assert vbState['viewRange'] == expected def test_zoom_range_limit(): """Test zooming with XRange and YRange limits set, but no X and Y limits""" vb = pg.ViewBox() vb.setLimits(minXRange=5, maxXRange=10, minYRange=5, maxYRange=10) # Try something within limits testRange = pg.QtCore.QRect(-15, -15, 7, 7) vb.setRange(testRange, padding=0) expected = [[testRange.left(), testRange.right()], [testRange.top(), testRange.bottom()]] vbViewRange = vb.getState()['viewRange'] assert vbViewRange == expected # and outside limits testRange = pg.QtCore.QRect(-15, -15, 17, 17) # Code should center the required width reduction, so move each side by 3 expected = [[testRange.left() + 3, testRange.right() - 3], [testRange.top() + 3, testRange.bottom() - 3]] vb.setRange(testRange, padding=0) vbViewRange = vb.getState()['viewRange'] vbTargetRange = vb.getState()['targetRange'] assert vbViewRange == expected assert vbTargetRange == expected def test_zoom_ratio(): """Test zooming with a fixed aspect ratio set""" vb = pg.ViewBox(lockAspect=1) # Give the viewbox a size of the proper aspect ratio to keep things easy vb.setFixedHeight(10) vb.setFixedWidth(10) # request a range with a good ratio testRange = pg.QtCore.QRect(0, 0, 10, 10) vb.setRange(testRange, padding=0) expected = [[testRange.left(), testRange.right()], [testRange.top(), testRange.bottom()]] viewRange = vb.getState()['viewRange'] viewWidth = viewRange[0][1] - viewRange[0][0] viewHeight = viewRange[1][1] - viewRange[1][0] # Assert that the width and height are equal, since we locked the aspect ratio at 1 assert viewWidth == viewHeight # and for good measure, that it is the same as the test range assert viewRange == expected # Now try to set to something with a different aspect ratio testRange = pg.QtCore.QRect(0, 0, 10, 20) vb.setRange(testRange, padding=0) viewRange = vb.getState()['viewRange'] viewWidth = viewRange[0][1] - viewRange[0][0] viewHeight = viewRange[1][1] - viewRange[1][0] # Don't really care what we got here, as long as the width and height are the same assert viewWidth == viewHeight def test_zoom_ratio2(): """Slightly more complicated zoom ratio test, where the view box shape does not match the ratio""" vb = pg.ViewBox(lockAspect=1) # twice as wide as tall vb.setFixedHeight(10) vb.setFixedWidth(20) # more or less random requested range testRange = pg.QtCore.QRect(0, 0, 10, 15) vb.setRange(testRange, padding=0) viewRange = vb.getState()['viewRange'] viewWidth = viewRange[0][1] - viewRange[0][0] viewHeight = viewRange[1][1] - viewRange[1][0] # View width should be twice as wide as the height, # since the viewbox is twice as wide as it is tall. assert viewWidth == 2 * viewHeight def test_zoom_ratio_with_limits1(): """Test zoom with both ratio and limits set""" vb = pg.ViewBox(lockAspect=1) # twice as wide as tall vb.setFixedHeight(10) vb.setFixedWidth(20) # set some limits vb.setLimits(xMin=-5, xMax=5, yMin=-5, yMax=5) # Try to zoom too tall testRange = pg.QtCore.QRect(0, 0, 6, 10) vb.setRange(testRange, padding=0) viewRange = vb.getState()['viewRange'] viewWidth = viewRange[0][1] - viewRange[0][0] viewHeight = viewRange[1][1] - viewRange[1][0] # Make sure our view is within limits and the proper aspect ratio assert viewRange[0][0] >= -5 assert viewRange[0][1] <= 5 assert viewRange[1][0] >= -5 assert viewRange[1][1] <= 5 assert viewWidth == 2 * viewHeight def test_zoom_ratio_with_limits2(): vb = pg.ViewBox(lockAspect=1) # twice as wide as tall vb.setFixedHeight(10) vb.setFixedWidth(20) # set some limits vb.setLimits(xMin=-5, xMax=5, yMin=-5, yMax=5) # Same thing, but out-of-range the other way testRange = pg.QtCore.QRect(0, 0, 16, 6) vb.setRange(testRange, padding=0) viewRange = vb.getState()['viewRange'] viewWidth = viewRange[0][1] - viewRange[0][0] viewHeight = viewRange[1][1] - viewRange[1][0] # Make sure our view is within limits and the proper aspect ratio assert viewRange[0][0] >= -5 assert viewRange[0][1] <= 5 assert viewRange[1][0] >= -5 assert viewRange[1][1] <= 5 assert viewWidth == 2 * viewHeight def test_zoom_ratio_with_limits_out_of_range(): vb = pg.ViewBox(lockAspect=1) # twice as wide as tall vb.setFixedHeight(10) vb.setFixedWidth(20) # set some limits vb.setLimits(xMin=-5, xMax=5, yMin=-5, yMax=5) # Request something completely out-of-range and out-of-aspect testRange = pg.QtCore.QRect(10, 10, 25, 100) vb.setRange(testRange, padding=0) viewRange = vb.getState()['viewRange'] viewWidth = viewRange[0][1] - viewRange[0][0] viewHeight = viewRange[1][1] - viewRange[1][0] # Make sure our view is within limits and the proper aspect ratio assert viewRange[0][0] >= -5 assert viewRange[0][1] <= 5 assert viewRange[1][0] >= -5 assert viewRange[1][1] <= 5 assert viewWidth == 2 * viewHeight pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_ArrowItem.py000066400000000000000000000003461457240071200251260ustar00rootroot00000000000000import pyqtgraph as pg app = pg.mkQApp() def test_ArrowItem_parent(): parent = pg.GraphicsObject() a = pg.ArrowItem(parent=parent, pos=(10, 10)) assert a.parentItem() is parent assert a.pos() == pg.Point(10, 10) pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_AxisItem.py000066400000000000000000000127301457240071200247400ustar00rootroot00000000000000from math import isclose import pytest import pyqtgraph as pg app = pg.mkQApp() def test_AxisItem_stopAxisAtTick(monkeypatch): def test_bottom(p, axisSpec, tickSpecs, textSpecs): viewPixelSize = view.viewPixelSize() assert isclose(view.mapToView(axisSpec[1]).x(), 0.25, abs_tol=viewPixelSize[0]) assert isclose(view.mapToView(axisSpec[2]).x(), 0.75, abs_tol=viewPixelSize[0]) def test_left(p, axisSpec, tickSpecs, textSpecs): viewPixelSize = view.viewPixelSize() assert isclose(view.mapToView(axisSpec[1]).y(), 0.875, abs_tol=viewPixelSize[1]) assert isclose(view.mapToView(axisSpec[2]).y(), 0.125, abs_tol=viewPixelSize[1]) plot = pg.PlotWidget() view = plot.plotItem.getViewBox() bottom = plot.getAxis("bottom") bottom.setRange(0, 1) bticks = [(0.25, "a"), (0.6, "b"), (0.75, "c")] bottom.setTicks([bticks, bticks]) bottom.setStyle(stopAxisAtTick=(True, True)) monkeypatch.setattr(bottom, "drawPicture", test_bottom) left = plot.getAxis("left") lticks = [(0.125, "a"), (0.55, "b"), (0.875, "c")] left.setTicks([lticks, lticks]) left.setRange(0, 1) left.setStyle(stopAxisAtTick=(True, True)) monkeypatch.setattr(left, "drawPicture", test_left) plot.show() app.processEvents() plot.close() def test_AxisItem_viewUnlink(): plot = pg.PlotWidget() view = plot.plotItem.getViewBox() axis = plot.getAxis("bottom") assert axis.linkedView() == view axis.unlinkFromView() assert axis.linkedView() is None class FakeSignal: def __init__(self): self.calls = [] def connect(self, *args, **kwargs): self.calls.append('connect') def disconnect(self, *args, **kwargs): self.calls.append('disconnect') class FakeView: def __init__(self): self.sigYRangeChanged = FakeSignal() self.sigXRangeChanged = FakeSignal() self.sigResized = FakeSignal() def test_AxisItem_bottomRelink(): axis = pg.AxisItem('bottom') fake_view = FakeView() axis.linkToView(fake_view) assert axis.linkedView() == fake_view assert fake_view.sigYRangeChanged.calls == [] assert fake_view.sigXRangeChanged.calls == ['connect'] assert fake_view.sigResized.calls == ['connect'] axis.unlinkFromView() assert fake_view.sigYRangeChanged.calls == [] assert fake_view.sigXRangeChanged.calls == ['connect', 'disconnect'] assert fake_view.sigResized.calls == ['connect', 'disconnect'] def test_AxisItem_leftRelink(): axis = pg.AxisItem('left') fake_view = FakeView() axis.linkToView(fake_view) assert axis.linkedView() == fake_view assert fake_view.sigYRangeChanged.calls == ['connect'] assert fake_view.sigXRangeChanged.calls == [] assert fake_view.sigResized.calls == ['connect'] axis.unlinkFromView() assert fake_view.sigYRangeChanged.calls == ['connect', 'disconnect'] assert fake_view.sigXRangeChanged.calls == [] assert fake_view.sigResized.calls == ['connect', 'disconnect'] def test_AxisItem_tickFont(monkeypatch): def collides(textSpecs): fontMetrics = pg.Qt.QtGui.QFontMetrics(font) for rect, _, text in textSpecs: br = fontMetrics.tightBoundingRect(text) if rect.height() < br.height() or rect.width() < br.width(): return True return False def test_collision(p, axisSpec, tickSpecs, textSpecs): assert not collides(textSpecs) plot = pg.PlotWidget() bottom = plot.getAxis("bottom") left = plot.getAxis("left") font = bottom.linkedView().font() font.setPointSize(25) bottom.setStyle(tickFont=font) left.setStyle(tickFont=font) monkeypatch.setattr(bottom, "drawPicture", test_collision) monkeypatch.setattr(left, "drawPicture", test_collision) plot.show() app.processEvents() plot.close() def test_AxisItem_label_visibility(): """Test the visibility of the axis item using `setLabel`""" axis = pg.AxisItem('left') assert axis.labelText == '' assert axis.labelUnits == '' assert not axis.label.isVisible() axis.setLabel(text='Position', units='mm') assert axis.labelText == 'Position' assert axis.labelUnits == 'mm' assert axis.label.isVisible() # XXX: `None` is converted to empty strings. axis.setLabel(text=None, units=None) assert axis.labelText == '' assert axis.labelUnits == '' assert not axis.label.isVisible() axis.setLabel(text='Current', units=None) assert axis.labelText == 'Current' assert axis.labelUnits == '' assert axis.label.isVisible() axis.setLabel(text=None, units=None) assert not axis.label.isVisible() axis.setLabel(text='', units='V') assert axis.labelText == '' assert axis.labelUnits == 'V' assert axis.label.isVisible() @pytest.mark.parametrize( "orientation,x,y,expected", [ ('top', False, True, False), ('top', True, False, True), ('left', False, True, True), ('left', True, False, False), ], ) def test_AxisItem_setLogMode_two_args(orientation, x, y, expected): axis = pg.AxisItem(orientation) axis.setLogMode(x, y) assert axis.logMode == expected @pytest.mark.parametrize( "orientation,log,expected", [ ('top', True, True), ('left', True, True), ('top', False, False), ('left', False, False), ], ) def test_AxisItem_setLogMode_one_arg(orientation, log, expected): axis = pg.AxisItem(orientation) axis.setLogMode(log) assert axis.logMode == expected pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_ErrorBarItem.py000066400000000000000000000020471457240071200255520ustar00rootroot00000000000000import numpy as np import pyqtgraph as pg app = pg.mkQApp() def test_ErrorBarItem_defer_data(): plot = pg.PlotWidget() plot.show() # plot some data away from the origin to set the view rect x = np.arange(5) + 10 curve = pg.PlotCurveItem(x=x, y=x) plot.addItem(curve) app.processEvents() app.processEvents() r_no_ebi = plot.viewRect() # ErrorBarItem with no data shouldn't affect the view rect err = pg.ErrorBarItem() plot.addItem(err) app.processEvents() app.processEvents() r_empty_ebi = plot.viewRect() assert r_no_ebi.height() == r_empty_ebi.height() err.setData(x=x, y=x, bottom=x, top=x) app.processEvents() app.processEvents() r_ebi = plot.viewRect() assert r_ebi.height() > r_empty_ebi.height() # unset data, ErrorBarItem disappears and view rect goes back to original err.setData(x=None, y=None) app.processEvents() app.processEvents() r_clear_ebi = plot.viewRect() assert r_clear_ebi.height() == r_empty_ebi.height() plot.close() pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_GraphicsItem.py000066400000000000000000000013221457240071200255670ustar00rootroot00000000000000import faulthandler import weakref import pyqtgraph as pg faulthandler.enable() pg.mkQApp() def test_getViewWidget(): view = pg.PlotWidget() vref = weakref.ref(view) item = pg.InfiniteLine() view.addItem(item) assert item.getViewWidget() is view del view assert vref() is None assert item.getViewWidget() is None def test_getViewWidget_deleted(): view = pg.PlotWidget() item = pg.InfiniteLine() view.addItem(item) assert item.getViewWidget() is view # Arrange to have Qt automatically delete the view widget obj = pg.QtWidgets.QWidget() view.setParent(obj) del obj assert not pg.Qt.isQObjectAlive(view) assert item.getViewWidget() is None pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_ImageItem.py000066400000000000000000000223611457240071200250570ustar00rootroot00000000000000import time import numpy as np import pytest import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui, QtTest from tests.image_testing import TransposedImageItem, assertImageApproved try: import cupy except ImportError: cupy = None app = pg.mkQApp() @pytest.mark.skipif(cupy is None, reason="CuPy unavailable to test") def test_useCupy_can_be_set_after_init(): prev_setting = pg.getConfigOption("useCupy") try: pg.setConfigOption("useCupy", False) w = pg.GraphicsLayoutWidget() w.show() view = pg.ViewBox() w.setCentralWidget(view) w.resize(200, 200) img = cupy.random.randint(0, 255, size=(32, 32)).astype(cupy.uint8) ii = pg.ImageItem() view.addItem(ii) pg.setConfigOption("useCupy", True) ii.setImage(img) w.hide() finally: pg.setConfigOption("useCupy", prev_setting) @pytest.mark.skipif(cupy is None, reason="CuPy unavailable to test") def test_ensuring_substrate(): prev_setting = pg.getConfigOption("useCupy") try: pg.setConfigOption("useCupy", True) ii = pg.ImageItem() data = cupy.random.randint(0, 255, size=(32, 32)).astype(cupy.uint8) assert data is ii._ensure_proper_substrate(data, cupy) assert isinstance(ii._ensure_proper_substrate(data, cupy), cupy.ndarray) assert data is not ii._ensure_proper_substrate(data, np) assert isinstance(ii._ensure_proper_substrate(data, np), np.ndarray) data = np.random.randint(0, 255, size=(32, 32)).astype(np.uint8) assert data is ii._ensure_proper_substrate(data, np) assert isinstance(ii._ensure_proper_substrate(data, np), np.ndarray) assert data is not ii._ensure_proper_substrate(data, cupy) assert isinstance(ii._ensure_proper_substrate(data, cupy), cupy.ndarray) data = range(0, 255) assert data is not ii._ensure_proper_substrate(data, np) assert isinstance(ii._ensure_proper_substrate(data, np), np.ndarray) assert data is not ii._ensure_proper_substrate(data, cupy) assert isinstance(ii._ensure_proper_substrate(data, cupy), cupy.ndarray) finally: pg.setConfigOption("useCupy", prev_setting) def test_ImageItem(transpose=False): w = pg.GraphicsLayoutWidget() w.show() view = pg.ViewBox() w.setCentralWidget(view) w.resize(200, 200) img = TransposedImageItem(border=0.5, transpose=transpose) view.addItem(img) # test mono float np.random.seed(0) data = np.random.normal(size=(20, 20)) dmax = data.max() data[:10, 1] = dmax + 10 data[1, :10] = dmax + 12 data[3, :10] = dmax + 13 img.setImage(data) QtTest.QTest.qWaitForWindowExposed(w) time.sleep(0.1) app.processEvents() assertImageApproved(w, 'imageitem/init', 'Init image item. View is auto-scaled, image axis 0 marked by 1 line, axis 1 is marked by 2 lines. Origin in bottom-left.') # ..with colormap cmap = pg.ColorMap([0, 0.25, 0.75, 1], [[0, 0, 0, 255], [255, 0, 0, 255], [255, 255, 0, 255], [255, 255, 255, 255]]) img.setLookupTable(cmap.getLookupTable()) assertImageApproved(w, 'imageitem/lut', 'Set image LUT.') # ..and different levels img.setLevels([dmax+9, dmax+13]) assertImageApproved(w, 'imageitem/levels1', 'Levels show only axis lines.') img.setLookupTable(None) # test mono int data = np.fromfunction(lambda x,y: x+y*10, (129, 128)).astype(np.int16) img.setImage(data) assertImageApproved(w, 'imageitem/gradient_mono_int', 'Mono int gradient.') img.setLevels([640, 641]) assertImageApproved(w, 'imageitem/gradient_mono_int_levels', 'Mono int gradient w/ levels to isolate diagonal.') # test mono byte data = np.fromfunction(lambda x,y: x+y, (129, 128)).astype(np.ubyte) img.setImage(data) assertImageApproved(w, 'imageitem/gradient_mono_byte', 'Mono byte gradient.') img.setLevels([127, 128]) assertImageApproved(w, 'imageitem/gradient_mono_byte_levels', 'Mono byte gradient w/ levels to isolate diagonal.') # test monochrome image data = np.zeros((10, 10), dtype='uint8') data[:5,:5] = 1 data[5:,5:] = 1 img.setImage(data) assertImageApproved(w, 'imageitem/monochrome', 'Ubyte image with only 0,1 values.') # test bool data = data.astype(bool) img.setImage(data) assertImageApproved(w, 'imageitem/bool', 'Boolean mask.') # test RGBA byte data = np.zeros((100, 100, 4), dtype='ubyte') data[..., 0] = np.linspace(0, 255, 100).reshape(100, 1) data[..., 1] = np.linspace(0, 255, 100).reshape(1, 100) data[..., 3] = 255 img.setImage(data) assertImageApproved(w, 'imageitem/gradient_rgba_byte', 'RGBA byte gradient.') img.setLevels([[128, 129], [128, 255], [0, 1], [0, 255]]) assertImageApproved(w, 'imageitem/gradient_rgba_byte_levels', 'RGBA byte gradient. Levels set to show x=128 and y>128.') # test RGBA float data = data.astype(float) img.setImage(data / 1e9) assertImageApproved(w, 'imageitem/gradient_rgba_float', 'RGBA float gradient.') # checkerboard to test alpha img2 = TransposedImageItem(transpose=transpose) img2.setImage(np.fromfunction(lambda x,y: (x+y)%2, (10, 10)), levels=[-1,2]) view.addItem(img2) img2.setScale(10) img2.setZValue(-10) data[..., 0] *= 1e-9 data[..., 1] *= 1e9 data[..., 3] = np.fromfunction(lambda x,y: np.sin(0.1 * (x+y)), (100, 100)) img.setImage(data, levels=[[0, 128e-9],[0, 128e9],[0, 1],[-1, 1]]) assertImageApproved(w, 'imageitem/gradient_rgba_float_alpha', 'RGBA float gradient with alpha.') # test composition mode img.setCompositionMode(QtGui.QPainter.CompositionMode.CompositionMode_Plus) assertImageApproved(w, 'imageitem/gradient_rgba_float_additive', 'RGBA float gradient with alpha and additive composition mode.') img2.hide() img.setCompositionMode(QtGui.QPainter.CompositionMode.CompositionMode_SourceOver) # test downsampling data = np.fromfunction(lambda x,y: np.cos(0.002 * x**2), (800, 100)) img.setImage(data, levels=[-1, 1]) assertImageApproved(w, 'imageitem/resolution_without_downsampling', 'Resolution test without downsampling.') img.setAutoDownsample(True) assertImageApproved(w, 'imageitem/resolution_with_downsampling_x', 'Resolution test with downsampling axross x axis.') assert img._lastDownsample == (4, 1) img.setImage(data.T, levels=[-1, 1]) assertImageApproved(w, 'imageitem/resolution_with_downsampling_y', 'Resolution test with downsampling across y axis.') assert img._lastDownsample == (1, 4) w.hide() def test_ImageItem_axisorder(): # All image tests pass again using the opposite axis order origMode = pg.getConfigOption('imageAxisOrder') altMode = 'row-major' if origMode == 'col-major' else 'col-major' pg.setConfigOptions(imageAxisOrder=altMode) try: test_ImageItem(transpose=True) finally: pg.setConfigOptions(imageAxisOrder=origMode) def test_setRect(): def assert_equal_transforms(tr1, tr2): dic = { # there seems to be no easy way to get the matrix in one call: 'tr11': ( tr1.m11(), tr2.m11() ), 'tr12': ( tr1.m12(), tr2.m12() ), 'tr13': ( tr1.m13(), tr2.m13() ), 'tr21': ( tr1.m21(), tr2.m21() ), 'tr22': ( tr1.m22(), tr2.m22() ), 'tr23': ( tr1.m23(), tr2.m23() ), 'tr31': ( tr1.m31(), tr2.m31() ), 'tr32': ( tr1.m32(), tr2.m32() ), 'tr33': ( tr1.m33(), tr2.m33() ) } log_string = 'Matrix element mismatch\n' good = True for key, values in dic.items(): val1, val2 = values if val1 != val2: good = False log_string += f'{key}: {val1} != {val2}\n' assert good, log_string tr = QtGui.QTransform() # construct a reference transform tr.scale(2, 4) # scale 2x2 image to 4x8 tr.translate(-1, -1) # after shifting by -1, -1 # the transformed 2x2 image would cover (-2,-4) to (2,4). # Now have setRect construct the same transform: imgitem = pg.ImageItem(np.eye(2), rect=(-2,-4, 4,8) ) # test tuple of floats assert_equal_transforms(tr, imgitem.transform()) imgitem = pg.ImageItem(np.eye(2), rect=QtCore.QRectF(-2,-4, 4,8) ) # test QRectF assert_equal_transforms(tr, imgitem.transform()) imgitem = pg.ImageItem(np.eye(2)) imgitem.setRect(-2,-4, 4,8) # test individual parameters assert_equal_transforms(tr, imgitem.transform()) imgitem = pg.ImageItem(np.eye(2)) imgitem.setRect(QtCore.QRect(-2,-4, 4,8)) # test QRect argument assert_equal_transforms(tr, imgitem.transform()) def test_dividebyzero(): # test that the calculation of downsample factors # does not result in a division by zero plt = pg.PlotWidget() plt.show() plt.setAspectLocked(True) imgitem = pg.ImageItem(np.random.normal(size=(100,100))) imgitem.setAutoDownsample(True) plt.addItem(imgitem) plt.setRange(xRange=[-5e+25, 5e+25],yRange=[-5e+25, 5e+25]) QtTest.QTest.qWaitForWindowExposed(plt) QtTest.QTest.qWait(100) # must manually call imgitem.render here or the exception # will only exist on the Qt event loop imgitem.render() pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_ImageItemFormat.py000066400000000000000000000172341457240071200262330ustar00rootroot00000000000000import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtGui def check_format(shape, dtype, levels, lut, expected_format): data = np.zeros(shape, dtype=dtype) item = pg.ImageItem(axisOrder='row-major') item.setImage(data, autoLevels=False, lut=lut, levels=levels) item.render() assert item.qimage.format() == expected_format def test_uint8(): Format = QtGui.QImage.Format dtype = np.uint8 w, h = 192, 108 lo, hi = 50, 200 lut_none = None lut_mono1 = np.random.randint(256, size=256, dtype=np.uint8) lut_mono2 = np.random.randint(256, size=(256, 1), dtype=np.uint8) lut_rgb = np.random.randint(256, size=(256, 3), dtype=np.uint8) lut_rgba = np.random.randint(256, size=(256, 4), dtype=np.uint8) # lut with less than 256 entries lut_mono1_s = np.random.randint(256, size=255, dtype=np.uint8) lut_mono2_s = np.random.randint(256, size=(255, 1), dtype=np.uint8) lut_rgb_s = np.random.randint(256, size=(255, 3), dtype=np.uint8) lut_rgba_s = np.random.randint(256, size=(255, 4), dtype=np.uint8) # lut with more than 256 entries lut_mono1_l = np.random.randint(256, size=257, dtype=np.uint8) lut_mono2_l = np.random.randint(256, size=(257, 1), dtype=np.uint8) lut_rgb_l = np.random.randint(256, size=(257, 3), dtype=np.uint8) lut_rgba_l = np.random.randint(256, size=(257, 4), dtype=np.uint8) levels = None check_format((h, w), dtype, levels, lut_none, Format.Format_Grayscale8) check_format((h, w, 3), dtype, levels, lut_none, Format.Format_RGB888) check_format((h, w, 4), dtype, levels, lut_none, Format.Format_RGBA8888) levels = [lo, hi] check_format((h, w), dtype, levels, lut_none, Format.Format_Indexed8) levels = None check_format((h, w), dtype, levels, lut_mono1, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono2, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgb, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgba, Format.Format_Indexed8) levels = [lo, hi] check_format((h, w), dtype, levels, lut_mono1, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono2, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgb, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgba, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono1_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono2_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgb_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgba_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono1_l, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono2_l, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgb_l, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgba_l, Format.Format_Indexed8) levels = [lo, hi] check_format((h, w, 3), dtype, levels, lut_none, Format.Format_RGB888) def test_uint16(): Format = QtGui.QImage.Format dtype = np.uint16 w, h = 192, 108 lo, hi = 100, 10000 lut_none = None lut_mono1 = np.random.randint(256, size=256, dtype=np.uint8) lut_mono2 = np.random.randint(256, size=(256, 1), dtype=np.uint8) lut_rgb = np.random.randint(256, size=(256, 3), dtype=np.uint8) lut_rgba = np.random.randint(256, size=(256, 4), dtype=np.uint8) # lut with less than 256 entries lut_mono1_s = np.random.randint(256, size=255, dtype=np.uint8) lut_mono2_s = np.random.randint(256, size=(255, 1), dtype=np.uint8) lut_rgb_s = np.random.randint(256, size=(255, 3), dtype=np.uint8) lut_rgba_s = np.random.randint(256, size=(255, 4), dtype=np.uint8) # lut with more than 256 entries lut_mono1_l = np.random.randint(256, size=257, dtype=np.uint8) lut_mono2_l = np.random.randint(256, size=(257, 1), dtype=np.uint8) lut_rgb_l = np.random.randint(256, size=(257, 3), dtype=np.uint8) lut_rgba_l = np.random.randint(256, size=(257, 4), dtype=np.uint8) levels = None try: fmt_gray16 = Format.Format_Grayscale16 except AttributeError: fmt_gray16 = Format.Format_ARGB32 check_format((h, w), dtype, levels, lut_none, fmt_gray16) check_format((h, w, 3), dtype, levels, lut_none, Format.Format_RGB888) check_format((h, w, 4), dtype, levels, lut_none, Format.Format_RGBA64) levels = [lo, hi] check_format((h, w), dtype, levels, lut_none, Format.Format_Grayscale8) levels = None check_format((h, w), dtype, levels, lut_mono1, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono2, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgb, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgba, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono1_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono2_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgb_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgba_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono1_l, Format.Format_Grayscale8) check_format((h, w), dtype, levels, lut_mono2_l, Format.Format_Grayscale8) check_format((h, w), dtype, levels, lut_rgb_l, Format.Format_RGBX8888) check_format((h, w), dtype, levels, lut_rgba_l, Format.Format_RGBA8888) levels = [lo, hi] check_format((h, w, 3), dtype, levels, lut_none, Format.Format_RGB888) def test_float32(): Format = QtGui.QImage.Format dtype = np.float32 w, h = 192, 108 lo, hi = -1, 1 lut_none = None lut_mono1 = np.random.randint(256, size=256, dtype=np.uint8) lut_mono2 = np.random.randint(256, size=(256, 1), dtype=np.uint8) lut_rgb = np.random.randint(256, size=(256, 3), dtype=np.uint8) lut_rgba = np.random.randint(256, size=(256, 4), dtype=np.uint8) # lut with less than 256 entries lut_mono1_s = np.random.randint(256, size=255, dtype=np.uint8) lut_mono2_s = np.random.randint(256, size=(255, 1), dtype=np.uint8) lut_rgb_s = np.random.randint(256, size=(255, 3), dtype=np.uint8) lut_rgba_s = np.random.randint(256, size=(255, 4), dtype=np.uint8) # lut with more than 256 entries lut_mono1_l = np.random.randint(256, size=257, dtype=np.uint8) lut_mono2_l = np.random.randint(256, size=(257, 1), dtype=np.uint8) lut_rgb_l = np.random.randint(256, size=(257, 3), dtype=np.uint8) lut_rgba_l = np.random.randint(256, size=(257, 4), dtype=np.uint8) levels = [lo, hi] check_format((h, w), dtype, levels, lut_none, Format.Format_Grayscale8) check_format((h, w, 3), dtype, levels, lut_none, Format.Format_RGB888) check_format((h, w, 4), dtype, levels, lut_none, Format.Format_RGBA8888) check_format((h, w), dtype, levels, lut_mono1, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono2, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgb, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgba, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono1_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono2_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgb_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_rgba_s, Format.Format_Indexed8) check_format((h, w), dtype, levels, lut_mono1_l, Format.Format_Grayscale8) check_format((h, w), dtype, levels, lut_mono2_l, Format.Format_Grayscale8) check_format((h, w), dtype, levels, lut_rgb_l, Format.Format_RGBX8888) check_format((h, w), dtype, levels, lut_rgba_l, Format.Format_RGBA8888) pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_InfiniteLine.py000066400000000000000000000072431457240071200255750ustar00rootroot00000000000000import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui, QtTest from tests.ui_testing import mouseDrag, mouseMove pg.mkQApp() def test_InfiniteLine(): # disable delay of mouse move events because events is called immediately in test pg.setConfigOption('mouseRateLimit', -1) # Test basic InfiniteLine API plt = pg.PlotWidget() plt.show() plt.setXRange(-10, 10) plt.setYRange(-10, 10) plt.resize(600, 600) # seemingly arbitrary requirements; might need longer wait time for some platforms.. QtTest.QTest.qWaitForWindowExposed(plt) QtTest.QTest.qWait(100) vline = plt.addLine(x=1) assert vline.angle == 90 br = vline.mapToView(QtGui.QPolygonF(vline.boundingRect())) assert br.containsPoint(pg.Point(1, 5), QtCore.Qt.FillRule.OddEvenFill) assert not br.containsPoint(pg.Point(5, 0), QtCore.Qt.FillRule.OddEvenFill) hline = plt.addLine(y=0) assert hline.angle == 0 assert hline.boundingRect().contains(pg.Point(5, 0)) assert not hline.boundingRect().contains(pg.Point(0, 5)) vline.setValue(2) assert vline.value() == 2 vline.setPos(pg.Point(4, -5)) assert vline.value() == 4 oline = pg.InfiniteLine(angle=30) plt.addItem(oline) oline.setPos(pg.Point(1, -1)) assert oline.angle == 30 assert oline.pos() == pg.Point(1, -1) assert oline.value() == [1, -1] # test bounding rect for oblique line br = oline.mapToScene(oline.boundingRect()) pos = oline.mapToScene(pg.Point(2, 0)) assert br.containsPoint(pos, QtCore.Qt.FillRule.OddEvenFill) px = pg.Point(-0.5, -1.0 / 3**0.5) assert br.containsPoint(pos + 1 * px, QtCore.Qt.FillRule.OddEvenFill) assert not br.containsPoint(pos + 3 * px, QtCore.Qt.FillRule.OddEvenFill) plt.close() def test_mouseInteraction(): # disable delay of mouse move events because events is called immediately in test pg.setConfigOption('mouseRateLimit', -1) plt = pg.PlotWidget() plt.show() plt.scene().minDragTime = 0 # let us simulate mouse drags very quickly. vline = plt.addLine(x=0, movable=True) hline = plt.addLine(y=0, movable=True) hline2 = plt.addLine(y=-1, movable=False) plt.setXRange(-10, 10) plt.setYRange(-10, 10) # test horizontal drag pos = plt.plotItem.vb.mapViewToScene(pg.Point(0,5)) pos2 = pos - QtCore.QPointF(200, 200) mouseMove(plt, pos) assert vline.mouseHovering is True and hline.mouseHovering is False mouseDrag(plt, pos, pos2, QtCore.Qt.MouseButton.LeftButton) px = vline.pixelLength(pg.Point(1, 0), ortho=True) assert abs(vline.value() - plt.plotItem.vb.mapSceneToView(pos2).x()) <= px # test missed drag pos = plt.plotItem.vb.mapViewToScene(pg.Point(5,0)) pos = pos + QtCore.QPointF(0, 6) pos2 = pos + QtCore.QPointF(-20, -20) mouseMove(plt, pos) assert vline.mouseHovering is False and hline.mouseHovering is False mouseDrag(plt, pos, pos2, QtCore.Qt.MouseButton.LeftButton) assert hline.value() == 0 # test vertical drag pos = plt.plotItem.vb.mapViewToScene(pg.Point(5,0)) pos2 = pos - QtCore.QPointF(50, 50) mouseMove(plt, pos) assert vline.mouseHovering is False and hline.mouseHovering is True mouseDrag(plt, pos, pos2, QtCore.Qt.MouseButton.LeftButton) px = hline.pixelLength(pg.Point(1, 0), ortho=True) assert abs(hline.value() - plt.plotItem.vb.mapSceneToView(pos2).y()) <= px # test non-interactive line pos = plt.plotItem.vb.mapViewToScene(pg.Point(5,-1)) pos2 = pos - QtCore.QPointF(50, 50) mouseMove(plt, pos) assert hline2.mouseHovering == False mouseDrag(plt, pos, pos2, QtCore.Qt.MouseButton.LeftButton) assert hline2.value() == -1 plt.close() pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_LegendItem.py000066400000000000000000000056351457240071200252400ustar00rootroot00000000000000import pyqtgraph as pg def test_legend_item_basics(): pg.mkQApp() legend = pg.LegendItem() assert legend.opts['pen'] == pg.mkPen(None) assert legend.opts['brush'] == pg.mkBrush(None) assert legend.opts['labelTextColor'] is None assert legend.opts['labelTextSize'] == '9pt' assert legend.opts['offset'] is None assert legend.columnCount == 1 assert legend.rowCount == 1 assert legend.labelTextColor() is None assert legend.labelTextSize() == '9pt' assert legend.brush() == pg.mkBrush(None) assert legend.pen() == pg.mkPen(None) assert legend.sampleType is pg.ItemSample # Set brush # ---------------------------------------------------- brush = pg.mkBrush('b') legend.setBrush(brush) assert legend.brush() == brush assert legend.opts['brush'] == brush # Set pen # ---------------------------------------------------- pen = pg.mkPen('b') legend.setPen(pen) assert legend.pen() == pen assert legend.opts['pen'] == pen # Set labelTextColor # ---------------------------------------------------- text_color = pg.mkColor('b') legend.setLabelTextColor(text_color) assert legend.labelTextColor() == text_color assert legend.opts['labelTextColor'] == text_color # Set labelTextSize # ---------------------------------------------------- text_size = '12pt' legend.setLabelTextSize(text_size) assert legend.labelTextSize() == text_size assert legend.opts['labelTextSize'] == text_size # Add items # ---------------------------------------------------- assert len(legend.items) == 0 plot = pg.PlotDataItem(name="Plot") legend.addItem(plot, name="Plot") assert len(legend.items) == 1 scatter = pg.PlotDataItem(name="Scatter") legend.addItem(scatter, name="Scatter") assert len(legend.items) == 2 assert legend.columnCount == 1 assert legend.rowCount == 2 curve = pg.PlotDataItem(name="Curve") legend.addItem(curve, name="Curve") assert len(legend.items) == 3 assert legend.rowCount == 3 scrabble = pg.PlotDataItem(name="Scrabble") legend.addItem(scrabble, name="Scrabble") assert len(legend.items) == 4 assert legend.layout.rowCount() == 4 assert legend.rowCount == 4 legend.setColumnCount(2) assert legend.columnCount == 2 assert legend.rowCount == 2 assert legend.layout.rowCount() == 2 # Remove items # ---------------------------------------------------- legend.removeItem(scrabble) assert legend.rowCount == 2 assert legend.layout.rowCount() == 2 assert scrabble not in legend.items assert len(legend.items) == 3 legend.removeItem(curve) assert legend.rowCount == 2 # rowCount will never decrease when removing assert legend.layout.rowCount() == 1 assert curve not in legend.items assert len(legend.items) == 2 legend.clear() assert legend.items == [] pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_LinearRegionItem.py000066400000000000000000000056531457240071200264200ustar00rootroot00000000000000import math import numpy as np import pytest import pyqtgraph as pg app = pg.mkQApp() def check_region(lr, bounds, exact=False, rtol=0.005): """Optionally tolerant LinearRegionItem region check""" reg = lr.getRegion() if exact: assert reg[0] == bounds[0] assert reg[1] == bounds[1] else: assert math.isclose(reg[0], bounds[0], rel_tol=rtol) assert math.isclose(reg[1], bounds[1], rel_tol=rtol) @pytest.mark.parametrize("orientation", ["vertical", "horizontal"]) def test_clip_to_plot_data_item(orientation): """Vertical and horizontal LRIs clipping both bounds to a PlotDataItem""" # initial bounds for the LRI init_vals = (-1.5, 1.5) # data for a PlotDataItem to clip to, both inside the inial bounds x = np.linspace(-1, 1, 10) y = np.linspace(1, 1.2, 10) p = pg.PlotWidget() pdi = p.plot(x=x, y=y) lr = pg.LinearRegionItem(init_vals, clipItem=pdi, orientation=orientation) p.addItem(lr) app.processEvents() if orientation == "vertical": check_region(lr, x[[0, -1]]) else: check_region(lr, y[[0, -1]]) def test_disable_clip_item(): """LRI clipItem (ImageItem) disabled by explicit call to setBounds""" init_vals = (5, 40) p = pg.PlotWidget() img = pg.ImageItem(image=np.eye(20, 20)) p.addItem(img) lr = pg.LinearRegionItem(init_vals, clipItem=img) p.addItem(lr) app.processEvents() # initial bound that was out of range snaps to the imageitem bound check_region(lr, (init_vals[0], img.height()), exact=True) # disable clipItem, move the right InfiniteLine beyond the new bound lr.setBounds(init_vals) lr.lines[1].setPos(init_vals[1] + 10) app.processEvents() check_region(lr, init_vals, exact=True) def test_clip_to_item_in_other_vb(): """LRI clip to item in a different ViewBox""" init_vals = (10, 50) img_shape = (20, 20) win = pg.GraphicsLayoutWidget() # "remote" PlotDataItem to bound to p1 = win.addPlot() img = pg.ImageItem(image=np.eye(*img_shape)) p1.addItem(img) # plot the LRI lives in p2 = win.addPlot() x2 = np.linspace(-200, 200, 100) p2.plot(x=x2, y=x2) lr = pg.LinearRegionItem(init_vals) p2.addItem(lr) app.processEvents() # no clip item set yet, should be initial bounds check_region(lr, init_vals, exact=True) lr.setClipItem(img) app.processEvents() # snap to image width check_region(lr, (init_vals[0], img_shape[1]), exact=True) def test_clip_item_override_init_bounds(): """clipItem overrides bounds provided in the constructor""" init_vals = (-10, 10) init_bounds = (-5, 5) img_shape = (5, 5) p = pg.PlotWidget() img = pg.ImageItem(image=np.eye(*img_shape)) p.addItem(img) lr = pg.LinearRegionItem(init_vals, clipItem=img, bounds=init_bounds) p.addItem(lr) app.processEvents() check_region(lr, (0, img_shape[1]), exact=True) pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_NonUniformImage.py000066400000000000000000000047301457240071200262530ustar00rootroot00000000000000import numpy as np import pytest import pyqtgraph as pg import pyqtgraph.functions as fn from pyqtgraph.colormap import ColorMap from pyqtgraph.graphicsItems.NonUniformImage import NonUniformImage from pyqtgraph.Qt import QtTest from tests.image_testing import assertImageApproved app = pg.mkQApp() def test_NonUniformImage_scale_dimensions(): x = [1.0, 3.0, 10.0] y = [1.0, 2.0, 4.0] X, Y = np.meshgrid(x, y, indexing='ij') Z = X * Y for args in [(Z, y, Z), (x, Z, Z)]: with pytest.raises(Exception) as ex: NonUniformImage(*args) assert "x and y must be 1-d arrays." in str(ex) def test_NonUniformImage_scale_monotonicity(): x = [1.0, 0.0, 10.0] y = [1.0, 2.0, 4.0] X, Y = np.meshgrid(x, y, indexing='ij') Z = X * Y for args in [(x, y, Z), (y, x, Z)]: with pytest.raises(Exception) as ex: NonUniformImage(*args) assert "The values in x and y must be monotonically increasing." in str(ex) def test_NonUniformImage_data_dimensions(): x = [1.0, 3.0, 10.0] y = [1.0, 2.0, 4.0] with pytest.raises(Exception) as ex: NonUniformImage(x, y, x) assert "The length of x and y must match the shape of z." in str(ex) def test_NonUniformImage_lut(): window = pg.GraphicsLayoutWidget() viewbox = pg.ViewBox() window.setCentralWidget(viewbox) window.resize(200, 200) window.show() x = [1.0, 3.0, 10.0] y = [1.0, 2.0, 4.0] X, Y = np.meshgrid(x, y, indexing='ij') Z = X * Y image = NonUniformImage(x, y, Z, border=fn.mkPen('g')) cmap = ColorMap(None, [0.0, 1.0]) image.setLookupTable(cmap.getLookupTable(nPts=256)) viewbox.addItem(image) QtTest.QTest.qWaitForWindowExposed(window) QtTest.QTest.qWait(100) assertImageApproved(window, 'nonuniform_image/lut-3x3') def test_NonUniformImage_colormap(): window = pg.GraphicsLayoutWidget() viewbox = pg.ViewBox() window.setCentralWidget(viewbox) window.resize(200, 200) window.show() x = [1.0, 3.0, 10.0] y = [1.0, 2.0, 4.0] X, Y = np.meshgrid(x, y, indexing='ij') Z = X * Y Z[:, 0] = [-np.inf, np.nan, np.inf] image = NonUniformImage(x, y, Z, border=fn.mkPen('g')) cmap = ColorMap(pos=[0.0, 1.0], color=[(0, 0, 0), (255, 255, 255)]) image.setColorMap(cmap) viewbox.addItem(image) QtTest.QTest.qWaitForWindowExposed(window) QtTest.QTest.qWait(100) assertImageApproved(window, 'nonuniform_image/colormap-3x3') pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_PlotCurveItem.py000066400000000000000000000037271457240071200257650ustar00rootroot00000000000000import numpy as np import pyqtgraph as pg from pyqtgraph.graphicsItems.PlotCurveItem import arrayToLineSegments from tests.image_testing import assertImageApproved def test_PlotCurveItem(): p = pg.GraphicsLayoutWidget() p.resize(200, 150) p.ci.setContentsMargins(4, 4, 4, 4) # default margins vary by platform p.show() v = p.addViewBox() data = np.array([1,4,2,3,np.inf,5,7,6,-np.inf,8,10,9,np.nan,-1,-2,0]) c = pg.PlotCurveItem(data) c.setSegmentedLineMode('off') # test images assume non-segmented-line-mode v.addItem(c) v.autoRange() # Check auto-range works. Some platform differences may be expected.. checkRange = np.array([[-1.1457564053237301, 16.145756405323731], [-3.076811473165955, 11.076811473165955]]) assert np.allclose(v.viewRange(), checkRange) assertImageApproved(p, 'plotcurveitem/connectall', "Plot curve with all points connected.") c.setData(data, connect='pairs') assertImageApproved(p, 'plotcurveitem/connectpairs', "Plot curve with pairs connected.") c.setData(data, connect='finite') assertImageApproved(p, 'plotcurveitem/connectfinite', "Plot curve with finite points connected.") c.setData(data, connect='finite', skipFiniteCheck=True) assertImageApproved(p, 'plotcurveitem/connectfinite', "Plot curve with finite points connected using QPolygonF.") c.setSkipFiniteCheck(False) c.setData(data, connect=np.array([1,1,1,0,1,1,0,0,1,0,0,0,1,1,0,0])) assertImageApproved(p, 'plotcurveitem/connectarray', "Plot curve with connection array.") p.close() def test_arrayToLineSegments(): # test the boundary case where the dataset consists of a single point xy = np.array([0.]) parray = arrayToLineSegments(xy, xy, connect='all', finiteCheck=True) segs = parray.drawargs() assert isinstance(segs, tuple) and len(segs) in [1, 2] if len(segs) == 1: assert len(segs[0]) == 0 elif len(segs) == 2: assert segs[1] == 0 pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_PlotDataItem.py000066400000000000000000000150361457240071200255460ustar00rootroot00000000000000import warnings import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtGui pg.mkQApp() def test_bool(): truths = np.random.randint(0, 2, size=(100,)).astype(bool) pdi = pg.PlotDataItem(truths) xdata, ydata = pdi.getData() assert ydata.dtype == np.uint8 def test_bound_formats(): for datatype in (bool, np.uint8, np.int16, float): truths = np.random.randint(0, 2, size=(100,)).astype(datatype) pdi_scatter = pg.PlotDataItem(truths, symbol='o', pen=None) pdi_line = pg.PlotDataItem(truths) bounds = pdi_scatter.dataBounds(1) assert isinstance(bounds[0], float), 'bound 0 is not float for scatter plot of '+str(datatype) assert isinstance(bounds[0], float), 'bound 1 is not float for scatter plot of '+str(datatype) bounds = pdi_line.dataBounds(1) assert isinstance(bounds[0], float), 'bound 0 is not float for line plot of '+str(datatype) assert isinstance(bounds[0], float), 'bound 1 is not float for line plot of '+str(datatype) def test_fft(): f = 20. x = np.linspace(0, 1, 1000) y = np.sin(2 * np.pi * f * x) pd = pg.PlotDataItem(x, y) pd.setFftMode(True) x, y = pd.getData() assert abs(x[np.argmax(y)] - f) < 0.03 x = np.linspace(0, 1, 1001) y = np.sin(2 * np.pi * f * x) pd.setData(x, y) x, y = pd.getData() assert abs(x[np.argmax(y)]- f) < 0.03 pd.setLogMode(True, False) x, y = pd.getData() assert abs(x[np.argmax(y)] - np.log10(f)) < 0.01 def test_setData(): pdi = pg.PlotDataItem() #test empty data pdi.setData([]) #test y data y = list(np.random.normal(size=100)) pdi.setData(y) assert len(pdi.xData) == 100 assert len(pdi.yData) == 100 #test x, y data y += list(np.random.normal(size=50)) x = np.linspace(5, 10, 150) pdi.setData(x, y) assert len(pdi.xData) == 150 assert len(pdi.yData) == 150 #test clear by empty call pdi.setData() assert pdi.xData is None assert pdi.yData is None #test dict of x, y list y += list(np.random.normal(size=50)) x = list(np.linspace(5, 10, 200)) pdi.setData({'x': x, 'y': y}) assert len(pdi.xData) == 200 assert len(pdi.yData) == 200 #test clear by zero length arrays call pdi.setData([],[]) assert pdi.xData is None assert pdi.yData is None def test_nonfinite(): def _assert_equal_arrays(a1, a2): assert a1.shape == a2.shape for ( xtest, xgood ) in zip( a1, a2 ): assert( (xtest == xgood) or (np.isnan(xtest) and np.isnan(xgood) ) ) x = np.array([-np.inf, 0.0, 1.0, 2.0 , np.nan, 4.0 , np.inf]) y = np.array([ 1.0, 0.0,-1.0, np.inf, 2.0 , np.nan, 0.0 ]) pdi = pg.PlotDataItem(x, y) dataset = pdi._getDisplayDataset() _assert_equal_arrays( dataset.x, x ) _assert_equal_arrays( dataset.y, y ) with warnings.catch_warnings(): warnings.simplefilter("ignore") x_log = np.log10(x) y_log = np.log10(y) x_log[ ~np.isfinite(x_log) ] = np.nan y_log[ ~np.isfinite(y_log) ] = np.nan pdi.setLogMode(True, True) dataset = pdi._getDisplayDataset() _assert_equal_arrays( dataset.x, x_log ) _assert_equal_arrays( dataset.y, y_log ) def test_opts(): # test that curve and scatter plot properties get updated from PlotDataItem methods y = list(np.random.normal(size=100)) x = np.linspace(5, 10, 100) pdi = pg.PlotDataItem(x, y) pen = QtGui.QPen( QtGui.QColor('#FF0000') ) pen2 = QtGui.QPen( QtGui.QColor('#FFFF00') ) brush = QtGui.QBrush( QtGui.QColor('#00FF00')) brush2 = QtGui.QBrush( QtGui.QColor('#00FFFF')) float_value = 1.0 + 20*np.random.random() pen2.setWidth( int(float_value) ) pdi.setPen(pen) assert pdi.curve.opts['pen'] == pen pdi.setShadowPen(pen2) assert pdi.curve.opts['shadowPen'] == pen2 pdi.setFillLevel( float_value ) assert pdi.curve.opts['fillLevel'] == float_value pdi.setFillBrush(brush2) assert pdi.curve.opts['brush'] == brush2 pdi.setSymbol('t') assert pdi.scatter.opts['symbol'] == 't' pdi.setSymbolPen(pen) assert pdi.scatter.opts['pen'] == pen pdi.setSymbolBrush(brush) assert pdi.scatter.opts['brush'] == brush pdi.setSymbolSize( float_value ) assert pdi.scatter.opts['size'] == float_value def test_clear(): y = list(np.random.normal(size=100)) x = np.linspace(5, 10, 100) pdi = pg.PlotDataItem(x, y) pdi.clear() assert pdi.xData is None assert pdi.yData is None def test_clear_in_step_mode(): w = pg.PlotWidget() c = pg.PlotDataItem([1,4,2,3], [5,7,6], stepMode="center") w.addItem(c) c.clear() def test_clipping(): y = np.random.normal(size=150) x = np.exp2(np.linspace(5, 10, 150)) # non-uniform spacing w = pg.PlotWidget(autoRange=True, downsample=5) c = pg.PlotDataItem(x, y) w.addItem(c) c.setClipToView(True) for x_min in range(-200, 2**10 - 100, 100): x_max = x_min + 100 w.setXRange(x_min, x_max, padding=0) xDisp, _ = c.getData() # vr = c.viewRect() if len(xDisp) > 3: # check that all points except the first and last are on screen assert( xDisp[ 1] >= x_min and xDisp[ 1] <= x_max ) assert( xDisp[-2] >= x_min and xDisp[-2] <= x_max ) c.setDownsampling(ds=1) # disable downsampling for x_min in range(-200, 2**10 - 100, 100): x_max = x_min + 100 w.setXRange(x_min, x_max, padding=0) xDisp, _ = c.getData() # vr = c.viewRect() # this tends to be out of data, so we check against the range that we set if len(xDisp) > 3: # check that all points except the first and last are on screen assert( xDisp[ 0] == x[ 0] or xDisp[ 0] < x_min ) # first point should be unchanged, or off-screen assert( xDisp[ 1] >= x_min and xDisp[ 1] <= x_max ) assert( xDisp[-2] >= x_min and xDisp[-2] <= x_max ) assert( xDisp[-1] == x[-1] or xDisp[-1] > x_max ) # last point should be unchanged, or off-screen c.setData(x=np.zeros_like(y), y=y) # test zero width data set: # test center and expected number of remaining data points for center, num in ((-100.,1), (100.,1), (0.,len(y)) ): # when all elements are off-screen, only one will be kept # when all elelemts are on-screen, all should be kept # and the code should not crash for zero separation w.setXRange( center-50, center+50, padding=0 ) xDisp, yDisp = c.getData() assert len(xDisp) == num assert len(yDisp) == num w.close() pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_ROI.py000066400000000000000000000276721457240071200236610ustar00rootroot00000000000000import math import platform import numpy as np import pytest from packaging.version import Version, parse import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui, QtTest from tests.image_testing import assertImageApproved from tests.ui_testing import mouseClick, mouseDrag, mouseMove, resizeWindow app = pg.mkQApp() pg.setConfigOption("mouseRateLimit", 0) def test_getArrayRegion(transpose=False): pr = pg.PolyLineROI([[0, 0], [27, 0], [0, 28]], closed=True) pr.setPos(1, 1) rois = [ (pg.ROI([1, 1], [27, 28], pen='y'), 'baseroi'), (pg.RectROI([1, 1], [27, 28], pen='y'), 'rectroi'), (pg.EllipseROI([1, 1], [27, 28], pen='y'), 'ellipseroi'), (pr, 'polylineroi'), ] for roi, name in rois: # For some ROIs, resize should not be used. testResize = not isinstance(roi, pg.PolyLineROI) origMode = pg.getConfigOption('imageAxisOrder') try: if transpose: pg.setConfigOptions(imageAxisOrder='row-major') check_getArrayRegion(roi, 'roi/' + name, testResize, transpose=True) else: pg.setConfigOptions(imageAxisOrder='col-major') check_getArrayRegion(roi, 'roi/' + name, testResize) finally: pg.setConfigOptions(imageAxisOrder=origMode) def test_getArrayRegion_axisorder(): test_getArrayRegion(transpose=True) def check_getArrayRegion(roi, name, testResize=True, transpose=False): # on windows, edges corner pixels seem to be slightly different from # other platforms giving a pxCount=2 for a fudge factor if (isinstance(roi, (pg.ROI, pg.RectROI)) and platform.system() == "Windows"): pxCount = 2 else: pxCount = -1 initState = roi.getState() win = pg.GraphicsView() win.show() resizeWindow(win, 200, 400) # Don't use Qt's layouts for testing--these generate unpredictable results. # Instead, place the viewboxes manually vb1 = pg.ViewBox() win.scene().addItem(vb1) vb1.setPos(6, 6) vb1.resize(188, 191) vb2 = pg.ViewBox() win.scene().addItem(vb2) vb2.setPos(6, 203) vb2.resize(188, 191) img1 = pg.ImageItem(border='w') img2 = pg.ImageItem(border='w') vb1.addItem(img1) vb2.addItem(img2) np.random.seed(0) data = np.random.normal(size=(7, 30, 31, 5)) data[0, :, :, :] += 10 data[:, 1, :, :] += 10 data[:, :, 2, :] += 10 data[:, :, :, 3] += 10 if transpose: data = data.transpose(0, 2, 1, 3) img1.setImage(data[0, ..., 0]) vb1.setAspectLocked() vb1.enableAutoRange(True, True) roi.setZValue(10) vb1.addItem(roi) if isinstance(roi, pg.RectROI): if transpose: assert roi.getAffineSliceParams(data, img1, axes=(1, 2)) == ( [28.0, 27.0], ((1.0, 0.0), (0.0, 1.0)), (1.0, 1.0)) else: assert roi.getAffineSliceParams(data, img1, axes=(1, 2)) == ( [27.0, 28.0], ((1.0, 0.0), (0.0, 1.0)), (1.0, 1.0)) rgn = roi.getArrayRegion(data, img1, axes=(1, 2)) # assert np.all((rgn == data[:, 1:-2, 1:-2, :]) | (rgn == 0)) img2.setImage(rgn[0, ..., 0]) vb2.setAspectLocked() vb2.enableAutoRange(True, True) app.processEvents() assertImageApproved(win, name + '/roi_getarrayregion', 'Simple ROI region selection.', pxCount=pxCount) with pytest.raises(TypeError): roi.setPos(0, False) roi.setPos([0.5, 1.5]) rgn = roi.getArrayRegion(data, img1, axes=(1, 2)) img2.setImage(rgn[0, ..., 0]) app.processEvents() assertImageApproved(win, name + '/roi_getarrayregion_halfpx', 'Simple ROI region selection, 0.5 pixel shift.', pxCount=pxCount) roi.setAngle(45) roi.setPos([3, 0]) rgn = roi.getArrayRegion(data, img1, axes=(1, 2)) img2.setImage(rgn[0, ..., 0]) app.processEvents() assertImageApproved(win, name + '/roi_getarrayregion_rotate', 'Simple ROI region selection, rotation.', pxCount=pxCount) if testResize: roi.setSize([60, 60]) rgn = roi.getArrayRegion(data, img1, axes=(1, 2)) img2.setImage(rgn[0, ..., 0]) app.processEvents() assertImageApproved(win, name + '/roi_getarrayregion_resize', 'Simple ROI region selection, resized.', pxCount=pxCount) img1.setPos(0, img1.height()) img1.setTransform(QtGui.QTransform().scale(1, -1).rotate(20), True) rgn = roi.getArrayRegion(data, img1, axes=(1, 2)) img2.setImage(rgn[0, ..., 0]) app.processEvents() assertImageApproved(win, name + '/roi_getarrayregion_img_trans', 'Simple ROI region selection, image transformed.', pxCount=pxCount) vb1.invertY() rgn = roi.getArrayRegion(data, img1, axes=(1, 2)) img2.setImage(rgn[0, ..., 0]) app.processEvents() assertImageApproved(win, name + '/roi_getarrayregion_inverty', 'Simple ROI region selection, view inverted.', pxCount=pxCount) roi.setState(initState) img1.setPos(0, 0) img1.setTransform(QtGui.QTransform.fromScale(1, 0.5)) rgn = roi.getArrayRegion(data, img1, axes=(1, 2)) img2.setImage(rgn[0, ..., 0]) app.processEvents() assertImageApproved( win, name + '/roi_getarrayregion_anisotropic', 'Simple ROI region selection, image scaled anisotropically.', pxCount=pxCount) # allow the roi to be re-used roi.scene().removeItem(roi) win.hide() def test_mouseClickEvent(): plt = pg.GraphicsView() plt.show() resizeWindow(plt, 200, 200) vb = pg.ViewBox() plt.scene().addItem(vb) vb.resize(200, 200) QtTest.QTest.qWaitForWindowExposed(plt) QtTest.QTest.qWait(100) roi = pg.RectROI((0, 0), (10, 20), removable=True) vb.addItem(roi) app.processEvents() mouseClick(plt, roi.mapToScene(pg.Point(2, 2)), QtCore.Qt.MouseButton.LeftButton) def test_mouseDragEventSnap(): plt = pg.GraphicsView() plt.show() resizeWindow(plt, 200, 200) vb = pg.ViewBox() plt.scene().addItem(vb) vb.resize(200, 200) QtTest.QTest.qWaitForWindowExposed(plt) QtTest.QTest.qWait(100) # A Rectangular roi with scaleSnap enabled initial_x = 20 initial_y = 20 roi = pg.RectROI((initial_x, initial_y), (20, 20), scaleSnap=True, translateSnap=True, snapSize=1.0, movable=True) vb.addItem(roi) app.processEvents() # Snap size roundtrip assert roi.snapSize == 1.0 roi.snapSize = 0.2 assert roi.snapSize == 0.2 roi.snapSize = 1.0 assert roi.snapSize == 1.0 # Snap position check snapped = roi.getSnapPosition(pg.Point(2.5, 3.5), snap=True) assert snapped == pg.Point(2.0, 4.0) # Only drag in y direction roi_position = roi.mapToView(pg.Point(initial_x, initial_y)) mouseDrag(plt, roi_position, roi_position + pg.Point(0, 10), QtCore.Qt.MouseButton.LeftButton) assert roi.pos() == pg.Point(initial_x, 19) mouseDrag(plt, roi_position, roi_position + pg.Point(0, 10), QtCore.Qt.MouseButton.LeftButton) assert roi.pos() == pg.Point(initial_x, 18) # Only drag in x direction mouseDrag(plt, roi_position, roi_position + pg.Point(10, 0), QtCore.Qt.MouseButton.LeftButton) assert roi.pos() == pg.Point(21, 18) def test_PolyLineROI(): rois = [ (pg.PolyLineROI([[0, 0], [10, 0], [0, 15]], closed=True, pen=0.3), 'closed'), (pg.PolyLineROI([[0, 0], [10, 0], [0, 15]], closed=False, pen=0.3), 'open') ] plt = pg.GraphicsView() plt.show() resizeWindow(plt, 200, 200) vb = pg.ViewBox() plt.scene().addItem(vb) vb.resize(200, 200) # plt.plotItem = pg.PlotItem() # plt.scene().addItem(plt.plotItem) # plt.plotItem.resize(200, 200) plt.scene().minDragTime = 0 # let us simulate mouse drags very quickly. # seemingly arbitrary requirements; might need longer wait time for some # platforms.. QtTest.QTest.qWaitForWindowExposed(plt) QtTest.QTest.qWait(100) for r, name in rois: vb.clear() vb.addItem(r) vb.autoRange() app.processEvents() assertImageApproved(plt, 'roi/polylineroi/' + name + '_init', 'Init %s polyline.' % name) initState = r.getState() assert len(r.getState()['points']) == 3 # hover over center center = r.mapToScene(pg.Point(3, 3)) mouseMove(plt, center) assertImageApproved(plt, 'roi/polylineroi/' + name + '_hover_roi', 'Hover mouse over center of ROI.') # drag ROI mouseDrag(plt, center, center + pg.Point(10, -10), QtCore.Qt.MouseButton.LeftButton) assertImageApproved(plt, 'roi/polylineroi/' + name + '_drag_roi', 'Drag mouse over center of ROI.') # hover over handle pt = r.mapToScene(pg.Point(r.getState()['points'][2])) mouseMove(plt, pt) assertImageApproved(plt, 'roi/polylineroi/' + name + '_hover_handle', 'Hover mouse over handle.') # drag handle mouseDrag(plt, pt, pt + pg.Point(5, 20), QtCore.Qt.MouseButton.LeftButton) assertImageApproved(plt, 'roi/polylineroi/' + name + '_drag_handle', 'Drag mouse over handle.') # hover over segment pt = r.mapToScene((pg.Point(r.getState()['points'][2]) + pg.Point( r.getState()['points'][1])) * 0.5) mouseMove(plt, pt + pg.Point(0, 2)) assertImageApproved(plt, 'roi/polylineroi/' + name + '_hover_segment', 'Hover mouse over diagonal segment.') # click segment mouseClick(plt, pt, QtCore.Qt.MouseButton.LeftButton) assertImageApproved(plt, 'roi/polylineroi/' + name + '_click_segment', 'Click mouse over segment.') # drag new handle mouseMove(plt, pt + pg.Point(10, -10)) # pg bug: have to move the mouse off/on again to register hover mouseDrag(plt, pt, pt + pg.Point(10, -10), QtCore.Qt.MouseButton.LeftButton) assertImageApproved(plt, 'roi/polylineroi/' + name + '_drag_new_handle', 'Drag mouse over created handle.') # clear all points r.clearPoints() assertImageApproved(plt, 'roi/polylineroi/' + name + '_clear', 'All points cleared.') assert len(r.getState()['points']) == 0 # call setPoints r.setPoints(initState['points']) assertImageApproved( plt, f'roi/polylineroi/{name}_setpoints', 'Reset points to initial state.', pxCount=1 if platform.system() == "Darwin" and parse(platform.mac_ver()[0]) >= Version("13.0") else 0 ) assert len(r.getState()['points']) == 3 # call setState r.setState(initState) assertImageApproved(plt, 'roi/polylineroi/' + name + '_setstate', 'Reset ROI to initial state.') assert len(r.getState()['points']) == 3 plt.hide() @pytest.mark.parametrize("p1,p2", [ ((1, 1), (2, 5)), ((0.1, 0.1), (-1, 5)), ((3, -1), (5, -6)), ((-2, 1), (-4, -8)), ]) def test_LineROI_coords(p1, p2): pw = pg.PlotWidget() pw.show() lineroi = pg.LineROI(p1, p2, width=0.5, pen="r") pw.addItem(lineroi) # first two handles are the scale-rotate handles positioned by pos1, pos2 for expected, (name, scenepos) in zip([p1, p2], lineroi.getSceneHandlePositions()): got = lineroi.mapSceneToParent(scenepos) assert math.isclose(got.x(), expected[0]) assert math.isclose(got.y(), expected[1]) pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_ScatterPlotItem.py000066400000000000000000000061011457240071200262730ustar00rootroot00000000000000import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui def test_scatterplotitem(): app = pg.mkQApp() plot = pg.PlotWidget() # set view range equal to its bounding rect. # This causes plots to look the same regardless of pxMode. plot.setRange(rect=plot.boundingRect()) # test SymbolAtlas accepts custom symbol s = pg.ScatterPlotItem(name="Scatter") symbol = QtGui.QPainterPath() symbol.addEllipse(QtCore.QRectF(-0.5, -0.5, 1, 1)) s.addPoints([{'pos': [0, 0], 'data': 1, 'symbol': symbol}]) assert s.name() == "Scatter" for i, pxMode in enumerate([True, False]): for j, useCache in enumerate([True, False]): s = pg.ScatterPlotItem() s.opts['useCache'] = useCache plot.addItem(s) s.setData(x=np.array([10, 40, 20, 30]) + i * 100, y=np.array([40, 60, 10, 30]) + j * 100, pxMode=pxMode, name="MoreScatter") s.addPoints(x=np.array([60, 70]) + i * 100, y=np.array([60, 70]) + j * 100, size=[20, 30]) assert s.name() == "MoreScatter" # Test uniform spot updates s.setSize(10) s.setBrush('r') s.setPen('g') s.setSymbol('+') app.processEvents() # Test list spot updates s.setSize([10] * 6) s.setBrush([pg.mkBrush('r')] * 6) s.setPen([pg.mkPen('g')] * 6) s.setSymbol(['+'] * 6) s.setPointData([s] * 6) app.processEvents() # Test array spot updates s.setSize(np.array([10] * 6)) s.setBrush(np.array([pg.mkBrush('r')] * 6)) s.setPen(np.array([pg.mkPen('g')] * 6)) s.setSymbol(np.array(['+'] * 6)) s.setPointData(np.array([s] * 6)) app.processEvents() # Test per-spot updates spot = s.points()[0] spot.setSize(20) spot.setBrush('b') spot.setPen('g') spot.setSymbol('o') spot.setData(None) app.processEvents() plot.close() def test_init_spots(): app = pg.mkQApp() plot = pg.PlotWidget() # set view range equal to its bounding rect. # This causes plots to look the same regardless of pxMode. plot.setRange(rect=plot.boundingRect()) spots = [ {'x': 0, 'y': 1}, {'pos': (1, 2), 'pen': None, 'brush': None, 'data': 'zzz'}, ] s = pg.ScatterPlotItem(spots=spots) # Check we can display without errors plot.addItem(s) app.processEvents() plot.clear() # check data is correct spots = s.points() defPen = pg.mkPen(pg.getConfigOption('foreground')) assert spots[0].pos().x() == 0 assert spots[0].pos().y() == 1 assert spots[0].pen() == defPen assert spots[0].data() is None assert spots[1].pos().x() == 1 assert spots[1].pos().y() == 2 assert spots[1].pen() == pg.mkPen(None) assert spots[1].brush() == pg.mkBrush(None) assert spots[1].data() == 'zzz' plot.close() pyqtgraph-pyqtgraph-0.13.4/tests/graphicsItems/test_TextItem.py000066400000000000000000000006271457240071200247620ustar00rootroot00000000000000import pyqtgraph as pg app = pg.mkQApp() def test_TextItem_setAngle(): plt = pg.PlotWidget() plt.show() plt.setXRange(-10, 10) plt.setYRange(-20, 20) item = pg.TextItem(text="test") plt.addItem(item) t1 = item.transform() item.setAngle(30) app.processEvents() t2 = item.transform() assert t1 != t2 assert not t1.isRotating() assert t2.isRotating() pyqtgraph-pyqtgraph-0.13.4/tests/image_testing.py000066400000000000000000000366531457240071200222050ustar00rootroot00000000000000# Image-based testing borrowed from vispy """ Procedure for unit-testing with images: Run individual test scripts with the PYQTGRAPH_AUDIT environment variable set: $ PYQTGRAPH_AUDIT=1 python pyqtgraph/graphicsItems/tests/test_PlotCurveItem.py Any failing tests will display the test results, standard image, and the differences between the two. If the test result is bad, then press (f)ail. If the test result is good, then press (p)ass and the new image will be saved to the test-data directory. To check all test results regardless of whether the test failed, set the environment variable PYQTGRAPH_AUDIT_ALL=1. """ import inspect import os import sys import time from pathlib import Path import numpy as np from pyqtgraph import GraphicsLayoutWidget, ImageItem, TextItem from pyqtgraph import functions as fn from pyqtgraph.Qt import QtCore, QtGui, QtWidgets tester = None # Convenient stamp used for ensuring image orientation is correct axisImg = [ " 1 1 1 ", " 1 1 1 1 1 1 ", " 1 1 1 1 1 1 1 1 1 1", " 1 1 1 1 1 ", " 1 1 1 1 1 1 ", " 1 1 ", " 1 1 ", " 1 ", " ", " 1 ", " 1 ", " 1 ", "1 1 1 1 1 ", "1 1 1 1 1 ", " 1 1 1 ", " 1 1 1 ", " 1 ", " 1 ", ] axisImg = np.array([map(int, row[::2].replace(' ', '0')) for row in axisImg]) def getTester(): global tester if tester is None: tester = ImageTester() return tester def getImageFromWidget(widget): # just to be sure the widget size is correct (new window may be resized): QtWidgets.QApplication.processEvents() qimg = QtGui.QImage(widget.size(), QtGui.QImage.Format.Format_ARGB32) qimg.fill(QtCore.Qt.GlobalColor.transparent) painter = QtGui.QPainter(qimg) widget.render(painter) painter.end() qimg = qimg.convertToFormat(QtGui.QImage.Format.Format_RGBA8888) return fn.ndarray_from_qimage(qimg).copy() def assertImageApproved(image, standardFile, message=None, **kwargs): """Check that an image test result matches a pre-approved standard. If the result does not match, then the user can optionally invoke a GUI to compare the images and decide whether to fail the test or save the new image as the standard. Run the test with the environment variable PYQTGRAPH_AUDIT=1 to bring up the auditing GUI. Parameters ---------- image : (h, w, 4) ndarray standardFile : str The name of the approved test image to check against. This file name is relative to the root of the pyqtgraph test-data repository and will be automatically fetched. message : str A string description of the image. It is recommended to describe specific features that an auditor should look for when deciding whether to fail a test. Extra keyword arguments are used to set the thresholds for automatic image comparison (see ``assertImageMatch()``). """ if isinstance(image, QtWidgets.QWidget): # just to be sure the widget size is correct (new window may be resized): QtWidgets.QApplication.processEvents() graphstate = scenegraphState(image, standardFile) image = getImageFromWidget(image) if message is None: code = inspect.currentframe().f_back.f_code message = "%s::%s" % (code.co_filename, code.co_name) # Make sure we have a test data repo available dataPath = getTestDataDirectory() # Read the standard image if it exists stdFileName = os.path.join(dataPath, standardFile + '.png') if not os.path.isfile(stdFileName): stdImage = None else: qimg = QtGui.QImage(stdFileName) qimg = qimg.convertToFormat(QtGui.QImage.Format.Format_RGBA8888) stdImage = fn.ndarray_from_qimage(qimg).copy() del qimg # If the test image does not match, then we go to audit if requested. try: if stdImage is None: raise Exception("No reference image saved for this test.") if image.shape[2] != stdImage.shape[2]: raise Exception("Test result has different channel count than standard image" "(%d vs %d)" % (image.shape[2], stdImage.shape[2])) if image.shape != stdImage.shape: # Allow im1 to be an integer multiple larger than im2 to account # for high-resolution displays ims1 = np.array(image.shape).astype(float) ims2 = np.array(stdImage.shape).astype(float) sr = ims1 / ims2 if ims1[0] > ims2[0] else ims2 / ims1 if (sr[0] != sr[1] or not np.allclose(sr, np.round(sr)) or sr[0] < 1): raise TypeError("Test result shape %s is not an integer factor" " different than standard image shape %s." % (ims1, ims2)) sr = np.round(sr).astype(int) image = fn.downsample(image, sr[0], axis=(0, 1)).astype(image.dtype) assertImageMatch(image, stdImage, **kwargs) if bool(os.getenv('PYQTGRAPH_PRINT_TEST_STATE', False)): print(graphstate) if os.getenv('PYQTGRAPH_AUDIT_ALL') == '1': raise Exception("Image test passed, but auditing due to PYQTGRAPH_AUDIT_ALL evnironment variable.") except Exception: if os.getenv('PYQTGRAPH_AUDIT') == '1' or os.getenv('PYQTGRAPH_AUDIT_ALL') == '1': sys.excepthook(*sys.exc_info()) getTester().test(image, stdImage, message) stdPath = os.path.dirname(stdFileName) print('Saving new standard image to "%s"' % stdFileName) if not os.path.isdir(stdPath): os.makedirs(stdPath) qimg = fn.ndarray_to_qimage(image, QtGui.QImage.Format.Format_RGBA8888) qimg.save(stdFileName) del qimg else: if stdImage is None: raise Exception("Test standard %s does not exist. Set " "PYQTGRAPH_AUDIT=1 to add this image." % stdFileName) if os.getenv('CI') is not None: standardFile = os.path.join(os.getenv("SCREENSHOT_DIR", "screenshots"), standardFile) saveFailedTest(image, stdImage, standardFile) print(graphstate) raise def assertImageMatch(im1, im2, minCorr=None, pxThreshold=50., pxCount=-1, maxPxDiff=None, avgPxDiff=None, imgDiff=None): """Check that two images match. Images that differ in shape or dtype will fail unconditionally. Further tests for similarity depend on the arguments supplied. By default, images may have no pixels that gave a value difference greater than 50. Parameters ---------- im1 : (h, w, 4) ndarray Test output image im2 : (h, w, 4) ndarray Test standard image minCorr : float or None Minimum allowed correlation coefficient between corresponding image values (see numpy.corrcoef) pxThreshold : float Minimum value difference at which two pixels are considered different pxCount : int or None Maximum number of pixels that may differ. Default is 0, on Windows some tests have a value of 2. maxPxDiff : float or None Maximum allowed difference between pixels avgPxDiff : float or None Average allowed difference between pixels imgDiff : float or None Maximum allowed summed difference between images """ assert im1.ndim == 3 assert im1.shape[2] == 4 assert im1.dtype == im2.dtype if pxCount == -1: pxCount = 0 diff = im1.astype(float) - im2.astype(float) if imgDiff is not None: assert np.abs(diff).sum() <= imgDiff pxdiff = diff.max(axis=2) # largest value difference per pixel mask = np.abs(pxdiff) >= pxThreshold if pxCount is not None: assert mask.sum() <= pxCount maskedDiff = diff[mask] if maxPxDiff is not None and maskedDiff.size > 0: assert maskedDiff.max() <= maxPxDiff if avgPxDiff is not None and maskedDiff.size > 0: assert maskedDiff.mean() <= avgPxDiff if minCorr is not None: with np.errstate(invalid='ignore'): corr = np.corrcoef(im1.ravel(), im2.ravel())[0, 1] assert corr >= minCorr def saveFailedTest(data, expect, filename): # concatenate data, expect, and diff into a single image ds = data.shape es = expect.shape shape = (max(ds[0], es[0]) + 4, ds[1] + es[1] + 8 + max(ds[1], es[1]), 4) img = np.empty(shape, dtype=np.ubyte) img[..., :3] = 100 img[..., 3] = 255 img[2:2+ds[0], 2:2+ds[1], :ds[2]] = data img[2:2+es[0], ds[1]+4:ds[1]+4+es[1], :es[2]] = expect diff = makeDiffImage(data, expect) img[2:2+diff.shape[0], -diff.shape[1]-2:-2] = diff png = makePng(data) # change `img` to `data` to save just the failed image directory = os.path.dirname(filename) if not os.path.isdir(directory): os.makedirs(directory) with open(filename + ".png", "wb") as png_file: png_file.write(png) print("\nImage comparison failed. Test result: %s %s Expected result: " "%s %s" % (data.shape, data.dtype, expect.shape, expect.dtype)) def makePng(img): """Given an array like (H, W, 4), return a PNG-encoded byte string. """ io = QtCore.QBuffer() qim = fn.ndarray_to_qimage(img, QtGui.QImage.Format.Format_RGBX8888) qim.save(io, 'PNG') return bytes(io.data().data()) def makeDiffImage(im1, im2): """Return image array showing the differences between im1 and im2. Handles images of different shape. Alpha channels are not compared. """ ds = im1.shape es = im2.shape diff = np.empty((max(ds[0], es[0]), max(ds[1], es[1]), 4), dtype=int) diff[..., :3] = 128 diff[..., 3] = 255 diff[:ds[0], :ds[1], :min(ds[2], 3)] += im1[..., :3] diff[:es[0], :es[1], :min(es[2], 3)] -= im2[..., :3] diff = np.clip(diff, 0, 255).astype(np.ubyte) return diff class ImageTester(QtWidgets.QWidget): """Graphical interface for auditing image comparison tests. """ def __init__(self): self.lastKey = None QtWidgets.QWidget.__init__(self) self.resize(1200, 800) #self.showFullScreen() self.layout = QtWidgets.QGridLayout() self.setLayout(self.layout) self.view = GraphicsLayoutWidget() self.layout.addWidget(self.view, 0, 0, 1, 2) self.label = QtWidgets.QLabel() self.layout.addWidget(self.label, 1, 0, 1, 2) self.label.setWordWrap(True) font = QtGui.QFont("monospace", 14, QtGui.QFont.Weight.Bold) self.label.setFont(font) self.passBtn = QtWidgets.QPushButton('Pass') self.failBtn = QtWidgets.QPushButton('Fail') self.layout.addWidget(self.passBtn, 2, 0) self.layout.addWidget(self.failBtn, 2, 1) self.passBtn.clicked.connect(self.passTest) self.failBtn.clicked.connect(self.failTest) self.views = (self.view.addViewBox(row=0, col=0), self.view.addViewBox(row=0, col=1), self.view.addViewBox(row=0, col=2)) labelText = ['test output', 'standard', 'diff'] for i, v in enumerate(self.views): v.setAspectLocked(1) v.invertY() v.image = ImageItem(axisOrder='row-major') v.image.setAutoDownsample(True) v.addItem(v.image) v.label = TextItem(labelText[i]) v.setBackgroundColor(0.5) self.views[1].setXLink(self.views[0]) self.views[1].setYLink(self.views[0]) self.views[2].setXLink(self.views[0]) self.views[2].setYLink(self.views[0]) def test(self, im1, im2, message): """Ask the user to decide whether an image test passes or fails. This method displays the test image, reference image, and the difference between the two. It then blocks until the user selects the test output by clicking a pass/fail button or typing p/f. If the user fails the test, then an exception is raised. """ self.show() if im2 is None: message += '\nImage1: %s %s Image2: [no standard]' % (im1.shape, im1.dtype) im2 = np.zeros((1, 1, 3), dtype=np.ubyte) else: message += '\nImage1: %s %s Image2: %s %s' % (im1.shape, im1.dtype, im2.shape, im2.dtype) self.label.setText(message) self.views[0].image.setImage(im1) self.views[1].image.setImage(im2) diff = makeDiffImage(im1, im2) self.views[2].image.setImage(diff) self.views[0].autoRange() while True: QtWidgets.QApplication.processEvents() lastKey = self.lastKey self.lastKey = None if lastKey in ('f', 'esc') or not self.isVisible(): raise Exception("User rejected test result.") elif lastKey == 'p': break time.sleep(0.03) for v in self.views: v.image.setImage(np.zeros((1, 1, 3), dtype=np.ubyte)) def keyPressEvent(self, event): if event.key() == QtCore.Qt.Key.Key_Escape: self.lastKey = 'esc' else: self.lastKey = str(event.text()).lower() def passTest(self): self.lastKey = 'p' def failTest(self): self.lastKey = 'f' def getTestDataDirectory(): dataPath = Path(__file__).absolute().parent / "images" return dataPath.as_posix() def scenegraphState(view, name): """Return information about the scenegraph for debugging test failures. """ state = "====== Scenegraph state for %s ======\n" % name state += "view size: %dx%d\n" % (view.width(), view.height()) state += "view transform:\n" + indent(transformStr(view.transform()), " ") for item in view.scene().items(): if item.parentItem() is None: state += itemState(item) + '\n' return state def itemState(root): state = str(root) + '\n' from pyqtgraph import ViewBox state += 'bounding rect: ' + str(root.boundingRect()) + '\n' if isinstance(root, ViewBox): state += "view range: " + str(root.viewRange()) + '\n' state += "transform:\n" + indent(transformStr(root.transform()).strip(), " ") + '\n' for item in root.childItems(): state += indent(itemState(item).strip(), " ") + '\n' return state def transformStr(t): return ("[%0.2f %0.2f %0.2f]\n"*3) % (t.m11(), t.m12(), t.m13(), t.m21(), t.m22(), t.m23(), t.m31(), t.m32(), t.m33()) def indent(s, pfx): return '\n'.join(pfx+line for line in s.split('\n')) class TransposedImageItem(ImageItem): # used for testing image axis order; we can test row-major and col-major using # the same test images def __init__(self, *args, **kwds): self.__transpose = kwds.pop('transpose', False) ImageItem.__init__(self, *args, **kwds) def setImage(self, image=None, **kwds): if image is not None and self.__transpose is True: image = np.swapaxes(image, 0, 1) return ImageItem.setImage(self, image, **kwds) pyqtgraph-pyqtgraph-0.13.4/tests/images/000077500000000000000000000000001457240071200202445ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/000077500000000000000000000000001457240071200222055ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/bool.png000066400000000000000000000011561457240071200236510ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ IDATxœíÔAn!AùÞ ''G‹´&W­¿Ð[´x½€O4NŽæœõd­õãÍûßú÷öÞwO¸ßu]'g_ñ >”°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H¼ïöÞéŽGcÜ=á~sΓ3? a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘'GsÎz²Öº{ðG}Zªà€ì*™IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/gradient_mono_byte.png000066400000000000000000000012241457240071200265620ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœFIDATxœíÖAŽâ@Aƒ¸wÙ'7+X!¨M†ˆU«Å´)õê/ ðN3cÔ߃Ù¶íåg.óîtsÿùá/g~~Ï?üò¯wÐÿ׺®3µÌ†µïûä'aa‘8ú ð›, a‘ð’°X$„EBX$ÜX$, a‘ 7 ‹EBX$<…$, a‘ 7 ‹EBX$„EÂEÂb‘ O! ‹EBX$„EÂEÂb‘ a‘pc‘°X$„EBX$ÜX$, a‘ð’°X$„EBX$ÜX$, a‘ 7 ‹EBX$<…$, a‘ 7 ‹EBX$„EÂEÂb‘ a‘pc‘°X$„EÂSHÂb‘ a‘pc‘°X$„EBX$ÜX$, a‘ð’°X$„EBX$ÜX$, a‘ 7 ‹EBX$„EÂEÂb‘ O! ‹EBX$„EÂEÂb‘ a‘pc‘°X$„EÂSHÂb‘ a‘pc‘°X$„EBX$ÜX$, a‘ 7 ‹EBX$<…$, a‘ 7 ‹EBX$„EÂEÂb‘ O! ‹EBX$„EÂEÂb‘ a‘pc‘°X$„EBX$ÜX$, a‘ð’°X$„EBX$ÜX$, a‘ 7 ‹EBX$<…$, a‘ 7 ‹EBX$„EÂEÂb‘ O! ‹EBX$„Eb6¬1Fú=8ûÇ ±æ+§(ÈXçË<ö{ŽÓ‰ã2qž7¿ÀÏÍŒUTƒe÷ÜæV©F|Iñ‡ÕðÍ™÷S$Ö¬€¡b”B¡,cÊç ìnÞ¡Ä{XªåYay÷Ó¿Ä›lÚǺ¼‹T±<„@ƒ4ª¶Šˆãrž–}¬M®œË*5©€múX˜\ÿÊ•+(ìgx,¡AKa{Í(Îb3"R(<Ôö±³J"o®æ5wÞH)(…ÂýéÎ|F±g…¢ÜŸ§ý±‘ç(b•†‹oTmÏ —Œ<6#ë~ŠÄ{fâKðXÂÇf4+àòâ{ð`©c3sY¥yK¼‡²˼’ì£)“‰ï‰Sà± „¨>Ö9(»çÖÇ•ø<ƒûXžú»Ÿ"ñž%þJ!„0MƒÔ âÁ‡ˆ=¬ÖǪ_a÷]â=ìÛÇ2# ¸ŸþûÙ!l:WX´ËÏA‘¤« NÁø×â­“¸-š‡ñ/ÑOâ?Z/ÁcAÌÖŠÇÖÖ¸ÿí^<`ük˜¸aÕ6#Ý~͘0þ•‹¯—‰ÏÁÊ”!0þ•Œï,v®ñ/!«4W‰ÏC)„¦96#+Þ³Ä_²Ú±Ä­Ä÷*àAñ‡åùŸRAe1™8?ÅðXB`ƒÔŒÌ¸A)ñù¸‰Dë”}ŽÓ‰ãJ|ž™úXž°Jù»h%¾!¬ÙÇr®€Uº'ö°u«óå†Wí"qf?{ BûÎír3¢i«û ƿ컸->57R+q Æ¿tíx7$ B`®P7%4it®€ŒÕŠ'ª­E—»Wÿ&•‰ÍHÍ<„À\a.¾s‰7ƒþÊ(qlFA¬Y.õÅ)f:6£)Þ6çÁcA÷3ÖY3ÝžÛÁ*u®€=úXfpø£Aœß«€”BA¨AZ¿Â\|ÞïaÊ>–™Î*iVÀRqŠÅûXç ìš.çÁcA4Hk['óZ¥ñ%kŽʼn/ï"\Iìaëñ/Í("Îì:x,ñ¯ïÈcDJ0ƒ ¿©ýÓ„ñ/û.:ˆ›×Ö†—«üª”B‚¹ÂÕÄf$"÷çaük©nHQÕ>ë+àã_µb‘DÕ³uâ!›ÙMeóÄÀBñöæJFŒÕÚ»y­Ò=qÔ‡…ÉÍßÅOñ9(²7‚|ÕOðXs…ãÅž¤ …Æ¿¾#™7—;W輟Mÿ²ï¢ƒxl lu¹x,ñ¯ÅÅùªmFü+d`ükßnHMëäJ!„ wKÁV‰5+`¨ØÃ¬ÇfÏ[â=¬lfy÷3<›à± „ R3¢°çŠÄšåR_œ¢_Ë *<Jü=qÅ>–þu’k‘¸s¢:ÀcAs÷±ÎAÍr9£ø^<Ø¢åYa%÷Óy?›ÐÇú+nçr?Å)ðXã_Éøö..÷çaü+öÍ™«T#¾„R!0W¨’ÎAÍ í„ñ¯ÉÄž¢÷³Æ¿¾#µ2±s…ú‡i‚Ç‚˜+´ï¢ƒX$sW®‚ñ¯ÅÅ Kü9˜AñØÌp÷S$Þ3_‚Ç‚æ>6£ Ö¬€¡b-ûXžÿIäÑ(ˆç-ñ(…€©g© J‰Ï‹M¤ûXΰJÅ)Vècu¾ÜðäZ$ŽËÄyðXÂ^ R3‚Uº!¾„>–-> È~ö°Åø×X{§ó;´Hì¿e<„À\a.Ú:Iº•âŒ%ã²µµèrq[4ã_ºo®É/Ü -z  B`ükÊnÈØÖ‰Æ¿ÿ7#æ®ó@)„˜+üŽ<(ñ黸)ö }lFä9Râóq“ŽÍ ÎÄã2q<„°×±¬R+ñ%ûXžÿIäÑ`•n‹= ëcƒ²Ï‘Lü+è!¨÷±<+Lj•–)ñ&ëô±œ+ ¯€‹‰SP !„í¤Í/7¯¯ç¡%z’N¼r ã_ Äç HzÚÏðXs…ýÄfd¸UªÏÐ&Œåâ"oNgoø+#ã_ɸ¾Ø³BÜ̓ǂ˜+œµRT@Ì`Mî¿„ñ¯Å»!Ík«J!„À\!b;~¯¨›QxŽ”ø_bë›™Î*in°Rq ï‡õññáTÀ¶ü FÃuÞr°nIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/gradient_mono_int_levels.png000066400000000000000000000012361457240071200277660ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœPIDATxœíÖ1rÂ@Aäâß‚—ãœÀ^ƒ‘Ô_]m0u{§pDËäк®õlÈõzýõÌyx×åryjöbXÂW<%,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"!,Â"1 kY–tvæÌ*$áÅz »õްÞê8»UXjë úc‘ðbmÞg~ï„uoÞ­V!÷– / a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘8Ï­ëšÎÀ|Dª->3æPIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/gradient_rgba_byte.png000066400000000000000000000013161457240071200265270ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ€IDATxœí×ÛNADÑøßÃü··'FƒM⎢k=)Hk:UÅ ðVÚ¶­>7dß÷/Ÿ¹[ý¬ó~œ™™ÓÌÌßüðúâéý¯ÇÏ^¼ðöã‡g.|f÷ö•¿è¶NûÿÿÓÌù¼”2«kV„y¹ŽðÍ$ ‰Eb9±ËSðç¨Bª„*$!±HØX$$ ‰EÂx'¡ I¨B‹„EBb‘°±H¨Bª„*$!±HH,‹„o…$T! UHB’X$l,‹„EB’P…$$ ‰EÂx'!±HØX$T! UHB’X$l,‹„EÂÅ"¡ Iï$$ ‹„Ä"ac‘P…$T! UHBb‘°±HH,‹„ñNB’P…$$ ‹„Ä"ac‘p±H¨BÆ; ‰EÂÆ"!±HØX$T! UHB’X$l,‹„Ä"a¼“P…$T! ‰EÂÆâJ‡¥§$ ‹+­]‰EÂÆ"¡ I¨B‹„Ä"a¼“X$l,ª„*$¡ IH,6 ‰EÂÆ"áb‘P…$Œw‹„EBb‘°±H¨Bª„*$!±HØX$$ ‰EÂx'¡ I¨B‹„EBb‘°±H¸X$T! ã„Ä"ac‘X$l,ª„*$¡ IH,6 ‰EBb‘0ÞI¨Bª„Ä"ac‘X$l,ª„*$¡ IH,‹„Ä"á[! UHB’P…$$ ‹„Ä"ac‘P…$T! ‰EBb‘0ÞIH,6 UHB’P…$$ ‹ÄêÅÚ¶-=ÇMxš™™û>Àïõ õÉn¨s&éBIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/gradient_rgba_byte_levels.png000066400000000000000000000012371457240071200301030ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœQIDATxœí×AjÃ@A%1äÙ+=Û&<Á+C£Xª: ³‡ff¼,À}Ì|4ƨßÁÙ¶íé7·ÙßZŸÿÖEüý€c­ëÔ”™ k¹¿þ.èóèpNÓëQ¾‚Ó1±HLO¬ŸòœŽUHÂ*$a’0±H¸±H˜X$L,ŽwV! «„‰EÂEÂÄ"áÆ"a’° IX…$L,& ‹„…$¬BV! «„‰EÂEÂÄ"áÆ"a’° I˜X$L,Žw& 7 «„UHÂ*d§¯©¯L,n,v2±8‹¾§¾ «„ㄉEÂEÂÄ"áÆ"a’° IX…$L,n,& ‹„ã„UHÂ*$ab‘pc‘0±H¸±H‹„UHÂñNÂÄ"áÆ"ab‘pc‘° IX…$¬B& 7 ‹„‰EÂñNÂ*$a’0±H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹Ämò»1FúŽ7²ý€ë¿[:Ñ×52ÊIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/gradient_rgba_float.png000066400000000000000000000013551457240071200266740ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœŸIDATxœíÚÝJQ…Ñ“ã{¾·ý\„a¢u„>J[ë"Â&™â°÷Öøžf.Z×µ¾îÈ~¿ÿöšíìsíö›1ÆËcŒÍÉ'·ÇON¿´ïöú·Ÿ=xö¥‹ÏÙ}ûéƒËçp¹tý¼Û/žóÖßÿÙ•Û1v»©”™=Xã0{!ŒãA„6X/å]ðp$‰éÄz.£ I¨B‹„Ä"a¼“X$$ ã„*$¡ IH,6 ‰EÂÆ"¡ I¨Bª„Ä"!±HH,^’P…$T! UHBb‘°±HH,6 UHB’X$$ ã„Ä"ac‘P…$T! UHBb‘°±HH,6 ‹„*$a¼“X$l,‹„EB’P…$T! ‰EÂÆ"!±HH,Æ; UHB’X$l,‹„EÂÁ"¡ Iï$$ ‹„Ä"ac‘P…$T! UHBb‘°±HH,‹„ñNB’P…$$ ‰Åæ²Hb‘ðªI,~‘Ä"a¼“P…$$ ‰EÂx'!±HØX$T! UHB’X$l,‹„EÂÁ"¡ Iï$$ ‹„Ä"ac‘P…$T! UHBb‘°±HH,‹„ñNB’P…$$ ‹„Ä"ac‘p°H¨BÆ; ‰EÂÆ"!±HØX$T! UHB’X$l,‹„Ä"a¼“P…$T! ‰EÂÆ"!±HØX$T! UHB’X$¦ëPÞGb‘˜N¬×ò.x8Æ; UH¤$$ ‹„Ä"ac‘ðÎ; UHB’X$$ ‰E¤$T! UHB’X$l,³k]×ô>îÂûÿýû«)À5o`n§ ÞŸIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/gradient_rgba_float_additive.png000066400000000000000000000233031457240071200305420ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ IDATxœíÍŽ3Ë‘žŸú!ÙlvkÆ«À€çÌ^÷ Ù´æëø›ã+ѽ°ä#Ú€½öÖ›ñÆ}0àt’Ø¿$«Ê‹ÈÈŠÌJ‹ìæ×­£|ÕYÅúïÌ7"#ߌ‚ŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒŒ?ESvêºîŒSþü9¸R @PÎ(gå ¾¨—üËú«3.Ÿïã‹]èœkýö·ŸÝ miÛx‡ª¢ªf³~ùqÆCóDEñ7G÷©'žký»uñ Kžà €g¶Ýö]°þ~ÜÍ„Šõͧ;`¾˜­+5À€+\yeîþtkàºàП®µ,Î㺛øà!Ö‡~Øï6îï]Á/òw­—€‡·||ÜòùÙ-·[€_þrÍéëÛoï®®–K€ëk·¼¹X­Ê28Ï?ýÓ¸½E–²Ï1übÊNS+ƒKZ®ëtKg’gЗҵýOÑ‹j´°ê÷)ô…¼‘ºßX¹úéjÏË=@uìèIv˜éê b½1êô?t‹ÅÔ³IEHõ‚ z5 CHÅGT½¤$÷y%Êã»ddœŽÉŒ5 H+rÍ’žZQp˜ijž·„Ûbê0Vá©Ëð–g,Y>o\¹¾¨‹þ§™)ðExkœ´˜Æ[óðF=iaxkHZv·q¬VŽ´ÄXÚç5ÈŒ•qLf,\«gJg²Ðs».倷úUý½yîO3–,•·J³ñEKÈIx«*Ü-[Ʋ,¤nê)Kõ*Ë“}ùËU¬l 3.‚3‹T ˜Ñ_^<ë."'à€±KòV/|/=ÂX‘)”‚ 7Ô7uh³Lµ×,Lç­§§“¯òãO»™“Oœ‘1“ë3Ÿ×¬]ÓoÊ •¸Ì³¼"¸øûïîhº'€V–Ït[€V‚*üõ÷±’®(J¢šõËzÁì `¶øöÓ°X±\º¬V !Ào»5pSüP á1¼¥<Ðk¡—Êêßý]¡——^½<Ðk¡—zm Äò@zy ×¢#HËe¯ „^XÆä3I§š+ã"8ÝÇ*ŠÛxŒ…ßR†\ac§Eèfù²È—“±ÓWa«*.{E¨ƒX†‡<ªèœî´úâQÓ7ÑAXxÝéôØé¢Ó‰83ŽEIqÛ¯ÚêåWÅluªƒqÛÑŸ £h×AØ í´bè äÄ~ôòqÓo”êUÎ&~a·þ 5͇ä#¾üIÚ@N©^Ùf\çH½M$ŒI˜Æ "ShyÅ%ìŒ-†¼ÕšÑÄî9Øxt.Æ Tá-±‰_@­5Ä›ðÖ¸<0É['iIûòidÆÊ¸^¡n¥á­"årЪ³Å(cµP΃UÁЗ<­ýKâœÉ¹¢–¾…'bFíxâdù-ñʹ‡t§#¾ü®£w(ÈŒ•q¼VÝ`y« cUxHòÖ]š±‡xË’V: ÉájGŸ+€ªNùX±¼}„/†)¢SÎÒ¾‰~‹ÉŒõ6c…ÎycÞc…3€våjFcNTWñ™™àËûŠ•ìÞ P®\¸!ÒAØAF1‹?úÀCŠÃºu’<ð•šæ£È¦0ã"xE¸Áü²T›ˆ@ÌX²qÌOôÒ«z ‚ìc¼u¸ÁŦPË÷Á*f.†UCÔ7\`Ò"ä­/&œ‚ÌXÁ¹C:‡¢‘R(Ý*¡ÇãÑj ¢]¹U cE½…‰A¤Ã"á–§‡~ãcù¹W ¼u’îÔ‹Ny/™±2.‚7UúY`,¿§å­ê0ˆ:D’1ˆ¤Ö4ºç£Œåcv.ÆGËs–îԎϼ-oMªX_ñÕwV P‡ÙfºÑÚ‘ÿÂÙ"©‹Œ°ÝÐmZ]š{¾ùîhöÍ“Ëm´6[Ú=¨ÛþëTêÀ²¨gÔ’ón°¸X,ùôé•®tyctI´Ý(O®^gÈÏIèåMøWõ×S ›ÂŒ‹à|S(HšÂÈÄØñDt£•gyç]òŽF'±‘žÊƒØiêng3‰À_N" ·u°§…Äí @ñNfñÝsRNDdÆÊ¸^ë¼Ûr1à*ŒËRÞŠf±vº¿øC¥C6¸ÄâN%c‡ÜЗTNJ›Ûí&õb6›~ÿ››w#-Þ5'ef¬Œ÷ÄÛøX¾<5•âik³¼Uj—³1öýá»ðÌÁ%ô!’1ÛÞü©¶‡sRZýÖuøz,c¡Ýûìlqœ”ƒ¯­X‚SX¦6R‚ÚD¿lôn\T³hÿßI®çîpAT½’6q›š’Ðk¬¸2oèÁŒ0z|üêõ¶9)'V¬l 3.‚·a,‘p¼kÚDï¼Kç·5{îCDÒlÕ©,ºIÞò¡ùý´œ”>!Ÿ]Iûxko˜“r 2ce\oÉXIáCy(ú@'nZuÞí_‰~Îéð\ŒZ…!_D1ß소­Æ=LH^ý¾1ˆ)x«œ”G‘+ã"¸ˆeËIÉQVKî¦3;4þð0a‡}æFÅ5¼éÄD¼%£×û‡0 F¹Ü”T°ïëlMÄkrRNœ°zrÅò‚‘ocŽüo|…(ûwe` £ÌiQ Â>ÓŒį:Qõ²”¾7ǺyYNÏŠþñ«×Ù9)óLèŒ÷ÄkM¡pFg¬*ÜGN24…Ý Ü ”³À—_„s£{°æÄ)Þ;•±Ÿ·ÎÐΦe{ÊŒ•qœœ*Ò+H}Áoœ‡ß›ü†;)G*SDÈ„dÖ©èTÐHHsCsÐlv€ý=û ÀöàçßÝ»¶ é²Üò™ýpËFu§ßrR–¥SIد,/د,ÿç;ŒâT Gƒ“]·>´>nNÊ¿üËœ*2ãýðÚ^a—ú5Bbp7Œø„½›RcÒ¡kÌáUè¢E>Öˆr+:y›Š&-9[2yõQÞº¿ÿ>o˜“rÒEÏ>r8¿¹Kýa<oí£ûG—4·p bÉêBC\¶²&㥙2‘ôå£×HÅŒT/¯ÿøÕë ëV6…ÁdÆj‚‰Q9%£¦o%%Q Â2–?\ÌVmòA4¡)”¡BƒòV„ªÁs'yËŸAä[ÏÏŒcµJV4Âø'Â[™±2.‚ÉŒµQͧòV—Z&7Zø†šäë9ùd¸²±3ylšÈÇÒòPQðègI WÊ—·˜žÝòVr„ñ‡1c™±2.‚ÉŒå›òÖcµ©–º"Þ"\­Â=íá.Lpt¯´<ÔAÒ…ZÆ’¾8Â[§¦Û¯Gu§ÁÙ:гyëSøúqëlâS˜ôè“ïÓ~"5é};‘‚Æ "Sê ¢Š57“ü%lˆ!=žxzVtŽÉ?þxâyu+›ÂŒ‹àdÆt~DÈ[‘ä€)<Ä[ÃüGÑLèÊ_¨¨Œ:K^u`.ÆÕ ÛÇo—ßç‡!<•·2ce\'8ïå8’y>{®`—C#$0ËRž¢"ÍæäUØ.¬ËÕžš‹±ˆ>37@?ýõX â(NÒ~dÒâÞÊŒ•qœÛ+$Xõþ–åª>­Ùè²–Ô›{‡)r¶ìuG|žyt¸á­Rsù%‡«“x o¤;ýøÎÖDLz‚®ëÖÛu1ò¶ß…ŸéR6 _þ7ÖRž™²œkÁþ4ƒ¿=Kàö¬‘ùÍ-h·^ÌêóàùžûÓ;àåàùàåÉå6zyØmÝRTrâ¶Gò@ ªE™ÅXXyà§Ow^È™ ÐukΩ^_"'åO~ò‹¢ø›£çͦ0ã"˜l •Ï»9 l™7sC«çÇõÚÔž#£ŠÓá­^]ìMì´:ÂXtL`ïH8Ñ&’Žkyo³8Qx™±2.‚“Ëažl Kùe;à*Ä ^ÉXž³6±Ó:Œšzöº>œ‚Õ1Ýi‡t§SD§¼w bŠ"‰ÌXÁdÆztûšy¿êé' ¥ ­b“åpã++¢ÆJu§Ãì\¥~Q¼8¦ƒðÕˆ]&Æ Æu§IÞú£&Žšºãc°Ö;ïaõ *–|oâÖÍ\°5©9`σ?íÏ#5i_:›¸Œ)”ÿ‘T¯jTaWç_JxHÈOõʦ0ã"˜ÌXOq”<7ÌaÀXn³úÑmÈ[ñ Æš™;ñpW26mFÑ3»±ÅYìË3±#¾üIòÀqm ƒ·¦ 3VÆE0¹ª£phâÐ΃pƒøX½Ÿ.ó ”·†\uöÇÌ| ll³…ÎÅØ¦N2ävÃÌÅŒ$¯¼^w:EtÊ{Ç ¦ 3VÆEp2cy$Çd¼³…æ‡ñ¹E™)þVUéªýé¤7ðÃ5¶[çC~Ž+¡¿5„¼‹U;µ>Öò˜Š‹T'ñ Ýé@t:¹b…|Þ…Ê;y™þßગ:ï>›¨_îo©+Ð*e:¾bÙÁ.üÕÆ êQš–W©ïbL©X‚WÊ9)³)̸&3–Î1ðA‡d¶™ ܰ3Ý/`,Õ T†·ªîo"¼00úø…ü„ãS2ì,g/j*ØSu?€œ”™±2.‚i©"ÿÏçõ^Ûö^Ì(€.¯Êkªk€jðõwwÀl§“Ä(Hey¥å_±–æ§¥)øÃzˆœùǧ+'Ç;lwO÷¼Ü¸rÓì¯ÁK-cí´¼—=‹~ã,Œpú¥Ÿë¢9‚\R·e¸rÕ:öÞš]¬¦g“3käwŒ·ÂÑix!¹zâ¤ÍïÝ ºiŠ _öºNOn«oÄ…Ìé:”šŠÕtnUò¶ï¥÷^ô6cw¿¨W 2©]Êî}$ýä»T,µ2Õ ö¦P òéžU4uäðDï:¼Ë)1ˆ@Ø%.´j©õÆW,W½ö CŸ¯|Mg!›ÂŒ‹`cI”Ó¶0Ï[)òw¦ð èWbh”·DV™ÂÝïçDKÌ¢^ºö&ûxÆÚŸp÷“0‡Y P-Ì=ì_Þb¶d5œ÷Ê­3÷a³1Í[ºC :MÚÜÖ]]Ø]bÄ÷»H{€›½‹ñò¦iÜ"3VÆE0­ÍWÆN·ƒ®qø„kTÏ #ÓÆ£o4QŠ//]}ÜR>•S›~ݸ ë®t7Ì´Mž˜aï\rï…»®»zÛßR€R­ˆNëNup,íËïv6Iס^‚:[(om6é©7 ¨ÎÌš/?ø“+ã"˜ÆXõ`Ç·\qv_^Zß+4±Ó¢u <¤K\.@ë l!ÎM½wÝ´ÝÔÚ….×£šÖ‹þ6¨ÁÇ ç¸š§Â£¼5&:¨Qb§À惨Œ,ÕÙ 9óµÎ¸N©XÑÛøòæÐmÝFçøJ•Äšz&åòÊ™ÂʸùÛÖjÓíß-ÙÓïþ,èôê¥ kì9ó†ià¼/æLšw礔Õ]|ª`uPƒïïS¦0”;³ØªM¼XŒ>›ÂŒ‹`Z›Ÿk "ä-לėß´JN‘ó^ÆÚ+E9ÆS(µŒQ¥eqœø¿ÚMH~É"À`Ö |ù!cvóÓ1Olɬ1ˆæìãM£613VÆNa,ã$µ·”/ß5ñþð†€±ürwP©ƒTÞÇ c3á³ ; ÔêäNä/³…zÖW)Æ:€t "Ùu8séPjÒñrÎÖ¿»™× 3VÆE09é?®EpY8Ùe0æKM’_ÿ×5P”2zSƒˆÎ݈¯ŒÒKy¶äçŸîÐ\Ù‹k€«Úñ‘ ¹J9rxþ÷f ,¯ÜÔ»ça‘úY_óþç5À@ûÄæàþ `ó°yÔUùéà§ÿæîá àáàéÅ-Ÿ_¶{Pë¾qýÁ´è´wšÕWs7>}{'Š1·”w{­o$Å!Ýÿ]ƒ̱4Z^Fâ“rNî°û‘¦”>¤Ÿq•ŠA˜µ97…ûÐ@ƒSØ]S†Iuå¦í[’ôµÕÎ…”fRe+€ÝÛÆkämIÛØs+\˜¼ŸÆtòQS¸H) º1û8–“2òå ž^ýªu‘W½Â×q¿âÚk€cgžhqf´0›ÂŒ‹àÆ*,ÇèæÎü)Tè4¦6P@¸¶Ô…y=c=aì´uÑùJækPixO Yµ«Æ5Í™&ļΩ‹à†_ÃX¨Të6r’‡ÙB}ù$c¥|ùÊ| ´ÕÚ6Ü@xOÏ鸆Óʪð–:›{÷,H "¸_‡LDf¬Œ‹àKF÷Âç˜@E ÎÙŠ:çrˆdŽ ì‚qžFOµî/!ËmÛÇ€ò  *îð>V½˜íÜ*2ùl^õJâ²ßF¯ÜË“NIïoygË/ÌÔÝñœf,-Išž´ð– <û4:vȶí-üØÔÒq¾Kk£ý°ÞÙÂH¬Ë5›J]™±2.‚S+tŠTS fçO«PÞ’š¨«8d¬¢S驉š–WTÂâ­vÃÑã¶û¥c¬4@Zj€Ô¦`˜í4î°”¼žÃŸO}î)ÈÁG"ÌÀèmôv­P¢ cþÌÀÒ2V²cÔ&bM«¾]äi¦Fç¼ûÿìœö©ÄdÆÊ¸&3VíÏc©ãe‡tú\M¶šòV;0á‘ÖÔû[6úð,3cÕ’þ`©ìå¨ËPg»sQñ!—”AW±¬¿bxK‚#oYÆJF ¹[¶N!hçbDλ/¿ªbEÿo›þÖçgIJ)×G]õÒ—µ²Î>©ì·öåBÿ_%ÏH`"ªm7ÍÔÁ‹l 3.‚i©"ù¼þïëò ’àø ²Š®ÅÖÍ%IàϾ¾Ø;—\«Sa`'j­°-þú{§ D5Ieå¾ß"KI¬8Ÿ»P§,ÿý·wÀrεLñ“´‹> eJNôü¿Ö¨JÎQHм3n›ÞÏ’þO§‘l_6Ï÷/lìêÖ•ï_¾ûwwÀà ÀÖ'If¹xÞl§”y(NøëPXT%3ùz°¨®jgm?ýü%ÈÕܽº:JãiWKrªÈŒ÷Ä)λ‰žyçÝ»íÐót¡Uš¨ilýCÞ²¾|5ÜKúòÛg¨éÀÇš·*· ½*ÉlVý³0à³fyçélTa "åcõoG|¬èƒfÃx Ç«,R:ˆè‡'yÚ†åêVEM¯NHP”‘ñö8åûs%ø ‚Fúã¥i…¥6»Ö0–WnÙ¶5…·BQ»0ñ¢C×6— Ö*Šê—%O":•¨©>xgË.íwTÎCrIb°Û*ì9†}{™1±Š8ãcUeÜIdƒJ2VRÑßá´Aè“+–«^• ¬K=+Õ,v¦b‰²¥SzïLUhõîƒzV¢>lu­bûâ®>ÔA” ×&Fïµ`æU#ßµ·¢š¨b½Iú˜(Kní™}%Ó1GlˆkZÅêå“cÏ6=„¯XæŸèu§V¬l 3.‚SË´­¢Žï°½uÞÕlµ†·úÆ¡k@‹ûL;5íÏeDòŒà>QÒAt€ã-ßóîóØ,,«yGþÔïï$a{ú/oùÀ“SÝßí¸Â.祮Ãæ-Ýøý¥.øòÃPídÆÊ¸Nn‰…~m²PgË/K_à|mv–l<ÙoýÝÉ“¾¼ü’rvªâ²Œ‘¨øXWÊIâcEyl$úZFž–õåÏC;pÜ킆1{ˤòëĹóÈô#°ÃŽ#w²×DDÃ>ô£ŠoM@f¬Œ‹`rK,z®B(ªÑ‚v¡K ¢a¯ÐrU«í 6âÎ ã8g Å[®Á´ý!À^C¨.aÊ^a—ó–G©b§µÉy×{Z'*'èR®I(™—;‰ca¸¡¨ž³¸Jv]Gyk7ò\bkÌ䊥|î'Š£í–~t¯4«úŽÜ° ±þ¿ƒÄ¤•æ,èôlж DKÐyÞ)“íFX„Aˆ\¤4Î{¹w-‰A,ý¬:}8ñÍüà ʂ[û]k_óLm‹cf¹ô7Ù¼«È—wšÊvɲá¹ضÛ`¯_'M‹N €Yé–‹ôÕ-k~ñ¯þúøãœy÷%4’Ûòzbc ‹2pE;µ€.Ü`Æ‹ÎÏGó ƒP‹jiÒ1³»ÛÐõ™¯D\¥:ð±ÌíÅ”u˜!,ýbšÑLA«ƒð1{¡6tð%È”4…ѪÛ@kÒ$_^ñ4mja6…Áéáõ@ê†H_ Ë"Ñ Û’Î„R[v”Œ´6Ud]W9 òå±1³‡ŸWc¬¢ea¹Ê ”½p7s¤WUžží#w!uEžò^ZÿmdÂ80+Y ÝüLb+#:¿[xóÏ™±2Þ§„¢¦iß>è4˜BË&”Š:aöi•áÄãn Ùl”mô×!v¶ŒDáÊÒì"¦œ%}¬pé»j/&ö^<ƲžÖ.år%y«¸Gþ޽ŸjHN¥ó¸WÖë8^.ó¯G:aï^¦ 2ce\“+Jœª…@2Úº£õ±*Îp^GA'ΖY¥k@n€¨u Óñ'il×/ÔZÞ*:öÒvÌ8kÑ¥K3ØH¢ÄÊ;=FÝ “K$ß$÷îWäi ‰d; LóƒrÔ X³ëOy CÏÕÓ˜ã-ÿÞw牆Ġ¬…Ý4Æš\±v1“[ åÿ7QêÄË4™Ö]%P^Üvg;÷FœäAÃñ‰Jè‹Ú¤bM¡ã‰%˜—òÖ3Œ)”UQ u` %t$5þ¶qº IËZFÂrT½FÂñe1ðå1uHª—Ä Æ+–>”¾9ÂЗWMæÄŠ•MaÆEpº) ›ZàY§Ñ–M˜ö8l7®}ªs:3^j©fÑ1kðmiIDATJ(ÿ*Ìñ¥Þ’£¡·+Ö=·ÆêG?rë&TH¶…BÉIòAVÖ[¯xàå@Ô4éËKaoî9¹U~½%s¡YÁʲšÿOOÞ’¡¨!oM”-Ñýœ0Ë_ú’Â1{å-+üêÙËÜŒ¸ü{m[‘Ò9[öv[7pܼ/¨Ã'7ïæU 9a’ºs’éÕ+›ÂŒ‹`ZªÈæóú—k‰CJH­VG[̤\œ{y\ðÍÝPwŽ«äCŒ•×AØ¡F•ò­¿_£š>™-ض.¢,wªS“ÂN.ô³;ÙA œ]6]l^è¡Æ)ÚæÆ«½.ܸÛM ðþþο(ArœZÒnüOë´)‰šÞm`DmŸÅ–»Ñ˹‚Ä!Ç ðΖ¿ûÒ’a…¤û•Bf¬Œ‹`cíaŸî:Ãü¤pù#uÙIK¹2ÎA¡î×LçIwà´îp×ìÅÃ+ôŽlŸ4jvf€ÂwmÞÒöQÛÊÖØDÒ âê;¼„E6…ï‹+°}Zs“«ýQ@Ô&ÕÜD– só£Ô’vt±Œeo®eëàûKÛ«ïuë0ÂÜ2ðåÃóV"ѧžûŸä´Ù9íT•ò%Æœ÷qzzô)ÆêuÑOƒ=ã|Fh,…ÌXÁùλ«Ü¦Uż•jûÞ‘·Þm¥LS›èC§KçÅƪ”±äð…žyÄi‰œûò€W±†ýSDƒ+Í‹ðBÀ½Ž1żߢٸ7ŽÀÞR”ÖÆï`^Ým¸1b R{Íg=2ce\Ók«¢ :XëÂ(_Ô2­wåù£6ï”*llÓç¬Ìê•ô®C¿­E\O¦½&yËï ½´ÛÊ‹€–üƒÍ£ç„Í>Xu¼580(lS?Å¡°ªyÌž·dcî/Î`cƒ“LÁ´Š%“U|•˜BY†Ëí¹OÜOôÂì4£P´%-)¼ÒrP±ti; þÒÉA¿ç¦ITŽÛB›SôÓ©¦ÐÂ×’cu¢ìÔ&¦2‚>qb•r—8ç ŒŒc8…± RÝU:¥1„Û&öƒ‚@¾šT…{Z-¬Ÿogg^-4МšœvÌ·ÂÞr™ ’|P„«€ò–wÞ£§½5cò§—lG oÛ1Jrj„å­s}ùÌXÁ4ÆjûÆ{8ÀF©g›`O{8<‡ÒøXÞ ³‡ûD;Ž2Wç}$Z¤}Z„«ÃûIúòcyVSà&åD{¤yë¼´òg5Az^ b’gø›ßü†p0¸ 3ÝEB?ù·UÓa>>ùàô ý¿ÏŸQÓ!˽Ö;»ÝCžý_ŸñDœõPûBE1½C‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘ñ§…ÿ ªÚ¯°àjIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/gradient_rgba_float_alpha.png000066400000000000000000000277131457240071200300470ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ IDATxœíO¯ô8vÞü#Uug“¬³ð6ð&@`8‹ÛN;mLOgaþ.Yþþ3ãE¾‰#éØ7œx'<]ª["™Å!©CJUW÷zêíDÏB/¥«’(½ÔsÂ8pàÀ8pàÀ8pàÀþ„ÙsÒýÑ=»~…ðÇüǯžãw^+|Îó 8‡3p ãF`à£\ô69À& üø‡?n.a€M>á"À3ÀŒá÷¾øˆþ $7É_“Ÿü`˜ã'ë/€ñàýìK`<ÏçÓ œOÇ8á4Fà£!£ÀÉ¥<À@F“_Ę\²ÀࣳùÑàŸþñ¸½8àzu׫d;M¸\|-Ó4¿þë¿9Ïó|æù„pžçAv Æ1FüøÇÿÁ1’Rÿý[›¬M€sð>ð_Xû8÷x/å«÷àýðþx?IáË/ÿ 8ŸoÀGÍçó Èöt’m8å÷€aò'ÿùaKÉØÛ°®þ*§·ˆê¯Ò’êK‘B`l÷Ó6Œõç±L«›˜¶aò@«–­“?AXLD¬’T!E}QC\ÓæZÊååî"yù}¤¹Ø4Í+ÆZ– F „½ÿ›ò<ýÿî¿ìm°“Ÿ:ÆZXýˆLH6å²fòÊ[Â!X 'pa¤p•ü¦2VÇ[úŽóÅË…äa4EÍŠºô6yK¹ÓÂ[ÍcD¹¦±¥–0 ™íÇ0¼™±¼í±‰ o)ÒÊ'¤äCxÛÄd?cx ö6Ø‹¿èïÙ–&¹ÍXòK@*ÖóÖâlQÛ· w|¬MÆ„ˆ%Wì|,_Ë££rUå­´xˆ¦ðB~L ÅG~»uyã/ǸuøÞŠÑY °Ÿ·žçc½ÙÚ²}d H^ ‡Í–®k^½/OÂÚ8ж¡®aU£©!Î{µzºaue ž—IóJqåËçæµ˜?ç6îþ*Þá¼æ‘›×Ú—OÉÆ°¿y¦ðÀ¯Þl …ÌS˜Šjtó}È[&ºzb¦-ƪÈÎû4ÈùBH7õóÛcÍâØ_ÓfªÊVx˨„u¦–÷ã¦PBG±ƒH™rÙÏ[„{Æ:ðìö±†I‡ * ØKSWr8±ÐŒ­âN Â&OqrR9Q£Æ ÖÎûL̬DuSÏYË),ŒµôгU)•„ð–»Ë­÷òÖ;|,6x ¾|%-o= ­#@zàW oî Ø=Œ5Vì²4åÍDVóõ»»WhZƪe«ž³ÒXš—Hlå­®“(WIª“(§XE ì€ Ò½ çóþ@çÂ[o=p¶®W·qô—7;ïòƒÍ†eUˆ÷GÖÌæe’¾ÞÒ¼#\sÃÒ‚Õy_7,1œhMalÛÙÒ¼´/Ÿñ¶æõކ%ÀoŒIoõå_^SxàW o0…úÓ·+‹Ã*jšÎˆÊPV¤1S¹F1BuÞ5ÂäP¦PH;SXËi>ÑQÔŠÀ€d_¾'µæ«¼Ë[νþ•±rŒ‘Aý¼õòò,Sx0Ö§`/c}õ_Wœ'Œš<0LƒìÃäýÅ~òÀøìSà4ŸÆp|Ž€ ƒ‹I0Éþè‡?êol’‘N¾ŒÓ9F7ÀŽøü‹ÏüÕ¸ °þ ?Î_ì 2·¼ þò7?ý’B yàÇã |4 ŒY‡˜¼èéœ_Ë`b‰A8g¼·À8zà£àÿñ^Š6“¼^;I`Õ À÷¾÷›@•Vm PåUyàª6zy Ô³Ê‹6ð÷*¬ÚÀúƼ¿Vm àýåÏÿüA3Q·ÛuÖoÄniò9tRLÙ­"9¨}›¿rg¸šÖå²µG߉NdÒ–¢ñh”î´ÃæˆP„—ɳê0®C©·Eãh àJ?Ñ´:ˆ\¿Õ§*ºÓ7á1UÝéýÖ;E§;±÷ºó8ëÿ†¹u‡»»l_üÄ}ÄF;ˆE¿åËwÍK7,FÔÅ7Ñ5¯—ËFÃÒ!‰P KvEX½`‰A¼Ú¼Dø&¼CÈ}yàMsJž·Èlöã0…ž‚ݦp º·ÓÓÉVØ‹¿n§- Ž˜¢ \®r—·”¦9ô*®ŠMS¸Ÿ±†Ö2ÆÑQD5¢½â­…6¬’¾ ïDp_ø`.FŒ®Öó—Ë[cx ö2VcÇX±Ý¢òâ)>Ö&c™¶E/îWÖ?¥-D*s1¢œAó=tÁOí¼W5Ä&céÝp^ndmr¬¼Õ9[”PÅ›ð>çý¾îô®//áÓ=:ˆ·â`¬OÁnˇÎÒä´ßǪ¼µf,ÈŒUõ[iKÑtã'TĶUD§(ÆÒƒT¾l5cI4²~Õ¶8[(ÞZw3ûÅ[‚÷ùX¯éN_×oís¶vÑÚnSè£%Ä•dn²)\«Yî)›ÍŠÌ“ÌY^7/åË›"\[ÃÔ–8Ö¥7…Vµ0T”A€Y×¼Ö1kk-ž¨ äòÀ†¦ù›=•9Lá§`/c%Ÿ¢DŸ•óþ @ê·ËÞa,”„KÙ²EÓ¼É[‹<ð5FP¦Ð³²Ñk½Fg Ã|7Ä_ykƒØ¯ƒ¨x‡„‹7Ê;m oà­ƒ±|{ØícÙ˜4 oirªþ–SÅy÷+™c-Êf5¬ÖCÏ[ë¹5{Ã#t“`o× ÆÒÝ‹ÎyÏYá´qi…ÍD½ÿ~Þzc½QwšE§ü3æb¼rõ~éØ=¸m WyKé;‰¬hìæ'àe«·eî1Öë^Bþ6c›byÍU¦TïVD§Üa¬.‘{…ó‰;>ÖR¿U BOÔ€]bùwˆNy§îT|ÁFwú®DÝ «ü¯™¼5npÀ=p:{àã8žÃ|<Àß~ý0^½èþ¥tÓà¤Ã/ð‹Ìäû³Oa>.œFÉÆ&ùB²00zŠ6èäBï"´>Y7DÀðcøâ‹Ï)’@窢m0úiôàì/À_ÿôK࣒ðî¤RŠ6f£h¼’zo;m `mªÚÀrãè«6¢ÞŸ:ð{ß{GêÀñÆÔ¿ökÿöaC)?ÜsÒoÅ[t^ ¦Kˆ3 *­ª¬ú8 žó¼ÂÍØ÷æåCÑ–»-Ê­î‡Fϰè=P©(@ÜÊI Ä"áª7 [#]¤I)ö!Öš:ˆŠwhù€9)÷à`¬OÁnÆJèhfJ1d/uá­.Ug:ÇõêGŠè”cmNüÊßOÉIÙSdÞŠ­¦Y.µÎÝPÇó:ɵž+Í[ À{»SQyë¢S>`NÊ=8ëÀS°—±lÊ]›J ©8[ý­`¤ænhfyªmÁ_XE"4cÑÌ?lsRö¼µ8[ùÚ’VÞZ3Ö\n$Œ5½‹±ÆÑíÔAÔ¿¾CtÊÌI¹«2;ϳɖ —æUl"äL!ΡØD ‘•ó^±ùæfe «1êÇÕ5sݼܨ¨Úæµòå›âÀÊ êµy5 ë]IÎç!ßõ5D­Ñ;´|Àœ”{p˜ÂOÁÞOÐ'Ÿšõ$bçËÑ.60þn¸¡C½’˜BmŒ¬r®õvÍXqùQ® ÷y+)m`­˜6…]×A˜î2 [Õ"\j{_Qc5ýòÀ÷å¤Üƒƒ±<»+øäìÂ[/¤£ŠAX¯ær<=ÌEtŠb,·¬ì¥ ÌG¡¸á omÆ HËxb—“RûXFyñ¼×ya\|<C‰NÙÏ[2'å®ß8ðKÇ^ÆbŽÙ™œD^œ-úDÌ>V>áÕ)ù×9@ª},·åút~›- Qý0ÒT°ã­2€¿¡ƒÐ.]×'}_¯PÆ€×xƒØ¯ƒÐøð9)UfçyCôONÛD6cò·äm"ÇxÍ®÷næOm:ú:®š×ïÝæ%s1Z™þáÒŸP•™Þ•=<”nÆ ¾£9)™ç8ð&ìýÇÐ ¸'°Å&²ŠA¨)$"^“Ϊ•š}ï¼åÅ£xË–j¶ðù:Fo ÜAô¼—[t>ªì^•úŽBXM|°ƒ,s9Øò–ÒATKD§]¯°íx67Ê•¹ïc±r³äˆSÓžê@õz šƒ˜%—îVNÊW1½]wzOt b,'å®+ï=ïÒ7,½»Ù°Üèëòxb×¼ªMDÅ ÜÊý4+k‹Êkš+3LÜwÞ7ÃZ~èfÜi^Ú——uâ;õïpÞïiyƒøP9)wY¹Ãx ÞÀX:öÝ%Ýd,sfb£t oµ¾<Â[¾üU]jÍX¶û Þè¼^©U¸ZIŸ¶xKË÷óÖ;œ÷{Ú@Æ öë *Þ•áí£='Œuà)xs€´›z°ÉXù»y‡|°å­Í„É¿”˜dÔ?×Wî<úÎy×#†ÝÏ)e?'eÇ[s1Êóí$­ëÛu§E§Ü‰AHëÁ‚Gµ<ëÀ¯Þ íTç½Õ¦ÛÏdSxk;aÕÁ¢Iê¸J¶ºß/Ò®>Ƥ ç>®±úÉ£D9a—³5MoR¼It ZwúrRþ«='ímXŸü»O®’St˜€›ŸnþBIœg× “h‹“›€¿ÿù×€;™ì =üªhùDç©òÀÜo–?xkDxŠŠ<ðFÀÏ#ðw_põˆ›¬4€i‚Ú/“ÿÝÏ>˜O@ g …1ç6’|!" Œ>m ð휔ÒÉ/¹!sªÈAÉ¿øâsßæ¤¼Ÿ¼ÊIYåUHÑ ÷rRþþ㦒ï»ç¤ÞнŒuçœD¹Ï²•ÜÝT-£r©³á#/:ˆ Ûœºè·âÌ25#o›é_íd TèªT+¯œÖÍk.?W³¥7sRêÐüæ‡ú×Û#YøarRîÁÁXž‚½_Æ©¸“›Òäš!R¯2g'Ç*˜ù˜·ªè´nSŠIé *oµVg}q£þ”ZƲå–VùûõüõdÚš‚&ç²±‰‡c>óV.Ýw0Ö;Fø€9)÷à`¬OÁnÆ §Mé•f,×94%yõ:D¹Bá­üq-1Ê\ oa7r7(5Øò§ZÍXŒ¿tUêÎWõXþêÜBg÷ô[kgëºÓ÷1ÖËI¹»gB—Ñ«MýÝ  V^à~j"ïÝvÝÎÁm ð(DœÕªØ"ÔS¨»@|,5D™Âöma¾™©ôºÌ†÷Ê¿ã9)÷à0…ž‚7änè(g-M¾)½”ur¶«Ce ÑjDÍÑó–òå­¨p|÷­h*ªëX[%pëœwmI;ÏÖ¯–¬æu_þ=òÀwh¹/ü¥ç¤Üƒƒ±<oH¼¶é$mвu¹ë¼ßsäÍèÙÐo5¾<*ÊIYï®ùÁ´ŒUûVMÔìœ}Ý-è*¿J^ýŠ~«êN?€è”˜“rÆ:𼱺#kÏ©Ócm2ÖඈNQ¼Õwe«Äò¦èNuGUפ¢JÊŒš•_Ë´ç¬+gäýV*ÒØ§ŠNù€9)÷`wî†ânšÂ͆µÇzаeµK}‘v.Fƒæ•Ó$y+©F\[%]í%¯âX]•º3w4,ô­îÈlÞ¦i~‡6˜“rSxà)ØÍXÉm¶ãG¦°Hõ™ë2Êqv²JowåÌ•wcUh½¬š‹á¶h)•i÷§Î‹GÊö´{ÉêM_~?o½CÈÌI¹cx ö2ÖŸþðO% d’5Ü\LC¢¬¼%+ÈæZ~ëÓO€ÙgY©¨LcVœ^RÞ(®trÓÿýÙ×À0æ%ÁÓ¼ä¤des²•“2§µ©IjUNÊÁy?xÀŸG #ú0þý×_ñºˆKo“—ÂË4P´¦·É¿äƒø½ÿø)joéÞç­,'}T9)ÓCÝ©W9)åÁ%3坿¤ô[9)ÿg›“R´¦§’“2K[³îôQNÊ”#ÖÂ?X`tøhع=ëÀS°—±LÒó–|B™=’ôÒH `¸s‚F‘bÆ`C.¤ȹq“'ý“’¸ 7€4’u΀är ¡qÇÈÄRžåî¹Úívpž®\Ùz‚€[p!W[¶Î^—›Þp-!]JŽßôH¡¥±¥$pPÇ•ôSM¨³!ÎÓ/|ŽMÏË \–€—XÄP¶.v4€LW8HCqy«Ma¶’7Ò @"ÿÕ,&êñÅ>7A…X*,ʧHMä@‚Å;çÕ6`¥0 æBur²‰uk[®.)ü@‘ÏÍÍ+èqŽ®×ѳ®aiƒxj-c5ˆƒì©œ”f±‰èæ¥>T»»a¦ðÀS°—±’IF1¹I&)_¾k r0Ï„NeÈED³ãl W!®ô/*WÆ5rRŒËrÂ[f(—QF0#–}FD/CR[àl6¬¥0‡ÌU.k§§åñ6ǪLû&Ä€º¸S1—7Eͼ91­c,µ¾i«–5cUÞÎòxòd›$õSæ{ŒuàÛÅnÆÊ«RyË¨å» šf:TÆÿW¶.—ƒ‡|âêFÒÅ×ÝTÂÙ—ó.âæ/ ä”ûš¹ÐFÇ[‘ÂU•·œ ?Fù@cQ ·\Ù¬¸ö#€7—ú«Þª®ht§¯è bÌä’çõ×ß­˵λ0ÖeØ^ð£‹SÈVÔ­çQ?B~-oµ_{ã cx ÞÂX‚–·¤g¥8b ÷¹Ü‘k»ú²µ¥“¨´1¾ñ”þõ´ÄÇj¶Cî$fÆ2q•LÎ ¯ð– ©ž¢c¼€S_mt™be¡bŸÔÜžúƒMÙÚ.´®Éë“|r²ÓZñn]¶:Dœ@t§W¡Â s»ÂÇ cUg«^ÚÅÙZ?ëìmXÑE«é-¢}ùÍæ% «¶¡\³Ò¼¤Õ6ØÆæ8VìÃZ@œKA$~2€Ug£w¼Ó¼²]N‘úÿlr'#GÂ]¾ÄfqÃQ‹öÜsÞWGÿHøzNʦî:\×o§Éo˜Â¸^±himó­mXʬW³˜›®j^{p˜ÂOÁ^Æ .v ou6Hƨ±B—BJèTÃÖFEÄ ‹$¸JÅC—mTчÅ–À)3–iØ¢ðÖV ¢Œ ³F9˪ʗÊ–ÑgSxa±§[‘÷ŠŽ±ÖÞw*ܨìÎÂ[r´ð–yÜ–%Ýé¦ó¾yŸÂõjȵ—©D~!‡ó~à[ÅnËGm_+oåÜùòù‰~6×1ÅQˆŠÀbq¼Ò$Ùô 0G,£Š2øcK9õ`n#ÙyÏWÛmÞ2ÊÇrÑ&eU¿<Š©ÏP|(λy@T´DÀÙ‡»'Ë=(c‹/¿ðVël¡ûÁg#0¤’÷ÉNF1Åj; ?úÑ´ôÁ”xÀGd4ÆÏ—бÃü[¿ó ÌD+ã'S²2ô{°`ÍäÌX;ÿçg_£'†€ÑEÀ¸”IÑš\Ä14”¯*ã&3X8ãç<àÇ‘46-ÉN¯7L7yÉ`z€Ë‹—]ý§Ï>ýtN' Ä3Ò(Û %$\þhKtjàmÖ"=uÒñüâóϽ½òr¼¹ÞN׬”íÅÛ ðÓ¿ú83pfyã0×kŽ.ŠºÕ»D‰ÅìÁÞ†u¥I¯kh‘ðdrMÛ*f±*/š_¬H;%\8SX7÷Œ"êz#ÓäN ßx ®WTP>:¢]ty1ζöKBù´Ì×ÈßͰÁIÅëW·iž­è@>¢t}äà«?Uc·“(ºLN€4Y½öŸ)]½Àúÿ7}ã¡HæÒÄ}ðe«™và0…ž‚½ŒõÂKïØ­>8ŠÃÞñVÞQ¼µü¨å-Oªì’ô cåÏOëꀘE5 8ûÁ•±?¨ÁO³!,*ÝêÌ[•ŒLœd Z§nÒcVÆòK³&â1Ê3–qºÄ:ÑóVO !Ž1zÓþOµŒu‘™±501¨g©ŒåÕcîÖïŒuà)ØÛ'&ZuïzðȘüYØ&ã‹ FPêÅEP'¦„UŒU …ºÊ®œ`êA–a˜•4ø,ü’x„y£%må…jWË:ÍJCÚn½ Jq¶ÝK.®î‡›šf¹YöûDá­yå¹Jo ¿Zç·ñ՜֦šfÞê|,Í[;p0Ö§`7c•ýÚ·0«·ïŠÊmìtA\Út*§»4Ò¶¦Äj°C#øŸ¯`s#{Ws)­²’­ †åþË[6˲K6¦v v+œØP\îë>EuðÒù í4øN!Ï®x+2l_¶#0U˜^”•³…ò·:'rv7¬8uÖâê.µí–$|¤6'©æEÊá¢,|(°¼kï.ÿY'gÎλ6…³+6Q5¯`«|`æNó¢4/ËâËû¨1üøp”P•}¼ìUô–Ó|ôȶ›×:‘åëk®=ú‚é*êòV»í5èàÕÁÃøvñS¸ÍXêœMS¸|0;xË2P?ª¢¿Û4 š/ç«lÌg¿  ü9’óêj•·Ò*õ«ÂÜð’Ô`s¬°íÆkç}SsÎ EKRj¡4Író-ÞJøŽu3îóåå)Ü´Òþ6vG«â©w¶¸ƒHlé ºóÙyßœ3])êøî`·5O¦ §°êð×!aíx%²µ˜¸j¾›¼•rdµêˆIVÅÙBõµ£^Š¥ vð>³ÔMK"¨ŽtZ¨qáš´tKŠÅÙ¢L*3@tE«_²òÀüí²íÞ[ŽåÕåK5j÷<]%÷š{ý–Ë?ˆÇ–]Qjôî”~¢ÐŽIÏìÄL¡4)WGëT;ËZÓ´¶d‹ÉPoD½†ð”QÝÙúV×ÚµÎâÌ·‰’G€›tÕ}.ç|Jóy•Þ¶É–[,¹ºæeÕAŸl™õ±®_¦G «Û&€³UÎ{wÍÜÈòÐE×¼’î;˜¶y™zN³kêOÅ—²ŠÉá†ß2ö2ÖOþÇOÆ0çà!ø1Ù|p.xÀEüàó/€Á ÞŒT°8cîjÅΙ¼ÆFÀæmœ €w3ðÛ¿õ @šlš—&ÀÆ àÒEv½ÚŽiúß÷5…>²AÊ™bí¢hóƤ4Iµ¶KŒÝ`ÀÑyàì|4#ÌÌf¾þÛ¯®ÑSðÀ%äòà2{`Š^ÊrÎg¿ó)0›ÌY®+@4^‚Ɉó°%$Ö$oàlÁé|ñýÏŸ4I!¿«x†4•WwÉÛ¯^o-ŒuàIØËX³™Åš‹k´%[Ûè-çtåŽ/AMNÛóVÇ)H9»vqvŠÂB~ò™gôð¥òœHÅ‘’múàåEôǃ˜Ë¸ <`°ˆ‹Jk©RñUb™e ÖëÝzÚ3w&SèPj*e‘pÅks‘Í!3ÔkÉOI$嘊×Ùf­Å,6½þûNä&Æ:ðìž°ÜyÀÖH)P󔸃|å·ðÛÍ#Í4º“²Å[5"šÔ©>ÃM>'§Ô#A{qIDAT«Ž^÷Új›ÛÕQSaYg u 1Ëà Q=Ñ2¬ž+©SÑe¬º‹Kì Ì}•Uw·…Ÿ'X Ÿm‰ÖUw3[7¼%›¤%,Ò3Öº2]=÷JÞ÷›Â8‹k;cçJ £.[_Ãåà%äYx2O¦Y:¶\šÞ«éú²¹y•¸hšcy/F5¬åu¤¶IÉö&¦ÐÜDŽgsAÅîûb$S}Šx¦ÚDT󲫯h áÁ̾MCãg™’DÞê°›µ¬På]óª6‘uNJ£2¼ÑÞèAÜÃx ÞÂXâW …¦a¥5•Oñ&ÀÖ4FŠ·¨)h„×û4ãŠRÖ£„©ä;Ð6ј’2Eÿ:¯ Fˆp½ SIj\g›ÜÄšÛlå%.‚æÒ-hÜúÊ[M”߯ø€œ”çnLau;ômû ŽKh^ç­¢ T÷]¿ÀýÕá`¬OÁnç=éÛ‹æÉ¥’·]m]I)­õe–ÉÊ%¹­d³--y™DU  ~%¾|;ZT)+3–ÙüÈT£ˆ™¸Ý<5e­•))e WsY‡Sì4ˆŸWÆ|”Ry‰Adg_éNow²Í¬=úâ;úÛTÿH§t¾¿òè}ÍO‘Þzƒˆ_kVå¶—°cx Þn6ÊUÈ)oˆ©ù…±œÍ½½, Þª]E@;^%~@¥¨{¼•,‹U…U¬ÎwÕsÈ¢áeöór->V)Ôƒƒi\®àK“B‚[jW¹¢°”Ö––ÈõÉRZl"€iSE¶h~ÿmóÊ KZ’t jÃ*M Õ°dÆJtå[rôš÷c>R¢pªzÝn«ô/¨¤ k}AT-)™ô«‚døò9eJ•Zu£^Ã:Lá§`wâµsd¡ 7(ƒ ÉWôr››ļ-£Šš·L‚æ›Ë¼µ²‰ÔDÙsùô*¬´•Ênf~€hy %Ñr¡(3ceš)[M`2Õ¸NÿÊ™WZÞÚˆAˆxK~ÃÆê¤/PЍu|µ3…4cõ˜Õ\Œ–·J—ªÌÅèúUÚª$vŠýÆ:ðìf¬[^»zë9“¶üµ0–Þ­>V覦3צ}¯ýj,*•XcùüZ_^JµÏ¼vÞ‹^ iÞJ¼„BN’øËšE[ßËÐ2VÌkõ’Ÿ¼Y€’‚7¿=·Žt6¼…f”žÆüu5ùx=ÁoÐØ¹2Övôuaò¸òåsMÅ—ï|Ú¾ëp0Öo{Ëc­¼ñÀh‡Üœíü w>vãGþ |ìÎÀÿËŸƒ$•ôxÀ%QR‘»Éeÿýï8;ÎŽ€µÞXñ‡\Ý.ëbðcÑ’SØX#žMQVÄÌ `4ó§ßûpóD?ñaç 0Ì` pš§Ó<§0÷ó¯)Ä0š W“õk< ðéƒé|{cÕÈUÖZ­ÎÖÑŽ@pãìFà믾®x`Â_R.S€ ~J^ €”?ûäÓÙ€àÎr5 Ø1¸ÛEãdÝ#Ñ©< p&Ê–Wþå¿ù÷¯5x“)e_(²¸¼j²x)“r,[¦~ı*œ¾´¢ëêIÆùJëÑSIÕêón[Âä¦öÜ“UgfAb“c"í¹Þ¨Úqy4 nåp]‰¼‹/—¿G>ô íô’Q=z3[«NªÑ) pŽ÷ó%¥»»þvmÞ²òë—Ýj˜åµX'ÕàÕ—ùÆ¡ÃÃx v3ÖKvÞçžž•˜I¦U½¸ì¡ç„s@ ju®ªŽbRÊáöBçÑ/!x`ùòD±o-®§®¨Ñ@²'J W$»Á62ëP¶Y÷—®³ëê¼…@ûZ­Iš/+oE«t-c·Ýó÷üËÔÌÜêFÛQÁ¼^uín<â-¿Ùƒ±<»çâ߈&Rn0™±ÄÇšËtP™êó28ybq3¨²yñBá¶,ý°lKø³ÄUÂk>ôb“Ê[ò‡¹\$ºEÍ\×ÈÈI%UÈwŽ™Qäa§ðÚëZoá-cMðiy+;[Â[U‰+Œ6 SØ¢MÿrÙð±2SÞŒAÄ•èt'Æ:ðìf¬—ü¯ðV¬ébåƒ.«Eæ9ìâcÝr¯PsÕRVß\˜^6Ë”¨&dR±4k nvm*„´‚úp $;R'D•N¨^M8¢²E­\B«/÷Û.ƒð–µu$¼á­¦“XyKëEŠÍª°Þ•®ëuÚü©#Bã%¶%/Ÿù¥s¶¤Ütw3Ñ·–LŒÚÉ•„Ÿ¶ØÄ¼DjR‰¦§nx|=Zn²)Ô‰˜–¸mX]#ØŠ&gDÓx Éu/å§¢ÑhçŒdac„2_¹¶ß&Õ0x«âòKój|y‰ì—„Ÿ•)¼÷ÆÖ «šÂNB¸Ù{²š¹ö¤¶›×F bSxà)ØËXöV’«Ô^l¢â­Ù6¾|º•pƒ˜¿n»×3†yš+ò*!évIé:Ø·ÐF•:”/x“·ŠiÉR²Õm/aÒÆÆü ’÷Eœ÷KÔB¿-y‹ÆFãsæÇ–·6b¦hu "³AN›2©á2eJÕ3oÎ3r!g®_ 4Íùô ÞÚƒƒ±<{ËÍ®´á»¼M]2¶u¹ÊÁ0]([ÖÆL•À`Ée•£¤Ié°ÊÕ6}ùÊ[É ýÁv5áºÀ½°¯Õ>Výôïk‹õ§ýuYÂÖÎÅèbâ-%Uµ{ŒeÛ]ðÓ´½®øÚ£OY;FµžÙ¥ß2<×8ëÀS°›±bf,[y«í$Â’›ExË„ýtjY}p9Ü`‹¥È©Îw­ËûÊ6)ž°)ScÓõÛä-“/•ìYÍÓ:sUÅo|®E_Г“¦¨´Ú…PŒH õ[Êô1ˆàó„“Â~Çë± a¬Ë¥Ï¤ uJÙ&³fÆêGË¥œ_flßäNìmXC¢^†9ö6‘U Â¥ÄÊOO›L^FøÃe1…¶ÜNî[ƒhš†•CkE8Ð4¯ &7yjGmR€uKÜ÷ª7’èÃ%©8V׆ºÿEÝ°ÒØ¬¯Q|ù¶yé÷!Oë—iã4ÛÖ‹|uÞµ ¿™ ¹xôŒÂnÆ€Úœ”‡)<ðíb/cݾ¹™üU%2Ÿ -åØ7’¥@¢óÞJr3;XœÜ|äà4Œg’pÏÀ8ž¿üÉO(B?IOk­ÏyjÕÁd]’‚ñÀ~ð`ü`ü§½[Wæ5Ÿšä¤ÌÏBlŠCq¤ØˆSšO1ç8¿û½O(s³†—I 2ñÁ_/€¿MÃuªç¸Ûüüg_ŸR¨×”þ¢¬s!~z–¦LƒyÉjƒl­5€,YåÞG?ÁÀ<ŒÀ×óÕÕz`²¸”òd½+åɨœ”ã ÃY®¹òDç% ¦8ÉØÿö±§ÁŒuà)Øí¼‡â¼/ÎÇâu.c*jØN,DÛÄ D0ßa·y^¶nƼ̯1Ïé*Ãg²›Š7–s­ËîËUݼ QV´¼ÕùòrF3^aòcêîÅìϰ <êEfê"lʃ¼F¿ÝáÏŽW`‰/ —ñ(žtÉ!ã‰Ý,Ö<ëàü=jÝV±×ê ¿–WÇ+n~Ô?߃±<ï 7ØT©«ã-U29Ü»äáê9‡ ó¶®(1*cIOÈ5»©~¯zœç¥èNW\U«ÂJ¼¥f;õŸ™)“`³¬tP9)·" =IX5¹ &èGZ oe—«ø°ƒÐù *oéõ)Àø2o“Óz†~e¬ijªô€òÕ5ö`oÃò!+,léöçÐKîÿ—æµØÄª‰uþ1…Q£Ë61ÜÔvÄ\·L¡ôÛ‰E0#öqš€[»Üþ÷ët=:ˆÅÃæeR“árö']‡Æ´Uƒ(1«$^¿jmÛó›S›hr.׈ ,tÍË®&Ž×ð¨a¹öO"›¹\š:ÜZÛ&Sxà)xƒ)ÌŒU>;Û`ʈ}ûΟšæ­à_^ùpÛ`,ã uuŸp•|j…±’²[ß™¡×J¹™,™#Š)$›ÂeeáÞVAA· 2LyêáŠáÖcöå­N¹ïä¤tJÓìÆ[lÜöú®º]–è/jÊuG¢cøb·•×­]¾W§|¬:º'‹D–‘/åpµ¼•ÊÌ…<\S·/‹ón Q­Ë”ÌyTé2嚨o«ÖS+·êWgc¢St¾¼ìEåÈe®’Ä·?åÎ%WÛ ¿1TBKx­ã5Èýê˜Oq¶P¼%Ñ‘Ì[2O8´á†.õƒ‹”ùo”µùDcøNa7c%¯õÄü•¥2±ŒÄçôvÊB·-oEÓvÅÓò˜¡åcYÅXù`È—èCú&ûXëþ¿i?¸JMV͂ͧWÞ2†55,éxEYU‘V\Å6c]Lû’7¹­õrF³äÞeYآ᭦“èÊZèz»íæm]ÕR¦½üBùXÝpu}ÚåÚÝ ËúÒB2šÁõbk £x &.mKU/'XÈdJYâXº Õ¦^,7JÒ¼ Ÿ§u`)©¦º˜«X+UÛB7¯2†uÃÒ…MÃQ–Uëä å1š%ýºK­b3!¦0Õ0# Ö Y‡Ê—é¿QÉNûÐÚýƒ;p˜ÂOÁœwMX)5ÒzЖÑ% ØPv¼¡ ùÝ’+¾¿VS8Ev7çBa¬ ‰]¯â¦|pí˜&.ªI…·:›(åÅ&Bt:ÌÚêveà&ë®âÎYè!пrNʹá­x«†)H}¶‰þŸ.À¢âÚTn­ë¹cx v+HÝ ³ (F}…5±XÔOPdU64;_^¦.dÞ Ytª]„ 5jRƒõ¹Ã ¿¸ ÷vÛÐDùà¼<ŒþþîðVv¶¤ì\-÷×ìL•'W¤Ú§îâ«õa,7Ö7P….³S™‹±ŠAXòûìyKy“©ö±º*Ý‹ªhÚ¾½ ëÿðwžùáñ×{NÒo¾ù׿ñï¸ÑýË¿Ü{ªü×~ü1À÷¿ÿŽ{8pàÀ8pàÀ8pàÀ8pàÀ¯"þnj΄û!ðîIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/init.png000066400000000000000000000040461457240071200236620ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœØIDATxœíÝ»NU[Åñ%Šà/HTP/&ö[ãƒø„ç°±³ö¬Œ• bTxᢠ€â…- v'kŒ3×NÆ9Çœÿ¯œŸs³Á‘U|ùæšUàÿhGÉ?KüAÆÇÇÿößì*ü¬Û·o×®www«-¿~ýR¥Ý»w×®wvvª-]]]ª4;;«J{öìiúi‡R¥?ªÒÞ½{UIýúûûÕ–÷ïß«R«ÕR¥ãÇ×®úôImÙµK@}í7n¨-Ûu”ü# )‚…‚…‚…‚…‚…‚…ˆÒ>V___íú·oßÔ–­­-U򯯬]ß±C6lwîÜ©Jª´¸¸¨JÊþýûU©§§G•æççUIµÙ&''Õ–£Gª’iõÍÌÌÔ®›?éc™ïP‚'""""""""J¤j¾ìÈ‘#jË—/_Timm­výäÉ“j‹™æ3TÇÕ4oÍ4ß?TijjJ•Ô à‰'šn©ôŸ®ªªƒ6ÝòáÃU2%xb!‚`!‚`!‚`!‚`!‚`!‚`!‚`!¢´Aªæ M§qss³iiaaAmQÝ¿JÏ£VºË777§¶˜ܦA:::ªJ¯_¿®]7‡ÈÍqg3ó©~ùFFFTÉü÷•à‰…‚…‚…‚…‚…‚…‚…ˆÒ>ÖêêjíúÏŸ?ÕsfWÍU/àó?ÈœŸV1sxڌř¦9®ÞÜg^´g¾ÞçÏŸUixx¸v]ýßUö¯jKðÄBÁBÁBÁBÁBÁBÁBÁBDiƒ´££>‚ß¿—­GÒ8P»nFöÖ××UÉìRÃtïÞ½S[ÌÙ%U2“ƒƒƒƒµëf’neeE•Ì®/^Ô® ©-ftQ]KSˆ'""""""""J¤ª in/Þ·oŸ*©³¹§NR[LßÒÜc£^Wi¦[MïÔ¼ÁÑÜÀ£f>U—¸²op4mg3wª˜vëòòrÓOÛŽ'""""""""J¤êð»éò™&¤zñ¤9Þnº æ2muúÞôÍ@¦åkÚ‰êOgZ¾æš§OŸ6Ýe^\`ærÍéû<±A°A°A°A°A°A°QÚÇR3níݬfß̽&fÈΜ„îëë«]oo’Μ6¯«To‘¼ÿ¾ÚrúôiU2³¯^½ª]7Ó|渳iÚ•à‰…‚…‚…‚…‚…‚…‚…‚…ˆÒ©ºYÅ4Í]1jÐÏœ«6=ÃÉÉIURo²ìííU[ÔÍÊ•mNšÛ¬Õ›Íw0昷HªA?ó†KóL£¸O,D,D,D,D,D,D,D,D”6ÁT»ìÁƒjËåË—UéÉ“'µëW®\Q[Ìô¦™;UÇšÍ àóçÏ«’éߪQÕªªfggk×Û; mºêDx{ï¤lo6ø/<±A°A°A°A°A°A°A°QÚ mµZM?Z oÞ¼Q¥‹/ª’™uT R5ÂZéƒê•·4/˜Toj4-_s…»¹´GõoM«Ó|Z7ólÇ        ¥ Ru=¸1<<ÜtKOO*™sôgÏžU%õŽÍ—/_ª-f°Óœ|7½SÕ„4ŸÖÕÕ¥JSSSª4::Z»þöí[µÅ\˜311Q»~õêUµe;žXˆ Xˆ Xˆ Xˆ Xˆ Xˆ Xˆ(íc™ÓÆŠ:l>|X•UÉŒæ©a:Ó(Z]]U%s¤ØôùÔÛ4Í=6æu•ÆôôtíúÖÖ–Úb®Ó6¢<±A°A°A°A°A°A°A°QÚ ››kúÑmÜVmn7cƒæütíºpSmÆÊ6iÍÑêçϟ׮¶ñiæ†"õKutÈÇGgg§*©;Ò ñÄBÁBÁBÁBÁBÁBÁBÁBDiƒÔÜ0£´qxÚ¼=Ñœ„6³ŽªAúøñcµÅÜ(n˜&­‹5[Ìw0£¼óóóµë¦íl†K;¦J%xb!‚`!‚`!‚`!‚`!‚`!‚`!‚`!¢´AjF •3gÎ4ÝòìÙ³6>Í|·………Úus–_ |VUuáÂUR¥¯_¿Ö®›ÅÍí7æô½ºSH}ÊNù¶qÒv<±A°A°A°A°A°A°QÚÇZ^^núÑ=jºÅtƒLÿÆ\R¢›»Í§™—;šCҪͶ¾¾®¶˜_¶»»»éZ[[S[Ô}ÕUU­¬¬¨R žXˆ Xˆ Xˆ Xˆ Xˆ Xˆ Xˆ Xˆ(mÞ¹s§éG?|ø°é–»wï6ÝòOºyó¦*™×1nnnÖ®«;v*ûªHÓÒT×E›AHs/õ¹sçT©O,D,D,D,D,D,D,D,D”6HoݺU»~ïÞ=µåúõ몤(_»vMm¹té’*---©’º¨··Wm1­NÃŒƒªÊ­VKm1žÏĮ̀’.P[666ÚøA%xb!‚`!‚`!‚`!‚`!‚`!‚`!BΚm766–þøƒŒÿÛ_ÀÔo±«/±• IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/levels1.png000066400000000000000000000012071457240071200242660ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ9IDATxœíرnÂ0@Q\ñß–¿<Ý:”ª\ åœ5±õ†+ïr>Ñ8òÓœ³žƒYk=æ"añã` _õ|&a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘¸þñü¶½Oclû§nc÷6ÎÅ‹EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„EBX$„Eâzð¿í÷W?çÈ3Wp"^,Â"!,Â"!,Â"!,Â"qtAº·¼³Ò¼³NÜ;eùox±H‹„°H‹„°H‹„°HÚÍ9ë98‘µÖ«GÞÔ7®Q\Ìåý¤IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/lut.png000066400000000000000000000036531457240071200235260ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ]IDATxœíÝAˆVeÆñw*E²ÂDB$DDBDÄE„…„HHˆ b""C„ˆHˆ ‰Æ‰"!"""C !!"""-DÌÒ$²œvñ-溟ô`Òÿ·<Ç3óÍÌã]î{ok’$I’$I’$I’þºü£áááôçÐ=dddäÿÍ¿ÖøZ³yänÍ„ú )¾Ñ>n̓ú,YÉ­¹µ€[ô{X>GFÃÖü^‚úi™Æ­ÛPëv•¹¯Ë?’úe°a°a°a°a°a°ÑuµêßòÈ/ý×âÓ<Ä­5Ü:Á-2k*¶6óÃ±ëØ¢5Û^VmÀNµêÛ õâWWì±6r« ¯XŠ0XŠ0XŠ0XŠ0XŠ0XŠ0XŠ0XŠèº ½õõæV±¤ÝõmõÁñ/häÊÀÓÔZ:>>a}úÀ\å-(Ý&ÚZ;uZœ¶ò5;Åþ¶ø oA}ÐNµ•O‘¤ãÓËxä}n=Ï­.¼b)Â`)Â`)Â`)Â`)Â`)Â`)Â`)¢ë‚ôRÿ_z”[ôúë7yä(ÒiüIZÒ-¬ª·ÖžáVñ€Iz8Àe)ö·ÅK{h[¬:‹¯¶êÅߨ—W,E,E,E,E,E,E,E,Et]òuܤõz’[Ûùìãÿ3á¾ÓMüÖs«8ùþ·h I/!o­Íæí–[k£O\?vGè…9­µÕP/ž ÐË+–" –" –" –" –" –" –"ºî±Š·Ü½Ü¢¸«xä8·vó!izûM±(:É­âÁŠÅž~Å3yd· ûa_uƒGøÝÓíñ;ú 󊥃¥ƒ¥ƒ¥ƒ¥ƒ¥ƒ¥ƒ¥ˆ® ÒP?Ä#‹úý,­Í½[;ñ!’m?o'¡^Üàö*·Š%íFn A}Ë}µâU6ôðÉ<2ƒ[ ÞqqêKKKKKKKK]¤‡úOàž¾ö'¶Šuâ,n-~tâúÚŸp¤x£xñ;ØÃ-ZÒ'Å_çVq+ï;PŸÏ#7¹5õ‹<ÒË+–" –" –" –" –" –" –" –"º.HÛÔ¾¿ôîI}Ðû[Zkû¸UÜy¡+ydˆ[G¹µ[_C½Xù®àV±‰Öçh­-äÖÔ‹§ôòŠ¥ƒ¥ƒ¥ƒ¥ƒ¥ƒ¥ƒ¥ˆ®{¬¯à1„Åq祷°EÇy‹mÐnn­ã.Þ…\¼ò¤¸£ð·¦C½¸c®øaçpë1¨Ÿá‘¹Üúê/óH/¯XŠ0XŠ0XŠ0XŠ0XŠ0XŠ0XŠ0XŠèº ]4þb¿_úTÿ#+y¤¸5ïßUìN÷ ¼K­âqŒ× ^üê‹%í”°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H‹„°H¼ïöÞéŽGcÜ=á~sΓ3? a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘ a‘'GsÎz²Öº{ðG}Zªà€ì*™IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/resolution_with_downsampling_x.png000066400000000000000000000022461457240071200312660ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœXIDATxœíÒ±kÓíÇáþÚ$U[k 1©V2¸éîä&"us±€ÔU' ÝÔIÜÅI‘.Ž".êä$Å MÕ’©i›P“wðx{†/çȹ®éîçáæá36ü?*2ÔjµÒ{ðY^^þ×™ñ¾ÕjµîÝ»w÷îÝ¥¥¥………f³ùòåËÜ¿ÿÍ›7sss·nݺsçÎóçÏ>|øýû÷›7o...¾ÿþÑ£G·oßÞØØxüøñ… Ÿ={¶ººúîÝ»?.--­¬¬ôûý………'Ož´ÛíÍÍÍ‹/¾xñâÆOŸ>½~ýúÕ«WWVV®\¹òúõëk×®½zõêòå˧OŸžœœüüùó¥K—Þ¾}{òäɹ¹¹óçÏW*•>œ;w®Z­~úôéСCÝn÷Ë—/ÕjµÙlîîî®®®öûýF£±¿¿ÿíÛ·n·;Ž;V­VÇÇǃÁÎÎÎÎÎÎÞÞÞ`0ØßßF~ (Š¢(&&&J¥R¥R9|øðäääŸ+ÛÛÛ?þì÷ûÕjufff0üøñ£×ëÍÎÎÖëõN§S*•æççƒÁÚÚÚììl­VFgΜét:£Ñh~~þëׯÇït:Íf³Ýn×ëõÝÝÝáp8==Ýh4Ö××O:µ¾¾^¯×·¶¶Ž9òëׯF£Ñn·Ïž=»±±QE­V«Õj•Jemm­^¯ÿ9LOOw»Ýííí'NLMMmnnnoo=zt8nmmõz½r¹<33355UE¯×ÛÛÛûýûwQ¥R©\.—Ë剉‰ñññ¢(ÆÆÆF£Ñp8<`0 þ#Â"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹a!,"„E„°ˆÂ"BXD‹aQd¨Õj¥÷à/²¼¼üß^øõs}sœ'IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/resolution_with_downsampling_y.png000066400000000000000000000035541457240071200312720ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœIDATxœíݹkkÆqM\c4F÷ˆÑÆ R©ˆ…`!Ö ’F’ÆÂF‚…H@ÐF--\ Å],QDÅ "jaáÔ¨¸“¸Å$·˜?à>sÏ{¸Ì™ï§>„§x˜ùåyß1@T†öïßïÒÑÑñ¯3£Ä¿544d ƒ ªªª”1µX#GJ×6 C±à‚b!ŸááaeŒb!Š…ÿ“Z,ñ„788¨ŒQ¸P¯XâȨÅ/€@F-Öß¿]s (ª««•1µX†0ˆ#q±¸"µXµµµ®9P‰Hkjj aG¿2¦K¼³µX?þtÍ`Ôbõôô¸æ@QL˜0AS‹õçÏCÄ‘¸Xuuu†0(Š…|z{{•1µXïÞ½3„A'NTÆx¤j±æÌ™ãšE‘x”•wd«R© ŽÄ¿±XÇB.j±æÍ›çšEÑ××§Œ©Åzñâ…! â˜5k–2¦«©©Éqˆ?ŠÔbMž<Ùq|üøQS‹õøñcCÄÁ­.ß 'Mšdƒ8>þ¬Œ±Å.Ô+Ö—/_\s µXâÿ¯¡¡AS‹µjÕ*CÄñêÕ+eL-Ö;w a‡øpO-ÖêÕ« aLJ”1µX/_¾4„Aâa j±¦OŸnƒ8~üø¡Œ©Åzûö­! ⨯¯WÆÔb577 ŽÄ¡Ÿ‰?6ξBd‹Ož µXÓ¦MsÍ¢·.«Å5JFð¢ò;v¬2¦ëׯ_†0ˆ#q±Ä£ €ŒZ,±§@F-Ö¸qã\s (†††”1µX£G6„AâVüÆ‚ µXƒƒƒ®9ŒZ,ñÎ dÔb »æ@0\±à‚ŸäpÁ­.¸bÁW,䓸PÖ±ßÌã¿B¸ XpA±à‚ÿ á‚ÍpÁ‹~È'ñ‹~lXEæëׯÊëXp¡«§§Ç5Š"ñÊ»xDxS§NUÆÔb  t8.Ôb‰§{#<ñ˜c·E>‰Ïnà¨Hd,X Œ©Åjll4„Aéð±qäS©T”1HáB-ÖÇ]s (.\¨Œ©Åª¯¯7„Aé°Ž…|ÄCCÕb=xðÀqˆ_UR‹µaÃCÄ‘ø},ž"“¸XgÏž5„A+V¬PÆÔb­]»ÖqˆT‹ÕÜÜlƒ8ž>}ªŒ©Åúôé“! JG-–ø¦3Q‹uîÜ9×(Š––eL-Ö¾}û aÇíÛ·•1µXÇŽ3„AK–,QÆÔb-_¾Üq$þäICCƒ! âèîîVÆÔb‰@„—¸X{öì1„A[¶lQÆÔb8qÂq\¹rES‹ÕÚÚjƒ86oÞ¬Œ©Å:zô¨! â¸qã†2¦«­­ÍqlÚ´I㊅|®_¿®Œ©Åª©©1„Aé¨ÅÚ¶m›kÅŽ;”1µX—/_6„AgΜQÆÔbmß¾ÝqlݺUS‹uèÐ!CÄqÿþ}eL-Öµk× aÇ”)S”1µX½½½†0ˆ#q±nÞ¼iƒ8vîÜ©Œ©Åºpá‚! â¸zõª2¦ëüùó†0ˆ#ñá¶·nÝ2„A‰Ÿ^¼xÑq?~\S‹µ{÷nCÄ!n«Q‹%žãdÔb͘1Ã5‚Q‹ÕÕÕåšE‘øË—.]2„A§OŸVÆÔb={öÌ¥£k×®]®9PâSµXâ{ƒ@F-ÖÁƒ]s (>¬Œ©Åš;w®! â7ªÅZ·n! JG-Ö‘#G\s (/7ÔÖÖ tÔb8pÀ5ŠB|¸§ëäÉ“†0ˆcï޽ʘZ¬E‹ tÔbÝ»wÏ5Š¢³³SS‹Õ××gƒÒa—\¨Å:uê”kÅÆ•1^ôC>‰‹Å׿‹Z¬Å‹»æ@0j±ÚÛÛ]s (*•Š2Æ'OOâbÍž=Û¥£«®®Î5‚Q‹5fÌ×F-VUU•k£«££Ã5 €-N±sØ–½IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/imageitem/resolution_without_downsampling.png000066400000000000000000000022731457240071200314670ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœmIDATxœíÔ=h“kÆá÷M-´¥hký\œÜ‚ ÁÅ'38(¤‹àâ 8 YÔ©DÁ­EÍ褛uPph¢ƒƒ"b¡KA*Ò(´I8óÙ¼9çp®kþóp?ž¢þÊß9šMïà?¤Ùlþ™‡fggûý~¯×ët:+++/_¾œ››«×ë###õzýþýû›››ËËË333eYÎÌÌt:v»½cÇŽjµº¾¾þäÉ“¢(–––Þ¿_ÅãÇ[­Öàà`¯×kµZW¯^­ÕjKKKÃÃë««eY~ûömjjêÇFãæÍ›ív{ÿþý›››çÎk4ÝnwppðÂ… Ÿ>}:tèжmÛ~ýúõîÝ»¢(jµZ·Û]YY¹}ûvQ»wïn·Ûß¿ýúõÇ'&&ÆÇÇwíÚ5>>>88xæÌ™jµ:??ìØ±¡¡¡ÉÉÉ¢(vîܹuëÖ²,/^¼ØétÖÖÖ^½zõâÅ‹¡¡¡J¥2??¿°°°¸¸XÅØØØÆÆÆúúz¥RÙ³gO·Û-˲V«}üøñäÉ“OŸ>ív»###_¾|©V«?þlµZ Ÿ?n6›?~üh4Û·oŸ››+ËòíÛ·ý~ÿúõë½^ïîÝ»7nÜX[[žž~þüùåË—ÏŸ?çÎ{÷î]»vmjjêèÑ£‡îõzý~rròÒ¥K{÷î-Šbß¾}'NœØ²eË£G<¸¼¼|êÔ©²,§§§‡††ªÕê*•Ê­[·VWW766NŸ>ýàÁƒÑÑÑ¢(¾~ýúìÙ³+W®œ={öøñãoÞ¼Y\\1²ÅY¥Y‘-N©ŠlñF]D‹#Õù˜4X¿F¨Õ²ëLºcq‡ÆpÈO´ÇbÆ`¹Ç‚ ]²Ùر€þ.ÜifÜ´èâÚ(ÛÖ!‚E—Vj]Z—­¤z/¼`etê V:÷,¹`årÛz V"7/¶lM ý/¸û—Y°¢û^¡¹ž¬è;½ŒZ`Á ­¥ÓËð¾²׫N/u¿x³cà‰ƒ…™¢ LaðCu›—8Ëg$üU÷~j-C †m«móp!)µ¢õˆÜÏ8樒šè°ê­°{äS:/}||Œ±Mq‰‰?#;T‰qWXrR3YuâÏË[!ŠY·>;;”~A· >A;œ3ü!ÏÛ$™f©jj²#e+t¶ùŽ‘°Ê §|·œ%Î9ëûd®oæ¹÷•¼²É§ß‹²ªÀõÔtKU„{Î'ô˜¥ø=zÅ>ëèôtº~p*æÕ9VŠš´÷:óâÃ?äÙM‘2S(ÕëRÅŽT­ÑÕê£`— –Ü[Í׬ºŸÊý­\{¬â-^~mÕ÷ÓÓ[©&ôy>Y¨¡¯älÅ|¿bÿÑGH/çcノQÎÓ9V‰ž|é]çÝ”hË÷"ýÍ>ÖïÌúEÝ,ÞŸÇòf|쌶(ûý¼=¡ºg‡æâ{OÿÛRVnÔFm˼?(³líÊø€Ô#P>½<.ûÏS¶“7‹l}ËuywUç‡=ÇåSG vogIÛ_¶`_º[­‡×ïO«ud¥Úx¨˜_¿x©v µT'÷óD–jæ•·/Õˆò´ôÒÒÓO<]Þ€'ïòTA®¤èÛ9_VØ”jXÑÜû2÷ê—–dkܱ!X¤‘dØòL† 2±!Xäa̲ÍB°ˆ2<[îX„,BpÄØk–‰EÁ"„`B°€ƒÞßM,B! 8nÔ5ËÄ"„`B°!XÀ)Ã?Mʲd‹(²EÙ"Šl¥µ&^D‘-¢ÈQd‹(²EÙêùD6ÿ–·œ´ÙIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/plotcurveitem/connectfinite.png000066400000000000000000000010431457240071200265020ustar00rootroot00000000000000‰PNG  IHDRÈ–¾PN pHYs  šœÕIDATxœíÝÍv‚0€Qìû¿sº°õX ˜ŸIˆpïÚ‹ïLPt\€RJ)¥£¯‚Ó¹W¥-"=÷¤-bü/I[XÍÈ-Möëѕަ£-ŠeF£-Êä£-r•¶¢-²…xª"ÞÕªú:ú€ZWW‹‰Ÿê‚ãj1±à#]s\-&ó³câ=’Ò‘lz!žM/t±µéeü•p;i‹JÖ¼ÐEN7Ú¢Œ5/tQ”‹¶È"”ÁüJjWã™XPŸ"žªŽâ(„BÆÕL,(a\l³Å…ÅCh>Æ}\ZD²wŠ.ì"ÞKIÂ"†…fwæSõ [Ã"%=ó²¿EJ&§ªî¼»üu0àŒ%U<“3uy³BSVØÃŠæîËÜ«_ZHk"î¼³Á"FȰå+ 2±(!XdH³<§G”,ª Ï–3%‹‚1ö˜ebQB°(!X”,þoø]1² |ú‰4ð&pܨg ˜XÀqgž¯qíJXÊkù8Ÿ*—Bà%GÇ‹ %‹ë]•*g, Ø…A ¨äÌÎõ.O•K!P£â"hbÐÐ/äyê¶[]š¦IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/000077500000000000000000000000001457240071200210355ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/baseroi/000077500000000000000000000000001457240071200224615ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/baseroi/roi_getarrayregion.png000066400000000000000000000145351457240071200270720ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœIDATxœíKsT×¹†W7’ºpèÂEDqŠbàªÌsÆ©œÊ gò°=8ÿÀCÎØWŠò܃T™ä7 *q’Z ÔRwŸëЫßGîÝî­/1•÷±V­Þ7}ÞþÞý]VJÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1æß‹Jß¿lµZ‡xæçI¥Ò§… ”9ë… òá§Ÿ~š¿úê«|822"?ûöm—£¥”žÜØØÇχ»»»ùðÈ‘#²^N±³³# ä³³³ù°^¯ËúŽ?ЫW¯ºœŽ,0¥tæÌ™|øúõë|(£û÷ï§~©öýKcº`Ã2!ذL¥|¬ÑÑÑ|(>“8wïÞ•Ÿ=z4...Ê‚sçÎåÃ'NäÃjUÿ«h4]~NæÍ›7Ý8>>žÅÅ9yò¤¬ùòe>¤¾‘Ê%=}úTÖONNæCñêe½«ÖjýG_ºP*¤“Ë´¿ýíÍÒÒïì´¿ü~ûí·ùz~§Cá§yÑ,ò¡™"N¾k‹Ýˆ†M)moo§®ˆî[[[ˇò;AfÊws.ÝJÓ—oý…ÿiIì(ס¿þõ›¿ÿýØïêÇÖß»wï_ÒÉÙßOKKÿ±±Ñ³üéOÌPÊÊEŸ81. VWßåɉŽ´Ô—/;¾wÈûãÔ)5Üׯ;^H|eNMuœqi©ãsÃ… zÁëëg”?sJi}½ã çç;"04,1}Š A*®÷®ýHoÜÐä!bË„`Ã2!ذL¥|¬³gϾÿ÷‘#o_¿~½¾Þ¶TqÆ%C#¥4==kµš,N¡æ’âzÓÉ;uêT>äæI‚zOBF"<)¥Ó§OçCñåé)KÞËÔÔT>¤S(Î>äy5Õjµ^¯çn\ß®:ñË„`Ã2!ذL6,‚ Ë„PJæ!”f³9::º·×þ-Ö>ˆf9þ¼,X__ﲞ\¿~=Š(c­„DT¨ å$DÃïÚ+++ùPD\B´qff&.--Éú›7oæÃååŽð+e²D™x…yAÊÞÞÞööÎêj; :½ ~c™lX&– Á†eB(å¼çi!•J¥^¯ç!)¡#)Y"<‘˜ŒdkñŒSbRŠ8ËRBÃ3гÿøñcY/1(ñµ‰<VNKÔèÆùOLôˆ‰Ô™kÔh4ÆÇǧ¦ÚA&õßX&– Á†eB°a™Óyo4ù§jIf"²`aaAˆsÝ=Ý*!½IÚ±Ä~xx8²hG|áçÏŸw¿zßBá—qA¾ÝK½41H(÷®F©ó¥d(¤‡úÆo,‚ Ë„`Ã2!ذL6,B)U˜G<*•ÊÑ£Gs%uÀ /ˆ c'V‰±HB³‘¤FET%¨BÊXQ…R¥#æ„§\¯AT!¤ŽHBF¼à¦yÔ«R©4›Í¼››ôßX&– Á†eB°a™­kòž`žó$-uÄMp錋ó.j`uuµs¹zë"èêJE][[[mÑ!’DDbBˆFj`B"aëX‰¨¦ÝI™ÍÅ‹eœBÈãKY·²'PSQaCF¢:™Û˜Ç|vww#¹ðä迱L6,‚ Ë„`Ã2!”rÞÅU<}útµÚNè‘ø€8¶ ®1 ²÷„¬gɼDTdé¶•àKNB–øÂÌÇ’°ƒT’&·Ìt(9…äo±å˜Ë~䀲³&«tD4ñ€"$¥Š†!É—b‘Œ<}Ty²@ÚB³Í³Äd¤ÊUa«Õjµ:N!Ç/ƒßX&– Á†eB°a™J9ïyáÈ‘ÚÈÈÈ»wí(‡x¾¬Ô}@Ä[—ì":ûâ{Š·ÎÅâŒ3aKN!¥,ÉwžÎ¸ì)"äŽ#ä‘‚vü’[¦Ék##­­wùcáߨoüÆ2!ذL6,‚ Ë„PÊyÿþûïßÿ{oooll¬Ñhw_•Òúæ‹‹‹ùéMòÝY¼oî=.®«8×tÞŹ–nX `…»Ë‡oúÎÒaKšÕr‡ÑâË3K È÷DÙÙÙ9vl4¿HÆúÆo,‚ Ë„`Ã2!ذL6,Âan„)ùX²‡;ëÇE4Ý»wOHÙŒhÖ‹Ê“þ[ì§%ÙQóóó²@va‘ü'ÊLÑ¡ :I Gž·<‘”2IPcŽ\R÷´F£±±±ñäI{ eißøeB°a™lX&– ¡”óžG$ªÕõãÇ7ºiÇ{èHЧ9==­×‘ß™”˜ŒD`Ø]WŽÀ=T¤B|mîÀ811‘YÔ/)h’ÿÄö¾Ý»ë:ï̯ÊØjµÆÆÆ&'Û7ÅPßøeB°a™lX&– Á†eB8ÌûíívW`É’ã&õó™››“¢ª$DÃ9‚ôa£Š”ÔBÑt *IbJ €È1è$3’èÇdJDˆ1¥Ë—/çC á|——z½ÞÈ¥¥\üÆ2!ذL6,‚ Ë„PÊyÏ#­Vkpp0ˆëMWW\cæKIÈB, ˜H Œôi.,`gÑ‹üDÜî8"Ðw–R%©ñøð¡¬—/‰)ñøâ}óŽò¬¸cÇö¶¶vó¦b³³³éðË„`Ã2!ذL6,B)ç=ÿŽ\­®7›íOÉ’%[õ%xëÜ,›™çCvË•SˆïÏý%Çgèü’vvvêõŽ(·í¿±L6,‚ Ë„`Ã2!”rÞsW±R©Œííµ“®$þ ¹G µ ,gVÖ³ô@b2’®Äõâ}‹kœRº}ûv>¼víZ>dhQâì'ÔƒÈ-ó %ÈóòåË|È&Ç¢6˜‚–?ÒcÇš¯^mç×ÀQßøeB°a™lX&– ¡”óžg8µZ­jµš'÷Èwgvnßœ…ȲW¶x²Ì¯’oñâêr½¤+±V[ @=zÔåz¼in‘";*ÊóK½4¸5Àý»?±Ô™C¶»»;66völ{ K«ûÆo,‚ Ë„`Ã2!ذL6,B)U˜ç3U«›ÛÛÛoÞ´UÄD%áH;«„Œ.A<`÷&Ç…²”ùXSSSùPJà0)l º¯PEJÌGZŽ1ÝJ”5SÖrŽ­ïïÉ/’Aª¾ñË„`Ã2!ذL6,¡mq‘Rj4::¥Jv““ÄÕe1…äKI/Ú;wîÈz©…l7’RZ\\̇ìw%)e ùéS…MäÒÐK|óT$(_D佯~ WHû)È2ï¨oüÆ2!ذL6,‚ Ë„`Ã2!”R…yH¡ÑhH•Žh"* 8°K˜„8$ä233#ëExJšÞÒÒ’¬&%4 !Â2!¹`&îå;Ž ç¼ÉqBŒ[ªHÑ=÷ò¾Èããµfs4’Y¿±L6,‚ Ë„`Ã2!”rÞóôf³922R¯·£.âi2yH6Ø`>–  v“çWÔƒtÃJHðO9¡HF2ÌXö#Î2‹dº·afFnAôÍÊÊŠ¬½ÂGš ¦V«µ¾¾þ´ ;~õßX&– Á†eB°a™J9ïy†Óàà“jµš»Ã’™õêUù¹T Ðu•,ù2ÎïÚâÛŠ+ÍJ‘ìà%þ¾\!w÷ç—ÛŠ4vë¾a"w(‘ f‚—(ž¡¡¡ü'L‰ë¿±L6,‚ Ë„`Ã2!ذL¥TágŸ}öþß'Nüï'Ÿ|’R»ñ°Äp˜n% ¸'»„\$¾Áøƒ¬M$%1 !Š,9…$‰hMÈÇ¢•‹h´Z­&ëEùJáU§À(V~ ¿øÅ77+•ʾŸáŸ oüÆ2!ذL6,‚ Ë„Pàýu¡ÕjåyøùË«?ÿù^½j÷gºuëV¾ž‰úâ*ž?^tÏÐâ¦óâ,ONNæCn"ë™1677—¥Ã#0â›óŒÒ™ŸŸÏ‡÷ïß—õ¢Ä[g‰½D±XãŸ'„}ñÅN³9~ëVûO&Çÿî»ï õÁá7– Á†eB°a™lX&„CsÞ¿þzë7¿é¶u6;·öíñO¸B9…øÚÌ0 }DûûéóÏ/üõ¯í¬CtÞKÖÇü~X­¦ßþö¿òß|óM>œžž–#ˆ £Ñ$ňdKhS& Æ”dó¤‹n-,’TD¶U–*y&¢ $ÄĽtÄpY&”Ûn«•jµŽ3J&ãææf߆uhýšÍ´¿/ÅL×T¯ëŸM°ôHüÔ ý´õÕª>DÌt  ]/,\Ð}˜Rª×»=¢]/ï\°Ùü'ý_Â>– Á†eB(åcâu˜Ÿ'?7eŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1æg…Û™nükZE~ýõ×2óÅ_äÃÁÁAYÀ å«««2311!3l¿É/¸/{rÊfé ÿ`¦¦¦dfiiIf.\¸ 3Üçbhh¨p´]Mu¼ånuìžJ¸eœüŠÛô=xð ð°?†;ú™lX&– Á†eB(å¼sã‘‘‘|HטÛð tç醮9yò¤ÌPLôâÎÓ«“î'-›Ú¥ƒä÷4à”;²ïA:H^P‚Èæ\#{â•Äo,‚ Ë„`Ã2!ذL6,B)U(û¶%ì´–ohøT+ÜcœŽ^â’ׯ_—ª0Ùö-¥tîÜ9™¡*äöqÜ/ŽA•••™¡v“]æRJ3332ÃðÑÍ›7efyyYf¨‘Ïœ9#3rÍ[[[éððË„`Ã2!ذL6,‚ Ë„PJ2ü$ÛqS+1mÙdŒ 1Æ·¹¹ÙýÔ ËÏNÍE©Ë³SK>~üXfñ¤v#|bTŽŒKÞ¸qCføT©¬E·2w² ~c™lX&– Á†eB°a™J©BјlY¸`aaAf¨ÔzÉeî%ƒ_õz]f†‡‡e†7E=õüùóÂ롚#…ñ»aÌñîÝ»23;;+3kkk2#)£¼ñ2øeB°a™lX&– Á†eB(¥ )©¤ï³()=X%Çh3?©¸¤Rc„‘·@ÝJUȺ·oßÊ (¯×CUÈŒVÖB2.É»`+ÁÖ2øeB°a™lX&– Á†eB(¥ ™)ý©_¨°¨ï¨ Ùd‘í$©{ e²' óE™±ùìÙ3™¹té’̰yË‹/d†Oƒ×Ìûâã53NÊŠE9R¿±L6,‚ Ë„`Ã2!ذL¥T!Cx"4Ø´¾—~/½ÄÔ¨›ë%‡“õ€/^,<ÌVGr“j7vefl/U–…GžXa0ñ'á7– Á†eB°a™lX&– ¡”*dYœ´ý¤2¢ÂbmOø+†)›•v7¥ÂbÍ óE©@™AÊ8)c|Ì_åÓàC湘wÊî¯ìÈ*÷EiY¿±L6,‚ Ë„`Ã2!ذL‡œA*†ªÚäìÙ³2ÃìP®aGê)fuò‚™SʈƒhT©T Œò8Ô¿Œœ2zȨÕn/GÞßßχޯÐ|ذL6,‚ Ë„`Ã2!”R…”x"…¸73©žXëÇ®5ŒÄñȵZMf¨ExdjIÖú1~ÇÐkù|¨ø¨ï¸†bX›ÉH¥DE­ Í€ Ë„`Ã2!ذL6,B)UÈ™(Öıj4j@æpRKRQ2Ó’úŽq7ž‹õ€ÌD¥N¤¾ÐçÏ#s £‡¬ß¤&åÓýËÀnüÆ2!ذL6,‚ Ë„`Ã2!”R…ÜAâMT|‹‹‹2CiÉXÕ×PõP©ñ8Tjì8ÊüUž06Ç(${™>Òtn¥Nä ½É Ëà7– Á†eB°a™lX&– ¡”*\^^î>ÃN)TF÷îÝ“Vö1îÆè!õû²9œóóó2ÓËŽŠÔ›Ô¤½Äù|¸_!3c™sËÌX^¡èhþ¤ ~c™lX&– Á†eB(å¼3KNè%ÕnzzZ¯ ©mt–yd†bxaBÖ$,Û¢‹Íäĉ‰ ™aÓ™Éf½lhЋó.çâaËà7– Á†eB°a™lX&– ¡”*dŸäÄ1Â(ÐÜÜœÌP=18Ãò&‡Í#©™fH5G•ÊÓñx§ Cq†‰~T|L!dhˆðòåË2#™;ì•Áo,‚ Ë„`Ã2!ذL6,B)UX¸ÛµÂ8£uTŽ,¥b—‹^lp†¿¢ºä6n„‘JÊj†_>|(3L!dì’ç¢J•;eVfüÆ2!ذL6,‚ Ë„`Ã2!rSIÚäfÚÔ€Œ|Q—1Ʋ-ž‹ê’›„Soö­£Nä]^ŠÏØ™ƒŠª‘S®¡ŽÕìò/ó`Ã2!ذL6,‚ Ë„PJ>}úTf kÓ¨°zÙZu…Ô€l ÒK„‘G¦.cN)U*£‡¼/žÚ×ÌjÒ+W®È #ƒ<—´œäå•Áo,‚ Ë„`Ã2!ذL6,B)UÈQ Zõ²)w/ù¢üÕ%c|̢䯨樰nß¾-3×®]“æ‚RÛRK²^’Oƒ×Ìè!w}ç+¬—äc/ƒßX&– Á†eB°a™lX&„Rª-M$ÞÄæ÷”T+ÏŸ?—ê æ‚2zH­Ä_±ör(~=zTx…ÔeÔ‰Ü wÁû”Ro2rZøT{I‚í¿±L6,‚ Ë„`Ã2!ذL¥T!剤)Rõ°fB™†JÃ#÷²D/*•¤SSS2Ã0Ìê쥯_/Z’ñDn‡Î É©¾©@¿±L6,‚ Ë„`Ã2!ذL¥T!剤q2†E­Äú»^ö¸sçŽÌp‹r†2¹?àââ¢Ì°›({¹,,,È ó<{é«Ãs±“*_/š”ª™ tww7Rž—Áo,‚ Ë„`Ã2!ذL6,Â!׊ð¡Vb|Š9œŒŽ1~733#3T ¼¼¥¥%™¡.c­c…½Ô9ò.¨ËzÙ"÷Å-$åNˆì?#ªyvv¶ðbzÇo,‚ Ë„`Ã2!ذL6,B)UÈžÈæ1Rzô¢ê%_”ꉱ9ven*5Wa¢l:¨b‘‘Jf´ö²ç…DôÒA÷Ee½²²"3ÔÈòä7¡Ôo,‚ Ë„`Ã2!ذL6,B)UHI%­8¯^½* ˜tJÕC±Éø]áî{é ]ÆN¡Œ²±o*µ$¯™j—y°<õ&óiùĨy®W¯^É ïBrS݃Ô|ذL6,‚ Ë„`Ã2!”R…Ÿþ¹ÌHpJÑCîA±ÉèuÅŠæ=]7(ß…šµ|§åòl‰_tjætUu÷î½ÎÞgŸSMÿ“¯iÛöÀïžf&“ÚN‡]éÇ?þqÿð'?ù‰uxë­·ú‡—.]²wïÞíÞ¸qÃ:¼üòËûw¸råJÿðÓO?µÇïž={Ö:|ñÅýÃétj–——û‡‡îîîîZÿo¿ý¶¸¸èïÚÚZÿðâÅ‹ÖáñãÇýí­-ë°¾¾¾ÿ%ìgúôië0›Íú‡=²›››ýÇ6ÿ<þQ=Ö—_~Ù?LWi¿þwÞyÇ:˜3¸zõªuHe˜Ï[ZZ²'Nœèæ/Ï^rïÞ=ëpæÌ™þáƒú‡;;;û_ѼKîäÈ‘#ÖÁ>ØcÇŽY‡£Gö͉6ñɧÏ3¯ùÌ3ÏX‡—ౠ„ƒ÷ÕÕU:ÔüéO/\¸Ùï3÷Çm?¬+äKŒ………þ¡ ²CÆö’3:thŸy¹·d±ó7á`rØg ð.ý{XZj~õ«Kýë¿hç|ï½÷¾¿Áû/~ñ µ——×^ý?Ûö/ý¿ÿýoú‡'Ož´3Ø87]º}Iig6ÆÌïàܹsýÃo¾ùÆ:ÌÕJ»„ݤ©y¦–R¸²²Ò?LS¶dÚ®aîWžbÚW®ü÷Ï~ëµ×ÞìwÈ÷5€†L›æµþñ;{¾ÔÙìÌÞþͽ{{Æ7ùf̰¶··­ÃÆÆÆ>ý›¦Y\<¿÷–ü[ÜÝÝ1Ý¿ïþÃ.aC¢üÎÌžûì³ý;䬑ÉqNHôƒÙû÷w76ŽÚÛ$*„§—ƒš+t4wŽÙ6é±Ìçe‡Ë—/ïKôso6‡c?Ü&ÌG}Ô?ÌÒÜ9›±þy“™½37™‡yÍüä_|ñEµÏž}°°°eé·™„ÆcA ”0P û“KKíd2±œ[sŽÝòR©kVš<7£“V»œ9${IÆ‘ØÀ9SD6”Î+š0å=[ FÎùX’)Çæö®S¯û_Íúúúl6±ṳ̂ãðXP†% ”¾0--ÍšfÃB0+²Ëºû÷ï÷Í7¡Ö¿‰4UŠ‚I[úYÔ–«üþö·¿õ_}õÕþaªVI&û”R+-‡”©5{›ù¦l’'Å´?,Y^n×Öæ—5<”€aA ¥°Yìì´mÛZe³ô9K` ÒôØùÃÒz)…&4Y¸mgøä“O¬Ã+¯¼Ò?4ÉÈ@ÕR‹6Z˜¥‚Ö!ÅÔôÝjšèœVêËñ“'ÓéÔ>ê|ÉðXPÂ@Õ¥?¾;nX©±y‹¬¦Ê\ÃLî]a¹±\®n?Ä\xhçÌ‘² í yE럫)ͤ—µw^ÖÜj本,;ôϹ²rqñ‘¹Iê±àéÂJaßß.-ÍÚ¶µróá9x7qLÕ°96!Ëu>¦s—Äd^Êf`ì=fñÂÜ)ËÆeÆÈ °òö’|S¦×¹Ð·¯øÛG—³@ÀcA ”0P ûá̤mÛý÷ßÉ\¬—™Nee—ÈÝ(­ª.ƒ8‹†rÁªÉ±!ß”MLYÅGþ%GVZ˜)%ÓT:ÛA3?ؽ‹ŸL§SSüÌ® % ôXý_Þ±c»“ÉÃýs!™M±²”éTNéØX;+m6#g?ìÁ»9ºïï0Öü#1»'âþe¾ ˜ ý£G,íÑëÜmÆ^’36v†þ›å¾}1üû\bx,(ÂD wšP +FHQ°00IÚdEv°*RoTÖ_XÐgÚÚ„¬ØlI†l&¾sw ȇÂYÅDÖ?šÚfå±-ºÏ¯Ÿ*ÛØØÞÝõ«dòlx,(ÂJa?Ž˜L&³Ù̴ςĔBs¿ù,ÓÊ\c±Lv0)LY±/¼ðÂþ÷`WÌÝf¬CjŠq™Þ´w‘+ZçVÚ'Ÿ‘o¿ŽïÈ‘'‹‹;Âç bx,(a Çê§pÚ¶L&V/eCï¹ÏÈ}žl‚%ëeíÇšóÜv¹Ç\TÆmvÖ<œ Õ›ÈåØ|îÞü–ËI¡Løsݪ=¹m:}lßEÖ¥ %`XPÂ@)ìKÛÒÒîd2±<–ÉJîylã⬅²qn®%·i¢ì`êœÓJ6Îq®iÄÜj*“Â,Ù0Êji‹òc±$•Ñž(–³FýÉ´ÍÍÍÝÝ]û²²L|x,(Â`×äííݶmMGÌcg>Æúç³tl‚%eÅt*“F6‡3÷yÌ)Lö‹ Seæ.ã±Ø6¯hbšÕ ¦øYœhw•ÛýOr6›M&›zʵÁÀcA ”p VgMd#çîîoÛ^Ú|‡D­pouuÕ:Ø=d¡ŸÉJFX&¯6ב‰D‹CS|Meæ>µ&S¬o¼ñFÿ0z`÷iáþw‘kxön€§™ðX[[³ÉdbƒD„ÎÝÝÿå—_¶¶(/'7쇕³%V•36Vîl[Á4QÌd)¢œ-1hû 41üÏ©w{›YXüé§ŸöÓåØxß;5{Óo ÛkkoÞÜóeåE€Ç‚0,(ឥsâÄnÛ®Ùü†Ö³lÈümÊ ¥ç¦ˆ>øàû‹ s¿šœ“1ì]ÌM2™îäÐÛ Y mç|÷Ýw­ƒ©çÜåçÖB>¼³¼¼¼ººç“ù‡#ú<”€aA ¥°pmo·“ÉÄrïG?úQÿ0„ýUüGŽì:´en%öðôâ—ïBŒEî6Í«Mse‡ð½ó_Mó?Mó›ý;å÷ûàìÙæ jYáàg?k~3Ǩ‚B ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”€aA ”°ø¯Ÿbg§¹}»ùÃþõ3Á÷Í… ÍÿXræÉœåõ×›—^:3Á÷ÍŸÿÜlnþÐ70BfG¿ï“¶mè[ø˜LÆ÷MŒCÃã[f×d(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(Â0,(añ‡¾!üîw¿ëo¿ýv×8räH×ØØØè.\èß|óM×X[[ë§OŸî‹‹û·oßîGí‡êOž<éÿk{{»;\XXèËËËvéÇwgžy¦kä«=zdWTãÖ­[]ãäÉ“û~ O5x,(a”kss³k¬®®vk×®u¥¥%ûËÙ³g»ÆÊÊJטL&]c6›Y¹–õõuëÜyù¿ãÇw{÷îu¶m»Æ±cÇìlrBgΜér]jè†ÏŸ?ß5äbÇ JÀ° „QJá¹sçºÆ7º†FÐR. ߃º†ÆÂÓéßN÷ïßï;;;]C'µ®mmmu‡øëŠïë´—.]êÏ>ûl×ÂJu!) nO²>FðXP†%ŒR >|Ø5”¾RêH*ùí·ßvŒÑ$1R@é¦îĉvæN³¤¹JD)+&Ôk3´Tx¨8T±¤nOQfkŒà±  J¥J#”áÙÝÝÝ®ÑIÕ;wì$’9¡UZ¦jAEŽŸþy×Pôª9ÍŒyÇ JÀ° „QJ¡tJ³~ÊRJ>4+'e‘Iݤ›ª–Q]B}º3k®P*,õÔdŸN")Tª iSçOIÕ=Œ<”€aA £”BéÝáÇ»†$FiFé¤Pº©øK‘N(aÊ%b]nSQ¡–—) ªétZ]Hw¥›‘nªàG¯Ò¥Ç JÀ° „Q:[ÉGj¢þ¥|¬Ibô¯ŒÈ¾þúë®!ÉëÄK=ÕÐì¡zæz@)`ÎWê„Â̼«Ç‚0,(a”R¨É8ÕafmŒb4­àS &U–Re3*kÑ«tž.5*R‚T©þ¥ ©F7,uSî4ßKftÇ JÀ° „QJ¡´L $…E…*ÈTÎS…4’*tÊm*Sª•ïŠeÑ©41—Ï«HFIT_K#ÕY7¬RJ=FðXP†%ŒR ¥w ²$LÊ7ªF ¨)Bé¦ôN¤¿äþ3þjÖO ¨t¨$L7#áS ¨¿(rTŽ®(f‰=€ƒaA £”Bɇ”E™â;©¤4Q¯Rç,Uø&”Jv'”ð)<”&Jïèåì¤Î/¹Ô 3ãªÆÁcA ”0J)TæP ß_|Ñ5R.3K)õ‘TIÎÔÐìa—ÀÌ-k2~Ôãò>%¬Bw%ti¥vÇ JÀ° „QJ¡¤Y—¢¦4Q“}>©¤Â7Õs*o)qÔ–ÚÝBE½V‚•á¡=‰£ô4'.•VÕ ¢ê_c%`XPÂ(¥Pz'$C ²´LOz'¹TçÜžT‹2¤Gšaì„Iê–›oë$JÒ*«’I­ÂØ”B½Š'S8”0J)”ŽHb´·ŒF=I ¥ÐOSx/^ìŠ.¥€šË³eº´jZtEŒjdþV§ÈQ ¨›‘kmãÁcA ”0J)TN2WæÃþ¤>ê,qÔ¤žôN!¤¢K5º3çv4ê SX§R{ƒëÎõ/½J’ªò°qÂF)…¹àN—Ï"”²(SÄ—{nk-FŠl—VÍj„þ¥L¬fSj³UW”J2Wà`XPÂ(¥PÑ\îÒ©y@E[ù$Ü}í”%g]Œ& “æ…tWꊪÆQnÖ6;mx2@‚aA £”BEj¦\ùž2¤iæ.7^Ó¿ÔYšõþûï7Mó /t‡ù\]ÝŒ=í·Ú¬ºQÆ5#G¤ÀÁ° „QJ¡rž ERR@UjQÉPtùLyuVAN§›7oÞ´¹ù¶â;…ŸºÏ|B¢âD…‡¹©éÁcA ”0J)” Ht4E(•”²è_T(©OtJvŠÞ¸q£;T즆nF™Ò|´„”Zµ¯Zt¯ÀV·'¥#x,(ÂF)…YÓ’[açvÙZãO—€j=þ—_~Ù5TÓ-Á¸|ùrw(™ËB½Dsš¾TR _î®XuŒà±  J¥ª¦%í'eÑÔ[ÆwÊ*K)IÕC+$gŠ»¨P:%…•„©‘ëu!­øê½(ŒÕ¿VWWÿ¿Oàé%`XPÂ(¥PŸTCiFɇ”E %•Ô«Kæ#ï•M•xus1…Î&ñ͇ª³´;Ÿ*%9Öë†Ç JÀ° „QJ¡$F¢£¼e®T^T›ÌH5E˜›žIà4…×I•¢Bin.0ÌŒº+åEuüH…µxŸ RÂF)…o¾ùf׎(ÈRx¨šÉœ"2É„Iê“ûÏè]FT‘Z>ù"÷dËܬ:+Ì'Sèå”Í8þsyúɧÙü;Ž à©â&?ß»âYktIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/baseroi/roi_getarrayregion_halfpx.png000066400000000000000000000147541457240071200304370ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœžIDATxœíÍoUšÆï—?c;±ñGâ$C$Ø´z9½îEkÔêm/[Äzê¬Kú˜Åô¢gzÑ+ÃiDœ8!_vœØ¾þ¾×žE1¨îó3·ªoùM¦ŸßqʧªN•ß¿O½ïyOJÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1æ‹¡Ï<999Ãq˜ÿ› h!*w½råJ¾ùÖ[oå›üq¾966&§ïííõ¹ZJéîÝ»ùæööv¾ù /HÿV«•oþðÃùæÄÄ„ôÍ7777¥Ãääd¾yppoÖëué/·ØÝÝ•r‹¥¥¥|óððPú7=¿ §OŸö¹,/0¥4;;›o>{ö,ß”ßÑ­[·Ò Ô>Ó˜>ذL6,B%k||<ߟIˆ¯¿þZNÎ7oÞ¼)òÍ©©©|³VÓÝn·Ïéô`Úívÿ ž;w.ßgzzZú?zô(ߤ¾‘ ÊîÝ»'ýçææòMñêšÍ¦ô——L·ukk«O“ÏX&„J3VJ©^?ùõ¯ko¼ñ_½?|’oܸёs›Í){||,¦§·ÒÏà F® ÍNGÀ9 èMëë=ýÇÇw¤ÿÞ^OÎX##=:±Ù<Ê776t„SS=·)ytT¯¿¶Ös…ÙY}ûûû)¥Ï?^[SI{¶T5¬?üaãW¿j¯®6SJW®|›ÿÑÄDÏSmnö¼””R­Vð%ld¤çOUá7ùEJ“†+¿'ÚÁèhÏ#ìîöüÚšMýšptt”úÒhœô6{úïîꇇ{n!#l6õ•îìô\al¬-:Îôôño»ûûßϦHªÖ¹sÝ¿þõÜŸþt!¥ô»ßýKþGŸ}öY¾Yècñ/N’V¡%MÎOâÒ°óÍÕÕÕ|“>–¸,¼ |y’i§ùX=ßêdÒ•¯V)¥Û·oç›W®\”ívû¿8|ÿýg)ûX&„J3Öýû÷Ûíý­­Úýûû)¥‹{þ}¬¬¬ä›"ˆf })¥µµµ|sff¦ÿx?~œoʦóçÏKÿÌáø N0ÒAšò¡?aey¢ååå|óêÕ«Òg§ÇÇ’ñü²/Wà¤><<ÜlžÔjµìÏ…LÉì?0ž±L6,‚ Ë„`Ã2!TrÞçççÇÇ×÷öêóóçSJOžô|• ÉÐHpöåôw¾ð+‘tÏŒWˆ;ÏŠ·. $“‘OJéÂ… ù¦Ä”ø¡Nò^ÄצÚÄv˜œœ¬ÕjCCCYt¨pãË„`Ã2!ذL6,‚ Ë„PInnnìïײ5´‘0×>ˆf¹|ù²tØØØèÓŸ¼öÚkù¦ˆ2®• 7U¡<‚DT‘˜’ˆ¸„ Ì¥K—òM r§”nܸ‘o>|ø0ߤL–µáöööþþa·ÛÍ‚Eb^ÏX&– Á†eB°a™*9ï­V«^¯×ëµ,ñHâ ’ Z˜¢þí·ßJ €HLFÒ5yG‰)1CUœefŒÉÅÙ¿sçŽô—”øÚDÞ ó«$jôúë¯ç›|c¢oDL¤”êõúÑÑÑÉÉI–O+òBÔI'û¯ XDk>>~úô¨ÓédK’äŽÜ t` ‚(aŽ”³JÈèÄ ö/r\(K™µ¸¸˜oÊxL ‹ˆî+T‘óÇt+QÖLYK)MLìÕë{YøK^)ƒTãË„`Ã2!ذL6,™mq‘àiJv““ÄÕåb É—’Z´_}õ•ô—µ íFRJ7oÞÌ7YïJRÊ®_¿žo2}ª°h€ÜB z‰ožŠä勈ƒƒƒéðàÁƒÅÅッnžºtéRþ§|¢ñŒeB°a™lX&– Á†eB¨¤ 766ööö÷öjÝ„´8ÑDTp`•0 qHÈEM‚ð”ñ¬®®JÑh²„&!¤S¸LHÌĽ;w‡Âyvv6ß” ·T‘E÷LÜ[ZZš›Ûoµž,-]âõ%5² ž±L6,‚ Ë„`Ã2!TrÞwvvŽŽŽ‡vvŽB.âi2yH6Ø`>–  V“çWÔƒTÃJÈFO6e˜qÙ8Ë\$Ó¿ 3#0ò¢o?~,ýE¯ð•ŽŒŒŸœœdoï»ï¾Ëÿ”¿Æ3– Á†eB°a™lX&„JÎûÕ«W''Ÿ5®^-ÎÌå•WätÉߢë*j@¾Œó»¶ø¶âJs¥€È Vð_FÈÝýÄùåv¢$Âúo˜ÈJdÀLðÊö;Iÿ$þL‰ÏX&– Á†eB°a™lX&„Jªðí·ß~óÍÿØÝ=×hüsJéwÞÉÿTb8L·’Ü“]d¦Ä7þ¢‰dILBÈ…"Kn! d"Zò±¨C%ä"Q)ÙS>AùÊÂ'ªNQ¬‘‘‘ùùo/_þ÷?þñ_ÊðW00ž±L6,‚ Ë„`Ã2!TrÞ?üðÃÑѵµÚ'ŸügBÄãÓO?Í7™¨/®âåË—¥Cÿ -n:/ÎòÜÜ\¾É B¤?3Æ®]»–oŠ«ËŒøæ¼£„t–——óÍ[·nIÿþ)n\b/Q,®ñßÝÝýå/;óó;ï¿ÿ~Â+’ë¿ûî»iPQ£ÑsG™Q¸ºK:0Nßív§§O¶¶Â'”ª†õÉ'c««?}=ú§üþö·žbö››úkkµz2}gf&¥Ã³gú^òV§‘¿•´ùÛÝn«ÌÍõ IþtÒndH¼£Œp~¾'ŸâáCý2Ç?vy¸Y—G˜=ò矟Ù._?GUÃêtÒŸÿüãÃ_½z#ÿ£¿ü¥gO¶GzÜ‹”ÒèhOÑŸË—5kåÁƒ~3ÖÔ”.×ÜÙéy­ss=<ÍÇêù‡»±¡®]ë1,1ôÓ|¬ž!æcõü¦——{¾ÐÞº¥EPÇÇ{>Éž…•þw°eB¨4c‰Žë¿ÀüÍ7ß”Ó%‚!+Fv¦”b¸÷ލ6)›VØŸ2S¦œþ™„TD–U–)Gþ2rUü1•E>üS+¿^P†”íeÿ̵ÏX&– Á†eB(È»è¿â˜ÿfæcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒùGÆeŒL?.cT©é| G¤ŽïG}$¤.h:ms6Ù½íÔ>,™¬{¸I‰ÑtÚkbÕÍíím9²°° GX˜×aIc^™pó½V«%GXŒ™u¹yÇ,gñ"_~ùeßÁöÃýL6,‚ Ë„`Ã2!TrÞ¹Iø°t¨Ë¸áe\c:§R¼?¶Çóô´îªB›cæÂíO¸3PÊðÙeׂtšàùV¹›èzî‡PÏX&– Á†eB°a™lX&„Jª°0$Û‰§ÓT!PQ°°CC܇}¸Ý-C(Ô¤õz]Ž”¹5)5 ¥7ïÅ#Ô‰…»fòÁ«àË„`Ã2!ذL6,‚ Ë„PIRGH²£cTFŒ²ñå'5· çÝ>|(GÚí¶¡¥žâ½8jI^™Y¸<³ø6æææäˆlK~êuDòUTÁ3– Á†eB°a™lX&– áŒc…Â+“ ÊXX™EZìÃëðÈþþ¾¡bÜÑLÂè!õu"¡ºä˜y¤Ì‚9¾CQŽÎ 5Ï6,‚ Ë„`Ã2!ذL•T!ƒh"X¸nŽ…:fggåsA¹’ŽŠ¯LlŽš‹«íx¤Œ&å«`Ä“ñ;fØêÖ‚é´'åxä—UFü–Ç3– Á†eB°a™lX&– ¡’*¤Ž@cXT4T=\[ÇbT—ŒKrxTOT—Tj¬cS&ْס*¤’ås12È+S“R2ÝWÞÏØØX:;öì», &þ]xÆ2!ذL6,‚ Ë„`Ã2!TR… cÉR>†Ÿ¨•˜{YF…q…`™ø]™•†ÌD¥&¥€âÝ©.ù¤Ô­OŸ>•#T»|.jÉ2ŠX®ã¤æ9À†eB°a™lX&– ¡’*dJ¤È.j²¾¾.G¨Sc†$£ueR"yV™Ý¹j×)_ Õ%c©TÖÔÑì|cò\Ü\² ž±L6,‚ Ë„`Ã2!TrÞé±JD‚næââ¢)S’¥ÖàY ÅÐ1§KK ¡óN¡Àñðu1ÈCâÝù6(8BéSFi•Ç3– Á†eB°a™lX&– ¡’*¤È’º† †¬¬¬È†k.\¸ GÊGä½8eöª(SçGê¦V”ý»ðŒeB°a™lX&– Á†eB¨¤ ™ *á9*>jœ2»Ï3òEDÊTwa<‘÷¢–¤dÆ «€¦Ó¯ԉ¬Ã7Æ÷÷q¶ ÏX&– Á†eB°a™Ôu-O™»ÍóÅ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1§òßt?ë·ÓU ‡IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/baseroi/roi_getarrayregion_img_trans.png000066400000000000000000000206701457240071200311320ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ IDATxœí{l\å™ÿ¿só\<íñxìÄ8q0MCº„~ÐÄVZ"mW•ª-RK-- å–VT*­ÊO jU¶î¥ Tma[ °Z¶,ª v» ¥@C.ŽíØc{ì™ñx<·³|™§§ãǯ=—çó‡õžñ™3ÇöÇÏó¾ÏûžsEQEQEQEQEQEQEQEQEQEQEQŽÇÜÚè“PšŒT èè@*µÑ§¢4 ´Š¨[ÊÚ`·Š¨[Ê©²Ü*¢n)«çý¬"ê–²NlQ·”“c%VuKY)+·Š¨[Ês²VuK9«³Š¨[Êñ9«ˆº¥ÔrêVuKù keQ·`­­"êV«cÂ*¢nµ.æ¬"êV+bÚ*¢nµëc‰F1;»NŸ¥l$ëiQ·šŸõ·Š¨[ÍÌFYEÔ­ædc­"êV³QVu«y¨«ˆºÕ Ô›UDÝjlêÓ*¢n5*õlQ·ú·Š¨[D£XEÔ­Æ ±¬"êV½ÓˆVu«~i\«ˆºU4ºUDݪ/šÃ*¢nÕ ÍdQ·6žæ³Š¨[I³ZE:;13³Ñ'Ñ‚4·UDÝZoZÁ*¢n­­cQ·ÖƒV³Š¨[fiM«ˆºeŠV¶Š¨[kZEÔ­µD­²£n­ jÕrÔ­SE­z?Ô­Õ£Vuk5¨U+AÝ:9Ôª•£n­µêdQ·>µju¨['B­:Ô­ã£V:êV-jÕZÑÕ…éé>‰:A­Z[Ô-@­2C«»¥V™£uÝR«LÓŠn©UëCk¹¥V­'­â–Zµþ4¿[jÕFÑÌn©UKsº¥VÕÍæ–ZU?4[jU½Ñ n©UõIc»¥VÕ3ê–ZUÿ4ž[jU£ÐHn©UEc¸¥V5"ÝÝH&7ú$N€ZÕ¸Ô©[.FFԪƦ« ““kv4皥\F(¯wM¦l >ÆÆ6ú$ŽË±cˆÇ7ú$”UÑߣG7ú$N€ºÕˆÔ»UDÝj,Ã*¢n5 dQ·êŸÆ³Š¨[õL£ZEÔ­ú¤±­"êV½Ñ Vu«~h«ˆºU4›UDÝÚXšÓ*¢nmÍlQ·ÖŸæ·Š¨[ëI«XEÔ­õ¡µ¬"ê–iZÑ*¢n™£u­"““èéÙè“h:ZÝ*¢n­-jÕ_¨O·,˲,k£ÏâäP«j©C·,ËÚµk—Ue£O烩+«Ü}ïcr;wbjj£Oå¯ùîw¿ à¾ûî·džžÑñéïÇþýØ´i£Ï£J}ýŽêÇ-˲b±Ø 7Üàþûï¯T*ýýýfffÞzë-Ô™^õfÖêºÂµ"Ç«¯ÖKNüÚ×¾&m§ÓyàÀƒõ“"ëÐ*ÔO*ê!'Z–uÇwøÆ7¾ R©<øàƒü~ÿôôôæÍ›œuÖYÆÇÇ76EÖ§U¨·T(l¬[–e }õ«_0;;  ³³“íüàkbbBöߺu+€ßýîwÜ\7ÃêÖ*ÔaÄ"õ·È½÷Þ àæ›oææ7Þè÷û].×m·ÝÆW"‘ÈÌÌÌÜÜ\, …BÃLëUÏV¡nÅÂÆ¹eY–ÛíP.—ùJ{{ûwÞY*•|éK_â‹7ß|s±XdÆàñx„Ãát:}Î9ç ªÌVçV¡nS¡°þnY–‰D¾óï¸ë®»¼ýöÛ¶lÙ ›Íhoo¿îºëŠÅ"€|>ïr¹îºë®žž‹‹‹æææ8NØ’æZVÿV¡ž#Ù¨¸µ°°À²,±¡X,...:ÎöövTë[•JåÆopíµ×Æãq·ß~;ªlvv6‰°æõz×$†5„U¨ÿˆEÖÍ-˲™.»ì²Ÿÿüç¨vÞ}>ŸÓéd4"•JE¾†B¡«¯¾šbE£Q_ÿú×Qssssáp˜¹u~~~rr«Ò«Q¬B£ˆ…õr‹b]vÙe~ùË_ >ŸÕ±!S›×ëeWŒn1ëår¹k¯½–b¥R)?ûÙÏP͌쥷Û=V½Õ k «Pÿ©PXÏœHcH àf0ÍfC¡P©T¢O°…4îp×]wQ”k®¹À'>ñ Jy÷Ýw‡Ã-Ë¢}}}+I‘e(b£nY–ÕÝÝÍqßüc^¯]>Èçó^¯—±‡) i¬5är9²Ã¥—^ €=3˲î»ï>¦TŽ8S”Íf …ÂûuóÎ*4PÄ"ë·xŠÅ"µ@5ÍI\¡4¯¿þz.— …BŒC…B€”²DŽG}ÀÕW_ÍÍÏ|æ3Âáð­·Þ:44„ꨳ½½=‘HÐ9»ÊhN,s˲¬¾¾¾¶¶¶J¥B“Êår.—+•J‘H„ƒDÇãr¹ä-ccc™L†›Œ@Á`ûäóù|>ïñx‡Çãy衇òù<€Ï}îsÜÿ[ßúV¹\~üñÇí§ …Bwwwu"r øG}ÞôD4X*¦¦°cÇZÞAšb]wÝuî¼óNyYÓ8ÓÓÓü~?€J¥2:::00ÀÝB¡Ð‘#GíæççQ ] {SSSº»»´µµ˜œœ¼å–[ÊåòÌÌ öÈ#0D1ÿ¦ÓéD¢òŸÿ™ýÛ¿=mdd„ŸRWK*NLÜèrÖÖ-®“¹êª«<üð覼T*U.—7oÞ<>>Žj@bÏfF8jôæ›o¢ªN"‘ÀÒ×ÔÔ»ðÑhÔáp°[”J¥+¯¼’ŒD"xà‰DåÉ'ÇÏ9'Á¡ãb2™DƒèÕ§xÖÊ-˲¶mÛ6??O±žxâ v˜Øãa)—Ë¥R‰1‰ß¥+tbnnî´ÓN{óÍ7–Ø…çÎét€ßï_ZZâHßåÝn7G‘”&J_qž;"²sOOO2™\ZZJ§Ó*Öz°&nQ,ÖÐï¸ã޶¶6ªÃ^#Ë›T­½½£<æ8þ¥éY*•ŠÅb´u¯š Àét2qRˆ]u~ÊÄÄÄí·ßpÅûþå_¾Æ(øíoç‹Çk¯½Öb5^罆žžµq+›ÍÎÏÏ3 )f2ap»Ý¬sZ–•Íf].M°´´ ½½ò%“IæA¹\.PJIeQg¨­p8œÏçûú¬ú§Þ½{[¹üà 7Üàóùn»í6~.t£ÐSq˲¬ÞÞ^×_=û7 $´Áòù|œD5ŽŽ28q<ÈAå»ï¾ €¹_yØX,vøða0[–µ°°À·û|3Ï>;{ÑE[Q üzíµ×ò³¾üå/7D¸B½-M^5==xí5Äb«|»Ëåúâ¿(±„•¦3âp8ìù.‹µµµQ£\.×ÕÕÕÖÖ&"¦Óét:ÍDF2™ {ß±X €Ûív»Ý,hoo/ ÑhîÙggw튱Ð0i{®Í¾}û~ô£­ògÛ šD,œ²[Äét:Ît:Í>Çãa! @2™Ìd2 ¬i‘B¡`!›7oÞ¼ys:fl…Br¨r¹<11a_z …Ø‹ÇKO>9¾wïŽJ¥’N§¹O¥Rq8òq\7Ñ(4|ËÎ*ú[–eqƼçÖ[oÇ㣣£Ž;†êøŸ0171¶¹Ýnvø-Nîß¿Ààà ª-·°¬Eí>Ì£E£¹'ž˜Þµ«Gþ+ìÑ@&“Éçó™L¦Qò š)b‘UÄ­ùùyöŽLNNvvv²Ç P( ˲8<Ìd2¹\Ž#;Æ!F8)¾ŒŒ s“)/‰pÜçõz¹?ª#A¿ß¿u«÷W¿šÙ½; ™Lz½^oõ)j.—+ ñÓ‹¦ŠXdåqKºí¨®léîîÎçó@`ëÖ­…B¡X,²ç$½rZ•Ëå(ŸtË2™ çaP­Aðì“Ñ™,joog.‘¨<ûììlÍçgQ¨v¹\.—kbb"•J±*ƯEŠ…“q«P(°PÄ+½ø|>ŸÏ'A‚*N§³¿¿Ÿ} $¦'~eAAüò*y¥R) ¹\Îçó zžyfzx¸˜dŠägy½^æJTKí<Ø@yÍ*VìWx`èZXX`tñù|‡âT ßï÷ûýù|>‹IñinnNÖ`¡º”Ùëõ2†9NŸÏGÏ\.W(b4:tè÷ïì\üÕ¯ÒgŸ2¨NgffºººxœÁÁA—ËU38m š­eçÄý-˲vïÞ `~~ž Ø)ÇìììÑ£G¹þ@©Tšžžž®>è}|||||\R6›­T*b&3?r¹œô«P rÛ¶ù_|1ÑE[].WGG“&Ç•JÅn’ÏçëêꚘ˜h¬p…æ äÖ±cÇ.¹ä¶Óé´½ã K¯œ°§ÅŽTGG‡Ï瓵¦–e•J%©×³Nao±Xdíé)>÷\ê¼ó6-..Æ«w4t¹\}}}}}}ÜœŸŸŸŸŸ—\#ÒäbaãÄ……{P9ãŒ36mÚF%©ùý~ùn4eçZÞ¾´´Ä¥/Äçóy½^ÖHøýþB¡ ñ¯¿ÿþïs’x<Îò=·Û …@$aÌ ƒÌ¡ Gó‹…ã¹ÅòU0ŒÇ㜃ëîîƒË«í’õr¹œÐ,..ºÝnŸÏÇþõÔÔ”=E˜™™± —L&‡‡ÛŸyfúì³{XtÍd2###,˜ù|¾……I¸&''Y|ß¿ÃåA4q罆å}ù`0xùå—£:Í,#A©[ÊŸ“åuf@ûð°û?::Ê¡œ×ë²­m›› ƒ^¯wpÐóØcﺔÇãáì!ªU‰l6Ë#OOO‹gœq†ÝÔÆ¢UÄÐÓƒdÛ·CâBM)a~~Þëõ†B¡ÉÉI.SÉf³r¡=+R\mÌW8©,ݬîîîR©Äú;w¢Eooù±ÇF?úÑDÂbO+•Jq!!ªkšYmgÐ*—Ën·›ÇoPZH,±’Itw'÷ìÙóñÀ-·Ü ³³Óž†âñx2™”²$CÚÒÒbß‹/rYi<F£ì¹ó]KKK2'ÝÓS|≉~ô4Æ<îÀz,{Wv¿9KÍIIhÄ<ˆécÙ‰Ålïè(˜žžŽÇã24+—ËårY–žžæG¦¹r¹lë•Ëåh4*Izñ€×–J‡ÿíß&Î<³c~~>Èê.©TŠ,‘ Ûíf7ÎëõÚ84-'–eY»wü뿾ÖÛû^´®T*.—‹ùˆMOOËÊt©T*›Írî_©Tdz1—ËÍÍÍq H²Ù,³Xooyÿ~$eYq €EP(Ä@z{{ÙQc0ãñÿ" ÓrbXXXxðÁÿå•ÿüüó»\.¹#C¡PH$²øÀää¤t¡»ºº¼^o$aÖ ƒ²‚kd.hË–¶§žšÚ¾ý½u –e¥ÓéwÞyÕeì4LVÑ Ú’Ñh´ë¢B+ŠÀétÞsÏwžyæÝhô½•ìRÒ,—Ë]]]Dz,öÜãñx"‘°W"ì@$áJ,ªT*õö–üàé§ûlÚ´©R©HW}ll¬¦|:11ñꫯrY)mËd2GëçÎÚ«¢µÄâ= ™§~øÃîڵ驧FœÎYv«‹Åâ±cÇìÅw–²$Í1ë1 ²kÅâ*¥Y\\ŒD"@ ‘¨<÷\êoþ¦«¿¿¿¿¿ß~ uWWó]©Tb5‹K“Q]¶*²Q®Æy?ZkTH®ºêª|>ÏÁÝæÍ¾ÑÑüG>23=h4ÊåõzyÕ<{Ó¨®ûcÁkA9‚jY ú,Ëòz½½½å§žÊœuVŒC=öÄ].W:– öê¤Á"»ÜhÄívoj¸+ê—ÑZ @¡P°OÈtttìÜÙûÊ+…¡¡€H$"i(™L ûböÅÅÅÅÅEûºÐ¥¥%ö÷–:;Ÿ~:ÉÞ”& Ê„´§ 7yá«\¶  \.OMMÙïuÓ¸4p°=Y,ËŠÇã7Ýt€{î¹€ËåZXX`wûÝw3—^zæÁƒT#kñLsŒ.333è´ÓNã‹ rik"Qù¯ÿZ¼ðÂ-Lm.—ËëõRb·Ûm¿Û‡ÜcÕpŃðápøÈ‘# Ñ‚©ÐÞ…‚­þ÷?ôÿqàüó;fgår™/:¹Øã5*e; èèXøõ¯öîÝÀív³6ÁØcW„zÙcR©T’M^Èo¿X£qi­T(¥¦0)MMM½õÖ[»vmzé¥Ùpø½«<d1^ž*W¨2'NNNr¨—^x!÷ÿðTc3 Ô?y½‡ý~4åÃápwww£‡¨šê‡9–e óB÷ÝwªÓÉr·¾‘‘.cÿßÿÝ»wÀ6ÁƒL&Ãb¦L¢Ú+Êår}}ÖË/—Ï=·o§¬Lv2r‘²òPœ ‡Ã±XŒ1›ÍÎÍÍ5d-±&''9ˆ#Éd2i[¶¼mÛ6–e{î–çž;ì÷/0êpX—¯"û3¤õõY¿ùMáâ‹·¥¥%®_–]uîÌ% .ZÀï÷ót+8)•Y–U,ee󯬧àì5ߨÐ+Ü—ÓübÉŒŠßïàŽ=úÆo( KKKbÌüü|ÍÞo¼qÖYýÏ??ÖÙY000àp8²ÙìæÍÎ'ŸÿÇ<«¯¯OŒikk«¹ÃårÉ .fàõziU$q¹\ `<ÇÓ4á -’ aÓ+‘H0ñ¯ÎXÅ‹ Ùv¹\\0ÃRV[[ÛÿüÏ¡¿û»¾R)2::šHT^x!·gO/ß™cöÀ˜+»»»™íOà¡7 “œd¤Ðô’á­X,Ž7X­R •? òz½¼•B0Ù/b–Éæ={ÿû¿~ìcH$*¿þõž= cccN§³­­=*û<a×JË‹E¹ÕG¹\nkkct¤möájsÐ$ÿ'‹°óÎ;·—Éd2›6m’qà#I¢Ñ( Û¿?âÜs7¡º ŠsˆìõööJ9”JÍÏϳÜ`¿e²=ò»B¦R©™™™¦ WhˆUCM‡Ù‰–;ŽöööÚ;ÔçŸß^.#‘øËmj.v`‡‰wv`ã">f:VDÛÛÛe!SŠrÕa3Ñ¢b Ë cÅëØ±cr#:aYV¹œG5 ð>¶&'''&&¤Ö•H$ŠÅ¢, äGFFh•ý>[2Hl&Z],¡Æ°p8Ìò»P|Qî B¢Ñ¨ýBF2®ÓÀëå™ùy˜ wà5^l¿þúëÍ”Ñ å†“EVòþ‚Á ýÎFK–d¡Až‰"GøãÿÈÞyçûmX‹Ïçórç#û•gMCSý—˜@R$”j˜nY–ßï猺DÉX‰H$Œdì¼spÀùfÆBÇ“N§§¦¦š,b5Õc1¬¿¿Ÿ½%y¼/€`0è÷û=¿Å(%o”K¾d½2Ç322ÒdVAûX+§¦öáXn""Y²X,=zTÊšfƹL&cYìœõõõÙ»ÚL¨X' “8488ȉDØñ:|øpOOO©T’e ò¼'n¶··Çª÷¾9tèPó…+h*Üüþ÷¿¿NçÚ\¬îÏ­K1‚Š¥¡~;ïßûÞ÷Ø8óÌ3,--qóðáÃl¼ôÒK2™ 7].o½õ»víð‡?üaÎX±¡K1‚Š¥aãG…ÄwÞyÜìííe£X,²ñ§?ý Àèè(7½^/¬W …š×9“à“Ÿü$€_üâÜœeãþûï_«“otT¨Ô*–b„õÞxãlÈ ÌöíÛÌÍÍqó•W^aãØ±cl”Ëeû$,3÷I”œ855ÅÇ›6mâæÌÌÌšþ(ʉЈ¥Áxçý¦›n‚m†ñ À;ï¼co$“I98Nç_IŸËåØö×ÛÚÚØB—„.ŽöîÝËÍŸþô§lHïþŽ;îXáOÑÊhç]©#T,ÅkÜyÿæ7¿ÉÆÖ­[ÙøÐ‡>[âûÉO~†¤6"Á¶½½J¥bo„B!nÊÔÍââ"l«¯$uÊG066ÆÍ;w²ñç?ÿùT~Fe%hÄRŒ b)F8ÕQ!V2Ö“×Ë/¿ÌÆë¯¿[ž’'¯,,,À–¹|ËF…2Ã#e-ŸÏ[ê”ernÌ’RÇºà‚ Øxúé§í‡âz@åýÐQ¡RG¨XŠV9*|öÙgÙ`=ó7Þà&W"ƒløý~¥R‰›ÊˆD"öÊþ‡ IšLX5;B:fƒ)¶I¦W™’Rêðð0GŽYÑO«œ<±#¬2bI)èàÁƒ°õ¬%ZHx˜ŸŸF¹){J a¬’‰‰L23à '!-›ÍÚ?kù'ÖŒdóÅ_dc÷îÝlÈ…=Êš£K1‚Š¥a•©ð÷¿ÿý{ïw»å+–õ¸Q­*Ér+Ars‹R°uÆeµ.5Òëç‘e4 ©P¬lI=tèRÐêììpùå—só‘GYñ/@ù4b)FP±#¬2ÊàŽ Ék’ÑdІ™NvLÇúªÙSÆ€²ÐO†{ÜAf¤ÁAŸ %WÊg±$&”œ(Å6®wõÊ¢K1Â*#–ü÷³‹-QD"–D ~KúòË ë5È벫fO92 -çPÓ—A€„@¹D‘%x‰×\s wß}÷‰~xehÄRŒ b)FXe*”ôÁ"SMO¶Äľ³¤'É•2-͆Œ¤¯-“Ê<¸ôÍå#x(ɘ²KŽÀ†ôååõš×È’å^xá$ Êû¢K1‚Š¥a•©P² ‹@’é$ïÔ,1¡œ$µ1i./_Iƒ;Ȭ‘ìÉRÙòÊ™ <™d—åx‹¶OúÓÜ”úÖç?ÿy6zè¡þB”4b)FP±#¬2JºaŽ“¼&uQÙß’)Kä6hLš’ÑjŽŒeÃFÙo‘O”‘)—Ê[j¦†`˪LŽ’·lÙ¯tUNXŠV±ä¿ŸhùüŒ\ÈYg 'R¾z¿»ÊÔ,ÃBµ@%W,ʸ§6™Û‘'0 -ÔÌ/ɹ¾ð…/°!Ï»þúëÜyç'ú](ÇC#–bK1Â*S¡$&Ö„R©Ô{‡ûë~1ª=hÉG‚ô♤ %yJ^a÷_R¤¤Baùr‰šÙ¤å9Wúûüy£äD™äùíoûÁ¿ åxhÄRŒ b)FXe*œžžf£fL' …¥.Å»ÇÈÒÉh²T©jy‘IŽÀoÉ<Œä>¦<ÉkR*“WjÎMŽ, ¦i9 Yè'û/ýy€€\òÊcÊ)I¾gƒO´“Ñ¢²r4b)F8Õ)þ÷Ëÿúò™d±‰X5IRÇb’·LÝå ¼$P±QӅDzeвƒ|„|@žWýØcÙ?ºEž< PêˆUF¬5?¥žYEÄREQEQEQEQEQEQEQEQEQEQEYþ9¬–^› D¼IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/baseroi/roi_getarrayregion_inverty.png000066400000000000000000000206201457240071200306420ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ IDATxœímp[g™÷/éèÕÖ«-Ù²ØMì–¦¥i²i¦0¤™n™¶Ì²»,݆…i ¦¥¤tòa†>3ÉPš)l¡-Ðôh>u†.3ìβ°ÛÒÝl’f›4äÕ‰;Ö›mÉ’¬·£ó|øG§r›:Šo[Gº~2·léèØþåºîûº¯sD$‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ t¶Õ>NÄ0 l6ùý WQgpppllŒõjK«}ºñƉhnnŽˆ*•Ê*Ÿ“b$+„cÒ-·Ürþüy"r¹\D477×ÛÛKDgÏžm×l(kùaŸ®»î:" ÇŽ&¢\.GDDd·ÛWï•#b-ìRÞì쬦i@`aaŸãv»Í/Y³fam´D¬eJÝtÓMår™ˆG¡PÐ4Ÿ022BDv»]Ó´b±h³ÙºÚR) b5‡¨p8LDkÖ¬!¢ .Q__Õ #"¯×KDétšˆÁáhÛßÛþ`ê`Ÿn¸áxã÷û‰ኈFFFòù¼y …• ÍfÃkóù|2™$¢ÁÁÁk®¹¦-³¡ˆµTا¡¡!¤¹|>Ï_÷ù|Dät:‘õTãúý~¶­¯¯OÓ4Ã0œNçÊý +ˆˆõÁÀŒõë×Q©T""óü‰ˆ¼^/"Ðèè¨ÝnG¸:wî à%‘H„ŸáÛ•v^ñ^%\(D"ÙlÖï÷G"‘B¡€Ô‰Dìv;ûÑÓÓ“Ëå0+7nÔu1)•J†¡ëz"‘ÐuŸ“ÍfûúúÚ¯ /«þ‘×ëÍåræ S±X¤z©“ˆÊå²aÝÝÝDT©TœN'ްqãF£'"¬{zz À|Ñáp âáüü<aOúàÁƒm´:%b±O]]]DT*•Nž6T­úàæI˜MNwßÝ÷Ö[ñM›úà®Ûí.•J…BÁëõr Ôf³A>„4,<9^†B!äbÃ0\.W;UÚ?b1O=õÔàààž={ð0ŸÏî5¨ÕÁÃýûO}â" Q}ˆ<?áâEãSŸ>|8‡Ñh4òüÌãñx½^è‹”êt:ÍUÖX,æñxPú¢z~lèÖ²4±Š‚Á ¥ÓiLÞ‰hjjj`` C™™"r:û÷ŸÚº5âvkT_Üq,ñx<Åb±V«Ùl¶ññ…­[LÝ~û‡¸CaxxY@\ž%“IŸÏ‡·s8ôîFšP(ÔͱúûûÑcø!v]l6Ûgþò/¯©Tº±ñ‡¨ã©ÃÏÇ„,·Ýz«ë?þãT¡Pp»Ý×\s ùý~Çãv»a*¹\.—Ëen%­V«ÕjÕ|2mÖ©ÜV?ÌòÒK/ùýþ]»v麎Š%Òïå½õÖ¹›oŒÿ¹\™ËåB¡‚J±X }}}~¿u„þþ~¢Ø'>Ñÿ?ÿ3ID†a4¬‡ÓéD5¿§§ÇívW*žá…Ãáp8Ì~£±¿‡ #R!Õ³!JTßN1wG…B¡û·C[¶D âÕ÷dˆˆEXKB—B¡J9¶mëþÃß}÷FÌÁ±-‹Åð|»ÝÞPb z-Þãñd³Yó´½··· ²a§ˆÅ˜+D”Ïçñ>xpüSŸÚX«eý~Êd2ÅbÑãñ†Á%ƒÞÞÞt:.+îæËçópbnζ}»ÿ?ÿóÈÇ>¶û6š¦U«Utó±Á0²!¤ñ—ˆ™§\Ö¥³R¡Ëåúþ÷¿OD<ð@±X„çÌ™Ù[né}ç)~f45‡¨ùùyLÉHæææ¦¦¦P5p¹\>Ÿ/‰èzôïþnäõ×Ï‘®ëæ%^.—Óu½V«™/®çZ±X,—Ë´|>ß 7Ü`õ‚V‰e³ÙΟ?ïr¹Ì}vsssÇŽMèC®³gçˆ(“Éøý~t"D£Qä5þ“{½^¯×‹Õ%p»Ý¨.œõ-"šŸŸw8æÖ¿J<Än#jîˆ[š¦õõõ™'õÖ¥ƒÄbžþyǃ•ÚÅ‹Åë¯wkZooo/ W*•²Ù,fBø3Çb±h4ÚÓÓCD•JEÓ´ááaìaö aX2©mßîÿßÿM¢â…yº®ë@/'"»Ýn–òq…¬Z­âRKÓYbÙl¶Ó§O£þÈ#¼ýö…;ï³Û{oœNg,3OÂP·äIOWWW(¬ .ÝÝݵZ %P¯×›Éd …B"a¿ãŽð‘#éÉÉÉÉÉIž†ÏÍÍ¥ÓéT*ED‡£R©`’Ž]”38\KgÃŽ›¼ƒZ­öðÃÿ÷¶ÛÖÏÏkTwßÒ4 T.—KÓ4]×ãñx­VC `rÆ ™L30§Óéõz+•J2I÷ܳîÌ™së×{/\¸0<< ùˆhhh¨aËy``ó­sçÎAk¿ßoN¸VÄÚkÚ&0 cË–-ÿþï‡_|ñÿ%å}ûö!e2—Ëeîùt¹\ýýý(Ž›ó&õÕj5 •ËeXb·Û¹:ÉÜnw4ª¿öÚÔÀ!iš_^(`'.þñz½gϞŕ<¨âÖjµ‹/Z·èÐqËf³FøŽ;nÚ¶íÒ”Ün·W*ŸÏW.—±‘‰D’É$½Âá°9?¢vÀeˆ®®.´8sù|>Kõ€Äuö‘‘‘þþ~sr¹\œà*•J©TZXXàBÔøøøøø8OÂJ¥’¹Í+ 9ŽR©têTîïÿ~ýùóUl<óÁQ€eG#‘Hoo/®­8~ü¸u[¬zÞWÄb«¨^–ŒÇã÷Ýw¥R©\.Ç­ZT/bñŸ¶««Ëï÷óÒÏëõV«Õb±ˆÞ„¾¾¾ÁÁA³ìˆF£§Oçï¼3òÖ[qT°ü~ÿØØ¦YÅb±»»ÛœYî[o½ÕŠ­öO…ïi²!®´A‘“¿uüøq|û9µZͼ$œmø3»Ýn³@ˆ|°-›Í.,,ƒAžrMOÓw„ßz+~Ë-—.fŒÇãܧU­V1æ4šË嬘©í#Ö{ZÅÄb±ßþö·†«!âñ¸¹5žê ï¼],¹Pn³ÙO𺲈Èétâ¡tÚyÇáýû/x½^^êº>5555ui+Dó Àr´³X—·Êf³8p€ˆ‚Áàc=Fõ .zzzÖ¬YÃÓ ‡Ã‰D8I šSžÏç³Ûíx!¤ ƒØ{ƺººÌ‹>4ŽŽ/|ô£ž×_?£ëúÜÜß`’ˆìv»9‹Åt:‚ÖrþjÔÓ¶©ðòV1¸h‡ˆ¦§§Ét«b±888X­V..%¢l6›L&×­[GõY9nq™ªV«á^£D¤ëz¡P˜ŸŸ¯Õj|)N&ã½óÎà¡CÓccÝT/ºrJ-•J/^$¢¡¡!¨¹,¿“•¤=#Ö­""—ËõÍo~szzzçÎøJ±X4wb™ã NNNâ+Õj;3Ùl[è«1?¿áòT»ÝîñxÐæ01QþøÇ{NÊó ïeNÇ ù¢ #ÖÒ­Âë2lѤR)ŸÏW(ÀÖ­[‡2fWlLWWWC×”ßïGÛBooo__bU>Ÿ¯Õjv»®pë_>Ÿ‡m‰„ããïyãñM›ú Ã@€Ôu½R©„Ãa¾2•Jùý~k´Ú-b-Ý*& òÆ_ÿÌÌLÃÕ56› ;~¿¿«« i b!Æðllìĉ'NœÀC̨¸Î^*•8þqåýܹÒ]wEqÍ~45/ ÐXqúôióÕAV¡­ÄjÂ*ð½ï}/ŸÏïÚµ‹ˆÖ®]KD±X̼‘G¦îdª gú æçç‹Å"&Ý·Þz+={öìÙ³æ—ã%£ïtdd­ ™Œ÷oÿv-_ûÚð^Dä÷û¹IÐ*´XÍYe³ÙP¸ˆ(@ U¤­h4ê÷û»»»Íwv4å‰èüùóçÏŸÈzóóó|(MÓÌ÷œŸŸÇr!™ÔþæoÖüË¿±Ûí@€?…oBID?øÁ,´6l±šŽU@×õþð‡QÐ̹¸ Oõúg2™ä»Hvuu¥Óisk<¶tBÒ%®«FŠÄ݈(ŸÏ»\®LÆ{ç‘Ç6›Íf³™÷”|ðÁ‡~¸ÉŸm•°Ìdð2\¥U<ß¹sg0Ü»w/Õ§PÕjÕ¬º@aX0ôx<è5…R===º®£Í!‡?™Ê¢ªn¾ETüÛÓÓS,kµ©ÿþïÊm·éºþÕ¯~³+¼ï /¼@DGµÄÞò«Â«´Šêkñ±1îæÐ…‚ß•ÔëõâÞ2ÝÝÝæ 5oKG£Qî\èêêJ¥R¸ :\.—Ýn7×À0F,ŒÇmûöýã¡COÿÓ?ý|ñßøÕ?CÅJËœè{rõVˆ•Édî¿ÿ~"zõÕWWcØ›jµŠûyà»p «¼¹¹¹‘‘‘ãÇc΄@…'C2¯×[*•PÐÇw¹FD‡ã¡‡¢º:ÝÝó÷ßÿô† !~r___2™ÄåC–ÐËÂ+¦±±e°ŠêA‹K‘P! y<žÙÙÙB¡°víZÞÈÓ4­á~Cv»¯æ.?dÃ………P(”H$xˆ?ú‹“ìŽ;jµZ&“ ƒ†a<ÿüóDôÊ+=\زe8˜œñÚZ«Š•NÓµ×R½Þ´<8Nóåí˜Ùp‚L¥Rår™“ÚÄÄÄðð03115Q…‡=ÜhU,qJ\£Çqo¾ÎË/¿Ì7p#¢“'ç·o÷80õÑ^S«Õ –%b°Ì‰šQa>œˆ¾ò•¯Øíö'Ÿ|’ ¡Á`½Â°ÉîwÞ¡úݰ #ʪ>ŸOÓ4®¶;N¾©fQŸÿüçÉôùûöí;yò$Õwm6›ù£Òé£D›‰¬w¹Žõ"– «¨ž ù"zwÊëîî6—ÀÐ馈•ù¦~ð©T*U*•/}éKDd÷³ïÞ½{tt´á40£â‹m6[,F‡YÌ*²œXЬ2Ó¨>Ë6_Ð\­V±LëêêŠÇãóóó•*¨Æ{DDtï½÷šÿóŸÿœ;ûNŸ>=44´víÚ\.W.—ÑÑ@ïNyÓÓ´y3]¼H¦Âª°ÒÕV†–¨ðꫯRýÞTHЗÖàëØ{öx<ؽ¦ºXåávHDôÌ3ÏéΑ†aàÉÈ¿G¥ËN¡b1:tÈJnY&b­@¬B6\·n¹s~Ç333ƒ+jW8Kbè—¿üeÔP)ýÕ¯~EDsss‡£Z­ò²RòEc8…²\ܲ†X+`•™}ûö}ö³Ÿmè-¶Û휪¨^ââKïxàlÂðFÍ·¿ým"B$¢@ €f&“áŽä+š’[Ë- ˆµÂVaqvìØñÓŸþ´··«6Ü4‹‘ù&">ú¨ùÆ¡¿øÅ/ˆ(ŸÏ÷ôô Çëõ"¼q;MÓK< ¹Õêb­°U|ãn^üó·œN§ÓéÌårø\¸Ç{ ! ëħŸ~Óy€oñÑ™3gh™ªPVq«¥'ï+l0  'Ÿ|’ˆ¾óï@2L¼|ðAª×*•ÊÞ½{aŠ}}}Ùl­ëÍ¥¼¥ÐúsùÖX«bÕƒÖèè('¸|>ÿµ¯}ˆfffp/«o}ë[æW!Dan¾ÿ~>”¢“lý¸Õ¢b­–U‹Aa“ùîw¿‹S&“ɬ_¿¾··÷Í7ßÄWV¦JÞúnµé4­n#®aO<ñÄO<†ÒÝ»wŒŒx<ÜvaãÆÝÝÝ7ß|óÍ7ߌ«h.ÅYIb12-U[ˆ–›cµH¬2 cïÞ½Øï{î¹ç¨þ‘]Wètà«RWw#¯5ç[­ÕšÜ"V¢@­VÛ´iÓ¦M›ˆèĉ¸¡ˆ­Îê#‘)'¶-±ZÊ*´g­]»öž{î!¢ÿøÇ¸)­v|z?Z3n­>«>¯ZŒa›7oÞ³gÏ*N¡®ˆ–o­©™nÔ*uVûD®qëÏ´¦UÖEÜ"«ÔÐén‰Uêè\·Ä*Õt¢[bÕÊÐYn‰U+I§¸%V­<íï–XµZ´³[bÕêÒžn‰U­@»¹%Vµíã–XÕj´ƒ[bUkbm·ÄªVƪn‰U­õÜ«¬‚•Ü«¬…5ÜJ&Éô)¡‚5hu·Ä*ëÒºn¥Rb•µ‰Åèðáe;Ú²]W˜N“¥.;1ŒV½zL¦íÖ¥¿Ÿ¦§Wû$.ƒ¸eEZÝ* nY kXÄ-«`%«€¸ÕúXÏ* nµ2Vµ ˆ[­‰µ­âV«ÑVq«uh«€¸Õ ´›U@ÜZ]ÚÓ* n­íl·Vžö· ˆ[+I§XÄ­•¡³¬â–j:Ñ* n©£s­â– úú¨þvŒ¸µ¼ˆUFÜZ.ĪFÄ­«G¬zoÄ­«A¬ºâVsˆUŒ¸u¥ˆUKEÜZ:bÕ•!n-±ªÄ­Ë#V5¸õ~ˆUW‹¸µ±jy·ÌˆUˉ¸ĪåGÜ«TÑÉn‰UjéL·Äª• ÓÜ«VŽÎqK¬Zi:Á­h”‰Õ>‰¤½Ý«V“vuK¬Z}ÚÏ-±ªUh'·ÄªÖ¢=Ü«Z«»%Vµ.ÖuK¬ju¬è–Xe ¬å–Xe%¬â–Xe=Zß-±Êª´²[b•µiM·Äªv ÕܫڇÖqK¬j7ZÁ-±ª=Y]·ÄªvfµÜŠD(™\…÷VŽ•wK¬êVÒ-±ª³X·ÄªNDµ[bUç¢Î-±ªÓQá–X%-·[b•ðg–Ë-±JhäêÝ«„÷æjÜ«„ËÑœ[b•ðÁ\©[b•°T–î–X%\KqK¬šáòn‰UBó¼Ÿ[b•pµ,vK¬–³[½½”J­êÙíÜ«„å'¦ãÇWû$AAAAAAAAAAAAAAAAAAÚ[¯1 cÙÏChel¶f<¹bD¬Ž¢¹?·}ÙÏCHÄ!b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(Á±Ú'°lœ^¯—ˆªÕ*b)GDÁ`Ð|@~¾ÓéÄ€“&VÃÆ“Íf1@J%Ó&Ò+o q)õºë®Ã`bbbI?­påHÄ”ÐdÄâRÐøø8™fÖ-8÷9<|ùå——ü >‰X‚D,A M¦B^ÜaÀy3oÑ Óñ8Ó¡¾EõìÉk@nôãåžÀ» <À¢‰œ+ù½PãrNäbú¸?BXF$b Jh2bñÿ~L±9ŠpÄâ„oñ\~qa½þ:7`5<“…oBó94LçyÀ!/QD žcçC=„Á3ÏPdj˜‰“)1aîÌé‰s%oKcÀ«žkó¦2Îss~ Š3&÷cñ0à¹<½áÆ5ܲü»ßýî  Âû"KP‚ˆ%(¡ÉTÈÙE ÎtœwZ x)ÇE#NmHš‹ËW<Àx׈Ÿ‰RÙâÊ/<‘d¯ùp‹¶Ï|æ3xÈõ­/|á üä'?Yâ/Dh@"– KPB“©Ó rç5®‹òð-N‘ÜzÀ·ACÒäŒÖpdZ´lä'à%ü޼2Ek!¿¤akˆLYÉ‘3àºuë0À•®ÂÕ KPB“‹ÿ÷#-ޟ᫱ëÌá„ËWïwW™†6,ª¨øŠE>žÉ÷vø/ ö—øŽ\_üâ1àÏÛ¹s'=õÔS—û]ï…D,A "– „&S!'&Ô„fgg/îÝóbªÏ 91<‹G>â*ç)þ ¦ÿœ"9â‹Û%v“ç\žïã-ø…œy“çüãÿ.„÷B"– KPB“©0•Jaа¦ãFa®Káî1ÜzÀ[‘ª™øøïÃpîCÊã¼Æ¥2þJùñ‘y€4ÍäOݹ뮻0@^æÏ©{á…Þû×!,B"– KPÂÕÞƒ´aaÅ{; ÒM 0?¤Eé|sÞêiHy|dζÈ}ÜèÇÏ_¼úü|É+ŽÉ§Äùzjj Ÿ>{F6IDAT|¢¯…¥#KPÂÕnéà?ÿ__üD&î3æÃ«! ñ€ëXˆ@<ãæ­°¸Á‹ SxZÔÍOà·àÏÚ¼ýöÛÉô±Ó÷Þ{/?ûÙÏH¸,±%ˆX‚šL…<ƒÆ€““8Ýà[œ+9O5Ü—†ë[¼¥Ópå*Wθ†ÜÇoÍÙ¶áP¼ÃÛH¼)ÔðÑüÖü©Ò7Þx#Õ?L[Â"KP‚ˆ%(¡Éرcƨ-î¶ãžΉ€7j8…!Uñ]h8W6|^¯"¹goÍk:.€5Ü™ûû¸e¹a³hñíO|ø^õ+¯¼b~ëùäù¡…h2b-ûy­LKAAAAAAAAAAaøÿÑ WïôdIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/baseroi/roi_getarrayregion_resize.png000066400000000000000000000145271457240071200304540ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ IDATxœíYlUº…—çãã1vl‡’0ßH1‰I pñÊ oœ8Ò±š¦E3„ÄΠ@‹~!Z nñÐê+¡n@jÝæ>€@  Äĉ“à1ާº+çOqNÇö>µ«Îú¢]çìªÚNVÖÿïï*B!„B!„B!„B!„B!„B1kJ¢@løë_qò$víŠz1¡(êăînôö@K ÚÛ£HÝÝX·îT{Ý:twG:‘ 6o>­*"m‰Ù²y3~ûÛ3|.m‰™s6UiKÌ„s«ŠH[âÂ˜Žªˆ´%¦ËôUE¤-q~.TUDÚçbfª"Ò–83³Q‘¶D6³W‘¶ÄiæJUDÚÀ\«ŠH[…Ž Ui«pq§*"m"®UE¤­Â"?ª"ÒV¡OUi+ùä_U¤½]]ÜW䃨TE¤­d­ªˆ´•4¶l‰^UDÚJ[¶`íÚ¨BÚJ¾©ŠH[ñÆOUi+®ø¬*"mÅÿUE¤­8Ui+ÄKUDÚò8ªŠH[þ_UiËGâ®*"mùE2TE¤-_H’ªˆ´=ÉS‘¶¢$©ª"ÒV4$[UDÚÊ7… *"måÂQéèÀ¦MQ"ñšªˆ´å–ÂT‘¶\±uk᪊H[sÏÖ­x≨áÒÖ\"U…‘¶æ©*ik¶HUgCÚš9RÕ¹‘¶f‚T5¤­ Cªš>ÒÖt‘ª.iëüHU3CÚ:RÕl¶ÎŒT5{¤­l¤ª¹BÚ:T5·H[€Tå†B×–TåŽÂÕ–TåšBÔ–T•:;±qcÔƒÈRU>)mmÛ&Uå›äkkÛ6¬Yõ ’$kKªŠ–djKªò¤iKªò‡ähKªò$hKªò“xkKªò™¸jKªòŸøiKªŠ qÒ–T/â¡-©*Žø®-©*¾ø«-©*îø¨-©*ø¥-©*Iø¢-©*yD¯-©*©¬__ŒèÞRU²‰F[RU!@m•”äë~÷݇—^Ê×ÍD¤üùϸ÷Þ™œX<ƒs>ü##èìœÉýDŒèìD?þùÏüÞuãFi+ÉD97”¶’ÊúõQW¤­äe­!Œ´•$|Q‘¶’_ª"ÒVÜñQUDÚŠ/þªŠH[qÄwUi+^ÄCUDÚŠ qR‘¶ü'~ª"Ò–ÏÄUUDÚò“x«ŠH[¾‘UiË’£*"mù@ÒTE¤­hI¦ªˆ´IVÙ´ Q¢ÀH¾ªˆ´•O¢RUQ÷6mÂÑ£èêŠäæÓ%‚¨‡paeÿk®_º:<ùdƒ‰àžâ ­ /^¼bÅ /¿ü2€t: àĉ/^ àÀ455(//pðàÁêêj•••úûûÔÖÖ8yò$€’’ì322b}.¾øbcccJKK?~ÜzÖÖÖòŽóçÏðóÏ?Û¨vïÞ%¬'ŸDmm4ªÂÌÿš:;ÑØ¨˜èŠ'ŸDMMdªB„ŽE|ö­ –-[öÀøàƒìر@EE€©©) ,@&˜œœäŸtÚ£êE]à‡~P__```À¾ ;Ü?þ ¹¹ÀÄÄ2n·ÿ~:åÐÐ2ŽÕØØÈ¯Ì±¨ªßý.Ig¥4Ê›§ry?µÕÓÓ³páBûöíPSSƒŒŒêêê9r™ZrøðaãããóæÍ0::ŠŒtØæŸŒ˜Ô"Û¼Ôå—_`É’%†‡‡‘ ˆ —K–,á)7•ÊO T…C¡¡˜8‡x¢*DîXÄ[ßjii9zô(2 2C=ŒŸÓ·ÆÇÇí¶ëëëËÊÊзx"½Š!)9ƒ]oo/€††dbM‘y:m‰žwòäI6ÃᓪàƒcùÖ¬yÑUÁÇ"úV?ó*¦ä,(Ð3.¹äÇŽÃ/+^Ë–-ÐÛÛËò³{:/œ‰‰2z³¨E‹!“à_{íµ:„ŒΟ?Ÿ'²ÀÁ´láÂ…­­ýÀ ?ª‚?ŽEä[3 µµ¿º:6D=_à‘c¯|«¼¼œõLÎÂè,4|÷ÝwÈ$FL§X;`Ït:ÍnôÚ»Ñþÿþ{dR4zá-è^Ìî¹æ»]49ÖW/ºè¢•+jk‹6onlmÍÇ_Èôñ˱ˆ|kš¬\9PU5µysCÔ9Þ9ñÄ·ÊËË™qBGؾꪫ1$› "3Sd4•J!“]1ëéé±Ît&ÂUšpQй«²\êéëëã|prrråʪª ««þĉ‡3ÅGÇ"ò­s°rå@uuÐÕUõ@Ί§ŽE"÷­²²2Z‹ãÌoh?,21yâ¾Åœ¬¾¾ž)O×ßYÇâR]§°?‹³HÖÀ˜‡ñ ¬Å·µ ÕÔww7LLŒ!cu¾á¯cùVmmCÕÕAw÷¼¨r¼v,¡oUUUqrǵaZ‡þDÇ /ö1yšœœ¤Ç°¶Îù gy°téRd è?ýô“]–vÈ‹ð<—…«?þ1UY9±uëüªª2dæ†,Üû†ïŽEä[V¯N§'·nõ1ðåÇ"èêB{;º»ówÓ¢¢"æO4’ð®=–£Âé}‹i“M÷X¯ânvàWü“e0î„¡'qáSËpy¬µµ?• ¶m[46v:Ù¢cñâ¾Ç"hjB{{ÔãÈ;«WWWÏ=Wõ@.€Ø8a¦•7ß ‚€s®ð#z?a6Æ´©ªªŠËˆtÖ®8 odÒÆ\ŠóG^–7eŸßüf¤ª*øÓŸ75¡··— WùÃ{+ü!NŽE Ê·V­¨ªšÚ¸±6ê\01s,’7ߢÑBèXt¯––df‚l³ OËYºt)OäÜY#Ú[UU2™V8a ïu^±âX:]üÔSÅÀ û6¼S™IZ oÄϱHâ}ë±ÇúÒé`Ë×§C,‹äÁ·†††èO´î#åLŸ°LÅŠ<&~{ôèQz †_ÑÃX£bþÄT‰SN^œ&´bűt7Î&R,˜3]£cvð¸:I¤oýú×GÓé`ûöæ¨2+bìXÄ©o-X°€É͆å¥ð#4ôªðs§ôÑÑQ®úÑŸ8CdÖ«8[¤o1âÎÒ‡ê)- ^x¡b¦Åâ½mtt”æÇlûî9*߈·c‘Äø½jÓ¦øÍs‰½cG¾µoß>n.`NC—úöÛo‘™Ö1%¢9…,++ã‡t#®ròÞ ÏMèÁ÷ML[¶4º}޾eâÐØúúúñ-Úžo$Á±H¬}‹^õì³>¦á3#!ŽEæÜ·ÊË˹!²šEƒÙ¹s'2*z3-ZT?ëUœëñùæð.ú3­‡>TV¬];Œ…ŸCd ~о¸¸8<ÙäÃ3DHŽc‘ØùV[Û`:tuÕE=9&QŽEæÐ·êêê8­#t š Ÿ‡fÆCâ·L§‚ àl޲@Ïz=‰ÓɧŸ.I§‹»ºêŠ‹OM69Åcý=¼Â‹øÍŒcðˆß6㎮.92+mA°hÑ¢G}À›o¾‰LèáÊ¥—^ŠLNÍuVøùO?ýÄEeæøŒ•T€½¦­m~æ™2ÆPþÉ †÷2,RÍ—]võÊÝ8,m0‘È}ñZ„$-žÇͶÁÊÊ©gž)‹z ®ðÑEçŠÙÇÄÉÉÉÜ-14~N¯bŒcî‡â¥8`vÏ'Ã|#±ŽE<ô­5kF°bs^’ìXd6¾U]]Í)“žð£`L€è\¥ae}&&&˜ŠÑÌx‘‘‘‘Ç?^ZZ´qcmuõéÝyáÂ&ºTxk2ÛSSS,ŠZ.ÌtÁ7îX¤£ÍÍX·.âa<þøñÊÊ©k"G^H¾c:ÖºuؼùÎêïïçë@i*$¼…†NÆr½ŠÒÉÉI¦\üª¯¯oõê¡ÚÚÔK/-œš:ŒL‚aOz’½Â™œìŠ+®@¦B[VVÆužÂn,ÒúFA8ioGKK4¾µzõ`eåÔK/µDpïˆ(Ç"ê[eeeœ 2Ñ ïÑ Ïù ŒéTee%GGG[[ÏŸ?ïÕW—îÚõ®¾újdæ€4<¦h|ªŒ—å¹Ì´¸Ó·hll¤ñ¾ÜôG«ór,’gßjm=^Q1õê«Kót?o(,Ç"Ó÷­±±±ðËÖÂo|ä+¸é´–ð{‹z{{ÇÆÆÚÛÇJKS›6Õ—”œ^-Þ¿¿~ <Ëè<=¼¯~ÆÔ­§§'üÄ÷ád½ŽÛ|Sȃoµ·UVbófß4ä”Bt,2ߪ©© ?íNSaíŠyq¶H;á·ô³§žP²aC:•šD¦:Å©±ªÎT)\ħK…=Œùm‰“ÁÆÆFZá}™®ùF:qä[?~,• 6lHÏñucEá:9¯oÑ68×cºC›a Šå(naøæ›o¼øbu*lÛ6É’dö1ó=ÞœZò“œ÷…‹øìÃ¥FºTØÛìøðñ2ú%ßÝ~ߤ?´c‘9ô­õë'S©`Û¶ÆówM:…îXäl¾uìØ1Nåh*ôf9\³c2ÄjÆªŠŠ©gŸ-kkkùÄ=}ˆ5*æXá¢OgvÅ-V„ÖÈ- Lé¸[ëСCœrGCø…%¾!Ç:Å,}«­m ¢bjëÖ¸>?çȱN“ë[ÃÃÃÌŸhœšÑ-˜ådN«¨º»€IšÍøø8W 9q£µ„'˜,zÑ~Xš¢‡1£b"E›¤5r+smm-ïK×ܳg~ùªpcý‚øÖOŒ¤RAW—ÊDˆ+ó-K–, ׊®¼òJdæ‰4•ŽŽñTªü(N0U¢ÁóZéa<‘¶G³ ¿’“MÞÂvœ"³éª¦¦†FVËxAžâr¬3@ßγâ³fÍp*lÙâû›±#Á£ç:|#Ö}üñÎ;îø;€çŸ7b¦u÷Ýÿ[Z:þŸÿÜL2Dk¡Ãµ´´°"Åü‰~Ãá§w8+¤·Ùï2Af3;-%4{'¼÷‹k—Ü¿jÕ*=¥ºÓéÁ3úÖí·\Z:þïÿ*ÿcŠ iÜ7‚ hjjúÇ?þkp°zùòÈTŒ~ÿû¢T*øË_®Â/熴ÚOss3ëU<¤Éñ‘CÚLøìÉ‹ãïÞ½W£Ùïµ WÔøÀ*;|ýõ×r¬8ñᇿª©zôÑS¿a«³s"• ^x!NoÆŽÍ ÏÅ%—\Á¿þõßÍÍ_,_ÞßÔÔTQ1µaCzþüS5$nHç®,îТ! „ift¦p.ÅŠ|ø Dæaá ^4'¶ƒ àW<…Oîsšé™§o„_døààhF3 ¼ …bºx¹OS!„B!„B!„B!„B!„B!„B!„B!„B!„"qÌäU]9o$ 'O¯t“° Š™ýsë5u –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX ¥Q`îimmeã•W^‰v$…ŒK8AÂN(šÁ9AÍäD§,_¾œÛn»½{÷xî¹ç"S"˜Ù?·K8!ö޵jÕ*6î¼óN6¾úê+68`xx˜‡o¿ývÞG—äXÂ#$,ᄇÂÇ{ À=÷ÜÃÃ/¾ø‚;v°155`rr’‡555l¼õÖ[ùgÜQ(!a 'Ä/®\¹’Ûo¿ÀÎ;yh'N°QYY>ñäÉ“lTUU±¡˜8 …GHX ± …k×®eãæ›ofƒÓÀýû÷󰤤„ çƒAðp||œêêj6¼ûî»n‡s …GÄÀ±:::ÜtÓM<´2Õ—_~‰?•••±Q\|êK*•022ÂC³.~n=­Ðõú믻û)â‹Kx„„%œào(dpã7øæ›ox¸oß>6Ž?ŽP ›7occcl”——‡/h!Ò‚&+^ûûûÙxÿý÷çôG‰7 …Â#$,áïBáŠ+ظ÷Þ{ÙøôÓOìÙ³‡‡¥¥§ž,â-ÔØæ…‰‰ 6XÙ²h'ÚÖ?MëN§Ù°ðú·¿ýmî~²¸¢P(PhcD³z•U›¸›ÊÖm,ã¶%¦ívÜ¥žbÁ”kD-òð CCCY·.¨ú–B¡ð K8!ß¡ÐÞ s÷Ýw³ñùçŸصk-0Yª¡¡¡8•µ¡ÏfpY+9U°ˆÍ+­ç»…?a´˜MLß|óÍéüÈqG¡PxDžË^ßxë­·²aõõ×_#´lý17GÆ¢Ìf¬ìDg²â“eÖ-ÊlÆN´4Ÿ¦hþdÑÑÑp;1ësóÎ÷Þ{oz ±DŽ% 9–p‚„%œàjVhÑá®»îðí·ßòОˆ·ÎÚ,ÊXÀ²y¢…ªpd‚ EF X66†<»r]]¶DÃKYè´³ ]ò²vzÙsAGeÃÞOR‰K³Bá–p‡B{ƆoECæAS‹€à,¢qºg“; CY/eÈ]ºaˆ´@i11ëDÛa!Ïz2„YD³!Ù5ù‰Y›6òsûYli°C26A( ˜Dz¥å[n¹… {‚õ*Ës )k×”Ù†õ¤ÁØz‹´²lð+0[7;±=ÍfH¼”9™%õ¶tÃdÜú[úÏ™‡í¶;Ú²GkCõ{läXÂ#$,á„Ù†Â|Àý÷ßÏC[¨±Æ d–A[DËÚyle­¬ú2È2n»sêÜ%;1+YlÍÚa•³¾¾¾¬K±ƒÅJÛpÁÁ[.o1Ñ">o}ìØ1òA#Äó9…Bá–p CáÓO?Íöõ×_Ð{Aíõhw°rwd­«äî¶S²æ}Yûòrß!“5¯´2•ÓÜ=ƒÄ‚¬Í ìÐb"oaï·±7¶YØeÏÜÆo¼˜ P(bãðáÃl0^Xfm‘ËÒX®ØänjÈÝÎõyÖ¯|¶†•xÓ¬­Ì¹—ÊJö‘óÎÈÜlXè´À—õxÄ¢ó;#¸¡ä]x„„%œ0ÃY!'ƒÈlg°(cïùøãÙ8räBÓ¥óΛìI« 1¢YXÉÚlýswg­YϬ_)õ«£ÃW°­YƒgË‚¬‘míÊqŒ€³DŽ%œ0ÛÊ»(òÿ›š…B!„B!„B!„B!„B!„þ=nR‘FÙöIIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/baseroi/roi_getarrayregion_rotate.png000066400000000000000000000152661457240071200304520ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœhIDATxœíkŒUÕÙÇ× Ã\.¢€ˆÜt(b  P^¡^šø¡Ñ¾D?4úÁÄ ñEÔšø["*JÑJo±¦dÐĶּ1­š&MJô› Ze€†™9ÊUä2gf€™÷¿ë9ÌÙìsÖ9{ïóÿ}Ú<îÛ™þ»Ös[kC!„B!„B!„B!„B!„B!„B!„B!„B!„B! g@±_ ˜|ò‰1Æ|öY±ß#‰”ûŠÆ¦MfáBSUe^}µØ¯BæMæÆÏ?öµEòT•…Ú"¹¢Ue¡¶Hx.¦* µEÂпª,Ô¹4‚¨ÊBm‘ W•…Ú"Ù¹TUY¨-ÒáTe¡¶HfrQ•…Ú".¹«ÊBm‘oÉ—ª,Ô1&ߪ²P[¥ŽUY¨­ÒÅŸª,ÔV)â[U–Ç7¿ÿ½÷§¨PUY¨­R¡ª²P[ɧðª²P[I¦Xª²P[ɤ¸ª²P[I# ª²P[É!:ª²P[I jª²P[ñ&šª²P[’²b¿À%°i“yä³yó%_Ø××çáu2òª1ÍÆ$M_ee—¬“Ø+´ªŒ1}}}W_}µ=^´h쯞¯ü 4Æt:mp‰1fïÞ½öàĉ0^~ùåö ²²Æ;ïl»æš¾%Kª cMM=øæ›o`:t¨=èîî†qÀ€s»iÈË;;;õåW]u•=èéé±¢¢Â|ýõ×0Ê[á¡øEƘ‘#GÚƒcÇŽÁˆ¿IsssaÅcï†\TU`Ö¬©Ü½»ìW¿êÎ~j¢‰°b¤*‹ÕÖ/~q¼Ø/RL*ŠýYÈ—ªjkkíf:#f“¦¦&«ªªìÁÎ;a=z´=6lŒååçþoyöìYçÌ¿ÿÝÔÖyñœ˗0ÆœTµÿ~{på•WÂØÖÖf¤ï‚ÐZºS‡²—]v™¾ùÁƒq|úôi{0|øp{°nÝà{îé|þùc?ûYµÌ¨uuu9Fd.¤7#^Ã3yòd{0~üxO:ew0"[!O–÷‡[9fÌå !ˆÜˆ•˜±JÒÐPÙÖVþòË]ÙOM ÑV"Ue±ÚZµªTò[V‚Ueih¨lm-+mEÅÇò­ªQ£FÙƒ#GŽÀˆª…,eÀ “gÂß‚ %‘F$¢dþÖk¯[´¨gÕªîŸÿ¼®•,¹ §…Œ”9­#FÀˆÜ˜¬· P#½%騡|$¨óàž&T}P‰+ñc•¤¡¡2•ðË_¦³ŸgŠ/¬’R•Åjkùò¯³Ÿ[Š<LUè ™”bЧ`Ä1nÜ8=êüWÉÔ©SqŒiKv" "„9·¡¡ò'?1Ï=wôÙg‡ÉÔ‚|™ÂÀ¼&cÇŽµ{öìqúôéö૯¾‚QÎÔhdÙ´lÈt†ÌË„ ˜#V ŽU’µk§R^xá›ì§Æ¢ «ÄUe±ÚZ±"}ÅUÖ®ÜÞ^‘¢ôáÐc#“Òó A¡G,ŽUùë_¯èè¨úéO÷f?5&TXTU?Xm½øâ©b¿H~(ÜTX\Ua*”Ýž²­@ëëëaÄ\–1É.ÖÝå‡êêjýtÌJè¼øíoÍ#Ôþæ7gV¬)'8€d¹H÷æ2Ù‹FYcÌáÇí²íÎ[ÙM‚X«²~}]{{Å3Ï.ö‹äJ!„EU]V[qÏoyU‚õëëöì©xþùk˯U!¶‡»c„ã%co8rI'Ò²PK¦0àxI•^|,ÙÝ€ED«W|øá3Ï=÷õÓO×âþòžð±dkÚ(d¶B>-¦¤K¤_(ý¹x±¢£ª˜òÚk5ííå+WÆ2Nô%,ª*/Xm½ürüz½L…T¬Ê„8¶TÀ bÄ %3 ˜ å6 èÀôgÄL*' tíÉÄ=²äûöíƒq„ öé€wÞ1 ¤V­êYº´FöVàAòéxgù ¹ßz"dŠ'Ëe®rÅlò?bEPUq§¡¡ª½½ü¥—âÔ˜gaQUž°Úzá…ØÔªó),ªÊ+ U{ö ˆ‹¶òæcE\UX óð3àlÉÐöiDBAüð·d”ž±ƒž¹¸—ËKp,×M` N<ðÀñ•+O­Xq~‘,(Á[’ï)³!ðÒä;#!},ùª!ÈψqU%‰uë†vt |æ™#ÙO-*yUU`b¡­\§Â¸¨ S€L(g\¯‡êË/¿„s„L7 s!;×Àú #f(42‘p—³2ï2‚$2øùKõ‚©%Kö-]Z#.—½r©~²L÷gìX̸‚289XqQU"‰x"¼°¨ª¢cµµlY{l«ºšªŠ U{÷VDP[a|¬Š “NÇLUˆÉeIÞ‰ô±à…`»#ª7Òˆ¶Ré¡&#„òŽÜùA¾ôÛà¢ÉDÆt²!þsÙ}÷}öÙ£/½4 ®¤ôð2^uæÌá#Ê’‘ôüBfÄêì4«V™wßÍå¹$Ÿ¼ñÆˆŽŽK—æTÝË/a„ÕÛkÞ{ϬYCmEˆ7Þ±yó eËç¶ILÞŸnxï=cŒy÷]ó£åímü©Pí1ÝÈ/S O-'#´'È–@ddj›ÉîÌ;2‰€¹R¶' _ Sç¨È÷Ä´…™nÕª}3gNèíí3&äbF$dâC¦K€¼CrÊcÅK[ÉæÓO·ßtÓÔîî¨ìF™k‚”ÚŠçUYГ—"4µU\"¨*“¯î†èk a6ây#¼Ù €ª¾\w×*ãG¹¤;×JUàEÉ,.—ž(þÈO³À‹’û)Ø«ZZöOŸ>®»ûÜ«¢åAökHw ¯'½=d[äî˜òo‚¼µÍD_[É£¥eÿu×9{6Zc•%Ÿ=ïÔV!±ªêî.ËmW_äù¥"«-|„B.¸C˜-g=|ôKNšˆíå£Ì,`.“gb.“úB?ãö“²¹Ó–]ÙeÄÞ²äÏL®8µ‰‰ææŽº:ÓÕuÂyO¹wòòò‘÷ÏXq’ÛUd¬óÇoD)mÅšææŽë¯ÛÕÕ‘ýÔhà=T¥¶rǪ*j¹õþ)D$ ÚB–A¶9/`²Ÿf@p.§-\%“ÈÈÜ7ΔŸ~@Ï‚L‚#Å/n65¥¦OwútYyùký—ë3®UÌ8ÊÄ:®’hŽ»&(¹mÅ‘¦¦ÔŒã»»3$º"Ná²¶ÔÖ¥²}{jæÌñÝÝeÆPXýBmgûöÔ¬Y㻺âäWI ]g*–¶àRÈê Š*2ÌFbâĉ0¢Bný€®y&VH¿ Õ!ù­r812…aƒüææ}cÇV§ÓîâRÙ[¯QºS(ÉŽ Y\š4i’=. ¶–ÞXÆÏa§LŽ[ýÓܼï»ß½2>šýÔSœÊ8µu1¬ªâ;‚¢µ\X[ˆí³n¾€Jž‰9Bî°ˆËå^há:ú d£NÀ¤¹gÏáyó¾SYY&žlŒ˜¶ä<޼Ikk+ŒÈ׈œõ0ÁÉ7AáA6úÉïY„ ˜½<·${ö®¯¿lÈØU–"7‰Q[«ª®®2‘7Åï>¤¶ ªb¿H>)¾°LA´…@]v¢ü’ñs²‡‰ ãѳ /‡7&÷>€g&ŸnÓ-×]7êÌ™sÆw¥Â+É«hû”îTÆ­"e£üBÙ,Šw–‰ Y§ A$„eJuÜjll™={RWW†mKãNT„eJO[çU•¨DHXƧ¶1ïèø¶¥©Ò ë1ÙГ¦ìnÀ (ý0ëÉmŒp毖–/¿ÿýëÊÊÊkj.˜^‘zOǭ䤆É R×\s Œ2‡Ž;Èޏ¿¼•Üq)Ñ–)q«¥åËiÓF×ÖúƒÜ…$rÂ2I×–UUWW™X]–@¢(,“\mAUÅ~ïDTX&ßÚ‚o!«7ˆÉ3îP%Kýp>d'¼1™D@ýD6XÏiË–– æ]uÕ¹ðã?¶S¦LÁ™(ÚÈU¬pÂdo^O>©¹ ˜|g´WÈŠ~Ü4Kús!ˆ®°L²Æ­-[Z¾÷½IÇ'Ù¯’DZX&)Ú²ªJ§ËD.3áD]X&OÚB\&—fË¥y˜dSæ™æÆ=eæsþë'gΗNŸ6Y¸—J¥`Äýåü…iQî—„‡Ê¼úe CfC2þ¤ûåžÐò‚ËÄyÜ:pàäĉƒ««“ï­;ÄCX&žÚ²ªêì4bD+b#,7mAU¥Iœ„erЊ*?)}42ÈïM ø#ý\%+!Öwill­¯qöl™=' ¤cŒ3fŒ=- ÈÈtž.Ý)8a21„ô–dõŽcu¦QTþ:Ù­‚˜ ËÄaÜjll3gb:ýMöS“Kü„e¢­­óª*9oÝ!–Â29hKæÓ‘1—Á9æ Ù_€¦¹äöíÛí¾øb÷ܹ“»»Ý}°ý¤ü&%òþõõõ0".;/—c‡œõ0«Ê™TNô˜Lå×40é;V¿I8â*,½q˪Šc•%ÆÂ2QÒUåoa™hh‹ªÒÄ^X&˜¶rËîø.ÒŸ@.— ¤—ùë‘lÝÚ6mÚéôIçþøL¦¾‘lO@º!cÇ„L"À1Â& é bé©\*w|@7©¬Ø`mjÆ/±‡# Â2Å·¶nm›={BŽ[¢'’„ËC[msæLà ˜‘äËô«-ä‘e¾ó…ÌMc^™w€Ð}×®ý7Þ8®³³×\8az•Ë.Ñ–s j²¥.c:䔄‚Làér—ïÄL-fÿ––»rÛõ;QÂ2…·víÚ?cƘžŽU%iÂ2þµeUÕÙѯ#E„dþmüi ªÊó}G2…e”¶P`ÉXÀ¿öÚkaDÍGú.Ö3Ûº55eJ]gç9ç#ã>ðdwœ9¹jN˜|<<éâàrÙšŠ“,Ré=·Ì…»0ࡲ„æ éÊŠV+,#´•¶nMÍ™3¾³óxöSI²…eÎkëÎ;sÏ«Š3`P.,sN[ÿó¯=õÎ;c/^Œÿ„,ƒœË`Ä Á'žxzÍš—z¨Ò\¸Í¦9½bŠ‘ûG"_ g%\.{î ‘™w̪²l€ùKîïˆÙY.uÌø!ÌŒ›PÈE%rƒÉ”È2·;·lù¯»îZâÊ'žxzõêçNŸÎ°}é‡äX–––©Æ˜»îZkÌÿ¿ ªC D©Ëœ×ÖäÉÿÝ×÷ çs¬Ê…’ðFûúúÐ_ð‡?üpæÌOþö·ûŒ1¯¿þº5ÊJ¾õ-::ŽýàÓÒés®BÆòü™YÀ´de'ÈÚ¾g!=ä¤;…[Ét¾©ÙÜÜ #\4éWÉRdC¤³ˆJ‘üúî°mÛ¶Œ^Zÿ”ˆõ-ÍÍSþóŸ9?þñýœÓÑq¬¾~TEBPŠ»þµeUÅÌBŽ”Š5nÜ8{`Ãø]»êûúúþøÇÿ{à‘Æ˜3fØÿºqã'sçN4¨|Р JýØyQnôƒ5zr.à ¹õNYLp“²%ùt9%![‘q; Ù!÷oFC^…ûËïtÊz@JqIJ47OÙ°¡vݺo;B7nÜtÇ7pÌ %ýGü÷¿k ­7ÝqǬtšy…üPž„Ìbgâ=c^1æ]cJoïŽ`„ˆ ‰1Æäö¡+B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„Dð_uÊöI-’ŠðÝ/ +ñäò?qI“øƒÂ"^ °ˆ(,â ‹xÂ"^ °ˆ(,â ‹xÂ"^ °ˆ(,â ‹xÂ"^ °ˆ(,â ‹xÂ"^ °ˆ(,â ‹xÂ"^¨(ö X¼x±cY½zuQÞ$G8b/PXÄ ñ…E¼@a/ä´ÛL¶"I .t,óæÍs,­­­ŽeÅŠßIËÿıˆ(,â ‹xÂ"^ °ˆŽÇ{̱ÜrË-ŽeëÖ­ŽeïÞ½ŽåÔ©SŽå­·ÞÊùí2À¨D ‹xÂ"^ °ˆ(,âF…¾xøá‡Ëí·ßîX¾øâ ÇÒÔÔäXz{{ËÙ³gË!CË›o¾ð=ûQ!‰ñ…E¼@a/PXÄ Œ óã>êXæÏŸïXvìØ‘Õ’N§KMMMÖ§www;–ÚÚZÇ"NdTH"…E¼@a/PXÄ ñ£Â0<ù䓎eîܹŽE×S©”c0`€cÑR]Ôß?}ú´c<ëUz]¡F×5z'r¼ûÞ$8±ˆ(,â ‹xÂ"^ °ˆJ=*\´h‘cѽ Ÿ~ú©ciiiq,î_RWëôê?®èé: >GG…º_´§§Ç±8è Aƒ²¾^p8b/PXÄ ñ…E¼@a/”VT¸dÉÇ2uêTDzyófDzÿ~ÇRUUåXô.1:RÓq¢Ž%uì¦× ‰@‡êXtß©C 58±ˆ(,â ‹xÂ"^H²óþàƒ:–9sæ8–Ï>û̱薽ºº:Çd–vÞõFzq•nôÓ®º¾³n!Ô–3gÎ8'ÑÎŽXÄ ñ…E¼@a/PXÄ É‰ üqÇ2kÖ,Ç¢·oloow,:æÒ §‚lد[íôB® ›>ê¨PßG¿aee¥cѨóKu ™ ±ˆ(,â ‹xÂ"^ °ˆâ.\¸Ð±èe[Ÿþ¹cÙµk—cÑmÓ1׈#‹nÇÓ•8'êst ¦[uT¨ÑwRøsž®÷­ÌŽXÄ ñ…E¼@a/PXÄ ñˆ /^ìXnºé&DzsçNÇÒÚÚêXtM/œÒ5¾cÇŽ9͉Ýt…1È>º[5H,©+ž:ÚuÞ9ÈOG,â ‹xÂ"^ °ˆ(,â…(F…÷ß¿c¹ù曋®ú577;OéXIÈt7¦^¨ï£{AµE?KGj:JÕÒuI}•ƹ.›æG,â ‹xÂ"^ °ˆ(,â…âG…=ôc¹õÖ[‹þŒ[*•r,º‚¦+qºÓR3räHÇäÃnúéA¶ù×µË ±d€‡ˆRõn—¹À‹xÂ"^ °ˆ(,â ‹x¡ÐQ¡þŒÛüùóËöíÛ‹ŽÃÅ\:ÂÒq¢Ž¹tf«tœ¨£K½·Œ¾O £¾þíGŽq,Îï 2‡#ñ…E¼@a/PXÄ ñ‚ߨPï 3{ölDzmÛ6Ç¢{Au\$žÒÙïEŸ£‹hA¾¡ ²pO¿îÕŸ~C9>ܱ8ݪ'OžÌúzÁáˆE¼@a/PXÄ ñ…E¼ç¨ðÞ{ï•ÿÔ½ :âëèèp,zmÞ§EGXA¢B}½›¨ŽË† æXt7¦ÞóSÇnA¾1¡ïä3æúÎz]¡®9:~™‚Ä ‹xÂ"^ °ˆ(,â…œ¢ÂeË–9–™3gÊ6559'è¨P׿‚t~ê­Qt©KG|:zÒ¨ŽÔ‚´Vêûèg‰Ýth¦ãM]õÓ½CŽ®·:¿T%s#ñ…E¼@a/PXÄ ñBöúÚÅÐU-cÌ+¯¼"ÿùÑG9'èÕmuuuŽEGXAÖè镆:šÓ=éߥﬣ0ý†ú>Çw,:þÕÏÒ5PÝ=«ß'Èn3Nœ¨ÂúõëƒT`3‹xÂ"^ °ˆ(,â ‹x!§Zᆠ˨Q£ä?Gõ&Y£“©¦¦Ï Bµë8(Èî.úÎA*•A¾`¨ãDmÑŸ {ï8¿‚{’@a/PXÄ ñ…E¼STøþûï;– &ÈÎ;×9áƒ>p,t,ú«ñA¾à +qz= .‡‰Ý‚ì$£ßG_¥k :– ²>1È÷ 5úw9Ñe¸@ûbpÄ"^ °ˆ(,â ‹xÂ"^È)*t*ƒF-ÔQÏm·ÝæX>üðCÇrèÐ!Ç¢ã m Ôè/Ýë‹:.Ó±›®ßéz¢~–Žƒô¯jôõU:*ÌïgëÝðwkRÊPXÄ ñ…E¼çå_$a„^þE!„B!„B!„B!„B!„BJÿ7¡mÞ`ñ¾IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/ellipseroi/000077500000000000000000000000001457240071200232045ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/ellipseroi/roi_getarrayregion.png000066400000000000000000000240751457240071200276150ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ IDATxœíytTUžÇoUR©$•}ß„„ME°iP*j(ÓØ"x„VÐQl7´±YŽzpE–6¤]i:i2(› ²@öªÊRIªæ²Ãã÷…TH½[Kòûœ>s¸wn½÷êåç«ß÷ý–+Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ó·Ðôø“6›MÅë`<¦‡âëÌYûõë§>þøãÊáªU«”ÃÀÀ@òñæææ.Ž&„(--UF£rMÖûùù)‡åååÊaPPY 644!!!Êakk«rèããCÖ“S455‘äIIIÊ¡Åb!ë}}/úÕÕÕuq:¼`r…QQQÊa}}½rHþF¢§h{üI†é6,F lXŒœò± ƒrH|&â@äçç“ëõzåðĉdA\\œrªjµô¿ŠŽŽŽ.>ŽŒÉdêú€ÁÁÁÊ!qqÂÂÂÈúªª*åõ 9 ¹¤²²2²>&&F9$^N§#ëÉMF·µ±±±‹!°Çð‹‘#6,F lXŒœrÞ{¡¡¶ÔÔ¶˜kP-8Øfÿ¿11åAAV£ÑÇßßj6k+*ZL&ɤil Úúú¶ÂBÕ¼Ý^†S†UQQ¡&$$(‡§OŸV‰ . ¢Oqþüyå022²ëë9wîœrØÖÖ¦†‡‡wþ;&¦cР¶„„ÆŒ kzº5-­Ãß_ìÛçc±»Ý˜LšúzMc£É¤3µƒµ££=*J$'ÛBB„É$ÆŽµ¤¤XŠŠüŠŠü ýŠŠü´>|á–’H~£ÔÔTå°ÿþd½ÙlVÉ‹x|³OŽ€:—(ñøøø®×÷˜>ôÄÒëm7ßÜróÍ-cÆ´”•ùúøØòò¬¿ü¢ÍÌô-(ð©ªÒàÛøø‹^(œ9sQLÉ.æSR,))–ÔTËM75MœØ|ãm»vévíòÛµKwò$5¬¾Cï7¬ë®ë¸óÎŽqãÚGŒ0åäøçäøÏžUP )ëö'ÖŽBQ[[«ÕбcÛÆŽµ¬ZeJLlܳGŸ­ß¶-Àhìy¼ß鵆n»ÿ~Ë´imÇŽùh-Ò?åøcNcµŠìl]v¶Në;fLë 7X/nسG¿ysà–-.¸ ªÂ»î²lØ`úé§ú¸8ÛÃÌœé¿l™>7—f"¸€º:í—_¼ürè AñYYÓ§7•–¶þùÏí½?ãÈ©'Vll¬rXSS£’ üÝ!Î>ù¸wž8ãÈ3ϘÜ’›ëóᇺ)SôöKgÜãJwþ’WØÒÒ¢’4áQFx²²4YY†„„°ûïoúüó¦C‡t_~°gÏE1%L~"y/Ä×F§$öà’WC‚Z=ξBzÉkΜšüü“¾¾¶k¯5Lðí·ú_S£]³&hìØ˜õëƒfÌhú⋳·ÜÒìøc^ˆ×–ݤt:1thúŸÿ¬olôùÈÝôé D>ôñË/ÏÞzko3//6¬iÓê;MjåÊH«ÕÝtåüü³ßŒ1/¿9mšqË–Ê#ZÆKðПŒ®¹æšÖÿýßóYYaC‡¦{£=Žñ›93fØ0Ëâŵùù~/¿ìà=°Wà}O¬W_­Y¼¸fΜØ÷ßïVÕÉÑ£~“'Çççûåå•L˜@_©{NUéUøÒK/)‡ùË_”Cr ÀÒ€ÚÚZåðöÛÍ+VÔ¼ñFØÇ ˆNȼ#iw$<" KÈ%‘DB €Ä=r|A˜ÄÄDåðÌ™3Bˆ€ÛŠÕ¾¾¶?ý)J«P.¨¬¬TQ&“Z ¼BRB‚`D§»§JÇ•,\Xß~à ‰f³÷=e¯ˆæfÍìÙÑãÇ7óÍÙ5k´Û¶ÑK<ðèø©1?._.„(;pÀ3m˃ kÀë¾}¦˜˜GÙ1}šôI“JšFžxwé›oþZôì™¶¥¦óN^L“d&D¹Àß_ìÚÕ6aÂÈôô ˆsM^4c…;É."o™±ÄžÈõ ð…Iñ^z߇oÆ Ô¹4HDG4s¦âäɶ+|Þx#^ÑVVöã[oMÿøãÏfÌP®'ÙWâRßQ ê¡ãO¬ØXëáà '^íî ñtŒ••ñÆÙÿýÝwºÂBýêÕÅöaTFFma¡Û® ðÃúùç†k®¡µ_ Rœ›ûÍK/=¾}»}øùç»wÿÏÿT ýýï# Ú¿n{/O‰û ë§ŸF…Ÿ)æÒ”î߯´­Í›#WÍ51y÷’%î½0‚› ++Ëôì³……î·o/Bi[CÿûÃå7¤U)¢'[]$''“õ$„röìY²€|er…#"÷„\!‰Y‰Wg¼öZãÆÆgŸMÄ9IÏ"å'ÎàÒ'ÖÛo×Íšáxãß~¢ÕŠ[n19^* ×Öøñ-ص‹Öl12xýõØ… éóÒ•¸Î°–-k˜?Ÿ‚.âÜ9߬¬°Ù³k/•ƒ‹ ë±Çj>ÿ<àìYöÙ]ÇÊ•Ñ3gÖ…„¸G!ºÂ°‚ƒ­Í†åÑ”–úhµBvÜŸX}‘½{ýF’ûÐRÓ°´ZëUWU””ôéJ¼ü:弓Â!çJJt:ˆç‹•$u Ä['ÙQèìß“xëØ¢˜8㘰ENAJ!°$Ÿ¸ó茓=EÈqÇä!)Øñ‹|e”#öÀÚÉ“–yóŠ¢££‰¾Á¿QQó‰WQY™àxãnJKý"": ‰n–š†YSSÓö3î û%'Kü5TÓ°""jjkÙ°¼ƒ’}ÿþ_“²aõQd–SÎûéÓ§;ÿm0Øôz‹ORgÿURÚ€¾ù‰'”CLo"ï‰÷mƒüTâºçwâ\“nX2ÀðŒòâ}gÒa‹ìoˆ;”=A|y‡;£¨®®¶ÿãèQËøñ-áá©Êÿ/ÆzŒjO¬ÔTk}=-a<–¢"ß”‰Ù¤*VG}}ŒãuŒgà5†e«ªR­¥#“I“›«Œ”e[ªVB‚U«u³^¦û¤¥µ ´@-T3¬  ›ÅÂU„ÞDUûµ1ƒR¯ëªm„Ü\]ݢܷìáŽõãD4?~œ, e3D³•Gúoa?-’•šJï2Ù……ä?¡Ì$:ƒN$†CînyBB.$Aä“á%].íÎÅ‹‡O™’¯?=ø¿ ƒž ?°aÃö%KÄ¥diQó‰ÕÚÊõ^ÀÖ¯/ÉÍ}{ôè¤ÿ½ÿ¹ß¬7®òرûÞ~[ݳ¨fXƒÍbaÃòtn|ôÑãß}—¿m[SMÙ¬1l••G¶n=—Ÿ?âT<V" <üÖçŸ?¼y³}h7,û¿sÖ®üÎ;ZHÇè1üS؇H;¶@±£¡É¤ ºK8••éÖöö×~xëÖ‹¥5å›Ð±Q÷=8N«Ó­Vm­ÆÇGV¨œ‘Å¢1™díÌ­¢aù„‡»mw<¦ ÚVY©š/DPÍ°ŠŠ|##k¯c<ƒÚOŸ–eUBUÃò‰Œä'–×’Ò^T$Ѱœ:´2âQQ!üý[ ÑÖök‚¸Þèê×ó¥HÈ‚X0`Bj`HŸf‡ìXôB>BÜÜq„€¾3)U"°¢¢"²ž$x‘˜Ÿxßø:³â† «>{VK:Š%%©ÖwCͺÂÚÚȈþ5ô’“-ÅÅ“ذú(ýû·–”HL%W×°¢""ªU< #o2¬ªªx½ž_¾{z½õÌ}e¥Ä=iœrÞÉ{d£qè°aÛ˜b’t(²UŸo7Ë#¾'yïŒÝrÉ)ˆïûy5@Þƒ xN|y‡»û9,ßè,x·ƒ%ù]o6Ž ºˆ Ámfì÷dôhSs³hoo'ïî±É@Qó‰e2…utø††ò¯¡§ó›ß4ýôýÏR]TîAZ^ž–˜X î1Õñ>ê¨HKH`Ãòhôz[zzË/¿Ðw`êÂO¬>‡ WBuÃ2™Â­VŸv³<—ë¯7ïßO[‘©ŽSª$H••• !Lóõ=TV65Ááž(DW’*”™¤ÄÞaˆh4ZD–b‚ù xF¢ãÈâ)D‡8P9Äô)r|ìmµZCBÌ™™þö’$rFÜ ´Ç¨¿ISQQ¿ë¯?¢úaUHJ²Þ|³åàA‰ág;êVAÁ€ÄÄÊÀ@.óD&OnÍÌtES );¬>_›Ívýõ­?þ¨—êÜJ|s,D&®%ñd1¿Š¼‹'®.®'éJX«M @Š‹‹»¸Þ4n‘BvT$ŒoêIƒ+¢p?ÄËݱ‡ªY½:Èh4’2R­Ž¥Õ=FâK±jUà“OR¥Ã¸˜ØØŽÑ£[·n•xV"×°¶o×''w¤§³ïNæÌi\³ÆEb°¹†%ø¡ånüým<`þà×yWv¤Ö–-þééíýûón(îáÉ'_æò»é†%„Xº4hùrúšqýúµOœØ´~½ëÞ2tâ”*$ùLDÂtÆöîÕÍœÙ2q¢íûï/Ê/#E8¤•€*"‚ˆÂŽš;”¥˜¯’x¬ÙwØ4€è>‡*’Ä|ˆˆÃt+¢¬_½zñâ8Ltë„ÜR RõW<±„/½¶x1§•º”ñã›-MNŽôdÑKâ"Ã:wÎço ™;Wµ²5Æ!K–Ô¼új¬ãurp‘a !V¬Ÿ9³!,Œ»þ¹‚¹s23ƒªª\D\gXBˆçž‹yê)î¡%ððŽQ£Z—/¿ì.!.@M‹&ž&ÉŽ2ß}§7Î:eJ݆ A\]ô1I¾éE›—G“TI- PíF„'NœP±ß)iOOOW1}ÊaÓr ÒЋøæÂ‘\@ùbŸ~zîÙgíV+i%@!%&&*‡øzŒKŸXBˆùóÃçÎ5&%ñ»xY¼øbÃW_;ææ ³\mXBˆiÓ¢?ý”n‡Ä¨Â7¶ŽÑêúâÃ**òýè£àW_e…¨>Ÿ|r~út ,]ƒ KñÁAýûwÜr ÇÕdýúº'žˆlm•ÕºýŠpa !~8꥗jCBøíƒ:<ú¨9?ß÷»ïä¶úè>N©BR iqD¡â¸ë®èƒÏddüºÿ%v #!r!ŠF@¹ž3gÎõD£‘!‡eBä‚1q¯sÇ‘K‚U=MŽí Xgã»;î¨5JûüóÉ­­Ýcâé‹LŽOR#ÁmO,!„Ù¬ùÏÿŒÞ¹“îSÊ\W_Ý4}zõóÏ«ÖvAÜiXBˆ'tË–…|ø!÷Zî!‘‘í+WO›F+"ÝŽ› K±c‡ÿ®]þK—ÒÔ¦;lÛ–?a‚Ê[ ª‚û KñÁ†;ü_y¥ÜñRFÁûïÝ~û‘§œw’¾CB.ÄÓÄä!¥#ùÃÇ×ÌšujѢ˦yv“"Î/Q${L@6ñdÅå3Ìì`Ùq–±Œ§ë6Ì!_A©oþõ¯‚[o¬ªºÈ‹ zSÜH]Paa¡rˆ¿zŒG<±ì,[xþ¼vÅ “ã¥}Û‘#'~÷»”ª*úó<ëÊV¯8tÈ÷½÷8ù²DEµçæž92½¶ÖMczŒg–â“Oü¿ùÆoófº-/#„HN¶de_w]F[›'úUJÜ–Öÿ»¾±Q³}{ý”)¡õõž~]ÆÔ©-wÜÑ2fŒÇ½Y¸$NÉpê:3?--|œäo)]×~ð/-Õíß_7o^ô?üš§EÞŒã{mòÒX)@ävð"þ¾ÃÝýˆó‹Û5@RаCX§w¿|y½V+fÏŽâÂ)p‡rÁ˜àEYßEÙÅ•âq?…ú\w]ÿ‡2>óLŸÎƒ ²ýóŸçòûÓŸÜ™z¥x®aÙ™93ÖbÑ|ú)í;ÝG;¶õÀÊÙ³#>ûÌ¥œÇ},Â;ï„<ؼiÓÙ•+}ÿñ7'Fº’W^1_}u{FF¼ã¥ž‡§?±ììÝ0cFìôé–?6ѪÎÞÇí··ž8q¾¼\;u*míä-xÁËNs³öÁƒî¾ÛrìXý’%ï¿ïŠžÒ®'0жjU£ŸŸøÿˆª¯×@­µ×àÔ…Ïž=[9œ3gŽrHb8˜nEàžìDfÚãkÖˆûïÿbÞ¼’ÌÌÉ55‘]¬'šˆ”Ĺ È"*ÄCHK@>êPr!-=}Ç„ Ù[¶Ü}ôhƽ÷ Ê—>¡ê$`‹|Òvÿ=Æ+ÿ‹Ø±cb\\ùm·}ßÞ®ûá‡qµµÞú{ÑÉ A‡o¸awQQô‚ϸûZÔÁ+ KQY™¸eˆ ;2uꆊŠDï5¯Áƒõý¹s‰_=µ  ÷¼ öVòsôè5G^Ói^{öÜæEæ5hС›nú®²21+ëáÚZ{’tïIxônòÓi^÷ßÿqMMô‘##Žâ,ƒqذcbÊ::|23®«óˆj-Õéù³×f³‘b„§Ÿ~Z9|ï½÷”CLÔ'®âUW]E`:‘ÜtÞl6ßv[ë4ÓºiSàöíI|UÜ „8ט16`À帺!¾99ã=÷4ÿ×5^}uǧŸú}ò‰_q±655U¹  €nNÛuŠ–Ø“(Öø“„°˜˜˜.ŽìØ1‡úàrô†'–’;õ;wꃃmøCÓÒ¥%mmš£0TT¸íÍêÈ‘–I“š§L1ggû¯[§ß±£·ÝóKÒ;¿¤Ñ¨yï=Ã_ 2¤ù–[fÏ®´ZÅ¿þ°wo`nn`CƒôL¦Œ ˨QM7ÞhºùæÖœ¿ìlÿ#âÍf B÷bz§au’——°zu\R’eÄˆÚ L‹Ÿ+/÷ݶ-¸ªÊ÷رŽS§tf³ Z,!¡#-­cȆë¯o¹é¦¦êjŸ½{?üÐðÈ#KïÑzݧ—V'ee~¡›7‡ !† i½öÚ–Ñ£›|°eàÀ6£Q{ê”oAïþýuuÂdÒ46 £Qšàà³ÙÇjz½Í`°††¶Ù‚‚lAAV__[Zš%-­#-­=-­£¾^[PàsêTàί½USã#.åÕõúŠa)ÉËÓçåé7n µ;ïqq¶§¥µØ:`€-(È"‚ƒEp°-4ô”ÁÐqäHÀàÁ-f³ÖhÔ˜LöÿiKJ|Ev¶ß»ïø45i8ï}§ ‹è¸® ̇N>^SsÑkR1"`gJ²Q î½CTi›v¹õ¥¥¢´T›í§ÕÒ*»nÕé„]]]®LH§v…JR±­2Y$d„U=¤ˆh:,"< ¹$û^ö`™PñŽì÷šq #6,F N½yWñ:ϤÇoÞ†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a˜¾·1bºÂ=x]ó¤çž{ŽÌàVrø n*^TTDfÈBˆêêj2³fÍšn^§‡à̳ƒ;ú1R`Ãb¤À†ÅH ‹‘‚SªÐÎûÂ… ÉLYY™Á]¨ýüè`¸5n.FfH#ÿKGfp—<ܯð7Þpx.I8ó'æ'#6,F lXŒذ)°a1RðUøÂ /2ƒ[¨¡ 3d&11‘Ì“™àà`2Ó¹¡\'>>t;`²eœ"!!Ì ºìׯ™9}ú4™q™NdUÈxlXŒذ)°a1R`Ãb¤à‰ªðÅ_$3¸k7ê»ØØX2ƒq@²ý¸€ýÉÅ¥v¢Çø]TÝ–µF1©o j[¼BÔ›ï¿ÿ¾«BÆã`Ãb¤À†ÅH ‹‘#÷«Â7ß|“Ì`´Îb±ÌÅZ%Ô€xŒ9bÔO«¥ÿùá¹0žh2™ž=::ÚáÙ«ªªÈLdd¤Ã5ëÖ­NÏÛËãIDATêñ8ذ)°a1R`Ãb¤À†ÅHÁÕªðÁ$3¨qPaa¼ Õ\kk+™Áh' €Ì477“T…x…¿ëÎLhh¨ÃsUTT™’üîß\²d‰¸BX2#6,F lXŒذ)ÈU…óæÍÃO‘™¶¶62ƒµu¨z0:†¹—Xý‡í“““É Öúaÿ³ÙLfRSSÉ Þì‡(y°¨Iu:™ihh 3]ÅŽ=V…ŒÇÁ†ÅH ‹‘#6,F Nm àT=­Ã,¨ñSؽó31‡5)n’’âð\¨ ñ\˜ŠGFí†* +(1ØÚCï$ÂO,F lXŒذ)°a1R`Ãb¤ r¬ðÑGU1;êì-ƒº #h¨ÂpMMM ™Á(Æ ƒ‚‚È *PüTwò[èNCGl´ê©®®ŽÌ`0ƒçÂÆXÁEf08ƒ*Œd8ŠKÅ»0„3˜Ö×Ň HP}c¨ŠÌá{ÎÀO,F lXŒذ)°a1R`Ãb¤à”*Äèt¨q0ˆmQõ`´〥¥¥d“æ° ‹¢POá5c„Û["˜Tˆ‘AŒBžûÜì{Î>÷®»{­½ö>‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ |7ØÈÈHR!""ÂxH:Q`Ÿ<ïóH¯™’’B*x |é±-xØcõ2’’:²³ÏÆÇ·¥¥AttgLL×ÿÉÉ%‘‘ígÎÇÆ¶;A55í  MM••§OCaaÐ7ß³±–à©aÍ™3ÇxøÐC‘ d„H4˜îe€   ãáÙ³gI—ËÕC}HMM5žø ©³xñbã!„’‘/q³ù[ˆ'ì×Ìš‰‰í“&5Oœè;Öµ{wð¶mŽ­[Cöì鳓Ÿ{\\9Ý?œ» ÊããÛÇŽm;Ö5vlsKKàŽ›6EíØ åååÆúd$ìcáчÃa<,++#ÒÓÓ‡¼S$¯ð ©PRRâ½8–ï3y²óæ›Ã†µ®\½jUô]w%××SM55Aë×G­_åp8 h3Æyà O=uúwbþë¿:¾ùÆ/¦ÞfXƵþâMÓ¦5mÙ¾jUô'Ÿ˜0\ø.;Š‹˜Øö³ŸÕ¯][[]¸fã¿ÿÛÁ‚½ ¥tÑÏ>û,©óòË/9B*ôë×ÏxÈC>°!m3¦ü¦›Úrr:V¯^½:¤©‰‰¸V’ñ>…žµ¯¢¢‚Ô'WäQo§Ó9rd—é¯^õ 55Ý.J|î²ôZ€¨¨(ã!×Êäädã!„‘eCCƒŸJáõ×;ÿíßê ÛŸxÂqè¯ ÍçŸ;>ÿÜ1gNüw4nÞ\º~}ÔsÏÅÕÖúz³/{ßÏu×9ÿúײ©S›x ñW¿ ó}«2²jUÔˆéGoÙRº`Au\,Ø{,â²ñ€ ™»àq,âÓõéÓ‡T ]4q—FjyôѪÊÊ GI)(p@t4͹ A#>cCTƒW ­"zM4`zÍU†O°,[¸lYÂ]w5üñ‰?ü!üµ×.éùä |BæôéÓÆC·>™F\WϰÓOYº´ú7¿©›7/iæÌTeUvçµ× J<}:ðË/‹ÇwºƒÏc3úñFgQQé_„þüç)‡õ“2²fMظqé7ß\ÿòËåöNzóP ‰´¹Mà‘@âÓq1%Y~~âO”ÔÕó½¶¶€¤$øúë¯H`˜ó ‡6&%%‘ gΜ1’»æ7E”‹ûtD[q–ÉÐæØ‡Š0¡n÷î’çžë³d ý`‰´qošÈ1Ÿé*--í~EjÁÄ+ô {ôX·ÜâüŸÿ)X½:ùßÿ}@[› I>ΦM±£GËÎnyõU3 {`N¸Ï<…"¡ÞcaŸ÷ÔSÕcƨ|ÑsÕú÷ïßs«ˆPRRB*9Ò?ë` ‡7ŠàBFîšë5ùjøwǃŽà‹=ÖüùÇ]®À[o¥I,~·†]sMʪUÍÙÙ6ˆÑûœa=ùä±"×­Kv_Õÿ¨ª œ4)âÿ·yÄ_φöP ‰0ñ Z’)ÀsèHº¦êÀß|³bݺ¨¿üªˆ§ÉÓ;IÆmj2Q`^_å·k×.ãáàÁƒ‡Ü“%yÃ<ÈD>(®•$†ÄCkAAA×^·~}ù’%‘Û·‡ñ›"“<Üa'þŠYàC=ֻXó—¿Ð¨£ÀùÉORﻯaÒ$/¥.z€¯Öúõ§ÿû¸­[é:;áÛøå/“§NmÊÏ÷QMôP ‰gÁ§tHfŸ%0H×­«~ñÅ„}û"ŒÝ6ïà $«ŽK!ž­FÎðÍ7ß ƒ 2’iÐ"w‰HfWx.¦F}Ÿ??õ駬\µyó¹!ͧ•ˆóÏ™¿Å¬Oô[¹²våʈmÛD=á¶Û’Þ¿¢¢"pÿ~ßš’÷аÈ(•äë-øjt551o^ÕçŸGnÛ ÒÁð½+È ”/W'¿EžyLÎÉGÊdhLÎÀ¯Hê“O XgÀ{Yr×¼—%ÝjBBÂM7õÛ³§düø~µµAÀ’ÀxPÊíkû|¬éÓë`åÊóX•pQ\uUú§Ÿw_Ï‹XfX'6]~¹káBºµàNgÀÔ©i|@Glâ¡’þ–¯&%ý-¼çç·]w]Ëí·ÇtiW ¢ž| LúpK#*ÀG©n3,È ¹Mž¼àvJ‡DãxĨ¨¨¨çK·àM;¼hQÊOT?üp7æ_ Q|þ¹ñY °¦Çúãë{ŒŠðÙ±#¢½îºË'ò ,0¬eËæÏ¬ªò•Zoâ?þ#åŽ;œYYÖ¯…õP ‰;Ãû|â@a ëW¿ê8{¶cÅŠÎÖÖnBƓˈNqŠ\‚ïFI²ê¸G‚Fº'?5>™êv_F’Lú`¡²K.é¶è/±'ø¸˜¼Â’3ð.81<@XVVöÒKðúëÇ¿ÿ~(÷HÈ„ÿîxTÒ¼×c͜ٴvmøþýÔÍtðÏÿ7}º“ý”¼‡— +5µcæÌ¦•+eÞÆ{üña‹{²“¶)x(…dÌÈ÷¡Kd%33“T {ÝáS@D[ù$9!_êH¾pˆ¤[ñ9läš5aÓ§;GŽ *Aî‚ :I ð oôX×\ÓÕùá‡Ò]y›9s¢ù’Wïà ÃzöÙ–ùóMÈÏ.–/¾)* þùÏ-ÈôP ‰G|ã+¿þuíöíÁ‡ut“ ²Ò’¯!36Ü+äY¹â6ra"Q"¾¢•´ÊíC„È ¹:ñu;âÖ¯t›…öøãÉŸ}VºaCü·UàßÛG7\z{¬˜2¥qáB:¼†Ó¸dIü¿þ«·×$ê5¬ûî«Þ¼Y†VóÖ[ѳg×:^ݾÆC)$ŸXPÞ͌ՙ™)gÏÖóYHŽÇñˆ·ÂE8D|j‚D¹qäÊE¼]RŸ§‡‹o¬@æx’ñ ù%È]»M#VMZ¶,úî»kþó?c€9³nÞ¡±Çºççë¯G˜‘?-|W–-‹¾÷^jÄZñ°Ç"ûòþ&00pÖ,çøñIêWΧcÉH™ÿJHÀ†Ï~^ïÜB~î|z„tH|*ƒœäBñÀ˜Ûî„tiüc!IcüÄeá™ÇdÖYÄkjàÍ7ƒ§M«xõÕ·o•è걦MkÞ²%ôÌÉñž}6äÁ½'º¾øûîkzé%ß%Ƨ8y2`ûö iÓ¼”ªeNv‰÷ddÞµ+âäÉ+žY@ÆÚ<ó˜ÌfðÙòà]>º';Œ¹Ý)ŸCFëÄGáÞ‘!Þ$¢×<³€¼…ÏØ3ðá?ùjŒû¼ñFË¿üKÍGu»)~|PáZz¬¼¼Ý{öÈšfŸãȑм¼–œotZZ +7÷‹÷Þ3a(˜ÎúõÑ7Ýä¤xs¤Ð(ƒï9|øû••ÝžÃEø&|‘$™¬àˆÅRO(ž‚Aœ>¢­Àn“L†p—ˆ¯Û]øƒnH‰ç?µå™ÇÄa'·ðöÛŽ5kjæÏ?÷ ÿñà™˜ßc)Ã2ý´‚)œ8\QðƒhßJÄdÃr8šûö-*.bîiY·.øæ›µ³<”Bâ­`Þ¨Q{öîͯ¬¬$~"—BÒÉógé­äKbHx"…\VH…ŒŒŒžÛ@®Èw›!¸¦'އ7É]ð­n3É'Ï=ß>H˜7¯ü‰'ºöLäù|Pá&÷X}ûžúê«ï™{NÁ\jkß{/üÊ+Mˆ)ô€‡= ~¨d©€€ÎáÃ¿Ú²å¶ØXú;èáù 2ä6ÁÂóeÉ•Ïs“6ðÙVÒEñÁ8YÄGz82Tâcs·{ó“–O ñ€Ám·YSÓ6aBûÁƒqp¾.ç¥y€™=VÿþGOœ Ï(|Ý»#FÒtÃòG¾ú*"?¿9$Dc†–‡RH¤Műú÷/Ú¾}’*Yá{“q1Ï…"ã\žòE¦‰x’Í̧•È@˜‹Ñk·ÙTD yÑ)ž-M#ñ…¸ \ÉÅø¬‘ \íÚ6thÕßþÎ}ž&î&öXiiE'OJevî »â ÷m˜fX¢ƒöB·a™³k²ËåJL,*,„jB:X!ºÃŸG&X¸¬âA#2‡Ãû|&ò ñ ¹Ê¸]ÆC|[~E"¦<»(>ON$­â36ê“ܽ;82²#0°Ï;ñµÁ`Z•–v¢¶ÖOþfSÚÚvócóÓ +>¾²¦F–yÙ‰cÇ‚33uÍ혳`5(((!¡²®.c’nw÷'=6yx)\À¢$q/9™>׉´'úYá‘W2×Á‰ÄåâKTÆíSkxˆuèСÆCþÐÒÆï¢°ÒÓ]TÐ}h˜Ú¦¦èöv{>¾Ø_)* 8PWšƒ9=VJJ]]]ŠqœH¡nw÷ÏÎÎ&È¢<>¹A~X|¶„¤pñ’îL¶‚–ÌDBD|¶„t|õ:þó©wr›üdG5ò×ÈxŸ,vCøíÄ ÈÊjá"¿¨˜ÓcÅÇŸ©©‘' ÚŒ¢¢àu±Ì1¬¸¸3µµbX6£¶6ÌxNïy0çY:ííÍ¥¥Æ)2ZçiC¤¿å2D†ÒnCDä24æûÕð9¹ ·A&¢;\eHT‰'C“sîÛ·T êéöAüs3!¶m‹ºì²Ðžwfó sz¬¤¤ŠŽ¹Û””¶˜-O˜6ǰŽÖÖVßz¬™p!Ôµ÷OêþLF³ðP ‰Ãžb ó¸ý ™<–¨'¯@tÊ픎ÛÍd¸jg–l€Ã×Ð’ |:…¸ºYYtv•äpó™.®}âóúj2-㪫Æ?þxIjHNZÙƒ÷gì|啯V¯¾ÀK\æôX!!®³ge…ªmóÀY×^û§»ïŽz7¿våäÕ?ýiphèøƒ‰—Ãò;.¿÷ÞæÊÊ÷»ê¢¢¦¦ÀÈÈŽ¦ŠŠ=+V|±jÕu‹›u¥øt!!‡KJª:;Ïy4dg6î²™à9ï$ºÈ]0ÒcóH Iˆpûð ·RHù ‰ñ,™wâQ_ò~SÄeãÓ/dcs®×?˜1ã¥Ë/Wn}}GGG}Y™ ÊÞ}wüÂ…®@¶@ÁLè±ÂÂ:ÚÚ‚V%ø,©Ã†Uµü#$ÑÔuîçtäãs®½Ö” ™šÜQ^Þ‡ŒÉ/g»’_3ÿa‘È9‘_?Ÿ`éy±9…'7“‹’…@²Ä¾±10-͇+ô@ÑÖ­yS¦àabb›q@‘÷“Ÿߵ˔ y¢_ç ‚‡ÔÈøÝ|ð€LäÌx:Þ˜v¾·ð®—¨¨– %ø./¸\ÁÁðüó0{v׋„»Ë»pÌy&eCDG›|”Ùaa÷oÞÜÒØ‘²Ñᨼcõ a11ËúÓfwÛò6{÷Â÷dÇ[té”)¯yqÞÆå£n½5ÞŒ‡_šÏ§ŸÂرV7B¸x>ø®¿^˙͉¼76‚{ƒ Þ&* ØJs0ǰŽ—Á»-‰Š–3fæVI äæšr&Á{À¥—BQ‘–“›cX…… '«GÐÈ AÀÝ™†9†uäää˜r&Á{ääÀ‘#î«y†–ÿbÃr:¡¦ºï%ø:6BNˆؠÇ€íÛÁŒ´‚÷p¹ìÐcêŠá :èß.½ØjNß#=ÌØÅYðÿôOðæ›ÏoZuü8´·C÷LwÁwùáá“O4žßÌí¸·n…qãL<Ÿ ‘qã`ëVç7Ó°>ù~øCÏ'è¢_? …î"ù0Ð}é‘à£Üv¼õ–ÞK˜Ùc•”@g'°Ì>‡î–ù¼ðÌšeu#w”—[ ëÛ\qüýïV7Bè‘ñãaÓ&«áGÂÀV7Bøv^¦O·ºðûßüyV7Bøv\.`Û+ÙÜ\`;€¾ÂÏ~ÿ÷V7Âc¾ø†·ºÂùxç˜:ÕêFxÌÃÃSOYÝ 쑌¶"2Ìx€”`2³fÁ3ÏX݈ïÈË/ý÷ZÝ¡;§N{†Ý,_CwžŒ÷X»n¹ÅêFÿàÀ2ÄêF˜Âe—Á—_ZÝ&O† ¬n„‰|ø!\wÕ¶mƒ«®²º&2n¬\iu#üž‘#aíZ«a:ë×à 7XÝÿfçN¸ür«a:ýû{Ä•à=n¿ÞxÃêFhbɘ3ÇêFø+ ½zë²úz`Oò´óä“ð›ßXÝ­x!ÉZ øKŒúï‡+®°ºþĆ 0y²ÕðÀ¡CV7Âo¸å–Þ;fçÌœ ¯¼bu#ü€ÄDÿË.ùÓŸàÆ­nDoç³Ï`äH«á}š›!Lº£… áÑG­n„%\}µÞ]ü™«®‚mÛ¬n„…,X?lu#z‰Ý÷÷)-…îÏTô?Þ~ô#«asú 2ãwâþ±÷ëöí0fŒµ-ò „ü|«a[ú 2ÿÀXTZ—–¶f üò—V·Éwhjòû®Û#Ъ/Õ—Î[,{VHN†Š «a7ˆUÝ}7¼újW¿ea«|Ž‘#á³Ï¬n„}HÊÊ2ZÕ/~|ÐU^TZš‘aM³|“ôt @\(÷nØ€=Óĉð çþÔgÈ;V¯¶¦Y>Ëĉ°}»Õ° Jõ&Mêö‰}Î1f ìßou#lÂsU¥¶œQ‰U¹aèPÿH!ún̘ëÖ­‹U]ééP[ ÁÁV·ÃW¹çX¾¼«¼¨´413S¬êB‰…;àšk¬n‡ïñư`A·Wf¼ý¶5M±/쯳ôç#) ŽÛo·º½ƒ… {×ÂpO™2Μìl«ÛÑ›˜<ª«að`«ÛaK–ÀŸÿlu#z%ññpà€?¦Ùdfв$S3O=û÷ÈV·Ã[,XEE0z´Õíð†…={àùç­n‡f®¾ŽƒÇ·ºþÆìÙPSS¦XÝ=¼ölÝ*Ï#²ˆ¸8øóŸá½÷àÊ+­nŠyÌ ›7ÃwZÝaüxøÛß`ãFÛçãÎ --°h‘Ì7ø&ÀöíðÑG¶4¯ßþ\.X´«›"œ•uóÊ+öØNwÐ X¼\.X¼Øžµñ7ƃµkÁå‚W^Q£¬n #8fÌ€;àðaøíoŤìFh(Ìœ »vÁÁƒðÈ#šjuƒ®¾Þz Ξ…åË%4eòóaéRøè#8xžn¸Á«Kûóò`ölxï=p:aõj¸í6ï]Ú°ºÞ ?&L€‰aÂس6n„>‚£GM^ yy0lüèG0q"ÔÕÁưilÚÍÍf^Èø…a¹òJ˜822àÇ?†((€C‡ºþ?pêê ¾ÚÛÝœ$<"#!+ òò 7rs!/rr  ¶mƒ;aãF8uÊ+÷ã«øa‰ï² õ?\y%ÄÄ@K Ô×C}=44@}=;¹¹ 11]ÿZ[aß>è²Heš……ÖÞoá׆õmDDt2¦à`hjê22õÏm—&‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ôzì·£_gg§ÕM°€€û}S6à ˎ·hu„Þ‰– 1,A bX‚İ-ˆa Zô †%hA KЂ– 1,A bX‚İ-ˆa Zô †%hA KЂ– 1,A bX‚İ-ˆa Zô †%hA KЂ– 1,A bX‚İ-ˆa Zô †%hA KЂ– 1,A bX‚İ-ˆa Zô †%hA KЂ– 1,A bX‚İ-ˆa Zô †%hA KЂ– 1,A bX‚İ-ˆa Zô †%hA KЂ– 1,A bX‚İ-ˆa Zô †%hA KЂ– 1,A bX‚İ-ˆa Zô †%hA KЂ– 1,A bX‚İ-ˆa Zôlu<áÌ™3ª°xñbUˆŒŒT…¦¦&U8p *;vLêëëUá’K.Q…ÐÐPU())Q…˜˜UˆˆˆP…ššUˆ—Ë¥ƒƒ»>ºèèhUp:ªP]]­  P…––ò.¬ƒoWç€ââbUHIIéáCðq¤Ç´`Ë û†ŒŒ UØ·oŸ*„……©ÂT!--MT! @ÚÛÛIìZT!0°ë·§zìiðleeeªÐÙÙi¬i<vB}úôQ…   Up8ª°ÿ~UÈÌÌT…ºººž>ßFz,A bX‚l)…éééªPXX¨ 8èFåŠW…Ó§O«Brr²*àUììÙ³ª˜˜¨ ¨¶(pÍÍÍÆ×ÑÀ+¢+€WÌÍÍU…¬¬,Uhll$màÞª$ʺ‘KЂ– [JaEE…*DEE©:kýû÷'uP[[[ÉyPÑÅC 5Ϭ¤5·ªªJPQX“’’T#gè‡bP­_¿~ª€R‹2î]Úé±-ˆa Z°¥¢F´µµ©êêN§ futtó\z饪pêÔ)UÀ  ™¢ªhjHHˆ:Dg}@| :z¿-**R…‘#GªÂÉ“'U:55•œ•ÔŽH%hA KЂ-¥P9h® (¨w‡VôïÐã«­­U ibr¾Å eW‰`ß¾}Iô:QÝÐ\ TEµ#¥vDz,A bX‚l)…˜î‚šÈÃŒyyyª€1Iô¿0й1èaYt<Õ%JKKÉIpúô¸–¡çˆy>è9–——«Š/Þ¦‘KЂ– [J!&¤££‡ž*&mâì:ƒ8Eˆº‰º†uP Qm<ÃÕφ™Ÿè«¢3ˆ.j\\9?J*"i3‚@ô`K)Dw 5%#œ¨wèd¡² n¢â QÎpò'•œ?~\fgg«Š†C± è«â…°U(⨛˜‹ÁKÛé±-ˆa Z°ºMgg'†",X  ¨><ï•=>T(¾¢Wb\¡üM¬‰p^ˆ§»`$%Û‰WÄ%‡è'.Z´ˆß²]KЂ– [z…_¿€Þúh¨w˜$ƒº‰.ʨ¬¬ü¶ó¨Ð(†CQQÝðOè~âÄ"f‡b§ñO˜ÅŠ][#=– 1,A ö–BôÈP Q1ÕAkðŠ@IDAT¢Û…‰4(UíD•D× W¾+Ï%Õ5‘Ëz¦<Á5—WÆéN[#=– 1,A ö–B”!&Œ7¢&â¬N¢‡3ƒ(—¨€8©‡"«T —N`Ú Nö¡„áÒ ¢¢â+è9âT&:•è‡Úé±-ˆa Z°·¢“…ÓsèÄ¡†šˆÉŸø'ž&Š>F)q‡f%»(|è¢&â{1Ýg'ùÂ|”K¬ƒçA¥¶5Òc Zô`³d ø–’‡zHP渟ˆ3ƒè "¨k|CQLUWtë°€*Œ†nºø'Œ‹â-`¥ðÅ_¼[öq¤Ç´ †%hÁÞ^!‚ñF\¶€O¦@?]?tÑC× 5ý¸Áƒ«‚Z¨È÷ýÆ·`´=G ®âºB>q‰‘X[ï-ÑKЂ– …^"…èR¡÷„ûrc)nƒ•q{RtñøÊwÜFM¢‡3d2 I8è0b«¢¢¶özÕ;ƒ– ›…ÝÀ]´pÚ´iª““£ (1(:èbL%Å5ûQ-çÇ)B”0tëðlø^ÜO‹—ÆÙÃûï¿ßí½H€TºÃ´ÐÛ¼BÕ ˜©‚ó}˜$ƒ~®ÅÀ@(f~úé§0tèPR“¯ªÀ¹H¼4ߥ ·Yë­H%hA KЂÍ| ¸xéPÌfA÷£©èëáŸ0¤‰¾žšÄ ¸jA‡Û‰Rˆ^áÓO?}á· ^¡ t!†%h¡×z…NᡨaF Æ-ÑYÃÄNüÎ÷õë× 0¸F 8ˆ~"!föz¤Ç´ †%hÁf¾|é™gžQ|‚|ff&©ƒžãÁƒUW#*ϽEtôPj1‘“KKJJTgyäZ.^¡ t!†%hÁf,˜¡ ˜QÃ' qÇQÔD|° ò q'1mIž\Ê÷R»(D ¡ 1,A 6ë`ÁT]¸óÎ;U§ðð9MÅu…jçRœÄ]¾ñ½è0b\téÒ¥¦´S¤PºÃ´`³ôèÂܹsUýDT@\W¨D·òÆ™A|Uò±Ç3·y"…‚Ð…– ›u°à-]ÀLQ\W¨2EùÎl^xè¼H¡ ta³ßÒèü ÛõX‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚¿ñÿ»s’4‡o °IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/ellipseroi/roi_getarrayregion_halfpx.png000066400000000000000000000236011457240071200311510ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ IDATxœíy|U¶ÇozËÒ„„„í ë ‹#gžŽbŸÎÞLt\pCYFGÑ|Ì( ¢ÈADTDAvb@À²‘…l$MHº“NÒËû£1çÄnwur¾ø™[sëÖ’Ãíó«sνŒAAAAAAAAAA]‹Ït82Þ¡L<´”«öéÓGØ|ðÁ…ÍuëÖ ›!!!àôææf£1ÆÊÊÊ„ÍÆÆFa3&&ô×étÂæåË—…MƒÁú ›×®]„͖–aS­VƒþàMMM ¸D||¼°ÙÚÚ úk47ü®^½êârø†Á dŒuëÖMج¯¯6Áß(??ŸyŠÊã3 ÂdXȰ.Hò±ôz½° |&à@äææ‚Ó…ͼ¼<Ð!..NØ 6U*ø¯Âf³¹8{0&“Éõ€¡¡¡Â&pq"""@ÿêêjaë0 ¸¥òòrÐ?66VØ^V«ýÁKÆnkCCƒ‹&ÐchÆ"¸ iÆêL9 »Áà u8ÿ«Õ:ÂÃL&•Ù¬2›Õf³ª®Îa6{þ¦KÑ +<ÜÞ¯_[rr[ß¾Í))¶”kk+ëÓÇÞØ`2´ÿ· @3p Ñ`°ëõv½Þ¦×ÛCB¬z½£¸XUV¦ºxQ]V¦*,Ôh««áw¢«VJJëèÑcÆXFŽlÑhÚÂBmn®êäIm~¾¦´Tm·wàõèÑCØ,--eŒÅÆÚ °§¦Ú~õ+ë¤IMýúµ ޝ¿.(ÐîßoÿöÛ®òJ]Ó™ßBl¬uܸ¦qãšn¾¹©¾^}ìXà-Šª«»>Áµ!’šUMêèQM»ó®×ÛSRÚ&Nl^±¢iÈÛáÃÚÇ5GŽhóòº® +)¤dÚ‹/¾(l.]ºTØÄŠ„ ÀhŒ±+W®›ÑÑÑÂ&þðíeZ-›>½eúô–^½l‡kR:¤©®ˆŒŒýÁwg‘3V;XsÆ  Ç„ miimãÇ·VWkNžÔmßÒþ[i4…ý“““…M»Ý4›ÍÂ&Ö­KÀý-‹‹ yáÂß„t”Æ-·´Í˜Ñ’žÞºukàâÅ!™™>ˆfZ,{÷êöîÕ1¦OJRϘÑôå—µ.h¶oùôÓ`÷çw:Ã\­Õ:22ê,X¸Ðrð ...êñÇõ§NùþßLy¹ú¥—BGŒè¾aƒaòdKQQå‹/¶%&v‰à½–VëxôÑšS§òl¶€™3ÒÓCwìй?Íë98~äÀqyyª={Zß~»ó›—¿–Nçx챚S§òššÔC‡ز%ª²R¶¯Æœhi xçõ AªöìiÝ´©­wo è4Hú½èÞ½»°YWW'l‚ à)3Æzöìéât†Üù¶¶6çÿxê©«÷ßmݺèÿøÆc6ÐÁ ¹`õÜy|‡ÀÕi* ÂÃPDxcQQQŒ±½{ÙÞ½lÚ´æõë‹Ïœ \½:²²RÍ:J~y/@L`µ{pW‚Z»ê?›±þðsvvICCÀ€}7nŒòõíHbçÎà´´^GÿãµóçÃT0Ço +"ÂþöÛÕÿùŸæ_ÿºÏúõ0úë¿ìÚ¥Ÿ>½»Áàøú늡C[ÜŸà'ø‡aÝÿµƒKÿïÿB~8¶­­FëV¯Ž˜3'fÅ ãŠÐðS”nXÝ»[wï.ïÑÃ:rdßC‡`rsg¢¨H›žÞ£°Pwî\éÍ7{PŠ6¬Ûo7ïØQñôÓ±Ï?í¾w§à½÷BGŽ¿ë.ócA%á_HR… 4d±´;\û4KïÞ½…Í… Ë#"L¿ù3[ÐŽûc(lQ†k%@& V…à@i˜ÔÔÔ›@Ä1T^Ñ«W/aÓ22™ž|2ú‘G®mÙRõÐCC„ªªª„M ‚ª•Àw R@Ð èt)(qÆR©ï½—WY©[°Úb×áµ×Âׯÿ曳©©~ù³¨8Ã:Ôœ•õýK/ÅoÝë¾w§æøñ  ÿíoeS§ÞàÑ«Pô](˰&N¬¿ë®ÚQ£†Ÿ?¯wß» `±¨î½75!¡õ¡‡*ÛÎþâ‹Ù{öøð®Ä  ú㎺?üÁ¸re‚¯oDq¬]ÛÃbQ/Zt™1öÀ»|ß²e ·-IÎ;¨<ñP„ƒIaúÑŸþTŸœ|-==˜±‚öƒÎH; &*LðAL g;ü* >ð³_RRúƒðµ1ààÊéö¨ÑâÅlîÜÖòÿýñïè-f±œÛ°áÁýûߺýva o€˜`(‰ È  N¤ ˆkÁcB‚uÞ¼.”®ä!þ¶êƒÅ‹æîv6kÏŸß»téœ/¾ðí]ý¾7¬™3¯iµlÕªnî»vUTjõ#Ç8oޞ͵Ÿ~û¿ÿ{Þy¼üôé½K—ÞÿÙg¾½½ñ±a͘q-5µuíZÿ'{•ªòìYÆØ‰Q_}ÕíÉ'‹œ‡ËOŸB)×JÀ—†õÇ?6 вlY×ýX%»Í¶ë‘Gæ8àlîÞÝý‡ Ï>[À{ðàÁo\äG!È鼃ïÔ ™ –Örë­Ó¦»þ‘&55ôεët+†²‹ÀWf\bäâþò…+**\ßö¾n¿ŒÚë¶òòÌW^I{íµõ“&1ÆrsÙ3Ï4/?ÿïóW:jkÛãjkk…§ƒì+ÖÑ3 ÁzÈc|3c%%YŸ¾aÚ4¸¼Ⴊìì=Ï>ûàþýΦé¶ocÏ/›’éÛ»ú9|Pq Õ:ªMHˆcÌÕ”F`ÊNÚóì³ùâ ^¿ó¡‡>¹zõw®VTèNŸVÜ÷dÖ[o]5ª«‡k<¦ìÔ©½Ë—·57Wž=?kVÒÚµ%—/몪”•òïíŸÂ×^«ÿüóàšßæð_J¿ýÖ©¬Y÷æ›Å>¼ŸñêxêÔf†íØAB夤$ðƒ¢Ÿy¦Â}W/"é§D<€ÈšÑj­^µª%>>ˆ±ëiO@¡à•XAŒ$Tál$Sª KpÃXÆUªtðÒ@x‚ûÁ÷T!NuD dÔ~Û6é7n¼6fLÝöí7”äc@Ô Ü0­RðÞŒµ{wëw*±š´sð—¿ô|ãJùb}Rñ’a=ùdý§Ÿª¿ûŽ\+ŽÌšÕs×.7Ò¼†7þÒC‡¶ôèa[½Z1ÿš:)ß|rø°:#CÕÕÞ0¬^0¾ý6ÌH!xð¾ü²E§CÎU“A“s­¦{î©ÏÍ )* Œ„õ€À5ÆÎ8pÞ… yënCL "×àƒ"z°ÕEß¾}AB©¬¬À#ƒ;Ä1"ðNÀ‚˜c¬W¯^«Véׯo^º´Ò³ðšÃ}Æzî¹ê+º»ïGÈÄÎZ òqTƒ¯a-ZTýò˱Vk'¬]V2+WÆ-[æ&y•7 «oßÖñãÍï½§Äl¡ÎMNNpq±î®»|¹ÐGúÿ~ã’%qîûX±¢Ç”)ѰââÊ °œ>Ý™W[P2K@QQàÿüÏêô%©B°N—0ärÛmû^=R¨JÀ‚¾ …h@ C!Ñ!U nÓî@™MB¬<—âñAY^Vè8ðA¢"sW˜„CFBÕ¹qcÔ‡¿ýö ÿ¶Á2Ì@â7à1\f¬¨(c\\Íþý”ÇçKjj4™™ÁééÐX½ú喓ǎã12ñ‹xã°yódË6þEÈoXÁÁ̓]8}z¸ì#¿”‹u—/«'NôÁ²"òMWŠbýúðô<”伃…3›gРÂ>xª[7 ˆÇ–!×@€k úã’yQ'°ÝC®1(Âa( ˆœÒ§p d€GÆéPà  /9Þ¹Á`ÈÌÔ¶´°”Ë… Z†Üž…oØcdž±’“s®^ín³Q"ƒ‚8~T¹œ>ü›ßøáŒ5jTSyy²û~„¸tI«×;bc]-c$#òV||›ÝÐØHÉ¢Š&++xÜ8/‡IúDÞ®³†m:qB T ` c†Ò‰pz¨¢kc;kâ*vÑôs™ ªhpHLp‘ x @”©ÑΠˆÀ` b2 Hµ¿uÌÛDzŸŒ/yf¬±c[33PÌF¸äØ1ÕØ±^š±ä2¬–ÌLÙŒàD~¾*4Ô ƒ÷<Á°ââlšòr?Øà…ؽ;hØ0oLZ2Vb¢U¾Ÿf‚/ÍͪÔT«û~’‘ä¼;ˆ¯­¬ ˆ‹‹s]q#* u@€·âØÙ¾'ðÖñÅÀÇ [à —äw;ã`O0 ÞqDT@A ^ñËmêÊ•€áÃMí‰\@ßà¿‘ÇÈ0cõéÓRZJS–PR¢KHð“ŸÂÞ½-eeAîû  ´4°OoäÏÈ`X -%%4cùuuš  ‡^Ïýû;ýv9¼ók(Éy/..îÓÇ~ü¸º àCK¯‚Òì›çåå ›À÷gè»3ð¾q:p]swà\ƒÕ°cí[‰üÜàÃ7öÁ [®ßCzøòn“¥°¨­­ýæUXX]mmCIr8–à1Rg¬èhGX˜›×M(Š€£øŸBƒÁa2ÑòWþ„É`å¾àžÔ:-½Þa6“aùaa·<ð@ÀÝãÂìÍ÷üêjñ±cÅŸÎéZ4cuÃÂþ{Û¶¦«W» <~n×.}tô„åË9]Nªaь兇?pôè»·ßžùúëõùÙ†@Ó…/¾8ºfMÍÙ³ý§LáqE©aFDX›š®¿ƒMÛA×ÑtáÂДåÍ‚kT€Êëoáõ´@vTr2Ì€»°€ü',3ÅA'ÃooyB. A ä“á[j—Éé6|ò׿Z,«ÕZ_o ±9 rö­]û×ãÇ Îœ¹”™É:’¥C3V— )-­èÈçÿ6›ôúŸ„üŸžœ–&û¥VK «©¡„EÓkøðóŸ|bý1½¶¡AUUõÓ\÷ÕW‘½{Ë~Q©†ȼ–ŸOxÆåワž®ù1õ#,Ì÷ÓŒÕÿ÷¿¿Šö]“ŽTÃó*¡L.8‘ôãïð^ÝqGá¿’2"Éy·ÙXT”ÅšÀ;vÁµ ÀÓìÙ³'¼¹#ÀwÆ‚˜ ˆÀàÕuÁxP |m.Æ‹ŽŽ6ñ ^  ä?áå}]¯®ëÖyoÿÍôôeeËâãu:^ool¼~o¿}øáì÷Þk*,tÊò©55©BB¼‘CMHÁáp¼0xð¼}ûòŒŠÜojÉ<åθÁƒ»õî}`éRW”þS¨Òëɰü˵kïgd…†v›öZÛäφLÚXQÁɪ˜ô‹|,?¢¡²rÿªU£Ys½YóÁ«Z†~»e„f¬.‡Áà05(>»¡¾^m6Ó†¼þD@«©QvvƒÉdºpÙd±˜¬V˜Ê²äð&õ 擘˜:UB4¸FŒÖ$Æ*¤âß ’@L @À¹] $úáÈ!SJJJ6±.))5ªñ£Bƒ‚´ éJpÿRÁr‹Š4IIÞ(U#d!)ÉZTÄ}Yk «¸X“˜H†åÄÄØ››¼éD3V×Â;Ó£««‘˜h-.ö†aIº†3⑟0uªÕf³¹Þ’»ºÀ5ÆùRÀµ050 Åm;.z§÷ï8À¾3Ð7 VTTúƒ/SÂãï?Ñœ9Úªª v™ò½âãã™LÈòS¨–¯jˆàKP½°ÐE 2Vuµ:%ÅÖ»7%Ïø“'_;wÎû)Ëó¡ìäI×·$<¦_?kCƒº®ÎOœwÆØÉ“ÚqãdÛ‘ŒàÄØ±­§NÁrsNH2ÞöïÈÙÙAO>y¹¶ö†ïÈ  lÕÇ·Ž7˾'øîŒWË—¾?ØÏƒ!5¾ƒ3ô)øònw÷s[¾Q[[+lâ’|כ㺀 ò%-Íüõ×ÁÂ×¾ÝãEðü6Cðæ¦›lIIŽmÛ¼”Ó×!|—³Y¶Ì°d‰Y§£•ټʚ5-=æã$¹¯“ôôÓ¡/½?@üÈÈh;sF“ããEË$Í– Ÿ Hg|`Çí¬Y5#G²¼<˜nŠpÀrV ets·È±[YŠó±zôè!l‚x\³ïvÑ ûܪHó"l“É‹ŽŽ^³¦dÀ€§ÂÆ)kðJqÊc¼a׋EΞmrßÌÃ_[²$]}€7 +;[[V¦~è!*ãË„ m7ÝdÙ¶ÍgŸ„xé—ø•WÂn½µièÐï\®kòÑGúSw÷ý¼‚÷\¼ŒŒï¾ ½(B.>ü°ñ¾ûBÝí†î=äüÔª­«SÝzklNŽ_úéâ7†åäóÏu))‘¬¦ÆøÄþ½°Ûôé­YYÕcǶΟùÆd¢jGÒ?‘yóæ ›óçÏ6A §[xOv 3Ûã6{õUûøñ{Ÿ}öè‘#Më°?ÐD $†¡ Y@…xa1”…u¨3ä2xð·ãÆí/-¼gÏï"§O¿þÿ‚=åR¾ ð «NŽbGËà?ÇøëÜëp¨ºõðá‰ii‡–.]~àÀ¤ 64À`Ÿ¢ÐéZ‡ É=ú`iiʶm #q¸³ÓெåÄá8|øÖ#G&ÞtSÖÌ™›ó³Gæä ÷õ}ARRò‡ÿ¾_¿‚œœ›&åë;⎖‡# +kLVÖ˜ÄIJ¡COßyçÇÙÙ#²³G´¶ú8Ã$*Ê8bÄ™áÿ¯¨èùÝwÃ>üð¿@öA'¦3V;¥¥}KKûîÞ}÷Сg&NÜß­Û¶ŠŠA—/¼|yÙì¥IB§kéÛ7?!!?!!ßh /.N|ýõyf³íô7ÞŸ (FxôÑG…Í7ß|SØÄ‰úÀUìÝ»7è€Ó‰„àMç³<`@ÔèÑcƘƌilnV8|â„þìÙÀšM‡ýqÆXbb¢° \ÝöTD„#5Õú»ßµNœhKNn=q"äĉà“'CrsázB ¤“œœ,læççƒþ®SÜð a Š…küABXll¬‹ñÏŸ?ïVüjÆš/¿ŒüòËHÆXß¾-#F§LiX¾¼Y¯·ꊊt¹¹¬°P›Ÿ¯))Q[­¢Þ FÃbbl©©Ö”kRRkJŠ55Õ¦Ñ8 ÌËS¯XÑ-'G(»°P•è̆%äÒ¥ÀÜ܈÷ß`ŒéõöääÖ¤¤Ö>}Ì÷ÜcNI±Z­ÉÉÖ†ÖØÈœÿÍÍ 6¬L¯·éõvƒÁ®×Ûõz›Zí()Ñ”—«óó5çÏk>ù$èâEumíõy",Ìÿò[8ÑU KˆÙ¬ÊÉ ÊÉ 2›úî¥Ñ8¬Vch( u8ÿ«Ó±¼¼³Ym6«L&•Ù¬º|¹±¥å§‰ oWF´Ó «C¬Ö£1ÀhdB¿31¤Íxî’v5ü,¤Cø ’f, ã\˜6 œ" b„¡)ÁÖ:xï ÚÀ²inûc™ jêÁW(üݤ"âe•È!#\Õ €¦ÃeBàO€·tåÊa— y ÍXȰ.a\ôå]Æû ”‰Ç_Þ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ˆ®-cD¸Â7øÝâI›6mGÜîÝÀ:Ú/ÄÇÑjµàÈìÙ³EÞ§B2wЊ~Ȱ.a\ Ã"¸ IúÐyß¹s'8ïghÖÑÉøðY`åÁ› àkao÷™ö¡Ë/åOL3Á2,‚ dXȰ.a\ðUøþûïƒ#xÇ6°Ï6ëh“4ŠÑétàéàqp¸«B<2>‚c&ƒÁ/yêÔ©Ì+*$Á2,‚ dXȰ.(Qb ˆ/$FOaå¶7gÅï°¾ÃWÇ×Âã`-)Fâ#îÓØØŽÌš5‹q€T!¡8Ȱ.a\ Ã"¸@†EpÁ÷ªpóæÍàk.Ü'88Øm“ÉŽàÈ Z­GpiHH8‚µ›ˆ GZ[[ÁwÌ3ç'IDAT|ÏXKΘ1ÃíµÜBªPdXȰ.a\ Ã"¸àmU¸zõjp$<<Á×úáK‹‰Äa]f·ÛÁaÄãàkáœR¬ ±&Åz«B\/‰se±"Æ}¦OŸÎ~!¤ ÅA†Ep ‹àÁ2,‚ |Uá[o½Ž`ƒcsݺuGÁœE‰õÖ\‹Áê _ «9\Ÿˆu?;G!qdávd¬R322˜KHŠƒ ‹àÁ2,‚ dX$m àõÃ`]†×áÄÚŸ…ûà Áææf·ã`}‡£™8v‰ÁOGÆzk[|–˜µnÄhI®ÐŒEp ‹àÁ2,‚ dXdŽFas÷îÝ V=bò3±êÁ±0¬zp«9œSŠU^[FŒ ÃZGôpìß!®+ôìý`ý ÞÏŸÿügÐb…„â Ã"¸@†Ep ‹àÁ™c… Œ…£ZX©áø>‚VFX=EFFºGë°z®FÄúïNˆïYÌ*:øâ|ZüøoÁš±.a\ Ã"¸@†Ep ‹à‚$UxõêUpÈ\Ù'&VˆÏÂjNÌšŸX]ŠÉ½Ä•}ø~ÄDâÄÄ18ï?;¾:Ö’ø~.ð~6nÜèööÄC3Á2,‚ dXȰ.a\9V„ŽÄ‰©¶³§V=b¨˜5jðÕñ|Ö›8§Á¹©Xíbm‹Á‘Sü~ð8 v)o0‘f,‚ dXȰ.a\ Ã"¸ Iâ0H¤Äê +#œ{‰ó*ÅÔzPIÇ:Š aŠ`%fÍOü¤8R‰u+V»ø¹ðûÁoÇ.rÄ’ÍXȰ.a\ Ã"¸@†EpA’*ÄÈ.¬•°~Áû5`Eƒcj¬Ôð8¬Ô°rÄ÷ŒûàqÄ€sJÅìy•5ÖÑb$x.\ö(š±.a\ Ã"¸@†EpA’óŽ=VàÎãä²èèhp‡5ð1[ `W‡b°Ó-f1›Ñ‰Y¾Ë 1.¿˜P>‚ÏÂÏúà–ÍXȰ.a\ Ã"¸@†EpA’*t›7‡•HEE8‚Ã5aaaàV=Xñ‰ ¼ˆ'èy¦±"Æ#ãp V©ø)p~%Þá-þ¢¢¢„M)’ÍXȰ.a\ Ã"¸@†EpA’*ÄÒ ¬_ÄHAÃÂé8‡u˜eõ± ÃIsnK©˜¸ÅNðYb6F{÷uˆ˜å6ÁµhQ Ã"¸@†Ep ‹àÁIª'vI…•HLL 8‚—åÀ`e„csXñáH¥˜ÅøÅ,%‚GÆ}Ä,ß(fiüìbªÄšŸöÀ»£Kf,‚ dXȰ.a\ Ã"¸ IâäOPW(Fõ`µ"f1 ÃUÌ"”b26ÅÔñy–wêö²ŽÞ†˜Mðsáø&`Ú´iàNÊÍXȰ.a\ Ã"¸@†EpAæmå€ôÀÊ#f»1[”ãè!Vax¬žÄd½âká³ÄÄ.ñR‘¸«91Ù¡b6âÃïGFhÆ"¸@†Ep ‹àÁ2,‚ 2«B ºiÓ&Ы9œý(fÛ4¬qp¿Ãkäãk‰QXx-¼BVŽbrAÅ„çðY¸ÊR̓Κ5Ëíµ<†f,‚ dXȰ.a\ Ã"¸ ³*`#¦jŸ…3$qv¨˜Ý°¾ÃgUWW3wàqðY8Ï?~ 1ÑL¬7ÅTGÊ»ñ„[hÆ"¸@†Ep ‹àÁ2,‚ PqˆÇáp`Áâ–­[·‚#XáVX¸VFx¬ËpÎÅ™–bòWqÌQÌê¦8ž(&ÃVÌ®sæÌa¿ÏþÄNhÆ"¸@†Ep ‹àÁ2,‚ ÞV…˜íÛ·‹¹8‚£uX=áµ\plç‚â:>¬ïÄì:U*Vjøß³˜•d<ЀR…„â Ã"¸@†Ep ‹àÁß«BÌæÍ›Á¬°p5"VFžÅïðC‰ÙåWöaÝŠU*«B|-|‡nGöR…„â Ã"¸@†Ep ‹àÁ%ªB̆ ÀÏÖiñlÏz1¤X“âØ%Ž0zVù8{ölæHŠƒ ‹àÁ2,‚ dXüCb***À¬žð¶ì8‡µ›˜ý,0ø,¬7ñµðý`½íöêœ UH(2,‚ dXȰ.a\ðWUèXsáðѳӎ9†††º¿E%AªPdXȰ.a\ä¼Ëx„2ñ;}FAAAAAAAAAAøŠÿéYAÅI§ÑIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/ellipseroi/roi_getarrayregion_img_trans.png000066400000000000000000000232001457240071200316450ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ IDATxœík”TÕ•Çÿõ~wõûMÓ@Ó€ Kƒ“‘Ñ`c&èZAAqPås™™¨ã“¥Q£Œˆ &Ÿ,WfÄG 3bƒH·Ð4ý¨®nêÙÕõ¾óa['—F°¾Ü{«öïëÜ¢ê֮ş½÷ÙgŸs†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a†aòƒÚhƒÑ8롇¦MòzûÖ­oß{¯$IªX¥ XXÇÂêr=î÷¯øÙφ¼¾dýúÛ‹‹Sñ¸*Vé³Úh)›ýrÆ¡/²¯ú.XXßMy9<¸Ý"QÛ =ÀÂú“&aòd45aüxŒ‡SÎÄZvïF$‚hÜnxÌ;45áŠ+0s&º»ñØcøì³á[Íh˜üG¼ÿ>¶nÅìÙ*[rùåø¿ÿÃ{ïaæL•-aNЉñá‡X¿?þ±Ú¦È8ÿ|¼óÞÍÍj›ÂœO=…Ý»ñêmÇQøñ±gž|Rm;˜á3w.’IÜ|³Úv ƒ[oÅà .¿\m;˜ïä•Wðàƒ°XÔ¶cØØíxè!üîwjÛÁ©Sá÷ëõÿW §“'ÿí•qçœ3uÖ¬©³fÕŸq†zv8yRnXº‹aæLôõ©mʉRU…÷ßdzÏbÕoìW®Z•I¥\%%ôWÁ®®W–,Q×¼BdåJüǨmÄñÐã®çº6~ÿÊ+å/θá†[>ø@-“ ”wÞÁuשmÄÈqíþp× ?㡯ÿèæ›g?õ”$[·â§?UÛˆ‘£ùG?ZðòË.¹G,#áú·ß®2E³N/B·¶bÎüïÿªmÇÈQÚÐ@-„o¾‰în´´–Λ-–âúú®/¾P;ãÁ¨¶'Hk+fÏÎ+U áÓOqíµØ³Gm;N] këVÌ™ƒmÛÔ¶c¤ uw§ q¹e ,À'Ÿ|sD">Ÿ:–3WyÕ®óÍ©³fÉ_¹ä¼ñ~°xñÜÿüOµ¬ÊV®Ì«9à‘8Š‹oÛ¸qˆ¶îY=ÿ¹®£žÂ‹ž ¤K—¢º÷Þ«¶ ãðz¼ür¨»Ûæv0šL™tzrï¢}mÉ+Ô6.ÿ8ýt »µ.˜tÁߟ7ïûóæ5s½²k&MRר|ÄçCe¥ÚF¨Jm-:;Õ6"ÏX»‡/r( `õjµ&µ ønfφӉ_ýJm;4ÀŽ˜>EEؽ[mSò€X ‡ÚFhá°ÚF ­{¬'žÀo`ófµíÐ É$Òi\r Þ{OmSôKs³Ž×4¥­ cǪm„~yÿ}mm°Ñ\€ÿú/µÐ)çŸ?ÿYm#4̆ Ú݃¤i6làÇâ ù?ÞñsÖYz–Æq±mô¹ÓB=^}—]¦¶šgά[§¶:bìXžK—>@CƒÚF|ZìÄX¸}¤¶:aãF,\¨¶z‹4ÃG³¥>Íy¬¿ÿ{øýøúkµíÐ _}…HGD¯>šÖܹœëÖaî\µÐ>6 ¬Lm#tEUþû¿Õ6BãZ›èH¡ÁæRm…Â3;„˜&›6aÆ µ8V> Aai‹înTW«m„©¯GG‡ÚFކ<Öøñøì3ôô¨m‡9x--3Fm;dhHX“'ã˜'ò3Ç"•:ìÕѰššÐÚª¶º¥µMMj!CCÂ?{÷ªm„nÙ»ãÇ«m„ VžÀÂ:*N§F×SuÁž=pýYeM<›Mm#t‹ËõÍ£:™Ã0›‘J©m„ÎÑÔƒªµ =~ÖòɉÀãQÛˆZ–ÛÍžüd‰FqÄC†UC+Âr¹ ©m„Î 5”¿kEXLZ?GBë˜Í0hæ„F­KSn\§h*Њ°4•xêž} \n8y¸Üð-¤ÓH§a·«m‡nÑT„v„ ¥…·Qœ8eeصKm#dhHX¡&LPÛÝ2a‚Aµ¡!aim}^_h­7„…•'°°ŽŠÖz õ…Öúo5$¬;ùØíÇfÃÎj¡Y:;Q[«¶:¤¡ííjq8òXà—'Š7ú²°ò K[Lž áýxáÓÞ‡ËW_q ~¸L𤭵gÛËË1y26nTÛ=póÍØ±ƒ§„ã¡Aª’$IÒTïÜ·ññǨ«SÛˆoCsÉ;€ÐÕ…9sÔ¶øÞ÷¾'åPÛ–oaÞ<|ý5?üx8ã lÛ¦² ’$yæ™<ðÀ<0jÔ( *lçNL™¢¶GÁ¬¶ßÎöíèíŨvд$I·Þz+€^xÀôéÓô÷÷“¶ jï´úÉOpà€vëÉZ …ÄÃãÖ[Õ4àÎ;ïc£Ñ¸}ûöíÛ·hnnv»Ýª;°[nÁ#¨õåßF=€>ÂÝw«ã´$IZ¾|9€{î¹@6›}ñÅ8޾¾¾Q£F8ãŒ3tuu mJö“Ÿ Öô3Ø5³söÛ3￯›$I7nÜm·ÝàСCJKKiüä“O’°º»»ÅûÇŽ `Ë–-ty vàÎ9Gs'%ËѮǰo^}wÜÇS͆çŸÀÝwßM—Ë–-s8&“éᇦW¼^o0¬¨¨ðx<”NÂî¹kÖhZUиÇ"ÂaÔÕº=¾’$™ÍfO<ñ€Ç{ÌårH§Ón¸á&“ @*•Z¾|¹×ë000 ²²2—••Øš[™Y…•” ­ ¥¥#xKEа.½Ó§ãŽ;NÑ×I’äõzxàÏ>û,€½{÷3f €h4 Àår-]º4•JˆÇã&“éÙgŸ­¬¬088  0ÍQØò娴 o¿}òwRM‡Bâ7ð³Ÿá꫱zõ©ûRò@’$ 5¤R©ÁÁA£ÑHìÁÍf—-[àÆo¬ªªðøã°X,:äõz)³Ùl'Ÿæ/Z¯Wª‚.<ÑÑéÓqð ²ß"Iy¦9sæüéOB.y·ÛíF£‘¼‘ÍfÅŸgñâÅ$¬ÎÎÎ’’wÝur~. e2¡PÈçóáøåÕØˆ?ÔÖã'Žn„5aÞz '*û-$¬9sæxûí·ìv;rsC m6›R1ÒE½X,vã7’°€?þñÈEFÊÒ³ÙÜ™[‹¦ÂZ[qá…hk©ßª,º€ùŒ‹»îRð+HXóæÍðú믈D"$ ·Û\Ž•N§³Ù,½Þ××Àn·»ÝîX,†œP–,Y “(Ÿ{î9EEE%I¢7×ÖÖ¶´´Ð·Ca?ŽÝ»ñÒKÊýôFOÂðÌ3س¿þµ"7—$©¼¼œæ}¿ùÍoØl6^>ˆÇã6›|%RÂ¥Q­äR\\,Þ0{öl”™I’´råJ ©¤Ñºº:'“É£¥ù·ÞŠÑ£±l™"¿Z!t¼ËYº¯½†înüéOJ}y¦T*E²@.̉ԛD³k×®ºººX,æñxÈ%“I¢”%ıvíZ‹/¦Ë+¯¼@QQÑý÷ß?nÜ8äf.—«¦¦†4'—òå—ãì³5Ñëq\èLX.» ù zzðñÇ#y[I’jkk­Vk6›%%e2™X,–N§½^/M-‹IvRjgggCCC$Wa#äv»é=ñx<[,ƒÁ`±X^zé¥x<ફ®¢÷ÿâ¿Èd2¯¼òŠÜ §Ó™L&ËËËs ‘34Оvœè, ¶mÃÒ¥øË_Fì†$¬¥K—xúé§Åëõh‡Ò)‡Ã ›Ívtt444ÐÛ<ÏÈÛ…B!ä\¹½ÞÞ^ååå¬V+ŸÏwß}÷e2™þþ~ºÛš5kÈEQü ‡Ã3f¤î¿?yé¥õ­¹STo©>º1ôHZZ°xñˆi‹úd-Z`õêÕÈ…¼@ ÉdFÕÕÕ…œC¢™ ý3“‡#íÙ³9éÔÔÔ ÒWoo/¥ð%%%ƒÒ2§Ó N_sÍ5tC*â¯Zµ ÀôéÉ{ïí¿è¢Jš"_ôûýЉ¼t`â1ؼO=…×^;ÙûH’ÔÔÔ …HX¯¿þ:%L”ñ Éd2étš|ý-i…4 G½gÏrK”ÂÓ›Ãá0‡Ã‘H$¨AK$h6›iI¢9í´Ï¿÷½¿ž{nZ¼¹²²Òï÷'‰p8ÌÂ:¼ú*6mÂ3ÏœÔMHXTC_¾|¹Õj%éPVDˆÊ›$5—ËE³<Šqô/M: ¤ª{  ŒF#ù!Z¢T¾¥»»{ýúókk;Þ|órò‚¿üå/Ðz‘Á`hiiÑ…°´Ûè7LfÏÆøñX¾üdïFC¹gc$“Ét:M¾ÄétšÍf³Ùl³ÙÄ”-’æˆD"‘H$D^ï÷û‹ŠŠhª‹ÅœNgqq±Íf#U%“Éx<•DKßEº|ôÑôîݾä’Aê³Ûí?üðwÞyÍ5×èBO=Ùz ®»ÿú¯˜9óDÖ|$Iª®®póÍ7S~CŽ„\ˆœD"Àn·Ó" r~¨££ƒœi‹&•_ý5Š}ô'ݶ¢¢¢=wæPQQ‘$I¥¥¥µµ©_ÜÿôÓîõë+‘sôç7ÞHßuÓM7éE^º÷XÄ /àŸÿŸ|‚ Näã&“éúë¯OæžuN• g„Á`Ç»ŠŠ «ÕJ2ŠÅbeeeV«U1‡Ãaì‘H„²ïŠŠ äërû¶\.׬Yý¿ýmûܹ¥ëÖ9¨Ð@ >±bÅŠ_+TVŒ<€¯¾Â¨QøÑðè£'þ £Ñh4Ãá0å@‹… Qü~$ š‘L&å.dÔ¨Q£F ‡ÃäÛ<¸U&“éîî–·žz<žTÊ÷݇¦M‹Ï˜Ñ‹Õd³Ùp8LïÉf³ƒA|õMè-î„>Þ|EEؼ™Ì°*¨’$M˜0aÉ’%V«õ‘Gq»ÝB¡P4¥)åF&“I´¾ †L&c2™(T‘zÂápiié§Ÿ~  ©©©¸¸˜äE¹Z&“¡ˆÇã™L& ^}uÏš5ñU«œÏ>ëJ¥R.—‹r/»Ý.¹“Éd2™ŒD"½½½z‰ƒÈ'%xýu¡¬ ûöáŸþé»ß …‚¹#Ò}>_iiii®A“þQ%I¢T=‰Äb1Òý«“‡Å÷ÖÖÖæææææfº¤çõzIŽ6›Þàüó“;w†KKMÍÍ›7óu~¿ßf³Ùr06™LUUUãÆ“Oô‚þ–t†ÉwbÅ ¬XÛoÇ“OâÝw¿å="mG®³¥¼¼<;αcÇ&“ÉT*E™“ÈÊIU±XŒÄ'Ò²H$Bë0ÈÕ èƒ”“‘V¨”zþùñ… ãñÌÅõô|“–‘t¨„a2™L&Swww  —Iꋼ€ýûqÑE8ï<Üq}=†5k†¾'™LR¡ˆvz°Ûív»]8 r0£ÑXWWG99$ Oô'Õ#„þpx•|öìØ’%Ñýû÷ßoüì3Ýn7›‰Di凾Ëf³Q E®Ô`ß¾}:ŠƒÈoa7bãFL™‚;îÀõ×ãñnrPßtx ×500@ÞÅn·ïß¿Ÿ–‡ÃáˆÇãîÜSƒÁ õ`Ñ%¥Ø6›|˜Ñh´Ûí¤³‰Ó_<8}z¼½Ý¾p¡gÏS,âåå墚EBìïï§6›­±±Ñd2 ™œê=ý'8yjj°p!æÎE&ƒ©S¹è¢ßõöZ.½ôÒgžy¦¨¨ˆÄAº\.ŸÏGÂ"ÿ!_Ÿ‘$‰¤Cï4 ¤Hò1ÅÅÅÕÕé‹/>4kVÌd2¾ûnñ»ïV:d9xð €L&300P__OÊ‹Åb´^„\Å‹–)þ †/¾øB_î …&,ÁԩرãÎ>úÕ”)®ŽŽ1«VíýŸÿ±ƒäšÜ)ÝI&“GËd2J¤(ÇJ§Ó¢"o6›kkÓ§æÿ‡H{nöàA˶mÆ·Þrvw—ÓßöõõÑܹܫªªÊçó‘O"_E·¢RªÛí¶Z­,,!IR]]Ým·ýt̘Iúhúôdk«56ø|ž¶6c{»õ¯ ‹¥@"‘p:äBh姦ÆS\œmhˆªª Oœh²Z1fLrËÛ'ŸX?ýÔ¶oŸ¹ÒüÀÀ@EE-Ê'•´ÿ¢§§gpp°¬¬Œ^”×ÜI¾Ÿ~ú) KPù À 7Üðè£(//¯«K–—û¦MóVWGFNZ,‰É“3N§40`0„B³.—äre].i`ÀÐÚê0îÚ•lk3îÝ‹/¿4%5‰D‚\5ZÕ××#^E¥êU)ÂÒGR©Tyy9IŠºt&Mš¤GU¡’÷£áv»çÏŸ\Bc·Û;;±m›í½÷♌° z›Ýžr:³GÖ`@2iF ñ¸Y|ÜLGGG"‘¨®†Íf£r Ýn·Íf#×E ˆ‹…r)äªÑh”ÔÖ××'f”&LcÝQ¸ÂÂ¥„P(d³Ù<Ïç£6•h4šÉd¢QC4j²Ùœ¨Û˜>G™ @yyy:¦&¹,¨~QSSC¥Š@ @ ¹žfZ[¤p™ÉdÌfsJÏOÉη%á IÒYguñÅ;Îûî»/‹ÙíöX,&êãn·»¯¯ÚÏ8N‹Å’J¥ŒFc:¦œÕj5]]]@Àjµ:’‘Ë墚L&º!-*Fºu2ªbFZpsL—Ë%IR*•òz½Û·o×cD^.é Ÿ¾¾¾ªª*Ê ‘[ÎmN§³²²’< M 3™ŒØºC—%%%"¨QÅ\è€öR‡ 5{9NŠžD èéé—¡P( ™ÍfZ ²ÙlòÝQpÂ’$iÚ´itò½’ÍfM&Å#P__ŸèL¢Ñ¨¼˜™ÍfÅòb, ƒ”‰ÑhTÅÚÛÛEÇ)Z ôx<ˆNguu5ÕiÅš·~S+AÁ ÀÀÀÀW\àÕW_5™LâD†d2YSSC› ŸÏ'R¨ÆÆÆ²²2›Íæõz©˜év»KKK…@#‘5rÑ%ù'Ñ•%IR8nkkC®&ºhûûûi.  ¤¤¤»»[§q›¼IÛÅj€L&SVV‡%I"ÏA±’šŒé=Âý^¯—2qªH0™L‡"‘Õ××g³Ù’’rr43G9tww P+3•ïûúú"§ì@0e(,aÑ4~ê©§ëD Y¤R©žžžúúz±L#‹v‡Ýn§Ôj``Àh4м^¯Á`«{Ô#‰Dè>ÅÅÅÔ» N[,–t:-q $8½ìÆ9…%,bÑ¢Eñx\t¼ WÌ,))¡â¤Íf#­P6 €²lª¼S/è++P-^’$ò7N§SäXäxL&S8.в:ú.äj¤”ì0›ÍTVÕ5—cQ!@\“»"äõz#‘-ûýþd2)of›yÛŸYé\Ô<íC–tI_ŶU™L¦··Wduº¦€êX’$UUUÑ3V®\I;ºR©T<·Z­^¯W¨¸%veY,Zl&UWW{<òLÔe‡c±å^Tñ¢sŽ(™³Ûí™LF„6RžØ´HJ2™Läç Ckk«®ã 0ŠÆ_B^@.re2zÑ`0„B!š÷Q¸=zôË[üÄ"Õ&H1r‰ˆ>ñJ:—´‘_¾YC¿–°Di@ì$ÒÛÛÛÛÛK­ä6(`Y,’ˆÉd"×E>€8´Èëõ–––J’D©…¿îînê9;QTTDA“îCùœ(4ä…",I’𛛝ºêªH$²råJ“É$ïnjj¢]hß3r]+Ünw0-S£¬ˆŠ¨â,?º­HÞém@iÑívG"±Ÿ¾‹öÒ$Á`Pïq•¼û|>šÄ~¿_t”hjjBNÑhtppòn Žñâýò4€ÓéL$û÷ïG®RšH$†ìö¡‚úååÆäAµ]NAx,I’&MšDã²²²X,Fš¨­­pèС@ 2­T*UTT$–hÈ—ˆ“âñ8máÊd2¤¼x<‰D(œ8pà€Ãáq“îS\\LQîæ÷ûÝnw:®­­•Ÿ<ƒ\ Ítïr‡ ë²Ë.°bÅ äR(Q«„ìˆÇl6K ~qq±Ïçs:”f‘°(=—IcJÚèhá™Òé´Á` r)ŒôGž’4D’¢[%“I¿ßŸq… ÅTk̘1cÆŒ‘/˜”••ÉÿuIUb /‹QùŠ.©…A~^ˆÃá ’¶œN§Á`¥2j€)Å_ÑOA«×ôAyÁ6Èa‰CiǪU«<¸{÷nÉd2‘HÅ„B¡!iÓîÝ»åyOCCƒÁ`­ž555µµµB1V«U¾‰€Édf³™<¢Íf#Uy½^“É$h2™´X,yã®P ¡2yÕÔÔP8£u’Ž( 0™L4×£¬‹œS:öxQè QXQQ•¯(…¢ÇþL·’’ùB’õi!W}¥øHëEâa*ôÚãEã]»våSD!”Ž:n4wuu‰‡È78Ðþ-%©Ð ž‰"îðùçŸÓÚÚÚÄÌÈPÇE[í%Ì3òꉈIJ•çaâä‡ÃA ÌÔ÷L"£JDMM y2JÞir@ ä -K8Ö×1Ã!¯~Œ¢…ÕÕÕQ¶$ï Àív;‹ÅBŽþJÞÚ@lùýÊ,K´õ çXÃeHvÚi§‰'_Š(™J¥<(šÅÊù¹H$"IM)9«­­•?v5Ÿ`a7¤0á‡Éy½^J¼ÚÛÛ+++Óé´Ød&Ι¡K—ËEÓIû÷ïÏ?w…'PØé§ŸNÂ2›Íô CäŠ[ò>ˆx<.6^ †ƒ楰Øc,GVÂ&Ožìt:€èqhooohhÈd2â©L.—Ëh4ÊŸ¨“g°°FŒ! «­­u8Ô6(ÞCÉ–hØÊWw…Ê!ØYg€V$)ƒ´êœ¯ Øc)Ç·†HÁ`PîÃæd‘rÔÖÖ655 Áå%ùé‡5ŽT¾ÆA†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a†a˜çDÎgÊïØ#9Eçx±° Šûçæ‡41ŠÀÂb…Å( ‹Q£,,FXXŒ"°°E`a1ŠÀÂb…Å( ‹Q£,,FXXŒ"°°E`a1ŠÀÂb…Å( ‹Q£,,FXXŒ"°°E`a1ŠÀÂb…Å( ‹Q£,,FXXŒ"°°E`a1ŠÀÂb…Å( ‹Q£,,FXXŒ"°°E`a1ŠÀÂb…Å( ‹Q£,,FXXŒ"°°E`a1ŠÀÂb…Å( ‹Q£,,FXXŒ"°°E`a1ŠÀÂb…Å( ‹Q£,,FXXŒ"°°E`a1ŠÀÂb…Å( ‹Q£,,FXXŒ"°°E`a1ŠÀÂb…Å( ‹Q£,,FXXŒ"°°E`a1ŠÀÂb…Å( ‹Q£,,FXXŒ"°°E`a1ŠÀÂÜ‹¬É&IDATb…Å( ‹Q£,,FXXŒ"°°E`a1Š`VÛ€cïÞ½4hii¡AYY€üàªÙTÀ°Çb…Å(‚ŽCá-·Ü`ÆŒt9nÜ8Äãq<ÿüóªÆ€=£†øŒ$IÉ|ðd¸ÿþûi0~üxTVVB–³ïܹ“W_}5 V¬X ¸¸˜.Ÿxâ‰Sdk~qbÿÜì±E`a1Š Ýäý¡‡¢Á”)S$ ºloo§ÁÇ ‰Ð¥Éd¢ÁW_}Eƒ3Ï<À¶mÛN‘ÅŒ öXŒ"°°EPVH“¸³Ï>›.«««iJ¥hðÅ_èèè K›ÍFªW%“É!¯ÓJ€K/½À[o½E—‡¢Á /¼0RÆ<+d4 ‹Q„S=+\¶l Ä Ì¤I“ƒAºÜ±c zzzhÉdäwn™bŸˆ€"&öööÒ€æõõõtÙßß?¢?…9ì±EPðûýâæ40},£Ó锿nµZi ]ÂuÑ<à /¤Ëßþö·4Ùýòåˇù+ NÞ ÁÂba„“÷{ï½—cÇŽ¥Áĉ! |/¿ü2 Dh#„³u¹\4Èf³òÇã¡K±t388Y÷•â ÐÙÙI—§Ÿ~: ¾üòË“ùÌp`Å( ‹Q¥f…¢«n×®]Å)àÄ+EFjßóB±Â#ÊZv»²Ð)Ú„m%EëÜsÏ¥Áúõëå·¢~@æhð¬Ñ,,F”ZÒÙ·o €t:M—4•àõzåïw»Ý4°X,4A“Ö…A8¦…TÈy(¼Š¥!QJmnn¦ÁŽÿ—1Â=£Š/é,Z´@II ]ˆUgòUb¡F,鈕rrÂ¥E£QAæáÄ…«£;ˆËQ£FÑ`Ú´i4xçwÀíYß'`a1ŠpŠZ“¯»î:ñYˆHGÙ½(G‰d|ÈZxƒ€l÷¹¹P–ˆ¡¢T6oÞ<lذ@WW]®Y³æ¸~TÀ¡Ñ,,FNQkò‘‘Ž" r³6ÑD¬å(zƒðÆb@!RLESƒ˜`Ò„QÜPÄDÚöƒ\¿ƒˆ¹Ì‹Q„S½¯pñâÅ4å%Bø'Q@ XCÞ)JðäŠÄâôµgä²ø#] pi3gΰyófºÞô¹çž;±_——pòÎh£ªm±¿þúëi@ëÓ"õ›mÄ+”æ‹Kû(´™ÍßÌ?D?–P(Á¡Ñ,,FÔ?m†V{Ž,S‰I½"Bž…4©A²¾ ÑÓLóGéÄ’Ž˜6RôÏþsº¤f>Ÿ/½ôÒˆüF]áÑ,,FÔ…Ä’%Kh ÷D!”¦"À‰7b-HÔQC¡ (hŠCÑ-ÞIóMÑ÷'%Sîw‡BFShÅc D}Kd딕‹#b„'£ä]\Šuî!7Ä}Ä`ÈÎDQߺöÚki Π¿zúé§GìçéöXŒ†`a1Š ¹Px$W]udý["Ò‰dB˜$B5Jˆ8ä¸eñ‘ËŸwÞy4±ò“O>ðâ‹/ŽäïÑ  ÁÂbA¡X°` D‹B¡¨c‰.ñ …]~ñLƒÂ\ááPÈh{¬!ÜvÛm4ž‰üHÞ…'Ò¬,Þ ååå4øáY /v­]»V™¡EØc1‚…Å(Bþ„£1þ|ˆ}>‚!&+9â9aô(MÑ©,öæÔ"‡BFC°°EÈÿPøÜtÓM48ò`fzø€x^õºuëh@5³yò‡BFCœ Çq;-“OŠa†a†a†a†a†a†a†a†a†a†a=ñÿáÁÿQz$IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/ellipseroi/roi_getarrayregion_inverty.png000066400000000000000000000227351457240071200313760ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ IDATxœíy”TÕµÿ¿5ÏSÕs7Ð -È OM"Hâ3fézÑåÁYp™6Q³Œ!Y¿¬È[€ £Æ9à{}1Q—€ÑxÏ|¨ 4 ¡é†nzîšçº¿?¶uri‘¡éÛ÷VõþüÁ:·êÞ[§¨oï½Ï>ûœ 0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0ã ÚH’D Žÿÿ™ÓFÊQYYÙÐÐ äUÕîÀ¸€4ÔØØ`hh@*•R¹O æXA„M:ûì³;::˜ÍfCCCÅÅÅÚÚÚ Õ²Å}„žÎ8ã n·{÷îݵµµÂá0€ŠŠ z½^½>* kÔz"—788h0Ünw,çX,ù%ÕÕÕ’$¤Ñba$©3f$“IF£1 qB]]½^o0âñ¸N§#ÓU’"XX#G˜(ŸÏ ººÀ¡C‡øý~äÀf³èïïàv»ÅŒÆ‚ýÿ/Ø/¦BOÓ§O'ݸ\.d®ÔÕÕE"yE#ANG×F"‘ÞÞ^•••&L(HoÈÂ:Y„žªªªÈÍE"ñºÓé`2™Èë$5q¡ËåjóûýƒA’$“É4vßa aaRƤI“$ òø €Íf# T__¯×ëÉ\\^^žL&ɺPÜ}àÀÊmƒƒƒ4úëîî`µZTUUhooïìì$' ¡¡aß¾}dÌD*Ë`0ˆx¿ð(´ÁÈ I¹ÝîÒÒRäLé‰~øÁÁAqZEEE<§Á åèõòòrz±ªªª««+à而’}}}‘H„L)Ì`0Ðýûûû il8~-–|”G ‹ÅB./“É †Ã‡#—£Bn†ü AÁ“°:Á`þõz½'yëééÒ@’ yÅãqŸÏGÚ*$ çOä$‘‡P4GÖ…¬…^¯Ïf³äÚ¨Áçó™L¦t:\:Š2 ™L†¤FÁ;ݹˆ‹ŠŠ$I"ñ‘F#™C: …BhNzÇŽc´Æ‹Åzª¨¨°Ûí‰Dkkk6›P^^.IR6›%[Egz½^ä~~.—‹„E;xð`2™ôxŸÏ`0Äb±d2IÚ5 ýýýVHSøéJÔÖÖ>üðÃ䛺»»É&ååå½½½d`d2™’’’T*EÊH§Ó@@îÂL&“<«éõzc±˜˜iƒCCCÁ`°¬¬ Ààà ‡õGƒÁh4JñY!QøÂÎ%‹-Y²¤ººšÆ}f³Ùb±ˆ,”ÇãI¥Rr³1mÚ4y–¡½½]’$§ÓIçtuuuvv Å$“ÉD"!†2™ Ù<étšÌU"‘ ML&Cau&•J•––LBk¼¸B‘+:pàr³{D? ˆr ‰DÂb±ˆ´‚Ýn'wIq…GòŸ?‹‘v-K"‘ˆF£6›M¤@u:‰L <…½ôz½tsI’Ìfs!e ßb Ö¬YSYY¹lÙ2:ŒD"n·[ÔdsÐa0ŒÅbô.Eë¬V«8!“ÉØív ×”–––––ŠøÌjµÚl6’/¹T“É$·åååV«•R_ÈùÇaÕZy͸°XdŠ<€þþ~¡†ÎÎÎŠŠ ŸÏGÒ`2™„‡Bnp'l‰ÕjÇãÙl–jª(`—W(ÔÖÖ’×#Hš"ëííu:ôqF£±½½GÒx½ÞÂ(vG«¬¬Œ*¢²1âf]èu:4“‡ÉêXsˆó‡dÑhÔb±L˜0€Ëå²Z­‹…” Àl6›Ífy)i:¦†èLU*Ô—9!/½ô’Ëåºÿþû3™ e,Éý‰¹¼h4Úßß/×_8öz½dTâñ¸Ûíöûý.—‹òeeeeeebL'IÒ0ÁF“ÉDÙü¢¢"‹Å’J¥D„çóù|>ŸÐ7e"”þOÆ…+DÎR ¹éyuàÚÛÛM&“‡å !4–$¹D£QN744&L˜@18M –——Óùz½~Xй\¼Õj ƒò°½¸¸¸¼áx–@ž‰Dè&a‘- ñxÜjµJ’$RÅÅÅýýýTe%ªù"‘ˆ\dº(ée0Òé4Uó “"‡™4Ѧ%bò+Éï?‹SB’¤ššwÝuW&“yâ‰'Ä[ýýýäÚ(¬¥¥¥¶“°hd'*B=iˆÎ7›ÍdH@‘H$“ÉFɵ‘vÉétºT*EíX,æt:ãñ8Å[$8*×ÙµkW^­qcétºŽŽ³Ù,¯³"ÑÐ4p p¹\T‰PZZJ~MØ$›Íf³ÙhtIX,òª$“É‹ÅH^¡PÈh4ÊKÿR9èfI d· ƒßï—õùË8–àÙgŸµZ­4R£WŠ‹‹‹‹‹…à‰D0¤Hˆ~æòòòÒÒÒ¢¢"©TÊ`0ÔÖÖÒ6š+Y¨h4*Rbd·2™ŒÛí¦Ëèõz¹¸I|"C–N§i©O^3¾„¥ÓéöïßO©ð{î¹Çf³ÕÕÕù|>aoÊËËåAå-EÐc·Û½^/9G²p‡#›Í’ͳÙl@@>ëwøðáÇ 644Ôßßß××Àh4¦R) ÒiV€ÒÂ\¹ÝÞwÁ;!ÌAš ¶Á`  *³Ùl02™Lwww6›¥AṨ\”5™L6›MÔÛèììŸOî)6i»ÝN±šð\N§S~~]]ÅïoÑ[$8 Þ)˜Óét}}}¢N0›ÍVTTäoBkÜ KNII PXM©¡§h4‡É‘àhçq¹(W§K()+£Ñ˜Íf)ãåt: Ã0èóùäK É÷¥Ói—Ë …‰„ä#ãÑ$éí·ß°lÙ22ò¥ÝÝÝòCrj"“i6›E™Ceee}}½Óéž«¯¯¯¯¯OŒ7èõzQ–C'‘ÇJ§Óòª *9”׿)ãÑb‘7œ;wî°Þãñôôô«êéé¡ßÞãqX­)‡C²ÙÂ: S$’Åt™ŒnØêø¾¾¾òòr¿ßßÓÓ#JE-Y¾üãt²Ïç#XTTät:Ãáp(J¥RTto0‰„Éd:çœsòÔŽGaápxݺuMMMä¡ìv{mmbîÜÄœ9p]]Ò`H̘‘1úÃa]$¢ õƒäpHN§d·g3]k«5ÑïÞÚ¿_ßÚŠ={ ‘‰¥'h&›B±H$’H$¼^ï¤I“劔¯³PRRB.µ³³³¥¥…Š]ó‘q-,’Ô¼nÝYÀÖóÏïٵ˒JézzRÍÍÖwÞqòIp`@g³y$ »ÝNAEý~¿ÛãÉÔÕÅêêR~`þ|£Å‚)SÚ¶m3oßnÙ¾Ý Ë?®´´”2XR©”Ñht¹\œ9r$Ëç E¨wî¹çæ£ÑʳîŽsæàï¿ÿ£žœ2ÅÕÑ1ñé§[¶m3‡Bÿ,÷£¤e2™t¹\ä)¤ÑÅûétÚb±P¡•ÑhôûÓ}矟¼à©»Û¸s§þO²wt”л}}}™L† yƲ²²îîn2™”h [ 7j6›u:Ý_|ÁÂÒ4ÕÕX¼ "Áœ9+ÿõ__0]qÅO<ñ„Ûí¦™þu8ÝÝÝ4.ÂB®â… H‡ƒÊÞiJGL]—”¤/½tàûß:ú·ßö¼óNEo¯‰æj2™L$©®®&E£ÑL&C 3J«R¢‹ $ KÓÌš…@U¶lÁ† hi áo¾ùfkÖ¬‰D, ý®{öì©­­5” DÉ‹’¨V«ÕétÒONVÇb±$“I’¦ÓéŒÅbv»}òäÌ¥—¾ñxW—å‘G2»v}¹Í_uu5ÅìÈi(N‹+e7èä®®®üÒVáÇX àÁá÷cùrlØ0ü]Z´àÈ‘#íbÇ+++Óé´Ñh¤Å¥‚Á`ooïĉx½^yHD®Sdª²Ù,í5  µÕððÃVÀzùå‘§žŠtué–/×ò‰]¾áå#DÚ=‘Hv«ªªÄ2¡ü"ŸþN•†¬[‡t«WcãÆcœ Iy.^¼Àš5kJJJâñ8Y,e¤ÈOƒÁl6K…b,ùš0ÇCá—˜jD.–"——Ífõzý…Æ/KRæ'?q:dàv»åY/Ö¬Y³tww8p€-–&xüqüÛ¿¡© ›7í9”Ð"mQ^ ¯¯ÏétF£Q2`'N¤IGX»Ý>¬jÊårÑ ¯¸¸Øï÷“"‘‰‰¢4 Â>øÀúöÛ™ Rücðw¬¿úÕ—Y.I’È@f2™T*åóùÄZȾ¾>—Ë•_cÃ̼_}5¢Q>ŒÉ“§*ÇãeeeÃV×èt:2<.—Ën·“Û"aQÒ\,ŽhhhØ»wïÞ½{é–âˆ<{"‘Iö-[L³g»;;3ÿøGï…~¹v£´´T¾œš +öïß/_”/š°^y³g£¸«VÂU¿þõ¯#‘Èý÷߀ʗËËËÅR" ‰Rœ$Iä¶B¡p çž{.€¶¶¶¶¶6ùåòºBª;­««ûË_¦648æÎ•ž|2$Ÿ7”—Ë%Šó…ÂÖôéèê»ïbéRÈðN×BCD9 äv»E:•ã(--u¹\‡C¾³£¨v'::::::Ün7y½öööP($ne0***ä{†B!›­tùrßÇ[ÿö·v—«S¯×»ÝnñL± %€'Ÿ|2Jÿ DXMMxí5Ìž?üa$—g2™§žzJX*« ¦!Û"†’½½½bI»ÝÞßß//§•ûÃL¹KÊr‘‹¤ÝD"‘·ß.þÁ&¼øâÐõ×Gu:N§™wMMMwÞyçH¾˜zäM0xÖ®E(„Ÿþt„—‹øýî»ïöx<+W®D.„J§ÓryQ()ÌãñX­V’¤ŠŠŠ2™ •9ÉO¦ ÉÒØPèOl\CÿÅãñ»îê°Ù°zõ¤L&óãÿ˜¢+úÜ^x@sss^„ðy?*|óMl܈uëF~644ˆj`aºÒét4»’Úl6J²;y@MŽO¬(--• v»½¯¯¶ ¡Ê³Ù¬×ëå90j“-\ºÔøÖ[¿õÖ7ÞXH/þêW¿Bî*y!)"o:zL¶mÃcá¿þëtïC K–,ðÆo]!#t“N§)óNï’¶h”744TWW×ÒÒB)VùªC™ÍfK$4cCïÒ…dFãwÜœt¦Nýâ_þåoßøFVœì÷û{{{iùP^È+-VK nº ۷­Èh‰=H ^¯×jµF£ÑšššÎÎNz×`0 ÛoH¯×‹µÑ¢Ê¼a,óz½===¢²T<úK8Ù[n¹%›ÍJ±>ûì³Î9'µqcßÅ—Qgòmp4N¾ «¹yÔT%0™LòåíÙWYYÙ××—L&…Skoo¯­­Šioo'iR] ©GZÅãqÚÒl6SQíM"6 yùå—ÅnÞ?‹Y7nì¾ì²šl6KÂÊ [EäMGålߎ{îÁÿüÏhÞ“žà®»îÒëõ«V­‰PÇCóʤrv»víBn7,’#¥U©ºFdÛM&“ØÔ¢¨o¼²çS¼úê«­­­ÈÍçèt:ù£úûß~ ü5$EäŸÅzóM<úè(« 9o(Éàh—çp8ä颪ªJžS ˆJ¾©é)‘H¤R©Ûo¿€$I¢žý¡‡¢Õ`r(¢‹u:ÝUWá?È3U!nÞ{o¢õã0Ì…!eË4§Ói¦ÙíöîîîP(dµZ)SERsD®¿þzùýÿð‡?ˆØöïß_UUUSS‡“ɤXÒ(·O¯¿Žòr<ñîºkô¿¬räÓŸBSjj°t©R÷—$‰JbH o¼ñr{{ gHv´´†^§¹gªÍ’? …Fy´€µk×B¶s¤$It2ùßææf7„Z¾ûöáé§•úî£NÞX¬éÓqçhlTð#ÈNœ8Q^¹@?¿Õj 5dW„—¤Y<á@ô£QN2¥o½õ€¡¡!£Ñ˜N§Å°ŽD)0„zà´´àƒ›àÖ:y#¬Í›1wî}Ö«¯¾zíµ×{T„^¯—¯¾%V\.×m·ÝF“0b¢æ±Ç@&€Ûí¦f ÛqŸRH~ÑEøøcäË"Öüp…/½„M›ðòËŠØ\ùÁðüóÏët:µQ‰º^¯§áå²Ùì½÷Þ+_B½bÅ ä ç<•-X,–Ý»wÓ§ŒxˆwË-¸àÜzëé~Í1 ,Ö•W¢³s,TÙÆÝbð/Þ¢'„Ãaz.Ü/~ñ 2i4NüíoKá„lЩQ´n±V®Ä/9vªBÎhÕ×׋ŒT$ùÙÏ~``` ‹‘k{ä‘GäW‘‰¢Øü“O>·õîxä<ú(|pÔï=šhÚbÕ×ã½÷ÐÐ0ÖŸKºï¾û˧ÓÐo```õêÕTb*äé÷ÛsLc%okÃüù8xPéÏ)P6mÂE©ð¹’$­X±bÅŠTPúÐCÕÕÕY­VÚïæÌ™‡ã¬³Î:묳èñÞ7\r Þ}w,?ð”Ñ®ÅZ°<€ï}OO—$iåÊ•4ß÷Ì3Ï ÷È.2WTé ª2‘·iþýß±uëØòI¡ÝÒä¥Kñøãjv€QD6›5k­òÛ»w/ís¬Ë¡J÷\ëa–™3ÿ»š  éÙ³g/[¶lÙ²e555R5»u4;wbæLµ;‘_üÇàškTîƒ$I$,­éI°hÑŒS&LÀÿ·ÚÈ­ÌѦ¤[·¢ºZíN -ÆX·ÞŠ-[Ôî nu’|ðA~Ìðh‚}ûð•8æØL™‚={ÔîıМÅ:ç `ÿ~µû‘'´´ ÅìÙj÷ã+hNX‹aýzµ;‘W¬_E‹Ôî„öyÿ}ȶXgNLyù±wÿbþÉ™gâóÏÕîD²{7¦NU»G£-W8o>üPíNä!~ˆyóÔîÄѰ°  K[tvB¶{s²ÔÔ ½]íN†,VCv̉9Y::°gdOêT «±²§ü1§F2©ìÚ¸SECš<­­jw"oimÅäÉjwB «@`a}- Ø·OíNä-ûö©°8à8hHX.—FçSó‚–äv›gŽ&Cn”¯œNȶTbr8z«æ”ÑTI¢V\¡Ó Ùð˜‘ÃéT»9´",—‹-ùé i(ÌÒŠ°Øb>l±˜ÂG+ÂÒÔ_[ž¢)«¯ai*>ÈS8N=œn8}8Ýp Òi¤Óœ 9šòƒÐް|þ9òí1¢¢¸X[Ë4$¬PHs+òˆ)S´`iHXZ›ŸÏ/´V¢!ai­¢(¿ÐZ5 «@`a}-ÍÍ8úù’Ì)`6£¹YíNh^þ52xù× à…—#Cƒ }YX…€…¥-xS‘Á›‚œ€/¾@Ooctj”—¹ZShKX>û G?ê–9×_;Õî„ö9çüïÿªÝ‰¼bÇ-n©ExsÛ“G³›ÛÔîÀ1()Ac#sNŠ»ïÆgŸi÷‰:ÚB#È ø§@[z{Õä‰öY´‡áÐ!µû‘G¨þ¦¼@ËiҢŰcÔy f¾pÉ%èìÄgŸ©Ý¼cÁ­?DT]6mÂüùjwâëѨŰe ŒF6ZÇæ’KNó`p¤Ô×k«ÜV;´µ¡®NíN-汃ƒ¨­ÅŒضMí®h‰Ÿþû÷ãT»ùN8 ‡CíNhCCjw¢0¸òJ<ú¨ÚÐ Ë—ãòËÕîDÁðÒK¸áµ;¡n¹Ï=§v' .‡×`aûq0ªÝ“墋°y³¶¾ (ßûžËïÐà@ë‡ؼ9Ÿ’/š~’ö0ššPSƒ¥KÕî‡ÂØ}¾›_~yààA³Ã@o4êõúiGnmÝúiµ;W¨¬[‡þPíN(‰Ýç»oëÖ3/½TþâÒçþöð‡zcÞ¸—¼äÍ7 yXÔôç?ϸì2ù+W]…×^Ã7—,¹î™gÔêÕxaûvœ{®ÚP€ÆK.Y¸nü•o~ýë—í[7l¨3G…ní·óÎÃsÏá¼óÔîÇhã*+3ÙlâpÞ<¬]‹o}ëËC»×ëôûÕéÙ©“—ÂÐØˆ_,@m ¾ùM<ñÎ:Kí~Œ”|€)S°zuAÅ[mm£ÀUWá±Ç†«*›ÍæQ"+ßyóM45©Ý‰ÑãÖ ~þüµ¯½6üõoÿøÇW­^­FÆ1k×â±ÇÔîÄ(±|•í·‡?<鍊ä/.¸ûî»7oV«K##Ÿ¤Ç¡© wÞ‰ï|GŽ¨Ý•‘RU…÷ßǪUxîó¢§ŸÖéõvŸ$©¿­í?ï¾[íŽW¦OGW®»Ní~ŒˆoÄ¡C˜2埯L<ÿü—]6ã²Ë*gÌP¯_LŽW^ÁÃC6f×:N'}/¾¨v?˜rõÕˆFqß}j÷ã$øÉO áÊ+Õîsò<þ8Z[µ[pñÅØ¿+V¨Ýf44`Ó&¼û..¾Xí®È¸ä¼û.Þ{“&©ÝætX°ï½‡O?ÅÂ…*÷äºë°s'Þ}WÓëG‹I7œY³ðÀ¨ªÂ–-ذ--'{aÍìÙÓ§{±³¹ùÐÿýßIÞaêT,Z„ommX¾|¼¬]/Â"ª«±x1.D$‚õëñÊ+èî>Þù&›í—{öìûè£a¯Ÿ1þÿ«¯O'“ǹ¶¼7Ü€… a³aýz<÷>ýoÀh›9s°r%6nDs3֭õ×» ÞìpüúXkûM,f:Ö#ð*+±p!žz »vaãF,_>~÷Ú§E‰;v`ǘ>óæáûßǪUøôS$“Ø·­­hmEK Bñ¯½ƒÕŠÒ"LІLžŒÉ“a±`æLlÝŠ­[ñ›ß`÷î1û6Zd|¹Âã3y2ÿ)»³¯Zº¯r†B_>fÒé„Ë…ÿôÆ®‹ûv}…þ)ÄæfÞ€99Èz½¨©Á´i˜6 55ðz¿Ö2‚qê O‰¡!^Õ~ʰ°N€N¯ŸþÝïQÇ!Ä `aT,öþªUß¾÷Þa¯oZ¾cØb1ŠÀÂb!]á=÷Ü`Þ¼ytX__Oxá…Oìéé¡«««é°¿¿T¿ s<Øb1Š xð~ÿý÷C6Cö ÀþýûåÞÞ^qsjèõG‰>RÃn·Ë_7›ÍÔ‰.aºhðÝï~—_zé%jˆè~åÊ•'ù-Æ3¼3‚…Å(Â(ï?ÿùÏ©1iÒ$jL:2Ç÷â‹/RC¸6B[‡ÃAl6+o¸\.:S7±X ²ê+á:Å ‡pøða:œ1c5öìÙs:ß‘9Øb1ŠÀÂbA©Q¡¨ªÛµkd~J88ñJ$Ì3Rù¾2*3<"­eµZ!s¢ÌAô¼¤Èc}ë[ߢÆ_þòù­¨ù:xTÈh£JMé8p€6› @:¦CÊðx<òóN'5L&5„Ó$‡5lbG ©A.²Ir¯bjH¤RÏ8ã j´··Ÿú7cN ¶XŒ"(>¥³dÉ>Ÿ©!fÉV‰‰1¥#ffÈÈ “‡©áv»!³pâBaêèâ°¦¦†sçΥƟÿügpyÖ‰ààÑ,,Fƨ4ù¶Ûn×RCx:ŠîE:JãÃæjÄ ꃸˆÍEƒ °„©²ë¯¿ž›7oÐÙÙI‡/¿üò)}©q»BFC°°E£Òä¯z:ò€ÈÚ„G¾R¤£èaEƒ\¤$Š¢1À¤£¸¡ð‰´ì¹zás™Q„-£c½®ðöÛo§†H/Â>‰º(Àv¦HÁ“)“ÓÃæž‘‹â¿j…IûÎw¾à£>¢CaM×®];²oWpðÎh£ª-±ÿáH šŸ¡·Xl#^¡0_ ßG®Íhürü!ê±Dƒ\áW'‹Dç!›ß²e 5ž}öÙÓüv…»BFC°°EP·šíùjšJ âèáò„+$§IÊÕMˆšf? O'¦tݑʠ¯¹æ:¤bÝÝÝÔxî¹çFå;æ5ì  ÁÂbA}WHÜqÇÔ…{"JÃFáàÄ „˜ yÔ@ @ rš¢ÆP”G‹3i¼)êþ"eÊõ`WÈh ­X,Èo‰h¢r±EŒ°d¼‹C1Ï=lᆸh [™(ò[‹/¦†Ø€ÞZ³fͨ}½<„-£!XXŒ"hÎ~•o¼²ú-áéD 2!º$\J8l»eq‰ˆåçÏŸO á+·mÛà÷¿ÿýh~Ÿ|ƒ]!£!XXŒ"ä+$nºé&jˆ<¹B‘ÇU âry"&†ÂR¢KÜPxÛ‹/¾˜¯¿þº¼/¼ðÂh}<‚]!£!XXŒ"ä+ü*·Þz+d¥ñ£‰a£¨a'„õêæÅððüóÏ—ßA<Ó`|Îð°+d4D[¬aÜwß}Ô–‰ìÞ…%V¬,N’’j\xá……ðbÑ+¯¼¢Ì—Ð"l± ÁÂb¡p\á×qà 7PC¬ó {4˜ÉÏ £GiŠJe±6\Mò°+d4 ‹Q„Âw…'äÎ;ï¤ÆW7f¦‡ˆçUoذ”3'O`WÈhˆZ¬Qï£e ÉA1 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 “Oüôò¤²o›¥`IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/ellipseroi/roi_getarrayregion_resize.png000066400000000000000000000171041457240071200311710ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœöIDATxœí{t•ՙƟ\ÜC’‚ÐÊ”á¦X—µ€¶K.vpt´Khuì%´]UK—·ŽX(©XÄÛTYڵħŠUQ**•› A¨ Ú @„@¹'$$gþx8Û¯A½ÏÉó[¬¬ýó]Þ“¼<ïeïï;€B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„QKŒk|gô•W~ýë^ühýúmþ³{"…X×xMbròu‹×UVvú÷£gžIèÙÓµu"bILN~ ¡áø×ln–c)–°B¼k<¢W/ úé¿Pÿ:[{aß>¤¤ %ÐЀe=°~=¶m€ÒRì܉ÒR”–¢¹Ùí'ðˆîž¼€ñã1nFŽÄðáÇüƒÿvì@G\ò÷^«¼gH ý 8æa·}ÜüôE™ñ1-ÆaèP rÌ·oÇ–-X³«Wcï^ןMt='¢¸»vaÏ<õ~ücœuÖgìvª9ÖС(*ÂâÅ(+ÃÇ£¸—\rÆm ºW(¼àLŸŽéÓñ·¿á‰'ðøãؽû ‰‹›tç^Œ‰ýìÜ”R·hbìXüâX²%%X²ÿ÷_þD Ý%Κ…Ë/€%K°d >Ù‡O™2ø‚ :½¸sÝºí¯¾z’gÈÊ´i˜>Gâ…°páÉ^ZøKFŠ‹ÑÞŽßýýú96¦ ÷݇¶6Ì›‡´4ÇÆˆÓ$3>ŠÃ‡qûíøœÀ冸xÜqjkñßÿôt×ÖˆSâŽ;P]¢"×vœ¢"ÔÔà¶Û\Û!N†K/EYæÍsmÇIóÛßb÷nLžìÚñyôè?ý /¿Œ‚צœ"bùr”” ¾{Õè‘À¥—¢¥%²ÿßO™‚¶6LšäÚa¸ÿ~¼ü²k#Îù ,pmÄ™À§zéÔÉÍÅ»ïbÏ|ç;®M9CLžŒŠ lÝŠœÈ;ûìë/þuié¯KK¯{úéüù×vÎ;Ë—cøp×vX`äH,_Ž+oûî];vž~Î!9C† ;ö¿Þìôé®­‹j.» 7º6Â&c§OÿcíŠã•øÆW^9ÿ?ÿÓ…EÝ€™3ñ ®°Ì‚êê¤ÌÌeË:wãz¦¦.¬«sdÔ)çÚ€SfÎâšk\Ûa“ÑW]ÕÖÐðÎÒ¥%%˜1£GcõêcommMËËKÎÌ,ï=§6~–¼OŠü|Üpƒk;lÓÑ‘’›ËáO~‚ÂBL™ò雩}ú„B!7†4‘äX¿ü%¾ùMß'jÎ 11µååfë?À·¿›o>¶YWQáÆª¨äûßÇâÅ®èBHËË ¾RR‚«¯FJvö½º²*Ú¸øb¬\éÚˆ®eô•WÞ¼jU§W¯ÆìÍ+ϽújEÆ}šºv+†O™R¼wïÙßúVÿ‘#ûù• ~³gÏòíÿ6t¨kËN‚XAÚØˆœ45¹¶Ãýû_:{öÀ±c”½ýöò9sŽÖ”íÝ«…\_š_ÄÔ©®ðŒ+®ÀÒ¥®ø"¼îcýìgˆ‹Ã¸¶Ã3vìÀ„ 0o¿íÚ”HdØ0lßîÚùÇ?É–w,[†pP|ýúáÅ]ñùxÚ =›7£²Òµ³oÞ}ÇÝò(>ŸÜ\ìßïÚˆ¡ª YY®ˆžþØÍ¥â ¹ê*üéO®ˆ.¹+V¸6"¢X¹_ìÚÿYºº6"¢8ë,E˯äýÊ+ÑÑ={\ÛQ|ôðïÿîÚŸÙ´ çžëÚˆäüó½{”GŠuñŨ«S7ùtذ­­7ε~ò꫘8ѵË¥—úus¥/Š5bjkUž>¯¼‚– æÚŽ0¾8Öu×aÃ×FD87â?pm„oTTàŸâŠS¦ž¨ë…b]tvìÐ4Ηå“O°k¾ùM×vðı¦MCI‰k#¢‚’L›æÚ¨©AR’k#¢‚´4TU¹6€Š5aÞy§›.i?ãÔÕaÇ\x¡k;|p¬ñã»éM8–X½ãÇ»6ÂÇ7kÖ¸6"ŠX³F-xÀÑ£ˆóú–Ž£G´´¸6¹b}ãذíín­ˆ*ŽÁÖ­8îKa»ÇŽ5r¤×wD(/¾ˆ‘#ÛàØ±ÆŒAuµ[¢êjŒãØÇŽ5t(JKÝš…”–vû[ËË‘ŸïÚˆ¨£ ee®pHR]¥9‚ÄD—¸ …C†`Û6‡×f¶nu ]:V^êë^?šihpü€—Ž•š*DzE}=RS]àÒ±RRðYßä-Î HIqi€+:‘c9¼~4ãܱ\~õbk«Gk´£ ç¿X—Š•˜y߆)8þ¾V—Žå\®£çi†+:éÖŽå¼×Å8ïJ±¢“n­Xû÷ël‘žÞoÖê{tëÕ MM¨©Aß¾MˆN Àþýhmuiƒã¤ZëhÖåʱ¢9¶lAïÞnMˆB23±e‹k#ÜrÁxë-×FD7â¼ó\᜶6dzZQFÏžhnvm„óPob5xò÷Ž¥‡XœYô•cŒã¾­]œ>ëÖáßpm„'Ô×kÒð̑Ç]À“ï„4ÙÙØ¼Ùµ‘ψÊJ,_îÚO˜0o¾éÚˆ¨`íZ/žézˆÃ—Ç«G6x ä磰л¯°Š,fÎÄÎxã ×vxÅ×¾†gŸumÄ?Š4þügœ}¶ëßZ_zÞï¿”Lš„W_umJ€̘1ÀÃ? )) @ss3ß°wï^õõõrrr$&&Ø·o_JJ €^½z¨­­––àÈ‘#âââpŸ¦¦&³Oÿþý´¶¶ˆpøða³gZZ¯˜  ¦¦ÆXUZz|<>ø ‹~3_ˆû©aþ|Üz«k#"˜ùóç»6!€/Š`Õ*ÌŸóÎÃßþæÚ”0ÉÉÉÔ' ÉŽ;ôèÑÀ‡~ //@zz:€ØØXííí|ªÓÐÐ`ÞJMMEX222TVV…Bæ]õÉ'ŸèÓ§ÂÚ–@¨”uuuægBBÂ9ç:Ö­ëªßËIà‘c!,Zÿñ®íS^^Þ·o_»víBøoƒ°3Or㇀[˺àwr’x <ÿ`vOÅâI˜31UbBFMbÕ¯_?eeeFŒ`ÿþý avv6dƒãàÁƒ¿ýmÛ¸qññÞ „w¨ªÂCaÎ×vxÏܹí÷ÝWWçãÑGÅ0w.^z }û¢¼Ü¥‰‰‰ìg² £Ztttعs'‰Ó)ÿÜ3))‰»Q{({ܶgÏ„S´ý{–y ªó°áǛ˅B!Š\\\\¿~í£G÷,*ÊNHðñ裳“Y³´äáD¼ðBíܹ®­ø\|tvòàÁñûßãÆÙ˜˜ÈĨ%ðMmå+_AXL%ˆp¥V__ÏVgÏž=ή˜Š•——››_,ËY*aîÅ®,;´UUU¬çÍ«zôÑ´²²x„•Ò7üU,<‚ü|\~¹k;Q±‚“}LžÚÛÛ©1ì­³d•·oß>ƒ B¸^QQaNK9äIx ËÆÕ›o¶ÍŸŸwøp¯ää„ç§Ù¸÷P,«Wã±ÇPRâÚ§,ZTóÔS½·léåÚ“"‹<ó úöÅÂ…¸å–®»hLL ó' IpÕÛQÁôˆºÅ¼Ç”{ìWqµwà[üÉ6WÂP“8KÈÒ2Øûõ¯¿õVÜŠ©­­Ç’-„‹'÷ÈP,²p!ÞxO>éÚŽ.çá‡k^{-áþÇ» Á1ŠE–/ǹçâñÇñ“ŸtÅåB¡k®à #j_a6Æ´)99™ÓˆTö®XRÒX2ic.Åú‘§åE¹ÏÔ}ôQâ»ïæåä ²²’' vùƒk+ü!’‹Ì™ƒM›ðòË®íèžzêàÆ‰=äuËê3‰0Å"‹¡¼›7ãœsì^¨¡¡:D ¡bQ½rss®9fž’3hÐ ÈÚY#Ê[rr2™V0abêÆLkÙ²²{ïÍzá… Ù¼{ôèQ„u‘…d«Û‡~‘§Xä•WPT„¿ü£F¹6Å_ûZË¢E{gÍÊ]³&ɵ-§ID*Ù²×\ƒ×_Çÿˆ ¬\¢¡¡úDiá:RV‚|…m*vä™0ñÝC‡Q«(0|‹Æó'¦J,9yòP(TTT=yrÃ~4ðÀV ÄDŠ ³¶¶6¦kT,Â|#R‹TUaôhäæúu7â—áÉ'÷¦¥µ÷»ƒëë}¹Iýôˆ`Å2üò—˜8Gâò˱lÙ™±BäìW±Z¤n1ºä’æßÿ~ß´iÙk×öˆÿtå;›gÔ¶––г=®»oðòÛD#[± +V GL›†W_Ea¡kkN‘AƒÚŸ}¶vÒ¤†aÃÎ^»ÖǸvDƒb‘övLŸŽ‰±r%ž}öÌÜT½k×...`NC•â­ªT2Öe§à̓ |‘jÄYBÁòmmm³g7|ç;mwßûÜsµÀ¾àå¨sÔ-þDxÉ|UUºÕìól#J˰bÆ¡C¨«ÃÌ™®­9!ßû^Ý®]Œ½ä’Áë×'»6ç =ŠäÞ{ñè£(.F}=î½óçŸæË$&&rA:²›Å,çƒ>@¸AEÍ`¦E‰ª­­e¿Šµïo?Ï#åúëkg̨ýßÿM5*¿©)&6öÓÜ+x"S(ž¬.cccƒÅ&O¬ý!ÚËP_Ÿý ùùHH@}=96©  £¸¸qÛ¶²¸8Œ;hîܬ¦¦Ç6Y#:ËÐЀ»îÂ]wᦛðÔSHLDI –,ÁÁƒ'uxzz:Ë:Bµ`òÄû¡™ñ°ÉÄw™N…B!Vs---ÙÙí&T\uU[c#–-‹>ü,„ËI>ô%'‹M–xì¿WCÅâ|‹bïå÷/Díÿ˜Ïäë_Ç´i˜>ÿ;žx›6açÎÏÝ9 õëׯ¨¨ÀÓO?pèáJaa!Â95ÿêìðõŠŠŠ³ÏŽ1¢uúô¦!C޼ôRòK/¥lßžŒpÜd Ï`ÇÊŸ¾cðà–AƒÚú÷o),Ü@LLLlì1bÌbÄäÝú„"Ä^#ïÇŒp•é<÷Ù¿?OÅ2‚‚Ç;Ã|£›:–¡¼%%Ç='$`èÐcÿÎ9Àâââú‚‚’ÄÄÖï¿®gÏPll¨±1¦©)¶±1¦¹¹áƒztt„vïNX¿>y×®ø¿ÿ½¹­íزªÞ½ýÌ|º¢²o„B¡!C†Ü|óÍ,X€p.•ø²eêϰ³@ÇŠgJÎ f¶=ƒ‹d‚7ñÝ`ç“Ç—&›‡qÀë²CA«***¼Ê±¢¶Ý ÜÒ½õú‹¨­­åã@ƒ*\B||(µŠ Òöövªߢ±¹@™a¦Å“õ‰ |àÑ!CîÐ&$$pž'(‡lÒú†KXAŠu"8aÂD'¸F™ 5ƒ¯Pɘ0õêÕ‹›T&ªÎÆ|õ«_E8Ó¢àQÃxWOËcYr¥!/‘••Eãu¹èRçR,a)Ö‰hmm >l-øÄG&LÔ JKð¹E•••Üdœ-Þ½{·9$Ø…g‡×RϘº•——ïã:œà“üÁG›D Å:©©©Á»Ý)*lñ6/V‹”¾K=ËÌÌ Ê«B>H]u¦Jü¼ß5¨aÌ·(K,³²²(i„×eºæR,a)Ö@Ù`­Çt‡2Ë>.SÞ¾};Â]¥ØØX.ƒá:fÎ ²´ä3&Y÷Q«˜0q>äˆ*Ô6ÊaGGo/£^òÙÝÁçMúƒKXAŠu"ª««YÊQT¨ áiæÞ'CL¡¨Tµ´´4ÞqObŠ9V°éÅÙ]q‰áI¸„)ç÷ïßÏ+‚,ñ )–°‚ëD4662¢l°4£Z0Ë!ÁzbÓÖÖÆYBn”–`É.凭)j3*&R”IJ#—2§¥¥ñºTÍ>úÿü¨pb +H±NÄÀƒ½¢¡C‡"\'RT¨gL¡˜*Q`bccy¥Ž“ŒÔ0HÙ£ØÉb“—®8å=©©©,©ŽÉÁ5×\ÃÁªU«8xï½÷ÔÖÖróî»ïîbÛ¢ƒÓûsK±„äX  yäšU¯¿þ:k׮堣£@[[7³²²8¸óÎ;»ÒÎHG¡Px„KX!òBáO<ÁÁÕW_ `ýúõÜ|ë­·8¨««ã ---x`SSÜqÇ– …Gȱ„"&>óÌ3\qżöÚk¶mÛÆÍøøcÓS±±Çþ·=záÚ@kk+™™™:tÀܹs-ÛÙ( ˆÅZºt)€©S§rsݺuüõ¯`,éÑ£qqq¤¤¤ ËéJNNæ€"g]·Ür‹½O¹H±„Gȱ„ü …Œ€¦L™‚@ܺu+ååå²üü|š››9èÕ«Wð„&Dš ÙÐЀ@dÍ555Á3˜Xzz:l€¸ë®»ÎÜ'‹T …Gȱ„| …Ï=÷^x!›6mâàÃ?äE¹ÉRágÂVjj*f‘{{{;0;;›Ó)eïÔœùÈ‘#và[ݼHT(á^±î¿ÿ~?ýéO¹ÉT~Unn.:d«gÏž•™{®ªª ¾’ÜÖËô±>ÜiöÆŒ(vÏõ[R,ár,ag¡ðø“'O°yófn¾óÎ;Ç, _‚}¦ÆÆFnšÇ\M•””d¬âÀLé0šó´´´p`¦zxˆ ¦pY„9Cuu57M£köìÙ§û¹#…Bár,a…®…?ü0×^{-¼ÑtÆ Ü4ÉÔbýû÷G N™¾C¤™Àé4“ƒð*"M]iÎÌ·Ì ¦ää™,22˜Þ~ûí§öá#…Bá]­XF6ŒDñá0FfÌM¦Åþ“é-™lºbšO&©7¶ñZÇh4Œ­y³<ËØ` î`]¦…ÖéÀyóæÚo!¢b c +tõ£"M+hΜ9p^ÅäË&¾˜ É™§Ì 1fÿãoÂa”4¯›Û Íz,F4þлwoLÀK›¹ N³Ô&¶>øàƒüüç??…ßET#ÅVc +¸_ÝÀ%Çßÿn–³{Ô©”C¸ÿd^75f™Cž9sNN¦ä™ÍŽùPæbbk§NX^^7÷íÛ×Éøhjq©*!ÇVp ÉÂ… 90ýLs †<óºtªéLõgd5gnã1ÍDO†0Ñ̙ͩòLUh¦›¸§ Ö¦Z4ðÀèX¡P(<ÂÅ2üæ7¿áÀdÐÓè2 -ª‚‘ ƒ™*îÓ§˰:MȘS™äݬ»2{²³eöç"i„UÐL:™+ši%ª¬15¢Ÿc#Å!ÇVð.OqqqpÓ$ãÌ©ŸÒ11”o™xdrsÓÇâü’YOQVVÆÉî™­›œ‹¡ &ð™˜hzi¼´éo™‰ß] P(MJ!„B!„B!„B!„B!„BIü?2¯rq~áIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/ellipseroi/roi_getarrayregion_rotate.png000066400000000000000000000173611457240071200311730ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ£IDATxœí{tTÕõÇwBÞ!<‚Lx‰´HdH—@„JPkE±¶…e!¢¸øZ1ÔjªÐ"fÕú •Ö€@E*P( ‚@äH $ 3“×üþØlÏÈ0É™;3ù~þºlîãÜdçîç9‡ˆ°zpÓ œ0¡®¦F +JJ>˜8±òôi«FfDY= øé”)_äæíÝ+…?{î¹nì^±ÂªQ…MQ±jkj¾ÿê«‚Í›¥Ða·[5ž°¤É)VRÅÄÐUWQ|oŠ‹#"*/§²2«‡v„¹bµjEÃ‡Ó 7PÔ¥ uíJÛ¶Ñ©ëèî¹g'§“Ž¡¾}©ukú¢5Ý=%Ì¢}ûhï^Ú»—vï¦C‡¬~%<kÀÊÈ áégOZ½š6m¢Í›éÈ*( òršöÍxŒ ~` iâÇ´ã]ª:@½zQïÞôÐCT]M×^KË–Q^}ù¥Eo²„bÙl4l N´g}ò M™B[¶\Á*+i÷WôÕW%½{Sf&ÍŸO6Ûy [½ºÑž„Cº¡gOš=›:v¤}ûhõjúä:{örçOZ¹2*:ZñÖSºuûð±ÇnØàõ’ÔTÊ̤ѣið`ÊË£> åËñ ÂÐV¬.]hölêߟžzŠ–.õõª–íÛw4Hž+-Í_»¶Þkãâhôhêߟ¦iÓhýú+1rRSiñb*( 1c¬@ÿþ´n­ZE×^kÍ@#“œLo¼A……ôë_[=¢;î ={该öí­ h¿û>M“&]ÙUnãüÕínïv?îvט–øñ› ¥¨ðo£‚jÓÆŸkÓÒÒ<¿ýíoY8þ|ÏABB ‡r =zÔspVÄmÛ¶õÄÄĵ~øá¿=òÈë'ƬZED‰‰‰|f||¼çÀ."†–-[z\. ›5kæ9—Ÿ;wN¿¼S§Nžƒªª*FEÿ…–‰œ¯¼?”߈ˆRRR<ååå,äŸÉèʉôãšÀE»wÓêÕôÌ3VåÒäæ&§§÷;¶zÚ´*)¿fèÐnC†tûéO­˜%„€bÝx#9tß}ôî»VŲ²âãâܹ¹"ê<`ÀÄ ºÒw̘ÞwÞ9ù믒•eõD°›ÂñãiÜ8ŠŽnè}š7oî9`KGšìÛ·…±±±žƒüü|vèÐÁs””ÄÂÈÈó–µµµòÌE‹hĈ³Ë¿ì±¬xFÞ„ §ò<461ñî7ßŒŠŽÞþÞ{DÔ¢E Ï%ÒlµjÕÊspòäI²—×°€ÇŽca»ví<lR‰(ZüøøM¥¡?sæŒr \åAýÅZ°€úõ£›n²zWÎ'Ÿ¶ÞÒá³g¯ïß!î¢Êº**ÞðÁþ=tÕO~báØCð*Ö«¯ÒÞ½4a‚Õãð‹?¾";»{÷Î/¿|úž{*å}4yòÀÉ“­XÀRÅZ²„¦ A[èѶW/Gy9™šžî9òbÜwöäÉ®ééÖ -@£5}:Ðo4æ= =;vdaAAç@ú.çË\Ò*))ñ´ñ–í(..æãêêj"r¹\œš:µÍK/Ùl®×_q»Ý‘.—Ûív:N§Ós ÐùÌ‘pइADÝ»w÷tîÜ™…••翎œw ‘­'Ëû³[™ššÊBy‚Ýkøpºí6ú¿ÿ³z ãäÞ½ÑÂ"š0!þ–[j†ˆZ·.øüsë† ‚ë‹Õ®½óN8”GVÏžýôÁƒ¯õîÍ’¬¬„Ý»+ö쉹`Á¿ÿ{ Ç‚답c…GÀTUYù¯ñãï_²$Qü• Ðüå‹wçåùâ Ç‚苵bO|¡F¦ý…_ði1Á‹«²”ÁN˜<“ý- ¥ …œˆ:¾eËö„„‡W¬øæ£š·kWUYÙw̘ߜöû»^¾0‘„k%K.œÓ⌉œVrr2 +**<ì’(ÔHoIû¸|$…\çá{*·õƒ`Q¬œÚ¼™V®´zÊáu릧÷5ªxÿ~"ZóôÓeeeñ¿Žyí5ÇÔ©ñVÎ,A¡X·ÞJ]»ÒX=3ì[¾¼FLŽ}ûí˜W^qŒWõá‡Ê8A¡X³gÓÌ™fÁ}2³À¥îS a#l6 KKK•ÿ•ôêÕ‹ÙlÉN®ylîOÄ/Xà8|Øñå—1ôÃÔù2…ÁvM&®ºê*ÏÁ÷ßÏÂ>}úxNœ8ÁBi©¹‘Af¸eC¦3d^ƬwÞ‡%§“6n´zeîÜØ_ çÙŒÖ+VN=ý´Õƒ8û÷GîÚsï½çê?54±X±~ö3*)¹²IZaÃþ4sfØÎë·ØÇÊÉ¡‡ă¸*"Û5¹”!Žºº:ÏÁÁƒYÈq¾l&á&¾‰߇„$=<»=ú£'Mrüë_]YøÝwßydAI:L Y:^œ­¸îºëX(_„}DéÃqLRHÏϬübÝs:D;wZ8‹yñÅäéÓK­…¬T¬¦é]Iêêè•WZ?úèq«ÒøXf ﺋ>þ˜Dç¦YØÊnOÙV  ¯¹æ²-óšd— kÝå‡8Ϻ6?|ºÇ*Í¿w^rÛí‘òžÒÀ1œ, Kt°-“=±Ü(KD§Nòp¶]#»IýÀ²/Ö=÷Ð×_[õðà"'§ÅÓO_vQ€Ä2Å> lœçý÷~üãêääºúO ¬Q¬~ýè»ïèÂWÐ7ßDæÅ.‡.ÖøXôÉ'}"§ ØÝ!áxÉØ›9¥“Ó²PÃþ–La°“$}~¨ôê8òOLL\»Ö•uvùòžD$]4¾¿¼'ûX²5£uëÖž™­åS §KäC¥?çÖ|±`Ö®m>xp¥˜²òX X Ô¯_“+ÖËš5͇õò9 Q,0…·ƒ$&¬Ê„8/©À„„…’™6…l=Iô°ù#aI¥â®=™¸ç,ùñãljèÿ¨:´ä³Ïzx„2PTT¤ŒM>H>Ç,$×›àž™bà“å4W9cÖ,øbÁzeùòf£FyÉ'…((V»v|±‚ŸÊJÚ²%rÀ€0±†(Vf&‰x \äã›Ý~{Eýç…ö±:w¦ï¿'¿–òj<5@æ ØÏ`gKžÀmŸt‰€Ÿý-¥{-ÅpÏ‚œ\Ê—ó%;wÖüò—§<ÿ”ó&xé-ñÉ‚{Krœ2Â^š3ç ¤%‡êþbuéBGŽø™!CAAÔ-·¸ê?/€bD÷èáe†YÈhS˜’bM%‡M€L({¯ÇŠƒ|6B¦8s!Sœ×àù$,T¡˜6ÉÓ ¥UÚ·:v´oÛ-3 œDež|#NÜËÞ9U„_YNfôÚ±èu¥ïú‹GÞzUÀy¶nmf³…C5Š\8]º@±®(Öå±Û#’’3 Ð>VE…5>Ç䲤ÃÞ‰ô±Ø i/Öóàêr[©ôƺté¢?ˆË;råOòè·E´kgOII‘i ¯éΆÈEØ•”ž×«äälöeÉHz~~è/Vt4]¨V/œ9Ù²%Lá•SVF"Ü*v{äÉ“A±îA ô;”–Z³«›BY´gs#w¦à<µ4FÜž [9# SÛ¼ø‘ìn`»#“l+e{BRRYZZMll¬Ls…@Ž“Í–´t,”‰9™‘“2ñ!Ó%Œ¼ƒà‹\DG×UW[¿îAà ô;QÜÂ0'&Æ]UÚ›Hz´båçÓ°a~f(åv:ÃA±íc•—“ÓI:·å Âavs±˜1{9²A€«úrÞ»V^7å’î»V²¨Â^”Ìðå²g!=½úÔ©:»Ý.·fa/J®§ÀWI!§d¿†t×xxÒÛãl‹\SþLüÀs¾o‰…ÊÀ°Ùj ‡9(Ööít!‰Tl¶š£G‘nð‹Í›é¾û(77 åM(ä„;³¥ÕãM¿¤Ñä0^8ÊÌ72È3ٖɾ8‰/óÝ;Ÿ]¹2>..N6°ÙòL»P^D& ØÔÊt¼×õ¥ådBÚb?°à‹•—G£Gþ±¡Á™3‘G6x½ ÀŪ­¥U«èÎ;ÿä`'-­ºW¯ªcÇÂÁZ“‹ÃGË+ƒÛ¸1¡þóBkþ8òòhÎúÍo÷Dî Ë.ò±lÂd‡fÿþý,ä®éypêAUx.†ìYàR oÙEbm.¹Üz빿ÿ½¥Çå’3N½&&xœríÎÈ-d#{~^+Nr¹ ¯uß±æ‹UZJ{öЭ·Zòðàeð`Çÿ&;VXV–‚5T0À¹uklMM8¤ÝÉÂ¥"óòè³ÏhêÔ=ŽƒsÙJÀH»ÀÆBnÍÀÁ¹ìà«ds2÷ÍgÊ­¸gÁcÔ† qmÜØœ#¹ã&Wä\?ÎŒËùú\Eº„)”‰u¾JÐP]5¹ €òó‘‚¿È A•76¯ÿ¼ÁÊwÞiê«&3mÛÖ¶iS»Lý§†V*ÖP¯^Ô·¯…Cn¾ùÜÒ¥IõŸ:Xœ‹{òIzùå@4Ò°K!«7\T‘a6ç ºv½¸a{9réîgòÄ é·quHzNìÄ8Ž3Ned´w¹\äË´ç5do{ÒâBLLÈâR·nÝ<Òä¥%¤7æu; ß±¸YqÍŠˆ Ûo·v3vlÅ¿ÿ_RM ŒõÕƒ'Ÿ¤Å‹é†¬‡uL›f80µþóB ëkÇÊϧ¬,Z²ÄàS8¶¯wñ¶PòL¶r…E¾\6pƒ€×þ;Ùhà9aìØÓ|{òäù~m¹ÎÃfKÚqΛ>|˜…œ¯—}|Ò걓#áƒlô“ûYøõŠEDO>I›6™U¬ eÊ”’ž=“ë?/ÔŠ !GÒ²eôè£V#àŒwêÝw“Ž0ɶK‚B±ˆhÊ3†–ì =&O.™7Ï‹í ‚å7YWG¿úíÙC?ú‘‘ûs .;H¹üâu» ÙÃɉ ã¹gA^ÎÞ˜\û€=3ùô_ü¢ðµ×’Žjéy]•Ї$'¬rñGºS^—Š”ìÊfQ³LLÈ:•Ë‹ˆòóé©§èíG@èÛ·2#£â/ ÛÉ»A¤XD´t)íÛþužøøº… ²²v9Áb ™gž¡>¢Ñ£)/¯1oËócÇŽ±P&¯ :°Ñ”Ý le£[=¹Œ_å±_›6ß~{ g¤yå|½|:ßJ5~Ì€°U½úê«Y(sè|9Ñï/o%W\òƒ S,"ºë.:xvï¦C‡¬Šþüç²^hqäH”¨î„!Á¨XDÔ§•”Póðé"9Ïäɇ7[±"LÚD/CpùX̹s4x0mßnõ8•AƒÎÞxcÕK/5¨—á”Ø–#5õ|;²lå,€LðÓ¥;ÅN˜LLpBzK²zÃŽ£ô ùv²[ÕBì‹Å¼õ%'ÓÙ³T]M=fõhˆÒÓÏ}øáÑûï·OŸÞöùçúX㡪X^xâãÉf£ÂB3Æš1Üx£ã½÷Ž_6{vÛñã;îÝÛ]u0ɬ¤¦Òœ9””Dÿù-[¦ºön·›§þeee±|ùòåžœ³ ’Ó ¸é@š˜¸¸orrjbciÁ‚Ž[·ªå?ÙÁËOÊõ’8c.{îX(;/8 §Zð 9$¶ªòéÒVòÛI«ÇFÿ*±Ï¤¨¨Èëb“—'ô|,¯ÑÐõ×ÓÃÓºud·S^-[F;v4þ³ 8“ž~6=ýÌwßÕÌ™Óì³Ï"ÓÒ¿¨|¥„‰byص‹²³);›®¿žF¦Å‹©MO_×ÚÞùê«k† q ì2¤ð‹/Z~þy‹'žèºråáú¯lª„•b1»vÑ®]4k¥¥yVáúC^^aeeäÁƒÑII_§·q:/é %$ÔuêTc³ÕvêTݾ}íwV8´n]ìâʼn?Þ;€ï„‰uyÜn·ÍÖ²oßÚž=ëî¿¿oJJquutç·jkkíöfv{¤ËUëŽuÇÅÑþýÑýúU;uâDÜñã1û÷Çùeâ·ßžßßK¶p7©¬ØðÒ^wb/((hº>V½œ9±aCÔ† Ô¦Í(¾ÿþÛIIµIIu••å.W„ËátRDDœÝI?ô©‰\Ú-Áåh*Šå—+¢¸8ª¸˜JK/þââB;$4Åâ<²Üo‚¿ðÒlñš2óÎÈ=çÓe¶‚S2àçØ^ڮȖ:¯]܉ m.'ä6œütù¹•›w²Ý”oÇYøCb–³aÝ•øëF€b#@±€šŠÅ Y{-à÷èу…œP¾ {f2_àuödw;srÖ;aòAìáI‡/—­<£Uf@Øñ’—ËUø¡²Ä΢ô åŒY?À ŠŒÐTLáĉ=“&Mb!g¤-c¡Ì}³•Ë ±¹‘æ•MŒ\?’óÒ*ñå²çŽm®lI`«*“ìl¿äúŽlåTG¯ys¯‹PÈI%òõý_,`(0 ¡©t7pïevv6Ë-Zä9+°oa³ÙXèµ¼Ã~ŒÌ,ðZ²gOµ#nj•ž ç¤;Å·’éÞSóÀ,dMúU² ÅÙé,r¥HîþÅwøæ›oüènÀ ŠŒÐTÒ l×dÏÁy_±Gï²ÔÏ+/Ê…~xŽž´eÜ©'—~àd€ œ×$‚Lñ_~~‡×å$d„lä×—Wñýå>²àøb#@±€šJThõB?¢B€°Äÿ]°¥VSÀ‚}¿ XaOC~ÅØŠŒÅF€b#@±€ XÀP,`(0 ŠŒÅF€b#@±€ XÀP,`(0 ŠŒÅF€b#@±€ XÀQVü€E‹)’GyÄ’‘4|±€ XÀP,`(0 Q¡•Ì›7O‘dff*›Í¦H222 Ž©‘À ŠŒÅF€b#@±€´© T†2o¿ý¶"yðÁÉúõëÉž={‰ÝnW$Ï>ûlÇæ•†üŠñÅF€b#@±€ XÀP,`D…¦xóÍ7‰Þ ºfÍE²qãFERWW§Hª««I›6mÉÌ™3}çe@T‚(0 ŠŒÅF@TØ8,^¼X‘dee)’Ï?ÿ\‘lÚ´I‘œ9sF‘´lÙ²Þ§Ÿ;wN‘´jÕJ‘̘1£Þû( *A ŠŒÅF€b# *ô‡%K–(’»ï¾[‘|úé§Šd×®]Š$*Jשþ©×ÔÔ(½zXUU¥HZ·n­HNŸ>­Hrrrè² *A ŠŒÅF€b# *¬ŸþóŸŠdÔ¨QŠäÿûŸ"Y»v­"Ñ\±±±Š¤Y³fŠ$11Q‘èõD=NlÞ¼¹"Ñ#P¥uêÔ©Ê ˆ AÐÅF€b#@±€ XÀXƒTEGŒ¡Hô5avîÜ©H***‰>055µÞ«jkk/9Ö èŸNyy¹"Q"ÇéÓ§×{ßÁ ŠŒÅF€b#@±€šzT¸páBE¢÷‚®ZµJ‘lÛ¶M‘ÄÄÄ(½Æ§ÏþÓ+qz|çv»‰^OŒŽŽV$¥¥¥õ>]‰@“’’¨ñÀ ŠŒÅF€b#@±€šVT¸téRE2pà@E²bÅ E’ŸŸ¯H‰^ãÓ#5½«S?GÝ\.—"ñ%MIIQ$zß©oVVVRã/0 ŠŒÅFgçýü£"Ñ·òÖË5zË^ûö퉾±›>Kw±õåõ%@tZ¿îòë ‡èM…z züÑðÅF€b#@±€ XÀP,`„ð‰ sssÉwÜ¡HôåwïÞ­HôV;=Ôc7½KN_šQõ&>=vÓc@}B˜>µ+>>^‘ÔÛèË<3ßÁ ŠŒÅF€b#@±€B5*œ?¾"ѧmé[yoÞ¼Y‘´hÑB‘èu·N:)‡Ã¡H|YÂ_?G¯èéÑœ¾œ¤KêwÖãVý*åéúƒ¾XÀP,`(0 ŠŒQá[o½¥Hî½÷^E¢G|Û·oW$zÌ¥Oœ:uê”"9qâ„"Ñ#G½ÏS_ðCŸÚ¥o$®_¥W*õXRŸŽæK…Q }YoÒwðÅF€b#@±€ XÀP,`„`ÜVîÕW_U$'NT$z ¨oìvòäIE¢ÇJúâ………ŠD¯úé”~g]ât:ë=G_8¤¨¨H‘èQ¡ÍfS$zO©~•ò³fÍRNÀ¶r è€b#@±€ XÀP,`ëk…sçÎU$cÇŽU$¾lã¦×ïô¹~z§¥õ¤¥¥Õ{g½S?G_IF%ãââê½³~Ž~gý*_æ06n˨¾XÀP,`(0 ŠŒèZ¡¾Û}÷ݧH6lØ HôP°ô¸L?Gƒô šþRzw¨~•.Ñ;6u‰»éO×£B½U¯0ê1àñãÇÉŸþô'º,¨‚ ŠŒÅF€b#@±€ÌÖ õ5aF¥Hô:àÖ­[‰>P_«S_t‰/Ñœ^OÔ#,½óÓ—MÂõ«tôØVßÏBõM%ô´C‡õ>½Á ŠŒÅF€b#@±€]+Ô÷†Ø±c‡"Ñ+h¾ìâ§÷Uê{1è3ûôÕDõ8±mÛ¶TzýNÝôJ¥þ¦zLª_¥G ú˜ËÊÊÉ‹/¾HWj… è€b#@±€ XÀP,`ëW›yæ™g‰^Ô+_úŽz¤ÇJz,©£Gjz¼©¿¸^ÔŸ¥Kô5aôZ¡^MMMU$z]2;;› ¢Bt@±€ XÀP,`(0‚õQ¡Ž^ÕÒc%=NÔ+ƒzÝM—$''+=ÂÒï¬×ï|¡¾¯½^OÔŸ¥ÿõ8ñ¹çž# *A ŠŒÅF€b#cT¨“““£HôxJŒÞ/êKO }‰}YF—è#Ô×MÕ+•Ó§O§€€¨P,`(0 ŠŒQ¡Îœ9sIII‰"Ñçê=½ËÔ—}ÙåA–/O×gP>ÿüódˆ AÐÅF€b#@±€ XÀ¡úÇ /¼ HôXRŸ±¨ïb¯¯ù™ HônÕ€Õø D… è€b#@±€ XÀ rÞq 8 ¹ø XÅÿïÙ1Ï÷˜³IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/000077500000000000000000000000001457240071200234025ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/closed_clear.png000066400000000000000000000011631457240071200265300ustar00rootroot00000000000000‰PNG  IHDRÈÈ­X®žsBIT|dˆ pHYsttÞfxIDATxœíÓ±À À°‡ýwNàÜB!MàÆkf¾Žöíx™A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A Â銑àö IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/closed_click_segment.png000066400000000000000000000057251457240071200302610ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ ‡IDATxœíÝÏS“×ðó&$„ˆ¤A E´€”@mD¥Ú‰üpÓ.:ÓÛkwwÛéÚ}w]µ]u¦».œÛ?@¬-?4FÔ4C#ŠÉ@†I# 4”ä.Þ{¹ˆ¨$9yÏûãû™,ô5œ÷™áñ9‡÷çÊÂQ¥¦½½ÿÊ•Ôööî‹©dòß_}•X]¥r :‰õ¯_~‰G"A·{÷EûåË®]ýá*·i)¢2Jj{;èv{®^Ý}±îÜ9*ƒƒ©è§Ñht:Ý1AŠ('–^¯¿páÝ1AŠ('V:N§Óííít‡É¡œXjµ:‘HÄb±3gÎФ…Òâ=™<}ùrݹs:Îh4Z"N×pöìÐÄ•ñArÔTF ŒŒhõúgËË©gÏÔ[[ 33ñ¿þ ß»§Ÿ …B™L†Ê]@¹*++?øàƒ¿j4š’’†!X,–ŽŽŽ={zz “x€Ê‹w•J•N§÷\üý÷ß[ZZ*++éÞ ÄŒþO…©Têåë.—«¶¶¶¶¶–îí@´„¨X¼û÷ï †ÆÆFºwq.±!>ŸÒÚÚJ÷¦ BM…;ÀÚÚÚ©S§èÞÄFèÄ"„ÌÎÎÎÏÏŸÃï>Èš SáŽh4úèÑ£îînºwñ`“X„§OŸŽ÷÷÷ÑÙV9³Ùl555¿Z­îëë;tèPáB&˜U,^*•²Ûí&“‰n$ÀƒÅûËFFFššš, Ý`€!Æk‡Ûí®ªªzçwèÆ¬ˆ¢bñ¼^¯^¯ojj¢0!–ŠÅ{øðáööv[[Å€ U,ÞôôôÊÊŠÝn§0!®ŠÅ››› ‡Ã~ø!•€ 1&!$‹ù|>‡Ã‘ÿP N§S«ÕÒ­¸¸øÒ¥KÅÅÅ´©êë룾Eãp8ÊÊÊèŽ …&ºÅûËnܸa³Ù***è E3±8Ž#„âÃ^7oÞ¬««ËjØ¢™X´Vîûº{÷®Ùl®¯¯/Ðø@ÍÄ*Ä<¸ÛÄÄ„V«µZ­…»Ð"™ŠÅ›ššÚÜÜDÓñ“RÅâƒÁX,ÖÙÙYèA>$V±x ÓÓÓhÄ%fÒ«X¼¥¥%¯×{ñâEþGQ3“ÉtöìY!ï¨ÑhÑtDæ***NŸ>-ü}ÑtD„$¹ÆÚMGDHªk¬=ÐtDläP±x|Ó‘'N° v“ObB|>ŸJ¥jiiaðd2îðûýh:œ¬*/£ésr«X<4aN†‹‡¦#òÑÜÜ,¶2£é+²­X<4aEžk¬=ø¦#ÕÕÕ¬Q™W¬n·Ûb±?~œu J¡”Ä"„üñÇ¥¥¥h:" EL…;&''ÑtDÊJ,‚¦#BQÐT¸MG ÄÄ"ÿk:ÒÛÛË:ÙRÜT¸#»\®ÁÁAŠ]L  zzz$÷ëçÇ9ÎdzDn”[±x™Læ×_íèè@ÓººÆÚcll MGèRzÅÚ¦#tQK¬Âõ0 šŽPD-±¤;#´PK,Iσ»¡é¨Xû@Ó‘ü¡bío:ât:Ñt$7¨X¯´¾¾>:::00 ÓéXÇ¢`ååårÝÖííí-//g…Ä`*|³ß~ûíäÉ“h:’$Öܺu MG²‚5ÖA¡éHVXY@Ó‘ƒÃT˜¾éÈûï¿Ï:±CÅÊZ8^\\¸Ûªä bå"‰<~üMG^+G+++h:òjZUTTd2™ååeZŠ_2™ …B‡#‰p\R§#Zí /Bˆ’þ¯FSSSCCë(Øp8.ܽ[´±Aö¼\.‚r–/ö0Ì¡C$‘P¿Üt$‘ ŠÝfÄ‹ŽT*…¦#»!±¨á›ŽØl6Öˆ7Ð499™N§™œû"6¨X”ù|¾ÕÕUôGÅ¢Ïï÷ÏÏÏ+üÑ<µŸ†•\±¶¶ÈÄI$v_‹rÜ_@ùövœUT2ÑÕÕ¥ä³ÝŠŠˆN·÷e0”â¨Î|?¾¬¬Œu¢ÃÕY\\Ì:ÉúøãÑNýU‡ÒÚà§B!ܸq£££Ãl6³D8H,Œ544X,Ö„3>>^UU¥m$– ¼^oiiicc#ë@ ŽNbÉ ‡‘`&'' !­­­¬),:‰…VVÀÚÚš¼?‘A'±0fkvvvqqñÌ™3¬)T,f"‘H øè£XRH,––——=ÓédˆX>|mÊr¦Õj/]º„s ö!ãF‚‘Ù9X¼‹ŽÁ[o½Å::°Æ‘±±±ÆÆFy1ŒŠ%.wîܑǧ}P±D‡ÿ´Ô·}P±Äˆßö‘t#.T,‘ ¬ÉK¼Âáp4•趦BQ[\\ R|øŒÄ»ååe¯×ëp8X’L…°¾¾~óæM%_mµZëêêXG!süñÕ¥¥¥¬9L…’Á_}êÔ)“ÉÄ:–7ÃT(1£££MMMUUU¬yT,éq»Ý555ÇŽcÈë bI’Çã)++óù+¨XRõàÁ•JÕÜÜÌ:ý¡bI˜ßïþü¹8·}P±¤- E£QŽŠ%y‹‹‹ÓÓÓçÏŸgÈ Xr°´´411!ªmL…2±¶¶Æoûh4Ö±Ðãp8дN 8Ž»xñ¢:à¡bÉJ&“¹~ýºÝn7l#ÁK†FFF¬V+Ûm ‰ÅqÇqH,Q¹}ûvMMMmm-«($Ê•8y<ƒÁÀê¬?$–œù|¾¢¢"&Û> +w1{üøñóçÏÛÛÛ¾/*–ü…B¡X,&ð™d¨Xа°° …섊¥Ož<ñù|½½½ÂÜKAâñ¸Ëå(’Äèf³Y„¿¶¯¢R©úúúôz}aï’ÿ¨XÒ’N§‡††:;; ºíƒ5–B [­ÖÊÊÊÄR®Û·o×ÖÖ=z´ƒc*T´û÷ï›L¦úúzê#£b)ÝŸþ©Õj­V+ÝaQ±€LMMmnnÚl6Šc¢b!„ƒÁ¥¥%ŠÛ>¨Xð_óóó·}P±àÿømŸžžžü‡BÅ‚Äãq·ÛÝß߯V«‡ÒÖÖV g!ÀŠZ­îïïÏgÛ ö‘J¥®]»ÖÙÙi0rk,x¥ááá–––#GŽäðµ¨Xð:.—ëøñã9,uP±à îÝ»—ö*¼¿íóÞ{ïüKP±à@¦¦¦¶¶¶ÚÚÚø~$ÔÌÌÌÊÊŠÝn?È›1BæææÂápWW×߉ŠÙ‰Åb“““ÝÝݯ*dmuuu||¼àÛ>*vH !ü¶OIIɾÿÊå6¨Þh<ýå—üŸ›››>|HI&®Ìm@¨žžÇsòóÏ‹^lé˜c)ûçO?U[­$“9d2™ß~{‹ãôFcëà §RÍy½4i…Bÿøæë'Ÿl®¯ëÆWŽŸˆåTª{?ÿì¹zU£Ñtww_¿~òÙ÷ßkЉTyÂss¥33w¾ýv~~~çb¾k#¬ÜFÍfóî3+óý IIIqq1ßjâèÑ£FBŠ„j;"QߨXZ]ýÔl®®®~÷Ýw‡‡‡ÿþûï|+ߺukkk‹Rñé§KÁ Ëå¢-H†Êf3¥Óü÷ýرc™L†ä_±ÒéôÚÚÿçT*•L&777ó¤%™L¦R)þûî÷ûù‡[9&–Z£©ïêR½ø|¬¢¾>æ÷ç(HΑ'ì_|±ûJŽÏ±jNžt^¹’ÞÞÞ}1Lþòõ׉x<÷A‚JÊË?ûî;Žù‡/€©ÿÔwÝë6EIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/closed_drag_handle.png000066400000000000000000000051621457240071200276750ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ $IDATxœíÝËSTÇðžŒ#"ƒÈ[@@D@."* ŠAy›d‘E¼æOHeíMvIV©Ê. «\[‚R¼AG ×€ŒÈåè€FyÝEßÌ‚ÂÌô9}úœï§\è)íþUÑõí£ÂB@[tLV9wŽÜ¹C¼Þ=òÃÄíf²†ÍÁºw,,»}ÇÃ۷Ƀä·ß˜ì‚12YÅë%v;¹{wÇÊ &kƒôl—3™Lf³™íš "ÆËb±TUU±]DÄø`ùý~¿ßîÜ9¶Ë‚p,ƒÁ°±±±¼¼\^^Îve ›—w‡Ü¾M**ˆÙ¼iµN-,,˜Í«—/Ç®3Y„c`²J{;±XÈê*ùë/óÖVìÔ”{iÉëpè]®¯\.“-@Ó’’’.\¸üetttSSSTTÇ‘@ RSSKKKw=¬­­=rä—y€Æ/ïz½Þï÷ïzøðáÃÒÒÒ„„¶{’±ÿ[¡ÏçûçóÎÎÎÜÜÜ´´4¶ÛbÉ‘XTooobbâÉ“'ÙîÊ$ßÁ"„ X,–üü|¶›‚ÉtŒŒx½Þââb¶û‚ÒÈ}°!/_¾t»ÝÛÿUÔGÖ«0hfffff¦²²’íî |!diiixxøÆl…àp¹Ýn»ÝÞØØh4²ù/KP­ÒÒÒÔÔÔþˆ^¯¯¯¯?|ø°D#<‹òûýÍÍÍ/^´Z­l‡ޏ½cíÒÞÞ^PPœœÌvà…b=~ü8===33“íHÀ…R‹r8±±±yyy G.”XÔ‹/!EEEŒ&>”•XÔÄÄćΟ?Ïd$àB‰‹2===??åʕȗ.w-,,Œ_¿~Éj 3…&õöí[‡ÃQWW§Ó±é˜QÙl6æ‡Àd2Ùl6|å¾XX&=R@€áš„ÇsÿþýÊÊÊ£G²]¤Ãò`±½wimm-..NLL”h}`‹åÁbøæ¾§îî¬ôôté¶V„I,êéÓ§ 999’î‘)±¨ÁÁÁ¨¨¨‚‚©7‚H–XÔØØØææ&Ê’”L¼Ä¢\.×òòò¥K—äÙB%dbQsss.—ëÚµk²í'jbQ+++ƒƒƒ555rn !pbQëëë]]]6› eIªµg‡‘Ÿ¯¹¹¹¼¼eIòPÿU¸][[Ê’ä¡­ƒEþ.KÊÈÈà=ˆÊiå*ÜÎápÄÅÅ:uŠ÷ j¦ÅƒEÒëõ(K’Žæ®Â §Ó‰²$éh4±(”%IG»‰E¡,I"šN, eIJ'E‡‘lP–ijǍÃH6(Kb‹ÙÁôÜ…–%?~œ÷ Âcv°D|sßSwwwvv6Ê’"„ÄÚC__Ê’"„ÄÚÊ’"„Äú,Z–TRRÂ{!á`}‰Ëåzóæ ʒ€«p³³³(K ÖþP–\…‚²$nRRRTÿ)(´,)&&†÷ ÀUZ–TVV†²¤}á* YGGÊ’ö…Ä -KÊÊÊâ=ˆr!±ÂÔßßsúôiÞƒ(+|ÃÃÃ~¿eI{BbEdrreI{BbEŠ–%UTTðDYX ,--ŽŽ¢,i;,6Þ½{GË’ ïYÔEÉF²1 (K"H,¶|>߃P–Dðò.”%$–DP–„Ä’ŠÆË’XÒrYKZ´,‰×wÛã‰%¹éééÅÅÅË—/óDV8Xr˜ŸŸŸ˜˜ÐTY®B™¬®®¢,)BwÉF;eIlKô#ÙË’bccyÏ"-6 /X!imm-))QwY›ƒ…¬Puuu©», ‰ÅºË’p°x¢eIgΜá={¸ 9ÛÚÚR_Y‹¿©©)õ•%!±–%]½z•÷ Ì ±”beeehhèæÍ›¼a‰¥ kkk===6›Íd2ñžE´Ða$NWWW'zYKq@KK‹èeIxÇR(ÑË’p°”Kè²$\…Š&nY–Ò Z–„«P´,©¬¬Œ÷ !ÀÁÃÌÌÌìì¬@eI¸ …±¸¸(PYK$š+KB‡‘œ„(KBb‰'X–Ç{–ÏÂ;–¨ÚÚÚŠŠŠ’’’x²7$–Àzzz222”Y–„ÄÛ³gÏ”Y–„Ä-K*,,ä=È8Xjàt:?~ü¨¨²$\…*ñêÕ+E•%!±Ôƒ–%UUUñ„$–ʬ®®ö÷÷×ÖÖroþAb©Íû÷ï;::£££yÏNg³ÙxO»ÕÔÔp,KbXˆ+ezôèDz$,5£eIiiiòoÍà`áÍ]Éúúú³³³eÞ‰¥~f³Yæ²$$–&ŒŽŽÊ\–„ÄÒ ™Ë’X"gYK[d+KBbiŽ0eIè0‘ÔeI¸ 5*X–/Åú¸ 5­££#???%%…ùÊH,­³Ûí©©©ÌË’X@ž?μ, ‰„ü]–töìYV "±à&''×××Y•%!±àÿ^¿~ͪ, ‰;°*KBbÁn´,©¾¾žsY:ŒTÉh4FR–„Ä‚½y½ÞHÊ’ðŽ_vY ö^Y öGË’rssþGXp CCCF£ñàeI8XpPããã/KÂU!8xY BsÀ²$$„,X–ô…߃Ăp⤦¦¦Ï•%…YÏe±Z/}ÿ=ýyaaáÈÈ!ij±Ñóûïá-‚ª©©éëëû×wßwž°0ÿ—ñßü‘RP@Ãññ ii[:Åj=k³éôúÿô÷³Äàr¹nýôSÁ×_o¾o±Zƒ?Œá-§ÓëŸþù§ãî]“ÉT]]ÝÒÒBùö×_M¢·ÈAè^ÍÌžš²ÿüóÜÜ\ða¤ïXxsBÈââ⮲¤0+èСCÑÑÑôK¶Oœ8a%Ä(ý—oƒ¢ääåŤ¤¼;v,)))//¯½½ýÓ§O‘¬µµµîîî­­-BÈño¾yãrõôô°˜„¡/)‰÷ûéÇ=333ÈËï÷¯¯¯ÓŸû|>dz¹¹áš ÇãóùèÇÝétÒÏ; ó`L¦œÊJýÎO]=ž“³ìtF>('ñÔ©‹·nmæ¿c¥×Þ¹ã÷z·?ô{<÷~üqcm-üA@‡Žýö—_tùnÂðÿöá¤ðÛ]·IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/closed_drag_new_handle.png000066400000000000000000000064621457240071200305520ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ äIDATxœíÝËWS×ð“HHJx …‚ÒRD!$°ÔjÛQí µ³»:ëêØ?£uÔN;pÝ»V}QADžQDƒ‚ÄH ò~?Ïä.JQ $;9ç$ßÏrà:&ûü–n¿ûd“½7E@aái¥®³óòÕ«ñXlïÅx4úß º\DnÜB¦cýç?Ü››¯&'÷^T]¹òìÆ{×®¹p‹H+ñXìÕääìõë{/6iµD.â“m®¨¨¨¤¤„l›ÀE„;–D""Û&páŽÇ#‘ÈçŸ^QQA¶eàÂK „Ãá›7ož:uJ¡Pm8„ÐÃ{4ª¾r¥I«-))‘Ëåµß|CQTEkkÓÆÆŒDâ÷û‰Ü8„Ìtƒ¸¼\ýÝwEI¥ÒŠŠ “ÉDQT$||ýºJ¥2™LkkkDnªªªª§§gßŶ¶¶ÞÞ^>Ÿð° l& ÛœL&“H$›››{/Úl¶P(400àõz}>Ù;;N>ŸŸH$Þ¾¾³³ó×_ÕÕÕ={–ìÈ*ŒÇãýéìì¬ËåúôÓOe2ÙûÛ  …P(´Ùl½Àív[,–®®®ââb‡ÃAöîÀ9 ÷ ‡Ãããã|>_§Ó‰D"²KN,¥RIÓ´Ýn?ò•v»ÝãñhµÚp8ìñxÈ–ŒËé3Ö>.—ëöíÛ]]]dËÆN¬ªªªH$â:Ηû¬V+ÇÓétN§3 ’­˜BæG:»RyÆzÛÆÆÆÖÖ–J¥r¹\ÏŸ?'[0‚É¡p¯x<þðáÃH$200PZZJ¶*È=ÂCamm­×ëõz½é½Ýét:µZMÓô±ÆS`¶$Ö.¯×;::*•JU*©ª ÷'V}}½Ãá¶³½½F‡††Ün7¾u”F£!ûý¾žžžööv‚ Bn00ó~,333ç“O>9qâÁf!ÛO7dþŒõ¶×¯_ooo«T*‹Å²²²B¶qȶ'VR0 …F($üŸ²+Éh4Æááá“'Ofé@ ë¦çp8nÞ¼YYYÙÙÙ™½»@渔X»¶··/]º„f¬Å‡÷w²X,É/:£Ñ˜ƒ;±L,GQMÓÛß… ¤R)³Å2’_›)--U*•f³™`›éq¹\[[[===Àét2]N!Ê·ÄÚîÝ»'‰úúúÂ_;ƒ#‘ü—J¥ååå‹…`›ÚÙÙ ƒz½Þï÷c?’\ÊÛÄÚe·ÛoܸQ[[ÛÑÑÁt-$æ±R177·³³sñâÅòòr¦k)$‡B™L&‹­V+Á6 òx}>Ÿouuµ½½½¬¬Œýƒ8‡ÊtÃ!‰ÄÔÔT(’H$L—“'H&Vuuu(r»ÝÛ̧Ói³ÙT*ÇÃ~$™CbýÃï÷ß½{·´´T­V'¿f i#™XîaÄ6›-‰ ⸶èîî®®®fº bº»»qÜAÚ0Çd‚äºÂ<ëXE™ÍæäêE«ÕúòåK¦Ëá’yOÝîqZ­¶¨¨ˆér8ƒäÃ{ccãææf8&Ø&KØívŸÏ§ÓépÜAŠðŒ•*§ÓyëÖ-w" …Çc0¬V+ö#9Þmcc#¹Ã ÓéÄqAb¥#¹Iò¸±XÌt9l„g¬ô­®®ÎÏÏk4šÆÆF¦kab+Ç{±„×ëýûï¿qÜÁÛˆu¬ÂßöôéS“Éôå—_VVV2]KÞ‰D/^dº †©T*w„Ä"izzÇ$›n(´'÷ƒìw°¾¾¾ººÊt9ŒAb‘—<î@$íw QÉþ_øÁcJd2Y?ÓU°‹B¡¸téRCC̓”Ï·ÿ×Ä…C6ަP(4 ÓU°‘VÛ¼cd©<Þë™ØPˆg¬ƒ š¦?ûì3¹\Ît-¹ƒg¬\ iztt´½½½p^£cåH4½ÿ¾P(,9z …9555‹Åêêê˜.$ëX¹6??ßØØ˜÷û¿a‚4ë"Ê` ‚Á½×&ø|þÌ /ËÛŸÙëXH¬ƒD£Ôààþ)+‘H¨ÕÄbw*Š;ZZZZZZ˜®‚Kär¹V«eºŠlÁ3cœN§Ùl>wîÓ…d>2éÍ›7ápøÔ©SLB‹aF£Q&“ÕÔÔ0]aèXÌ›››kiiɳ¯pa(d…±±±þþ~>ŸðÙï Bb±ÅÝ»w?í‘ $[ƒÁÇ÷öö2]H,ÙÙÙ±Z­ùq<,‹]L&MÓ|ðÓ…d ‰Å:KKKJ¥’ëK‘Xl4==}æÌ™ÒÒR¦ I‹¥¸þ!‹¥hšdº4a(d/ŸÏg49ú5yt,V³Z­N§³µµ•éBŽLÇ*Ì=Œrcuuµ¨¨èý÷ßgºã!Ó±ð€•UOž<©««ãÖ®§d:ÆÁl›œœ<þ<‡Î±Fbq·& б8#‹=|ø+;¯`(ä·ÛýêÕ«ÎÎN¦ 9‹c,‹ßïgÿ‚($÷¼xñB"‘œ![7Dbq›' X‡çææØ¹C'‹ÛÇúú: EGÇâ<³ÙF›››™.ä_0æƒçÏŸËåòêêj¦ ù:Vž˜ýðÃÙ³NCaþÓëõÉïÆ1+¯°gCa^ ‹‹‹jµšéBXyÇf³mmm1¾N‰•‡L&EQÌžTÄÊOOŸ>­ªªR*•L€ÄÊ[=joogj>+Ÿ1ø!‰•Ïhš¾ÿþÀÀ@îoÄÊs^¯wyy9÷ëôѱò#ëô1„ÕÕU‘HT__Ÿ³;"± ÅãÇëëës¶N‰U@r¹N‰UXr6A cñx<‡ŽÅ ±XljjJ§ÓeûF:âŠ[\.×ÚÚZ¶×é£c"‹ÅNŸ>½[èXxrç¢ååå'NÔÖÖf©}$V᚟ŸonnÎÒ:}$VA×h4€xËH¬B—¥ $V¡ …B }}}d›Ebe·Û- ÙuúH, (Š2›Í±X¬©©‰TƒH,ø¿gÏž½÷Þ{UUUDZCÇ‚ÌÌÌ´¶¶J¥ÒÌ›ÂPÿrïÞ="GŽ!±`?"H,ØÏï÷/--©TªLAbÁ;looÛl¶¶¶¶´[@bÁ»­­­ñùü†††ôÞŽÄ‚-..ÖÔÔTTT¤ñ^$fjjêܹsb±ø¸oDbÁÒûˆÄ‚#$‰‰‰ ½^¬w!±àhçåË—çÏŸOý-H,HÉææ¦Ûíþè£R|= Rµ²²RRRRWW—Ê‹‘Xp ƒ¡¡¡A.—ùJ$σzzzD"Ñá/CÇ‚cKeC![4žžÖjµ‡¼‰ép:¯_¿îèè8èH,HÓúúz0 Ò·¼¼\VVVSSóö¥yRT©\®þþûäïÛÚÚ–––(ŠŠƒ¿þšv•ÀQz½¾¸«+FÓ{/¦yú7×®‰e2ÛÊ ÇWVVE5ªT4M?øí7ÅwÐ<ðÃOnߦ÷ô­4;ÏŸþý÷Ùë×‹ŠŠ.\¸pëÖ-Š¢¾þå—¢œlC¬",.~:2âøóÏ‘‘‘Ý‹™>cáÉ(ŠŠÇメ··w÷Jš‰µK,SU__/§(áðp†m·4·´Hkj:::ÁåË—GGGÃáp¦ËívG"Š¢”_}µóêÕÄĉj3øŠD"ùï. “S™v¬D"áñx’¿ÇãÑh4 eØ&pK4ÇãûþÝÓìX‚¢¢fŽÿï »”ÍÍÛËËéœUyú´êÛo÷^Is«îìÙ‹W¯&b±½Ñè?ýt»Ó/8H,“}ýóϼ,l ò?wÚÑžÐ0$IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/closed_drag_roi.png000066400000000000000000000031061457240071200272270ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœøIDATxœíØÍk\UÇñßdƒÁ¤h„ØhŠ!"éʤ`‹¡ ëÖlj+見.€]Øiýš]!à¢ÐbÝ BÁ¶à¢†’Š©B J E«e4- )Ml\òf’™¹¯ç9çûe3îáùpçÌ-*R]ºTliùí΋£ãã]}}³““Ñö$ŸjŠy}g§zz™„¼*.¬}û4=È$äUqa=z¤BAgÎ$2 ùS\X’æç±E[kŽvÙ?KKýСövýÔ©Ÿ_ÔȈÞzåÍ/+?$;­í²»×®=×Ö¶P­žTß®~ýUõîÕým“¯-Lܸ‘ì„d½½š]ÿX©ð›HR"g¬U*œ·HJ–°E’Ò€%lQJ°„­àK –°v)¶.]XÂV¨¥KØ ²,` [á•,a+°²ƒ%l…T¦°„­`Ê–°F9À¶(X–ïåKØòºIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/closed_hover_handle.png000066400000000000000000000031141457240071200300760ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœþIDATxœíØMkTWÇñ_æÌÁLŠÕÐFH‚³+nÚBt‘jèÆ 7F_ ×¾ .w‚B߀ɬB+H@7‹–yXÔ$3™t1“43÷ñüÏù~™ÅÌ{æ÷ýw¦¨H=®rYïßï[œ™Ñø¸æç£mI^Uˆy|¹\®T*‰ŒB>V¥R™œœLbòª¸°Z­ÖÎÎN½^Odò¦¸°$µZ-IØ¢½•¢Ölêî]]½ªR©yîÜâòòòààà¥K•·o7’ŒVŒvØì¬ÔhhuµX,ž]\l|ú´ñáÃ7/_~×h4’‘B¬Z­Þ¸qc÷c½^çžHJäkoKKKây‹‡%l‘¤4` [”,a+øÒ‚%l…]а„­€K–°j©Ã¶‚, XÂVxeKØ ¬ì` [!•),a+˜²†%l…Q°„­Ê–°å{¹Á¶¼.OX–¿å KØò´üa [>æ,aË»\%lù•C°„-r –°åKÎÁ¶¼ÈEX–ý…%lÏ]X–圆%l™ÍuXÂ–Í À¶ f–°e-3°„-SY‚%lÙÉ,aËHö` [2 KØr>«°„-·3 KØr8Û°„-W3KØr2` [îå ,a˱ü%l¹”W°„-gò –°åF¶ÈOXÂVÞy KØÊ5Ÿa [ùå9,a+§ü‡%låQ°„­Ì –°•mÁ¶2,,XÂVVKØÊ¤a [é(,a+åÂ…%l¥Yа„­Ô –°•NÀ’°•BÀú¶’ X_ÃV‚k_ØJ*` [‰¬CÂVü€uxØŠ°Ž [qÖqa+rÀ:!lE X'‡­««°ÕkÀê6lõ°z[ݬÞÂV—«ç°ÕMÀжN XÃÖñ+zØ:&`Å [G¬¸aëЀ•@ØúÀJ&lX‰…­½+ɰµ°[€•|ذR [ÀJ«Àm+ÅB¶¬t Ö°R/L[ÀÊ¢m+£B³¬ì ʰ2-[Àʺ@l+‡B°¬|òÞ°rËo[ÀÊ3m+ç|µ¬üóÒ°œÈ?[Àr%ÏlË¡|²,·òưœË[Àr1lËѬÛ–»™¶,§³k X®gÔ° dѰldΰÌd˰,eȰŒeŰìe°Læ¾-`YÍq[À2œË¶€e;gmË|nÚ–9h Xžäš-`ù“S¶€åUîØ–o9b Xæ‚-`ùYî¶€åmùÚ–Ïåh Xž——-`ù_.¶€DÙÛV(el X•¥-`…Uf¶€\ÙØVˆe` X–¶-`…[ª¶€téÙVè¥d X”Š-`‘”‚-`Ñ—’µ,úZ‚¶€EûJʰè`‰ØR|[À¢Ã‹i Xtdql‹Ž+²-`Ñ E³,:¹¶€E]Õ«-`Q·õd XÔCÝÛõV—¶€E=×-`Q”N´,ŠØñ¶ú¢m:P«ý|r¹<::ÚùŽæçÏsOžD“LÖuöúõRÿÞõb´í¦Ÿ>¾xQ;;§††††‡[…Â@­öÃÍ›}…ŸoÞ$0/©ÑhürÿþÓÓÿ®­ Ôj»¯R´íú …ùgÏ~ñ¢Z­NLL¼zõJÒí™™ò~¶BÕÕ¿Þ½ûãñãΫÏX”@+++Úÿ¼ñе[¥R™šš’422R“JSS1÷$[×맆‡WΟ/•Jccc³³³›››qa­¯¯¿~ýzkkKÒ™[·þùøqnn.‰iÉL…+W†ÚíÎyk·ÛŠÅj·Ûëëë÷ÛÛÛÍfscc#æžd«f³¹½½Ý9ï ¥RI‘aËåñk× Å}?*ÏŒÿ½¸P2×·.ütçÎÞ•ˆÿc}ùò¯¶[­½‹ífó·>¯­E V=}úö£G}ň]‘ý…¦œ(‚j›IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/closed_hover_roi.png000066400000000000000000000032651457240071200274430ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœgIDATxœíØÏkÓwÇñWÒ8Y™ÕtsàìV±¡CAX#¬2Á¹ë¼tu‡1ð R cÐÌο@= ‚Åîàe¸!L…QœHݦ&‚Ý$.ŠR1Õî°Î¦5ß~óãûãóãù$‡öóé'¼¡’O"™_&h£kãÆm££Ï¦§«ŸU*'öì™*—ãŒì.Öããîܹ11Q½XºzêÔÙÇãŒì.´ñlzúÆÄÄű±êŵñD.” ý‹ÎNuu%0 9U8¬Õ«uùr“S…ÃzøP™ŒöîM`r§pX’ÊelQc_Þ+•MCCk–-Óïºúº ½ÿÖ{'Š¿$9YZ[ÐÆõ3g^io\*ež”>è/}÷méúo¥5íÞy|ôܹ$'$GëîÖÍ›s¿‹¼'Rxuݱª+¹oQx ö¨Žš%lQXM¶hÑš‡%lQp-Á¶( Va [T«` [ôRÑÀ¶h~‘Á¶¨ª(a [ôöHR°„-Š –°å}qÁ¶ü.FX–ÇÅ KØòµØa [^–,aË¿‚%lyVr°„-ŸJ–°åMIöü(X–¥KØr½Ô` [N—&,aËÝR†%l9Zú°„-3–°å\¦À¶ÜÊ X–C™KØr%ã` [Nd",aËþ …%lYž¹°„-›3–°em¦Ã¶ìÌX–…ÙKز-k` [Ve,aËž,ƒ%lY’}°„-²–°e|¶Â¶ÌÎbX–ÁÙ KØ25ëa [Fæ,a˼%l–;°„-“r –°eL®Á¶ÌÈAX–¹ KØJ;ga [©æ2,a+½‡%l¥”û°„­4ò–°•x¾À¶’Í#XÂV‚ùKØJ*ï` [‰ä#,a+þ<…%lÅœ¿°„­8ó–°[¾Ã¶â X¶bX³a+Ú€5¶" XóÂVTkaØŠ$`Õ[­¬Úa«Å€¶Z X‹…­¦VHØj.`…‡­&V]a«Ñ€UoØj(`5¶êX…­:VÃa«ž€ÕLØ XM†­ÅVóak‘€ÕRØ X­†­š+‚°õrÀŠ&l-X‘…­ê€eØz°"[ÿ¬èÖ€SØV\yn X1æ³-`Å›·¶€{~ÚVyh X å›-`%—W¶€•hþØVÒyb X)äƒ-`¥“󶀕ZnÛVš9l X)çª-`¥Ÿ“¶€eDîÙ–)9f Xå’-`™•3¶€e\nØ–‰9` X†f»-`™›Õ¶€etöÚ–éYj Xd£-`Ù‘u¶€eMvÙ–MYd X–e‹-`Ù—¶€eeæÛ–­n Xg²-`Ù±¶€e}fÚ– h XŽdš-`¹“Q¶€åTæØ–kb Xf‚-`¹Yê¶€åléÚ–Ë¥h XŽ—–-`¹_*¶€åEÉÛ–/%l X•¤-`ùUb¶€å]ÉØ–%` Xž·-`ù[¬¶€åuñÙ–ïÅd X‹-`‘ƒ-`ÑlÑÚÍ¡-`Ѽ¢²,ZX$¶€E5jݰ¨v-ÚÖŠ­LÐF{>¿içNIÚ½[û÷KRejê§#Gš“ì¬XÔÌŒ~ükWnéÒ[ç›zð æ©¶ §ûôèÑU}}š™éX™_·>íf¾=Ÿ_¿}{&›½59åàdvgÏê£/w­ÿä³ÒÇíùü‹ÇšB¡wË–_Ož¬y*ôt™löÂñãÇÆº»õõ‡–¤‡-y‰-9ß÷§—~üÆÏ}ÿ ïÛ7·XìÛ¶-èw,ª«óç»o¾b½hÕ*uuéÖ-Iº¼B˦µæ«$ »ñš¦rz·¬ŽŒhÝ:ݽr$Öä¤úûuïž$mýF÷ÿÐÅcÌJÕÿ¹V¼­ÓEIÑ“'áGÂa=}ªK—f~ôHå²nßnaF²°Þ²rùÙÿûȈ::ÂÂj[²¤góælÛ¼+{zþ¾v­Õ1ÉÂÞìí- V¯ô dsÁþ‚6º6lØ::ú|zºzñy¥2><ôÕ¹Ú«Ë—ï8x03ÿU&›ËýpàÀŸW®¤5QËý gÒ1Vfy6IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/closed_hover_segment.png000066400000000000000000000061371457240071200303150ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ IDATxœíÝ{P”åð+tˆ”EgD$E,ARTšÑ€æ(byé‚vñv&ocj3ÞšòÒLj¥8gRs q(9ˆ6!:J)äñÒ™9 ÚLH˜". çíЊ`÷Ù}Þwßïç/}gyžïŒ¿ù=¿]ä """"""""""""""""""""}1Y%$::yéRkCƒýC«Å²{Þ¼ºkׄlAÚ"¦°fää\¯©©*.¶8$-íl~þ7›7 Ù‚´¥£U¬ UÅÅÿÎζØ;.NÈâ¤EÄ.çïoèÔ©“Ø5I‹–ŸŸ133P욤E‚ «¶ÖKQÙ¹S쪤=‚ ËËË+;;8?‡‰]˜4FÐðn±Ä¦¥õŽ‹ëÔ©S@@@MÍä7ñ÷7žþtÞ!ë“æˆù¸ÁøØc±¯¾ ÀÏϯk×®—.]`êR·éÛ»u²é[PPÐàÁƒíþŠÆFrš×ñ3–Õjmþ«¢ÀË ee0@ì>¤v‚ «C‡öOšš`2!+ £F‰ÝŠTMÌðÞ¬EÇjöä“8|AAÈÊ»!©”Ë;V³„Œ‹ùóÅnH*å¾ÂðòË ÅÚµb÷$5ríð~¯ pã>ûL춤:î.,|€’ìß/vgRÁÃûÃÂfÛ·CQPZŠØX±û“ZÈ),_}³—.¡W/±H$…;ÿ#F ®>*6ÉçÖw…÷úé' º}úˆ B’ÉìX6·oãoC~>†›…d’ܱš…‡cÝ:¤¦ŠCÒÈïXÍââ–†Y³Ä&"9ÔÒ±l&L@t4V®˜ˆäPQDz™=^^à#jº:–ͻ99B‘GHHH0B–zñE=*d%’ÀMÿË_~ EÁ¹sè×OÈzäVj< ›;†”üþ;¼½E-In¢ºá½…Š „†âæM„„\•\Nda MMM×píy%%4HìÂäB" Kì9ØBϞض ÉÉ.Zž9¼ ?[ˆ‰Á×_ÃdBF†ë6!14Ó±lžññX²Ä¥›" ËÕËæµ×Ð¥ 6lpõ>äu,›wÞAu523ݰ9H{Ëæ£PP€ƒݳµ›ÈáÝmËfçN( ΜAT”Ûö$cÝþc7¢¦ÆÍ{Rë49cÙûáDGÃjE×®nÞ™F«3–½_~·7ÊËÑ¿¿û7§ûÓ|Dz±]ï–“ƒøx)ûSKÞï‰#G„»“Ià G¡½Q£’‚yóä¦ O9 í½ô°fìúæiËfþ|ܼ‰mÛdçÐ1ìX6k×¢´ûöÉÎA΋ŒŒ •â.cÇâøqÙ!tÉ£ÞÞkÿ~˜Í¸x*+xÏç™3–½ÒRÄÇãÖ-øùÉŽ¢';cÙ»t ]º ¦aa²£è†. øóz·‚ &;Š>xþQh¯OlØ€ñãeçÐ}€áÃ1mfΔÃÓéå(´—šŠ˜¬X!;‡GÓca˜5 ÞÞHO—Ãséî(l¶r%**°{·ìÔ*w¹Íĉøö[Ù!<‘–~Úrr ((/GD„ì(žE§3–½£G‘šŠß~CGÁ—…éš~g,{çÎ!, uuèÑCvO!¬°\t‡‘ÛØ®w+-Et´ì(AXaiôl!$Û·#)Iví6Vh÷laÐ äçÃdÂŽ²£h;Ö}$'#!‹ËΡe Ëc:–Í´i Äúõ²sh;Ö-Y‚šˆba=̆ 8t²sh‡÷VdfBQpú4?†hVë„ٌ˗ѽ»ì(ÚÁ£°MΜAL Ð¥‹ì(ÁÂj«šøø ¢‚ß®n~ÜжëÝöìÁÈ‘²£¨ž°Ëã;V³þýQXˆ  ìÚ%;ŠŠ±c9">©©˜;WvãŒå )SŽÕ«eçP+v,ÇÍ›‡º:lÝ*;‡*±c9eÍœ8¼<Ù9<˜ ï0r›qãPR";„Êð]¡ûöÁlFUz÷–E5xŠqü8pó&|}eGQïÂ\¼ˆÀ@( ûÀŽ%–íz·C‡0t¨ì(²±c‰†?FJŠìR±c¹Ä°axýu̘!;‡<ìX®2~<Æòå²sHÂŽåB3gÂÇ›6ÉÎ!;–k­Xóçõøÿ ر\.={öà›odçp/~òî»wCQpö,Ugû%%%uä=@«Wáå%;‡[pÆrŸòr„‡£¾^?í#¦°´~‡‘ÛØ®w;qQQ²£¸˜˜Ââ€Õ.=zàóÏ‘˜(;‡+‰™Šx¶Wt4€É„ÌLÙQ\ƒKš¤$ŒƒE‹dçp –LS§"(ëÖÉÎáb ‹G¡Ã/†¢ #CvÑØ±ä[¿‡ãÀÙ9„âð® ;v@Qpê ’E1…Ŏ异˜Í¨®ö»æ9c©ÈéÓ< \v§qÆR—Ë—a4âüyôë';ŠsرTÇv½[n.FŒÅ ìX*÷ÞäI²s8Š…¥^#Gâ…0gŽìáQ¨j“'£o_¬Z%;Gû±°Ônî\Ô×cËÙ9Ú‰G¡¬^“'±w¯ìíÁHµaëV( Š‹1|¸ì(mÃoéhF^ÌfTV",Lv”6àQ¨%%%3üÎeGi ‡w©ªBP®\ʯOdÇÒÛõn‡#6Vv”cÇÒªÞ½±q#Æ“ãر4lèP¼ù&¦O—ã~ر´-%±±X¶LvŽ{°ciÞŒ0±q£ìwcay‚åËQY‰ìlÙ9ìð(ô›6!7……²sü¿¥ã9ví‚¢ ¬ ‘‘²£ˆÂ;ŒÔ£üú+:»FÈAœ±<ÍÙ³èÛ ‚ƒeÆPXƒÁ`0°°ÔÃv½ÛÉ“8PZ…Åv¥NÝ»##Ï='gwƒ Kµ¢¢PP“ ;wº{k‹Ÿ5¨Yb"ñöÛîÞ—G¡çKKCp0>üЭ›²cé¢E¸r_|á¾Ù±ôbÝ:"?ßMÛ ÞÙ±´"#Š‚“'ãò½ø®P_€ÙŒŸFHˆk7⌥;§N!6wî À…»pÆÒ£êjøú¢²}ûºj –NÙ®wËËóϺd}…ºÖ¯V­ÂĉâWfÇÒ»#0q"ÞzKð²ìX„I“÷ß¹&;Àœ9°Xðé§ÂdÇ¢?­Z…Ó§‘›+f5~@JÙ²Š‚ï¾C\œ³Kñ[:t—½{a6ãÂôéãÔ:œ±¨¥âb$&¢¶F£ã‹pÆ¢û¨¬D¸z½z9¸;ÝßèÜ……2Ä‘/gÇ¢‡ Ez:ÆŽm÷ò]!µ"6ûöÁdÂöííø*v,jݸq6 K—¶ãK8cQ›LŸ__|òI[_Ï¢¶Z¶ /"+«M/æQHí°q#òòpäHë¯äðNí“ EÁ?bÀïÄ;Œt(2W®À`xà 8c‘#ÊÊ«ݺÝÿ.¹‡ê;uªíÏ‘‘‘eee,uuE[·:¶ iTM á?|vGûça“7o6úû_¹pÁ`0M¦®·nè5dHSSÓwÛ¶ ÈKŒ‚Ÿg_;í?K,÷FVÖÓS¦ðööNLL´=œ”ž>R£¿h–œ?þ¿~úä•WîzèìŒÅÏ@n.’“±pá_Oœ}7g4}||F  gÏž@ÇÑ£\“´%ì‰'ü‚ƒ¿øçèY³þ›m˜6í—úúzg ëúõëÇŽ»sç€À ~­ª***‘–4£CTÔãEEEEEX¸°Á××Z_ïtÇjll¬­­µýÙjµZ,–Û·o;•´Äb±X­VÛ¿ûÚµþ’N ËËÛ;ì™g:xyÙ? 3WT8“´Ç>äîéÝÁϱBžzê¹¥Kì6Z,9 Ô]¿îx@Ò £¿ÿ¤M› ww""""""""""""""""""""Ò›ÿâSyÝeIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/closed_init.png000066400000000000000000000033131457240071200264040ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ}IDATxœíØÏk“wÀñOÓ'kRM‡Ó‚ÊL1q¢‡U°‚NË@¼yðRëm7Ï=û¨xʼxÓ¤KCDE -XØ¦ÈÆBŒ­Õ¶€e[𨖅é` Xv–º-`Y[º¶€es)Ú–å¥e Xö—Š-`9Qò¶€åJ Û–C%i Xn•˜-`9W2¶€åb Ø–£©¶,wSj XN§Î°\O‘-`‘[À"¶€E‹×°ès1Ú­+.[À¢Åb XԤ趀EÍ‹h XX[]Az …c—.‰H6›Ý¿ýT–—'oßîtN2²:¬]§O{==.ýr÷îòâbÓ]ÝAOwñÎþƒeuu[___¿ŸÉô ßœ;וÉüñìYŒs“æ•Ëåï._þöâÅÿ{ …µÛ׃ƒNž|ñàAÓ]^ÐÓue2¿Þ»÷t|<ŸÏ?~üñãÇ"ráÆì&¶d}å……?_¾|qëVýƒ«ÞàÈÈÁ³gƒ¶pÆ¢–šŸŸ—vÎ[ïXkõôôär¹ááaÙ»woAÄŽ2"×@©´­¿~ß>ÏóŠÅâÄÄÄû÷ï·ÞkiiéÉ“'>|‘çÏÿ=7799ϼdH™#Gújµúë^,kµZè–pXµZmii©~¿Z­V*••••ˆƒ’YU*•jµZݧ§§=/œMà#º³Ù'2Ýë¾6îøkf&ú d\_8082Ò¸204” ø;֞Ç¿«ù~ãb­R¹õjÐOdkùíÛ/\¿Þµþ]&ãy?]»ööÕ«´¦"""""""""ŠÜÿôÈ9?¤SÁIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/closed_setpoints.png000066400000000000000000000031321457240071200274700ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ IDATxœíØ»k[WÀñŸ¥«Z2†X.nl¨–ˆ††,mÀÉàÆ¦K¶ ^âdèœ!sþŒ2²è?Åx°'SB‚Á†„>œBK…¥õCwPpd×éÜ×ùóý¢A:p~p?Ü{¥¬õýóçÙ\î÷·oÛ§gg‡Ê埗–Ìö$—Ê„<>—ËåóùHF!— +ŸÏOLLD1 9UXXõz}¿R©D2 9SXX"R¯×E[Ô^`vX£V»v÷néúõ †‡‡?_[8ùòÚë×ÑÎGJËš¶:?ÿY_ß?ÕêÎÆF6ûëÊJõǿ߽ûååËjµíˆäc…Barròàc¥RážHÉ3V{«««ÂóEK°E",ÁÅK°å}qÁlù]Œ°[/,Á–¯ÅK°åeIÀlùWB°[ž•,Á–O% K°åMIÃlùQ °[”,Á–ë¥K°åtiÂl¹[ʰ[Ž–>,Á–‹YK°å\¶Àl¹•E°[e,Á–+YK°åD6ÂléÏRX‚-åÙ K°¥9«a ¶Ôf;,Á–ÎÀl)L,Á–¶ÔÀl©J,Á–ž”Ál)I,Á–†TÂlYŸVX‚-»S K°eqºa ¶lM=,Á–•¹K°e_ŽÀlY–;°[6å,Á–5¹K°eGÂlY›°[iç,,ÁVª¹ K°•^ŽÃl¥”û°[iä,ÁVâùK°•lÁl%˜_°[Iå,ÁV"ùK°žÂlÅœ¿°[qæ5,ÁVlùK°OÀÁV ëcØŠ6`} [¬Ca+ª€u4lE°Ž [áÖña+dÀ:1l… X§…-ã€uFØ2 Xg‡-ƒ€ÕQØê6`u¶º X]„­ÎVwa«Ã€ÕuØê$`™„­3–aØ:=`™‡­SV¨°uRÀ ¶Ž X„­ÿ¬hÂÖ‘€YØjXQ†­ƒ€qØj¬èÖ+¦°¬¸òܰbÌg[ÀŠ7om+öü´¬$òаÊ7[ÀJ.¯l+Ñü±¬¤óİRÈ[ÀJ'çm+µÜ¶¬4sذRÎU[ÀJ?'mˊܳ,[r̰,Ê%[À²+gl˺ܰ,sÀ°,M»-`Ù›j[À²:½¶€e{JmKAmKGêlKMºlKSŠlKYZlK_*lKeöÛ–Ö,·,ÅÙl Xº³Ö°Ôg§-`¹…¶€åH¶Ù–;Ye XNe-`¹–%¶€å`6Ø–›¥n XΖ®-`¹\ж€åxiÙ–û¥b X^”¼-`ùR¶€åQIÚ–_%f XÞ•Œ-`ùX¶€åiqÛ–¿Åj X^Ÿ-`ù^L¶€E±Ø‰Ä` Xô±hm‹>¡-`Ñ¡¢²,:Z$¶€EÇÞ°èøBÚX[À¢Ó2¶,:#3[À¢³3°,ê¨nm‹:­+[À¢.êܰ¨»:´,êºNl‹L:ӰȰÓmõ˜mÚW,^»wODr¹ÜØØXë;jÛÛ‹Ož˜ÎI*kÁ:ófÐÛÛ¾ž5ÛnæéÓ‘K—d¿pppd¤žÉô‹_ݺՓÉüöêUó’’ªÕê·÷ï=3óïæf_±xð ̶ëÉd–ž=ûñÅ‹B¡0>>>77'"Ó³³¹Ãlɇª¼yóÓãÇ­W+ž±(‚Ö××åðó–áë ÞÞÞ|>?55%"£££E‘`j*䞤«r¥Ò?2²~áB¥Ri~~~ww7,¬­­­………½½=º}û¯÷–Ô”¹zu°Ùl÷R©Ôl6%ü«ÙlnmmµÞ7Z­¶³³rOÒU­Vk4­ó¾¼¼ÃÊærå72ÙC?*‡Êå?WVÂJêúââÅoîÜi_1üëË+W¾{ø°Y¯·/6kµ<ØÞÜ4V8wnúÑ£ž¬á_WDDDDDDDDDDDDDDDDDDDDäFÿ1¸¡ÕGO]sIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/closed_setstate.png000066400000000000000000000033131457240071200272750ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ}IDATxœíØÏk“wÀñOÓ'kRM‡Ó‚ÊL1q¢‡U°‚NË@¼yðRëm7Ï=û¨xʼxÓ¤KCDE -XØ¦ÈÆBŒ­Õ¶€e[𨖅é` Xv–º-`Y[º¶€es)Ú–å¥e Xö—Š-`9Qò¶€åJ Û–C%i Xn•˜-`9W2¶€åb Ø–£©¶,wSj XN§Î°\O‘-`‘[À"¶€E‹×°ès1Ú­+.[À¢Åb XԤ趀EÍ‹h XX[]Az …c—.‰H6›Ý¿ýT–—'oßîtN2²:¬]§O{==.ýr÷îòâbÓ]ÝAOwñÎþƒeuu[___¿ŸÉô ßœ;וÉüñìYŒs“æ•Ëåï._þöâÅÿ{ …µÛ׃ƒNž|ñàAÓ]^ÐÓue2¿Þ»÷t|<ŸÏ?~üñãÇ"ráÆì&¶d}å……?_¾|qëVýƒ«ÞàÈÈÁ³gƒ¶pÆ¢–šŸŸ—vÎ[ïXkõôôär¹ááaÙ»woAÄŽ2"×@©´­¿~ß>ÏóŠÅâÄÄÄû÷ï·ÞkiiéÉ“'>|‘çÏÿ=7799ϼdH™#Gújµúë^,kµZè–pXµZmii©~¿Z­V*••••ˆƒ’YU*•jµZݧ§§=/œMà#º³Ù'2Ýë¾6îøkf&ú d\_8082Ò¸204” ø;֞Ç¿«ù~ãb­R¹õjÐOdkùíÛ/\¿Þµþ]&ãy?]»ööÕ«´¦"""""""""ŠÜÿôÈ9?¤SÁIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/open_clear.png000066400000000000000000000011631457240071200262200ustar00rootroot00000000000000‰PNG  IHDRÈÈ­X®žsBIT|dˆ pHYsttÞfxIDATxœíÓ±À À°‡ýwNàÜB!MàÆkf¾Žöíx™A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A ‚A Â銑àö IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/open_click_segment.png000066400000000000000000000037251457240071200277470ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ‡IDATxœíÝKO›WÀq_ðÝÆŒÁccƒÁ\Œ¹0ƒÁÜW]tTµ©4‹ÙV]ç3dÕfÕn»ˆ& #E‰fA2êˆHQ”*A#5R3™‘†H‘ 56³`D:+ò=ãÃÿ'/àDzý—x…ü“ ׋٫ôNNnß¼Y;=m\¬U«üâ‹ÊÑ‘!OæbÌõ‡»wßþüóá£G‹¹7þöý÷¾}Û§@si1ä*µÓÓÃGîÜi\L,.rq4#‹±—ki1æNE³3øÆ2›Í###Æ^ÍÈà«Z­ONN{Y4ƒo,“ÉtxxøæÍ›……ïŒ&bЋ÷juîÆÆWëN§s ŸÿÓ“'†\Mǘ·\ÀÜgŸ]¾t½nùòÞ½{õzÝgþËf³íìì¸\.éèhmm-HW@G…B¡««Kº:šíëë“®€Ž2™L*•’®€ŽR©Ôøø¸tt‹Åfff¤+ £îîîEþö*´µµ•J%é èÈívoooó—60žÕjÝÚÚòx<Ò!ÐÑêêj{{»tt”Ïç#‘ˆtt455Õßß/]ŽŽKW@GÒÐQ4ÍårÒÐQ(ZZZ’®€Žü~¹\–®€ŽÇÞÞžÃáŽÊårkk«tt´¼¼ÜÙÙ)]ÍÍÍõööJW@GÙl6™LJW@Gétš¡#P"‘H0tJôôôÌÏÏKW@GÁ`°X,JW@G>ŸossÓl6f® ð+›Í¶»»ËÐ(ÁШÂШÂШ’Éd¥+ £¡¡¡±±1é è(3tJ0tª0tª0tª0t 1tªäóùp8,]MOOÇãqé èhllŒ¡#P‚¡#P…¡#P…¡#PÅï÷¯¯¯KW@GN§sww×n·K‡@;f³yccÃçóI‡@GÅb‘¡#P‚¡#P…¡#P…¡#P…¡#P…¡#P…¡#PÅçómll0tƳÛí»»»N§S::Z__÷ûýÒÐÑÒÒCG CG  CG  CG J<Ÿžž–®€ŽÂáp>Ÿ—®€ŽÚÛÛ:%:U.†ŽØí&çòÃf“îCS+—‹?üÐòîéÒcßį3\ÇcªT¬¿:R©˜®í6£E:@µZ-‰0tä7–a?~ìõz³Ù¬tÈÿn,#={ö¬^¯ÏÍÍI‡ÈãÆ2ØÓ§OŽŽ˜x<¦wïÞ[éîîÎçó×ùÅ;ÿ6À/¿˜ž<1U*k¯Íæüø£ÿôô­TtÐÒbr:/?/GuB‰ó£:‡ttT.—h%ŠÅb0”®€Žæçç#‘ˆtt455Ŷ”K¥RÒÐQ*•—®€Žb±ŸÈ€ápxaaAº:êèèXYY‘®€Ž¼^ïÆÆ†ttd·Û÷öö8ÇJpŽT)‹ÒÐÑÂÂG C ކ*lû@•T*Å .(ǧ¦¦¤+ £H$¶”èèèàŒ (áóùÊå²ttäp88¾Jœ_íõz¥C £•••öövé è(ŸÏwwwKW@G333±XLº:çü(1444::*]õ÷÷³í%"‘G£C‰`0¸¼¼,]µ¶¶²í%η}l´Ã™ÍæÍÍMÇ#­®®¶µµIW@G‹‹‹lû@‰™™™¾¾>é è(“É HW@GÃÃÃlû@‰þþþÉÉIé 訧§‡3É DggçÒÒ’ttä÷û×××¥+ #§Ó¹³³ÓÂè0œÅbÙÚÚr»ÝÒ!ÐQ©TbÛJ,..vuuIW@G³³³ÑhTº:š˜˜H&“ÒÐQ:‘®€Ž‰D6›•®€Žz{{Ùölû@¿ß¿¶¶&]¹\®íím«Õ*íX­Öíím¶} D©T ÒÐQ¡P…BÒÐQ.—cÛJ°íUÒét:–®€Ž’ÉäÄÄ„ttFs¹œtt … …‚ttJ¥’ttäv»ÙöçÛ>.—ëþ«ùju·µÍ}þù¥Åj¥²ÿÍ7W» šÔÚÚÚÁÁAæ“OZŽÆõ+~pñw·o»üþ¾xѸÏåÎÎÎ~ûíÕ3Ñlîß¿ÿû[·º‹Å6®_ñÆ2[,ý;w?þúkÛû·-®ƒ¿ÿô“÷å˿ܺõêÕ«‹E‹`´ñúõë`0˜H$.V>ô3üN§óâ]h4Úf2µ0vâšI¦RÞpøßÁ`8zðàÁÉÉɇÞX'''ûûûç_w~ôÑ¿/¾Å5aÉfÛëõóŸ{,;;;3}øo¬³³³ãããó¯kµZµZ½ø×DµZ­Õjç?÷çÏŸŸ¿¹uÅËj³% Ëûïu&“ož?ÿðP4Ðà`îÓOW®ø>Vo&³qófýô´q±^­ÞýòËÊÛ·WDrùýõ•™wá®·ÿÊãsîž>uþIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/open_drag_handle.png000066400000000000000000000033111457240071200273570ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ{IDATxœíÜÏOÚwÇñ/¿‘ª€Q±€ þ`‚(þ¡‹§¶d[{ØÐôÜ¡Ùeëi½öФÀziMºì°«Ië’&ÍšnË~\ªAË$nÙ…~ßù„ÏÇ ?‡¯ÄoŒ1ø4 \,SnÉåŒ;wŒ““s‡í¶që–ñǦ¼úŒ9Ö£GÆÏ?ûûçoÜ0¾ûθwÏ”w@Ÿ±›rËɉ±¿o<|xîpcԻї¬æ^g·›ó¤¢ß™ü`Y,–ÙÙYsïD?2ùÁj·ÛGGG¹\ÎÜkÑwL~° Ã8<<|óæÍêêªé7£˜ó+Q»mܸqö·õWn÷okkÃ?þø—)÷£ï˜óçŸÏøâ‹ÿ”öööLy à.—kww×étªmmm ©^U*•Ë—/«^­®®†ÃaÕ+ £\.755¥zt477733£zt4==ÍfU¯€Ž"‘Èòò²êÐQ(*•JªW@G>ŸïÚµkªW@Gׯ_çS\0ŸÕjm6›—.]R=:ºzõªßïW½:ÚØØS½:* ÑhTõ èhaa!•J©^¥R©ùùyÕ+ £X,¶´´¤zt4>>¾¾¾®zt422R­VU¯€Ž···-sþéø‡ÃáhµZn·[õè¨^¯{½^Õ+ £r¹<::ªzt´²²299©zt´¸¸˜H$T¯€Ž2™ ±$ˆˆÇãÄ’ "‹EÕ+ £`0¸¹¹©zt4<<Üh4T¯€Ž\.W«Õ"–óY,bIR©T€êÐÑÚÚÚÄÄ„êÐQ>Ÿ'–Ä’ …X¤K‚bIâóùjµšêБÇãÙÙÙ!–óÙl¶f³éñxTŽjµ±$ˆ –)…B!‰¨^e³Ùd2©zt”N§‰%A±$H!–)Ä’ …X¤K‚ bIR.—ƒÁ êÐQ±X$–Ä’ …X¤ÄãñÅÅEÕ+ £ÉÉIbIA, Rˆ%A ±$H鯒UŽªÕ*±$ˆ –)ù|>‹©^ÍÏϧÓiÕ+ £d2I, "ˆ%AJ(ÚØØP½:òûýÄ’ ¢K²Ùlª‡@;6›mgg‡XDK‚bIB, Rˆ%A ±$H‰Åbù|^õ èhbbbmmMõ è(K‚bIB, ‚êõúðð°êÐÑææ&±$ˆ –)Ä’ %“Éd2Õ+ £D"A, "ˆ%AJ0,—˪W@G^¯·^¯«^¹ÝîV«åp8Tv,Ëöö6±$ˆ –)Ä’ …X¤K‚bI‰D …‚êÐÑØØ±$ˆ –)Ä’ …XÕj5ŸÏ§ztT*•B¡êÐÑòò2±$ˆ –)étznnNõ èhjjŠXDK‚”@ P©TT¯€Ž†††¶¶¶ˆ%Á|N§³Õj¹\.ÕC £F£A, "ˆ%AJ±X ‡ÃªW@G¹\.«^ÍÎÎK‚bIB, Rˆ%A ±$H!–)Ä’ ¨Z­ŽŒŒ¨^­¯¯«^---K‚bI’L&T¯€Ž¢Ñ(±$ˆ –)Ä’ Åãñ4›MbI0ŸÝn'–)Ä’ …X¤K‚”l6;==­zt433C, "ˆ%A ±$H!–)ÝX’êБÓéÜÝÝý¿XRy.ß_¼yó_‡í·oŸ|ûmo¢O5gÏž}ôÙgöóO˜½·ë>½woÀëýåù󳇱••N§óôþýÞg¢ßìíí}ùÕW¡ÍÍçOŸž=ïñÁ²X­ß?xðÃÇg?ù湋秗//½x±÷î«W¯ÞZ‚6^¿~=::z6–ÔãO¬÷Ünw©Tê¾¾råŠß0ìüûö“H¥ÇÇB¡P*•züøññññ‡>XÇÇÇOž<é¾~üñ¯‡‡ï¿Äa]\y÷®û}F£NÇøðŸXNçèè¨ûúôô´Ýn¿ÿD»Ý>==í~ߺŸ;íñÁ²9‰RÉzþ£«ÁDâÍÁÁ‡EßM&W>ÿüìIÇšÌf·îÜywrröð]»ýèöí·þÙû@ô¡¯÷“¯¿¶ðy€‹ío¢Ä3ü£°±IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/open_drag_new_handle.png000066400000000000000000000047641457240071200302450ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœ ¦IDATxœíÝËO×ð™ñØÆ06A Á`‡G€Äðû !¼²ê¢wѦ»«îª®óg´YµÛ.ÐͲ‹FU]E$Š’*ʽººR¥*É"J{ü6¶?î‚ÊušKÍsüýˆ¡™¯à§3ãs~í…'r•á¹¹õ[·ª•Jó`U–ÿñÕWÅtšÈ-@]ÈÖßïÜɼ}ûâÑ£æA÷Í›ÿýé§Þ¾Mä ."‘«T+•ý²µÕ<8¹8¨‘@ör¢H¦RAí–  d¯ jD¸°^¿~½±±ÑÛÛKöÊ .„ ‹ã¸»wï:N›ÍFüâ „ï²ì¹yó½ÕzïÔÔØ›7OM¦B¡@ä. "d^n0tw{>ÿü½Áƒbñ_[[n·ûÕ«W/_¾$r#€?LOO{½^A ÿØ…3Ks ÷ˆÇã¥R)‰är¹|> w„ö²°°pùòeÚ)à4œÆŒÕðæÍ½^ïv»%I*—˧yk`Ÿ^¯…B/^¤X411 u:í  ˆS}6“$)›Ír¹œÍfiÅf¹\®«W¯ÒN„Q›±vvvxžƒ©TªX,ÒŽlÑh4>ŸojjŠv`‘ÃáˆD"F£‘v8)úÂf©T*™Lz<žz½žÆ›å¸™™·ÛM;´îlÍX {{{²,Çb±L&ƒwÝy‹‹‹³³³´S‹FFF–——;;;iæ †H$ât:iMNNúý~ì0S…3ºx?R"‘( ¡P¨X,ær9Úq€9ssssss´SÀǨiÆjØÙÙÑh4@ ™Lâß‹@˜(Š~¿rr’v`‘Óé ‡Ã´ƒÀ;Tù(l–L&S©”Ïç«V«™L†v`Îìììââ"íð;ÕÏX {{{Õj5¦Óéýý}Úq€-<Ï{<ž™™ÚA€Ev»}iiÉl6ÓÌ1ÑhÔápÐ,šššòù| ;KIµ`ü'žH$ŠÅb8. 8È›ŸŸw¹\´S´Æg¬†·oߊ¢èõz%I*•J´ã[t:]0§X4>> …ôz=í ,k—Ga3I’2™Œßï—eç‘yW®\A»…´ãŒÕ°»»[«ÕÂáp*•¿0A¼^ï¥K—hÅb1“ÉD;0Çd2Åb±ÑÑQÚA€EÓÓÓ‡çÉôìh[m½x?R<?88ˆF£hwŠ@»ƒ“ÀŒõ§Ðî„v  ‰‰‰@  ÕjiQ < E’¤|> ÑîvÇ„ë¯9lw€óH@‡ç‘ Ý(â°ÝÁ` ä,£°u‡í¼^/Ú€"ÐîàC˜±h´;H§Óhwä¹Ýn´;E Ý(å°ÝA›ŸG‚·³)ejjÊjµ>yò¤R©èt܇ÿf<8àd™F2P;›Í¶¶¶622øð!—Ï¿ÿ±½Í¡É´.píï Ž‹Îz†Ö™L\¡À¯®®Z­ÖæqœˆÉÄåóœV« ‡ÃͯÙ.¬#¦hP‚,Ë<E±M^£GaªÇW*•ááaÚA‡Â:mÏž=³ÛíÝÝÝ´ƒ( ï*îà€{þœ{÷MÛ‚ <}ÊW*uZ©€¢Èut¼óÑÕ¥[__¡ XdµZíJÁÛf¨9…¥>’$]¸pA£Ñär9ÚY€9¡PÈb±ÐN,Z[[q( §×ëWV°O`³Ùü~?íGÀâ]ÝŠÅ"Ïó###gmŸ> Kõ2™ŒÍf³X,©TŠv–? °XH$G­VÃ>} ûôA)›››}œ›Ã W¯^qg·Û)ç&y<ž¾¾>Ú)€EاŠÀ>}PJggg$¡XDeŸ>^n`•}ú(¬¶J¥†††t:]6›¥˜ƒ}ú ìÓE`Ÿ>(¥»»; *},ÞÛN©T:…}ú(¬v”Ëå,‹ÍfS® «MI’d·ÛyžÇ>} ûôA)ëëë \@ZGGǵk×h§õôôø|>²×Ä\±Xì>}pÇe2™žžžÎÎNRûôQXð»x<ît:«Õ*ÚÙyÑhÔl6ÓN,ºqãíÀ"“É‹Åh§õ÷÷»Ýî“\‹w8B¡PÐétCCCñx¼µ+ °àhétz``À`0 çõz{{{i§-// Ú)€9‚ lllÐN,êêê ‡Ã´S‹çççÿýø«Ž%ŸÏ›L¦þþþcîÓGaÁq%“ÉááaQ±OÈ V«•v `Ñõë×u:íÀ­V»ººJ;°Èjµ|ïЊR©T¯×ÇÆÆþlŸ> Z”Íf?²O…­“$itt”ã¸ÛÙµØ)Êhµz¾øâ½A¹XÜþî»Ö.ê‡õW¯VêõæÁ{ ÿíömƒÅÿí·æA»Û]¯×~ÿ}ëA…ê—.E¾üòß?ÿ\oª­ ‹„'?üðËÖVóà§ß~«Å1„íGÔëÿsï^òÇïÝ»×D“&  Z­>þÜëõ6FZœ±:::çž?ÞÊq"N˜h3Žñqóà ËåÒh4ëëë÷ïß/—Ë'-¬r¹¼½½}øyß'Ÿ$^¼h| mBp¹lµÚáï]ÅZ­Æ|ƪ×ë¥Réðójµ*ËrãKh²,W«Õ÷~ï-–F«uƒÂ»võ9{¿þÚz@P­þ‹ÝŸ}Ö<ÒâëX×/_¿u«V©4ÖdùÎ×_±[¨Í,–O¿ù†Ç±€íí>$ý2åœýIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/open_drag_roi.png000066400000000000000000000020531457240071200267170ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœÝIDATxœíØ?hœuÇñßåBDs X‰P ¡ PM¨íjqpÎÒ?¢.Ã-B—^prm¶©CK‹âæ œ¬mCÁ"ª8[ô …+\Ò:ì%ˆÃóäC¹äõšžç Ï/Ü›çŽk–JÞ¿x±96öëÍ›ƒÃÅ••=³³¿¬®V;“d¤æó­Ö¶¬ÁNS7¬F£œ:µ-›°£Ô «ÛÕÿ¡nX¥”NG[l5Zí±õ~áØ±—üçöÇRæçË›/¾þYçûíÛ!Ö¨öØÄÔÔÂÑ£[†o¿Õë}÷Éòrí¥`‹NÇw"Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘ò?m5ªøÌôôÂñã[†ý^ï›3gªÈêtÊãÇåëßNŒŽÎ+†õÞ… ­Ö·o÷ÎÏ{îÜ•³g«¯ÉúøË㯽{å‹ëƒÃÑjg5FFVÏŸ¿qéÒàpqeels¶ì_]çùë¯üµ´¼üd8òôöaç¸v­4›~oU|cýkf¦\½ºqýÃTyn­ìý°æ‘ ™ŸŸ-½Ñòj·LN–v»ìÛWîÝ«ÖÝ»åÀëÕ?*7>­y$CæÊÔKår§”RÚíòða)õßXëëåÎëJ·ûä–]b®[F§7>÷v»LN–R9¬æØØì¡C#ÍæàpÏììï·nÕ]“!ôÂÜÜü‘#ƒ“Š7ÌìßøäÉGkkƒÃGýþçKK½û÷«/ÈšhµOŸnl~˰Ûü ïÃ/ÝÚEØIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/open_hover_handle.png000066400000000000000000000020371457240071200275710ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœÑIDATxœíØÏkgÇñÙÍc)nR°"4Rvq¡ â)=˜“HÏ"Åüñ7xöâÿ`ă^…ú?!^BV$ÔE¼÷ÑS²Œ»ÛÃÒ°É¡‡Ù|(›¼^§™/ÌÃóæ™eçŠZž=+æç‹·o÷ ×ÖŠN§ØÜ¬·$GJsÊç˲<”}pÄLV£Ñèv»‡²Ž’iꪪ( mqÀ´aEÑëõ m±_Í_HUUܾ]\¾¼7è-..^¸°ðúõî!mŒÙÖ¨÷ØâbqëÖÁá©Sg^¼h08LÝn×7‘m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHù¶õVübiéû;w «Çë-ÈŒ‡uæÊ•òĉÉyYo¹Ÿ><ÙjýùþýäðÛ••Ñhôêɓڻdæôz½ïßÿîÚµß^¾œœ× «Ñln>}úËóç“Ãkkóû³å8øûãÇßß¼ùõÑ£^¯·7lþâÈØÞÞ.þý,ŽÕ<±ö,,,¬®®Ž¯————Š¢¼zuÊ5™-n÷˳g·Ï+˲Ýn¯¯¯÷ûýiÃê÷ûãëÓׯÿõáÃÞ-ÇDóÒ¥¯†Ãñ{o·ÛÃá°˜þÄF»»»ãëÁ`PUÕÞ-ÇDUUƒÁ`üÞ·¶¶Ê²,j‡57?ßY]mÎÍMOw:¼{7ýF™9_Ÿ?¿róæä¤æÿXß\¼øÃ½{ÃÏŸ'‡ÃªúùîÝOŸêot²ÕºñàAcÿ)Àqó…C Õb8·(IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/open_hover_roi.png000066400000000000000000000022231457240071200271240ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœEIDATxœíØAhÖuÇñßóøÈ0j›Pb4†``õˆÍk’ÐÙËœxÙ%ØÅgäÅ«zRB…¡t ,„èSC"HÁ<³’zá¶i—¡OæÃƒŽÏ꙯×é¿ï¿g_Ø›gÿ=¥Àÿ_¥Ó¡Í›wLN.ÌÏ·ææÎìÛ×j6ó‹ÑÛ:†õÉÙ³wggoÎÌ´ëãã×ÎûîèÑübô¶Z§ óó7gf®LO·ßͯÄJPíú˰+M÷°*•ràÀ2lŠÒ=¬fS[<³îa•R mñl:?¼ÏÍmô´~­”z½¼÷ú;g?-×nô°Ž7¬ܲk×ÃÞoµ~ü|j*¼/ FÃßD2´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"å¹ÛªtºñÒÚµ[vï~b8×j}ìØóüzV£Q>,ßþ¶·Ö×÷Ä­K'O¶îÞ}꩎a}túôš?nÜh®¯×gNœ¸püøÒ×¥‡újoßÛ{.|y¹}¸ndäÞ;_ìÙóÔ#µN¯U©V8uêÊôtûpç‘#«ÿ•-+Þ×çû>|õòÆ¿öOM=ÖÇÆ6îØÑéHu9ö¢÷]ºT*•gxÞêøŽõÈÐP¹xqñúçÁòÊ|YÿéónGoºùriÕÊ[ÍÒß_&&ʆ åöí.Gº‡5;[¶n]¼ÞþYùó—råäR¥·¼ûq|£œo”RÊÄD¹¿û‘îa-,”[·¯ïÝ+Íæã/yAŒ4Kmíâï}b¢ô÷w?Ò1¬U«WoÛV]µª}øÚððïׯ/uMzк‘‘úØXûdxt´ZëüÏ_§C›6mŸœ|0?ß>|07wvÿþN]°R­ØyøpåŸï2ÕZ훃½zõ¿Ú –ìoû«ê¾ƒ¢±†IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/open_hover_segment.png000066400000000000000000000041131457240071200277750ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœýIDATxœíÝ{LÕõÇñ7 )ð²*/µ×@‰¼4Ù¼Õl§ýäâoÂÑ¡¶E—?º¸ßÂJ5ÛðR"l¡¶ØRl€RyÙ¯Dú¥Ø&JÔ$ßsà÷‡¿Ù±ßoó×áëÞž7¯Ç_ç|`ïóÜÎgggŸsˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆhdñ2eÊ„¸¸Ô¢"§Ãáºè4Œ›mà·ßL¹ ò,æl¬œÚÚ«ÝÝ­­®‹ñ™™íõõMee¦ÜyS¦8ŽÎÖÖï««]£Ÿ~Ú”á䉼Í÷ÀæÎ#OeòƲXðá‡æŽ$dòƺrçÎaçNs§’ç1ycøè#Ô×㫯LLžÄ¤'™yûÙº4ôcáßž*·0e>ysŽÆŒIÈÈøÓâƒa%ÿ$"”[ rñÐCDx¸téãå…‹ñÄÒ¤Ò?àÙg¥#H¥¯¿ÆK/IGJŸ}†Õ«¥#H¥M›°aƒt©ôÚkغU:‚TZ±_|!A*-\ˆ¶6éR)>¿ü"A*=ü00z´téãï¾><òˆt©ôóÏHL”Ž •ZZðüóÒ¤ÒçŸ#/O:‚T*/Ç[oIGа™ÿÖäaZ¹ øaDº'V­Bm­t©ôâ‹øæéRé™gÐÑ!A*MžŒ+Wàë+ÝAúŒƒ›71a‚t©tîfÌŽ •ŽEjªt©ôå—°Z¥#H¥ª*¼úªtÝÍ}wò~W¯¼‚°0|ðt©TXˆ;¤#H¥Œ ìß/A*=÷Nð‹’è^˜>ÝÝÒ¤RDœNŒ+ÝAúx{£§Ó¦IwJ'ObÞ<éRéÀ,_.A*íÚ›M:‚TÚ¼ï½'A*¡²R:‚TÊÎÆ¾}Ò¤Ò¢E8rD:‚TJHÀÙ³Ò¤RT®_ǨQÒ¤O@~ÿ11Ò¤ÒéÓ˜5K:‚TjmÅÒ¥Ò¤R]rs¥#H¥-[ðæ›ÒªyÞ‡)L‘—__”–JwJùù¨©‘Ž •–-áCÒ¤ÒìÙ8uJ:‚Tš2—/ÃÇœ_^'rÃÀøñÒ¤RWââ¤#H¥cǰ`t©T_¬,éRiÛ6¬_/áÉFèÉû]Y­ÇÆÒ¤Òڵؾ]:‚TÊÌDc£t©”œŒãÇ¥#H¥ØX\¸ A*EFÂá@X˜téc± ·S§JwJíí˜;W:‚T:xééÒ¤Ru5 ¤#H¥’¼û®tÄýŠ/é¸ÏfÃÀ**¤;H¥œìÝ+A*-^ŒÃ‡¥#H¥™3ÑÙ)A*Mš„þ~Iw>¸v ÑÑÒ¤Ò™3˜9S:‚T:|K–HGJ{ö 'G:‚Tª¨ÀoHGáÉû=”› ??””HwJؽ[:‚TJKCS“t©4gÚÛ¥#H¥©Sqé,éÒ'4Æ“î •ÎŸGl¬t©tü8RR¤#H¥†dfJGJÛ·cÝ:éR©¸ÅÅÒ¤ÒºuضM:‚TÊÊBCƒt©”’‚cǤ#H¥¸8œ?/A*Ã@h¨téããƒK—0eŠt©têæÌ‘Ž •šš–&A*íÞü|éR©´ï¼#ñ×ñÃ÷»‚ØíزEºƒTÊÍÅž=Ò¤Ò’%hm•Ž •fÍ™3Ò¤Rt4®]C` té„þ~Lš$ÝA*uv"!A:‚T:r‹KGJ{÷";[:‚Tª¬Äë¯KGüž¼{¼œ`óféRÉfCuµt©”žŽƒ¥#H¥¹sqò¤t©4mz{áÍ'Ïdº°08ˆŒ”î •.\ÀôéÒ¤Ò‰HN–Ž •‘‘!A*íØµk¥#H¥ñþûÒ¤Òúõ¨ª’Ž •¬VÔ×KGJ àèQéRiÆ tuIGJãÇãæM„„Hw>¾¾¸|“'KwJ˜=[:‚T:tË–IGJ55XµJ:‚T*+ÃÛo›9ï#Èχa ¼\ºƒTÊËC]t©´t)ZZ¤#H¥ÄDœ>-A*ÅÄ ¯Ò¤ÏèѸ~QQÒ¤ÒÙ³ˆ—Ž •ÚÚ°h‘t©´oV¬Ž •¶nEQÑ_øž¼Óÿ%;AAØ´IºƒTZ½»vIGJË—ãÀéRiÞ<üø£t©ôøãèé——té3v,ñ¿ÿêæ– IÈÊúÓ¢10Ð\QáÞ@òPÝÝHIApâJ??×u÷Æ¥—•÷Üù"xT|üÐÐPKe¥û™äi"#ÑØµòÛ>ë?÷·¹®»¹±¼¼½¿Ý¹óû;¿§7­´Ô÷ÎmK#Á?Šýr Û:¾[óé§,ò€”LPW‡ÔTþ±âæ#ÖmþþþIII·.Oœ81ð™?˜3ɳÄ<öبÈȪççåý«ºÚËjýÕn·wcÙíöæææ[—Ã_x¡·³óöU!¼ccC›››››QXè rÚíÃ~ĺqãÆ­ËN§Ó0ŒÛWi„0 ÃétÞºß7løÏtº¹±,¾¾1IIÞ‹ëbxLÌÅŸ~v'yž}4þå—]WÜ<Çšðä“ÉEEƒ‡ëâ aÔ®Y3põªû䂃ÓJJ¼î|”!"""""""""""""""""""¢‘æßã'ðÒ%-îIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/open_init.png000066400000000000000000000022271457240071200260770ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœIIDATxœíØ¿k”Çñ»óD-Å$A¥\ÈA‹ˆ:Ä!™D n"Å1:uç,.þt±àª»t²BJq°bC=$S‹ô‰S O.é®Ö§WµÛ‹¯×ôÜ÷¹'ù½yîx*øÿ«–ØsèÐñ‰‰öòrç°]ŸŸ;·¸°_ŒÞVÖ§7o>}òdnf¦s8<>>{ûö—““ùÅèmõ²íåå¹™™{SSÃÆÈH~%6‚Z×wÔë¥ñA™îaU«Õf³ùVa#éVQ•JE[¼”îaU*•V«UÑ/£üÇ{QïüµÞßß¿kÿþîß#‹ÑÛJ7lëï?rúôsÃíÛ¿»ukíÿ¦f³é;‘m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHy嶪e'Þ8ræÌsÃbqqúêÕWø7ô®µ°v=Zß²å¹S__¿¾øôé ¯ª—ý¹O&'·õõýòøqçðýááÕÕÕ¯®]{ímé­Vëã >8qâû»w;ç;‡†ö>üÙÙ³/¼ª4¬j­öÍ÷¦¦:‡§._Þü—lÙð~[XøéÁƒo¯\iµZëÃá±±/»¤öF£çÍÏÏWþøZü'JïXë¶nÝ:::ºv¼wïÞJ¥~ìØ+ïG/l6ßݽ{~ß¾z½Þh4îܹ³´´ô÷—tkiiizzzíxÇÉ“¿ÎÍ­¿ä-Q;x𽕕µÏ½Ñh¬¬¬t½¤{X«««Ïž=[;n·ÛEQ¬¿ä-QE»Ý^ûÜgggëõîÙ”¾cÓæÍƒ££µM›:‡;~ôèõ¥çìëœ ŽŒÔÊ +}޵çÀ&&V–—;‡+Eqóüù²GlTÛúúN]ºTýó]¦V¯qñâþW[Àkû&J'„¶QIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/open_setpoints.png000066400000000000000000000020521457240071200271600ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœÜIDATxœíØÏkgÇñÙÍ“RLRHEh¤ìâBAÄSr0'‘žEJzðÇ¡g/þF<èUP¨ÿCâ%ô`ņºˆôP ýEô”,ãîö°4l<ô0›e“×ë4ó…yx`Þ<³ìTQÉwOMOÿöêÕèpm}}±Õúek«Úš%õ1Ÿo4‡²Ž˜qêÕjívûP¶ÂQ2nXeYE¡->2nXEQt:B[TñR¯,WnÜh^¼¸?™ŸŸ?uîܯ/^ÒÆ˜lµjÍÎϯ\¿þÑpáäÉŸž>`p˜Úí¶o"Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘òmÕª­øÉÂÂÊÍ› ËÝÝͪ-È„†uêҥƉ£óFµå¾½wovnîÏ7oF‡_./ƒçVÞ%§Óé|sçÎWW®üüìÙè¼bXµz}ëÑ£ž<®­¯OÌ–ãàïwï~ùòÇû÷;Îþ°þ?nˆ#cgg§ø÷³8TñÄÚ733³ºº:¼^ZZZ(ŠÆåËc®ÉdiµÛŸž>½sæL£Ñh6›ÝnwܰºÝîæææðzñêտ޾ݿ嘨_¸ðY¿?|ïÍf³ßïãŸXƒÁ`oooxÝëõʲܿå˜(˲×ë ßûööv£Ñ(*‡55=ÝZ]­OM[­?^¿£LœÏÏž]¾vmtRñ¬/Οÿúöíþ‡£Ã~Y~ëÖîû÷Õ7Èš›[»{·vð”à¸ùK‘$âÞˉšIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/open_setstate.png000066400000000000000000000022271457240071200267700ustar00rootroot00000000000000‰PNG  IHDRÈÈ":9É pHYs  šœIIDATxœíØ¿k”Çñ»óD-Å$A¥\ÈA‹ˆ:Ä!™D n"Å1:uç,.þt±àª»t²BJq°bC=$S‹ô‰S O.é®Ö§WµÛ‹¯×ôÜ÷¹'ù½yîx*øÿ«–ØsèÐñ‰‰öòrç°]ŸŸ;·¸°_ŒÞVÖ§7o>}òdnf¦s8<>>{ûö—““ùÅèmõ²íåå¹™™{SSÃÆÈH~%6‚Z×wÔë¥ñA™îaU«Õf³ùVa#éVQ•JE[¼”îaU*•V«UÑ/£üÇ{QïüµÞßß¿kÿþîß#‹ÑÛJ7lëï?rúôsÃíÛ¿»ukíÿ¦f³é;‘m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHÑ)Ú"E[¤h‹m‘¢-R´EжHy嶪e'Þ8ræÌsÃbqqúêÕWø7ô®µ°v=Zß²å¹S__¿¾øôé ¯ª—ý¹O&'·õõýòøqçðýááÕÕÕ¯®]{ímé­Vëã >8qâû»w;ç;‡†ö>üÙÙ³/¼ª4¬j­öÍ÷¦¦:‡§._Þü—lÙð~[XøéÁƒo¯\iµZëÃá±±/»¤öF£çÍÏÏWþøZü'JïXë¶nÝ:::ºv¼wïÞJ¥~ìØ+ïG/l6ßݽ{~ß¾z½Þh4îܹ³´´ô÷—tkiiizzzíxÇÉ“¿ÎÍ­¿ä-Q;x𽕕µÏ½Ñh¬¬¬t½¤{X«««Ïž=[;n·ÛEQ¬¿ä-QE»Ý^ûÜgggëõîÙ”¾cÓæÍƒ££µM›:‡;~ôèõ¥çìëœ ŽŒÔÊ +}޵çÀ&&V–—;‡+Eqóüù²GlTÛúúN]ºTýó]¦V¯qñâþW[Àkû&J'„¶QIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/roi_getarrayregion.png000066400000000000000000000173651457240071200300170ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ§IDATxœíytUÕÙÆwfF™6§.tBW© "[ìBŠ«v «JK‹Z…6¥aR––É bV ¶‘ÁA"(C˜F3ɽß÷3=>O¼7æÜsïÍó[þ‘½Ý÷œ÷ž¼Ù¼ïy‡mŒB!„B!„B!„B!„B!„¨_ÄÕú“~¿?ŒrˆÈ$.®–ÒÀÍ]»víê>úè£Îá¼yóœÃfÍšÁÇËÊÊ‚\ÍsøðaçðÂ… Îa»ví`}£FœÃ£G:‡‰‰‰°¾iÓ¦Îá¹sç`A‹-œÃ‹/:‡ °nQZZ à;wv/]ºë4øÚ/èÌ™3AnÇÃ4Æ\qÅÎáÙ³gCøíß¿ßÔ–øZRˆ H±„¤X ®l¬æÍ›;‡`3ñÉ'ŸÀÇ7nìîÛ·tìØÑ9lÙ²¥s•••A>ÎÌ—_~ü‚IIIÎ!˜8­Zµ‚õ'NœpÙ¿ ‚HGŽõíÛ·wÁªkذ!¬‡‡Ìfëùóçƒ ù‚µÆ•bcÚ¦¦&|%MÃääÀ'Oú+*\^YD5î¼Â>}úýúו_ùJ­Z·6ÆÄ5jtqïÞs6„A:µ¸R¬ÄNNìÞýÎôéáÈ‘#1MÓÓ›ôìÑD4#ã]XÁ­`ìØ±ßýîwwîÜ æ°¨·¸R¬sçε,)),,|î¹çŽ;Ö¤I“?þØ´nmš6mšœ|ðàAçbpˆ … Àé3Æœ:uÊ9lÛ¶mpyNž<é^¾|Ù9lݺ5¬///wÙ‰ƒ0„ý†üJ^ߨGÎa·nÝ`}II‰s/âùÍ>\ý\ðÄ;uê|}­ ÏŽeŒ9~üxjjê¹sçÐcõ·ŠÕ81±m÷îÆ˜„† 7åå}¿wïÊÂÂcáLD5®¶¾[¶´KMýÉêÕ?Y½:©cG3`À›÷íÙ³]QQ¸äQŠ««øàÁ¬¾}??°s§ùÏ̹sÙÆŒ=zÃáOD+®«C‡U?'$$œ={öôéÓÆ˜ <öØc©©©Îdhc’¿zS ¸¸€9Æ8 äÂñ 0çYB°Ö!M"<†"0á1Æ´iÓÆ9'š“Ÿ ïlmö6 ±‡@^MHj­÷XóçÏ_³f dÿˆúƒÅ¤·ÜrËæÍ›9MÔì¾yOKKÛ³g¼}õë!k®¹ÆM†«ˆR¬+Veeåõ×_ÏÉX"¶qÒ©úÙçó5oÞÜé—U¥Ý?¾OŸ>¼õÖ[Ÿ¥K—.pý€ùMë™ï|ç;Î!8e\+™€ìBæ ü›Îˆ)g(“’’â:tÖßpà ÎáñãÇCv“Á[b ¡ BLà§»¡Ž²ŠŠŠ†¾yóæº¹ðœºK›9zôèüã·ß~»Îî(<¤Nó±>ûì³_üâ¹¹¹uySá uè—ŸŸ?cÆŒ×_½Žï+êWÆ»3ß(..îÒ¥KΤþT’»víÊÊÊZ¾|ù¸q㜠àú˜ T˜ð¡®×çóÁz0–9c îÆþ_|ë!¶6Æ5çWAÔèúë¯wù‰΄¡:p/ÂøÆÑ›Ôä÷ßÉ’%ûÛß<¹»¨<Ëy÷ÝwW¯^=wî\¯Vñ²˜býúõÿüç?gÍšå¡ ÂWé¼ñÆ»víš9s¦·bˆ°Nã½²²Òùª’™˜À‚ùóçOœ8ñ—¿üå‹/¾ À¸žne(»Þ2s‰}“&MœCxÏnÈ.,, .[ß@È7ã׃&Ƙ¢¯çîBö•©î;:a¨ÖDD]áÂ… ‹‹‹ö³Ÿy-ˆ¡XƘ?ÿùÏ>Ÿoüøñ^ "ÂC¤(–1æ¯ýkbbâƒ>èµ " Dbc²²²RRR= DTYŠeŒ™5kVzzúàÁƒ½D¸Â•WèŒxÄÅÅ5nÜØégA9‡ÀC©ªHyä‘G-ZTXX H¨âl$¨Q¯]ð Ù¯ò÷¡Ñœ!ÇäaÀ+ä„0¨#‚ %ù D½@à0¿DÜŽ`„ #FŒøÁ~ൠ¢–Dn™Ã¸qã²³³/^¼¸uëV¯eßšÈU,cÌÃ?üꫯ–——ðÁ^Ë"¾úOa£Gž>}:¤‹ˆÈ'l]“ãââ|>Ÿ3ç Î}àöT`³1Hz衇V­Zõ«_ý P`ÈZç€M]¨ˆç|ð਋+¯¼ÖCåØ1ì»_$ä<bV†ª38€W€ô,î Pk"}Ç pï½÷Î;—Cc"b‰Å2Æ <ø•W^ ÙÔODQ£XƘ~ýú­_¿^Í ¢‚hR,cÌ­·Þúþûï«DäeŠeŒ¹ùæ›wîÜéµ"®þô¡O×… œQpIÀI4¢C!‘ªxHZZÚ‡~˜šš ë!@2íÊl¸i1D¥à‚|}(+â£lÀƒÈÍ̃&qȼNÎm„˜x…üjMôíXƘ’’’>}úìÙ³ÇkAÄ7•ŠeŒ)..8p`^^ž×‚ˆê‰VÅ2Æ=zôxï½÷¼DTC+–1¦  `Ò¤ItÒXäáÊxS±M›6Î#ˆ€akÈ4昖°>>ú裞x≜œœ¡C‡BDÎé„n[†Lc(Â1”€¶0çcAØŠƒT_™Ó¡à¿ÅÇ­Ã3çw~`þCzVȾÔ5'ºw¬|ðÁìÙ³_{í5¯ÿ#˳uëÖŋϟ?ßkAÄÿ#ŠeŒÙ¸qãš5k233½DKŠeŒyûí·ß{ï½gžyÆkA„;ãÝù¦Ø÷U3`вñ–¦ó•q ¸ì±cÇ-ZT^^>eʔɓ'C¾÷Ç‚ -~Qï©Á{çÀлx.mw‚ |â¸GàÀÕø‚tä;ø7!ßÔך˜Ú±,]º´  à©§žòZzM *–1fáÂ…§OŸV3‰MÅ2ÆÌ™3Çï÷«„WĬbc.\˜””¤fžËŠeŒùË_þ’’’rß}÷y-H½#l^¡ßï/**rf .ô06”NÄéMPEEú\ö 3uêÔÙ³g0`ùòå°œ&¾ 8’PEÃ!˜p‘ <pÊØËƒá6Ï“á ·b r}7ÄøŽ`êÔ©ýúõ6l˜×‚Ô#ê…bc~þóŸ6ìî»ïöZúB=ªJ¨*ØW WPË3zô蜜œ²²2¥žÚÆ•b9 Íš5sIÀòåJHÝçXë]ÄÆ>Øž± $3 >|ýúõÓ¦MÛ³g㜰·€R.Ésžq(\ƒ rYy  …;~ÁWfwkNgËT÷;ª5õÅÆr2pàÀ¬¬,.òa¤>*–1æûßÿþÒ¥KÕ ÂõT±Œ1½{÷~íµ×8»W„…ú«XƘ>}úlذ_3 ÷¸2Þzôhã8…%¼˜`7üP:A žy!HPã"‰EÃGà ÏÖúVhÇBöíÛ÷‡?üaéÒ¥^ ÝH±ªaÏž= ,X´h‘ׂD1R¬êÉËË{饗^~ùe¯‰V¤XßÈæÍ›W®\ù /x-HTâÊxwF$âãã[´hät6$ÁÒLNNFᾑۙ/1ˆÀpw]¸Ÿ¡RPPРAƒ¹sçN˜0Á­Í'0Âù\Ô)hÿÄí}ƒw× i¼s~\¼0ö9׎‚—_~yÛ¶mYYY^ eH±Bóâ‹/~úé§Ï=÷œ×‚DR¬±`Á‚S§NMž<ÙkA¢)VMÉÌÌôù|j4RC¤Xß‚9sæ´hÑBFjBˆL± øý~籋ÿú׿֬YãLL[±b…s=D µùêÞ½; ÷õD6p‚¸F®=‰¡c±¡ÔBNs/)°àé§ŸþôÓO—-[Æyá ÌÀä Bæ Ä|8¦tÕUW9‡ìÃ)/P×i€çÏŸ™KøMhÇúÖLŸ>ý†n5j”ׂD4R¬Ú0eÊ”þýû:ÔkA")V-yì±Ç222îºë.¯‰P¤XµgüøñãÆëß¿¿×‚D"®^á;8~¿¿aÆΈ48×LcΗkâE0(A YÀΆ*|B@íÚµ›8qâ²e˪MdÛJ• ÆŸs£!Á bJ|}ÈãoYqàm„±‚W;–[ÆŽ;mÚ´ôôt¯‰,¤Xa`Ô¨QÏ>ûl=¼$‚b…‡¡C‡>ÿüó]ºtñZHAŠ6î¾û5ƒàÊxw¾GŽOJJrÔð™_|ƒµÎ‡åñaæÎ!wË…[€íÏçy€7ï†òŸÀ–go¹å–üüüÛn»- jÈò xÓÍ%ùÁç]àÐð13ðLàÝ=7¨5Ú±ÂLZZÚîÝ»ùW^ßb…Ÿ«¯¾º  Àk)_ZZ—IÖ+¤XV())éÛ·ï–-[¼Ä3¤X¶(..5jÔÆ½Ä\y…ÎvŸÏwüøqgˆ€}" ä™(àWB•»™Pb2ÍPÕ ¸¥\&_áèÑ£<òHnnîøÃÀ õ !×8zõÕW;‡ÀáëshxpG> ´ÖhDzËÁƒ'OžüÆox-H]#ŲÎÞ½{gΜYߊª¥XuÁ®]»²²²þþ÷¿{-HÝ!Ū#¶mÛ¶dÉ’9sæx-HáÊxwšŠqqq‰‰‰Î(Ä ÷ÈPñŒƒi ë¹ûÄd ]‰×ƒõ ¦±1fÛ¶mÎáµ×^ërhð6ÀØ_»v­Ïç›1cF `ßÐWf !ÈsâÄ ç«?ÀÛà4x¤p aڱꔵk×nܸ±>ìK±êšìììíÛ·Ïš5ËkAì"Åò€+Vüîw¿óZ‹H±¼añâÅÅÅÅO>ù¤×‚ØÂ•ñîÌpòûýñññÎüxÉË[ÁÃÓi –,çWÁ»x0uy=¤+q­6€|þùçAä1dMse³³òxÁ‚S¦L™6mZ•ÉűhpÞŸ‡ü‰Ê!ƒ3]¸´ºÖhÇò’?ýéOIIIUNb,!Åò˜§Ÿ~ºk×®cÇŽõZ0#Åòž'Ÿ|òÆoŒ±fR¬ˆ`òäÉßûÞ÷FŒáµ aCŠ)Lš4iĈôZðàÊ+tæ3ÅÇÇ—””8½ˆ@+&CE8ÐÎÊPF8A|Ap3C(ë9«S§NÎ!”ÀsÀ$dÓðûÀ‹|àV­ZUVV¶iÓ¦À Ä|À‰ãt+ð¬9e €GÊAªZ¶öË",Ü{ï½ëÖ­+++û÷¿ÿíµ,®Ð?…Ç Aƒžyæ™›o¾ÙkA\!ÅŠD ðüóÏ_wÝu^ R{¤XJïÞ½_}õÕ0&¡×1á´±*++Æ&dGA8©ËÅ/½hù4Tø5@€Ž1ÆìÛ·Ï9ä¶ R–ššêrúTȦp hè¶yFFƆ n¿ýöªØ<1v_À9¸xñ",ÉÙžØT÷jv¬ˆæšk®Ù±cGϧ¬3¤X‘NçÎ8²–.ÒbEíÛ·ç“Æ")Vàóù’““¹<5’‘bE¥¥¥ééé}ô‘ׂÔW^¡3¤PYY U:à±Çî‰rrÆã 6ï¡C‡`=øhp꽡NÈ2!˜÷àÄ€ghrœ‘‘±}ûö~ýú†|¤ ìjœ¸}‘áúéíXÑDaaá¸q㢢ш+Ê8pàÀã?ž››ëµ !bEùùù¿ýío³³³½$R¬¨dçΙ™™‹/öZoÄ•ñîLßñù|Íš5sVÂ@º'!ÉùXD0¸›¿à=@7,CÙH`É*’ 3.ûc™‹d‚·aæ |§³cÇŽyóæeff>ôÐCU“à¯ð#‡é³Ï>s¹ãW­ÑŽżóÎ;+W®ŒÌ}KŠݬ]»vÆ óæÍóZDŠõdggçååÍž=ÛkA¾†+X¾|ùþýûgÎœéµ ÿÃÕaãÎó®6mÚ´eËçËëgŸ}Ö¹²© U €¥Ì7ã!›Õ‚)Í/ÊÁ½à^`­ƒqÍݤÀøå”xµ )hÜ!,xuØæS§NMIIÉÌ̬šaÿfàÁÿýâ‹/tظ0³gÏ®¨¨˜4i’ׂ#ÅŠ1²²²Çïµ R¬˜cÖ¬Y;w3fŒ·bH±bßÿþ÷ééé#GŽôP)VlòÄOôíÛwðàÁ^ à*¤3qâĪŸ[¶l Û/Äp8Ý ð™ìrøÇ`=½@IŒ¡  ·€xû¹Åër/ Δ7äùBáSp—m÷îÝ?þø]wÝåì _Úð¯ ÖhÇŠeþñôìÙÓ“âD)VŒ“““Ó«W¯äää:¾¯+öYµjU¿~ýÚ·o_—7•bÕ V®\yçw²™kW!g1B^^Þúõëö/¤sp¢>˜Š]ºtÁ3´øÐy0–áo”õœ1Ö½{wçL]ŽÀ€mÎw„°•3&fŒÙ¿?¬ÿ¬u.±‡ ¸;[·n>|¸³ \ÿã?®uHÇmï†Þ>Ú$)ÉÓ´U«&½z5-+3Æ”ïØá_.n¿ýöíÛ·?2cFÓ«® ÌT)¼£Û·‡ñ^®þ)¼e̘žÃ‡›¸8Ðë¸8—Ю]â!á‘N„›^ýúe/\Ø´qc¿1ÎÿF,]޹ݱN~òÉ»³gcÊFŽ,ÏË+;s¦Ñu×5JO‡l óÏœY 8MpP ¸l†ºCÞ;Ûpx¤ƒß²LR¹­2$Â3áTG(‚Ÿ¥ŠËeB[´xxýú…½{†%%%U®ë©S§¸L¨Ö„mÇ*-- ¸ßñ•• ~EEHÉÅR°€c°àÛ^ò-C®gÅ ~h+\0ä‚àCJ±XqA±ªQ”K—*üþªy~!.Ü*VË®]Ó¾:«£ÉM7ctè`è/ID ÜüU)b·(À•b¬[ײ[·Ö_½I|ú|¥Ñе¢~R~ö즧žêгg`Xµ#¾þÓŸ†÷F®Þ¼‡Q™Dšƒ%„B!„B!„B!„B!„B!„B!„B!„B!„"¢P# ÚI±b7¿bµãVb +H±„¤X ®º&/Y²f~øa71ƒv,a)–°‚KXAŠ%¬ ÅVpå6kÖ f222œÃœœ7×Ñ‹v,a)–°‚KXAŠ%¬ ÅVpåò)Ëp óý÷ß V®\éæŽ"ZÐŽ%¬ ÅVb +H±„¤X ®¼BŸÏ3/^ þ‘{î¹fÞzë-72ˆÈD;–°‚KXAŠ%¬ ÅVb +¸ò !2hŒiذ¡sxæÌXÀŽä!C`&77×T"ÐŽ%¬ ÅVb +H±„¤X aŽ6nÜØ9LJJ‚Ü}°²²f¸e ·µŽv,a)–°‚KXAŠ%¬ ÅVpå–””À ø‰à$Vû‘6mÚÀÌåË—afذa0óæ›oÖ\NQ÷hÇVb +H±„¤X R,aW^a«V­`æôéÓÎa‹-ð~ ðŽEEE0“3˜jŒ:t(̬Y³&¨°¢NÑŽ%¬ ÅVb +H±„¤X aÎ mÙ²¥sÈ^!¸¦ºXá¹sç`¦uëÖ0sâÄ ˜4h̬[·%u…v,a)–°‚KXAŠ%¬ ÅVp岋W^^î6iÒpv(w¤aðìÙ³0Ãþ&“1räH˜ÉÎÎ6¢NÐŽ%¬ ÅVb +H±„¤X ®¼Â¦M›Â 4“)++ƒ;v„p$Mu~"߈¯Ì QÙOÌÈÈ€™œœ#, KXAŠ%¬ ÅVb +H±„\y…Í›7>Ãß¡C‡`&¤kiŒ‰‹‹ ¹†J䯸xüCúÑ~3¯¼òŠ®ÑŽ%¬ ÅVb +H±„¤X aÎ -..v¹Mbb"̰ŸØ¡C˜a}IîQóå—_ w­aÏQçb„íX R,a)–°‚KXÁ•ñΖ8ÀF7g®¸â ˜a3œ¾ò… `†Ã>| 'r©ÙwÜ3ï¼óŽAÑŽ%¬ ÅVb +H±„¤X ®¼BÎヾ'Ož„êÔ©̰7ÇÁ>ž.99f ¾dªó¹mIM=>|8̬^½ÚÚ±„¤X R,a)–°‚KXÁ•WÈî)Àõa\€ÅÉw•••Á/kªóO:3ìßq’c—<Ã2³wùàƒÂÌŠ+L=F;–°‚KXAŠ%¬ ÅVb +„¹)ÀÏTTTÀ ûe¥¥¥0Ã1>nÉÞ%_Àþ&©š´á+×óx¢v,a)–°‚KXAŠ%¬ ÅVpårxŽÝ%€=,®õã8`³fÍ`†}@ŽèÕ$ÂÈWæ£ÎáuS—Ê^!¯1cÆÀÌK/½dbíX R,a)–°‚KXAŠ%¬æX!¸KÜŽ†½Âšä‹ò§¸¤‘…áx"Нœ’’3ùùù0Ó­[7˜ácîö%cø˜;íX R,a)–°‚KXAŠ%¬àÊ+äTOpè¸/(û€Üƒ´¨¨f’’’`¦&±9îlÃÙª|eîÃþæ±cÇB^‡}@&†ûØhÇVb +H±„¤X R,aW^!ÈÀÍá*Bv$¹S(гC9ƒ”#Œì©q/Sþg¶mÛf a†ûØð û€œÑÊÑÌ{î¹fÞzë-ñhÇVb +H±„¤X R,aW^aÈV-ì6²¯Äyž59ZüóÏ?‡™öíÛà { |ŒùáÇa†ÏFäS0ºté3ìÍÕ¤¯ß‹K5á°cÌwÞ 37n4†v,a)–°‚KXAŠ%¬ ÅVpår«p|ØWâŸQ“øçrÆ&g~ž8qfØ/ãx"Ç ùd öd9È3Ç7¡àïÅÝoî»ï>˜yýõ×C^Ù*Ú±„¤X R,a)–°‚KXÁ•WÈa>Ï?´k×f8ƒ”½'ö%9ÈqI®ad7–sSÙç ™(kª«sd Ùÿe¯™åá+sÌ‘¯?÷ß?̬\¹2¤„µF;–°‚KXAŠ%¬ ÅVb + OTsØ/3Æ,Y²Ä9äG¹w({sc?ˆ}¥Ö­[à Wí±„ìOqv(Ç.Ù“­I'Ž]Ö${–¯Ì~+{» ÜÓPý~M®S-Ú±„¤X R,a)–°‚KXÁU¬pÙ²e0³víZçðÌ™3°€ý)îÃ9¥ Gô8È^aMÎ=d¿µS§N0õ‡ÑcOïÎ2'''ÃÌ‘#G`&d⮩YÎ-øÚƒ 2áC;–°‚KXAŠ%¬ ÅVsHGĵé!„B!„B!„B!„B!„BˆúÆÿL€ ƒóÌÂIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/roi_getarrayregion_anisotropic.png000066400000000000000000000166621457240071200324300ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœdIDATxœí}pUÕ¹Æ÷IrBHÈäC¾B `ƒE¤àEiÁZˆ·V“‘–6z-)µSìP¥L±-ƒmmé0:u¦S?(ƒÅ•Âm£ÕÑhÕ±µ*-ä–* _‚„€B€ξ,ûÞÝçåf'›³²Ï>çùýµö9ëì½ö9ïYÏzßõ®µ‡B!„B!„B!„B!„B!„B!„rqÄ|Æuݤ·ƒ¤2±XŸí$'Ø•¦L™’“—W={¶9¼òÊ+?~Ãu϶´8Žó«_ýÊ[Ĉp†cÇŽy:Æ×s…êêjïáîÝ»¡Baa¡÷°´´*ìß¿ß{˜••è=0`€÷ðüùóPÿĉÞÜüzÏœ9ã=>|8T8uê”÷ðܹsP¡£££çKÀß~ðàÁP!‘H”^zé°+®0‡¦plÏžý7:ŽsöìYoý“'O:}' a9ŽówÝU6~|û¡CŽãÄ«ªÌ‹Yee±ÜÜÎÍ›Ÿ–ô_züñƒ›6%º»Çéêê2/μçžÇo¾ù¤ú# a8p`Šën\»vóÚµŽãÜ}÷ÝæõŸýlV^^,ƒÿßÿþw8tcÇŽ… º‹ Ï‹ÇãP¡¨¨È{¨ÿyð‘ãÇC…!C†x?úè#ïawwwÏW„ÞÅQÝI^^T8pà€÷°  *äçç{¡uT¿«û¼3gÎä•”<µpá¹Ó§Ç©¨¨0¯}é¥òŠŠ]]„Oƒ?!I!¸ •••K–,1Ëmùù¹®;þŠ+¼uôŸþXz¬ ?dgg{‰DÏ´ÏÑc¦ÜÜÜ*èú6 ^ó;ªƒÑÃ> @ï’H$^8ð•W^ÉþWc–,Y²sçξž§gÖ’%KLštyyù¬#òóósrrŒj ŒÅr]wÈÀ6lðÖ/..†3À8Wwéð#i;ƒ1¦þ ÊÊʼ‡GŽ ¾Z —€F‚š;ÊÔ´4È{¨MÔVÛ.œÁ×°´˜0 1f̶mÛbÝÝ3gÎ|ë­·¦M›6mÚ´üAƒæÎ›8qBßW’Ðc]0úÐÖÖæ=Ôÿ]Ðè›Ã’1¦ îÌë;ª„&9êwýðÃ{¾ ‰ôo_ÅéÓ§¡tHÚ°`ਿ7°u_ÃÒc¬¼¼<×uOœ8qýu×ýíoÛµkWÏgF@ÃzôÑGÿsôès§Oïݹ³   öܹææfÇqbãÇ;G¾¹eËÊ•+½õõo=¸Ùú#ÐÃ9êK‡à‚£ú0põõ«”””@ÝêÝ0D­tÐkÂHÜQ_‹!À9> Få=Ô¶{þüùE·ÝV6qâ#Ï=÷Î;ïÈ—p}gç“kמ8x>ò­o}Ëé;Á{¬ÍkÖ\{ï½%£FÅãñ]99Y':ŽãÆbn²Õš$Áï¾»??¿»¦frMÖö¦¦Sj´˜à†utÇŽÿnlt§¤¤dÙo¬þã“Õ&b•åË—ÿÏï~÷ä“OšC_ÿ  kß¾}R6*ý'Ù»ï¾ g9r¤÷P&ÚÛÛ½‡zæ;„‚!‘ÖJ_·ÚÚwðàÁž¯¨£Þ0ôÖJê¬G–àpèKÀ]€ø®X±b÷îÝëÖ­“ Á=:JЃ‘„Á;‰ ÷Ýw_[[Ûš5kúáZ f K–,I$<ð@ÿ\.`åUºüü|×uÁµ†æF¥}Æ ƒ à'ê8™V:P =c¤+@« .¥>tiWW;ÿ´Ù7‚*2Â|à=4_ËwÞY^^þ£ý¨°°¾7=™¦~ ¦?_ûÚתªª¾÷½ïõçEiXiNCCäI“î¹çž~¾n@ÃòJÛàÁƒ]×…ùp t$"¤†hä%—\¶oßî=„À £äXW€ 3L9ŽsôèQï!º¾)P.íÓ¶¾ÿþûP}Ïž==WгF^9®««»îºë.\èuWÁ™Õ¾0½BÒµµµuuuwÜqG(WOšaAä;Ç ÝcAŸ§+TVVöÜ$ð¼±7Ìá@ÿ䍿Ÿÿü§÷PÇ|ç|`êëFêèt“Úá0½æg>ó™ÆÆÆ¯~õ«:åkôèÑÞC=Çš*“Ð$Õ˜:uêÂ… çÎbhXéÆÄ‰—-[vÓM7…ÛŒ€†åˆÇã±X bB0nÕsì—Òº©É¾@)(:†Ñþx$0pÖ‘3Jë+Â@·R0ôœ™@Èjjjxà©S§Ê+Z¯á§ιPÐ1ì±Ò‡ªªªõë×_~ùåa7ÄqhXiCEEEsssMMMØ ù˜€†å&ãû€ É:‡Ò5A¶¥:½0Ú»iÓ‰~àµéU~o¿ý¶÷~6í¨B¶2Á·¤µbH:´·inª¨¨èwÞ©®®ÎÎΆI-¦0,Ñ«¡ôöX‘'ïÚµKO¶† +òá=L;ªZÔn#¸:U*h1}íµ×&L˜àm ´žV9Öß³þH˜aš››§OŸ®‡z©@ÀË;J-,,ÌÊÊ‚Tcè-t6•žÁ ƒÑ´0Õsð_ÔÉÝpN=R†ñ>œA_êëÕ”Ðè^îZ÷²Ò­¶´´Ì˜1ãÌ™3ÐqB˜Jù~±IÉÇbI6nÜ8gέ¤© +z¼þúë·ß~»^Ÿ’R”BoÇÍÊZoèoõàÄQ«TÐaèÃõ:Pß%1z°30p:yÁwJ¢q:b Xú¯¾úê²eËöîÝk¾}S ×z¡/(¾þÞô,PØcE‰gžyæÁÜ…íÇÇŠ 6lxä‘GÞzë­°Ò+–×ÉÎÎv]·çýwôF.P_'—Ni .¡w£„¬:íÄAÐH'é‚ÃôMÁÄ”N€WôèâE>úè£MMMo¾ù&lG£•vÐÔ_,äê̤ø”ÂðÐCýéOúc¤61Øcyÿy±X þý Ñшc]p·ï¡ÝÃ_MO¦úîË™Áz"BeC‡õ¶¶¶B}¨à»ñš^xgèìì¼ÿþû·nÝúì³Ïšû'F¡ŸÖ ĽtN„$ƒÁ+¥ùÁ~°gÏžuëÖ…Ý>CÃJ]¾ýío?~ü׿þuØ B@)ô޳²²\×…A% e^Ù»w/T€e€z3ëè lõ„.Èʘ1c ìa º£§€|w¯„ꥎâ,\¸°££céÒ¥PÒ­ôœ4R;PA :$ƒ=V*òÍo~³¨¨èÁ »!Á¡a¥óæÍ5jÔO~ò“°rQ”B¯×ÕÕ•••î jßVZê20c£½Bj €Û¨… r ôŠVh•ïC„à„ZA|µÛ8þü)S¦,[¶ÌÌöøú•¾Yh:‹*À/åôâÑ ½‘÷¢®®îšk®ùîw¿vC’ +U¨­­­¯¯_¼xqØ I Ëë@ëì˜îÐ2Dá´V‚·¢E"=5&ZÈ@µr« õuê8\zc˜w¹Ÿ1cFccã­·Þ Ù ú¾›”öÜ$G9³¾aá`°Ç Ÿ«®ºêî»ïž3gNØ I& Ë»áÙ³gõV‘ðçÖÑ)ë lôìô‚zçø»ë_èôTœÒ§t`Ì·;ÑA¦ &üøÇ?þâ¿h¾"è±ô%ÀeÑse0ë¬Gâ¾’þ±À+LÆ·bÅŠo¼1ì†$VhŒ9ò±Ç›5kVØ ±Br²²²² ä:¥§t`¬­3a4=ûÞÕ£{ØaL‹©ïžˆ=§ùjod¨‡G,•——oذaÆŒ žð=cНר€éµ¬ ¦ú.ô "Œ¼‡@aaák¯½öÒNG(…ýMNNÎÖ­[!Ï3ýHŽ:J5|ŸW¾‰^$ “º8Pú!õÐçëü pú@[%+0¢]6ß îÐÒÒò©O}ÊœY?‚L:ÿÔVgô‹!FÿÓÁ³P û•M›6]}õÕI‰@¦84¬þã/ùKmm­ïÜyzP ½ÞJ,K$ }à$j)„N^oïk½$<&]~B-+P¡ªªªç6Àõn3PÁ«)/¼ð­·Þ áJÞ„»Ð+Z¡‚ÞB¾yíùBŸÎÐƒŠ°Çêšššî¼óN=¢JcöXÞà‡ëº±X ò¥ààû|r:j‚EçËŸUÏsCôl+tQz0+⡇ƒ¡º£"@Æ’^ýõyóæµ´´8½Ø›¢JzRHüßn–åè.M祀=–]^|ñÅÅ‹«Ê(hXùÃþ°|ùò7†Ý(…^i3€8ÈŠÞóÆÅ: &+ôZr˜&Ò@õ´ „µ(€^ÿÙT‚W ûÛß>üðï¼òŠ·è”ΖH-à‚he„'Šéõ¨¸Ò>N{,+¬^½zýúõ/¼ðBØ Vòùå/ÙÜÜüÌ3Ï„Ý0I®É]]]®ë‚Ž@«ã1P_?K&Xt´tJODÀŽïó˜µ0Á+àj•q]wÅŠ[¶lùýï¯Ý1Gù¶úŠàWêìP|œ­Ò36ðMêy'½68ì±’ÉøÃ÷Þ{oíÚµa7$|hXIcÑ¢EÇ_µjUØ I ’³`ÕQÑHßÝý¡Ç†‡—:½ØA÷ÊËË¡´A'ú¬h äæ:¼ÄE‹utt¬ZµÊÕâ *ãûÔ¬‡‡{釀/¬ÃÂð[è˜-÷nH,XP\\ü³Ÿý,솤Iè±Î;‹Å`ƒPßÝýÇ`QžžÜ€?–þçA —ž±tgØ ÆQÉL"2ÃóÆÆÆêêêïÿû¹¹¹ÐêÕë0ü×Sïp›:±x÷îÝÞC½lÆû°ØÉQá7Ý)&åÉ<Ì ½(¾ò•¯Lš4iÑ¢Ea7$å a§¾¾~æÌ™ ,»!©Hž¥STTäº.t°0BÔiCÐßj‚¡´ïN/;vì€W`h¬÷«Ñs2Ü…Wß?ÿùÏ×ÕÕÍ›7Ï[tG« t24Ù¶mÛ ¨§ï‚ô÷Cíôhy {¬ \{íµ_ÿú׿üå/‡ÝÔ…†Õg®¾úêÅ‹ßxã:,N„€†åu¸ºººb±Äx|g? ³@§Ã‚zê  S¾S:¾›ÉhÕg¶µµuòäÉ÷ßÿ5×\ã\h -죧SÀÕ;v,T€n=Ó¥µïXׇÉ4ýÓø^¢7°Çê—]vÙêÕ«§L™vC"¤½eäÈ‘O?ý4­ª—ì±¼>]III"‘€õ'°µµvÙ@&tÎ;Dõ€zl „i|߇_ô …eeeëׯ¿ôÒK½Ñ'!Ó!YpÁtÔžc£o \6=ý›k½†Øµ^Ç›”U:”B ÔÔÔ4}úô°%’šœ››‹Å`Ìÿ<í ÿfýǂȖŽ9Á¿_ç?ù.6‡Wtrs{{{NNÎæÍ›Íãìa!NƒÛÔkSá:´ùUzê’¼uŸwÙe—yu€Ð÷A˜IYbÏˇ;vŒ?>ìVD ‘ß 8I3‰ؕ––&%™5ÕhmmÕÓ¤ÿHKÃÚ·oŸö‘~%ý kçÎ555a·"ãI3ÃÚ²eËäÉ“ÃnI/Ãzã7Ì< Ÿ´1¬—_~ùsŸû\Ø­ ÿ"= ëÙgŸMËü#LÖ† æÎv+È¿uÃzâ‰' ؤ‘6¬Ç{ìŽ;î»iHFçcýüç?ßµk×Ê•+ÃnH’¹†õÓŸþ´­­í¡‡ »!éI†ÖÒ¥K‰ÄòåËÃnHÚ’‰i3ßùÎwJJJÒæéË©IÆÖ‚ ª««ïºë®°BüˆW8þüÇ<ìVÞÃjhhX·n]Ø­ ½&†UWW×ÔÔv+H_H}Ú={vsssØ­ }$Å ëÓŸþôŸÿüç°[AúN*Ö•W^¹iÓ¦°[A‘²†õÉO~òÿøGØ­ AIMÃ3fÌž={Ân¹Rа†šQOLORÍ°ŠŠŠôbyÒϤ۔N<okk»àslH’n†ÕÑÑ¡÷Ñ#ýOZ¥Í´··—””èM`Hÿ“>†ÕÚÚZ]]­˜C¢J* Þ¹ÕBºaq«…ô$\ÃâV iKˆ†Å­Ò™° ‹[-¤9¡·ZHúß°¸ÕBFÐφŭ2…þ4,nµ¢yçV "2†Å­¢E4 ‹[-DޤÍp«…(’ê†Å­2{^!·ZÈh,·ZÈtl·Z É7,nµ@'نŭÈÇ$Ѱ¸Õù?’eXÜjüI1,nµ@‹7,nµ@.ÀE·ZHKBžÒáV éJȆŭÒ•0Óf¸ÕBšaq«âC€Á;·Z þôÕ°¸Õé}2,nµ@zKï ‹[->ÐKÃâV ¤oôư¸Õé3¾†Å­Hz6,nµ@Òƒaq«…ŒÅbä[-d2¶ ‹[-d8V ‹[-ài39¹¹c¦Ms§¨¨èh<~éÌ™Žã¸‰DýUWq« üÉî»oÊ—¾túرx<>uêÔ¿þõ¯ŽãTÖÔ hi¹«¶6y-$Æ­Z5ýßp<^áüùóWnÝzý½÷†Ý4>Ic544ÔÖÖ>ÿüóÉ:!‰4É1¬ÜÜÜ[n¹å–[nIÊÙHÃÊÍÍ]ºti}}ýÅŸŠ¤ I0¬Ã‡ÿ⿸øót"x¸!–•U<|ø° ¼/”–vr‘ ¹˜pÃøY³~ø|W׿.+kåÍ7Ùµë¢F!„B!„B!„B!„B!„B!„B!„B!„B!„T'ø6FaáºnØMX,z¿TÄÈ@Êâ-‡ö{’ÞаˆhXÄ 4,b± ‹X†E¬@Ã"V a+аˆhXÄ 4,b± ‹X†E¬@Ã"V a+аˆhXÄ 4,b± ‹X†E¬@Ã"V a+аˆhXÄ 4,b± ‹X†E¬@Ã"V a+аˆhXÄ 4,b± ‹X†E¬@Ã"V a+аˆhXÄ 4,b± ‹X†E¬@Ã"V a+аˆhXÄ 4,b± ‹X†E¬@Ã"V a+аˆhXÄ 4,b± ‹X†E¬@Ã"V a+аˆhXÄ 4,b± ‹X†E¬@Ã"V a+аˆhXÄ 4,b± ‹X†E¬v‚ðÄO˜ÂSO=e yyy¦ÐÙÙi C‡5…#GŽ˜Â™3gLaðàÁ¦“óñí=zÔòóóM!77×NŸ>m Ï?ÿ|rï"½aE¬ »}ÆuÝU«V™òÛo¿m ûöí3…xþ;}øá‡¦ÐÝÝm ………¦ R(ˆJ’ÞÀ‹X†E¬I) «Ê+æZ¢•¤gØc+аˆ"Ù±Ÿ;wÎ$Abž"Žï¿ÿ¾)ˆ'*&ê&¯ˆw)—œ‘]SYÎö…/|Áž{ÜTšÁ‹X†E¬I)ÁÒ3z¢’•••¦ ¢¦Ã¡¦ 9€RGDöüùó¦`œÊ¶¶68 ¹ 챈hXÄ ‘”BÑ)™õ“QÉÖÖVS·N²×EÝD7%[FêÈ%¤Ž9³äçˆ Ó=¼ 챈hXÄ ‘”BÑ»˜‚h™LŠÞ‰ŠnJN©xvrB>½DÌÌ9ŠW(ËË"·Ì¡`E¬@Ã"Vˆ¤Šï¦5QÞ2dˆ)H⨼%ê&oÉúiáƒ>0‘<£¤RS 2{ØØØh ²P;“aE¬@Ã"Vˆ¤J¾¨d~êÜqß²³³MA¯¾—u’6#é¦ò)9 Êd¢HÅ!•·ˆÃ‹X‚†E¬I)-“Uó"…"ŽâÊC‰yJ"ͱcÇLA\?‰¯J¤ô’K.1ãê¤SÑDI™3gŽ)<ýôÓï1ê°Ç"V a+DR Eï$J)Â$1OI¤”)BÑMÑ;Y³/¯èýgŒþÊô¢( dŸÊì¤4&“aE¬@Ã"Vˆ¤J§8q⑉'*)š(Ÿ’Ê:MTr`DE%Í EøÄ=M”µ\­¯¯7…¦¦¦@7aØc+аˆ")…2Ç'¾ýû÷›‚–K‘9yETLtMäL 2{h"®zËí?Êã¤y{,b±B$¥P¤2Ù'‰4ÀM”É>>QIqßdÿI­q1b„)˜…ŠòYÑJíŠç(☰Ç"V a+DR õN/"Câúɾܢw"—RYoO*‹2$d*3Œf*PÔMâ®2ó('‘ ­Dbo»í6SX»vm_n4°Ç"V a+DR %*i¢²·Œ8ŒÃ† 3Q(qýdáðáÃMA¼KQ@I}eriY¹/W‡Q :~›9°Ç"V a+DR %&©WJÜRB’Ø)•EeROôN\Hýœ_sf½TRœAq!eoðÙ³g›ÂK/½Ô§[Ž챈hXÄ ‘”BŽ"§ŸE(R%Sxâñé=·e-†YVÕ;Õò–DbeI£–Ú´‡=± ‹X!’R(Þœ~z ÌŠ&> „4{x´“®,rf–󋞊ê I«´C*W¼ýöÛMaõêÕ½¹åÈÁ‹X†E¬I)OM„I¯|×2$oÉÌÞxMÞ’Ê’Aº}ûvÇqªªªÌ¡DAi <í×{Zu“®°Ç"V a+DR %æ)Z#¹ ¢€’A*›ˆŠ i‡NR_ô"AIÈ1ºyøða¨ (ˆW(î§´S?!ñúë¯7…_|Ñï¾£{,b±B$¥PEDG¦E%%)TÞ’à¤V(Ñ5íÐI€´´´ÔqœC‡™C™õ“‚4F"¥:qT”Zr_e7›4ƒ=± ‹X!’R¨sZDE˜ôvÙ²ÆaïÞ½¦PQQa " ²ÿÀ¦ 90f Fee¥9™Ó‰:ò™ÓáÓJ*ºœf›x³Ç"V a+DR %§EÔG„I”E’6µ'±S‰RФÊC+DÎÄO4^¡,¦…P ò¬CA.$Òñ•{76=`E¬@Ã"Vˆ¤ŠÇ'‚"aÆòòrSe…•”O‰/©y/ÑT/SY/¦³‰øŠ.ËI¤²h·~ª”Èñ¬Y³Láå—_îñkHiØc+аˆ")…"1":·Ô+%.*›Ìˆ8Ê¡œPÄQNrST‰W(š«êŒÒ*‰‹Êy$áGTXïGöXÄ 4,b…XØ è3ÞgC¬Y³ÆÄÉ÷P²CEæÄ#aõÑûψT™ˆ¨¸–úÉzO6›•ÊâŠæ òq¹…›nºIWKqØc+Dìà\èi6™@äz,B!„B!„B!„B!„B!„’iü/©мÍ9¦ IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/roi_getarrayregion_halfpx.png000066400000000000000000000173701457240071200313550ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœªIDATxœímtTÕÕÇO2ä„j) H”´ •b]-±VPÔ‚`ECÐ*P° B¡5´@ ! )Z›²¨ +å¡’U0P ˆ Š‘XAAÊ[ÁðVJ3IÈÌóaú¤—ÿŽ3×¹srçåÿûÄ9œ¹wÏesfï»_ŽR„B!„B!„B!„B!„B!$ºˆ ø“'ˆrÐ$&&@ icå®=zô0³²²ŒÃ%K–‡íÚµƒ;NWSJýë_ÿ2/_¾lvîÜÖÇÇLJ§N2Û·oëÛ¶mkÖÖÖ‚Ž;‡õõõÆ¡Ãá€õp‹«W¯Â¸E÷îÝÆ†XߦÍuÿ@.\ðq;)0<@¥ÔW¿úUãðâÅ‹Æ!üUVVª@‰ ø“„ø€ŠE´ÈOa\bâÓkÖ¼¦ÔÔ;Œó 55uë×I0Þ¢Xm““oMOL©ûžzªy2&6ö¶lq®^Ý<ħŸ~ ×IHH0> nºé&ã099Ù8ŒÅí¶©©ÉÇÇ¥såÊßìСƒq&N§N`ýÙ³gCéßÀA¤ªª*Xÿµ¯}Í8«...ÖÃC–fë¥K—| å&PãÝãi¯Ô•3gš'bE?‘ü?Vm¬‘#G0 (¢HªbõìÙ3//ïž{î Š4$b°ôËËÚµk'NœX/,ÍA±”RcÇŽ---=¤Ôé \Ž„?(V£Ëu±ªjM—.¯[×»K—ºk×>¼T©gÜ}kjj¼ËŽ?nü8DJ„ ÀéSJ;wÎ8¼ñÆ} öïÿû:9ï|å+°Þår‡Ò‰ƒ0„ýJø•r|£ÔÔTã0%%Ö×ÕÕ‡ð"^¾Ù‡+H?<ñ›o¾Ù÷ú€ D±œµµ/?òȱS§æ>ýt©SÏ_¸°º¤D)uÓ¤I£326nÜN,‰BÔÐÚÏ?¿A©3Ö?ùìÙ3ž9xP9%%%>úhRRRp¥$aGðC:üãŸxâ ØrI´¡%Vø‡?üaܸqÔ­hÆ’WØ¥K—¤¤$§ÓÙ¥K¥Ôùóç›ÿjáÂ…UUUF[24”R]»v5÷æ<ãX!¯s^JÖ:¤©@„G‰ Dx”R7Üpƒq1%™üy/`kKo{äÈ«ñ+@ÀhÌn¸ýöÛeøD Ëét¦§§ïÛ·Oß-HÈ¢7ëÂ… C‡Ýq}v ‰´'ú>}úG?úQEE…î‘¢52H?ž••µ}ûöV¸ ,y…µµµõõõ.—Ë[#AcÚÝæÍ›WQQ‘™™Ù< >Ë-·Ü×o޵¸^Ò§Oãœ2Y+™€Ò+„ÌAˆ¨ÈÄ”À‰S"Ó­[7ãðäÉ“°¾_¿~ÆáCœjÉM†Z )!¤@ˆ üt+´^Îûž={^xá…’’’V»#±‘V-¦øè£–/_^\\Üš7%¶ÐÚU:[·n---]ºti+ß—´26”•••½óÎ;/¾øbëßš´–Œ÷øøx‡Ãáp8¼‰GO€X¡ÑܰaCÛ¶móóósss›'9ׇÄddrÜêzÝn7¬cYfŒÁÁØÿç?ÿ ë!¶¶Œk™_Q£¾}û‡ò‰΄u>à^€wbÛ V׬YSYYiT,IØY ½råÊsçÎMŸ>ÝFˆ&l.±õÕW§Nj¯$èØß»¡¨¨())é'?ù‰Ý‚`bÕxmÓ¦×x‡÷ÔÌ$i^0sæÌÂÂÂÜÜÜ×_ݸŒkßéVJdÁ[fYbŸ˜˜h‚üJØÂŸþ¹o¤õ ø}3€q ôÐÄ@)U]]mBö•jé; b±‚ý;–—œœœ^½z1ÂnAHpÅRJ|ç;ß2dˆÝ‚ BŠ¥”ÊÍÍ}àî½÷^»!V -ÅRJ͘1###ã®»î²[b‰ ½i "?ÿùÏ—-[ær¹d ,)V\\œÃáˆõ†>ÀÉ‚s^ÅX‘òÐC•••UWWïß¿¿yªd6Ä”Àk“.,ÝXð ¡Jšó*áx‚„­d 2Àà+Ët(¸äoÉãÖá™ËÓÈÁü‡ô,¿}©Íö;–—µk×îܹ3//ÏnAȈÅRJ­ZµêèÑ£999v B”Š$ÅRJ­Zµªºº:;;ÛnAHd)–Rª¸¸¸±±1++ËnA¢KÆû•+W¼¯Œ! LQi¼ƒ¥é=7Åd\ÁYÃãµ…sssçÏŸŸ‘‘±iÓ&ãßÊþX¡%_”Ã{jðä!gð.^–6€;Áyâ¼Iÿ®&/xíÚ5Xc~ßÔL¤íX^òòòzôèñøãÛ-Hô™Š¥”ÊÉɹýöÛy仉R"V±”Rùùù `3[ˆdÅRJ=ûì³>ø ›A´>®XJ©éÓ§9’Í Z«^accc}}½×+/\$èa¬D:‘Lo‚*(Ò—e?pÁæ“5Ÿzê©5kÖTUU}ôÑGÆà4É ‚# U42¤Y$œ2éåÁˆÀÈ6Ï“‘A*ßUtA<7òw,/O<ñļyóî¼óN»‰¢E±”RC‡-**êÝ»·Ý‚DQ¤XJ©{ï½wåÊ•ALÀ%_Dt)–R*==}ýúõò-? .–Œ÷›nº)))Éåry# âËWV ÀÎ! `­Cv‘4öÁö„ˆMs2Sÿþý?ýôÓ€ñ.¶àP !KòÁœ—Æ8œ)”'Ž@ RdÇ/øÊÒÀZ³ãEþLÔíX^úôé³oß>ˆý‘ ¥Š¥”JMMýÇ?þa·Kô*–ÛíNKK3¶¢$A$zK)åt: ´sçN»‰@,ïǯ­­­©©9~ü¸­Wá%¯´Í>lÊô&xï ¥òìq0]Á¸–ç‹8ŽK—.edd¼ÿþû÷ÝwtÃR"Ìïiçðâ[ÚÎÐaË÷SŸ[^æoÒ€3QÀ–—±„€‰êËËéÓ§Ç_VVf· K)¥Nœ8‘½mÛ6»‰¨XÿáСCÓ¦MÛ²e‹Ý‚DT¬ÿ²sçÎ °ÑHPïÞ A§¢¢"11±´´tÔ¨QvËÞó L8´†²~œ¦C‡Á(›ŸEÖCúoÉ÷앚šª”:räÈ–-[þüç?Ϙ1Ãx ‹ùOÒÍ?T †O@y!HP“E8 ’l /Äžçü)l-[¶lݺµ  ÀnAÂ*VËlÚ´iÏž=¿ùÍoì$\¡b}!ëÖ­ûì³Ï¸o˯¼òJuuunn®Ý‚„–Œ÷äää„„„ÄÄDohBžØaD’`ivíÚ…»>"¶³¼ Äd #»ëÂä*MMM………¹¹¹ÙÙÙ………`kËo¼ñFãPõC ä?Éö¾¾»ëú5Þe~\¼ îXþ)((èСÃ3Ï|ø<`· ¡N0Kì!•²ä z DÌç¶ÛnƒàUAˆFÖ¨À '±ô"!µ|:%¼$oLi„ «V­º|ùrEE¬‡o$ƒN0‰~2™ƒ’1¥ž={‡Ò†S^À¯ù­À t Œ3fíÚµN§“iÍ_ $333//¯_¿~v ¢P±gøðá/½ôR¯^½ì$¡bYâþûï_±b…ìŠK,ÙXMMMn·ÛãñxA}Ñ‘$^d®˜Æ2_ LKh7%&P%(~ ØeÑ |Ìï‰#=ôPEEÅÈ‘#¡Fµd;ƒA°cÇŽÁzHð‚˜’¼>XßòAVä{uïÞ] îXA`РAo¾ù¦lƒÍP±‚Czzúßþö7Ù&$j¡bþýû9rÄn)B*VÐp»Ý}úôòî¨Å’ñÞ¾}ûøøøøøxï ex éPpTŸÖº<,lOxï,»åÂ-Àö—çy€7ò+ñ*ly)°Óé¼ë®»öíÛçmvê·|ì}Y’ïû°qùË >~éÒ¥“'OV å)à‡~ýë_7eú\_ö†‡w bГ;–v***þò—¿¼ôÒKv ÒªP±ZƒÍ›7oݺuáÂ…v ÒzP±Z‰õë×ïÙ³gÖ¬Yv ÒJP±Z×_ýĉ¿øÅ/ì¤5°d¼ÇÅÅÅÆÆ:¯ÍWøÐïJŒƒi ëeéÄd ]I®ëLc¥ÔŽ;ŒC89LöoŒ}¥Ô‹/¾ø³ŸýìÇ?þñ¢E‹”øÊRBòÀ‰²É1x2 )hÄì îX­Í’%Kššš²³³íD/T,X¼xqÇŽ'Mšd· ¡bÙC~~~JJÊ„ ìDT,Û˜={vZZÚ“O>i· Z°d¼744¸Ýîk×®yS ¹^òÊέ`HÊBd0-Á’•ùUð.L]¹Ò•d­6¸#'Nœð!Ö´<"NTœ9sæÒ¥K›šš6lØ ZŠ @ƒ+ðäyˆ¾Ÿ˜9dP­.K«†;–ÍL™2eĈ?øÁì$ÈP±ìçé§Ÿ7nÜÀí$˜°wCH0zôèuëÖÕÖÖ~øá‡v˸c… #GŽ|î¹ç¼Éò+„©¢DHÇo™,÷|¿>Ž349>pà@QQQii騱cUKGª@ѽL܃¾Èp}H´w¬0cûöí+V¬X¾|¹Ý‚øŠ~”——¿ñÆK–,±[_P±Â’·Þz«¼¼¼  ÀnA¾*V¸òÆoìÝ»wΜ9v Ò2–Œ÷ºººÆÆÆ††o„\ ÝJ&!)ó±ˆ`ÈnR`ü‚÷ OŽ€l$°d•¿ 3YöƲ,’ñ݆YF`à+€óûßÿ~âĉS¦LÉËËó΀¿")8LG5eǯ€áŽÞ,[¶¬¦¦æW¿ú•Ý‚ T¬°§¨¨Èãñ„Z3*V$PXX˜œœœ••e· ÿ…Š!ÌŸ??%%eôèÑv ò,ï)));vlllô¦:ùÎÌÿÆ7¾‡ü-iº‚7oÆå{m°mÁ”–•à^È^`òt?0~åqà @ šìæûÀD8¡$++«¤¤$33sݺuÞ™à|A™0ܱ"ŠY³f}ÿûß>|¸Ý‚P±"ŽiÓ¦=üðÃ÷ß¿½bP±"É“'3æî»ï¶QönˆLÆÿ§?ýéêÕ«»ví²EîXË“O>9gΜ¾}ûÚrwK;ÖäÉ“ÓÒÒ®^½êu^~úÓŸÿb82Ý È3ÙÁÍ„ø†Œ?Àzð‰ $F‰‹<nñpZ•ÈÇ’~(„\ÀGƒ3å•ð|¡ðIzÀ{ï½·bÅŠ¿þõ¯Í¾´ÿÃ+Â)))ùáØúEÕT¬ÈgåÊ•£F â;*3øSØ©[·óJÅvîÓ®]LLLlçÎJ)§RAÛIIP)..ž4iÒÿnØ ®iã Þ9ÐFQ¬¶ÉÉ“7lxW©„aÃIIm<ž„”¥Ô¦˜˜LÑΕ„Ëœ™¹üüy£ÕÖÖívmÞìö—°(V\bbr·n+Õù›ßœ7oÞ¹sç–.]ëpÌ;}úùçŸo^@ÊD}0o¹åXà;CK:Æ2t’„Àz™1vÛm·‡`êÊ ˜2òŽÒIMM5+++a½ï7YbQ,£»36=}à¨Q«W}šñkÖ|ºcDZwßmñúS§NUB+Šp»Ý={ölF#V_öêÕkРAwÞygLLLߘ˜†Çkþ«~ýúWú}; ­Kù?Þˆlñ޻ߌSØrdF(lð¾C¶q‡˜±ß;Bý–ß¾)°£Èê.X`|[qkjê}Ó¦]>w®¢¢âäÉ“A`Q,gmíÑmÛÖ?úèÄM›ŒóõÍG¤¥¥Áu ‚#JœL Åøýé„¶i~×Ë-¶ß%~îe[eØrà—QVõÀ)ùÈŸZ0ûŒ<òÎ;æåy®ÿG¹töìá>¸xîœw(s-&Åjt¹–=öØ«OÿëÊ222‚$ >»Š‹wÃÿvé. þ~-P±ˆüä]ø@¾Å!‘‡ßÌB!„B!„B!„B!„B!„B!„B!„B!„B!Ñ Û_ØÐƈŠñXù'fG?¢*Ñ‹hŠE´`éÈyË!C¬\D ܱˆ¨XD T,¢*Ñ‹hÁêA˜@YY™q8tèÐà^Ÿ„ ܱˆ¨XD T,¢*Ñ‹hÁ’W(Á‡q8wî\XŸŸoåŽ$\àŽE´@Å"Z b-P±ˆ¨XD –¼BYtÖÔÔäc¨”š={6Ì<ÿüóVd ¡ w,¢*Ñ‹hŠE´@Å"Z°ä¶iƒoll4].,¸zõ*Ì̘1f/^lE* pÇ"Z b-P±ˆ¨XD T,¢K^aBBÌÄÆ^§©qqq°RL•Rõõõ03gΘY°`A€"›àŽE´@Å"Z b-P±ˆ¨XD –¼B·Û 3×®]3Û¶m d)"8’J©ÄÄD˜‘Y¦2•„ܱˆ¨XD T,¢*Ñ‹hÁÒy…Û¶mƒÉK—.‡rô ¥k)#Œr¬X\´h‘OyÉ—Æãñ|^!w,¢*Ñ‹hŠE´@Å"Z°änß¾&ëêêŒCéÊÈ Ì •Ÿô¥·aJ¥ÔÂ… Qhòe WHB*Ñ‹hŠE´@Å"Z°äÂé„JõöîÝë{j©ÿŒ¬=Œ—w‡§Ó 3²ìqþüùŠ˜†^! 9¨XD T,¢*Ñ‹h!È^!¸f»wfPÆøäŒDÆ¥ÿ"=Ph‘ª˜wêz…$ä b-P±ˆ¨XD T,¢KÝfdb'8kÒ/“ù¢22(½B”‡b˜éc#ï5oÞ<¿3$¸c-P±ˆ¨XD T,¢*Ñ‚%¯P&‚#&+%W®\éßÉ^¦2†%=>铚ùT~~>ÌÌ;W‘/ w,¢*Ñ‹hŠE´`Éx—–/˜ó2€“œœ 3ÒÀ—F·L ,­ÏLz t¦OŸ3/¼ð‚">áŽE´@Å"Z b-P±ˆ¨XD Aö Á}“Vuu5ÌÈpMRRÌHo®¡¡Á¯xòSfi†ò:òP;yð]”ËhŠE´@Å"Z b-P±ˆ,y…Ò5ƒžŽ²>Ìårù½¬t6åà¤ÕRAX»ví`FF姤(UJyž}öY˜yî¹çTËhŠE´@Å"Z b-P±ˆ,y…2±\*évêÔÉïE$2~'óEÍÌÈ#dþª™13 H¢¼Ýw,¢*Ñ‹hŠE´@Å"Z°äJg BoÒ+4SEh¦i½ŒßIïRzs²ÒPÞKúwfªÍäÀLnn®ŠP¸c-P±ˆ¨XD T,¢*Ñ‚%¯P6“ÏŒgæ9é9Êh\#}R3¨ô7eÖ«™{I¯PÊÁ~"w,¢*Ñ‹hŠE´@Å"Z°äÊ¢<@Öß™9 ÎL_P‰\#ýM8 ]µä»IÿNFåÉ ²CŽ™ž¨Ræ™3gÂ̯ýk†pÇ"Z b-P±ˆ¨XD T,¢K^¡tj`F.0“±)?%ëÍø’2[ÕÌY.\ð+¼NMM ÌÈÞªò:f*³³³aæ·¿ý­ y¸c-P±ˆ¨XD T,¢*Ñ‚ÿ Ï/Âãñlܸ/w½k¶k×.¿×‘15éÍÉšA4ó)ésɨŸÌ•ÑÃÀòW¥(×Èïe¦ÓÎâÅ‹•<™àáŽE´@Å"Z b-P±ˆ¨XD –b…҃à ÌdQʘšŒšñå•ÍÔú™é8*呱K3^ª¼—™zIYç(ÉÉÉ™ÂÂB¿ŸÒ w,¢*Ñ‹hŠE´@Å"Zr)¸0²ŽOúnÒç’—•–ß’F¥ÔåË—aÆLüNz©Ò›“3²‚RÎÈóÍDÍdáJ/5??fæÎ«ZîXD T,¢*Ñ‹hŠE´`É+ô{L¼ô¹Ìœa&Êf&¯ÒL×ù)›3“A*ý23}lä7•3fºèÈo*ó`[9žÈ‹hŠE´@Å"Z b-P±ˆ,ÕÊIpñÞÿ}X }%y¼…ô¥ïf¦›hûöíaFúSfòNý6ÕiñSRžÀ"ƒrŒBJŸT>1¿ÏgðàÁRÖ’ЂŠE´@Å"Z b-P±ˆ,Å ¥kN„ŒXIGflš‰'J?H"¯#ã€ò+H™eüÎLÔÏÌi‰òiÈð«DvÈ1Sù(½BùÝwßõ{kópÇ"Z b-P±ˆ¨XD Aé#à!„B!„B!„B!„B!„B‰6þÄ\uò@މ¾IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/roi_getarrayregion_img_trans.png000066400000000000000000000316521457240071200320550ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ IDATxœí{TÕõïW¿æÙ=o¢(&5‰IÅTâ¯R‰ñeýJZ!æå+1bP4! Qo"ñ ‚ of`€A/H@A4ñW÷ŠZ©RQD†æÑ=3ýîsÿX·W-öÞ§g˜™3Ý̬ÏÔa÷9§Ïôùžµ×Z{í}AAAAAAAAAAAAAAAAAAAAAAAAAAAè®l_À°bYm»\£ëof¼Ù¾€áæ›ßü&nÈDaN0ê„Eüõ¯Å T˜ÈkhE²,‹ÌÕu×]Gí“'O1`CÍ(;vÌî£É“'O˜0DaCÄèA¢Y¶l™òÑw¿û]8uê”(l0ŒaY–5fÌÜž={6µ»ÝnÜH¥RÊ!Ó¦M€ãÇ‹6ÜÙ¾€áã¾ûî»ï¾ûì>mmm}÷ÝwqûÔ©Sü#¿ßï÷û­4Î^åHaT<…–eýýï§ÿþþ÷¿€G}´¶¶–[ZZh»°°°ªª ·?ŽçŸ>nþĆe`´t…ª æÍ›‡ÝßÊ•+ù………ÐÖÖ“&MÒÏðõ¯Õ&NXF‹°–.]zÇw?ºõÖ[+**þð‡??:uªÒB6lìØ±çwH&ÌÄÈÿ-,Ë"qÜ{ï½0sæL` R¨¨¨ í|7¸¹jnnÆšš °àðáí­­¸- ƒÑ),ä±Ç»ýöÛq›„ÕÞÞN;466Ò6 ‹Cª€Ã‡Ó¶( FOW¨ðØcA:‰5wî\ã>¿øÅ/pã‰'ž0î€Ácee¥ÒN‚ÍNØÿƒ-ËòzÿÿÃóôÓO{<ÜFa!ÅÅŸq×]w‘ÅBÁ£ø!Hii)nôôô@<€@ @;æÞyçeò]+™LBZ(© ž~úiܸ馛ôcѰÅãqÌ\ªŸÏg÷½ÕÕÕ0Ê Øÿ ‹…Ï=÷nôôôpa% Úîîî€9sæp¢MB"‘Èúõëé<¸1vìXÚëì‹/¾ m·ÛMÛV؈ýÃÀ²,²+óçϧv|úé§pÁª )..ž5kn+ ÇC'䠇øQRRB¢$(,,üì³Ïp{ä)l´t…hT¸}‚´ªpcâĉ`Ó-Z´ºººhDˆT…Üyçpº^IUÐÜÜŒ§åºDÐÍÏÏÏy™°‘ó—(ps÷ß?n¬^½Ò·„(,$âbWWmß}÷Ý´M}%:R°xñb.,ê( ½½¯Šùùù¸ñÑGáÆPØYÿØaYÖ¹çž ííí¤*H iooÇ0«Šk‚‡x$,ªƒ¸çž{¸F€/¿ü6lØ ¨Š¶Ï=÷\ú"ÆðÉ'ŸàÆÙ«°‘ßVTTƒÁ’’¥o3¦FS©÷~ˆP(„zQ <óÌ3¨ ÜHˆtr~§7lØ€7Þx£ñð{|òIã§x*˲pƒTçœsnäZ&,W®c±, ‹Y,žeÀ® ½xÞµÑ]A£‚»ñЧO.y]===ü—••)g¸æškø\Í–e-_¾NO|p ŠÓÔ”öX,Ì5̺ÂFš°HU0gÎÜèîîÖ……¸\.ìãøà½Uuu5õz$ Þ+ñ|:wç1Å …HUpº4£Ñ(éž„Å'kôôô¬X±‚þj§ò2Þ£°p8L1A¶6*ºB¿ß·ßçó)ª‚tçÕÓÓSTT¤ˆ9OT*Ô8TÃo-%N€±“¼F]]^Õ-·Üb<ùm·Ý%%%?ü0¶ðRiráyø‰ š½^o¶2a#JX–eÕÔÔäååñ{ ¬®!'“I]@Ú!»ê õyOÄm4*äÅë×F#‘·jĪU«pãæ›oÆ ž²€‡zH^ йâ‘ýf'lDu…(,ÜÆ’´F$,`Îu"‘P*õV2™¤QšÐ¸Ö„B!.,ʸ¢¶Ðhñ@g_óòò”¯ƒÓ»à_þò—´Í¿£‡††>ÐÉ]4—ËE=5yd·hÊ¤Ó QKý'·ÛMüS%»­à÷û3lj¼›ãy|ÐÞÞN6ƒðù|}N|mhh€3fèªÂv”È’%KøQ(4Éùùù<«‚TVVb¿ét9¨“–•…ÙˆDvÁIôh¨‚ ž}öYãþîñÙ8Üæ¨ËcÇŽ‘¹RTtE½!wËÆO8·R'OžÄ‰'’Å"{éðçñdÙ¼6¬:ä*áÞ$æZáto t¨&lPë– ^˜3§9£ËÐI7Ž: û¹€8è¬ðû ,5oœ¿J æ>þøc;7 Ûy|Gªâ—d<|þüùh‡pá eHOýÀhNW•Ûíæ‘©Ây燆mh° ë™PhNUÕÜÿ{ÅO~’SÚBð]³f µð—¢6nhÂ`,óûýÉd’WÅd@ñÇiú—"Pújc¿Ltww———ã æÿ‘ @"‘ 7Ÿ(--Å1J <…=9z½.š2T]ä~&ºüøhw7<øÁY×_LCt„†q‚Á êôdWVVò™¨ÜlÄb1ÜÿÖüÆðŠÂ?þ7¸kŽ4µ¡úc±O–òÞª··—,³Ì»Œd2I÷Œ„Å#ùââb²p\X”äaÞE”> ‹üHûsx_aá†×ë¥+ᢰãg?û Ë;~|á÷¿ï™8±kÁÚsåÊ•º° ]§V6kÂ*,+{ôØ1RÕªU«fÏžÇãñøÜwß}öª«ºØC?œpaá¸[SSuæúÀÛ6_¯Þ€p8LwWnð;Ä ªÈðtvv’°xšǹñœº° •Jdzyܪg€u»¿}ðÁ⫯®Zå.* üæ7¤-ì¯q8’Ÿ™Oq¹\¸èá Ug*¬ž}öíõë¾óþ÷È‘#555‰DÂçóy½Þ”eE#‘D"RÀÆÀŽÝ½{÷Œ30ù9cÆŒT*eYV2™\ºti"‘p¹\‰D"ãÀìJQQ=ýаh›ÄÄ»3rºËËËÂB£ˆ&JÒÛÛ‹éá'b,'MÇãq]Xã.¾øªGùÛ·¿ =ô×w hþ7 ‹+éÃ?Va¹½Þ?½û.ïõ®¿þúŸüä'7ÜpÃ3¡ÐÜqã\©”×ëõù|(µ3Ýر?þñßzë-ŸÏ———7~üx·Ûír¹<OOO—áóù<O"‘@EbÇGÄb±d2Çc±íC{â]¤C¡~FQÜøkÐxT</))éêêJ$¨c‰lÙ²%+Úòx<Æú;|ìB¡F3ÃÃ"ÔŠ>VƒTWW£òô\%œ> !U!™‹(urôèQÞγ¾–eáIHÓ»_yåg;v\òï?ñÄ{öìÁ¾¯zúô=üðúÿú/Ü'™L>òÈ#¸MI/Θ+L‚tþôé·¿ø"Eˆ¸šÔ0k˲,¬5ðx<¿þõ¯©]I‡Júãw˜&EÀmËf|>îÀsªÝ}ù===(å@  Ï“€sÎ9çË/¿ä]9¿TÔe,ÿ+ÜÑñýû».¿|Ï/‰û(ªR@ãd·Ðá ÔNí 7¤Øßœmq”j¯×‹6Æ®lÆåraª0èFoÝEŽýa»]í2ùÎ<”£íP(„'QrýX«ƒ»UWWëƒÊþá«W¯^±bÅÿ™9ó~øüw¾S=}ú•óç×_{-õËÜŽRȹtéR¼fª‹%¬”ö$e][PWWG¿š±:¯··}¦x<ÎÍ> Å„B¡d2i×Oá]´'ò·`ðf'‘d2iYVss3wΔcåÀèúkkk·lÙòÞ{ïù½Þ%W\ñó^p¹\õ×^ËO¥RT>¯ŸüÉ'Ÿ{Æ? #ßP(4„%YV:ª-Ê‹–––òr¢¥¥¥¢¢BOà\V¼‹.—ËøSRËîQƦTžÐw:tßÃC‹ÆpP n·ÛÎ é'çR£°4“ªèÓÖÖV¯×›ŸŸo·…btí¬ìàq¶4yìVWW¦•Z6ô½PEEEJ‰À{Æoï5Ha¼s¤[މVrVt¦M›ÆKù”ùäêQú[©ÎC£ElݺuóæÍ¨*ÝÈá©<.ªª* §‰ÔCk®`jÞЖ2ŒƒtvvÚU!C_KdÛ¹çeŒ j±ªª SùÊÝíKCÃá°¾Œ§¸¸õJ¥È«««Û²eËë¯¿ŽŠooo×O‚^¹]Å¢^?T Çd '´EÞî­·ÞšyOnlx¢Ë˜,íé類Ș¯Ç¡¼Ó\…h~ð>õööêyT>)Ín$ÀXYJVÓívc7ºfÍšµk×r7ÒF7—òjjj ¾Äœ^ž:„ Ó,‡´ãÆC—œÓŸ‘d4Bn·sú|±+H{H(V—ËÅkª8è?Ù%«Œ¹~D*•Â?ͨ?ô«¶oßNщâGêÏ<ã`Y¦ë¸›ÿùçŸù\á›þ5TÚ²,‹|ê¿üå/N"Øõƒt{¸¨Ñív£±QR©´^Í„ Œ© sT|¸šogxË&âõz)Ç¡ƒîQ$Á«-((àÞ:Ùã Û>—’kmmÅó÷ õŒÖy…Nûò¨0nÀx?HKžÆ$JKK#‘Ș1c(ÿÎ!ÿšl¡òˆ“‹m|ô)G‰Dô^}ÿââb¼BÞ_£LQkÖ¬á1 °©`z§äççO™2Ž9ÂçpÓàP`8ÜV‡D[|©E„›«@ €©SŒOØ©é·ûˆãÇ£þ¸¹*(( qe»H†Ñ\AAq¼@üƦ¦&½wnllÜ´iÓ¾}ûü~¿¥: ýõ>0eÊtá%577;1g5 3¡£-˲.»ì2ܾöÚk±ÿ2>©FiQd,yãàÍkkkÓ2ì4Ñ~Øýèd'ø}")çååáµ)s¬)w…㕺H`ÁAccã¶mÛ^ýuü/%Vx™×b*•êííµk/((p¹\………Æ‚Ÿ¡";S쇶Oìêê¢1An'h»©© ]]c„9»Y¦xzÆÁhØ†Š¬­Ý0`m¡ ÅóXøæƒø˜Úy¬ÕÕÕ܃±ÛàQÙ £S‚/í¡VwÔÐÅ&‹Å­¬×ë5ÊêêêÖ­[Gã€X­ïæñxÆŽ‹&–GâiÑvúý~=ÃòÁ8´vC6ßb~Ö-[ú¹?•õÀUW]e—’€üüüüü|¤S `BiŒÇz<žòòr»Ñb(((ˆF£(Jý6cAº1Ô²ËM(ߎ$“ITÕît­:~]uuµ> 槦¦¦¦¦ÆÎù€X,†“¼û¼ŒÁ“åÕfÙ'¢¶h1îU`„ÚRú„Û cbº¼¼Ÿõd2É É›‰F£§NÒ;TjËnU2œüšy ~}}}]]W°‘õêêê'NØ0Ò–²²OÚ[o½åÜbFÙ_ƨŸÚ¢ê+¥Þç– ³¢Šù±Ë5Ç)³åñxðþé!$¤c±d2iÌb€©&ŒŸ‡:Mž±\³fÍúõë÷ìÙƒsxÀ^ Ê%ñX!™LÒÃãPÑU²/,8C»å÷ûï¸ã;‰à£i7ôkLysO f×›„Ãaœã…n–âHQžŒtÌ¿åóÏ?Ç ;—¹µµݸ… ¢ªø§x凢 ßͪû®êêj'J¯Œä„°àÌûDÝÏP²XÀD«U+ИZ†WèPñ‰îófÈVó¨ÂèæŸ:u Õ_VVÆEªZ²dɦM›6oÞ¬;yhù°äËNÔ™òÃIñ---ø-n·ÛÑ~rGXQ[Øâ6ŸU²hÑ"»l BÕ2ÕÕÕÜŒX®w4Øa^ Ëc”¼^/åiñfë £ÉÝéììÄm2™¨ªýë_ž¤ïóùìÂÊÄR -3'KíògCH 2j«ÏX†¬O.ÑÒÒ—U!ÐÇg7??ßn|½{;S^”÷ª¤ã`0XYYi,§Ã].©J)£µq(ÂàæŠ„e·&ïÉ“'1¬–uÈ-aA?úDê¼.\Hü·ÆÛ¬ä¨hé‹1cÆtwwÛ-ª†êäòâ}%™»»XUU…·Ð¸¨)ö’˜‡Ó•ÚÚÚººº×^{ÍxZÐÊuâñ8Í°Õ ^®-ï¼óÎh\ÜVÑÆá댑?a,’ÉÏÏGÜÎÍWz7e`‘4dp¤ ô©S§òi^D"‘0Öýñ´½$qÅŠ7nDUY–E¿ìÖ³D•$ Ó£UQQ¢Ql3®di—‰rrQX i+Ãl8H¥R4ä§ËÝüÖÖVÜß «ÛäT[b´R‡ÆóóÅÜ mçð£Ñ¨±¨¯|åÊ•¤* ñxI]³×ë5–ÞcÆŒ …BÒÈŽ’£Â¦-jq¹\øWUUá*ÂüÈØÇ᳋;Lž<ÙèÅSÚ“æ’”#‘ÞEå䜖——ã¢\Æ¿=!·Û­¡+W®Ü°aömÛð¿íöÝw߆×ä®° ±±qË–-{÷îÅÿ^}õÕ¸ÑÖÖ–aPïn4µKG¡¿ÅåÅ2²LÆ^#™LÆb±òòrÅD!$;R¤âêñ!mTýuÀ¬¯$𻺺ÐWӈа‘ŸÇI$Ž"ëds¬°ŸìÞ½ûoû›ñ£êêjž°VÖnhIC-|•öH$ÒÑÑaÔ’L&Iz<ˆã‰T¸¢tÓ®4Æ3;vlñâÅ ,Ø»w¯q¨ ¨¨‡;áôÚ4x'Nœ8qâD†É·X˜o u¨úÊp Ãð†»í?þø{g%¾µÈ¼h¶nE:::P@~¿_ÿÑñ£ÎÎN=.C»‚7Þ.åm ^zé¥eË–íØ±ÒZWÐO·«Áõz½hŸPÊCO½Î'å…B!ãô"‰P²­ÅóÏ?ßÐÐðòË/Czœ›RYŒaqÚ™™¡F1]tÁÆ,ñprvt…ŽÕ?ùä“]»v-`ëâ#½½½¸b§ñXìàÈÇÒ“ãÇ7®G‘H¤8q‡ÒÒÒI“&á²XüHô‰D¢½½UõÏþ“©T*•JÙ¹h¾4ܸr-îß¿_¯Z&Æ/3–£9MîZ,#X…‹Å,X`|+©Ïç£Úe. ìb¨>]wä“É$õ;g4FKNý¤I“PLº «««[±bÅîÝ»3”™ãyx È—öϜٿ?vôveMMMƒ'À‘£˲¬©S§âzÔ·ß~»òéÎ;·mÛ¶xñb=Y@¿û‰'2x$˜ °³pix#ï•h&¾‘ÒÒR—ËEŠ7ò ã iŒgN¥RÆ‚_¹eYø`èYõH$‚ˉãí…†,¥qÍš5õõõmmmv^eƒÅVƒÁ ¥è===¸p·ñSìÉ>éUÂEEE›6mRêÖ‘P(d¥1ž¼²²{I° 2,Ë2†¨(JLeq§p˜9kºÂH$‚ý w/¾ø"Ô××Ϙ1Ò.6?)¿)µ}m*h3fŒqýíd2ùÅ_è9'”žÓ²,EÄ«W¯^»ví«¯¾ŠæÍΧ²-þÕÔm¥R) }S56$ »î‡ÈËÆÁ²,ô…óòòôEÕ0½^VVÖÙÙ‰ÚÚ¸q#®AÚŸTqÑÚÚj\vÝ/Ì~ùý~»N£0¼å«W¯®¯¯çÆdxŒ 'ƒAìšír(Xzo×ëíÆÒa#…EÄb1»—@ÚÛݵkW*•"m”œä•¼’D¯Àäÿ ‡ÃhŒñ ˆO¥Rz´uëÖ544ðuxz“z1ãxŽÏçCë‚ S,Mæ|z<§1PšÜ1üæ rPXd®ìžþy»C^yå•üüü7Μ9[¸óaœCàKP2 ›`7Gn¾âÖ2x2bÙ²e ¯¿þº]/Føý~¯×‹'Ñï=0ý#~v¯)Àöá™E¨“‹Î;™ þÎp(HC-äÔoß¾ýí·ß®¯¯ÏðÚfþî}àO3áèœsΩIcù¤­­mïÞ½Û¶m[±b…¢$wãßEÛÁ`PqàÂá0UÝ(ž«V­Ú¼yó›o¾™Á6 #e÷)kGKJJŒu/$¦ªª*cÅâ©S§²b® §,–eY¸î>Ìš5‹^ÄeÜ_‰ ÓkØ÷îÝ›——·aÆo¼Q?6s TPP@KÞCÑkiš»ÐYPIDATiÁÛ½öªU«êëë÷îÝ‹·o¤ô)ËǼõ••ì¦ •——?~œ¿ ƒWØÝݹòqxÈ!a …B±ssBïw€óÏ?_Ÿ‹¼gÏdzaÆY³fÙEû4ȃD¾.ŠNKKË®]»Ö­[ÇëÖ }ؘ‡ež¢Fý~†W †’É$æP”­á_D'·„ÕÒÒ¢,ʰ|ùrÜðx<­­­Æ\àRÊh V>-Z´èæ›oÆî'ñÄÚ<»~ßÚ€/uÖnݺuÓ¦Mo¾ù¦’ÄçæŠ¾Åîä”ÈËËÓG“ðp¿ßY{Z…Ò ÌÒSÙê!w|,˲Ðãiii¹çž{2,ÉÒÚÚÊŸòÌýÚË/¿üü£¶¶–vÎàëDÒЕ¸‹¶uëÖ•+WR}•Ë劦±;yEEv—ƶ±XÌàÕâ ²]"-•&[Y+ܲXÔ-Òª±d~-ËBëâóù#‘Hmm-·¯ßïGBƒƒŸbOë¹qP—Ë—/ohh8pà€ñÛ© ž{BtÁÆÅB°ÿBmùý~»t(j‹›.åòp£©©)‹æ rDX–e}õ«_ÕÛqVª1P"h†»±Â3—””¼ñÆP[[K¹1Æ¥ìÊ‹±‹QV›AU½öÚkdÒ¸'Ä©Ì+ôƒÁ²²2»UùtëÅ‹gÈ)†ucFN Ágñúë¯7~Jºá9î”ç›SxõÆoTUU-X°`öìÙúÉõêuÅk¡BW°z:£ H{¢VôÞÊ®N57v n·GŸ,ËÊÊ4/;rHX„nç¹SEuyÆWââmÌ=âú ,˜;w.ùÔÊí$‹jÖ¯_¿víÚ={öØ­gÔÚÚJsüu“ƒ– /Oùˆÿ.`ö›pþ23JUd½„\Òáý 7WÓÀçŸÎ…E?ŸEc7~LRßñÃþðŠ+® :®?²XƳá{l¨¾ -h8æÞºòRqcu(õh~¿Ÿ. ‹NÂß¿Ât7Qü+ÈYlmmͺ°rÂxö¤1~zî¹çÒ ²ñ÷ª¬¬4:I\Ž}ôn¼öÚk;vìX²d þ7œÆÎÍ£ª ý`»Åd0™ÎÓ•J‘1õó.M·Ûm\| ƒÑh”Äd7fŸ-r«+Äî#“¹¦‰P(„>“’˜ÆÇ•QYYi7&ˆç©¨¨Ø¹s',Y²„¯¶Eãƒú‚€+W®¬¯¯ÿðÃkjjìÂ1ÔÉBIl’¶ìª×¯'ª««#‘Jt iIQš-ÌdÝbY–Ewô·¿ý-n655e˜ ‡v+/êc‚|ø°1Ã5¥2Lev»Ý´‚þ¸c´_tÎ9¾ÿüÏÅsçb¢¡¡á¡Ûn›ø›ßTõ«\4|Õ%ö€ÆTE[[›±rŸÊ¶páPãÉ¿LÃ5ͻ˜òÓä¢ÅRлÈË/¿\Ù' âCñʰ±eY‹¯¸âwÿó?›ýëÿõ¯[O__„Àô/SVå×+ûøˆÓK19---¥¥¥ô’X}˜AIÒæ²¹‚³ÝÇÊ ï"©‘éxyíùßK—þ߇¦q,œ>…• ‹W­È»Ÿ $í¦Á Ú޾×år½ÿþûpÉ%—èÇbž¬ªªÊnÙH½‡µÔÊF…°ˆ>‹ £q?ãºgdÃÚÛÛñœvú{ÿý÷¹QTtÃÃv£YÊMs£MX„’§À¬7wÅŒ¡'™L†Ãa»L,zr©T M ½8!¹•iÊøú;/µŸ™Ø¬‹b~Haô¢Ê‘<¿‘¼ÛòûýXÅÊM ÿîéé¡ijÜbÑIxÿËm!šOeYTîÃ:t(7-V.^SÑ‹xg„vS ´'¯-,,4VP9¿ñ-›œ@ @ÂÒ@QÒW䬪`Ôv…v(NO “€ª««{{{íº!êÝH‘|’’vU7xZ»W‹c&¶¦¦&»+"÷‡\¿¾l¡8aúä‘eâþìÛÕÂŒk=Ð/%w¶0žµ{oYî ÂÊ„ž§øÚ×¾Æw0¾œsôèQôÄ/ú€üü|ûì3j¤ÌªÛí¦·Ìñ£HŽeeen·ÛîÝ-8¸žËJRaŠÂ¨8×½à¶ÝôµD"ÖȘȠvòÕ””˜Q9ÈYóä&dÀ.¾øbj$Ço? ˆ{E´°°KiÕ…h4ÚÙÙ‰ÙöœZT­?äºE1Âh-{îÂãHbEEyf«²²Ëf<˜ûý ˆÅ6t'ì[ßúnÐøt{{;ÖYÇ‹ìf†å&"¬áFQÉ‹SRR¢˜«á¹¶!D„•5'¬ººZY¾V_ +LJq8"¬,£w‘J i·nŽ#ÂÊ2, p6rvØÕÑ *ì‚ .Àÿ~úé§gK?"¬Ü‡šžEÂAAAAAAAAAAAAAAAAAF_ÇîÍØÂH" '‰°F<ƒ¹ÅgÙ²ôÂÙ‚Kp–à",ÁDX‚#ˆ°Ga Ž ÂA„%8‚Kp–à",ÁDX‚#ˆ°Ga Ž ÂA„%8‚Kp–à",ÁDX‚#ˆ°Ga Ž ÂA„%8‚Kp–à",ÁDX‚#ˆ°Ga Ž ÂA„%8‚Kp–à",ÁDX‚#ˆ°Ga Ž ÂA„%8‚Kp–à",ÁDX‚#ˆ°Ga Ž ÂA„%8‚Kp–à",Á¼Ù¾€²páB¥å¢‹.RZ®¼òÊáºAE,–à",ÁDX‚#ˆ°Ga Žàð‘–e¹\?<‹-RZ.½ôR¥åÛßþ¶Ò²ÿ~¥åý÷ßWZn»í¶A_Ý(b0·X,–à",ÁDX‚#ˆ°Ga Ž0ÜQáÊ•+•}Œï²Ë.SZ>øà¥eëÖ­JKwwwŸß®_ð3Ï<ÓçQ£‰ …œC„%8‚Kp–à",Á†8*ܾ};ÿ¯>¢7nÜ8¥eçÎJË;ï¼£´¸ÝêL&•Ç£´ƒA¥% )-“&MRZxà@¢B!a Ž ÂA„%8‚Kp„AE…­­­z#ÿ¯ßíÛ·Oi)--íó»âñ¸ÒÒÕÕ¥´TVV*-‘HDiÑcœüü|¥%•J)-÷ߟW8"‘¨PÈ9DX‚#ˆ°Ga Ž0(ç}×®]Jãøc±˜~”ÒRRR¢´œ:uJi3fŒÒròäI¥¥­­Mi)++SZü~¿Ò¢»êÑhTiéééQZžzê)ˆó.ä",ÁDX‚#ˆ°Ga Ž0¨¨ðü£Ò˜——Çÿëóù”úS §£Ç&zt©à+-zÚÞÞ®´ôöööy…úyæÍ›#‰ …œC„%8‚Kp–à",ÁÞ}÷ÝêéN"€²CQQ‘Ò¢OÉ*,,TZô1¾ŽŽ¥E HÁ4¨Ÿ¹?K‰è‘¬~=úµûÏ3ç8 9‡Kp–à",ÁDX‚# êµråååJ‹2ЦÇzT¨ñõg }ÚV"‘PZúÑè‘£^wª»~fýÛyä¥åOúSŸ×3b‹%8‚Kp–à",ÁDX‚# **ÔK4½^oæô(L°ô}ô™}zt©ŸGŸÕ¨·èߥ]öùg‚)rÔ¯ð¹çžSZî¼óN¡ˆÅA„%8‚Kp–à",Á†Ãa¥E ßô9zý‰õy|úHœ'ꑚ>æ¨ÏFÔkJõý<ú|ÉþD—zœ¨/BùøãÈ@,–à",ÁDX‚#ˆ°Ga Ž0¨y…z£„ý‰ïôZP=¾+((èó(}UR}üNIõÙˆúË ôkÖãDýzôT_ÝT¿B}ýÕ @–y…BÎ!ÂA„%8‚Kp–àƒ+Ôƒ%|ëÏŒ<=rÔ×ÕWwÑãÄþŒ9ꑚ>š©Ç‰úÊ6ú+ÓõÚT} Uÿ5ôµLõwpÌ;Wiyì±Ç ç‹%8‚Kp–à",ÁDX‚# j¬pÕªUJ£déo#×Çõ4}]P½bSõhNoÑ«:õHMÔÑÇõF½UIûóÆ`0¨´è¿Æüùóí/vàÈX¡sˆ°Ga Ž ÂA„%8Â Æ ›››•½´R¡³³SiÑ#¬‰'*-úh¾r©¾ ª>z¨Ç€z„ÕŸhNŸÕ¨G :úx¢ÛêWÞçøä“O*-sæÌéó(G‹%8‚Kp–à",ÁDX‚# **ÔQ†ùô(L+ÔÑ£§ŠŠŠ>÷ÑGõ¹~cÇŽUZôÙˆúQý‰%»ºº”=–,--íó»ôPKÕÇïôðüÑGUZæÍ›ÈX,ÁDX‚#ˆ°Ga Ž ÂaˆçVVVòÿêc|z¬¤ŸDïô*J}dP¯Õ.õ˜ToéÏyô¨Pøtô9Œúyô±B=*ìs@LQóC=¤´<üðÃ}žgÀˆÅA„%8‚Kp–à",Á5¯ðÞ{ïͼ^W©×Lêñ‹+éÑ¥…éñ”þ&ýzôTŸW¨„º`›Ó¯G7õ¿Køô5jôý¯èO•©^O[VVÆÿ«¿&Cæ 9‡Kp–à",ÁDX‚# j¬P»”ÀGDúóŽ =VÒã2ý«õ}ôˆ¦?c—ú™õ5QõÈQIõØMÕëWõZY=ÞÔCý}úlÍ>߯ñÈ#ÀÐ!Kp–à",ÁDX‚# jHg¯CÈM<¤#‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ Œ6þÜÁ ¡ûHFtIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/roi_getarrayregion_inverty.png000066400000000000000000000311301457240071200315610ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ IDATxœí{|TÕÕ÷÷ÉÌ$3ÉÌäžP)h[k˧Ö^i MEQ”›áÐpÑXT¼`ë´Þ/µ­P}½TíÇë£V¬¶}>ÏS/µ¶¾ÞP¹˜„Ü&·™Ìõýc=³ÞÅÞûœÄ$'9„õýƒÏ™=gΜp~³öZk¯½· Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0̱…1Ø7ÀtO*•‚Ã8jž—{°o€1õ4nÜ8!ÄgŸ}6¨·óÕ`a9ÔÓqÇ'„ÈÎÎÔÛé%,,’:ùä“…---Ò»ãÆK¥RGKoÈÂ|ÐD¤$:;;=ÏÀÞQ?ÀÂ4PO¥¥¥ØXTT„Ç­­­pPXX87Ö/°°ÔÓw¾ó³sZ[[322ðecc#hëøã?ZzCÖÀ’:餓àe0„ƒ‘#Gîß¿_QPP€VJÅëõÚýÆQ ý£4Q#FŒBøý~x‰ÂÚ±cǨQ£ðüööv|¸‚°O>ùÄùF‹-–]P—¼¹¹Y=!ïÝ»×â YYY *!D2™¤Úr>,¬~õ4~üx·[ÿß«Fy_|ñ­¬¬,‹ëS{ædXXýHjüøñê[ùùùÍÍÍ.—K‡µéx"‘SC…’*++s¾ ÏÂê+h¢¾þõ¯ !233£Ñ(=¡³³SÝP ʳ¾~GG;\LV/AAäçç !ÊÊʤ8 „())—n·;Ó@p>Ÿ^Rãäõzc±˜]·> 5¿‡€z:þøã…¡PßBm}þùçØˆÂB€°$Ç …%„ÈÈÈhll„cŒé ÃÀïÝ»×ÉŒ-VOIMœ8Q¤ö€eee`®„õõõ ­d2©õåÃá0hK¤>| gá|XXÝ€& $%‘›››L&->>zôht’´)ƒ®®®®®.õƒ­­­Á`>‹ª:Šp®-\PO˜ÀĦ¢³³Sä´ökè­Sï…Fµn;4æåå !ÚÚÚ°½¾¾GŒÆo×®]Ží ÙbT %ˆ>ÚÛÛACuuuWÀTZ²œœÔ–0ªƒA‹D(äKÍÒcŽÂ¡zx@RcÆŒ—Ø=ÑôÈ£öÆï÷Co5vìXl¤]dGGŒŠ´8¤‹l¤Â£rDsHÓ`Ž5ZGÓ(¤Ò¡ª(mmm.— äE#5Àçóù|>ôvïÞo>Âáp8FUIt¥ihhPß­¯¯F£ª‘ÃL„ňõ sU;@S1vìXL€¿ ÇÚ¸âr¹233ÍÞ…Ú’Ñ£GïÛ·ßM$WN&“ZQœ,)àØ-4 Ž6z¥@ ðÅ_@KKK xÓâÈ~ )((hjj‚ƒææf‹‚Ïo|ãBˆÚÚZxéñxh"Tuç‰öÅÚaœ’’gï+‚g¦Måææ†B!P õu(hœPCÚ/…GžJ¥@RZÀoiiÉÍÍÕž Vbù|¾p8lvA'0Ä},t¡‚Á`0TKÚÛÛÛÛÛÑ}ÿ¿À·FI£½x4í"¨'Œ5 ¾]™ÿ6l˜bìØ±cÇŽÕ†xP/ ÷œ““£ýö¢4¦ü 24……zš0a„ T§;333‘HH:[õ÷¿ÿíöÛg=õ”BÒv‹@Ií·»\®Q£FÑÚ=‰={ö`üxâ‰'Jï‚ÖÕ{†¿+ž'NœØíHöÀ3¤ºBê’ ÒQ´†aTÿÏÿ<¹xñ>xåÊ+/xâ‰ÇÎ;O= êõ¨CSZZJÓZjŸ5jÔ(å¡C‡´† /%„@·½««K*Ìg ÿP(dÖu:!",T0,..Vß=î¸ãh ¦ð—ü÷ÿŸ /¬ß¹Sñþ_þ"Ö¯Ÿ÷ÜswÊÂï÷k«@LMicImã‡~xÊ)§À1¥£Z4«þ³ÎÖ"Ž‹&¾h¢hÇÚ¢ÆÉLXÍÍÍ5ï¼óè¼yuŸ~j\pøðáÅ&LÝ´ikE•Ú*ø f‡  'Óø3ÔbÑ -ZuF«££ƒzWTXÑhCZ”{cc££bãÒÇBê¸4Ò ·¤ONª³Ã+Ì{øáGçͫ߹Ó0 Ã0n¼ñF!D]]Ýþÿû?kjÎÙ¼YývÇÓÒÒ‚ƒw˜;@Z[[ÍòLPÆhOˆD"0D‘œœ³D‰£8šºB´O§Ÿ~ºôV €Ñ²²2‹±6Tç !^Û´éÂmÛîþÁ„çŸþ¬Y³Þ~ûí—_~Yqî½÷>SU•vÈzF²ª0kJJJP°Žï233ñÛ½^¯¨Ž=ú´ÓNsTBëè–”…R®`0ˆž,­Nq¹\‰DžŸ¶&³«¶ö©‹/®yóÍÃ÷ß_QQ1qâÄÇ\1ñÆŸ©ªjܽ[A_ze,AÎÍÍÕJ Óª™™™ÅÅÅf¥/ªN³¼‹Åü~¿3çI;ZX4ÊÓæ;;;©‹£’L&Ñ*Hin‘¶@‘¢/¼pñÆÓ¾ñ !DeeåÛÜýË_‚/oF4EM@ŠU:¡¨¨Hk;›šš àO3 ëhçŽÞa,C£åüÂe' õ4|øpí">Ÿ~ú©öSØÄb1íä ///•J¡kî¹ç~ï”S–Ì»äå—ï:ãŒËþñs~üãÍ¿øEWSÓöíÛEÚìÁÉÉdR*]WÁNM­ìƒ4)vÄtæè:t$»Q[h***^yå8ž0aÂŽ;„@@kç!˜wdzž0aLš4©¢¢bÕªU´]f¦,_¾üˆÇãxK*’ÔÖÖF3Ö•}†aXîÕÕÕ¡Öóòò¤‰b…t[M?À8Ây7« öìÙƒIõ466jhŸ£ªÊËËO?ýôU«VÁKÌbû|>5e ÒléÒ¥Û¶mK¥RàËãxK8¶x¢Ð+QUIó¡ÕŒkVV¼d2i1ñ F±°ã󏏨 ±¡#=¨oã™3gbû¯ýk8 ÿË‚Á ­¹£âiïžúûyyyåååÿñÿqíµ×¢›L»$*,ÚÇaÊ`Û¶mO<ñÄöíÛ³³³©CMû¾®®.ˆÌ^âñ8þ Ø¥R‹EÇ=©°Àhy½^:"I=*VVVÖ]XްXj'µ=ÚB%ô¤u`AU—_~9môûýT[Ö«æ-Z´èÑGÍÊÊzíµ×´'ùå—pŒSœx©õ®h"Î3“À{££L8pžJ¥ðWä„åh$¬C‡ !¶lÙrË-·¨ï¢3ÔÑÑÊ£…ÂÚø «š&OžPÏ¡99üì›ššš´… 0pJ ‡ÃÚÞP¤íºh aØj{CGX,Jiié]wÝES”âââââbš­±^:qÚ´iåå娪ö4Ú“½ið¥tMÍž={Á‚?ùÉOà%¸8€ÙÅ›šš ãÖNÌÌÌÔZ/¸[¨s7SUF39qd. Ë JÓÀ˪ªªY³fM:ì%Œñ™=Îai¨Hkóµ)ª°¹¹Ùçó™Õäççççç9Rûîã a†±sçÎP($…iW\q§R)p&´W8é¤“ŠŠŠÊË˧M›¶|ùrÉ*¨cˆô‹‚Á ÅÜT!„ÏçC=IQjUUÕŒ3¾ÿýï[„R¤_ÿ³:êŒ]CCƒ™Ú  Ëk¿¸±±ñ¤“N‚­DPUô—ËE+R$Ô":n¨õÏ(Ñh4 UVVΟ?_]õ~'():?$f¿“¦¦&œ—¡õÒÜnwCC„Ô¿W,''¦b›Ý¹­8KX†aà¨þƱX@J à[ÀúAååå“'O¾é¦›àÝ@ €+Q@ ¹¹¹ÖezûÒ` ½”ZÈÚ:óÌ3…ñxÜ,C†ö [Ô½…š#‘ˆÛí6[~mÿþýû÷ï·~œ%,%•D"Ñ‘†¶ƒª®¾úêýû÷£¦Jú;­¤h Õ¿Z{{kÖ¬9ûì³Ï8ã õžá ++Ë„@Γ§nw*¤·Q[[«.Ä5XFˉÂÂÿ,¬#Ô%:ð̘1ã[ßúÖ‚ Ì–8Bü¬ºDq[[í.©÷½oß¾Ci´Wöù|¸>ÇÊ•+Ï?ÿü)S¦Ð‰vå´Ï…<¸_it˜óhfÀ¢ih£v‰ÔÄqÂ2 C8@Ú¢<ଳΪ¨¨˜?>¶P7¹8ö³Ñh4‘HXx`R)9àþ4´ñ’K.meddX”°Š#=zÕ®@¨¡ 0ÛÛÛñgfÖ'ª768:k˜½ VgæÌ™çœsU@Sè Ñù}Ú:*Þó`Öí¡ýVK–,ÙºukWW×K/½-´ôÏ0 )CÜŠz’’ÖÃÌG a9šNh9Îbèc=øàƒÚ·PUÓ§OGU577[×¹ãÇ333µÅÅÅÅZ¯²P›o±;ôw ÇeË–Í™3§¢¢ßu§¡ÁۃֵʼnDÂbqÊdõʃ‚…e]%ðz½ëÖ­£ÿ³ ª… ÂËÂÂBê}Ó™9‚ÌnÐ~ã°að»Ôæ»aÉ+8¦˜è.UÁ-[¶¬²²rêÔ©ðÈÍ@1K¿íŸY ‚ÎÔ"ývàÀé¿b`ptWhS8K—.=óÌ3.\H§I©¨ó¤>˺l0''Çâ™Á£Åq!uùÆÎÎÎ /¼ð±ÇBHõò@Àzø¼±±Ñbƒ'øC´W€ ¤á|œ} ¸7t¢Åñ`í•aŸ&3Û&Ò.HDMVÁ€7ªp’t¨Å»òµ¯}Mj_½zõÁƒËËËkjj‚Á ÚµÅb1œF§ÆÃÉð<´šp¹\´/ëùF¦¸øÇþýûÍœý… þ᯿þºÅu¤ÜàIt·Xl•h–{º]ïìÆ¡ÂR5Œ?~âĉ555Ò»ÙÙÙ… `Ð?£‚ èvŠ“ðz½h?´ãq¡PCú¨büøñãÆûøãñíÐ]T¨¾¾Þ¢[‰ÇãuuuXÊ"mýJƒ-Ô êx9Åëõb ]uuõùçŸ?mÚ4‘ÎÇjsCh”Cpõ6mm`aa¡Å¼ÙᨱX ª_|^‚É1[µB‰F£`´JKK-¦§Š#§ê«¨ë¼K›£Z|vÉ’%>ø`8~þùçµ'@0Æ•NÈq»ÝÚ5þT*…N•T¡ >|ÀŒÖÑ!¬©S§fff¾øâ‹`!´i*º>‡ÐŃ©T ‹¨èbƨN¿ß¯•tCSã…É i¸Î  Ë“^tÑE0TõüóÏãæõ ³Eð"(ßÏ?ÿœîü#ÙZõãŸÓr´°À…_¿~=Œ.ŸuÖYÐ>wîÜ'žxO³žÀžH$¬³Õùùù¨Bõ ŸÕÖš‚9·Ìòt—9¼óÎ;ï¹çžB¼÷Þ{Z¥âb]]]9zìôñžÐh îT0çúX¨JûV]]+,%¦¥ROqd¡•×ë…’K³ïu¹\ølÔ%µ¡ò'ÉQ-Œ¡Œ9ríÚµÕÕÕåååÚá¼ÎÎNt’¨¦Á²B ªÅ’§0óBkD¡74û`?âh‹5gÎ!ªêå—_£UTTd±ˆTMYLE¤»•tÅëÀÞårù|>³2´¨Hzeq¤©ªªúÝï~'„xöÙg¡%[$¾4»ù††‹jôÚÚÚÚÚZŒh<¸bÅŠ9sæœuÖYfi°–––¶4Ú<δVãApçLUÂiËÂVu;x‡‚ ;> ¥¥¥Zï rTê²`ù¤uúmŽo ­,’®ðñÕ«Wc)öçé¥PGBW“"33ÓÚO())Aøé§ŸŽ?^1iÒ$»{CY, U†k»ãjlBˆÕ«Ww¦Ñ^s̘1˜qÐn/˜‘‘¡}0Zô§ñx|O3û‡…Vºn‡d\W¯^=cÆŒÿøÇ"=ûÔ¢¶X­s§©0ö³ârŠÅ²P•5Ý@sƒ"½¶±mmms¿À,¡ïŒcAˆ…m«­­µž;ZXXˆ)º*TI¬^½úÎ;ïlooÇõåÈ/àÆ™Ú<ýÀßÈ#Àh•––¢¤¾ûÝïÚj´a±¾’ªÚÛÛo»í6‹wÛÛÛi‹-ió–ÔgÏÎζ˜×ïóùâñ8ªJš 1" ¶ÐÇv 'X˜¸Œj/[¶lîܹ?ýéOé»pÛêv¬ð-9iÌ.Žf[»¡µ ¾Åꡪ`xGð_¼xñC=„uºÚÏb%] ‹¢Í¦â9‰DÂb&t·‰Gµ7¤«Hj§-[¶lëÖ­Bˆ—^z)[ lÃð(Þ?¬•Ç.— e4ðÓuÙb}ÕP~¦¸QO ²8Ÿ~ú©vã!D(ÂUó´ŠÄ©âÈ:>¹¬¬,­ª@4`šÕ®hçtÐŽlÁ‚Ò\ A€ºº:Ã0ÌVTãGé„”é)§œbßðÎ` «/ªzõÕW-,?8Å())ï¬]âI$Ú8H$‚³OUKé­f]_߸\®… Òšføººº:Õ¿„¦ÔZ Zƒ”{^ÛMX½P•a”¶9B`B+ Z¸ÕÕÕQÅXLäÂoÄã––‹åh ÃH$hÌÔÎb¡È0i3d ­ï}ï{XϨ픉æè„ñ"‹©cv08Âêc(‘››‹=5cx\VV¦ý¡0†hæÇh„¡&§6hq»ÝÍÍÍfÛêd@©8½££ã‚ . kRR`·Ùè, ŒÁ¯zZcc£}Ń ¬þRÕ³Ï>k½bLVVîÉ£ÎË€>K;.•B< uüÑXF£Qm íMvv¶E$Êñ‘CRµÕ’Fúsè½YwD"‘p8l]%Ûw:*죪 6Tç”®Y³fË–-pÜÖÖf=ŒHã,u™ðúaÛ7qäúŽ‘H¤Û UuÒ‰D´öPîL[÷2gΜ^x!‰lß¾¦R¬ãÓ½{÷ZÑ÷;*¬þíUÔœagg'>H ó#ÒNÙTiµ‚TÊ.b·«hmmEG•2¨½.š"Uø,\¸pÛ¶m‚ìÍ)„H$è™iGœºººð‡qðàAÔVÓŸp vdJ®+ì/U†Áÿõ×_/Òƒ»³gÏÖž«²Pï}ðd2©l³gÏ88xð Eu LÛ§6†$Õ…’ˆÇãAœ´Ÿõ¾¬¨uÔÍ¢E‹Î=÷Ü)S¦@e‡6!¸f¥É i´ïö{»B»½u!Dnn®vnlÎ}„ÅÈ+Øœn%Žœ ¨íF±ÏJ&“†aX ÃíܹSà ʼnªcG«X-öofÏžýÇ?þ±««kûöíÒ:"øÐ–Ç444¨_ú·7´ÑbÙ­*Lb©‹³ !JKKµz¯º$³ÿÇì4fyv­KŽIOçÝ®rœ°U©T ê!…]ttttÀBBZŠÆ‚hN•ön‘Hl5Tô¿ž:UøxÐbE"šÑxûí·ñîsïÞ½´T‹¤T*…^#ÚzÝQŒvè@`Û¶mÏ<óÌ[o½…ÔO£4ÑáÂH$?‰}ûöõ£Å²¥+UIh}œæ™t³Rt„N‡—¶§‡­ÖÖÖf]K q |ss³¶ P;çóùºÝ‘Ðëõ^rÉ%0χj«dâÄú?ƒÚe,`$½ð/=zt?ö†ýߤªpW˜ù©¢-FÃzn*ÔäP+%• «5ƒt‚͈#´ßHë)hwt¢{jÒÎ1cÆ¥–+VÌš5kòäÉð2XZzþæÍÕû›8rcNzç˜J5««î#}–Kù¥¤ª ØAmŸ?>f&µµ10NÏ’*{Š@ `Q“þ™Yéßþ4´‘Fm3m„.—ËívkÕ t…Vxÿ+V¬8÷ÜsO;í´ÎTjùë¯?>sæ+W^¹à…èÇ¡ÀßlÔyݺufwÕ úd÷V>÷ÜË…Ó`à{@ZSZUU… uçécÐÚºð5u{Ñ»‚ß4]¦ 2Ç'P@]ÒÓÞ:è@ @­º9xð ]Yo•ÞÿÿßráþûÛ¾ýíKÆBøýþâ *n½õá³ÏÆ“ioî×Å_Lÿ®U«VõKoØ{‹µaÇŽÇW®¼iß>_n® U b´‰ì /Hc#Ö x455>|ƒ85K†â ôÉùýþ`íÅsrr°äPë¨íÛ·O›<ƒg/m¾’]XøïSNñ½ñÔ†ÑðÉ'Û¯ºjQzQ1‰‹/¾Te½tÞ7ìØñÛ3Zkk/ÏË»£¥å½Ë.›öÓŸ°ª³Ä&hÅï÷÷|u(º†‡õ¼pz̲èa§6fÌÍYtµP•L&=Oqq1”ßx<·Û——Ûz<žT*C.—+???P\|Æ¥—þ}ӦףњššýèGO=õÔîÝ»=}ºúþIDATïØ±ýª«.ضíé¥K….—몫®ÂïR×›8ùä“ûÅ…ï°@UµŸ|/ÿ±bÅ/yä[Ø@vË–-kÖ¬l‚Ö%“IŸÏ‹Åàix0ðØà ‰À¼…Ï5 ÂR3°Ë|Ä0 8€«¹Ý Ç“L&á¿ßËÀÒBðEðøÕ”xšX,&'“I(à)& Ã02²²J‰SO=µµµõ7Þ(//æ™gà¯î<|Ø_Rr饗Zü×…Ãá‡z¨ŸÅW–Ëã¹æý÷©ª üZfæ--ןp‚ˆÇá?þ¿zxЋàÁ_ÿú×ÚÚÚwß}aê\FFÆ¢E‹P"øÌ‰}`ð„à_l„ª´>B?ÞÖÖïvuuÁhâË/¿Ä«…B!|ð00‹eggã÷ÂÔ/BHm!MîSW ŽÁKËÌÌ,™8ñ¬ÛnÛtÚiðîøC!ÄÒêêÀE…î¾[¤ãº²â÷¿ÿ=ôï ôW»Öì-[þñÈ#{ßy^~ñÅ#FŒËœH$R†îèÀÿОôâ#ôà/ùËÌ™3áUVVbHxï½÷¯FޱCÄ|:ê£Î¾šÅúÏë®»iß¾kG†Hð•W^¹ôÒKáénرcóäÉ­æËÌÙÊ{ï½×]wÝe—]&„8pà­ÚSݬT*ÕÑÑa6Ÿ7´Pä)½k†¶:k¢à¤Ò?´OÚšAÇc¶ž€¢þã³Þxãö}ûZ·n¥ªB`®¯ö àZYìË÷•è*ïhiAm’×5ðÐY³fÍÂvô3P^¯×l¢ôtpŒO—vI999hبiA£EÇ©°àA‚CsHu‚¸ª–.™ŒwB$h´æÍ›‡CUîaÃ|?ú‘kĪª­[·Òn¯  ²1pÁÍzMoœwˆQ[ƒ®*ÀbÉu!D$Á"ˆüü|uÚ`aa¡vH(V÷°¤Ðu"´ócµÓq­Çh4j±J&ô¥óæÍSãµµ]ÿüglÏÑ]½l±®&lû¾÷N/Ó  ­«†_ÿ¯9AU”|óXf5ìHggçÈ‘#ÍÞ…l'Z5úÝí‚- ˜ajmmU“éh„¨C ã‰ðEÚÉ¥9.Y²^jÇï'Ëã­z<0ZÚu+E:Ûÿiƒ`±€Ëóòª_zÉ!ª‚‚$j 'Igïà¦7ÂÄöàª,`¥,Ökf1àmh(þ Åï÷ãCUW¾„¬vòV(ÂÊ3ßµ®î½€KKöKxاê†m••aËhàgf–éFgH[ç.Lª ðìß¿Ÿ–¯HÀZßrTÍ]#®¨¨Èbu¤ë®»N߃ºñlуšjÑr«a¦m3ÝàpR©VDÑ…$·lÙ‚ó°Që 2´BW±¢ø¨Ú¢‡Ä‘i§P(„^<ºÆÔbiçaûܹsé„ZÖý÷ß/H*„Š#++ 'š.FmíÚµKô·žÁ_ÆÈV@Ihóéö‚Tüi˹ÚÛÛ­§´µµáS—¦Êˆ´¦M:Äb±nWRÀñ±ÖÖVüÜ·ì‰'žøì³ÏÔO_gg§Ö‘= Û$ MaE£Ñ;î¸Ã¬D ¯¤jtÕ›8q"­D"a‘Is…5’”E:QI÷+@æõzÑ%×jý†n;v,7N«-í½†å¼IÓW\xÕHÔÔÔÜyçBÇc±Â NëÚkç§Ssb½¸™a^¯×Ìm_ºt)`Ÿ%iý†n°¸8<-í <ÀzB†”°ÌhooÇ'J½Zè8 £Ôf‰êêêJKKñÙheAhŒ a+!D[[›vöóçÏ·¾sužÈîÝ»ÑhY@¤2ÀzB†²°xà‹'GGp…nß/ПvÎ]vv6f´e^x5šæ@Î9çíÁèÂ~fÓ¿Ðǧ tÒ³öãÃP<\+Y²d ã÷¤Ô˜”˜P{IšÛ4Û4™5kÊBª2é<ì[i§²ÐŠCô„ 5aY@g}aŽ«ÁF£Quu$J2™ìêê2›ê£ŽSXYYi}owÝu—E5"8^xµC‡aV7wˆž!.¬G}´ÛºVt{éŽH[[›Öß/**jhh°Öâ5×\ƒÇ8:Ig]C—'d5ͤüÑG çé ‚Â2ë §OŸþBzÖJ °v’踬´“HÕhUëNUWW[Ü!ÞF^^žZŒË€k¯Œu¬¤€!(,kT‹ú:Úé”¶¶6‹I¤×^{­'¥Ñé©ùùùXl®Š^áv»1®j ¯ép=!GÇ]öj´èÀºð4QîõzÑéÖÆbTLôò +V¬dñ:Û„õ«_ýJúF¼·––¼7€°Ð¬-zB†¾ÅjjjÒŽIà |8”j©ØT 冸°°Âqhé]”•¬[·Îb1¨­3CëØa±„ŸCOOÈPô†j‚qÍš5›6m²øàâÅ‹±ŸÂád‘®¿ýöÛÅ‘y|¤¾¾žfÅÔýÞ(ï«2”…¥¢šêEÕÔÔX¬× i1 IÚ‚ŽR›n=vô„ ñ¿,NϪ©©ªœ,ŽL5¡Ñ‚,”  ÌÒîÝ»±“CØ…ê–!n± 7Ä&dýúõ›6m‚ĦvˆPŠ.ÀO±Ø»$u ê âÂÒrÉ%—“UŠ `>ŒB;ß§ˆ !>ÿüó1cÆÐwûwÕQÍ1ñ÷ƒÑ‚EÆ.¿ürl¿é¦›à   àç?ÿ9ÓôÕ­ZÁF®*ËzBŽ‹e±tõ$ttžpm4Z8%õ¤r¬ ¹ãŽ;ÀhmܸQ+)ȉÌ ³â`ëÉ‚cBXàÂCþéÖ[oÅ›ªª*iïSO=U˜L`ßµkÖ+³¤ºå˜pë­·Z¼[\\Œ¼¤ 쬧^0h»Ø"›7oÆc‹½*a?˜Â`½£8£r¬Ë0 ̲÷òåËÕ“ß|óÍ;w²žúÂ1Ô “Ôòæ›o‹©ï+K—B|‘†MT?rlý'¦R©ÓÒ«Uÿë_ÿ‚V’[]!’b=1ý‰Ùž9 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 Ã0 £Åèõ'S©T?ÞãL £÷ é%,¬!O_qF?Þà ,,ÆXXŒ-°°[`a1¶ÀÂbl…ÅØ ‹±c ,,ÆXXŒ-°°[`a1¶ÀÂbl…ÅØ ‹±c ,,ÆXXŒ-°°[`a1¶ÀÂbl…ÅØ ‹±c ,,ÆXXŒ-°°[`a1¶ÀÂbl…ÅØ ‹±c ,,ÆXXŒ-°°[`a1¶ÀÂbl…ÅØ ‹±c ,,ÆXXŒ-°°[`a1¶ÀÂbl…ÅØ ‹±c ,,ÆXXŒ-°°[pö ô’»ï¾[j9ùä“¥–)S¦ Ôí02l±[`a1¶ÀÂbl…ÅØ ‹±£×ŸL¥R†Ñû[pÏ=÷H-ßüæ7¥–I“&I-|ðÔòþûïK-]tQŸïî¢/˜-c ,,ÆXXŒ-°°[`a1¶0ÐQáÖ­[¥uŒïÛßþ¶Ôòá‡J-O?ý´ÔÒÞÞÞí·«7|×]wuû©cŽ ÇÁÂbl…ÅØ ‹±c ý¾ð ô¥:¢7lØ0©åå—_–ZÞyç©%#Cþ$ ©ÅårI-­­­RK[[›Ô2räH©åÚk¯Œ‚£Bư°[`a1¶ÀÂbl…ÅØBŸ¢ÂÇ«ô¥ß½õÖ[RKnnn·ß‹Å¤–P($µJ-‘HDjQcœ¬¬,©%™LJ-W]uU·w8$á¨q,,ÆXXŒ-°°[è“óþ§?ýIjüøãéËh4ª~Jj ƒRKcc£ÔR\\,µÔ××K- RK^^žÔâ÷û¥ÕUïêê’Z:::¤–;î¸C°óÎ8c ,,ÆXXŒ-°°[èSTxÅWH™™™ô¥Çã‘NèIžŠ›¨Ñ¥:€“““#µ¨hSS“ÔÒÙÙÙíª×¹úê«Åƒ£BÆq°°[`a1¶ÀÂbl…ÅØBŸ¢Âµk×Ê—;2ˆÒ ÙÙÙR‹:%ËçóI-ê_ss³Ô"¤B7¨^¹'K‰¨‘¬z?êµ+¯¼²Û+;Ž ÇÁÂbl…ÅØ ‹±c }ÚV.??_j‘ÚÔ˜B Õ1¾ž,¢NÛŠÇãRKO"5rTëNÕoW¯¬~ûÍ7ß,µ\sÍ5ÝÞÏ-c ,,ÆXXŒ-°°[`a1¶Ð§¨P-Ñt»ÝÖ'¨Q˜a©ç¨3ûÔèR½Ž:«QmQ¿K»ìöϺÈQ½Ãûî»Oj©®®C¶XŒ-°°[`a1¶ÀÂbl…ÅØBŸ¢Âp8,µHá›:G¯'q¢:O‰SãD5RSÇÕÙˆjM©Ú¢^G/Ù“èRÕE(o¹å1$`‹ÅØ ‹±c ,,ÆXXŒ-ôi^¡ÂHa`Oâ;µTï¼^o·ŸRW%UÇïÔ˜T¨nV Þ³'ª÷£F êê¦êªë¯nÞ¼Y <¯q,,ÆXXŒ-°°[`a1¶Ð§±B5¨‘·žÌÈS#Gu]Puu5Nìɘ£©©£™jœ¨®l£n™®Ö¦ª©êÿ†º–©ºÇúõ륖M›6 Ç˱c ,,ÆXXŒ-°°[èÓXá¶mÛ¤F)ÈRw#WÇÕ4u]PµbSÕhNmQ«:ÕHMTQÇÕFµUI{²ãFkk«Ô¢þoÜxãæ7Û{x¬q,,ÆXXŒ-°°[`a1¶Ð§±Â/¿üRjQK+%ZZZ¤5Â*++“ZÔÑ:uåRuATuôPÕ«'Ñœ:«Q@UÔñD5¶Uÿ®žìçxÛm·I-ëÖ­ëöS¶Â‹±c ,,ÆXXŒ-°°[èST¨" ó©Q˜:V¨¢FOÝž£Ž0ªsýJJJ¤u6¢ú©žÄ’¡PHjQcÉÜÜÜn¿KÕ±TuüN Ï7nÜ(µ\}õÕba‹ÅØ ‹±c ,,ÆXXŒ-ôó¼ÂÂÂBúRãSc%õ"j|§VQª#ƒju¨:p©Æ¤jKO®£F…jħ¢ÎaT¯£ŽªQa·²B5oذAj¹á†º½N¯a‹ÅØ ‹±c ,,ÆXXŒ-ôi^aMMõ9j]¥Z3©Æ/j¬¤F—j¦ÆSêNêý¨¨:¯P u…nlN½5ÞTÿ.5âSרQ[Ô¿¢'U¦j=m^^}©n“Áó ÇÁÂbl…ÅØ ‹±c }+TÃ.)ðQ#‘žì1¡ÆJj\¦~µzŽÑôdìR½²º&ª9ª1©»©£¢jýªZ+«Æ›êÿ¡ºŸ…:[³Ûý5n¾ùfѰÅbl…ÅØ ‹±c }ÒéÇû`œI¯‡t†a†a†a†a†a†a†a†a†a†a˜cÿãa®ô$lOIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/polylineroi/roi_getarrayregion_rotate.png000066400000000000000000000144721457240071200313710ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœìIDATxœí}lÕUšÇOÛÛh)}DD„¡$¾%ɬeb0™¸ú—B+½ ˆ¸q4+oñ]%®ÎNÑ :b@MŒÉج‘Én„ÙÉèŠâ¬RDA‘w‹PJ­½m÷#ßýî9z{éé}û~þ ‡§÷÷û[¾üžç<ç9ç#„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„ÈòRÝ¡ ¯¯/Õ]Èlòò¬“Hˆ~¤!ãÆ³ÆÆFŸþyÛ>|8ŒÎ%Ƙo¿ýÖ6ÚÛÛa¬­­µ¢¢"¿ûî;Û(++ƒqذa¶qòäIËËËm£«« Æ‚‚ÿò3gÎø—;Ö6~úé'#‘ŸÿAOœ8#ß Å72ÆÔÔÔØÆ?ü#~'»wï6'?‰k„è K!W\aii©mÀÓò&;w¸¸Ø6víÚãÅ_l#GŽ„1?ÿçÿ–===þ'ÙC>}Ú¹Ä3bÄÛ`·UQQaGŽ1".áû8pÆ‹.ºÈ6àR1………h㛲£?uê”Óp®J½±D$, K!Wb¬ƒÚÆ%—\ã×_m» gÃáÔ±cÇl£ººÚ¿ùÑ£GÑîîî¶ÊÊJüñGÛàŒŒhÊ\p4#ºaŒ¹âŠ+lã²Ë.ƒ±££Ã6w0”­àóýVŽ=Fþ@è%‚ a‰ HX"¹c5Ê6¾ÿþ{1kÁSÂø“ˆ·B1lD"Šó@ˆ·øA­xÊ9-d¤ å´ªªª`DnŒ'ò0QÃÑv˜>b#æypO“Ôü £7–‚„%‚+®uœYÀT ê ùˆK/½ƶ¶6ç§Ì”)SІÛâJÌó°+ÄÓ95€A>§0à×8q0fÌÛøæ›o`¼êª«lãðáÃ0²§F!gP²Áé ÎË$ÞX"–‚„%‚+1fE¸\SpôööÚÆž={`Ä8Ÿ“(2Á} ¥0pCaGx¸"0cÌþýûmƒ'”8`è3^ÈVL:Fþ"ˆ9†C ')8òK½±D$,„œs…\íÉe¾qÒ¤I0—ÅM²sÂCw® -))ñŸ¯„Ê ¾';8€d9Gõ|×Ä¢PÖsüøqÛ@¶ÝéàjÒ$ÐKAÂA°Dr%ÆÂØᎡÀ‹ÇÞ8xI'ÒÔÚúñÇôÁC ÒÓû;´iÓÌ’’Q·Ý6ùøñÎÎÎ+VØÿ˾}k&OŽ‘â‡˜'H?kiÉËÏ?yð byi+µü}Æå¿û]åŒÿ|ûíÖr_kkjUe’›Òù¬¥ª²ÔÕÕ­[·næÌ™ƒÔ+1.\رgÏ«--7<ø 1æ¾ÖÖ®¾:µª2ÉU7ôÑ@¤ù{ Ãl ¦ e¸@³ú¼îWÜC¹8AhÅ“*ˆ¢xž—sÍ&øh y?{USSSIIÉ£>jŒ©[°à7üã¿þâ±®.®×àp Ýã)#Ìhñî˜ü;I‚Á¬ÇÒ{kˆijjª¨¨xúé§í_·­_¿yÅŠ”¿«,ƒ\è'm VUO<ñOìÛ—¢î¸ ~¡_zúDBÁ î0Ìf¯‡C¿Øi"ÁÃFÎ,À—ñ'áËø /$ñãn?ÉÅp[Xv±lÙ²ŠŠŠ'Ÿ|2//“pµœyŠ›…b¯Š ¸Êƒ}q)MÖ{+(PUª;r>BÕ¼K[°ªZ•% ç!àb ikÐÉU™Ð‹)Ò'ÞBo»ˆ6a" ùâ‹/`DUGH=ðÜ0ÖbpÍöÄ‘]†ö†à)Df¼âÔ&&¢Ñh~~þý÷ßïô“÷n@¾€¶àiAÜ?îŒoWwž'q‚/ÿÒ{kPˆF£=ôPª;’(C±®PÚº@¬ªÒ›êŽ ©ßÑOÚ2gUõÈ#¤º#ƒFê…er^[Ù§*“>[E†Ž·0Pç RL¿Ä=®‚k8‘ð05 |9¢1Þû‘?ݦ ÊÊÊ{ì1rÅÝ• ] •}r8w«H.”@\ÈÅ¢è3'&xž* ÒâeÉÁ÷VCCCeeåc=–êŽ >i$,“cÚ²ªÊЛ~IWùDdÌ8#'Ùìwà4¹º ýàõx#\ÿÕÔÔT[[»víÚaƱ{E꟎[±SÃ8‚ÆÄ‰aä:îÀ+q¾︔éõƲdý{«©©©²²ríÚµ©îH@ÒQX&«µeUõøã§º#aISa™,ÕVŽ¨Ê¤aŒÅ b¼…Ø‚gK0&»COõ#øàJDcœDÀü ØÈ©¾¾~ܸqÍÍÍ6úðÃíO±)œ¡I^ÅŠ Œk+Ð=~R¼ ÷å<ã„oÇ›fq<—éûƲdÍ{«¾¾¾ººº¹¹9Õ"Ò]X&+´eU•¹U{IÖ®\¸ODœ“ËfóÒ<ø.ʃà47îÉ™wø ütéÒ¥v§¡¸ ÷öÑN¸?û/¸EÞ/ å¼ê9…ÁÙ¸_é~ÞšQIo,K†¾·–.]Z[[›õU%c„e2P[VU™^ š™$,“QÚÊeU™L‰±˜äâ-LªÄ=6’c2ðy˜üáxWñLˆ]JKKW¯^m?ƒ`JÇ3zôhÛàPd8€§s8… ŒÈAp´Ä³7Kâ:Éߎ«U“ ÃÞX–4o544TUU­N›ƒ¸RBF ˤ±¶¬ªr*³—Ìs… 9ŸÈùtdÌypÄõ(:àý#[[[m…õõõUUUkÖ¬qöYÀö“|&%òþ“&M‚it®¼@:€/Ç özðªìIÙÑÙòipúöÀ@§'É‘©o,KZ½· ªTw$-Èla™´Ñ–TåñÂ2i -©Ê'ƒc,¦ßx Cn®n@ìÂñÆá¼ÜCzÎ؈Į†ÀéH¸?ŽÉ4qyÒ q+&8‰€À›,0 bé)¯GåPMÊ36X›÷$öäȆ7–%%ï­†††êêj;(˜ì–rmYU=õÔSCó¸Ì"K\!8—OD™ó𜛆_àÌ;Àн±±±ªªÊÖ‚²3‚{åeÈh³¯Á—ÔÅ­Â@%»l$8q€§³Çö“†<5;xÿ¯¾ú FÞ†) ²êe‚÷VcccMMMÖ,$N ËÖ–UUV®2D²SX&˜¶¤ªɶ‹A¼eèx˸øW^y%Œ˜óáØÅFf #FŒxøá‡­1î>ˆ¸:Á¯Ú@ÆB„Ç!.çÒ Ì8ñ$•¿ç–ùÿ»0à¡<„â Ž yF+ ²YX欶åV 555t6DjÉZWêêêŒ1S§N½›XUeÖÙ©%ËßXàÅ_ܼyó‘#Gššš`D–}ŒX!8kÖ¬²²²­[·.Y²„·‚»a÷ ÃûG"_À^ —sͲ!œy‡Wåiø/ÞßÞ™—:Æ=3î&¼¨„7˜L‚ìcY6lØpã7r`‘ ³fÍ>|øÖ­[Cô*‹Éa™³ÚÐ%VU[¶l Ô¥,&‡„eŒÙ°aC\¿©êBHô·œÑôõõ¡¾à¾ûî[°`Á»ï¾{èС—^zÉy&߯‹/¾âŠ+°‡qÜéÄ1œYÀZ\³€ðÜγàȹ§p+N7àLÍÝ»wÈÿÿp)²!,b¦ˆOÿÂvìØ‘øÿÆÿ{Ð@/ÈÖ¯_?wî\T­cîüÃø‹/¾è¢‹²fg씋Â2gµ5mÚ4c̲;¶¾ð·޲?²ªZ¹reJ;˜ñäŠ+œ1c†mßvÛm°ßzë­ŸOœ¸bÆŒÚŠŠ±×_?iþüÑÛ·6Ì®±á=}°ó"qà`Ï[? èk0žgW…$—"ŸÎÕ 8§“ý#Š#Øó d1xï$)¸Ló§N’+ÿ9a´½{'O˜`Œ9ð׿Nnk›>¾Vn ¹+¬ªßþöùºº›çÎ}ê©§&L˜pçwFÚÛŸ[»öÖuëRݵl W\¡cyÛ˜yÆÄݲn¿1ÿaÌ‚!èVæ„+ÌQ.›5+úÎ;¶]]]Íçu¯moÿ‡¹sSÔ/‘ùL›7ÚkÛÛ‹iM‹ÉàhKªƒ´%U‰AfÚ¼yÑ?ýIªƒOÍÙT§B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„BôKò§:ùGj‰ì#ç~IXYÏ…üçîA˜"(–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–‚„%‚ a‰ HX"–B$ÕH1Ž¥¹¹9%=É2ôÆA°D$, KAÂAÈ­Qá<àX¦L™âXªªªËO<°OYŠÞX"–‚„%‚ a‰ ä%}e___^^ò— ,p,sçÎu,Ÿ|ò‰cùúë¯KEE…cÉ‘iŸ ù'ÖKAÂA°D$, K!{F…K–,q,3fÌp,_}õ•cÙ»w¯cñ¿T~¾û߯««Ë±¼ùæ› ö3ƒÐ¨P¤–‚„%‚ a‰ HX"™:*¬¯¯w,sæÌq,Ÿ~ú©cùòË/˰aÃKoo¯cñKÿNœ8áX Ëk¯½f2 EÚ!a‰ HX"–‚„%‚£Â¦¦&ÇrÝu×9Ä·cÇÇâÏú•––:–öövÇâøb±˜c)..v,ŽåÕW_5…F…"í°D$, KAÂAHÇQá]wÝåXnºé&ÇâwîÜéX~øáÇâÔÊËËK[[›c)++ë÷>‰Xº»»Ë믿nÒ EÚ!a‰ HX"–‚„%‚úQáÂ… Ëìٳˮ]»˾}ûËO?ýäXzzz‹?ÇçÏúó‰~M©ÿ,†±¯¯Ï±9–—_~¹ßg Š´CÂA°D$, Ka¨G…þ1n7Üpƒcimmu,þлùã2¶.‘ZPÿK%r•oñÇ’¾Å'úOã7LŠÐ¨P¤–‚„%‚ a‰ HX"aG…þž0×^{­cÙ³gcÙ½{·cñWí%2š‹DÜCóüÏ$2ŸèÝü;û#PÿÎþHÖÇ¿jäÈ‘ŽeݺuýÞgPШP¤–‚„%‚ a‰ HX"ƒ<*¼ãŽ;ø¯·Ür‹óÄçŸ áÂü“ ñù£0¿Ê4‘ºS\–HýêPÎÑŸ=ôŸžÈ4PÝ©F…"í°D$, KAÂA¸ QáŠ+ãÕW_Íõw€ñ«Cý¹9<åžü%NŸ>íXaùøÏJdŽÏ¿s"–ŽŽÇ’ÈÜeee¥cñG©ëׯ?wgE£B‘vHX"–‚„%‚ a‰ \ШÐ7>÷Üsü×>øÀùÀ÷ßïX***KII‰cñÇJ‰ŒÝYýçï/ê/ÿÎþ¬ŸßCÿ>§Nr,þø×–?.ó÷2Mdg›7š¢Q¡H;$, KAÂA°D.hTèÔîL‡}øá‡Î>ìßDZŒ1±øsjþxÊÇ=ùc¿Ó'¹q¢_›úã?öÛÃáÇ÷û,ÿ*ÿÎþ÷òc›6m2çE£B‘vHX"–‚„%‚ a‰ \ШÐYEhŒ?~<ÿuúôéÎÞÿ}ÇrôèQÇâƒü_éÏÄùë©ÏLdŸU"k}‹?¾ó¿{"§`$ÒCç÷ì/NÔ¨P¤–‚„%‚ a‰ HX"ý¯³;£Fr,Îf2þheΜ9ŽeË–-ŽåرcŽ%‘Sü}JáÌ™3ŽÅ_±èËü±["3zþ³üZÙDæ%}ü;ûWù£Bç›Þ}÷Ýý>(qôÆA°D$, Ka—‰,cPΓB!„B!„B!„B!„B!„¹Àÿ(®«N=Š©×IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/rectroi/000077500000000000000000000000001457240071200225045ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/rectroi/roi_getarrayregion.png000066400000000000000000000151021457240071200271040ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœôIDATxœíKlœ×y†Ï EJ¢HÝ(KâEвš ÐM×é*AŠ$ÍΛ íÂ6oºèÊÀ ¯½0ÕEÐEàMR$@‘U´;ÅËÀ’)²DÉE‘”HŠ”x™™.äpμ=3ž¾Ä‚Þg¥sræ¿ñóŸïý¿ËIÉcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ƼX”:þe­Vëâu˜¯&¥R‡²£ÈY?žßxã|øþûïçÃþþ~ùù“'Oš-¥tûöí|¸¼¼œ_zé%Yß××—?ûì³|800 ëwïÞeÁÞ½{óáÚÚZ>ìéé‘õrŠÕÕUY §ˇëëë²~ÇŽ†?ÐÇ›œŽ,0¥tèС|øèÑ£|(£k×®¥N)wüKcš`Ã2!ذ^\:öŸÚ¡µgÏž|(>“8W®\‘Ÿïܹ3NMMÉ‚£GæÃ}ûöåÃrYÿ«¨T*M~NæñãÇÍ888˜ÅÅÙ¿¿¬¿ÿ~>¤¾‘Ê%ݹsGÖ>|8ŠW×ÛÛ+ëå!Óm]ZZÚú÷è×¾ö¸\žÿôÓ&쿱^P޾üò7ò“ùõ¯‡ÆÇ#ŽoÃz9úòËßzï½ÿüÞ÷Þ»p!ȶlX/Ϭê?¾õ­gà ۲a½@”J%±ªg<³­'Ntó\ÿ²V«;wnkøío/ýèG{kµúgffòõòy3ÁY¦«»k×®†km¥bä2¬V«²^œ}" <å{lJicc£ù僧8ãü * ·@_{ee%êGéòÎÛ÷¿Ãÿ÷·ŸÊéÍ7ËóóŸ?ÕûÃþýÕWóå7oÞüË|y¿{÷îÖ¿ß~ûñôô7VWë_~?úè£|qO~&–‹æ§ù\¤”D(Eœ|×» ›ðg û÷7\ÒÜ\ÃþС½ËUfŠqÁÑ£Cù°ZÕÊ·þ–æ¾¾Õ)¨ÔÓ{üoúÿçã ës7SJßùÎãÿx÷Ï~v ¥täüùµ…±ã"2¬œÍÍ4=ýW‹‹õ0Ëo~ó«|ÿó’Ç´oß ,xðài>jXÀˆÊýû ß;äýqà€î£G jŸ¯Ìáá†3NO7|n8~\/xa¡áŒ|¥-,4\áÄDƒ%ñ*¦Ïÿ– RqýÓÿú‡þÝï~ùÃ>šž>þs«=rþü7úÓ_|ÿû-ß>ö±^8>|íµúùÏ÷ÿé×–Uu÷,6¬‘g¶Uò×V•ºø…æùâÃ×^û×ÿ»oýé/¾Ñ}«J ëÈ‘#[ÿîéyòèÑ£……ú+PœqÉÐH)ŒŒäÃùùyY 1œ–šKHÈ…NÞš_áÓ§ Nž¤©H„'!#ž”ÒÁƒó¡øòôÍ%ïexx8Ò)gŸ ò¼šž_¾úèÁêÊJý¦º=ôÿ¾ÀT5xÚElX&– Á†eB°a™ ©Â<„R­V÷ìÙ³±Qÿ-Ö>ˆf9vì˜,XXXh²žä±ËQÆZ ɤ*”[ ¿SÏÎÎæCq ÑÀÑÑÑ|8==-ë/\¸%üJ™,µ¼Â–„­¤’ 0¹e¦CÉ)$‹-Çä™s7òÜý_[[ÛØèÍ%H˾Ôíã7– Á†eB°a™lX&„BÎ{þ¥¸ú'¶fÄ¥ó.žf¾Ê3$ãJ°¬øÂ’/Eg_2´ø¡\jD=pDùÏÒ‘#làŽ#"Dpc=9`^(ñŒ\ßìܹ´¶VÊoŠ_ê;Æo,‚ Ë„`Ã2!ذL6,B×Ta­V››››Ÿ¯ç`‰Dâ&õ’NÄô&©¢‘"}–ýÈegMVéˆhâEHJ C:’/Å"y"ú¨òd´…f›g‰É0H•«ÂZ­V«5œBŽ_¿±L6,‚ Ë„`Ã2!rÞóBOÏ|ÿÓ§õ(‡x¾¬Ô}@Ä[—ì":ûâ{Š·ÎÅâŒ3aKN!¥,ÉwžÎ¸ì)"äŽ#ä‘‚vü’[¦Ékýý•åå§ùcáߨcüÆ2!ذL6,‚ Ë„PÈyÿôÓO·þ½±±100P©Ô»¯Ji}ó©©©|Èô&ùî,Þ7÷×Uœk:ïâ\K7¬„ °–»Ë‡oúÎÒaKšÕr‡ÑâË3K È÷DY]]ݽ{O~‘Œ%tŒßX&– Á†eB°a™lX&„nn„)ùX²‡;ëÇE4]½zUHÙŒhÖ‹Ê“þ[ì§%ÙQ²@va‘ü'ÊLÑ¡ :I Gž·<‘”2IPcŽ\Ró´J¥²¸¸xûv} eiÇøeB°a™lX&– ¡óžG$Êå…½{÷V*ºiÇt$ÅÓÑ‹kŒHˆïÌJLF"0ì®+Gà*R !¾6w`ʇ,ê—4Éb{ßæÝu[:ï̯ÊX«Õ®ßC@ã7– Á†eB°a™lX&– ¡›%ö«««++õ®À’%ÇMê%æ3>>. DUIˆ†5*réÃF)©…¢éT’Ä”‘;bÐIf$Ñ! É”ˆcJ§NʇÂù./;v¬¯¯Wri)×_¿±L6,‚ Ë„`Ã2!rÞóˆG­VëííÍ#âzÓÕטùR² &R#}š[°³èE~"î?wè;K©’Ôøß¸qCÖK‚—Ä”x|ñ¾yGyVÜîÝËËkyS±±±±Ô%üÆ2!ذL6,‚ Ë„PÈyÏ¿#—Ë ƒƒƒÕjýS²¤CÉV} Þ:7ËãfæùÝråâûs?Qò<áS¸øò-w÷kY¾‘¼§íJò›o6Î]"h¸ÍLþLªÕj©TÊ?ß³É@ÇøeB°a™lX&– Á†eB(¤ ó©jµ:333?_P -÷D])U:”™Rbß2$–¡%²” ^r <£è8¹Bn‘":ôôéÓùéSr|öÎ/iuuu}½!ÊÄ­@;Æo,‚ Ë„`Ã2!ذL…œ÷ÜU,•Jõ¤+‰?HîQBm ÆÅ™•õ,=˜Œ¤+q½xßâ§”.]º”Ïž=›ÙZÔ†8û õ r˼B òÜ¿?²É±¨ ¦ åt÷îêÇ+ù50FÔ1~c™lX&– Á†eB(ä¼çNµZ­\.çÉ=òÝ™[Å7g!²ì•-ž,ó«ä[¼¸º\/éJ¬Õ–›7o6¹žoš[¤ÈŽŠrÁüR/ ®D p?ÄæO,5æ­­­ 9R_ÃÒêŽñË„`Ã2!ذL6,‚ Ë„PHæùLåòÒÊÊÊãÇuÕ#ñD E8ÒÎ*!£KDؼÉqKYÊ|¬ááá|(%ð ˜´l º¯¥Š”˜´cº•(k¦¬åìܹ¾¹Ù“_$ƒTã7– Á†eB°a™lX&„®mq‘RªT:¥Jv““ÄÕe1…äKI/ÚË—/Ëz©…l7’RšššÊ‡ìw%)e“““ùéS-›È)¤¡—øæ©•\ |q÷¾zF®7SÚ—?dÞQÇøeB°a™lX&– Á†eB(¤ óB¥R‘*ÑDTp`—0 qHÈettTÖ‹ð”4½ééiY/MJhB:-˄䂙¸—ï8B(œó&Ç A0n©"E÷LÜËû"ÎW«{ò‡ ©‘EðË„`Ã2!ذL6,B!ç=Oß©V«ýýýëëõ¨‹xšL’ 6˜%HƒÝ¤Äùõ ݰ¼ÄSN(’‘ 3–ýˆ³Ì"™æm˜‘[}3;;+ëE¯ð‘æ‚©V«-,,üñuEÂŽ_ã7– Á†eB°a™lX&„BÎ{žáÔÛ{»\.çî°dæŸ9sF~.•t]%K¾Œó»¶ø¶âJ³R@ä;x‰¿/WÈÝýÄùåv¢$šo˜ÈJä‚™à%Ч¯¯/ÿ Sâ:Æo,‚ Ë„`Ã2!ذL6,B!Uøæ›oný{ß¾÷^ýõ”ê‡%†Ãt+YÀ=Ù%ä"ñ Æd½h")‰I¹PdÉ)$LDkB>u¨„\D£ÍÏÏËzQ¾RøDÕ)0Š•ßÂ׿þ«¥¥R©ô÷[3ütŒßX&– Á†eB°a™ZxM¨Õjyþïÿð·¿}ûáÃz¦‹/æë™¨/®â±cÇdAó -n:/ÎòáÇó!7‘õÌχÒa‹ñÍyF éLLLäÃk×®ÉzÑâ­³Ä^¢X¬ñÏÂÞygµZ¼x±þ'“ãòÉ'-õÁá7– Á†eB°a™lX&„®9ï|°üÝï6Û:›[;v ƒø3\¡œB|mf˜…>¢ÍÍôÖ[Ç?þ¸žƒÕEç½a½òÊ+[Ãr9ýàÿ˜/øðÃóáÈȈAT5 ˆ&Ù(F$[B›2 h0¦$›ç° ]tkË2!IEd[e©Ò‘g"š1¡HBLÜKG —eB¹íÖji~¾áŒ’ɸ´´Ô±au­£_µš67¥˜©ášÖ×õÏ& Xz$ ¾ìûú¾ÜúrY"f†•Š®—¶\Ð|˜RZ_oöˆvìÐõòÎå«Õ?ÓÿKØÇ2!ذL…|¬.^‡ùjòUXÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1Æc¾R¸‘iÆ_¦Uä| 3ï¼óN>ìí핼Pn0ñàÁ™’¶ßäÎÜ—=9e³‰´Ý0ÃÃÃ23==-3Ç—îsÑ×××r´]MÛu¼ånuìžJ¸eœüŠÛô]¿~½åa¿wô3!ذL6,‚ Ë„PÈyçÆýýýù®1·àAèÎÓ '\³ÿ~™¡˜hǧW;00 3ÜOZ6µKÛÉ îiÀ=(wd߃´¼ ‘͸FöÄ+ˆßX&– Á†eB°a™lX&„BªPömKØi-ßÐðT+ÜcœŽvâ’çΓª0Ùö-¥tôèQ™¡*äöqÜ/ŽA•ÙÙY™¡v“]æRJ£££2ÃðÑ… dfffFf¨‘:$3rÍËËË©{øeB°a™lX&– Á†eB(¤ ~’í¸©•˜¶Æl2FÐã[ZZj~ê„Àå¶g§æ¢ÔåÙ©%oݺ%3ŒxR»>1*GÆ%ÏŸ?/3|ªTÖ¢[™;Y¿±L6,‚ Ë„`Ã2!ذL…T!ƒhL¶l¹`rrRf¨ÔÚÉeî%ƒ_ëëë2³k×.™áMQOݽ{·åõPÍ‘–ñ»maÌñÊ•+2366&3sss2#)£¼ñ"øeB°a™lX&– Á†eB(¤ )©¤ï³()=X%Çh3?©¸¤Rc„‘·@ÝJUȺÂ'OžÈ (¯×CUÈŒVÖB2.É»`+ÁÖ"øeB°a™lX&– Á†eB(¤ ™)ý©_¨°¨ï¨ Ùd‘í$©Û e²' óE™±ùÙgŸÉÌÉ“'e†Í[îÝ»'3|¼fÞŸ¯™qRV,ʹx"øeB°a™lX&– Á†eB(¤ ¡Á¦õíô{i'¦FÈØ\;9œ¬îWÈÌXæÜ23–W(:š?)‚ßX&– Á†eB°a™ 9ïÌ’ÚIµÑkBje™¡^˜Çã°% ˶èb39qhhHfXFÆ´G¦F²™G;´ã¼Ë¹xØ"øeB°a™lX&– Á†eB(¤ ™Ç'9q †0 4>>.3TO ΰ¼‰ÇaóHj@¦RÍQ¥2ÄÄt<Þ)ÃPœa¢S¢fQòWTsTX—.]’™³gÏÊ sA©m©%Y/ɧÁkfô»¾ó‰µ¬—äc/‚ßX&– Á†eB°a™lX&„Bª-M$ÞÄæ÷”T+wïÞ•ê æ‚2zH­Ä_±ör(~oÞ¼Ùò ©Ë¨¹A:ï‚!<ö)¥Þdä´åSm' ¶}üÆ2!ذL6,‚ Ë„`Ã2!R…”'’¦HÕÚAv e*5ÜÎþí¨TfË ;À0«³¾:T|íhIƹ:7$§ú¦í"~c™lX&– Á†eB°a™ ©BÊIãd ‹Z‰õwíìqùòe™áå erÀ©©)™a7Qör™œœ”æy¶ÓW‡çb'U*¾v4)U3èÚÚZ>¤|(3¼ ÉMuRó`Ã2!ذL6,‚ Ë„PH¾õÖ[2#ÁA*5F¹Å&£cÔAü+òXµÇøõÏŰ•,3H©I¿£4›ŸŸ—*bîÊAJD':VhžlX&– Á†eB°a™Zk‡/¢V«½ûî»2yñâÅ|Ƚ!¨;&3íä”RQs>|XfXÈ_Q·ŽË {™2¢GÅdz3V811!3×®]“™–‰»i»œ[FN[ÎÍ͵£.·Åo,‚ Ë„`Ã2!ذL…œ÷.^‡ùjÒ±ónŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1Æc^4þÓø§$évOAIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/rectroi/roi_getarrayregion_anisotropic.png000066400000000000000000000141651457240071200315260ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ'IDATxœíËoǕƻ/"%¾$Š%JÖƒŠˆ€Aü 0kg1cg•M–Æx‘ÙÅA ‹cÌnV,¼ à’I€Y±`lc¶%Cï'%êÁ7yogQšÅïó°íÄ}¿UõeÝ瞯ΩSÕEaŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒy2Ê頻jÛïÃìdÊò;ÛI³+½úê«ùá믿NÞ{ï½üpff†:ܽ{7?¼~ý:u8uêÔÖNž<™^¸p:ŒŽŽæ‡“““ÔáòåËùa§Ó¡ÃÃÃùá®]»òÃn·Ký|˜:,,,ä‡kkkÔayyyëKÐÏ~ïÞ½Ô¡×ëå‡=¢«««ùáÇ‹ï•Æl =Ö•+WòCu•ôëÿä“O¨9ƒÙÙYê .Š Ÿ700@ÆÆÆòCýåÑ[îÝ»GöíÛ—Þ¿??ÜØØØúŠä] q'CCCÔ¾Ø={öP‡Ý»wç‡äD ùæÕç‘×?$^ˆ PÿBÒT* $mZèGQ›®ò;{öl~øÒK/凨R¶&™è[R­¤’¦ÖècꇢIÓ|X2<\--Ý#yÕVì±L6,BC)Ì#‹ªª*  h–^g (Aª[_!(­§RHB£…Ût†óçÏS‡_|1?$ÉÐ@•R‹6R¨¥‚ÔAÅ”ôj hVÊåxqq¥ÓéÐW­oi€=– ¡¡ÇÊG©££ÝNg…JÉ[h5•Îàä`tï Êéruú!êÂC:§Ž”ihLgÐ+R]MIÎ@½,}jõ²äV5çDE`Ú!?çÈÈ|ÿ#r“®Ç2;– ¡¡æþv` WU•3×Á;‰£ªuÐ0 ™®ó!¨]£y)š¡Ï¨Å µS:”ÓŒ`é%è-ú¡H¯u¡o®øI‹é«ÓY Øc™lX&„†R˜‡3}}eUU[ï¿£¹P-.#ÒŠ.¡»QRUq é‚U’c:ƒ~(š˜¢Š}EGTZ¨)%SU:ÚAS¿ØÍ‹;)¾f×`eBhè±ò_Þž=ݲ|¸u.D³)”ÇÒq.¹ÝÓïL·–¬Ý—‘*ƒu"œReÓÓÓùáíÛ·©?u¨ÝxMÒÔ¥Q£ BòÓ‘äN?E”’l†=– Á†eBh(…ù˜±ÓéUUE{*CôÊÅ‹©-ÔÍdh ¬ÙØê„.Éʉ'¨íaLº£S@µ»WÒ u©#ºpˆÊ­t·nRˆ¼CY–ËËˤéT@Ð {,‚ Ë„ÐP ó n}½êt:ÎСÆ&´ÒRWÈÐŒF…Z•KPبÂDY"]ÑJwUû!:¡ª3‰¯†ô–Ú¸²¶ M«Hò}}ë###GnªÉ®}t÷ÁË„`Ã2!4”Â<€ߨªó‚Qt£™²pª•ª¨(P@¤›PvQ…ŒÄQ•‹B]ꯥ‘éÆ 4ï¤Õ‹[oÚS|‹MJ·¾¥bs0;2R®®Þ§i"]]Ü{,BC•×ð¯®öªª"—C?nͦÐHY%”°ÑÙò‚ºs ýÜuz„’NeШJcµî¤6ÉD³+z Yt®Œfu$žÕ KUU‘è]5ÀË„`Ã2!lOuC§óˆR>¤S:¥Ccm­<¦Ù ý ïêè>ßa¬ø&1­Ýqë2_H†¾éK›ôZw›¡·èŒ A‡ÿ$dºo@.¦åÿ²Å%šaeB°a™¶E 7 Q *FPQ 0PIÒd…v JRO”Ö_PÐGÚZˆ¬Ðl‰†l$¾µ»èCá¨bBëImµò˜Ýkˆ—§ÊVVÖ»]¾Š&Ï`eB°a™JaG”eÙëõHû(HT)$÷«ÏÒ!­Ô%1Ëh’B•êpìØ±­ï®¨»ÍPÕ â4½IŸBW´ÖVÒ7¯‘o^Ç74´Øß¿A!¼*`eBhè±òNUUeYR½ ½kŸ û<Ñ‹ÖËÒUç¹ét¹(ŒÓì,y8ª’Ò±yíÞü”ÓI!Møµn•žÜÖé,ÐÿBëÒ`eB°a™Ja.mݲ,)E²¢{Ó¸Xk¡hœ«kÉišH;:ë´ „uœKQ[MER¨%¤SZ-M1~-‚¨2ÒÅtÖ(ŸL[]]ív»ôÏÒ2ñØc™lX&„mØ5y}½[UéylÍÇP}–M°¨¬NiÒˆæpjŸÇ¬ÂD¯PT¨*S»Œ‡b[½"‰©V7âkq"Ý•Vlçßd¯×+Ë’¦žtmpì±L6,¶,Xí’¬ÝÝŸ<6=¼´ø;ˆRáÞÔÔu {ÐB?’°H^i®C‰‡ªø’ÊÔ>µFS¬§OŸÎõ¡tšÎÿº†§ðÞ f'³ km­W–% iZ»»ÿ©S§¨-ÊÓÉ úaél •péŒ •;ÓV0…3QŠHgKÈÒ>… ÿuê>¦_¸p!?T—Cã}ZìTlN¿õõ­/-=¼qcÓ?K/Ú{,‚ Ë„° ÏÒëVÕÍoÐh]ˆÈߪ ÑPº6EôùçŸÓ+44ÖýjtN† OQ›d"ÝÑ¡7 ´šÎùé§ŸRRÏÚé÷–!víÚžšÚôÍ|ãˆþ»beB°a™Jap­¯WeYRާvöƒ* ´–ÔS;NÕNéÔn&£ªAÁ,m€£kh©ƒN§P¨;;;K¨†[gºTûŠŽµ>™Öëõúûûé¿S{‰oƒ=– Á†eBh(…yL71Ñíõ®Òv9´µµ†l$ZóNÙE ÁÈck& "j~Q+…t¨'$!Ó”,Í;iÖ—žc£ŠB6~¡ÍU¯óØvcccii‰¢W¯Ò1;—m(Mì•eIcFúåiµ+ýšõ‡E™-Í9ѯ_'Xj›Ó+ZÜL¥…@Z"FS÷u¦Khjê«tꊼÕç½òÊ+ù¡&óUüCCÝÁÁ5r{^bov.13sðå—WŸÙ™¶£#*ŒºŒy"rÛ²U™í$ÙÖØô´­Êl3o9ó‹?~Öwaþ?2<1ñ¬oÁcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1Ælf¶Š|ÊTUõ¬oáP–íûOµŒçÐ°Úø‘ý‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ذL6,‚ Ë„`Ã2!ô?ëhÂû￟|ðAj ¥ÆÊÊJjLOO§Æ­[·Rcii)5öîÝ›ýý?þ;wRc÷îÝ©188˜‹‹‹ùŸÖ××Óa___j Ó¥RãÀ©¡ïzôè]Û·o§Æøøø–_ÃŽÆË„ÐJµººšSSS©qéÒ¥Ô W&''Scdd$5ʲL^¯G}àZ–——©sò(𣣣©qïÞ½Ô¨ª*5öìÙCgƒÚ·o_jÀu¡>xð`jÀŶ{,‚ Ë„ÐJ)Ü¿j\¿~=50‚†rAøîß¿Ÿ w:Nóóó©±±±‘8¨-Hº¶¶¶–1ðÇ1ÞÇigffRãСC©……âBP@Üd½Øc™lX&„VJáÇSé+¤Ž ’Ùn·›Iªæææè$9€Z†jADŽ/^L D¯˜ÓÔ˜·Øc™lX&„VJ!t ³~ÈRB>0+eAÝ ›¨–A\}Ò™1W†zb²'"Å…0ƒ‰ó«¤âÚˆ=– Á†eBh¥BïvíÚ•¤¡wBè&â/Dv8!„I—ˆ¥Ü&¢B,/CÂ=à´¸î 7ÝDÁÞ…K·{,‚ Ë„ÐJg ùPMÄŸ°‚Oƒ5H þ¤ÙÍ›7S’—Ä =ÑÀì!zêz@( ÎWâÂL½«aeB°a™Z)…˜ŒC¦ÖÆ Fà >bPd)Q6ƒ²¼ çI©Qè¤Hñ'\…4¸a¨r§úY4£ÛFì±L6,B+¥Z†B ¢Bd"ç‰BH:ä6‘)ÅÊ÷¤bZt MÔåó(’AçÇÒHtÆ #„„R·{,‚ Ë„ÐJ)„Þ!È‚0!߈B( ¦¡›Ð;^Ñýg’þbÖ ˆt($ 7áC ˆW9¢W„@{‰½1Œ Ë„ÐJ)„|@Y‘!¾ƒJBñ.tÖ2Q„oP@¨d:!„á!4z‡@Og'q~È%N¨W4Úˆ=– Á†eBh¥"sˆ„ïòåË©¡r©YJ¨¤ r†fSS·¬Ñø#Ðû„°ÜÀ¥‘Úm#öX&– ¡•Rˆ©Ö¥ MÄd„*‰ð õœÈ[B±¥vZ¨ˆ÷B°4è qĤô!$¢K4Ò™u;t€„!¬C‰½ÁqçøÞIÅ ý°qc– ¡•R¨ î |ú,B( 1D|ºç6Öb¨È¦´ªîTð'db13¨R«•¨¸"TÒs…Æ06,B+¥ÑœîÒ‰y@D[ú$Ü-í¤!g)Fƒ„A õB¸+ HqETã 7K›~2…1Š Ë„ÐJ)D¤aÒ•ï*Cøfîtã5ü ¡YçÎ+ŠâرcéPŸ«‹›¡§ýæ§Õªd\5r´ÃذL­”BäURŸîŽXµØc™lX&„VJ!jZôÑ~PL½i|‡Ü)²”T<´r†81E…Ð)(,$ ]ˆ a}ÄŸa,þ455õ};{,‚ Ë„ÐJ)DÄÕ@šòeBA%ñ.Ä’úÈ{dS!^©³.¦ÀÙ ¾úPBt†vëS¥ ǸsÜp±Ç2!ذL­”BH DyK]!ˆ¼(6™8bŠP7=ƒÀa /I¢Bh®.0ÔŒ¸+äEqü@…±xߤÆ06,B+¥ð7ÞH è‚,„‡¨9Ì!"ƒ A˜ >ºÿ .‘2¢ˆÔôɺ'›æfÑ1 >™owÙŒ1 ÿ\v>ú4›çulÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1Æì(þN%-€3>qIEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/rectroi/roi_getarrayregion_halfpx.png000066400000000000000000000154141457240071200304540ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ¾IDATxœíMlfÕyÇß/{ÆÛ36öx>†¢ ,ª ÒHI•JQK‘²bÑÔìŠP$Ø%° ŠDé¦"EbQUª @%ê ²i:‚ÎØa¾ìñŒgüm¿vïÝ÷ÿ3ï½y¯Ÿ*Óùÿˆs}î½ç^?süüïóœç¤dŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1Æcn,zº>ssssÇaþ0éééÒBjeîzèСlóÑGÍ6_xá…lsçÎrúÒÒR‡«¥”>ýôÓlóêÕ«ÙæM7Ý$ýF¶ùÙgŸe›ÒÇŽÙæÜÜœtÌ6WVV²Íjµ*ýå‹‹‹ÒAnqàÀlsuuUú×jm¿ K—.u¸,/0¥4::šm^¾|9Û”ßщ'R·Tº>Ó\¿L|ùËÑ·(5c™ë‘ž~zÇÈÈüùóWÏœ‰»‹g¬‹ž~zfròõï~÷Á—_Þµo_ÜJÍXýýýÙ¦øLâ@¼ÿþûrzooo¶999)öîÝ›m e›•Šþ«h6›N§3??ßù‚»víÊ6ÅÅ–þçÏŸÏ6©oä‚2¤Ó§OKÿ±±±lS¼ºz½.ýå%‹ÛúÕgž9}üø½òJJé…ûîûÎ[oýã7¾qijªÃ»Æ3ÖÂWŸyffr²eU-^üÊW}ýõÝÐLÛBY«ZÝüæ7¯‰µ»ï~·ý‡³cÇÖåÜz½MÊnllH‡áá+nÍ F® Íõuç0  M4ÍÌ´õïï_þKKm8cõõµéÄz}-ÛœÕ µÝB¦ä;ôúÓÓmW½ö‡ÿìo›‹ÿ=°ðÊÞ¿ZN)½ùfïôt5¥ôƒ/}é©ßþöåoûÌ»ò»+KYÃzä‘Ù˜Ÿšª§”ú0û£6³˜›k{))¥J%çKX__ÛŸªÜo*ò‹”& W~O´ƒ;Úaq±í×V¯ëׄµµµÔ‘Zm³½ÙÖqQGØÛÛv a½®¯ta¡í ;w^{Ó÷þÉîß|Xú/,´ùXò!ž_öå 2žùú×þÙÏÞûÁ_W*Çÿâ¹ç¦?øàÔOš•ùG küôÆâŸî¿ÿ;oý繕˜þŽ¿úê6Z’à?…7o?ñÇ›©züÕWCïbú™8ÿ÷Ñ·°a™JùXãããýý3KKÕññÝ)¥‹Û¾ˆJ†dh$8ûrz‚;Ÿû•H:ÈçÆ+ÄçÅ[—áIˆÀH„'¥´gÏžlSbJüP'y/òùƒjC{Øapp°R©ôôô´¢C¹èÏX&– Á†eB°a™lX&„Rªpnnneeey¹ÒZ# A‰síƒh–ƒJ‡ÙÙÙýÉwÞ™mŠ(ãZ rSÊ#HD…Ÿ­%¦$".!³ÿþlS‚Ü)¥cÇŽe›çÎË6)“e­GxõêÕååÕf³Ù Iˆißöå”zÆ2!ذL6,‚ Ë„PÊyo4ÕjµZ­´$ž ¢¹)ê~ø¡tˆÄd$]“w”˜3TÅYfƘÜQœýS§NI‰A‰¯Mä0¿J¢FwÝuW¶É7&úFÄDJ©Z­®­­mnn¶òiE^ˆ:)ƒg,‚ Ë„`Ã2!ذLe÷J¥R«ÕZλ|§–d&"n¿ývé Îuçt«„ì"){Äå_}}}Ù¦Œ?Á>Ó^Eƒ ÷-ä~Ĺ–%tRÄ ¥433“mr}X³Ùl4z*•%yöÔC]ãË„`Ã2!ذL6,‚ Ë„PJÖëõjµZ©TZ¡²ÀœáQa¬Ä*1I¨b6’Ä”DµQòÈ€)cEÊ*©)’ |Ów– [ßX‚ž_žù[ÕÀÌÌÌÜÜêÚÚZksI’c,¡kø@:ȲÑ,\?.*Oêo±ž–dG=zT:È.,’ÿD™):”A'‰áÈà–'r‘5.‘!m™‚–ÝÅ^²´kþøcé/ ^SâõÅû掎 -Öj‹-¥"ù^ÀCt‰g,‚ Ë„`Ã2!ذL¥œ÷Fc¥Ñ¨¶>(ËwdI‡’­ú¼un–'¾§|wfµ\¹…øþÜÏCÔ€Œ?áS¸øò¹»ûå.ßh­sÿ.Éï¼Ù8 t‰ á63ëëëÍfsss³õräÛ=‹ tg,‚ Ë„`Ã2!ذL6,B)U877·²²²¼\ieJ>}:ûSj"!wOÑ•²J‡2S–Øç†€ä‚¢Ñ2´D–2ÁKw'#ä)¢Co½õÖl“éSr}ÖÞØØ¸tim}}½µ$IîÈ­@»Æ3– Á†eB°a™lX&„RÎ{½^¯T*Õjµå3Jƕĸ_Ö&pÁ¸¸–ÒŸK$&#éJì/Þ·¸Æ)¥_ÿú×ÙæwÜ‘m²´¨ qöÖƒÈ#s„ä‘!YäXÔSÐšÍæÐÐR­¶Úê)2FÔ5ž±L6,‚ Ë„`Ã2!”rÞWWW766ÖׯUJ•äùîÌÊ­â›s!²¸–âÉ2¿J¾Å‹«Ëþ’®ÄµÚ"G>ùä“ãIð¦¹EŠì¨(æ—z)p%j€û!v~c)¥µµµùùÕf³Ù’²ZK«»Æ3– Á†eB°a™lX&– ¡”*ܵkW£±ÞÛ[i%6‰„‘ø€¢„E8RÎ*!£KD/عÈq®,e>ÖÄÄD¶)Kà0É- º/WEJÌGDÓ­DY3e-¥40°T­.µÂ_òJ¤êÏX&– Á†eB°a™¶m‹‹OS²£˜œ$®.SH¾”Ô¢}ï½÷¤¿¬…l7’RšœœÌ6YïJRÊn¿ýöl“éS¹EäRÐK|ó”'(_D¬¬¬H‡³gÏNLl¬¬4[á©ýû÷gÊ'êÏX&– Á†eB°a™lX&„Rªpvvviiyi©2;ÛLH‹MDÅ!V “‡„\DÑ$OÏÔÔ”ô&KhB:¹Ë„dÀLÜ;uêTúb(œGGG³M ‚qKYtÏĽŒ-7ØÏëKjdú(ûSVüêÏX&– Á†eB°a™J9¸¶V;|8?3ÿ¶Ûn“Ó%‹®«¨ù2ÎïÚâÛŠ+Í•"/XÁKü}!w÷ç—ÛŠ4Vë¼a"w(‘3Á«µßIúß ôgJ\×xÆ2!ذL6,‚ Ë„`Ã2!”R…=öØ=÷¼¶¸¸«V»?¥ôøãg*1¦[IîÉ.2SâŒ?HÑD²$&!äB‘%·2­ ùXÔ¡r‘¨”ì)Ÿ |eáU§À(V__ßøø‡þû÷¾÷w eø+èÏX&– Á†eB°a™J9ïÏ=÷ÜŽ ÓÓ•_|;!âñÒK/e›LÔWñàÁƒÒ¡s†7gyll,Ûä!ÒŸcGŽÉ6ÅÕeF|sÞQB:GÍ6Oœ8!ý;§¸q‰½D±¸Æqqñ¾ûÖÇÇžzê©„W$×â‰'R·xÆ2!”- réRÏ·¾µr÷Ýë)¥;îø×ìŽk[­µ¼¬ÿzªÕ6-½s§.Ïâ¿ø,õºþTÔ{oïR‡Ÿ&L9ÌíïoÛ3V&à«ÕÚDsï80p2Û¼zUŸ¨Vk»£Ì(\Ý%§o6›ÃÛW®„O(e ëÅwNM}þõè²?úÕ¯ÚŠÙÏÍ鯭ÑhËô”—/ë{É’[FþVÒnäo÷ü¼ÚÁØXÛäO'íF†Ä;ÊÇÇÛò)ÎÓ/süc—…›u‰aq„­G~óÍmÛåë‹(kXëëéÇ?¾öð‡Ëþè'?iÛ“íüù6÷"¥´cG[ÑŸƒ5kåìÙN3ÖÐ.×\Xh{­ccmÜÊÇjû‡;;«Ži3,1ô­|¬¶!måcµý¦mûB{â„Aíïoû$»>Vú¿Á>– ¡ÔŒ%:®óó{î¹GN—†¬IØ™R6ŠáÞ;¢Ú¤lZnÊL™r:dRYVY¦ùËÈU=òÇTùðO­ü xARk/ûÏa®e×xÆ2!ذL6,BNÞEøÇüÿ#73ÇcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1Æč˙Nt]ƨT ÒgŸ}VŽHßçŸ^:H]Ð´Õæl²{Û–}X2Y÷p“£i«×Ī›W¯^•#{÷î•#¬FÌë°¤1¯L¸ù^£Ñ#,ÆÌºÜ<‹c–³x‘ãÇwl'\ÑÏ„`Ã2!ذL6,B)盉K‡ºˆ^Ä5¦s*ÅûÓV{<ë®*t±9f!Üþ„û1ó¥ Ÿ]v-H[‰Žo•»ˆ®ç~eðŒeB°a™lX&– Á†eB(¥ sI²xÚJò• ûPñ14Ä}ØØ‡ÛÝ2„BMZ­VåH‘{Q“RRzó^ieÍmî1×6,‚ Ë„`Ã2!ذL¥T!—Ή„¡æ"Œ…ä*Bª§"…ö ã‰Ìz¥nåYTŽ| –Šd’jŽ[ P#ó¬ÜH¥77×6,‚ Ë„`Ã2!ذL¥TaîJ´"›{Ù(›gö¡Þd8ŒÚúŽq@FôFFFä•#¯SDíRÍQ¾MOOË>)c—’ÛÝ_„g,‚ Ë„`Ã2!ذL6,B)U˜+jØ*Œj…g1:V¤J ×èÉ ýôÓO啯355%G˜çÉëpÅ"Ÿªz³HŽ+Ï’÷S¤dkqEöª(RçGê¦æV”ý½ðŒeB°a™lX&– Á†eB(¥ )Í$FÏu®¯o’OÎyžó<÷^@QEQEQEQEQEQEQEQ¥™q4úš—ÇóÅgžÙrÞyu¯¿õ_ÿõƒ¿ýÛj¥Ò³RlOG0øÿs9ÏW÷ïûKKŸ¯Ñg×Ô¸}6 T(4ú쇳Ñ' ´&*ÖjI§qèP£OÂ>h*\©†‡ßiD£ >[ ëýI¥02‚té4FFJ5ú„쀖އ»£ãŸóÏš®Vÿô¢Ó‰áø/¨–Ë;µfGÅ:©>°3´TÖ½îså^ÿCNs¢²R)tu½çW»º4'*'Îñ­"ê–rb¬Æ*¢n)«eõVuKyNÔ*¢n)ÇcmVuKywNÆ*¢n)õœ¼UDÝRþÄzYEÔ-Xo«ˆºÕîXaQ·Úë¬"êV;bµUDÝj/6Æ*b~~ƒ>Ki$iQ·ZŸ·Š¨[­L£¬"êVkÒX«ˆºÕj4ƒUDÝjšÇ*¢nµÍfQ·ìMsZEÔ-»ÒÌVuË~4¿UDݲv±Š¨[öÀ^Vu«Ù±£UDÝj^ìkQ·š»[EÔ­æ¢5¬"êV³ÐJVu«ñ´žUDÝj$­jéîÆÜ\£O¢ im«ˆºµÑ´ƒUDÝÚ8ÚÇ*¢nmífQ·¬¥=­"ê–U´³UDÝZÔ*¢n­'j•uk}P«V¢n,jÕ{¡n­µêø¨[kA­Z êÖ‰¡V­ukµ¨U'Šºõþ¨UkCÝ:jÕÉ n½;jÕÉ£nÕ£V­==˜môI4 jÕú¢nj•5´»[j•u´¯[j•Õ´£[jÕÆÐ^n©UI»¸¥Vm<­ï–ZÕ(ZÙ-µª±´¦[jU3Ðjn©UÍC븥V5­à–ZÕœØÛ-µª™±«[jUóc?·Ô*»`'·Ô*{a·Ô*;ÒÛ‹d²Ñ'qÔ*ûÒ¤n¹\S«ìMO¦§×íhÎu9J¥‚P^ïºLi >&&}ïʱcˆÇ}ÊšÄÑ£>‰ã nÙ‘f·Š¨[öÂVuË.ØÉ*¢n5?ö³Š¨[ÍŒ]­"êVsbo«ˆºÕl´‚UDÝjZÇ*¢n5­fQ·KkZEÔ­FÑÊVukãi}«ˆºµ‘´‹UDÝÚÚË*¢nYM;ZEÔ-ëh_«Èô4úú}-G»[EÔ­õE­úÍé–a†a4ú,N µªž&tË0Œ]»v5}:ïOSYånô ¼C<Žéiì܉™™FŸÊŸóíoÀ=÷Ü#n9ކžÑ»38ˆýû±iS£Ï£FsýŒšÇ-Ã0b±Øu×]àÞ{ï­V«ƒƒƒæææÞxã 4™^ÍfÖëºÂõ"ÇË/7KNüÊW¾"m§ÓyàÀضm[gggó¤È&´ Í“ …fȉ†aÜvÛm¾öµ¯¨V«÷ß?¿ß?;;»yófgœq€ÉÉÉÆ¦Èæ´ Í– …ƺeÆèèè—¿üeóó󺻻ÙþÞ÷¾G±¦¦¦dÿ-[¶øÍo~ÃÍ 3¬i­BF,Ò q‹Ü}÷Ýn¼ñFn^ýõ~¿ßårÝrË-|%‰ÌÍÍ¥ÓéX, …0†Y­W3[…¦ sË0 ·Û  R©ð•`0xûí·—Ëe_øÂøâ7ÞX*•˜1x<áp8“ÉœuÖY¨ék kr«Ð´©PØx· ÈD"ßúÖ·ÜqÇÞ|óM###r¹€`0xÍ5×”J%…BÁårÝqÇ}}}–––¤ÓiN§¦¤¹^†5¿UhæˆE·†!6”J¥¥¥%§Ó Q«oU«Õ믿ÀÕW_ÇÜzë­¨°ùùùH$˜×ë]—f «Ðü‹l˜[†a02]rÉ%?ýéOQë¼û|>§ÓÉhDªÕªü …®¼òJŠ511F|õ«_E-Î¥Óép8Ìܺ°°0==5ée«`±°QnQ¬K.¹ÀÏþs”Àçó¡66djóz½ìŠÑ-f½|>õÕWS¬T*à'?ù j™‘½4âv»'jw£Z¥a6² ÍŸ …̉4†nvvvÈår¡P¨\.Ó'˜Bw¸ãŽ;(ÊUW]àcû¥¼óÎ;„ÃaKKK†aпդH{YE,b©[†aôöörÜ÷Ãþ€×ëÅŸ— …‚×ëeìaGJBk ù|@WW—ìpñÅ`ÏÌ0Œ{)•ãÎår¹b±ø^Ý|ÛYE,²q‹§T*Q ÔÒœÄJóꫯæóùP(Ä8T,H)Käxøá‡\yå•ÜüÔ§> ß|óÍ£££¨:ƒÁ`"‘ sf•íhl',sË0ŒŽŽŽjµJ“*•J>Ÿ/—Ë‘H„ƒDÇãr¹ä-CCCÙl–›Œ@ܧP( Çãp8<Ïj>@ P,{{{k‘À_:ÍyoÐãa³T(ÌÌ`ÇŽõ¼ƒ4źæškÜ~ûíò:³§qfggøý~Õju|||hhˆ»…B¡#GŽ0Ú-,, ºöfffôööèèè0==}ÓM7U*•¹¹9í¡‡bˆbþÍd2‰Dõ?þ#÷WuÊØØ?¥©–TÛœèJÖ×-®“¹âŠ+<øàƒ¨¥¼T*U©T6oÞ<99‰Z@bÏ¿fF8jôú믣¦N"‘ÀÒ×ÌÌ »ðÑhÔáp°[”ËåË/¿œŒD"î»ï>‰DõñÇ'Ï:+Á¡ãb2™„Mô²Á)‡õrË0Œ­[·.,,P¬Ç{Œ&öxB*•J¹\fLâWé H§Ó§œrÊ믿ΰÄ.>>àØ±c¨ÿ #sc›Ûíf÷ˆ_â¤áþýû £VÐ"| ËZÔîðáß÷ù|ÃÞ§žšÝ¶-L3Eò³¼^/s%j¥v´QD«Š…U»Åžº]|>ß¡C‡8è÷ûý~¡PˆÅbR|J§Ó² µ¥Ì^¯—1Ìétú|>zær¹B¡£Ñ¡C‡¸w÷Ò/~‘9óÌ8E­p:77×ÓÓÃã »\®ºÁ©hµ>–™ã÷· ÃØ½{7€…….`§óóóGåúOåryvvv¶ö ÷ÉÉÉÉÉI H¹\®Z­ŠU<šÌüÈçóÒ¯B-ÈmÝêþùÂlq¹\]]]LšT«U³I>Ÿ¯§§gjjÊ^á ­-ÞÏ­cÇŽ]tÑElg2sÇ@<—^9aO‹©®®.ŸÏ'kM Ã(—ËR¯gÂüÞR©ÄÚ×Wzæ™Ô9çlZZZŠ×îhèr¹¸¹°°°°° 8;ÒâbaãÄÅÅEsP9í´Ó6mÚF%©ùý~ùj4eçZÞ¾¼¼Ì¥/Äçóy½^ÖHøýþb±(ñopÿöoiŽI<gù€Ûí…B@ ‰0æuvv2‡ÚŽÖ ïæËWñxœsp½½½+«í’õòù¼Ð,--¹ÝnŸÏÇþõÌÌŒ9E˜››3 —L&·m >õÔì™gö±èšÍfÇÆÆX0óù|‹‹‹’pLOO³ø¾ÿ~ÛåA´p罎•}ùÎÎÎK/½µif JÝR~,¯3š‡o„Ýÿññqå¼^ïŒimk:îììôz½ÃÞGy{xØ ¤<gQ«Jär9yvvVì<í´Ó̦ڋv @_’Il߉ u¥„……¯× …¦§§¹L%—ËÉ…ö¬Hqµ1_ᤲt³z{{Ëå2ëï܉ýý•G?ADÂ`O+•Jq!!jkšYmgЪT*n·›Ç·)m$€X É$z{“{öìùèG? ছnÐÝÝmNCñx<™LJY’!myy™±ïʬ4G£QöÜù®ååe™“îë+=öØÔyç˜ÇXeïÊì7g©9) àÀṽh“>–™X Àö®®2€ÙÙÙx<.C³J¥R©TdYA èëëc~dš«T*æ±^¥R‰F£’ÔØ©xía¹|ø_ÿuêôÓ»€¬îJ¥ØÁ" ºÝnvã¼^¯yƒíh;± ÃØ½{è_þå•þþw¢uµZu¹\ÌGhvvVV¦H¥R¹\Ž;pÿjµ*Ó‹ù|>Ns Hr¹³Xeÿ~$Yq €EP(Ä@úûûÙQc0ãñ-ÿAXLÛ‰`qqñþûÿßå—ÿã³Ï>êr¹äŽ Åb1‘HÈâOÓÓÓÒ…îééñz½‘H„Y¯³³³»»[V@p ‚ÌŒt<ñÄÌöíï¬S0 #“ɼõÖ[¨-c§a²ŠfxxØ<ŒF£v¬‹ í(§Óy×]ßzê©·£ÑwV²KI³R©ôôôx<Ã0ØsÇã‰DÂ\‰0G ‘H„+±x¨r¹Üß_yôу§žê°iÓ¦jµ*]õ‰‰‰ºòéÔÔÔË/¿Ìe¥´-›Ímž;k¯‰ö‹÷€džúþ÷¿¿kצ'žs:çÙ­.•JÇŽ3ßYÊ’4ǬÇ$È®‹«”fii)‰D¢úÌ3©¿ø‹žÁÁÁÁÁAó%Ô===Ìwår™Õ,.MFmÙªH»\ó^´×¨\qÅ…Bƒ»Í›}ãã…}hnvÑh”!Êëõòªyö¦Q[÷Ç‚;ׂ9rµ²ô†áõzûû+O<‘=㌇z쉻\®L&#>ìÕI!ƒEv¹ÑˆÛíÞd»+êWÐ^ @±X4OÈtuuíÜÙÿÒKÅÑÑ€H$"i(™L‹Eóbö¥¥¥¥¥%óºÐååeö÷–º»—ž|2ÉÞ”¦³³S&¤=5¸É _å²U•JeffÆ|¯ûbã`{¢†Ço¸áwÝu—˵¸¸ÈîöÛog/¾øôƒ³¨E Öâ™æ]æææ(Ð)§œÂåÒÖD¢úŸÿ¹ôá0µ¹\.¯×K‰Ýn·ùnrIÔÂÂ7†Ãá#GŽØ:¢ S¡¹ S7üoþfôßÿýÀ¹çvÍÏ;+• _t8r±!ÇkTÊüvÐÕµøË_.îÝ»3€Ûífm‚±Ç¬õ2Ǥr¹,›¼ß|±†}i¯T(¥¦0)ÍÌ̼ñÆ»vmzá…ùpø«<d1^ž*W¨2'NOOs¨—Ÿ{.ÿw÷!Ôb3 Ô?y½‡ý~4åÃápoo¯ÝCT-õÍÃ0¶mÛÆ[ÝsÏ=¨M'ËÝúÆÆÆ¸Œýÿw|ïÞ!Ó²Ù,‹™2]ˆZ¯(ŸÏ /¾X9ûì¾²2ÙMMMq È ÈiDÊÊCqF(Çb1FÄ\.—N§[@²6ŠXÓÓÓÄ‘d2™4-[Þºu+Ã0Î>{ä™gûý‹Œ:ÖjÈþ iƯ~U¼ð­@`yy™+Y)]^^®»ÚGÖ]¡¶”Ô|2-Pm7Ób†±}ûv¶{zzòù<#ÊÀÀ€ÃáH¥Rããã 'J¥Ò¹çnýÕ¯f9Ÿ‹Åb±˜äÐB¡ ·ôõ1V™¯ø;räˆÙ?®ø¥b±˜ßïg¬\. tuu™'¡%ùÚÛ‡ÜÕ@±>ñ‰OØ·ojy6˜/:5 £Z­²ƒ¿ÿÛùH¢Pè¤*²:àt:ûû+\µG-XtX^^v¹\¢Q¹\v8W²ÊÊò#%b b®,‹Éd²ò Ú$b¡6’022222b^ÌÞÓÓcþíÒª©©©½{Ï|öÙ Ÿ/Ç®:w憡!­à÷ûùFº‡”Ê Ã(•J²²ŠùWÖSpöšo´õ ÷•´¾X2£â÷ûï»ï¾£G¾öÚkŠÅâòò²³°°P7…÷Úk¯qÆà³ÏNtwW 9Ž\.·y³óñÇ'ÿþïÏc:::ê®Åp¹\²‚‹Ùx½^Z‰D\.OÆãñ´L¸B›¤B˜ôJ$Lgü­3Vñ¢B¶].̰”ÕÑÑñ?ÿsè¯ÿz \ŽŒ'ÕçžËïÙÓÏ·pæ˜=0æÊÞÞ^&Góxè Ã$')4½dx+•J“““-#V»HåFÃFGG½^/¯G¥Ì_拘e²yÏžáÿþïƒù‰ê/¹¸gOÀÄÄ„Óéìèè`Ê<ÏCص’Åò¥RInõQ©T:::i›y¸Ú´Èßlj"ìœsÎáíe²Ùì¦M›äFÜøH’h4JÃöïÏE£8ûìM¨-¨â"ûFýýýR¥R ,7˜o™lŽ…ü*‡©Tjnn®eÂÚ'bÕQÀ„Ãav¢åŽ£ýýýæõ¹ç+$º­CÝÅì0ñÎ `\ÄÇLÇŠh0”a„L)ÊU‡­D›Š%¬4Œ¯cÇŽÉhè„a•Jµ444Äûؘžžžšš’ZW"‘(•J²0£a TæûlÉ ±•hw±„:ÃÂá0ËWìBñE¹ƒ‰F£æKɸN ¯—g~ääa*Ü×x±ýꫯ¶RD;”NY5Êûèìì4_àÀÙhÉ’,4È3Qä¿ÿýï¹Ã[o½e¾­kñ…BAî|d¾ò¬eh©¿+É¥šûa,¦†á÷û9#ć.Q2V"‰#;ïp¾™±Ðãñd2™™™™‹X-õÍXŠ688ÈÞ’<Þ@gg§ßï÷x< lü£”¼Q.ù’õÊ<ÏØØX‹Yíc­žºNØ?øA¹‰ˆdÉR©tôèQY (kšç²Ù¬a<²s600`~ìj+¡b04LâÐðð0#P$aÇëðáÃ}}}årY–-Èóž¸ cµ{ß:t¨õÂ4ž˜úì/¿ü2—]vûöíÐÕÕÅÍï~÷»t®­ÅÚ~ݱKP±KhÞÎûw¾ó6N?ýtËËËÜ<|ø0/¼ð€l6ËM—ËÅÆo¼ÁÆ®]»üîw¿Û 3VLhÄR,AÅR,¡ñ£BâÎ9çnö÷÷³Q*•ØøÃþ`||œ›^¯— Ö«ŠÅbÝëœÉðñÀÏ~ö3nÎÏϳqï½÷®×É·:*TšK±„^ýõlÈ ÌöíÛ¤Óin¾ôÒKl;vŒJ¥b>‚„eæ>É€’gffØàøqÓ¦MÜœ››[×oE9±K°¼ó~à 7À4Ãøà­·Þ27’ɤœ §óϤÏçólóëlH¡KBÇ{÷îåæüc6¤wÛm·­ò»hg´ó®4*–b ëÜyÿú×¿ÎÆ–-[ØøÀ>SâûÑ~Ƥ6"Á6 ²Q­VÍP(ÄM™ºYZZ‚iõ•¤NÙáèÑ£&&&¸¹sçN6þøÇ?žÌ÷¨¬XŠ%¨XŠ%œì¨+ëÉ€ëÅ_dãÕW_…)OI‚“WaÊŒ\¾‡£B™á‘²–Ïçƒ)uÊ297fI©cþùl<ù䓿Cq= ò^è¨Pi"T,ÅÖ8*|úé§Ù`=óµ×^ã&W"èììdÃï÷(—ËÜäP@$1Pö÷xÑNF‹Êêш¥XÂÉNéð¯_þÖWîÀÈ$ëŒ%ÀHĪ HÒ:#ô¸eꆬ\à%Šº.Y²\7Y´òö§> Ï«~ä‘GÌÝ&OÐ(MÄ#ÖºŸ‡Ò̬!b)Š¢(Š¢(Š¢(Š¢(Š¢(Š¢(Š¢(Š¢(Š¢(Š¢(Š¢¬ÿ]·.1ÌÚ©IEND®B`‚pyqtgraph-pyqtgraph-0.13.4/tests/images/roi/rectroi/roi_getarrayregion_inverty.png000066400000000000000000000210141457240071200306630ustar00rootroot00000000000000‰PNG  IHDRÈd¸ç pHYs  šœ IDATxœímp[å•ÇtõjëÕ–lÙNì$6”@ Ɇv2, ³ÝÝnÙN?Ðia:PÊða·Svf S:-ÚÒmaZ^Ú’OÌ´S¶3ÝíÒ](ÛlÞ–„4¯NœØ±,ɶd½KWw?ü£ÃE†à8~,]éü>dž+_]]Ë¿œó<çyî½D‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ ‚ Bgakö t"†a a³É÷/\6FÁÁÁ±±1Ö«-q4û:8tÍ5×Ñüü<U*•&Ÿ“b$+„cÒõ×_öìY"r¹\D4??ßÛÛKD§OŸn×l(kåaŸ®¼òJ" GŽ&¢l6KDDd·Û›wŽÊ±V ö )onnNÓ´@ P(x·Ûm~Ëš5k ÃhË %b­PêÚk¯-—ËDäp8òù¼¦i¼ÃÈÈÙívMÓŠÅ¢ÍfCèjK¥€ˆµ|8D…Ãa"Z³f ;wŽˆúúú¨ny½^"J¥RDøGÛ~ÿmû‹©ƒ}ºúê«áßï'"„+"Éåræ.F‚6› ïÍår‰D‚ˆ×­[×–ÙPÄZ*ìÓÐÐÒ\.—ã×}>9Nd=Õø~¿ŸmëëëÓ4Í0 §Ó¹z¿Ã*"b}00cÆ DT*•ˆÈÜ""¯×‹4::j·Û®Îœ9CDxK$áý!òc»ÒÎ#ÞË„ 壣£‘H$“ÉøýþH$’Ïç‘Ú"‘ˆÝng?zzz²Ù,zå`Ó¦Mº®#&%“IÃ0t]Ÿ™™Ñu÷Éd2}}}íW…—ˆÕÿ‰Èëõf³Ys‡©X,R½ÔIDårÙ0Œîîn"ªT*N§GØ´iv=qâ¿w]×ѵòz½xo›!b]€}Ú¸q#MNNÆb±r¹Œè‚~÷øø8j›`nn£¿xúè£ØÌår@€×Ôê`sÏžŸøÄ‡ˆBTŸ$"ÇÃ;œ?o|êSÃÎ`3F£QîŸy<¯× }‘RN§¹Ê‹Å<J_TÏ «µ,MGD,„¢`0HD©T w"ššš‡ÃPgvv–ˆœNçž='n¸!âvkTÜq,ñx<Åb±V«Ùl¶ññ 78öîºùæñ …ááad=q¹–H$|>>ÎápLLLлÒ„B¡öXìÐA«¿¿+¢b obÖÅf³íÝ{ê/ÿr]¥Ò‰?DOÞ²xÜvã®ÿú¯ù|Þív¯[·Žˆü~¿Çãq»Ý0•ˆ\.—Ëå2/%­V«ÕjÕ|2m¶R¹­~™äÅ_ôûý=ô®ë¨X"ýñ\Þg®».0>þN¹2›Í†B!•b±úúúü~?êýýýD±O|¢ÿÿw’ˆ Ãh8§Ó‰j~OOÛí®T*Üà ‡Ãáp˜ýF%b¾‡U #R!Õ³!JTŸN1¯Ž …Bÿñû·näó6Ä#ªÏÉ‹0–„.ù|>™tlÛÖý‡?¼ýöMèƒcZ0‹a»ÝÞPb z-Þãñd2s·½··· ²a§ˆÅ˜+D”ËåðÞ·oüSŸÚT«eü~J§ÓÅbÑãñ†Á%ƒÞÞÞT*…UV¼š/—ËÁ‰ùyÛöíþÿþïCûØÌÛhšV­V±š †‘ !Û¸DÌÜå².• ].×~ð"ºçž{ŠÅ" ðx<§NÍ]}ïÛoOñžÑhÔ¢Ð%G ™ŸŸŸššBÕÀårù|¾H$¢ëÑ¿û»‘×_?EDº®›‡xÙlV×õZ­f¾¸žKhÅb±\.sÐòù|W_}µÕ Z$–Íf;{ö¬Ëå2¯³›ŸŸ?rdúCr>=ODétÚï÷c%B4E^ã?¹×ëõz½]·Û êÂyPß"¢……‡Ãa^úW©ƒMÌ6¢æŽ¸¥iZ__Ÿ¹So]:H,æ¹çžóx<©?_¼ê*·¦õööö²p¥R)“É '„?s,‹F£===DT©T4MÆ6a®†%Úöíþÿû¿*^è§ëºðv"²Ûíf¹!WȪÕ*.õ±4%–Íf;yò$Já<ðÀ[o»õÖ1»½ñÆétÆb1s' uKîôtuu…B!ôº°Ð¥»»»V«¡êõzÓét>ŸŸ™±ßrKøÐ¡Ôäääää$wÃçççS©T2™$"‡ÃQ©TÐIǬÊ®€¥³aÇuÞA­V»ÿþ¾é¦ ÕÀ4Mà *—Ë¥iš®ëñx¼V«¡FÐ9ã• ét=0§Óéõz+•J"AwܱþÔ©36xÏ;7<< ùˆhhh¨aÊy``ý­3gÎ@k¿ßoN¸VÄÚcÚe`ÆÖ­[ÿó?¾ð¿ÌÌ”wïÞ”N§].—yͧËåêïïGqÜœ×Щ¯V«¡P¨\.ûÝÎÕ)Hæv»£QýÕW§IÓüö|>;qñ×ë=}ú4®äA·V«?ÞºE‡Ž‹X6›Í0·Ürí¶mºäv»½R©ø|¾r¹Œ‰äH$’H$¸è‡Íùµ.Ctuu¡ Å™ËçóaÿDBÛ²…ff´sT ?‚|è¼£3g³Ù’É$¯¬ÕjÖ-huV‹ˆfg‰èd&£Q$1¯ÍÒ4MÓ4ö)ŸÏÏÌÌ`‡×§›KPX®Î«Šu]ǵ7Øt8v»Ýíù«¿8rd> 6¬» ‡Ã\A¥ú Z­²|&V¤³Äš¥ÑQ" †ñꫯÑ£>Š a¾ 4›7!W2]./sõù|¬W2™L&“|q¥Rοþë¡7ß<ƒØ“L&Óé4Ú…B¡Z­šWU`É¡yi¼Eé T«ææ.Lïlݺ•ÿœ  ÎÌÌ UÍÌÌàoïóù0RCßȼ´áêød2‹Åúúúfffx©1Ö2$Ú?üÃèÿüÏ©µk/|ááp°§§Ççóe³Ù………J¥‚E÷š¦•J%§Óyà 7X4vJÄb«˜l6ûÌ3ÏP= q}dd¤¿¿ßœ†\.'¸J¥R*• …¢ÆÇÇÇÇǹV*•Ì˼B¡Ãá(•J'Ndÿþï7œ=[ÅÄ3Xv4‰ôööâÚŠ£GZwɃUÏû’XlÕË’ñxü®»î"¢d2™Ífy©Õ‹Xü§íêêòûý<ôóz½ÕjµX,bmB__ßàà ÙöD£Ñ“'s·Þ9p Ž –ßïC7«X,vww›ó/Ë}ã7Z± Õþ©ð=­B6Ä•6(ròŽ=Š1ŸS«ÕÌC¹¹¹†?³Ûí6 „ÈÛ2™L¡PƒÜåšž¦[n 8¿þú 3Æãq^§U­VÑæ4šÍf­˜©í#Ö{ZÅÄb±ßýîwh†«!âñ¸yi<Õ¼óŸÝnÇ!e0ÄÜ3vèêê2ú°pt|¼ðÑz^ý”®ëóóó|ƒI"²Ûíæt\,S© Z+ùÕ¨§mSáÅ­bpÑMOO“é.VÅbqpp°Z­:\\JD™L&‘H¬_¿žê½r>Üâ2U­VýF‰H×õ|>¿°°P«ÕøRœtÚ{ë­Áýû§Çƺ©^tå”Z*•Ο?ODCCCPsE¾“Õ¤=#Ö­""—ËõÍo~szzzçÎx¥X,šWb™ã 6'''ñJµZÅÌL&“ÁT#ÖÕ˜÷o¸<Õn·{<,s˜˜(üã='NäxŠÏ2§ã†…ù¢ #ÖÒ­Bã2LÑ$“IŸÏ—ÏçÀÖ¯_2zWlLWWWê)¿ße ½½½}}}ˆU¹\®V«Ùív¸ÂKÿr¹l›™q|üã=o¼1¾ys¿aº®W*•p8Ì×B&“I¿ßo­‚V»E¬¥[ŃAžøëïïŸm¸ºÆf³abÇï÷wuu!mA,Äîã;vìØ±cØDŠëì¥R‰ãWÞÏœ)Ýv[×ìG£Qó +Nž‹ˆü~?/´ í#Öò¬²Ùl(\D”@ €€„ªÒV4õûýÝÝÝæ;;š‹òDtöìÙ³gÏd½‰‰‰……>”¦iæ{.,,`¸Hhó7kþíßÙíö@ ÀÏDá›PÑøC ÛD¬eÇ* ëú~ô#Ž(X̹¸ Oõúg"‘à»Hvuu¥R)óÒxLé4„¤K\W‰»Q.—s¹\é´÷Ö[#ÎØl6›ÍfžSº÷Þ{ï¿ÿþeþnMÂ2Á‹p™Vqÿ}çÎÁ`p×®]TïBU«U³^X ÂÁ ÇãÁZS(ÕÓÓ£ë:–9 äð“) ,ªêæ«qPDÅ¿===Åb±V›úÓŸ*7Ý4¦ëúW¿úUô®ð¹Ï?ÿ<>|Ø]xË /Ó*ª ÇÆÆx50‡.ø®¤^¯÷–éîî6w¨‘øxZ:òÊ…®®®d2‰[Ð`å‚Ëå²ÛíæÚˆ…ñ¸m÷îÜ¿ÿ©ïÿŸðâ7¾ñ ª?CÅJËœè{rùVˆ•N§ï¾ûn"zå•WWcØ›jµŠûyà§p £¼ùùù‘‘‘£G¢Ï„@…!™×ë-•J(èã§\ #"‡Ãqß}÷Q]îî…»ï~jãÆïÜ××—H$pù%ô²pÄJ¥hll¬¢zÐâR$T…Bgnn.ŸÏ¯]»–'ò4Mk¸ßÝnçk£y•²a¡P…B333< Äþâ$»cÇŽZ­–N§ƒÁ aÏ=÷½ürÏÞ½ç¶nÄ tÎøFm­UÅJ¥èŠ+¨^oZœN§ùòvôl8Á &“Ér¹ÌImbbbxx˜™˜˜€š¨ÂÃ^hU,qJ\£Çqo¾ÎK/½Ä7p#¢ãǶo÷ïÝ;õÑ®«Õj˱ XæDͨ° Ï'¢¯|å+v»ý‰'žàBh0ÄZaX‚d÷öÛoSýnXÐeUŸÏ§iWÛN'ßÔ½¨Ïþódz>ÅîÝ»?NõÙF›Íf~´S*u˜h ‘õ.×±^ÄRaÕ³!_$CïNyÝÝÝær2×У2ßÔ>•J¥J¥ò¥/}‰ˆ Ãàõì<òÈèèhÃi GÅ!Úl¶XŒöï·˜Ud9±Ye¦!…Q½—m¾ ¹Z­b˜ÖÕÕÇ<*UP爈èÎ;ï4ÿ¿ø¯ì;yòäÐÐÐÚµk³Ùl¹\ÆŠzwÊ›ž¦-[èüy2V-€•þ+¨¶Ê0 ,‰ ¯¼ò ÕïíAõ€ípi ^ÇܳÇãÁì5ÕµÀ(·C"¢§Ÿ~šLwŽ4 ;#ÿ>|˜.Ú…ŠÅhÿ~+¹e™ˆµ ± Ùpýúõæ• øó{<žÙÙY\Qƒ¸ÂY³xœ@¿üå/£¦€Jé¯ýk"šŸŸw8Õj•‡u’/ûÀ.”åâ–5ÄZ«ÌìÞ½û³ŸýlÃÚb»ÝΩŠê%.¾ôþž{îÁ$ OÔ|ûÛß&"„@" `¦Ói^‘|I]rk¹e±VÙ* îÀŽ;~ö³ŸõööbÔ†›fñBd¾‰Èƒ>h¾qè/ùK"Êår===XãõzÞx9Ͳ‡xr«ÕÅZe«øÆÝ<øç9N§Ó™Ífñ\¸‡~! ãħžz Ýy€ñÑ©S§h…ªPVq«¥;ï«l0  'žx‚ˆ¾óï@2t¼î½÷^ª×*•Ê®]»`Š}}}™LK×'&&–—ò–Bë÷å[7b5Å*ª­ÑÑQNp¹\îk_ûÍÎÎ ÜËê[ßú–ù]Qè›ïÙ³‡¥è$[?nµ¨XͲj1(l2ßýîw±Ä”I§Ó6lèíí}óÍ7ñÊêTÉ[ß­–#•¢æ.Ä5 ãñÇüñDZ ô‘Gñx<¸í¦M›º»»¯»îºë®»WÑ4\гšÄbdª¶-×Çj‘XeÆ®]»0ß÷ì³ÏRý‘]WXéÀW¥6w"¯5û[­µ4¹E¬(DZ­¶yóæÍ›7ѱcÇpC[æ#‘)'¶-±ZÊ*,ÏZ»víwÜAD?ùÉOp3Rjv|z?Z3n5Ÿ¦÷«cÆ–-[}ôÑ&v¡.‰–ío5d’L7jŒ:Í>‘K@Üz‡Ö´Êºˆ[Db•:Ý-±Jë–X¥šNtK¬Z:Ë-±j5é·ÄªÕ§ýÝ«šE;»%V5—ötK¬jÚÍ-±ªuh·ÄªV£Ü«Zk»%Vµ2VuK¬j}¬ç–Xe¬ä–Xe-¬áV"A¦§„ Ö ÕÝ«¬K뺕LŠUÖ&£ƒWìh+v]a*E–ºì@hÄ0Zõê1é¶[—þ~šžnöI\qËŠ´ºU@ܲÖ° ˆ[VÁJVq«õ±žU@Üje¬j·Zk[Ä­V£¬âVëÐ>Vq«h7«€¸Õ\ÚÓ* n5‹v¶ ˆ[«Oû[Ä­Õ¤S¬âÖêÐYVqK5h·ÔѹVqK}}T ]#n­,bÕ;ˆ[+…XÕˆ¸uùˆUï¸u9ˆUCÜZbÕ#n]*bÕR·–ŽXuiˆ[KA¬ZâÖÅ«–¸õ~ˆU—‹¸µ±je·ÌˆU+‰¸Ī•GÜ«TÑÉn‰UjéL·ÄªÕ ÓÜ«VÎqK¬Zm:Á­h”ffš}H{»%V5“vuK¬j>íç–XÕ*´“[bUkÑn‰U­ˆÕÝ«Zëº%Vµ:VtK¬²ÖrK¬²VqK¬²­ï–XeUZÙ-±ÊÚ´¦[bU;Ðjn‰UíCë¸%Vµ­à–XÕž4×-±ªi–[‘%Mø\aõX}·ÄªNa5Ý«:‹ÕqK¬êDT»%Vu.êÜ«:n‰UÑJ»%V ï°Rn‰UB#—ï–X%¼7—ã–X%\Œå¹%V Ì¥º%V Keén‰UÂ¥±·Ä*a9\Ü-±êâØš}-M2I›®ä+þ†×»] þ”‰F›rRÖÀÑìhibƒ®_ä~7žXS«½ó¢ÝNë"çú»¶U›wj‚•quw/›5çÄÞ^J&éû…‚Óãiꩵ:öfŸ€ˆDèèQêí¥Þ^:z”"‘fŸT¸$"J¥(™«–ŠˆµTš~õ˜µT((A"Öãêînö)XëbTK¥“o¼ñEO9þÚkz¥Ò”SAAAAAAAAAAAAAAA¡¥XÎ=H ÃXñóZ›mUîU+buËûsËý±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%ˆX‚D,A "– KP‚ˆ%(AÄ” b J±%8š}+ÆñãÇÑ8|ø0½½½DtÓM75íœ:‰X‚D,A N…<ðmß¾›£££h‹E4~üã7åÄ’ˆ%(¶Œ÷†a³-ç—Ã#<‚ÆW\F__™úìo½õwÝuÏ<ó …B!l>ñÄ«t®íÅòþܱ%ˆX‚Z·óþØc¡ñᘈJ¥6Ïœ9ƒÆë¯¿ND ØÔ4 cÇŽ¡±eË"Ú¿ÿ*±`B"– KPBóG…Ä}ä#Áf,C£R© qèÐ!":{ö,6Ýn7¨W•Ëå†×1“CDŸþô§‰èW¿ú6gggÑxöÙgWêä; -„ˆ%(aµG…>ø <³qãF"šŸŸÇæÁƒјžžFC×uó8,#÷qäœ833ƒÆkÖ¬Áf*•ZÑ_E¸±%(ï¼?ôÐCdš‡A|"¢“'Oš‰D‚ކÝþ.éóù<]]]æ×].\èâÐ…qÀí·ßŽÍ_| îÝïÚµk‰¿E'#w¡…±%¬pçýë_ÿ:6l@㪫®"Sâ{á…ÐàÔ8Øvww£Q«ÕÌ ¿ßMžº) dZ}Å©“w8wîMNNbóÚk¯EãÏþóåüŽÂRˆ%(AÄ”p¹£B ¬x¬Ç®7Þx·ß~›LyŠ¿’ËåÈ”±| y†‡ËZ‡L©“—9ð¹!KrkÛ¶mhüæ7¿1 ë…÷CF…B !b JXæ¨ð·¿ý-¨g9r›X‰@D>Ÿ ¯×KDÕj›ÊQ04÷w:hpÒDÂj˜Øa2™ H©dšäAzå©!.¥^yå•hLLL,é·.‰X‚–±¸4>>N¦ž5G étšˆÂá06yO$ˆUä2¥ÈÔçÕ 88OÔp¯GæÑ§Bn ²Å9ôôéÓhpA«§§‡ˆ>÷¹Ïaó¥—^Zò |±%ˆX‚–™ yp‡ç5Îh4ž~úé‹ýòˆ%(AÄ”°ÌTÈéE¦†ž8™úΜž8Wò´4<à¾6O*ãàÜ7çÀ¡8còz,>Ü—ç×n\ÃK–ÿûß_â× ¼/±%ˆX‚–™ 9› Ä™ŽóNÃÊqшS’æâò7°Ïñž(•-®œñÀIvñh‘Ï·hûÌg>ƒM®o}á _@ã§?ýé¿¡‰X‚D,A ËL…œnã8¯q]”wÀ8EòÒ¾ ’&g´†#Ó¢a#ð'òÈK ù- SCdʪHŽœׯ_®t.‰X‚–±ø?"Ðâù¾*³ÎN¸|õ~w•iX†Eõ_±ÈGÀžØxn‡Ÿ€€´xXÐ0¿Äwäú⿈??lçÎDôä“O^ì»Þ ‰X‚D,A ËL…œ˜Pš››»p¸w÷‹©Þƒæ|Äp/ùˆ«Pœ§øtÿ9Er*Ä/—h˜MZœs¹¿à7rNäIž?þñü]ï…D,A "– „e¦Âd2‰FØŽ s] wᥜ$¼$²IDATœÑx© RÕâ"?âyÎ}Hyœ×¸TƯ4œ™HÓ|@~êÎm·Ý†ò2?§îùçŸï¯CX„D,A "– „˽iÃÀŠçv¤›@ `Þ¤E+Óùæ<ÕÓòøÈœm‘ûx¡ï¿xôø|É+ŽÉ§Äùzjj <ÑŽG‹ÂÒ‘ˆ%(ár§tð¿Ÿÿ¯/Þ‘‰×s€áˆÕ¸Áu,D îqóÔ X¼À‹ ]xZ´ šwààgmÞ|óÍdzìôwÞ‰ÆÏþs.ŠD,A "– „e¦BîA£ÁI„‹Iœnð#Εœ§îKÃõ-žÒi¸r•+g\CîãælÛp(žááI$žjx44?Uúšk®¡ú3È´rKø@$b J±%,ó;vì@գūíxMçDÀ5œÂªø.4œ+žÇ£H^3ˆæ1ÀîÌÆëûxÉrÃdÑâÛŸ2xø?¯úå—_6t‡|Zwãÿ¾&ïó+—¿R?übABˆ9ÐׇŸýì ¿ULóáܪ"Ò–¸0æ¢*"m‰¹2wUiKœŸ U‘¶Ä¹˜Ÿªˆ´%ÎÎBTE¤-‘ÏÂUE¤-ñ‹¥*"m `±UE¤­RÇ…ªˆ´Uº¸S‘¶Jת"ÒViQUi«T(¦ªˆ´•|Н*ÒÙ‰žžî+ŠATª"ÒV2‰VUDÚJ»vE¯*"m%‡]»°eKÔƒ!m%ßTE¤­x㧪ˆ´W|V‘¶â‡ÿª"ÒVœˆ‹ªˆ´â¥*"mùNUE¤-‰¯ªˆ´å#qW‘¶ü"ª"Ò–/$IUDÚŠžä©ŠH[Q’TUi+’­*"m›RP‘¶ŠG騊tuaçΨ‘xJMUDÚrKiªŠH[®Ø½»tUE¤­Åg÷nÜuWÔƒðik1‘ªÂH[‹ƒTUˆ´µP¤ª/BÚš?RÕ¹‘¶æƒT5¤­ Cªš;ÒÖ\‘ª.iëüHUóCÚ:RÕB¶ÎŽTµp¤­|¤ªÅBÚú ©jq‘¶©Ê ¥®-©Ê¥«-©Ê5¥¨-©ª8twcÇŽ¨Q4¤ªbR*ÚÚ³Gª*6É×Öž=ؼ9êA”$IÖ–T-ÉÔ–TåIÓ–TåÉÑ–TåIЖTå'ñÖ–Tå3qÕ–Tå?ñÓ–Tâ¤-©*^ÄC[RUñ][RU|ñW[RUÜñQ[RU2ðK[RU’ðE[RUòˆ^[RURÙ¶ =ѽ¥ªd¶¤ªR€Úª¨(Öýnº ?\¬›‰Hùýïqãó9±|ç¼ø"ÆÇÑÝ=Ÿû‰ÑÝ¡!üå/ŽëŽÒV’‰rn(m%•mÛ¢®8H[É#ÊZCi+Iø¢*"m%¿TE¤­¸ã£ªˆ´_üU‘¶âˆïª"ÒV¼ˆ‡ªˆ´â¤*"mùOüTE¤-Ÿ‰«ªˆ´å'ñV‘¶|# ª"Ò–?$GUDÚò¤©ŠH[Ñ’LUi+*’¬*²s'ºº¢D‰‘|Ui«˜D¥ª²î ì܉ãÇÑÓÉÍçJQáÂ(+Ëÿ×ܶ ¸ûî(Á=ÄA[A¬Zµjýúõ~ûÛßÈd2N:`ÕªU>þøc###ZZZTUUøä“OjkkÔÔÔP__àôéÓ***°Ïøø¸õ¹è¢‹LNN¨¬¬pòäIëY__Ï;.]ºÀ§Ÿ~j£:pà@ž°î¾õõѨ ó{ükQèîFs³b¢+î¾uu‘© :ñÙ·‚ X»víøC/¼ð€}ûö¨®®0;; `Ù²eÈÅ òòr333ü“®C{cT]¾|9€þóŸ Û·a‡û׿þ µµÀôô4rnwèÐ!:åèè(rŽÕÜÜ̯̱¨ªŸÿ¼I_He”7º»Ïäò~j«¿¿ÅŠ< ®®95448vìrÿ´äèÑ£¦¦¦–,Y`bb9é°Í?1©E¶y©K.¹ÀêÕ«Œ!.W¯^ÍS(n*•Ÿ>¨ †BC1qñDUˆÜ±ˆ·¾ÕÖÖvüøqäd†z?§oMMMÙ)l766¦R)ô-žH¯bÈcJÎ`700 ©© ¹GSdžN[¢ç>}š FÆpgø¤*øàXD¾µ`òGUðıˆ‡¾544ļŠ)9 ôŒ‹/¾À‰'ðùŠ×Úµk °|À잎ŋ0gbbÄ„ŒžÄ,jåÊ•È%øW\q€#GŽ g„K—.å‰,p0-[±bE{û0âªàcùÖßÞÂE?c¦uÛmGR©`Ë–I`2ü"S¨ðƒöåååáÉ&/ž!úCr‹Äη::F2™ §§!ê,2‰r,²ˆ¾ÕÐÐÀi¡[Ðlø<43š¿e:gsüzÖ«èIœNÞ{oE&SÞÓÓP^~f²É)ëïáÝæXìÀ¯hfƒoDü¶wôôàØ±i+‚•+WÞ~ûíž|òIäB—P¾ô¥/!—Só_~~øða.*3Çg¬¤ìý3#ÀØ}÷¥Cù'/ÞKȰH5ùË_¦^¹‡¥ &òÃÃÃ…/^‹¤…BÃó˜ØÑ1RS3{ß}©¨â ]t±XxLœ™™)ÜCãáçô*Æ8öáÎ㦦&v  øÉÄÄÄæÍã5{÷¶67#We-ƒ‘÷£>B.µgèdŸ#GŽðRœF0»ç“a¾‘XÇ"úÖæÍã X±9/Iv,²ߪ­­e”IOøQ0&@ô®Ò°²À>ÓÓÓLÅhf¼Èøøøwž¬¬,Û±£¾¶ö³ÝyáÂ&ºTxk2Û³³³,ŠZ.ÜtÁ7îX¤« ­­Øº5âaÜyçÉššÙ;ê"GQH¾c:ÖÖ­è뻀³†††ø:Pš o¡¡“±Ü@¯btff†)¿Ü´i´¾>ýðÃ+fg"W†àEØ“žd¯0E.'ûÊW¾‚\…6•Jq‡§°‹´¾QŽE:;ÑÖomÚ4RS3ûðÃmÜ;"JűȅúV*•âL‰Nx^x>ÈOèdL§jjjx811ÑÞ~réÒ%>ºæý÷ÿÀå—_ŽÜ†ÇO•ñ²<—™wòÍÍÍ´1Þ—›þhu¾QBŽEŠì[íí'««g}tM‘îç ¥åXdî¾599~ÙZø|7=ƒÖ~oÑÀÀÀäädgçdeezçÎÆŠŠÏV‹:d§„ßÏ2:Oï+¤Ÿ1uëïï?1Æ}8y¯ãöÇTŠà[“55èëó÷MCN)EÇ"sñ­ºººðÓî4Ö®ø˜g‹´~K?»çÛ·gÒéäªS|‘«êL•ÂE|ºTØÃ˜oÑ–8lnn¦¥Þ—éšo”¨cG¾uç'Òé`ûöÌ"_7V”®c‘óúmƒs=¦;´– XŽâ†wß}ÀCÕ¦ÓÁž=KW¯®Cn3ßãÍ©%ß1Éy_¸ˆÏ>\j¤K…½Í~/£_òÝÝá÷MúCI;YDßÚ¶m&öìi>פSêŽE¾È·Nœ8Á©M…ÞÀ,‡kvL†˜Bmßž­®ž½ÿþ*`¤¾¾žOÜÓ‡X£bŽ.zñtfWÜbEhÜÂÀ”Ž»µŽ9Â9 w4„_Xâr¬3,з::†««gwïŽëñ‹Žë3 }kllŒùmƒS3º³œÜ‰“ÕÕAoo0C³™ššâ*!'n´–ð“E/ÚKSô0fTL¤h“´Fne®¯¯ç}éš~ø!>ÿªpc}ŽyøÖ]w§ÓAOÊDˆ+ó-«W¯׊.½ôR俉4•®®©tºê—¿,N1U¢Á”——óZéa<‘¶G³ ¿’“MÞÂvœ"·éª®®ŽFVËxAžâr¬³@ßγâ³yóX:ìÚåû›±#Á£ç:|#¶¾üòþë®û/¿ùÍos#fZ7Üð·ÊÊ©¿ÿýfä’!Z ®­­)æOôv?½ÃY!½Í~— r›Ùi,¡Ù8á½_\»ävø7ê)¸Ð›ÉŒœÕ·®½öåÊÊ©W^ù~ñÇ<Ò¸oAÐÒÒòç?ud¤vݺ}ÈUŒ~ñ‹²t:øÃ.Ãç熴ÚOkk+ëU<¤Éñ‘CÚLøìÉ‹ã8p9W£Ùïµ WÔøÀ*;¼óÎ;r¬8ñâ‹ß¯«½ýö3¿a«»{:|0NoÆŽÍ ÏÅÅ_Á_ÿúï­­o®[7ÔÒÒR]=»}{féÒ35$nHç®,îТ! ‡ift¦p.ÅŠ|ø Dæaá ^4'¶ƒ àW<…Oîsšé™§o„_døoàYà‰hF3¼ …b®x¹OS!„B!„B!„B!„B!„B!„B!„B!„B!„"qÌçU]o$ §H¯t“°JŠùýsë5u –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX –p‚„%œ a 'HX •Q`ñioogã‘G‰v$¥ŒK8AÂN(›Ç9A”•ÍçD§¬[·Žï|ç;l|ôÑGxàÈÆ”æ÷Ï-ÇNˆ½cmܸ‘ï~÷»l¼ýöÛl|üñÇÆÆÆxøÌ3Ï}tI@Ž%§¦¦Ø¨­­ecddÀsÏ=çvè1G¡PxD ««« ÀUW]ÅC+S½õÖ[ùS*•b£¼üÌÿ–t: `||œ‡f]üÜzZ¡ëñÇw÷SÄ9–ð K8ÁßPÈà›ßü&€wß}—‡dãäÉ“²%K–°199ÉFUUUø‚"-h²âe‘qhhˆçŸ~Q”x£P(`£¿¿¡ò¦m^`ãn>„ö2XE”Í"`}}½?¯'±5ëÀF‰O …GDïX·Ýv€›nº‰‡¯¿þ:V¯jllDÈ]̱X¦2£²! ³AK³Åi+_YnÎKUWWóÐ’zKÿY³þ¥¹KŽ%ùä\~丣P(<¢HŽe¯o¼æškØ0‹zçwZ ¶‡þ˜›#gQf3Vv¢3YñÉ2kƒe6c'ZšOS4²ÆÄÄD¸ƒ˜÷¹yçŸþô§¹ý5Ä9–ð K8Áù[“o½õV×]w-8p€ ¬Â…‹q| Ð:ä­[Kö­ Å+ØçdíÊy'Ú¼ÁV£¬îeá˜,DþøÇ?fã±Ç;ßßG© ÇN°„\Í -:\ýõÞ{ï=Úñ¶ÀÂY›E X6O´Pî\´ÈhËÆÆgWnhh`Öhx) vb^¡ËB^ÞN/{.èøñãlØÃûI*qiV(o}âÄ òA#Äó9…Bá–pÂv 6 ͒Δ÷› r¦/ú1Íó’´aë¬È±„$,á„y&ï\ɰfÍ_ÿú×yøÒK/±qôèQ6/,³¶Èei,Wl 75ngÈû<ïW>[ÃÊN¼iÞVæÂKå%û(xgdᎠ6,tZàË{¼ÇFbÑùÙgŸEÜPò.}úÀ˜H$ì.1Æì߿ߜ:u Æ«®ºÊÃxç{¯¿¾kñâ’¾}ûÂXVVf¾úê+û÷ïoÚÛÛaìÕ«—=—·¶¶ê˯½öZ{ÐÑÑcQÑ…È_~ù%ŒòVx(~‘1fðàÁöàĉ0âoR__Ÿ†°¢1Å>Uõ0k×ïÙS𳟵§>5ÖD@XR•Åjë§?=™ëÉ%a_»![ª*//·éŒMêêê`,))±»ví‚qèСö`À€0^ø¿å¹sçœ3ÿügS^~ì¹çN/_>ÐsúôiçcL¿~ýì¶***ìÁ¡C‡`„ˆKŒ[ZZ`¼úê«í†TcLïÞ½qŒ_*ú“'O:ÎUiê/Vä¾U’ßÿ¾_SSïåËçúErCx…iUYòY[!V Te±ÚZ¹òTêSãE},ª:xð =¸æšk`Ü»w¯=¾ BkéN9rÄ 4HßüðáÃ8îìì´•••ö`ýú¾÷ÜÓúÌ3'~üãR™QkkksŒÈ\Ho F¼†1fìØ±ö`äÈ‘0ž9sÆ ï`D¶Bž,ï·rذa0ÊÒ t_¬Ø|«$ÕÕÅ{÷¾ðB[êSãB¸„KUY¬¶V¯Î—üVˆ„cUYª«‹ òD[añ±|«jÈ!öàØ±c0¢j!KpÂä™ð·àBI¤‰(™‚¿õÊ+',èX½ºý'?)ƒk%K.Èi!#eDNk Ø;¹1YoA¡FzKÒ±CùHQçÁ=MZõAI(¾X±ÿVIª«‹›šz­Z•H}j”ɽ°òJU«­åË¿L}jdÉñPØcªB_€Ì, ƒ>#ƈ#FÀxüøqç_%ãÇÇ1†-Ù‰€ŠÆÜêêâüÀ,[vüé§ÈÔ‚|™ÂÀ¸&Ç·ûöíƒqòäÉöà‹/¾€QŽÔhdÙ´lÈt†ÌˤA.¿Xyø­’¬[×·©©×³Ï~•úÔ’3a幪,V[+Vİ"7¢ªÀºu}››‹â§­øX9Qª"²]¥ ép`ãÂ={öÀˆ8_&Ðd‚û‘  ’nõ—¿ÜpÏ=‡_|±ýç?ÑÜÜl² $&€w–޲“&M‚QþøˆÒ‡CLRHÏ/ zú‹ÅoUR^ýê––’ýhêS#B ‹ªê«­çž;“ëÉ=7æVU e·§l+ÐÆªª*1–%M²Ë„5Bw9Ç¡´´T?£:/~ùKóðÃå¿øÅÙ+Ë Y`.Ó}€±LöÄ¢QÖsôè…MÎmwÞ ÈnÒ4è¡/¿UÙ°¡¢¹¹è©§"¿Ç]O‹ªº"¬¶¢žßò.,ª* 6l¨Ø·¯è™g"¬-¿>VxT…ØîŽŽ—Œ½ápÈ)HÈB ü-™Â€ã%}0uê¨óç»Ì¥‰9™I™øé ïå±¢¥­xóñǵ³fooËj”™&H©­0pQUá1Y)BS[¹%„ª2Ùên¿¶f#ž7ÂË‘ ¨êËyp­’nÊ%ݸV²¨/Jfp¹ìðDñGnÍ/J®§`¯jh88yòˆöö ¯Š–Ù¯!Ý5¼žôöm‘«cÊ¿Id­m&üÚŠ 'Lvî\¸¾U–lö¼S[=‰UU{{Af«Âø"Ë/Zma 9áa¶õ°é—4ÛËF™YÀX&ÏÄX&7úB?éò“²¹Ã¦]>|jâÄá—$ 0ÔÊ5“®,GU,è +r,Nƒì«=´ÚŠ ‡Ÿºîº~%%a—Ï(µå«ª¶6“YþÒ;¾ÆgjËPUøñèø…J[è Ë.âX6a¡ٹs'ŒèJžR²}s1dÏJ1زˈµ!dÉž™œqjõõ-¦­í”óžríä 䯲‘÷OZq’ËU$­óÇoD*mEšúú–I“†·µµ¤>5xU©­Ì±ª [n½{z"m!Ë [ €0XÈ­œËa WÉ$r2÷3åÖèYIp¤ø±ãf]]ÓäÉ#:; /™ë‡Ì¸œÿ˜t®bÒ¡P&Öq•@3\5¹‡’kaÐV©«kš2ed{{’DWÈ鹬-µu¥ÔÖ6M:²½½À «[¨­àÔÖ6M›6²­-J~•¤§ëL¹Ò\ Y½AQE†ÙÈAŒ=FôAÈ¥Ð5 ÏÄÄ é·¡:$÷*‡#S6ȯ¯?0|xi"áN.•½ð¥;…Bì˜Å¥1cÆØébi é%Ý#89(`ò»Õ=õõ¾ñk‰ã©O 1¹©ŒS[—ê*º# ÈYËEk ±}ÊÅ0BÉ31FÈq¹\ë 2\Gl4À 4÷í;:{öÅÅâÉÆˆaKŽãÈ›466ˆ|½LaÈQœ|d£ŸÜÏ" rÙËÃï–dß¾£UUƒúõ‹ü·Ê’ã&1jËbUÕÖV ò¯Ñ&÷݇ÔT•ëÉ&¹–ém!P—¤(¿$Ý®BöpÂ#‘a5¾DOX&ÜÚº¨ª¼óÖ"),“¶d>sœc ’ýh:ëGÖÖÖÚ4|öÙž™3Ƕ·»ë,`ùI¹'%òþUUU0".;/—c‡õ0ªÊ‘TôLånô‡®ß$=¢*,¾ï–U¿U– Ë„I[T•C´…e¡-ªJya™`ÚBÈ-»à»Hq¸œn€^æ ¬G²}ûÞ‰¯N$N;÷Ç6™FøF²=醤2‰Ç‹,H¤ƒˆ©§r>ª\ñݤ²bƒ¹©IwbO8Ëä}ûÞéÓGe¸$z,‰‰°L.´US³wÆŒQ“a™nµ…<²Ì`¼¹iŒ 2óºïÞ}ðæ›G´¶ž7—F^å´ d´åXƒ€l©KÚ…N9d#¡ xºÇåæ©å¯ÃèßÐÐc[f«~ÇJX¦§¾[»wœ2eXG¿U—%nÂ2þµeUÕÚÒÝ‘BB<ÿ6þ´Ueù¾±#žÂ2J[(°$-àßpà 0¢æ#}ë™mßÞ4n\Ekëç#é:ðdwœ99kN˜|<<éâàrÙšŠ“,Ré5·Ì¥«0ࡲ„æ éÊŠVÄVXFh++lßÞ4cÆÈÖÖ“©O%ñ–¹¨­;ïÌtD¼¨*Ž€A‰¹°Ìmý÷ßÿþÄ[o=hŒY¸p!þ Y9–Áˆ‚=öäÚµÏ?ôP±¹t™! 7rxÅ#×D¾@ŽJ¸\öÜ!"3ïUeÙã—\ߣ³œê˜t#̤‹PÈI%rÉ4È“inwnÛöowݵ.+{ìÉ5k–uv&Y>„tCü¿X–††ñƘ»îZg̃_U‰O D¾Ë\ÔÖØ±ÿÑÕõAÎç·*òÂíêêBÁo~óïS§~ô§?ÝgŒyõÕW­QVò­oÑÒrâ;ß™˜H\p’–wàÇÈÌ6Ð’•iœ kGØÏBz6ÈHw ·’éì©Y__#\4éWÉRdC¤³ˆJ‘Üý wرcGR/­{òÄÇúšúúqÿú׌ï}oc7ç´´œ¨ªU‘4ÈÇ¿]÷Ú²ªbf!CòÅÇ1b„=°aüîÝU]]]¿ûÝÿ>ðÀ`cÌ”)Sì¿nÞüÑÌ™cúô)ìÓç’R?V^” ý`ŽžË0EB.ý€d\Ò$‚l D>]IÈV$]NBöAÈõ›‘ÅWáþrŸNYHƒ|übYêëÇmÚT¾~ýס›7o¹ãŽ›8f…¼þ#þãeÐÖæÍ[î¸cZ"Á¼BvÈ OBf±“ñŽ1/ó¶1ù·vG0Òˆ ‰1Æd¶Ñ!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„B!„BBHú»:¥ÚR‹ÄìûEaÅžLþ'Îë0‰?(,â ‹xÂ"^ °ˆ(,â ‹xÂ"^ °ˆ(,â ‹xÂ"^ °ˆ(,â ‹xÂ"^ °ˆ(,â ‹xÂ"^ °ˆ(,â…¢\¿¹„… :–5kÖääM2„_,â ‹xÂ"^ °ˆ(,â…ŒV›ÉÁR$ñbÞ¼yŽeöìÙŽ¥±±Ñ±¬X±Âã; 2ùŸ˜_,â ‹xÂ"^ °ˆ(,âF…=Ç£>êX¾ýío;–íÛ·;–ýû÷;–3gÎ8–7Þx#ã·K£B:(,â ‹xÂ"^ °ˆúbþüùŽåöÛow,Ÿ}ö™c©««s,çÏŸw,çÎs,ýúõs,¯½öZÀ÷ìF…$tPXÄ ñ…E¼@a/0*Ì<òˆc™3gŽcÙ¹sgJK"‘p,eee)ŸÞÞÞîXÊËËKq"£B:(,â ‹xÂ"^ °ˆ¦Ãã?îXfΜéXt°©©É±ôêÕ˱è?©® ê=À;;;Kß¾}Ë©S§Ë›o¾iº…Q! ñ…E¼@a/PXÄ Œ SóÄO8–éÓ§;ÝùYSSãXôŸ«wïÞŽ¥°Ðý¿zii©cimmu,:NÔWé;;ñæúõëõm’pAa/PXÄ ñ…E¼À)\t xÓM79½&ÌÞ½{K[[›cÑU¿ÊÊÊ”Wéy…]sÔè5jœÈñî»ïNy“àð‹E¼@a/PXÄ ñ…E¼ïQá‚ ‹îýøãKCCƒc)*rÿ’ºZ§gÿitEO×õ9:*Ôý¢ŽÅ‰@ûôé“òõ‚Ã/ñ…E¼@a/PXÄ ñB~E…‹/v,ãÇw,[·nu,t,%%%ŽE¯£#5'êXRÇnzÎ`´ÿþŽE÷: ZƒÃ/ñ…E¼@a/PXÄ qvÞ|ðAÇ2cÆ ÇòÉ'Ÿ8ݲWQQáX‚LÀÒλ^¨CO®Ò~ÚU×wÖ-„ÚröìYÇâ„ úÑ™À/ñ…E¼@a/PXÄ ñB|¢ÂE‹9–iÓ¦9½|css³cÑ1—ž8dÁ~Ýj§'rYôQG…ú>ú ‹‹‹‹Ž@_ªÉLà‹xÂ"^ °ˆ(,â ‹x!ªQá¼yó‹ž¶õé§Ÿ:–Ý»w;½i›Ž¹èXt;ž®Äé8QŸ£1ÝB¨£B¾sŸót½ne&ð‹E¼@a/PXÄ ñ…E¼¨páÂ…ŽeÖ¬YŽe×®]Ž¥±±Ñ±è šž8¥k|'Nœp,:š »é cu8t·jXRW ¾îÕý,©é(U¿¾J×%õUç>ºlš üb/PXÄ ñ…E¼@a/ä>*|衇Ë­·ÞêXô6nMMMŽEWÐt%NwZjìX‚l즟d™]» KÙ<(U¯v™ üb/PXÄ ñ…E¼@a/ôtT¨·q›3gŽc©­­u,:L/æÒ–ŽuÌ¥û3ƒ\¥ãD]êµeô}‚Tõ}ôo?vì˜cq~W98üb/PXÄ ñ…E¼@a/ø õš0Ó§Ow,;vìp,ºTÇeAâ)Mõ^ô9ºˆd·M‰{ú}tw¨Žøôêȱ²²Ò±8ݪ§OŸNùzÁá‹xÂ"^ °ˆ(,â ‹x!ËQá½÷Þ+ÿS÷‚ꈯ¥¥Å±è¹uza‰ õ}ôj¢:.0`€cÑݘzÍO»ÙcBß9È6æúÎz^¡®9:îLA"…E¼@a/PXÄ ñBFQáÒ¥KËÔ©SåÖÕÕ9'è¨P׿‚t~ê¥Qt©KG|:zÒ¨ŽÔ‚´Vêûèg‰Ýth¦ãM]õÓ½BŽ®·:¿T%3_,â ‹xÂ"^ °ˆ(,â…ÔõµË¡«ZƘ—^zIþç|àœ g·UTT8a™£§gêhN[tô¤—¾³ŽÂôêûœ None: """Regression test for #2838.""" proc = subprocess.run([sys.executable, "-c", "import pyqtgraph.canvas"]) assert proc.returncode == 0 pyqtgraph-pyqtgraph-0.13.4/tests/test_colormap.py000066400000000000000000000053151457240071200222300ustar00rootroot00000000000000import pytest import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtGui pos = [0.0, 0.5, 1.0] qcols = [ QtGui.QColor('#FF0000'), QtGui.QColor('#00FF00'), QtGui.QColor('#0000FF') ] float_tuples = [ (1.0, 0.0, 0.0, 1.0), (0.0, 1.0, 0.0, 1.0), (0.0, 0.0, 1.0, 1.0) ] int_tuples = [ (255, 0, 0,255), ( 0,255, 0,255), ( 0, 0,255,255) ] @pytest.mark.parametrize("color_list", (qcols, int_tuples)) def test_ColorMap_getStops(color_list): cm = pg.ColorMap(pos, color_list, name='test') # default is byte format: stops, colors = cm.getStops() assert (stops == pos).all() assert (colors == int_tuples).all() # manual byte format: stops, colors = cm.getStops(pg.ColorMap.BYTE) assert (stops == pos).all() assert (colors == int_tuples).all() stops, colors = cm.getStops('bYTe') assert (stops == pos).all() assert (colors == int_tuples).all() # manual float format: stops, colors = cm.getStops(pg.ColorMap.FLOAT) assert (stops == pos).all() assert (colors == float_tuples).all() stops, colors = cm.getStops('floaT') assert (stops == pos).all() assert (colors == float_tuples).all() # manual QColor format: stops, colors = cm.getStops(pg.ColorMap.QCOLOR) assert (stops == pos).all() for actual, good in zip(colors, qcols): assert actual.getRgbF() == good.getRgbF() stops, colors = cm.getStops('qColor') assert (stops == pos).all() for actual, good in zip(colors, qcols): assert actual.getRgbF() == good.getRgbF() @pytest.mark.parametrize("color_list", (qcols, int_tuples)) def test_ColorMap_getColors(color_list): cm = pg.ColorMap(pos, color_list, name='from QColors') colors = cm.getColors() assert (colors == int_tuples).all() colors = cm.getColors('byte') assert (colors == int_tuples).all() colors = cm.getColors('float') assert (colors == float_tuples).all() colors = cm.getColors('qcolor') for actual, good in zip(colors, qcols): assert actual.getRgbF() == good.getRgbF() def test_ColorMap_getByIndex(): cm = pg.ColorMap([0.0, 1.0], [(0,0,0), (255,0,0)]) assert cm.getByIndex(0) == QtGui.QColor.fromRgbF(0.0, 0.0, 0.0, 1.0) assert cm.getByIndex(1) == QtGui.QColor.fromRgbF(1.0, 0.0, 0.0, 1.0) def test_round_trip(): # test that colormap survives a round trip. # note that while both input and output are in BYTE, # internally the colors are stored as float; thus # there is a conversion BYTE -> float -> BYTE nPts = 256 zebra = np.zeros((nPts, 3), dtype=np.uint8) zebra[1::2, :] = 255 cmap = pg.ColorMap(None, zebra) lut = cmap.getLookupTable(nPts=nPts) assert np.all(lut == zebra) pyqtgraph-pyqtgraph-0.13.4/tests/test_configparser.py000066400000000000000000000014101457240071200230660ustar00rootroot00000000000000import numpy as np from pyqtgraph import configfile def test_longArrays(tmpdir): """ Test config saving and loading of long arrays. """ arr = np.arange(20) tf = tmpdir.join("config.cfg") configfile.writeConfigFile({'arr': arr}, tf) config = configfile.readConfigFile(tf) assert all(config['arr'] == arr) def test_multipleParameters(tmpdir): """ Test config saving and loading of multiple parameters. """ par1 = [1,2,3] par2 = "Test" par3 = {'a':3,'b':'c'} tf = tmpdir.join("config.cfg") configfile.writeConfigFile({'par1':par1, 'par2':par2, 'par3':par3}, tf) config = configfile.readConfigFile(tf) assert config['par1'] == par1 assert config['par2'] == par2 assert config['par3'] == par3 pyqtgraph-pyqtgraph-0.13.4/tests/test_functions.py000066400000000000000000000415471457240071200224330ustar00rootroot00000000000000from collections import OrderedDict from copy import deepcopy import numpy as np import pytest from numpy.testing import assert_array_almost_equal import pyqtgraph as pg from pyqtgraph.functions import arrayToQPath, eq, SignalBlock from pyqtgraph.Qt import QtCore, QtGui np.random.seed(12345) def testSolve3D(): p1 = np.array([[0,0,0,1], [1,0,0,1], [0,1,0,1], [0,0,1,1]], dtype=float) # transform points through random matrix tr = np.random.normal(size=(4, 4)) tr[3] = (0,0,0,1) p2 = np.dot(tr, p1.T).T[:,:3] # solve to see if we can recover the transformation matrix. tr2 = pg.solve3DTransform(p1, p2) assert_array_almost_equal(tr[:3], tr2[:3]) def test_interpolateArray_order0(): check_interpolateArray(order=0) def test_interpolateArray_order1(): check_interpolateArray(order=1) def check_interpolateArray(order): pytest.importorskip("scipy") def interpolateArray(data, x): result = pg.interpolateArray(data, x, order=order) assert result.shape == x.shape[:-1] + data.shape[x.shape[-1]:] return result data = np.array([[ 1., 2., 4. ], [ 10., 20., 40. ], [ 100., 200., 400.]]) # test various x shapes interpolateArray(data, np.ones((1,))) interpolateArray(data, np.ones((2,))) interpolateArray(data, np.ones((1, 1))) interpolateArray(data, np.ones((1, 2))) interpolateArray(data, np.ones((5, 1))) interpolateArray(data, np.ones((5, 2))) interpolateArray(data, np.ones((5, 5, 1))) interpolateArray(data, np.ones((5, 5, 2))) with pytest.raises(TypeError): interpolateArray(data, np.ones((3,))) with pytest.raises(TypeError): interpolateArray(data, np.ones((1, 3,))) with pytest.raises(TypeError): interpolateArray(data, np.ones((5, 5, 3,))) x = np.array([[ 0.3, 0.6], [ 1. , 1. ], [ 0.501, 1. ], # NOTE: testing at exactly 0.5 can yield different results from map_coordinates [ 0.501, 2.501], # due to differences in rounding [ 10. , 10. ]]) result = interpolateArray(data, x) # make sure results match ndimage.map_coordinates import scipy.ndimage spresult = scipy.ndimage.map_coordinates(data, x.T, order=order) #spresult = np.array([ 5.92, 20. , 11. , 0. , 0. ]) # generated with the above line assert_array_almost_equal(result, spresult) # test mapping when x.shape[-1] < data.ndim x = np.array([[ 0.3, 0], [ 0.3, 1], [ 0.3, 2]]) r1 = interpolateArray(data, x) x = np.array([0.3]) # should broadcast across axis 1 r2 = interpolateArray(data, x) assert_array_almost_equal(r1, r2) # test mapping 2D array of locations x = np.array([[[0.501, 0.501], [0.501, 1.0], [0.501, 1.501]], [[1.501, 0.501], [1.501, 1.0], [1.501, 1.501]]]) r1 = interpolateArray(data, x) r2 = scipy.ndimage.map_coordinates(data, x.transpose(2,0,1), order=order) #r2 = np.array([[ 8.25, 11. , 16.5 ], # generated with the above line #[ 82.5 , 110. , 165. ]]) assert_array_almost_equal(r1, r2) def test_subArray(): a = np.array([0, 0, 111, 112, 113, 0, 121, 122, 123, 0, 0, 0, 211, 212, 213, 0, 221, 222, 223, 0, 0, 0, 0]) b = pg.subArray(a, offset=2, shape=(2,2,3), stride=(10,4,1)) c = np.array([[[111,112,113], [121,122,123]], [[211,212,213], [221,222,223]]]) assert np.all(b == c) # operate over first axis; broadcast over the rest aa = np.vstack([a, a/100.]).T cc = np.empty(c.shape + (2,)) cc[..., 0] = c cc[..., 1] = c / 100. bb = pg.subArray(aa, offset=2, shape=(2,2,3), stride=(10,4,1)) assert np.all(bb == cc) def test_rescaleData(): rng = np.random.default_rng(12345) dtypes = map(np.dtype, ('ubyte', 'uint16', 'byte', 'int16', 'int', 'float')) for dtype1 in dtypes: for dtype2 in dtypes: if dtype1.kind in 'iu': lim = np.iinfo(dtype1) data = rng.integers(lim.min, lim.max, size=10, dtype=dtype1, endpoint=True) else: data = (rng.random(size=10) * 2**32 - 2**31).astype(dtype1) for scale, offset in [(10, 0), (10., 0.), (1, -50), (0.2, 0.5), (0.001, 0)]: if dtype2.kind in 'iu': lim = np.iinfo(dtype2) lim = lim.min, lim.max else: lim = (-np.inf, np.inf) s1 = np.clip(float(scale) * (data-float(offset)), *lim).astype(dtype2) s2 = pg.rescaleData(data, scale, offset, dtype2) assert s1.dtype == s2.dtype if dtype2.kind in 'iu': assert np.all(s1 == s2) else: assert np.allclose(s1, s2) def test_eq(): eq = pg.functions.eq zeros = [0, 0.0, np.float64(0), np.float32(0), np.int32(0), np.int64(0)] for i,x in enumerate(zeros): for y in zeros[i:]: assert eq(x, y) assert eq(y, x) assert eq(np.nan, np.nan) # test class NotEq(object): def __eq__(self, x): return False noteq = NotEq() assert eq(noteq, noteq) # passes because they are the same object assert not eq(noteq, NotEq()) # Should be able to test for equivalence even if the test raises certain # exceptions class NoEq(object): def __init__(self, err): self.err = err def __eq__(self, x): raise self.err noeq1 = NoEq(AttributeError()) noeq2 = NoEq(ValueError()) noeq3 = NoEq(Exception()) assert eq(noeq1, noeq1) assert not eq(noeq1, noeq2) assert not eq(noeq2, noeq1) with pytest.raises(Exception): eq(noeq3, noeq2) # test array equivalence # note that numpy has a weird behavior here--np.all() always returns True # if one of the arrays has size=0; eq() will only return True if both arrays # have the same shape. a1 = np.zeros((10, 20)).astype('float') a2 = a1 + 1 a3 = a2.astype('int') a4 = np.empty((0, 20)) assert not eq(a1, a2) # same shape/dtype, different values assert not eq(a1, a3) # same shape, different dtype and values assert not eq(a1, a4) # different shape (note: np.all gives True if one array has size 0) assert not eq(a2, a3) # same values, but different dtype assert not eq(a2, a4) # different shape assert not eq(a3, a4) # different shape and dtype assert eq(a4, a4.copy()) assert not eq(a4, a4.T) # test containers assert not eq({'a': 1}, {'a': 1, 'b': 2}) assert not eq({'a': 1}, {'a': 2}) d1 = {'x': 1, 'y': np.nan, 3: ['a', np.nan, a3, 7, 2.3], 4: a4} d2 = deepcopy(d1) assert eq(d1, d2) d1_ordered = OrderedDict(d1) d2_ordered = deepcopy(d1_ordered) assert eq(d1_ordered, d2_ordered) assert not eq(d1_ordered, d2) items = list(d1.items()) assert not eq(OrderedDict(items), OrderedDict(reversed(items))) assert not eq([1,2,3], [1,2,3,4]) l1 = [d1, np.inf, -np.inf, np.nan] l2 = deepcopy(l1) t1 = tuple(l1) t2 = tuple(l2) assert eq(l1, l2) assert eq(t1, t2) assert eq(set(range(10)), set(range(10))) assert not eq(set(range(10)), set(range(9))) @pytest.mark.parametrize("s,suffix,expected", [ # usual cases ("100 uV", "V", ("100", "u", "V")), ("100 µV", "V", ("100", "µ", "V")), ("4.2 nV", None, ("4.2", "n", "V")), ("1.2 m", "m", ("1.2", "", "m")), ("1.2 m", None, ("1.2", "", "m")), ("5.0e9", None, ("5.0e9", "", "")), ("2 units", "units", ("2", "", "units")), # siPrefix with explicit empty suffix ("1.2 m", "", ("1.2", "m", "")), ("5.0e-9 M", "", ("5.0e-9", "M", "")), # weirder cases that should return the reasonable thing ("4.2 nV", "nV", ("4.2", "", "nV")), ("4.2 nV", "", ("4.2", "n", "")), ("1.2 j", "", ("1.2", "", "")), ("1.2 j", None, ("1.2", "", "j")), # expected error cases ("100 uV", "v", ValueError), ]) def test_siParse(s, suffix, expected): if isinstance(expected, tuple): assert pg.siParse(s, suffix=suffix) == expected else: with pytest.raises(expected): pg.siParse(s, suffix=suffix) def test_CIELab_reconversion(): color_list = [ pg.Qt.QtGui.QColor('#100235') ] # known problematic values for _ in range(20): qcol = pg.Qt.QtGui.QColor() qcol.setRgbF( *np.random.random((3)) ) color_list.append(qcol) for qcol1 in color_list: vec_Lab = pg.functions.colorCIELab( qcol1 ) qcol2 = pg.functions.CIELabColor(*vec_Lab) for val1, val2 in zip( qcol1.getRgb(), qcol2.getRgb() ): assert abs(val1-val2)<=1, f'Excess CIELab reconversion error ({qcol1.name() } > {vec_Lab } > {qcol2.name()})' MoveToElement = pg.QtGui.QPainterPath.ElementType.MoveToElement LineToElement = pg.QtGui.QPainterPath.ElementType.LineToElement _dtypes = [] for bits in 32, 64: for base in 'int', 'float', 'uint': _dtypes.append(f'{base}{bits}') _dtypes.extend(['uint8', 'uint16']) def _handle_underflow(dtype, *elements): """Wrapper around path description which converts underflow into proper points""" out = [] dtype = np.dtype(dtype) # get the signed integer type of the same width dtype_int = np.dtype(f'i{dtype.itemsize}') for el in elements: newElement = [el[0]] for ii in range(1, 3): coord = el[ii] if dtype.kind == 'u' and coord < 0: # coord is a float with a negative integral value. # for unsigned integer types, we want negative values to # wrap-around. to get consistent wrap-around behavior # across different numpy versions and machine platforms, # we first convert coord to a signed integer. coord = np.array(coord, dtype=dtype_int).astype(dtype) newElement.append(float(coord)) out.append(tuple(newElement)) return out @pytest.mark.parametrize( "xs, ys, connect, expected", [ *( ( np.arange(6, dtype=dtype), np.arange(0, -6, step=-1).astype(dtype), 'all', _handle_underflow(dtype, (MoveToElement, 0.0, 0.0), (LineToElement, 1.0, -1.0), (LineToElement, 2.0, -2.0), (LineToElement, 3.0, -3.0), (LineToElement, 4.0, -4.0), (LineToElement, 5.0, -5.0) ) ) for dtype in _dtypes ), *( ( np.arange(6, dtype=dtype), np.arange(0, -6, step=-1).astype(dtype), 'pairs', _handle_underflow(dtype, (MoveToElement, 0.0, 0.0), (LineToElement, 1.0, -1.0), (MoveToElement, 2.0, -2.0), (LineToElement, 3.0, -3.0), (MoveToElement, 4.0, -4.0), (LineToElement, 5.0, -5.0), ) ) for dtype in _dtypes ), *( ( np.arange(5, dtype=dtype), np.arange(0, -5, step=-1).astype(dtype), 'pairs', _handle_underflow(dtype, (MoveToElement, 0.0, 0.0), (LineToElement, 1.0, -1.0), (MoveToElement, 2.0, -2.0), (LineToElement, 3.0, -3.0), (MoveToElement, 4.0, -4.0) ) ) for dtype in _dtypes ), # NaN types don't coerce to integers, don't test for all types since that doesn't make sense ( np.arange(5), np.array([0, -1, np.nan, -3, -4]), 'finite', ( (MoveToElement, 0.0, 0.0), (LineToElement, 1.0, -1.0), (LineToElement, 1.0, -1.0), (MoveToElement, 3.0, -3.0), (LineToElement, 4.0, -4.0) ) ), ( np.array([0, 1, np.nan, 3, 4]), np.arange(0, -5, step=-1), 'finite', ( (MoveToElement, 0.0, 0.0), (LineToElement, 1.0, -1.0), (LineToElement, 1.0, -1.0), (MoveToElement, 3.0, -3.0), (LineToElement, 4.0, -4.0) ) ), *( ( np.arange(5, dtype=dtype), np.arange(0, -5, step=-1).astype(dtype), np.array([0, 1, 0, 1, 0]), _handle_underflow(dtype, (MoveToElement, 0.0, 0.0), (MoveToElement, 1.0, -1.0), (LineToElement, 2.0, -2.0), (MoveToElement, 3.0, -3.0), (LineToElement, 4.0, -4.0) ) ) for dtype in _dtypes ), # Empty path with all types of connection *( ( np.arange(0), np.arange(0, dtype=dtype), conn, () ) for conn in ['all', 'pairs', 'finite', np.array([])] for dtype in _dtypes ), ] ) def test_arrayToQPath(xs, ys, connect, expected): path = arrayToQPath(xs, ys, connect=connect) element = None for i in range(path.elementCount()): # nan elements add two line-segments, for simplicity of test config # we can ignore the second segment if element is not None and (eq(element.x, np.nan) or eq(element.y, np.nan)): continue element = path.elementAt(i) assert eq(expected[i], (element.type, element.x, element.y)) def test_ndarray_from_qpolygonf(): # test that we get an empty ndarray from an empty QPolygonF poly = pg.functions.create_qpolygonf(0) arr = pg.functions.ndarray_from_qpolygonf(poly) assert isinstance(arr, np.ndarray) def test_ndarray_from_qimage(): # for QImages created w/o specifying bytesPerLine, Qt will pad # each line to a multiple of 4-bytes. # test that we can handle such QImages. h = 10 fmt = QtGui.QImage.Format.Format_RGB888 for w in [5, 6, 7, 8]: qimg = QtGui.QImage(w, h, fmt) qimg.fill(0) arr = pg.functions.ndarray_from_qimage(qimg) assert arr.shape == (h, w, 3) fmt = QtGui.QImage.Format.Format_Grayscale8 for w in [5, 6, 7, 8]: qimg = QtGui.QImage(w, h, fmt) qimg.fill(0) arr = pg.functions.ndarray_from_qimage(qimg) assert arr.shape == (h, w) def test_colorDistance(): pg.colorDistance([pg.Qt.QtGui.QColor(0,0,0), pg.Qt.QtGui.QColor(255,0,0)]) pg.colorDistance([]) @pytest.mark.parametrize( "test_input,expected", [ (["r"], [255, 0, 0, 255]), (["g"], [0, 255, 0, 255]), (["b"], [0, 0, 255, 255]), (["c"], [0, 255, 255, 255]), (["m"], [255, 0, 255, 255]), (["y"], [255, 255, 0, 255]), (["k"], [0, 0, 0, 255]), (["w"], [255, 255, 255, 255]), (["d"], [150, 150, 150, 255]), (["l"], [200, 200, 200, 255]), (["s"], [100, 100, 150, 255]), ([0.75], [191, 191, 191, 255]), ([11, 22, 33], [11, 22, 33, 255]), ([11, 22, 33, 44], [11, 22, 33, 44]), ([(11, 22, 33)], [11, 22, 33, 255]), ([(11, 22, 33, 44)], [11, 22, 33, 44]), ([0], [255, 0, 0, 255]), ([1], [255, 170, 0, 255]), ([2], [170, 255, 0, 255]), ([3], [0, 255, 0, 255]), ([4], [0, 255, 170, 255]), ([5], [0, 170, 255, 255]), ([9], [255, 0, 0, 255]), ([(0, 2)], [255, 0, 0, 255]), ([(1, 2)], [0, 255, 255, 255]), ([(2, 2)], [255, 0, 0, 255]), (["#89a"], [136, 153, 170, 255]), (["#89ab"], [136, 153, 170, 187]), (["#4488cc"], [68, 136, 204, 255]), (["#4488cc00"], [68, 136, 204, 0]), ([QtGui.QColor(1, 2, 3, 4)], [1, 2, 3, 4]), (["steelblue"], [70, 130, 180, 255]), (["lawngreen"], [124, 252, 0, 255]), ], ) def test_mkColor(test_input, expected): qcol: QtGui.QColor = pg.functions.mkColor(*test_input) assert list(qcol.getRgb()) == expected def test_signal_block_unconnected(): """Test that SignalBlock does not end up connecting an unconnected slot""" class Sender(QtCore.QObject): signal = QtCore.Signal() class Receiver: def __init__(self): self.counter = 0 def slot(self): self.counter += 1 sender = Sender() receiver = Receiver() with SignalBlock(sender.signal, receiver.slot): pass sender.signal.emit() assert receiver.counter == 0 pyqtgraph-pyqtgraph-0.13.4/tests/test_makeARGB.py000066400000000000000000007220341457240071200217710ustar00rootroot00000000000000import sys from typing import Any, Dict, Type, Union import numpy as np import pytest from pyqtgraph import getConfigOption, getCupy, setConfigOption from pyqtgraph.functions import makeARGB as real_makeARGB try: import cupy except ImportError: cupy = None IN_2D_INT8 = np.array([[173, 48, 122, 41], [210, 192, 0, 5], [104, 56, 102, 115], [78, 19, 255, 6]], dtype=np.uint8) IN_RGB_INT8 = np.array( [ [[16, 69, 62], [66, 132, 135], [220, 80, 36], [53, 34, 68]], [[140, 23, 113], [0, 63, 206], [96, 255, 100], [226, 182, 155]], [[28, 237, 223], [215, 232, 209], [17, 16, 50], [96, 187, 93]], [[220, 193, 232], [134, 168, 150], [55, 64, 221], [96, 108, 227]], ], dtype=np.uint8, ) IN_RGBA_INT8 = np.array( [ [[151, 252, 73, 107], [28, 221, 35, 0], [87, 122, 126, 114], [47, 59, 24, 200]], [[189, 246, 242, 255], [123, 255, 29, 14], [201, 208, 133, 32], [118, 203, 141, 245]], [[133, 131, 248, 81], [4, 84, 99, 40], [40, 167, 119, 150], [13, 158, 108, 21]], [[156, 221, 166, 250], [77, 188, 13, 166], [0, 1, 185, 25], [83, 35, 103, 120]], ], dtype=np.uint8, ) IN_2D_INT16 = np.array( [ [13364, 55041, 40746, 40937], [57612, 34247, 34132, 0], [10109, 56950, 41856, 21479], [14881, 65535, 48079, 11372], ], dtype=np.uint16, ) IN_RGB_INT16 = np.array( [ [[55626, 45263, 0], [19468, 39208, 36391], [33255, 8664, 56991], [37588, 31212, 38295]], [[58933, 16402, 36905], [9928, 23928, 12418], [16461, 47738, 18189], [17004, 39307, 59941]], [[43717, 49573, 9843], [35967, 3891, 39618], [53542, 58151, 29112], [53667, 4092, 35267]], [[15957, 21648, 45238], [65535, 47107, 52049], [6342, 34547, 19902], [43386, 37301, 35095]], ], dtype=np.uint16, ) IN_RGBA_INT16 = np.array( [ [ [13060, 40847, 29621, 46719], [0, 36509, 33525, 56649], [48328, 23093, 47186, 26801], [57336, 12247, 30996, 11691], ], [ [4863, 41121, 32045, 25250], [27779, 65098, 59921, 47771], [8906, 18280, 5066, 48587], [65535, 25758, 27250, 17284], ], [ [52005, 65535, 40746, 65535], [33, 57630, 27750, 42371], [50176, 35079, 19220, 63662], [17702, 5506, 36216, 48303], ], [ [61592, 27692, 37436, 7249], [54653, 39986, 58441, 12819], [20887, 56588, 32440, 85], [13457, 14661, 58972, 48779], ], ], dtype=np.uint16, ) IN_2D_FLOAT = np.array( [ [np.inf, 0.53662884, np.nan, 0.8853132], [0.8496698, 0.88006145, 1.0, 0.06621328], [0.99158293, 0.8476984, 0.16672458, 0.9887786], [0.07076367, 0.66354364, 0.8781082, 0.988832], ], dtype=np.float32, ) IN_RGB_FLOAT = np.array( [ [ [0.23317624, 0.39086635, 0.12795302], [0.40659714, 0.9079258, 0.28431135], [0.91651599, 0.46082205, 0.16928465], [0.29368765, 0.97987488, 0.72257988], ], [ [np.nan, 0.72908475, 0.54018012], [0.91277435, 0.2842577, 0.73481915], [0.33844504, 0.22060913, 0.9802894], [0.13995676, 0.34752838, 0.39652277], ], [ [0.85315026, 0.19330797, 0.0], [0.48584232, 0.04943356, 0.59906953], [np.inf, 0.32614581, 0.1483722], [0.37340863, 0.35432855, 0.08973532], ], [ [0.69666134, 0.52481322, 0.49057305], [0.93366339, 0.1428689, 0.6845513], [0.27681383, 0.69472673, 0.06750892], [0.26349886, 0.25841691, 0.86171104], ], ] ) IN_RGBA_FLOAT = np.array( [ [ [0.97383172, 0.62680971, 0.02285016, np.nan], [0.85295433, 0.93014834, 0.59482999, np.inf], [0.4017482, 0.79809183, 0.22407464, 0.17327807], [0.95953263, 0.69535086, 0.28846483, 0.76970823], ], [ [0.11487603, 0.7447609, 0.06767498, 0.98054729], [0.66071068, 0.73931366, 0.33155686, 0.81827122], [0.78035892, 0.52920802, 0.5671388, 0.31783899], [0.81709002, 0.82204682, 0.82584029, 0.49434749], ], [ [0.03142089, 0.8322058, 0.31646922, 0.94636969], [0.62381573, 0.60052138, 0.50244611, 0.92886007], [np.nan, np.nan, 0.02940048, 0.52529675], [0.9786162, 0.54928697, 0.2409731, 0.34705397], ], [ [0.68922233, np.inf, 0.85027734, 0.35388624], [0.16489042, 0.29860162, 0.09349833, 0.67714667], [0.25351483, 0.25596098, 0.80461891, 0.99952403], [0.0, 1.0, 0.58084746, 0.46211944], ], ] ) INPUTS: Dict[Any, np.ndarray] = { (np.uint8, "2D"): IN_2D_INT8, (np.uint8, "RGB"): IN_RGB_INT8, (np.uint8, "RGBA"): IN_RGBA_INT8, (np.uint16, "2D"): IN_2D_INT16, (np.uint16, "RGB"): IN_RGB_INT16, (np.uint16, "RGBA"): IN_RGBA_INT16, (np.float32, "2D"): IN_2D_FLOAT, (np.float32, "RGB"): IN_RGB_FLOAT, (np.float32, "RGBA"): IN_RGBA_FLOAT, } LUT8 = np.zeros((255,), dtype=np.uint8) LUT8[::2] = 255 LUT16 = np.zeros((65535,), dtype=np.uint8) LUT16[::3] = 255 LUTS: Dict[Any, np.ndarray] = { np.uint8: LUT8, np.uint16: LUT16, } LEVELS = { "SIMPLE": (0, 1), "RGB": ((0, 255), (1, 250), (100, 160)), "RGBA": ((255, 11111), (100, 10000), (0, 255), (127, 255)), } EXPECTED_OUTPUTS: Dict[tuple, Union[Type[Exception], np.ndarray]] = { (np.uint8, "2D", None, None, None, True): np.array( [ [[173, 173, 173, 255], [48, 48, 48, 255], [122, 122, 122, 255], [41, 41, 41, 255]], [[210, 210, 210, 255], [192, 192, 192, 255], [0, 0, 0, 255], [5, 5, 5, 255]], [[104, 104, 104, 255], [56, 56, 56, 255], [102, 102, 102, 255], [115, 115, 115, 255]], [[78, 78, 78, 255], [19, 19, 19, 255], [255, 255, 255, 255], [6, 6, 6, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, None, None, False): np.array( [ [[173, 173, 173, 255], [48, 48, 48, 255], [122, 122, 122, 255], [41, 41, 41, 255]], [[210, 210, 210, 255], [192, 192, 192, 255], [0, 0, 0, 255], [5, 5, 5, 255]], [[104, 104, 104, 255], [56, 56, 56, 255], [102, 102, 102, 255], [115, 115, 115, 255]], [[78, 78, 78, 255], [19, 19, 19, 255], [255, 255, 255, 255], [6, 6, 6, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, None, 232, True): np.array( [ [[157, 157, 157, 255], [43, 43, 43, 255], [110, 110, 110, 255], [37, 37, 37, 255]], [[191, 191, 191, 255], [174, 174, 174, 255], [0, 0, 0, 255], [4, 4, 4, 255]], [[94, 94, 94, 255], [50, 50, 50, 255], [92, 92, 92, 255], [104, 104, 104, 255]], [[70, 70, 70, 255], [17, 17, 17, 255], [232, 232, 232, 255], [5, 5, 5, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, None, 232, False): np.array( [ [[157, 157, 157, 255], [43, 43, 43, 255], [110, 110, 110, 255], [37, 37, 37, 255]], [[191, 191, 191, 255], [174, 174, 174, 255], [0, 0, 0, 255], [4, 4, 4, 255]], [[94, 94, 94, 255], [50, 50, 50, 255], [92, 92, 92, 255], [104, 104, 104, 255]], [[70, 70, 70, 255], [17, 17, 17, 255], [232, 232, 232, 255], [5, 5, 5, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, None, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint8, None, True): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint8, None, False): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint8, 232, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint8, 232, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint16, None, True): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint16, None, False): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint16, 232, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint16, 232, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint16, 13333, True): np.array( [ [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", None, np.uint16, 13333, False): np.array( [ [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", None, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", None, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", None, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", None, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", None, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint16, None, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint16, None, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint16, 232, True): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint16, 232, False): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint16, 13333, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "SIMPLE", np.uint16, 13333, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGB", None, None, True): Exception, (np.uint8, "2D", "RGB", None, None, False): Exception, (np.uint8, "2D", "RGB", None, 232, True): Exception, (np.uint8, "2D", "RGB", None, 232, False): Exception, (np.uint8, "2D", "RGB", None, 13333, True): Exception, (np.uint8, "2D", "RGB", None, 13333, False): Exception, (np.uint8, "2D", "RGB", np.uint8, None, True): Exception, (np.uint8, "2D", "RGB", np.uint8, None, False): Exception, (np.uint8, "2D", "RGB", np.uint8, 232, True): Exception, (np.uint8, "2D", "RGB", np.uint8, 232, False): Exception, (np.uint8, "2D", "RGB", np.uint8, 13333, True): Exception, (np.uint8, "2D", "RGB", np.uint8, 13333, False): Exception, (np.uint8, "2D", "RGB", np.uint16, None, True): Exception, (np.uint8, "2D", "RGB", np.uint16, None, False): Exception, (np.uint8, "2D", "RGB", np.uint16, 232, True): Exception, (np.uint8, "2D", "RGB", np.uint16, 232, False): Exception, (np.uint8, "2D", "RGB", np.uint16, 13333, True): Exception, (np.uint8, "2D", "RGB", np.uint16, 13333, False): Exception, (np.uint8, "2D", "RGBA", None, None, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [122, 122, 122, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [2, 2, 2, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [102, 102, 102, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", None, None, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [122, 122, 122, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [2, 2, 2, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [102, 102, 102, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", None, 232, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [110, 110, 110, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [2, 2, 2, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [92, 92, 92, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [232, 232, 232, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", None, 232, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [110, 110, 110, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [2, 2, 2, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [92, 92, 92, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [232, 232, 232, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", None, 13333, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [123, 123, 123, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", None, 13333, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [123, 123, 123, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint16, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint16, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint16, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint16, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint16, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "2D", "RGBA", np.uint16, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, None, None, True): np.array( [ [[16, 69, 62, 255], [66, 132, 135, 255], [220, 80, 36, 255], [53, 34, 68, 255]], [[140, 23, 113, 255], [0, 63, 206, 255], [96, 255, 100, 255], [226, 182, 155, 255]], [[28, 237, 223, 255], [215, 232, 209, 255], [17, 16, 50, 255], [96, 187, 93, 255]], [[220, 193, 232, 255], [134, 168, 150, 255], [55, 64, 221, 255], [96, 108, 227, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, None, None, False): np.array( [ [[62, 69, 16, 255], [135, 132, 66, 255], [36, 80, 220, 255], [68, 34, 53, 255]], [[113, 23, 140, 255], [206, 63, 0, 255], [100, 255, 96, 255], [155, 182, 226, 255]], [[223, 237, 28, 255], [209, 232, 215, 255], [50, 16, 17, 255], [93, 187, 96, 255]], [[232, 193, 220, 255], [150, 168, 134, 255], [221, 64, 55, 255], [227, 108, 96, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, None, 232, True): np.array( [ [[14, 62, 56, 255], [60, 120, 122, 255], [200, 72, 32, 255], [48, 30, 61, 255]], [[127, 20, 102, 255], [0, 57, 187, 255], [87, 232, 90, 255], [205, 165, 141, 255]], [[25, 215, 202, 255], [195, 211, 190, 255], [15, 14, 45, 255], [87, 170, 84, 255]], [[200, 175, 211, 255], [121, 152, 136, 255], [50, 58, 201, 255], [87, 98, 206, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, None, 232, False): np.array( [ [[56, 62, 14, 255], [122, 120, 60, 255], [32, 72, 200, 255], [61, 30, 48, 255]], [[102, 20, 127, 255], [187, 57, 0, 255], [90, 232, 87, 255], [141, 165, 205, 255]], [[202, 215, 25, 255], [190, 211, 195, 255], [45, 14, 15, 255], [84, 170, 87, 255]], [[211, 175, 200, 255], [136, 152, 121, 255], [201, 58, 50, 255], [206, 98, 87, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, None, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint8, None, True): np.array( [ [[255, 0, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [0, 255, 255, 255]], [[255, 0, 0, 255], [255, 0, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255]], [[255, 0, 0, 255], [0, 255, 0, 255], [0, 255, 255, 255], [255, 0, 0, 255]], [[255, 0, 255, 255], [255, 255, 255, 255], [0, 255, 0, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint8, None, False): np.array( [ [[255, 0, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255]], [[0, 0, 255, 255], [255, 0, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255]], [[0, 0, 255, 255], [0, 255, 0, 255], [255, 255, 0, 255], [0, 0, 255, 255]], [[255, 0, 255, 255], [255, 255, 255, 255], [0, 255, 0, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255]], [[0, 255, 255, 255], [255, 0, 0, 255], [0, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 255, 255], [0, 0, 255, 255], [0, 255, 0, 255], [0, 255, 255, 255]], [[255, 0, 0, 255], [0, 255, 255, 255], [255, 255, 0, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255]], [[255, 255, 0, 255], [0, 0, 255, 255], [255, 255, 0, 255], [0, 0, 0, 255]], [[255, 0, 0, 255], [255, 0, 0, 255], [0, 255, 0, 255], [255, 255, 0, 255]], [[0, 0, 255, 255], [255, 255, 0, 255], [0, 255, 255, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint16, None, True): np.array( [ [[0, 255, 0, 255], [255, 255, 255, 255], [0, 0, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 0, 255], [255, 0, 0, 255], [0, 0, 0, 255]], [[0, 255, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 0, 255, 255]], [[0, 0, 0, 255], [0, 255, 255, 255], [0, 0, 0, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint16, None, False): np.array( [ [[0, 255, 0, 255], [255, 255, 255, 255], [255, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 255, 255, 255], [0, 0, 255, 255], [0, 0, 0, 255]], [[0, 255, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 0, 255, 255]], [[0, 0, 0, 255], [255, 255, 0, 255], [0, 0, 0, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint16, 232, True): np.array( [ [[0, 0, 0, 255], [255, 255, 0, 255], [0, 255, 0, 255], [255, 255, 0, 255]], [[0, 0, 255, 255], [255, 255, 0, 255], [255, 0, 255, 255], [0, 255, 255, 255]], [[0, 0, 0, 255], [255, 0, 0, 255], [255, 0, 255, 255], [255, 0, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 255, 255], [255, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint16, 232, False): np.array( [ [[0, 0, 0, 255], [0, 255, 255, 255], [0, 255, 0, 255], [0, 255, 255, 255]], [[255, 0, 0, 255], [0, 255, 255, 255], [255, 0, 255, 255], [255, 255, 0, 255]], [[0, 0, 0, 255], [0, 0, 255, 255], [255, 0, 255, 255], [255, 0, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 0, 0, 255], [0, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint16, 13333, True): np.array( [ [[0, 0, 0, 255], [255, 0, 0, 255], [255, 255, 0, 255], [0, 0, 255, 255]], [[255, 0, 0, 255], [255, 255, 255, 255], [255, 0, 0, 255], [0, 255, 0, 255]], [[255, 0, 0, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 255, 0, 255]], [[255, 0, 0, 255], [0, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", None, np.uint16, 13333, False): np.array( [ [[0, 0, 0, 255], [0, 0, 255, 255], [0, 255, 255, 255], [255, 0, 0, 255]], [[0, 0, 255, 255], [255, 255, 255, 255], [0, 0, 255, 255], [0, 255, 0, 255]], [[0, 0, 255, 255], [0, 0, 255, 255], [0, 0, 255, 255], [0, 255, 255, 255]], [[0, 0, 255, 255], [255, 255, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", None, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", None, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", None, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", None, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", None, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint16, None, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint16, None, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint16, 232, True): np.array( [ [[0, 255, 0, 255], [255, 255, 255, 255], [0, 0, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255], [0, 0, 0, 255]], [[0, 255, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 0, 255, 255]], [[0, 0, 0, 255], [0, 255, 255, 255], [0, 0, 0, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint16, 232, False): np.array( [ [[0, 255, 0, 255], [255, 255, 255, 255], [255, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 255, 255, 255], [0, 255, 255, 255], [0, 0, 0, 255]], [[0, 255, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 0, 255, 255]], [[0, 0, 0, 255], [255, 255, 0, 255], [0, 0, 0, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint16, 13333, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "SIMPLE", np.uint16, 13333, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", None, None, True): np.array( [ [[16, 69, 0, 255], [66, 134, 148, 255], [220, 80, 0, 255], [53, 33, 0, 255]], [[140, 22, 55, 255], [0, 63, 255, 255], [96, 255, 0, 255], [226, 185, 233, 255]], [[28, 241, 255, 255], [215, 236, 255, 255], [17, 15, 0, 255], [96, 190, 0, 255]], [[220, 196, 255, 255], [134, 171, 212, 255], [55, 64, 255, 255], [96, 109, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", None, None, False): np.array( [ [[0, 69, 16, 255], [148, 134, 66, 255], [0, 80, 220, 255], [0, 33, 53, 255]], [[55, 22, 140, 255], [255, 63, 0, 255], [0, 255, 96, 255], [233, 185, 226, 255]], [[255, 241, 28, 255], [255, 236, 215, 255], [0, 15, 17, 255], [0, 190, 96, 255]], [[255, 196, 220, 255], [212, 171, 134, 255], [255, 64, 55, 255], [255, 109, 96, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", None, 232, True): np.array( [ [[14, 63, 0, 255], [60, 122, 135, 255], [200, 73, 0, 255], [48, 30, 0, 255]], [[127, 20, 50, 255], [0, 57, 255, 255], [87, 236, 0, 255], [205, 168, 212, 255]], [[25, 219, 255, 255], [195, 215, 255, 255], [15, 13, 0, 255], [87, 173, 0, 255]], [[200, 178, 255, 255], [121, 155, 193, 255], [50, 58, 255, 255], [87, 99, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", None, 232, False): np.array( [ [[0, 63, 14, 255], [135, 122, 60, 255], [0, 73, 200, 255], [0, 30, 48, 255]], [[50, 20, 127, 255], [255, 57, 0, 255], [0, 236, 87, 255], [212, 168, 205, 255]], [[255, 219, 25, 255], [255, 215, 195, 255], [0, 13, 15, 255], [0, 173, 87, 255]], [[255, 178, 200, 255], [193, 155, 121, 255], [255, 58, 50, 255], [255, 99, 87, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", None, 13333, True): np.array( [ [[255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", None, 13333, False): np.array( [ [[0, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [0, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint8, None, True): np.array( [ [[255, 0, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 255, 255]], [[255, 255, 0, 255], [255, 0, 255, 255], [255, 255, 255, 255], [255, 0, 0, 255]], [[255, 0, 255, 255], [0, 255, 255, 255], [0, 0, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 0, 255, 255], [0, 255, 255, 255], [255, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint8, None, False): np.array( [ [[255, 0, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 0, 255]], [[0, 255, 255, 255], [255, 0, 255, 255], [255, 255, 255, 255], [0, 0, 255, 255]], [[255, 0, 255, 255], [255, 255, 0, 255], [255, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 0, 255, 255], [255, 255, 0, 255], [255, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint8, 232, True): np.array( [ [[255, 0, 255, 255], [255, 255, 0, 255], [255, 0, 255, 255], [255, 255, 255, 255]], [[0, 255, 255, 255], [255, 0, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[0, 0, 255, 255], [0, 0, 255, 255], [0, 0, 255, 255], [0, 0, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint8, 232, False): np.array( [ [[255, 0, 255, 255], [0, 255, 255, 255], [255, 0, 255, 255], [255, 255, 255, 255]], [[255, 255, 0, 255], [255, 0, 255, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 0, 0, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint16, None, True): np.array( [ [[0, 0, 255, 255], [255, 0, 0, 255], [0, 0, 255, 255], [0, 255, 255, 255]], [[0, 255, 255, 255], [255, 255, 0, 255], [255, 0, 255, 255], [0, 255, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 255, 255], [255, 0, 255, 255]], [[0, 0, 0, 255], [0, 255, 255, 255], [0, 255, 0, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint16, None, False): np.array( [ [[255, 0, 0, 255], [0, 0, 255, 255], [255, 0, 0, 255], [255, 255, 0, 255]], [[255, 255, 0, 255], [0, 255, 255, 255], [255, 0, 255, 255], [0, 255, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 0, 0, 255], [255, 0, 255, 255]], [[0, 0, 0, 255], [255, 255, 0, 255], [0, 255, 0, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint16, 232, True): np.array( [ [[0, 255, 255, 255], [255, 0, 255, 255], [0, 0, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 0, 255], [255, 0, 255, 255], [0, 255, 0, 255]], [[0, 255, 0, 255], [255, 0, 0, 255], [255, 0, 255, 255], [255, 0, 255, 255]], [[0, 0, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint16, 232, False): np.array( [ [[255, 255, 0, 255], [255, 0, 255, 255], [255, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 255, 255, 255], [255, 0, 255, 255], [0, 255, 0, 255]], [[0, 255, 0, 255], [0, 0, 255, 255], [255, 0, 255, 255], [255, 0, 255, 255]], [[255, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint16, 13333, True): np.array( [ [[0, 0, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [0, 255, 255, 255]], [[255, 0, 0, 255], [255, 0, 0, 255], [255, 0, 255, 255], [0, 0, 0, 255]], [[255, 255, 0, 255], [255, 255, 0, 255], [255, 0, 255, 255], [255, 0, 255, 255]], [[255, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGB", np.uint16, 13333, False): np.array( [ [[255, 0, 0, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255]], [[0, 0, 255, 255], [0, 0, 255, 255], [255, 0, 255, 255], [0, 0, 0, 255]], [[0, 255, 255, 255], [0, 255, 255, 255], [255, 0, 255, 255], [255, 0, 255, 255]], [[0, 0, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGB", "RGBA", None, None, True): Exception, (np.uint8, "RGB", "RGBA", None, None, False): Exception, (np.uint8, "RGB", "RGBA", None, 232, True): Exception, (np.uint8, "RGB", "RGBA", None, 232, False): Exception, (np.uint8, "RGB", "RGBA", None, 13333, True): Exception, (np.uint8, "RGB", "RGBA", None, 13333, False): Exception, (np.uint8, "RGB", "RGBA", np.uint8, None, True): Exception, (np.uint8, "RGB", "RGBA", np.uint8, None, False): Exception, (np.uint8, "RGB", "RGBA", np.uint8, 232, True): Exception, (np.uint8, "RGB", "RGBA", np.uint8, 232, False): Exception, (np.uint8, "RGB", "RGBA", np.uint8, 13333, True): Exception, (np.uint8, "RGB", "RGBA", np.uint8, 13333, False): Exception, (np.uint8, "RGB", "RGBA", np.uint16, None, True): Exception, (np.uint8, "RGB", "RGBA", np.uint16, None, False): Exception, (np.uint8, "RGB", "RGBA", np.uint16, 232, True): Exception, (np.uint8, "RGB", "RGBA", np.uint16, 232, False): Exception, (np.uint8, "RGB", "RGBA", np.uint16, 13333, True): Exception, (np.uint8, "RGB", "RGBA", np.uint16, 13333, False): Exception, (np.uint8, "RGBA", None, None, None, True): np.array( [ [[151, 252, 73, 107], [28, 221, 35, 0], [87, 122, 126, 114], [47, 59, 24, 200]], [[189, 246, 242, 255], [123, 255, 29, 14], [201, 208, 133, 32], [118, 203, 141, 245]], [[133, 131, 248, 81], [4, 84, 99, 40], [40, 167, 119, 150], [13, 158, 108, 21]], [[156, 221, 166, 250], [77, 188, 13, 166], [0, 1, 185, 25], [83, 35, 103, 120]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, None, None, False): np.array( [ [[73, 252, 151, 107], [35, 221, 28, 0], [126, 122, 87, 114], [24, 59, 47, 200]], [[242, 246, 189, 255], [29, 255, 123, 14], [133, 208, 201, 32], [141, 203, 118, 245]], [[248, 131, 133, 81], [99, 84, 4, 40], [119, 167, 40, 150], [108, 158, 13, 21]], [[166, 221, 156, 250], [13, 188, 77, 166], [185, 1, 0, 25], [103, 35, 83, 120]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, None, 232, True): np.array( [ [[137, 229, 66, 97], [25, 201, 31, 0], [79, 110, 114, 103], [42, 53, 21, 181]], [[171, 223, 220, 232], [111, 232, 26, 12], [182, 189, 121, 29], [107, 184, 128, 222]], [[121, 119, 225, 73], [3, 76, 90, 36], [36, 151, 108, 136], [11, 143, 98, 19]], [[141, 201, 151, 227], [70, 171, 11, 151], [0, 0, 168, 22], [75, 31, 93, 109]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, None, 232, False): np.array( [ [[66, 229, 137, 97], [31, 201, 25, 0], [114, 110, 79, 103], [21, 53, 42, 181]], [[220, 223, 171, 232], [26, 232, 111, 12], [121, 189, 182, 29], [128, 184, 107, 222]], [[225, 119, 121, 73], [90, 76, 3, 36], [108, 151, 36, 136], [98, 143, 11, 19]], [[151, 201, 141, 227], [11, 171, 70, 151], [168, 0, 0, 22], [93, 31, 75, 109]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, None, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [209, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 52, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 209, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 52, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint8, None, True): np.array( [ [[0, 255, 0, 0], [255, 0, 0, 255], [0, 255, 255, 255], [0, 0, 255, 255]], [[0, 255, 255, 255], [0, 255, 0, 255], [0, 255, 0, 255], [255, 0, 0, 0]], [[0, 0, 255, 0], [255, 255, 0, 255], [255, 0, 0, 255], [0, 255, 255, 0]], [[255, 0, 255, 255], [0, 255, 0, 255], [255, 0, 0, 0], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint8, None, False): np.array( [ [[0, 255, 0, 0], [0, 0, 255, 255], [255, 255, 0, 255], [255, 0, 0, 255]], [[255, 255, 0, 255], [0, 255, 0, 255], [0, 255, 0, 255], [0, 0, 255, 0]], [[255, 0, 0, 0], [0, 255, 255, 255], [0, 0, 255, 255], [255, 255, 0, 0]], [[255, 0, 255, 255], [0, 255, 0, 255], [0, 0, 255, 0], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint8, 232, True): np.array( [ [[0, 0, 255, 0], [0, 0, 0, 255], [0, 255, 255, 0], [255, 0, 0, 0]], [[0, 0, 255, 255], [0, 255, 255, 255], [255, 0, 0, 0], [0, 255, 255, 255]], [[0, 0, 0, 0], [0, 255, 255, 255], [255, 0, 255, 255], [0, 0, 255, 0]], [[0, 0, 0, 0], [255, 0, 0, 0], [255, 255, 255, 255], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint8, 232, False): np.array( [ [[255, 0, 0, 0], [0, 0, 0, 255], [255, 255, 0, 0], [0, 0, 255, 0]], [[255, 0, 0, 255], [255, 255, 0, 255], [0, 0, 255, 0], [255, 255, 0, 255]], [[0, 0, 0, 0], [255, 255, 0, 255], [255, 0, 255, 255], [255, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 255, 0], [255, 255, 255, 255], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint16, None, True): np.array( [ [[0, 255, 0, 0], [0, 0, 0, 255], [255, 0, 255, 255], [0, 0, 255, 0]], [[255, 255, 0, 0], [255, 0, 0, 0], [255, 0, 0, 0], [0, 0, 255, 0]], [[0, 0, 0, 255], [0, 255, 255, 0], [0, 0, 0, 255], [0, 0, 255, 255]], [[255, 0, 0, 0], [0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint16, None, False): np.array( [ [[0, 255, 0, 0], [0, 0, 0, 255], [255, 0, 255, 255], [255, 0, 0, 0]], [[0, 255, 255, 0], [0, 0, 255, 0], [0, 0, 255, 0], [255, 0, 0, 0]], [[0, 0, 0, 255], [255, 255, 0, 0], [0, 0, 0, 255], [255, 0, 0, 255]], [[0, 0, 255, 0], [0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint16, 232, True): np.array( [ [[0, 0, 255, 0], [0, 255, 0, 255], [0, 0, 255, 0], [255, 0, 255, 0]], [[255, 0, 0, 0], [255, 0, 0, 255], [0, 255, 0, 0], [0, 0, 0, 255]], [[0, 0, 255, 0], [255, 0, 255, 255], [255, 0, 255, 0], [0, 0, 0, 0]], [[255, 255, 0, 0], [0, 255, 0, 0], [255, 255, 255, 0], [255, 0, 255, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint16, 232, False): np.array( [ [[255, 0, 0, 0], [0, 255, 0, 255], [255, 0, 0, 0], [255, 0, 255, 0]], [[0, 0, 255, 0], [0, 0, 255, 255], [0, 255, 0, 0], [0, 0, 0, 255]], [[255, 0, 0, 0], [255, 0, 255, 255], [255, 0, 255, 0], [0, 0, 0, 0]], [[0, 255, 255, 0], [0, 255, 0, 0], [255, 255, 255, 0], [255, 0, 255, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint16, 13333, True): np.array( [ [[0, 255, 255, 0], [255, 0, 255, 255], [255, 255, 255, 0], [255, 255, 255, 0]], [[255, 0, 0, 0], [0, 0, 0, 255], [255, 255, 255, 0], [0, 255, 0, 255]], [[255, 255, 255, 0], [0, 255, 0, 255], [255, 0, 255, 255], [0, 0, 255, 255]], [[0, 0, 255, 255], [255, 0, 0, 255], [255, 0, 255, 0], [0, 255, 255, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", None, np.uint16, 13333, False): np.array( [ [[255, 255, 0, 0], [255, 0, 255, 255], [255, 255, 255, 0], [255, 255, 255, 0]], [[0, 0, 255, 0], [0, 0, 0, 255], [255, 255, 255, 0], [0, 255, 0, 255]], [[255, 255, 255, 0], [0, 255, 0, 255], [255, 0, 255, 255], [255, 0, 0, 255]], [[255, 0, 0, 255], [0, 0, 255, 255], [255, 0, 255, 0], [255, 255, 0, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", None, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", None, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", None, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 232, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", None, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 232, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", None, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint16, None, True): np.array( [ [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint16, None, False): np.array( [ [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint16, 232, True): np.array( [ [[0, 255, 0, 0], [0, 0, 0, 255], [255, 0, 255, 255], [0, 0, 255, 0]], [[255, 255, 0, 255], [255, 255, 0, 0], [255, 0, 0, 0], [0, 0, 255, 0]], [[0, 0, 0, 255], [0, 255, 255, 0], [0, 0, 0, 255], [0, 0, 255, 255]], [[255, 0, 0, 0], [0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint16, 232, False): np.array( [ [[0, 255, 0, 0], [0, 0, 0, 255], [255, 0, 255, 255], [255, 0, 0, 0]], [[0, 255, 255, 255], [0, 255, 255, 0], [0, 0, 255, 0], [255, 0, 0, 0]], [[0, 0, 0, 255], [255, 255, 0, 0], [0, 0, 0, 255], [255, 0, 0, 255]], [[0, 0, 255, 0], [0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint16, 13333, True): np.array( [ [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "SIMPLE", np.uint16, 13333, False): np.array( [ [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGB", None, None, True): Exception, (np.uint8, "RGBA", "RGB", None, None, False): Exception, (np.uint8, "RGBA", "RGB", None, 232, True): Exception, (np.uint8, "RGBA", "RGB", None, 232, False): Exception, (np.uint8, "RGBA", "RGB", None, 13333, True): Exception, (np.uint8, "RGBA", "RGB", None, 13333, False): Exception, (np.uint8, "RGBA", "RGB", np.uint8, None, True): Exception, (np.uint8, "RGBA", "RGB", np.uint8, None, False): Exception, (np.uint8, "RGBA", "RGB", np.uint8, 232, True): Exception, (np.uint8, "RGBA", "RGB", np.uint8, 232, False): Exception, (np.uint8, "RGBA", "RGB", np.uint8, 13333, True): Exception, (np.uint8, "RGBA", "RGB", np.uint8, 13333, False): Exception, (np.uint8, "RGBA", "RGB", np.uint16, None, True): Exception, (np.uint8, "RGBA", "RGB", np.uint16, None, False): Exception, (np.uint8, "RGBA", "RGB", np.uint16, 232, True): Exception, (np.uint8, "RGBA", "RGB", np.uint16, 232, False): Exception, (np.uint8, "RGBA", "RGB", np.uint16, 13333, True): Exception, (np.uint8, "RGBA", "RGB", np.uint16, 13333, False): Exception, (np.uint8, "RGBA", "RGBA", None, None, True): np.array( [ [[0, 3, 73, 0], [0, 3, 35, 0], [0, 0, 126, 0], [0, 0, 24, 145]], [[0, 3, 242, 255], [0, 3, 29, 0], [0, 2, 133, 0], [0, 2, 141, 235]], [[0, 0, 248, 0], [0, 0, 99, 0], [0, 1, 119, 45], [0, 1, 108, 0]], [[0, 3, 166, 245], [0, 2, 13, 77], [0, 0, 185, 0], [0, 0, 103, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", None, None, False): np.array( [ [[73, 3, 0, 0], [35, 3, 0, 0], [126, 0, 0, 0], [24, 0, 0, 145]], [[242, 3, 0, 255], [29, 3, 0, 0], [133, 2, 0, 0], [141, 2, 0, 235]], [[248, 0, 0, 0], [99, 0, 0, 0], [119, 1, 0, 45], [108, 1, 0, 0]], [[166, 3, 0, 245], [13, 2, 0, 77], [185, 0, 0, 0], [103, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", None, 232, True): np.array( [ [[0, 3, 66, 0], [0, 2, 31, 0], [0, 0, 114, 0], [0, 0, 21, 132]], [[0, 3, 220, 232], [0, 3, 26, 0], [0, 2, 121, 0], [0, 2, 128, 213]], [[0, 0, 225, 0], [0, 0, 90, 0], [0, 1, 108, 41], [0, 1, 98, 0]], [[0, 2, 151, 222], [0, 2, 11, 70], [0, 0, 168, 0], [0, 0, 93, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", None, 232, False): np.array( [ [[66, 3, 0, 0], [31, 2, 0, 0], [114, 0, 0, 0], [21, 0, 0, 132]], [[220, 3, 0, 232], [26, 3, 0, 0], [121, 2, 0, 0], [128, 2, 0, 213]], [[225, 0, 0, 0], [90, 0, 0, 0], [108, 1, 0, 41], [98, 1, 0, 0]], [[151, 2, 0, 222], [11, 2, 0, 70], [168, 0, 0, 0], [93, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", None, 13333, True): np.array( [ [[0, 204, 255, 0], [0, 162, 255, 0], [0, 29, 255, 0], [0, 0, 255, 255]], [[0, 196, 255, 255], [0, 208, 255, 0], [0, 145, 255, 0], [0, 138, 255, 255]], [[0, 41, 255, 0], [0, 0, 255, 0], [0, 90, 255, 255], [0, 78, 255, 0]], [[0, 162, 255, 255], [0, 118, 255, 255], [0, 0, 255, 0], [0, 0, 255, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", None, 13333, False): np.array( [ [[255, 204, 0, 0], [255, 162, 0, 0], [255, 29, 0, 0], [255, 0, 0, 255]], [[255, 196, 0, 255], [255, 208, 0, 0], [255, 145, 0, 0], [255, 138, 0, 255]], [[255, 41, 0, 0], [255, 0, 0, 0], [255, 90, 0, 255], [255, 78, 0, 0]], [[255, 162, 0, 255], [255, 118, 0, 255], [255, 0, 0, 0], [255, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint8, None, True): np.array( [ [[255, 0, 0, 255], [255, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 0]], [[255, 0, 255, 255], [255, 0, 0, 255], [255, 255, 0, 255], [255, 255, 0, 0]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 0, 0, 0], [255, 0, 255, 255]], [[255, 0, 255, 0], [255, 255, 0, 0], [255, 255, 0, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint8, None, False): np.array( [ [[0, 0, 255, 255], [0, 0, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0]], [[255, 0, 255, 255], [0, 0, 255, 255], [0, 255, 255, 255], [0, 255, 255, 0]], [[255, 255, 255, 255], [0, 255, 255, 255], [0, 0, 255, 0], [255, 0, 255, 255]], [[255, 0, 255, 0], [0, 255, 255, 0], [0, 255, 255, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint8, 232, True): np.array( [ [[255, 0, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 0, 255]], [[255, 0, 255, 255], [255, 0, 255, 255], [255, 255, 0, 255], [255, 255, 255, 0]], [[255, 255, 0, 255], [255, 255, 255, 255], [255, 0, 255, 0], [255, 0, 255, 255]], [[255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint8, 232, False): np.array( [ [[255, 0, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255]], [[255, 0, 255, 255], [255, 0, 255, 255], [0, 255, 255, 255], [255, 255, 255, 0]], [[0, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 0], [255, 0, 255, 255]], [[0, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 255], [255, 255, 255, 255]], [[255, 0, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 255], [255, 255, 255, 255]], [[255, 0, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint16, None, True): np.array( [ [[255, 0, 0, 255], [255, 0, 0, 255], [255, 0, 255, 255], [255, 255, 255, 0]], [[255, 255, 0, 0], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 255, 0]], [[255, 0, 0, 255], [255, 255, 255, 255], [255, 0, 0, 255], [255, 0, 255, 255]], [[255, 0, 0, 0], [255, 255, 0, 0], [255, 255, 0, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint16, None, False): np.array( [ [[0, 0, 255, 255], [0, 0, 255, 255], [255, 0, 255, 255], [255, 255, 255, 0]], [[0, 255, 255, 0], [0, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 0]], [[0, 0, 255, 255], [255, 255, 255, 255], [0, 0, 255, 255], [255, 0, 255, 255]], [[0, 0, 255, 0], [0, 255, 255, 0], [0, 255, 255, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint16, 232, True): np.array( [ [[255, 255, 255, 255], [255, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 0, 0], [255, 255, 0, 255], [255, 0, 0, 255], [255, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 0], [255, 0, 0, 255]], [[255, 0, 0, 255], [255, 0, 0, 0], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint16, 232, False): np.array( [ [[255, 255, 255, 255], [0, 0, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 255, 255, 0], [0, 255, 255, 255], [0, 0, 255, 255], [0, 0, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 0], [0, 0, 255, 255]], [[0, 0, 255, 255], [0, 0, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint16, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 255], [255, 255, 255, 0]], [[255, 0, 0, 0], [255, 0, 0, 255], [255, 0, 255, 255], [255, 255, 0, 255]], [[255, 0, 255, 255], [255, 255, 0, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint8, "RGBA", "RGBA", np.uint16, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 255], [255, 255, 255, 0]], [[0, 0, 255, 0], [0, 0, 255, 255], [255, 0, 255, 255], [0, 255, 255, 255]], [[255, 0, 255, 255], [0, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 0], [0, 0, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, None, None, True): np.array( [ [[52, 52, 52, 255], [214, 214, 214, 255], [158, 158, 158, 255], [159, 159, 159, 255]], [[224, 224, 224, 255], [133, 133, 133, 255], [132, 132, 132, 255], [0, 0, 0, 255]], [[39, 39, 39, 255], [221, 221, 221, 255], [162, 162, 162, 255], [83, 83, 83, 255]], [[57, 57, 57, 255], [255, 255, 255, 255], [187, 187, 187, 255], [44, 44, 44, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, None, None, False): np.array( [ [[52, 52, 52, 255], [214, 214, 214, 255], [158, 158, 158, 255], [159, 159, 159, 255]], [[224, 224, 224, 255], [133, 133, 133, 255], [132, 132, 132, 255], [0, 0, 0, 255]], [[39, 39, 39, 255], [221, 221, 221, 255], [162, 162, 162, 255], [83, 83, 83, 255]], [[57, 57, 57, 255], [255, 255, 255, 255], [187, 187, 187, 255], [44, 44, 44, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, None, 232, True): np.array( [ [[47, 47, 47, 255], [194, 194, 194, 255], [144, 144, 144, 255], [144, 144, 144, 255]], [[203, 203, 203, 255], [121, 121, 121, 255], [120, 120, 120, 255], [0, 0, 0, 255]], [[35, 35, 35, 255], [201, 201, 201, 255], [148, 148, 148, 255], [76, 76, 76, 255]], [[52, 52, 52, 255], [232, 232, 232, 255], [170, 170, 170, 255], [40, 40, 40, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, None, 232, False): np.array( [ [[47, 47, 47, 255], [194, 194, 194, 255], [144, 144, 144, 255], [144, 144, 144, 255]], [[203, 203, 203, 255], [121, 121, 121, 255], [120, 120, 120, 255], [0, 0, 0, 255]], [[35, 35, 35, 255], [201, 201, 201, 255], [148, 148, 148, 255], [76, 76, 76, 255]], [[52, 52, 52, 255], [232, 232, 232, 255], [170, 170, 170, 255], [40, 40, 40, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, None, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint8, 232, True): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint8, 232, False): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint16, None, True): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint16, None, False): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint16, 232, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint16, 232, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint16, 13333, True): np.array( [ [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", None, np.uint16, 13333, False): np.array( [ [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", None, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", None, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", None, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", None, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", None, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint16, None, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint16, None, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint16, 232, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint16, 232, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint16, 13333, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "SIMPLE", np.uint16, 13333, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGB", None, None, True): Exception, (np.uint16, "2D", "RGB", None, None, False): Exception, (np.uint16, "2D", "RGB", None, 232, True): Exception, (np.uint16, "2D", "RGB", None, 232, False): Exception, (np.uint16, "2D", "RGB", None, 13333, True): Exception, (np.uint16, "2D", "RGB", None, 13333, False): Exception, (np.uint16, "2D", "RGB", np.uint8, None, True): Exception, (np.uint16, "2D", "RGB", np.uint8, None, False): Exception, (np.uint16, "2D", "RGB", np.uint8, 232, True): Exception, (np.uint16, "2D", "RGB", np.uint8, 232, False): Exception, (np.uint16, "2D", "RGB", np.uint8, 13333, True): Exception, (np.uint16, "2D", "RGB", np.uint8, 13333, False): Exception, (np.uint16, "2D", "RGB", np.uint16, None, True): Exception, (np.uint16, "2D", "RGB", np.uint16, None, False): Exception, (np.uint16, "2D", "RGB", np.uint16, 232, True): Exception, (np.uint16, "2D", "RGB", np.uint16, 232, False): Exception, (np.uint16, "2D", "RGB", np.uint16, 13333, True): Exception, (np.uint16, "2D", "RGB", np.uint16, 13333, False): Exception, (np.uint16, "2D", "RGBA", None, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[231, 231, 231, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", None, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[231, 231, 231, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", None, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[210, 210, 210, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", None, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[210, 210, 210, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", None, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint16, None, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint16, None, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint16, 232, True): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint16, 232, False): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint16, 13333, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "2D", "RGBA", np.uint16, 13333, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, None, None, True): np.array( [ [[216, 176, 0, 255], [75, 152, 141, 255], [129, 33, 221, 255], [146, 121, 149, 255]], [[229, 63, 143, 255], [38, 93, 48, 255], [64, 185, 70, 255], [66, 152, 233, 255]], [[170, 192, 38, 255], [139, 15, 154, 255], [208, 226, 113, 255], [208, 15, 137, 255]], [[62, 84, 176, 255], [255, 183, 202, 255], [24, 134, 77, 255], [168, 145, 136, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, None, None, False): np.array( [ [[0, 176, 216, 255], [141, 152, 75, 255], [221, 33, 129, 255], [149, 121, 146, 255]], [[143, 63, 229, 255], [48, 93, 38, 255], [70, 185, 64, 255], [233, 152, 66, 255]], [[38, 192, 170, 255], [154, 15, 139, 255], [113, 226, 208, 255], [137, 15, 208, 255]], [[176, 84, 62, 255], [202, 183, 255, 255], [77, 134, 24, 255], [136, 145, 168, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, None, 232, True): np.array( [ [[196, 160, 0, 255], [68, 138, 128, 255], [117, 30, 201, 255], [133, 110, 135, 255]], [[208, 58, 130, 255], [35, 84, 43, 255], [58, 168, 64, 255], [60, 139, 212, 255]], [[154, 175, 34, 255], [127, 13, 140, 255], [189, 205, 103, 255], [189, 14, 124, 255]], [[56, 76, 160, 255], [232, 166, 184, 255], [22, 122, 70, 255], [153, 132, 124, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, None, 232, False): np.array( [ [[0, 160, 196, 255], [128, 138, 68, 255], [201, 30, 117, 255], [135, 110, 133, 255]], [[130, 58, 208, 255], [43, 84, 35, 255], [64, 168, 58, 255], [212, 139, 60, 255]], [[34, 175, 154, 255], [140, 13, 127, 255], [103, 205, 189, 255], [124, 14, 189, 255]], [[160, 76, 56, 255], [184, 166, 232, 255], [70, 122, 22, 255], [124, 132, 153, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, None, 13333, True): np.array( [ [[255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, None, 13333, False): np.array( [ [[0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [0, 255, 0, 255], [0, 0, 0, 255], [255, 0, 0, 255]], [[0, 0, 0, 255], [255, 0, 255, 255], [255, 0, 255, 255], [255, 255, 0, 255]], [[255, 255, 255, 255], [0, 0, 255, 255], [255, 255, 0, 255], [255, 0, 0, 255]], [[255, 255, 255, 255], [255, 0, 255, 255], [255, 255, 0, 255], [255, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [0, 255, 0, 255], [0, 0, 0, 255], [0, 0, 255, 255]], [[0, 0, 0, 255], [255, 0, 255, 255], [255, 0, 255, 255], [0, 255, 255, 255]], [[255, 255, 255, 255], [255, 0, 0, 255], [0, 255, 255, 255], [0, 0, 255, 255]], [[255, 255, 255, 255], [255, 0, 255, 255], [0, 255, 255, 255], [255, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 0, 255], [0, 255, 0, 255]], [[255, 255, 255, 255], [0, 255, 0, 255], [255, 255, 255, 255], [255, 0, 255, 255]], [[255, 0, 255, 255], [0, 0, 255, 255], [0, 0, 0, 255], [0, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 0, 255], [0, 255, 0, 255]], [[255, 255, 255, 255], [0, 255, 0, 255], [255, 255, 255, 255], [255, 0, 255, 255]], [[255, 0, 255, 255], [255, 0, 0, 255], [0, 0, 0, 255], [255, 255, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint16, None, True): np.array( [ [[255, 0, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 255, 255, 255]], [[0, 0, 0, 255], [0, 255, 0, 255], [255, 0, 255, 255], [255, 0, 0, 255]], [[0, 0, 255, 255], [255, 255, 255, 255], [0, 0, 255, 255], [255, 255, 0, 255]], [[255, 255, 0, 255], [0, 0, 0, 255], [255, 0, 255, 255], [255, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint16, None, False): np.array( [ [[255, 0, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 0, 255]], [[0, 0, 0, 255], [0, 255, 0, 255], [255, 0, 255, 255], [0, 0, 255, 255]], [[255, 0, 0, 255], [255, 255, 255, 255], [255, 0, 0, 255], [0, 255, 255, 255]], [[0, 255, 255, 255], [0, 0, 0, 255], [255, 0, 255, 255], [0, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint16, 232, True): np.array( [ [[0, 0, 255, 255], [0, 255, 0, 255], [255, 255, 255, 255], [0, 0, 255, 255]], [[0, 0, 0, 255], [0, 255, 0, 255], [0, 255, 0, 255], [255, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 0, 0, 255], [255, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint16, 232, False): np.array( [ [[255, 0, 0, 255], [0, 255, 0, 255], [255, 255, 255, 255], [255, 0, 0, 255]], [[0, 0, 0, 255], [0, 255, 0, 255], [0, 255, 0, 255], [0, 0, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 255, 255], [0, 0, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint16, 13333, True): np.array( [ [[0, 0, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 0, 255, 255]], [[0, 255, 0, 255], [255, 0, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255]], [[0, 0, 0, 255], [255, 0, 0, 255], [255, 0, 255, 255], [0, 0, 0, 255]], [[255, 255, 0, 255], [0, 0, 0, 255], [255, 0, 0, 255], [255, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", None, np.uint16, 13333, False): np.array( [ [[255, 0, 0, 255], [0, 0, 255, 255], [0, 0, 255, 255], [255, 0, 255, 255]], [[0, 255, 0, 255], [255, 0, 255, 255], [0, 0, 255, 255], [0, 0, 255, 255]], [[0, 0, 0, 255], [0, 0, 255, 255], [255, 0, 255, 255], [0, 0, 0, 255]], [[0, 255, 255, 255], [0, 0, 0, 255], [0, 0, 255, 255], [255, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", None, None, True): np.array( [ [[255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", None, None, False): np.array( [ [[0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", None, 232, True): np.array( [ [[255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", None, 232, False): np.array( [ [[0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", None, 13333, True): np.array( [ [[255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", None, 13333, False): np.array( [ [[0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint16, None, True): np.array( [ [[0, 0, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint16, None, False): np.array( [ [[255, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint16, 232, True): np.array( [ [[0, 0, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint16, 232, False): np.array( [ [[255, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint16, 13333, True): np.array( [ [[0, 0, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "SIMPLE", np.uint16, 13333, False): np.array( [ [[255, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", None, None, True): np.array( [ [[255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", None, None, False): np.array( [ [[0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", None, 232, True): np.array( [ [[255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", None, 232, False): np.array( [ [[0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", None, 13333, True): np.array( [ [[255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", None, 13333, False): np.array( [ [[0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint16, None, True): np.array( [ [[0, 0, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint16, None, False): np.array( [ [[255, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint16, 232, True): np.array( [ [[0, 255, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 0, 0, 255]], [[0, 0, 0, 255], [0, 255, 0, 255], [255, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 255, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[255, 255, 0, 255], [0, 0, 0, 255], [255, 255, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint16, 232, False): np.array( [ [[255, 255, 0, 255], [0, 0, 255, 255], [0, 0, 255, 255], [0, 0, 255, 255]], [[0, 0, 0, 255], [0, 255, 0, 255], [0, 0, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 255, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 255, 255, 255], [0, 0, 0, 255], [0, 255, 255, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint16, 13333, True): np.array( [ [[0, 0, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGB", np.uint16, 13333, False): np.array( [ [[255, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGB", "RGBA", None, None, True): Exception, (np.uint16, "RGB", "RGBA", None, None, False): Exception, (np.uint16, "RGB", "RGBA", None, 232, True): Exception, (np.uint16, "RGB", "RGBA", None, 232, False): Exception, (np.uint16, "RGB", "RGBA", None, 13333, True): Exception, (np.uint16, "RGB", "RGBA", None, 13333, False): Exception, (np.uint16, "RGB", "RGBA", np.uint8, None, True): Exception, (np.uint16, "RGB", "RGBA", np.uint8, None, False): Exception, (np.uint16, "RGB", "RGBA", np.uint8, 232, True): Exception, (np.uint16, "RGB", "RGBA", np.uint8, 232, False): Exception, (np.uint16, "RGB", "RGBA", np.uint8, 13333, True): Exception, (np.uint16, "RGB", "RGBA", np.uint8, 13333, False): Exception, (np.uint16, "RGB", "RGBA", np.uint16, None, True): Exception, (np.uint16, "RGB", "RGBA", np.uint16, None, False): Exception, (np.uint16, "RGB", "RGBA", np.uint16, 232, True): Exception, (np.uint16, "RGB", "RGBA", np.uint16, 232, False): Exception, (np.uint16, "RGB", "RGBA", np.uint16, 13333, True): Exception, (np.uint16, "RGB", "RGBA", np.uint16, 13333, False): Exception, (np.uint16, "RGBA", None, None, None, True): np.array( [ [[50, 158, 115, 181], [0, 142, 130, 220], [188, 89, 183, 104], [223, 47, 120, 45]], [[18, 160, 124, 98], [108, 253, 233, 185], [34, 71, 19, 189], [255, 100, 106, 67]], [[202, 255, 158, 255], [0, 224, 107, 164], [195, 136, 74, 247], [68, 21, 140, 187]], [[239, 107, 145, 28], [212, 155, 227, 49], [81, 220, 126, 0], [52, 57, 229, 189]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, None, None, False): np.array( [ [[115, 158, 50, 181], [130, 142, 0, 220], [183, 89, 188, 104], [120, 47, 223, 45]], [[124, 160, 18, 98], [233, 253, 108, 185], [19, 71, 34, 189], [106, 100, 255, 67]], [[158, 255, 202, 255], [107, 224, 0, 164], [74, 136, 195, 247], [140, 21, 68, 187]], [[145, 107, 239, 28], [227, 155, 212, 49], [126, 220, 81, 0], [229, 57, 52, 189]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, None, 232, True): np.array( [ [[46, 144, 104, 165], [0, 129, 118, 200], [171, 81, 167, 94], [202, 43, 109, 41]], [[17, 145, 113, 89], [98, 230, 212, 169], [31, 64, 17, 172], [232, 91, 96, 61]], [[184, 232, 144, 232], [0, 204, 98, 149], [177, 124, 68, 225], [62, 19, 128, 170]], [[218, 98, 132, 25], [193, 141, 206, 45], [73, 200, 114, 0], [47, 51, 208, 172]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, None, 232, False): np.array( [ [[104, 144, 46, 165], [118, 129, 0, 200], [167, 81, 171, 94], [109, 43, 202, 41]], [[113, 145, 17, 89], [212, 230, 98, 169], [17, 64, 31, 172], [96, 91, 232, 61]], [[144, 232, 184, 232], [98, 204, 0, 149], [68, 124, 177, 225], [128, 19, 62, 170]], [[132, 98, 218, 25], [206, 141, 193, 45], [114, 200, 73, 0], [208, 51, 47, 172]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, None, 13333, True): np.array( [ [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [6, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 17], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 6, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 17], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint8, None, True): np.array( [ [[255, 255, 0, 0], [255, 255, 255, 255], [255, 0, 0, 255], [0, 0, 255, 0]], [[255, 255, 255, 255], [255, 0, 0, 0], [255, 0, 0, 0], [255, 255, 255, 0]], [[255, 255, 255, 255], [255, 255, 0, 255], [0, 255, 255, 0], [255, 0, 255, 0]], [[0, 0, 0, 255], [255, 0, 0, 0], [0, 255, 255, 255], [255, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint8, None, False): np.array( [ [[0, 255, 255, 0], [255, 255, 255, 255], [0, 0, 255, 255], [255, 0, 0, 0]], [[255, 255, 255, 255], [0, 0, 255, 0], [0, 0, 255, 0], [255, 255, 255, 0]], [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 0, 0], [255, 0, 255, 0]], [[0, 0, 0, 255], [0, 0, 255, 0], [255, 255, 0, 255], [0, 0, 255, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint8, 232, True): np.array( [ [[255, 255, 255, 0], [255, 0, 255, 255], [0, 0, 0, 255], [255, 0, 0, 0]], [[0, 0, 0, 0], [255, 255, 255, 0], [0, 255, 0, 255], [255, 0, 255, 0]], [[255, 255, 255, 255], [255, 255, 255, 0], [0, 255, 255, 0], [255, 0, 255, 255]], [[255, 255, 255, 0], [0, 0, 255, 0], [0, 255, 255, 255], [0, 0, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint8, 232, False): np.array( [ [[255, 255, 255, 0], [255, 0, 255, 255], [0, 0, 0, 255], [0, 0, 255, 0]], [[0, 0, 0, 0], [255, 255, 255, 0], [0, 255, 0, 255], [255, 0, 255, 0]], [[255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 0, 0], [255, 0, 255, 255]], [[255, 255, 255, 0], [255, 0, 0, 0], [255, 255, 0, 255], [255, 0, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint16, None, True): np.array( [ [[0, 0, 0, 255], [255, 0, 255, 255], [0, 0, 0, 0], [255, 0, 255, 255]], [[255, 255, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 255, 0, 0]], [[255, 0, 255, 0], [255, 255, 255, 0], [0, 255, 0, 0], [0, 0, 255, 255]], [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0], [0, 255, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint16, None, False): np.array( [ [[0, 0, 0, 255], [255, 0, 255, 255], [0, 0, 0, 0], [255, 0, 255, 255]], [[0, 255, 255, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 255, 0, 0]], [[255, 0, 255, 0], [255, 255, 255, 0], [0, 255, 0, 0], [255, 0, 0, 255]], [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0], [0, 255, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint16, 232, True): np.array( [ [[0, 255, 0, 255], [255, 255, 0, 0], [255, 255, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 255, 0]], [[0, 0, 255, 0], [255, 255, 0, 0], [255, 0, 0, 255], [0, 0, 0, 0]], [[0, 0, 255, 0], [0, 255, 0, 255], [0, 0, 255, 255], [0, 255, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint16, 232, False): np.array( [ [[0, 255, 0, 255], [0, 255, 255, 0], [0, 255, 255, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [255, 0, 0, 0]], [[255, 0, 0, 0], [0, 255, 255, 0], [0, 0, 255, 255], [0, 0, 0, 0]], [[255, 0, 0, 0], [0, 255, 0, 255], [255, 0, 0, 255], [0, 255, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint16, 13333, True): np.array( [ [[0, 255, 0, 255], [255, 0, 0, 0], [0, 255, 0, 0], [255, 0, 255, 0]], [[0, 0, 255, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 255]], [[0, 0, 255, 0], [255, 255, 0, 0], [0, 0, 0, 255], [0, 0, 255, 0]], [[0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 0, 0], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", None, np.uint16, 13333, False): np.array( [ [[0, 255, 0, 255], [0, 0, 255, 0], [0, 255, 0, 0], [255, 0, 255, 0]], [[255, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 255]], [[255, 0, 0, 0], [0, 255, 255, 0], [0, 0, 0, 255], [255, 0, 0, 0]], [[0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 0], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", None, None, True): np.array( [ [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", None, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", None, 232, True): np.array( [ [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", None, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", None, 13333, True): np.array( [ [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint16, None, True): np.array( [ [[0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint16, None, False): np.array( [ [[0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint16, 232, True): np.array( [ [[0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint16, 232, False): np.array( [ [[0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint16, 13333, True): np.array( [ [[0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "SIMPLE", np.uint16, 13333, False): np.array( [ [[0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGB", None, None, True): Exception, (np.uint16, "RGBA", "RGB", None, None, False): Exception, (np.uint16, "RGBA", "RGB", None, 232, True): Exception, (np.uint16, "RGBA", "RGB", None, 232, False): Exception, (np.uint16, "RGBA", "RGB", None, 13333, True): Exception, (np.uint16, "RGBA", "RGB", None, 13333, False): Exception, (np.uint16, "RGBA", "RGB", np.uint8, None, True): Exception, (np.uint16, "RGBA", "RGB", np.uint8, None, False): Exception, (np.uint16, "RGBA", "RGB", np.uint8, 232, True): Exception, (np.uint16, "RGBA", "RGB", np.uint8, 232, False): Exception, (np.uint16, "RGBA", "RGB", np.uint8, 13333, True): Exception, (np.uint16, "RGBA", "RGB", np.uint8, 13333, False): Exception, (np.uint16, "RGBA", "RGB", np.uint16, None, True): Exception, (np.uint16, "RGBA", "RGB", np.uint16, None, False): Exception, (np.uint16, "RGBA", "RGB", np.uint16, 232, True): Exception, (np.uint16, "RGBA", "RGB", np.uint16, 232, False): Exception, (np.uint16, "RGBA", "RGB", np.uint16, 13333, True): Exception, (np.uint16, "RGBA", "RGB", np.uint16, 13333, False): Exception, (np.uint16, "RGBA", "RGBA", None, None, True): np.array( [ [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[108, 255, 255, 255], [255, 255, 255, 255], [203, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 139, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", None, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 108, 255], [255, 255, 255, 255], [255, 255, 203, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 139, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", None, 232, True): np.array( [ [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[98, 255, 255, 255], [255, 255, 255, 255], [184, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 126, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", None, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 98, 255], [255, 255, 255, 255], [255, 255, 184, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 126, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", None, 13333, True): np.array( [ [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint16, None, True): np.array( [ [[0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint16, None, False): np.array( [ [[0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint16, 232, True): np.array( [ [[255, 255, 255, 0], [255, 0, 255, 0], [0, 0, 255, 0], [0, 0, 255, 0]], [[0, 0, 255, 0], [255, 0, 255, 0], [0, 255, 0, 0], [255, 0, 255, 0]], [[0, 255, 0, 0], [255, 0, 0, 0], [0, 255, 0, 0], [255, 255, 255, 0]], [[0, 0, 255, 0], [0, 0, 255, 255], [0, 255, 255, 255], [255, 0, 255, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint16, 232, False): np.array( [ [[255, 255, 255, 0], [255, 0, 255, 0], [255, 0, 0, 0], [255, 0, 0, 0]], [[255, 0, 0, 0], [255, 0, 255, 0], [0, 255, 0, 0], [255, 0, 255, 0]], [[0, 255, 0, 0], [0, 0, 255, 0], [0, 255, 0, 0], [255, 255, 255, 0]], [[255, 0, 0, 0], [255, 0, 0, 255], [255, 255, 0, 255], [255, 0, 255, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint16, 13333, True): np.array( [ [[255, 255, 0, 0], [255, 0, 0, 0], [0, 255, 0, 0], [0, 255, 0, 0]], [[0, 255, 0, 0], [255, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [255, 0, 0, 0], [255, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.uint16, "RGBA", "RGBA", np.uint16, 13333, False): np.array( [ [[0, 255, 255, 0], [0, 0, 255, 0], [0, 255, 0, 0], [0, 255, 0, 0]], [[0, 255, 0, 0], [0, 0, 255, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 255, 0], [0, 0, 255, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", None, None, True): np.array( [ [[255, 255, 255, 255], [136, 136, 136, 255], [0, 0, 0, 0], [225, 225, 225, 255]], [[216, 216, 216, 255], [224, 224, 224, 255], [255, 255, 255, 255], [16, 16, 16, 255]], [[252, 252, 252, 255], [216, 216, 216, 255], [42, 42, 42, 255], [252, 252, 252, 255]], [[18, 18, 18, 255], [169, 169, 169, 255], [223, 223, 223, 255], [252, 252, 252, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", None, None, False): np.array( [ [[255, 255, 255, 255], [136, 136, 136, 255], [0, 0, 0, 0], [225, 225, 225, 255]], [[216, 216, 216, 255], [224, 224, 224, 255], [255, 255, 255, 255], [16, 16, 16, 255]], [[252, 252, 252, 255], [216, 216, 216, 255], [42, 42, 42, 255], [252, 252, 252, 255]], [[18, 18, 18, 255], [169, 169, 169, 255], [223, 223, 223, 255], [252, 252, 252, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", None, 232, True): np.array( [ [[255, 255, 255, 255], [124, 124, 124, 255], [0, 0, 0, 0], [205, 205, 205, 255]], [[197, 197, 197, 255], [204, 204, 204, 255], [232, 232, 232, 255], [15, 15, 15, 255]], [[230, 230, 230, 255], [196, 196, 196, 255], [38, 38, 38, 255], [229, 229, 229, 255]], [[16, 16, 16, 255], [153, 153, 153, 255], [203, 203, 203, 255], [229, 229, 229, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", None, 232, False): np.array( [ [[255, 255, 255, 255], [124, 124, 124, 255], [0, 0, 0, 0], [205, 205, 205, 255]], [[197, 197, 197, 255], [204, 204, 204, 255], [232, 232, 232, 255], [15, 15, 15, 255]], [[230, 230, 230, 255], [196, 196, 196, 255], [38, 38, 38, 255], [229, 229, 229, 255]], [[16, 16, 16, 255], [153, 153, 153, 255], [203, 203, 203, 255], [229, 229, 229, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", None, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint16, None, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 0], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint16, None, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 0], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint16, 232, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 0], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint16, 232, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 0], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint16, 13333, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 0], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "SIMPLE", np.uint16, 13333, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 0], [0, 0, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGB", None, None, True): Exception, (np.float32, "2D", "RGB", None, None, False): Exception, (np.float32, "2D", "RGB", None, 232, True): Exception, (np.float32, "2D", "RGB", None, 232, False): Exception, (np.float32, "2D", "RGB", None, 13333, True): Exception, (np.float32, "2D", "RGB", None, 13333, False): Exception, (np.float32, "2D", "RGB", np.uint8, None, True): Exception, (np.float32, "2D", "RGB", np.uint8, None, False): Exception, (np.float32, "2D", "RGB", np.uint8, 232, True): Exception, (np.float32, "2D", "RGB", np.uint8, 232, False): Exception, (np.float32, "2D", "RGB", np.uint8, 13333, True): Exception, (np.float32, "2D", "RGB", np.uint8, 13333, False): Exception, (np.float32, "2D", "RGB", np.uint16, None, True): Exception, (np.float32, "2D", "RGB", np.uint16, None, False): Exception, (np.float32, "2D", "RGB", np.uint16, 232, True): Exception, (np.float32, "2D", "RGB", np.uint16, 232, False): Exception, (np.float32, "2D", "RGB", np.uint16, 13333, True): Exception, (np.float32, "2D", "RGB", np.uint16, 13333, False): Exception, (np.float32, "2D", "RGBA", None, None, True): np.array( [ [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [1, 1, 1, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", None, None, False): np.array( [ [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [1, 1, 1, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", None, 232, True): np.array( [ [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", None, 232, False): np.array( [ [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", None, 13333, True): np.array( [ [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [52, 52, 52, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [8, 8, 8, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [45, 45, 45, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", None, 13333, False): np.array( [ [[255, 255, 255, 255], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [52, 52, 52, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [8, 8, 8, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [45, 45, 45, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint16, None, True): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint16, None, False): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint16, 232, True): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint16, 232, False): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint16, 13333, True): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "2D", "RGBA", np.uint16, 13333, False): np.array( [ [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", None, None, True): np.array( [ [[59, 99, 32, 255], [103, 231, 72, 255], [233, 117, 43, 255], [74, 249, 184, 255]], [[0, 185, 137, 0], [232, 72, 187, 255], [86, 56, 249, 255], [35, 88, 101, 255]], [[217, 49, 0, 255], [123, 12, 152, 255], [255, 83, 37, 255], [95, 90, 22, 255]], [[177, 133, 125, 255], [238, 36, 174, 255], [70, 177, 17, 255], [67, 65, 219, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", None, None, False): np.array( [ [[32, 99, 59, 255], [72, 231, 103, 255], [43, 117, 233, 255], [184, 249, 74, 255]], [[137, 185, 0, 0], [187, 72, 232, 255], [249, 56, 86, 255], [101, 88, 35, 255]], [[0, 49, 217, 255], [152, 12, 123, 255], [37, 83, 255, 255], [22, 90, 95, 255]], [[125, 133, 177, 255], [174, 36, 238, 255], [17, 177, 70, 255], [219, 65, 67, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", None, 232, True): np.array( [ [[54, 90, 29, 255], [94, 210, 65, 255], [212, 106, 39, 255], [68, 227, 167, 255]], [[0, 169, 125, 0], [211, 65, 170, 255], [78, 51, 227, 255], [32, 80, 91, 255]], [[197, 44, 0, 255], [112, 11, 138, 255], [255, 75, 34, 255], [86, 82, 20, 255]], [[161, 121, 113, 255], [216, 33, 158, 255], [64, 161, 15, 255], [61, 59, 199, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", None, 232, False): np.array( [ [[29, 90, 54, 255], [65, 210, 94, 255], [39, 106, 212, 255], [167, 227, 68, 255]], [[125, 169, 0, 0], [170, 65, 211, 255], [227, 51, 78, 255], [91, 80, 32, 255]], [[0, 44, 197, 255], [138, 11, 112, 255], [34, 75, 255, 255], [20, 82, 86, 255]], [[113, 121, 161, 255], [158, 33, 216, 255], [15, 161, 64, 255], [199, 59, 61, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", None, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", None, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 0, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint8, None, True): np.array( [ [[0, 0, 255, 255], [0, 0, 255, 255], [0, 0, 0, 255], [255, 0, 255, 255]], [[255, 0, 0, 0], [255, 255, 0, 255], [255, 255, 0, 255], [0, 255, 0, 255]], [[0, 0, 255, 255], [0, 255, 255, 255], [255, 0, 0, 255], [0, 255, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint8, None, False): np.array( [ [[255, 0, 0, 255], [255, 0, 0, 255], [0, 0, 0, 255], [255, 0, 255, 255]], [[0, 0, 255, 0], [0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 0, 255]], [[255, 0, 0, 255], [255, 255, 0, 255], [0, 0, 255, 255], [255, 255, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [0, 0, 255, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint8, 232, True): np.array( [ [[255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255], [255, 0, 0, 255]], [[255, 0, 0, 0], [0, 0, 255, 255], [255, 0, 0, 255], [255, 255, 0, 255]], [[0, 255, 255, 255], [255, 0, 255, 255], [255, 0, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 0, 255, 255], [255, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint8, 232, False): np.array( [ [[0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255], [0, 0, 255, 255]], [[0, 0, 255, 0], [255, 0, 0, 255], [0, 0, 255, 255], [0, 255, 255, 255]], [[255, 255, 0, 255], [255, 0, 255, 255], [255, 0, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 0, 255, 255], [0, 0, 255, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint16, None, True): np.array( [ [[0, 0, 255, 255], [255, 0, 0, 255], [255, 0, 255, 255], [0, 0, 0, 255]], [[255, 0, 255, 0], [0, 0, 255, 255], [255, 255, 0, 255], [0, 0, 255, 255]], [[255, 0, 255, 255], [255, 0, 0, 255], [0, 0, 255, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [0, 0, 255, 255], [0, 255, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint16, None, False): np.array( [ [[255, 0, 0, 255], [0, 0, 255, 255], [255, 0, 255, 255], [0, 0, 0, 255]], [[255, 0, 255, 0], [255, 0, 0, 255], [0, 255, 255, 255], [255, 0, 0, 255]], [[255, 0, 255, 255], [0, 0, 255, 255], [255, 0, 0, 255], [255, 255, 255, 255]], [[0, 0, 0, 255], [255, 0, 0, 255], [0, 255, 0, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint16, 232, True): np.array( [ [[255, 255, 0, 255], [0, 255, 0, 255], [0, 0, 255, 255], [0, 0, 0, 255]], [[255, 0, 0, 0], [0, 0, 0, 255], [255, 255, 0, 255], [0, 0, 0, 255]], [[0, 0, 255, 255], [0, 0, 255, 255], [0, 255, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 0, 255], [0, 0, 255, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint16, 232, False): np.array( [ [[0, 255, 255, 255], [0, 255, 0, 255], [255, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 255, 0], [0, 0, 0, 255], [0, 255, 255, 255], [0, 0, 0, 255]], [[255, 0, 0, 255], [255, 0, 0, 255], [0, 255, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 255, 255, 255], [255, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint16, 13333, True): np.array( [ [[255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255], [255, 0, 0, 255]], [[255, 255, 0, 0], [0, 0, 0, 255], [255, 0, 0, 255], [255, 0, 255, 255]], [[0, 255, 255, 255], [255, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[255, 0, 255, 255], [0, 0, 0, 255], [255, 0, 255, 255], [255, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "SIMPLE", np.uint16, 13333, False): np.array( [ [[0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255], [0, 0, 255, 255]], [[0, 255, 255, 0], [0, 0, 0, 255], [0, 0, 255, 255], [255, 0, 255, 255]], [[255, 255, 0, 255], [0, 0, 255, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[255, 0, 255, 255], [0, 0, 0, 255], [255, 0, 255, 255], [0, 0, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", None, None, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", None, None, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", None, 232, True): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [255, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", None, 232, False): np.array( [ [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 255, 255], [0, 0, 0, 255]], [[0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255], [0, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", None, 13333, True): np.array( [ [[12, 0, 0, 255], [21, 0, 0, 255], [47, 0, 0, 255], [15, 0, 0, 255]], [[0, 0, 0, 0], [47, 0, 0, 255], [17, 0, 0, 255], [7, 0, 0, 255]], [[44, 0, 0, 255], [25, 0, 0, 255], [255, 0, 0, 255], [19, 0, 0, 255]], [[36, 0, 0, 255], [48, 0, 0, 255], [14, 0, 0, 255], [13, 0, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", None, 13333, False): np.array( [ [[0, 0, 12, 255], [0, 0, 21, 255], [0, 0, 47, 255], [0, 0, 15, 255]], [[0, 0, 0, 0], [0, 0, 47, 255], [0, 0, 17, 255], [0, 0, 7, 255]], [[0, 0, 44, 255], [0, 0, 25, 255], [0, 0, 255, 255], [0, 0, 19, 255]], [[0, 0, 36, 255], [0, 0, 48, 255], [0, 0, 14, 255], [0, 0, 13, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint8, None, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint8, None, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint8, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint8, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[255, 255, 255, 0], [0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 255, 0], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint16, None, True): np.array( [ [[0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint16, None, False): np.array( [ [[255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint16, 232, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint16, 232, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint16, 13333, True): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGB", np.uint16, 13333, False): np.array( [ [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 0], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGB", "RGBA", None, None, True): Exception, (np.float32, "RGB", "RGBA", None, None, False): Exception, (np.float32, "RGB", "RGBA", None, 232, True): Exception, (np.float32, "RGB", "RGBA", None, 232, False): Exception, (np.float32, "RGB", "RGBA", None, 13333, True): Exception, (np.float32, "RGB", "RGBA", None, 13333, False): Exception, (np.float32, "RGB", "RGBA", np.uint8, None, True): Exception, (np.float32, "RGB", "RGBA", np.uint8, None, False): Exception, (np.float32, "RGB", "RGBA", np.uint8, 232, True): Exception, (np.float32, "RGB", "RGBA", np.uint8, 232, False): Exception, (np.float32, "RGB", "RGBA", np.uint8, 13333, True): Exception, (np.float32, "RGB", "RGBA", np.uint8, 13333, False): Exception, (np.float32, "RGB", "RGBA", np.uint16, None, True): Exception, (np.float32, "RGB", "RGBA", np.uint16, None, False): Exception, (np.float32, "RGB", "RGBA", np.uint16, 232, True): Exception, (np.float32, "RGB", "RGBA", np.uint16, 232, False): Exception, (np.float32, "RGB", "RGBA", np.uint16, 13333, True): Exception, (np.float32, "RGB", "RGBA", np.uint16, 13333, False): Exception, (np.float32, "RGBA", "SIMPLE", None, None, True): np.array( [ [[248, 159, 5, 0], [217, 237, 151, 255], [102, 203, 57, 44], [244, 177, 73, 196]], [[29, 189, 17, 250], [168, 188, 84, 208], [198, 134, 144, 81], [208, 209, 210, 126]], [[8, 212, 80, 241], [159, 153, 128, 236], [0, 0, 7, 0], [249, 140, 61, 88]], [[175, 255, 216, 90], [42, 76, 23, 172], [64, 65, 205, 254], [0, 255, 148, 117]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", None, None, False): np.array( [ [[5, 159, 248, 0], [151, 237, 217, 255], [57, 203, 102, 44], [73, 177, 244, 196]], [[17, 189, 29, 250], [84, 188, 168, 208], [144, 134, 198, 81], [210, 209, 208, 126]], [[80, 212, 8, 241], [128, 153, 159, 236], [7, 0, 0, 0], [61, 140, 249, 88]], [[216, 255, 175, 90], [23, 76, 42, 172], [205, 65, 64, 254], [148, 255, 0, 117]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", None, 232, True): np.array( [ [[225, 145, 5, 0], [197, 215, 138, 255], [93, 185, 51, 40], [222, 161, 66, 178]], [[26, 172, 15, 227], [153, 171, 76, 189], [181, 122, 131, 73], [189, 190, 191, 114]], [[7, 193, 73, 219], [144, 139, 116, 215], [0, 0, 6, 0], [227, 127, 55, 80]], [[159, 255, 197, 82], [38, 69, 21, 157], [58, 59, 186, 231], [0, 232, 134, 107]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", None, 232, False): np.array( [ [[5, 145, 225, 0], [138, 215, 197, 255], [51, 185, 93, 40], [66, 161, 222, 178]], [[15, 172, 26, 227], [76, 171, 153, 189], [131, 122, 181, 73], [191, 190, 189, 114]], [[73, 193, 7, 219], [116, 139, 144, 215], [6, 0, 0, 0], [55, 127, 227, 80]], [[197, 255, 159, 82], [21, 69, 38, 157], [186, 59, 58, 231], [134, 232, 0, 107]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", None, 13333, True): np.array( [ [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 0, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", None, 13333, False): np.array( [ [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 0, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint8, None, True): np.array( [ [[255, 0, 0, 0], [0, 0, 0, 255], [255, 0, 0, 255], [255, 0, 0, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 0, 255, 255]], [[255, 255, 255, 0], [0, 0, 255, 255], [255, 255, 0, 0], [0, 255, 0, 255]], [[0, 255, 255, 255], [255, 255, 0, 255], [255, 0, 0, 255], [255, 255, 255, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint8, None, False): np.array( [ [[0, 0, 255, 0], [0, 0, 0, 255], [0, 0, 255, 255], [0, 0, 255, 255]], [[0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 0, 255, 255]], [[255, 255, 255, 0], [255, 0, 0, 255], [0, 255, 255, 0], [0, 255, 0, 255]], [[255, 255, 0, 255], [0, 255, 255, 255], [0, 0, 255, 255], [255, 255, 255, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint8, 232, True): np.array( [ [[0, 0, 0, 0], [0, 0, 255, 255], [0, 0, 0, 255], [255, 0, 255, 255]], [[255, 255, 0, 0], [0, 0, 255, 0], [0, 255, 0, 0], [0, 255, 0, 255]], [[0, 0, 0, 0], [255, 0, 255, 0], [255, 255, 255, 0], [0, 0, 0, 255]], [[0, 255, 0, 255], [255, 0, 0, 0], [255, 0, 255, 0], [255, 255, 255, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint8, 232, False): np.array( [ [[0, 0, 0, 0], [255, 0, 0, 255], [0, 0, 0, 255], [255, 0, 255, 255]], [[0, 255, 255, 0], [255, 0, 0, 0], [0, 255, 0, 0], [0, 255, 0, 255]], [[0, 0, 0, 0], [255, 0, 255, 0], [255, 255, 255, 0], [0, 0, 0, 255]], [[0, 255, 0, 255], [0, 0, 255, 0], [255, 0, 255, 0], [255, 255, 255, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint8, 13333, True): np.array( [ [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint8, 13333, False): np.array( [ [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint16, None, True): np.array( [ [[0, 0, 255, 0], [0, 255, 255, 0], [255, 255, 0, 255], [0, 0, 0, 255]], [[0, 255, 0, 255], [255, 255, 0, 255], [0, 0, 255, 255], [255, 0, 0, 255]], [[0, 0, 255, 0], [255, 0, 0, 0], [255, 255, 255, 0], [0, 255, 255, 0]], [[255, 0, 255, 0], [255, 0, 0, 255], [255, 0, 0, 0], [255, 0, 0, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint16, None, False): np.array( [ [[255, 0, 0, 0], [255, 255, 0, 0], [0, 255, 255, 255], [0, 0, 0, 255]], [[0, 255, 0, 255], [0, 255, 255, 255], [255, 0, 0, 255], [0, 0, 255, 255]], [[255, 0, 0, 0], [0, 0, 255, 0], [255, 255, 255, 0], [255, 255, 0, 0]], [[255, 0, 255, 0], [0, 0, 255, 255], [0, 0, 255, 0], [0, 0, 255, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint16, 232, True): np.array( [ [[255, 0, 0, 0], [0, 0, 255, 0], [255, 0, 255, 0], [255, 0, 255, 0]], [[0, 0, 255, 0], [255, 255, 0, 255], [0, 0, 0, 0], [255, 0, 0, 255]], [[0, 0, 0, 255], [255, 0, 0, 0], [255, 255, 255, 0], [0, 0, 0, 0]], [[255, 0, 0, 0], [0, 255, 255, 0], [0, 0, 255, 255], [255, 0, 0, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint16, 232, False): np.array( [ [[0, 0, 255, 0], [255, 0, 0, 0], [255, 0, 255, 0], [255, 0, 255, 0]], [[255, 0, 0, 0], [0, 255, 255, 255], [0, 0, 0, 0], [0, 0, 255, 255]], [[0, 0, 0, 255], [0, 0, 255, 0], [255, 255, 255, 0], [0, 0, 0, 0]], [[0, 0, 255, 0], [255, 255, 0, 0], [255, 0, 0, 255], [0, 0, 255, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint16, 13333, True): np.array( [ [[255, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 255, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [255, 0, 0, 0], [0, 0, 255, 255]], [[0, 0, 0, 0], [0, 0, 255, 255], [255, 255, 0, 0], [255, 255, 0, 0]], [[255, 0, 0, 0], [0, 255, 0, 0], [0, 0, 0, 255], [255, 0, 0, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "SIMPLE", np.uint16, 13333, False): np.array( [ [[0, 0, 255, 0], [0, 0, 0, 0], [0, 0, 0, 255], [255, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 255, 0], [255, 0, 0, 255]], [[0, 0, 0, 0], [255, 0, 0, 255], [0, 255, 255, 0], [0, 255, 255, 0]], [[0, 0, 255, 0], [0, 255, 0, 0], [0, 0, 0, 255], [0, 0, 255, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGB", None, None, True): Exception, (np.float32, "RGBA", "RGB", None, None, False): Exception, (np.float32, "RGBA", "RGB", None, 232, True): Exception, (np.float32, "RGBA", "RGB", None, 232, False): Exception, (np.float32, "RGBA", "RGB", None, 13333, True): Exception, (np.float32, "RGBA", "RGB", None, 13333, False): Exception, (np.float32, "RGBA", "RGB", np.uint8, None, True): Exception, (np.float32, "RGBA", "RGB", np.uint8, None, False): Exception, (np.float32, "RGBA", "RGB", np.uint8, 232, True): Exception, (np.float32, "RGBA", "RGB", np.uint8, 232, False): Exception, (np.float32, "RGBA", "RGB", np.uint8, 13333, True): Exception, (np.float32, "RGBA", "RGB", np.uint8, 13333, False): Exception, (np.float32, "RGBA", "RGB", np.uint16, None, True): Exception, (np.float32, "RGBA", "RGB", np.uint16, None, False): Exception, (np.float32, "RGBA", "RGB", np.uint16, 232, True): Exception, (np.float32, "RGBA", "RGB", np.uint16, 232, False): Exception, (np.float32, "RGBA", "RGB", np.uint16, 13333, True): Exception, (np.float32, "RGBA", "RGB", np.uint16, 13333, False): Exception, (np.float32, "RGBA", "RGBA", None, None, True): np.array( [ [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 255, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", None, None, False): np.array( [ [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 255, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", None, 232, True): np.array( [ [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 255, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", None, 232, False): np.array( [ [[0, 0, 0, 0], [0, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 255, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", None, 13333, True): np.array( [ [[0, 0, 1, 0], [0, 0, 31, 255], [0, 0, 11, 0], [0, 0, 15, 0]], [[0, 0, 3, 0], [0, 0, 17, 0], [0, 0, 29, 0], [0, 0, 43, 0]], [[0, 0, 16, 0], [0, 0, 26, 0], [0, 0, 1, 0], [0, 0, 12, 0]], [[0, 255, 44, 0], [0, 0, 4, 0], [0, 0, 42, 0], [0, 0, 30, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", None, 13333, False): np.array( [ [[1, 0, 0, 0], [31, 0, 0, 255], [11, 0, 0, 0], [15, 0, 0, 0]], [[3, 0, 0, 0], [17, 0, 0, 0], [29, 0, 0, 0], [43, 0, 0, 0]], [[16, 0, 0, 0], [26, 0, 0, 0], [1, 0, 0, 0], [12, 0, 0, 0]], [[44, 255, 0, 0], [4, 0, 0, 0], [42, 0, 0, 0], [30, 0, 0, 0]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint8, None, True): np.array( [ [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint8, None, False): np.array( [ [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint8, 232, True): np.array( [ [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint8, 232, False): np.array( [ [[255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint8, 13333, True): np.array( [ [[255, 255, 0, 0], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint8, 13333, False): np.array( [ [[0, 255, 255, 0], [0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 0], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint16, None, True): np.array( [ [[255, 255, 0, 0], [255, 255, 0, 0], [255, 255, 255, 255], [255, 255, 0, 255]], [[255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 0, 0], [255, 255, 0, 255]], [[255, 0, 0, 255], [255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 0, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint16, None, False): np.array( [ [[0, 255, 255, 0], [0, 255, 255, 0], [255, 255, 255, 255], [0, 255, 255, 255]], [[0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [0, 255, 255, 0], [0, 255, 255, 255]], [[0, 0, 255, 255], [255, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint16, 232, True): np.array( [ [[255, 255, 255, 0], [255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 0, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint16, 232, False): np.array( [ [[255, 255, 255, 0], [255, 255, 255, 0], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 0], [255, 255, 255, 255]], [[255, 0, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint16, 13333, True): np.array( [ [[255, 255, 0, 0], [255, 255, 0, 0], [255, 255, 0, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 255]], [[255, 255, 0, 255], [255, 255, 0, 255], [255, 255, 0, 0], [255, 255, 255, 255]], [[255, 0, 0, 255], [255, 255, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), (np.float32, "RGBA", "RGBA", np.uint16, 13333, False): np.array( [ [[0, 255, 255, 0], [0, 255, 255, 0], [0, 255, 255, 255], [255, 255, 255, 255]], [[255, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255]], [[0, 255, 255, 255], [0, 255, 255, 255], [0, 255, 255, 0], [255, 255, 255, 255]], [[0, 0, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]], ], dtype=np.uint8, ), } def _error_description(output, test_case): return ( f"'{test_case['name']}' output does not match expectations\n" + f"\tExpected:\n{test_case['expected_output']!r}\n\n" + f"\tReceived:\n{output!r}\n" ) def _do_something_for_every_combo(func): for dtype in [np.uint8, np.uint16, np.float32]: for in_fmt in ["2D", "RGB", "RGBA"]: data = INPUTS[(dtype, in_fmt)] for levels_name in [None, "SIMPLE", "RGB", "RGBA"]: levels = LEVELS.get(levels_name, None) if dtype == np.float32 and levels_name is None: continue for lut_type in [None, np.uint8, np.uint16]: lut = LUTS.get(lut_type, None) for scale in [None, 232, 13333]: for use_rgba in [True, False]: key = (dtype, in_fmt, levels_name, lut_type, scale, use_rgba) func(data, key, levels, lut, scale, use_rgba) def _makeARGB(*args, **kwds): img, alpha = real_makeARGB(*args, **kwds) if kwds.get('useRGBA'): # endian independent out = img elif sys.byteorder == 'little': # little-endian ARGB32 to B,G,R,A out = img else: # big-endian ARGB32 to B,G,R,A out = img[..., [3, 2, 1, 0]] return out, alpha def save_reference(): """ This saves the output (or exception type) of running makeARGB for every combo of arguments. The output isn't fit for immediate inclusion in this file as EXPECTED_OUTPUTS, and needs some replace-all work. """ with open("_unformatted_expected_outputs_", "w") as tmp_file: def write_expectation_to_file(data, key, levels, lut, scale, use_rgba): try: output, alpha = _makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba) except Exception as e: tmp_file.write(f"{key!r}: {type(e)}\n") else: tmp_file.write(f"{key!r}: {output!r},\n") _do_something_for_every_combo(write_expectation_to_file) def test_makeARGB_against_generated_references(): def assert_correct(data, key, levels, lut, scale, use_rgba): expectation = EXPECTED_OUTPUTS[key] if isinstance(expectation, type) and issubclass(expectation, Exception): try: _makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba) except Exception as e: assert expectation == type(e) else: assert False, f"makeARGB({key!r}) was supposed to raise {expectation} but didn't raise anything." else: output, alpha = _makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba) assert ( output == expectation ).all(), f"Incorrect _makeARGB({key!r}) output! Expected:\n{expectation!r}\n Got:\n{output!r}" _do_something_for_every_combo(assert_correct) @pytest.mark.skipif(cupy is None, reason="CuPy unavailable to test") def test_cupy_makeARGB_against_generated_references(): prev_setting = getConfigOption("useCupy") try: setConfigOption("useCupy", True) cupy = getCupy() def assert_cupy_correct(data, key, levels, lut, scale, use_rgba): data = cupy.asarray(data) if lut is not None: lut = cupy.asarray(lut) expectation = EXPECTED_OUTPUTS[key] if isinstance(expectation, type) and issubclass(expectation, Exception): try: _makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba) except Exception as e: assert expectation == type(e) else: assert False, f"makeARGB({key!r}) was supposed to raise {expectation} but didn't raise anything." else: expectation = cupy.asarray(expectation) output, alpha = _makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba) assert ( output == expectation ).all(), f"Incorrect _makeARGB({key!r}) output! Expected:\n{expectation!r}\n Got:\n{output!r}" _do_something_for_every_combo(assert_cupy_correct) finally: setConfigOption("useCupy", prev_setting) @pytest.mark.filterwarnings("ignore:invalid value encountered") def test_numba_makeARGB_against_generated_references(): oldcfg_numba = getConfigOption("useNumba") if not oldcfg_numba: try: import numba except ImportError: pytest.skip("Numba unavailable to test") # useCupy needs to be set to False because it takes # precedence over useNumba in rescaleData oldcfg_cupy = getConfigOption("useCupy") setConfigOption("useCupy", False) setConfigOption("useNumba", not oldcfg_numba) test_makeARGB_against_generated_references() setConfigOption("useNumba", oldcfg_numba) setConfigOption("useCupy", oldcfg_cupy) def test_makeARGB_with_human_readable_code(): # Many parameters to test here: # * data dtype (ubyte, uint16, float, others) # * data ndim (2 or 3) # * levels (None, 1D, or 2D) # * lut dtype # * lut size # * lut ndim (1 or 2) # * useRGBA argument # Need to check that all input values map to the correct output values, especially # at and beyond the edges of the level range. def checkArrays(a, b): # because py.test output is difficult to read for arrays if not np.all(a == b): comp = [] for i in range(a.shape[0]): if a.shape[1] > 1: comp.append('[') for j in range(a.shape[1]): m = a[i, j] == b[i, j] comp.append('%d,%d %s %s %s%s' % (i, j, str(a[i, j]).ljust(15), str(b[i, j]).ljust(15), m, ' ********' if not np.all(m) else '')) if a.shape[1] > 1: comp.append(']') raise Exception("arrays do not match:\n%s" % '\n'.join(comp)) def checkImage(img, check, alpha, alphaCheck): assert img.dtype == np.ubyte assert alpha is alphaCheck if alpha is False: checkArrays(img[..., 3], 255) if np.isscalar(check) or check.ndim == 3: checkArrays(img[..., :3], check) elif check.ndim == 2: checkArrays(img[..., :3], check[..., np.newaxis]) elif check.ndim == 1: checkArrays(img[..., :3], check[..., np.newaxis, np.newaxis]) else: raise Exception('invalid check array ndim') # uint8 data tests im1 = np.arange(256).astype('ubyte').reshape(256, 1) im2, alpha = _makeARGB(im1, levels=(0, 255)) checkImage(im2, im1, alpha, False) im3, alpha = _makeARGB(im1, levels=(0.0, 255.0)) checkImage(im3, im1, alpha, False) im4, alpha = _makeARGB(im1, levels=(255, 0)) checkImage(im4, 255 - im1, alpha, False) im5, alpha = _makeARGB(np.concatenate([im1] * 3, axis=1), levels=[(0, 255), (0.0, 255.0), (255, 0)]) checkImage(im5, np.concatenate([im1, im1, 255 - im1], axis=1), alpha, False) im2, alpha = _makeARGB(im1, levels=(128, 383)) checkImage(im2[:128], 0, alpha, False) checkImage(im2[128:], im1[:128], alpha, False) # uint8 data + uint8 LUT lut = np.arange(256)[::-1].astype(np.uint8) im2, alpha = _makeARGB(im1, lut=lut) checkImage(im2, lut, alpha, False) # lut larger than maxint lut = np.arange(511).astype(np.uint8) im2, alpha = _makeARGB(im1, lut=lut) checkImage(im2, lut[::2], alpha, False) # lut smaller than maxint lut = np.arange(128).astype(np.uint8) im2, alpha = _makeARGB(im1, lut=lut) checkImage(im2, np.linspace(0, 127.5, 256, dtype='ubyte'), alpha, False) # lut + levels lut = np.arange(256)[::-1].astype(np.uint8) im2, alpha = _makeARGB(im1, lut=lut, levels=[-128, 384]) checkImage(im2, np.linspace(191.5, 64.5, 256, dtype='ubyte'), alpha, False) im2, alpha = _makeARGB(im1, lut=lut, levels=[64, 192]) checkImage(im2, np.clip(np.linspace(384.5, -127.5, 256), 0, 255).astype('ubyte'), alpha, False) # uint8 data + uint16 LUT lut = np.arange(4096)[::-1].astype(np.uint16) // 16 im2, alpha = _makeARGB(im1, lut=lut) checkImage(im2, np.arange(256)[::-1].astype('ubyte'), alpha, False) # uint8 data + float LUT lut = np.linspace(10., 137., 256) im2, alpha = _makeARGB(im1, lut=lut) checkImage(im2, lut.astype('ubyte'), alpha, False) # uint8 data + 2D LUT lut = np.zeros((256, 3), dtype='ubyte') lut[:, 0] = np.arange(256) lut[:, 1] = np.arange(256)[::-1] lut[:, 2] = 7 im2, alpha = _makeARGB(im1, lut=lut) checkImage(im2, lut[:, None, ::-1], alpha, False) # check useRGBA im2, alpha = _makeARGB(im1, lut=lut, useRGBA=True) checkImage(im2, lut[:, None, :], alpha, False) # uint16 data tests im1 = np.arange(0, 2 ** 16, 256).astype('uint16')[:, None] im2, alpha = _makeARGB(im1, levels=(512, 2 ** 16)) checkImage(im2, np.clip(np.linspace(-2, 253, 256), 0, 255).astype('ubyte'), alpha, False) lut = (np.arange(512, 2 ** 16)[::-1] // 256).astype('ubyte') im2, alpha = _makeARGB(im1, lut=lut, levels=(512, 2 ** 16 - 256)) checkImage(im2, np.clip(np.linspace(257, 2, 256), 0, 255).astype('ubyte'), alpha, False) lut = np.zeros(2 ** 16, dtype='ubyte') lut[1000:1256] = np.arange(256) lut[1256:] = 255 im1 = np.arange(1000, 1256).astype('uint16')[:, None] im2, alpha = _makeARGB(im1, lut=lut) checkImage(im2, np.arange(256).astype('ubyte'), alpha, False) # float data tests im1 = np.linspace(1.0, 17.0, 256)[:, None] im2, alpha = _makeARGB(im1, levels=(5.0, 13.0)) checkImage(im2, np.clip(np.linspace(-128, 383, 256), 0, 255).astype('ubyte'), alpha, False) lut = (np.arange(1280)[::-1] // 10).astype('ubyte') im2, alpha = _makeARGB(im1, lut=lut, levels=(1, 17)) checkImage(im2, np.linspace(127.5, 0, 256).astype('ubyte'), alpha, False) # nans in image # 2d input image, one pixel is nan im1 = np.ones((10, 12)) im1[3, 5] = np.nan im2, alpha = _makeARGB(im1, levels=(0, 1)) assert alpha assert im2[3, 5, 3] == 0 # nan pixel is transparent assert im2[0, 0, 3] == 255 # doesn't affect other pixels # With masking nans disabled, the nan pixel shouldn't be transparent im2, alpha = _makeARGB(im1, levels=(0, 1), maskNans=False) assert im2[3, 5, 3] == 255 # 3d RGB input image, any color channel of a pixel is nan im1 = np.ones((10, 12, 3)) im1[3, 5, 1] = np.nan im2, alpha = _makeARGB(im1, levels=(0, 1)) assert alpha assert im2[3, 5, 3] == 0 # nan pixel is transparent assert im2[0, 0, 3] == 255 # doesn't affect other pixels # 3d RGBA input image, any color channel of a pixel is nan im1 = np.ones((10, 12, 4)) im1[3, 5, 1] = np.nan im2, alpha = _makeARGB(im1, levels=(0, 1), useRGBA=True) assert alpha assert im2[3, 5, 3] == 0 # nan pixel is transparent # test sanity checks class AssertExc(object): def __init__(self, exc=Exception): self.exc = exc def __enter__(self): return self def __exit__(self, *args): assert args[0] is self.exc, "Should have raised %s (got %s)" % (self.exc, args[0]) return True with AssertExc(TypeError): # invalid image shape _makeARGB(np.zeros((2,), dtype='float')) with AssertExc(TypeError): # invalid image shape _makeARGB(np.zeros((2, 2, 7), dtype='float')) with AssertExc(): # float images require levels arg _makeARGB(np.zeros((2, 2), dtype='float')) with AssertExc(): # bad levels arg _makeARGB(np.zeros((2, 2), dtype='float'), levels=[1]) with AssertExc(): # bad levels arg _makeARGB(np.zeros((2, 2), dtype='float'), levels=[1, 2, 3]) with AssertExc(): # can't mix 3-channel levels and LUT _makeARGB(np.zeros((2, 2)), lut=np.zeros((10, 3), dtype='ubyte'), levels=[(0, 1)] * 3) with AssertExc(): # multichannel levels must have same number of channels as image _makeARGB(np.zeros((2, 2, 3), dtype='float'), levels=[(1, 2)] * 4) with AssertExc(): # 3d levels not allowed _makeARGB(np.zeros((2, 2, 3), dtype='float'), levels=np.zeros([3, 2, 2])) pyqtgraph-pyqtgraph-0.13.4/tests/test_pickles.py000066400000000000000000000005301457240071200220400ustar00rootroot00000000000000import math import pickle from pyqtgraph import SRTTransform def test_SRTTransform(): a = SRTTransform({'scale': 2, 'angle': math.pi / 2}) b = pickle.loads(pickle.dumps(a)) assert a == b def test_SRTTransform3D(): a = SRTTransform({'scale': 2, 'angle': math.pi / 2}) b = pickle.loads(pickle.dumps(a)) assert a == b pyqtgraph-pyqtgraph-0.13.4/tests/test_qimage_writethru.py000066400000000000000000000015511457240071200237720ustar00rootroot00000000000000import numpy as np import pyqtgraph as pg def test_qimage_writethrough(): w, h = 256, 256 backstore = np.ones((h, w), dtype=np.uint8) ptr0 = backstore.ctypes.data fmt = pg.Qt.QtGui.QImage.Format.Format_Grayscale8 qimg = pg.functions.ndarray_to_qimage(backstore, fmt) def get_pointer(obj): if hasattr(obj, 'setsize'): return int(obj) else: return np.frombuffer(obj, dtype=np.uint8).ctypes.data # test that QImage is using the provided buffer (i.e. zero-copy) ptr1 = get_pointer(qimg.constBits()) assert ptr0 == ptr1 # test that QImage is not const (i.e. no COW) # if QImage is const, then bits() returns a copy ptr2 = get_pointer(qimg.bits()) assert ptr1 == ptr2 # test that data gets written through to provided buffer qimg.fill(0) assert np.all(backstore == 0) pyqtgraph-pyqtgraph-0.13.4/tests/test_qmenu_leak_workaround.py000066400000000000000000000014671457240071200250140ustar00rootroot00000000000000import sys import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets def test_qmenu_leak_workaround(): # refer to https://github.com/pyqtgraph/pyqtgraph/pull/2518 pg.mkQApp() topmenu = QtWidgets.QMenu() submenu = QtWidgets.QMenu() refcnt1 = sys.getrefcount(submenu) # check that after the workaround, # submenu has no change in refcnt topmenu.addMenu(submenu) submenu.setParent(None) # this is the workaround for PySide{2,6}, # and should have no effect on bindings # where it is not needed. refcnt2 = sys.getrefcount(submenu) assert refcnt2 == refcnt1 # check that topmenu is not a C++ parent of submenu. # i.e. deleting topmenu leaves submenu alive del topmenu assert pg.Qt.isQObjectAlive(submenu)pyqtgraph-pyqtgraph-0.13.4/tests/test_qpainterpathprivate.py000066400000000000000000000022661457240071200245110ustar00rootroot00000000000000import numpy as np import pytest import pyqtgraph as pg from pyqtgraph.Qt import QtGui def test_qpainterpathprivate_read(): x0, y0 = 100, 200 size = 100 qpath = QtGui.QPainterPath() qpath.moveTo(x0, y0) for idx in range(1, size): qpath.lineTo(x0 + idx, y0 + idx) memory = pg.Qt.internals.get_qpainterpath_element_array(qpath) assert len(memory) == size assert np.all(memory['x'] == np.arange(x0, x0 + size)) assert np.all(memory['y'] == np.arange(y0, y0 + size)) assert memory['c'][0] == 0 assert np.all(memory['c'][1:] == 1) @pytest.mark.skipif( not hasattr(QtGui.QPainterPath, 'reserve'), reason="needs Qt version >= 5.13" ) def test_qpainterpathprivate_write(): x0, y0 = 100, 200 size = 100 qpath0 = QtGui.QPainterPath() qpath0.moveTo(x0, y0) for idx in range(1, size): qpath0.lineTo(x0 + idx, y0 + idx) qpath1 = QtGui.QPainterPath() memory = pg.Qt.internals.get_qpainterpath_element_array(qpath1, size) assert len(memory) == size memory['x'] = np.arange(x0, x0 + size) memory['y'] = np.arange(y0, y0 + size) memory['c'][:1] = 0 memory['c'][1:] = 1 assert qpath0 == qpath1 pyqtgraph-pyqtgraph-0.13.4/tests/test_qt.py000066400000000000000000000013271457240071200210370ustar00rootroot00000000000000import os import pytest import pyqtgraph as pg app = pg.mkQApp() def test_isQObjectAlive(): o1 = pg.QtCore.QObject() o2 = pg.QtCore.QObject() o2.setParent(o1) del o1 assert not pg.Qt.isQObjectAlive(o2) @pytest.mark.skipif( pg.Qt.QT_LIB == "PySide2" and tuple(map(int, pg.Qt.PySide2.__version__.split("."))) >= (5, 14) and tuple(map(int, pg.Qt.PySide2.__version__.split("."))) < (5, 14, 2, 2), reason="new PySide2 doesn't have loadUi functionality" ) def test_loadUiType(): path = os.path.dirname(__file__) formClass, baseClass = pg.Qt.loadUiType(os.path.join(path, 'uictest.ui')) w = baseClass() ui = formClass() ui.setupUi(w) w.show() app.processEvents() pyqtgraph-pyqtgraph-0.13.4/tests/test_ref_cycles.py000066400000000000000000000033571457240071200225360ustar00rootroot00000000000000""" Test for unwanted reference cycles """ import warnings import weakref import numpy as np import pyqtgraph as pg app = pg.mkQApp() def assert_alldead(refs): for ref in refs: assert ref() is None def qObjectTree(root): """Return root and its entire tree of qobject children""" childs = [root] for ch in pg.QtCore.QObject.children(root): childs += qObjectTree(ch) return childs def mkrefs(*objs): """Return a list of weakrefs to each object in *objs. QObject instances are expanded to include all child objects. """ allObjs = {} for obj in objs: obj = qObjectTree(obj) if isinstance(obj, pg.QtCore.QObject) else [obj] for o in obj: allObjs[id(o)] = o return [weakref.ref(obj) for obj in allObjs.values()] def test_PlotWidget(): def mkobjs(*args, **kwds): with warnings.catch_warnings(): warnings.simplefilter("ignore") w = pg.PlotWidget(*args, **kwds) data = np.array([1,5,2,4,3]) c = w.plot(data, name='stuff') w.addLegend() # test that connections do not keep objects alive w.plotItem.vb.sigRangeChanged.connect(mkrefs) app.focusChanged.connect(w.plotItem.vb.invertY) # return weakrefs to a bunch of objects that should die when the scope exits. return mkrefs(w, c, data, w.plotItem, w.plotItem.vb, w.plotItem.getAxis('left')) for _ in range(5): assert_alldead(mkobjs()) def test_ImageView(): def mkobjs(): iv = pg.ImageView() data = np.zeros((10,10,5)) iv.setImage(data) return mkrefs(iv, iv.imageItem, iv.view, iv.ui.histogram, data) for _ in range(5): assert_alldead(mkobjs()) pyqtgraph-pyqtgraph-0.13.4/tests/test_reload.py000066400000000000000000000051371457240071200216640ustar00rootroot00000000000000import os import shutil import sys import time import pytest import pyqtgraph as pg pgpath = os.path.join(os.path.dirname(pg.__file__), '..') pgpath_repr = repr(pgpath) code = """ import sys sys.path.append({path_repr}) import pyqtgraph as pg class C(pg.QtCore.QObject): sig = pg.QtCore.Signal() def fn(self): print("{msg}") """ def remove_cache(mod): if os.path.isfile(mod+'c'): os.remove(mod+'c') cachedir = os.path.join(os.path.dirname(mod), '__pycache__') if os.path.isdir(cachedir): shutil.rmtree(cachedir) @pytest.mark.skipif( ( (pg.Qt.QT_LIB == "PySide2" and pg.Qt.QtVersion.startswith("5.15")) or (pg.Qt.QT_LIB == "PySide6") ) and (sys.version_info >= (3, 9)), reason="Unknown Issue" ) @pytest.mark.usefixtures("tmp_module") def test_reload(tmp_module): # write a module mod = os.path.join(tmp_module, 'reload_test_mod.py') print("\nRELOAD FILE:", mod) with open(mod, "w") as file_: file_.write(code.format(path_repr=pgpath_repr, msg="C.fn() Version1")) # import the new module import reload_test_mod print("RELOAD MOD:", reload_test_mod.__file__) c = reload_test_mod.C() c.sig.connect(c.fn) v1 = (reload_test_mod.C, reload_test_mod.C.sig, reload_test_mod.C.fn, c.sig, c.fn, c.fn.__func__) # write again and reload with open(mod, "w") as file_: file_.write(code.format(path_repr=pgpath_repr, msg="C.fn() Version 2")) time.sleep(1.1) #remove_cache(mod) _ = pg.reload.reloadAll(tmp_module, debug=True) v2 = (reload_test_mod.C, reload_test_mod.C.sig, reload_test_mod.C.fn, c.sig, c.fn, c.fn.__func__) oldcfn = pg.reload.getPreviousVersion(c.fn) if oldcfn is None: # Function did not reload; are we using pytest's assertion rewriting? raise Exception("Function did not reload. (This can happen when using py.test" " with assertion rewriting; use --assert=plain for this test.)") assert oldcfn.__func__ is v1[2] assert oldcfn.__self__ is c # write again and reload with open(mod, "w") as file_: file_.write(code.format(path_repr=pgpath_repr, msg="C.fn() Version2")) time.sleep(1.1) # remove_cache(mod) _ = pg.reload.reloadAll(tmp_module, debug=True) _ = (reload_test_mod.C, reload_test_mod.C.sig, reload_test_mod.C.fn, c.sig, c.fn, c.fn.__func__) cfn1 = pg.reload.getPreviousVersion(c.fn) cfn2 = pg.reload.getPreviousVersion(cfn1) assert cfn1.__func__ is v2[2] assert cfn2.__func__ is v1[2] assert cfn1.__self__ is c assert cfn2.__self__ is c pg.functions.disconnect(c.sig, c.fn) pyqtgraph-pyqtgraph-0.13.4/tests/test_signalproxy.py000066400000000000000000000073411457240071200227740ustar00rootroot00000000000000import pytest from pyqtgraph import SignalProxy from pyqtgraph.Qt import QtCore, mkQApp class Sender(QtCore.QObject): signalSend = QtCore.Signal() def __init__(self, parent=None): super(Sender, self).__init__(parent) class Receiver(QtCore.QObject): def __init__(self, parent=None): super(Receiver, self).__init__(parent) self.counter = 0 def slotReceive(self): self.counter += 1 @pytest.fixture def qapp(): app = mkQApp() if app is None: app = mkQApp() yield app app.processEvents(QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 100) def test_signal_proxy_slot(qapp): """Test the normal work mode of SignalProxy with `signal` and `slot`""" sender = Sender(parent=qapp) receiver = Receiver(parent=qapp) proxy = SignalProxy(sender.signalSend, delay=0.0, rateLimit=0.6, slot=receiver.slotReceive, threadSafe=False) assert proxy.blockSignal is False assert proxy is not None assert sender is not None assert receiver is not None sender.signalSend.emit() proxy.flush() qapp.processEvents(QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 10) assert receiver.counter > 0 def test_signal_proxy_disconnect_slot(qapp): """Test the disconnect of SignalProxy with `signal` and `slot`""" sender = Sender(parent=qapp) receiver = Receiver(parent=qapp) proxy = SignalProxy(sender.signalSend, delay=0.0, rateLimit=0.6, slot=receiver.slotReceive, threadSafe=False) assert proxy.blockSignal is False assert proxy is not None assert sender is not None assert receiver is not None assert proxy.slot is not None proxy.disconnect() assert proxy.slot is None assert proxy.blockSignal is True sender.signalSend.emit() proxy.flush() qapp.processEvents(QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 10) assert receiver.counter == 0 def test_signal_proxy_no_slot_start(qapp): """Test the connect mode of SignalProxy without slot at start`""" sender = Sender(parent=qapp) receiver = Receiver(parent=qapp) proxy = SignalProxy(sender.signalSend, delay=0.0, rateLimit=0.6, threadSafe=False) assert proxy.blockSignal is True assert proxy is not None assert sender is not None assert receiver is not None sender.signalSend.emit() proxy.flush() qapp.processEvents(QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 10) assert receiver.counter == 0 # Start a connect proxy.connectSlot(receiver.slotReceive) assert proxy.blockSignal is False sender.signalSend.emit() proxy.flush() qapp.processEvents(QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 10) assert receiver.counter > 0 # An additional connect should raise an AssertionError with pytest.raises(AssertionError): proxy.connectSlot(receiver.slotReceive) def test_signal_proxy_slot_block(qapp): """Test the block mode of SignalProxy with `signal` and `slot`""" sender = Sender(parent=qapp) receiver = Receiver(parent=qapp) proxy = SignalProxy(sender.signalSend, delay=0.0, rateLimit=0.6, slot=receiver.slotReceive, threadSafe=False) assert proxy.blockSignal is False assert proxy is not None assert sender is not None assert receiver is not None with proxy.block(): sender.signalSend.emit() sender.signalSend.emit() sender.signalSend.emit() proxy.flush() qapp.processEvents(QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 10) assert receiver.counter == 0 sender.signalSend.emit() proxy.flush() qapp.processEvents(QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 10) assert receiver.counter > 0 pyqtgraph-pyqtgraph-0.13.4/tests/test_srttransform3d.py000066400000000000000000000024621457240071200234070ustar00rootroot00000000000000import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal import pyqtgraph as pg from pyqtgraph.Qt import QtGui testPoints = np.array([ [0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1], [-1, -1, 0], [0, -1, -1]]) def testMatrix(): """ SRTTransform3D => Transform3D => SRTTransform3D """ tr = pg.SRTTransform3D() tr.setRotate(45, (0, 0, 1)) tr.setScale(0.2, 0.4, 1) tr.setTranslate(10, 20, 40) assert tr.getRotation() == (45, QtGui.QVector3D(0, 0, 1)) assert tr.getScale() == QtGui.QVector3D(0.2, 0.4, 1) assert tr.getTranslation() == QtGui.QVector3D(10, 20, 40) tr2 = pg.Transform3D(tr) assert np.all(tr.matrix() == tr2.matrix()) # This is the most important test: # The transition from Transform3D to SRTTransform3D is a tricky one. tr3 = pg.SRTTransform3D(tr2) assert_array_almost_equal(tr.matrix(), tr3.matrix()) assert_almost_equal(tr3.getRotation()[0], tr.getRotation()[0]) assert_array_almost_equal(tr3.getRotation()[1], tr.getRotation()[1]) assert_array_almost_equal(tr3.getScale(), tr.getScale()) assert_array_almost_equal(tr3.getTranslation(), tr.getTranslation()) pyqtgraph-pyqtgraph-0.13.4/tests/test_stability.py000066400000000000000000000071621457240071200224220ustar00rootroot00000000000000""" PyQt/PySide stress test: Create lots of random widgets and graphics items, connect them together randomly, the tear them down repeatedly. The purpose of this is to attempt to generate segmentation faults. """ import gc import sys import time import weakref from random import randint, seed import pyqtgraph as pg from pyqtgraph.Qt import QtTest from pyqtgraph.util.garbage_collector import GarbageCollector app = pg.mkQApp() def test_garbage_collector(): GarbageCollector(interval=0.1) time.sleep(1) seed(12345) widgetTypes = [ pg.PlotWidget, pg.ImageView, pg.GraphicsView, pg.QtWidgets.QWidget, pg.QtWidgets.QTreeWidget, pg.QtWidgets.QPushButton, ] itemTypes = [ pg.PlotCurveItem, pg.ImageItem, pg.PlotDataItem, pg.ViewBox, pg.QtWidgets.QGraphicsRectItem ] widgets = [] items = [] allWidgets = weakref.WeakKeyDictionary() def crashtest(): global allWidgets try: gc.disable() actions = [ createWidget, #setParent, forgetWidget, showWidget, processEvents, #raiseException, #addReference, ] thread = WorkThread() thread.start() while True: try: action = randItem(actions) action() print('[%d widgets alive, %d zombie]' % (len(allWidgets), len(allWidgets) - len(widgets))) except KeyboardInterrupt: print("Caught interrupt; send another to exit.") try: for _ in range(100): QtTest.QTest.qWait(100) except KeyboardInterrupt: thread.terminate() break except: sys.excepthook(*sys.exc_info()) finally: gc.enable() class WorkThread(pg.QtCore.QThread): '''Intended to give the gc an opportunity to run from a non-gui thread.''' def run(self): i = 0 while True: i += 1 if (i % 1000000) == 0: print('--worker--') def randItem(items): return items[randint(0, len(items)-1)] def p(msg): print(msg) sys.stdout.flush() def createWidget(): p('create widget') global widgets, allWidgets if len(widgets) > 50: return None widget = randItem(widgetTypes)() widget.setWindowTitle(widget.__class__.__name__) widgets.append(widget) allWidgets[widget] = 1 p(" %s" % widget) return widget def setParent(): p('set parent') global widgets if len(widgets) < 2: return child = parent = None while child is parent: child = randItem(widgets) parent = randItem(widgets) p(" %s parent of %s" % (parent, child)) child.setParent(parent) def forgetWidget(): p('forget widget') global widgets if len(widgets) < 1: return widget = randItem(widgets) p(' %s' % widget) widgets.remove(widget) def showWidget(): p('show widget') global widgets if len(widgets) < 1: return widget = randItem(widgets) p(' %s' % widget) widget.show() def processEvents(): p('process events') QtTest.QTest.qWait(25) class TstException(Exception): pass def raiseException(): p('raise exception') raise TstException("A test exception") def addReference(): p('add reference') global widgets if len(widgets) < 1: return obj1 = randItem(widgets) obj2 = randItem(widgets) p(' %s -> %s' % (obj1, obj2)) obj1._testref = obj2 pyqtgraph-pyqtgraph-0.13.4/tests/ui_testing.py000066400000000000000000000063471457240071200215350ustar00rootroot00000000000000import time from pyqtgraph.Qt import QtCore, QtGui, QtTest, QtWidgets def resizeWindow(win, w, h, timeout=2.0): """Resize a window and wait until it has the correct size. This is required for unit testing on some platforms that do not guarantee immediate response from the windowing system. """ QtWidgets.QApplication.processEvents() # Sometimes the window size will switch multiple times before settling # on its final size. Adding qWaitForWindowExposed seems to help with this. QtTest.QTest.qWaitForWindowExposed(win) win.resize(w, h) start = time.time() while True: w1, h1 = win.width(), win.height() if (w,h) == (w1,h1): return QtTest.QTest.qWait(10) if time.time()-start > timeout: raise TimeoutError("Window resize failed (requested %dx%d, got %dx%d)" % (w, h, w1, h1)) # Functions for generating user input events. # We would like to use QTest for this purpose, but it seems to be broken. # See: http://stackoverflow.com/questions/16299779/qt-qgraphicsview-unit-testing-how-to-keep-the-mouse-in-a-pressed-state def mousePress(widget, pos: QtCore.QPointF, button, modifier=None): if isinstance(widget, QtWidgets.QGraphicsView): widget = widget.viewport() global_pos = QtCore.QPointF(widget.mapToGlobal(pos.toPoint())) if modifier is None: modifier = QtCore.Qt.KeyboardModifier.NoModifier event = QtGui.QMouseEvent( QtCore.QEvent.Type.MouseButtonPress, pos, global_pos, button, QtCore.Qt.MouseButton.NoButton, modifier ) QtWidgets.QApplication.sendEvent(widget, event) def mouseRelease(widget, pos: QtCore.QPointF, button, modifier=None): if isinstance(widget, QtWidgets.QGraphicsView): widget = widget.viewport() global_pos = QtCore.QPointF(widget.mapToGlobal(pos.toPoint())) if modifier is None: modifier = QtCore.Qt.KeyboardModifier.NoModifier event = QtGui.QMouseEvent( QtCore.QEvent.Type.MouseButtonRelease, pos, global_pos, button, QtCore.Qt.MouseButton.NoButton, modifier ) QtWidgets.QApplication.sendEvent(widget, event) def mouseMove(widget, pos: QtCore.QPointF, buttons=None, modifier=None): if isinstance(widget, QtWidgets.QGraphicsView): widget = widget.viewport() global_pos = QtCore.QPointF(widget.mapToGlobal(pos.toPoint())) if modifier is None: modifier = QtCore.Qt.KeyboardModifier.NoModifier if buttons is None: buttons = QtCore.Qt.MouseButton.NoButton event = QtGui.QMouseEvent( QtCore.QEvent.Type.MouseMove, pos, global_pos, QtCore.Qt.MouseButton.NoButton, buttons, modifier ) QtWidgets.QApplication.sendEvent(widget, event) def mouseDrag(widget, pos1: QtCore.QPointF, pos2: QtCore.QPointF, button, modifier=None): mouseMove(widget, pos1) mousePress(widget, pos1, button, modifier) mouseMove(widget, pos2, button, modifier) mouseRelease(widget, pos2, button, modifier) def mouseClick(widget, pos: QtCore.QPointF, button, modifier=None): mouseMove(widget, pos) mousePress(widget, pos, button, modifier) mouseRelease(widget, pos, button, modifier) pyqtgraph-pyqtgraph-0.13.4/tests/uictest.ui000066400000000000000000000022001457240071200210100ustar00rootroot00000000000000 Form 0 0 400 300 PyQtGraph 10 10 120 80 10 110 120 80 PlotWidget QWidget
      pyqtgraph
      1
      ImageView QWidget
      pyqtgraph
      1
      pyqtgraph-pyqtgraph-0.13.4/tests/widgets/000077500000000000000000000000001457240071200204455ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tests/widgets/test_busycursor.py000066400000000000000000000013741457240071200243030ustar00rootroot00000000000000import pytest import sys import pyqtgraph as pg pg.mkQApp() @pytest.mark.skipif( sys.platform.startswith("linux") and pg.Qt.QT_LIB == "PySide6" and (6, 0) < pg.Qt.PySide6.__version_info__ < (6, 4, 3), reason="taking gui thread causes segfault" ) def test_nested_busy_cursors_clear_after_all_exit(): with pg.BusyCursor(): wait_cursor = pg.Qt.QtCore.Qt.CursorShape.WaitCursor with pg.BusyCursor(): assert pg.Qt.QtWidgets.QApplication.overrideCursor().shape() == wait_cursor, "Cursor should be waiting" assert pg.Qt.QtWidgets.QApplication.overrideCursor().shape() == wait_cursor, "Cursor should be waiting" assert pg.Qt.QtWidgets.QApplication.overrideCursor() is None, "No override cursor should be set" pyqtgraph-pyqtgraph-0.13.4/tests/widgets/test_combobox.py000066400000000000000000000015531457240071200236720ustar00rootroot00000000000000import pyqtgraph as pg pg.mkQApp() def test_combobox(): cb = pg.ComboBox() items = {'a': 1, 'b': 2, 'c': 3} cb.setItems(items) cb.setValue(2) assert str(cb.currentText()) == 'b' assert cb.value() == 2 # Clear item list; value should be None cb.clear() assert cb.value() is None # Reset item list; value should be set automatically cb.setItems(items) assert cb.value() == 2 # Clear item list; repopulate with same names and new values items = {'a': 4, 'b': 5, 'c': 6} cb.clear() cb.setItems(items) assert cb.value() == 5 # Set list instead of dict cb.setItems(list(items.keys())) assert str(cb.currentText()) == 'b' cb.setValue('c') assert cb.value() == str(cb.currentText()) assert cb.value() == 'c' cb.setItemValue('c', 7) assert cb.value() == 7 pyqtgraph-pyqtgraph-0.13.4/tests/widgets/test_graphics_view.py000066400000000000000000000052731457240071200247170ustar00rootroot00000000000000import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui, QtWidgets app = pg.mkQApp() def test_basics_graphics_view(): view = pg.GraphicsView() background_role = view.backgroundRole() assert background_role == QtGui.QPalette.ColorRole.Window assert view.backgroundBrush().color() == QtGui.QColor(0, 0, 0, 255) assert view.focusPolicy() == QtCore.Qt.FocusPolicy.StrongFocus assert view.transformationAnchor() == QtWidgets.QGraphicsView.ViewportAnchor.NoAnchor minimal_update = QtWidgets.QGraphicsView.ViewportUpdateMode.MinimalViewportUpdate assert view.viewportUpdateMode() == minimal_update assert view.frameShape() == QtWidgets.QFrame.Shape.NoFrame assert view.hasMouseTracking() is True # Default properties # -------------------------------------- assert view.mouseEnabled is False assert view.aspectLocked is False assert view.autoPixelRange is True assert view.scaleCenter is False assert view.clickAccepted is False assert view.centralWidget is not None assert view._background == "default" # Set background color # -------------------------------------- view.setBackground("w") assert view._background == "w" assert view.backgroundBrush().color() == QtCore.Qt.GlobalColor.white # Set anti aliasing # -------------------------------------- aliasing = QtGui.QPainter.RenderHint.Antialiasing # Default is set to `False` assert view.renderHints() & aliasing != aliasing view.setAntialiasing(True) assert view.renderHints() & aliasing == aliasing view.setAntialiasing(False) assert view.renderHints() & aliasing != aliasing # Enable mouse # -------------------------------------- view.enableMouse(True) assert view.mouseEnabled is True assert view.autoPixelRange is False view.enableMouse(False) assert view.mouseEnabled is False assert view.autoPixelRange is True # Add and remove item # -------------------------------------- central_item = QtWidgets.QGraphicsWidget() view.setCentralItem(central_item) assert view.centralWidget is central_item # XXX: Removal of central item is not clear in code scene = view.sceneObj assert isinstance(scene, pg.GraphicsScene) assert central_item in scene.items() item = QtWidgets.QGraphicsWidget() assert item not in scene.items() view.addItem(item) assert item in scene.items() view.removeItem(item) assert item not in scene.items() # Close the graphics view # -------------------------------------- view.close() assert view.centralWidget is None assert view.currentItem is None assert view.sceneObj is None assert view.closed is True pyqtgraph-pyqtgraph-0.13.4/tests/widgets/test_histogramlutwidget.py000066400000000000000000000016241457240071200260070ustar00rootroot00000000000000""" HistogramLUTWidget test: Tests the creation of a HistogramLUTWidget. """ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets def testHistogramLUTWidget(): pg.mkQApp() win = QtWidgets.QMainWindow() win.show() cw = QtWidgets.QWidget() win.setCentralWidget(cw) l = QtWidgets.QGridLayout() cw.setLayout(l) l.setSpacing(0) v = pg.GraphicsView() vb = pg.ViewBox() vb.setAspectLocked() v.setCentralItem(vb) l.addWidget(v, 0, 0, 3, 1) w = pg.HistogramLUTWidget(background='w') l.addWidget(w, 0, 1) data = pg.gaussianFilter(np.random.normal(size=(256, 256, 3)), (20, 20, 0)) for i in range(32): for j in range(32): data[i*8, j*8] += .1 img = pg.ImageItem(data) vb.addItem(img) vb.autoRange() w.setImageItem(img) QtWidgets.QApplication.processEvents() win.close() pyqtgraph-pyqtgraph-0.13.4/tests/widgets/test_matplotlibwidget.py000066400000000000000000000053161457240071200254360ustar00rootroot00000000000000""" MatplotlibWidget test: Tests the creation of a MatplotlibWidget. """ from importlib.metadata import version import numpy as np import pytest import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets pytest.importorskip("matplotlib") # see https://github.com/matplotlib/matplotlib/pull/24172 if ( pg.Qt.QT_LIB == "PySide6" and tuple(map(int, pg.Qt.PySide6.__version__.split("."))) > (6, 4) and tuple(map(int, version("matplotlib").split("."))) < (3, 6, 2) ): pytest.skip( "matplotlib + PySide6 6.4 bug", allow_module_level=True ) from pyqtgraph.widgets.MatplotlibWidget import MatplotlibWidget pg.mkQApp() default_parent = None default_figsize = MatplotlibWidget.figsize_default default_dpi = MatplotlibWidget.dpi_default def assert_widget_fields(mplw, parent, figsize, dpi): assert mplw.parent() == parent assert np.allclose(mplw.getFigure().get_size_inches(), figsize) assert mplw.getFigure().dpi == dpi def test_init_with_qwidget_arguments(): """ Ensures providing only the parent argument to the constructor properly intializes the widget to match the QWidget constructor prototype. """ win = QtWidgets.QMainWindow() mplw = MatplotlibWidget(win) assert_widget_fields(mplw, win, default_figsize, default_dpi) def test_init_with_matplotlib_arguments(): """ Tests the contructor that sets variables associated with Matplotlib and abstracts away any details about the underlying QWidget parent class. """ figsize = (1.0, 3.0) dpi = 256 mplw = MatplotlibWidget(figsize, dpi) assert_widget_fields(mplw, default_parent, figsize, dpi) def test_init_with_no_arguments(): mplw = MatplotlibWidget() assert_widget_fields(mplw, default_parent, default_figsize, default_dpi) def test_init_sanity(): """ Tests to ensure the constructor behaves as expected. """ parent = QtWidgets.QMainWindow() figsize = (1.0, 4.0) dpi = 256 # These tests will not work if these two assertions do not hold. assert figsize != default_figsize assert dpi != default_dpi mplw = MatplotlibWidget(parent, figsize=figsize) assert_widget_fields(mplw, parent, figsize, default_dpi) mplw = MatplotlibWidget(parent, dpi=dpi) assert_widget_fields(mplw, parent, default_figsize, dpi) mplw = MatplotlibWidget(parent, figsize, dpi) assert_widget_fields(mplw, parent, figsize, dpi) mplw = MatplotlibWidget(figsize, dpi) assert_widget_fields(mplw, default_parent, figsize, dpi) mplw = MatplotlibWidget(figsize, dpi, parent) assert_widget_fields(mplw, parent, figsize, dpi) mplw = MatplotlibWidget(dpi=dpi, parent=parent) assert_widget_fields(mplw, parent, default_figsize, dpi) pyqtgraph-pyqtgraph-0.13.4/tests/widgets/test_progressdialog.py000066400000000000000000000005471457240071200251100ustar00rootroot00000000000000import pytest import sys import pyqtgraph as pg pg.mkQApp() @pytest.mark.skipif( sys.platform.startswith("linux") and pg.Qt.QT_LIB == "PySide6" and (6, 0) < pg.Qt.PySide6.__version_info__ < (6, 4, 3), reason="taking gui thread causes segfault" ) def test_progress_dialog(): with pg.ProgressDialog("test", 0, 1) as dlg: dlg += 1 pyqtgraph-pyqtgraph-0.13.4/tests/widgets/test_spinbox.py000066400000000000000000000041221457240071200235370ustar00rootroot00000000000000import pytest import pyqtgraph as pg pg.mkQApp() def test_SpinBox_defaults(): sb = pg.SpinBox() assert sb.opts['decimals'] == 6 assert sb.opts['int'] is False @pytest.mark.parametrize("value,expected_text,opts", [ (0, '0', dict(suffix='', siPrefix=False, dec=False, int=False)), (100, '100', dict()), (1000000, '1e+06', dict()), (1000, '1e+03', dict(decimals=2)), (1000000, '1000000 V', dict(int=True, suffix='V')), (12345678955, '12345678955', dict(int=True, decimals=100)), (1.45e-9, '1.45e-09 A', dict(int=False, decimals=6, suffix='A', siPrefix=False)), (1.45e-9, '1.45 nA', dict(int=False, decimals=6, suffix='A', siPrefix=True)), (1.45, '1.45 PSI', dict(int=False, decimals=6, suffix='PSI', siPrefix=True)), (1.45e-3, '1.45 mPSI', dict(int=False, decimals=6, suffix='PSI', siPrefix=True)), (-2500.3427, '$-2500.34', dict(int=False, format='${value:0.02f}')), (1000, '1 k', dict(siPrefix=True, suffix="")), (1.45e-9, 'i = 1.45e-09 A', dict(int=False, decimals=6, suffix='A', siPrefix=False, prefix='i =')), (0, '0 mV', dict(suffix='V', siPrefix=True, scaleAtZero=1e-3)), (0, '0 mV', dict(suffix='V', siPrefix=True, minStep=5e-6, scaleAtZero=1e-3)), (0, '0 mV', dict(suffix='V', siPrefix=True, step=1e-3)), (0, '0 mV', dict(suffix='V', dec=True, siPrefix=True, minStep=15e-3)), ]) def test_SpinBox_formatting(value, expected_text, opts): sb = pg.SpinBox(**opts) sb.setValue(value) assert sb.value() == value assert sb.text() == expected_text def test_evalFunc(): sb = pg.SpinBox(evalFunc=lambda s: 100) sb.lineEdit().setText('3') sb.editingFinishedEvent() assert sb.value() == 100 sb.lineEdit().setText('0') sb.editingFinishedEvent() assert sb.value() == 100 @pytest.mark.parametrize("suffix", ["", "V"]) def test_SpinBox_gui_set_value(suffix): sb = pg.SpinBox(suffix=suffix) sb.lineEdit().setText(f'0.1{suffix}') sb.editingFinishedEvent() assert sb.value() == 0.1 sb.lineEdit().setText(f'0.1 m{suffix}') sb.editingFinishedEvent() assert sb.value() == 0.1e-3 pyqtgraph-pyqtgraph-0.13.4/tests/widgets/test_tablewidget.py000066400000000000000000000074251457240071200243610ustar00rootroot00000000000000from collections import OrderedDict import numpy as np import pyqtgraph as pg app = pg.mkQApp() listOfTuples = [('text_%d' % i, i, i/9.) for i in range(12)] listOfLists = [list(row) for row in listOfTuples] plainArray = np.array(listOfLists, dtype=object) recordArray = np.array(listOfTuples, dtype=[('string', object), ('integer', int), ('floating', float)]) dictOfLists = OrderedDict([(name, list(recordArray[name])) for name in recordArray.dtype.names]) listOfDicts = [OrderedDict([(name, rec[name]) for name in recordArray.dtype.names]) for rec in recordArray] transposed = [[row[col] for row in listOfTuples] for col in range(len(listOfTuples[0]))] def assertTableData(table, data): assert len(data) == table.rowCount() rows = list(range(table.rowCount())) columns = list(range(table.columnCount())) for r in rows: assert len(data[r]) == table.columnCount() row = [] for c in columns: item = table.item(r, c) if item is not None: row.append(item.value) else: row.append(None) assert row == list(data[r]) def test_TableWidget(): w = pg.TableWidget(sortable=False) # Test all input data types w.setData(listOfTuples) assertTableData(w, listOfTuples) w.setData(listOfLists) assertTableData(w, listOfTuples) w.setData(plainArray) assertTableData(w, listOfTuples) w.setData(recordArray) assertTableData(w, listOfTuples) w.setData(dictOfLists) assertTableData(w, transposed) w.appendData(dictOfLists) assertTableData(w, transposed * 2) w.setData(listOfDicts) assertTableData(w, listOfTuples) w.appendData(listOfDicts) assertTableData(w, listOfTuples * 2) # Test sorting w.setData(listOfTuples) w.sortByColumn(0, pg.QtCore.Qt.SortOrder.AscendingOrder) assertTableData(w, sorted(listOfTuples, key=lambda a: a[0])) w.sortByColumn(1, pg.QtCore.Qt.SortOrder.AscendingOrder) assertTableData(w, sorted(listOfTuples, key=lambda a: a[1])) w.sortByColumn(2, pg.QtCore.Qt.SortOrder.AscendingOrder) assertTableData(w, sorted(listOfTuples, key=lambda a: a[2])) w.setSortMode(1, 'text') w.sortByColumn(1, pg.QtCore.Qt.SortOrder.AscendingOrder) assertTableData(w, sorted(listOfTuples, key=lambda a: str(a[1]))) w.setSortMode(1, 'index') w.sortByColumn(1, pg.QtCore.Qt.SortOrder.AscendingOrder) assertTableData(w, listOfTuples) # Test formatting item = w.item(0, 2) assert item.text() == ('%0.3g' % item.value) w.setFormat('%0.6f') assert item.text() == ('%0.6f' % item.value) w.setFormat('X%0.7f', column=2) assert isinstance(item.value, float) assert item.text() == ('X%0.7f' % item.value) # test setting items that do not exist yet w.setFormat('X%0.7f', column=3) # test append uses correct formatting w.appendRow(('x', 10, 7.3)) item = w.item(w.rowCount()-1, 2) assert isinstance(item.value, float) assert item.text() == ('X%0.7f' % item.value) # test reset back to defaults w.setFormat(None, column=2) assert isinstance(item.value, float) assert item.text() == ('%0.6f' % item.value) w.setFormat(None) assert isinstance(item.value, float) assert item.text() == ('%0.3g' % item.value) # test function formatter def fmt(item): if isinstance(item.value, float): return "%d %f" % (item.index, item.value) else: return str(item.value) w.setFormat(fmt) assert isinstance(item.value, float) assert isinstance(item.index, int) assert item.text() == ("%d %f" % (item.index, item.value)) pyqtgraph-pyqtgraph-0.13.4/tools/000077500000000000000000000000001457240071200167755ustar00rootroot00000000000000pyqtgraph-pyqtgraph-0.13.4/tools/generateChangelog.py000066400000000000000000000053161457240071200227560ustar00rootroot00000000000000import re, time, sys def generateDebianChangelog(package, logFile, version, maintainer): """ ------- Convert CHANGELOG format like: pyqtgraph-0.9.1 2012-12-29 - change - change -------- to debian changelog format: python-pyqtgraph (0.9.1-1) UNRELEASED; urgency=low * Initial release. -- Luke Sat, 29 Dec 2012 01:07:23 -0500 *package* is the name of the python package. *logFile* is the CHANGELOG file to read; must have the format described above. *version* will be used to check that the most recent log entry corresponds to the current package version. *maintainer* should be string like "Luke ". """ releases = [] current_version = None current_log = None current_date = None with open(logFile) as file_: for line in file_.readlines(): match = re.match(package+r'-(\d+\.\d+\.\d+(\.\d+)?)\s*(\d+-\d+-\d+)\s*$', line) if match is None: if current_log is not None: current_log.append(line) else: if current_log is not None: releases.append((current_version, current_log, current_date)) current_version, current_date = match.groups()[0], match.groups()[2] #sys.stderr.write("Found release %s\n" % current_version) current_log = [] if releases[0][0] != version: raise Exception("Latest release in changelog (%s) does not match current release (%s)\n" % (releases[0][0], version)) output = [] for release, changes, date in releases: date = time.strptime(date, '%Y-%m-%d') changeset = [ "python-%s (%s-1) UNRELEASED; urgency=low\n" % (package, release), "\n"] + changes + [ " -- %s %s -0%d00\n" % (maintainer, time.strftime('%a, %d %b %Y %H:%M:%S', date), time.timezone/3600), "\n" ] # remove consecutive blank lines except between releases clean = "" lastBlank = True for line in changeset: if line.strip() == '': if lastBlank: continue else: clean += line lastBlank = True else: clean += line lastBlank = False output.append(clean) output.append("") return "\n".join(output) + "\n" if __name__ == '__main__': if len(sys.argv) < 5: sys.stderr.write('Usage: generateChangelog.py package_name log_file version "Maintainer "\n') sys.exit(-1) print(generateDebianChangelog(*sys.argv[1:])) pyqtgraph-pyqtgraph-0.13.4/tools/pg-release.py000066400000000000000000000213731457240071200214010ustar00rootroot00000000000000#!/usr/bin/python import os, sys, argparse, random from shell import shell, ssh description="Build release packages for pyqtgraph." epilog = """ Package build is done in several steps: * Attempt to clone branch release-x.y.z from source-repo * Merge release branch into master * Write new version numbers into the source * Roll over unreleased CHANGELOG entries * Commit and tag new release * Build HTML documentation * Build source package * Build deb packages (if running on Linux) * Build Windows exe installers Release packages may be published by using the --publish flag: * Uploads release files to website * Pushes tagged git commit to github * Uploads source package to pypi Building source packages requires: * * * python-sphinx Building deb packages requires several dependencies: * build-essential * python-all, python3-all * python-stdeb, python3-stdeb Note: building windows .exe files should be possible on any OS. However, Debian/Ubuntu systems do not include the necessary wininst*.exe files; these must be manually copied from the Python source to the distutils/command submodule path (/usr/lib/pythonX.X/distutils/command). Additionally, it may be necessary to rename (or copy / link) wininst-9.0-amd64.exe to wininst-6.0-amd64.exe. """ path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) build_dir = os.path.join(path, 'release-build') pkg_dir = os.path.join(path, 'release-packages') ap = argparse.ArgumentParser(description=description, epilog=epilog, formatter_class=argparse.RawDescriptionHelpFormatter) ap.add_argument('version', help='The x.y.z version to generate release packages for. ' 'There must be a corresponding pyqtgraph-x.y.z branch in the source repository.') ap.add_argument('--publish', metavar='', help='Publish previously built package files (must be stored in pkg-dir/version) and tagged release commit (from build-dir).', action='store_const', const=True, default=False) ap.add_argument('--source-repo', metavar='', help='Repository from which release and master branches will be cloned. Default is the repo containing this script.', default=path) ap.add_argument('--build-dir', metavar='', help='Directory where packages will be staged and built. Default is source_root/release-build.', default=build_dir) ap.add_argument('--pkg-dir', metavar='', help='Directory where packages will be stored. Default is source_root/release-packages.', default=pkg_dir) ap.add_argument('--skip-pip-test', metavar='', help='Skip testing pip install.', action='store_const', const=True, default=False) ap.add_argument('--no-deb', metavar='', help='Skip building Debian packages.', action='store_const', const=True, default=False) ap.add_argument('--no-exe', metavar='', help='Skip building Windows exe installers.', action='store_const', const=True, default=False) def build(args): if os.path.exists(args.build_dir): sys.stderr.write("Please remove the build directory %s before proceeding, or specify a different path with --build-dir.\n" % args.build_dir) sys.exit(-1) if os.path.exists(args.pkg_dir): sys.stderr.write("Please remove the package directory %s before proceeding, or specify a different path with --pkg-dir.\n" % args.pkg_dir) sys.exit(-1) # Clone source repository and tag the release branch shell(''' # Clone and merge release branch into previous master mkdir -p {build_dir} cd {build_dir} rm -rf pyqtgraph git clone --depth 1 --branch master --single-branch {source_repo} pyqtgraph cd pyqtgraph git checkout -b release-{version} git pull {source_repo} release-{version} git checkout master git merge --no-ff --no-commit release-{version} # Write new version number into the source sed -i "s/__version__ = .*/__version__ = '{version}'/" pyqtgraph/__init__.py sed -i "s/version = .*/version = '{version}'/" doc/source/conf.py sed -i "s/release = .*/release = '{version}'/" doc/source/conf.py # make sure changelog mentions unreleased changes grep "pyqtgraph-{version}.*unreleased.*" CHANGELOG sed -i "s/pyqtgraph-{version}.*unreleased.*/pyqtgraph-{version}/" CHANGELOG # Commit and tag new release git commit -a -m "PyQtGraph release {version}" git tag pyqtgraph-{version} # Build HTML documentation cd doc make clean make html cd .. find ./ -name "*.pyc" -delete # package source distribution python setup.py sdist mkdir -p {pkg_dir} cp dist/*.tar.gz {pkg_dir} # source package build complete. '''.format(**args.__dict__)) if args.skip_pip_test: args.pip_test = 'skipped' else: shell(''' # test pip install source distribution rm -rf release-{version}-virtenv virtualenv --system-site-packages release-{version}-virtenv . release-{version}-virtenv/bin/activate echo "PATH: $PATH" echo "ENV: $VIRTUAL_ENV" pip install --no-index --no-deps dist/pyqtgraph-{version}.tar.gz deactivate # pip install test passed '''.format(**args.__dict__)) args.pip_test = 'passed' if 'linux' in sys.platform and not args.no_deb: shell(''' # build deb packages cd {build_dir}/pyqtgraph python setup.py --command-packages=stdeb.command sdist_dsc cd deb_dist/pyqtgraph-{version} sed -i "s/^Depends:.*/Depends: python (>= 2.6), python-qt4 | python-pyside, python-numpy/" debian/control dpkg-buildpackage cd ../../ mv deb_dist {pkg_dir}/pyqtgraph-{version}-deb # deb package build complete. '''.format(**args.__dict__)) args.deb_status = 'built' else: args.deb_status = 'skipped' if not args.no_exe: shell(""" # Build windows executables cd {build_dir}/pyqtgraph python setup.py build bdist_wininst --plat-name=win32 python setup.py build bdist_wininst --plat-name=win-amd64 cp dist/*.exe {pkg_dir} """.format(**args.__dict__)) args.exe_status = 'built' else: args.exe_status = 'skipped' print(unindent(""" ======== Build complete. ========= * Source package: built * Pip install test: {pip_test} * Debian packages: {deb_status} * Windows installers: {exe_status} * Package files in {pkg_dir} Next steps to publish: * Test all packages * Run script again with --publish """).format(**args.__dict__)) def publish(args): if not os.path.isfile(os.path.expanduser('~/.pypirc')): print(unindent(""" Missing ~/.pypirc file. Should look like: ----------------------------------------- [distutils] index-servers = pypi [pypi] username:your_username password:your_password """)) sys.exit(-1) ### Upload everything to server shell(""" cd {build_dir}/pyqtgraph # Uploading documentation.. (disabled; now hosted by readthedocs.io) #rsync -rv doc/build/* pyqtgraph.org:/www/code/pyqtgraph/pyqtgraph/documentation/build/ # Uploading release packages to website rsync -v {pkg_dir} pyqtgraph.org:/www/code/pyqtgraph/downloads/ # Push master to github git push https://github.com/pyqtgraph/pyqtgraph master:master # Push tag to github git push https://github.com/pyqtgraph/pyqtgraph pyqtgraph-{version} # Upload to pypi.. python setup.py sdist upload """.format(**args.__dict__)) print(unindent(""" ======== Upload complete. ========= Next steps to publish: - update website - mailing list announcement - new conda recipe (http://conda.pydata.org/docs/build.html) - contact deb maintainer (gianfranco costamagna) - other package maintainers? """).format(**args.__dict__)) def unindent(msg): ind = 1e6 lines = msg.split('\n') for line in lines: if len(line.strip()) == 0: continue ind = min(ind, len(line) - len(line.lstrip())) return '\n'.join([line[ind:] for line in lines]) if __name__ == '__main__': args = ap.parse_args() args.build_dir = os.path.abspath(args.build_dir) args.pkg_dir = os.path.join(os.path.abspath(args.pkg_dir), args.version) if args.publish: publish(args) else: build(args) pyqtgraph-pyqtgraph-0.13.4/tools/py2exe.bat000066400000000000000000000005121457240071200206770ustar00rootroot00000000000000rem rem This is a simple windows batch file containing the commands needed to package rem a program with pyqtgraph and py2exe. See the packaging tutorial at rem http://luke.campagnola.me/code/pyqtgraph for more information. rem rmdir /S /Q dist rmdir /S /Q build python .\py2exeSetupWindows.py py2exe --includes sip pause pyqtgraph-pyqtgraph-0.13.4/tools/py2exeSetupWindows.py000066400000000000000000000014101457240071200231530ustar00rootroot00000000000000""" Example distutils setup script for packaging a program with pyqtgraph and py2exe. See the packaging tutorial at http://luke.campagnola.me/code/pyqtgraph for more information. """ from distutils.core import setup from glob import glob import py2exe import sys ## This path must contain msvcm90.dll, msvcp90.dll, msvcr90.dll, and Microsoft.VC90.CRT.manifest ## (see http://www.py2exe.org/index.cgi/Tutorial) dllpath = r'C:\Windows\WinSxS\x86_Microsoft.VC90.CRT...' sys.path.append(dllpath) data_files = [ ## Instruct setup to copy the needed DLL files into the build directory ("Microsoft.VC90.CRT", glob(dllpath + r'\*.*')), ] setup( data_files=data_files, windows=['main.py'] , options={"py2exe": {"excludes":["Tkconstants", "Tkinter", "tcl"]}} ) pyqtgraph-pyqtgraph-0.13.4/tools/pyuic5000077500000000000000000000000521457240071200201360ustar00rootroot00000000000000#!/usr/bin/python3 import PyQt5.uic.pyuic pyqtgraph-pyqtgraph-0.13.4/tools/rebuildPtreeRst.py000066400000000000000000000023051457240071200224660ustar00rootroot00000000000000import os.path import textwrap from pyqtgraph.parametertree.Parameter import PARAM_TYPES, _PARAM_ITEM_TYPES def mkDocs(typeList): typeNames = sorted([typ.__name__ for typ in typeList]) typDocs = [ f"""\ .. autoclass:: {name} :members: """ for name in typeNames] indented = '\n'.join(typDocs) # There will be two newlines at the end, so remove one return textwrap.dedent(indented)[:-1] types = set(PARAM_TYPES.values()) items = [typ.itemClass for typ in PARAM_TYPES.values() if typ.itemClass is not None] \ + [item for item in _PARAM_ITEM_TYPES.values()] items = set(items) doc = f"""\ .. This file is auto-generated from pyqtgraph/tools/rebuildPtreeRst.py. Do not modify by hand! Instead, rerun the generation script with `python pyqtgraph/tools/rebuildPtreeRst.py`. Built-in Parameter Types ======================== .. currentmodule:: pyqtgraph.parametertree.parameterTypes Parameters ---------- {mkDocs(types)} ParameterItems -------------- {mkDocs(items)} """ here = os.path.dirname(__file__) rstFilename = os.path.join(here, '..', 'doc', 'source', 'parametertree', 'parametertypes.rst') with open(rstFilename, 'w') as ofile: ofile.write(doc) pyqtgraph-pyqtgraph-0.13.4/tools/rebuildUi.py000066400000000000000000000030101457240071200212650ustar00rootroot00000000000000#!/usr/bin/python """ Script for compiling Qt Designer .ui files to .py """ import os import subprocess import sys pyqt6uic = 'pyuic6' usage = """Compile .ui files to .py for PyQt6 Usage: python rebuildUi.py [--force] [.ui files|search paths] May specify a list of .ui files and/or directories to search recursively for .ui files. """ args = sys.argv[1:] if '--force' in args: force = True args.remove('--force') else: force = False if len(args) == 0: print(usage) sys.exit(-1) uifiles = [] for arg in args: if os.path.isfile(arg) and arg.endswith('.ui'): uifiles.append(arg) elif os.path.isdir(arg): # recursively search for ui files in this directory for path, sd, files in os.walk(arg): uifiles.extend(os.path.join(path, f) for f in files if f.endswith('.ui')) else: print('Argument "%s" is not a directory or .ui file.' % arg) sys.exit(-1) compiler = pyqt6uic extension = '_generic.py' # rebuild all requested ui files for ui in uifiles: base, _ = os.path.splitext(ui) py = base + ext if not force and os.path.exists(py) and os.stat(ui).st_mtime <= os.stat(py).st_mtime: print(f"Skipping {py}; already compiled.") else: cmd = f'{compiler} {ui} > {py}' print(cmd) try: subprocess.check_call(cmd, shell=True) except subprocess.CalledProcessError: os.remove(py) else: print(f"{py} created, modify import to import from pyqtgraph.Qt not PyQt6") pyqtgraph-pyqtgraph-0.13.4/tools/release_instructions.md000066400000000000000000000021711457240071200235640ustar00rootroot00000000000000PyQtGraph Release Procedure --------------------------- 1. Create a release-x.x.x branch 2. Run pyqtgraph/tools/pg-release.py script (this has only been tested on linux) - creates clone of master - merges release branch into master - updates version numbers in code - creates pyqtgraph-x.x.x tag - creates release commit - builds documentation - builds source package - tests pip install - builds windows .exe installers (note: it may be necessary to manually copy wininst*.exe files from the python source packages) - builds deb package (note: official debian packages are built elsewhere; these locally-built deb packages may be phased out) 3. test build files - test setup.py, pip on OSX - test setup.py, pip, 32/64 exe on windows - test setup.py, pip, deb on linux (py2, py3) 4. Run pg-release.py script again with --publish flag - website upload - github push + release - pip upload 5. publish - update website - mailing list announcement - new conda recipe (http://conda.pydata.org/docs/build.html) - contact various package maintainers pyqtgraph-pyqtgraph-0.13.4/tools/setupHelpers.py000066400000000000000000000500741457240071200220400ustar00rootroot00000000000000from contextlib import suppress import json import os import re import shutil import subprocess import sys from distutils import core from typing import Dict, Any from .generateChangelog import generateDebianChangelog # Maximum allowed repository size difference (in kB) following merge. # This is used to prevent large files from being inappropriately added to # the repository history. MERGE_SIZE_LIMIT = 100 # Paths that are checked for style by flake and flake_diff FLAKE_CHECK_PATHS = ['pyqtgraph', 'examples', 'tools'] # Flake style checks -- mandatory, recommended, optional # See: http://pep8.readthedocs.org/en/1.4.6/intro.html # and https://flake8.readthedocs.org/en/2.0/warnings.html FLAKE_MANDATORY = set([ 'E101', # indentation contains mixed spaces and tabs 'E112', # expected an indented block 'E122', # continuation line missing indentation or outdented 'E125', # continuation line does not distinguish itself from next line 'E133', # closing bracket is missing indentation 'E223', # tab before operator 'E224', # tab after operator 'E242', # tab after ‘,’ 'E273', # tab after keyword 'E274', # tab before keyword 'E901', # SyntaxError or IndentationError 'E902', # IOError 'W191', # indentation contains tabs 'W601', # .has_key() is deprecated, use ‘in’ 'W602', # deprecated form of raising exception 'W603', # ‘<>’ is deprecated, use ‘!=’ 'W604', # backticks are deprecated, use ‘repr()’ ]) FLAKE_RECOMMENDED = set([ 'E124', # closing bracket does not match visual indentation 'E231', # missing whitespace after ‘,’ 'E211', # whitespace before ‘(‘ 'E261', # at least two spaces before inline comment 'E271', # multiple spaces after keyword 'E272', # multiple spaces before keyword 'E304', # blank lines found after function decorator 'F401', # module imported but unused 'F402', # import module from line N shadowed by loop variable 'F403', # ‘from module import *’ used; unable to detect undefined names 'F404', # future import(s) name after other statements 'E501', # line too long (82 > 79 characters) 'E502', # the backslash is redundant between brackets 'E702', # multiple statements on one line (semicolon) 'E703', # statement ends with a semicolon 'E711', # comparison to None should be ‘if cond is None:’ 'E712', # comparison to True should be ‘if cond is True:’ or ‘if cond:’ 'E721', # do not compare types, use ‘isinstance()’ 'F811', # redefinition of unused name from line N 'F812', # list comprehension redefines name from line N 'F821', # undefined name name 'F822', # undefined name name in __all__ 'F823', # local variable name ... referenced before assignment 'F831', # duplicate argument name in function definition 'F841', # local variable name is assigned to but never used 'W292', # no newline at end of file ]) FLAKE_OPTIONAL = set([ 'E121', # continuation line indentation is not a multiple of four 'E123', # closing bracket does not match indentation of opening bracket 'E126', # continuation line over-indented for hanging indent 'E127', # continuation line over-indented for visual indent 'E128', # continuation line under-indented for visual indent 'E201', # whitespace after ‘(‘ 'E202', # whitespace before ‘)’ 'E203', # whitespace before ‘:’ 'E221', # multiple spaces before operator 'E222', # multiple spaces after operator 'E225', # missing whitespace around operator 'E227', # missing whitespace around bitwise or shift operator 'E226', # missing whitespace around arithmetic operator 'E228', # missing whitespace around modulo operator 'E241', # multiple spaces after ‘,’ 'E251', # unexpected spaces around keyword / parameter equals 'E262', # inline comment should start with ‘# ‘ 'E301', # expected 1 blank line, found 0 'E302', # expected 2 blank lines, found 0 'E303', # too many blank lines (3) 'E401', # multiple imports on one line 'E701', # multiple statements on one line (colon) 'W291', # trailing whitespace 'W293', # blank line contains whitespace 'W391', # blank line at end of file ]) FLAKE_IGNORE = set([ # 111 and 113 are ignored because they appear to be broken. 'E111', # indentation is not a multiple of four 'E113', # unexpected indentation ]) def checkStyle(): """ Run flake8, checking only lines that are modified since the last git commit. """ # First check _all_ code against mandatory error codes print('flake8: check all code against mandatory error set...') errors = ','.join(FLAKE_MANDATORY) cmd = ['flake8', '--select=' + errors] + FLAKE_CHECK_PATHS proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) #ret = proc.wait() output = proc.stdout.read().decode('utf-8') ret = proc.wait() printFlakeOutput(output) # Check for DOS newlines print('check line endings in all files...') count = 0 allowedEndings = set([None, '\n']) for path, dirs, files in os.walk('.'): if path.startswith("." + os.path.sep + ".tox"): continue for f in files: if os.path.splitext(f)[1] not in ('.py', '.rst'): continue filename = os.path.join(path, f) with open(filename, 'U') as fh: _ = fh.readlines() endings = set( fh.newlines if isinstance(fh.newlines, tuple) else (fh.newlines,) ) endings -= allowedEndings if len(endings) > 0: print("\033[0;31m" + "File has invalid line endings: " + "%s" % filename + "\033[0m") ret = ret | 2 count += 1 print('checked line endings in %d files' % count) # Next check new code with optional error codes print('flake8: check new code against recommended error set...') diff = subprocess.check_output(['git', 'diff']) proc = subprocess.Popen(['flake8', '--diff', # '--show-source', '--ignore=' + errors], stdin=subprocess.PIPE, stdout=subprocess.PIPE) proc.stdin.write(diff) proc.stdin.close() output = proc.stdout.read().decode('utf-8') ret |= printFlakeOutput(output) if ret == 0: print('style test passed.') else: print('style test failed: %d' % ret) return ret def printFlakeOutput(text): """ Print flake output, colored by error category. Return 2 if there were any mandatory errors, 1 if only recommended / optional errors, and 0 if only optional errors. """ ret = 0 gotError = False for line in text.split('\n'): m = re.match(r'[^\:]+\:\d+\:\d+\: (\w+) .*', line) if m is None: print(line) else: gotError = True error = m.group(1) if error in FLAKE_MANDATORY: print("\033[0;31m" + line + "\033[0m") ret |= 2 elif error in FLAKE_RECOMMENDED: print("\033[0;33m" + line + "\033[0m") #ret |= 1 elif error in FLAKE_OPTIONAL: print("\033[0;32m" + line + "\033[0m") elif error in FLAKE_IGNORE: continue else: print("\033[0;36m" + line + "\033[0m") if not gotError: print(" [ no errors ]\n") return ret def unitTests(): """ Run all unit tests (using py.test) Return the exit code. """ try: if sys.version[0] == '3': out = subprocess.check_output('PYTHONPATH=. py.test-3', shell=True) else: out = subprocess.check_output('PYTHONPATH=. py.test', shell=True) ret = 0 except Exception as e: out = e.output ret = e.returncode print(out.decode('utf-8')) return ret def checkMergeSize( sourceBranch=None, targetBranch=None, sourceRepo=None, targetRepo=None ): """ Check that a git merge would not increase the repository size by MERGE_SIZE_LIMIT. """ if sourceBranch is None: sourceBranch = getGitBranch() sourceRepo = '..' if targetBranch is None: if sourceBranch == 'master': targetBranch = 'master' targetRepo = 'https://github.com/pyqtgraph/pyqtgraph.git' else: targetBranch = 'master' targetRepo = '..' workingDir = '__merge-test-clone' env = dict(TARGET_BRANCH=targetBranch, SOURCE_BRANCH=sourceBranch, TARGET_REPO=targetRepo, SOURCE_REPO=sourceRepo, WORKING_DIR=workingDir, ) print("Testing merge size difference:\n" " SOURCE: {SOURCE_REPO} {SOURCE_BRANCH}\n" " TARGET: {TARGET_BRANCH} {TARGET_REPO}".format(**env)) setup = """ mkdir {WORKING_DIR} && cd {WORKING_DIR} && git init && git remote add -t {TARGET_BRANCH} target {TARGET_REPO} && git fetch target {TARGET_BRANCH} && git checkout -qf target/{TARGET_BRANCH} && git gc -q --aggressive """.format(**env) checkSize = """ cd {WORKING_DIR} && du -s . | sed -e "s/\t.*//" """.format(**env) merge = """ cd {WORKING_DIR} && git pull -q {SOURCE_REPO} {SOURCE_BRANCH} && git gc -q --aggressive """.format(**env) try: print("Check out target branch:\n" + setup) subprocess.check_call(setup, shell=True) targetSize = int(subprocess.check_output(checkSize, shell=True)) print("TARGET SIZE: %d kB" % targetSize) print("Merge source branch:\n" + merge) subprocess.check_call(merge, shell=True) mergeSize = int(subprocess.check_output(checkSize, shell=True)) print("MERGE SIZE: %d kB" % mergeSize) diff = mergeSize - targetSize if diff <= MERGE_SIZE_LIMIT: print("DIFFERENCE: %d kB [OK]" % diff) return 0 else: print("\033[0;31m" + "DIFFERENCE: %d kB [exceeds %d kB]" % ( diff, MERGE_SIZE_LIMIT) + "\033[0m") return 2 finally: if os.path.isdir(workingDir): shutil.rmtree(workingDir) def mergeTests(): ret = checkMergeSize() ret |= unitTests() ret |= checkStyle() if ret == 0: print("\033[0;32m" + "\nAll merge tests passed." + "\033[0m") else: print("\033[0;31m" + "\nMerge tests failed." + "\033[0m") return ret def getInitVersion(pkgroot): """Return the version string defined in __init__.py""" path = os.getcwd() initfile = os.path.join(path, pkgroot, '__init__.py') init = open(initfile).read() m = re.search(r'__version__ = (\S+)\n', init) if m is None or len(m.groups()) != 1: raise Exception("Cannot determine __version__ from init file: " + "'%s'!" % initfile) version = m.group(1).strip('\'\"') return version def gitCommit(name): """Return the commit ID for the given name.""" commit = subprocess.check_output( ['git', 'show', name], universal_newlines=True).split('\n')[0] assert commit[:7] == 'commit ' return commit[7:] def getGitVersion(tagPrefix): """Return a version string with information about this git checkout. If the checkout is an unmodified, tagged commit, then return the tag version If this is not a tagged commit, return the output of ``git describe --tags`` If this checkout has been modified, append "+" to the version. """ path = os.getcwd() if not os.path.isdir(os.path.join(path, '.git')): return None try: v = ( subprocess.check_output( ["git", "describe", "--tags", "--dirty", '--match="%s*"' % tagPrefix], stderr=subprocess.DEVNULL) .strip() .decode("utf-8") ) except (FileNotFoundError, subprocess.CalledProcessError): return None # chop off prefix assert v.startswith(tagPrefix) v = v[len(tagPrefix):] # split up version parts parts = v.split('-') # has working tree been modified? modified = False if parts[-1] == 'dirty': modified = True parts = parts[:-1] # have commits been added on top of last tagged version? # (git describe adds -NNN-gXXXXXXX if this is the case) local = None if (len(parts) > 2 and re.match(r'\d+', parts[-2]) and re.match(r'g[0-9a-f]{7}', parts[-1])): local = parts[-1] parts = parts[:-2] gitVersion = '-'.join(parts) if local is not None: gitVersion += '+' + local if modified: gitVersion += 'm' return gitVersion def getGitBranch(): m = re.search( r'\* (.*)', subprocess.check_output(['git', 'branch'], universal_newlines=True)) if m is None: return '' else: return m.group(1) def getVersionStrings(pkg): """ Returns 4 version strings: * the version string to use for this build, * version string requested with --force-version (or None) * version string that describes the current git checkout (or None). * version string in the pkg/__init__.py, The first return value is (forceVersion or gitVersion or initVersion). """ ## Determine current version string from __init__.py initVersion = getInitVersion(pkgroot=pkg) # If this is a git checkout # try to generate a more descriptive version string try: gitVersion = getGitVersion(tagPrefix=pkg+'-') except: gitVersion = None sys.stderr.write("This appears to be a git checkout, but an error " "occurred while attempting to determine a version " "string for the current commit.\n") sys.excepthook(*sys.exc_info()) # See whether a --force-version flag was given forcedVersion = None for i, arg in enumerate(sys.argv): if arg.startswith('--force-version'): if arg == '--force-version': forcedVersion = sys.argv[i+1] sys.argv.pop(i) sys.argv.pop(i) elif arg.startswith('--force-version='): forcedVersion = sys.argv[i].replace('--force-version=', '') sys.argv.pop(i) ## Finally decide on a version string to use: if forcedVersion is not None: version = forcedVersion else: version = initVersion # if git says this is a modified branch, add local version information if gitVersion is not None: _, _, local = gitVersion.partition('+') if local != '': version = version + '+' + local sys.stderr.write("Detected git commit; " + "will use version string: '%s'\n" % version) return version, forcedVersion, gitVersion, initVersion DEFAULT_ASV: Dict[str, Any] = { "version": 1, "project": "pyqtgraph", "project_url": "http://pyqtgraph.org/", "repo": ".", "branches": ["master"], "environment_type": "virtualenv", "show_commit_url": "http://github.com/pyqtgraph/pyqtgraph/commit/", # "pythons": ["3.7", "3.8", "3.9"], "matrix": { # "numpy": ["1.17", "1.18", "1.19", ""], "numpy": "", "pyqt5": ["", None], "pyside2": ["", None], }, "exclude": [ {"pyqt5": "", "pyside2": ""}, {"pyqt5": None, "pyside2": None} ], "benchmark_dir": "benchmarks", "env_dir": ".asv/env", "results_dir": ".asv/results", "html_dir": ".asv/html", "build_cache_size": 5 } class ASVConfigCommand(core.Command): description = "Setup the ASV benchmarking config for this system" user_options = [] def initialize_options(self) -> None: pass def finalize_options(self) -> None: pass def run(self) -> None: config = DEFAULT_ASV with suppress(FileNotFoundError, subprocess.CalledProcessError): cuda_check = subprocess.check_output(["nvcc", "--version"]) match = re.search(r"release (\d{1,2}\.\d)", cuda_check.decode("utf-8")) ver = match.groups()[0] # e.g. 11.0 ver_str = ver.replace(".", "") # e.g. 110 config["matrix"][f"cupy-cuda{ver_str}"] = "" with open("asv.conf.json", "w") as conf_file: conf_file.write(json.dumps(config, indent=2)) class DebCommand(core.Command): description = "build .deb package using `debuild -us -uc`" maintainer = "Luke Campagnola " debTemplate = "debian" debDir = "deb_build" user_options = [] def initialize_options(self): self.cwd = None def finalize_options(self): self.cwd = os.getcwd() def run(self): version = self.distribution.get_version() pkgName = self.distribution.get_name() debName = "python-" + pkgName debDir = self.debDir assert os.getcwd() == self.cwd, 'Must be in package root: %s' % self.cwd if os.path.isdir(debDir): raise Exception('DEB build dir already exists: "%s"' % debDir) sdist = "dist/%s-%s.tar.gz" % (pkgName, version) if not os.path.isfile(sdist): raise Exception("No source distribution; " + "run `setup.py sdist` first.") # copy sdist to build directory and extract os.mkdir(debDir) renamedSdist = '%s_%s.orig.tar.gz' % (debName, version) print("copy %s => %s" % (sdist, os.path.join(debDir, renamedSdist))) shutil.copy(sdist, os.path.join(debDir, renamedSdist)) print("cd %s; tar -xzf %s" % (debDir, renamedSdist)) if os.system("cd %s; tar -xzf %s" % (debDir, renamedSdist)) != 0: raise Exception("Error extracting source distribution.") buildDir = '%s/%s-%s' % (debDir, pkgName, version) # copy debian control structure print("copytree %s => %s" % (self.debTemplate, buildDir+'/debian')) shutil.copytree(self.debTemplate, buildDir+'/debian') # Write new changelog chlog = generateDebianChangelog( pkgName, 'CHANGELOG', version, self.maintainer) print("write changelog %s" % buildDir+'/debian/changelog') open(buildDir+'/debian/changelog', 'w').write(chlog) # build package print('cd %s; debuild -us -uc' % buildDir) if os.system('cd %s; debuild -us -uc' % buildDir) != 0: raise Exception("Error during debuild.") class DebugCommand(core.Command): """Just for learning about distutils.""" description = "" user_options = [] def initialize_options(self): pass def finalize_options(self): pass def run(self): global cmd cmd = self print(self.distribution.name) print(self.distribution.version) class TestCommand(core.Command): description = "Run all package tests and exit immediately with ", \ "informative return code." user_options = [] def run(self): sys.exit(unitTests()) def initialize_options(self): pass def finalize_options(self): pass class StyleCommand(core.Command): description = "Check all code for style, exit immediately with ", \ "informative return code." user_options = [] def run(self): sys.exit(checkStyle()) def initialize_options(self): pass def finalize_options(self): pass class MergeTestCommand(core.Command): description = "Run all tests needed to determine whether the current ",\ "code is suitable for merge." user_options = [] def run(self): sys.exit(mergeTests()) def initialize_options(self): pass def finalize_options(self): pass pyqtgraph-pyqtgraph-0.13.4/tools/shell.py000066400000000000000000000021061457240071200204550ustar00rootroot00000000000000import os, sys import subprocess as sp def shell(cmd): """Run each line of a shell script; raise an exception if any line returns a nonzero value. """ pin, pout = os.pipe() proc = sp.Popen('/bin/bash', stdin=sp.PIPE) for line in cmd.split('\n'): line = line.strip() if line.startswith('#'): print('\033[33m> ' + line + '\033[0m') else: print('\033[32m> ' + line + '\033[0m') if line.startswith('cd '): os.chdir(line[3:]) proc.stdin.write((line + '\n').encode('utf-8')) proc.stdin.write(('echo $? 1>&%d\n' % pout).encode('utf-8')) ret = "" while not ret.endswith('\n'): ret += os.read(pin, 1) ret = int(ret.strip()) if ret != 0: print("\033[31mLast command returned %d; bailing out.\033[0m" % ret) sys.exit(-1) proc.stdin.close() proc.wait() def ssh(host, cmd): """Run commands on a remote host by ssh. """ proc = sp.Popen(['ssh', host], stdin=sp.PIPE) proc.stdin.write(cmd) proc.wait() pyqtgraph-pyqtgraph-0.13.4/tox.ini000066400000000000000000000013321457240071200171470ustar00rootroot00000000000000[tox] envlist = ; qt 5.15.x py{39,310,311}-pyqt5_515 py{39,310}-pyside2_515 ; qt 6.2 py{39,310,311}-pyqt6_62 py{39,310}-pyside6_62 ; qt 6-newest py{39,310,311}-{pyqt6,pyside6} [base] deps = pytest pytest-xdist numpy scipy pyopengl h5py [testenv] passenv = DISPLAY,XAUTHORITY,PYTHON_VERSION setenv = PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command deps= {[base]deps} pyside2_515: pyside2 pyqt5_515: pyqt5 pyqt6_62: pyqt6~=6.2.0 pyqt6_62: PyQt6-Qt6~=6.2.0 pyside6_62: pyside6~=6.2.0 pyqt6: pyqt6 pyside6: PySide6-Essentials commands= python -c "import pyqtgraph as pg; pg.systemInfo()" pytest -n auto {posargs:}