CrypSPARC Tools, changing phase shifts for micrographs: which .cs file to use?

I want to use cryoSPARC Tools to edit phase shift values after a Patch CTF job, but cannot seem to find it in the .cs file, which file am I to take from the Patch CTF output?

Cheers,

Wim

Hi @WimJHH! If you’re using CryoSPARC Tools to edit metadata, you shouldn’t need to load a .cs file. Something like below will set the phase shift values (or any other field you like):

from cryosparc.tools import CryoSPARC
import json
from pathlib import Path
with open(Path('~/instance-info.json').expanduser(), 'r') as f:
    instance_info = json.load(f)

cs = CryoSPARC(**instance_info)
assert cs.test_connection()

project_uid = "P345"
workspace_uid = "W5"
job_uid = "J112"

project = cs.find_project(project_uid)
job = project.find_job(job_uid)
results = job.load_output("exposures")

results["ctf/phase_shift_rad"] = 0.1 # or whatever value

project.save_external_result(
    workspace_uid=workspace_uid,
    dataset=results,
    type='exposure',
    slots=["ctf"],
    passthrough=(job_uid, 'exposures'),
    title='exposures_with_phase_shift'
)

This creates an “External results” job with the exposures with updated phase shift:

1 Like