diffusion-cartogram 0.2.0__tar.gz → 0.2.2__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 (23) hide show
  1. diffusion_cartogram-0.2.2/CHANGELOG.md +80 -0
  2. diffusion_cartogram-0.2.2/MANIFEST.in +23 -0
  3. {diffusion_cartogram-0.2.0/diffusion_cartogram.egg-info → diffusion_cartogram-0.2.2}/PKG-INFO +22 -2
  4. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/README.md +2 -2
  5. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/diffusion_cartogram/__init__.py +9 -3
  6. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/diffusion_cartogram/core.py +394 -54
  7. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/diffusion_cartogram/core_2d.py +160 -0
  8. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/diffusion_cartogram/visualization.py +8 -5
  9. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2/diffusion_cartogram.egg-info}/PKG-INFO +22 -2
  10. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/diffusion_cartogram.egg-info/SOURCES.txt +3 -6
  11. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/pyproject.toml +2 -2
  12. diffusion_cartogram-0.2.0/tests/test_core.py +0 -374
  13. diffusion_cartogram-0.2.0/tests/test_core_2d.py +0 -372
  14. diffusion_cartogram-0.2.0/tests/test_interpolation.py +0 -70
  15. diffusion_cartogram-0.2.0/tests/test_io.py +0 -160
  16. diffusion_cartogram-0.2.0/tests/test_vizualization.py +0 -214
  17. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/LICENSE +0 -0
  18. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/README_pypi.md +0 -0
  19. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/diffusion_cartogram/visualization_2d.py +0 -0
  20. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/diffusion_cartogram.egg-info/dependency_links.txt +0 -0
  21. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/diffusion_cartogram.egg-info/requires.txt +0 -0
  22. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/diffusion_cartogram.egg-info/top_level.txt +0 -0
  23. {diffusion_cartogram-0.2.0 → diffusion_cartogram-0.2.2}/setup.cfg +0 -0
@@ -0,0 +1,80 @@
1
+ # Changelog
2
+
3
+ ## [0.2.2] - 2026-08-31
4
+
5
+ ### New: Additional reconstruction options
6
+
7
+ - **Added** `load_mesh_topology(mesh_path)`: loads a mesh's own vertices,
8
+ faces, and per-vertex normals with **no resampling**. This is the new
9
+ default entry point for the deformation pipeline (replaces `create_pcd` as
10
+ the "get me surface points" call for most users; `create_pcd` still exists
11
+ unchanged for anyone who wants a lighter/resampled point cloud, or as the
12
+ Poisson fallback's input).
13
+ - **Modified** `export_mesh_file(filename, deformed_pcd, ...)`:
14
+ - New parameters: `method='none'` (new default), `original_faces=None`.
15
+ - `method='none'`: requires `original_faces`; if given, saves
16
+ `(deformed_pcd, original_faces)` directly via
17
+ `pymeshlab.Mesh(vertex_matrix=..., face_matrix=...)` -- no reconstruction.
18
+ - If `method='none'` but `original_faces` is `None`: emits a
19
+ `RuntimeWarning` and **falls back to `method='poisson'`** (the prior,
20
+ only, behavior) automatically.
21
+ - `method='poisson'`: unchanged prior behavior (screened Poisson
22
+ reconstruction with estimated normals), reachable explicitly or via the
23
+ automatic fallback above.
24
+ - Added `method='ball_pivoting'` and `method='alpha_shape'` alongside `'none'`/ `'poisson'`. New parameters, all with defaults matching pymeshlab's own except `alpha_filtering`. `ball_radius=0.0` (0% = auto-estimated), `ball_clustering=20.0`, `ball_creasethr=90.0`, `ball_deletefaces=False`, `alpha=1.0`, `alpha_filtering='Alpha Shape'` (pymeshlab's own filter default is `'Alpha Complex'`, deliberately overridden -- `'Alpha Complex'` retains interior simplicial-complex faces, not just the outer boundary).
25
+ - Backward compatible: existing callers that only ever passed
26
+ `(filename, deformed_pcd)` keep working exactly as before, just now with
27
+ a printed warning nudging them toward the no-reconstruction path.
28
+
29
+
30
+ ## [0.2.1] - 2026-07-31
31
+
32
+ ### New: Post hoc animation
33
+ - **`animate_surface_posthoc`** - Interpolate the final displacement field and densities to create an animation for display purposes. Faster than running with tracking but not guaranteed to be accurate at intermediate steps
34
+ - **`animate_map_posthoc`** - Same function implemented for 2D maps
35
+
36
+ ## [0.2.0] - 2026-04-29
37
+
38
+ ### New: 2D VDERM Pipeline
39
+
40
+ - **`VDERMGrid2D`** — 2-D Lagrangian-Eulerian grid; same physics as `VDERMGrid` (diffusion + gradient advection) with one dimension removed. Compatible with the existing `run_VDERM()` function.
41
+ - **`run_VDERM_2d_with_tracking()`** — tracking run with grid and map-point exports (CSV format: `x y v_x v_y rho` for grid, `x y rho` for map points).
42
+ - **`make_initial_grid_2d()`** / **`compute_grid_dimensions_2d()`** / **`print_grid_info_2d()`** — 2-D grid utilities mirroring the 3-D equivalents.
43
+ - **`interpolate_to_map_2d()`** / **`interpolate_densities_2d()`** / **`interpolate_velocities_2d()`** — 2-D interpolation from grid to arbitrary point sets.
44
+
45
+ ### New: Geographic I/O (`pip install diffusion-cartogram[2D]`)
46
+
47
+ - **`read_geojson(filepath)`** — extract 2-D point array from GeoJSON (polygon boundaries, point features, line features).
48
+ - **`read_shapefile(filepath)`** — same for Shapefiles.
49
+ - **`read_geotiff(filepath, band=1)`** — read a raster band plus coordinate arrays.
50
+ - **`density_from_geotiff(grid_2d, filepath)`** — sample a GeoTIFF raster onto a `VDERMGrid2D` density field with bilinear interpolation; handles north-up rasters and nodata automatically.
51
+ - **`write_csv_2d()`** / **`read_csv_2d()`** — simple 2-column / 3-column CSV I/O for 2-D point sets.
52
+
53
+ ### New: 2D Visualization
54
+
55
+ - **`plot_map_2d()`** — scatter plot of 2-D points with optional density colouring.
56
+ - **`plot_density_field_2d()`** — heatmap of the `VDERMGrid2D` density field.
57
+ - **`plot_map_before_after()`** — side-by-side comparison of original and deformed map.
58
+ - **`animate_map_deformation_2d()`** — GIF / MP4 animation from `vderm_map/` CSV exports.
59
+ - **`animate_grid_deformation_2d()`** — GIF / MP4 animation from `vderm_grid/` CSV exports.
60
+ - **`plot_density_evolution_2d()`** — density statistics over iterations.
61
+
62
+ ### Packaging
63
+
64
+ - Version bumped to **0.2.0**.
65
+ - New optional dependency group **`[2D]`**: geopandas, rasterio, shapely.
66
+ - New optional dependency group **`[3D]`**: pymeshlab.
67
+ - New optional dependency group **`[all]`**: `[2D]` + `[3D]`.
68
+ - `pyproject.toml` now points `readme` at `README_pypi.md` (no embedded GIF) for PyPI; `README.md` remains the full GitHub README.
69
+
70
+ ## [0.1.0] - 2026-02-09
71
+
72
+ ### Initial Release
73
+
74
+ - Core VDERM algorithm implementation
75
+ - Flexible XYZ file I/O
76
+ - Optional mesh support via PyMeshLab
77
+ - Visualization and animation tools
78
+ - Tracking with intermediate exports
79
+ - ParaView export capabilities
80
+ - Comprehensive example notebooks
@@ -0,0 +1,23 @@
1
+ # Include essential files
2
+ include README.md
3
+ include LICENSE
4
+ include CHANGELOG.md
5
+
6
+ # Include package code
7
+ recursive-include diffusion_cartogram *.py
8
+
9
+ # Exclude examples, tests, and large files
10
+ prune examples
11
+ prune tests
12
+ global-exclude *.stl
13
+ global-exclude *.obj
14
+ global-exclude *.ply
15
+ global-exclude *.xyz
16
+ global-exclude *.gif
17
+ global-exclude *.mp4
18
+ global-exclude *.png
19
+ global-exclude *.jpg
20
+ global-exclude .git*
21
+ global-exclude __pycache__
22
+ global-exclude *.pyc
23
+ global-exclude .DS_Store
@@ -1,9 +1,29 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffusion-cartogram
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Volumetric Density-Equalizing Reference Map — 3D shape deformation and 2D cartogram generation
5
5
  Author-email: Jonah Spector <spector.jo@northeastern.edu>
6
- License-Expression: MIT
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Jonah Spector
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
7
27
  Project-URL: Homepage, https://github.com/jspector792/diffusion-cartogram
8
28
  Project-URL: Repository, https://github.com/jspector792/diffusion-cartogram
9
29
  Project-URL: Issues, https://github.com/jspector792/diffusion-cartogram/issues
@@ -253,8 +253,8 @@ If you use this package in academic work, please cite the appropriate original p
253
253
  And optionally, this implementation:
254
254
  ```bibtex
255
255
  @software{vderm2026,
256
- title={diffusion-cartogram: A Python implementation of Volumetric Density-Equalizing Reference Map},
257
- author={Jonah Spector},
256
+ title={diffusion-cartogram: A Python package for diffusion deformations in 2 and 3 dimensions},
257
+ author={Jonah Spector and Albert-László Barabási},
258
258
  year={2026},
259
259
  url={https://github.com/jspector792/diffusion-cartogram}
260
260
  }
@@ -29,13 +29,14 @@ cartogram deformation from GeoJSON / Shapefile inputs.
29
29
  >>> vd.plot_map_2d(deformed, title='Population Cartogram')
30
30
  """
31
31
 
32
- __version__ = '0.2.0'
32
+ __version__ = '0.2.2'
33
33
 
34
34
  # Core VDERM classes and algorithms
35
35
  from .core import (
36
36
  VDERMGrid,
37
37
  run_VDERM,
38
38
  run_VDERM_with_tracking,
39
+ animate_surface_posthoc,
39
40
  )
40
41
 
41
42
  # I/O functions
@@ -43,6 +44,7 @@ from .core import (
43
44
  write_xyz,
44
45
  read_xyz,
45
46
  create_pcd,
47
+ load_mesh_topology,
46
48
  export_mesh_file,
47
49
  export_mesh_vtk,
48
50
  )
@@ -85,11 +87,13 @@ __all__ = [
85
87
  'VDERMGrid',
86
88
  'run_VDERM',
87
89
  'run_VDERM_with_tracking',
88
-
90
+ 'animate_surface_posthoc',
91
+
89
92
  # I/O
90
93
  'write_xyz',
91
94
  'read_xyz',
92
95
  'create_pcd',
96
+ 'load_mesh_topology',
93
97
  'export_mesh_file',
94
98
  'export_mesh_vtk',
95
99
 
@@ -126,6 +130,7 @@ if _has_visualization:
126
130
  from .core_2d import (
127
131
  VDERMGrid2D,
128
132
  run_VDERM_2d_with_tracking,
133
+ animate_map_posthoc,
129
134
  )
130
135
 
131
136
  # 2-D grid utilities
@@ -172,7 +177,8 @@ __all__ += [
172
177
  # 2-D classes and algorithms
173
178
  'VDERMGrid2D',
174
179
  'run_VDERM_2d_with_tracking',
175
- # 2-D grid utilities
180
+ 'animate_map_posthoc',
181
+ # 2-D grid utilities
176
182
  'compute_grid_dimensions_2d',
177
183
  'make_initial_grid_2d',
178
184
  'print_grid_info_2d',