Error in v5.0.3 with 2D classification with 1 class

We just upgraded to v5 yesterday and I am running into an error if I try to do 2D classification with a single class. To be honest, I don’t know if I have ever done this before in other versions of CryoSPARC, so it might not be v5 specific. However, I am following a pretty thorough protocol from a recent preprint ( https://www.biorxiv.org/content/10.64898/2026.02.24.703950v1 ) that requires this step.

I tried running a standard 2D classification with 1 class both with filaments and with a non-filament particle set, and I get the following error:

Traceback (most recent call last): File "cli/run.py", line 106, in cli.run.run_job File "cli/run.py", line 211, in cli.run.run_job_function File "compute/jobs/class2D/run.py", line 295, in compute.jobs.class2D.run.run_class_2D File "[...]/cryosparc_worker/compute/alignment.py", line 652, in greedy_align_2D_noqueue align_res = align_pairs( ^^^^^^^^^^^^ File "[...]/cryosparc_worker/compute/alignment.py", line 363, in align_pairs idx_arr = N_K_to_idx_arr(N_K, mode="ordered_pairs" if ordered_pairs else "pairs" if all_pairs else "all2one") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "[...]/cryosparc_worker/compute/alignment.py", line 50, in N_K_to_idx_arr assert N_K > 1 ^^^^^^^ AssertionError

The error occurs at the start of iteration 18, when there are approximately 1800 particles with default parameters. I played around with a couple of parameters (classification uncertainty, alignment res, etc.) to no avail.

Any suggestions?

Will note, not urgent on my end. I increased batchsize to use all particles and then just marked the job as complete after it failed, and that seems to have worked OK for current purposes!

Thanks @tlevitz for posting the observation and workaround. We are looking into this issue on our end also.

1 Like

Hi there,
Thanks for reporting. We have triaged this and will be releasing a fix soon. 2D classification with 1 class should be allowed to run.

In the meantime, a workaround is to set the Plotting sort method parameter to size.
Michael

1 Like

Hi all,
A fix for this issue has been release in v5.0.4 of CryoSPARC
Michael

1 Like