Hi,
I am trying to load a particle set in a cryposparc-tools
script. The script is incomplete, but I am trying to debug what I have so far.
When I run it (python3 select_defocus_change.py
) it dies with an error (attached) at the point where I try to load the first particle set. J434 is a Homogeneous Reconstruction job, so it has a particles
output group.
Script:
from cryosparc.tools import CryoSPARC
cs = CryoSPARC(host="c112384", base_port=39000, license="xxx" ,email="xxx", password="xxx")
assert cs.test_connection()
project = cs.find_project("P23")
job1 = cs.find_job("P23", "J434")
job2 = cs.find_job("P23", "J448")
particle_set1 = job1.load_output("particles")
particle_set2 = job2.load_output("particles")
particle_set1['ctf/def_abs'] = (particle_set1['ctf/df1_A']+particle_set1['ctf/df1_A'])/2
particle_set2['ctf/def_abs'] = (particle_set2['ctf/df1_A']+particle_set2['ctf/df1_A'])/2
defocus_change = abs(particle_set1['ctf/def_abs']-particle_set2['ctf/def_abs'])
particle_set2['ctf/def_change'] = defocus_change
project.save_external_result(
workspace_uid = "W4",
dataset = particle_set2,
type = "particle",
name = "defocus_change_particles",
slots = ["ctf"],
passsthrough = (job1.uid, "particles"),
title = "particles with changed defocus",
)
Error:
user@c112384:~$ python3 select_defocus_change.py
Connection succeeded to CryoSPARC command_core at http://c112384:39002
Connection succeeded to CryoSPARC command_vis at http://c112384:39003
Connection succeeded to CryoSPARC command_rtp at http://c112384:39005
Traceback (most recent call last):
File "select_defocus_change.py", line 9, in <module>
particle_set1 = job1.load_output("particles")
File "/home/exx/.local/lib/python3.8/site-packages/cryosparc/job.py", line 390, in load_output
metafiles = set(r["metafiles"][0 if r["passthrough"] else version] for r in results)
File "/home/exx/.local/lib/python3.8/site-packages/cryosparc/job.py", line 390, in <genexpr>
metafiles = set(r["metafiles"][0 if r["passthrough"] else version] for r in results)
IndexError: list index out of range