No description
Find a file
GaffaSnobb 3143635897
Some checks are pending
CI / Python 3.11 (push) Waiting to run
CI / Python 3.14 (push) Waiting to run
Bump version to 3.0.0.2
2026-06-23 09:59:31 +02:00
.gitea/workflows Harden CI verification 2026-06-22 15:22:01 +02:00
doc Update documentation plots 2023-03-01 15:53:12 +09:00
kshell_utilities Bump version to 3.0.0.2 2026-06-23 09:59:31 +02:00
tests Clean up repo-wide ruff lint debt 2026-06-22 12:37:02 +02:00
tools Profile and separate OBTD heatmap rendering cost 2026-06-22 10:35:16 +02:00
.gitignore Update gitignore 2023-07-12 11:43:59 +09:00
CITATION.cff Initial commit of citation file 2022-05-04 14:29:57 +02:00
LICENSE Add license and requirements for pypi 2021-09-29 17:19:16 +02:00
MANIFEST.in Modernize packaging and move test fixtures 2026-06-16 07:57:50 +02:00
PERFORMANCE.md Load selected OBTD data for narrow analyses 2026-06-21 16:32:12 +02:00
pyproject.toml Bump version to 3.0.0.2 2026-06-23 09:59:31 +02:00
README.md Profile and separate OBTD heatmap rendering cost 2026-06-22 10:35:16 +02:00
setup.py Modernize packaging and move test fixtures 2026-06-16 07:57:50 +02:00
TEST_CONFIDENCE_PLAN.md Clean up remaining multipolarity wording 2026-06-17 07:44:16 +02:00
TEST_COVERAGE_PLAN.md Add risk-focused test coverage and cleanup hardening 2026-06-16 06:34:38 +02:00
TESTING.md Harden CI verification 2026-06-22 15:22:01 +02:00

kshell-utilities

Handy utilities for processing nuclear shell model data from KSHELL. Se the KSHELL repository for installation and usage instructions for KSHELL.

Installation

Install from the PyPi repository

pip install kshell-utilities

Or, for the very latest version, clone this repository to your downloads directory. cd to the root directory of this repository and run

pip install .

Usage

Please see the How to use the output from KSHELL section of the Wiki in the KSHELL repository for an introduction on how to use kshell-utilities: https://github.com/GaffaSnobb/kshell/wiki/How-to-use-the-output-from-KSHELL

Runtime cache

loadtxt(..., load_and_save_to_file=...) controls the NumPy cache used for faster re-runs:

  • False: recalculate from source files and do not write cache files.
  • True: load a current valid cache when available; otherwise recalculate and save a new cache.
  • "overwrite": recalculate from source files and replace cache files.

Cache files are written under tmp/ by default. Set KSHELL_UTILITIES_CACHE_DIR to use another directory. Cache entries include schema/package metadata and source-file fingerprints; stale, unversioned, corrupt, or object-array caches are ignored and regenerated instead of being loaded.

Derived OBTD arrays are cached for repeated plotting workflows. obtd_heatmap, obtd_B_plot, and interference_angle save their computed x/y or matrix data, and warm cache hits can render without materializing OBTD arrays. obtd_modifier(..., make_heatmap=False) also checks its modified-transition cache before loading OBTD data.

For workflows that need the cached heatmap arrays but not the figure rendering, use obtd_heatmap(..., plot=False, return_data=True). For faster rendered heatmaps where per-cell labels are not needed, use annot=False.

OBTD loading

Directory loads use load_obtd="lazy" by default. Levels and transition data are loaded immediately, while one-body transition density files are loaded only if OBTD data is requested, for example through obtd_heatmap, interference_angle, obtd_B_plot, obtd_modifier, or direct obtd_dict access.

OBTD methods that first select transitions, such as obtd_heatmap, interference_angle, and obtd_B_plot, load only the OBTD master arrays needed for those selected transitions. Direct obtd_dict access still loads the full OBTD dictionary for compatibility.

Use load_obtd=True to load OBTDs during loadtxt(...), or load_obtd=False to prevent automatic OBTD loading for memory-constrained non-OBTD workflows.

Profiling

tools/profile_pipeline.py runs representative pipeline timings. Add --memory to report current and peak traced allocations with tracemalloc, including cases for lazy directory loads, GSF-only workflows with OBTDs present, narrow OBTD heatmaps, full obtd_dict materialization, and warm derived OBTD caches.

Example:

python tools/profile_pipeline.py --iterations 1 --memory --case gsf_only_directory_with_obtd --case obtd_heatmap_narrow_warm_cache

Plot display

Plotting helpers should avoid implicit interactive display where possible. Newer plotting APIs use show=False by default and return matplotlib figure/axes objects so callers can decide whether to display, save, or close figures.

Testing

The test suite is being built against the latest stable Python 3.14 series.

Install the package with test dependencies:

pip install -e ".[test]"

Run the test suite:

python -m pytest

Run with coverage:

python -m pytest --cov

See TESTING.md for the current baseline and known xfailed regressions.

Credits

KSHELL is created by Noritaka Shimizu https://arxiv.org/abs/1310.5431. Code in this repository is built upon tools created by Jørgen Eriksson Midtbø: https://github.com/jorgenem/kshell_public.