an.measurements#
Measured durations: shots whose renderer, not their author, decides their length.
A whole-shot renderer that owns its clock (Manim: only the scene file’s own
play and wait calls fix its length) implements measure_duration
(ClockOwningRenderer). Its answer is DERIVED data:
it lives in a derived store keyed by the shot’s content (the renderer’s
measurementsstore), never inscene.mdorir/scene.json— a render never rewrites what the author wrote (an#279 review, H1);settle_durations()applies it IN MEMORY, to a copy of the scene, before anything readsshot.duration— the film timeline, captions, the sound layer, the cache keys — so the film’s layout is a pure function of the IR and the measurements;an sync --accept-measured(accept_measured()) takes it into the authored scene on request, patching each shot’sduration:line in place.
This is how core study §4.2’s “written back into the IR” is resolved: the IR the render LAYS OUT holds the measured length; the IR the author OWNS is untouched unless they accept it.
Narration longer than the picture is never cut silently. A shot’s settled
length is max(measured, end of its dialogue): the renderer holds its last
frame for the difference, and a warning says so — or, under strict
(--strict-assets, which already refuses stand-ins), the render is refused.
>>> declared_duration(Shot(id="a", renderer="manim")) is None # the schema's placeholder
True
>>> declared_duration(Shot(id="a", renderer="manim", duration=3.0))
3.0
Functions
|
Write each clock-owned shot's MEASURED length into the authored scene. |
|
The registered renderer of |
|
The duration the AUTHOR wrote, or |
|
A COPY of |
|
Warn each finding as a |
Exceptions
A measured shot cannot be laid out as asked (e.g. a hold under strict mode). |
|
A finding about a shot, warned by |
- exception an.measurements.MeasurementError[source]#
Bases:
RuntimeErrorA measured shot cannot be laid out as asked (e.g. a hold under strict mode).
- exception an.measurements.ShotFindingWarning[source]#
Bases:
UserWarningA finding about a shot, warned by
an render— located byfile:linewhen the thing to fix is an opaque source (a Manim scene file).
- an.measurements.accept_measured(project_dir)[source]#
Write each clock-owned shot’s MEASURED length into the authored scene.
Only stored measurements (render first); only shots whose scene duration differs. Each
duration:line is patched in place throughan.stores.scenes.ScenesStore.patch_shot_durations(), so the prose and comments ofscene.mdare kept. Returns{shot id: seconds}written.
- an.measurements.clock_owner_for(shot, registry=None)[source]#
The registered renderer of
shotif it owns its clock, elseNone.
- an.measurements.declared_duration(shot)[source]#
The duration the AUTHOR wrote, or
None.scene.mdfills the schema’s placeholder (an.base.DEFAULT_DURATION) into a shot that writes noduration:, so that value reads as “not declared” — an explicitduration: 5is indistinguishable from it.
- an.measurements.settle_durations(scene, ctx, *, render, force=False, strict=False, registry=None)[source]#
A COPY of
scenewhose clock-owned shots carry their settled length, and the findings about them.sceneitself is never modified.render=False(an validate) uses stored measurements only: a shot never measured is reported as “length unknown until rendered” and judged against nothing.render=True(an render) measures what is not stored;forcemeasures everything afresh.
- an.measurements.warn_findings(findings, *, stacklevel=3)[source]#
Warn each finding as a
ShotFindingWarning(location: …).- Return type: