Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
fix(video): a walk's body witnesses two steps an interval only where it rises and falls of its own, read against its lowest row and its head, so a picture shaken or zoomed on its beat is no witness
Soohong Kim288539f0e682
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d0f4987..52aee8b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,18 +4,18 @@ 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 only where its body witnesses it, 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 only where the body's top line, read less the picture's own flow, rises and falls twice an interval: 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 nothing witnesses, its crossings stay on steps with a warning (`cycle-unwitnessed`). 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 with the same witness, the view's foot cue only refusing where it turns over one interval on; where nothing witnesses, its crossings stay on steps with a warning, and `video-set` leaves a `cycle-unwitnessed` loop out of the cycle alignment. Every report whose clip stands still gains `stands` and `run_limit`, and reports where cycle reading is asked gain `cycles`, with `bob` where the picture passes and `cue` only where a view is given.+**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 body's top line, read less the picture's own flow, rises and falls twice an interval, and that rise and fall must be the body's own, read against its lowest row and its head's width, so the picture moved or zoomed with it witnesses nothing: 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 nothing witnesses, its crossings stay on steps with a warning (`cycle-unwitnessed`). 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 with the same witness, the view's foot cue only refusing where it turns over one interval on; where nothing witnesses, its crossings stay on steps with a warning, and `video-set` leaves a `cycle-unwitnessed` loop out of the cycle alignment. Every report whose clip stands still gains `stands` and `run_limit`, and reports where cycle reading is asked gain `cycles`, with `bob` where the picture passes and `cue` only where a view is given.-- **New: crossing cycle detection (`local_cycle.read_cycles`, `local_cycle.bob_word`, `local_cycle.off_flow`, `local_cycle.cue_word`, `crossings.HIDE_SHARE`, `crossings.Reading.hides`, `CYCLE_SLACK`, `CUE_FLOOR`, `CUE_SWAPPED`, `BOB_TWICE`, `BOB_FLOOR`, `BOB_ROWS`, `UNWITNESSED`).** 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), only where a witness that reads no leg says the interval holds two steps: the body's top line (`legs.strike_signals` `top`) less its flow rising and falling twice an interval. New function `local_cycle.off_flow(values, interval)` returns `values` (per frame) less their flow: each frame minus the mean of the interval about it (a moving average one interval long, its two end frames weighted by the part of a frame the interval covers), kept only over the frames the interval fits about (the first and last `ceil(interval/2 - 0.5)` frames drop out), and what is left minus its least-squares straight line; a rise and fall once or twice an interval averages to nothing over one interval and is left whole, while a flow slower than the interval is taken out wholly where it bends no more than a cubic (a constant, a straight drift, an arc, a cubic) and in part where it is a slow sway a few intervals long. `local_cycle.bob_word(top, interval, height)` reads the body's top line less its flow (`off_flow(top, interval)`), not the raw line; `swing` is the range of the line left over the body's median height, and `rows` is that range in pixel rows. Where the clip is under an interval long so nothing is left, `says` is null and `why` says its top line less its flow is not read; where `swing` is under `BOB_FLOOR` (0.005) or `rows` is under `BOB_ROWS` (2), `says` is null, `why` says the line's range less its flow is under 0.5 % of the body's height or 2 rows, so it does not rise and fall (the top line is read in whole pixel rows, so a picture drifting up or down makes the line step a row up and down as it rounds, and that rounding, less its own mean over an interval, stays under 2 rows), and `half` and `quarter` are not read. Otherwise it reads the line left's correlation half an interval on (`half`) and a quarter of an interval on (`quarter`), both with `crossings.correlation_on` (each the larger of the two whole lags about the span), saying `"cycles"` only where `half` is `BOB_TWICE` (0.28) or more and `quarter` is `-BOB_TWICE` (-0.28) or less (the line is as it was half an interval on and turned over a quarter on, which is a rise and fall twice an interval; a step's bob is turned over half an interval on, and any flow left over is as it was at both half and a quarter of an interval on so it cannot pass the quarter test), null otherwise with `why` giving both values. The directional foot cue (`legs.shade_cue` from the side or diagonal, `legs.depth_cue` from the front or back) is read with a view given by `local_cycle.cue_word(cue, interval, step=None)` and can only refuse cycles: under `CUE_FLOOR` (0.5) of the step it is drawn in (`legs.TONE`, 1/255, or a pixel row of median body height) it says `"alike"`; where it turns over one interval on (`crossings.correlation_on` at or below `CUE_SWAPPED`, `-0.2`) it says `"steps"`, refusing cycles because the other leg leads there; otherwise null. With no view no cue is read at all. Where the view's cue says `"steps"`, the count stands (two steps); else where the bob says `"cycles"`, cycles are marked; otherwise crossings stay on steps with `unwitnessed` true (`local_cycle.UNWITNESSED`) and a warning (`cycle-unwitnessed`). 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.bob_word`, `local_cycle.off_flow`, `local_cycle.twice_an_interval`, `local_cycle.own_beat`, `local_cycle.cue_word`, `crossings.HIDE_SHARE`, `crossings.Reading.hides`, `legs.body_signals`, `CYCLE_SLACK`, `CUE_FLOOR`, `CUE_SWAPPED`, `BOB_TWICE`, `BOB_FLOOR`, `BOB_ROWS`, `BOB_OWN`, `BOB_SCALE`, `BEAT_FRAMES`, `UNWITNESSED`).** 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), only where a witness that reads no leg says the interval holds two steps, the body's own rise and fall twice an interval: its top line (`legs.strike_signals` `top`) less its flow, read against its lowest row and head's width. New function `local_cycle.off_flow(values, interval)` returns `values` (per frame) less their flow: each frame minus the mean of the interval about it (a moving average one interval long, its two end frames weighted by the part of a frame the interval covers), kept only over the frames the interval fits about (the first and last `ceil(interval/2 - 0.5)` frames drop out), and what is left minus its least-squares straight line; a rise and fall once or twice an interval averages to nothing over one interval and is left whole, while a flow slower than the interval is taken out wholly where it bends no more than a cubic (a constant, a straight drift, an arc, a cubic) and in part where it is a slow sway a few intervals long. `local_cycle.bob_word(signals, interval)` reads the body's top line less its flow (`off_flow(top, interval)`), not the raw line; `swing` is the range of the line left over the body's median height, and `rows` is that range in pixel rows. Where the clip is under an interval long so nothing is left, `says` is null and `why` says its top line less its flow is not read; where `swing` is under `BOB_FLOOR` (0.005) or `rows` is under `BOB_ROWS` (2), `says` is null, `why` says the line's range less its flow is under 0.5 % of the body's height or 2 rows, so it does not rise and fall (the top line is read in whole pixel rows, so a picture drifting up or down makes the line step a row up and down as it rounds, and that rounding, less its own mean over an interval, stays under 2 rows), and `half` and `quarter` are not read. Otherwise it reads the line left's correlation half an interval on (`half`) and a quarter of an interval on (`quarter`), both with `crossings.correlation_on` (each the larger of the two whole lags about the span), saying `"cycles"` only where `half` is `BOB_TWICE` (0.28) or more and `quarter` is `-BOB_TWICE` (-0.28) or less (the line is as it was half an interval on and turned over a quarter on, which is a rise and fall twice an interval; a step's bob is turned over half an interval on, and any flow left over is as it was at both half and a quarter of an interval on so it cannot pass the quarter test), null otherwise with `why` giving both values. Where any frame's lowest solid row is the frame's last row (`legs.body_signals` `edge`), `says` is null, `why`: "its lowest row is the frame's last row in {n} of {N} frames: the feet may run off the frame, and the picture moving is not read off them" (there the lowest row is the frame's, not the feet's). `local_cycle.twice_an_interval(values, interval)` reads `values` (per frame) less their flow (`off_flow`), then a least-squares fit of a mean, the harmonic twice an interval (cos and sin of 4 pi k / `interval`) and the harmonic once an interval (cos and sin of 2 pi k / `interval`), k the frames left counted from the first; it returns the twice-an-interval harmonic as a complex amplitude (its cos coefficient less i times its sin coefficient), in the values' units (a line rising and falling a rows either way twice an interval reads a in magnitude; lines read so over the same frames and interval subtract as they move), or None where fewer than `BEAT_FRAMES` (8) frames are left; where none, `says` is null, `why`: "its top line's rise and fall twice an interval is not read against its lowest row and head: under 8 frames are left less the flow". `local_cycle.own_beat(signals, interval)` reads three lines with `twice_an_interval`: the top line (`top`), the lowest solid row (`reach`) and the head's width (`crown`, a log); it returns, in rows up and down (twice the magnitude): `beat` (the top line's), `lowest` (the lowest row's), `head` (the head width's, scaled by the body's median height), `less_lowest` (the top line's less the lowest row's: the picture moving taken out), `less_head` (that again with the head width's, scaled by the body's median height, added: the picture zooming taken out as well), and `own`, the smaller of `less_lowest` and `less_head` (None where a line is not read). The floor is the larger of `BOB_ROWS` and `BOB_FLOOR` of the body's median height; where `less_lowest` is under the larger of `BOB_OWN` (0.3) times `beat` and the floor, `says` is null, `why`: "its lowest row rises and falls with it: less the lowest row's, its top line's rise and fall twice an interval is {x} rows of {beat} ({percent}; at least 30% and {floor} rows): the picture moves with the body, and the body's own is not told from it"; where `less_head` is under the largest of `BOB_OWN` times `beat`, the floor, and `BOB_SCALE` (0.6) times `less_lowest`, `says` is null, `why`: "its head's width changes with it: less the head's scale too, its top line's rise and fall twice an interval is {x} rows of {beat} ({percent}), {ratio} of the {less_lowest} left against the lowest row (at least 30%, {floor} rows and 0.6): the picture zooms with the body, and the body's own is not told from it"; otherwise `says` `"cycles"`. This tells them apart because a body rising and falling on its legs leaves its planted foot, the lowest solid row, on the ground, and its head as wide as it was: the picture moved up and down carries the lowest row with the top line by the same rows, so nothing is left of the line's rise against it, while the picture zoomed in and out widens the head as it lifts the line, by as much as the body's height grows, so nothing is left once the head's scale is taken out too. New `legs.body_signals(frames)` reads per frame `crown`, the log of the mean width (in alpha) of the band from 2 % to 10 % of the clip's median body height below the first solid row (`legs.CROWN` = `(0.02, 0.10)`), and `edge`, 1 where the lowest solid row is the frame's last row, else 0; only the step count's witness reads them, merged by `loop.read_steps` into the signals it passes to `local_cycle.read_cycles`; `legs.strike_signals` is unchanged, so the loop report's `gait.silhouette.signals` is unchanged, and `--anchor none` still gives the old cut, its pictures and reports byte for byte apart from the engine hash. The directional foot cue (`legs.shade_cue` from the side or diagonal, `legs.depth_cue` from the front or back) is read with a view given by `local_cycle.cue_word(cue, interval, step=None)` and can only refuse cycles: under `CUE_FLOOR` (0.5) of the step it is drawn in (`legs.TONE`, 1/255, or a pixel row of median body height) it says `"alike"`; where it turns over one interval on (`crossings.correlation_on` at or below `CUE_SWAPPED`, `-0.2`) it says `"steps"`, refusing cycles because the other leg leads there; otherwise null. With no view no cue is read at all. Where the view's cue says `"steps"`, the count stands (two steps); else where the bob says `"cycles"`, cycles are marked; otherwise crossings stay on steps with `unwitnessed` true (`local_cycle.UNWITNESSED`) and a warning (`cycle-unwitnessed`). 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 and cycle-unwitnessed loops (`batch.align_gaits`, `video-set --align-cycles auto`).** Takes flagged with `start-stop` retakes loop no two steps, and loops whose crossings were left on steps unwitnessed (`cycle-unwitnessed`) may have two steps that are two cycles and would play at twice their speed if aligned as one cycle; both 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}`, listing `["start-stop"]`, `["cycle-unwitnessed"]`, or both) 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, bob, cycles, unwitnessed, why}`, where `cue` and `bob` are recorded only where the picture passes, `cue: {range, floor, swapped, one, says, why}` only with a view, `one` absent where `says` is `"alike"`, `bob: {swing, rows, floor, twice, half, quarter, says, why}`, `half` and `quarter` absent under the floors and `why` absent where it says `"cycles"`, and `unwitnessed` true only where nothing witnessed); 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 item `loop["cycle-unwitnessed"]` (`true`), 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, signals=None)`, `local_cycle.bob_word(top, interval, height)`, `local_cycle.off_flow(values, interval)`, `local_cycle.cue_word(cue, interval, step=None)`, `local_cycle.BOB_TWICE`, `local_cycle.BOB_FLOOR`, `local_cycle.BOB_ROWS`, `local_cycle.UNWITNESSED`, `local_cycle.CUE_FLOOR`, `legs.TONE`, `local_cycle.repeat_at(distances, span)`, `batch.anchor_for(state, cut, anchor)`, `batch.left_out_why(reasons, stands=False)`, `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: its top line rises and falls twice an interval, cutting one cycle within a frame with `cycles` true, `steps: 2`, and no cue read with no view; the same walker with its far leg drawn as the near one (legs alike), with no view and with `--view back_diagonal`, is still cut to one cycle because the view's cue says `"alike"` (which no longer refuses) and the bob witnesses;+- Report fields: `cycle.step_count.cycles` (`{asked, interval, overlap, half, one, two, slack, cue, bob, cycles, unwitnessed, why}`, where `cue` and `bob` are recorded only where the picture passes, `cue: {range, floor, swapped, one, says, why}` only with a view, `one` absent where `says` is `"alike"`, `bob: {swing, rows, floor, twice, half, quarter, edge, body: {beat, lowest, head, less_lowest, less_head, own, share, scale, least, scale_least}, says, why}`, `half`, `quarter`, `edge` and `body` absent under the floors, `body` absent where under 8 frames are left, and `why` absent where it says `"cycles"`, and `unwitnessed` true only where nothing witnessed); 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 item `loop["cycle-unwitnessed"]` (`true`), 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, signals=None)`, `local_cycle.bob_word(signals, interval)`, `local_cycle.twice_an_interval(values, interval)`, `local_cycle.own_beat(signals, interval)`, `local_cycle.BOB_OWN`, `local_cycle.BOB_SCALE`, `local_cycle.BEAT_FRAMES`, `legs.body_signals(frames)`, `legs.CROWN`, `local_cycle.off_flow(values, interval)`, `local_cycle.cue_word(cue, interval, step=None)`, `local_cycle.BOB_TWICE`, `local_cycle.BOB_FLOOR`, `local_cycle.BOB_ROWS`, `local_cycle.UNWITNESSED`, `local_cycle.CUE_FLOOR`, `legs.TONE`, `local_cycle.repeat_at(distances, span)`, `batch.anchor_for(state, cut, anchor)`, `batch.left_out_why(reasons, stands=False)`, `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 (the walkers' bodies rise and fall on legs whose soles stay on the ground unless held still or drawn carried whole):+ - 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: its top line rises and falls twice an interval, cutting one cycle within a frame with `cycles` true, `steps: 2`, and no cue read with no view, its bob's `body.share` at least `0.3`, `body.scale` at least `0.6`, `edge` 0, and its `why` naming the body's own; the same walker with its far leg drawn as the near one (legs alike), with no view and with `--view back_diagonal`, is still cut to one cycle because the view's cue says `"alike"` (which no longer refuses) and the bob witnesses;- 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): with `--view front_diagonal` cut to one cycle because its foot cue moves over the floor and does not turn over one interval on (`says` null) and its top line rises and falls twice an interval; without a view it is not asked and is cut to two cycles (32, 36 frames);- the walker seen from behind (17.5 on ones; no view and `--view back_diagonal`) and the front-diagonal walker (16, `--view front_diagonal`) with their bodies held still: the top line does not rise and fall (the line left under `BOB_FLOOR` of the body's height and under `BOB_ROWS` rows), keeping two intervals (two cycles) with `cycles` false, `unwitnessed` true, and the warning naming the cut;- a side walker whose two steps are one silhouette (46-frame cycle, near and far a tone or four apart), passes brief: not asked with no view or `--view side`, keeping two steps at 46 frames;@@ -28,6 +28,16 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the- the wide legs-alike side walker (46-frame cycle, crossings every 23 frames, a pass can hide), carried up and down with the whole picture: along a smooth arc 24 px deep, and, with its body held still, along the same arc, along a sway 12 px either way, four intervals long (92 frames), and down a ramp 24 px over the clip, a row every three frames; each is cut two steps, 46 frames, with `unwitnessed` and the warning; for the bobbing walker its `half` is `-0.28` or less (less its flow its line rises and falls once an interval); for the still one its `rows` is under `BOB_ROWS`; before this change every one of the four was cut one step, counted two, and no warning said so;- the walker seen from behind whose far foot hides behind the near one (cycle 17.5 frames on ones, legs drawn alike), carried along the arc and the cubic: cut one cycle; the bob says `"cycles"` with its `quarter` at `-0.28` or less;- synthetic units meeting every 15 frames verify that where a pass can hide (feet together 9 frames at each meeting), a top line rising and falling every 7.5 frames (twice an interval) marks cycles (15 frames kept as one cycle, `steps: 2`), while rising and falling every 15 frames (once an interval) or held still keeps two steps of 15 (30 frames) with `unwitnessed` true and the warning; brief meetings with no view or `side` are not asked; on front diagonals with brief meetings, a cue turning over every 15 frames (one interval on) keeps two steps of 15 (30 frames) whatever the body does, and a cue turning over half an interval on and holding one interval on is no witness (30 frames with the warning when the top line is once an interval, 15 frames and one cycle when twice an interval); a still cue (range far under half a tone) or one flickering every 4 frames refuses nothing, letting the body decide (twice an interval: one cycle of 15; held still: 30 with the warning) on front diagonals with brief meetings, back diagonals where a pass can hide, and with no view where a pass can hide; and `bob_word` on an interval of 15 frames for a body 100 rows tall says `"cycles"` with 3 rows either way every 7.5 frames, says null every 15 or 30 frames, and says null under the floors at 0.2 rows either way without reading `half` or `quarter` (`swing` and `rows` are the range of `off_flow`'s line), while for a top line in whole rows on a picture held still or carried along an arc 24 rows deep, a cubic 48 rows either way, a sway 12 rows either way four intervals long, or a ramp of 6 rows over the clip, rising and falling twice an interval says `"cycles"` under every one, once an interval, or not at all, says null under every one, and not rising at all, on the still picture, the arc, the cubic or the ramp, the line left is under `BOB_ROWS`, and `off_flow` over intervals of 15 and 17.5 frames takes a cubic flow out wholly and leaves a rise and fall once or twice an interval as it was (less its straight line) over the frames the interval fits about;+ - the walker seen from behind whose far foot hides (cycle 17.5 frames on ones, no view) and the front-diagonal walker whose near foot steps out (cycle 16, `--view front_diagonal`), their bodies rising and falling twice an interval carried whole, feet and all: cut two intervals, `unwitnessed`, the warning; the bob's `half` is `0.28` or more and its `quarter` `-0.28` or less (the top line alone rises and falls twice an interval), its `body.share` is under `0.3`, and its `why` says its lowest row rises and falls with it;+ - the wide legs-alike side walker (46-frame cycle, its crossings its steps every 23 frames, a pass can hide), held still or rising and falling on its legs once a step, on a picture shaken up and down 3 px twice an interval (dy = round(3 sin(4 pi k / 23))): two steps, 46 frames, `unwitnessed`, the warning; held still, its bob's `half` is `0.28` or more and `quarter` `-0.28` or less, and its `why` says its lowest row rises and falls with it;+ - the walker seen from behind (17.5, rising and falling twice an interval on its legs), its frames cut at the soles' row so the lowest row is each frame's last: two intervals, `unwitnessed`, the warning, `edge` over 0 and a `why` naming the frame's last row;+ - `twice_an_interval` over intervals of 15 and 17.5 frames: a line rising and falling 3 rows either way twice an interval, with a rise and fall of 2 rows once an interval and a cubic flow 48 rows either way laid on it, reads 3 rows (within 0.15); the same rise and fall on a constant reads within 0.15 of it; 14 frames over an interval of 15 read None;+ - `bob_word` over an interval of 15 frames, the body 100 rows tall, its lines in whole rows: a top line rising and falling 3 rows either way twice an interval with the lowest row still says `"cycles"` (`share` over 0.9, `scale` 1); the same rise and fall with the lowest row rising and falling with it (the body carried up and down whole, or held still on a picture shaken twice an interval: the same lines) says null, its `why` naming the lowest row; a rise and fall of 3 rows of its own on a picture shaken 12 rows with it (its own a fifth of the line's, under `BOB_OWN`) says null;+ - `bob_word`: the body zoomed in and out twice an interval with the picture about its feet (3 % either way: the top line 3 rows, the lowest row still) or about its middle (6 %: the top line and the lowest row 3 rows either way, turned over from each other), its head's width and height scaled with it: null, `scale` under `0.6`, its `why` naming the head's width;+ - `bob_word`: the planted rise and fall says `"cycles"`; the same with the lowest row on the frame's last row in one frame of 73 says null, `edge` 1, `why` "in 1 of 73 frames";+ - read off drawn frames with `legs.strike_signals` and `legs.body_signals`: five walkers that do not rise and fall twice an interval on their legs (the wide legs-alike side walker, interval 23, held still, carried whole bobbing once a step, or rising and falling on its legs once a step; the walker seen from behind, legs alike, interval 17.5, held still or carried whole rising and falling twice an interval), each moved up and down with the whole picture 3, 6 or 12 px either way every d/4, d/2, d or 2d frames (d its interval) at four phases: none is witnessed. Three of them (the side walker held still and on its legs, the walker from behind held still) zoomed in and out 0.5, 1, 2 or 4 % either way every d/4, d/2 or d frames about the feet, the middle or the head, at two phases: none is witnessed;+ - the side walker rising and falling on its legs once a step (its crossings its steps), running: both soles lifted up to 1, 2, 3 or 6 px off the ground while the body is high; still or on a picture moved 6 px either way every d/2 (two phases) or every d frames: never witnessed;+ - the side walker drawn as a view from behind or a diagonal draws feet, each sole up to 6, 12 or 24 px lower the further back its foot is, the foot moving forward lifted 8 px (the lowest row is the planted foot, sliding down the screen through its step); still, or on a picture moved 3, 6 (four phases) or 12 px either way every d/2 frames, or 6 px every d: never witnessed;- 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 b3c1ae3..d7bd173 100644--- a/docs/loop-repair.md+++ b/docs/loop-repair.md@@ -1317,7 +1317,7 @@ counted two steps: a half-cycle loop, with no warning. The crossings mark cyclesthat reads no leg says the interval holds two steps: the body's top line (`legs.strike_signals` `top`,one row per frame) rising and falling twice an interval. The body rises and falls once a step whicheverleg leads, so two rises an interval are two steps an interval.-`local_cycle.bob_word(top, interval, height)` reads the body's top line less its flow+`local_cycle.bob_word(signals, interval)` reads the body's top line less its flow(`off_flow(top, interval)`), not the raw line. `local_cycle.off_flow(values, interval)` returns `values`(per frame) less their flow: each frame minus the mean of the interval about it (a moving average oneinterval long, its two end frames weighted by the part of a frame the interval covers), kept only over@@ -1339,10 +1339,47 @@ span). It says `"cycles"` only where `half` is `BOB_TWICE` (`0.28`) or more andrise and fall twice an interval. Otherwise null, and `why` gives both values. A rise and fall twice aninterval is as it was half an interval on and turned over a quarter on; a step's bob (once an interval)is turned over half an interval on; any flow left over (slower than the interval) is as it was at both-half and a quarter of an interval on, so it cannot pass the quarter test. The whole picture shaking up-and down at twice the interval's beat is the same signal as the bob and is read as one; a sway of the-whole picture as large as the bob or larger, between about one and three intervals long, can hide a true-bob, and then the crossings stay on steps with the warning (two intervals, named), not one cycle. The+half and a quarter of an interval on, so it cannot pass the quarter test. A sway of the whole picture as+large as the bob or larger, between about one and three intervals long, can hide a true bob, and then+the crossings stay on steps with the warning (two intervals, named), not one cycle. It next reads `edge`,+the number of frames whose lowest solid row is the frame's last row (`legs.body_signals` `edge`). Where+any frame's is: `says` null, `why`: "its lowest row is the frame's last row in {n} of {N} frames: the+feet may run off the frame, and the picture moving is not read off them". There the lowest row is the+frame's, not the feet's. `local_cycle.twice_an_interval(values, interval)`: `values` (per frame) less+their flow (`off_flow`), then a least-squares fit of a mean, the harmonic twice an interval (cos and sin+of 4 pi k / `interval`) and the harmonic once an interval (cos and sin of 2 pi k / `interval`), k the+frames left counted from the first; it returns the twice-an-interval harmonic as a complex amplitude+(its cos coefficient less i times its sin coefficient), in the values' units: a line rising and falling+a rows either way twice an interval reads a in magnitude. Lines read so over the same frames and+interval subtract as they move. None where fewer than `BEAT_FRAMES` (`8`) frames are left. Where none:+`says` null, `why`: "its top line's rise and fall twice an interval is not read against its lowest row+and head: under 8 frames are left less the flow". `local_cycle.own_beat(signals, interval)` reads three+lines with `twice_an_interval`: the top line (`top`), the lowest solid row (`reach`) and the head's+width (`crown`, a log). It returns, in rows up and down (twice the magnitude): `beat` (the top line's),+`lowest` (the lowest row's), `head` (the head width's, scaled by the body's median height), `less_lowest`+(the top line's less the lowest row's: the picture moving taken out), `less_head` (that again with the+head width's, scaled by the body's median height, added: the picture zooming taken out as well), and+`own`, the smaller of `less_lowest` and `less_head`. None where a line is not read. The floor is the+larger of `BOB_ROWS` and `BOB_FLOOR` of the body's median height. Where `less_lowest` is under the larger+of `BOB_OWN` (`0.3`) times `beat` and the floor: `says` null, `why`: "its lowest row rises and falls with+it: less the lowest row's, its top line's rise and fall twice an interval is {x} rows of {beat} ({percent};+at least 30% and {floor} rows): the picture moves with the body, and the body's own is not told from it".+Where `less_head` is under the largest of `BOB_OWN` times `beat`, the floor, and `BOB_SCALE` (`0.6`)+times `less_lowest`: `says` null, `why`: "its head's width changes with it: less the head's scale too, its+top line's rise and fall twice an interval is {x} rows of {beat} ({percent}), {ratio} of the {less_lowest}+left against the lowest row (at least 30%, {floor} rows and 0.6): the picture zooms with the body, and+the body's own is not told from it". Otherwise `says` `"cycles"`. A body rising and falling on its legs+leaves its planted foot, the lowest solid row, on the ground, and its head as wide as it was. The+picture moved up and down carries the lowest row with the top line by the same rows, so nothing is left+of the line's rise against it. The picture zoomed in and out widens the head as it lifts the line, by as+much as the body's height grows, so nothing is left once the head's scale is taken out too.+`legs.body_signals(frames)`: per frame `crown`, the log of the mean width (in alpha) of the band from+2 % to 10 % of the clip's median body height below the first solid row (`legs.CROWN` = `(0.02, 0.10)`),+and `edge`, 1 where the lowest solid row is the frame's last row, else 0. `signals` are the frames'+`legs.strike_signals` merged with `legs.body_signals`; the body's median height is the median of+`signals["height"]`. Only the step count's witness reads them: `loop.read_steps` merges them into the+signals it passes to `local_cycle.read_cycles`. `legs.strike_signals` is unchanged, so the loop report's+`gait.silhouette.signals` is unchanged. Theview's foot cue can only refuse cycles (`local_cycle.cue_word(cue, interval, step=None)`):`legs.shade_cue` from the side or a diagonal, `legs.depth_cue` from the front or back, per frame. A cuewhose range over the clip is under `CUE_FLOOR` (0.5) of the step it is drawn in (`legs.TONE` of luma, or@@ -1356,8 +1393,9 @@ shade of the feet's two halves is no longer read. Where the picture passes, thefirst: where it says `"steps"`, `cycles` is false, the count stands (two steps), `why` says the view'sfoot cue turns over there: the other leg leads, a step, and no warning is given. Else where the bob says`"cycles"`, `cycles` is true, and `why` says the body's top line less its flow rises and falls twice an-interval (its `half`, at least `BOB_TWICE`; its `quarter`, at most `-BOB_TWICE`): two steps an interval,-the feet meet once a cycle. Else `cycles` is false and `unwitnessed` is true: the crossings stay on+interval (its `half`, at least `BOB_TWICE`; its `quarter`, at most `-BOB_TWICE`), the body's own ({own}+rows of {beat} left against its lowest row and head, {share}; at least 30%): two steps an interval, the+feet meet once a cycle. Else `cycles` is false and `unwitnessed` is true: the crossings stay onsteps, as from the side; `why` says nothing that reads no leg witnesses two steps an interval (the bob'sown `why` in parentheses, or "no top line read"): a step on draws as a cycle on, as from the side, andthe crossings mark steps; and the loop's warnings (`jolt.warnings`, from `local_cycle.step_verdict`) gain@@ -1371,15 +1409,18 @@ cut one interval long is two steps (one cycle) and is taken as such (`steps: {cowritten). Recorded in `cycle.step_count.cycles`:`{asked, interval, overlap, half, one, two, slack, cue, bob, cycles, unwitnessed, why}`;`cue: {range, floor, swapped, one, says, why}` (only with a view; `one` absent where `says` is `"alike"`;-`says` is `"steps"`, `"alike"` or null); `bob: {swing, rows, floor, twice, half, quarter, says, why}`-(`half` and `quarter` absent under the floors; `why` absent where it says `"cycles"`; `says` is-`"cycles"` or null); `unwitnessed` true only where nothing witnessed; absent where not asked. `cue` and+`says` is `"steps"`, `"alike"` or null); `bob: {swing, rows, floor, twice, half, quarter, edge, body, says, why}`+(`half`, `quarter`, `edge` (frames whose lowest row is their last) and `body` are absent under the floors;+`body` is also absent where under 8 frames are left; `body` is `{beat, lowest, head, less_lowest, less_head, own,+share, scale, least, scale_least}`: the six rows values rounded to 0.01, `share` = `own` / `beat`,+`scale` = `less_head` / `less_lowest`, `least` = `BOB_OWN`, `scale_least` = `BOB_SCALE`; `why` absent+where it says `"cycles"`; `says` is `"cycles"` or null); `unwitnessed` true only where nothing witnessed; absent where not asked. `cue` and`bob` are recorded only where the picture passes. 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 thesynthetic walkers of `tests/video/test_walk_steps.py` (bodies rising and falling 3 px either way once a-step unless held still), a walker seen from behind whose far foot hides behind the near one (feet+step on legs whose soles stay on the ground unless held still or drawn carried whole), a walker seen from behind whose far foot hides behind the near one (feettogether over half the interval) has a cycle of 20 frames drawn on twos, 24 on threes, and 17.5 and 18.5frames on ones: its top line rises and falls twice an interval; cut one cycle (within a frame of it),`cycles` true, `steps` 2; with no view no cue is read. The same walker with its far leg drawn as the near@@ -1423,7 +1464,34 @@ its line rises and falls once an interval); for the still one its `rows` is undechange every one of the four was cut one step, counted two, and no warning said so. The walker seen frombehind whose far foot hides behind the near one (cycle 17.5 frames on ones, legs drawn alike), carriedalong the arc and the cubic: cut one cycle; the bob says `"cycles"` with its `quarter` at `-0.28` or-less.+less. The walker seen from behind whose far foot hides behind the near one (a cycle of 20 frames drawn+on twos, 24 on threes, and 17.5 and 18.5 frames on ones) also has `body.share` at least `0.3`,+`body.scale` at least `0.6`, `edge` 0, and its `why` names the body's own. The walker seen from behind+whose far foot hides (cycle 17.5 frames on ones, no view) and the front-diagonal walker whose near foot+steps out (cycle 16, `--view front_diagonal`), their bodies rising and falling twice an interval carried+whole, feet and all: cut two intervals, `unwitnessed`, the warning; the bob's `half` is `0.28` or more and+its `quarter` `-0.28` or less (the top line alone rises and falls twice an interval), its `body.share` is+under `0.3`, and its `why` says its lowest row rises and falls with it. The wide legs-alike side walker+(46-frame cycle, its crossings its steps every 23 frames, a pass can hide), held still or rising and falling+on its legs once a step, on a picture shaken up and down 3 px twice an interval (dy = round(3 sin(4 pi k /+23))): two steps, 46 frames, `unwitnessed`, the warning; held still, its bob's `half` is `0.28` or more and+`quarter` `-0.28` or less, and its `why` says its lowest row rises and falls with it. The walker seen from+behind (17.5, rising and falling twice an interval on its legs), its frames cut at the soles' row so the+lowest row is each frame's last: two intervals, `unwitnessed`, the warning, `edge` over 0 and a `why` naming+the frame's last row. Read off drawn frames with `legs.strike_signals` and `legs.body_signals`, five walkers+that do not rise and fall twice an interval on their legs (the wide legs-alike side walker, interval 23, held+still, carried whole bobbing once a step, or rising and falling on its legs once a step; the walker seen from+behind, legs alike, interval 17.5, held still or carried whole rising and falling twice an interval), each+moved up and down with the whole picture 3, 6 or 12 px either way every d/4, d/2, d or 2d frames (d its+interval) at four phases: none is witnessed. Three of them (the side walker held still and on its legs, the+walker from behind held still) zoomed in and out 0.5, 1, 2 or 4 % either way every d/4, d/2 or d frames about+the feet, the middle or the head, at two phases: none is witnessed. The side walker rising and falling on+its legs once a step (its crossings its steps), running: both soles lifted up to 1, 2, 3 or 6 px off the+ground while the body is high; still or on a picture moved 6 px either way every d/2 (two phases) or every d+frames: never witnessed. The side walker drawn as a view from behind or a diagonal draws feet, each sole up+to 6, 12 or 24 px lower the further back its foot is, the foot moving forward lifted 8 px (the lowest row is+the planted foot, sliding down the screen through its step); still, or on a picture moved 3, 6 (four phases)+or 12 px either way every d/2 frames, or 6 px every d: never witnessed.**Choosing the cut.**@@ -1488,18 +1556,21 @@ step's beat read as steps; a narrow step that opens the feet only just past theat 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 theclip repeats one interval on as near as two on, the crossings mark cycles only where the body's top line-rises and falls twice an interval unless the view's foot cue says `"steps"`; 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 whose feet do-meet once a cycle but whose body's top line does not rise and fall twice an interval (a body held still, or-a top line that a part held over the head moves on a beat of its own) has its crossings left on steps: cut-two cycles long, with the warning, and `video-set` leaves it out of the cycle alignment (`video-cycle-align`-run on its own reads such a loop's `steps: 2` as one cycle; through `video-set` it is left out); and a walk-whose crossings are its steps, whose legs are drawn alike so its picture repeats a step on, and whose top-line rises and falls twice a step (a part over the head on a beat twice the step's) would still be read as-cycles. Four-legged gaits are read as one foot band (`legs.strike_signals`), as before.+rises and falls twice an interval of the body's own (against its lowest row and head's width) unless the+view's foot cue says `"steps"`; 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 whose feet do meet once a cycle but whose body's top line does not+rise and fall twice an interval of the body's own (a body held still, a figure carried up and down whole, a+picture moved with the body so that less than `BOB_OWN` of the rise is left against its lowest row, or zoomed+with it so that the head's scale takes what is left down too far, a run whose feet leave the ground so far+with the body that too little of the rise is its own, feet at the frame's last row, or a top line that a+part held over the head moves on a beat of its own) has its crossings left on steps: cut two cycles long,+with the warning, and `video-set` leaves it out of the cycle alignment (`video-cycle-align` run on its own+reads such a loop's `steps: 2` as one cycle; through `video-set` it is left out); and a walk whose crossings+are its steps, whose legs are drawn alike so its picture repeats a step on, and whose top line rises and+falls twice a step (a part over the head on a beat twice the step's) would still be read as cycles. 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 c69013f..ad5f3c0 100644--- a/sprite_gen/video/legs.py+++ b/sprite_gen/video/legs.py@@ -13,10 +13,19 @@ Both read the same per-frame signals (`strike_signals`) and choose between themlower, once a step.- `top`: the body's top line, for a body with no legs to read. It rises and falls once a stepwhichever leg leads, so the step count reads it as the witness that a crossing interval holds- two steps (`local_cycle.bob_word`).+ two steps (`local_cycle.bob_word`) — against the lowest row and the head's width, since the+ picture moving or zoomed with the body moves the line as well.- `gap`: the widest empty run between the foot band's two ends, of the frame's height — two feetseen apart.+The step count's witness reads two more (`body_signals`), recorded nowhere else:++- `crown`: the head's width, the log of the mean width (in alpha) of the band CROWN of the clip's+ median body height below the first solid row. A picture zoomed in and out widens and narrows+ it as it lifts and lowers the top line; a body rising and falling on its legs leaves it.+- `edge`: 1 where the lowest solid row is the frame's last row — the feet may run off the+ frame, and the lowest row is the frame's, not theirs — else 0.+Which 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 other leg leads one@@ -32,6 +41,7 @@ widens once a step. Counting steps therefore also asks for two feet seen apart (from __future__ import annotations+import mathfrom typing import Anyfrom PIL import Image@@ -41,6 +51,7 @@ from sprite_gen._deps import npFOOT_BAND = 0.08 # fraction of the frame's own height, measured up from its lowest opaque rowLOW_ALPHA = 128 # the legs are read off solid pixels onlyBODY_RUN = 0.5 # the body's top line: the first row at least half as wide as the frame's widest+CROWN = (0.02, 0.10) # the head's top band: from 2 % to 10 % of the body's median height below its first solid row# A walk seen from the side or a diagonal opens its feet by a good part of its height each step;# from the front or back its foot band hardly changes width, but the foot nearer the viewer is# drawn lower by a few hundredths of it.@@ -98,6 +109,27 @@ def strike_signals(frames: list[Image.Image]) -> dict[str, list[float]]:return out+def body_signals(frames: list[Image.Image]) -> dict[str, list[float]]:+ """Per frame, from the solid pixels, what the step count's witness reads besides `strike_signals`:+ `crown` and `edge` (see the module). `crown` reads the same band of every frame, of the clip's+ median body height."""+ edge, firsts, heights, widths = [], [], [], []+ for f in frames:+ alpha = np.asarray(f.getchannel("A"))+ rows = np.nonzero((alpha >= LOW_ALPHA).any(axis=1))[0]+ if rows.size == 0:+ raise ValueError("a loop frame has no solid body")+ y0, y1 = int(rows[0]), int(rows[-1])+ edge.append(float(y1 == alpha.shape[0] - 1))+ firsts.append(y0)+ heights.append(y1 - y0 + 1)+ widths.append(alpha.sum(axis=1, dtype=np.float64) / 255.0)+ median = float(np.median(heights)) if frames else 0.0+ a0, a1 = max(1, math.ceil(CROWN[0] * median)), max(2, math.ceil(CROWN[1] * median))+ crown = [float(np.log(max(1e-6, w[y0 + a0 : y0 + a1].sum() / (a1 - a0)))) for y0, w in zip(firsts, widths)]+ return {"crown": crown, "edge": edge}++def swings(sig: dict[str, list[float]]) -> dict[str, float]:"""How far the stride and the lowest row swing over the frames, of the median body height."""height = float(np.median(sig["height"]))diff --git a/sprite_gen/video/local_cycle.py b/sprite_gen/video/local_cycle.pyindex 7a8b67d..cebdd7f 100644--- a/sprite_gen/video/local_cycle.py+++ b/sprite_gen/video/local_cycle.py@@ -48,9 +48,23 @@ CUE_FLOOR = 0.5# interval on, and a flow left over is as it was at both. A line left whose range is under BOB_FLOOR of the body's# median height, or under BOB_ROWS pixel rows (a line read in whole rows rounds a row up and down as the picture# drifts), does not rise and fall, and witnesses nothing.+# The picture moving up and down moves the line as the body does, on any beat — shaken twice an interval it is pixel for+# pixel a body carried up and down whole, feet and all — and the picture zoomed in and out lifts and lowers it too. So the+# line's rise and fall twice an interval (`twice_an_interval`) is read against the body's own lowest row and head+# (`own_beat`): less the lowest solid row's (`legs.strike_signals` `reach`, the planted foot, which a body rising on its+# legs leaves on the ground and the picture carries along), and less that again of the head's width's+# (`legs.body_signals` `crown`, scaled to the body's median height: a zoom widens the head as it lifts the line, a body+# rising leaves it). What is left of the line's rise and fall either way is the body's own: at least BOB_OWN of it and+# over the floor above, and the head's width taking it down to no less than BOB_SCALE of what is left against the lowest+# row. Else the picture moves or zooms with the line, or the body does not rise and fall enough of its own to tell from+# it, and nothing is witnessed. Where the lowest solid row is the frame's last row in any frame (`legs.body_signals`+# `edge`) it is the frame's, not the feet's, and nothing is witnessed either.BOB_TWICE = 0.28BOB_FLOOR = 0.005BOB_ROWS = 2+BOB_OWN = 0.3+BOB_SCALE = 0.6+BEAT_FRAMES = 8 # a rise and fall twice an interval is fitted (`twice_an_interval`) to no fewer framesSIDE_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# A loop whose clip one interval on is the same picture, as a walk whose feet meet once a cycle draws it, with nothing# to witness whether they do (`read_cycles`): its crossings stay on steps, so its two steps may be two cycles. Named on@@ -552,15 +566,55 @@ def off_flow(values, interval):return left - np.polyval(np.polyfit(t, left, 1), t)-def bob_word(top, interval, *, height):- """Whether the body rises and falls twice an interval `interval` frames long (`read_cycles`), read off its top line- (`top`, per frame, in pixel rows: `legs.strike_signals`) without telling the legs apart, less its flow (`off_flow`):- `says` `cycles` where the line left ranges BOB_FLOOR of the body's median `height` or more and BOB_ROWS rows or- more, and it is as it was half an interval on and turned over a quarter on (`crossings.correlation_on`, BOB_TWICE or- over there and -BOB_TWICE or under here) — a step each rise, two steps an interval; None otherwise, with why.- Returns the record: `swing` (the line left's range, of the body's height), `rows` (in rows), `floor`, `twice`,- `half` and `quarter` (where read), `says`."""- values = off_flow(top, interval)+def twice_an_interval(values, interval):+ """How `values` (per frame) rise and fall twice an interval `interval` frames long, less their flow (`off_flow`): the+ harmonic of what is left fitted by least squares with a mean and the harmonic once an interval (cos and sin of+ 4 pi k / `interval` and of 2 pi k / `interval`, k the frames left from the first), its cos less i times its sin — a+ complex amplitude, in the values' units: a line rising and falling a rows either way twice an interval reads a, its+ phase at the first frame left. Lines read so over the same frames and interval subtract as they move. None where+ under BEAT_FRAMES frames are left."""+ x = off_flow(values, interval)+ if x.size < BEAT_FRAMES:+ return None+ k = np.arange(x.size, dtype=float)+ basis = np.stack([np.ones_like(k), np.cos(4*np.pi*k/interval), np.sin(4*np.pi*k/interval), np.cos(2*np.pi*k/interval),+ np.sin(2*np.pi*k/interval)], axis=1)+ coef = np.linalg.lstsq(basis, x, rcond=None)[0]+ return complex(coef[1], -coef[2])+++def own_beat(signals, interval):+ """The body's own rise and fall twice an interval `interval` frames long (`bob_word`), read off `signals`+ (`legs.strike_signals` `top`, `reach` and `height`, `legs.body_signals` `crown`) as `twice_an_interval` reads each:+ the top line's, less the lowest row's (the picture moving taken out), and less that again of the head's width's+ scaled to the body's median height (the picture zooming taken out). Returns, in rows up and down: `beat` (the top+ line's), `lowest`, `head`, `less_lowest`, `less_head`, and `own`, the smaller of the last two. None where a line is+ not read."""+ height = float(np.median(signals['height']))+ top, lowest, crown = (twice_an_interval(signals[k], interval) for k in ('top', 'reach', 'crown'))+ if top is None or lowest is None or crown is None:+ return None+ less_lowest = top - lowest+ less_head = less_lowest + height*crown+ return {'beat': 2*abs(top), 'lowest': 2*abs(lowest), 'head': 2*height*abs(crown), 'less_lowest': 2*abs(less_lowest),+ 'less_head': 2*abs(less_head), 'own': 2*min(abs(less_lowest), abs(less_head))}+++def bob_word(signals, interval):+ """Whether the body rises and falls twice an interval `interval` frames long (`read_cycles`), read off `signals`+ (`legs.strike_signals` with `legs.body_signals`) without telling the legs apart. Its top line (`top`, in pixel rows)+ less its flow (`off_flow`) ranges BOB_FLOOR of the body's median `height` or more and BOB_ROWS rows or more, and it+ is as it was half an interval on and turned over a quarter on (`crossings.correlation_on`, BOB_TWICE or over there+ and -BOB_TWICE or under here): it rises and falls twice an interval. And that rise and fall is the body's own+ (`own_beat`): what is left of it against the lowest row, and against the head's width as well, is at least BOB_OWN+ of it and over the floor, the head's width taking it down to no less than BOB_SCALE of what is left against the+ lowest row, and no frame's lowest row is its last (`edge`). Then `says` `cycles` — a step each rise, two steps an+ interval; None otherwise, with why. Returns the record: `swing` (the line left's range, of the body's height),+ `rows` (in rows), `floor`, `twice`, `half` and `quarter` (where read), `edge` (frames whose lowest row is their+ last), `body` (`own_beat`, in rows up and down, with `share`, `own` of `beat`, and `scale`, `less_head` of+ `less_lowest`; where read), `says`."""+ height = float(np.median(signals['height']))+ values = off_flow(signals['top'], interval)rows = float(values.max()-values.min()) if values.size else 0.0swing = rows/height if height > 0 else 0.0word = {'swing': round(swing, 4), 'rows': round(rows, 2), 'floor': BOB_FLOOR, 'twice': BOB_TWICE}@@ -570,13 +624,39 @@ def bob_word(top, interval, *, height):return {**word, 'says': None, 'why': f"its top line's range less its flow ({swing:.2%} of the body's height, {rows:.1f} "f"rows) is under {BOB_FLOOR:.1%} or {BOB_ROWS} rows: it does not rise and fall"}half, quarter = (crossings_mod.correlation_on(values, interval/k) for k in (2, 4))- word.update(half=None if half is None else round(half, 3), quarter=None if quarter is None else round(quarter, 3))- if half is not None and quarter is not None and half >= BOB_TWICE and quarter <= -BOB_TWICE:- return {**word, 'says': 'cycles'}- return {**word, 'says': None, 'why': f"its top line less its flow does not rise and fall twice an interval "- f"({'not read' if half is None else f'{half:+.2f}'} half an interval on, "- f"{'not read' if quarter is None else f'{quarter:+.2f}'} a quarter on: not at least "- f"{BOB_TWICE:+g} and at most {-BOB_TWICE:+g})"}+ edge = sum(1 for e in signals['edge'] if e)+ beat = own_beat(signals, interval)+ word.update(half=None if half is None else round(half, 3), quarter=None if quarter is None else round(quarter, 3), edge=edge)+ if beat is not None:+ word['body'] = {**{k: round(v, 2) for k, v in beat.items()},+ 'share': round(beat['own']/beat['beat'], 3) if beat['beat'] else 0.0,+ 'scale': round(beat['less_head']/beat['less_lowest'], 3) if beat['less_lowest'] else 0.0,+ 'least': BOB_OWN, 'scale_least': BOB_SCALE}+ if half is None or quarter is None or half < BOB_TWICE or quarter > -BOB_TWICE:+ return {**word, 'says': None, 'why': f"its top line less its flow does not rise and fall twice an interval "+ f"({'not read' if half is None else f'{half:+.2f}'} half an interval on, "+ f"{'not read' if quarter is None else f'{quarter:+.2f}'} a quarter on: not at least "+ f"{BOB_TWICE:+g} and at most {-BOB_TWICE:+g})"}+ if edge:+ return {**word, 'says': None, 'why': f"its lowest row is the frame's last row in {edge} of {len(signals['edge'])} frames: "+ "the feet may run off the frame, and the picture moving is not read off them"}+ if beat is None:+ return {**word, 'says': None, 'why': f"its top line's rise and fall twice an interval is not read against its lowest row "+ f"and head: under {BEAT_FRAMES} frames are left less the flow"}+ floor = max(BOB_ROWS, BOB_FLOOR*height)+ if beat['less_lowest'] < max(BOB_OWN*beat['beat'], floor):+ return {**word, 'says': None, 'why': f"its lowest row rises and falls with it: less the lowest row's, its top line's rise "+ f"and fall twice an interval is {beat['less_lowest']:.1f} rows of {beat['beat']:.1f} "+ f"({beat['less_lowest']/beat['beat']:.0%}; at least {BOB_OWN:.0%} and {floor:.1f} "+ "rows): the picture moves with the body, and the body's own is not told from it"}+ if beat['less_head'] < max(BOB_OWN*beat['beat'], floor, BOB_SCALE*beat['less_lowest']):+ return {**word, 'says': None, 'why': f"its head's width changes with it: less the head's scale too, its top line's rise "+ f"and fall twice an interval is {beat['less_head']:.1f} rows of {beat['beat']:.1f} "+ f"({beat['less_head']/beat['beat']:.0%}), {beat['less_head']/beat['less_lowest']:.2f} "+ f"of the {beat['less_lowest']:.1f} left against the lowest row (at least "+ f"{BOB_OWN:.0%}, {floor:.1f} rows and {BOB_SCALE:g}): the picture zooms with the body, "+ "and the body's own is not told from it"}+ return {**word, 'says': 'cycles'}def read_cycles(reading, distances, *, view=None, cue=None, cue_step=None, signals=None):@@ -591,9 +671,10 @@ def read_cycles(reading, distances, *, view=None, cue=None, cue_step=None, signaThe picture is the same a step on as a cycle on where the legs are drawn alike, and so is everything else that doesnot tell the legs apart (a foot cue under a light fixed on the screen, how far apart the feet are drawn): it markscycles only where a witness that reads no leg says the interval holds two steps — the body's top line (`signals`,- `legs.strike_signals`: `top`, and `height`) rising and falling twice an interval, less its flow (`bob_word`: the- picture drifting or swaying up and down as it pleases witnesses nothing). The view's foot cue (`cue`, per frame,- drawn in steps of `cue_step`; `cue_word`) only refuses: where it turns over one interval on, the other leg leads+ `legs.strike_signals` with `legs.body_signals`) rising and falling twice an interval, less its flow and of its own+ (`bob_word`: the picture drifting, swaying, shaking or zooming up and down as it pleases witnesses nothing, read+ against the lowest row and the head's width; a lowest row on the frame's edge holds the word). The view's foot cue+ (`cue`, per frame, drawn in steps of `cue_step`; `cue_word`) only refuses: where it turns over one interval on, the other leg leadsthere, a step. With no witness the crossings stay on steps, as from the side, and the record names it(`unwitnessed`): where the feet do meet once a cycle, each step counted is a cycle. Returns what was read, Nonewhere it is not asked."""@@ -618,7 +699,7 @@ def read_cycles(reading, distances, *, view=None, cue=None, cue_step=None, signapicture = (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})")word = None if cue is None or view is None else cue_word(cue, d, step=cue_step)- bob = None if not signals else bob_word(signals['top'], d, height=float(np.median(signals['height'])))+ bob = None if not signals else bob_word(signals, d)said.update({**({'cue': word} if word is not None else {}), **({'bob': bob} if bob is not None else {})})if word is not None and word['says'] == 'steps':said.update(cycles=False, why=f"{picture}, but the view's foot cue turns over there ({word['one']:+.2f}, at most "@@ -626,7 +707,9 @@ def read_cycles(reading, distances, *, view=None, cue=None, cue_step=None, signaelif bob is not None and bob['says'] == 'cycles':said.update(cycles=True, why=f"{picture}, and the body's top line less its flow rises and falls twice an interval "f"({bob['half']:+.2f} half an interval on, at least {BOB_TWICE:+g}; {bob['quarter']:+.2f} a "- f"quarter on, at most {-BOB_TWICE:+g}): two steps an interval, the feet meet once a cycle")+ f"quarter on, at most {-BOB_TWICE:+g}), the body's own ({bob['body']['own']:.1f} rows of "+ f"{bob['body']['beat']:.1f} left against its lowest row and head, {bob['body']['share']:.0%}; "+ f"at least {BOB_OWN:.0%}): two steps an interval, the feet meet once a cycle")else:said.update(cycles=False, unwitnessed=True,why=f"{picture}, but nothing that reads no leg witnesses two steps an interval "diff --git a/sprite_gen/video/loop.py b/sprite_gen/video/loop.pyindex dc9fae3..ce165e7 100644--- a/sprite_gen/video/loop.py+++ b/sprite_gen/video/loop.py@@ -1542,10 +1542,11 @@ 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, the body's bob read off `signals` — the frames' leg signals, read here where not given — 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`)."""+ clip's distances, the body's bob read off `signals` — the frames' leg signals, read here where not given, with the+ body's own (`legs.body_signals`) — 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 = 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,7 +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))- local_cycle.read_cycles(reading, D, view=view, cue=cue, cue_step=step, signals=signals)+ body = {**signals, **legs_mod.body_signals(frames)} if signals else None+ local_cycle.read_cycles(reading, D, view=view, cue=cue, cue_step=step, signals=body)return readingdiff --git a/tests/video/test_walk_steps.py b/tests/video/test_walk_steps.pyindex 19ddd9f..d8e81c7 100644--- a/tests/video/test_walk_steps.py+++ b/tests/video/test_walk_steps.py@@ -13,17 +13,21 @@ Each walker is drawn so the pixel search alone makes one of the faults a walk lo- a walk that stalls, its cut playing the stalled step.Two whose feet meet on the screen once a cycle, read as cycles (`local_cycle.read_cycles`) and cut one cycle, their-body rising and falling twice an interval between crossings — the witness that reads no leg: a walk seen from behind-whose far foot passes hidden behind the near one, on ones, twos or threes, a cycle a whole number of frames or not,-its legs drawn apart or alike (the parent engine counted the cycle one step and cut two cycles, or kept the search's-cut unwritten); and a 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. The guards: from the side, and where the view's foot cue says the other leg-leads an interval on, the count stands however alike a step on draws; and where nothing that reads no leg witnesses-two steps an interval — legs drawn alike from any view, alike and wide as a hidden pass is, alike and wide under a-light fixed on the screen, the swing foot lifted under such a light, a far leg a few tones off with no view, and a-walk whose feet do meet once a cycle but whose body does not bob — the crossings stay on steps, named in a warning.-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.+body rising and falling twice an interval between crossings on legs whose feet stay on the ground — the witness that+reads no leg, read against the lowest row and the head's width: a walk seen from behind whose far foot passes hidden+behind the near one, on ones, twos or threes, a cycle a whole number of frames or not, its legs drawn apart or alike+(the parent engine counted the cycle one step and cut two cycles, or kept the search's cut unwritten); and a 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. The guards: from the side, and where the view's foot cue says the other leg leads an interval on, the count+stands however alike a step on draws; and where nothing that reads no leg witnesses two steps an interval — legs drawn+alike from any view, alike and wide as a hidden pass is, alike and wide under a light fixed on the screen, the swing+foot lifted under such a light, a far leg a few tones off with no view, a walk whose feet do meet once a cycle but+whose body does not bob, the same walk carried up and down whole, feet and all (the picture moved on its beat), a body+held still on a picture shaken twice an interval, and feet that run off the frame — the crossings stay on steps,+named in a warning. Read off drawn frames, no walk that does not rise and fall twice an interval on its legs is+witnessed however the whole picture moves or zooms, on any beat, nor a run whose feet leave the ground, nor a planted+foot sliding down the screen. 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."""@@ -42,6 +46,7 @@ from conftest import feet_unseenfrom sprite_gen.video import crossings, legs, local_cycle, loopFRAMES = 73+GROUND = 166 # the row the walkers' soles stand on: a body rising and falling on its legs leaves its feet theredef _side(k: float, *, cycle: float, phase: float = 0, tail_cycle: float = 1, tail: int = 0, arms: bool = True) -> Image.Image:@@ -90,43 +95,46 @@ def _front(k: float, *, cycle: float, phase: float = 0, tail_cycle: float = 1, treturn im-def _behind(k: int, *, cycle: float, hold: int, alike: bool = False, bob: int = 3) -> Image.Image:+def _behind(k: int, *, cycle: float, hold: int, alike: bool = False, bob: int = 3, whole: bool = False) -> Image.Image:"""A walker seen from behind on a diagonal, drawn on twos or threes (`hold`): the near leg swings ahead and back,and the far one is seen beside it only while it is behind — ahead, it stands hidden behind the near leg. The feetare seen apart once a cycle and together through the other step, its pass hidden among them: one crossing shows a- cycle. The body bobs `bob` px once a step; the far leg darker (`alike`: drawn as the near one); arms opposite, the- far one darker; each repeat of a drawing redrawn a little (a pixel aside, a few tones)."""+ cycle. The body rises and falls `bob` px once a step on its legs, the feet on the ground (`whole`: carried up and+ down with it, feet and all — the picture moved, not a walk); the far leg darker (`alike`: drawn as the near one);+ arms opposite, the far one darker; each repeat of a drawing redrawn a little (a pixel aside, a few tones)."""redraw = k % holdph = 2 * math.pi * (k - redraw) / cycleim = Image.new("RGBA", (300, 220))d = ImageDraw.Draw(im)x, y = 90 + redraw, 40 + round(bob * math.cos(2 * ph))+ sole = y + 126 if whole else GROUNDsw = 16 * math.sin(ph)near = x + 14 + swfar = x + 14 - sw if sw > 0 else neard.rectangle((x + 14 - sw - 4, y + 34, x + 14 - sw + 4, y + 72), fill=(150, 150, 150, 255))- d.rectangle((far - 5, y + 80, far + 5, y + 126), fill=(70, 70, 80, 255) if alike else (50, 50, 60, 255))- d.rectangle((near - 5, y + 80, near + 5, y + 126), fill=(70, 70, 80, 255))+ d.rectangle((far - 5, y + 80, far + 5, sole), fill=(70, 70, 80, 255) if alike else (50, 50, 60, 255))+ d.rectangle((near - 5, y + 80, near + 5, sole), fill=(70, 70, 80, 255))d.rectangle((x, y + 30, x + 28, y + 84), fill=(200 + 12 * redraw, 80, 80, 255))d.rectangle((x + 2, y, x + 26, y + 28), fill=(230, 200, 170, 255))d.rectangle((x + 14 + sw - 4, y + 34, x + 14 + sw + 4, y + 72), fill=(225, 225, 225, 255))return im-def _outward(k: float, *, cycle: float, bob: int = 3) -> Image.Image:+def _outward(k: float, *, cycle: float, bob: int = 3, whole: bool = False) -> Image.Image:"""A walker on a front diagonal whose near foot steps out toward the camera: it swings wide ahead and back, and thefar foot hardly moves, so the feet meet on the screen once a cycle, where the near foot passes the far one on its- way back; its pass on the way out is made apart. The body bobs `bob` px once a step; arms opposite, the far one- darker; the far leg a tone off the near."""+ way back; its pass on the way out is made apart. The body rises and falls `bob` px once a step on its legs, the feet+ on the ground (`whole`: carried with it); arms opposite, the far one darker; the far leg a tone off the near."""ph = 2 * math.pi * k / cycleim = Image.new("RGBA", (300, 220))d = ImageDraw.Draw(im)x, y = 90, 40 + round(bob * math.cos(2 * ph))+ sole = y + 126 if whole else GROUNDsw = 16 * math.sin(ph)near, far = x + 14 + sw, x + 34 - 4 * math.sin(ph)d.rectangle((x + 14 - sw - 4, y + 34, x + 14 - sw + 4, y + 72), fill=(150, 150, 150, 255))- d.rectangle((far - 5, y + 80, far + 5, y + 126), fill=(61, 61, 71, 255))- d.rectangle((near - 5, y + 80, near + 5, y + 126), fill=(60, 60, 70, 255))+ d.rectangle((far - 5, y + 80, far + 5, sole), fill=(61, 61, 71, 255))+ d.rectangle((near - 5, y + 80, near + 5, sole), fill=(60, 60, 70, 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))d.rectangle((x + 14 + sw - 4, y + 34, x + 14 + sw + 4, y + 72), fill=(225, 225, 225, 255))@@ -134,13 +142,17 @@ def _outward(k: float, *, cycle: float, bob: int = 3) -> 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, lift: int = 0, light: tuple[str, int] | None = None, bob: int = 3) -> Image.Image:+ leg_half: int = 5, lift: int = 0, light: tuple[str, int] | None = None, bob: int = 3, whole: bool = False,+ air: int = 0, slide: int = 0) -> 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 thanforward — nothing else tells a step from the next. Each leg is drawn `leg_half` px either side of its line: at 10the feet are seen together over half the interval at a pass, as where the far foot passes hidden. The leg swingingforward is lifted up to `lift` px, most at its pass; `light` lays a light fixed on the screen over the legs- (`_lit`). The body bobs `bob` px once a step."""+ (`_lit`). The body rises and falls `bob` px once a step on its legs, the feet on the ground (`whole`: carried with+ it). A run lifts both soles up to `air` px off the ground while the body is high; a view from behind or a diagonal+ draws each sole up to `slide` px lower the further back its foot is (the planted foot sliding down the screen+ through its step)."""ph = 2 * math.pi * (k + phase) / cycleim = Image.new("RGBA", (300, 220))d = ImageDraw.Draw(im)@@ -152,7 +164,8 @@ def _alike(k: float, *, cycle: float, phase: float = 0, tone: int = 1, lean: flofor sign, t in ((1, 0), (-1, tone if leg_tone is None else leg_tone)):lx = x + 14 + 14 * sign * math.sin(ph)up = round(lift * max(0.0, sign * math.cos(ph)))- box = (lx - leg_half, y + 80 - up, lx + leg_half, y + 126 - up)+ ground = y + 126 if whole else GROUND - round(air * max(0.0, -math.cos(2 * ph)))+ box = (lx - leg_half, y + 80 - up, lx + leg_half, ground + round(slide * (1 - sign * math.sin(ph)) / 2) - up)d.rectangle(box, fill=(60 + t, 60 + t, 70 + t, 255))ImageDraw.Draw(drawn).rectangle(box, fill=255)d.rectangle((x, y + 30, x + 28, y + 84), fill=(200, 80, 80, 255))@@ -177,14 +190,15 @@ def _lit(im: Image.Image, legs_drawn: Image.Image, light: tuple[str, int] | Nonereturn Image.fromarray(a)-def _carried(draw, motion: str, room: int = 60):+def _carried(draw, motion, room: int = 60):"""`draw`'s walker carried up and down the screen with the whole picture (a motion of the picture, not the walk's)on a canvas `room` px taller either side: `"arc"` along a smooth arc, 24 px down at either end of the 73 framesand level in the middle; `"cubic"` from 48 px up at the start to 48 down at the end, still in the middle;`"sway"` 12 px down, level, 12 up and back every 92 frames; `"ramp"` 24 px down over the clip, a row every three- frames."""- move = {"arc": lambda k: round(24 * ((k - 36) / 36) ** 2), "cubic": lambda k: round(48 * ((k - 36) / 36) ** 3),- "sway": lambda k: round(12 * math.sin(2 * math.pi * k / 92)), "ramp": lambda k: round(24 * k / 72)}[motion]+ frames; or `motion(k)` px down in frame k."""+ move = motion if callable(motion) else {+ "arc": lambda k: round(24 * ((k - 36) / 36) ** 2), "cubic": lambda k: round(48 * ((k - 36) / 36) ** 3),+ "sway": lambda k: round(12 * math.sin(2 * math.pi * k / 92)), "ramp": lambda k: round(24 * k / 72)}[motion]def frame(k: int) -> Image.Image:im = draw(k)@@ -352,7 +366,8 @@ def test_a_walk_whose_far_foot_hides_is_cut_one_cycle(tmp_path, cycle, hold):assert said["asked"].startswith("the feet together") and said["overlap"] > crossings.HIDE_SHAREassert said["one"] < said["half"] and "cue" not in said and "unwitnessed" not in saidassert said["bob"]["says"] == "cycles" and said["bob"]["half"] >= local_cycle.BOB_TWICE and said["bob"]["swing"] >= local_cycle.BOB_FLOOR- assert "rises and falls twice an interval" in said["why"]+ assert said["bob"]["body"]["share"] >= local_cycle.BOB_OWN and said["bob"]["body"]["scale"] >= local_cycle.BOB_SCALE+ assert said["bob"]["edge"] == 0 and "rises and falls twice an interval" in said["why"] and "the body's own" in said["why"]@pytest.mark.slow@@ -563,6 +578,50 @@ def test_a_walk_whose_feet_meet_once_a_cycle_carried_up_and_down_is_cut_one_cyclassert said["bob"]["says"] == "cycles" and said["bob"]["quarter"] <= -local_cycle.BOB_TWICE[email protected]("walker, view, interval", [("behind", None, 17.5), ("outward", "front_diagonal", 16)])+def test_a_walk_carried_up_and_down_whole_feet_and_all_is_cut_two_intervals_with_a_warning(tmp_path, walker, view, interval):+ """The two walkers whose feet meet once a cycle, their body rising and falling twice an interval with the feet+ carried along (`whole`): the whole figure moved up and down on the walk's beat, pixel for pixel a picture shaken+ twice an interval over a body held still. Its top line alone rises and falls twice an interval, and the lowest row+ with it: nothing of it is the body's own, and nothing that reads no leg tells a step on from a cycle on. Two+ intervals, a warning naming why (the parent engine read the top line alone and cut one cycle)."""+ draw = ((lambda k: _behind(k, cycle=interval, hold=1, whole=True)) if walker == "behind" else+ (lambda k: _outward(k, cycle=interval, whole=True)))+ said = _unwitnessed(_cut(tmp_path / "out", _keyed(tmp_path, draw), *(("--view", view) if view else ())), interval)+ assert said["bob"]["half"] >= local_cycle.BOB_TWICE and said["bob"]["quarter"] <= -local_cycle.BOB_TWICE+ assert said["bob"]["body"]["share"] < local_cycle.BOB_OWN and "its lowest row rises and falls with it" in said["bob"]["why"]++[email protected]("bob", [0, 3])+def test_a_walk_on_a_picture_shaken_twice_an_interval_is_cut_two_steps_with_a_warning(tmp_path, bob):+ """The wide walker with its legs drawn alike, its crossings its steps every 23 frames, held still (or rising and+ falling on its legs once a step), on a picture shaken 3 px up and down twice an interval — dy = round(3 sin(4 pi k /+ 23)), a camera's shake, not the walk. Its top line on the screen rises and falls twice an interval (the parent engine+ read it so, as the body, and cut 23 frames, one step, counted two, and no warning said so), but its lowest row rises+ and falls with it, and the body's own rise and fall twice an interval is nothing: two steps, 46 frames, a+ warning."""+ walker = lambda k: _alike(k, cycle=46, phase=13, tone=4, lean=1, leg_tone=0, leg_half=10, bob=bob) # noqa: E731+ report = _cut(tmp_path / "out", _keyed(tmp_path, _carried(walker, lambda k: round(3 * math.sin(4 * math.pi * k / 23)))))+ said = _unwitnessed(report, 23)+ assert said["asked"].startswith("the feet together")+ if not bob:+ assert said["bob"]["half"] >= local_cycle.BOB_TWICE and said["bob"]["quarter"] <= -local_cycle.BOB_TWICE+ assert "its lowest row rises and falls with it" in said["bob"]["why"]+++def test_a_walk_whose_feet_run_off_the_frame_is_cut_two_intervals_with_a_warning(tmp_path):+ """The walker seen from behind whose feet meet once a cycle, rising and falling on its legs twice an interval, its+ frames cut at the soles' row: the lowest row is each frame's last. The feet may run off the frame there, so the+ lowest row is the frame's, not theirs, and the picture's moving cannot be read off it: nothing is witnessed, two+ intervals, a warning naming why."""+ walker = lambda k: _behind(k, cycle=17.5, hold=1).crop((0, 0, 300, GROUND + 1)) # noqa: E731+ said = _unwitnessed(_cut(tmp_path / "out", _keyed(tmp_path, walker)), 17.5)+ assert said["bob"]["edge"] > 0 and "the frame's last row" in said["bob"]["why"]++@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@@ -664,12 +723,22 @@ def _reading(run: int) -> crossings.Reading:runs=[(c - run // 2, c + run // 2) for c in middles])+def _body(top, *, lowest=None, crown=None, edge=None) -> dict:+ """Leg signals (`legs.strike_signals`, `legs.body_signals`) of a body 100 rows tall whose top line is `top` (per+ frame), its lowest row `lowest` (140 throughout: the feet on the ground) and its head `crown` wide (log; 20 px+ throughout), no lowest row on the frame's last row unless `edge` says where."""+ n = len(top)+ return {"top": [float(v) for v in top], "reach": [140.0] * n if lowest is None else [float(v) for v in lowest],+ "crown": [math.log(20)] * n if crown is None else [float(v) for v in crown],+ "edge": [0.0] * n if edge is None else [float(v) for v in edge], "height": [100.0] * n}++def _bob(beat: float | None) -> dict:- """Leg signals whose body's top line rises and falls 3 rows either way every `beat` frames (None: held still), the- body 100 rows tall: every 7.5 frames it rises and falls twice an interval of `_reading`, every 15 once."""+ """Leg signals whose body's top line rises and falls 3 rows either way every `beat` frames on legs whose feet stay+ on the ground (None: held still), the body 100 rows tall: every 7.5 frames it rises and falls twice an interval of+ `_reading`, every 15 once."""t = np.arange(FRAMES)- top = 40 + (np.zeros(FRAMES) if beat is None else 3 * np.cos(2 * np.pi * (t - 8) / beat))- return {"top": list(top), "height": [100.0] * FRAMES}+ return _body(40 + (np.zeros(FRAMES) if beat is None else 3 * np.cos(2 * np.pi * (t - 8) / beat)))def _choose(found: dict, *, period: int, seam: float, run: int = 9, search_seam: float = 1.0, view: str | None = None,@@ -812,7 +881,7 @@ def test_the_body_witnesses_two_steps_an_interval_where_its_top_line_rises_and_frange under BOB_FLOOR of the body's height and under BOB_ROWS rows, does not rise and fall, however it correlates."""t = np.arange(FRAMES)line = list(40 + swing * np.cos(2 * np.pi * t / beat))- word = local_cycle.bob_word(line, 15, height=100)+ word = local_cycle.bob_word(_body(line), 15)assert word["says"] == says and word["floor"] == local_cycle.BOB_FLOOR and word["twice"] == local_cycle.BOB_TWICEleft = local_cycle.off_flow(line, 15)assert word["swing"] == pytest.approx(np.ptp(left) / 100, abs=1e-4)@@ -828,16 +897,17 @@ def test_the_body_witnesses_two_steps_an_interval_where_its_top_line_rises_and_f@pytest.mark.parametrize("beat", [7.5, 15, None])def test_the_body_is_read_less_the_flow_of_the_picture(beat, flow):"""`bob_word` on an interval of 15 frames, the body 100 rows tall, its top line read in whole rows: rising and- falling 3 rows either way twice an interval (every 7.5 frames), once (every 15) or not at all, on a picture held- still or carried up and down with the line: along an arc 24 rows deep, a cubic 48 rows either way, a sway 12 rows- either way four intervals long, a ramp of 6 rows over the clip. Less its flow the line is the body's own: twice an- interval witnesses two steps an interval wherever the picture goes, and once or not at all never does; a line that- does not rise and fall is left under BOB_ROWS by the picture drifting in whole rows."""+ falling 3 rows either way twice an interval (every 7.5 frames), once (every 15) or not at all on legs whose feet+ stay on the ground, on a picture held still or carried up and down with the body, feet and all: along an arc 24 rows+ deep, a cubic 48 rows either way, a sway 12 rows either way four intervals long, a ramp of 6 rows over the clip.+ Less its flow the line is the body's own: twice an interval witnesses two steps an interval wherever the picture+ goes, and once or not at all never does; a line that does not rise and fall is left under BOB_ROWS by the picture+ drifting in whole rows."""t = np.arange(FRAMES)flows = {"still": 0 * t, "arc": 24 * ((t - 36) / 36) ** 2, "cubic": 48 * ((t - 36) / 36) ** 3,"sway": 12 * np.sin(2 * np.pi * t / 60), "ramp": 6 * t / 72}top = np.round(40 + (0 if beat is None else 3 * np.cos(2 * np.pi * t / beat)) + flows[flow])- word = local_cycle.bob_word(list(top), 15, height=100)+ word = local_cycle.bob_word(_body(top, lowest=np.round(140 + flows[flow])), 15)assert (word["says"] == "cycles") is (beat == 7.5)if beat is None and flow != "sway":assert word["rows"] < local_cycle.BOB_ROWS and "does not rise and fall" in word["why"]@@ -860,6 +930,180 @@ def test_the_flow_taken_out_leaves_a_rise_and_fall_once_or_twice_an_interval_whoassert np.max(np.abs(local_cycle.off_flow(list(flow), interval))) < 1e-9+def test_the_rise_and_fall_twice_an_interval_reads_as_far_as_the_line_moves():+ """`twice_an_interval` over an interval of 15 frames (and 17.5): a line rising and falling 3 rows either way twice an+ interval, with a rise and fall once an interval and a cubic flow laid on it, reads 3 rows; two lines read over the+ same frames subtract as they move — the same rise and fall on another flow leaves next to nothing. Under BEAT_FRAMES+ frames left less the flow, nothing is read."""+ t = np.arange(FRAMES)+ for interval in (15, 17.5):+ flow = 48 * ((t - 36) / 36) ** 3 + 2 * np.cos(2 * np.pi * t / interval)+ rise = 3 * np.cos(4 * np.pi * t / interval + 1)+ a = local_cycle.twice_an_interval(list(flow + rise), interval)+ assert abs(a) == pytest.approx(3, abs=0.15)+ b = local_cycle.twice_an_interval(list(5 + rise), interval)+ assert abs(a - b) < 0.15+ assert local_cycle.twice_an_interval(list(range(14)), 15) is None++[email protected]("motion", ["planted", "moved", "planted and shaken"])+def test_a_rise_and_fall_the_lowest_row_shares_is_the_picture_moving(motion):+ """`bob_word` on an interval of 15 frames, the body 100 rows tall, its lines read in whole rows. A top line rising+ and falling 3 rows either way twice an interval on legs whose feet stay on the ground (`planted`) is the body's own,+ all of it left against the lowest row: two steps an interval. The same rise and fall with the lowest row rising and+ falling with it (`moved`) — the body carried up and down whole, feet and all, or a body held still on a picture+ shaken twice an interval, the same lines either way — is the picture moving: the line alone rises and falls twice+ an interval, and nothing of it is left against the lowest row. A body's own rise and fall of 3 rows on a picture+ shaken 12 rows with it (`planted and shaken`) is a fifth of the line's, under BOB_OWN: not told from the picture.+ Neither witnesses anything."""+ t = np.arange(FRAMES)+ rise = 3 * np.cos(2 * np.pi * t / 7.5)+ own, moved = {"planted": (rise, 0 * t), "moved": (0 * t, rise), "planted and shaken": (rise, 4 * rise)}[motion]+ word = local_cycle.bob_word(_body(np.round(40 + own + moved), lowest=np.round(140 + moved)), 15)+ assert word["half"] >= local_cycle.BOB_TWICE and word["quarter"] <= -local_cycle.BOB_TWICE and word["edge"] == 0+ body = word["body"]+ assert body["least"] == local_cycle.BOB_OWN and body["scale_least"] == local_cycle.BOB_SCALE+ if motion == "planted":+ assert word["says"] == "cycles" and body["share"] > 0.9 and body["scale"] == pytest.approx(1)+ else:+ assert word["says"] is None and body["share"] < local_cycle.BOB_OWN+ assert "its lowest row rises and falls with it" in word["why"] and "the picture moves with the body" in word["why"]++[email protected]("about", ["feet", "middle"])+def test_a_rise_and_fall_the_heads_width_shares_is_the_picture_zooming(about):+ """`bob_word` on an interval of 15 frames: a body 100 rows tall, zoomed in and out with the picture twice an interval+ about its feet (3 % either way: its top line rising and falling 3 rows, its lowest row still) or about its middle+ (6 %: the top line and the lowest row 3 rows either way, turned over from each other). Against the lowest row the top+ line rises and falls as a body on its legs would, but its head widens as the line lifts, as much as the body's+ height grows: less the head's scale nothing is left. The picture zooms; nothing is witnessed."""+ t = np.arange(FRAMES)+ f = 1 + (0.03 if about == "feet" else 0.06) * np.sin(2 * np.pi * t / 7.5)+ at = 140 if about == "feet" else 90+ top, lowest = np.round(at - (at - 40) * f), np.round(at + (140 - at) * f)+ word = local_cycle.bob_word({**_body(top, lowest=lowest, crown=np.log(20 * f)), "height": list(100 * f)}, 15)+ assert word["half"] >= local_cycle.BOB_TWICE and word["quarter"] <= -local_cycle.BOB_TWICE+ assert word["says"] is None and word["body"]["scale"] < local_cycle.BOB_SCALE+ assert "its head's width changes with it" in word["why"] and "the picture zooms with the body" in word["why"]+++def test_a_lowest_row_on_the_frames_last_row_holds_the_word():+ """A top line rising and falling twice an interval on legs whose feet stay on the ground witnesses two steps an+ interval; the same with the lowest row on the frame's last row in one frame does not: the feet may run off the+ frame there, and the lowest row is the frame's, not theirs. The word says why."""+ t = np.arange(FRAMES)+ top = np.round(40 + 3 * np.cos(2 * np.pi * t / 7.5))+ assert local_cycle.bob_word(_body(top), 15)["says"] == "cycles"+ word = local_cycle.bob_word(_body(top, edge=(t == 30)), 15)+ assert word["says"] is None and word["edge"] == 1 and f"the frame's last row in 1 of {FRAMES} frames" in word["why"]+++# Walkers moved or zoomed with the whole picture, by their interval between crossings d: the side walker whose legs are+# drawn alike and wide, its crossings its steps (23 frames), and the walker seen from behind whose feet meet once a cycle+# (17.5); held still, carried up and down whole (feet and all, on the walk's beat), or rising and falling on its legs+# once a step. None rises and falls twice an interval on its legs.+_STEPS = {"cycle": 46, "phase": 13, "tone": 4, "lean": 1, "leg_tone": 0, "leg_half": 10}+NOT_TWICE = {+ "steps-still": (23, lambda k: _alike(k, **_STEPS, bob=0)),+ "steps-whole": (23, lambda k: _alike(k, **_STEPS, whole=True)),+ "steps-on-its-legs": (23, lambda k: _alike(k, **_STEPS)),+ "hidden-still": (17.5, lambda k: _behind(k, cycle=17.5, hold=1, alike=True, bob=0)),+ "hidden-whole": (17.5, lambda k: _behind(k, cycle=17.5, hold=1, alike=True, whole=True)),+}+++def _zoomed(draw, scale, about: str):+ """`draw`'s walker zoomed in and out with the whole picture, `scale(k)` in frame k about its feet, its middle or its+ head (bilinear), on a canvas 60 px taller either side."""+ ax, ay = 104, {"feet": GROUND, "middle": 103, "head": 40}[about]++ def frame(k: int) -> Image.Image:+ im, f = draw(k), scale(k)+ big = im.resize((round(im.width * f), round(im.height * f)), Image.BILINEAR)+ out = Image.new("RGBA", (im.width, im.height + 120))+ out.paste(big, (round(ax - ax * f), round(60 + ay - ay * f)))+ return out+ return frame+++def _word_of(draw, interval: float) -> dict:+ frames = [draw(k) for k in range(FRAMES)]+ return local_cycle.bob_word({**legs.strike_signals(frames), **legs.body_signals(frames)}, interval)++[email protected]("period", [0.25, 0.5, 1, 2])[email protected]("walker", list(NOT_TWICE))+def test_a_walk_moved_up_and_down_with_the_whole_picture_on_any_beat_is_never_witnessed(walker, period):+ """`bob_word` off the drawn frames (`legs.strike_signals`, `legs.body_signals`) at the walker's interval d, the+ whole picture moved up and down 3, 6 or 12 px either way every d/4, d/2, d or 2d frames, at four phases+ (`_carried`). The top line on the screen may rise and fall twice an interval with the picture (the parent engine+ read it so, and witnessed a body held still on a picture shaken twice an interval), but the lowest row moves with+ it, and what is left against it does not rise and fall twice an interval: none is witnessed."""+ d, draw = NOT_TWICE[walker]+ frames = [draw(k) for k in range(FRAMES)]+ for rows in (3, 6, 12):+ for phase in (0, math.pi / 2, math.pi, 3 * math.pi / 2):+ shake = lambda k, m=rows, f=phase: round(m * math.sin(2 * math.pi * k / (period * d) + f)) # noqa: E731+ word = _word_of(_carried(lambda k: frames[k], shake), d)+ assert word["says"] is None, (walker, period, rows, phase, word)+ if (walker, period, rows, phase) == ("steps-still", 0.5, 3, 0):+ assert word["half"] >= local_cycle.BOB_TWICE and word["quarter"] <= -local_cycle.BOB_TWICE+ assert "its lowest row rises and falls with it" in word["why"]++[email protected]("period", [0.25, 0.5, 1])[email protected]("walker", ["steps-still", "steps-on-its-legs", "hidden-still"])+def test_a_walk_zoomed_in_and_out_with_the_whole_picture_on_any_beat_is_never_witnessed(walker, period):+ """The same walkers, held still or rising and falling on their legs once a step, zoomed in and out with the picture+ 0.5 to 4 % either way every d/4, d/2 or d frames about their feet, middle or head, at two phases (`_zoomed`): where+ the top line rises and falls twice an interval against the lowest row, the head widens with it, and less its scale+ nothing of the body's own is left. None is witnessed."""+ d, draw = NOT_TWICE[walker]+ frames = [draw(k) for k in range(FRAMES)]+ for amount in (0.005, 0.01, 0.02, 0.04):+ for about in ("feet", "middle", "head"):+ for phase in (0, math.pi / 2):+ scale = lambda k, a=amount, f=phase: 1 + a * math.sin(2 * math.pi * k / (period * d) + f) # noqa: E731+ word = _word_of(_zoomed(lambda k: frames[k], scale, about), d)+ assert word["says"] is None, (walker, period, amount, about, phase, word)+++# The picture moved up and down (of the interval d, px either way, phase), or held still (None).+SHAKES = [None, (0.5, 6, 0), (0.5, 6, math.pi / 2), (1, 6, 0)]+SLIDE_SHAKES = [None, (0.5, 3, 0), *((0.5, 6, f) for f in (0, math.pi / 2, math.pi, 3 * math.pi / 2)), (0.5, 12, 0), (1, 6, 0)]+++def _shake(shake, d: float):+ return (lambda k: 0) if shake is None else (lambda k: round(shake[1] * math.sin(2 * math.pi * k / (shake[0] * d) + shake[2])))++[email protected]("air", [1, 2, 3, 6])+def test_a_run_whose_feet_leave_the_ground_as_its_body_rises_is_never_witnessed_two_steps_an_interval_of_steps(air):+ """The side walker rising and falling on its legs once a step, its crossings its steps (23 frames), running: both+ soles lifted up to `air` px off the ground while the body is high, so the lowest row rises with the body for half of+ each step. Still or on a picture moved 6 px either way every d/2 or d frames: what is left of the top line against+ the lowest row rises and falls once an interval, never twice — not witnessed."""+ frames = [_alike(k, **_STEPS, air=air) for k in range(FRAMES)]+ for shake in SHAKES:+ assert _word_of(_carried(lambda k: frames[k], _shake(shake, 23)), 23)["says"] is None, (air, shake)++[email protected]("slide", [6, 12, 24])+def test_a_walk_whose_planted_foot_slides_down_the_screen_is_never_witnessed_two_steps_an_interval_of_steps(slide):+ """The side walker rising and falling on its legs once a step, its crossings its steps, drawn as a view from behind+ or a diagonal draws feet: each sole up to `slide` px lower the further back its foot is, the foot moving forward+ lifted 8 px — the lowest row is the planted foot, sliding down through its step and jumping up when the other lands.+ Still or on a picture moved 3, 6 (at four phases) or 12 px either way every d/2 frames, or 6 every d: not+ witnessed."""+ frames = [_alike(k, **_STEPS, lift=8, slide=slide) for k in range(FRAMES)]+ for shake in SLIDE_SHAKES:+ assert _word_of(_carried(lambda k: frames[k], _shake(shake, 23)), 23)["says"] is None, (slide, shake)++@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