blosc2 3.3.3__tar.gz → 3.3.4__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 (257) hide show
  1. {blosc2-3.3.3 → blosc2-3.3.4}/ANNOUNCE.rst +6 -5
  2. {blosc2-3.3.3 → blosc2-3.3.4}/CMakeLists.txt +1 -1
  3. {blosc2-3.3.3 → blosc2-3.3.4}/PKG-INFO +1 -1
  4. {blosc2-3.3.3 → blosc2-3.3.4}/RELEASE_NOTES.md +18 -0
  5. {blosc2-3.3.3 → blosc2-3.3.4}/doc/python-blosc2.rst +1 -1
  6. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/classes.rst +1 -0
  7. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/proxysource.rst +2 -2
  8. blosc2-3.3.4/doc/reference/simpleproxy.rst +30 -0
  9. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/storage.rst +2 -0
  10. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/jit-numpy-funcs.py +1 -1
  11. {blosc2-3.3.3 → blosc2-3.3.4}/pyproject.toml +1 -1
  12. {blosc2-3.3.3 → blosc2-3.3.4}/src/blosc2/blosc2_ext.pyx +27 -2
  13. {blosc2-3.3.3 → blosc2-3.3.4}/src/blosc2/lazyexpr.py +86 -9
  14. {blosc2-3.3.3 → blosc2-3.3.4}/src/blosc2/ndarray.py +5 -4
  15. {blosc2-3.3.3 → blosc2-3.3.4}/src/blosc2/proxy.py +20 -5
  16. {blosc2-3.3.3 → blosc2-3.3.4}/src/blosc2/schunk.py +12 -3
  17. blosc2-3.3.4/src/blosc2/version.py +1 -0
  18. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_lazyexpr.py +28 -8
  19. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_lazyexpr_fields.py +41 -0
  20. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_reductions.py +60 -0
  21. blosc2-3.3.3/src/blosc2/version.py +0 -1
  22. {blosc2-3.3.3 → blosc2-3.3.4}/.gitignore +0 -0
  23. {blosc2-3.3.3 → blosc2-3.3.4}/.guix/modules/python-blosc2-package.scm +0 -0
  24. {blosc2-3.3.3 → blosc2-3.3.4}/.guix-channel +0 -0
  25. {blosc2-3.3.3 → blosc2-3.3.4}/.pre-commit-config.yaml +0 -0
  26. {blosc2-3.3.3 → blosc2-3.3.4}/CONTRIBUTING.rst +0 -0
  27. {blosc2-3.3.3 → blosc2-3.3.4}/LICENSE.txt +0 -0
  28. {blosc2-3.3.3 → blosc2-3.3.4}/README.rst +0 -0
  29. {blosc2-3.3.3 → blosc2-3.3.4}/README_DEVELOPERS.md +0 -0
  30. {blosc2-3.3.3 → blosc2-3.3.4}/RELEASING.rst +0 -0
  31. {blosc2-3.3.3 → blosc2-3.3.4}/code_of_conduct.md +0 -0
  32. {blosc2-3.3.3 → blosc2-3.3.4}/doc/_static/blosc-favicon_32x32.png +0 -0
  33. {blosc2-3.3.3 → blosc2-3.3.4}/doc/_static/blosc-favicon_64x64.png +0 -0
  34. {blosc2-3.3.3 → blosc2-3.3.4}/doc/_static/blosc-logo_128.png +0 -0
  35. {blosc2-3.3.3 → blosc2-3.3.4}/doc/_static/blosc-logo_256.png +0 -0
  36. {blosc2-3.3.3 → blosc2-3.3.4}/doc/_static/css/custom.css +0 -0
  37. {blosc2-3.3.3 → blosc2-3.3.4}/doc/conf.py +0 -0
  38. {blosc2-3.3.3 → blosc2-3.3.4}/doc/development/code-of-conduct.rst +0 -0
  39. {blosc2-3.3.3 → blosc2-3.3.4}/doc/development/contributing.rst +0 -0
  40. {blosc2-3.3.3 → blosc2-3.3.4}/doc/development/index.rst +0 -0
  41. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/index.rst +0 -0
  42. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/installation.rst +0 -0
  43. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/overview.rst +0 -0
  44. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/01.ndarray-basics.ipynb +0 -0
  45. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/02.lazyarray-expressions.ipynb +0 -0
  46. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/03.lazyarray-udf.ipynb +0 -0
  47. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/04.reductions.ipynb +0 -0
  48. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/05.persistent-reductions.ipynb +0 -0
  49. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/06.remote_proxy.ipynb +0 -0
  50. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/07.schunk-basics.ipynb +0 -0
  51. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/08.schunk-slicing_and_beyond.ipynb +0 -0
  52. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/10.ucodecs-ufilters.ipynb +0 -0
  53. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/11.prefilters.ipynb +0 -0
  54. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/12.postfilters.ipynb +0 -0
  55. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/blosc2-pipeline.png +0 -0
  56. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/blosc2-pipeline.svg +0 -0
  57. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/lazyexpr-broadcast.png +0 -0
  58. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/reductions/3D-cube-plane.png +0 -0
  59. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/reductions/3D-cube.png +0 -0
  60. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/reductions/memory-access-2D-x.png +0 -0
  61. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/reductions/memory-access-2D-y.png +0 -0
  62. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/remote_proxy.png +0 -0
  63. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/backward.png +0 -0
  64. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/backward.svg +0 -0
  65. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/decoder.png +0 -0
  66. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/decoder.svg +0 -0
  67. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/decoder2.png +0 -0
  68. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/decoder2.svg +0 -0
  69. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/encoder.png +0 -0
  70. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/encoder.svg +0 -0
  71. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/encoder2.png +0 -0
  72. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/encoder2.svg +0 -0
  73. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/forward.png +0 -0
  74. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials/images/ucodecs-filters/forward.svg +0 -0
  75. {blosc2-3.3.3 → blosc2-3.3.4}/doc/getting_started/tutorials.rst +0 -0
  76. {blosc2-3.3.3 → blosc2-3.3.4}/doc/index.rst +0 -0
  77. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/array_operations.rst +0 -0
  78. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.__getitem__.rst +0 -0
  79. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.__init__.rst +0 -0
  80. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.__len__.rst +0 -0
  81. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.__setitem__.rst +0 -0
  82. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.append_data.rst +0 -0
  83. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.decompress_chunk.rst +0 -0
  84. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.delete_chunk.rst +0 -0
  85. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.fill_special.rst +0 -0
  86. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.filler.rst +0 -0
  87. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.get_chunk.rst +0 -0
  88. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.get_slice.rst +0 -0
  89. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.insert_chunk.rst +0 -0
  90. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.insert_data.rst +0 -0
  91. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.iterchunks.rst +0 -0
  92. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.iterchunks_info.rst +0 -0
  93. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.postfilter.rst +0 -0
  94. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.prefilter.rst +0 -0
  95. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.remove_postfilter.rst +0 -0
  96. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.remove_prefilter.rst +0 -0
  97. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.to_cframe.rst +0 -0
  98. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.update_chunk.rst +0 -0
  99. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.update_data.rst +0 -0
  100. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/c2array.rst +0 -0
  101. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/decorators.rst +0 -0
  102. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/index.rst +0 -0
  103. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/lazy_functions.rst +0 -0
  104. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/lazyarray.rst +0 -0
  105. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/linear_algebra.rst +0 -0
  106. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/low_level.rst +0 -0
  107. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/ndarray.rst +0 -0
  108. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/ndfield.rst +0 -0
  109. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/proxy.rst +0 -0
  110. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/proxyndsource.rst +0 -0
  111. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/reduction_functions.rst +0 -0
  112. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/save_load.rst +0 -0
  113. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/schunk.rst +0 -0
  114. {blosc2-3.3.3 → blosc2-3.3.4}/doc/reference/utilities.rst +0 -0
  115. {blosc2-3.3.3 → blosc2-3.3.4}/doc/release_notes/index.md +0 -0
  116. {blosc2-3.3.3 → blosc2-3.3.4}/examples/btune.py +0 -0
  117. {blosc2-3.3.3 → blosc2-3.3.4}/examples/c2array-get-slice.py +0 -0
  118. {blosc2-3.3.3 → blosc2-3.3.4}/examples/compress2_decompress2.py +0 -0
  119. {blosc2-3.3.3 → blosc2-3.3.4}/examples/compress_decompress.py +0 -0
  120. {blosc2-3.3.3 → blosc2-3.3.4}/examples/filler.py +0 -0
  121. {blosc2-3.3.3 → blosc2-3.3.4}/examples/gil.py +0 -0
  122. {blosc2-3.3.3 → blosc2-3.3.4}/examples/mmap-rw.py +0 -0
  123. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/arange-constructor.py +0 -0
  124. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/asarray_.py +0 -0
  125. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/broadcast_expr.py +0 -0
  126. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/buffer.py +0 -0
  127. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/bytedelta_filter.py +0 -0
  128. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/c2array_expr.py +0 -0
  129. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/compute_expr.py +0 -0
  130. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/compute_fields.py +0 -0
  131. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/compute_udf_numba.py +0 -0
  132. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/compute_where.py +0 -0
  133. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/copy_.py +0 -0
  134. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/empty_.py +0 -0
  135. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/eye-constructor.py +0 -0
  136. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/filter_sort_fields.py +0 -0
  137. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/formats.py +0 -0
  138. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/fromiter-constructor.py +0 -0
  139. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/general_expressions.py +0 -0
  140. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/getitem.py +0 -0
  141. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/iterchunks_info.py +0 -0
  142. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/jit-expr.py +0 -0
  143. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/jit-reduc.py +0 -0
  144. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/linspace-constructor.py +0 -0
  145. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/lists-vs-bools-idx.py +0 -0
  146. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/meta.py +0 -0
  147. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/ndarray_copy.py +0 -0
  148. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/ndmean.py +0 -0
  149. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/persistency.py +0 -0
  150. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/proxy-carray.py +0 -0
  151. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/proxy-ndarray.py +0 -0
  152. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/reduce_and_enlarge.py +0 -0
  153. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/reduce_expr.py +0 -0
  154. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/reduce_expr_save.py +0 -0
  155. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/reduce_string_expr.py +0 -0
  156. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/resize_.py +0 -0
  157. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/work_with_numpy.py +0 -0
  158. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ndarray/zfp_codec.py +0 -0
  159. {blosc2-3.3.3 → blosc2-3.3.4}/examples/pack_array.py +0 -0
  160. {blosc2-3.3.3 → blosc2-3.3.4}/examples/pack_tensor.py +0 -0
  161. {blosc2-3.3.3 → blosc2-3.3.4}/examples/postfilter1.py +0 -0
  162. {blosc2-3.3.3 → blosc2-3.3.4}/examples/postfilter2.py +0 -0
  163. {blosc2-3.3.3 → blosc2-3.3.4}/examples/postfilter3.py +0 -0
  164. {blosc2-3.3.3 → blosc2-3.3.4}/examples/prefilter.py +0 -0
  165. {blosc2-3.3.3 → blosc2-3.3.4}/examples/save_tensor.py +0 -0
  166. {blosc2-3.3.3 → blosc2-3.3.4}/examples/schunk.py +0 -0
  167. {blosc2-3.3.3 → blosc2-3.3.4}/examples/schunk_roundtrip.py +0 -0
  168. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ucodecs.py +0 -0
  169. {blosc2-3.3.3 → blosc2-3.3.4}/examples/ufilters.py +0 -0
  170. {blosc2-3.3.3 → blosc2-3.3.4}/examples/vlmeta.py +0 -0
  171. {blosc2-3.3.3 → blosc2-3.3.4}/generate_version.py +0 -0
  172. {blosc2-3.3.3 → blosc2-3.3.4}/guix.scm +0 -0
  173. {blosc2-3.3.3 → blosc2-3.3.4}/images/Complete-Write-Read-B2ND.png +0 -0
  174. {blosc2-3.3.3 → blosc2-3.3.4}/images/M1-i386-vs-arm64-pack.png +0 -0
  175. {blosc2-3.3.3 → blosc2-3.3.4}/images/M1-i386-vs-arm64-unpack.png +0 -0
  176. {blosc2-3.3.3 → blosc2-3.3.4}/images/Read-Partial-Slices-B2ND.png +0 -0
  177. {blosc2-3.3.3 → blosc2-3.3.4}/images/b2nd-2level-parts.png +0 -0
  178. {blosc2-3.3.3 → blosc2-3.3.4}/images/eval-expr-full-mem-M2.png +0 -0
  179. {blosc2-3.3.3 → blosc2-3.3.4}/images/eval-expr-scarce-mem-M2.png +0 -0
  180. {blosc2-3.3.3 → blosc2-3.3.4}/images/lazyarray-dask-large.png +0 -0
  181. {blosc2-3.3.3 → blosc2-3.3.4}/images/lazyarray-dask-small.png +0 -0
  182. {blosc2-3.3.3 → blosc2-3.3.4}/images/lazyarray-expr-large.png +0 -0
  183. {blosc2-3.3.3 → blosc2-3.3.4}/images/lazyarray-expr.png +0 -0
  184. {blosc2-3.3.3 → blosc2-3.3.4}/images/linspace-compress.png +0 -0
  185. {blosc2-3.3.3 → blosc2-3.3.4}/images/linspace-decompress.png +0 -0
  186. {blosc2-3.3.3 → blosc2-3.3.4}/images/pack-array-cratios.png +0 -0
  187. {blosc2-3.3.3 → blosc2-3.3.4}/images/reduc-float64-amd.png +0 -0
  188. {blosc2-3.3.3 → blosc2-3.3.4}/images/reduc-float64-log-amd.png +0 -0
  189. {blosc2-3.3.3 → blosc2-3.3.4}/pytest.ini +0 -0
  190. {blosc2-3.3.3 → blosc2-3.3.4}/src/blosc2/__init__.py +0 -0
  191. {blosc2-3.3.3 → blosc2-3.3.4}/src/blosc2/c2array.py +0 -0
  192. {blosc2-3.3.3 → blosc2-3.3.4}/src/blosc2/core.py +0 -0
  193. {blosc2-3.3.3 → blosc2-3.3.4}/src/blosc2/helpers.py +0 -0
  194. {blosc2-3.3.3 → blosc2-3.3.4}/src/blosc2/info.py +0 -0
  195. {blosc2-3.3.3 → blosc2-3.3.4}/src/blosc2/storage.py +0 -0
  196. {blosc2-3.3.3 → blosc2-3.3.4}/tests/conftest.py +0 -0
  197. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_auto_parts.py +0 -0
  198. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_buffer.py +0 -0
  199. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_c2array_expr.py +0 -0
  200. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_c2array_reductions.py +0 -0
  201. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_c2array_udf.py +0 -0
  202. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_copy.py +0 -0
  203. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_empty.py +0 -0
  204. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_evaluate.py +0 -0
  205. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_full.py +0 -0
  206. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_get_slice_nchunks.py +0 -0
  207. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_getitem.py +0 -0
  208. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_iterchunks_info.py +0 -0
  209. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_jit.py +0 -0
  210. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_lazyudf.py +0 -0
  211. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_lossy.py +0 -0
  212. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_matmul.py +0 -0
  213. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_metalayers.py +0 -0
  214. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_mode.py +0 -0
  215. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_nans.py +0 -0
  216. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_ndarray.py +0 -0
  217. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_numpy.py +0 -0
  218. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_persistency.py +0 -0
  219. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_proxy.py +0 -0
  220. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_proxy_c2array.py +0 -0
  221. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_proxy_expr.py +0 -0
  222. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_resize.py +0 -0
  223. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_setitem.py +0 -0
  224. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_slice.py +0 -0
  225. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_squeeze.py +0 -0
  226. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_struct_dtype.py +0 -0
  227. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_transpose.py +0 -0
  228. {blosc2-3.3.3 → blosc2-3.3.4}/tests/ndarray/test_zeros.py +0 -0
  229. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_bytes_array.py +0 -0
  230. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_comp_info.py +0 -0
  231. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_compress2.py +0 -0
  232. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_compression_parameters.py +0 -0
  233. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_compressors.py +0 -0
  234. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_decompress.py +0 -0
  235. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_iterchunks.py +0 -0
  236. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_mmap.py +0 -0
  237. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_open.py +0 -0
  238. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_open_c2array.py +0 -0
  239. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_pathlib.py +0 -0
  240. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_postfilters.py +0 -0
  241. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_prefilters.py +0 -0
  242. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_proxy_schunk.py +0 -0
  243. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_python_blosc.py +0 -0
  244. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_schunk.py +0 -0
  245. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_schunk_constructor.py +0 -0
  246. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_schunk_delete.py +0 -0
  247. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_schunk_get_slice.py +0 -0
  248. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_schunk_get_slice_nchunks.py +0 -0
  249. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_schunk_insert.py +0 -0
  250. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_schunk_set_slice.py +0 -0
  251. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_schunk_update.py +0 -0
  252. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_storage.py +0 -0
  253. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_tensor.py +0 -0
  254. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_ucodecs.py +0 -0
  255. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_ufilters.py +0 -0
  256. {blosc2-3.3.3 → blosc2-3.3.4}/tests/test_vlmeta.py +0 -0
  257. {blosc2-3.3.3 → blosc2-3.3.4}/update_version.py +0 -0
@@ -1,10 +1,11 @@
1
- Announcing Python-Blosc2 3.3.3
1
+ Announcing Python-Blosc2 3.3.4
2
2
  ==============================
3
3
 
4
- This is a bugfix release, with some minor optimizations. We improved the
5
- correct chaining of *string* lazy expressions (there is still room for
6
- improvement). Also, a new version of C-Blosc2 (v2.7.2.dev) that fixes
7
- mmap issues on Windows is used; thanks to @JanSellner for the fix.
4
+ This is a bugfix release, with some minor optimizations. We further improved the
5
+ correct chaining of *string* lazy expressions (to allow operands with more
6
+ diverse data types). In addition, both indexing and where expressions are now
7
+ supported within *string* lazy expressions. Finally, casting rules have
8
+ been improved to be more consistent with NumPy.
8
9
 
9
10
  You can think of Python-Blosc2 3.x as an extension of NumPy/numexpr that:
10
11
 
@@ -50,7 +50,7 @@ else()
50
50
  include(FetchContent)
51
51
  FetchContent_Declare(blosc2
52
52
  GIT_REPOSITORY https://github.com/Blosc/c-blosc2
53
- GIT_TAG 3f9c085c0c0f357b140fb5a50d1f8df06de3383a # v2.17.1 + mmap fix
53
+ GIT_TAG 4ef3c7440a85632e6c8b6c5d2a9e651e45569fc1 # v2.17.1 + mmap fix
54
54
  )
55
55
  FetchContent_MakeAvailable(blosc2)
56
56
  include_directories("${blosc2_SOURCE_DIR}/include")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blosc2
3
- Version: 3.3.3
3
+ Version: 3.3.4
4
4
  Summary: A fast & compressed ndarray library with a flexible compute engine.
5
5
  Author-Email: Blosc Development Team <blosc@blosc.org>
6
6
  Maintainer-Email: Blosc Development Team <blosc@blosc.org>
@@ -1,5 +1,23 @@
1
1
  # Release notes
2
2
 
3
+ ## Changes from 3.3.4 to 3.3.5
4
+
5
+ XXX version-specific blurb XXX
6
+
7
+ ## Changes from 3.3.3 to 3.3.4
8
+
9
+ * Expand possibilities for chaining string-based lazy expressions to incorporate
10
+ data types which do not have shape attribute, e.g. int, float etc.
11
+ See #406 and PR #411.
12
+
13
+ * Enable slicing within string-based lazy expressions. See PR #414.
14
+
15
+ * Improved casting for string-based lazy expressions.
16
+
17
+ * Documentation improvements, see PR #410.
18
+
19
+ * Compatibility fixes for working with `h5py` files.
20
+
3
21
  ## Changes from 3.3.2 to 3.3.3
4
22
 
5
23
  * Expand possibilities for chaining string-based lazy expressions to include
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p style="text-align: center; color: black; background-color: rgba(230, 169, 9, 0.65);">
8
8
  <a href="https://github.com/Blosc/python-blosc2/blob/main/RELEASE_NOTES.md"
9
- style="font-size: 1.5em;">Version 3.3.2 released on 2025-05-01!</a>
9
+ style="font-size: 1.5em;">Version 3.3.3 released on 2025-05-14!</a>
10
10
  <span style="display: inline-block; width: 20px;"></span>
11
11
  <span style="font-family: monospace;">pip install blosc2 -U</span>
12
12
  </p>
@@ -12,3 +12,4 @@ Main Classes
12
12
  proxy
13
13
  proxysource
14
14
  proxyndsource
15
+ simpleproxy
@@ -4,8 +4,8 @@ ProxySource
4
4
  ===========
5
5
 
6
6
  Base interface for all supported sources in :ref:`Proxy` and are not NDim objects.
7
- For example, a file, a memory buffer, a network resource, etc. For NDims, see
8
- :ref:`ProxyNDSource`.
7
+ For example, a file, a memory buffer, a network resource, etc. For n-dimemsional
8
+ ones, see :ref:`ProxyNDSource`.
9
9
 
10
10
  .. currentmodule:: blosc2.ProxySource
11
11
 
@@ -0,0 +1,30 @@
1
+ .. _SimpleProxy:
2
+
3
+ SimpleProxy
4
+ ===========
5
+
6
+ Simple proxy for a NumPy array (or similar) that can be used with the Blosc2 compute engine.
7
+
8
+ This only supports the __getitem__ method. No caching is performed.
9
+
10
+ .. currentmodule:: blosc2.SimpleProxy
11
+
12
+ Methods
13
+ -------
14
+
15
+ .. autosummary::
16
+ :toctree: autofiles/simpleproxy
17
+ :nosignatures:
18
+
19
+ __init__
20
+ __getitem__
21
+
22
+ Attributes
23
+ ----------
24
+
25
+ .. autosummary::
26
+ :toctree: autofiles/simpleproxy
27
+
28
+ shape
29
+ dtype
30
+ src
@@ -1,3 +1,5 @@
1
+ .. _CompStorParams:
2
+
1
3
  Compression, decompression and storage parameters
2
4
  =================================================
3
5
 
@@ -18,7 +18,7 @@ import blosc2
18
18
  # Create some sample data
19
19
  a = blosc2.linspace(0, 1, 10 * 100, dtype="float32", shape=(10, 100))
20
20
  b = blosc2.linspace(1, 2, 10 * 100, dtype="float32", shape=(10, 100))
21
- c = blosc2.linspace(-10, 10, 10, dtype="float32", shape=(100,))
21
+ c = blosc2.linspace(-10, 10, 100, dtype="float32", shape=(100,))
22
22
 
23
23
 
24
24
  # Example 1: Basic usage of the jit decorator with reduction
@@ -41,7 +41,7 @@ dependencies = [
41
41
  "py-cpuinfo; platform_machine != 'wasm32'",
42
42
  "requests",
43
43
  ]
44
- version = "3.3.3"
44
+ version = "3.3.4"
45
45
 
46
46
 
47
47
  [project.optional-dependencies]
@@ -2595,8 +2595,33 @@ cdef class NDArray:
2595
2595
 
2596
2596
 
2597
2597
  cdef b2nd_context_t* create_b2nd_context(shape, chunks, blocks, dtype, kwargs):
2598
- # This is used only in constructors, dtype will always have NumPy format
2599
- dtype = np.dtype(dtype)
2598
+ if isinstance(dtype, list) and len(dtype) > 0 and isinstance(dtype[0], tuple):
2599
+ # Extract just the field names and basic dtype info
2600
+ fields = []
2601
+ for field in dtype:
2602
+ name = field[0]
2603
+ field_dtype = field[1]
2604
+
2605
+ # Handle different field formats:
2606
+ # 1. ('name', ('|S10', {'h5py_encoding': 'ascii'})) - h5py style
2607
+ # 2. ('name', '<i4') - standard NumPy style
2608
+ # 3. ('name', '<i4', (shape,)) - NumPy with shape info
2609
+
2610
+ if isinstance(field_dtype, tuple) and len(field_dtype) > 0:
2611
+ # h5py nested representation with metadata dict
2612
+ field_dtype = field_dtype[0]
2613
+
2614
+ # Check if we have shape information as third element
2615
+ if len(field) > 2 and field[2] is not None:
2616
+ # Include the shape information
2617
+ fields.append((name, field_dtype, field[2]))
2618
+ else:
2619
+ fields.append((name, field_dtype))
2620
+
2621
+ dtype = np.dtype(fields)
2622
+ else:
2623
+ dtype = np.dtype(dtype)
2624
+
2600
2625
  typesize = dtype.itemsize
2601
2626
  if 'cparams' in kwargs:
2602
2627
  kwargs['cparams']['typesize'] = typesize
@@ -116,7 +116,7 @@ dtype_symbols = {
116
116
  constructors = ("arange", "linspace", "fromiter", "zeros", "ones", "empty", "full", "frombuffer")
117
117
  # Note that, as reshape is accepted as a method too, it should always come last in the list
118
118
  constructors += ("reshape",)
119
- reducers = ("sum", "prod", "min", "max", "std", "mean", "var", "any", "all")
119
+ reducers = ("sum", "prod", "min", "max", "std", "mean", "var", "any", "all", "slice")
120
120
 
121
121
  functions = [
122
122
  "sin",
@@ -541,7 +541,7 @@ def compute_smaller_slice(larger_shape, smaller_shape, larger_slice):
541
541
 
542
542
  # Define the patterns for validation
543
543
  validation_patterns = [
544
- r"[\;\[\:]", # Flow control characters
544
+ r"[\;]", # Flow control characters
545
545
  r"(^|[^\w])__[\w]+__($|[^\w])", # Dunder methods
546
546
  r"\.\b(?!real|imag|(\d*[eE]?[+-]?\d+)|(\d*[eE]?[+-]?\d+j)|\d*j\b|(sum|prod|min|max|std|mean|var|any|all|where)"
547
547
  r"\s*\([^)]*\)|[a-zA-Z_]\w*\s*\([^)]*\))", # Attribute patterns
@@ -551,7 +551,20 @@ validation_patterns = [
551
551
  _blacklist_re = re.compile("|".join(validation_patterns))
552
552
 
553
553
  # Define valid method names
554
- valid_methods = {"sum", "prod", "min", "max", "std", "mean", "var", "any", "all", "where", "reshape"}
554
+ valid_methods = {
555
+ "sum",
556
+ "prod",
557
+ "min",
558
+ "max",
559
+ "std",
560
+ "mean",
561
+ "var",
562
+ "any",
563
+ "all",
564
+ "where",
565
+ "reshape",
566
+ "slice",
567
+ }
555
568
  valid_methods |= {"int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64"}
556
569
  valid_methods |= {"float32", "float64", "complex64", "complex128"}
557
570
  valid_methods |= {"bool", "str", "bytes"}
@@ -579,7 +592,7 @@ def validate_expr(expr: str) -> None:
579
592
  raise ValueError(f"'{expr}' is not a valid expression.")
580
593
 
581
594
  # Check for invalid characters not covered by the tokenizer
582
- invalid_chars = re.compile(r"[^\w\s+\-*/%().,=<>!&|~^]")
595
+ invalid_chars = re.compile(r"[^\w\s+\-*/%()[].,=<>!&|~^]")
583
596
  if invalid_chars.search(skip_quotes) is not None:
584
597
  invalid_chars = invalid_chars.findall(skip_quotes)
585
598
  raise ValueError(f"Expression {expr} contains invalid characters: {invalid_chars}")
@@ -706,11 +719,13 @@ def conserve_functions( # noqa: C901
706
719
  opname,
707
720
  v,
708
721
  ) in localop.operands.items(): # expression operands already in terms of basic operands
709
- newopname = self.update_func(v)
722
+ # add illegal character ; to track changed operands and not overwrite later
723
+ newopname = ";" + self.update_func(v)
710
724
  newexpr = re.sub(
711
725
  rf"(?<=\s){opname}|(?<=\(){opname}", newopname, newexpr
712
726
  ) # replace with newopname
713
- node.id = newexpr
727
+ # remove all instances of ; as all changes completed
728
+ node.id = newexpr.replace(";", "")
714
729
  else:
715
730
  node.id = self.update_func(localop)
716
731
  else:
@@ -731,6 +746,41 @@ def conserve_functions( # noqa: C901
731
746
  return newexpression, newoperands
732
747
 
733
748
 
749
+ def convert_to_slice(expression):
750
+ """
751
+ Takes expression and converts all instances of [] to .slice(....)
752
+
753
+ Parameters
754
+ ----------
755
+ expression: str
756
+
757
+ Returns
758
+ -------
759
+ new_expr : str
760
+ """
761
+
762
+ new_expr = ""
763
+ skip_to_char = 0
764
+ for i, expr_i in enumerate(expression):
765
+ if i < skip_to_char:
766
+ continue
767
+ if expr_i == "[":
768
+ k = expression[i:].find("]") # start checking from after [
769
+ slice_convert = expression[i : i + k + 1] # include [ and ]
770
+ slicer = eval(f"np.s_{slice_convert}")
771
+ slicer = (slicer,) if not isinstance(slicer, tuple) else slicer # standardise to tuple
772
+ if any(isinstance(el, str) for el in slicer): # handle fields
773
+ raise ValueError("Cannot handle fields for slicing lazy expressions.")
774
+ slicer = str(slicer)
775
+ # use slice so that lazyexpr uses blosc arrays internally
776
+ # (and doesn't decompress according to getitem syntax)
777
+ new_expr += ".slice(" + slicer + ")"
778
+ skip_to_char = i + k + 1
779
+ else:
780
+ new_expr += expr_i
781
+ return new_expr
782
+
783
+
734
784
  class TransformNumpyCalls(ast.NodeTransformer):
735
785
  def __init__(self):
736
786
  self.replacements = {}
@@ -1903,9 +1953,18 @@ def infer_dtype(op, value1, value2):
1903
1953
  if op != "~" and value2.dtype != np.bool_:
1904
1954
  raise ValueError(f"Invalid operand type for {op}: {value2.dtype}")
1905
1955
  return np.dtype(np.bool_)
1906
- dtype1 = value1.dtype if hasattr(value1, "dtype") else np.array(value1).dtype
1907
- dtype2 = value2.dtype if hasattr(value2, "dtype") else np.array(value2).dtype
1908
- return np.result_type(dtype1, dtype2)
1956
+
1957
+ # Follow NumPy rules for scalar-array operations
1958
+ # Create small arrays with the same dtypes and let NumPy's type promotion determine the result type
1959
+ if np.isscalar(value1) and hasattr(value2, "shape"):
1960
+ arr2 = np.array([0], dtype=value2.dtype)
1961
+ return (value1 + arr2).dtype
1962
+ elif np.isscalar(value2) and hasattr(value1, "shape"):
1963
+ arr1 = np.array([0], dtype=value1.dtype)
1964
+ return (arr1 + value2).dtype
1965
+ else:
1966
+ # Both are arrays or both are scalars, use NumPy's type promotion rules
1967
+ return np.result_type(value1, value2)
1909
1968
 
1910
1969
 
1911
1970
  class LazyExpr(LazyArray):
@@ -2091,6 +2150,8 @@ class LazyExpr(LazyArray):
2091
2150
 
2092
2151
  operands = {
2093
2152
  key: np.ones(np.ones(len(value.shape), dtype=int), dtype=value.dtype)
2153
+ if hasattr(value, "shape")
2154
+ else value
2094
2155
  for key, value in self.operands.items()
2095
2156
  }
2096
2157
 
@@ -2532,6 +2593,7 @@ class LazyExpr(LazyArray):
2532
2593
  def _compute_expr(self, item, kwargs): # noqa: C901
2533
2594
  if any(method in self.expression for method in reducers):
2534
2595
  # We have reductions in the expression (probably coming from a string lazyexpr)
2596
+ # Also includes slice
2535
2597
  _globals = get_expr_globals(self.expression)
2536
2598
  lazy_expr = eval(self.expression, _globals, self.operands)
2537
2599
  if not isinstance(lazy_expr, blosc2.LazyExpr):
@@ -2764,6 +2826,7 @@ class LazyExpr(LazyArray):
2764
2826
  def _new_expr(cls, expression, operands, guess, out=None, where=None, ne_args=None):
2765
2827
  # Validate the expression
2766
2828
  validate_expr(expression)
2829
+ expression = convert_to_slice(expression)
2767
2830
  if guess:
2768
2831
  # The expression has been validated, so we can evaluate it
2769
2832
  # in guessing mode to avoid computing reductions
@@ -2784,6 +2847,20 @@ class LazyExpr(LazyArray):
2784
2847
  expression_, operands_ = conserve_functions(
2785
2848
  _expression, _operands, new_expr.operands | local_vars
2786
2849
  )
2850
+ # if new_expr has where_args, must have come from where(...) - or possibly where(where(..
2851
+ # since 5*where, where + ... are evaluated eagerly
2852
+ if hasattr(new_expr, "_where_args"):
2853
+ st = expression_.find("where(") + len(
2854
+ "where("
2855
+ ) # expr always begins where( - should have st = 6 always
2856
+ finalexpr = ""
2857
+ counter = 0
2858
+ for char in expression_[st:]: # get rid of external where(...)
2859
+ finalexpr += char
2860
+ counter += 1 * (char == "(") - 1 * (char == ")")
2861
+ if counter == 0 and char == ",":
2862
+ break
2863
+ expression_ = finalexpr[:-1] # remove trailing comma
2787
2864
  new_expr.expression = f"({expression_})" # force parenthesis
2788
2865
  new_expr.expression_tosave = expression
2789
2866
  new_expr.operands = operands_
@@ -1175,10 +1175,11 @@ class NDArray(blosc2_ext.NDArray, Operand):
1175
1175
  """The decompression parameters used by the array."""
1176
1176
  return self.schunk.dparams
1177
1177
 
1178
- @property
1179
- def storage(self) -> blosc2.Storage:
1180
- """The storage of the array."""
1181
- return self.schunk.storage
1178
+ # TODO: Uncomment when blosc2.Storage is available
1179
+ # @property
1180
+ # def storage(self) -> blosc2.Storage:
1181
+ # """The storage of the array."""
1182
+ # return self.schunk.storage
1182
1183
 
1183
1184
  @property
1184
1185
  def urlpath(self) -> str:
@@ -555,18 +555,33 @@ class SimpleProxy(blosc2.Operand):
555
555
  if not hasattr(src, "shape") or not hasattr(src, "dtype"):
556
556
  # If the source is not a NumPy array, convert it to one
557
557
  src = np.asarray(src)
558
- self.src = src
559
- self.dtype = src.dtype
560
- self.shape = src.shape
558
+ self._src = src
559
+ self._dtype = src.dtype
560
+ self._shape = src.shape
561
561
  # Compute reasonable values for chunks and blocks
562
562
  cparams = blosc2.CParams(clevel=0)
563
563
  self.chunks, self.blocks = blosc2.compute_chunks_blocks(
564
564
  self.shape, chunks, blocks, self.dtype, **{"cparams": cparams}
565
565
  )
566
566
 
567
+ @property
568
+ def src(self):
569
+ """The source object that this proxy wraps."""
570
+ return self._src
571
+
572
+ @property
573
+ def shape(self):
574
+ """The shape of the source array."""
575
+ return self._shape
576
+
577
+ @property
578
+ def dtype(self):
579
+ """The data type of the source array."""
580
+ return self._dtype
581
+
567
582
  def __getitem__(self, item: slice | list[slice]) -> np.ndarray:
568
583
  """
569
- Get a slice as a numpy.ndarray using the :ref:`ProxyNumPy`.
584
+ Get a slice as a numpy.ndarray (via this proxy).
570
585
 
571
586
  Parameters
572
587
  ----------
@@ -577,7 +592,7 @@ class SimpleProxy(blosc2.Operand):
577
592
  out: numpy.ndarray
578
593
  An array with the data slice.
579
594
  """
580
- return self.src[item]
595
+ return self._src[item]
581
596
 
582
597
 
583
598
  def jit(func=None, *, out=None, **kwargs): # noqa: C901
@@ -1441,13 +1441,22 @@ def open(
1441
1441
  The path where the :ref:`SChunk` (or :ref:`NDArray`)
1442
1442
  is stored. If it is a remote array, a :ref:`URLPath` must be passed.
1443
1443
  mode: str, optional
1444
- The open mode.
1444
+ Persistence mode: 'r' means read only (must exist);
1445
+ 'a' means read/write (create if it doesn't exist);
1446
+ 'w' means create (overwrite if it exists). Default is 'a'.
1445
1447
  offset: int, optional
1446
1448
  An offset in the file where super-chunk or array data is located
1447
1449
  (e.g. in a file containing several such objects).
1448
1450
  kwargs: dict, optional
1449
- mmap_mode: The memory mapping mode.
1450
- initial_mapping_size: The initial size of the memory mapping.
1451
+ mmap_mode: str, optional
1452
+ If set, the file will be memory-mapped instead of using the default
1453
+ I/O functions and the `mode` argument will be ignored.
1454
+ For more info, see :class:`blosc2.Storage`. Please note that the `w+` mode, which
1455
+ can be used to create new files, is not supported here since only existing files
1456
+ can be opened. You can use :func:`SChunk.__init__ <blosc2.schunk.SChunk.__init__>`
1457
+ to create new files.
1458
+ initial_mapping_size: int, optional
1459
+ The initial size of the memory mapping. For more info, see :class:`blosc2.Storage`.
1451
1460
  cparams: dict
1452
1461
  A dictionary with the compression parameters, which are the same that can be
1453
1462
  used in the :func:`~blosc2.compress2` function.
@@ -0,0 +1 @@
1
+ __version__ = "3.3.4"
@@ -1364,14 +1364,13 @@ def test_chain_expressions():
1364
1364
  le4_ = blosc2.lazyexpr("(le2 & le3)", {"le2": le2_, "le3": le3_})
1365
1365
  assert (le4_[:] == le4[:]).all()
1366
1366
 
1367
- # TODO: Eventually this test should pass
1368
- # expr1 = blosc2.lazyexpr("arange(N) + b")
1369
- # expr2 = blosc2.lazyexpr("a * b + 1")
1370
- # expr = blosc2.lazyexpr("expr1 - expr2")
1371
- # expr_final = blosc2.lazyexpr("expr * expr")
1372
- # nres = (expr * expr)[:]
1373
- # res = expr_final.compute()
1374
- # np.testing.assert_allclose(res[:], nres)
1367
+ expr1 = blosc2.lazyexpr("arange(N) + b")
1368
+ expr2 = blosc2.lazyexpr("a * b + 1")
1369
+ expr = blosc2.lazyexpr("expr1 - expr2")
1370
+ expr_final = blosc2.lazyexpr("expr * expr")
1371
+ nres = (expr * expr)[:]
1372
+ res = expr_final.compute()
1373
+ np.testing.assert_allclose(res[:], nres)
1375
1374
 
1376
1375
 
1377
1376
  # Test the chaining of multiple persistent lazy expressions
@@ -1403,3 +1402,24 @@ def test_chain_persistentexpressions():
1403
1402
  le4_.save("expr4.b2nd", mode="w")
1404
1403
  myle4 = blosc2.open("expr4.b2nd")
1405
1404
  assert (myle4[:] == le4[:]).all()
1405
+
1406
+
1407
+ @pytest.mark.parametrize(
1408
+ "values",
1409
+ [
1410
+ (np.ones(10, dtype=np.uint16), 2),
1411
+ (np.ones(10, dtype=np.uint16), np.uint32(2)),
1412
+ (2, np.ones(10, dtype=np.uint16)),
1413
+ (np.uint32(2), np.ones(10, dtype=np.uint16)),
1414
+ (np.ones(10, dtype=np.uint16), 2.0),
1415
+ (np.ones(10, dtype=np.float32), 2.0),
1416
+ (np.ones(10, dtype=np.float32), 2.0j),
1417
+ ],
1418
+ )
1419
+ def test_scalar_dtypes(values):
1420
+ value1, value2 = values
1421
+ dtype1 = (value1 + value2).dtype
1422
+ avalue1 = blosc2.asarray(value1) if hasattr(value1, "shape") else value1
1423
+ avalue2 = blosc2.asarray(value2) if hasattr(value2, "shape") else value2
1424
+ dtype2 = (avalue1 * avalue2).dtype
1425
+ assert dtype1 == dtype2, f"Expected {dtype1} but got {dtype2}"
@@ -226,6 +226,47 @@ def test_where(array_fixture):
226
226
  np.testing.assert_allclose(res, nres[sl])
227
227
 
228
228
 
229
+ # Test expressions with where() and string comps
230
+ def test_lazy_where(array_fixture):
231
+ sa1, sa2, nsa1, nsa2, a1, a2, a3, a4, na1, na2, na3, na4 = array_fixture
232
+
233
+ # Test 1: where
234
+ # Test with string expression
235
+ expr = blosc2.lazyexpr("where((a1 ** 2 + a2 ** 2) > (2 * a1 * a2 + 1), 0, a1)")
236
+ # Test with eval
237
+ res = expr.compute()
238
+ nres = ne_evaluate("where(na1**2 + na2**2 > 2 * na1 * na2 + 1, 0, na1)")
239
+ np.testing.assert_allclose(res[:], nres)
240
+ # Test with getitem
241
+ sl = slice(100)
242
+ res = expr[sl]
243
+ np.testing.assert_allclose(res, nres[sl])
244
+
245
+ # Test 2: sum of wheres
246
+ # Test with string expression
247
+ expr = blosc2.lazyexpr("where(a1 < 0, 10, a1) + where(a2 < 0, 3, a2)")
248
+ # Test with eval
249
+ res = expr.compute()
250
+ nres = ne_evaluate("where(na1 < 0, 10, na1) + where(na2 < 0, 3, na2)")
251
+ np.testing.assert_allclose(res[:], nres)
252
+
253
+ # Test 3: nested wheres
254
+ # Test with string expression
255
+ expr = blosc2.lazyexpr("where(where(a2 < 0, 3, a2) > 3, 10, a1)")
256
+ # Test with eval
257
+ res = expr.compute()
258
+ nres = ne_evaluate("where(where(na2 < 0, 3, na2) > 3, 10, na1)")
259
+ np.testing.assert_allclose(res[:], nres)
260
+
261
+ # Test 4: multiplied wheres
262
+ # Test with string expression
263
+ expr = blosc2.lazyexpr("1 * where(a2 < 0, 3, a2)")
264
+ # Test with eval
265
+ res = expr.compute()
266
+ nres = ne_evaluate("1 * where(na2 < 0, 3, na2)")
267
+ np.testing.assert_allclose(res[:], nres)
268
+
269
+
229
270
  # Test where with one parameter
230
271
  def test_where_one_param(array_fixture):
231
272
  sa1, sa2, nsa1, nsa2, a1, a2, a3, a4, na1, na2, na3, na4 = array_fixture
@@ -428,3 +428,63 @@ def test_reduction_index():
428
428
  assert arr[:10].shape == (10,)
429
429
  assert arr[0].shape == (1,)
430
430
  assert arr.shape == newarr.shape
431
+
432
+
433
+ def test_slice_lazy():
434
+ shape = (20, 20)
435
+ a = blosc2.linspace(0, 20, num=np.prod(shape), shape=shape)
436
+ arr = blosc2.lazyexpr("anarr.slice(slice(10,15)) + 1", {"anarr": a})
437
+ newarr = arr.compute()
438
+ np.testing.assert_allclose(newarr[:], a.slice(slice(10, 15))[:] + 1)
439
+
440
+
441
+ def test_slicebrackets_lazy():
442
+ shape = (20, 20)
443
+ a = blosc2.linspace(0, 20, num=np.prod(shape), shape=shape)
444
+ arr = blosc2.lazyexpr("anarr[10:15] + 1", {"anarr": a})
445
+ newarr = arr.compute()
446
+ np.testing.assert_allclose(newarr[:], a[10:15] + 1)
447
+
448
+ # Try with getitem
449
+ a = blosc2.linspace(0, 20, num=np.prod(shape), shape=shape)
450
+ arr = blosc2.lazyexpr("anarr[10:15] + 1", {"anarr": a})
451
+ newarr = arr[:3]
452
+ res = a[10:15] + 1
453
+ np.testing.assert_allclose(newarr, res[:3])
454
+
455
+ # Test other cases
456
+ arr = blosc2.lazyexpr("anarr[10:15, 2:9] + 1", {"anarr": a})
457
+ newarr = arr.compute()
458
+ np.testing.assert_allclose(newarr[:], a[10:15, 2:9] + 1)
459
+
460
+ arr = blosc2.lazyexpr("anarr[10:15][2:9] + 1", {"anarr": a})
461
+ newarr = arr.compute()
462
+ np.testing.assert_allclose(newarr[:], a[10:15][2:9] + 1)
463
+
464
+ arr = blosc2.lazyexpr("anarr[10] + 1", {"anarr": a})
465
+ newarr = arr.compute()
466
+ np.testing.assert_allclose(newarr[:], a[10] + 1)
467
+
468
+ arr = blosc2.lazyexpr("anarr[10, 1] + 1", {"anarr": a})
469
+ newarr = arr[:]
470
+ np.testing.assert_allclose(newarr, a[10, 1] + 1)
471
+
472
+
473
+ def test_reduce_string():
474
+ shape = (10, 10, 2)
475
+
476
+ # Create a NDArray from a NumPy array
477
+ npa = np.linspace(0, 1, np.prod(shape), dtype=np.float32).reshape(shape)
478
+ npb = np.linspace(1, 2, np.prod(shape), dtype=np.float64).reshape(shape)
479
+ npc = npa**2 + npb**2 + 2 * npa * npb + 1
480
+
481
+ a = blosc2.asarray(npa)
482
+ b = blosc2.asarray(npb)
483
+
484
+ # Get a LazyExpr instance
485
+ c = a**2 + b**2 + 2 * a * b + 1
486
+ # Evaluate: output is a NDArray
487
+ d = blosc2.lazyexpr("sl + c.sum() + a.std()", operands={"a": a, "c": c, "sl": a.slice((1, 1))})
488
+ sum = d.compute()[()]
489
+ npsum = npa[1, 1] + np.sum(npc) + np.std(npa)
490
+ assert np.allclose(sum, npsum)
@@ -1 +0,0 @@
1
- __version__ = "3.3.3"
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