pye57 0.4.1__tar.gz → 0.4.3__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.

Potentially problematic release.


This version of pye57 might be problematic. Click here for more details.

Files changed (84) hide show
  1. {pye57-0.4.1/src/pye57.egg-info → pye57-0.4.3}/PKG-INFO +9 -8
  2. {pye57-0.4.1 → pye57-0.4.3}/README.md +1 -1
  3. {pye57-0.4.1 → pye57-0.4.3}/setup.py +4 -3
  4. pye57-0.4.3/src/pye57/__version__.py +1 -0
  5. {pye57-0.4.1 → pye57-0.4.3/src/pye57.egg-info}/PKG-INFO +9 -8
  6. {pye57-0.4.1 → pye57-0.4.3}/src/pye57.egg-info/SOURCES.txt +30 -1
  7. pye57-0.4.3/tests/test_main.py +305 -0
  8. pye57-0.4.1/src/pye57/__version__.py +0 -1
  9. {pye57-0.4.1 → pye57-0.4.3}/LICENSE +0 -0
  10. {pye57-0.4.1 → pye57-0.4.3}/MANIFEST.in +0 -0
  11. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/LICENSE.md +0 -0
  12. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/README.md +0 -0
  13. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/extern/CRCpp/LICENSE +0 -0
  14. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/extern/CRCpp/README.md +0 -0
  15. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/extern/CRCpp/inc/CRC.h +0 -0
  16. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/include/E57Exception.h +0 -0
  17. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/include/E57Format.h +0 -0
  18. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/include/E57SimpleData.h +0 -0
  19. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/include/E57SimpleReader.h +0 -0
  20. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/include/E57SimpleWriter.h +0 -0
  21. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/BlobNodeImpl.cpp +0 -0
  22. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/BlobNodeImpl.h +0 -0
  23. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/CheckedFile.cpp +0 -0
  24. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/CheckedFile.h +0 -0
  25. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/Common.cpp +0 -0
  26. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/Common.h +0 -0
  27. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/CompressedVectorNodeImpl.cpp +0 -0
  28. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/CompressedVectorNodeImpl.h +0 -0
  29. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/CompressedVectorReaderImpl.cpp +0 -0
  30. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/CompressedVectorReaderImpl.h +0 -0
  31. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/CompressedVectorWriterImpl.cpp +0 -0
  32. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/CompressedVectorWriterImpl.h +0 -0
  33. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/DecodeChannel.cpp +0 -0
  34. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/DecodeChannel.h +0 -0
  35. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/Decoder.cpp +0 -0
  36. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/Decoder.h +0 -0
  37. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/E57Exception.cpp +0 -0
  38. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/E57Format.cpp +0 -0
  39. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/E57SimpleData.cpp +0 -0
  40. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/E57SimpleReader.cpp +0 -0
  41. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/E57SimpleWriter.cpp +0 -0
  42. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/E57Version.h +0 -0
  43. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/E57XmlParser.cpp +0 -0
  44. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/E57XmlParser.h +0 -0
  45. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/Encoder.cpp +0 -0
  46. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/Encoder.h +0 -0
  47. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/FloatNodeImpl.cpp +0 -0
  48. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/FloatNodeImpl.h +0 -0
  49. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/ImageFileImpl.cpp +0 -0
  50. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/ImageFileImpl.h +0 -0
  51. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/IntegerNodeImpl.cpp +0 -0
  52. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/IntegerNodeImpl.h +0 -0
  53. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/NodeImpl.cpp +0 -0
  54. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/NodeImpl.h +0 -0
  55. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/Packet.cpp +0 -0
  56. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/Packet.h +0 -0
  57. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/ReaderImpl.cpp +0 -0
  58. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/ReaderImpl.h +0 -0
  59. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/ScaledIntegerNodeImpl.cpp +0 -0
  60. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/ScaledIntegerNodeImpl.h +0 -0
  61. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/SectionHeaders.cpp +0 -0
  62. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/SectionHeaders.h +0 -0
  63. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/SourceDestBufferImpl.cpp +0 -0
  64. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/SourceDestBufferImpl.h +0 -0
  65. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/StringNodeImpl.cpp +0 -0
  66. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/StringNodeImpl.h +0 -0
  67. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/StructureNodeImpl.cpp +0 -0
  68. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/StructureNodeImpl.h +0 -0
  69. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/VectorNodeImpl.cpp +0 -0
  70. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/VectorNodeImpl.h +0 -0
  71. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/WriterImpl.cpp +0 -0
  72. {pye57-0.4.1 → pye57-0.4.3}/libE57Format/src/WriterImpl.h +0 -0
  73. {pye57-0.4.1 → pye57-0.4.3}/pyproject.toml +0 -0
  74. {pye57-0.4.1 → pye57-0.4.3}/setup.cfg +0 -0
  75. {pye57-0.4.1 → pye57-0.4.3}/src/pye57/__init__.py +0 -0
  76. {pye57-0.4.1 → pye57-0.4.3}/src/pye57/e57.py +0 -0
  77. {pye57-0.4.1 → pye57-0.4.3}/src/pye57/exception.py +0 -0
  78. {pye57-0.4.1 → pye57-0.4.3}/src/pye57/libe57_wrapper.cpp +0 -0
  79. {pye57-0.4.1 → pye57-0.4.3}/src/pye57/scan_header.py +0 -0
  80. {pye57-0.4.1 → pye57-0.4.3}/src/pye57/utils.py +0 -0
  81. {pye57-0.4.1 → pye57-0.4.3}/src/pye57.egg-info/dependency_links.txt +0 -0
  82. {pye57-0.4.1 → pye57-0.4.3}/src/pye57.egg-info/not-zip-safe +0 -0
  83. {pye57-0.4.1 → pye57-0.4.3}/src/pye57.egg-info/requires.txt +0 -0
  84. {pye57-0.4.1 → pye57-0.4.3}/src/pye57.egg-info/top_level.txt +0 -0
@@ -1,31 +1,34 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pye57
3
- Version: 0.4.1
3
+ Version: 0.4.3
4
4
  Summary: Python .e57 files reader/writer
5
5
  Home-page: https://www.github.com/davidcaron/pye57
6
6
  Author: David Caron
7
7
  Author-email: dcaron05@gmail.com
8
8
  License: MIT
9
- Platform: UNKNOWN
10
9
  Classifier: License :: OSI Approved :: MIT License
11
10
  Classifier: Programming Language :: Python
12
11
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.7
14
12
  Classifier: Programming Language :: Python :: 3.8
15
13
  Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: Implementation :: CPython
18
- Requires-Python: >=3.7
18
+ Requires-Python: >=3.8
19
19
  Description-Content-Type: text/markdown
20
- Provides-Extra: test
21
20
  License-File: LICENSE
21
+ Requires-Dist: numpy
22
+ Requires-Dist: pyquaternion
23
+ Provides-Extra: test
24
+ Requires-Dist: pytest; extra == "test"
22
25
 
23
26
 
24
27
  # pye57
25
28
 
26
29
  [![PyPI](https://img.shields.io/pypi/v/pye57.svg)](https://pypi.org/project/pye57)
27
30
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pye57.svg)](https://pypi.org/project/pye57)
28
- ![GitHub](https://img.shields.io/github/workflow/status/davidcaron/pye57/build)
31
+ ![GitHub](https://img.shields.io/github/actions/workflow/status/davidcaron/pye57/build.yml?branch=master)
29
32
 
30
33
  Python wrapper of [LibE57Format](https://github.com/asmaloney/libE57Format) to read and write .e57 point cloud files
31
34
 
@@ -137,5 +140,3 @@ Use pip again
137
140
  ```
138
141
  python -m pip uninstall pye57
139
142
  ```
140
-
141
-
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![PyPI](https://img.shields.io/pypi/v/pye57.svg)](https://pypi.org/project/pye57)
4
4
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pye57.svg)](https://pypi.org/project/pye57)
5
- ![GitHub](https://img.shields.io/github/workflow/status/davidcaron/pye57/build)
5
+ ![GitHub](https://img.shields.io/github/actions/workflow/status/davidcaron/pye57/build.yml?branch=master)
6
6
 
7
7
  Python wrapper of [LibE57Format](https://github.com/asmaloney/libE57Format) to read and write .e57 point cloud files
8
8
 
@@ -107,7 +107,7 @@ setup(
107
107
  ext_modules=ext_modules,
108
108
  packages=["pye57"],
109
109
  package_dir={"": "src"},
110
- include_package_data=True,
110
+ # include_package_data=True,
111
111
  package_data={"pye57": package_data},
112
112
  extras_require={"test": "pytest"},
113
113
  license="MIT",
@@ -115,13 +115,14 @@ setup(
115
115
  "License :: OSI Approved :: MIT License",
116
116
  "Programming Language :: Python",
117
117
  "Programming Language :: Python :: 3",
118
- "Programming Language :: Python :: 3.7",
119
118
  "Programming Language :: Python :: 3.8",
120
119
  "Programming Language :: Python :: 3.9",
121
120
  "Programming Language :: Python :: 3.10",
121
+ "Programming Language :: Python :: 3.11",
122
+ "Programming Language :: Python :: 3.12",
122
123
  "Programming Language :: Python :: Implementation :: CPython",
123
124
  ],
124
125
  cmdclass={"build_ext": BuildExt},
125
126
  zip_safe=False,
126
- python_requires=">=3.7",
127
+ python_requires=">=3.8",
127
128
  )
@@ -0,0 +1 @@
1
+ __version__ = "0.4.3"
@@ -1,31 +1,34 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pye57
3
- Version: 0.4.1
3
+ Version: 0.4.3
4
4
  Summary: Python .e57 files reader/writer
5
5
  Home-page: https://www.github.com/davidcaron/pye57
6
6
  Author: David Caron
7
7
  Author-email: dcaron05@gmail.com
8
8
  License: MIT
9
- Platform: UNKNOWN
10
9
  Classifier: License :: OSI Approved :: MIT License
11
10
  Classifier: Programming Language :: Python
12
11
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.7
14
12
  Classifier: Programming Language :: Python :: 3.8
15
13
  Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: Implementation :: CPython
18
- Requires-Python: >=3.7
18
+ Requires-Python: >=3.8
19
19
  Description-Content-Type: text/markdown
20
- Provides-Extra: test
21
20
  License-File: LICENSE
21
+ Requires-Dist: numpy
22
+ Requires-Dist: pyquaternion
23
+ Provides-Extra: test
24
+ Requires-Dist: pytest; extra == "test"
22
25
 
23
26
 
24
27
  # pye57
25
28
 
26
29
  [![PyPI](https://img.shields.io/pypi/v/pye57.svg)](https://pypi.org/project/pye57)
27
30
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pye57.svg)](https://pypi.org/project/pye57)
28
- ![GitHub](https://img.shields.io/github/workflow/status/davidcaron/pye57/build)
31
+ ![GitHub](https://img.shields.io/github/actions/workflow/status/davidcaron/pye57/build.yml?branch=master)
29
32
 
30
33
  Python wrapper of [LibE57Format](https://github.com/asmaloney/libE57Format) to read and write .e57 point cloud files
31
34
 
@@ -137,5 +140,3 @@ Use pip again
137
140
  ```
138
141
  python -m pip uninstall pye57
139
142
  ```
140
-
141
-
@@ -3,6 +3,34 @@ MANIFEST.in
3
3
  README.md
4
4
  pyproject.toml
5
5
  setup.py
6
+ /home/runner/work/pye57/pye57/libE57Format/src/BlobNodeImpl.cpp
7
+ /home/runner/work/pye57/pye57/libE57Format/src/CheckedFile.cpp
8
+ /home/runner/work/pye57/pye57/libE57Format/src/Common.cpp
9
+ /home/runner/work/pye57/pye57/libE57Format/src/CompressedVectorNodeImpl.cpp
10
+ /home/runner/work/pye57/pye57/libE57Format/src/CompressedVectorReaderImpl.cpp
11
+ /home/runner/work/pye57/pye57/libE57Format/src/CompressedVectorWriterImpl.cpp
12
+ /home/runner/work/pye57/pye57/libE57Format/src/DecodeChannel.cpp
13
+ /home/runner/work/pye57/pye57/libE57Format/src/Decoder.cpp
14
+ /home/runner/work/pye57/pye57/libE57Format/src/E57Exception.cpp
15
+ /home/runner/work/pye57/pye57/libE57Format/src/E57Format.cpp
16
+ /home/runner/work/pye57/pye57/libE57Format/src/E57SimpleData.cpp
17
+ /home/runner/work/pye57/pye57/libE57Format/src/E57SimpleReader.cpp
18
+ /home/runner/work/pye57/pye57/libE57Format/src/E57SimpleWriter.cpp
19
+ /home/runner/work/pye57/pye57/libE57Format/src/E57XmlParser.cpp
20
+ /home/runner/work/pye57/pye57/libE57Format/src/Encoder.cpp
21
+ /home/runner/work/pye57/pye57/libE57Format/src/FloatNodeImpl.cpp
22
+ /home/runner/work/pye57/pye57/libE57Format/src/ImageFileImpl.cpp
23
+ /home/runner/work/pye57/pye57/libE57Format/src/IntegerNodeImpl.cpp
24
+ /home/runner/work/pye57/pye57/libE57Format/src/NodeImpl.cpp
25
+ /home/runner/work/pye57/pye57/libE57Format/src/Packet.cpp
26
+ /home/runner/work/pye57/pye57/libE57Format/src/ReaderImpl.cpp
27
+ /home/runner/work/pye57/pye57/libE57Format/src/ScaledIntegerNodeImpl.cpp
28
+ /home/runner/work/pye57/pye57/libE57Format/src/SectionHeaders.cpp
29
+ /home/runner/work/pye57/pye57/libE57Format/src/SourceDestBufferImpl.cpp
30
+ /home/runner/work/pye57/pye57/libE57Format/src/StringNodeImpl.cpp
31
+ /home/runner/work/pye57/pye57/libE57Format/src/StructureNodeImpl.cpp
32
+ /home/runner/work/pye57/pye57/libE57Format/src/VectorNodeImpl.cpp
33
+ /home/runner/work/pye57/pye57/libE57Format/src/WriterImpl.cpp
6
34
  libE57Format/LICENSE.md
7
35
  libE57Format/README.md
8
36
  libE57Format/extern/CRCpp/LICENSE
@@ -77,4 +105,5 @@ src/pye57.egg-info/SOURCES.txt
77
105
  src/pye57.egg-info/dependency_links.txt
78
106
  src/pye57.egg-info/not-zip-safe
79
107
  src/pye57.egg-info/requires.txt
80
- src/pye57.egg-info/top_level.txt
108
+ src/pye57.egg-info/top_level.txt
109
+ tests/test_main.py
@@ -0,0 +1,305 @@
1
+ import pytest
2
+ import os
3
+ import time
4
+
5
+ import numpy as np
6
+
7
+ import pye57
8
+ from pye57 import libe57
9
+ from pye57.utils import get_fields
10
+
11
+ try:
12
+ from exceptions import WindowsError
13
+ except ImportError:
14
+ class WindowsError(OSError):
15
+ pass
16
+
17
+
18
+ def test_hi():
19
+ assert libe57.__doc__
20
+
21
+
22
+ def test_data(*args):
23
+ here = os.path.split(__file__)[0]
24
+ return os.path.join(here, "test_data", *args)
25
+
26
+
27
+ def delete_retry(path):
28
+ try:
29
+ if os.path.exists(path):
30
+ os.remove(path)
31
+ except WindowsError:
32
+ time.sleep(0.1)
33
+ if os.path.exists(path):
34
+ os.remove(path)
35
+
36
+
37
+ @pytest.fixture
38
+ def e57_path():
39
+ return test_data("test.e57")
40
+
41
+ @pytest.fixture
42
+ def e57_spherical_path():
43
+ return test_data("testSpherical.e57")
44
+
45
+ @pytest.fixture
46
+ def temp_e57_write(request):
47
+ path = test_data("test_write.e57")
48
+ request.addfinalizer(lambda: delete_retry(path))
49
+ return path
50
+
51
+
52
+ @pytest.fixture
53
+ def image_and_points(e57_path):
54
+ f = libe57.ImageFile(e57_path, mode="r")
55
+ scan_0 = libe57.StructureNode(libe57.VectorNode(f.root().get("/data3D")).get(0))
56
+ points = libe57.CompressedVectorNode(scan_0.get("points"))
57
+ return f, points
58
+
59
+
60
+ def test_constants():
61
+ assert libe57.CHECKSUM_POLICY_NONE == 0
62
+ assert libe57.CHECKSUM_POLICY_SPARSE == 25
63
+ assert libe57.CHECKSUM_POLICY_HALF == 50
64
+ assert libe57.CHECKSUM_POLICY_ALL == 100
65
+ assert libe57.E57_INT8_MIN == -128
66
+ assert libe57.E57_INT8_MAX == 127
67
+ assert libe57.E57_INT16_MIN == -32768
68
+ assert libe57.E57_INT16_MAX == 32767
69
+ assert libe57.E57_INT32_MIN == -2147483647 - 1
70
+ assert libe57.E57_INT32_MAX == 2147483647
71
+ assert libe57.E57_INT64_MIN == -9223372036854775807 - 1
72
+ assert libe57.E57_INT64_MAX == 9223372036854775807
73
+ assert libe57.E57_UINT8_MIN == 0
74
+ assert libe57.E57_UINT8_MAX == 255
75
+ assert libe57.E57_UINT16_MIN == 0
76
+ assert libe57.E57_UINT16_MAX == 65535
77
+ assert libe57.E57_UINT32_MIN == 0
78
+ assert libe57.E57_UINT32_MAX == 4294967295
79
+ assert libe57.E57_UINT64_MIN == 0
80
+ assert libe57.E57_UINT64_MAX == 18446744073709551615
81
+
82
+
83
+ def test_open_imagefile(e57_path):
84
+ f = libe57.ImageFile(e57_path, mode="r")
85
+ assert f.isOpen()
86
+ f.close()
87
+
88
+
89
+ def test_open_imagefile_write(temp_e57_write):
90
+ f = libe57.ImageFile(temp_e57_write, mode="w")
91
+ assert f.isOpen()
92
+ f.close()
93
+
94
+
95
+ def test_e57_mode_error(temp_e57_write):
96
+ with pytest.raises(ValueError):
97
+ f = pye57.E57(temp_e57_write, mode="pasta")
98
+
99
+
100
+ def test_get_structure_names(e57_path):
101
+ f = libe57.ImageFile(e57_path, "r")
102
+ root = f.root()
103
+ names = []
104
+ for id_ in range(root.childCount()):
105
+ names.append(root.get(id_).pathName())
106
+ assert names == ['/formatName', '/guid', '/versionMajor', '/versionMinor', '/e57LibraryVersion',
107
+ '/coordinateMetadata', '/creationDateTime', '/data3D', '/images2D']
108
+
109
+
110
+ def test_get_data3d_nodes(e57_path):
111
+ f = libe57.ImageFile(e57_path, "r")
112
+ root = f.root()
113
+ node = root.get("data3D")
114
+ data3d = libe57.VectorNode(node)
115
+ scan_count = data3d.childCount()
116
+ assert scan_count == 4
117
+ for scan_id in range(scan_count):
118
+ assert isinstance(data3d.get(scan_id), libe57.Node)
119
+
120
+
121
+ def test_get_read_data3d(e57_path):
122
+ f = libe57.ImageFile(e57_path, "r")
123
+ scan_0 = libe57.StructureNode(libe57.VectorNode(f.root().get("/data3D")).get(0))
124
+ points = libe57.CompressedVectorNode(scan_0.get("points"))
125
+ assert points.childCount() == 281300
126
+
127
+
128
+ def test_source_dest_buffers(e57_path):
129
+ f = libe57.ImageFile(e57_path, "r")
130
+ capacity = 1000
131
+ types = list("bBhHlLq?fd")
132
+ sizes = [1, 1, 2, 2, 4, 4, 8, 1, 4, 8]
133
+ buffers = libe57.VectorSourceDestBuffer()
134
+ for t in types:
135
+ data = np.zeros(capacity, t)
136
+ sdb = libe57.SourceDestBuffer(f, "something", data, capacity, True, True)
137
+ buffers.append(sdb)
138
+
139
+ for t, sdb, size, in zip(types, buffers, sizes):
140
+ assert sdb.pathName() == "something"
141
+ assert sdb.capacity() == capacity
142
+ assert sdb.stride() == size
143
+ assert sdb.doScaling()
144
+ assert sdb.doConversion()
145
+
146
+
147
+ def test_unsupported_point_field(temp_e57_write):
148
+ with pye57.E57(temp_e57_write, mode="w") as f:
149
+ with pytest.raises(ValueError):
150
+ data = {"cartesianX": np.random.rand(10),
151
+ "bananas": np.random.rand(10)}
152
+ f.write_scan_raw(data)
153
+
154
+
155
+ def test_source_dest_buffers_raises(e57_path):
156
+ f = libe57.ImageFile(e57_path, "r")
157
+ capacity = 1000
158
+ data = np.zeros(capacity, "i")
159
+ with pytest.raises(ValueError):
160
+ libe57.SourceDestBuffer(f, "something", data, capacity, True, True)
161
+
162
+
163
+ def test_read_points_x(image_and_points):
164
+ imf, points = image_and_points
165
+ bufs = libe57.VectorSourceDestBuffer()
166
+ capacity = 10000
167
+ X = np.zeros(capacity, "f")
168
+ bufs.append(libe57.SourceDestBuffer(imf, "cartesianX", X, capacity, True, True))
169
+ data_reader = points.reader(bufs)
170
+ size = data_reader.read()
171
+ assert size == capacity
172
+ assert not np.all(np.zeros(capacity, "f") == X)
173
+
174
+
175
+ def test_index_out_of_range(e57_path):
176
+ f = libe57.ImageFile(e57_path, "r")
177
+ with pytest.raises(IndexError):
178
+ scan = f.root()["data3D"][-1]
179
+ with pytest.raises(IndexError):
180
+ scan = f.root()["data3D"][5]
181
+ scan_0 = f.root()["data3D"][0]
182
+ with pytest.raises(IndexError):
183
+ r = scan_0["pose"]["rotation"][-1]
184
+ with pytest.raises(IndexError):
185
+ r = scan_0["pose"]["rotation"][5]
186
+
187
+
188
+ def test_read_header(e57_path):
189
+ f = libe57.ImageFile(e57_path, "r")
190
+ data3d = f.root()["data3D"]
191
+ headers = pye57.ScanHeader.from_data3d(data3d)
192
+ fields = ['cartesianX', 'cartesianY', 'cartesianZ', 'intensity', 'rowIndex', 'columnIndex', 'cartesianInvalidState']
193
+ for header in headers:
194
+ assert fields == header.point_fields
195
+ assert headers[0].pretty_print()
196
+ scan_0_rot = [[-0.4443, 0.8958, 0.],
197
+ [-0.8958, -0.4443, 0.],
198
+ [0., 0., 1.]]
199
+ assert np.allclose(scan_0_rot, headers[0].rotation_matrix, atol=1e-3)
200
+ scan_0_tra = [301336.23199, 5042597.23676, 15.46649]
201
+ assert np.allclose(scan_0_tra, headers[0].translation)
202
+
203
+
204
+ def test_read_xyz(e57_path):
205
+ e57 = pye57.E57(e57_path)
206
+ xyz = e57.read_scan(0)
207
+ assert np.any(xyz)
208
+
209
+
210
+ def test_read_header_spherical(e57_spherical_path):
211
+ f = libe57.ImageFile(e57_spherical_path, "r")
212
+ data3d = f.root()["data3D"]
213
+ headers = pye57.ScanHeader.from_data3d(data3d)
214
+ fields = ['sphericalRange', 'sphericalAzimuth', 'sphericalElevation', 'intensity', 'colorRed', 'colorGreen', 'colorBlue', 'sphericalInvalidState']
215
+ for header in headers:
216
+ assert fields == header.point_fields
217
+ assert headers[0].pretty_print()
218
+
219
+
220
+ def test_read_xyz_spherical(e57_spherical_path):
221
+ e57 = pye57.E57(e57_spherical_path)
222
+ xyz = e57.read_scan(0)
223
+ assert np.any(xyz)
224
+
225
+
226
+ def test_read_raw(e57_path):
227
+ e57 = pye57.E57(e57_path)
228
+ header = e57.get_header(0)
229
+ fields = header.point_fields
230
+ data = e57.read_scan_raw(0)
231
+ assert sorted(fields) == sorted(data.keys())
232
+ assert np.any(data["cartesianX"])
233
+ assert len(data["cartesianX"]) == header.point_count
234
+
235
+
236
+ def test_read_write_single_scan(e57_path, temp_e57_write):
237
+ e57 = pye57.E57(e57_path)
238
+ header_source = e57.get_header(0)
239
+ with pye57.E57(temp_e57_write, mode="w") as e57_write:
240
+ raw_data_0 = e57.read_scan_raw(0)
241
+ e57_write.write_scan_raw(raw_data_0, rotation=header_source.rotation, translation=header_source.translation)
242
+ scan_0 = pye57.E57(e57_path).read_scan_raw(0)
243
+ written = pye57.E57(temp_e57_write)
244
+ header = written.get_header(0)
245
+ assert np.allclose(header.rotation, header_source.rotation)
246
+ assert np.allclose(header.translation, header_source.translation)
247
+ scan_0_written = written.read_scan_raw(0)
248
+ fields = "cartesianX cartesianY cartesianZ intensity rowIndex columnIndex cartesianInvalidState".split()
249
+ for field in fields:
250
+ assert np.allclose(scan_0[field], scan_0_written[field])
251
+
252
+ scan_0 = e57.read_scan(0)
253
+ scan_0_written = written.read_scan(0)
254
+ for field in scan_0:
255
+ assert np.allclose(scan_0[field], scan_0_written[field])
256
+
257
+
258
+ def test_copy_file(e57_path, temp_e57_write):
259
+ e57 = pye57.E57(e57_path)
260
+ with pye57.E57(temp_e57_write, mode="w") as f:
261
+ for scan_id in range(e57.scan_count):
262
+ header = e57.get_header(scan_id)
263
+ data = e57.read_scan_raw(scan_id)
264
+ f.write_scan_raw(data, scan_header=header)
265
+ header_written = f.get_header(scan_id)
266
+ assert header_written.guid
267
+ assert header_written.temperature == header_written.temperature
268
+ assert header_written.relativeHumidity == header_written.relativeHumidity
269
+ assert header_written.atmosphericPressure == header_written.atmosphericPressure
270
+ assert header_written.rowMinimum == header.rowMinimum
271
+ assert header_written.rowMaximum == header.rowMaximum
272
+ assert header_written.columnMinimum == header.columnMinimum
273
+ assert header_written.columnMaximum == header.columnMaximum
274
+ assert header_written.returnMinimum == header.returnMinimum
275
+ assert header_written.returnMaximum == header.returnMaximum
276
+ assert header_written.intensityMinimum == header.intensityMinimum
277
+ assert header_written.intensityMaximum == header.intensityMaximum
278
+ assert header_written.xMinimum == header.xMinimum
279
+ assert header_written.xMaximum == header.xMaximum
280
+ assert header_written.yMinimum == header.yMinimum
281
+ assert header_written.yMaximum == header.yMaximum
282
+ assert header_written.zMinimum == header.zMinimum
283
+ assert header_written.zMaximum == header.zMaximum
284
+ assert np.allclose(header_written.rotation, header.rotation)
285
+ assert np.allclose(header_written.translation, header.translation)
286
+ assert header_written.acquisitionStart_dateTimeValue == header.acquisitionStart_dateTimeValue
287
+ assert header_written.acquisitionStart_isAtomicClockReferenced == header.acquisitionStart_isAtomicClockReferenced
288
+ assert header_written.acquisitionEnd_dateTimeValue == header.acquisitionEnd_dateTimeValue
289
+ assert header_written.acquisitionEnd_isAtomicClockReferenced == header.acquisitionEnd_isAtomicClockReferenced
290
+ # todo: point groups
291
+ # header.pointGroupingSchemes["groupingByLine"]["idElementName"].value()
292
+ # header.pointGroupingSchemes["groupingByLine"]["groups"]
293
+
294
+ assert f.scan_count == e57.scan_count
295
+
296
+
297
+ def test_read_color_absent(e57_path):
298
+ e57 = pye57.E57(e57_path)
299
+ with pytest.raises(ValueError):
300
+ data = e57.read_scan(0, colors=True)
301
+
302
+
303
+ def test_scan_position(e57_path):
304
+ e57 = pye57.E57(e57_path)
305
+ assert np.allclose(e57.scan_position(3), np.array([[3.01323456e+05, 5.04260184e+06, 1.56040279e+01]]))
@@ -1 +0,0 @@
1
- __version__ = "0.4.1"
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