deapi 5.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. deapi-5.2.0/.github/workflows/build.yaml +69 -0
  2. deapi-5.2.0/.github/workflows/documentation.yaml +38 -0
  3. deapi-5.2.0/.github/workflows/publish.yaml +33 -0
  4. deapi-5.2.0/.github/workflows/test-publish.yaml +33 -0
  5. deapi-5.2.0/.pre-commit-config.yaml +10 -0
  6. deapi-5.2.0/CHANGES.rst +18 -0
  7. deapi-5.2.0/PKG-INFO +44 -0
  8. deapi-5.2.0/README.md +35 -0
  9. deapi-5.2.0/deapi/__init__.py +33 -0
  10. deapi-5.2.0/deapi/buffer_protocols/__init__.py +29 -0
  11. deapi-5.2.0/deapi/buffer_protocols/pb_2_3_0.py +666 -0
  12. deapi-5.2.0/deapi/buffer_protocols/pb_3_11_4.py +741 -0
  13. deapi-5.2.0/deapi/buffer_protocols/pb_3_19_3.py +114 -0
  14. deapi-5.2.0/deapi/buffer_protocols/pb_3_23_3.py +41 -0
  15. deapi-5.2.0/deapi/buffer_protocols/pb_3_6_1.py +745 -0
  16. deapi-5.2.0/deapi/client.py +2159 -0
  17. deapi-5.2.0/deapi/conf.py +184 -0
  18. deapi-5.2.0/deapi/data_types.py +586 -0
  19. deapi-5.2.0/deapi/fake_data/__init__.py +7 -0
  20. deapi-5.2.0/deapi/fake_data/base_fake_data.py +113 -0
  21. deapi-5.2.0/deapi/fake_data/grains.py +87 -0
  22. deapi-5.2.0/deapi/index.rst +10 -0
  23. deapi-5.2.0/deapi/prop_dump.json +450 -0
  24. deapi-5.2.0/deapi/python_3_instruction.txt +31 -0
  25. deapi-5.2.0/deapi/release_notes.txt +34 -0
  26. deapi-5.2.0/deapi/simulated_server/__init__.py +0 -0
  27. deapi-5.2.0/deapi/simulated_server/fake_server.py +721 -0
  28. deapi-5.2.0/deapi/simulated_server/initialize_server.py +66 -0
  29. deapi-5.2.0/deapi/tests/__init__.py +0 -0
  30. deapi-5.2.0/deapi/tests/conftest.py +95 -0
  31. deapi-5.2.0/deapi/tests/original_tests/01_fps.py +102 -0
  32. deapi-5.2.0/deapi/tests/original_tests/02_hwRoisize.py +155 -0
  33. deapi-5.2.0/deapi/tests/original_tests/03_hwBinning.py +117 -0
  34. deapi-5.2.0/deapi/tests/original_tests/04_swBinning.py +141 -0
  35. deapi-5.2.0/deapi/tests/original_tests/05_swhwBinning.py +113 -0
  36. deapi-5.2.0/deapi/tests/original_tests/06_patternPixel.py +139 -0
  37. deapi-5.2.0/deapi/tests/original_tests/07_reference.py +92 -0
  38. deapi-5.2.0/deapi/tests/original_tests/08_virtmask.py +114 -0
  39. deapi-5.2.0/deapi/tests/original_tests/09_scanRoi.py +104 -0
  40. deapi-5.2.0/deapi/tests/original_tests/10_imageStatistics.py +247 -0
  41. deapi-5.2.0/deapi/tests/original_tests/__init__.py +0 -0
  42. deapi-5.2.0/deapi/tests/original_tests/func.py +76 -0
  43. deapi-5.2.0/deapi/tests/original_tests/propertyName.py +725 -0
  44. deapi-5.2.0/deapi/tests/original_tests/test_legacy.py +132 -0
  45. deapi-5.2.0/deapi/tests/speed_tests/__init__.py +0 -0
  46. deapi-5.2.0/deapi/tests/speed_tests/test_internal_file_saving.py +54 -0
  47. deapi-5.2.0/deapi/tests/speed_tests/test_movie_buffer_transfer.py +54 -0
  48. deapi-5.2.0/deapi/tests/test_client.py +270 -0
  49. deapi-5.2.0/deapi/tests/test_fake_server/__init__.py +0 -0
  50. deapi-5.2.0/deapi/tests/test_fake_server/test_server.py +35 -0
  51. deapi-5.2.0/deapi/tests/test_file_saving/__init__.py +0 -0
  52. deapi-5.2.0/deapi/tests/test_file_saving/test_file_loading_libertem.py +49 -0
  53. deapi-5.2.0/deapi/tests/test_file_saving/test_file_loading_rsciio.py +53 -0
  54. deapi-5.2.0/deapi/tests/test_file_saving/test_scan_pattern_saving.py +68 -0
  55. deapi-5.2.0/deapi/version.py +3 -0
  56. deapi-5.2.0/deapi.egg-info/PKG-INFO +44 -0
  57. deapi-5.2.0/deapi.egg-info/SOURCES.txt +87 -0
  58. deapi-5.2.0/deapi.egg-info/dependency_links.txt +1 -0
  59. deapi-5.2.0/deapi.egg-info/entry_points.txt +2 -0
  60. deapi-5.2.0/deapi.egg-info/requires.txt +24 -0
  61. deapi-5.2.0/deapi.egg-info/top_level.txt +1 -0
  62. deapi-5.2.0/doc/Makefile +20 -0
  63. deapi-5.2.0/doc/_static/de_api_icon.svg +114 -0
  64. deapi-5.2.0/doc/_templates/autosummary/base.rst +5 -0
  65. deapi-5.2.0/doc/_templates/custom-attribute-template.rst +8 -0
  66. deapi-5.2.0/doc/_templates/custom-class-template.rst +38 -0
  67. deapi-5.2.0/doc/_templates/custom-function-template.rst +8 -0
  68. deapi-5.2.0/doc/_templates/custom-module-template.rst +67 -0
  69. deapi-5.2.0/doc/_templates/custrom-method-template.rst +8 -0
  70. deapi-5.2.0/doc/changes.rst +1 -0
  71. deapi-5.2.0/doc/conf.py +64 -0
  72. deapi-5.2.0/doc/help/dev_guide.rst +94 -0
  73. deapi-5.2.0/doc/help/help.rst +15 -0
  74. deapi-5.2.0/doc/help/index.rst +10 -0
  75. deapi-5.2.0/doc/help/pyDEServer.rst +65 -0
  76. deapi-5.2.0/doc/index.rst +11 -0
  77. deapi-5.2.0/doc/intro.rst +29 -0
  78. deapi-5.2.0/doc/make.bat +35 -0
  79. deapi-5.2.0/doc/reference/index.rst +47 -0
  80. deapi-5.2.0/examples/README.rst +3 -0
  81. deapi-5.2.0/examples/live_imaging/README.rst +3 -0
  82. deapi-5.2.0/examples/live_imaging/viewing_the_sensor.py +57 -0
  83. deapi-5.2.0/examples/setting_parameters/README.rst +3 -0
  84. deapi-5.2.0/examples/setting_parameters/setting_up_stem.py +42 -0
  85. deapi-5.2.0/examples/virtual_imaging/README.rst +3 -0
  86. deapi-5.2.0/examples/virtual_imaging/setting_virtual_masks.py +94 -0
  87. deapi-5.2.0/examples/virtual_imaging/vdf_vbf.py +101 -0
  88. deapi-5.2.0/pyproject.toml +74 -0
  89. deapi-5.2.0/setup.cfg +4 -0
@@ -0,0 +1,69 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ branches: main
7
+
8
+ env:
9
+ MPLBACKEND: agg
10
+
11
+ jobs:
12
+ build-with-pip:
13
+ name: ${{ matrix.os }}-py${{ matrix.python-version }}${{ matrix.LABEL }}
14
+ runs-on: ${{ matrix.os }}
15
+ timeout-minutes: 15
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ os: [ubuntu-latest, windows-latest, macos-latest]
20
+ python-version: ["3.10", "3.11", "3.12"]
21
+ include:
22
+ - os: ubuntu-latest
23
+ python-version: 3.10
24
+
25
+ DEPENDENCIES: protobuf==5.26.0
26
+ LABEL: -oldest
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+
30
+ - name: Set up Python ${{ matrix.python-version }}
31
+ uses: actions/setup-python@v4
32
+ with:
33
+ python-version: ${{ matrix.python-version }}
34
+
35
+ - name: Install dependencies and package
36
+ shell: bash
37
+ run: |
38
+ pip install -U -e .'[tests]'
39
+
40
+ - name: Install oldest supported versions
41
+ if: contains(matrix.LABEL, 'oldest')
42
+ run: |
43
+ pip install ${{ matrix.DEPENDENCIES }}
44
+
45
+ - name: Display Python, pip and package versions
46
+ run: |
47
+ python -V
48
+ pip -V
49
+ pip list
50
+
51
+ - name: Run docstring tests
52
+ continue-on-error: true
53
+ run: |
54
+ pytest --doctest-modules --doctest-continue-on-failure --ignore-glob=deapi/tests deapi
55
+
56
+ - name: Run tests
57
+ run: |
58
+ pytest --cov=. --cov-report=xml
59
+
60
+ - name: Generate line coverage
61
+ if: ${{ matrix.os == 'ubuntu-latest' }}
62
+ run: |
63
+ coverage report --show-missing
64
+
65
+ - name: Upload coverage to Codecov
66
+ if: ${{ always() }}
67
+ uses: codecov/codecov-action@v4
68
+ env:
69
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,38 @@
1
+ name: documentation
2
+
3
+ on: [push, pull_request, workflow_dispatch]
4
+
5
+ permissions:
6
+ contents: write
7
+
8
+ jobs:
9
+ docs:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: '3.11'
18
+
19
+ - name: Install dependencies
20
+ shell: bash
21
+ run: |
22
+ pip install -U -e .'[doc]'
23
+
24
+ - name: Sphinx build
25
+ run: |
26
+ python deapi/simulated_server/initialize_server.py 13241 &
27
+ sleep 5 &&
28
+ sphinx-build doc _build &&
29
+ kill %1
30
+
31
+ - name: Deploy to GitHub Pages
32
+ uses: peaceiris/actions-gh-pages@v3
33
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
34
+ with:
35
+ publish_branch: gh-pages
36
+ github_token: ${{ secrets.GITHUB_TOKEN }}
37
+ publish_dir: _build/
38
+ force_orphan: true
@@ -0,0 +1,33 @@
1
+ name: Upload to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ workflow: "*"
8
+
9
+ jobs:
10
+ deploy:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ # IMPORTANT: this permission is mandatory for trusted publishing
14
+ id-token: write
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v2
20
+ with:
21
+ python-version: '3.x'
22
+
23
+ - name: Install dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install build
27
+
28
+ - name: Build package
29
+ run: |
30
+ python -m build
31
+
32
+ - name: Publish package distribution to PyPI
33
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,33 @@
1
+ name: Test Upload Python Package
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ workflow: "*"
6
+
7
+ jobs:
8
+ deploy:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ # IMPORTANT: this permission is mandatory for trusted publishing
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v2
18
+ with:
19
+ python-version: '3.x'
20
+
21
+ - name: Install dependencies
22
+ run: |
23
+ python -m pip install --upgrade pip
24
+ pip install build
25
+
26
+ - name: Build package
27
+ run: |
28
+ python -m build
29
+
30
+ - name: Publish package distribution to TestPyPI
31
+ uses: pypa/gh-action-pypi-publish@release/v1
32
+ with:
33
+ repository_url: https://test.pypi.org/legacy/
@@ -0,0 +1,10 @@
1
+ repos:
2
+ - repo: https://github.com/psf/black
3
+ # Version can be updated by running "pre-commit autoupdate"
4
+ rev: 24.10.0
5
+ hooks:
6
+ - id: black
7
+ ci:
8
+ # Don't run automatically on PRs, instead add the comment
9
+ # "pre-commit.ci autofix" on a pull request to manually trigger auto-fixing
10
+ autofix_prs: false
@@ -0,0 +1,18 @@
1
+ .. _changelog:
2
+
3
+ Changelog
4
+ *********
5
+
6
+ This document describes the changes in the DEAPI library.
7
+
8
+
9
+ Unreleased
10
+ ==========
11
+ - Initial release
12
+ - Renamed `Client` functions from CamelCase to snake_case (Legacy functions are still available)
13
+ - Added buffer_protocol module for handling different buffer protocol files
14
+ - Added a data_types module for handling different data types
15
+ - Added a python based DEServer for testing purposes
16
+ - Update the Testing to allow for a real DEServer to be used for testing (#7)
17
+ - Add support for `@pytest.mark.server` decorator for tests that require a full DEServer to be running (#7)
18
+ - Add a commandline interface for the pydeserver. (#8) Running `pydeserver --port 13241` will start the server on port 13241
deapi-5.2.0/PKG-INFO ADDED
@@ -0,0 +1,44 @@
1
+ Metadata-Version: 2.1
2
+ Name: deapi
3
+ Version: 5.2.0
4
+ Summary: API for DE Server
5
+ Author: Direct Electron
6
+ Project-URL: Bug Reports, https://github.com/hyperspy/hyperspy/issues
7
+ Project-URL: Documentation, https://hyperspy.org/hyperspy-doc/current/index.html
8
+ Project-URL: Conda-forge, https://anaconda.org/conda-forge/hyperspy
9
+ Project-URL: Homepage, https://hyperspy.org
10
+ Project-URL: Support, https://gitter.im/hyperspy/hyperspy
11
+ Project-URL: Source, https://github.com/hyperspy/hyperspy
12
+ Keywords: EELS,STEM,TEM,hyperspy,microscopy,Cryo EM,4D STEM
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Requires-Python: >=3.8
23
+ Requires-Dist: numpy>=1.20.0
24
+ Requires-Dist: protobuf
25
+ Requires-Dist: pillow
26
+ Requires-Dist: matplotlib
27
+ Requires-Dist: scipy
28
+ Requires-Dist: scikit-image
29
+ Requires-Dist: sympy
30
+ Provides-Extra: tests
31
+ Requires-Dist: pytest-instafail; extra == "tests"
32
+ Requires-Dist: pytest-mpl; extra == "tests"
33
+ Requires-Dist: pytest-rerunfailures; extra == "tests"
34
+ Requires-Dist: pytest-xdist; extra == "tests"
35
+ Requires-Dist: pytest>=3.6; extra == "tests"
36
+ Requires-Dist: setuptools_scm; extra == "tests"
37
+ Requires-Dist: pytest-cov; extra == "tests"
38
+ Requires-Dist: pytest-xprocess; extra == "tests"
39
+ Requires-Dist: libertem; extra == "tests"
40
+ Requires-Dist: hyperspy; extra == "tests"
41
+ Provides-Extra: doc
42
+ Requires-Dist: sphinx; extra == "doc"
43
+ Requires-Dist: pydata_sphinx_theme; extra == "doc"
44
+ Requires-Dist: sphinx-gallery; extra == "doc"
deapi-5.2.0/README.md ADDED
@@ -0,0 +1,35 @@
1
+ Warning!
2
+ ========
3
+
4
+ This API is still under development and is subject to changes. It is provided for future reference and development.
5
+
6
+
7
+
8
+
9
+
10
+ DE API - Python
11
+ ===============
12
+
13
+ The DE API provides python bindings for basic operations for controlling the DEServer. This API isn't functional without
14
+ a working copy of DEServer and a Direct Electron Detector.
15
+
16
+
17
+ Installation
18
+ ------------
19
+
20
+ The python api can be installed using either `pip` or `anaconda`.
21
+
22
+
23
+ Installing using pip
24
+
25
+ ```bash
26
+ $ pip install deapi
27
+ ```
28
+
29
+ Installing using conda
30
+
31
+ ```bash
32
+ $ conda install -c conda-forge deapi
33
+ ```
34
+
35
+ Usage and documentation is hosted here.
@@ -0,0 +1,33 @@
1
+ from deapi.client import Client
2
+ from deapi.version import version as __version__
3
+
4
+ from deapi.data_types import (
5
+ FrameType,
6
+ PixelFormat,
7
+ DataType,
8
+ MovieBufferStatus,
9
+ MovieBufferInfo,
10
+ VirtualMask,
11
+ ContrastStretchType,
12
+ Attributes,
13
+ Histogram,
14
+ PropertySpec,
15
+ PropertyCollection,
16
+ )
17
+
18
+
19
+ __all__ = [
20
+ "Client",
21
+ "__version__",
22
+ "FrameType",
23
+ "PixelFormat",
24
+ "DataType",
25
+ "MovieBufferStatus",
26
+ "MovieBufferInfo",
27
+ "VirtualMask",
28
+ "ContrastStretchType",
29
+ "Attributes",
30
+ "Histogram",
31
+ "PropertySpec",
32
+ "PropertyCollection",
33
+ ]
@@ -0,0 +1,29 @@
1
+ # Choose the right protocol buffer version based on the python version
2
+
3
+ import sys
4
+
5
+ pyVersion = sys.version.split("(")[0][0:4].split(".")
6
+
7
+
8
+ if int(pyVersion[0]) < 3:
9
+ from cStringIO import (
10
+ StringIO,
11
+ ) # use string io to speed up, refer to http://www.skymind.com/~ocrow/python_string/
12
+ import deapi.buffer_protocols.pb_2_3_0 as pb
13
+ else:
14
+ from io import (
15
+ StringIO,
16
+ ) # use string io to speed up, refer to http://www.skymind.com/~ocrow/python_string/
17
+
18
+ long = int # python 3 no longer has int
19
+ if int(pyVersion[1]) >= 10:
20
+ # import pb_3_19_3 as pb
21
+ import deapi.buffer_protocols.pb_3_23_3 as pb
22
+ elif int(pyVersion[1]) >= 8:
23
+ import deapi.buffer_protocols.pb_3_11_4 as pb
24
+ else:
25
+ import deapi.buffer_protocols.pb_3_6_1 as pb
26
+
27
+ __all__ = [
28
+ "pb",
29
+ ]