Skip to content

store tabulated densities as float32 npz to fit PyPI's 100 MB limit - #87

Merged
beykyle merged 1 commit into
mainfrom
shrink-density-tables
Sep 4, 2026
Merged

store tabulated densities as float32 npz to fit PyPI's 100 MB limit#87
beykyle merged 1 commit into
mainfrom
shrink-density-tables

Conversation

@beykyle

@beykyle beykyle commented Sep 4, 2026

Copy link
Copy Markdown
Owner

The v3.0 wheel was 145 MB because the bskg3 and d1m density tables shipped as 452 MB of 11-column ASCII, of which the loader only read the radius, proton and neutron density columns. Each model is now one compressed .npz (13 + 12 MB) holding just the two densities as float32 on a uniform grid; the original tables carry 5-6 significant digits and round-trip to 6e-8 relative error. The wheel drops to 29 MB, the sdist to 39 MB, and import jitr no longer parses 452 MB of text (8.8 s to 1.6 s).

  • density.py: load .npz at init; keep the .rad reader as read_rad_file and add write_density_npz for conversion
  • scripts/convert_density_tables.py: rebuild an npz from a .rad directory
  • remove src/data/densities/{bskg3,d1m}/*.rad (kept in history, 71e4ea0)
  • tests: rad -> npz round trip and uniform-grid check

The v3.0 wheel was 145 MB because the bskg3 and d1m density tables
shipped as 452 MB of 11-column ASCII, of which the loader only read the
radius, proton and neutron density columns. Each model is now one
compressed .npz (13 + 12 MB) holding just the two densities as float32
on a uniform grid; the original tables carry 5-6 significant digits and
round-trip to 6e-8 relative error. The wheel drops to 29 MB, the sdist
to 39 MB, and `import jitr` no longer parses 452 MB of text (8.8 s to
1.6 s).

- density.py: load <model>.npz at init; keep the .rad reader as
  read_rad_file and add write_density_npz for conversion
- scripts/convert_density_tables.py: rebuild an npz from a .rad directory
- remove src/data/densities/{bskg3,d1m}/*.rad (kept in history, 71e4ea0)
- tests: rad -> npz round trip and uniform-grid check

Claude-Session: https://claude.ai/code/session_014PvAXNJiHj9E9CiGeH45Pm
@beykyle
beykyle merged commit d1b3abb into main Sep 4, 2026
9 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant