Releases: bjmorgan/hofmann
v0.19.0
AtomData hardening and sparse assignment.
New features:
-
set_atom_datagainsby_speciesandby_indexkeyword arguments for sparse per-atom metadata assignment.by_speciesmaps species labels to values;by_indexmaps atom indices. Both can be combined in one call, withby_indextaking precedence at overlapping atoms. -
New
select_by_speciesmethod filters a full-length per-atom array to keep only selected species, filling the rest with the appropriate missing sentinel. -
StructureScene.speciesis now stored as a tuple, fixed at construction.
Breaking changes:
-
set_atom_datano longer accepts a dict as its positionalvaluesargument. Useby_index=instead. -
Missing entries in sparse categorical atom data are now filled with
None(object-dtype) instead of empty strings. -
The
AtomDatacontainer is no longer re-exported fromhofmannorhofmann.model. The only supported way to obtain an instance is viascene.atom_data. -
The
atom_dataproperty now returns a read-onlyMappingview. Direct mutation raisesTypeErrororAttributeError. -
2-D atom data shape is now validated against
len(scene.frames)at both write and render time.
See the changelog for details.
v0.18.0
Breaking changes:
-
AtomDataexposes derived per-key metadata via read-only mapping attributesrangesandlabels, replacing the previousglobal_range()andglobal_labels()methods. Callers migrate with a direct substitution:ad.global_range(key)becomesad.ranges[key], andad.global_labels(key)becomesad.labels[key]. -
AtomData.__setitem__rejects unsupported dtypes at assignment time with a clearValueError. Supported dtypes are bool, integer, float, string, and object. -
resolve_atom_coloursis no longer part of the public API. Colour resolution goes through theStructureScenerendering methods.
See the changelog for details.
v0.17.0
Breaking change: StructureScene.atom_data arrays are now stored read-only. In-place mutation of a returned array (e.g. scene.atom_data["charge"][0] = 99) raises ValueError: assignment destination is read-only instead of silently bypassing shape validation and cache invalidation. Update values by building a new array and reassigning the key.
See the changelog for details.
v0.16.0
v0.15.1
v0.15.0
What's new
-
Interactive viewer: frame indicator (
f), go-to-frame (g),
set-step (s), and step-aware frame navigation. -
New
StructureScene.render_animation()method for exporting
trajectories as GIF or MP4 animations. -
atom_datais now a validatedAtomDatacontainer that checks
array shapes on assignment. It also accepts 2-D arrays of shape
(n_frames, n_atoms)so that colourmap-based colouring can vary
per frame in animations and the interactive viewer.
v0.14.2
v0.14.1
v0.14.0
What's new
-
Breaking:
Framenow carries alatticefield (shape(3, 3)orNone). Thelatticefield onStructureScenehas been replaced by a read-only property that delegates toframes[0].lattice. Code that constructed aStructureScenewithlattice=...should move the lattice onto eachFrameinstead. This correctly supports NPT (variable-cell) trajectories where the unit cell changes between frames. Rendering functions now resolve the lattice from the current frame, so cell edges, periodic bonds, and axes widgets update per frame. -
New
from_ase()constructor andStructureScene.from_ase()classmethod for building scenes directly from ASEAtomsobjects, without requiring pymatgen. Supports both periodic and non-periodic systems, single structures and trajectories (list[Atoms]orase.io.Trajectory), and the same style, bond, polyhedra, and view options asfrom_pymatgen. ASE is available as an optional dependency:pip install "hofmann[ase]".from_ase()stores the lattice per frame, correctly supporting NPT trajectories where the cell changes between frames.
Install
pip install hofmann==0.14.0v0.13.1
Documentation figures are now generated at Sphinx build time via a builder-inited hook, rather than being pre-generated and committed to the repository. This ensures figures always reflect the current rendering code.
pymatgenis now included in thedocsoptional extra- Set
SKIP_IMAGE_GEN=1to skip figure generation during rapid local iteration