packingcubes 0.2.1__tar.gz → 0.2.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.
- {packingcubes-0.2.1 → packingcubes-0.2.3}/CHANGELOG.md +123 -1
- packingcubes-0.2.3/PKG-INFO +361 -0
- packingcubes-0.2.3/README.md +318 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/examples/timing_tests.py +355 -205
- {packingcubes-0.2.1 → packingcubes-0.2.3}/examples/timing_tests.sh +0 -6
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/__init__.py +7 -1
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/bounding_box.py +41 -36
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/cubes.py +299 -79
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/data_objects.py +123 -34
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/packed_tree/kdtree.py +63 -29
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/packed_tree/packed_tree.py +2 -2
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/packed_tree/packed_tree_numba.py +0 -31
- packingcubes-0.2.3/packingcubes.egg-info/PKG-INFO +361 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes.egg-info/SOURCES.txt +1 -0
- packingcubes-0.2.3/packingcubes.egg-info/entry_points.txt +2 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes.egg-info/requires.txt +9 -4
- {packingcubes-0.2.1 → packingcubes-0.2.3}/pixi.lock +515 -56
- {packingcubes-0.2.1 → packingcubes-0.2.3}/pyproject.toml +14 -14
- {packingcubes-0.2.1 → packingcubes-0.2.3}/tests/test_kdtree.py +24 -30
- packingcubes-0.2.1/PKG-INFO +0 -77
- packingcubes-0.2.1/README.md +0 -38
- packingcubes-0.2.1/packingcubes.egg-info/PKG-INFO +0 -77
- {packingcubes-0.2.1 → packingcubes-0.2.3}/.gitattributes +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/.github/dependabot.yml +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/.github/workflows/ci.yml +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/.github/workflows/pypi-publish.yml +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/.github/workflows/ruff.yml +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/.gitignore +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/.gitlint +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/.pre-commit-config.yaml +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/LICENSE +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/cliff.toml +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/doc/example_packed.jpg +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/doc/packed_format.md +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/examples/Basic_Usage.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/examples/Benchmarking.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/examples/Example_PackedTree.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/examples/Profiling.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/configuration.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/octree.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/packed_tree/__init__.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/packed_tree/packed_node.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/packed_tree/packed_tree_meta.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes/tree_vis.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes.egg-info/dependency_links.txt +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/packingcubes.egg-info/top_level.txt +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/setup.cfg +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/tests/conftest.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/tests/test_bounding_box.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/tests/test_data_objects.py +0 -0
- {packingcubes-0.2.1 → packingcubes-0.2.3}/tests/test_octree.py +0 -0
|
@@ -1,4 +1,113 @@
|
|
|
1
|
-
## [
|
|
1
|
+
## [0.2.3] - 2026-03-25
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- Adding loading factor ([29f05af](https://github.com/astrosocket/packingcubes/commit/29f05afd3b16cd9591a0f16d9b147e5b214be124))
|
|
6
|
+
- Allow multiple dfs/sbs and save to file ([c5f0e54](https://github.com/astrosocket/packingcubes/commit/c5f0e5406bccdd18adf4af4be68594ad94369dbd))
|
|
7
|
+
- Allow dataset as argument to KDTree ([944540d](https://github.com/astrosocket/packingcubes/commit/944540d2c61ad0242dd17325aed32a98423db9fa))
|
|
8
|
+
- Add auto thread based default cubes_per_side ([c24f39b](https://github.com/astrosocket/packingcubes/commit/c24f39b016fed12a73b270ff8049ef1793263d11))
|
|
9
|
+
- Expose save_dataset flag, make output optional ([bbbd234](https://github.com/astrosocket/packingcubes/commit/bbbd2346fcd0cc4584842fe3c81dd04df0d94f7b))
|
|
10
|
+
|
|
11
|
+
### 🐛 Bug Fixes
|
|
12
|
+
|
|
13
|
+
- Assuming search_ball_sizes even when none ([1e6a018](https://github.com/astrosocket/packingcubes/commit/1e6a01808acda955b7b7a0fe8769ed562ac22b60))
|
|
14
|
+
|
|
15
|
+
### 🚜 Refactor
|
|
16
|
+
|
|
17
|
+
- Remove empty sidecar file header creation ([668a914](https://github.com/astrosocket/packingcubes/commit/668a914980a6fb1b0a7f0ccef5af5c903c3f379f))
|
|
18
|
+
|
|
19
|
+
### ⚡ Performance
|
|
20
|
+
|
|
21
|
+
- Move cubes reordering into parallel loop ([857295b](https://github.com/astrosocket/packingcubes/commit/857295b25257727f9a199ce42eae9c06dc9a8447))
|
|
22
|
+
- Add unsafe BoundingSphere creation ([af01b30](https://github.com/astrosocket/packingcubes/commit/af01b303608eb3c2d5d5afa55a8dc114103139df))
|
|
23
|
+
- Combine search methods and use single shape creation ([75985e9](https://github.com/astrosocket/packingcubes/commit/75985e99e4d270f69e4dae052360e4d1812f7bb6))
|
|
24
|
+
- Switch to check_overlap ([68edfd6](https://github.com/astrosocket/packingcubes/commit/68edfd6845249aa80fc79965ad4f81c4a20f6dfb))
|
|
25
|
+
- Inline _cubes_position, remove extra calculation ([83b51e7](https://github.com/astrosocket/packingcubes/commit/83b51e7a50ca027d4360d4995938965bd33b668a))
|
|
26
|
+
- Use explicit bounds in box references ([cac5169](https://github.com/astrosocket/packingcubes/commit/cac51691fdf7f61e360e665c59eb15e11d13f8e5))
|
|
27
|
+
|
|
28
|
+
### 🧪 Testing
|
|
29
|
+
|
|
30
|
+
- Number of bugfixes ([fcd5af2](https://github.com/astrosocket/packingcubes/commit/fcd5af21b718367f6e5dbc6cc1fa53f1eebe7e6b))
|
|
31
|
+
- Refactor timing_test to use fewer globals, general improvements ([b1e66b8](https://github.com/astrosocket/packingcubes/commit/b1e66b888644bad32c8de10390876eecca20a12e))
|
|
32
|
+
- Handle error in timing gracefully ([c4df754](https://github.com/astrosocket/packingcubes/commit/c4df7544d08649f49e6e7d5499ab9f2341e4124c))
|
|
33
|
+
- Switch to faster query_ball_point options ([340d8a3](https://github.com/astrosocket/packingcubes/commit/340d8a3d63c907924638662ef8104a4f8c779cbb))
|
|
34
|
+
- Display number of threads if cubes testing ([d55daa8](https://github.com/astrosocket/packingcubes/commit/d55daa8d61462674ea6876ac27828cc013662dc8))
|
|
35
|
+
## [0.2.2.2] - 2026-03-20
|
|
36
|
+
|
|
37
|
+
### ⚙️ Miscellaneous Tasks
|
|
38
|
+
|
|
39
|
+
- Add twine to build group, specify markdown ([#13](https://github.com/astrosocket/packingcubes/issues/13)) ([ed349a5](https://github.com/astrosocket/packingcubes/commit/ed349a51c4fc36099aa09c33d856ed7a63d1ce9f))
|
|
40
|
+
## [0.2.2.1] - 2026-03-20
|
|
41
|
+
|
|
42
|
+
### ⚙️ Miscellaneous Tasks
|
|
43
|
+
|
|
44
|
+
- Add twine to build group, specify markdown ([a33903e](https://github.com/astrosocket/packingcubes/commit/a33903e9f4d228a35046cc7bcef8012aa8f52d2f))
|
|
45
|
+
## [0.2.2] - 2026-03-20
|
|
46
|
+
|
|
47
|
+
### 🚀 Features
|
|
48
|
+
|
|
49
|
+
- Flesh out the readme ([e757b45](https://github.com/astrosocket/packingcubes/commit/e757b4586b2c79fe11e2152f70019a567f367d01))
|
|
50
|
+
- Support passing a regular array to Cubes constructor ([c59097b](https://github.com/astrosocket/packingcubes/commit/c59097b8eb844dda5be5510125b7b4c487e7c54c))
|
|
51
|
+
- Allow loading cubes data from file ([d45b5d7](https://github.com/astrosocket/packingcubes/commit/d45b5d70ee30975a870f75ee6ee348e745fafa37))
|
|
52
|
+
- Allow optional particle type when getting indices ([17084be](https://github.com/astrosocket/packingcubes/commit/17084be15b8d69830f378ce69f4c01e2db05037f))
|
|
53
|
+
- Allow specifying a string or Path when saving cubes ([1674664](https://github.com/astrosocket/packingcubes/commit/1674664e8e41dfe4739b3af796160a8018767ef3))
|
|
54
|
+
- Add CLI option to specify where cubes should be saved ([823d4fe](https://github.com/astrosocket/packingcubes/commit/823d4fe6216e833a5c9b2b4c56aa1bd539302b5f))
|
|
55
|
+
- Support more general BoxLike for cube_box argument ([a4b8545](https://github.com/astrosocket/packingcubes/commit/a4b8545f248dbe67039dda145697fedb6291a9b6))
|
|
56
|
+
- Add flag to save datasets in make_cubes ([5e16e98](https://github.com/astrosocket/packingcubes/commit/5e16e987e47abca74e6a214022920372d14b124b))
|
|
57
|
+
- Add method to save out sorted positions and indices ([cdc9be2](https://github.com/astrosocket/packingcubes/commit/cdc9be26c6fc7d2cb3a6fa8e72cee5968a8939da))
|
|
58
|
+
- Allow 1 & 2D data for KDTrees ([01f2828](https://github.com/astrosocket/packingcubes/commit/01f2828a391baf27f212be04c23ff38fe9200ae3))
|
|
59
|
+
- Expose the InMemory class ([f870ccd](https://github.com/astrosocket/packingcubes/commit/f870ccd970323969efefe3b02c10a9c3ad9b0ab0))
|
|
60
|
+
|
|
61
|
+
### 🐛 Bug Fixes
|
|
62
|
+
|
|
63
|
+
- Remove old view of data when loading new positions ([b8be47c](https://github.com/astrosocket/packingcubes/commit/b8be47cbea55dd0bbeba98eb4478623b62b3ce52))
|
|
64
|
+
|
|
65
|
+
### 💼 Other
|
|
66
|
+
|
|
67
|
+
- Fix argument typing ([c913ffb](https://github.com/astrosocket/packingcubes/commit/c913ffb844ec98bcdc4ceb58737908a0b68a6377))
|
|
68
|
+
- Fix typing complaints from mypy ([4736c03](https://github.com/astrosocket/packingcubes/commit/4736c03b370bc58d29ddf3b1ffa904d285d417ab))
|
|
69
|
+
|
|
70
|
+
### 🚜 Refactor
|
|
71
|
+
|
|
72
|
+
- Remove yt timing ([243d15f](https://github.com/astrosocket/packingcubes/commit/243d15f4d5c3ddb6f3890fbe210d5f393ed6326c))
|
|
73
|
+
- Remove more Dataset-Cubes interdependence ([7778fb7](https://github.com/astrosocket/packingcubes/commit/7778fb770653868a747285f4f479d4aec7e80f05))
|
|
74
|
+
- Remove the cache file for HDF5Datasets ([d33987b](https://github.com/astrosocket/packingcubes/commit/d33987bebc74372def420a116025844aa2e6d3ab))
|
|
75
|
+
- Remove some missed debugging print statements ([24d5ebd](https://github.com/astrosocket/packingcubes/commit/24d5ebd6a51ee39743182f1766beb6eaa25b1b3b))
|
|
76
|
+
|
|
77
|
+
### 📚 Documentation
|
|
78
|
+
|
|
79
|
+
- Add docstring to _get_particle_indices_in_shape ([60b9fac](https://github.com/astrosocket/packingcubes/commit/60b9facd1b904817a8420283070dc8debf0b4db8))
|
|
80
|
+
- Add missing docstring to make_cubes ([59b4be6](https://github.com/astrosocket/packingcubes/commit/59b4be626fe514973d5806341575435216f4aed1))
|
|
81
|
+
- Add _data_container to attribute list ([c087267](https://github.com/astrosocket/packingcubes/commit/c0872671595523642590da3a860b891650b4bcf7))
|
|
82
|
+
|
|
83
|
+
### ⚡ Performance
|
|
84
|
+
|
|
85
|
+
- Skip loading particle data if not actually changing particle_type ([e4476d3](https://github.com/astrosocket/packingcubes/commit/e4476d376f3dde3eb4d6bec1f28987d8e1bff79b))
|
|
86
|
+
|
|
87
|
+
### 🧪 Testing
|
|
88
|
+
|
|
89
|
+
- Allow 1 and 2D arrays for KDTree ([02c53d8](https://github.com/astrosocket/packingcubes/commit/02c53d88d3a3a720de50999430fdaacf2a8f557e))
|
|
90
|
+
## [0.2.1] - 2026-03-19
|
|
91
|
+
|
|
92
|
+
### 🐛 Bug Fixes
|
|
93
|
+
|
|
94
|
+
- Fix typo ([547cd0a](https://github.com/astrosocket/packingcubes/commit/547cd0ad8fbe1390787ada6a2844d530bf3a6051))
|
|
95
|
+
|
|
96
|
+
### ⚙️ Miscellaneous Tasks
|
|
97
|
+
|
|
98
|
+
- Readd pypi publishing ([1d374ab](https://github.com/astrosocket/packingcubes/commit/1d374ab11ea3aad609c8002e4ec54a02b6f9885c))
|
|
99
|
+
- Move scm variable ([9cd97e5](https://github.com/astrosocket/packingcubes/commit/9cd97e5d0eef020d4dbf67b2f4b496bca23f8b35))
|
|
100
|
+
- Attempt testpypi publishing ([47e169c](https://github.com/astrosocket/packingcubes/commit/47e169c7ecbb85e4b618f6bcfd11963c0a215c34))
|
|
101
|
+
- Set fetch-depth, remove local version component ([b071880](https://github.com/astrosocket/packingcubes/commit/b071880f730e591f6be6cc48ac864ae09e00e3bb))
|
|
102
|
+
- Fix version export, add setuptools_scm ([fb4e24b](https://github.com/astrosocket/packingcubes/commit/fb4e24b156ed5e2b1db291819877c77fc6d9b7e9))
|
|
103
|
+
- Print version and turn of upload temporarily ([2993a11](https://github.com/astrosocket/packingcubes/commit/2993a11ebcd944df6b10b58ba48ae46d612309bc))
|
|
104
|
+
- Forgot to add pixi run ([ccf9e5d](https://github.com/astrosocket/packingcubes/commit/ccf9e5d7043885cf106df18e9c2b47a01edd9d84))
|
|
105
|
+
- Switch to pixi install in pypi pipeline ([8a9e35f](https://github.com/astrosocket/packingcubes/commit/8a9e35f541a41e57ec13eedc67fb864071fe1d51))
|
|
106
|
+
- Switch to runtime version checking ([3130d73](https://github.com/astrosocket/packingcubes/commit/3130d7320e808a91b409eebdb2a86ccb992c96d7))
|
|
107
|
+
- Add install step ([a458f0f](https://github.com/astrosocket/packingcubes/commit/a458f0fa0433d5790f406ca29202d867f030e5a2))
|
|
108
|
+
- Update workflow to remove the frozen status and update lockfile ([9a21b96](https://github.com/astrosocket/packingcubes/commit/9a21b966afa59327b9e7ba5dd14264996f449cda))
|
|
109
|
+
- Add verbosity to publishing to help resolve error ([062eb10](https://github.com/astrosocket/packingcubes/commit/062eb10805a33bca1de9f9c5e9983cdd6903619c))
|
|
110
|
+
## [0.2.0] - 2026-03-18
|
|
2
111
|
|
|
3
112
|
### 🚀 Features
|
|
4
113
|
|
|
@@ -44,6 +153,9 @@
|
|
|
44
153
|
|
|
45
154
|
### 🐛 Bug Fixes
|
|
46
155
|
|
|
156
|
+
- Missing character in repository-url ([2e13f53](https://github.com/astrosocket/packingcubes/commit/2e13f53e9b2808e76dfaa4f194d1924a6007c8df))
|
|
157
|
+
- Invert typo in publishing workflow ([35d2815](https://github.com/astrosocket/packingcubes/commit/35d281532a14799e81ef1c6b6061a66d2c9bac81))
|
|
158
|
+
- Fix typo in publishing workflow ([8a99a56](https://github.com/astrosocket/packingcubes/commit/8a99a56c8639e214e2f9eb1683f51843293d63ad))
|
|
47
159
|
- Jitter=0 not being set correctly ([63fce23](https://github.com/astrosocket/packingcubes/commit/63fce233a11b4f58203c7b20bccf25ddad214f63))
|
|
48
160
|
- Used < instead of <= ([4c44186](https://github.com/astrosocket/packingcubes/commit/4c441863d32ff5d3ac05ca1ddfc7569bb700ab9e))
|
|
49
161
|
- Move per node behavior to subfunction ([1da6e20](https://github.com/astrosocket/packingcubes/commit/1da6e20a3d766a3beedf38862ac9e5b2c30778b6))
|
|
@@ -224,6 +336,15 @@
|
|
|
224
336
|
|
|
225
337
|
### ⚙️ Miscellaneous Tasks
|
|
226
338
|
|
|
339
|
+
- Add pypi publishing workflow and fix testpypi workflow ([4410603](https://github.com/astrosocket/packingcubes/commit/4410603ded84e0937f4673ba6b013001a3481e65))
|
|
340
|
+
- Set pydocstyle and fix license file name ([76da9fb](https://github.com/astrosocket/packingcubes/commit/76da9fbb3dfefa1231ab2b4ed54d7383294d053e))
|
|
341
|
+
- Fix extra space in dependabot timing ([#7](https://github.com/astrosocket/packingcubes/issues/7)) ([b2ac0f4](https://github.com/astrosocket/packingcubes/commit/b2ac0f4dbb7cf1bbc312e577f3786caaf6994942))
|
|
342
|
+
- Fix extra space in dependabot timing ([9102209](https://github.com/astrosocket/packingcubes/commit/9102209cd90bf7d9e8074427c6830fb8ec37d530))
|
|
343
|
+
- Switch to frozen install in CI ([1a974f0](https://github.com/astrosocket/packingcubes/commit/1a974f0e59585f506223875cef3bc2672eea7cb8))
|
|
344
|
+
- Update lockfile and jupyter environment ([933886d](https://github.com/astrosocket/packingcubes/commit/933886d166ab12224d3b495f664169549964a837))
|
|
345
|
+
- Update checkout version in workflows ([e9706ac](https://github.com/astrosocket/packingcubes/commit/e9706acdc86c5cea6ef262acc8703df1a69ff2a4))
|
|
346
|
+
- Update pixi version in CI ([8c5ffcf](https://github.com/astrosocket/packingcubes/commit/8c5ffcf4a4b7880b999d7b83bd58a4015f5d5d1d))
|
|
347
|
+
- Add project metadata and pypi release workflow ([ebb04b6](https://github.com/astrosocket/packingcubes/commit/ebb04b61edade29ef545b986b18be1197270e9fc))
|
|
227
348
|
- Add pykdtree for future benchmarking ([6787bdd](https://github.com/astrosocket/packingcubes/commit/6787bdd622c9e236b949645ab9dbbe0b75d2c9e5))
|
|
228
349
|
- Updating lock file ([ceab923](https://github.com/astrosocket/packingcubes/commit/ceab9234bbeb8485af1190508242b30b3b587b79))
|
|
229
350
|
- Remove old CurrentNode comment ([8c3562b](https://github.com/astrosocket/packingcubes/commit/8c3562b0cabf73245866ad6625b4b263d60e6243))
|
|
@@ -316,4 +437,5 @@
|
|
|
316
437
|
|
|
317
438
|
- Add basic .gitlint file ([5c3a2e2](https://github.com/astrosocket/packingcubes/commit/5c3a2e261d21f06afea804f4a81eabd72b8cfad4))
|
|
318
439
|
- Ignore profiler output ([7e302b3](https://github.com/astrosocket/packingcubes/commit/7e302b39745f7ca79257b20f2eb7e44b1cd00b99))
|
|
440
|
+
## [0.0.0] - 2025-10-29
|
|
319
441
|
<!-- generated by git-cliff -->
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: packingcubes
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: PackingCubes octree implementation for astro data
|
|
5
|
+
Author: Michael Ryan
|
|
6
|
+
Author-email: Josh Borrow <josh@joshborrow.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: home, https://github.com/astrosocket/packingcubes
|
|
9
|
+
Project-URL: source, https://github.com/astrosocket/packingcubes
|
|
10
|
+
Project-URL: issues, https://github.com/astrosocket/packingcubes/issues/new
|
|
11
|
+
Keywords: astronomy,astrophysics
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Development Status :: 3 - Alpha
|
|
17
|
+
Classifier: Environment :: Console
|
|
18
|
+
Classifier: Intended Audience :: Science/Research
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
21
|
+
Requires-Python: >=3.12
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: numpy
|
|
25
|
+
Requires-Dist: h5py
|
|
26
|
+
Requires-Dist: numba
|
|
27
|
+
Requires-Dist: xxhash<4,>=3.6.0
|
|
28
|
+
Provides-Extra: viz
|
|
29
|
+
Requires-Dist: matplotlib; extra == "viz"
|
|
30
|
+
Requires-Dist: pygfx; extra == "viz"
|
|
31
|
+
Requires-Dist: rendercanvas; extra == "viz"
|
|
32
|
+
Requires-Dist: pyside6; extra == "viz"
|
|
33
|
+
Provides-Extra: jupyter
|
|
34
|
+
Requires-Dist: jupyter-rfb; extra == "jupyter"
|
|
35
|
+
Provides-Extra: benchmark
|
|
36
|
+
Requires-Dist: scipy; extra == "benchmark"
|
|
37
|
+
Requires-Dist: unyt; extra == "benchmark"
|
|
38
|
+
Provides-Extra: all
|
|
39
|
+
Requires-Dist: packingcubes[viz]; extra == "all"
|
|
40
|
+
Requires-Dist: packingcubes[jupyter]; extra == "all"
|
|
41
|
+
Requires-Dist: packingcubes[benchmark]; extra == "all"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# packingcubes
|
|
45
|
+
|
|
46
|
+
[](https://pypi.org/project/packingcubes)
|
|
47
|
+
[](https://pypi.org/project/packingcubes/)
|
|
48
|
+
|
|
49
|
+
<!--- Tests and style --->
|
|
50
|
+
[](https://hypothesis.readthedocs.io/)
|
|
51
|
+
[](https://github.com/charliermarsh/ruff)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
Compact octree implementation used for Socket
|
|
55
|
+
|
|
56
|
+
`packingcubes` aims to provide a fast, minimal-memory-usage octree
|
|
57
|
+
implementation, specialized for use in astronomical/astrophysical contexts.
|
|
58
|
+
It's written in pure python, with [Numba](https://numba.pydata.org/)-based
|
|
59
|
+
acceleration of the critical code paths.
|
|
60
|
+
|
|
61
|
+
## Requirements
|
|
62
|
+
[](https://pypi.org/project/packingcubes/)
|
|
63
|
+
is required. Python versions outside this range may work, but their usage is
|
|
64
|
+
not supported, and at least some features are >Python 3.12.
|
|
65
|
+
|
|
66
|
+
### Python packages
|
|
67
|
+
* `numpy` - required for core routines
|
|
68
|
+
* `numba` - required for core routines (and most of the speed)
|
|
69
|
+
* `h5py` - required for reading snapshot data and saving `Cubes` and
|
|
70
|
+
`PackedTree`s
|
|
71
|
+
* `xxhash` - required for core routines (packed metadata format)
|
|
72
|
+
|
|
73
|
+
### Optional packages
|
|
74
|
+
Visualization (the `viz` group):
|
|
75
|
+
* `matplotlib` - to use basic octree visualization and plotting (see
|
|
76
|
+
Basic_Usage in the Examples)
|
|
77
|
+
* `pygfx` - to do interactive octree visualization (see Example_PackedTree in
|
|
78
|
+
the Examples)
|
|
79
|
+
* `rendercanvas` - to do interactive octree visualization
|
|
80
|
+
* `pyside6` - performant interactive octree visualization (uses Qt, other
|
|
81
|
+
options include `wgpu-py`, `pyodide`. See the
|
|
82
|
+
[rendercanvas backends](https://rendercanvas.readthedocs.io/stable/backends.html)
|
|
83
|
+
documentation for more details
|
|
84
|
+
|
|
85
|
+
Jupyter (the `jupyter` group):
|
|
86
|
+
* `jupyter-rfb` - for interactive octree visualization in a notebook (see the Visualization section, above)
|
|
87
|
+
|
|
88
|
+
Benchmark (the `benchmark` group):
|
|
89
|
+
* `scipy` - we benchmark against `scipy`'s `KDTree`
|
|
90
|
+
* `unyt` - for unit-aware timing purposes
|
|
91
|
+
|
|
92
|
+
The `all` group combines all of the above.
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
### Installation
|
|
96
|
+
We're on [PyPI](https://pypi.org/project/packingcubes), so installation is as
|
|
97
|
+
simple as
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
pip install packingcubes
|
|
101
|
+
```
|
|
102
|
+
or
|
|
103
|
+
```sh
|
|
104
|
+
uv pip install packingcubes
|
|
105
|
+
```
|
|
106
|
+
or
|
|
107
|
+
```sh
|
|
108
|
+
pixi add packingcubes --pypi
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Additional package requirements can be installed via optional dependencies (see
|
|
112
|
+
the requirements section for the lists). Examples:
|
|
113
|
+
```sh
|
|
114
|
+
pip install "packingcubes[viz, jupyter]"
|
|
115
|
+
```
|
|
116
|
+
or
|
|
117
|
+
```sh
|
|
118
|
+
pixi add packingcubes[all] --pypi
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Construction
|
|
123
|
+
#### From a snapshot on disk
|
|
124
|
+
From the command line:
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
packcubes SNAPSHOT OUTPUT
|
|
128
|
+
```
|
|
129
|
+
will generate a `Cubes` data structure and store it in the `OUTPUT` hdf5 file
|
|
130
|
+
along with the sorted positions and shuffle-list.
|
|
131
|
+
|
|
132
|
+
Alternatively:
|
|
133
|
+
```python
|
|
134
|
+
import packingcubes
|
|
135
|
+
|
|
136
|
+
cubes = packingcubes.Cubes("path/to/snapshot.hdf5")
|
|
137
|
+
|
|
138
|
+
cubes.save("path/to/output.hdf5")
|
|
139
|
+
# sorted positions/indices are stored in .snapshot_sorted.hdf5 by default
|
|
140
|
+
|
|
141
|
+
# to save elsewhere, use
|
|
142
|
+
dataset = packingcubes.HDF5Dataset(
|
|
143
|
+
"path/to/snapshot.hdf5", sorted_filepath="path/to/output.hdf5"
|
|
144
|
+
)
|
|
145
|
+
cubes = packingcubes.Cubes(dataset)
|
|
146
|
+
|
|
147
|
+
# if you already have positions_data as an Nx3 matrix, you can use
|
|
148
|
+
cubes = packingcubes.Cubes(positions_data)
|
|
149
|
+
# Note: this data will be sorted in place! you may want to make a copy
|
|
150
|
+
|
|
151
|
+
# You can also do the following for easy saving.
|
|
152
|
+
# The data will still not be copied (by default)
|
|
153
|
+
dataset = packingcubes.InMemory(positions=positions_data)
|
|
154
|
+
cubes = packingcubes.Cubes(dataset)
|
|
155
|
+
dataset.save("path/to/output.hdf5")
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Several configuration options are available, see `packcubes --help` or `help(packingcubes.Cubes)` for more information.
|
|
159
|
+
|
|
160
|
+
You can load the saved Cubes with
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
import packingcubes
|
|
164
|
+
|
|
165
|
+
cubes = packingcubes.Cubes("path/to/saved_cubes.hdf5")
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Searching
|
|
169
|
+
Currently, `packingcubes` provides two public methods for searching your
|
|
170
|
+
dataset:
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
# particle_types is a string or Sequence[str] that maps to a particle type in
|
|
174
|
+
# the snapshot
|
|
175
|
+
# center is anything that can be converted by numpy's array method to an (3,)
|
|
176
|
+
# array, and is the sphere's center
|
|
177
|
+
# radius is a float
|
|
178
|
+
indices_dict = cubes.get_indices_in_sphere(particle_types, center, radius)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
# particle_types is a string or Sequence[str] that maps to a particle type in
|
|
183
|
+
# the snapshot
|
|
184
|
+
# box is anything that can be converted by numpy's array method to an (6,)
|
|
185
|
+
# float array where the first 3 elements are the front-left-bottom corner,
|
|
186
|
+
# and the second 3 elements are the box width, depth, and height
|
|
187
|
+
# (aka [x, y, z, dx, dy, dz])
|
|
188
|
+
indices_dict = cubes.get_indices_in_box(particle_types, box)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
For both methods, the returned object is a dictionary of `particle_type` keys
|
|
192
|
+
mapped to lists of (start, stop) tuples, representing the start and stop
|
|
193
|
+
indices of contiguous tuples in the **sorted** dataset.
|
|
194
|
+
|
|
195
|
+
So the search pipeline might go something like:
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
# cubes are associated with HDF5Dataset dataset created from orig_dataset
|
|
199
|
+
# which is an h5py File object
|
|
200
|
+
indices_dict = cubes.get_indices_in_sphere(
|
|
201
|
+
center, radius, particle_types=["PartType0", "Black_Holes"]
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
velocities_list = []
|
|
205
|
+
with h5py.File(orig_dataset_file) as orig_dataset:
|
|
206
|
+
for start,stop in indices_dict["PartType0"]:
|
|
207
|
+
shuffle = dataset.index[start:stop]
|
|
208
|
+
# WARNING: the following could be very slow if shuffle gets
|
|
209
|
+
# large (>10000)
|
|
210
|
+
v = orig_dataset["PartType0/Velocity"][shuffle,:]
|
|
211
|
+
velocities_list.extend(v)
|
|
212
|
+
|
|
213
|
+
velocities = np.fromiter(velocities_list)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Warning**: this could become slow if the `shuffle` sections get big
|
|
217
|
+
(`len(shuffle)>1000`)! This is because HDF5 loading is inefficient in this
|
|
218
|
+
manner (the `v =` line), not because of the search (the `indices_dict =`
|
|
219
|
+
and `shuffle =` lines).
|
|
220
|
+
|
|
221
|
+
The sorting is already performed for the positions information (it was
|
|
222
|
+
necessary to construct the tree), but `packingcubes` does not apply the sort to
|
|
223
|
+
the other fields in the snapshot.
|
|
224
|
+
|
|
225
|
+
So if you only need positional information,
|
|
226
|
+
```python
|
|
227
|
+
indices_dict = cubes.get_indices_in_sphere(center, radius)
|
|
228
|
+
|
|
229
|
+
positions_list = []
|
|
230
|
+
# We don't need to open the orig_dataset file
|
|
231
|
+
dataset.particle_type = "PartType0"
|
|
232
|
+
for start,stop in indices_dict["PartType0"]:
|
|
233
|
+
positions_list.extend(dataset.positions[start:stop])
|
|
234
|
+
|
|
235
|
+
positions = np.fromiter(positions_list)
|
|
236
|
+
```
|
|
237
|
+
should be very fast.
|
|
238
|
+
|
|
239
|
+
If you need a different field, (like the `velocities`, as above), we recommend
|
|
240
|
+
preloading the entire velocities array, using the shuffle list to presort it,
|
|
241
|
+
and then treating it analogously to the `dataset.positions` field or saving it
|
|
242
|
+
back out:
|
|
243
|
+
```python
|
|
244
|
+
indices_dict = cubes.get_indices_in_sphere(center, radius)
|
|
245
|
+
indices = indices_dict["PartType0"]
|
|
246
|
+
|
|
247
|
+
with h5py.File(orig_dataset_path) as orig_dataset:
|
|
248
|
+
loaded_velocities = orig_dataset["PartType0/velocity"]
|
|
249
|
+
# Just to make sure we're looking at the correct particle type
|
|
250
|
+
dataset.particle_type = "PartType0"
|
|
251
|
+
loaded_velocities = loaded_velocities[dataset.index,:]
|
|
252
|
+
|
|
253
|
+
# use directly
|
|
254
|
+
velocities_list = []
|
|
255
|
+
for start,stop in indices:
|
|
256
|
+
velocities_list.extend(loaded_velocities[start:stop])
|
|
257
|
+
|
|
258
|
+
# or save it back out
|
|
259
|
+
with h5py.File(sorted_velocity_path, "a") as outfile:
|
|
260
|
+
outfile["PartType0/velocity"] = loaded_velocities
|
|
261
|
+
...
|
|
262
|
+
velocities_list = []
|
|
263
|
+
with h5py.File(sorted_velocity_path) as vel_dataset:
|
|
264
|
+
for start, stop in indices:
|
|
265
|
+
velocities_list.extend(
|
|
266
|
+
vel_dataset["PartType0/velocity"][start:stop, :]
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
velocities = np.fromiter(velocities_list)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
If this seems like a hassle, consider the [GUSTEAU](https://www.github.com/astrosocket/gusteau)
|
|
274
|
+
project, which among many other improvements, will do all of this additional
|
|
275
|
+
field sorting (and the original cubing) for you!
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
### KDTree
|
|
279
|
+
We have also reimplemented some of the API from the `KDTree` in `scipy.spatial`,
|
|
280
|
+
notably the `query_ball_point` method (This is also what the benchmarks compare
|
|
281
|
+
against). Example usage modified from the `scipy.spatial.KDTree` [documentation](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.KDTree.query_ball_point.html):
|
|
282
|
+
```python
|
|
283
|
+
>>> import numpy as np
|
|
284
|
+
>>> from packingcubes import KDTree # this is the only change you need to make
|
|
285
|
+
>>> x, y = np.mgrid[0:5, 0:5]
|
|
286
|
+
>>> points = np.c_[x.ravel(), y.ravel()]
|
|
287
|
+
>>> tree = KDTree(points)
|
|
288
|
+
>>> sorted(tree.query_ball_point([2, 0], 1))
|
|
289
|
+
[5, 10, 11, 15]
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
#### Caveats:
|
|
293
|
+
* The provided dataset may be sorted in-place. See the `KDTree` constructor's
|
|
294
|
+
`data` and `copy_data` arguments for more information on when that occurs.
|
|
295
|
+
* Only `query`, `query_ball_point`, and `query_ball_tree` are fully supported.
|
|
296
|
+
`query_pairs` and `count_neighbors` are a work in progress (`query_pairs` may
|
|
297
|
+
not provide completely correct output, `count_neighbors` does not yet have
|
|
298
|
+
the `KDTree` API portion implemented and may not be correct).
|
|
299
|
+
`sparse_distance_matrix` is not planned. Both `count_neighbors` and
|
|
300
|
+
`sparse_distance_matrix` will raise `NotImplementedErrors`.
|
|
301
|
+
* Only `query_ball_point` has been benchmarked and is guaranteed to be
|
|
302
|
+
performant. We are currently working on `query`'s performance, but will not
|
|
303
|
+
plan on beating `scipy`.
|
|
304
|
+
* A number of optional constructor and method arguments are not supported (for
|
|
305
|
+
example, setting the distance metric `p` to a number other than 2). Some of
|
|
306
|
+
these may be supported in the future (like `p=3`), others will not (like
|
|
307
|
+
`balanced_tree`). For the most part, we emit warnings if an argument or its
|
|
308
|
+
value does not make sense in the `packingcubes` context and try to only raise
|
|
309
|
+
errors if there is no possible analog and/or a significant change in behavior.
|
|
310
|
+
* Only 1, 2, and 3D data is supported. PackedTrees specifically expect 3D data
|
|
311
|
+
(since it's an octree implementation), thus 1 and 2D data will be copied and
|
|
312
|
+
padded with 0s (e.g. `[[1, 2], [3, 4]]` will become `[[1, 2, 0], [3, 4, 0]]`
|
|
313
|
+
). This should not signficantly impact memory usage (beyond the copy) and the
|
|
314
|
+
PackedTree should just function as a binary or quadtree.
|
|
315
|
+
* For performance reasons, some of the `packingcube` default output formats may
|
|
316
|
+
not match the `scipy` output formats (`array`s instead of `list`s, for
|
|
317
|
+
example). For those methods where that's a possibility, additional arguments
|
|
318
|
+
can be provided which will enforce the the "proper" format (e.g. by setting
|
|
319
|
+
`return_lists=True`) at a small performance penalty.
|
|
320
|
+
* Likewise for performance reasons, some of the the default `packingcube`
|
|
321
|
+
output indices will be in terms of the sorted dataset (remember, the dataset
|
|
322
|
+
will be sorted in-place unless specified otherwise). For those methods, you
|
|
323
|
+
may be able to specify `return_data_inds=False` to get indices into the
|
|
324
|
+
unsorted dataset. Alternatively, reference the `sort_index` property.
|
|
325
|
+
|
|
326
|
+
## Development requirements
|
|
327
|
+
### uv
|
|
328
|
+
To get ready for development, create a virtual enviroment and install the
|
|
329
|
+
package:
|
|
330
|
+
```
|
|
331
|
+
uv venv --python=3.12
|
|
332
|
+
source .venv/bin/activate
|
|
333
|
+
uv pip install -e ".[dev]"
|
|
334
|
+
pre-commit install
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
We use ruff for formatting. When you go to commit your code, it will
|
|
338
|
+
automatically be formatted thanks to the pre-commit hook.
|
|
339
|
+
|
|
340
|
+
Tests are performed using pytest.
|
|
341
|
+
### pixi
|
|
342
|
+
Using with pixi is pretty easy, simply
|
|
343
|
+
```sh
|
|
344
|
+
pixi shell
|
|
345
|
+
```
|
|
346
|
+
To look at visualizations, run tests, or develop, simply specify the
|
|
347
|
+
corresponding environment
|
|
348
|
+
```sh
|
|
349
|
+
# visualizations
|
|
350
|
+
pixi shell -e viz
|
|
351
|
+
# testing (also includes viz)
|
|
352
|
+
pixi shell -e test
|
|
353
|
+
# developing (also includes viz & test)
|
|
354
|
+
pixi shell -e dev
|
|
355
|
+
pre-commit install
|
|
356
|
+
```
|
|
357
|
+
and e.g. to run tests, say
|
|
358
|
+
```sh
|
|
359
|
+
pixi run test
|
|
360
|
+
```
|
|
361
|
+
which runs `pytest --cov=packingcubes` in the `dev` environment.
|