refactor: move video I/O to minian.io (part of #309)#321
Conversation
Colocate load/export paths in a dedicated io module per maintainer direction on miniscope#309. Keep behavior unchanged; deprecate legacy helpers and add utilities/visualization import shims for backward compatibility. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Thanks @thicclatka. I think our plan is to first get robust unit tests up and running based on a data simulation module for minian I am close to making a PR for. Once we have that, it would be great to get some of these large minian modules refactored into more manageable chunks. |
|
Noted, thanks @daharoni. Happy to wait on this and sync up once your simulation module + unit-test PR lands. No rush on my side. We can hold #321 as-is for the time being. #321 is step 1 on #309 (the broader For context on what I have in mind for the pipeline side (just reference implementations), the scripts/modules on my fork's
Happy to port those incrementally after simulation-backed tests exist, aligned with however you want the merge train ordered. |
Part of #309
Summary
Implements @sneakers-the-rat's step 1: move video/movie file I/O out of the god modules into a dedicated top-level
minian.iomodule. This PR is move-only / behavior-neutral — noH264OutputOptionsrefactor, no change to ffmpeg kwargs inwrite_video.minian/io.pywithload_videos,write_video,load_avi_ffmpeg, and private helpers (_ensure_ffmpeg,_load_avi_lazy,_load_tif_lazy,_load_tif_perframe)load_avi_ffmpegname unchanged (dask graph /TaskAnnotationcontract)@deprecated:load_avi_lazy_framewise,load_avi_perframe,write_vid_blk,concat_video_recursiveminian.utilities: scipy-style__getattr__shim +DeprecationWarningfor symbols that moved tominian.iominian.visualization: keepgenerate_videos; re-exportwrite_videofor backward compat; shim deprecated imports ofwrite_vid_blk/concat_video_recursivetyping_extensionsdependency (for@deprecatedon Python <3.13)Compatibility
from minian.utilities import load_videosfrom minian.io import load_videosfrom minian.utilities import ensure_ffmpeg_ensure_ffmpegfrom minian.visualization import write_videofrom minian.io import write_videofrom minian.visualization import write_vid_blkfrom minian.io import write_vid_blkOut of scope (follow-up PRs on #309)
utilities.pyinto submodules (dataset,dask_opt,chunking,signal)H264OutputOptions/ shared ffmpeg output buildervisualization/package splitTest plan
pdm run python -m pytest minian/test/test_pre_processing.py --no-covpdm run ruff check minian/io.py minian/utilities.py minian/visualization.pyfrom minian.utilities import load_videosemitsDeprecationWarningand returns same object asminian.io.load_videosMade with Cursor