factoriax.analysis.curriculum_strip#
Render a graded-achievement curriculum as a horizontal phase strip.
Public surface:
AchievementSpec: plain-Python achievement-bit record.StripLayout: geometry constants.render(): top-level entry. It consumes a sequence of specs plus a phase->hex palette, and writes a PNG.
This module owns no color scheme. phase_palette is a necessary
argument. The caller therefore sets the look of each phase, and two
reports can style the same curriculum differently.
Internally the renderer is broken into focused helpers: cell-position
computation, per-cell drawing, phase-label drawing, and the dashed
hand-vs-automation boundary. Same decomposition discipline as
factoriax.analysis.recipe_graph.
- class factoriax.analysis.curriculum_strip.AchievementSpec(bit: int, name: str, phase: str, hand_craftable: bool)#
One bit in the curriculum.
This mirrors the per-bit metadata of the engine, but holds plain Python types. A caller can therefore draw the strip from a JSON dump without an import of the JAX-backed engine module.
- bit#
The index of this achievement in the achievement mask. It is also the large number drawn in the cell.
- Type:
- name#
The short label under the number. Long names overflow the cell, because nothing truncates them.
- Type:
- class factoriax.analysis.curriculum_strip.StripLayout(cell_w: float = 1.6, cell_h: float = 1.1, gap: float = 0.05, phase_gap: float = 0.45, boundary_dash_extension: float = 0.35, fallback_color: str = '#cccccc', stroke_darken: float = 0.45)#
Geometry constants for the curriculum strip render.
- factoriax.analysis.curriculum_strip.render(achievements: Sequence[AchievementSpec], out_path: Path | str, *, phase_palette: Mapping[str, str], layout: StripLayout | None = None) Path#
Draw the curriculum strip and return the path of the new file.
- Parameters:
achievements – The bit specs, in draw order. The strip keeps that order. Two rules apply to it. Cells of one phase must be next to each other, and every hand-craftable bit must come before every automation bit. An empty sequence raises
IndexError.out_path – Where to write the image. The extension sets the format, and matplotlib accepts PNG and SVG among others. Missing parent directories are created.
phase_palette –
{phase_name: hex}. A phase absent from this map getsStripLayout.fallback_colorand no warning.layout – Geometry constants, or
Nonefor the defaults.
- Returns:
out_pathas aPath, after the write.- Return type:
Notes
The function writes a file and closes its own figure.