Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
fix(video): a foot cue that does not move leaves a walk's crossings on steps where a pass can hide
Soohong Kim8ed31897eb4b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e097b63..a5d751b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,23 +4,24 @@ 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: 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`.+**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 only where the shade of its feet's two halves moves: 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`; where the shade does not move (legs drawn alike to it), its crossings stay on steps, cut as in 3.5.0, with a warning. 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, and a foot cue that does not move leaves the crossings on steps wherever it is read, where a pass can hide too. Every report whose clip stands still gains `stands` and `run_limit`, reports where cycle reading is asked gain `cycles`, and reports where a pass can hide gain `cycles.cue` with no view as well.-- **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`.+- **New: crossing cycle detection (`local_cycle.read_cycles`, `local_cycle.cue_word`, `crossings.HIDE_SHARE`, `crossings.Reading.hides`, `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); with no view, where a pass can hide, the feet's shade is read only for whether it moves (`lead` false): 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 `"alike"`, one that moves says nothing (null); `"steps"` and `"cycles"` are said only by the view's cue, `"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"` or `"alike"`; 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: {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)`.+- Report fields: `cycle.step_count.cycles` (`{asked, interval, overlap, half, one, two, slack, cue: {range, floor, swapped, half, one, says, why}, cycles, why}`, the cue's `half` and `one` absent where `says` is `"alike"`, and with no view where a pass can hide and the picture repeats each interval `{range, floor, says, 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, lead=True)`, `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`, `hides`, 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), 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`);+ - 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 says `"alike"` (it 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;+ - the same 46-frame walker with its legs drawn alike and each leg twice as wide (10 px either side of its line instead of 5), so the feet are seen together over half the interval at each pass, where a pass could hide: asked with no view and with `--view` set to `side`, `front_diagonal` and `back`, one interval on (a step on) is the same picture, as near as two on, but the foot cue (the view's, or with no view the feet's shade) does not move (`says: "alike"`): two steps, 46 frames, `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 at each meeting), a still cue, with the back diagonal view or with no view, leaves the crossings on steps (two steps of 15, 30 frames, with the warning); with no view a shade that moves, even one turning over one interval on, is not asked which leg leads and leaves the picture to mark cycles (15 frames kept 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 ec9ca97..6d174c3 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` (`range`, `floor`, `swapped`, `half`, `one`, `says`, `why`), `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`; `says` is `"steps"`, `"cycles"`, `"alike"` or null; with no view, where a pass can hide, `cue` has only `range`, `floor`, `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` |@@ -1308,55 +1308,75 @@ it). It is read at half the crossing interval (`half`), one interval (`one`) andThe 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 twoon, 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`, and-is 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: 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 (`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.+(`local_cycle.cue_word(cue, interval, step=None, lead=True)`): `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. With no view given, where a pass can hide+(`reading.hides`), `video-loop` reads the shade of the feet's two halves (`legs.shade_cue`, in steps of+`legs.TONE`) and passes it to `local_cycle.read_cycles` as the cue, read only for whether it moves+(`lead` false). 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 `"alike"`, its correlations are not read (`half` and `one` absent), and `why` gives its range and+the step. 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, with `lead` true (the view's foot cue), 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). With `lead` false (no view), only whether+the cue moves is read: its correlations are not read, because the two halves are the picture's halves,+which are the two legs only from the side or a diagonal; a cue that moves says null, `why` "it moves;+with no view, which leg leads is not read", and the record has only `range`, `floor`, `says` and `why`+(no `swapped`, `half` or `one`). Where a pass can hide (`reading.overlap` over `crossings.HIDE_SHARE`,+0.5), the picture marks cycles unless the cue says `"steps"` (the view's cue) or `"alike"` (the view's+cue, or with no view the feet's shade). Legs drawn alike to the cue are the same picture a step on as a+cycle on, so the picture cannot tell; the crossings stay on steps, as from the side, with the warning. A+cue that moves and says null 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 `"alike"` or null, the crossings stay on+steps, as from the side, the cut taken without a view, with the warning. Where the crossings stay on+steps this way, `cycles.why` says the view's foot cue does not tell the legs apart (with the cue's own+`why` in parentheses): a step on draws as a cycle on, as from the side, and the crossings mark steps+(with no view, "the feet's shade" in place of "the view's foot cue"); 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 its 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. It is given wherever the crossings stay on steps because the cue says+`"alike"` or null, where a pass can hide too. 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}`+(the cue's `half` and `one` absent where `says` is `"alike"`), and with no view where a pass can hide and+the picture repeats each interval `cue: {range, floor, says, why}`; `says` is `"steps"`, `"cycles"`,+`"alike"` or null; 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`, and is 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: 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 (`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,+`says: "alike"`). The crossings stay on steps: two steps, 46 frames, `cycles` false, and a warning that+names the cut. The same 46-frame walker with its legs drawn alike and each leg twice as wide (10 px+either side of its line instead of 5), so the feet are seen together over half the interval at each pass,+where a pass could hide: asked with no view and with `--view` set to `side`, `front_diagonal` and `back`.+One interval on (a step on) is the same picture, as near as two on, but the foot cue (the view's, or with+no view the feet's shade) does not move (`says: "alike"`): two steps, 46 frames, `cycles` false, and a+warning that names the cut.**Choosing the cut.**@@ -1420,8 +1440,8 @@ 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, 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+clip repeats one interval on as near as two on, a pass that can hide marks cycles unless the cue says+`"steps"` or `"alike"`, 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: aside walk with brief passes whose two steps are one silhouette is not asked, because from the side thelegs a step on are one silhouette, as near as a cycle on, and the picture cannot tell; a clip with no@@ -1432,7 +1452,12 @@ its crossings left on steps: where its feet do meet once a cycle, it is cut twowarning; and a cue that moves with how the feet meet rather than with which leg leads (for example bothfeet drawn lighter as they part) turns over half an interval on just as swapped legs do, and can stillread 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.+on by chance. With no view the feet's shade is read only for whether it moves, so where a pass can hide,+a walk whose legs are drawn a few tones apart (its shade moves) and whose two steps look alike in the+picture can still be read as cycles from the picture: give `--view`. And a walk whose far foot does pass+hidden while its legs are drawn alike to its cue (the view's, or with no view the feet's shade) has its+crossings left on steps: where its feet do meet once a cycle, it is cut two cycles long, with the+warning. 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/crossings.py b/sprite_gen/video/crossings.pyindex 93ab3af..283bf0f 100644--- a/sprite_gen/video/crossings.py+++ b/sprite_gen/video/crossings.py@@ -252,6 +252,12 @@ class Reading:return Nonereturn float(np.median(whole)) / self.interval+ @property+ def hides(self) -> bool:+ """Gap mode: whether a pass can hide among the feet seen together (`overlap` over HIDE_SHARE)."""+ overlap = self.overlap+ return overlap is not None and overlap > HIDE_SHARE+def record(self) -> dict[str, Any]:"""The reading as the report keeps it."""out: dict[str, Any] = {"method": "observed-crossings-v1", "mode": self.mode, "readable": self.readable,diff --git a/sprite_gen/video/local_cycle.py b/sprite_gen/video/local_cycle.pyindex 4488e92..00c4653 100644--- a/sprite_gen/video/local_cycle.py+++ b/sprite_gen/video/local_cycle.py@@ -36,8 +36,8 @@ CYCLE_SLACK = 0.5# 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).+# 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) rounds to one value: the legs are drawn alike to it, 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@@ -500,20 +500,23 @@ def repeat_at(distances, span):return min(found) if found else 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."""+def cue_word(cue, interval, *, step=None, lead=True):+ """What a foot cue (`cue`, per frame) says of the legs `interval` frames on (`read_cycles`): `says` `alike` where its+ 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 does not move: the legs are drawn alike to it, and its correlation (the arithmetic's) is not read. Else,+ for the view's cue (`lead`), `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. With no view+ (`lead` false: the shade of the feet's two halves) only whether it moves is read. Returns the record."""values = np.asarray(cue, dtype=float)spread = float(values.max()-values.min()) if values.size else 0.0word = {'range': float(f'{spread:.3g}'), **({'floor': float(f'{CUE_FLOOR*step:.3g}')} if step is not None else {}),- 'swapped': CUE_SWAPPED}+ **({'swapped': CUE_SWAPPED} if lead else {})}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'}+ return {**word, 'says': 'alike', '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'}+ if not lead:+ return {**word, 'says': None, 'why': 'it moves; with no view, which leg leads is not read'}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:@@ -530,19 +533,20 @@ def read_cycles(reading, distances, *, view=None, cue=None, cue_step=None):at 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, 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."""+ intervals on within CYCLE_SLACK. Where the clip says so, a foot cue (`cue`, per frame, drawn in steps of `cue_step`)+ is asked (`cue_word`): the view's, which leg leads — where the other leads one interval on, the interval is a step —+ and with no view the shade of the feet's two halves, only whether it moves.++ Asked where a pass can hide (`reading.hides`, the far foot behind the near one): there the picture marks cycles+ unless the cue says the other leg leads, or does not move — legs drawn alike to it are the same picture a step on as+ a cycle on. Asked too where the `view` is given and is not the side, but there the picture alone marks nothing: 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 there 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 None- overlap = reading.overlap- hides = overlap is not None and overlap > HIDE_SHARE+ overlap, hides = reading.overlap, reading.hidesif not hides and view in (None, SIDE_VIEW):return Noned = reading.interval@@ -560,20 +564,21 @@ def read_cycles(reading, distances, *, view=None, cue=None, cue_step=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:- word = None if cue is None else cue_word(cue, d, step=cue_step)+ word = None if cue is None else cue_word(cue, d, step=cue_step, lead=view is not None)if word is not None:said['cue'] = wordsays = 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 ({word['one']:+.2f}, at most {CUE_SWAPPED:+g}): the other leg leads, a step")- elif hides:+ elif hides and says != 'alike':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=False, why=f"{picture}, but the view's foot cue does not tell the legs apart "+ named = "the view's foot cue" if view is not None else "the feet's shade"+ said.update(cycles=False, why=f"{picture}, but {named} 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)@@ -722,19 +727,19 @@ def _two_steps(cycle, record):def step_verdict(cycle):- """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."""+ """The step count's warnings, in words: crossings left on steps because a 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, "+ if said.get('cycles') is False and (said.get('cue') or {}).get('says', 'steps') in (None, 'alike'):+ out.append(f"the clip one interval on is the same picture, as a walk whose feet meet once a cycle draws it, but its "+ f"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'):diff --git a/sprite_gen/video/loop.py b/sprite_gen/video/loop.pyindex bece907..46c2f2c 100644--- a/sprite_gen/video/loop.py+++ b/sprite_gen/video/loop.py@@ -1543,9 +1543,10 @@ def read_steps(frames: list[Image.Image], D: np.ndarray, *, view: str | None = Nsignals: 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`, theclip'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."""+ `legs.TONE`, `legs.depth_cue` from the front or back, in pixel rows of the body's median height; with no view, where+ a pass can hide, the shade of the feet's two halves, read only for whether it moves). 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))@@ -1557,6 +1558,8 @@ def read_steps(frames: list[Image.Image], D: np.ndarray, *, view: str | None = Ncue = [legs_mod.shade_cue(f, facing) if lateral else legs_mod.depth_cue(f) for f in frames]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))+ elif reading.readable and reading.hides:+ cue, step = [legs_mod.shade_cue(f, facing) for f in frames], legs_mod.TONElocal_cycle.read_cycles(reading, D, view=view, cue=cue, cue_step=step)return reading@@ -2783,8 +2786,10 @@ def add_arguments(parser: argparse.ArgumentParser) -> None:"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, ""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")+ "a cue that does not tell the legs apart leaves them on steps, as from the side, and so does one "+ "that does not move (legs drawn alike to it) wherever it is asked (docs/loop-repair.md section 3, "+ "\"The step count\"). Default: not given, asked only where a pass can hide, and there the feet's "+ "shade is read only for whether it moves")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 756dbb9..6a88245 100644--- a/tests/video/test_walk_steps.py+++ b/tests/video/test_walk_steps.py@@ -16,10 +16,11 @@ 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 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.+view is given and its foot cue turns over a step on. Four guards: from the side, where the view's foot cue says the+other leg leads an interval on, where the cue cannot tell the legs apart (legs drawn alike, filmed from the front, the+back or a diagonal), and where legs drawn alike and wide keep the feet together over half the interval at a pass, as a+hidden pass does (with a view or none), 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."""@@ -127,10 +128,12 @@ 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, leg_tone: int | None = None) -> Image.Image:+def _alike(k: float, *, cycle: float, phase: float = 0, tone: int = 1, lean: float = 0, leg_tone: int | None = None,+ leg_half: int = 5) -> Image.Image:"""A side walker whose two steps are the same silhouette: the far leg and arm `tone` tones lighter than the nearones (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."""+ forward — nothing else tells a step from the next. Each leg is drawn `leg_half` px either side of its line: at 10+ the feet are seen together over half the interval at a pass, as where the far foot passes hidden."""ph = 2 * math.pi * (k + phase) / cycleim = Image.new("RGBA", (300, 220))d = ImageDraw.Draw(im)@@ -140,7 +143,7 @@ def _alike(k: float, *, cycle: float, phase: float = 0, tone: int = 1, lean: flod.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 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((lx - leg_half, y + 80, lx + leg_half, y + 126), fill=(60 + t, 60 + t, 70 + t, 255))d.rectangle((x, y + 30, x + 28, y + 84), fill=(200, 80, 80, 255))d.rectangle((x + 2, y, x + 26, y + 28), fill=(230, 200, 170, 255))return im@@ -366,12 +369,34 @@ def test_a_walk_whose_legs_are_drawn_alike_is_cut_two_steps_from_any_view(tmp_pasaid = counted["cycles"]assert said["asked"] == f"the {view} view, the legs side by side" and said["overlap"] <= crossings.HIDE_SHAREassert 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 said["cue"]["says"] == "alike" 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 wfor w in report["jolt"]["warnings"])[email protected]("view", [None, "side", "front_diagonal", "back"])+def test_a_walk_whose_legs_are_drawn_alike_and_wide_is_cut_two_steps_where_a_pass_could_hide(tmp_path, view):+ """The same walker with its legs drawn alike and twice as wide: the feet are seen together over half the interval at+ each pass, as where the far foot passes hidden, so the count asks the picture with or without a view — and one+ interval on (a step on) is the same picture, as near as two on. But the foot cue does not move: the view's, or with+ no view the shade of the feet's two halves, its range far under half the step it is drawn in. The legs are drawn+ alike to it, the picture cannot tell a step on from a cycle on, and the crossings stay on steps: two steps, 46+ frames, and a warning naming why (the parent engine let the picture mark cycles and cut 23 frames, one step, counted+ two)."""+ keyed = _keyed(tmp_path, lambda k: _alike(k, cycle=46, phase=13, tone=4, lean=1, leg_tone=0, leg_half=10))+ report = _cut(tmp_path / "out", keyed, *(("--view", view) if view else ()))+ counted = _two_steps(report, 46)+ said = counted["cycles"]+ assert said["asked"].startswith("the feet together") 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"] == "alike" and said["cue"]["range"] < said["cue"]["floor"] and "one" not in said["cue"]+ assert ("the view's foot cue" if view else "the feet's shade") + " 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.slowdef test_a_cut_of_two_steps_that_does_not_close_leaves_the_searchs_cut(tmp_path):"""On threes, a big tail on its own beat: the search's cut is one the count does not refute (it plays feet held@@ -572,7 +597,8 @@ def test_from_a_diagonal_a_cue_that_does_not_tell_the_legs_apart_leaves_the_croscue=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"]+ assert said["cycles"] is False and "does not tell the legs apart" in said["why"]+ assert said["cue"]["says"] == ("alike" if cue == "still" else None)if cue == "still":assert said["cue"]["range"] < said["cue"]["floor"] and "one" not in said["cue"]else:@@ -582,14 +608,36 @@ def test_from_a_diagonal_a_cue_that_does_not_tell_the_legs_apart_leaves_the_crosassert 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."""[email protected]("view", ["back_diagonal", None])+def test_where_a_pass_can_hide_a_still_cue_leaves_the_crossings_on_steps(view):+ """Where a pass can hide (the feet together 9 frames at each meeting) the picture marks cycles unless the cue says+ otherwise. A still cue — the view's, or with no view the shade of the feet's two halves — says the legs are drawn+ alike to it: the picture a step on is then the picture a cycle on, and cannot tell. The crossings stay on steps, two+ steps of 15, a warning naming it, whatever the still cue's roundings correlate (the parent engine let the picture+ mark cycles and kept the search's 15 frames, counted two steps)."""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)+ picked, record = _choose({"start": 10, "length": 15}, period=15, seam=1.0, view=view, cue=cue, cue_step=legs.TONE)+ said = record["cycles"]+ assert said["asked"].startswith("the feet together") and said["cycles"] is False+ assert said["cue"]["says"] == "alike" and said["cue"]["range"] < said["cue"]["floor"] and "one" not in said["cue"]+ assert ("the view's foot cue" if view else "the feet's shade") + " does not tell the legs apart" in said["why"]+ assert record["chosen_by"] == "two steps" and abs(picked["length"] - 30) <= 1+ assert any("does not tell its legs apart" in w for w in local_cycle.step_verdict({**picked, "step_count": record}))+++def test_where_a_pass_can_hide_with_no_view_a_moving_shade_leaves_the_picture_to_mark_cycles():+ """With no view the shade of the feet's two halves is read only for whether it moves, not for which leg leads (its+ halves are the picture's, the legs' only from a side or a diagonal): one that moves — here turning over one+ interval on, as a view's cue whose other leg leads there would — leaves the picture to mark cycles, the search's 15+ frames a cycle, counted two steps."""+ t = np.arange(FRAMES)+ cue = list(0.05 * np.sin(2 * np.pi * (t - 8) / 30))+ picked, record = _choose({"start": 10, "length": 15}, period=15, seam=1.0, 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 said["asked"].startswith("the feet together") and said["cycles"] is True+ assert said["cue"]["says"] is None and said["cue"]["range"] >= said["cue"]["floor"]+ assert "one" not in said["cue"] and "swapped" not in said["cue"]assert (picked["start"], picked["length"]) == (10, 15) and picked["steps"] == {"count": 2, "by": "crossings"}