Skip to content

Standardize result-attribute naming on MgVideo (e.g. ssm_fig → ssm_figure) #346

Closed

Description

@alexarje

Background

Methods stash their results on the parent object under inconsistent attribute names:

  • _video: motion_video, history_video, eulerian_video, motionvectors_video, blur_faces_video, pose_video, warp_video
  • _image: heatmap_image, mhi_image, stroboscope_image, blend_image
  • oddballs: ssm_fig (vs _figure used elsewhere), subtract (no suffix), motion_plot, ssm_combined, pixelarray, motiongram_x/y, videogram_x/y

Task

Adopt a single convention (e.g. <name>_video / _image / _figure) and rename the outliers.

Caveats (why this is deferred / 2.0-scope)

  • Renaming these attributes is breaking: show(key=...) resolves some of them by attribute name, and user code/tests may reference them.
  • Best done with deprecation aliases (keep the old attribute pointing at the new one for a release) and targeted for a major version (2.0).

Activity

  1. alexarje commented on Aug 6, 2026

    @alexarje
    ContributorAuthor

    Partial progress: two of the oddballs were renamed as part of a bug fix (744169f), because storing the result under the method's own name shadowed the bound method and broke repeated calls: subtract is now stored as subtract_video and the sonomotiongram result as sonomotiongram_audio. The remaining renames (ssm_fig, motion_plot, ssm_combined, pixelarray, etc.) still need the deprecation-alias treatment and remain 2.0-scope.

  2. alexarje commented on Aug 22, 2026

    @alexarje
    ContributorAuthor

    Further partial progress: ssm_fig is done (ca9ff0e).

    ssm() now stores its result as ssm_figure, with ssm_fig kept as a deprecated property alias that reads and writes the canonical attribute and warns. The show(key='ssm') lookup moved with it, since it resolves by attribute name out of the instance dictionary and a class-level property does not appear there.

    The alias is a property rather than a second attribute deliberately: two plain attributes drift apart the moment either side is reassigned, and the point of keeping the old name is that a script written against it sees what the new code stored. Its getter also re-raises under the name that was asked for, so hasattr(v, "ssm_fig") is False on a video with no SSM rather than raising about an attribute the caller never mentioned.

    That is the deprecation-alias pattern this issue calls for, so the remaining renames can follow the same shape when 2.0 comes around.

    Still open here: motion_plot, ssm_combined, pixelarray, motiongram_x/y, videogram_x/y, and the 2.0 removal of the ssm_fig alias itself.

  3. alexarje commented on Aug 22, 2026

    @alexarje
    ContributorAuthor

    Correction to the hash above: the commit was rebased onto #366 before pushing, so it is 9ef2a4f, not ca9ff0e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions