I’m trying to get my head around
cryosparc-tools. A simple use case might be to take a particle set (e.g. from a refinement job) and edit one parameter (e.g. Cs or amplitude contrast for example) and output a modified particle set. How would I go about doing that?
Hi @olibclarke, you can use a combination of
CryoSPARC.save_external_result and dataset operations to achieve this. Here’s some partial code:
from cryosparc.tools import CryoSPARC
cs = CryoSPARC(...) # fill in credentials and instance info here
puid = "PX" # substitute with project UID
wuid = "WY" # substitute with workspace UID
juid = "JZ" # substitute with job UID
output = "particles" # substitute with job output name
job = cs.find_job(puid, juid)
particles = job.load_output(output, slots=["ctf"])
# == Modify output dataset here ==
particles["ctf/cs_mm"] = ...
particles["ctf/amp_contrast"] = ...
cs.save_external_result(puid, wuid, "particle", particles,
desc="set cs to ... and amplitude contrast to ...",
This creates a new External job in the target workspace with a modified
particles.ctf output group that inherits other output groups from the given refinement job.
I used the Re-center Particles example as a template for this code, I recommend reading that and the other examples to learn more about cryosparc-tools’s capabilities.
Hope that helps!
That is exceptionally helpful, thanks @nfrasser!