Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
fix(video): a view's foot cue that does not tell the legs apart leaves a walk's crossings on steps
Soohong Kimf3f60266575b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d85c373..e097b63 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,22 +4,23 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the## Unreleased - A walk whose feet meet once a cycle is cut one cycle long, a walk that starts or stops in its take is named to film again, and video-set cuts a searched walk or run with motion-auto by default-**Upgrading from 3.5.0: `video-set` now cuts searched walk and run loops with `--anchor motion-auto` and their view by default, and `video-loop --anchor motion-auto` recognises crossings that mark cycles where feet hide or step apart instead of cutting two cycles.** Every walk or run item whose loop is searched is now cut with `motion-auto` and its view, producing a different cut and different bytes; `--anchor none` gives the old cut, its pictures and reports byte for byte apart from the engine hash (`producer.implementation_sha256`). Idle, attack, once-hold, lifetime, and once-return items are cut as before. In `video-loop --anchor motion-auto` without `--view`, a walk whose feet are seen together over half the interval at a pass (`crossings.HIDE_SHARE`, 0.5) and whose picture repeats each interval is now counted on cycles: where the parent engine cut two cycles, the loop is now one cycle with new bytes; where the parent engine kept the search's cut with no `steps`, the cut is the same and the strip and report now record `steps: 2`. A walk whose crossings mark steps (brief passes, or from the side) is cut to the same bytes. With `--view` (or through `video-set`), a front, back, or diagonal walk is evaluated even with brief passes. Every report whose clip stands still gains `stands` and `run_limit`, and reports where cycle reading is asked gain `cycles`.+**Upgrading from 3.5.0: `video-set` now cuts searched walk and run loops with `--anchor motion-auto` and their view by default, and `video-loop --anchor motion-auto` recognises crossings that mark cycles where feet hide or step apart instead of cutting two cycles.** Every walk or run item whose loop is searched is now cut with `motion-auto` and its view, producing a different cut and different bytes; `--anchor none` gives the old cut, its pictures and reports byte for byte apart from the engine hash (`producer.implementation_sha256`). Idle, attack, once-hold, lifetime, and once-return items are cut as before. In `video-loop --anchor motion-auto` without `--view`, a walk whose feet are seen together over half the interval at a pass (`crossings.HIDE_SHARE`, 0.5) and whose picture repeats each interval is now counted on cycles: where the parent engine cut two cycles, the loop is now one cycle with new bytes; where the parent engine kept the search's cut with no `steps`, the cut is the same and the strip and report now record `steps: 2`. A walk whose crossings mark steps (brief passes, or from the side) is cut to the same bytes. With `--view` (or through `video-set`), a front, back, or diagonal walk is evaluated even with brief passes: such a walk is counted on cycles only where its foot cue turns over half an interval on, and where the cue does not tell the legs apart its crossings stay on steps, cut as without a view, with a warning. Every report whose clip stands still gains `stands` and `run_limit`, and reports where cycle reading is asked gain `cycles`.-- **New: crossing cycle detection (`local_cycle.read_cycles`, `crossings.HIDE_SHARE`, `CYCLE_SLACK`, `CUE_SWAPPED`).** In gap mode on a readable reading, when feet can hide behind one another (`reading.overlap` over `crossings.HIDE_SHARE`, 0.5) or when the view is given and is not `side`, crossing intervals are checked to see if they mark full cycles rather than single steps. `repeat_at(distances, span)` reads the mean distance of frames to those lagged by `span` over the clip's mean step from frame to frame. Comparing distances at half, one, and two intervals, crossings mark cycles when `one < half` and `one <= two + CYCLE_SLACK` (0.5), unless the directional foot cue (`legs.shade_cue` from the side or diagonal, `legs.depth_cue` from the front or back) indicates the other leg leads one interval on (`crossings.correlation_on` at or below `CUE_SWAPPED`, −0.2). When cycles are marked, `Reading.mark_cycles` sets `per` to 2 and halves `step` and `step_range`: a cut one interval long is two steps, and the search's cut (`--anchor motion-auto`) taken on it writes `steps: {count: 2, by: crossings}`. A fixed cut (`--cycle fixed`, `fixed_count`) and the loop as it plays round (`ring_steps`) read the same; a fixed cut one interval long is counted two steps and not refused, and still writes no `steps`.+- **New: crossing cycle detection (`local_cycle.read_cycles`, `local_cycle.cue_word`, `crossings.HIDE_SHARE`, `CYCLE_SLACK`, `CUE_FLOOR`, `CUE_SWAPPED`).** In gap mode on a readable reading, when feet can hide behind one another (`reading.overlap` over `crossings.HIDE_SHARE`, 0.5) or when the view is given and is not `side`, crossing intervals are checked to see if they mark full cycles rather than single steps. `repeat_at(distances, span)` reads the mean distance of frames to those lagged by `span` over the clip's mean step from frame to frame. Comparing distances at half, one, and two intervals, crossings mark cycles when `one < half` and `one <= two + CYCLE_SLACK` (0.5), judged with the directional foot cue (`legs.shade_cue` from the side or diagonal, `legs.depth_cue` from the front or back): a cue whose range over the clip is under `CUE_FLOOR` (0.5) of the step it is drawn in (`legs.TONE`, 1/255, or a pixel row of median body height) does not move and says nothing; otherwise the cue says `"steps"` where it turns over one interval on (`crossings.correlation_on` at or below `CUE_SWAPPED`, −0.2) and `"cycles"` where it turns over half an interval on (−0.2 or under) and not one interval on; a hidden pass marks cycles unless the cue says `"steps"`; the view alone needs the cue to say `"cycles"`; otherwise crossings stay on steps, with a warning. When cycles are marked, `Reading.mark_cycles` sets `per` to 2 and halves `step` and `step_range`: a cut one interval long is two steps, and the search's cut (`--anchor motion-auto`) taken on it writes `steps: {count: 2, by: crossings}`. A fixed cut (`--cycle fixed`, `fixed_count`) and the loop as it plays round (`ring_steps`) read the same; a fixed cut one interval long is counted two steps and not refused, and still writes no `steps`.- **Removed: the same-picture rule (`local_cycle.same_picture`, `local_cycle.same_picture_count`, `local_cycle.SAME_PICTURE_MAX`, count code `same-picture`, report fields `step_count.search.same_picture` and `step_count.same_picture`).** It kept the search's cut, with no `steps`, where the count said one step; it never cut one cycle where the search had found two. `local_cycle.read_cycles` takes its place.- **New: walk start-stop retake reporting (`loop.stand_retake`, `crossings.Reading.stands`).** In gap mode, runs where the feet stay together longer than `run_limit` (√2 times the median whole pass run) are recorded in `Reading.stands`. Where a clip shows its steps, contains `stands`, and the cut kept does not count two steps (`verdict` is not `two`) with no two-step cut closing between the standing frames, `loop.stand_retake` emits a `retake` report (`reason: "start-stop"`, `remedy: "retake"`), keeping the cut as cut without refusal under `--unfixed refuse`. Where a part also pops, one `retake` names both (`loop.retakes`): the first reason's record, `reasons: ["part-pop", "start-stop"]`, and each reason's numbers under its own key (`part_pop`, `start_stop`).- **Changed: `video-set` defaults gait anchoring to `motion-auto` (`batch.anchor_for`).** Without an explicit `--anchor`, `video-set` cuts each walk and run item whose loop is searched (`cycle_for` returns `auto` or `periodic`) with `motion-auto`, and assigns `none` to idle, attack, once-hold, lifetime, and once-return items; explicit `--anchor` options are applied to every item as before. `video-set` passes each item's view to `video-loop`. Any item whose loop names a retake carries `loop.retake`, appears in the set's `warnings`, and appends ` (film again: <reasons>)` to `table.md`.- **Changed: cycle alignment leaves out start-stop retake loops (`batch.align_gaits`, `video-set --align-cycles auto`).** Takes flagged with `start-stop` retakes loop no two steps and are excluded from gait cycle alignment, keeping their loops as cut while aligning the remaining directions. Excluded items are recorded under `left_out` (`{item: reasons}`) with a stderr warning and a set warning; if fewer than two directions remain, alignment is skipped (`applied: false`, `why: "fewer than two directions left to align"`).- CLI: `video-loop --view front|back|side|front_diagonal|back_diagonal` (default none) sets the clip view for cycle detection and foot cue selection.-- Report fields: `cycle.step_count.cycles` (`{asked, interval, overlap, half, one, two, slack, cue: {one, swapped}, cycles, why}`); `step_count.stands` and `step_count.run_limit`; `loop.retake` (`{reason: "start-stop", reasons, start_stop: {stands, run_limit, crossings, cut, verdict, code, why}, remedy: "retake"}`); the set report's item `loop.retake` (`{reason, reasons, remedy}`) and its state's `cycle_align.<state>.left_out` (`{item: reasons}`).-- Python callers: new `local_cycle.read_cycles(reading, distances, view=None, cue=None)`, `local_cycle.repeat_at(distances, span)`, `batch.anchor_for(state, cut, anchor)`, `loop.stand_retake(cycle)`, `loop.retakes(*records)`, `loop.STAND_REASON`; `crossings._alternation` is now public `crossings.correlation_on(values, span)`; `align._feet`, `align._depth_cue`, `align._shade_cue`, and `align.SHADE_BAND` are moved to `legs.feet_halves`, `legs.depth_cue`, `legs.shade_cue`, and `legs.SHADE_BAND` (`align` keeps `_depth_cue` and `_shade_cue` aliases); `crossings.Reading` gains `interval`, `per`, `cycles`, and `mark_cycles(said)`.+- Report fields: `cycle.step_count.cycles` (`{asked, interval, overlap, half, one, two, slack, cue: {range, floor, swapped, half, one, says, why}, cycles, why}`); the loop's warnings (`jolt.warnings`); `step_count.stands` and `step_count.run_limit`; `loop.retake` (`{reason: "start-stop", reasons, start_stop: {stands, run_limit, crossings, cut, verdict, code, why}, remedy: "retake"}`); the set report's item `loop.retake` (`{reason, reasons, remedy}`) and its state's `cycle_align.<state>.left_out` (`{item: reasons}`).+- Python callers: new `local_cycle.read_cycles(reading, distances, view=None, cue=None, cue_step=None)`, `local_cycle.cue_word(cue, interval, step=None)`, `local_cycle.CUE_FLOOR`, `legs.TONE`, `local_cycle.repeat_at(distances, span)`, `batch.anchor_for(state, cut, anchor)`, `loop.stand_retake(cycle)`, `loop.retakes(*records)`, `loop.STAND_REASON`; `crossings._alternation` is now public `crossings.correlation_on(values, span)`; `align._feet`, `align._depth_cue`, `align._shade_cue`, and `align.SHADE_BAND` are moved to `legs.feet_halves`, `legs.depth_cue`, `legs.shade_cue`, and `legs.SHADE_BAND` (`align` keeps `_depth_cue` and `_shade_cue` aliases); `crossings.Reading` gains `interval`, `per`, `cycles`, and `mark_cycles(said)`.- **Tests**: `tests/video/test_walk_steps.py` covers these synthetic walker cases:- a walker seen from behind whose far foot hides behind the near one (feet together over half the interval) across cycles of 20 frames on twos, 24 on threes, and 17.5 and 18.5 on ones is cut to one cycle within a frame, with `cycles` true and `steps: 2`;- a side walker whose two steps are one silhouette (46-frame cycle, near and far legs one or four tones apart) is not asked with no view or `--view side`, keeping two steps at 46 frames;- - a front-diagonal walker stepping toward the camera with feet passing apart (feet together under half the interval, cycle 16 and 18) cuts one cycle (16, 18) with `--view front_diagonal`, and cuts two cycles (32, 36) without a view;- - a 46-frame front-diagonal walker with legs four tones apart asked with `--view front_diagonal` sees one interval on as near as two on, but keeps two steps at 46 frames because the foot cue alternates one interval on;- - synthetic units meeting every 15 frames verify that repeating every 15 frames with 9 frames overlap marks cycles, repeating every 30 frames marks steps, brief meetings with no view or `side` are not asked, and front diagonals defer to the cue;+ - a front-diagonal walker stepping toward the camera with feet passing apart (feet together under half the interval, cycle 16 and 18), whose foot cue turns over half an interval on, cuts one cycle (16, 18) with `--view front_diagonal`, and cuts two cycles (32, 36) without a view;+ - a 46-frame front-diagonal walker with legs four tones apart asked with `--view front_diagonal` sees one interval on as near as two on, but keeps two steps at 46 frames because the foot cue turns over one interval on;+ - the same 46-frame walker with its legs drawn alike (its arms still four tones apart) asked with `--view` set to `front`, `front_diagonal`, `back` and `back_diagonal` sees one interval on as near as two on, but the foot cue does not move (its range far under the floor), keeping two steps at 46 frames with `cycles` false and a warning that names the cut;+ - synthetic units meeting every 15 frames verify that repeating every 15 frames with 9 frames overlap marks cycles, repeating every 30 frames marks steps, brief meetings with no view or `side` are not asked, and on front diagonals a cue turning over every 15 frames (one interval on) keeps two steps of 15 (30 frames), a cue turning over every 7.5 frames (half an interval on) and holding one interval on marks cycles (15 frames kept as one cycle), a still cue (a sine of amplitude 1e-8, its range far under half a tone) and a cue flickering every 4 frames (turning over neither) leave crossings on steps (two steps of 15, with the warning), while where a pass can hide (feet together 9 frames, back diagonal) a still cue leaves the picture to mark cycles (15 frames as one cycle with `steps: 2`);- synthetic start-stop clips with feet together for 15 frames at the head and 14 at the tail alongside passes of 8 and 3 frames flag retakes when the cut is uncertain, omit retakes when counted as two steps, and report no `stands` when feet only pass.- **Tests**: `tests/video/test_gait_guard_anchor_wide.py` and `tests/video/test_cycle_align.py` cover batch anchoring and cycle alignment:- `batch.anchor_for` assigns `motion-auto` to walk and run loops while assigning `none` to cheer, walk with `--anchor none`, and pinned idle items, propagating loop retakes to item records, warnings, and markdown tables;diff --git a/docs/loop-repair.md b/docs/loop-repair.mdindex 39a8a46..ec9ca97 100644--- a/docs/loop-repair.md+++ b/docs/loop-repair.md@@ -1269,7 +1269,7 @@ crossings, joined at the wrap where the walk itself goes on, is one cycle (`cros| `step_range` | the clip's own step (the median between crossings) and the range a step must lie in, a factor of √2 either way || `readable`, `why`, `alternation` | whether the clip shows its steps: three crossings or more, and in sign mode a lean that turns over a step on (correlation one step on at most **−0.7**, `crossings.ALTERNATION_MAX`) || `cut`, `search` | the cut taken and the pixel search's own cut (or why it found none), each with its `verdict`, `code`, `k` (steps covered), `phase` and `ring` |-| `cycles` | whether crossings mark cycles: `asked`, `interval`, `overlap`, `half`, `one`, `two`, `slack`, `cue` (`one`, `swapped`), `cycles` (`true` or `false`), and `why`; absent where not asked |+| `cycles` | whether crossings mark cycles: `asked`, `interval`, `overlap`, `half`, `one`, `two`, `slack`, `cue` (`range`, `floor`, `swapped`, `half`, `one`, `says`, `why`), `cycles` (`true` or `false`), and `why`; absent where not asked || `stands`, `run_limit` | gap mode, the runs of the feet together longer than any pass (over `run_limit`, √2 times the median run the clip shows whole: whole, or cut by the first or last frame), recorded as pairs of frames; only where there is one || `chosen_by` | `search` (kept), `two steps` (chosen on the count), and the search again where the count refutes its cut (`searched_again`) || `declined` | the best two-step cut, where none closed and the search's cut stood: its `cut`, `phase`, whether it passed the gates (`gated`) and its `seam` |@@ -1294,43 +1294,69 @@ behind on a diagonal), or a foot steps toward or away from the camera and passesdiagonal, a front view). There the feet meet once a cycle, the engine called a cycle one step, and twosteps were two cycles: a loop twice as long as the walk's cycle, which then plays at half the walk'sspeed beside the rest of a set. Before any cut is judged,-`local_cycle.read_cycles(reading, distances, view=None, cue=None)` asks whether the crossings mark cycles-instead of steps. It is asked only in gap mode, on a readable reading, and only where a pass can hide-(`reading.overlap` over `crossings.HIDE_SHARE`, 0.5: the feet seen together over half the interval at a-pass) or where the clip's view is given (`--view front|back|side|front_diagonal|back_diagonal`, default-none) and is not `side`. From the side the legs a step on are one silhouette, as near as a cycle on, and-the picture cannot tell; so a side clip with brief passes, or a clip with no view and brief passes, is-not asked (the count stands exactly as before). `repeat_at(distances, span)` measures how far the clip-lies from itself `span` frames on: the mean distance of every frame to the one a lag on, over the clip's-mean step from one frame to the next, the nearer of the two whole lags about `span` (none where the clip-holds under half a lag of frames past it). It is read at half the crossing interval (`half`), one-interval (`one`) and two intervals (`two`). The crossings mark cycles where `one < half` (one interval on-is nearer than the pose a half interval on) and `one <= two + CYCLE_SLACK` (`CYCLE_SLACK` = 0.5 of the-mean step: one interval on is as near as two on, so the same leg leads one interval on). Then the view's-foot cue is asked: `legs.shade_cue` (the near foot's shade against the far one's) from the side or a-diagonal, `legs.depth_cue` (the picture's right foot drawn lower than its left) from the front or back,-per frame; its correlation one interval on is read with `crossings.correlation_on(values, span)` (trend-removed). At `CUE_SWAPPED` (-0.2) or under, the other leg leads one interval on: the interval is a step,-and the count stands. A cue that does not follow the feet reads near 0 and decides nothing. Where they-mark cycles the reading holds two steps an interval (`Reading.mark_cycles`: `per` 2, `step` half the-interval, `step_range` halved): a cut one interval long is two steps (one cycle) and is taken as such-(`steps: {count: 2, by: crossings}` written). Recorded in `cycle.step_count.cycles`:-`{asked, interval, overlap, half, one, two, slack, cue: {one, swapped}, cycles: true|false, why}`; absent-where not asked. The same reading is used for the search's cut (`--anchor motion-auto`), a fixed cut-(`--cycle fixed`, `fixed_count`), and the loop as it plays round (`ring_steps`, told the clip's `cycles`-since a loop alone is too short to read two intervals on). `video-set` passes each item's view. On the-synthetic walkers of `tests/video/test_walk_steps.py`, a walker seen from behind whose far foot hides-behind the near one (feet seen together over half the interval) has a cycle of 20 frames drawn on twos,-24 on threes, and 17.5 and 18.5 frames on ones (a cycle not a whole number of frames): cut one cycle-(within a frame of it), `cycles` true, `steps` 2. A side walker whose two steps are one silhouette+`local_cycle.read_cycles(reading, distances, view=None, cue=None, cue_step=None)` asks whether the+crossings mark cycles instead of steps. It is asked only in gap mode, on a readable reading, and only+where a pass can hide (`reading.overlap` over `crossings.HIDE_SHARE`, 0.5: the feet seen together over+half the interval at a pass) or where the clip's view is given+(`--view front|back|side|front_diagonal|back_diagonal`, default none) and is not `side`. From the side+the legs a step on are one silhouette, as near as a cycle on, and the picture cannot tell; so a side clip+with brief passes, or a clip with no view and brief passes, is not asked (the count stands exactly as+before). `repeat_at(distances, span)` measures how far the clip lies from itself `span` frames on: the+mean distance of every frame to the one a lag on, over the clip's mean step from one frame to the next,+the nearer of the two whole lags about `span` (none where the clip holds under half a lag of frames past+it). It is read at half the crossing interval (`half`), one interval (`one`) and two intervals (`two`).+The crossings mark cycles where `one < half` (one interval on is nearer than the pose a half interval on)+and `one <= two + CYCLE_SLACK` (`CYCLE_SLACK` = 0.5 of the mean step: one interval on is as near as two+on, so the same leg leads one interval on). Then the view's foot cue is asked+(`local_cycle.cue_word(cue, interval, step=None)`): `legs.shade_cue` (the near foot's shade against the+far one's) from the side or a diagonal, `legs.depth_cue` (the picture's right foot drawn lower than its+left) from the front or back, per frame. A cue whose range over the clip (largest value minus smallest)+is under `CUE_FLOOR` (0.5) of the step it is drawn in does not move: legs drawn alike to the cue leave it+still, and what is left of it is floating point rounding, which repeats with the legs and can correlate+fully one interval on; it says nothing (`says` null) and its correlations are not read. The step a cue is+drawn in is `legs.TONE` (1/255, one 8-bit level of luma) for the shade cue, or one pixel row of the+body's median height (1 over the median body height in pixels) for the depth cue. Otherwise its+correlation half an interval on (`half`) and one interval on (`one`) is read with+`crossings.correlation_on` (trend removed). The cue says `"steps"` where it turns over one interval on+(correlation at `CUE_SWAPPED`, −0.2, or under: the other leg leads there, so the interval is a step);+`"cycles"` where it turns over half an interval on (−0.2 or under) and does not turn over one interval on+(the other leg leads a step on, so the interval is two steps); and null where it does neither (the cue+does not tell the legs apart). Where a pass can hide (`reading.overlap` over `crossings.HIDE_SHARE`,+0.5), the picture marks cycles unless the cue says `"steps"`; a cue that says nothing leaves the+picture's word. Where only the view asks (the view is given and is not `side`, and passes are brief), the+picture alone marks nothing, because legs drawn alike are the same picture a step on as a cycle on: the+crossings mark cycles only where the cue says `"cycles"`; where it says `"steps"`, the count stands (two+steps); where it says nothing (it does not move, or it turns over neither a step on nor an interval on),+the crossings stay on steps, as from the side, and the cut is the one taken without a view. In that last+case `cycles.why` says the view's foot cue does not tell the legs apart: a step on draws as a cycle on,+as from the side, and the crossings mark steps; and the loop's warnings (`jolt.warnings`, from+`local_cycle.step_verdict`) gain a line: the clip one interval on is the same picture, as a walk whose+feet meet once a cycle draws it, but the view's foot cue does not tell its legs apart, so its crossings+are counted as steps, as from the side, and where its feet do meet once a cycle, each step counted in the+cut is a cycle. Where they mark cycles the reading holds two steps an interval (`Reading.mark_cycles`:+`per` 2, `step` half the interval, `step_range` halved): a cut one interval long is two steps (one cycle)+and is taken as such (`steps: {count: 2, by: crossings}` written). Recorded in `cycle.step_count.cycles`:+`{asked, interval, overlap, half, one, two, slack, cue: {range, floor, swapped, half, one, says, why}, cycles: true|false, why}`;+absent where not asked. The same reading is used for the search's cut (`--anchor motion-auto`), a fixed+cut (`--cycle fixed`, `fixed_count`), and the loop as it plays round (`ring_steps`, told the clip's+`cycles` since a loop alone is too short to read two intervals on). `video-set` passes each item's view.+On the synthetic walkers of `tests/video/test_walk_steps.py`, a walker seen from behind whose far foot+hides behind the near one (feet seen together over half the interval) has a cycle of 20 frames drawn on+twos, 24 on threes, and 17.5 and 18.5 frames on ones (a cycle not a whole number of frames): cut one+cycle (within a frame of it), `cycles` true, `steps` 2. A side walker whose two steps are one silhouette(46-frame cycle, near and far a tone or four apart) is not asked with no view or with `--view side`, andis cut two steps (46 frames) as before. A front-diagonal walker whose near foot steps out toward the-camera and passes the far one apart (feet together under half the interval), cycle 16 and 18 frames: with-`--view front_diagonal` cut one cycle (16, 18 frames); without a view it is not asked and is cut as-before (32, 36 frames: two cycles, as the engine cannot tell without the view). The same 46-frame walker-filmed as a front diagonal, its far leg four tones off the near one, is asked with+camera and passes the far one apart (feet together under half the interval), cycle 16 and 18 frames: its+foot cue moves over the floor and turns over half an interval on and not one interval on+(`says: "cycles"`); with `--view front_diagonal` cut one cycle (16, 18 frames); without a view it is not+asked and is cut as before (32, 36 frames: two cycles, as the engine cannot tell without the view). The+same 46-frame walker filmed as a front diagonal, its far leg four tones off the near one, is asked with`--view front_diagonal`: one interval on is as near as two on, but the foot cue turns over one interval-on: two steps (46 frames), the count stands.+on (`says: "steps"`): two steps (46 frames), the count stands. The same 46-frame walker with its legs+drawn alike (its arms still four tones apart), asked with `--view` set to `front`, `front_diagonal`,+`back` and `back_diagonal`: one interval on (a step on) is the same picture, as near as two on, and the+foot cue does not move (its range far under the floor). The crossings stay on steps: two steps, 46+frames, `cycles` false, and a warning that names the cut.**Choosing the cut.**@@ -1394,13 +1420,19 @@ the feet together inside the clip as long as a pass, and a wobble that reaches tstep's beat read as steps; a narrow step that opens the feet only just past the reading's threshold readsat that threshold. Where a pass is hidden behind the other foot, or where the view is given and is not`side`, the cycles reading (`local_cycle.read_cycles`) sees whether the crossings mark cycles: where the-clip repeats one interval on as near as two on, and the foot cue does not show the legs swapped, the-reading marks cycles and cuts one cycle as two steps. What it still cannot tell: a side walk with brief-passes whose two steps are one silhouette is not asked, because from the side the legs a step on are one-silhouette, as near as a cycle on, and the picture cannot tell; a clip with no view and brief passes is-not asked, so a front diagonal whose near foot steps out apart is then cut two cycles, so give `--view`;-and a cue that does not follow the feet reads near 0 and decides nothing. Four-legged gaits are read as-one foot band (`legs.strike_signals`), as before.+clip repeats one interval on as near as two on, a pass that can hide marks cycles unless the foot cue+says `"steps"`, and where only the view asks, the crossings mark cycles only where the cue says+`"cycles"`; where they mark cycles, the reading cuts one cycle as two steps. What it still cannot tell: a+side walk with brief passes whose two steps are one silhouette is not asked, because from the side the+legs a step on are one silhouette, as near as a cycle on, and the picture cannot tell; a clip with no+view and brief passes is not asked, so a front diagonal whose near foot steps out apart is then cut two+cycles, so give `--view`; a walk filmed from the front, the back or a diagonal, with brief passes, whose+legs are drawn alike to its view's cue (or whose cue turns over neither a step on nor an interval on) has+its crossings left on steps: where its feet do meet once a cycle, it is cut two cycles long, with the+warning; and a cue that moves with how the feet meet rather than with which leg leads (for example both+feet drawn lighter as they part) turns over half an interval on just as swapped legs do, and can still+read a step as a cycle; so can a cue that flickers on a beat of its own and turns over half an interval+on by chance. Four-legged gaits are read as one foot band (`legs.strike_signals`), as before.### The step gate: every step between drawings, and a fixed cut's countdiff --git a/sprite_gen/video/legs.py b/sprite_gen/video/legs.pyindex fe9feb4..3a2f447 100644--- a/sprite_gen/video/legs.py+++ b/sprite_gen/video/legs.py@@ -18,7 +18,9 @@ Both read the same per-frame signals (`strike_signals`) and choose between themWhich of the two feet is which is read on cues the view draws (`depth_cue`, `shade_cue`): from the front or back thefoot nearer the viewer is drawn lower, from the side or a diagonal the far leg is drawn in shade. `video-cycle-align`names the foot that lands by them (`align.strike_foot`), and the step count asks whether the same leg leads again one-crossing interval on (`local_cycle.read_cycles`).+crossing interval on (`local_cycle.read_cycles`). Legs drawn alike to a cue leave it still: its range over the clip+under half the step it is drawn in (a TONE of luma, a pixel row of the body's height) is the arithmetic's, not the+feet's (`local_cycle.cue_word`).The swing of the stride or the lowest row says there is something to read, not that it is legs:a legless body that squashes as it bounces widens its foot band once a cycle, where a walker's@@ -47,6 +49,7 @@ REACH_MIN = 0.015 # the lowest row's swing (of the body's height) that says a fFEET_APART = 0.02FEET_APART_SHARE = 0.2SHADE_BAND = 0.15 # the shade cue reads the feet and lower legs: the lowest 15 % of the body+TONE = 1 / 255 # one 8-bit level of luma (0..1): the step the shade cue's tones are drawn in; the depth cue's is a pixel rowdef _longest_runs(solid: np.ndarray) -> np.ndarray:diff --git a/sprite_gen/video/local_cycle.py b/sprite_gen/video/local_cycle.pyindex 21d7dc2..4488e92 100644--- a/sprite_gen/video/local_cycle.py+++ b/sprite_gen/video/local_cycle.py@@ -31,10 +31,14 @@ SEAM_TRIES = 4 # two-step cuts, best first, whose seam is read as the seam gate# interval on and as near as two intervals on within CYCLE_SLACK of the clip's mean step (each read at a whole lag, up# to half a frame off the interval: about half a step).CYCLE_SLACK = 0.5-# ... unless the view's foot cue (`legs.shade_cue` from a diagonal or the side, `legs.depth_cue` from the front or-# back) correlates at CUE_SWAPPED or under one interval on (`crossings.correlation_on`): the other leg leads there,-# and the interval is a step. A cue that does not follow the feet reads near 0 and decides nothing.+# The view's foot cue (`legs.shade_cue` from a diagonal or the side, `legs.depth_cue` from the front or back) says which+# leg leads (`cue_word`): turned over to CUE_SWAPPED or under one interval on (`crossings.correlation_on`), the other+# leg leads there and the interval is a step; turned over half an interval on and not one, the other leg leads a step+# on and the interval is two. A cue that does neither does not tell the legs apart, and says nothing.CUE_SWAPPED = -0.2+# ... nor does a cue whose range over the clip is under CUE_FLOOR of the step it is drawn in (`legs.TONE` of luma, a+# pixel row of the body's height): it rounds to one value, and its correlation is the arithmetic's (not read).+CUE_FLOOR = 0.5SIDE_VIEW = 'side' # from the side the legs a step on are one silhouette, as near as a cycle on: asked only where a pass hides@@ -496,18 +500,45 @@ def repeat_at(distances, span):return min(found) if found else None-def read_cycles(reading, distances, *, view=None, cue=None):+def cue_word(cue, interval, *, step=None):+ """What the view's foot cue (`cue`, per frame) says of the legs `interval` frames on (`read_cycles`): `says` `steps`+ where it turns over one interval on (`crossings.correlation_on` at CUE_SWAPPED or under: the other leg leads there),+ `cycles` where it turns over half an interval on and not one (the other leg leads a step on: the interval is two+ steps), None where it does neither — it does not tell the legs apart. A cue whose range over the clip is under+ CUE_FLOOR of the `step` it is drawn in (`legs.TONE` of luma, a pixel row of the body's height) does not move — legs+ drawn alike to it — and says nothing, its correlation (the arithmetic's) not read. Returns the record."""+ values = np.asarray(cue, dtype=float)+ spread = float(values.max()-values.min()) if values.size else 0.0+ word = {'range': float(f'{spread:.3g}'), **({'floor': float(f'{CUE_FLOOR*step:.3g}')} if step is not None else {}),+ 'swapped': CUE_SWAPPED}+ if step is not None and spread < CUE_FLOOR*step:+ return {**word, 'says': None, 'why': f'its range over the clip ({spread:.2g}) is under half the step it is drawn in '+ f'({step:.2g}): it does not move'}+ half, one = (crossings_mod.correlation_on(values, span) for span in (interval/2, interval))+ word.update(half=None if half is None else round(half, 3), one=None if one is None else round(one, 3))+ if one is not None and one <= CUE_SWAPPED:+ return {**word, 'says': 'steps'}+ if half is not None and half <= CUE_SWAPPED:+ return {**word, 'says': 'cycles'}+ said = ', '.join(f'{v:+.2f} {k}' for k, v in (('half an interval on', half), ('one on', one)) if v is not None) or 'not read'+ return {**word, 'says': None, 'why': f'it turns over neither a step on nor an interval on ({said}, over {CUE_SWAPPED:+g})'}+++def read_cycles(reading, distances, *, view=None, cue=None, cue_step=None):"""Whether the crossings the clip shows (`reading`, gap mode) mark its cycles, not its steps, read and kept on thereading (`Reading.mark_cycles`; crossings.py, "Crossings that mark cycles"). The feet need not meet on the screenat every pass: the far foot can pass hidden behind the near one, or a foot step toward or away from the camera andpass the other apart. Then they meet once a cycle, and the clip one interval between crossings on (`repeat_at`) hasthe same leg leading, not the other: it is nearer than half an interval on (the pose a step on) and as near as two- intervals on within CYCLE_SLACK. Where the clip says so, the view's foot cue (`cue`, per frame) is asked whether the- other leg leads one interval on (`crossings.correlation_on` at CUE_SWAPPED or under): there the interval is a step.-- Asked where a pass can hide (`reading.overlap` over HIDE_SHARE, the far foot behind the near one), or where the- `view` is given and is not the side; from the side the legs a step on are one silhouette, as near as a cycle on, and- the picture cannot tell. Returns what was read, None where it is not asked."""+ intervals on within CYCLE_SLACK. Where the clip says so, the view's foot cue (`cue`, per frame, drawn in steps of+ `cue_step`) is asked which leg leads (`cue_word`): where the other leads one interval on, the interval is a step.++ Asked where a pass can hide (`reading.overlap` over HIDE_SHARE, the far foot behind the near one): there the picture+ marks cycles unless the cue says the other leg leads. Asked too where the `view` is given and is not the side, but+ there the picture alone marks nothing: legs drawn alike are the same picture a step on as a cycle on, so the cue must+ say the other leg leads a step on — half an interval on. A cue that does not tell the legs apart (one that does not+ move, or turns over neither a step on nor an interval on) leaves the crossings on steps, as from the side, where the+ legs a step on are one silhouette and the picture cannot tell. Returns what was read, None where it is not asked."""if reading.mode != 'gap' or not reading.readable:return Noneoverlap = reading.overlap@@ -520,6 +551,8 @@ def read_cycles(reading, distances, *, view=None, cue=None):if hides else f'the {view} view, the legs side by side'),'interval': round(d, 2), 'overlap': None if overlap is None else round(overlap, 3),**{k: None if v is None else round(v, 3) for k, v in near.items()}, 'slack': CYCLE_SLACK}+ picture = (f"the clip one interval on ({near['one']:.2f} steps off) is nearer than half an interval on ({near['half']:.2f}) "+ f"and as near as two on ({near['two']:.2f}, +{CYCLE_SLACK:g})" if None not in near.values() else None)if None in near.values():said.update(cycles=False, why='the clip is too short to be read two intervals on')elif not (near['one'] < near['half'] and near['one'] <= near['two']+CYCLE_SLACK):@@ -527,16 +560,22 @@ def read_cycles(reading, distances, *, view=None, cue=None):f"an interval on ({near['half']:.2f}) and two on ({near['two']:.2f}, +{CYCLE_SLACK:g}) ""would make it: the crossings mark steps")else:- turned = None if cue is None else crossings_mod.correlation_on(cue, d)- if cue is not None:- said['cue'] = {'one': None if turned is None else round(turned, 3), 'swapped': CUE_SWAPPED}- if turned is not None and turned <= CUE_SWAPPED:+ word = None if cue is None else cue_word(cue, d, step=cue_step)+ if word is not None:+ said['cue'] = word+ says = None if word is None else word['says']+ if says == 'steps':said.update(cycles=False, why=f"the clip one interval on is the same picture, but the view's foot cue turns over "- f"there ({turned:+.2f}, at most {CUE_SWAPPED:+g}): the other leg leads, a step")+ f"there ({word['one']:+.2f}, at most {CUE_SWAPPED:+g}): the other leg leads, a step")+ elif hides:+ said.update(cycles=True, why=f"{picture}: the same leg leads, the feet meet once a cycle")+ elif says == 'cycles':+ said.update(cycles=True, why=f"{picture}, and the view's foot cue turns over half an interval on ({word['half']:+.2f}, "+ f"at most {CUE_SWAPPED:+g}): the other leg leads a step on, the feet meet once a cycle")else:- said.update(cycles=True, why=f"the clip one interval on ({near['one']:.2f} steps off) is nearer than half an "- f"interval on ({near['half']:.2f}) and as near as two on ({near['two']:.2f}, "- f"+{CYCLE_SLACK:g}): the same leg leads, the feet meet once a cycle")+ said.update(cycles=False, why=f"{picture}, but the view's foot cue does not tell the legs apart "+ f"({word['why'] if word is not None else 'none given'}): a step on draws as a cycle "+ "on, as from the side, and the crossings mark steps")reading.mark_cycles(said)return said@@ -683,14 +722,20 @@ def _two_steps(cycle, record):def step_verdict(cycle):- """The step count's warnings, in words: a cut taken on two steps whose seam the pixel search refuses (a part off- the legs' beat) or that passed no gate, a search's cut kept where no two-step cut closes, and a clip that shows- its steps but no cut of two."""+ """The step count's warnings, in words: crossings left on steps because the view's foot cue cannot tell the legs+ apart where the clip one interval on is the same picture (`read_cycles`), a cut taken on two steps whose seam the+ pixel search refuses (a part off the legs' beat) or that passed no gate, a search's cut kept where no two-step cut+ closes, and a clip that shows its steps but no cut of two."""counted = cycle.get('step_count')if not counted or not counted.get('readable'):return []s, L = cycle['start'], cycle['length']out = []+ said = counted.get('cycles') or {}+ if said.get('cycles') is False and (said.get('cue') or {}).get('says', 'steps') is None:+ out.append(f"the clip one interval on is the same picture, as a walk whose feet meet once a cycle draws it, but the "+ f"view's foot cue does not tell its legs apart ({said['cue']['why']}): its crossings are counted as steps, "+ f"as from the side — where its feet do meet once a cycle, each step counted in the cut {s}/{L} is a cycle")if counted.get('chosen_by') == 'two steps':if not counted.get('gated'):out.append(f"the cut {s}/{L} covers two steps by the clip's crossings, but no two-step cut joins the walk within "diff --git a/sprite_gen/video/loop.py b/sprite_gen/video/loop.pyindex da1dd7f..bece907 100644--- a/sprite_gen/video/loop.py+++ b/sprite_gen/video/loop.py@@ -1542,20 +1542,22 @@ def wrap_on_cells(frames: list[Image.Image]) -> float:def read_steps(frames: list[Image.Image], D: np.ndarray, *, view: str | None = None, facing: str = "right",signals: dict[str, list[float]] | None = None) -> crossings_mod.Reading:"""The clip's crossings (`crossings.read`), and whether they mark its cycles (`local_cycle.read_cycles`, on `D`, the- clip's distances, and the `view`'s foot cue: `legs.shade_cue` from the side or a diagonal, `legs.depth_cue` from the- front or back). Every count the clip's steps make is read on it: the search's cut (`_by_steps`), a fixed cut- (`fixed_count`) and, carried to the loop, the loop as it plays (`ring_steps`). `signals` are the frames' leg signals- where already read."""+ clip's distances, and the `view`'s foot cue: `legs.shade_cue` from the side or a diagonal, drawn in tones of+ `legs.TONE`, `legs.depth_cue` from the front or back, in pixel rows of the body's median height). Every count the+ clip's steps make is read on it: the search's cut (`_by_steps`), a fixed cut (`fixed_count`) and, carried to the+ loop, the loop as it plays (`ring_steps`). `signals` are the frames' leg signals where already read."""signals = leg_signals(frames) if signals is None else signalstry:reading = crossings_mod.read(crossings_mod.foot_signals(frames, gap=signals["gap"] if signals else None))except ValueError:return crossings_mod.Reading(len(frames), "gap", [], why="a frame has no solid body to read the feet from")- cue = None+ cue = step = Noneif view is not None:lateral = view in handed_mod.LATERAL_VIEWScue = [legs_mod.shade_cue(f, facing) if lateral else legs_mod.depth_cue(f) for f in frames]- local_cycle.read_cycles(reading, D, view=view, cue=cue)+ heights = signals["height"] if signals else legs_mod.strike_signals(frames)["height"]+ step = legs_mod.TONE if lateral else 1.0 / float(np.median(heights))+ local_cycle.read_cycles(reading, D, view=view, cue=cue, cue_step=step)return reading@@ -2780,7 +2782,8 @@ def add_arguments(parser: argparse.ArgumentParser) -> None:help="walk/run: the view the clip is filmed from. The step count asks whether the feet, which need not ""meet on the screen at every pass, meet once a cycle (`cycle.step_count.cycles`): where a pass ""can hide, as without it, and from the front, the back or a diagonal also where passes are brief, "- "the view's foot cue saying whether the other leg leads an interval on (docs/loop-repair.md "+ "there only where the view's foot cue says the other leg leads a step on, half an interval on — "+ "a cue that does not tell the legs apart leaves them on steps, as from the side (docs/loop-repair.md ""section 3, \"The step count\"). Default: not given, asked only where a pass can hide")parser.add_argument("--name", default="loop", help="basename for strip/gif/webp outputs")parser.add_argument("--report", type=Path)diff --git a/tests/video/test_walk_steps.py b/tests/video/test_walk_steps.pyindex f38075d..756dbb9 100644--- a/tests/video/test_walk_steps.py+++ b/tests/video/test_walk_steps.py@@ -16,9 +16,10 @@ Two whose feet meet on the screen once a cycle, read as cycles (`local_cycle.reaseen from behind whose far foot passes hidden behind the near one, on ones, twos or threes, a cycle a whole number offrames or not (the parent engine counted the cycle one step and cut two cycles, or kept the search's cut unwritten); anda walk on a front diagonal whose near foot steps out toward the camera and passes the far one apart, read so where its-view is given. Two guards: from the side, or where the view's foot cue says the other leg leads an interval on, the-count stands however alike a step on draws. And one the count alone gets wrong, where the search's cut stands: a walk on-threes whose tail closes on no cut of two steps.+view is given and its foot cue turns over a step on. Three guards: from the side, where the view's foot cue says the+other leg leads an interval on, and where the cue cannot tell the legs apart (legs drawn alike, filmed from the front,+the back or a diagonal), the count stands however alike a step on draws. And one the count alone gets wrong, where the+search's cut stands: a walk on threes whose tail closes on no cut of two steps.A walk the search already cuts two steps long, joined at the walk's own point, is cut exactly as before; a bodywhose feet cannot be read is cut as before. Synthetic frames only."""@@ -34,7 +35,7 @@ import pytestfrom PIL import Image, ImageDrawfrom conftest import feet_unseen-from sprite_gen.video import crossings, local_cycle, loop+from sprite_gen.video import crossings, legs, local_cycle, loopFRAMES = 73@@ -126,9 +127,10 @@ def _outward(k: float, *, cycle: float) -> Image.Image:return im-def _alike(k: float, *, cycle: float, phase: float = 0, tone: int = 1, lean: float = 0) -> Image.Image:+def _alike(k: float, *, cycle: float, phase: float = 0, tone: int = 1, lean: float = 0, leg_tone: int | None = None) -> Image.Image:"""A side walker whose two steps are the same silhouette: the far leg and arm `tone` tones lighter than the near- ones, the arms swinging `lean` px further back than forward — nothing else tells a step from the next."""+ ones (the far leg `leg_tone`, where given: 0 draws the legs alike), the arms swinging `lean` px further back than+ forward — nothing else tells a step from the next."""ph = 2 * math.pi * (k + phase) / cycleim = Image.new("RGBA", (300, 220))d = ImageDraw.Draw(im)@@ -136,7 +138,7 @@ def _alike(k: float, *, cycle: float, phase: float = 0, tone: int = 1, lean: flofor sign, t in ((1, 0), (-1, tone)):sw = sign * (16 * math.sin(ph) + lean)d.rectangle((x + 14 - sw - 4, y + 34, x + 14 - sw + 4, y + 72), fill=(190 + t, 190 + t, 190 + t, 255))- for sign, t in ((1, 0), (-1, tone)):+ for sign, t in ((1, 0), (-1, tone if leg_tone is None else leg_tone)):lx = x + 14 + 14 * sign * math.sin(ph)d.rectangle((lx - 5, y + 80, lx + 5, y + 126), fill=(60 + t, 60 + t, 70 + t, 255))d.rectangle((x, y + 30, x + 28, y + 84), fill=(200, 80, 80, 255))@@ -313,7 +315,11 @@ def test_a_diagonal_walk_whose_near_foot_steps_out_is_cut_one_cycle_from_its_vie_cut(tmp_path / "view", keyed, "--view", "front_diagonal")counted = _one_cycle(tmp_path / "view", cycle)assert counted["cycles"]["overlap"] <= crossings.HIDE_SHARE and counted["cycles"]["asked"] == "the front_diagonal view, the legs side by side"- assert counted["cycles"]["cue"]["one"] > local_cycle.CUE_SWAPPED+ # The far leg a tone off the near one moves the cue a tone where the feet part: over the floor, and it turns over+ # half an interval on (a step on) and not one — the other leg leads a step on, the interval is two.+ cue = counted["cycles"]["cue"]+ assert cue["says"] == "cycles" and cue["range"] >= cue["floor"] == pytest.approx(local_cycle.CUE_FLOOR * legs.TONE, rel=0.01)+ assert cue["half"] <= local_cycle.CUE_SWAPPED < cue["one"]plain = _cut(tmp_path / "plain", keyed)assert "cycles" not in plain["cycle"]["step_count"] and abs(plain["cycle"]["length"] - 2 * cycle) <= 1@@ -342,7 +348,28 @@ def test_a_diagonal_walk_whose_foot_cue_turns_over_a_step_on_is_cut_two_steps(tmcounted = _two_steps(report, 46)said = counted["cycles"]assert said["cycles"] is False and said["one"] <= said["two"] + local_cycle.CYCLE_SLACK- assert said["cue"]["one"] <= local_cycle.CUE_SWAPPED and "the other leg leads" in said["why"]+ assert said["cue"]["one"] <= local_cycle.CUE_SWAPPED and said["cue"]["says"] == "steps" and "the other leg leads" in said["why"]++[email protected]("view", ["front", "front_diagonal", "back", "back_diagonal"])+def test_a_walk_whose_legs_are_drawn_alike_is_cut_two_steps_from_any_view(tmp_path, view):+ """The same walker with its legs drawn alike, its arms still four tones apart, filmed from the front, the back or a+ diagonal: one interval on (a step on) is the same picture, as near as two on, and the view's foot cue does not move+ — the shade of legs drawn alike, feet drawn on one row — its range far under half the step it is drawn in. The cue+ does not tell the legs apart and the picture cannot, and the crossings stay on steps, as from the side: two steps,+ 46 frames, and a warning naming why (the parent engine read the still cue's float roundings, or no correlation, as+ the same leg leading and cut 23 frames, one step, counted two)."""+ report = _cut(tmp_path / "out", _keyed(tmp_path, lambda k: _alike(k, cycle=46, phase=13, tone=4, lean=1, leg_tone=0)),+ "--view", view)+ counted = _two_steps(report, 46)+ said = counted["cycles"]+ assert said["asked"] == f"the {view} view, the legs side by side" and said["overlap"] <= crossings.HIDE_SHARE+ assert said["cycles"] is False and said["one"] < said["half"] and said["one"] <= said["two"] + local_cycle.CYCLE_SLACK+ assert said["cue"]["says"] is None and said["cue"]["range"] < said["cue"]["floor"] and "one" not in said["cue"]+ assert "does not tell the legs apart" in said["why"]+ assert any("does not tell its legs apart" in w and f"the cut {report['cycle']['start']}/46" in w+ for w in report["jolt"]["warnings"])@pytest.mark.slow@@ -447,14 +474,14 @@ def _reading(run: int) -> crossings.Reading:def _choose(found: dict, *, period: int, seam: float, run: int = 9, search_seam: float = 1.0, view: str | None = None,- cue: list[float] | None = None) -> tuple[dict, dict]:+ cue: list[float] | None = None, cue_step: float | None = None) -> tuple[dict, dict]:"""`by_steps` on a clip whose picture goes round every `period` frames and whose feet meet every 15 (`_reading`),- its crossings read as `read_cycles` reads them from `view` and its foot `cue`, with the search's cut `found`: every- two-step cut's seam reads `seam` at the gate, its top calm and its flow off 1.0 either side, and the search's own- cut `search_seam`."""+ its crossings read as `read_cycles` reads them from `view` and its foot `cue` (drawn in steps of `cue_step`, where+ given), with the search's cut `found`: every two-step cut's seam reads `seam` at the gate, its top calm and its flow+ off 1.0 either side, and the search's own cut `search_seam`."""D = _distances(period=period, frames=FRAMES)reading = _reading(run)- local_cycle.read_cycles(reading, D, view=view, cue=cue)+ local_cycle.read_cycles(reading, D, view=view, cue=cue, **({} if cue_step is None else {"cue_step": cue_step}))return local_cycle.by_steps(D, np.zeros(FRAMES), reading, found=dict(found), refused=None, min_len=12, max_len=FRAMES,seam_flow=lambda s, L: {"off": [1.0, 1.0], "turn": [0.0, 0.0], "window": [[0, 0, 1, 1], [0, 0, 1, 1]]},@@ -518,17 +545,54 @@ def test_where_the_feet_meet_briefly_the_count_stands_from_the_side_or_no_view(vdef test_from_a_diagonal_the_foot_cue_says_which_leg_leads_an_interval_on(turns, cycles):"""The same brief meetings from a front diagonal: asked. One interval on is the same picture; where the view's footcue turns over there (the near foot's shade leading one interval, the far one's the next) the other leg leads and- the count stands, two steps of 15; where it does not, the crossings mark cycles and the search's 15 frames are the- cycle."""+ the count stands, two steps of 15; where it turns over half an interval on instead and holds one on, the other leg+ leads a step on, the crossings mark cycles and the search's 15 frames are the cycle."""t = np.arange(FRAMES)cue = list(np.sin(2 * np.pi * (t - 8) / (30 if turns else 15)))- picked, record = _choose({"start": 10, "length": 15}, period=15, seam=1.0, run=3, view="front_diagonal", cue=cue)+ picked, record = _choose({"start": 10, "length": 15}, period=15, seam=1.0, run=3, view="front_diagonal", cue=cue,+ cue_step=legs.TONE)said = record["cycles"]assert said["asked"] == "the front_diagonal view, the legs side by side" and said["cycles"] is cycles- assert (said["cue"]["one"] <= local_cycle.CUE_SWAPPED) is turns+ assert (said["cue"]["one"] <= local_cycle.CUE_SWAPPED) is turns and said["cue"]["says"] == ("steps" if turns else "cycles")+ assert turns or said["cue"]["half"] <= local_cycle.CUE_SWAPPEDassert abs(picked["length"] - (15 if cycles else 30)) <= (0 if cycles else 1)[email protected]("cue", ["still", "own beat"])+def test_from_a_diagonal_a_cue_that_does_not_tell_the_legs_apart_leaves_the_crossings_on_steps(cue):+ """The same brief meetings from a front diagonal, the clip one interval on the same picture, but the view's foot cue+ does not tell the legs apart. Legs drawn alike leave it still: a few float roundings, its range far under half a+ tone (`legs.TONE`) — not read, however well the roundings, which repeat with the legs, correlate one interval on. Or+ it flickers on a beat of its own (every 4 frames), turning over neither a step on nor an interval on. It says nothing,+ the picture alone cannot tell a step on from a cycle on, and the count stands, two steps of 15, a warning naming it+ (the parent engine read either as the same leg leading and kept the search's 15 frames, counted two steps)."""+ t = np.arange(FRAMES)+ values = 1e-8 * np.sin(2 * np.pi * (t - 8) / 15) if cue == "still" else 0.05 * np.cos(2 * np.pi * t / 4)+ picked, record = _choose({"start": 10, "length": 15}, period=15, seam=1.0, run=3, view="front_diagonal",+ cue=list(values), **({"cue_step": legs.TONE} if cue == "still" else {}))+ said = record["cycles"]+ assert said["one"] < said["half"] and said["one"] <= said["two"] + local_cycle.CYCLE_SLACK+ assert said["cycles"] is False and said["cue"]["says"] is None and "does not tell the legs apart" in said["why"]+ if cue == "still":+ assert said["cue"]["range"] < said["cue"]["floor"] and "one" not in said["cue"]+ else:+ assert said["cue"]["half"] > local_cycle.CUE_SWAPPED and said["cue"]["one"] > local_cycle.CUE_SWAPPED+ assert record["chosen_by"] == "two steps" and abs(picked["length"] - 30) <= 1+ warned = local_cycle.step_verdict({**picked, "step_count": record})+ assert any("does not tell its legs apart" in w for w in warned)+++def test_where_a_pass_can_hide_a_still_cue_leaves_the_picture_to_mark_cycles():+ """Where a pass can hide (the feet together 9 frames at each meeting) the picture marks cycles, as without a view: a+ still cue (legs drawn alike to it) is no cue, and says nothing against it — whatever its roundings correlate."""+ t = np.arange(FRAMES)+ cue = list(-1e-8 * np.cos(2 * np.pi * (t - 8) / 30))+ picked, record = _choose({"start": 10, "length": 15}, period=15, seam=1.0, view="back_diagonal", cue=cue, cue_step=legs.TONE)+ said = record["cycles"]+ assert said["asked"].startswith("the feet together") and said["cycles"] is True and said["cue"]["says"] is None+ assert (picked["start"], picked["length"]) == (10, 15) and picked["steps"] == {"count": 2, "by": "crossings"}++@pytest.mark.parametrize("verdict, named", [("uncertain", True), ("two", False)])def test_a_walk_that_starts_and_stops_in_the_take_is_named_to_film_again(verdict, named):"""Feet together 15 frames at the head and 14 at the tail, longer than any pass the clip shows whole (8, 3): the