It is essentially wasteful to load the raw data and write the motion corrected files to disk, and then separately read the motion corrected files back from disk 2 independent times while used in the pxCov and indexMovie calculations. We could save substantial time by loading the raw data once, motion corrected, and performing all pxCov + indexing functions on this data while still in memory before writing to disk.
It is essentially wasteful to load the raw data and write the motion corrected files to disk, and then separately read the motion corrected files back from disk 2 independent times while used in the pxCov and indexMovie calculations. We could save substantial time by loading the raw data once, motion corrected, and performing all pxCov + indexing functions on this data while still in memory before writing to disk.