etho-python 1.2.4__tar.gz → 1.2.5__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.
- {etho_python-1.2.4 → etho_python-1.2.5}/PKG-INFO +2 -1
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/callbacks.md +1 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/configuration/protocol.md +1 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/pyproject.toml +2 -2
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/callbacks/_image.py +69 -16
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/callbacks/_trace.py +12 -10
- etho_python-1.2.5/tests/test_pyav_callback.py +15 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/.github/workflows/draft-pdf.yml +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/.github/workflows/python-package.yml +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/.github/workflows/static.yml +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/.gitignore +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/CITATION.cff +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/CONTRIBUTING.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/LICENSE +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/README.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/Makefile +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/README.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/_static/etho_dark.svg +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/_static/etho_light.svg +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/_templates/api_head.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/_templates/autosummary/module.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.app.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.cli.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.client.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.BLTZeroService.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.DAQZeroService.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.GCMZeroService.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.GOVZeroService.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.NICounterZeroService.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.TemplateZeroService.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.ZeroService.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.camera.base.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.camera.basler.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.camera.dummy.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.camera.hamamatsu.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.camera.spinnaker.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.camera.spinnaker_old.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.camera.ximea.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.dlp.dlp_make_warpfiles.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.utils.concurrent_task.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.services.utils.log_exceptions.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.utils.calibration.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.utils.config.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.utils.runner.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.utils.sound.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.utils.tui.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api/etho.utils.zeroclient.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/api_etho.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/cli.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/conf.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/configuration/calibration_led.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/configuration/calibration_speaker.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/configuration/configuration.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/configuration/global.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/configuration/playlist.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/extensions.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/hardware/camera.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/hardware/govee.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/hardware/hardware.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/hardware/nidaq.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/hardware/projector.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/hardware/scanimage.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/index.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/install.rst +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/logging.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/make.bat +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/make_api_doctree.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/docs/tutorial.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/paper/bib.bib +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/paper/fig_flow.pdf +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/paper/paper.md +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/__init__.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/app.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/assets/etho_icon1_pipeline_dark.svg +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/assets/etho_icon1_pipeline_light.svg +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/cli.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/client.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/res_app.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/resumable.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/BLTZeroService.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/DAQZeroService.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/DLPZeroService.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/GCMZeroService.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/GOVZeroService.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/NICounterZeroService.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/ScanImageTriggerZeroService.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/TemplateZeroService.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/ZeroService.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/__init__.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/callbacks/__init__.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/callbacks/_base.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/camera/__init__.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/camera/base.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/camera/basler.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/camera/dummy.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/camera/hamamatsu.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/camera/spinnaker.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/camera/spinnaker_old.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/camera/ximea.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/daq/IOTask.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/dlp/dlp_make_warpfiles.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/dlp/dlp_runners.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/resumable.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/utils/__init__.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/utils/concurrent_task.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/services/utils/log_exceptions.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/utils/__init__.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/utils/calibration.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/utils/config.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/utils/runner.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/utils/sound.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/utils/tui.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/src/etho/utils/zeroclient.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_cli_gui_smoke.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_config.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_config.yaml +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_daq_playlist.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_gov_service.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_import.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_resumable.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_service_client_wiring.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_services.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_sound.py +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_sound_playlist_mono.txt +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_sound_playlist_stereo.txt +0 -0
- {etho_python-1.2.4 → etho_python-1.2.5}/tests/test_zarr_callbacks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: etho-python
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.5
|
|
4
4
|
Summary: etho
|
|
5
5
|
Author-email: Jan Clemens <clemensjan@googlemail.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -12,6 +12,7 @@ Requires-Dist: numpy; python_version >= "3.11"
|
|
|
12
12
|
Requires-Dist: scipy
|
|
13
13
|
Requires-Dist: h5py
|
|
14
14
|
Requires-Dist: opencv-python-headless
|
|
15
|
+
Requires-Dist: av>=16,<18
|
|
15
16
|
Requires-Dist: bleak
|
|
16
17
|
Requires-Dist: pandas
|
|
17
18
|
Requires-Dist: pyzmq
|
|
@@ -33,6 +33,7 @@ the callback accepts options.
|
|
|
33
33
|
| `disp` | Display frames with OpenCV. |
|
|
34
34
|
| `disp_fast` | Display frames with pyqtgraph. |
|
|
35
35
|
| `save_avi` | Save frames with OpenCV `VideoWriter`. |
|
|
36
|
+
| `save_pyav` | Save H.264 MP4 video with PyAV. |
|
|
36
37
|
| `save_ffmpegcv` | Save frames with an ffmpegcv backend. |
|
|
37
38
|
| `save_vidgear` | Save frames through VidGear. |
|
|
38
39
|
| `save_avi_fast` | Save video with NVIDIA Video Processing Framework. |
|
|
@@ -107,6 +107,7 @@ Common camera callbacks:
|
|
|
107
107
|
- `disp_top`: Display a center/top view helper.
|
|
108
108
|
- `save_timestamps`: Save system and camera timestamps.
|
|
109
109
|
- `save_avi`: Save video with OpenCV `VideoWriter`.
|
|
110
|
+
- `save_pyav`: Save H.264 MP4 video with PyAV.
|
|
110
111
|
- `save_ffmpegcv`: Save video with an ffmpegcv backend.
|
|
111
112
|
- `save_vidgear`: Save video through VidGear.
|
|
112
113
|
- `save_vidgear_round`: Save long videos, chunked into a sequences of individual files using the VidGear output.
|
|
@@ -11,13 +11,13 @@ classifiers = ["License :: OSI Approved :: MIT License"]
|
|
|
11
11
|
dynamic = ["description"]
|
|
12
12
|
requires-python = ">=3.10"
|
|
13
13
|
dependencies = [
|
|
14
|
-
'numpy<2; python_version < "3.11"', 'numpy; python_version >= "3.11"', 'scipy', 'h5py', 'opencv-python-headless', 'bleak',
|
|
14
|
+
'numpy<2; python_version < "3.11"', 'numpy; python_version >= "3.11"', 'scipy', 'h5py', 'opencv-python-headless', 'av>=16,<18', 'bleak',
|
|
15
15
|
'pandas', 'pyzmq', 'gevent', 'future', 'pillow', 'msgpack-python',
|
|
16
16
|
'pyyaml', 'ipython', 'defopt', 'msgpack-numpy', 'rich', 'psutil', 'tables',
|
|
17
17
|
'pydaqmx', 'pyqtgraph', 'qtpy', 'PySide6-Essentials', 'zarr>=2,<3; python_version < "3.11"', 'zarr>=3,<4; python_version >= "3.11"', 'zerorpc-numpy'
|
|
18
18
|
]
|
|
19
19
|
readme= "README.md"
|
|
20
|
-
version="1.2.
|
|
20
|
+
version="1.2.5"
|
|
21
21
|
|
|
22
22
|
[project.scripts]
|
|
23
23
|
etho = "etho.cli:main"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Callbacks for processing images."""
|
|
2
2
|
|
|
3
|
-
import logging
|
|
3
|
+
import logging
|
|
4
|
+
from fractions import Fraction
|
|
4
5
|
from xml.dom import NotFoundErr
|
|
5
6
|
import numpy as np
|
|
6
7
|
from . import register_callback
|
|
@@ -15,11 +16,18 @@ try:
|
|
|
15
16
|
import cv2
|
|
16
17
|
|
|
17
18
|
cv2_import_error = None
|
|
18
|
-
except ImportError as cv2_import_error:
|
|
19
|
-
pass
|
|
20
|
-
|
|
21
|
-
try:
|
|
22
|
-
import
|
|
19
|
+
except ImportError as cv2_import_error:
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
import av
|
|
24
|
+
|
|
25
|
+
av_import_error = None
|
|
26
|
+
except ImportError as av_import_error:
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
import ffmpegcv
|
|
23
31
|
|
|
24
32
|
ffmpegcv_import_error = None
|
|
25
33
|
except ImportError as ffmpegcv_import_error:
|
|
@@ -157,7 +165,7 @@ class ImageDisplayPQG(ImageCallback):
|
|
|
157
165
|
|
|
158
166
|
@for_all_methods(log_exceptions(logger))
|
|
159
167
|
@register_callback
|
|
160
|
-
class ImageWriterCV2(ImageCallback):
|
|
168
|
+
class ImageWriterCV2(ImageCallback):
|
|
161
169
|
"""Save images to video using opencv's VideoWriter.
|
|
162
170
|
|
|
163
171
|
Fast but little control over video compression quality.
|
|
@@ -202,15 +210,60 @@ class ImageWriterCV2(ImageCallback):
|
|
|
202
210
|
|
|
203
211
|
self.vw.write(image)
|
|
204
212
|
|
|
205
|
-
def _cleanup(self):
|
|
206
|
-
self.vw.release()
|
|
207
|
-
del self.vw
|
|
208
|
-
super()._cleanup()
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
@for_all_methods(log_exceptions(logger))
|
|
212
|
-
@register_callback
|
|
213
|
-
class
|
|
213
|
+
def _cleanup(self):
|
|
214
|
+
self.vw.release()
|
|
215
|
+
del self.vw
|
|
216
|
+
super()._cleanup()
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
@for_all_methods(log_exceptions(logger))
|
|
220
|
+
@register_callback
|
|
221
|
+
class ImageWriterPyAV(ImageCallback):
|
|
222
|
+
"""Save H.264 video using PyAV."""
|
|
223
|
+
|
|
224
|
+
SUFFIX: str = ".mp4"
|
|
225
|
+
FRIENDLY_NAME = "save_pyav"
|
|
226
|
+
TIMESTAMPS_ONLY = False
|
|
227
|
+
|
|
228
|
+
def __init__(self, data_source, *, poll_timeout=0.01, **kwargs):
|
|
229
|
+
super().__init__(data_source=data_source, poll_timeout=poll_timeout, **kwargs)
|
|
230
|
+
|
|
231
|
+
if av_import_error is not None:
|
|
232
|
+
logger.exception("Could not import PyAV. Aborting!", exc_info=av_import_error)
|
|
233
|
+
raise av_import_error
|
|
234
|
+
|
|
235
|
+
self.container = None
|
|
236
|
+
|
|
237
|
+
def _loop(self, data):
|
|
238
|
+
if hasattr(self.data_source, "WHOAMI") and self.data_source.WHOAMI == "array":
|
|
239
|
+
image = data
|
|
240
|
+
else:
|
|
241
|
+
image, timestamp = data
|
|
242
|
+
|
|
243
|
+
if self.container is None:
|
|
244
|
+
self.container = av.open(self.file_name + self.SUFFIX, "w")
|
|
245
|
+
self.stream = self.container.add_stream("libx264", rate=Fraction(str(self.frame_rate)))
|
|
246
|
+
self.stream.width = image.shape[1]
|
|
247
|
+
self.stream.height = image.shape[0]
|
|
248
|
+
self.stream.pix_fmt = "yuv420p"
|
|
249
|
+
|
|
250
|
+
frame_format = "gray" if image.ndim == 2 else "bgr24"
|
|
251
|
+
frame = av.VideoFrame.from_ndarray(image, format=frame_format)
|
|
252
|
+
for packet in self.stream.encode(frame):
|
|
253
|
+
self.container.mux(packet)
|
|
254
|
+
|
|
255
|
+
def _cleanup(self):
|
|
256
|
+
if self.container is not None:
|
|
257
|
+
for packet in self.stream.encode():
|
|
258
|
+
self.container.mux(packet)
|
|
259
|
+
self.container.close()
|
|
260
|
+
self.container = None
|
|
261
|
+
super()._cleanup()
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
@for_all_methods(log_exceptions(logger))
|
|
265
|
+
@register_callback
|
|
266
|
+
class ImageWriterFCV(ImageCallback):
|
|
214
267
|
"""Save images to video using ffmpegcv.
|
|
215
268
|
|
|
216
269
|
Supports hardware accelerated encoding
|
|
@@ -220,14 +220,16 @@ class SaveZarr(BaseCallback):
|
|
|
220
220
|
raise zarr_import_error
|
|
221
221
|
self.file_name = file_name
|
|
222
222
|
# Backward compatibility for Zarr 2; remove when Python 3.10 support ends.
|
|
223
|
-
if hasattr(zarr, "DirectoryStore"):
|
|
224
|
-
self.f = zarr.DirectoryStore(self.file_name + self.SUFFIX)
|
|
225
|
-
self.arrays = zarr.group(self.f, overwrite=True)
|
|
226
|
-
self._create_array = self.arrays.create_dataset
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
self.
|
|
230
|
-
self.
|
|
223
|
+
if hasattr(zarr, "DirectoryStore"):
|
|
224
|
+
self.f = zarr.DirectoryStore(self.file_name + self.SUFFIX)
|
|
225
|
+
self.arrays = zarr.group(self.f, overwrite=True)
|
|
226
|
+
self._create_array = self.arrays.create_dataset
|
|
227
|
+
self._auto_chunks = True
|
|
228
|
+
else:
|
|
229
|
+
self.f = zarr.storage.LocalStore(self.file_name + self.SUFFIX)
|
|
230
|
+
self.arrays = zarr.group(self.f, overwrite=True, zarr_format=2)
|
|
231
|
+
self._create_array = self.arrays.create_array
|
|
232
|
+
self._auto_chunks = "auto"
|
|
231
233
|
self.vanilla: bool = True
|
|
232
234
|
|
|
233
235
|
self.attrs = attrs
|
|
@@ -245,10 +247,10 @@ class SaveZarr(BaseCallback):
|
|
|
245
247
|
for key, val in self.attrs.items():
|
|
246
248
|
self.arrays["samples"].attrs[key] = val
|
|
247
249
|
|
|
248
|
-
self._create_array("systemtime", shape=(0, 1), chunks=
|
|
250
|
+
self._create_array("systemtime", shape=(0, 1), chunks=self._auto_chunks, dtype=systemtime.dtype, compressor=compressor)
|
|
249
251
|
|
|
250
252
|
sn = np.array(data.shape[:1])[:, np.newaxis]
|
|
251
|
-
self._create_array("samplenumber", shape=(0, 1), chunks=
|
|
253
|
+
self._create_array("samplenumber", shape=(0, 1), chunks=self._auto_chunks, dtype=sn.dtype, compressor=compressor)
|
|
252
254
|
# print([(k, v.shape) for k, v in self.arrays.items()])
|
|
253
255
|
|
|
254
256
|
def _append_data(self, data, systemtime):
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import av
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
from etho.services.callbacks._image import ImageWriterPyAV
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_pyav_callback_writes_h264_mp4(tmp_path):
|
|
8
|
+
writer = ImageWriterPyAV(None, file_name=str(tmp_path / "video"), frame_rate=30)
|
|
9
|
+
writer._loop((np.zeros((4, 6, 3), dtype=np.uint8), 1.0))
|
|
10
|
+
writer._cleanup()
|
|
11
|
+
|
|
12
|
+
with av.open(str(tmp_path / "video.mp4")) as video:
|
|
13
|
+
stream = video.streams.video[0]
|
|
14
|
+
assert stream.codec_context.name == "h264"
|
|
15
|
+
assert (stream.width, stream.height) == (6, 4)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|