torchcell.utils

Shared helpers. paths resolves output directories relative to the current checkout (so a script run from a git worktree writes into that worktree); utils holds the repository-wide figure standards (the ordered plot palette, Nature panel widths in millimeters, savefig_true_size_svg() and apply_paper_style()); and file_lock provides FileLockHelper for locked JSON reads and writes.

Classes

FileLockHelper

Cross-platform file locking utility for JSON file operations.

Functions

repo_root

Walk up from from_path to the enclosing checkout root, or None if outside one.

experiment_root

<checkout>/experiments, or $EXPERIMENT_ROOT when outside a checkout.

experiment_results_dir

<checkout>/experiments/<experiment>/results, created if missing.

asset_images_dir

<checkout>/notes/assets/images[/subdir], created if missing.

format_scientific_notation

Format a number into scientific notation, preserving all significant digits.

savefig_true_size_svg

Save a matplotlib figure as an SVG that imports at TRUE physical size in draw.io.

mm_to_in

Millimeters -> inches, for matplotlib figsize at true physical size.

apply_paper_style

Set every rcParam the repo figure standard fixes, explicitly.

display_label

Map an internal representation key to its plot-display label (identity if unmapped).

panel_label

Draw a panel letter at the panel's top-left corner, in the repo standard.

Constants

PANEL_WIDTHS_MM

MAX_HEIGHT_MM

PLOT_PALETTE

PLOT_PALETTE_NAMES

PLOT_PALETTE_FILL

REPRESENTATION_DISPLAY_NAMES

PAPER_RC