Import movie error

I am getting the following error when i try to import movies with gain reference

[CPU: 766.1 MB]  Traceback (most recent call last):
  File "cryosparc2_master/cryosparc2_compute/", line 82, in
  File "cryosparc2_compute/jobs/imports/", line 651, in run_import_movies_or_micrographs
    imgdata = tiff.read_tiff(abs_path).sum(axis=0) * gainref
ValueError: operands could not be broadcast together with shapes (7676,3710) (7420,7676) 

This is K2 data as tiff movies. I have checked the headers of my tiffs and my header, and the dimensions are consistent (7420,7676) but somehow, one of them is being read as 3710 in the X direction.


Hi @aparvate,

Is it possible if you can run this code for me, and attach the file it creates?

First, get together 2 paths

  1. dir_path : The path to the directory where your movies are saved
  2. output_path : The path to the file where the stats will be written to (file will be created when the script is run)

Then, in a shell, run cryosparcm icli , which will open up an interactive python shell. You can then copy and paste this code, with the two variables modified

import os
from cryosparc2_compute.blobio import mrc
dir_path = '/data/movies'
output_path = '/u/cryosparcuser/header_stats.txt'
for path in os.listdir(dir_path):
    filepath = os.path.join(dir_path, path)
    with open(output_path, 'a') as file_out:
        with open(filepath, 'rb') as file_obj:
            header = mrc.read_mrc_header(file_obj)
            file_out.write(filepath + ' : ')
            file_out.write(str(header) + ', ')
            file_out.write("File size: {}".format(os.path.getsize(filepath)))

Sorry i should have given more details in the first message. I am using my own data set and not the test data set in the tutorial. I will try your script out but i used the mrc files and it seems to work… well sortta
I am running a stand alone version of cryosparc on a single machine with an RTX 2080 (8gb).
There was another problem with the mrc - they were too big for my GPU…So i binned them 2x and now my motion correction is running fine.

Hey @aparvate,

Sorry, I forgot to edit my post as I used it from another post I created. You can specify the path to where your movies were saved and the script will work. This just tells us if there are any inconsistencies between the header and the actual file size on disk.