Blob Picker: ValueError: cannot reshape array of size 65280 into shape (1,1024,1024)

Hello,

I used a blob picker in v3.2.0+patched to pick around 11,000,000 particles from about 3,000 micrographs. I want to extract these particles now to run 2D class averaging but am running into the following error:

ValueError: cannot reshape array of size 65280 into shape (1,1024,1024)

Here is the whole traceback:

[CPU: 4.85 GB]   (1315 of 3516) Finished processing micrograph 1314.

[CPU: 4.25 GB]   -- 0.1: processing J8/motioncorrected/002650374566925255637_stack_02576_X+1Y+0-3_patch_aligned_doseweighted.mrc

[CPU: 4.85 GB]   (1316 of 3516) Finished processing micrograph 1315.

[CPU: 3.89 GB]   -- 0.0: processing J8/motioncorrected/009045250411906160206_stack_02582_X-1Y+0-3_patch_aligned_doseweighted.mrc

[CPU: 4.85 GB]   (1317 of 3516) Finished processing micrograph 1316.

CPU: 4.43 GB]   Traceback (most recent call last):
  File "/home/nick/CryoSPARC/install/cryosparc_worker/cryosparc_compute/jobs/runcommon.py", line 1801, in run_with_except_hook
    run_old(*args, **kw)
  File "/home/nick/CryoSPARC/install/cryosparc_worker/deps/anaconda/envs/cryosparc_worker_env/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/nick/CryoSPARC/install/cryosparc_worker/cryosparc_compute/jobs/pipeline.py", line 86, in stage_target
    work = processor.exec(item)
  File "/home/nick/CryoSPARC/install/cryosparc_worker/cryosparc_compute/jobs/pipeline.py", line 43, in exec
    return self.process(item)
  File "/home/nick/CryoSPARC/install/cryosparc_worker/cryosparc_compute/jobs/extract/run.py", line 439, in process
    _, mrcdata = mrc.read_mrc(path_abs)
  File "/home/nick/CryoSPARC/install/cryosparc_worker/cryosparc_compute/blobio/mrc.py", line 128, in read_mrc
    data = read_mrc_data(file_obj, header, start_page, end_page, out)
  File "/home/nick/CryoSPARC/install/cryosparc_worker/cryosparc_compute/blobio/mrc.py", line 90, in read_mrc_data
    data = n.fromfile(file_obj, dtype=dtype, count= num_pages * ny * nx).reshape(num_pages, ny, nx)
ValueError: cannot reshape array of size 65280 into shape (1,1024,1024)

Not sure what to do to get around this. Any help is appreciated.

Hi @NKHO, this happens when there’s something wrong with one of the micrographs. It likely somehow got corrupted on disk.

In future releases of cryoSPARC, we’ll automatically skip these corrupt micrographs during extraction rather than fail the whole job. In the meantime, I suggest filtering them out using instructions here:

For your case, also change the part that says

os.stat(full_path).st_size > 0

to

os.stat(full_path).st_size > 1000000

Because it looks like the corrupt file is not empty.

Let me know how that goes.