pye57 0.4.4__tar.gz → 0.4.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.

Potentially problematic release.


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

Files changed (170) hide show
  1. {pye57-0.4.4/src/pye57.egg-info → pye57-0.4.5}/PKG-INFO +1 -1
  2. pye57-0.4.5/src/pye57/__version__.py +1 -0
  3. {pye57-0.4.4 → pye57-0.4.5}/src/pye57/libe57_wrapper.cpp +3 -0
  4. pye57-0.4.5/src/pye57/utils.py +117 -0
  5. {pye57-0.4.4 → pye57-0.4.5/src/pye57.egg-info}/PKG-INFO +1 -1
  6. {pye57-0.4.4 → pye57-0.4.5}/tests/test_main.py +117 -0
  7. pye57-0.4.4/src/pye57/__version__.py +0 -1
  8. pye57-0.4.4/src/pye57/utils.py +0 -42
  9. {pye57-0.4.4 → pye57-0.4.5}/LICENSE +0 -0
  10. {pye57-0.4.4 → pye57-0.4.5}/MANIFEST.in +0 -0
  11. {pye57-0.4.4 → pye57-0.4.5}/README.md +0 -0
  12. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/LICENSE-MIT.md +0 -0
  13. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/LICENSE.md +0 -0
  14. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/README.md +0 -0
  15. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/extern/CRCpp/LICENSE +0 -0
  16. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/extern/CRCpp/README.md +0 -0
  17. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/extern/CRCpp/inc/CRC.h +0 -0
  18. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/include/E57Exception.h +0 -0
  19. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/include/E57Format.h +0 -0
  20. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/include/E57SimpleData.h +0 -0
  21. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/include/E57SimpleReader.h +0 -0
  22. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/include/E57SimpleWriter.h +0 -0
  23. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/include/E57Version.h +0 -0
  24. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/ASTMVersion.h +0 -0
  25. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/BlobNode.cpp +0 -0
  26. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/BlobNodeImpl.cpp +0 -0
  27. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/BlobNodeImpl.h +0 -0
  28. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/CheckedFile.cpp +0 -0
  29. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/CheckedFile.h +0 -0
  30. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/Common.cpp +0 -0
  31. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/Common.h +0 -0
  32. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/CompressedVectorNode.cpp +0 -0
  33. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/CompressedVectorNodeImpl.cpp +0 -0
  34. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/CompressedVectorNodeImpl.h +0 -0
  35. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/CompressedVectorReader.cpp +0 -0
  36. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/CompressedVectorReaderImpl.cpp +0 -0
  37. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/CompressedVectorReaderImpl.h +0 -0
  38. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/CompressedVectorWriter.cpp +0 -0
  39. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/CompressedVectorWriterImpl.cpp +0 -0
  40. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/CompressedVectorWriterImpl.h +0 -0
  41. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/DecodeChannel.cpp +0 -0
  42. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/DecodeChannel.h +0 -0
  43. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/Decoder.cpp +0 -0
  44. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/Decoder.h +0 -0
  45. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/E57Exception.cpp +0 -0
  46. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/E57SimpleData.cpp +0 -0
  47. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/E57SimpleReader.cpp +0 -0
  48. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/E57SimpleWriter.cpp +0 -0
  49. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/E57Version.cpp +0 -0
  50. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/E57XmlParser.cpp +0 -0
  51. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/E57XmlParser.h +0 -0
  52. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/Encoder.cpp +0 -0
  53. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/Encoder.h +0 -0
  54. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/FloatNode.cpp +0 -0
  55. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/FloatNodeImpl.cpp +0 -0
  56. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/FloatNodeImpl.h +0 -0
  57. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/ImageFile.cpp +0 -0
  58. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/ImageFileImpl.cpp +0 -0
  59. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/ImageFileImpl.h +0 -0
  60. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/IntegerNode.cpp +0 -0
  61. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/IntegerNodeImpl.cpp +0 -0
  62. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/IntegerNodeImpl.h +0 -0
  63. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/Node.cpp +0 -0
  64. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/NodeImpl.cpp +0 -0
  65. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/NodeImpl.h +0 -0
  66. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/Packet.cpp +0 -0
  67. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/Packet.h +0 -0
  68. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/ReaderImpl.cpp +0 -0
  69. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/ReaderImpl.h +0 -0
  70. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/ScaledIntegerNode.cpp +0 -0
  71. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/ScaledIntegerNodeImpl.cpp +0 -0
  72. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/ScaledIntegerNodeImpl.h +0 -0
  73. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/SectionHeaders.cpp +0 -0
  74. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/SectionHeaders.h +0 -0
  75. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/SourceDestBuffer.cpp +0 -0
  76. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/SourceDestBufferImpl.cpp +0 -0
  77. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/SourceDestBufferImpl.h +0 -0
  78. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/StringFunctions.cpp +0 -0
  79. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/StringFunctions.h +0 -0
  80. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/StringNode.cpp +0 -0
  81. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/StringNodeImpl.cpp +0 -0
  82. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/StringNodeImpl.h +0 -0
  83. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/StructureNode.cpp +0 -0
  84. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/StructureNodeImpl.cpp +0 -0
  85. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/StructureNodeImpl.h +0 -0
  86. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/VectorNode.cpp +0 -0
  87. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/VectorNodeImpl.cpp +0 -0
  88. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/VectorNodeImpl.h +0 -0
  89. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/WriterImpl.cpp +0 -0
  90. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/src/WriterImpl.h +0 -0
  91. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/README.md +0 -0
  92. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/LICENSE +0 -0
  93. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/README.md +0 -0
  94. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/README.md +0 -0
  95. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/docs/README.md +0 -0
  96. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/gmock-actions.h +0 -0
  97. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/gmock-cardinalities.h +0 -0
  98. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/gmock-function-mocker.h +0 -0
  99. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/gmock-matchers.h +0 -0
  100. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/gmock-more-actions.h +0 -0
  101. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/gmock-more-matchers.h +0 -0
  102. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/gmock-nice-strict.h +0 -0
  103. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/gmock-spec-builders.h +0 -0
  104. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/gmock.h +0 -0
  105. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/internal/custom/README.md +0 -0
  106. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +0 -0
  107. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h +0 -0
  108. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/internal/custom/gmock-port.h +0 -0
  109. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h +0 -0
  110. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/internal/gmock-port.h +0 -0
  111. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/include/gmock/internal/gmock-pp.h +0 -0
  112. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/test/gmock-matchers_test.h +0 -0
  113. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googlemock/test/gmock_link_test.h +0 -0
  114. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/README.md +0 -0
  115. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/docs/README.md +0 -0
  116. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest-assertion-result.h +0 -0
  117. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest-death-test.h +0 -0
  118. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest-matchers.h +0 -0
  119. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest-message.h +0 -0
  120. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest-param-test.h +0 -0
  121. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest-printers.h +0 -0
  122. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest-spi.h +0 -0
  123. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest-test-part.h +0 -0
  124. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest-typed-test.h +0 -0
  125. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest.h +0 -0
  126. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest_pred_impl.h +0 -0
  127. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/gtest_prod.h +0 -0
  128. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/custom/README.md +0 -0
  129. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/custom/gtest-port.h +0 -0
  130. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/custom/gtest-printers.h +0 -0
  131. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/custom/gtest.h +0 -0
  132. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h +0 -0
  133. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/gtest-filepath.h +0 -0
  134. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/gtest-internal.h +0 -0
  135. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/gtest-param-util.h +0 -0
  136. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/gtest-port-arch.h +0 -0
  137. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/gtest-port.h +0 -0
  138. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/gtest-string.h +0 -0
  139. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/include/gtest/internal/gtest-type-util.h +0 -0
  140. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/samples/prime_tables.h +0 -0
  141. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/samples/sample1.h +0 -0
  142. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/samples/sample2.h +0 -0
  143. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/samples/sample3-inl.h +0 -0
  144. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/samples/sample4.h +0 -0
  145. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/src/gtest-internal-inl.h +0 -0
  146. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/test/googletest-param-test-test.h +0 -0
  147. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/test/gtest-typed-test_test.h +0 -0
  148. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/extern/googletest/googletest/test/production.h +0 -0
  149. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/include/Helpers.h +0 -0
  150. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/include/RandomNum.h +0 -0
  151. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/include/TestData.h +0 -0
  152. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/src/RandomNum.cpp +0 -0
  153. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/src/TestData.cpp +0 -0
  154. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/src/main.cpp +0 -0
  155. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/src/test_SimpleData.cpp +0 -0
  156. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/src/test_SimpleReader.cpp +0 -0
  157. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/src/test_SimpleWriter.cpp +0 -0
  158. {pye57-0.4.4 → pye57-0.4.5}/libE57Format/test/src/test_StringFunctions.cpp +0 -0
  159. {pye57-0.4.4 → pye57-0.4.5}/pyproject.toml +0 -0
  160. {pye57-0.4.4 → pye57-0.4.5}/setup.cfg +0 -0
  161. {pye57-0.4.4 → pye57-0.4.5}/setup.py +0 -0
  162. {pye57-0.4.4 → pye57-0.4.5}/src/pye57/__init__.py +0 -0
  163. {pye57-0.4.4 → pye57-0.4.5}/src/pye57/e57.py +0 -0
  164. {pye57-0.4.4 → pye57-0.4.5}/src/pye57/exception.py +0 -0
  165. {pye57-0.4.4 → pye57-0.4.5}/src/pye57/scan_header.py +0 -0
  166. {pye57-0.4.4 → pye57-0.4.5}/src/pye57.egg-info/SOURCES.txt +0 -0
  167. {pye57-0.4.4 → pye57-0.4.5}/src/pye57.egg-info/dependency_links.txt +0 -0
  168. {pye57-0.4.4 → pye57-0.4.5}/src/pye57.egg-info/not-zip-safe +0 -0
  169. {pye57-0.4.4 → pye57-0.4.5}/src/pye57.egg-info/requires.txt +0 -0
  170. {pye57-0.4.4 → pye57-0.4.5}/src/pye57.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pye57
3
- Version: 0.4.4
3
+ Version: 0.4.5
4
4
  Summary: Python .e57 files reader/writer
5
5
  Home-page: https://www.github.com/davidcaron/pye57
6
6
  Author: David Caron
@@ -0,0 +1 @@
1
+ __version__ = "0.4.5"
@@ -197,6 +197,9 @@ PYBIND11_MODULE(libe57, m) {
197
197
  cls_StructureNode.def("set", [](StructureNode &node, const std::string &pathName, StringNode &n){
198
198
  node.set(pathName, n);
199
199
  }, "pathName"_a, "n"_a);
200
+ cls_StructureNode.def("set", [](StructureNode &node, const std::string &pathName, BlobNode &n){
201
+ node.set(pathName, n);
202
+ }, "pathName"_a, "n"_a);
200
203
  cls_StructureNode.def(py::init<const e57::Node &>(), "n"_a);
201
204
  cls_StructureNode.def("isRoot", &StructureNode::isRoot);
202
205
  cls_StructureNode.def("parent", &StructureNode::parent);
@@ -0,0 +1,117 @@
1
+ from pye57 import libe57
2
+ from pye57.libe57 import NodeType
3
+
4
+ import numpy as np
5
+
6
+ def get_fields(node):
7
+ return [node.get(id_).elementName() for id_ in range(node.childCount())]
8
+
9
+
10
+ def get_node(node, name):
11
+ cast = {
12
+ NodeType.E57_BLOB: libe57.BlobNode,
13
+ NodeType.E57_COMPRESSED_VECTOR: libe57.CompressedVectorNode,
14
+ NodeType.E57_FLOAT: libe57.FloatNode,
15
+ NodeType.E57_INTEGER: libe57.IntegerNode,
16
+ NodeType.E57_SCALED_INTEGER: libe57.ScaledIntegerNode,
17
+ NodeType.E57_STRING: libe57.StringNode,
18
+ NodeType.E57_STRUCTURE: libe57.StructureNode,
19
+ NodeType.E57_VECTOR: libe57.VectorNode
20
+ }
21
+ n = node.get(name)
22
+ return cast[n.type()](n)
23
+
24
+ def convert_spherical_to_cartesian(rae):
25
+ """
26
+ Converts spherical(rae) to cartesian(xyz), where rae = range, azimuth(theta),
27
+ elevation(phi). Where range is in meters and angles are in radians.
28
+
29
+ Reference for formula: http://www.libe57.org/bestCoordinates.html (Note: the
30
+ formula is different from the one online, so please use formula at the above reference)
31
+ """
32
+ range_ = rae[:, :1]
33
+ theta = rae[:, 1:2]
34
+ phi = rae[:, 2:3]
35
+ range_cos_phi = range_ * np.cos(phi)
36
+ return np.concatenate((
37
+ range_cos_phi * np.cos(theta),
38
+ range_cos_phi * np.sin(theta),
39
+ range_ * np.sin(phi)
40
+ ), axis=1)
41
+
42
+
43
+ def copy_node(node, dest_image):
44
+ compressed_node_pairs = []
45
+ blob_node_pairs = []
46
+
47
+ out_node = None
48
+ # 'Element' Types
49
+ if (isinstance(node, libe57.FloatNode)):
50
+ out_node = libe57.FloatNode(
51
+ dest_image,
52
+ value=node.value(),
53
+ precision=node.precision(),
54
+ minimum=node.minimum(),
55
+ maximum=node.maximum())
56
+
57
+ elif (isinstance(node, libe57.IntegerNode)):
58
+ out_node = libe57.IntegerNode(
59
+ dest_image,
60
+ value=node.value(),
61
+ minimum=node.minimum(),
62
+ maximum=node.maximum())
63
+
64
+ elif (isinstance(node, libe57.ScaledIntegerNode)):
65
+ out_node = libe57.ScaledIntegerNode(
66
+ dest_image,
67
+ node.rawValue(),
68
+ minimum=node.minimum(),
69
+ maximum=node.maximum(),
70
+ scale=node.scale(),
71
+ offset=node.offset())
72
+
73
+ elif (isinstance(node, libe57.StringNode)):
74
+ out_node = libe57.StringNode(
75
+ dest_image,
76
+ node.value())
77
+
78
+ elif (isinstance(node, libe57.BlobNode)):
79
+ out_node = libe57.BlobNode(dest_image, node.byteCount())
80
+ blob_node_pairs.append({ 'in': node, 'out': out_node })
81
+
82
+ # 'Container' Types
83
+ elif (isinstance(node, libe57.CompressedVectorNode)):
84
+ in_prototype = libe57.StructureNode(node.prototype())
85
+ out_prototype, _, _ = copy_node(in_prototype, dest_image)
86
+ out_codecs, _, _ = copy_node(node.codecs(), dest_image)
87
+
88
+ out_node = libe57.CompressedVectorNode(dest_image, out_prototype, out_codecs)
89
+
90
+ compressed_node_pairs.append({
91
+ 'in': node,
92
+ 'out': out_node
93
+ })
94
+
95
+ elif isinstance(node, libe57.StructureNode):
96
+ out_node = libe57.StructureNode(dest_image)
97
+ for i in range(node.childCount()):
98
+ in_child = get_node(node, i)
99
+ in_child_name = in_child.elementName()
100
+ out_child, out_child_compressed_node_pairs, out_child_blob_node_pairs = copy_node(in_child, dest_image)
101
+
102
+ out_node.set(in_child_name, out_child)
103
+ compressed_node_pairs.extend(out_child_compressed_node_pairs)
104
+ blob_node_pairs.extend(out_child_blob_node_pairs)
105
+
106
+ elif isinstance(node, libe57.VectorNode):
107
+ out_node = libe57.VectorNode(dest_image, allowHeteroChildren=node.allowHeteroChildren())
108
+ for i in range(node.childCount()):
109
+ in_child = get_node(node, i)
110
+ in_child_name = f'{i}'
111
+ out_child, out_child_compressed_node_pairs, out_child_blob_node_pairs = copy_node(in_child, dest_image)
112
+
113
+ out_node.append(out_child)
114
+ compressed_node_pairs.extend(out_child_compressed_node_pairs)
115
+ blob_node_pairs.extend(out_child_blob_node_pairs)
116
+
117
+ return out_node, compressed_node_pairs, blob_node_pairs
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pye57
3
- Version: 0.4.4
3
+ Version: 0.4.5
4
4
  Summary: Python .e57 files reader/writer
5
5
  Home-page: https://www.github.com/davidcaron/pye57
6
6
  Author: David Caron
@@ -6,6 +6,7 @@ import numpy as np
6
6
 
7
7
  import pye57
8
8
  from pye57 import libe57
9
+ from pye57.utils import get_node, copy_node
9
10
 
10
11
  try:
11
12
  from exceptions import WindowsError
@@ -37,10 +38,18 @@ def delete_retry(path):
37
38
  def e57_path():
38
39
  return sample_data("test.e57")
39
40
 
41
+
40
42
  @pytest.fixture
41
43
  def e57_spherical_path():
42
44
  return sample_data("testSpherical.e57")
43
45
 
46
+
47
+ @pytest.fixture
48
+ def e57_with_data_and_images_path():
49
+ # From http://www.libe57.org/data.html
50
+ return sample_data("pumpAVisualReferenceImage.e57")
51
+
52
+
44
53
  @pytest.fixture
45
54
  def temp_e57_write(request):
46
55
  path = sample_data("test_write.e57")
@@ -302,3 +311,111 @@ def test_read_color_absent(e57_path):
302
311
  def test_scan_position(e57_path):
303
312
  e57 = pye57.E57(e57_path)
304
313
  assert np.allclose(e57.scan_position(3), np.array([[3.01323456e+05, 5.04260184e+06, 1.56040279e+01]]))
314
+
315
+
316
+ BUFFER_TYPES = {
317
+ libe57.FloatNode: 'd',
318
+ libe57.IntegerNode: 'l',
319
+ libe57.ScaledIntegerNode: 'd'
320
+ }
321
+
322
+
323
+ def make_buffer(node: libe57.Node, capacity: int):
324
+ node_type = type(node)
325
+ if node_type not in BUFFER_TYPES:
326
+ raise ValueError("Unsupported field type!")
327
+
328
+ buffer_type = BUFFER_TYPES[node_type]
329
+
330
+ np_array = np.empty(capacity, buffer_type)
331
+ buffer = libe57.SourceDestBuffer(
332
+ node.destImageFile(), node.elementName(), np_array, capacity, True, True)
333
+ return np_array, buffer
334
+
335
+
336
+ def make_buffers(node: libe57.StructureNode, capacity: int):
337
+ data = {}
338
+ buffers = libe57.VectorSourceDestBuffer()
339
+ for i in range(node.childCount()):
340
+ field = get_node(node, i)
341
+ d, b = make_buffer(field, capacity)
342
+ data[field.elementName()] = d
343
+ buffers.append(b)
344
+ return data, buffers
345
+
346
+
347
+ def copy_compressed_vector_data(in_node: libe57.Node, out_node: libe57.Node):
348
+ chunk_size = 100000
349
+
350
+ in_prototype = libe57.StructureNode(in_node.prototype())
351
+ out_prototype = libe57.StructureNode(out_node.prototype())
352
+
353
+ in_data, in_buffers = make_buffers(in_prototype, chunk_size)
354
+ out_data, out_buffers = make_buffers(out_prototype, chunk_size)
355
+
356
+ in_reader = in_node.reader(in_buffers)
357
+ out_writer = out_node.writer(out_buffers)
358
+
359
+ n_points = in_node.childCount()
360
+ current_index = 0
361
+ while current_index != n_points:
362
+ current_chunk = min(n_points - current_index, chunk_size)
363
+
364
+ in_reader.read()
365
+ for field in in_data:
366
+ out_data[field][:current_chunk] = in_data[field][:current_chunk]
367
+
368
+ out_writer.write(current_chunk)
369
+
370
+ current_index += current_chunk
371
+
372
+ in_reader.close()
373
+ out_writer.close()
374
+
375
+
376
+ def copy_blob_data(in_node, out_node):
377
+ chunk_size = 100000
378
+
379
+ byte_count = in_node.byteCount()
380
+ blob_buffer = np.empty(chunk_size, np.ubyte)
381
+ current_index = 0
382
+ while current_index != byte_count:
383
+ current_chunk = min(byte_count - current_index, chunk_size)
384
+
385
+ in_node.read(blob_buffer, current_index, current_chunk)
386
+ out_node.write(blob_buffer, current_index, current_chunk)
387
+
388
+ current_index += current_chunk
389
+
390
+
391
+ def test_clone_e57(e57_with_data_and_images_path, temp_e57_write):
392
+
393
+ in_image = libe57.ImageFile(e57_with_data_and_images_path, "r")
394
+ out_image = libe57.ImageFile(temp_e57_write, "w")
395
+
396
+ for i in range(in_image.extensionsCount()):
397
+ out_image.extensionsAdd(
398
+ in_image.extensionsPrefix(i),
399
+ in_image.extensionsUri(i)
400
+ )
401
+
402
+ in_root = in_image.root()
403
+ out_root = out_image.root()
404
+
405
+ compressed_node_pairs = []
406
+ for i in range(in_root.childCount()):
407
+ in_child = get_node(in_root, i)
408
+ in_child_name = in_child.elementName()
409
+ out_child, out_child_compressed_node_pairs, out_child_blob_node_pairs = copy_node(in_child, out_image)
410
+
411
+ out_root.set(in_child_name, out_child)
412
+ compressed_node_pairs.extend(out_child_compressed_node_pairs)
413
+
414
+ for compressed_node_pair in compressed_node_pairs:
415
+ copy_compressed_vector_data(compressed_node_pair['in'], compressed_node_pair['out'])
416
+
417
+ for blob_node_pair in out_child_blob_node_pairs:
418
+ copy_blob_data(blob_node_pair['in'], blob_node_pair['out'])
419
+
420
+ in_image.close()
421
+ out_image.close()
@@ -1 +0,0 @@
1
- __version__ = "0.4.4"
@@ -1,42 +0,0 @@
1
- from typing import Type
2
-
3
- from pye57 import libe57
4
- from pye57.libe57 import NodeType
5
-
6
- import numpy as np
7
-
8
- def get_fields(node):
9
- return [node.get(id_).elementName() for id_ in range(node.childCount())]
10
-
11
-
12
- def get_node(node, name):
13
- cast = {
14
- NodeType.E57_BLOB: libe57.BlobNode,
15
- NodeType.E57_COMPRESSED_VECTOR: libe57.CompressedVectorNode,
16
- NodeType.E57_FLOAT: libe57.FloatNode,
17
- NodeType.E57_INTEGER: libe57.IntegerNode,
18
- NodeType.E57_SCALED_INTEGER: libe57.ScaledIntegerNode,
19
- NodeType.E57_STRING: libe57.StringNode,
20
- NodeType.E57_STRUCTURE: libe57.StructureNode,
21
- NodeType.E57_VECTOR: libe57.VectorNode
22
- }
23
- n = node.get(name)
24
- return cast[n.type()](n)
25
-
26
- def convert_spherical_to_cartesian(rae):
27
- """
28
- Converts spherical(rae) to cartesian(xyz), where rae = range, azimuth(theta),
29
- elevation(phi). Where range is in meters and angles are in radians.
30
-
31
- Reference for formula: http://www.libe57.org/bestCoordinates.html (Note: the
32
- formula is different from the one online, so please use formula at the above reference)
33
- """
34
- range_ = rae[:, :1]
35
- theta = rae[:, 1:2]
36
- phi = rae[:, 2:3]
37
- range_cos_phi = range_ * np.cos(phi)
38
- return np.concatenate((
39
- range_cos_phi * np.cos(theta),
40
- range_cos_phi * np.sin(theta),
41
- range_ * np.sin(phi)
42
- ), axis=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
File without changes
File without changes
File without changes
File without changes