I am trying to track particles in a final NU-refine job back to the parent micrographs (preferably in a list format). Is there a simple way in which to do this?
Welcome to the forum @cparthurphd.
With cryosparc-tools and a csinfo.yaml
file that looks like
license: 682437fb-d6ae-47b8-870b-b530c587da94
host: localhost
base_port: 61000
email: username@email.server
password: top7secret-phrase
you can do this:
from cryosparc.tools import CryoSPARC
import cryosparc.dataset
import pandas
import yaml
instance_info_file = '/home/user1/instance_infos/csinfo.yaml' # as described above
with open(instance_info_file, 'r') as yh:
cs = CryoSPARC(**yaml.safe_load(yh))
puid, juid = 'P44', 'J341' # An NU-refine job
nu_particles = cs.find_job(puid, juid).load_output('particles')
df = pandas.DataFrame(nu_particles.rows())[[
'uid', 'location/micrograph_path',
'location/center_x_frac', 'location/center_y_frac']]
df.to_csv(f'{puid}_{juid}_particles.csv')
(I am not sure how useful the csv file would be in case of a real dataset with many more than 10,000 particles.)
Does this help?