I’m trying to automate select_2D jobs using cryosparc-tools (v5 API). The goal is to script which 2D class averages are retained without manual interaction in the GUI.
Here’s what I’ve attempted so far:
from cryosparc.tools import CryoSPARC
cs = CryoSPARC(“http://myhost:39000”)
project = cs.find_project(“P310”)
job = project.create_job(“W1”, “select_2D”)
job.connect(“particles”, “J99”, “particles_selected”)
job.connect(“templates”, “J99”, “templates_selected”)
job.set_param(“selected_templates”, [0, 2, 5, 8]) # 0-based class indices to keep
job.queue(hostname=“worker-node”)
Upon execution of this code, the Select2D job is created with both inputs (particles and templates) connected. However, when the job runs it still opens the interactive class selection interface with nothing pre-selected, effectively ignoring the param.
Is there a supported way to run select_2D non-interactively with pre-defined class selections? This would be very useful for batch processing pipelines where class assignments are already known.
Thanks in advance,
Mike