Skip to content

1.33.0

Latest

Choose a tag to compare

@alexarje alexarje released this 03 Dec 11:21

[1.33.0] — 2026-12-03

  • Documentation: README gains "What you can reuse" and "What it does not do", naming Kinetics Toolkit, PyEyesWeb and librosa as the tools for what this package leaves out (2026-09-18).
  • Documentation: every docstring parameter list matches its function's signature (grouped entries such as start, end are split, one per parameter), and the documentation site builds with mkdocs build --strict, locally and in CI (2026-12-03).

The unreleased features below were developed for and are exercised end to end by
avsegmenter, which segments concert and lecture recordings.

Fixed

  • The agreement rule of motiontempo(), tempo_similarity() and _fold.tempo_over_time is
    half of the windows, not two thirds. Returned values change:
    a recording in which between
    half and two thirds of the windows agree now has a tempo where it had NaN. A tempo that
    fluctuates with its phrases often has a third of its windows off the median, and a recording
    without a tempo stays below a half (the bundled dancer has 31%). The price is with short
    recordings: windows of smooth unpulsed motion reach one half in about one recording of a
    minute in ten and one of two minutes in forty. min_share restores the stricter rule.
  • beat_statistics(source='motion') called the rate of its motion onsets a tempo. It is a
    count of the peaks the onset detector accepts: 191.5 per minute on the bundled pianist, where
    signals with the same broad spectrum and no order give 211 to 234 and the motion's periodic
    levels lie at 113, 212 and 324. The figure says "motion onsets per minute", data gains
    onset_rate (the same value as tempo), and the docstring says what the number is.
  • motiondescriptors() called the largest bin of the whole recording's spectrum "the dominant
    periodicity of the motion".
    It is the bottom of a spectrum that falls with rate: 21.0 per
    minute for the dancer and 13.5 for the pianist, where signals with the same broad spectrum
    and no order put theirs below 30 per minute in 97% and 94% of cases. The value is unchanged;
    the docstring and the figure's label say what it is.
  • The per-marker dominant frequency of the average-pose figure read the encoder's rhythm. A
    repeated frame stops every marker for one frame, which at every sixth frame of 30 is 5 per
    second. The speed is now cleaned with remove_frame_locked first.
  • motiontempo() reported the encoder's rhythm as the motion tempo. Its returned values
    change, and so do its defaults.
    Frame differences of compressed video jump at every keyframe
    and drop at every repeated frame, on an exact frame lattice, and that was the dominant
    frequency: 125 BPM on the bundled dancer.avi (a keyframe every 12 frames at 25 fps), 300 BPM
    on pianist.avi (a near-repeated frame every sixth). _motiontempo.remove_frame_locked now
    takes such lattices out of the signal (clean=True, the default in quantity_of_motion). The
    tempo is then estimated in windows (_fold.tempo_over_time, 12 s windows 4 s apart, 40 to 240
    BPM) and reported when half of the windows agree to within 8%: tempo_bpm and
    dominant_frequency are the median, or NaN with a RuntimeWarning and a reason, and data
    gains tempo_curve, tempo_times, tempo_quartiles, tempo_share and frame_locked. The
    defaults of fmin and fmax move from 0.2 and 8 Hz to 40 and 240 per minute. The dancer now
    returns no tempo and the pianist 109 BPM.
  • tempo_similarity() returned a motion tempo for motion that has none (125 BPM for the
    dancer). Its motion tempo now comes from the same windowed estimate; without one,
    motion_tempo_bpm, tempo_ratio and tempo_agreement are NaN. beat_statistics(source='motion'),
    phase_synchrony(), dynamics_coupling() and motiondescriptors() read the same cleaned
    signal, so their numbers change as well. The quantity of motion written by motion() is
    unchanged.
  • get_framecount failed when ffprobe printed a message before the count: on Ubuntu's ffprobe a
    WebM with Opus audio gives "Error parsing Opus packet header." on the same pipe as the video
    stream's count, and the whole output went to int(). The count is now read from its own line.
    This was the ten failing tests of the Ubuntu CI jobs.
  • MediaPipe segmentation aborted the process on frame widths that are not a multiple of four,
    the bundled 518-pixel-wide dancer.avi among them, as soon as it found a person:
    _spacetime._make_segmenter now pads the frame to the next multiple and cuts the mask back.
    This affected silhouette_waterfall, spacetime_volume and multishot(segmenter='mediapipe').
  • The videogram_* tracks of extract_tracks were motiongrams (#383): they averaged the motion
    frame, not the picture. They are now written as motiongram_v.u1 / motiongram_h.u1 under
    motiongram_* keys, and true videograms come from one extra ffmpeg filter graph
    (extract_videograms, on by default, videograms=False to skip), trimmed so that column j
    lines up with motion frame j. read_columns, build_pyramid and render_timeline take both
    names; an analysis folder written before the rename serves its motion means under
    motiongram_* and, under videogram_*, with a warning that says what they are.
  • _mocap.read_c3d imported MgError from _utils, where it does not live; mypy on master failed on it.
  • _tracks.read_columns failed on any recording long enough to need a pyramid level.
    extract_tracks and extract_tracks_parallel write the base videograms only, and
    read_columns memory-mapped videogram_v.L<k>.u1 without checking it existed, so the first
    read of a real concert raised FileNotFoundError unless the caller knew to run
    build_pyramid first. It now builds the levels on first use.

Added

  • The levels of a motion signal. Music runs at several temporal levels at once, and
    _levels.motion_levels (and MgVideo.motion_levels()) lists every periodicity in a motion
    signal from tens of seconds to eight per second, each with period, strength against a
    stated null (signals with the same broad spectrum and random phases), presence (the share of
    windows in which it stands out), frame_locked (it falls on the encoder's lattice or a
    harmonic) and supported (the recording's sound has it too, from sound_levels), and groups
    levels at 3/2, 2, 3 and 4 into metrical families. It promotes none to the tempo. The fast
    range is read by _fold.window_spectra, the windows motiontempo() reads, and the slow range
    by _fold.slow_candidates, the autocorrelation estimate_period(search='slow') reads. On the
    bundled examples: the dancer has no level in the beat range and one slow level, the music's
    repetition at 21.4 s, which its motion follows below chance; the pianist has a beat at 113 per
    minute (111 in its sound) and levels at twice and three times that, one family.
  • The motion tempogram. motion_tempogram and motion_tempogram_view (and
    MgVideo.motion_tempogram()) draw the windowed spectrum over time on a logarithmic rate axis,
    with the levels marked and the sound's tempogram, measured the same way, beneath it.
  • Slow periods. estimate_period(search='slow'), and with it fold_signal, folded_view and
    MgVideo.folded(), look for the repetition of a whole passage, from 8 s to two fifths of the
    signal, in the autocorrelation of the smoothed signal, tested against surrogates with the same
    smoothness (alpha; None returns the strongest lag as a candidate). fold_signal keeps a last
    row that is at least half filled, with NaN where the signal has ended. MgVideo.folded() takes
    clean in place of despike.
  • The two bundled videos are reference cases (tests/test_reference_examples.py, marked
    slow) and are described once, on the examples page.
  • Four pictures of where, when, and both. Spatial: time_composite and
    MgVideo.time_composite() paint every pixel that moved in the hue of the moment it moved,
    over the average frame, with a colour bar for time; the strongest moment wins where a pixel
    moved more than once (combine='latest' for the last), and mask= takes a MaskTrack or a
    silhouette function. Temporal: _raster.activity_raster draws one labelled row per person
    (mask_activity, from a MaskTrack) or per body region (region_activity, from pose
    landmarks), scaled per row by default, with missing values drawn as missing; and
    _fold.fold_signal, folded_view and MgVideo.folded() stack a motion signal with one
    period per row, the period given or estimated by estimate_period, which raises when the
    dominant frequency is not a peak. Spatial-temporal: _videograms.slitscan and
    MgVideo.slitscan() keep one pixel column or row of every frame, at a given position, at the
    strongest motion or following a tracked point. All read in one pass with constant memory and
    sample long recordings. _motiontempo.quantity_of_motion is the signal motiontempo() already
    computed, now callable.
  • Silhouette panels and held objects — _spacetime.silhouette_panels and
    MgVideo.silhouette_panels() lay one person out as numbered, timed panels at regular intervals
    or given times, all under one crop, as a dark silhouette on a paper-coloured ground with an
    optional stick figure from pose landmarks. held_silhouette(person, frame, plate) adds what the
    person holds (whatever differs from the room plate next to the body), held_axis reduces that
    object to one line segment and held_axes runs it through a video; silhouette_waterfall and
    spacetime_volume take held=True. _plate.room_plate_colour is the colour room plate that
    multishot and MgVideo.plate() already built, now in one place. A panel without a person stays
    empty and is counted.
  • pose_timeline(view='marey') — every posture as thin light lines on black at its true size
    and place, each moved step pixels to the right of the one before, with a time axis and an
    optional (frames, 4) array of segments (a held instrument's axis) in a second colour;
    every draws every n-th frame, and MgVideo.pose_timeline(view='marey', held=True) finds the
    segments itself.
  • Masks per object (#388) — new _masks module. track_masks follows each person (YOLO
    prompts) or each given box through a video with SAM 2 at 2 fps in one-minute chunks, with
    re-detection at chunk starts, and saves a MaskTrack (bit-packed .npz). mask_holding counts
    lost, jumping, merged and drifting masks and the longest clean run; mask_motion gives the
    frame difference inside each mask beside the whole frame. MgVideo.motion(mask=, mask_object=)
    restricts quantity, centroid and area of motion, the motiongrams and the motion video to one
    mask. SAM 2 is installed from its repository, not as an extra, since it is not on PyPI under
    its own name.
  • People on stage — new _performers module. detect_people runs a YOLO person detector
    (ultralytics extra) at a low frame rate through an ffmpeg pipe; on_stage keeps the boxes
    whose heads are in the upper part of the frame and drops the audience cut off by the bottom
    edge; performer_count reports how many perform in a span as a high percentile of the
    per-frame counts (the wide shots), with median and maximum beside it. Exact for a soloist,
    a duo and a five-piece band from an operated concert camera; a choir is under-counted.
  • performer_count(..., stat="typical") takes the median over framings instead of the widest, for
    lecture halls where the widest framings are the hall and the slides; detect_people and
    make_proxy / camera_motion take ffmpeg_input_args (e.g. ["-hwaccel", "cuda"]).
  • Camera cuts and PTZ — new _camera module. camera_motion labels each sample of a video
    still, moving or cut from ORB matches and a partial-affine RANSAC fit between consecutive
    frames of a small 2 fps proxy (make_proxy), and returns cuts, shots and the share of time in
    each state; still_runs gives the framings (still runs between moves and cuts);
    camera_state_at samples the state at arbitrary times, so motion measures can exclude camera
    motion. performer_count(..., camera=...) counts per framing (the 75th percentile of each, the
    widest framing being the estimate), which is what makes the count right with an operated camera.
  • tracks.json (and the dict both extractors return) carries analysis_dir, so a caller can
    go from extract_tracks_parallel(...) to read_columns/check_tracks without
    reconstructing the analysis/<stem> path convention.
  • extract_wav is exported from the package root.
  • Events against events — new _events module. event_alignment measures how far each
    event of one stream (strokes, footfalls, looks) falls from the nearest event of another
    (note onsets, beats, cues) against uniformly placed surrogate references, and says whether
    the two attract, avoid or sit at chance, with the signed lag of the nearest reference
    telling which came first; event_xcorr correlates the binned event trains. On the
    painter–pianist session this separated three takes no envelope correlation had.
  • Cross-recurrence — _correlate.cross_recurrence: recurrence rate at a fixed radius
    quantile, determinism, mean line length and the diagonal recurrence profile of two series,
    each against circular-shift surrogates, so a high determinism from two smooth series is not
    mistaken for coordination.
  • The painting as a time series — new _canvas module. painting_content reduces a
    canvas video to one hand-free median frame per second and measures painted share, monotone
    coverage, chromatic share, the hue histogram (drawn as a colourgram by colourgram_image),
    warm/cool balance, edge density, composition (composition: paint centre and spread,
    left–right symmetry, edge-orientation histogram and anisotropy) and a dominant-colour
    palette per minute. Bound on MgVideo as painting().
  • Head turns from the IMU — _pupillabs.head_turns: yaw relative to a running median,
    and the spans where the head is turned away from what the wearer has been facing.
  • TRC and C3D readers — read_trc and read_c3d beside read_qtm_tsv, so Qualisys,
    OptiTrack, Vicon, Theia3D, Pose2Sim and OpenCap exports all land on the same trajectory
    contract: (marker_names, data, fs) with data of shape (frames, markers, 3), gaps as
    NaN (never zeros) and positions converted onto millimetres from the file's declared unit.
    read_c3d rides the optional ezc3d package, added to the [c3d] extra beside the
    pure-Python c3d writer dependency; analog channels and events are declaredly not read.
  • FreeMoCap reader — read_freemocap reads a FreeMoCap recording folder onto the same
    trajectory contract: the body trajectories from output_data/mediapipe_body_3d_xyz.npy
    (millimetres and NaN gaps already, passed through unchanged) with MediaPipe's 33 landmark
    names, and the frame rate derived from the recording's own timestamp records the way
    FreeMoCap itself derives it — None with a warning when no record exists, never a guessed
    default. Hands, face, centre of mass and reprojection errors are declaredly not read.