Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
fix(video): the body's word is one line, its top line or its first solid row, rising and falling twice an interval on the screen and over its feet, the rows down the middle of the body tell a body rising whole from a picture zoomed with it where a band moves on the beat, and a line must be at least `BOB_OWN` of what is left against its lowest row.
Soohong Kim2d50505fd7a1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f2c1a35..95ffa7e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,21 @@All notable public changes to `sprite-gen` are recorded here. Versions track the `version:` field in `SKILL.md` and `pyproject.toml`.+## Unreleased++**Upgrading from 3.13.0: some walk cuts and crossing readings change, and a set's alignment can change with them.** The body's word is now one line, its top line or its first solid row, rising and falling twice an interval on the screen and over its feet, the same line in both places, and where a band of the upper body moves on the beat the rows down the middle of the body tell a body rising whole from a picture zoomed with it. Now witnessed: a walk whose arms swing past its sides where the rows down its middle read a body rising whole; such a cut stands, or a crossing interval that was left on steps is read as a cycle, and its cut can change: the search's cut stands, or a shorter two-step cut is chosen. Now held, named: a walk rising and falling on its legs on a picture swaying up and down once a cycle or slower. It was witnessed over its feet alone, but a head rising twice in one step said the same in one place, and a half cycle stood on it, so a line must now say so in both places. Its loop says `cycle-unwitnessed`, and `video-cycle-align --cycles <loop>=1` settles it where it is one cycle. Also held now: a head rising twice in one step, and a line on a beat of its own over feet that do the rising and falling, which stood before. `video-loop` run on its own can now write `four steps` on a cut of two cycles it used to hold `cycle-unwitnessed`; `video-set` leaves it out of alignment (`cycle-four-steps`) and `video-cycle-align` run on its own stops on it. A set's alignment can change: a loop newly witnessed joins it, so the set's length, and the frames made between for the others, can change.++**Walks that stay held, named:** a walk whose rows down its middle fit a zoom as well as they fit standing; a walk whose top line a tail takes and whose first solid row says so only on the screen, the shape of a head rising twice in one step; a walk whose body rises and falls once in the cut; a cut whose line over the feet does not read twice the cut; a search's cut kept where no two-step cut closes. `video-cycle-align --cycles <loop>=1` settles each that is one cycle.++### Walk and run loops++- **Changed: the body's word is one line in both places (`local_cycle.body_word`, `local_cycle.TOP_LINES`, `local_cycle.bob_word(..., line=)`, `local_cycle.read_cycles`, `local_cycle.cut_word`).** `local_cycle.body_word(signals, interval)` reads each line of `local_cycle.TOP_LINES` (`{'top': 'its top line', 'first_row': 'its first solid row'}`), in that order, with `local_cycle.bob_word(signals, interval, feet=False, line='top')` in both places of `local_cycle.CUT_LINES`, and says `"cycles"` where one line says so on the screen and over its feet, the same line in both, never one line on the screen and the other over the feet. `read_cycles` reads it on the crossing interval, and `cut_word` reads it on the cut L, L/2 and 2L through `local_cycle._cut_lines`, saying `"two steps"`, `"four steps"` or `"one step"` only where the same line says so in both places. On the screen alone a head rising twice in one step reads as two steps, and the feet leave no such rise and fall over them; over the feet alone the two feet's heights, taken in by turns, read as the body's, and the screen line has none of them. Two lines are read because `top` passes over what is narrower than half the frame's widest row, so a tail or a cape lifted over the head takes it off the head where the first solid row stays on the body's top, and the first solid row takes an ear's or a hat's tip in; neither is the better line. The price is the design's: a walk whose rise and fall shows in one place only is not witnessed. `why` strings that said "its top line" now say the line's name, and the cut's `why` where nothing says is each place's why, repeated ones once, joined by "; ".+- **New: the rows down the middle of the body (`legs.body_signals` `first_row`, `strips`, `legs.STRIP`, `legs.DEEP`, `local_cycle.body_depth`, `BOB_RIGID`, `STRIP_FLOOR`, `STRIP_SHIFT`, `STRIP_SHIFT_MIN`).** `legs.body_signals(frames)` also returns `first_row` (per frame, the first solid row) and `strips` (per frame, the rows down the middle of the body: `legs.DEEP` = 0.7 of its median height from the first solid row, `legs.STRIP` = 0.12 of that height either side of the mean column of the solid pixels among them, each row's mean premultiplied colour and mean cover, shape frames by rows by 4, values 0..1); neither is recorded in any report, and `legs.strike_signals` and `gait.silhouette.signals` are unchanged. `local_cycle.body_depth(signals, interval)` reads the strip at the top of the rise against the bottom: the frames where the rise and fall twice an interval of the line over its lowest row stands a half or more of the way to the top and to the bottom, each set's strips in a median, each fit moved as it fits best, in steps of a twelfth of the most and at least half a row, at most `STRIP_SHIFT` (0.03) of the body's height either way and at least `STRIP_SHIFT_MIN` (3) rows. It returns `need`, `risen`, `rigid`, `zoom`, `ratio` (`zoom` of `rigid`), `moved` and `frames`, or None where no strip is read, the rise and fall is none, a set holds under two frames or the frames at the top are not the taller. `local_cycle.own_beat` reads the body's own on `less_lowest` alone where `ratio` is `BOB_RIGID` (1.0) or more, holds where it is under, and leaves the bands to decide where it is not read: no `depth`, or `moved` under `STRIP_FLOOR` (`CUE_FLOOR` * `legs.TONE`, half the step the colours are drawn in, about 0.00196: under it the strip is as good as plain to that zoom). A body rising whole carries those rows as they are; a zoom as far as the rise draws them longer; arms swinging across the bands hardly touch them. So a walk whose arms swing past its sides on the beat is witnessed where the rows down its middle read a body rising whole, and the bands no longer hold it there. A body one flat colour down its middle has no strip to read, and the bands decide as they did. A picture zoomed on the beat with every band seen drawn against the zoom and a strip as plain is still read as the body's own.+- **New: a line must be at least `BOB_OWN` of what is left against the lowest row on the screen (`local_cycle.bob_word`).** After the `less_lowest` gate and before the bands, where `beat` is under `BOB_OWN` (0.3) times `less_lowest`, nothing is witnessed, and `why` says "its lowest row does the rising and falling: {name} does so twice an interval {beat} rows on the screen, {percent} of the {less_lowest} left against its lowest row (at least 30%), and the body's own is not told from it". Read every four frames, a line on a beat of twelve leaves nothing of it twice an interval of 24, and still correlates there; what is left against the lowest row is then all the lowest row's.+- **Changed: report fields.** `cycle.step_count.cycles.bob` gains `top_line`, the line that said so, where it says `"cycles"`, and `feet`, the record over the feet, its `says` and `top_line` the same. `body` in `bob`, `lines.*.bob` and `lines.*.on` gains `depth`: null or `{need, risen, rigid, zoom, moved, ratio, frames}` (`need`, `rigid`, `zoom` and `moved` rounded to 5 places, `risen` to 2, `ratio` to 3), a measure recorded as the other measures are, not a verdict. `cycle.cut_witness.by` is `["screen", "feet"]` or `["order"]`, never one place; `cut_witness.lines.screen.says` and `lines.feet.says` are always the cut's word; `lines.*.bob`, `lines.*.on` and `on` carry `top_line`. No report key tells a right hold from a false one. `why` strings changed as `docs/loop-repair.md` says: the line's name in place of "its top line", "on the screen and over its feet" in the crossings' why, the new gate's why, the strip's why, the band gate's why extended with what the rows down the middle tell, and `mark` read of the line that stood.+- **Changed: Python callers.** New `local_cycle.body_word`, `local_cycle.body_depth` and `local_cycle.TOP_LINES`; `local_cycle.bob_word` takes `line`, a `TOP_LINES` key; `local_cycle._cut_line` and `local_cycle.CUT_WORDS` are gone.+- **Tests (`tests/video/test_walk_steps.py`, `tests/video/test_cycle_align.py`, `tests/video/test_loop_silent_pass.py`).** Renamed `test_a_walk_rising_on_its_legs_on_a_picture_swaying_once_a_cycle_or_slower_is_held_as_cut_named` (was `..._is_witnessed_one_cycle`), `test_a_walk_whose_feet_meet_once_a_cycle_its_arms_swinging_past_its_sides_is_cut_one_cycle` (was `..._is_cut_two_intervals_with_a_warning`) and `test_a_walk_whose_arms_swing_past_its_sides_reads_as_one_whose_arms_swing_within_them` (was `test_a_walk_whose_arms_swing_past_its_sides_is_never_witnessed_its_crossings_left_on_steps_or_its_cut_held`). `test_a_fixed_cut_of_one_cycle_whose_crossings_mark_cycles_is_counted_two_steps` now says a walk seen from behind on twos, its arms swinging past its sides, is counted two steps, the same as one whose arms swing within its sides, because the rows down the middle of the body read a body rising whole (it used to say its crossings were left on steps, its fixed cut counted one step, and failed). New tests for a top line on a quick beat of its own over feet rising twice an interval, a head rising twice in one step, a cape taking the top line off the head, a line on the screen and another over the feet, the rows down the middle of a body, a reason both lines of a body give (naming neither) said once, on a crossing interval and on a cut, and `video-cycle-align` on its own stopping on a walk its body reads four steps. Synthetic frames only.+## v3.13.0 - A walk whose feet meet once a cycle is cut one cycle long only where a witness says so, video-set cuts a searched walk or run with motion-auto by default, contract strings written once, read by name**Upgrading from 3.12.1: walk and run cuts and the `video-set` default change, while the contract strings work changes no output.** `video-set` without `--anchor` used to cut everything with `--anchor none`. It now cuts each walk and run item whose loop is searched with `--anchor motion-auto` and passes the item's view to `video-loop`, so those items get 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`, crossings are read as marking cycles, not steps, only where a witness that reads no leg says the interval holds two steps. This is asked where feet are seen together over half the interval at a pass (`crossings.HIDE_SHARE`, 0.5), or where `--view` is given and is not `side` (`video-set` passes the view); `video-loop --view` is new. There are two witnesses. One: the body's top line, less the picture's own flow, rises and falls twice an interval, and that rise and fall is the body's own, read against its lowest row and its upper body, so the picture moved or zoomed with it witnesses nothing. Two, from the front, the back or a diagonal only, never from the side: the order the feet are drawn in. The view's foot cue only refuses. A walk 3.12.1 cut two cycles long is now one cycle, with new bytes. A walk where 3.12.1 kept the search's cut with no `steps` keeps its cut, and the strip and report now record `steps: 2`. A walk whose crossings mark steps (brief passes, or from the side) keeps its cut and its pictures. Where nothing witnesses, the crossings stay on steps with a warning naming `cycle-unwitnessed`. Every walk or run cut is now held to the witness's word before it is cut, in `video-loop --anchor motion-auto` with `--cycle auto` or `periodic`. A cut nothing witnesses as whole cycles keeps its length exactly as chosen, is named `cycle-unwitnessed` in the warnings and the report (`cycle.cut_witness`), and is never lengthened or shortened. A walk that starts or stops inside its take gets a `retake` record (`reason: "start-stop"`, `remedy: "retake"`). Its cut is kept and is not refused, and `video-set` names it in its warnings and in `table.md`. `video-set` leaves `cycle-unwitnessed`, `cycle-four-steps` and start-stop loops out of cycle alignment, names them under `left_out`, keeps those loops as cut, and aligns the other directions. Standalone `video-cycle-align` now reads the cut report beside each loop. On a held or four-step cut it stops under its default `--multi-cycle fail` before rewriting any file. `--multi-cycle warn` aligns with a warning, and `--cycles` settles it. Reports gain `stands` and `run_limit` where a clip stands still, `cycles` where cycle reading is asked, and `cycle.cut_witness` only in reports of `--anchor motion-auto` cuts; `--anchor none` reports are unchanged. Report fields `step_count.search.same_picture` and `step_count.same_picture` and the count code `same-picture` are removed.diff --git a/docs/loop-repair.md b/docs/loop-repair.mdindex 7897846..a29d28f 100644--- a/docs/loop-repair.md+++ b/docs/loop-repair.md@@ -1314,9 +1314,10 @@ whose crossings are its steps, its legs drawn alike, turns its cue over half anwalk whose other leg leads a step on does; and a cue that merely moves (the no-view shade) says nothingabout which leg leads. Read that way, a walk whose crossings are its steps was cut one step long andcounted two steps: a half-cycle loop, with no warning. The crossings mark cycles only where a witness-that 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 whichever-leg leads, so two rises an interval are two steps an interval.+that reads no leg says the interval holds two steps: one line of the body, its top line+(`legs.strike_signals` `top`, one row per frame) or its first solid row (`legs.body_signals` `first_row`),+rising and falling twice an interval on the screen and over its feet, the same line in both places. The+body rises and falls once a step whichever leg leads, so two rises an interval are two steps an interval.`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 one@@ -1352,12 +1353,14 @@ frames left counted from the first; it returns the twice-an-interval harmonic as(its cos coefficient less i times its sin coefficient), in the values' units: a line rising and fallinga rows either way twice an interval reads a in magnitude. Lines read so over the same frames andinterval 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 upper body: under 8 frames are left less the flow". `local_cycle.own_beat(signals, interval)` reads-the top line (`top`), the lowest solid row (`reach`) and the lowest opaque row (`sole`) with-`twice_an_interval`. What is left of the top line's rise and fall against the lowest row (`less_lowest`,-the top line's less the lowest solid row's or less the lowest opaque row's, whichever leaves less) gives-the zoom that would make it: the median frame zoomed in by 1 + `less_lowest` / the body's median height+`says` null, `why`: "{name}'s rise and fall twice an interval is not read against its lowest row and+upper body: under 8 frames are left less the flow". `{name}` in each `why` is the line's name, from+`local_cycle.TOP_LINES` = `{'top': 'its top line', 'first_row': 'its first solid row'}`, the `line`+`bob_word(signals, interval, feet=False, line='top')` reads. `local_cycle.own_beat(signals, interval)`+reads the line (`top` or `first_row`), the lowest solid row (`reach`) and the lowest opaque row (`sole`)+with `twice_an_interval`. What is left of the line's rise and fall against the lowest row (`less_lowest`,+the line's less the lowest solid row's or less the lowest opaque row's, whichever leaves less) gives the+zoom that would make it: the median frame zoomed in by 1 + `less_lowest` / the body's median height(`legs.zoomed`). Each band's `zoom` is how far that moves the band's width, in pixels, measured on thebody as it is drawn, not assumed of its outline: a band whose sides run straight down moves by the zoom'swhole part, a band across a top that widens as it goes down (a pointed head, an ear's tip, a hat's point)@@ -1369,52 +1372,89 @@ a zoom moves a band's width in step with the line it lifts, but the band's own p(arms, a cape) move it too, in step with the line, against it, or a quarter of the beat off, and thezoom's part is not told from theirs. As much of the zoom as a band reads is taken out whatever its turn,so a band whose width moves against the line adds nothing to what is left. `less`, for a band seen, is-what is left of the top line's rise and fall twice an interval less as much of the zoom as the band-reads: `less_lowest` times (1 - `reads`), and nothing where `reads` is 1 or more. It returns `beat`,-`lowest`, `sole`, `less_lowest`, `bands` (`{rows, width, zoom, beat, reads, less}`, per band: its rows-below the first solid row, its width in the median frame and `zoom`, in pixels, `beat` in pixels,-`reads` and `less` null where the band is not seen), `less_bands` (the least `less`, null where no band-is seen), `still_bands` (the number of bands seen whose `reads` is at most 1 - `BOB_SCALE`, 0.4: they-hold still on the beat), and `own`, the smaller of `less_lowest` and `less_bands`. 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 no band is seen (`less_bands` null): `says` null,-`why`: "no band of its upper body would show the picture zooming: zoomed in as far as its top line rises-and falls twice an interval against its lowest row ({less_lowest} rows of {height}), no band's width-moves 1 px (at most {largest zoom}): the picture zooming with the body is not told from the body's-own". Where `less_bands` is under the largest of `BOB_OWN` (0.3) times `beat`, the floor, and-`BOB_SCALE` (0.6) times `less_lowest`: `says` null, `why`: "its upper body's width changes with it:-less as much of the zoom as its band {a}% to {b}% of its height below its top reads, 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 may zoom with the body, and the-body's own is not told from it". Where `beat` is under `BEAT_STILL` (`1e-9` rows), as for a body whose top line holds still on the-screen while only its lowest row rises and falls (a body that does not rise and fall whose foot drawn-nearer is drawn lower each step), `{percent}` now reads "its top line holding still"-(`local_cycle._share`). The test is against `BEAT_STILL` rather than zero because a top line that does-not rise and fall fits to round-off, which is 0 under one machine's numpy and a tiny nonzero value under-another's. What the witness says is unchanged; before, `video-loop` stopped there on a division by zero.-Since every band's `less` is `less_lowest` times (1 - `reads`), this-hold catches every band seen that moves on the beat (its `reads` over 0.4): the body's own is witnessed-only where every band seen holds still on the beat and what is left is still at least 30% of `beat` and-over the floor. Otherwise `says` `"cycles"`. A body rising and falling on its legs leaves its planted-foot, the lowest solid row, on the ground, and carries its upper body's bands whole, leaving their-widths. 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 each band as it-lifts the line, as far as the band's outline lets it. Where no band would show the zoom, or any band-that would moves on the beat (arms swinging across it, a cape, or the picture zooming), nothing tells-the picture zooming from the body's own, and nothing is witnessed. One band holding still says only that-no zoom shows in that band: a head drawn narrower as the picture zooms in holds still so. A body rising-and falling so little that no band would move a pixel is not told from a zoom either. Two cases this-does not tell apart: (a) a picture zoomed on the beat with every band seen drawn against the zoom,-so that each band holds still: its band widths are those of an upper body rising whole on its legs with-no zoom (measured on one such drawing, every band within 0.78 px of such a body), and it is read as the-body's own; (b) a body that rises and falls twice a step on its own legs: the witness rests on a body-rising and falling once a step, and such a body reads as two steps an interval of one. A walk whose arms-swing past its sides on the beat is not witnessed where a band seen moves on the beat (its `reads` over-0.4). Where a walk is not witnessed, its crossings stay on steps, or its cut is held, and either way it-is named, never handed out as a cycle unnamed.+what is left of the line's rise and fall twice an interval less as much of the zoom as the band reads:+`less_lowest` times (1 - `reads`), and nothing where `reads` is 1 or more. It returns `beat`, `lowest`,+`sole`, `less_lowest`, `bands` (`{rows, width, zoom, beat, reads, less}`, per band: its rows below the+first solid row, its width in the median frame and `zoom`, in pixels, `beat` in pixels, `reads` and+`less` null where the band is not seen), `less_bands` (the least `less`, null where no band is seen),+`still_bands` (the number of bands seen whose `reads` is at most 1 - `BOB_SCALE`, 0.4: they hold still+on the beat), `depth` and `whole`, the reading of the rows down the middle of the body, and `own`,+`less_lowest` where `whole` is True or no band is seen, else the smaller of `less_lowest` and+`less_bands`. None where a line is not read. `depth` is `local_cycle.body_depth(signals, interval)`,+which reads the rows down the middle of the body (`legs.body_signals` `strips`) at the top of the rise+against the bottom: the frames where the rise and fall twice an interval of the line over its lowest row+(`over_feet`) stands a half or more of the way to the top, and those where it stands a half or more of+the way to the bottom, each set's strips in a median. The strip at the bottom, as it stands and zoomed by+`need`, is fit to the one at the top, each fit moved as it fits best, in steps of a twelfth of the most+and at least half a row, at most `STRIP_SHIFT` (0.03) of the body's height either way and at least+`STRIP_SHIFT_MIN` (3) rows. It returns `need` (the zoom those frames' rise would be, of the body's+height), `risen` (in rows), `rigid` (how far the strip at the top lies from the one at the bottom as it+stands), `zoom` (how far from that one zoomed by `need`), `ratio` (`zoom` of `rigid`), `moved` (how far+the zoom moves the strip at the bottom from itself, the most `zoom` could tell) and `frames` (how many+frames stand in each set). None where no strip is read, the rise and fall is none, a set holds under two+frames or the frames at the top are not the taller. `whole` is True where `ratio` is `BOB_RIGID` (1.0)+or more, False under it, and None where it is not read: no `depth`, or `moved` under `STRIP_FLOOR`.+`STRIP_FLOOR` = `CUE_FLOOR` * `legs.TONE`, half the step the colours are drawn in, about 0.00196, as+`CUE_FLOOR` reads a cue: under it the strip is as good as plain to that zoom, which of the two fits+better is the rounding of its colours, and it is not read. A body rising whole carries those rows as+they are; a zoom as far as the rise draws them longer. They read the body's own where that zoom fits+them no better than they fit as they stand. Arms swinging across the bands hardly touch them. 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, {name}'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". Then where `beat` is under `BOB_OWN` (0.3) times `less_lowest`: `says` null, `why`: "its+lowest row does the rising and falling: {name} does so twice an interval {beat} rows on the screen,+{percent} of the {less_lowest} left against its lowest row (at least 30%), and the body's own is not+told from it": read every four frames, a line on a beat of twelve leaves nothing of it twice an interval+of 24, and still correlates there, and what is left against the lowest row is then all the lowest row's.+Where no band is seen (`less_bands` null): `says` null, `why`: "no band of its upper body would show the+picture zooming: zoomed in as far as {name} rises and falls twice an interval against its lowest row+({less_lowest} rows of {height}), no band's width moves 1 px (at most {largest zoom}): the picture+zooming with the body is not told from the body's own". Then where `whole` is False: `says` null, `why`:+"the rows down the middle of its body fit a zoom as well as they fit standing: at the top of its rise+they lie {zoom} off those at the bottom zoomed {need}, the rise of {risen} rows, and {rigid} off them as+they stand ({ratio} of it, at least 1): the picture may zoom with the body, and the body's own is not+told from it". Then, only where `whole` is None, where `less_bands` is under the largest of `BOB_OWN`+(0.3) times `beat`, the floor, and `BOB_SCALE` (0.6) times `less_lowest`: `says` null, `why`: "its upper+body's width changes with it: less as much of the zoom as its band {a}% to {b}% of its height below its+top reads, {name}'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), and the rows down the+middle of its body do not tell (a zoom as far as that moves them {moved}, under {STRIP_FLOOR}, or: they+are not read): the picture may zoom with the body, and the body's own is not told from it". Where+`whole` is True the bands are recorded and left out. Where `beat` is under `BEAT_STILL` (`1e-9` rows),+as for a body whose top line holds still on the screen while only its lowest row rises and falls (a body+that does not rise and fall whose foot drawn nearer is drawn lower each step), `{percent}` now reads+"{name} holding still" (`local_cycle._share`). The test is against `BEAT_STILL` rather than zero because+a top line that does not rise and fall fits to round-off, which is 0 under one machine's numpy and a tiny+nonzero value under another's. What the witness says is unchanged; before, `video-loop` stopped there on+a division by zero. Since every band's `less` is `less_lowest` times (1 - `reads`), this hold catches+every band seen that moves on the beat (its `reads` over 0.4) where the rows down the middle of the body+do not tell: there the body's own is witnessed only where every band seen holds still on the beat and+what is left is still at least 30% of `beat` and over the floor. Otherwise `says` `"cycles"`. A body+rising and falling on its legs leaves its planted foot, the lowest solid row, on the ground, carries its+upper body's bands whole, leaving their widths, and carries the rows down the middle of its body as they+are. The picture moved up and down carries the lowest row with the line by the same rows, so nothing is+left of the line's rise against it. The picture zoomed in and out widens each band as it lifts the line,+as far as the band's outline lets it, and draws the rows down the middle of the body longer. Where no+band would show the zoom, nothing tells the picture zooming from the body's own, and nothing is+witnessed. Where a band that would moves on the beat (arms swinging across it, a cape, or the picture+zooming), the rows down the middle of the body tell the two apart where they are read: a zoom as far as+the rise fits a body rising whole no better than it fits as it stands, and fits a picture zoomed with the+body better. Where they are not read, nothing tells the picture zooming from the body's own, and nothing+is witnessed. One band holding still says only that no zoom shows in that band: a head drawn narrower as+the picture zooms in holds still so. A body rising and falling so little that no band would move a pixel+is not told from a zoom either. Two cases this does not tell apart: (a) a picture zoomed on the beat+with every band seen drawn against the zoom, so that each band holds still, and the rows down its middle+as good as plain to the zoom (a zoom as far as the rise moves them under `STRIP_FLOOR`): its band widths+are those of an upper body rising whole on its legs with no zoom (measured on one such drawing, every+band within 0.78 px of such a body), and it is read as the body's own; (b) a body that rises and falls+twice a step on its own legs: the witness rests on a body rising and falling once a step, and such a+body reads as two steps an interval of one. A walk whose arms swing past its sides on the beat is+witnessed where the rows down its middle read a body rising whole, and is not witnessed where a band+seen moves on the beat (its `reads` over 0.4) and those rows do not tell; a body one flat colour down+its middle has no strip to read, and the bands decide. Where a walk is not witnessed, its crossings stay+on steps, or its cut is held, and either way it is named, never handed out as a cycle unnamed.`legs.body_signals(frames)`: `bands` (per frame, each band's mean width in alpha, in pixels, read on the samerows in every frame, those of the clip's median body height), `band_rows`, `median_frame` (the alpha of theframe whose body height is nearest the clip's median), `edge`, 1 where the lowest solid row is the frame's@@ -1422,7 +1462,11 @@ last row, else 0, and `sole`, the lowest row with a fully opaque pixel (alpha `llowest solid row where a frame has none, because a shadow drawn translucent under the feet is solid to thelegs' reading (alpha 128 or more) and, drawn fixed on the screen, stays while the picture moves, so apicture shaken twice an interval would otherwise be read as the body's own rise against it; the feet are-drawn opaque and move with the picture. `signals` are the frames' `legs.strike_signals` merged with+drawn opaque and move with the picture. It also returns `first_row` (per frame, the first solid row) and+`strips` (per frame, the rows down the middle of the body: `legs.DEEP` = 0.7 of its median height from the+first solid row, `legs.STRIP` = 0.12 of that height either side of the mean column of the solid pixels among+them, each row's mean premultiplied colour and mean cover, shape frames by rows by 4, values 0..1). Neither+is recorded in any report. `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'switness 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. The@@ -1438,11 +1482,12 @@ correlation half an interval on and never says `"cycles"`. With no view given, nshade of the feet's two halves is no longer read. Where the picture passes, the view's cue is checkedfirst: 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`), the body's own ({own}-rows of {beat} left against its lowest row and upper body, {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 on-steps, as from the side; `why` says nothing that reads no leg witnesses two steps an interval (the bob's+`"cycles"`, `cycles` is true, and `why` says the line that stood (its top line or its first solid row) less+its flow rises and falls twice an interval on the screen and over its feet (its `half`, at least+`BOB_TWICE`; its `quarter`, at most `-BOB_TWICE`, on the screen), the body's own ({own} rows of {beat} left+against its lowest row and upper body, {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 on steps, 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`) gainthis line (`s/L` being the cut): "the clip one interval on is the same picture, as a walk whose feet meet@@ -1455,14 +1500,20 @@ 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, 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, sole, less_lowest, less_bands,-still_bands, own, bands: {rows, width, zoom, beat, reads, less}, share, scale, least, scale_least,-band_floor}`: `share` = `own` / `beat`, `scale` = `less_bands` / `less_lowest` (`share` and `scale` read 0.0-where the value they are divided by is under `BEAT_STILL`, null where no band is seen),-`least` = `BOB_OWN`, `scale_least` = `BOB_SCALE`, `band_floor` = `BAND_FLOOR`; values rounded to 0.01; `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,+top_line, feet, 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, sole,+less_lowest, less_bands, still_bands, own, bands: {rows, width, zoom, beat, reads, less}, depth, share, scale,+least, scale_least, band_floor}`: `share` = `own` / `beat`, `scale` = `less_bands` / `less_lowest` (`share`+and `scale` read 0.0 where the value they are divided by is under `BEAT_STILL`, null where no band is seen),+`depth` null or `{need, risen, rigid, zoom, moved, ratio, frames}` (`local_cycle.body_depth`'s; `need`,+`rigid`, `zoom` and `moved` rounded to 5 places, `risen` to 2, `ratio` to 3: a measure, recorded as the other+measures are), `least` = `BOB_OWN`, `scale_least` = `BOB_SCALE`, `band_floor` = `BAND_FLOOR`; the other+values rounded to 0.01; `top_line`, the line that said so, only where it says `"cycles"`; `feet`, the same+record read over its feet (with `over`, the row it was read over, `reach` or `sole`), its `says` and+`top_line` the same as the screen's; `why` absent where it says `"cycles"`; `says` is+`"cycles"` or null; no key tells a right hold from a false one); `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`@@ -1487,29 +1538,27 @@ with their bodies held still have their top line not rising and falling (the linranges under `BOB_FLOOR` of the body's height and under `BOB_ROWS` rows): two intervals (two cycles),`cycles` false, `unwitnessed` true, and the warning naming the cut. The walker seen from behind whose farfoot hides (17.5 on ones, no view) and the front-diagonal walker whose near foot steps out (16,-`--view front_diagonal`), rising and falling 3 px on their legs once a step as the walkers cut one cycle-do, their arms swinging 16 px either way of the body's middle, past its sides (the upper body widens and-narrows twice an interval across the bands the arms swing over): cut two intervals, `unwitnessed`, the-warning; the bob's `half` is `0.28` or more and its `quarter` `-0.28` or less, its `body.less_lowest` is-at least `BOB_OWN` of `body.beat`, its `body.scale` is under `0.6`, its largest band `reads` is over-`0.4`, `body.still_bands` is fewer than the bands seen, and its `why` says its upper body's width changes-with it and the picture may zoom with the body. The walkers the tests witness, or whose cut the cut's-witness reads one step, drawn instead with their arms swinging 16 px either way of the body's middle,-past its sides (nineteen forms, `PAST_ITS_SIDES`): none is a silent half cycle. A walk whose feet meet-once a cycle (the walker whose far foot hides, 18.5 frames on ones, 20 on twos and 24 on threes; the same-with its legs drawn alike, 17.5 and 20, with no view and with `--view back_diagonal`; the front-diagonal-walker whose near foot steps out, 18, `--view front_diagonal`; the walker whose far foot hides, legs-alike, carried along the arc and the cubic; the same walker turned 15 degrees about its feet over the-clip) is cut two intervals, `unwitnessed`, the warning, its bob's `why` naming the upper body's width.-Any other cut is held as chosen (`cut_witness.held` `"unwitnessed"`, its word null, the warning): 46-frames for the wide walker with its far leg four tones off (`--view side` and `--view front_diagonal`),-23 for the sliding foot and for the walker held still over a shadow on a picture shaken twice a step, 30-for the limp, and a cycle for the walks on a picture swaying once a cycle or slower. A side walker whose-two steps are one silhouette (46-frame cycle, near and far a tone or four apart), passes brief, is not-asked with no view or with `--view side`, and is cut two steps (46 frames) as before, its cut held and-named by the cut's witness. The same 46-frame walker filmed as a front diagonal, its far leg four tones-off the near one, is asked with `--view front_diagonal`: the picture passes, but the foot cue turns over-one interval on (`says: "steps"`): two steps, 46 frames, its cut held and named by the cut's witness. The+`--view front_diagonal`), rising and falling 3 px on their legs once a step, their arms swinging 16 px+either way of the body's middle, past its sides (the upper body widens and narrows twice an interval across+the bands the arms swing over), are cut one cycle: the bob says `"cycles"`, its `body.scale` is under+`0.6`, its largest band `reads` is over `0.4`, and its `body.depth.ratio` is at least `BOB_RIGID` and its+`body.depth.moved` at least `STRIP_FLOOR`. The walkers the tests witness, or whose cut the cut's witness+reads one step, drawn instead with their arms swinging 16 px either way of the body's middle, past its+sides (nineteen forms, `PAST_ITS_SIDES`), read as the walkers with their arms within their sides do: none+is a silent half cycle. A walk whose feet meet once a cycle (the walker whose far foot hides, 18.5 frames on+ones, 20 on twos and 24 on threes; the same with its legs drawn alike, 17.5 and 20, with no view and with+`--view back_diagonal`; the front-diagonal walker whose near foot steps out, 18, `--view front_diagonal`;+the walker whose far foot hides, legs alike, carried along the arc and the cubic; the same walker turned 15+degrees about its feet over the clip) is cut one cycle. The wide walker with its far leg four tones off+(`--view side` and `--view front_diagonal`) stands at 46 frames, witnessed, nothing named. Held as chosen,+named (`cut_witness.held`, the warning): 23 frames on the word `one step` for the sliding foot, 30 frames+on the word `one step` for the limp, 23 with no word for the walker held still over a shadow on a picture+shaken twice a step, and a cycle with no word for the walks on a picture swaying once a cycle or slower. A+side walker whose two steps are one silhouette (46-frame cycle, near and far a tone or four apart), passes+brief, is not asked with no view or with `--view side`, and is cut two steps (46 frames) as before,+witnessed, nothing named. The same 46-frame walker filmed as a front diagonal, its far leg four tones off+the near one, is asked with `--view front_diagonal`: the picture passes, but the foot cue turns over one+interval on (`says: "steps"`): two steps, 46 frames, witnessed, nothing named. Thesame 46-frame walker with its legs drawn alike (arms still four tones apart), asked with `--view` set to`front`, `front_diagonal`, `back` and `back_diagonal`: the picture passes, the cue says `"alike"`, andits top line rises and falls once an interval (a step), so its `half` correlation is negative: nothing@@ -1704,37 +1753,42 @@ those). This witness is needed because legs drawn alike loop as well on one stepfeet that slide down the screen through their step (as a view from behind or a diagonal draws a planted foot),or off a shadow under the feet on a picture that moves, count half steps or quarter steps; and a shadow under thefeet can leave the step count no feet to read, handing out the search's one-step cut with nothing named.-`local_cycle.cut_word(signals, length)` reads the body's top line on two lines, `local_cycle.CUT_LINES` =-`{'screen': 'on the screen', 'feet': 'over its feet'}`: the top line on the screen, less its flow-(`bob_word(signals, L)`), and the top line over its feet (`bob_word(..., feet=True)`, `local_cycle.over_feet`,-taking the top line less the lowest solid row, `reach`, or less the lowest opaque row, `sole`, whichever leaves-less of its rise and fall twice an interval). Read on the screen alone, a picture swaying up and down once a cut-or slower hides that rise and fall instead (the flow taken out at the cut's length leaves such a sway whole, and-the feet move with the picture), and the line over the feet reads it; read over the feet alone, a walk turned-slowly about its feet as it goes (a lean changing on them) tilts the ground under the feet, and the line over-them takes in the two feet's heights by turns. Each line (`local_cycle._cut_line`) reads `local_cycle.bob_word`-(the body's own rise and fall twice an interval) on the cut L, on half of it (L/2) and on twice it (2L), and says-the first it rises and falls twice on: `"two steps"` on L (the cut is a cycle); `"four steps"` on L/2 (two-cycles); `"one step"` on 2L (once in the cut); null where none, with the reading's `why`. The cut's word is the-first either line says, in the order `local_cycle.CUT_WORDS` = `("two steps", "four steps", "one step", None)`.-It returns `{says, by, lines, on, why, mark}`: `by`, the lines that said the word (`"screen"`, `"feet"`, or-both), only where it says one; `lines`, each line's own word, `{screen: {...}, feet: {...}}`, each-`{says, bob, on, why}` (`bob` that line's reading on the cut, `on` its reading at L/2 or 2L that said four-steps or one step, with its `interval`, only for four steps or one step, `why` only where that line's `says` is-null; the feet line's `bob` and `on` record `over`, the row it was read over, `reach` or `sole`); `on`, for four-steps or one step, the first line in `by`'s reading that said it, with its `line` and `interval`; `why`, only-where neither line says a word: each line's why, joined by "; "; `mark`, only where marked. Where the cut-stands (two steps or four steps) and its lowest row (the one the line over the feet is read over: `sole` where-the feet line was read over `sole`, else the lowest solid row) rises and falls twice the cut more than its top-line does on the screen (`local_cycle.own_beat`'s `sole` or `lowest` greater than its `beat`, both rounded to two-places), the record carries `mark: {over, feet, beat}` (`local_cycle._feet_mark`), in rows up and down to two-places. The line over the feet is then the feet's as much as the body's: a foot hidden behind the other shakes it-so once a cycle, and a cut of two cycles could be stood on it as one. A mark holds nothing: the cut stands as its-word says, and nothing is warned or left out for it. Two steps or four steps: the cut stands, and-`cycle.cut_witness` records `{cut: [s, L], ...cut_word's record}`.+`local_cycle.cut_word(signals, length)` reads the body's word, `local_cycle.body_word`, one line in both+places of `local_cycle.CUT_LINES` = `{'screen': 'on the screen', 'feet': 'over its feet'}`: the line on the+screen, less its flow (`bob_word(signals, L)`), and the line over its feet (`bob_word(..., feet=True)`,+`local_cycle.over_feet`, taking the line less the lowest solid row, `reach`, or less the lowest opaque row,+`sole`, whichever leaves less of its rise and fall twice an interval; there each `why` names it "{name} over+its lowest {solid|opaque} row"). On the screen alone, a head rising twice in one step+reads as two steps, and the feet leave no such rise and fall over them; over the feet alone, the two feet's+heights, taken in by turns, read as the body's, and the screen line has none of them. The price is the+design's: a walk whose rise and fall shows in one place only is not witnessed. A picture swaying up and down+once a cut or slower, which the flow taken out at the cut's length leaves whole, hides the rise and fall on+the screen while the line over the feet reads it, and such a walk's cut is held, named; a walk leaning+further on its feet as it goes can do the same over its feet on a cut a frame longer than the one it is cut.+The body's word is read (`local_cycle._cut_lines`) on the cut L, on half of it (L/2) and on twice it (2L),+and the cut's word is the first it rises and falls twice on, the same line in both places: `"two steps"` on+L (the cut is a cycle); `"four steps"` on L/2 (two cycles); `"one step"` on 2L (once in the cut); null where+none. It returns `{says, by, lines, on, why, mark}`: `by`, `["screen", "feet"]` where the body said the+word and `["order"]` where the order did, never one place, only where it says one; `lines`, each place's+record, `{screen: {...}, feet: {...}}`, each `{says, bob, on, why}` (`says` in both places the cut's word,+`bob` that place's reading on the cut, `on` its reading at L/2 or 2L that said four steps or one step, with+its `interval`, only for four steps or one step, `why` only where `says` is null; the record over the feet's+`bob` and `on` record `over`, the row it was read over, `reach` or `sole`); `on`, for four steps or one step,+the screen's reading that said it, with its `line` (`"screen"`), `interval` and `top_line`; `why`, only+where nothing says a word: each place's why, repeated ones once, joined by "; "; `mark`, only where marked.+Where the cut stands (two steps or four steps) and its lowest row (the one the line over the feet is read+over: `sole` where the record over the feet was read over `sole`, else the lowest solid row) rises and falls+twice the cut more than the line that stood (`top_line`) does on the screen (`local_cycle.own_beat`'s `sole`+or `lowest` greater than its `beat`, both rounded to two places), the record carries `mark: {over, feet,+beat}` (`local_cycle._feet_mark`), in rows up and down to two places. The line over the feet is then the+feet's as much as the body's: a foot hidden behind the other shakes it so once a cycle, and a cut of two+cycles could be stood on it as one. A mark holds nothing: the cut stands as its word says, and nothing is+warned or left out for it. Two steps or four steps: the cut stands, and `cycle.cut_witness` records+`{cut: [s, L], ...cut_word's record}`.`local_cycle.cut_word(signals, length, order=None, declined=None)` reads the order on the cut: `loop._witnessed`passes it the order (none from the side, none where the frames give no top line) and the step count's `declined`-record. Where neither line says two steps or four steps, the order is read on the cut: if it says two steps or+record. Where the body says neither two steps nor four steps, the order is read on the cut: if it says two+steps orfour steps, the cut stands, `by` records `["order"]`, and the record is placed under `order`. Otherwise thelines' word stands, the order's record is kept under `order`, and its reason is joined to the cut's why. A cut offour steps read on the order is two cycles exactly as one read by the body: `local_cycle.four_steps` is true,@@ -1769,15 +1823,18 @@ walk whose legs are drawn alike (half its cycle), or a whole cycle of a body thacycle: a limp, or a legless body bouncing as it goes (the walk window already admits a legless body's fastbounce); nothing that reads no leg tells the two apart, and cutting again two long would loop two cycles ofthe second.-The warning of a cut held on one step names the line or lines its body's top line rose and fell once on-("the body's top line on the screen", "over its feet", or "on the screen and over its feet") and, for the other-line, that it says nothing, with that line's why. `local_cycle.held_verdict` refuses by name, with a `ValueError`,-a cut held on one step whose record names no line it was read on (no `by` or `lines`), and `step_verdict` with it;-no engine path hands it one, its one caller saying the record the same run has just written. The loop report's-`cycle.cut_witness` records `{cut, says, by, lines, on, why, held, mark}` (`by` only where it says a word,-`on` only for four steps or one step, `why` only where `says` is null, `held` only where held, `mark` only where-marked); the printed summary's `cycle.cut_witness` records `{cut, says, by, held, mark}` (each where present).-The feet line's `bob` and `on` record `over`, the row it was read over (`reach` or `sole`).+The warning of a cut held on one step names the line that rose and fell once ("its top line" or "its first+solid row"), "on the screen and over its feet"; the word being one line in both places, there is no other+line to say nothing of. `local_cycle.held_verdict` refuses by name, with a+`ValueError`, a cut held on one step whose record names no line it was read on (no `by` or `lines`), and+`step_verdict` with it; no engine path hands it one, its one caller saying the record the same run has just+written. The loop report's `cycle.cut_witness` records `{cut, says, by, lines, on, why, held, mark}` (`by`+only where it says a word, `on` only for four steps or one step, `why` only where `says` is null, `held`+only where held, `mark` only where marked); the printed summary's `cycle.cut_witness` records+`{cut, says, by, held, mark}` (each where present). `by` is `["screen", "feet"]` or `["order"]`, never one+place; `lines.screen.says` and `lines.feet.says` are the cut's word; `lines.*.bob`, `lines.*.on` and `on`+carry `top_line`, the line that stood. The record over the feet's `bob` and `on` record `over`, the row it+was read over (`reach` or `sole`). No key in the record tells a right hold from a false one.**What crossings cannot see**: a hold the step range absorbs (a 13-frame step held to 17), a still run ofthe feet together inside the clip as long as a pass, and a wobble that reaches the reading's sides at a@@ -1790,28 +1847,42 @@ view's foot cue says `"steps"`; where they mark cycles, the reading cuts one cycstill cannot tell: a side walk with brief passes whose two steps are one silhouette is not asked, becausefrom the side the legs a step on are one silhouette, as near as a cycle on, and the picture cannot tell; aclip 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 taking out, band by band, as much of the zoom as each band's width reads, whatever its turn,-leaves too little of the rise (`less_bands` under the largest of `BOB_OWN` times `beat`, the floor, and-`BOB_SCALE` times `less_lowest`), a walk with no band of the upper body that a zoom as far as the rise would-move a pixel or more (`BAND_FLOOR`), as for a body rising and falling so little, or one narrowing from a point-at its top all the way down (a cone), a walk with any such band moving on the beat, as where its arms-swing past its sides (one such band is enough), 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); a picture zoomed on the beat with every band-seen drawn against the zoom, so that each band holds still on the screen, is read as the body's own: its band-widths are those of an upper body rising whole on its legs (measured on one such drawing, every band within-0.78 px of such a body); 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, or a body rising and falling twice a step on its own legs) would still be read as cycles (the-witness rests on a body rising and falling once a step, and nothing that reads no leg tells the two apart).-A walk whose body rises and falls once a cycle (a limp) and a legless body bouncing once in its cut are held-and named even where the cut is a whole cycle, and a walk carried up and down whole, feet and all, with no-rise of its own, is held. The witness never lengthens or shortens a cut.+cut two cycles, so give `--view`; a walk whose feet do meet once a cycle but no line of whose body, its top+line or its first solid row, rises and falls twice an interval of the body's own on the screen and over its+feet (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, a line on a beat of its own over a lowest row that+does the rising and falling (`beat` under `BOB_OWN` times `less_lowest`), a picture zoomed with the body so+that the rows down the middle of the body fit a zoom as well as they fit standing (`ratio` under+`BOB_RIGID`), or zoomed with it so that, where those rows do not tell, taking out, band by band, as much of+the zoom as each band's width reads, whatever its turn, leaves too little of the rise (`less_bands` under+the largest of `BOB_OWN` times `beat`, the floor, and `BOB_SCALE` times `less_lowest`), a walk with no band+of the upper body that a zoom as far as the rise would move a pixel or more (`BAND_FLOOR`), as for a body+rising and falling so little, or one narrowing from a point at its top all the way down (a cone), a walk+with any such band moving on the beat where the rows down the middle of its body do not tell, as where its+arms swing past its sides and those rows are not read or a zoom as far as the rise moves them under+`STRIP_FLOOR` (one such band is enough; where they read a body rising whole, the bands hold nothing), a+line that says so in one place only, as a head rising twice in one step does on the screen and not over the+feet, or a tail that takes the top line off the head while the first solid row says so only on the screen,+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 stops on it); a picture zoomed on the beat+with every band seen drawn against the zoom, so that each band holds still on the screen, and the rows down+its middle as good as plain to the zoom, is read as the body's own: its band widths are those of an upper+body rising whole on its legs (measured on one such drawing, every band within 0.78 px of such a body); and+a walk whose crossings are its steps, whose legs are drawn alike so its picture repeats a step on, and whose+line rises and falls twice a step on the screen and over its feet (a body rising and falling twice a step+on its own legs) would still be read as cycles (the witness rests on a body rising and falling once a step,+and nothing that reads no leg tells the two apart); a part over the head on a beat twice the step's says so+on the screen alone, the shape of a head rising twice in one step, and is held. What stays held and named:+a walk whose rows down its middle fit a zoom as well as they fit standing; a walk whose top line a tail+takes and whose first solid row says so only on the screen, the shape of a head rising twice in one step; a+walk whose body rises and falls once in the cut; a cut whose line over the feet does not read twice the+cut; a search's cut kept where no two-step cut closes. A walk whose body rises and falls once a cycle (a+limp) and a legless body bouncing once in its cut are held and named even where the cut is a whole cycle,+and a walk carried up and down whole, feet and all, with no rise of its own, is held.+`video-cycle-align --cycles <loop>=1` settles a held loop that is one cycle. The witness never lengthens or+shortens a cut.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 4d6e2ca..10a68e0 100644--- a/sprite_gen/video/legs.py+++ b/sprite_gen/video/legs.py@@ -13,9 +13,9 @@ 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, or a- cut, holds two steps (`local_cycle.bob_word`, `local_cycle.cut_word`) — against the lowest row,- the lowest opaque row and the widths of the upper body, since the picture moving or zoomed with- the body moves the line as well.+ cut, holds two steps (`local_cycle.body_word`, `local_cycle.cut_word`) — against the lowest row,+ the lowest opaque row, the rows down the middle of the body and the widths of the upper body,+ 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.@@ -37,6 +37,14 @@ The step count's witness reads more (`body_signals`), recorded nowhere else:lowest solid row is then its, not the feet's. The feet are drawn opaque.- `edge`: 1 where the lowest solid row is the frame's last row — the feet may run off theframe, and the lowest row is the frame's, not theirs — else 0.+- `first_row`: the first solid row. `top` passes over what is narrower than half the frame's+ widest row, and it is taken off the head by a part as wide as that, a tail or a cape lifted over+ it, where the first solid row stays on the body's top. The first solid row takes an ear's or a+ hat's tip in. Neither is the better line, so the witness reads both (`local_cycle.TOP_LINES`).+- `strips`: per frame, the rows down the middle of the body (`_strip`), DEEP of its median height+ from the first solid row, in colour and cover. A body rising on its legs carries its rows whole,+ where a picture zoomed in and out draws them longer and shorter. Arms swinging across the bands+ hardly touch them, so the witness reads them where the bands cannot tell (`local_cycle.body_depth`).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`@@ -67,6 +75,10 @@ BODY_RUN = 0.5 # the body's top line: the first row at least half as wide as th# The upper body's bands, each from and to these fractions of the body's median height below its first solid row: the# head's top band first, then down to the middle of the body, where the legs part.BANDS = ((0.02, 0.10), (0.10, 0.18), (0.18, 0.26), (0.26, 0.34), (0.34, 0.42), (0.42, 0.50))+# The strip down the body's middle (`_strip`): STRIP of the body's median height either side of its middle column, DEEP+# of it down from the first solid row: past the waist, where a body's rows are still the body's and not its legs'.+STRIP = 0.12+DEEP = 0.7# 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.@@ -173,11 +185,25 @@ def zoomed(alpha: np.ndarray, scale: float) -> np.ndarray:resample=Image.Resampling.BILINEAR))+def _strip(frame: Image.Image, alpha: np.ndarray, first: int, rows: int, half: float) -> np.ndarray:+ """The strip down the middle of the body of `frame` (`alpha` its alpha, `first` its first solid row): its `rows` from+ the first solid row, `half` px either side of the mean column of the solid pixels among them, each row's mean+ premultiplied colour and its mean cover, (rows, 4) in 0..1, nothing past the frame's last row."""+ middle = float(np.nonzero(alpha[first:first + rows] >= LOW_ALPHA)[1].mean())+ left, right = max(0, round(middle - half)), min(alpha.shape[1], round(middle + half) + 1)+ cover = alpha[first:first + rows, left:right].astype(np.float32) / 255.0+ colour = np.asarray(frame.crop((left, first, right, first + cover.shape[0])).convert("RGB")).astype(np.float32) / 255.0+ out = np.zeros((rows, 4), dtype=np.float32)+ out[:cover.shape[0], :3] = (colour * cover[..., None]).mean(axis=1)+ out[:cover.shape[0], 3] = cover.mean(axis=1)+ return out++def body_signals(frames: list[Image.Image]) -> dict[str, Any]:"""From the solid pixels, what the step count's witness reads besides `strike_signals` (see the module): per- frame `bands`, `sole` and `edge`; and `band_rows` and `median_frame`. `bands` reads the same rows of every frame,- of the clip's median body height."""- edge, sole, heights, read = [], [], [], []+ frame `bands`, `sole`, `edge`, `first_row` and `strips`; and `band_rows` and `median_frame`. `bands` and `strips`+ read the same rows of every frame, of the clip's median body height."""+ edge, sole, heights, read, firsts = [], [], [], [], []for f in frames:alpha = np.asarray(f.getchannel("A"))rows = np.nonzero((alpha >= LOW_ALPHA).any(axis=1))[0]@@ -189,12 +215,16 @@ def body_signals(frames: list[Image.Image]) -> dict[str, Any]:edge.append(float(y1 == alpha.shape[0] - 1))heights.append(y1 - y0 + 1)read.append(_row_widths(alpha))+ firsts.append(y0)median = float(np.median(heights)) if frames else 0.0rows = band_rows(median)middle = (np.asarray(frames[int(np.argmin([abs(h - median) for h in heights]))].getchannel("A")) if frameselse np.zeros((1, 1), np.uint8))+ deep = math.ceil(DEEP * median)+ strips = [_strip(f, np.asarray(f.getchannel("A")), y0, deep, STRIP * median) for f, y0 in zip(frames, firsts)]return {"bands": [_bands_of(y0, width, rows) for y0, width in read], "band_rows": rows, "median_frame": middle,- "sole": sole, "edge": edge}+ "sole": sole, "edge": edge, "first_row": [float(y0) for y0 in firsts],+ "strips": np.stack(strips) if strips else np.zeros((0, 0, 4), dtype=np.float32)}def swings(sig: dict[str, list[float]]) -> dict[str, float]:diff --git a/sprite_gen/video/local_cycle.py b/sprite_gen/video/local_cycle.pyindex dc7a5d8..d995fe3 100644--- a/sprite_gen/video/local_cycle.py+++ b/sprite_gen/video/local_cycle.py@@ -42,7 +42,7 @@ CUE_SWAPPED = -0.2# A cue whose range over the clip is under CUE_FLOOR of the step it is drawn in (`legs.TONE` of luma, a pixel row of the# body's height) rounds to one value: the legs are drawn alike to it, and its correlation is the arithmetic's (not read).CUE_FLOOR = 0.5-# The body's bob witnesses that the crossings mark cycles (`bob_word`), read without telling the legs apart: the body's+# The body's bob witnesses that the crossings mark cycles (`body_word`), read without telling the legs apart: the body's# top line (`legs.strike_signals` `top`) rises and falls once a step (a body rising and falling twice a step on its own# legs reads as two steps an interval of one, and nothing that reads no leg tells it apart). It is read less its flow# (`off_flow`): the picture drifting, swaying or zooming up and down slower than the interval, or a lean changing, moves@@ -51,18 +51,24 @@ CUE_FLOOR = 0.5# each by BOB_TWICE (correlated BOB_TWICE or over there, -BOB_TWICE or under here); where it holds one it is turned over# half an 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. A walk's cut, read whole as it is cut (`cut_word`), is read so-# on two lines (CUT_LINES), and its word is the first either says: the top line on the screen, and the top line over its-# feet (`over_feet`). At the cut's length a picture swaying once a cut is left whole, and on the screen it hides the-# body's rise and fall twice the cut, where the feet move with it; a walk leaning further on its feet as it goes tilts-# the ground under them, and the line over its feet takes in the two feet's heights by turns, where the screen line has-# none of them.+# drifts), does not rise and fall, and witnesses nothing. A line reads so in two places (CUT_LINES), on the screen and over+# the body's feet (`over_feet`), and it witnesses only where it says so in both (`body_word`), the crossing interval and+# a walk's cut alike. On the screen alone a head rising twice in one step reads as two steps; the feet leave no such rise+# and fall over them. Over the feet alone the two feet's heights, taken in by turns, read as the body's; the screen line+# has none of them. A walk whose rise and fall shows in one place only is therefore not witnessed, as a picture swaying+# once a cut, left whole by the flow taken out at the cut's length, hides the rise and fall on the screen, or a walk+# leaning further on its feet as it goes tilts the ground under them. The line that says so in both is read as one+# (TOP_LINES, never one line on the screen and the other over the feet): the top line, or the first solid row (`legs.body_signals`+# `first_row`), since a tail or a cape as wide as half the widest row takes the top line off the head.# 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 upper# body (`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 zoom each band of the-# upper body reads (`legs.body_signals` `bands`: a body rising on its legs carries them whole and leaves their widths; a+# on its legs leaves on the ground and the picture carries along), and that left is the top line's own: at least BOB_OWN+# of it is on the screen, or the rise and fall left is the lowest row's, on a line that rises and falls on some other+# beat (read every four frames, a line on a beat of twelve leaves nothing of it twice an interval of 24, and still+# correlates there). Then less that again of the zoom each band of the upper body reads (`legs.body_signals` `bands`: a+# body rising on its legs carries them whole and leaves their widths; a# zoom widens each as it lifts the line, as far as the band's outline lets it — one whose sides run straight down by the# zoom's whole part, one under a point, as of a pointed head, an ear or a hat, by none). How far a zoom moves each band# is measured on the body as it is drawn, not assumed of its outline: the frame of its median height zoomed in as far as@@ -74,23 +80,40 @@ CUE_FLOOR = 0.5# zoom as far as its width rises and falls twice an interval, whatever its turn (`own_beat` `reads`): a zoom moves it in# step with the line it lifts, but its parts swinging across it move it too, in step with the line, against it or a# quarter of the beat off, and the zoom's part is not told from theirs. It holds still on the beat where it reads no-# more than 1 - BOB_SCALE. The witness holds by default: where no band is seen, or any band seen moves on the beat,-# nothing tells the picture zooming from the body's own, and nothing is witnessed. One band holding still says only-# that no zoom shows in it (a head drawn narrower as the picture zooms in holds still so), and a band its parts swing-# across on the beat, as arms do, may hide a zoom under the swing at any turn. A picture zoomed with every band seen-# drawn against it, each holding still, is read as the body's own: its upper body's widths are those of one rising-# whole on its legs. What is left of the line's rise and fall is the body's own where, against the lowest row, it is-# at least BOB_OWN of it and over the floor above, and less as much of the zoom as each band seen reads, it is so again-# and 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.+# more than 1 - BOB_SCALE. One band holding still says only that no zoom shows in it (a head drawn narrower as the+# picture zooms in holds still so), and a band its parts swing across on the beat, as arms do, may hide a zoom under the+# swing at any turn: a walk's arms read so, whatever the picture does. So where it can, the witness reads what a zoom+# does and arms do not, the rows down the middle of the body (`body_depth`, `legs.body_signals` `strips`), at the top of+# the rise against the bottom: a body rising whole carries them as they are, and a zoom as far as the rise draws them+# longer. They read the body's own where that zoom fits them no better than they fit as they stand (BOB_RIGID), and,+# read at all, they decide, and the bands' widths are recorded and left out. They are read where such a zoom would show:+# it moves the strip STRIP_FLOOR or more; drawn plain, the strip fits a zoom as well as anything. Where it is not read,+# the bands decide, and the witness holds by default: where any band seen moves on the beat, nothing tells the picture+# zooming from the body's own, and nothing is witnessed. A picture zoomed with every band seen drawn against it, each+# holding still, and a strip as plain, is read as the body's own: its upper body is that of one rising whole on its+# legs. What is left of the line's rise and fall is the body's own where, against the lowest row, it is at least BOB_OWN+# of it and over the floor above, the top line's own is at least BOB_OWN of that, a band would show the zoom, and either+# the strip reads the body's own or, less as much of the zoom as each band seen reads, the line's rise and fall is left+# as above and 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 = 2BOB_OWN = 0.3BOB_SCALE = 0.6BAND_FLOOR = 1.0 # pixels of a band's mean width a zoom moves: under it the pixel grid moves the band as much+BOB_RIGID = 1.0 # a zoom as far as the rise fits the strip no better than it fits as it stands: a body rising whole+# How far a zoom as far as the rise moves the strip (`body_depth` `moved`, the mean of its colour and cover over its rows,+# each in 0..1) for it to be read: half the step its colours are drawn in (`legs.TONE`), as CUE_FLOOR reads a cue. Under+# it the strip is as good as plain to that zoom, and which of the two fits it better is the rounding of its colours.+STRIP_FLOOR = CUE_FLOOR*legs_mod.TONE+# The strip's fits (`body_depth`) are each moved as they fit best, in steps of a twelfth of this and at most half a row+# or more: STRIP_SHIFT of the body's height either way, at least STRIP_SHIFT_MIN rows. Its rows are read from the first+# solid row, which a body's outline rounds and a nod moves a little over the rise.+STRIP_SHIFT = 0.03+STRIP_SHIFT_MIN = 3.0BEAT_FRAMES = 8 # a rise and fall twice an interval is fitted (`twice_an_interval`) to no fewer frames# A line that does not rise and fall fits to round-off, not to nothing: exactly 0 under one machine's numpy, about 1e-30# rows under another's, and two lines that move alike leave about 1e-14 rows of each other. A line read in whole rows@@ -98,10 +121,12 @@ BEAT_FRAMES = 8 # a rise and fall twice an interval is fitted (`twice_an_interv# thousand frames. Under BEAT_STILL rows there is no rise and fall to take a share of (`_share`, `bob_word` `share` and# `scale`). What the witness says does not read it: its floors are whole rows.BEAT_STILL = 1e-9-# The lines a walk's cut is read on (`cut_word`), and where each reads the body's top line: on the screen, and over its-# feet (`over_feet`). Each says its own word; the cut's is the first either says, in CUT_WORDS' order.+# Where a line is read (`body_word`): on the screen, and over the body's feet (`over_feet`). It witnesses where it says so+# in both.CUT_LINES = {'screen': 'on the screen', 'feet': 'over its feet'}-CUT_WORDS = ('two steps', 'four steps', 'one step', None)+# The lines read so (`signals` keys), one at a time: the top line first, as `legs.strike_signals` reads it, then the first+# solid row (`legs.body_signals`).+TOP_LINES = {'top': 'its top line', 'first_row': 'its first solid row'}SIDE_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# The order the feet are drawn in witnesses as the body does (`order_word`), for the step count and the cut alike: from# the front, the back or a diagonal the foot nearer the viewer is drawn lower (`legs.feet_order`), and the nearer foot@@ -669,6 +694,53 @@ def twice_an_interval(values, interval):return complex(coef[1], -coef[2])+def _strip_off(tall, short, stretch, shift):+ """How far the strip `tall` (`legs.body_signals` `strips`, rows by channels) lies from `short` stretched down by+ 1 + `stretch` and moved `shift` rows down: the mean absolute difference over the rows and channels it covers."""+ rows = np.arange(tall.shape[0], dtype=float)+ at = (rows - shift)/(1 + stretch)+ keep = (at >= 0) & (at <= rows[-1])+ made = np.stack([np.interp(at, rows, short[:, c]) for c in range(short.shape[1])], axis=1)+ return float(np.abs(tall - made)[keep].mean())+++def body_depth(signals, interval):+ """The rows down the middle of the body at the top of its rise against the bottom (`signals`: `strips`,+ `legs.body_signals`): the frames where the rise and fall twice an interval `interval` frames long of the line over+ its lowest row (`over_feet`, as `own_beat` takes it) stands a half or more of the way to the top and to the bottom,+ each set's strips in a median. Returns, each fit (`_strip_off`) moved as it fits best: `need`, the zoom those frames'+ rise would be, of the body's height, and `risen`, in rows; `rigid`, how far the strip at the top lies from the one at+ the bottom as it stands; `zoom`, from that one zoomed by `need`; `ratio`, `zoom` of `rigid`, 1 or more where the zoom+ fits no better; `moved`, how far the zoom moves the strip at the bottom from itself, the most `zoom` could tell; and+ `frames`, how many frames stand in each set. None where no strip is read, the rise and fall is none, a set holds+ under two frames or the frames at the top are not the taller."""+ strips = signals.get('strips')+ if strips is None:+ return None+ line = over_feet(signals, interval)[0]+ rise = twice_an_interval(line, interval)+ if rise is None or rise == 0:+ return None+ reach = math.ceil(interval/2 - 0.5)+ at = np.arange(reach, line.size-reach)+ wave = (rise*np.exp(4j*np.pi*(at-reach)/interval)).real+ tall, short = at[wave <= -abs(rise)/2], at[wave >= abs(rise)/2]+ if tall.size < 2 or short.size < 2:+ return None+ height = float(np.median(signals['height']))+ risen = float(np.median(line[short]) - np.median(line[tall]))+ if risen <= 0:+ return None+ need = risen/height+ top, bottom = np.median(strips[tall], axis=0), np.median(strips[short], axis=0)+ most = max(STRIP_SHIFT_MIN, STRIP_SHIFT*height)+ shifts = np.arange(-most, most + 0.01, max(0.5, most/12))+ rigid, zoom = (min(_strip_off(top, bottom, stretch, c) for c in shifts) for stretch in (0.0, need))+ moved = min(_strip_off(bottom, bottom, need, c) for c in shifts)+ return {'need': need, 'risen': risen, 'rigid': rigid, 'zoom': zoom, 'ratio': zoom/max(rigid, 1e-6), 'moved': moved,+ 'frames': [int(tall.size), int(short.size)]}++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`) as `twice_an_interval` reads each: the top@@ -687,8 +759,10 @@ def own_beat(signals, interval):frame and `zoom`, in pixels; `beat`, its width's rise and fall twice an interval, in pixels up and down; where it isseen, `reads`, `beat` of `zoom` — the share of the zoom making the line's rise and fall it reads, whatever its turn— and `less`, what is left of the line's rise and fall less as much of that zoom, else None), `less_bands`, the- least `less` (None where no band is seen), `still_bands`, the bands seen that hold still on the beat, and `own`, the- smaller of `less_lowest` and `less_bands`. None where a line is not read."""+ least `less` (None where no band is seen), `still_bands`, the bands seen that hold still on the beat, `depth`+ (`body_depth`), `whole` (True where the strip reads a body rising whole, False where it reads a zoom, None where it+ is not read: no `depth`, or `moved` under STRIP_FLOOR) and `own`: `less_lowest` where `whole` is True or no band is+ seen, else the smaller of `less_lowest` and `less_bands`. None where a line is not read."""height = float(np.median(signals['height']))top, lowest, sole = (twice_an_interval(signals[k], interval) for k in ('top', 'reach', 'sole'))if top is None or lowest is None or sole is None:@@ -702,11 +776,13 @@ def own_beat(signals, interval):reads = [2*abs(beat)/abs(z) if s else None for z, beat, s in zip(zoom, beats, seen)]less = [2*abs(left)*max(0.0, 1 - r) if r is not None else None for r in reads]less_bands = min((v for v in less if v is not None), default=None)+ depth = body_depth(signals, interval)+ whole = None if depth is None or depth['moved'] < STRIP_FLOOR else bool(depth['ratio'] >= BOB_RIGID)return {'beat': 2*abs(top), 'lowest': 2*abs(lowest), 'sole': 2*abs(sole), 'less_lowest': 2*abs(left),'bands': {'rows': [list(r) for r in rows], 'width': widths, 'zoom': zoom, 'beat': [2*abs(b) for b in beats],'reads': reads, 'less': less},'less_bands': less_bands, 'still_bands': sum(1 for r in reads if r is not None and r <= 1 - BOB_SCALE),- 'own': 2*abs(left) if less_bands is None else min(2*abs(left), less_bands)}+ 'depth': depth, 'whole': whole, 'own': 2*abs(left) if less_bands is None or whole else min(2*abs(left), less_bands)}def over_feet(signals, interval):@@ -721,38 +797,44 @@ def over_feet(signals, interval):return lines[over], over-def _share(rows, beat):- """`rows` as a share of the top line's rise and fall twice an interval (`beat`, `own_beat`), for a why: or, where- that is none (under BEAT_STILL), the top line holding still on the screen."""- return f"{rows/beat:.0%}" if beat >= BEAT_STILL else "its top line holding still"+def _share(rows, beat, name):+ """`rows` as a share of the rise and fall twice an interval of a line (`beat`, `own_beat`) named `name`, for a why:+ or, where that is none (under BEAT_STILL), the line holding still on the screen."""+ return f"{rows/beat:.0%}" if beat >= BEAT_STILL else f"{name} holding still"-def bob_word(signals, interval, *, feet=False):- """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. With `feet`, the line so read is the top line- over the lowest row (`over_feet`), the picture's moving taken out first (`cut_word`: the picture moving once a cut,- which `off_flow` leaves whole, would hide the rise and fall twice it). And that rise and fall is the body's own+def bob_word(signals, interval, *, feet=False, line='top'):+ """Whether one line of the body rises and falls twice an interval `interval` frames long in one place, read off+ `signals` (`legs.strike_signals` with `legs.body_signals`) without telling the legs apart: `line` (TOP_LINES, in+ pixel rows) on the screen, or with `feet` over the lowest row (`over_feet`, the picture's moving taken out first: the+ picture moving once a cut, which `off_flow` leaves whole, would hide the rise and fall twice it). The line 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 (solid or opaque, whichever leaves less) is at least BOB_OWN- of it and over the floor; a band of the upper body would show the picture zooming as far as that (seen, BAND_FLOOR- pixels or more), and less as much of the zoom as each band seen reads, whatever its turn, as much is left again, and- no less than BOB_SCALE of what is left against the lowest row — every band seen holds still on the beat; and no- frame's lowest row is its last (`edge`). Held by default: where no band is seen, or any band seen moves on the beat- (its parts swinging across it, as arms do, or the picture zooming), the body's own is not told from a zoom, and- nothing is witnessed. 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`,- `over` (with `feet`: the row the line is read over), `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_bands` of `less_lowest`, None where no band is seen; where read), `says`."""+ of it and over the floor; the line's own on the screen is at least BOB_OWN of what is left against the lowest row; a+ band of the upper body would show the picture zooming as far as that (seen, BAND_FLOOR pixels or more); the strip+ down the middle of the body reads a body rising whole (`whole`), or where the strip is not read, less as much of the+ zoom as each band seen reads, whatever its turn, as much is left again, and no less than BOB_SCALE of what is left+ against the lowest row — every band seen holds still on the beat; and no frame's lowest row is its last (`edge`).+ Held by default: where no band is seen, where the strip reads a zoom, or, it not read, where any band seen moves on+ the beat (its parts swinging across it, as arms do, or the picture zooming), the body's own is not told from a zoom,+ and nothing is witnessed. Then `says` `cycles` — a step each rise, two steps an interval; None otherwise, with why.+ This is one line in one place: the body's word on an interval is `body_word`'s. Returns the record: `swing` (the line+ left's range, of the body's height), `rows` (in rows), `floor`, `twice`, `over` (with `feet`: the row the line is read+ over), `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_bands` of `less_lowest`, None where no band is seen;+ `depth` as `own_beat` reads it, its measures only, `whole` being no part of the record: a hold is not told from a hold+ by it; where read), `says`."""+ if line != 'top':+ signals = {**signals, 'top': signals[line]}height = float(np.median(signals['height']))- line, what, extent = signals['top'], "its top line", "its top line's range"- word = {}+ name = TOP_LINES[line]+ what, extent, word, drawn = name, f"{name}'s range", {}, signals['top']if feet:- line, over = over_feet(signals, interval)- what = f"its top line over its lowest {'opaque' if over == 'sole' else 'solid'} row"+ drawn, over = over_feet(signals, interval)+ what = f"{name} over its lowest {'opaque' if over == 'sole' else 'solid'} row"extent, word = f"the range of {what}", {'over': over}- values = off_flow(line, interval)+ values = off_flow(drawn, 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, **word}@@ -766,13 +848,16 @@ def bob_word(signals, interval, *, feet=False):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:- bands = beat['bands']- word['body'] = {**{k: None if v is None else round(v, 2) for k, v in beat.items() if k != 'bands'},+ bands, depth = beat['bands'], beat['depth']+ word['body'] = {**{k: None if v is None else round(v, 2) for k, v in beat.items() if k not in ('bands', 'depth', 'whole')},'bands': {'rows': bands['rows'], **{k: [None if v is None else round(v, 2) for v in bands[k]]for k in ('width', 'zoom', 'beat', 'reads', 'less')}},'share': round(beat['own']/beat['beat'], 3) if beat['beat'] >= BEAT_STILL else 0.0,'scale': (None if beat['less_bands'] is None elseround(beat['less_bands']/beat['less_lowest'], 3) if beat['less_lowest'] >= BEAT_STILL else 0.0),+ 'depth': None if depth is None else {'need': round(depth['need'], 5), 'risen': round(depth['risen'], 2),+ **{k: round(depth[k], 5) for k in ('rigid', 'zoom', 'moved')},+ 'ratio': round(depth['ratio'], 3), 'frames': depth['frames']},'least': BOB_OWN, 'scale_least': BOB_SCALE, 'band_floor': BAND_FLOOR}if half is None or quarter is None or half < BOB_TWICE or quarter > -BOB_TWICE:return {**word, 'says': None, 'why': f"{what} less its flow does not rise and fall twice an interval "@@ -783,32 +868,74 @@ def bob_word(signals, interval, *, feet=False):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 "+ return {**word, 'says': None, 'why': f"{name}'s rise and fall twice an interval is not read against its lowest row "f"and upper body: 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 "+ return {**word, 'says': None, 'why': f"its lowest row rises and falls with it: less the lowest row's, {name}'s rise "f"and fall twice an interval is {beat['less_lowest']:.1f} rows of {beat['beat']:.1f} "- f"({_share(beat['less_lowest'], beat['beat'])}; at least {BOB_OWN:.0%} and {floor:.1f} "+ f"({_share(beat['less_lowest'], beat['beat'], name)}; 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['beat'] < BOB_OWN*beat['less_lowest']:+ return {**word, 'says': None, 'why': f"its lowest row does the rising and falling: {name} does so twice an interval "+ f"{beat['beat']:.1f} rows on the screen, {_share(beat['beat'], beat['less_lowest'], name)} of "+ f"the {beat['less_lowest']:.1f} left against its lowest row (at least {BOB_OWN:.0%}), "+ "and the body's own is not told from it"}if beat['less_bands'] is None:return {**word, 'says': None, 'why': f"no band of its upper body would show the picture zooming: zoomed in as far as "- f"its top line rises and falls twice an interval against its lowest row "+ f"{name} rises and falls twice an interval against its lowest row "f"({beat['less_lowest']:.1f} rows of {height:.0f}), no band's width moves "f"{BAND_FLOOR:g} px (at most {max(abs(z) for z in beat['bands']['zoom']):.2f}): ""the picture zooming with the body is not told from the body's own"}- if beat['less_bands'] < max(BOB_OWN*beat['beat'], floor, BOB_SCALE*beat['less_lowest']):+ if beat['whole'] is False:+ depth = beat['depth']+ return {**word, 'says': None, 'why': f"the rows down the middle of its body fit a zoom as well as they fit standing: "+ f"at the top of its rise they lie {depth['zoom']:.4f} off those at the bottom zoomed "+ f"{depth['need']:.2%}, the rise of {depth['risen']:.1f} rows, and {depth['rigid']:.4f} "+ f"off them as they stand ({depth['ratio']:.2f} of it, at least {BOB_RIGID:g}): the "+ "picture may zoom with the body, and the body's own is not told from it"}+ if beat['whole'] is None and beat['less_bands'] < max(BOB_OWN*beat['beat'], floor, BOB_SCALE*beat['less_lowest']):a, b = legs_mod.BANDS[beat['bands']['less'].index(beat['less_bands'])]return {**word, 'says': None, 'why': f"its upper body's width changes with it: less as much of the zoom as its band "- f"{a:.0%} to {b:.0%} of its height below its top reads, its top line's rise and fall "+ f"{a:.0%} to {b:.0%} of its height below its top reads, {name}'s rise and fall "f"twice an interval is {beat['less_bands']:.1f} rows of {beat['beat']:.1f} "- f"({_share(beat['less_bands'], beat['beat'])}), {beat['less_bands']/beat['less_lowest']:.2f} "+ f"({_share(beat['less_bands'], beat['beat'], name)}), {beat['less_bands']/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 may zoom with the "- "body, and the body's own is not told from it"}+ f"{BOB_OWN:.0%}, {floor:.1f} rows and {BOB_SCALE:g}), and the rows down the middle of its "+ f"body do not tell (a zoom as far as that moves them {_strip_moved(beat['depth'])}): the "+ "picture may zoom with the body, and the body's own is not told from it"}return {**word, 'says': 'cycles'}+def _strip_moved(depth):+ """How far a zoom as far as the rise moves the strip (`body_depth`), for a why: or that it is not read."""+ return "they are not read" if depth is None else f"{depth['moved']:.4f}, under {STRIP_FLOOR:g}"+++def body_word(signals, interval):+ """The body's word on an interval `interval` frames long, a crossing interval (`read_cycles`) or a cut (`cut_word`):+ `says` `cycles` where one of its lines (TOP_LINES, the first that does) rises and falls twice an interval both on the+ screen and over its feet (`bob_word`, CUT_LINES), the same line in both; None otherwise. Returns the screen's record+ with `says`, where it says `top_line`, the line, and `feet`, the record over its feet, its `says` and `top_line` the+ same; where it says nothing, the top line's records, each with `why`: each line's reading in that place, or that it+ said so only in the other, a reading both lines give once."""+ read = []+ for line in TOP_LINES:+ if line in signals:+ words = {place: bob_word(signals, interval, feet=place == 'feet', line=line) for place in CUT_LINES}+ if all(word['says'] == 'cycles' for word in words.values()):+ return {**words['screen'], 'top_line': line, 'feet': {**words['feet'], 'top_line': line}}+ read.append((line, words))++ def why(place, line, words):+ other = next(p for p in CUT_LINES if p != place)+ return words[place].get('why') or (f"{TOP_LINES[line]} rises and falls twice an interval {CUT_LINES[place]}, "+ f"but not {CUT_LINES[other]}")+ said = {place: {**read[0][1][place], 'says': None, 'why': '; '.join(dict.fromkeys(why(place, *each) for each in read))}+ for place in CUT_LINES}+ return {**said['screen'], 'feet': said['feet']}++def _touch(a, b):"""Whether two contacts ([first, last] column) share or touch a column."""return max(a[0], b[0]) <= min(a[1], b[1]) + 1@@ -928,10 +1055,11 @@ 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 marks- cycles only where a witness that reads no leg says the interval holds two steps — the body's top line (`signals`,- `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 widths of the upper body; a lowest row on the frame's edge holds the word) — or the+ cycles only where a witness that reads no leg says the interval holds two steps — a line of the body (`signals`,+ `legs.strike_signals` with `legs.body_signals`) rising and falling twice an interval on the screen and over its feet,+ less its flow and of its own (`body_word`, `bob_word`: the picture drifting, swaying, shaking or zooming up and down+ as it pleases witnesses nothing, read against the lowest row and the rows down the middle of the body or the widths+ of the upper body; a lowest row on the frame's edge holds the word) — or theorder the feet are drawn in (`order`, per frame: `legs.feet_order`; `order_word`), the foot drawn nearer changingsides twice an interval where the clip shows its two sides of feet are its two legs, not read from the side. Theview's foot cue (`cue`, per frame, drawn in steps of `cue_step`; `cue_word`) only refuses: where it turns over one@@ -959,7 +1087,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, d)+ bob = None if not signals else body_word(signals, d)feet = None if order is None or view == SIDE_VIEW else order_word(order, d)said.update({**({'cue': word} if word is not None else {}), **({'bob': bob} if bob is not None else {}),**({'order': feet} if feet is not None else {})})@@ -967,12 +1095,12 @@ def read_cycles(reading, distances, *, view=None, cue=None, cue_step=None, signasaid.update(cycles=False, why=f"{picture}, but the view's foot cue turns over there ({word['one']:+.2f}, at most "f"{CUE_SWAPPED:+g}): the other leg leads, a step")elif 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}), the body's own ({bob['body']['own']:.1f} rows of "- f"{bob['body']['beat']:.1f} left against its lowest row and upper body, "- f"{bob['body']['share']:.0%}; "- f"at least {BOB_OWN:.0%}): two steps an interval, the feet meet once a cycle")+ said.update(cycles=True, why=f"{picture}, and {TOP_LINES[bob['top_line']]} less its flow rises and falls twice an "+ f"interval on the screen and over its feet ({bob['half']:+.2f} half an interval on, at least "+ f"{BOB_TWICE:+g}; {bob['quarter']:+.2f} a quarter on, at most {-BOB_TWICE:+g}, on the "+ f"screen), the body's own ({bob['body']['own']:.1f} rows of {bob['body']['beat']:.1f} left "+ f"against its lowest row and upper body, {bob['body']['share']:.0%}; at least "+ f"{BOB_OWN:.0%}): two steps an interval, the feet meet once a cycle")elif feet is not None and feet['says'] == 'two steps':said.update(cycles=True, why=f"{picture}, and the foot drawn nearer changes sides {feet['per']:.2f} times an "f"interval, the clip's two sides of feet its two legs (none slides from one to the "@@ -988,28 +1116,32 @@ def read_cycles(reading, distances, *, view=None, cue=None, cue_step=None, signareturn said-def _cut_line(signals, length, *, feet):- """One line's word on a walk's cut `length` frames long (`cut_word`): the body's top line on the screen, or over- its feet (`feet`), read by `bob_word` on the cut, on half of it and on twice it — the first it rises and falls- twice on says two steps, four steps or one step; None where it does on none, with why (the reading on the cut).- Returns {'says', 'bob': the reading on the cut, 'on': the reading that said four steps or one step, with its- `interval`, 'why' where None}."""- bob = bob_word(signals, length, feet=feet)- if bob['says'] == 'cycles':- return {'says': 'two steps', 'bob': bob}- for says, span in (('four steps', length/2), ('one step', 2*length)):- word = bob_word(signals, span, feet=feet)- if word['says'] == 'cycles':- return {'says': says, 'bob': bob, 'on': {'interval': round(span, 2), **word}}- return {'says': None, 'bob': bob, 'why': bob['why']}+def _cut_lines(signals, length):+ """Each place's word on a walk's cut `length` frames long (`cut_word`, CUT_LINES), the body's (`body_word`) read on+ the cut, on half of it and on twice it — the first it rises and falls twice on says two steps, four steps or one+ step; None where it does on none, with why (the reading on the cut). Returns, per place, {'says', 'bob': the reading+ on the cut, 'on': the reading that said four steps or one step, with its `interval`, 'why' where None}."""+ bob = body_word(signals, length)+ cut = {'screen': {k: v for k, v in bob.items() if k != 'feet'}, 'feet': bob['feet']}+ says, on = ('two steps' if bob['says'] == 'cycles' else None), None+ if says is None:+ for word, span in (('four steps', length/2), ('one step', 2*length)):+ read = body_word(signals, span)+ if read['says'] == 'cycles':+ says = word+ on = {'screen': {k: v for k, v in read.items() if k != 'feet'}, 'feet': read['feet']}+ on = {place: {'interval': round(span, 2), **read} for place, read in on.items()}+ break+ return {place: {'says': says, 'bob': cut[place], **({'on': on[place]} if on else {}),+ **({'why': cut[place]['why']} if says is None else {})} for place in CUT_LINES}def _feet_mark(signals, length, over):"""Whether a walk's cut `length` frames long that stands (`cut_word`) is marked: its lowest row — the one its lineover the feet is read over (`over`) — rises and falls twice the cut more than its top line does on the screen- (`own_beat`). The line over the feet is then the feet's as much as the body's: a foot hidden behind the other- shakes it so once a cycle, and stood a cut of two cycles on it as one. A mark, not a hold. Returns {'over', 'feet',- 'beat'}, in rows up and down to two places (as `bob_word`'s `body`), where it is so; None where not, or not read."""+ (`own_beat`, `signals` as the line that stood is read). The line over the feet is then the feet's as much as the+ body's: a foot hidden behind the other shakes it so once a cycle. A mark, not a hold. Returns {'over', 'feet', 'beat'},+ in rows up and down to two places (as `bob_word`'s `body`), where it is so; None where not, or not read."""beat = own_beat(signals, length)if beat is None:return None@@ -1022,22 +1154,22 @@ def cut_word(signals, length, *, order=None, declined=None):pixel search's, the step count's crossings read or not read (loop `_witnessed`). Legs drawn alike loop as well onone step as on two, and crossings read off feet that slide, or off a shadow under them on a picture that moves, cancount half steps: the legs cannot say the cut is a cycle, and the body's own rise and fall, once a step, is read- instead (`bob_word`, off `signals`: `legs.strike_signals` with `legs.body_signals`), its top line read on two lines- (CUT_LINES, `_cut_line`): on the screen, and over its feet (`feet`). A picture moving once a cut, as a slow sway or- drift whose turn is a cycle long does, is left whole by the flow taken out at the cut's length and hides the rise- and fall twice it on the screen, where the feet move with it; a walk leaning further on its feet as it goes tilts- the ground under them, and the line over its feet takes in the two feet's heights by turns, where the screen line- has none of them. Each line says its own word; the cut's is the first either says (CUT_WORDS):-- - `two steps` where it rises and falls twice the cut (`bob_word` on the cut says cycles): the cut is a cycle;+ instead (`body_word`, off `signals`: `legs.strike_signals` with `legs.body_signals`): one of its lines saying so both+ on the screen and over its feet (CUT_LINES, `_cut_lines`). A picture moving once a cut, as a slow sway or drift whose+ turn is a cycle long does, is left whole by the flow taken out at the cut's length and hides the rise and fall twice+ it on the screen; a walk leaning further on its feet as it goes tilts the ground under them, and the line over its+ feet takes in the two feet's heights by turns. Either way the rise and fall shows in one place only, and neither is+ witnessed, as a head rising twice in one step is not. The body says:++ - `two steps` where it rises and falls twice the cut (`body_word` on the cut says cycles): the cut is a cycle;- `four steps` where it does so twice half the cut: the cut is two cycles;- `one step` where it does so twice two cuts — once the cut: the cut is one step of a walk, or a whole cycle of abody that rises and falls once a cycle (a limp, a body with no legs that bounces as it goes); the body cannottell which, and it witnesses no cycle;- - None where neither line reads any of these: nothing witnesses the cut whole cycles (`why`, each line's reading- on the cut).+ - None where it reads none of these: nothing witnesses the cut whole cycles (`why`, each place's reading on the+ cut).- Where neither line says the cut is a cycle or two, the order the feet are drawn in is read on it (`order`, per+ Where it does not say the cut is a cycle or two, the order the feet are drawn in is read on it (`order`, perframe: `legs.feet_order`; `order_word`, as the step count reads it, None from the side): two steps or four, wherethe clip shows its two sides of feet are its two legs, and the cut stands on it (`by` ['order']); else the lines'word stands, the order's record kept (`order`). The order counts the changes in the cut, not whether its length@@ -1045,15 +1177,15 @@ def cut_word(signals, length, *, order=None, declined=None):of the clip's two-step cuts closes (`declined`, the step count's record of the best of them), it does not stand onthe order — a length the closing refused — and the order's word is kept as `read`.- Where the cut stands (two steps or four) and its lowest row rises and falls twice it more than its top line does on- the screen, the word carries a mark (`mark`, `_feet_mark`), and nothing more. Returns {'says', 'by': the lines that- said it (where it says), 'lines': each line's own word (`_cut_line`), 'on': the first such line's reading that said- four steps or one step, with its `line` and `interval`, 'why' where None, 'mark' where marked, 'order' where- read}."""+ Where the cut stands (two steps or four) and its lowest row rises and falls twice it more than the line that stood+ does on the screen, the word carries a mark (`mark`, `_feet_mark`), and nothing more. Returns {'says', 'by': the+ places it was said in (where it says), 'lines': each place's reading (`_cut_lines`), 'on': the reading that said four+ steps or one step, on the screen, with its `line` and `interval`, 'why' where None, 'mark' where marked, 'order'+ where read}."""if not signals:return {'says': None, 'why': 'no top line read: a frame has no solid body'}- lines = {line: _cut_line(signals, length, feet=line == 'feet') for line in CUT_LINES}- says = min((word['says'] for word in lines.values()), key=CUT_WORDS.index)+ lines = _cut_lines(signals, length)+ says = lines['screen']['says']if says not in ('two steps', 'four steps') and order is not None:feet = order_word(order, length)if feet['says'] in ('two steps', 'four steps') and declined:@@ -1069,13 +1201,13 @@ def cut_word(signals, length, *, order=None, declined=None):'why': '; '.join([*dict.fromkeys(word['why'] for word in lines.values()), _order_why(feet)])}if says is None:return {'says': None, 'lines': lines, 'why': '; '.join(dict.fromkeys(word['why'] for word in lines.values()))}- by = [line for line, word in lines.items() if word['says'] == says]- said = {'says': says, 'by': by, 'lines': lines}+ said = {'says': says, 'by': list(CUT_LINES), 'lines': lines}if says != 'two steps':- said['on'] = {'line': by[0], **lines[by[0]]['on']}+ said['on'] = {'line': 'screen', **lines['screen']['on']}if says == 'one step' and order is not None:said['order'] = feet- mark = None if says == 'one step' else _feet_mark(signals, length, lines['feet']['bob']['over'])+ stood = (said.get('on') or lines['screen']['bob'])['top_line']+ mark = None if says == 'one step' else _feet_mark({**signals, 'top': signals[stood]}, length, lines['feet']['bob']['over'])return {**said, **({'mark': mark} if mark else {})}@@ -1310,10 +1442,8 @@ def held_verdict(cycle):"cut_word records it (CUT_LINES); cut the loop again to have its witness so recorded")on = said['on']where = ' and '.join(CUT_LINES[line] for line in said['by'])- rest = ''.join(f", and {CUT_LINES[line]} it says nothing ({word['why']})" for line, word in said['lines'].items()- if line not in said['by'])- return [f"nothing that reads no leg witnesses the cut {s}/{L} whole cycles: the body's top line {where} rises and falls "- f"of its own once in it ({on['half']:+.2f} a cut on, {on['quarter']:+.2f} half a cut on){rest} — one step of a "+ return [f"nothing that reads no leg witnesses the cut {s}/{L} whole cycles: {TOP_LINES[on.get('top_line', 'top')]} {where} rises and "+ f"falls of its own once in it ({on['half']:+.2f} a cut on, {on['quarter']:+.2f} half a cut on) — one step of a "f"walk whose legs are drawn alike, half its cycle, or a whole cycle of a body that rises and falls once a cycle "f"(a limp, a body with no legs that bounces as it goes) — and {basis}. The cut is kept as chosen: cut again two "f"long, it would loop two of such a body's cycles ({UNWITNESSED})"]diff --git a/sprite_gen/video/loop.py b/sprite_gen/video/loop.pyindex b0d06fd..8e08e02 100644--- a/sprite_gen/video/loop.py+++ b/sprite_gen/video/loop.py@@ -1956,7 +1956,7 @@ def _counted(cycle: dict[str, Any], steps: int, *, window: CutWindow, D: np.ndardef _witnessed(cycle: dict[str, Any], *, frames: list[Image.Image], view: str | None = None) -> dict[str, Any]:"""The cut a walk's search and step count chose (`_by_steps`), held to one word before it is cut whichever way itwas chosen — the search's, two steps by the clip's crossings, crossings read or not: the body's- (`local_cycle.cut_word`: its top line on the screen and over its feet, the first word either says), or where it says+ (`local_cycle.cut_word`: one of its lines saying so both on the screen and over its feet), or where it saysno cycle the order the feet are drawn in (`legs.feet_order`, as the step count reads it; not from the side `view`),recorded `cut_witness` — not the order where the cut is the search's, kept because none of the clip's two-step cutscloses (`declined`). Legs drawn alike loop as well on one step as on two, and crossings read off feet that slide,diff --git a/tests/video/test_cycle_align.py b/tests/video/test_cycle_align.pyindex 6fb43a0..33a4be7 100644--- a/tests/video/test_cycle_align.py+++ b/tests/video/test_cycle_align.py@@ -20,8 +20,9 @@ import numpy as npimport pytestfrom PIL import Image, ImageDraw-from sprite_gen.video import align, local_cycle+from sprite_gen.video import align, legs, local_cyclefrom sprite_gen.video import loop as loop_mod+from tests.video import test_walk_steps as walksW, H = 100, 120@@ -400,16 +401,29 @@ def test_video_set_leaves_a_loop_its_body_rises_and_falls_four_times_in_out_of_tassert f"four times in its cut ({local_cycle.FOUR_STEPS})" in capsys.readouterr().err+def _drawn_four_steps() -> dict:+ """The body's word on a cut of two cycles of a walker whose arms swing past its sides, off its frames (`cut_word`):+ the loop `video-loop` writes where the cut it was asked for, or the one it was handed, runs two cycles long."""+ frames = [walks._behind(k, cycle=20, hold=2) for k in range(walks.FRAMES)]+ word = local_cycle.cut_word({**legs.strike_signals(frames), **legs.body_signals(frames)}, 40)+ return {k: word.get(k) for k in ("says", "by")}++@pytest.mark.slow@pytest.mark.parametrize("witness, reason", [({"held": "unwitnessed"}, local_cycle.UNWITNESSED),- ({"says": "four steps", "by": ["order"]}, local_cycle.FOUR_STEPS)])+ ({"says": "four steps", "by": ["order"]}, local_cycle.FOUR_STEPS),+ (_drawn_four_steps, local_cycle.FOUR_STEPS)],+ ids=["held", "four-steps-by-its-order", "four-steps-by-its-body"])def test_video_cycle_align_alone_stops_on_a_loop_whose_cut_its_report_holds_and_names_why(tmp_path, witness, reason):"""`video-cycle-align` run on a set's loops alone, without the rows `video-set` marks, reads the report beside eachloop (`align.held_cut`): a loop whose cut nothing witnessed whole cycles (`cycle-unwitnessed`) may hold half acycle or two, and one cut two cycles long where its strip counts two steps (`cycle-four-steps`) returns half way atits second step, which alone reads as one cycle. Either stops the set before anything is rewritten, named under`suspects` with its reason and its report, never aligned as one cycle without a word (the parent engine aligned- both: the first at its own length, the second at twice the speed of the rest); a count settles it."""+ both: the first at its own length, the second at twice the speed of the rest); a count settles it. A body read as+ four steps stops it as the order does, witnessed on the screen and over its feet; the parent engine held such a+ cut's arms against it, and the loop that reads two cycles now stops the set as one held does."""+ witness = witness() if callable(witness) else witnessfour = reason == local_cycle.FOUR_STEPSdirs = [_cut(tmp_path, n, L, cycles=c, report=n == "N")for n, L, c in (("S", 20, 1), ("E", 24, 1), ("N", 40 if four else 28, 2 if four else 1))]diff --git a/tests/video/test_loop_silent_pass.py b/tests/video/test_loop_silent_pass.pyindex d530043..7c043ac 100644--- a/tests/video/test_loop_silent_pass.py+++ b/tests/video/test_loop_silent_pass.py@@ -237,15 +237,16 @@ def test_a_fixed_cut_of_one_cycle_whose_crossings_mark_cycles_is_counted_two_stepicture, the body rises and falls twice an interval, its arms swinging within its sides, the crossings mark cycles,and the cut of one cycle is two steps — not failed, as `--anchor motion-auto` counts its own cut (the parent enginecounted it one step and stood the count aside). Its arms swinging past its sides, the bands they swing across move- on the beat and nothing witnesses the crossings cycles: left on steps, they count the cut one step, and it fails."""- for arm, cycles in ((ARMS_IN, True), (16, False)):+ on the beat, but the rows down the middle of the body read a body rising whole, and it is counted the same (the+ engine before read the bands alone, left the crossings on steps, counted the cut one step and failed it)."""+ for arm in (ARMS_IN, 16):frames = [_behind(k, cycle=20, hold=2, arm=arm) for k in range(73)]D = loop_mod._distances(np.stack([loop_mod._small_features(f) for f in frames]))counted = loop_mod.fixed_count(frames, D, 20, 20)- assert counted["chosen_by"] == "caller" and counted["cycles"]["cycles"] is cycles, arm- assert counted["cycles"].get("unwitnessed", False) is not cycles, arm- assert counted["cut"]["verdict"] == ("two" if cycles else "refuted") and counted["cut"]["k"] == [2 if cycles else 1], arm- assert loop_mod.odd_count({"kind": "fixed", "step_count": counted}) is not cycles, arm+ assert counted["chosen_by"] == "caller" and counted["cycles"]["cycles"] is True, arm+ assert counted["cycles"].get("unwitnessed", False) is False, arm+ assert counted["cut"]["verdict"] == "two" and counted["cut"]["k"] == [2], arm+ assert loop_mod.odd_count({"kind": "fixed", "step_count": counted}) is False, armdef test_a_wrap_a_part_on_its_own_beat_leaves_open_says_so_in_its_failure_line(tmp_path: Path):diff --git a/tests/video/test_walk_steps.py b/tests/video/test_walk_steps.pyindex 78e8e16..5aa2e06 100644--- a/tests/video/test_walk_steps.py+++ b/tests/video/test_walk_steps.py@@ -14,22 +14,23 @@ Each walker is drawn so the pixel search alone makes one of the faults a walk loTwo whose feet meet on the screen once a cycle, read as cycles (`local_cycle.read_cycles`) and cut one cycle, their bodyrising 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 widths of the upper body, every band of it holding still on the beat (the arms-swinging within the body's sides): 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, or whose arms swing-past its sides on the beat (a zoom's part of its width not told from theirs), 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, whatever the top-of its head (flat, round, a point, two ears' tips) or however its head or a cape is drawn against the zoom, 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.+leg, read against the lowest row and the rows down the middle of the body or the widths of its upper body, the same+line saying so on the screen and over the feet, its arms swinging within the body's sides or past them: 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, whatever the top of its head (flat, round, a point, two+ears' tips) or however its head or a cape is drawn against the zoom, nor a run whose feet leave the ground, nor a planted+foot sliding down the screen, nor a line on a beat of its own that a frame rate folds onto twice an interval over feet+that do the rising and falling, nor a head rising twice in one step on feet that do not. 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 seen from the front whose feet stay apart and meet once a cycle, its body still, is witnessed by the order itsfeet are drawn in (`local_cycle.order_word`): the foot drawn nearer, lower, changes sides twice an interval, and the clip@@ -509,22 +510,22 @@ def test_a_walk_whose_feet_meet_once_a_cycle_but_whose_body_does_not_bob_is_cut_@pytest.mark.slow@pytest.mark.parametrize("walker, view, interval", [("behind", None, 17.5), ("outward", "front_diagonal", 16)])-def test_a_walk_whose_feet_meet_once_a_cycle_its_arms_swinging_past_its_sides_is_cut_two_intervals_with_a_warning(tmp_path, walker,- view, interval):- """The two walkers whose feet meet once a cycle, rising and falling on their legs twice an interval as the ones cut- one cycle do, their arms swinging 16 px either way of the body's middle, past its sides: the upper body widens and- narrows twice an interval across the bands the arms swing over. A picture zooming on the beat moves a band so too,- and its part there is not told from the arms' at any turn: less as much of the zoom as such a band reads, the- line's rise and fall is not left. Nothing that reads no leg witnesses two steps an interval: two intervals, two- cycles, named in a warning (the parent engine witnessed it on a band that held still and cut one cycle)."""+def test_a_walk_whose_feet_meet_once_a_cycle_its_arms_swinging_past_its_sides_is_cut_one_cycle(tmp_path, walker, view, interval):+ """The two walkers whose feet meet once a cycle, rising and falling on their legs twice an interval, their arms+ swinging 16 px either way of the body's middle, past its sides: the upper body widens and narrows twice an interval+ across the bands the arms swing over, and a zoom's part there is not told from theirs. The rows down the middle of+ the body tell it: a body rising whole carries them as they are, and a zoom as far as the rise draws them longer.+ They fit as they stand better than they fit that zoom, and they decide: two steps an interval, one cycle (the parent+ engine read the bands alone, left the crossings on steps and cut two intervals, two cycles, named)."""draw = (lambda k: _behind(k, cycle=interval, hold=1)) if walker == "behind" else (lambda k: _outward(k, cycle=interval))- report = _cut(tmp_path / "out", _keyed(tmp_path, draw), *(("--view", view) if view else ()))- bob = _unwitnessed(report, interval)["bob"]- assert bob["half"] >= local_cycle.BOB_TWICE and bob["quarter"] <= -local_cycle.BOB_TWICE- assert bob["body"]["less_lowest"] >= local_cycle.BOB_OWN * bob["body"]["beat"] and bob["body"]["scale"] < local_cycle.BOB_SCALE- reads = [r for r in bob["body"]["bands"]["reads"] if r is not None]- assert max(reads) > 1 - local_cycle.BOB_SCALE and bob["body"]["still_bands"] < len(reads)- assert "its upper body's width changes with it" in bob["why"] and "the picture may zoom with the body" in bob["why"]+ _cut(tmp_path / "out", _keyed(tmp_path, draw), *(("--view", view) if view else ()))+ bob = _one_cycle(tmp_path / "out", interval)["cycles"]["bob"]+ assert bob["says"] == "cycles" and bob["half"] >= local_cycle.BOB_TWICE and bob["quarter"] <= -local_cycle.BOB_TWICE+ assert bob["top_line"] == "top" and bob["feet"]["says"] == "cycles" and bob["feet"]["top_line"] == "top"+ body = bob["body"]+ assert "whole" not in body and body["depth"]["ratio"] >= local_cycle.BOB_RIGID+ assert body["depth"]["moved"] >= local_cycle.STRIP_FLOOR and body["scale"] < local_cycle.BOB_SCALE+ assert max(r for r in body["bands"]["reads"] if r is not None) > 1 - local_cycle.BOB_SCALE@pytest.mark.slow@@ -620,29 +621,29 @@ def test_a_side_walk_whose_two_steps_look_alike_is_cut_two_steps_however_near_a_a tone or a few apart from the far ones. The walk is slower than the window, so the search cuts one step, and atone tone the clip a step on draws nearer than the next frame (0.89 playback steps). Its feet pass briefly — no passcan hide — and from the side the picture is not asked: the count stands, two steps, a cycle long. Its arms swing- past its sides on the beat, and a zoom is not told from the bands they swing across: nothing that reads no leg- witnesses the cut whole cycles, held as cut, named (the parent engine witnessed it on a band that held still)."""+ past its sides on the beat, across the bands of its upper body; the rows down the middle of the body read a body+ rising whole, and the cut stands witnessed (the parent engine held it, named)."""keyed = _keyed(tmp_path, lambda k: _alike(k, cycle=46, phase=13, tone=tone, lean=lean))for out, extra in (("plain", ()), ("side", ("--view", "side"))):report = _cut(tmp_path / out, keyed, *extra)counted = _two_steps(report, 46)assert counted["search"]["verdict"] == "refuted" and counted["search"]["k"] == [1]- assert "cycles" not in counted and _held(report)["says"] is None+ assert "cycles" not in counted and _strip_says_whole(_witnessed(report))@pytest.mark.slowdef test_a_diagonal_walk_whose_foot_cue_turns_over_a_step_on_is_cut_two_steps(tmp_path):"""The same walker filmed as a front diagonal: its legs a step on are one silhouette, so the clip one interval on isas near as a cycle on, but its far leg is drawn a few tones off the near one, and the view's foot cue turns over one- interval on — the other leg leads. The count stands: two steps, a cycle long. Its arms swinging past its sides,- nothing that reads no leg witnesses the cut whole cycles: held as cut, named."""+ interval on — the other leg leads. The count stands: two steps, a cycle long, its arms swinging past its sides and+ the rows down the middle of its body witnessing the cut."""report = _cut(tmp_path / "out", _keyed(tmp_path, lambda k: _alike(k, cycle=46, phase=13, tone=4, lean=1)),"--view", "front_diagonal")counted = _two_steps(report, 46)said = counted["cycles"]assert said["cycles"] is False and said["one"] <= said["two"] + local_cycle.CYCLE_SLACKassert said["cue"]["one"] <= local_cycle.CUE_SWAPPED and said["cue"]["says"] == "steps" and "the other leg leads" in said["why"]- assert "unwitnessed" not in said and _held(report)["says"] is None+ assert "unwitnessed" not in said and _strip_says_whole(_witnessed(report))@pytest.mark.slow@@ -1263,12 +1264,15 @@ def test_a_body_whose_shoulders_swing_on_the_beat_is_never_witnessed_however_itsinterval, its crown and the column under its shoulders holding still, its shoulders swinging a quarter of the beaton (`_shrugging`). Nothing zooms, but band by band it reads as a picture zoomed with the body whose crown and columnare drawn against the zoom and whose shoulders swing over it: five bands are seen, one holds still, four move on the- beat. The parent engine witnessed it on the one holding still; held, named."""+ beat. Drawn in one flat colour down its middle, the rows there would not show such a zoom and do not tell, so the+ bands decide. The parent engine witnessed it on the one holding still; held, named."""frames = [_shrugging(k) for k in range(128)]word = local_cycle.bob_word({**legs.strike_signals(frames), **legs.body_signals(frames)}, 16)assert word["half"] >= local_cycle.BOB_TWICE and word["quarter"] <= -local_cycle.BOB_TWICEassert sum(r is not None for r in word["body"]["bands"]["reads"]) == 5 and word["body"]["still_bands"] == 1+ assert word["body"]["depth"]["moved"] < local_cycle.STRIP_FLOORassert word["says"] is None and "its upper body's width changes with it" in word["why"]+ assert "the rows down the middle of its body do not tell" in word["why"]def test_a_lowest_row_on_the_frames_last_row_holds_the_word():@@ -1388,6 +1392,7 @@ def test_a_walk_zoomed_in_and_out_with_the_whole_picture_on_any_beat_is_never_wi# between them, its feet together over half the interval at a pass (46 frames a cycle, its crossings its steps every# 23), held still or rising and falling on its legs once a step._TOPPED = {"cycle": 46, "phase": 11, "tone": 0, "leg_half": 10}+_ZOOM_FITS = "the rows down the middle of its body fit a zoom as well as they fit standing"def _zoom_every(period: float, amount: float = 0.04):@@ -1401,14 +1406,15 @@ def test_a_still_walk_with_a_pointed_head_zoomed_about_its_feet_twice_a_step_is_row, which the zoom about the feet leaves where it is, its top line rises and falls twice an interval of a step,and the band across its head's top widens with it by nothing — a zoom moves a band under a point not at all. Thestep count's crossings count its steps, and the parent engine cut one of them, 23 frames, half a cycle, as two- steps, nothing named. The bands lower down its upper body, whose sides run straight down, widen with the zoom:- less the zoom they read, nothing of the line's rise and fall is left. Not witnessed half a cycle; held, named."""+ steps, nothing named. The bands lower down its upper body, whose sides run straight down, widen with the zoom, and+ the rows down the middle of its body fit that zoom better than they fit as they stand. Not witnessed half a cycle;+ held, named."""draw = _zoomed(lambda k: _alike(k, **_TOPPED, bob=0, top="pointed"), _zoom_every(11.5), "feet")report = _cut(tmp_path / "out", _keyed(tmp_path, draw))_not_silent(report, 46)word = _word_of(draw, 23)assert word["half"] >= local_cycle.BOB_TWICE and word["quarter"] <= -local_cycle.BOB_TWICE- assert word["says"] is None and "its upper body's width changes with it" in word["why"]+ assert word["says"] is None and word["body"]["depth"]["ratio"] < local_cycle.BOB_RIGID and _ZOOM_FITS in word["why"]bands = word["body"]["bands"]assert abs(bands["zoom"][0]) < local_cycle.BAND_FLOOR and max(bands["zoom"]) >= local_cycle.BAND_FLOOR@@ -1498,14 +1504,16 @@ def test_a_still_walk_zoomed_twice_a_step_its_head_drawn_against_the_zoom_is_nevAgainst its lowest row its top line rises and falls twice an interval of a step; the bands across its head holdstill on the screen, and those across the body under it move. The parent engine took a band holding still as thewitness that nothing zooms and read the swing under it as the body's own, and cut 23 frames, half a cycle, as two- steps, nothing named. The swing may hide the zoom at any turn: never witnessed half a cycle; held, named."""+ steps, nothing named. The swing may hide the zoom at any turn, and the rows down the middle of the body do not hide+ it from the strip: they fit the zoom better than they fit as they stand. Never witnessed half a cycle; held, named."""draw = _caped() if form == "cape" else _drawn_against(form)report = _cut(tmp_path / "out", _keyed(tmp_path, draw))_not_silent(report, 46)assert local_cycle.unwitnessed(report["cycle"])word = _word_of(draw, 23)assert word["half"] >= local_cycle.BOB_TWICE and word["quarter"] <= -local_cycle.BOB_TWICE- assert word["says"] is None and word["body"]["still_bands"] >= 1 and "its upper body's width changes with it" in word["why"]+ assert word["says"] is None and word["body"]["still_bands"] >= 1 and word["body"]["depth"]["ratio"] < local_cycle.BOB_RIGID+ assert _ZOOM_FITS in word["why"]# The picture moved up and down (of the interval d, px either way, phase), or held still (None).@@ -1559,6 +1567,160 @@ def test_a_cut_is_witnessed_by_how_often_the_body_rises_and_falls_in_it(beat, saassert word["on"]["says"] == "cycles" and word["on"]["interval"] == {"four steps": 8, "one step": 32}[says]+def _on_legs(top, feet):+ """A column on two legs, one flat colour: its top `top(k)` rows off row 40 in frame k, its soles `feet(k)` off row 180."""++ def frame(k: int) -> Image.Image:+ y, sole = 40 + top(k), 180 + feet(k)+ im = Image.new("RGBA", (300, 220))+ d = ImageDraw.Draw(im)+ d.rectangle((80, y, 140, y + 85), fill=(180, 80, 80, 255))+ d.rectangle((84, y + 80, 99, sole), fill=(60, 60, 70, 255))+ d.rectangle((121, y + 80, 136, sole), fill=(60, 60, 70, 255))+ return im+ return frame+++def _signals(draw, frames: int) -> dict:+ drawn = [draw(k) for k in range(frames)]+ return {**legs.strike_signals(drawn), **legs.body_signals(drawn)}+++def _quick(interval: int, turns: int | None):+ """A top line on a beat of its own, 4 rows either way: `turns` times an interval of `interval` frames, or (None) by+ the four rows 4, -4, -4, 4 over and over. Read in whole frames, half an interval on and a quarter on it correlates+ as a rise and fall twice an interval does, and it has next to nothing of one."""+ return (lambda k: (4, -4, -4, 4)[k % 4]) if turns is None else (lambda k: round(4 * math.sin(2 * math.pi * k * turns / interval)))++[email protected]("interval, turns", [(24, None), (18, 6), (24, 10), (30, 6), (36, 14)])+def test_a_top_line_on_a_quick_beat_of_its_own_over_feet_rising_twice_an_interval_is_never_witnessed(interval, turns):+ """A column whose feet rise and fall 6 rows twice an interval and whose top runs on a quick beat of its own (`_quick`).+ Its two correlations pass, and against its lowest row a rise and fall twice an interval is left: all of it the+ lowest row's, the top line's own on the screen next to none. The lowest row does the rising and falling, and the+ parent engine read that as the body's own, two steps an interval, and cut it so. Never witnessed, the word says+ why, and the crossings stay on steps."""+ feet = lambda k: round(6 * math.cos(4 * math.pi * k / interval)) # noqa: E731+ signals = _signals(_on_legs(_quick(interval, turns), feet), 120)+ word = local_cycle.bob_word(signals, interval)+ assert word["half"] >= local_cycle.BOB_TWICE and word["quarter"] <= -local_cycle.BOB_TWICE+ assert word["says"] is None and "its lowest row does the rising and falling" in word["why"]+ assert word["body"]["beat"] < local_cycle.BOB_OWN * word["body"]["less_lowest"]+ assert local_cycle.cut_word(signals, interval)["says"] != "two steps"+ middles = range(interval // 2, 120, interval)+ reading = crossings.Reading(120, "gap", [(float(c), float(c)) for c in middles],+ runs=[(c - interval // 3, min(c + interval // 3, 119)) for c in middles])+ said = local_cycle.read_cycles(reading, _distances(period=interval, frames=120), signals=signals)+ assert said["cycles"] is False and said["unwitnessed"] is True and "its lowest row does the rising and falling" in said["bob"]["why"]++[email protected]("form", ["signals", "drawn"])+def test_a_head_rising_twice_in_one_step_is_never_cut_half_a_cycle_unnamed(form):+ """`cut_word` on a cut 16 frames long, one step of a walk 32 frames a cycle, read off signals (`_body`) and off a+ drawn column: its head rises and falls 3 rows every 8 frames, twice the cut, and its feet 8 rows every 16, once the+ cut. On the screen alone the line reads two steps, half a cycle cut as a whole one, and the parent engine stood it+ so, nothing named. Over its feet the line rises and falls as the feet do, once the cut. A line witnesses only where+ it says so in both places: nothing witnesses the cut, and the word says why."""+ head = lambda k: round(3 * math.cos(2 * math.pi * k / 8)) # noqa: E731+ feet = lambda k: round(8 * math.cos(2 * math.pi * k / 16)) # noqa: E731+ signals = _signals(_on_legs(head, feet), 96) if form == "drawn" else _body(+ [40.0 + head(k) for k in range(96)], lowest=[140.0 + feet(k) for k in range(96)])+ assert local_cycle.bob_word(signals, 16)["says"] == "cycles" and local_cycle.bob_word(signals, 16, feet=True)["says"] is None+ word = local_cycle.cut_word(signals, 16)+ assert word["says"] is None and "by" not in word and [line["says"] for line in word["lines"].values()] == [None, None]+ assert "its top line rises and falls twice an interval on the screen, but not over its feet" in word["why"]+ assert "its top line less its flow does not rise and fall" not in word["lines"]["screen"]["why"]+ assert local_cycle.body_word(signals, 16)["says"] is None+++def _lifted_cape(k: int) -> Image.Image:+ """A body rising and falling 3 rows every 8 frames on feet that stay on the ground, its head a narrow column and a+ cape as wide as its widest row over its shoulders, lifted 8 rows either way on a beat of its own (every 11 frames):+ `top`, which passes over what is narrower than half the widest row, reads the cape and not the head."""+ y = 40 + round(3 * math.cos(2 * math.pi * k / 8))+ lift = round(8 * math.sin(2 * math.pi * k / 11))+ im = Image.new("RGBA", (300, 220))+ d = ImageDraw.Draw(im)+ d.rectangle((102, y, 118, y + 30), fill=(230, 200, 170, 255))+ d.rectangle((90, y + 30, 130, y + 100), fill=(200, 80, 80, 255))+ d.rectangle((70, y + 24 + lift, 150, y + 60), fill=(90, 120, 200, 255))+ d.rectangle((92, y + 100, 105, GROUND), fill=(60, 60, 70, 255))+ d.rectangle((115, y + 100, 128, GROUND), fill=(60, 60, 70, 255))+ return im+++def test_a_cape_that_takes_the_top_line_off_the_head_leaves_the_word_to_the_first_solid_row():+ """The top line and the first solid row are each read, one at a time, both on the screen and over the feet. A cape+ lifted on its own beat takes the top line off the head (`_lifted_cape`), where the first solid row stays on it and+ rises and falls twice an interval: it witnesses, and the word names it (the parent engine read the top line alone+ and held the cut)."""+ signals = _signals(_lifted_cape, FRAMES)+ assert local_cycle.bob_word(signals, 16)["says"] is None+ word = local_cycle.body_word(signals, 16)+ assert word["says"] == "cycles" and word["top_line"] == "first_row" and word["feet"]["top_line"] == "first_row"+ cut = local_cycle.cut_word(signals, 16)+ assert cut["says"] == "two steps" and cut["by"] == list(local_cycle.CUT_LINES) and cut["lines"]["feet"]["bob"]["top_line"] == "first_row"+ assert local_cycle.body_word({k: v for k, v in signals.items() if k != "first_row"}, 16)["says"] is None+++def test_a_line_on_the_screen_and_another_over_the_feet_witness_nothing():+ """`body_word` reads one line in both places. The top line rises and falls twice an interval on the screen and not+ over its feet, which rise and fall once an interval; the first solid row, which also moves with the feet, does so+ over them and not on the screen. Each says so in one place: nothing is witnessed, and each line's why is in the word."""+ t = np.arange(FRAMES)+ head, feet = 3 * np.cos(2 * np.pi * t / 8), 8 * np.cos(2 * np.pi * t / 16)+ word = local_cycle.body_word({**_body(40 + head, lowest=140 + feet), "first_row": list(40 + head + feet)}, 16)+ assert word["says"] is None and "top_line" not in word+ assert "its top line rises and falls twice an interval on the screen, but not over its feet" in word["why"]+ assert "its first solid row rises and falls twice an interval over its feet, but not on the screen" in word["feet"]["why"]+++def _marked(k: int, zoom: bool, marked: bool) -> Image.Image:+ """A column on planted feet, rising 3 rows either way twice an interval of 24 frames, or (`zoom`) zoomed about its+ feet as far as that; `marked`, with a band across it every 12 rows down its middle, else one flat colour."""+ wave = math.cos(4 * math.pi * k / 24)+ scale = 1 + 3 * wave / 100 if zoom else 1+ y = (lambda row: round(GROUND - (GROUND - row) * scale) - (0 if zoom else round(3 * wave)))+ im = Image.new("RGBA", (300, 220))+ d = ImageDraw.Draw(im)+ d.rectangle((90, y(40), 130, y(150)), fill=(180, 80, 80, 255))+ for row in range(44, 140, 12 if marked else 1000):+ d.rectangle((90, y(row), 130, y(row + 4)), fill=(240, 220, 90, 255))+ d.rectangle((94, y(146), 108, GROUND), fill=(60, 60, 70, 255))+ d.rectangle((112, y(146), 126, GROUND), fill=(60, 60, 70, 255))+ return im+++def test_the_rows_down_the_middle_of_a_body_are_read_where_a_zoom_would_show_in_them():+ """`body_depth`, `own_beat` `whole`: a body with marks down its middle, rising 3 rows either way twice an interval on+ planted feet, carries them as they are, and zoomed about its feet as far as that it draws them longer (`_marked`).+ Those fits decide; a body one flat colour down its middle has none to read, a zoom moves its strip under+ STRIP_FLOOR, and the bands decide. That is `own_beat`'s to read; the report keeps the measures and no such word, and+ a hold is not told from a hold by it."""+ walker = _marked+ read = {(zoom, marked): local_cycle.own_beat(_signals(lambda k: walker(k, zoom, marked), 96), 24)+ for zoom in (False, True) for marked in (False, True)}+ assert read[False, True]["whole"] is True and read[True, True]["whole"] is False+ assert read[False, True]["depth"]["ratio"] >= local_cycle.BOB_RIGID > read[True, True]["depth"]["ratio"]+ assert read[False, False]["whole"] is None and read[False, False]["depth"]["moved"] < local_cycle.STRIP_FLOOR+ signals = _signals(lambda k: walker(k, False, True), 96)+ body = local_cycle.bob_word(signals, 24)["body"]+ assert "whole" not in body and "whole_least" not in body and "depth" in body+++def test_a_reason_both_lines_give_is_said_once():+ """The column zoomed on the beat, marks down its middle (`_marked`): its top line and its first solid row are one+ row, and each is held for the same reason, the rows down the middle of the body fitting the zoom as well as they fit+ standing, a reason that names no line. The body's word, read on a crossing interval and on a cut, says it once (the+ first reading of this engine said it once for each line, joined)."""+ signals = _signals(lambda k: _marked(k, True, True), 96)+ assert list(signals["first_row"]) == list(signals["top"])+ reason = "fit a zoom as well as they fit standing"+ word = local_cycle.body_word(signals, 24)+ assert word["says"] is None and word["why"].count(reason) == 1+ assert local_cycle.cut_word(signals, 24)["why"].count(reason) == 1++@pytest.mark.parametrize("span, says", [(30, "two steps"), (60, "four steps"), (15, "one step"), (22, None)])def test_the_order_the_feet_are_drawn_in_says_how_many_steps_a_span_holds(span, says):"""`order_word` on the walker whose feet stay apart, a cycle 30 frames: the foot drawn nearer changes sides every 15@@ -1715,17 +1877,34 @@ def _held(report: dict) -> dict:return said+def _witnessed(report: dict) -> dict:+ """The cut handed out is witnessed: a line of the body rises and falls twice it on the screen and over its feet,+ two steps, nothing held and nothing named."""+ c = report["cycle"]+ said = c["cut_witness"]+ assert report["status"] == "passed" and said["cut"] == [c["start"], c["length"]]+ assert said["says"] == "two steps" and said["by"] == list(local_cycle.CUT_LINES) and "held" not in said+ assert not local_cycle.unwitnessed(c) and not any(local_cycle.UNWITNESSED in w for w in report["jolt"]["warnings"])+ return said+++def _strip_says_whole(said: dict) -> bool:+ """The rows down the middle of the body, read on the cut, fit as they stand no worse than a zoom as far as the rise,+ and such a zoom would show in them."""+ depth = said["lines"]["screen"]["bob"]["body"]["depth"]+ return depth["ratio"] >= local_cycle.BOB_RIGID and depth["moved"] >= local_cycle.STRIP_FLOOR++@pytest.mark.slow@pytest.mark.parametrize("body", ["on-its-legs", "whole"])def test_a_walk_whose_feet_a_shadow_hides_from_the_step_count_is_never_cut_one_step_unnamed(tmp_path, body):"""The wide walker with its legs drawn alike, its crossings its steps every 23 frames, over a shadow drawn with itapart under its feet: the step count reads no feet, and the search cuts 23 frames — one step, which loops as a cycle- does where the legs are drawn alike (the parent engine handed it out so, nothing named). Its arms swing past its- sides on the beat, and a zoom is not told from the bands they swing across: nothing that reads no leg says the cut- is a cycle, held as cut, named. Drawn with its arms within its sides, read off its frames: rising and falling on its+ does where the legs are drawn alike (the parent engine handed it out so, nothing named). Rising and falling on itslegs once a step, the body rises and falls once the cut — one step, or a whole cycle of a body that does so once a- cycle; carried up and down whole, feet and all, it does not of its own. (So drawn, or held still on its legs, the- loop is refused: its wrap jumps.)"""+ cycle; carried up and down whole, feet and all, it does not of its own. Nothing says the cut is a cycle: held as cut,+ named. Its arms swinging past its sides or within them, the word is the same, read off its frames. (Drawn with its+ arms within its sides, or held still on its legs, the loop is refused: its wrap jumps.)"""drawn = {"on-its-legs": {}, "whole": {"whole": True}}[body]report = _cut(tmp_path / "out", _keyed(tmp_path, _shadowed(lambda k: _alike(k, **_STEPS, **drawn), lambda k: 0,shadow="apart", screen=False)))@@ -1733,11 +1912,11 @@ def test_a_walk_whose_feet_a_shadow_hides_from_the_step_count_is_never_cut_one_scounted = report["cycle"]["step_count"]assert counted["readable"] is False and counted["chosen_by"] == "search"said = _held(report)- assert said["says"] is None and said["cut"] == counted["search"]["cut"] and abs(said["cut"][1] - 23) <= 1+ says = {"on-its-legs": "one step", "whole": None}[body]+ assert said["says"] == says and said["cut"] == counted["search"]["cut"] and abs(said["cut"][1] - 23) <= 1within = _shadowed(lambda k: _alike(k, **_STEPS, arm=ARMS_IN, **drawn), lambda k: 0, shadow="apart", screen=False)frames = [within(k) for k in range(FRAMES)]- word = local_cycle.cut_word({**legs.strike_signals(frames), **legs.body_signals(frames)}, said["cut"][1])- assert word["says"] == {"on-its-legs": "one step", "whole": None}[body]+ assert local_cycle.cut_word({**legs.strike_signals(frames), **legs.body_signals(frames)}, said["cut"][1])["says"] == says@pytest.mark.slow@@ -1827,25 +2006,24 @@ def test_a_still_walk_over_a_shadow_on_the_screen_on_a_picture_shaken_twice_a_st@pytest.mark.slow@pytest.mark.parametrize("walker, cycle, sway", [("steps", 46, (2, 12, 0)), ("steps", 46, (3, 24, math.pi / 2)),("behind", 20, (2, 24, math.pi))])-def test_a_walk_rising_on_its_legs_on_a_picture_swaying_once_a_cycle_or_slower_is_witnessed_one_cycle(tmp_path, walker, cycle, sway):+def test_a_walk_rising_on_its_legs_on_a_picture_swaying_once_a_cycle_or_slower_is_held_as_cut_named(tmp_path, walker, cycle, sway):"""A walk rising and falling on its legs once a step, its feet on the ground, its arms swinging within its sides, ona picture swaying up and down once a cycle or slower — 12 px either way every 46 frames or 24 px every 69 (the widewalker with its legs drawn alike, its crossings its steps every 23 frames), 24 px every 40, up first (the walker- whose far foot passes hidden, 20 frames a cycle on twos): a slow motion of the whole picture, not the walk's. The- cut is a cycle. Taken out at the cut's length, the flow leaves the sway whole, and the top line on the screen rises- and falls with it once the cut: read there alone, the body's rise and fall twice the cut is hidden and the cycle- held. Over its feet, which move with the picture, the top line rises and falls twice the cut: two steps, witnessed,- nothing named."""+ whose far foot passes hidden, 20 frames a cycle on twos). The cut is a cycle. Taken out at the cut's length, the flow+ leaves the sway whole, and the top line on the screen rises and falls with it once the cut, hiding the body's rise+ and fall twice it. Over its feet, which move with the picture, the line does rise and fall twice the cut, but a head+ rising twice in one step says the same in one place: a line witnesses only where it says so in both. The cycle is+ held as cut, named, the price of that guard (the parent engine witnessed it over its feet alone)."""draw, d = {"steps": (lambda k: _alike(k, **_STEPS, arm=ARMS_IN), 23),"behind": (lambda k: _behind(k, cycle=20, hold=2, arm=ARMS_IN), 20)}[walker]report = _cut(tmp_path / "out", _keyed(tmp_path, _carried(draw, _shake(sway, d))))_not_silent(report, cycle)- c = report["cycle"]- said = c["cut_witness"]- assert report["status"] == "passed" and abs(c["length"] - cycle) <= 1.5 and said["cut"] == [c["start"], c["length"]]- assert said["says"] == "two steps" and "feet" in said["by"] and "held" not in said- assert said["lines"]["feet"]["bob"]["over"] in ("reach", "sole")- assert not local_cycle.unwitnessed(c) and not any(local_cycle.UNWITNESSED in w for w in report["jolt"]["warnings"])+ said = _held(report)+ assert abs(said["cut"][1] - cycle) <= 1.5 and said["says"] is None+ feet = said["lines"]["feet"]["bob"]+ assert feet["over"] in ("reach", "sole") and feet["half"] >= local_cycle.BOB_TWICE and feet["quarter"] <= -local_cycle.BOB_TWICE+ assert "its top line rises and falls twice an interval over its feet, but not on the screen" in said["why"]def _leaning(draw, degrees: float):@@ -1866,11 +2044,10 @@ def test_a_walk_leaning_further_on_its_feet_as_it_goes_is_witnessed_one_cycle(tm(17.5 frames), rising and falling 3 px on its legs once a step, its arms swinging within its sides, turned 15degrees about its feet over the clip: a lean changing slowly, on its feet. The count reads its crossings as cyclesand cuts one cycle. On the screen the top line, less its flow, rises and falls of its own twice the cut, every band- of its upper body a zoom so far would move a pixel holding still on the beat: two steps, witnessed, nothing named.- The lean tilts the ground under the feet, and the line over them takes in the two feet's heights by turns: read off- its frames on a cut of 18, it does not rise and fall twice the cut, nor four times, nor once, where the line on the- screen says two steps. (Its arms swinging past its sides, as the parent engine's walker's did, the bands they swing- across move on the beat, and a zoom is not told from them: its crossings stay on steps, two intervals, named.)"""+ of its upper body a zoom so far would move a pixel holding still on the beat, and over its feet it does so too: two+ steps, witnessed, nothing named. The lean tilts the ground under the feet, and the line over them takes in the two+ feet's heights by turns: read off its frames on a cut of 18, a frame longer, it does not rise and fall twice the cut+ over them, nor four times, nor once, where it does on the screen, and one place alone witnesses nothing."""leaning = _leaning(lambda k: _behind(k, cycle=17.5, hold=1, alike=True, arm=ARMS_IN), -15)report = _cut(tmp_path / "out", _keyed(tmp_path, leaning))_not_silent(report, 17.5)@@ -1878,70 +2055,70 @@ def test_a_walk_leaning_further_on_its_feet_as_it_goes_is_witnessed_one_cycle(tmsaid = c["cut_witness"]assert report["status"] == "passed" and abs(c["length"] - 17.5) <= 1 and said["cut"] == [c["start"], c["length"]]assert c["step_count"]["cycles"]["cycles"] is True and c["steps"] == {"count": 2, "by": "crossings"}- assert said["says"] == "two steps" and "screen" in said["by"] and "held" not in said- body = said["lines"]["screen"]["bob"]["body"]+ body = _witnessed(report)["lines"]["screen"]["bob"]["body"]assert body["still_bands"] == sum(r is not None for r in body["bands"]["reads"]) >= 1- assert not local_cycle.unwitnessed(c) and not any(local_cycle.UNWITNESSED in w for w in report["jolt"]["warnings"])frames = [leaning(k) for k in range(FRAMES)]word = local_cycle.cut_word({**legs.strike_signals(frames), **legs.body_signals(frames)}, 18)- assert word["says"] == "two steps" and word["by"] == ["screen"] and word["lines"]["feet"]["says"] is None- assert "does not rise and fall twice an interval" in word["lines"]["feet"]["why"]+ assert word["says"] is None and "does not rise and fall twice an interval" in word["lines"]["feet"]["why"]+ assert "rises and falls twice an interval on the screen, but not over its feet" in word["lines"]["screen"]["why"]-# The walkers the tests above draw with their arms swinging within their sides (ARMS_IN) and witness, or read one step,-# drawn with their arms swinging 16 px either way of the body's middle, past its sides, as the parent engine's tests-# drew them: (draw, frames, view, the walk's cycle, the cut: "steps" and the interval its crossings are left on steps-# at, cut two intervals, or "held" and the length of the cut held as chosen).+# The walkers the tests above draw with their arms swinging within their sides (ARMS_IN), drawn with their arms swinging+# 16 px either way of the body's middle, past its sides, as the parent engine's tests drew them: (draw, frames, view, the+# walk's cycle, the cut: "one cycle" and the frames it is cut, "stands" and the frames of the cut witnessed, or "held",+# the frames of the cut held as chosen and the word it holds on).PAST_ITS_SIDES = {- "hidden-18.5-ones": (lambda k: _behind(k, cycle=18.5, hold=1), FRAMES, None, 18.5, ("steps", 18.5)),- "hidden-20-twos": (lambda k: _behind(k, cycle=20, hold=2), FRAMES, None, 20, ("steps", 20)),- "hidden-24-threes": (lambda k: _behind(k, cycle=24, hold=3), FRAMES, None, 24, ("steps", 24)),- "alike-17.5": (lambda k: _behind(k, cycle=17.5, hold=1, alike=True), FRAMES, None, 17.5, ("steps", 17.5)),+ "hidden-18.5-ones": (lambda k: _behind(k, cycle=18.5, hold=1), FRAMES, None, 18.5, ("one cycle", 18.5)),+ "hidden-20-twos": (lambda k: _behind(k, cycle=20, hold=2), FRAMES, None, 20, ("one cycle", 20)),+ "hidden-24-threes": (lambda k: _behind(k, cycle=24, hold=3), FRAMES, None, 24, ("one cycle", 24)),+ "alike-17.5": (lambda k: _behind(k, cycle=17.5, hold=1, alike=True), FRAMES, None, 17.5, ("one cycle", 17.5)),"alike-17.5-back_diagonal": (lambda k: _behind(k, cycle=17.5, hold=1, alike=True), FRAMES, "back_diagonal", 17.5,- ("steps", 17.5)),- "alike-20": (lambda k: _behind(k, cycle=20, hold=2, alike=True), FRAMES, None, 20, ("steps", 20)),- "alike-20-back_diagonal": (lambda k: _behind(k, cycle=20, hold=2, alike=True), FRAMES, "back_diagonal", 20, ("steps", 20)),- "outward-18": (lambda k: _outward(k, cycle=18), FRAMES, "front_diagonal", 18, ("steps", 18)),+ ("one cycle", 17.5)),+ "alike-20": (lambda k: _behind(k, cycle=20, hold=2, alike=True), FRAMES, None, 20, ("one cycle", 20)),+ "alike-20-back_diagonal": (lambda k: _behind(k, cycle=20, hold=2, alike=True), FRAMES, "back_diagonal", 20, ("one cycle", 20)),+ "outward-18": (lambda k: _outward(k, cycle=18), FRAMES, "front_diagonal", 18, ("one cycle", 18)),"carried-arc": (_carried(lambda k: _behind(k, cycle=17.5, hold=1, alike=True), "arc", 0), FRAMES, None, 17.5,- ("steps", 17.5)),+ ("one cycle", 17.5)),"carried-cubic": (_carried(lambda k: _behind(k, cycle=17.5, hold=1, alike=True), "cubic", 60), FRAMES, None, 17.5,- ("steps", 17.5)),- "leaning": (_leaning(lambda k: _behind(k, cycle=17.5, hold=1, alike=True), -15), FRAMES, None, 17.5, ("steps", 17.5)),+ ("one cycle", 17.5)),+ "leaning": (_leaning(lambda k: _behind(k, cycle=17.5, hold=1, alike=True), -15), FRAMES, None, 17.5, ("one cycle", 17.5)),"far-leg-off-side": (lambda k: _alike(k, cycle=46, phase=13, tone=4, lean=1, leg_half=10), FRAMES, "side", 46,- ("held", 46)),+ ("stands", 46)),"far-leg-off-front_diagonal": (lambda k: _alike(k, cycle=46, phase=13, tone=4, lean=1, leg_half=10), FRAMES,- "front_diagonal", 46, ("held", 46)),- "slides": (lambda k: _alike(k, **_STEPS, lift=8, slide=12), FRAMES, None, 46, ("held", 23)),- "limps": (lambda k: _alike(k, cycle=30, phase=8, tone=4, lean=1, bob=0, limp=3), 100, None, 30, ("held", 30)),+ "front_diagonal", 46, ("stands", 46)),+ "slides": (lambda k: _alike(k, **_STEPS, lift=8, slide=12), FRAMES, None, 46, ("held", 23, "one step")),+ "limps": (lambda k: _alike(k, cycle=30, phase=8, tone=4, lean=1, bob=0, limp=3), 100, None, 30, ("held", 30, "one step")),"shaken-over-a-shadow": (_shadowed(lambda k: _alike(k, **_STEPS, bob=0), _shake((0.5, 6, math.pi / 2), 23), shadow="touch",- screen=True), FRAMES, None, 46, ("held", 23)),- "swaying-12-every-46": (_carried(lambda k: _alike(k, **_STEPS), _shake((2, 12, 0), 23)), FRAMES, None, 46, ("held", 46)),+ screen=True), FRAMES, None, 46, ("held", 23, None)),+ "swaying-12-every-46": (_carried(lambda k: _alike(k, **_STEPS), _shake((2, 12, 0), 23)), FRAMES, None, 46, ("held", 46, None)),"swaying-24-every-69": (_carried(lambda k: _alike(k, **_STEPS), _shake((3, 24, math.pi / 2), 23)), FRAMES, None, 46,- ("held", 46)),+ ("held", 46, None)),"hidden-swaying-24-every-40": (_carried(lambda k: _behind(k, cycle=20, hold=2), _shake((2, 24, 0), 20)), FRAMES, None, 20,- ("held", 20)),+ ("held", 20, None)),}@pytest.mark.slow@pytest.mark.parametrize("form", list(PAST_ITS_SIDES))-def test_a_walk_whose_arms_swing_past_its_sides_is_never_witnessed_its_crossings_left_on_steps_or_its_cut_held(tmp_path, form):- """The walkers witnessed above, or read one step, drawn as the parent engine's tests drew them, their arms swinging- past their sides (`PAST_ITS_SIDES`): the bands the arms swing across widen and narrow on the beat, and a zoom's- part there is not told from theirs. Nothing that reads no leg witnesses two steps an interval, or the cut whole- cycles. A walk whose feet meet once a cycle has its crossings left on steps and is cut two intervals, named (the- parent engine witnessed it one cycle, or, leaning, held that cycle); any other cut is held as chosen, named, its- word null (the parent engine witnessed the far leg's two steps and the swaying walks' cycle over their feet,- nothing named, and held the sliding foot's and the limp's cut on the word one step). Never a silent half cycle."""- draw, frames, view, cycle, (kind, length) = PAST_ITS_SIDES[form]+def test_a_walk_whose_arms_swing_past_its_sides_reads_as_one_whose_arms_swing_within_them(tmp_path, form):+ """The walkers witnessed above, or held, drawn as the parent engine's tests drew them, their arms swinging past+ their sides (`PAST_ITS_SIDES`): the bands the arms swing across widen and narrow on the beat, and a zoom's part there+ is not told from theirs, but the rows down the middle of the body are told from it, and the arms do not cross them.+ A walk that says two steps a cycle with its arms within its sides says so with them past: a walk whose feet meet once+ a cycle is cut one cycle, and a cut of two steps stands witnessed. A walk held so is held so, on the same word, one+ step or none (the parent engine left the crossings on steps, two intervals, named, and held the rest, its word null).+ Never a silent half cycle."""+ draw, frames, view, cycle, (kind, length, *word) = PAST_ITS_SIDES[form]report = _cut(tmp_path / "out", _keyed(tmp_path, draw, frames=frames), *(("--view", view) if view else ()))_not_silent(report, cycle)- if kind == "steps":- said = _unwitnessed(report, length)- assert "its upper body's width changes with it" in said["bob"]["why"]+ if kind == "one cycle":+ assert _one_cycle(tmp_path / "out", length)["cycles"]["bob"]["body"]["depth"]["ratio"] >= local_cycle.BOB_RIGID+ elif kind == "stands":+ said = _witnessed(report)+ assert abs(said["cut"][1] - length) <= 1.5 and _strip_says_whole(said)else:said = _held(report)- assert said["says"] is None and abs(said["cut"][1] - length) <= 1.5+ assert said["says"] == word[0] and abs(said["cut"][1] - length) <= 1.5@pytest.mark.parametrize("verdict, named", [("uncertain", True), ("two", False)])