Skip to main content

MAGGIE

Mesh-Agnostic Graphics for Group-wise Iteration and Evolution

Load and plot multigroup neutron flux, and the scattering and fission rate densities computed from it, from transport and diffusion codes. MAGGIE currently reads output from ants, discrete1 and NeutronDiffusion, plus any code that saves plain arrays.

Install

pip install maggie

MAGGIE needs Python 3.11-3.14. Standalone executables that need no Python are attached to each GitHub Release (see Download below).

Start the viewer with maggie (or python -m maggie).

Roadmap

  1. ants, discrete1, NeutronDiffusion - static. Load screen, viewer tabs for flux and scattering/fission rate densities. (done)
  2. ants, discrete1, NeutronDiffusion - live. Watch a running solver and update the plots as time steps / iterations arrive.
  3. Other transport codes. MC/DC, OpenMC, OpenMOC and OpenSN readers will be added once steps 1-2 are settled.

Using the app

maggie opens the load screen:

  • Problem - 1D, 2D or 3D.
  • Flux files - one or more; several files are separate runs, overlaid on 1-D plots. Bare arrays (ants, discrete1, NeutronDiffusion np.save) need an axis order, e.g. time, x, group; the list suggests each code's layouts.
  • Cross sections (optional) - scattering, fission and a material map (ants' medium_map). Picking an ants-style .npz for one fills the others from the same file. Matrices are sigma[to, from] unless set otherwise.
  • Discretizations - energy, x/y/z and time grids: from the flux file, uniform (space and time), or loaded from a file (edges or centres).

Load opens the viewer, with tabs for flux, scattering rate density and fission rate density (R_g = Sigma_g phi_g, a [to, from] matrix summed over to). Each tab picks the dataset, group (or the sum), time step, a spatial or energy-spectrum view, and for 3-D the plane and slice. File > Load new data goes back to the load screen with the same choices.

Everything on the load screen can be given on the command line:

maggie flux.npy --dim 1 --axes "time,x,group" \
       --scatter xs.npz:xs_scatter --fission xs.npz:xs_fission --map xs.npz:medium_map \
       --x-grid edges_x.npy --energy-grid edges_g.npy --view   # --view skips the load screen
maggie info result.npz           # what MAGGIE finds in a file

Supported files

Source Files What MAGGIE gets
ants, discrete1 bare .npy/.npz (np.save(flux), np.savez(flux=..., keff=...)) axes from a per-code preset= or dims=; scalars become attributes, edges_* arrays become coords
NeutronDiffusion .npz from ndiffusion.save_result, or a bare np.save(flux) (x|cell, group); 2-D split to (x, y, group) given edges
MAGGIE schema .npz, .h5 written by maggie.io.write_flux / save named dims, edges, std, mesh, attrs
any other code bare .npy/.npz/.csv/.txt/.h5 axes from dims=

The reader is picked from the file contents, not only the extension.

import maggie.io as mio

flux = mio.load("flux.npy", preset="ants", layout="1D time-dependent")  # -> Field
flux.dims                                    # ('time', 'x', 'group')
flux.isel(time=-1).sum("group")              # reductions keep coords

mio.load("flux.npy", dims="T x I x G")       # same, naming the axes directly
mio.entries("result.npz")                    # what is in a file (no data read)
mio.load("result.npz", "flux", edges_x=ex, edges_y=ey)  # NeutronDiffusion 2-D

From the command line, maggie info FILE [KEY] shows which readers recognise a file, what it holds, and a summary of the loaded field.

Writing MAGGIE files from a solver

from maggie.io import write_flux

write_flux("slab.h5", flux, dims=("time", "x", "group"),
           x=edges_x, group=edges_g, time=times,
           attrs={"code": "ants", "keff": keff})

Coords are bin edges (length n+1) or centres (length n). Dim names: x y z r theta phi cell region group group_out time angle moment mu azi polar (I, G, T and other short forms are accepted).

Plotting from scripts and notebooks

maggie.plot draws the viewer's plots with matplotlib alone (no Qt window), for notebooks or saving figures:

import maggie
from maggie.plot import plot

flux = maggie.load("flux.npy", preset="ants", layout="1D time-dependent")
ax = plot(flux)                                  # last step, summed over groups
plot(flux, group=3, step=0, log=True)            # one group, first step
plot(flux, kind="spectrum", at={"x": 500})       # energy spectrum at cell 500
plot({"ants": flux, "discrete1": other})         # overlay runs
ax.figure.savefig("flux.png")

Two spatial axes give a colour map; for 3-D pick the plane and slice with plane=("x", "z"), at={"y": 10}.

Download

Prebuilt executables for Windows, macOS, and Linux are attached to each GitHub Release (no Python install needed).

  • Windows: unzip and run maggie.exe. SmartScreen may warn because the exe is unsigned — click "More info" → "Run anyway".
  • macOS: unzip and open maggie.app. The app is unsigned, so Gatekeeper blocks the first launch — right-click → Open, or run xattr -dr com.apple.quarantine maggie.app. Pick the arm64 zip for Apple Silicon or x64 for Intel.
  • Linux: untar and run ./maggie.

The single-file executables self-extract on launch, so the first start takes a few seconds.

Development

git clone https://github.com/bwhewe-13/maggie.git && cd maggie
pip install -e ".[dev]"     # plus pytest, pytest-qt
pytest                      # headless; GUI tests run offscreen

Releasing

  1. Set version in pyproject.toml (e.g. 0.2.1) and merge to main.
  2. Optional dry run: run the Release workflow by hand (Actions > Release

    Run workflow). It builds the package and tests the installed wheel but publishes nothing.

  3. Tag and push: git tag v0.2.1 && git push origin v0.2.1. The workflow checks the tag matches the version, runs the tests, tests the built wheel, publishes to PyPI and attaches executables to a GitHub Release.

Publishing uses PyPI trusted publishing: on pypi.org the project has a publisher for this repository, workflow release.yml, environment pypi.

Layout

src/maggie/
  core/dims.py        canonical dimension names + aliases
  core/field.py       Field - named-dim array + coords, std, mesh, attrs (no Qt)
  core/mesh.py        UnstructuredMesh (CSR cells)
  core/xs.py          cross sections -> reaction rate densities
  core/session.py     LoadSpec (load-screen choices) -> Session (datasets + rates)
  core/views.py       field -> what one plot shows (group/time/slice selection)
  io/base.py          Reader interface, registry, detect/entries/load
  io/schema.py        MAGGIE file schema: reader + save/write_flux
  io/presets.py       axis layouts for bare arrays from ants/discrete1/ndiffusion
  io/readers/         arrays (bare files + presets), ndiffusion
  gui/load_window.py  screen 1: files, cross sections, discretizations
  gui/viewer_window.py screen 2: one tab per quantity
  gui/field_view.py   controls + matplotlib plot used by each tab
  plot.py             matplotlib plots without Qt (used by the viewer tabs)
  app.py              command line, window controller (main())

Extending

  • New file format: subclass maggie.io.Reader in io/readers/, decorate it with @register, and import it in io/readers/__init__.py. Implement sniff (0-100 confidence), entries (metadata only), and read (-> Field).
  • New bare-array code: add its layouts to PRESETS in io/presets.py.

Metadata

Release files for maggie 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maggie 0.2.0
File Size Uploaded Provenance Actions
maggie-0.2.0.tar.gz 53.7 kB With provenance Details for maggie-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maggie 0.2.0
File Interpreter ABI Platform Actions
maggie-0.2.0-py3-none-any.whl Python 3 none any Details for maggie-0.2.0-py3-none-any.whl

Total release size: 106.5 kB

Release files / maggie-0.2.0.tar.gz

Download URL maggie-0.2.0.tar.gz
Size 53.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a6e7159b5961bd97f46edcdb1efee2ed5d4c7fc7c99062cd62037395ac6111bb
BLAKE2b-256 checksum
How to use checksums
9a686dfde7c14d7061604fe9f40d4e4725c7725aa84ac4052e590f5a85d43663
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / maggie-0.2.0-py3-none-any.whl

Download URL maggie-0.2.0-py3-none-any.whl
Size 52.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d542ebcd51576b1e4b9dca6432e33af7f2f3614934e81fc45f51de88e5920b1
BLAKE2b-256 checksum
How to use checksums
aae2a9f6a69afd3b194e1187de7edeb8c0ecc70634e0db3447ed4a3932dd836a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for maggie 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for maggie-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page