write_record
write_record(spec, name, *, derived=None, history=None)Write <output_dir>/<name>/run.json and return its path.
derived is whatever the run worked out that the specification does not already say - fitted anchors, the target survey. For a segmentation run it is usually empty, and that is the honest answer rather than an omission: the specification already carries the colormap, the input shape and the window, so re-running it reproduces the model.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| spec | The specification the run was built from. It is written out whole, so the record is enough to reproduce the run without the file it came from. | required | |
| name | str | The model’s name, which is also the directory the record goes in. | required |
| derived | dict[str, Any] | None | What the run worked out for itself, if anything. | None |
| history | Any | The per-epoch numbers, as the trainer produced them. | None |
Returns
| Name | Type | Description |
|---|---|---|
| Path | The path written: <output_dir>/<name>/run.json. |
The record stamps pyplatypus.__version__, which is why that literal and the one in pyproject.toml are held together by a test: a release reporting the wrong version writes wrong provenance into every file it produces, and those files outlive it.
No doctest: this writes a directory and wants a whole specification to do it, and the engine’s own tests cover it with one.