Skip to content

8 ‐ Chaining

Alexander Refsum Jensenius edited this page Aug 1, 2026 · 6 revisions

For complete documentation see Working with Results on the docs site.


Every analysis method returns its result object (MgVideo, MgImage, or MgFigure), so calls can be chained directly:

import musicalgestures as mg

mv = mg.MgVideo('/path/to/video.avi', skip=4, crop='auto')

mv.motion().show()
mv.motionvideo().history().show()
mv.motionvideo().blend(component_mode='average').show()

mg.MgVideo('/path/to/video.avi', skip=4, crop='auto').motion().history().average().show()

The basic non-chained workflow is equivalent and sometimes clearer:

mv = mg.MgVideo('/path/to/video.avi', starttime=5, endtime=15, skip=3)
mv.motion()
mv.history()
mv.show(key='motion')
mv.show(key='history')

Clone this wiki locally