### Run Jupyter Notebook Server Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Start the Jupyter Notebook server to access and run the example notebooks. Ensure the environment is activated and all dependencies are installed. ```sh jupyter notebook ``` -------------------------------- ### Install crYOLO Dependencies Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/intro.md Optional commands to install dependencies required for the crYOLO example notebook. This includes packages like pyqt5 and specific versions of setuptools, along with the cryolo pip package. ```sh conda install -c conda-forge pyqt=5 libtiff wxPython=4.1.1 adwaita-icon-theme 'setuptools<66' pip install 'cryolo[c11]' --extra-index-url https://pypi.ngc.nvidia.com ``` -------------------------------- ### Create and Activate Conda Environment for Examples Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Create a new Conda environment named 'cryosparc-tools-example' with specified dependencies, including Python, NumPy, PyQt, and others. Activate this environment before running example notebooks. ```sh conda create -n cryosparc-tools-example -c conda-forge python=3 numpy=1.18.5 \ pyqt=5 libtiff wxPython=4.1.1 adwaita-icon-theme 'setuptools<66' # exclude these dependencies if you don't need cryolo conda activate cryosparc-tools-example ``` -------------------------------- ### Install cryosparc-tools Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/intro.md Install the latest version of cryosparc-tools from PyPI into your current Python environment. ```sh pip install cryosparc-tools ``` -------------------------------- ### Initialize and Start Live Session Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/live-session.ipynb Configures exposure groups, updates session parameters, and starts the live session. Ensure exposure_group_configs and session_params are defined beforehand. ```python for i in range(len(exposure_group_configs) - len(api.sessions.find_exposure_groups(project_uid, session_uid))): api.sessions.create_exposure_group(project_uid, session_uid) for eg in zip(api.sessions.find_exposure_groups(project_uid, session_uid), exposure_group_configs): api.sessions.update_exposure_group(project_uid, session_uid, eg[0].exp_group_id, eg[1]) api.sessions.finalize_exposure_group(project_uid, session_uid, eg[0].exp_group_id) api.sessions.update_session_params(project_uid, session_uid, session_params) api.sessions.start(project_uid, session_uid) ``` -------------------------------- ### Install CryoSPARC Tools Example Dependencies Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/intro.md After activating the Conda environment, use these commands to install the necessary Python packages for running cryosparc-tools examples, including matplotlib and pandas. ```sh pip install matplotlib~=3.4.0 pandas==1.1.4 cryosparc-tools ``` -------------------------------- ### Build Documentation Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Build the project documentation using Jupyter Book. Ensure build dependencies are installed first. ```sh jupyter-book build docs ``` -------------------------------- ### CryoSPARC Connection Setup Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/live-session.ipynb Define the master hostname and port for your CryoSPARC installation and establish a connection using the cryosparc.tools library. Ensure the hostname and port match your login token. ```python master_hostname = "localhost" # should match hostname portion of login token base_port = 62000 # should match port portion of login token ``` ```python import time import cryosparc.tools cs = cryosparc.tools.CryoSPARC(f"http://{master_hostname}:{base_port}") assert cs.test_connection() api = cs.api ``` -------------------------------- ### Create and Activate Conda Environment for Examples Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/intro.md This command creates a new Conda environment named 'cryosparc-tools-example' with specified Python and NumPy versions, and then activates it. This is recommended for running example Jupyter notebooks with their required dependencies. ```sh conda create -n cryosparc-tools-example -c conda-forge python=3 numpy==1.18.5 conda activate cryosparc-tools-example ``` -------------------------------- ### Get CLI Help Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/cli.md Use the --help flag to view available commands and options for the cryosparc-tools CLI. ```bash python -m cryosparc.tools --help ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Install pre-commit hooks to ensure code quality and consistency before committing changes. ```sh pre-commit install ``` -------------------------------- ### Install Build Dependencies Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Install the necessary dependencies for building distribution packages of the cryosparc-tools library. ```sh pip install -e ".[build]" ``` -------------------------------- ### Start Streaming 3D Refinement Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/live-session.ipynb Selects a volume from a previous _ab initio_ reconstruction and starts a 3D refinement job. Ensure 'volume_class_0' is a valid input. ```python api.sessions.select_phase2_abinit_volume(project_uid, session_uid, volume_name="volume_class_0") api.sessions.update_phase2_refine_params(project_uid, session_uid, refine_params) refine_job_uid = api.sessions.setup_phase2_refine(project_uid, session_uid).uid api.sessions.enqueue_phase2_refine(project_uid, session_uid) ``` -------------------------------- ### Start _ab initio_ 3D Reconstruction Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/live-session.ipynb Configures and starts an _ab initio_ 3D reconstruction job. Waits for the job to complete before proceeding. ```python api.sessions.update_phase2_abinit_params(project_uid, session_uid, abinit_params) abinit_job_uid = api.sessions.setup_phase2_abinit(project_uid, session_uid).uid api.sessions.enqueue_phase2_abinit(project_uid, session_uid) cs.find_job(project_uid, abinit_job_uid).wait_for_status("completed") ``` -------------------------------- ### Instantiate CryoSPARC with Token Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/cli.md Example of how to instantiate the CryoSPARC class in Python using a saved login token. This avoids embedding credentials directly in scripts. ```python from cryosparc.tools import CryoSPARC cs = CryoSPARC("http://localhost:39000") project = cs.find_project("P1") ``` -------------------------------- ### Initialize CryoSPARC Connection and Find Project/Workspace Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Establishes a connection to the CryoSPARC instance, verifies the connection, and locates a specific project and workspace. Ensure the host and base_port are correctly configured for your CryoSPARC installation. ```python from cryosparc.tools import CryoSPARC cs = CryoSPARC(host="cryoem0.sbi", base_port=61000) assert cs.test_connection() project = cs.find_project("P251") workspace = project.find_workspace("W10") lane = "cryoem3" ``` -------------------------------- ### Initialize CryoSPARC Connection Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/connect_series_to_class3D.ipynb Establishes a connection to the CryoSPARC instance. Ensure the base_port is correctly set for your CryoSPARC installation. ```python from cryosparc.tools import CryoSPARC cs = CryoSPARC(base_port=40000) assert cs.test_connection() ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Install development dependencies and build native modules for the cryosparc-tools package. This includes editable installation with development extras. ```sh pip install -U pip wheel pip install -e ".[dev]" ``` -------------------------------- ### Clean Build Artifacts Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Remove previous build artifacts and compiled Python files before installing or running examples. This ensures a clean state. ```sh rm -rf cryosparc/*.so build dist *.egg-info ``` -------------------------------- ### Install Python Packages in Conda Environment Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Install additional Python packages required for running example notebooks within the activated Conda environment. This includes `cryosparc-tools`, `matplotlib`, `pandas`, `notebook`, and optionally `cryolo`. ```sh pip install cryosparc-tools matplotlib~=3.4.0 pandas~=1.1.0 notebook pip install 'cryolo[c11]' --extra-index-url https://pypi.ngc.nvidia.com # optional, only if you want to use cryolo ``` -------------------------------- ### Install Specific cryosparc-tools Version Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/intro.md Install a specific minor release version of cryosparc-tools that corresponds to your CryoSPARC minor release version. For example, for CryoSPARC v4.1.2, use `pip install cryosparc-tools~=4.1.0`. ```sh pip install cryosparc-tools~=4.1.0 ``` -------------------------------- ### Install Jupyter Notebook Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/intro.md Use this pip command to install the Jupyter Notebook package. This is a prerequisite for running CryoSPARC tools interactively in a notebook environment. ```sh pip install notebook ``` -------------------------------- ### Download a Job File Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/jobs.ipynb Download a specific file from the job's directory to a local path or file handle. The example shows downloading to 'sample.mrc' and then checking its size. ```python job.download_file(extracted[0], target="sample.mrc") with open("sample.mrc", "rb") as f: print(f"Downloaded {len(f.read())} bytes") ``` -------------------------------- ### Start Streaming 2D Classification Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/live-session.ipynb Sets up and enqueues a 2D classification job. Monitor particle count to ensure sufficient data is processed. ```python api.sessions.update_phase2_class2D_params(project_uid, session_uid, class2D_params) api.sessions.setup_phase2_class2D(project_uid, session_uid) api.sessions.enqueue_phase2_class2D(project_uid, session_uid) ``` ```python while ( api.sessions.find_one(project_uid, session_uid).phase2_class2D_num_particles_seen < abinit_params["abinit_num_particles"] ): time.sleep(10) api.sessions.select_all_class2d_templates(project_uid, session_uid, "select") ``` -------------------------------- ### Start External Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/cryolo.ipynb Initiates the external job, causing it to write to its outputs and job log. This action sets the job status to 'Waiting'. ```python job.start() ``` -------------------------------- ### Run Jupyter Notebook Server Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/intro.md Execute this command in your terminal to start a Jupyter Notebook server. By default, it runs on http://localhost:8888. Optional arguments can make it accessible on the local network. ```sh jupyter notebook ``` ```sh jupyter notebook --no-browser --ip=0.0.0.0 --port=8888 ``` -------------------------------- ### Create and Configure External Job for crYOLO Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/cryolo.ipynb Creates a new external job for crYOLO particle picking and connects various inputs such as training micrographs, training particles, and all micrographs. It also defines the output slots for predicted particles. Ensure job UIDs and output names match your CryoSPARC setup. ```python job = project.create_external_job("W3", title="crYOLO Picks") job.connect("train_micrographs", "J18", "split_0", slots=["micrograph_blob"]) job.connect("train_particles", "J19", "particles_selected", slots=["location"]) job.connect("all_micrographs", "J18", "split_0", slots=["micrograph_blob"]) job.connect("all_micrographs", "J18", "remainder", slots=["micrograph_blob"]) job.add_output("particle", "predicted_particles", slots=["location", "pick_stats"]) ``` -------------------------------- ### Setup External Job for Saving Latent Components Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/3dflex-custom-latent-trajectory.ipynb Configures an external job to save custom latent components. Connects to the train job to ensure output fields are passed through correctly. ```python ``` -------------------------------- ### Update Session Compute Configuration Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/live-session.ipynb Apply the defined compute resources to the CryoSPARC Live session. This step is crucial before starting the session to ensure it utilizes the correct lanes and GPUs. ```python api.sessions.update_compute_configuration(project_uid, session_uid, compute_resources) ``` -------------------------------- ### Initialize CryoSPARC with URL Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/CHANGELOG.md Instantiate the CryoSPARC class by providing the instance URL. This is an alternative to relying on default port access. ```python cs = CryoSPARC("https://cryosparc.example.com:61000") ``` -------------------------------- ### Initialize CryoSPARC Connection Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/upscale-expanded-particles.ipynb Establishes a connection to the CryoSPARC instance. Ensure your base port is correctly configured. ```python from cryosparc.tools import CryoSPARC cs = CryoSPARC(base_port=40000) cs.test_connection() ``` -------------------------------- ### CryoSPARC Class Initialization (No License) Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/CHANGELOG.md The `license` argument is no longer required when creating a `CryoSPARC` instance. This argument will be removed in a future release. ```python cs = CryoSPARC() ``` -------------------------------- ### Connect to CryoSPARC Instance Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/3dflex-custom-latent-trajectory.ipynb Establishes a connection to your CryoSPARC instance using credentials from 'instance-info.json'. Asserts that the connection is successful. ```python import json from pathlib import Path import numpy as n from cryoparc.tools import CryoSPARC with open(Path("~", "instance-info.json").expanduser(), "r") as f: credentials = json.load(f) cs = CryoSPARC(**credentials) assert cs.test_connection() ``` -------------------------------- ### Connect to CryoSPARC Instance Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/magnification.ipynb Establishes a connection to the CryoSPARC instance. Ensure the host and base port are correctly configured for your environment. ```python from cryosparc.tools import CryoSPARC cs = CryoSPARC(host="cryoem5", base_port=40000) assert cs.test_connection() ``` -------------------------------- ### Update cryosparc-tools Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/intro.md Update an existing installation of cryosparc-tools to the latest version. ```sh pip install -U cryosparc-tools ``` -------------------------------- ### Initialize CryoSPARC Connection and Find Project Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/xml-exposure-groups.ipynb Establishes a connection to the CryoSPARC API and verifies the connection. It then finds a specific project by its ID. ```python from cryosparc.tools import CryoSPARC cs = CryoSPARC(host="cryoem0.sbi", base_port=61000) assert cs.test_connection() project = cs.find_project("P251") ``` -------------------------------- ### Job Output Saving Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/CHANGELOG.md Outputs cannot be saved for external jobs with building or completed status. Clear the job, start it, save outputs, and then stop it. ```python job.clear() job.start() save_outputs() job.stop() ``` -------------------------------- ### Initialize CryoSPARC Client Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/hi-res-2d-classes.ipynb Initializes the CryoSPARC client and tests the connection. Ensure the host and base_port are correctly set for your CryoSPARC instance. ```python from cryosparc.tools import CryoSPARC cs = CryoSPARC(host="cryoem0.sbi", base_port=61000) assert cs.test_connection() ``` -------------------------------- ### Create and Initialize CryoSPARC Live Session Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/live-session.ipynb Create a new CryoSPARC Live session within a specified project and set initial configurations such as waiting for exposures and automatic pausing. ```python session_uid = api.sessions.create(project_uid, title=session_title, description=session_description).session_uid ``` ```python api.sessions.set_session_phase_one_wait_for_exposures(project_uid, session_uid, phase_one_wait_for_exposures=True) ``` ```python api.sessions.configure_auto_pause(project_uid, session_uid, auto_pause="graceful", auto_pause_after_idle_minutes=5) ``` -------------------------------- ### Create crYOLO Directories Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/cryolo.ipynb Creates the necessary subfolders within the job directory for crYOLO data preparation. ```python job.mkdir("full_data") job.mkdir("train_image") job.mkdir("train_annot") ``` -------------------------------- ### Set Import Movies Job Parameter Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Modify job parameters using `set_param()` while the job is in the 'building' status. This example changes the 'skip_header_check' parameter to False. ```python import_movies_job.set_param("skip_header_check", False) ``` -------------------------------- ### Creating and Queueing Ab-Initio Reconstruction and Refinement Jobs Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Create and queue 'homo_abinit' and 'homo_refine_new' jobs, establishing particle and volume connections from previous jobs. Specify refinement parameters as needed. ```python abinit_job = workspace.create_job( "homo_abinit", connections={"particles": (select_templates_job.uid, "particles_selected")}, ) refine_job = workspace.create_job( "homo_refine_new", connections={ "particles": (abinit_job.uid, "particles_all_classes"), "volume": (abinit_job.uid, "volume_class_0"), }, params={ "refine_symmetry": "D7", "refine_defocus_refine": True, "refine_ctf_global_refine": True, }, ) abinit_job.queue(lane) refine_job.queue(lane) abinit_job.wait_for_done(), refine_job.wait_for_done() ``` -------------------------------- ### Initialize CryoSPARC Client Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/jobs.ipynb Initialize the CryoSPARC client to interact with the API. Ensure the connection is successful before proceeding. ```python from cryosparc.tools import CryoSPARC cs = CryoSPARC("http://cryoem0.sbi:61000") assert cs.test_connection() ``` -------------------------------- ### Initialize CryoSPARC Client Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/delete-rejected-exposures.ipynb Initializes the CryoSPARC client connection. Ensure the host and base_port are correctly configured for your CryoSPARC instance. ```python from cryosparc.tools import CryoSPARC cs = CryoSPARC(host="cryoem0.sbi", base_port=40000) assert cs.test_connection() ``` -------------------------------- ### Login to Multiple CryoSPARC Instances Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/cli.md Demonstrates logging into multiple CryoSPARC instances or with different user accounts by running the login command multiple times with distinct URLs and email addresses. ```bash python -m cryosparc.tools login --url http://localhost:39000 --email ali@example.com python -m cryosparc.tools login --url http://localhost:39000 --email saara@example.com python -m cryosparc.tools login --url https://cryosparc.example.com --email suhail@example.com ``` -------------------------------- ### Create and Configure External Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/magnification.ipynb Initializes an external job for combining magnifications and connects particle inputs. Ensure particles have 'location', 'blob', and 'ctf' slots. ```python job = project.create_external_job("W6", title="Combine Magnifications") job.connect("particles_1", "J38", "particles_selected", slots=["location", "blob", "ctf"]) job.connect("particles_2", "J39", "particles_selected", slots=["location", "blob", "ctf"]) job.add_output("particle", name="combined_particles", slots=["location", "blob", "ctf"]) job.start() ``` -------------------------------- ### Visualize 2D Classes with Matplotlib Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/hi-res-2d-classes.ipynb Generates a grid of 2D class templates using matplotlib, including scale bars. The plots are saved as PNG and PDF. Ensure matplotlib is installed and configured for inline plotting. ```python %matplotlib inline from pathlib import Path import matplotlib.pyplot as plt N = templates_selected["blob/shape"][0][0] scale_bar_a = 100 scale_bar_px = scale_bar_a / templates_selected["blob/psize_A"][0] # 100 A in pixels num_rows = 3 num_cols = 5 fig, axes = plt.subplots(num_rows, num_cols, figsize=(num_cols, num_rows), dpi=400) plt.margins(x=0, y=0) for i, template in enumerate(templates_selected.rows()): path = template["blob/path"] index = template["blob/idx"] blob = all_templates_blobs[path][index] ax = axes.flatten()[i] ax.axis("off") ax.imshow(blob, cmap="gray", origin="lower") if i % num_cols == 0: # If this template is in the first column, plot scale bar scale_bar_x = N // 7 box_center = N / 2 ax.plot( # draw scale bar line [scale_bar_x, scale_bar_x], [box_center + scale_bar_px / 2, box_center - scale_bar_px / 2], color="white", ) ax.text( # scale bar text scale_bar_x - 2, # add space between scale bar label and line box_center, "100 \u00c5", # unicode for angstrom symbol rotation=90, horizontalalignment="right", verticalalignment="center", fontsize=6, color="white", ) fig.tight_layout(pad=0, h_pad=0.4, w_pad=0.4) fig.savefig(Path.home() / "class2d.png", bbox_inches="tight", pad_inches=0) fig.savefig(Path.home() / "class2d.pdf", bbox_inches="tight", pad_inches=0) ``` -------------------------------- ### Run cryosparc-tools CLI Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/cli.md Basic command structure for running cryosparc-tools from the terminal. ```bash python -m cryosparc.tools [options] ``` -------------------------------- ### Connect to CryoSPARC Instance Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/intro.md This Python script imports the CryoSPARC function and establishes a connection to your CryoSPARC instance. Replace with your CryoSPARC instance URL. Ensure you have logged in previously. ```python from cryosparc.tools import CryoSPARC cs = CryoSPARC("") assert cs.test_connection() ``` -------------------------------- ### Specify or Create CryoSPARC Project Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/live-session.ipynb Choose to use an existing CryoSPARC project by its UID or create a new project with specified title, description, and parent directory. ```python project_uid = "P291" # existing project ``` ```python # project_uid = cs.api.projects.create(title=project_title, # description=project_description, # parent_dir=project_parent_dir).uid ``` -------------------------------- ### Clone Repository and Initialize Submodules Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Clone the cryosparc-tools repository and initialize its submodules. Ensure Git LFS is pulled for large files. ```sh git clone --recursive https://github.com/cryoem-uoft/cryosparc-tools.git cd cryosparc-tools git lfs pull ``` -------------------------------- ### Load and Sample Particles Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/magnification.ipynb Loads particle datasets from inputs and samples the first 5 particles from each. Filters for relevant fields like pixel size and anisotropic magnification. ```python import pandas as pd particles_1 = job.load_input("particles_1") particles_2 = job.load_input("particles_2") samples = particles_1.slice(0, 5).append(particles_2.slice(0, 5)).filter_fields(["blob/psize_A", "ctf/anisomag"]) pd.DataFrame(samples.rows()) ``` -------------------------------- ### Define Raw Data and Processing Parameters Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/live-session.ipynb Configure parameters for raw data input, project details, session titles, and processing settings like pixel size, acceleration voltage, and blob detection parameters. This includes specifying file paths for raw data and gain references. ```python project_parent_dir = "/bulk2/CS/prod_projects" # where to create CryoSPARC project dir project_title = "Live test" project_description = "Live processing of the EMPIAR-10025 subset" session_title = "Live test session" session_description = "realtime processing of EMPIAR-10025 subset" exposure_group_configs = [ { "file_engine_watch_path_abs": "/bulk5/data/empiar_10025_subset/", "file_engine_filter": "14sep05c_00024sq_*.frames.tif", "gainref_path": "/bulk5/data/empiar_10025_subset/norm-amibox05-0.mrc", }, { "file_engine_watch_path_abs": "/bulk5/data/empiar_10025_subset/", "file_engine_filter": "14sep05c_c_00003gr_00014sq_*.frames.tif", "gainref_path": "/bulk5/data/empiar_10025_subset/norm-amibox05-0.mrc", }, ] session_params = { "psize_A": 0.6575, "accel_kv": 300, "cs_mm": 2.7, "total_dose_e_per_A2": 53, "blob_diameter_min": 100, "blob_diameter_max": 200, "box_size_pix": 440, "bin_size_pix": 256, "output_f16": True, "extract_f16": True, } class2D_params = {"class2D_K": 20} # for ab initio 3D reconstruction abinit_params = {"abinit_K": 1, "abinit_num_particles": 9000} refine_params = {"refine_symmetry": "D7"} ``` -------------------------------- ### Create and Queue Template Picker Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Create a Template Picker job, connecting it to CTF estimation and selected templates. Queue the job and wait for its completion. ```python template_picker_job = workspace.create_job( "template_picker_gpu", connections={ "micrographs": (ctf_estimation_job.uid, "exposures"), "templates": (select_blob_templates_job.uid, "templates_selected"), }, params={"diameter": 200}, ) template_picker_job.queue(lane) template_picker_job.wait_for_done() ``` -------------------------------- ### Generate crYOLO Configuration File Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/cryolo.ipynb Uses 'job.subprocess' to run the 'cryolo_gui.py config' command, creating a crYOLO configuration file. Processes run locally, not on a remote CryoSPARC instance. Specify box size and input folders. ```python job.subprocess( ( "cryolo_gui.py config config_cryolo.json 130 --train_image_folder train_image --train_annot_folder train_annot" ).split(" "), cwd=job.dir, ) ``` -------------------------------- ### Deprecated Directory Methods Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/CHANGELOG.md The `project.dir()` and `job.dir()` methods are deprecated and will be removed. Use the `.dir` attribute instead. ```python project.dir job.dir ``` -------------------------------- ### Queue and Run Import Movies Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Submit the configured job to the queue using `queue()` and wait for its completion with `wait_for_done()`. The job status will be returned. ```python import_movies_job.queue(lane) import_movies_job.wait_for_done() ``` -------------------------------- ### Create and Configure Class3D Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/connect_series_to_class3D.ipynb Creates a 'class_3D' job, connecting it to the volumes imported in the previous step. It configures the number of frames and initialization mode based on the imported volumes. ```python no_of_frames = len(import_volumes_job.outputs) vol_outputs = [(import_volumes_job.uid, f"imported_volume_{v}") for v in range(1, no_of_frames + 1)] new_class_3D_job = workspace.create_job( "class_3D", connections={"volume": vol_outputs}, params={"class3D_N_K": no_of_frames, "class3D_init_mode": "input"}, ) ``` -------------------------------- ### Build Distribution Packages Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Build the distribution packages (e.g., wheels, sdists) for the cryosparc-tools package. The output will be in the `dist/` directory. ```sh python -m build ``` -------------------------------- ### Train crYOLO Model Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/cryolo.ipynb Run the crYOLO training script with specified parameters. Use `mute=True` to suppress output to the console, and `checkpoint=True` with a `checkpoint_line_pattern` to log checkpoints. ```python job.subprocess( "cryolo_train.py -c config_cryolo.json -w 5 -g 0 -e 15".split(" "), cwd=job.dir, mute=True, checkpoint=True, checkpoint_line_pattern=r"Epoch \d+/\d+", # e.g., "Epoch 42/200" ) ``` -------------------------------- ### Create an Import Movies Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Creates an 'import_movies' job within a specified workspace. This job requires parameters such as blob paths, gain reference path, pixel size, acceleration voltage, and total dose. Use `cs.print_job_types()` to discover available job keys. ```python job_sections = cs.print_job_types() import_movies_job = workspace.create_job( "import_movies", params={ "blob_paths": "/bulk5/data/EMPIAR/10025/data/empiar_10025_subset/*.tif", "gainref_path": "/bulk5/data/EMPIAR/10025/data/empiar_10025_subset/norm-amibox05-0.mrc", "psize_A": 0.6575, "accel_kv": 300, "cs_mm": 2.7, "total_dose_e_per_A2": 53, }, ) ``` -------------------------------- ### Create and Queue Blob Picker Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Create a Blob Picker job, connecting it to the output of a curation job. Queue the job and wait for its completion. ```python blob_picker_job = workspace.create_job( "blob_picker_gpu", connections={"micrographs": (curate_exposures_job.uid, "exposures_accepted")}, params={"diameter": 100, "diameter_max": 200}, ) blob_picker_job.queue(lane) blob_picker_job.wait_for_done() ``` -------------------------------- ### Link Micrographs for crYOLO Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/cryolo.ipynb Loads input micrographs and creates symbolic links in the 'full_data' and 'train_image' directories. Ensure the 'project.symlink' function is available and correctly configured. ```python all_micrographs = job.load_input("all_micrographs", ["micrograph_blob"]) train_micrographs = job.load_input("train_micrographs", ["micrograph_blob"]) for mic in all_micrographs.rows(): source = mic["micrograph_blob/path"] target = job.uid + "/full_data/" project.symlink(source, target) for mic in train_micrographs.rows(): source = mic["micrograph_blob/path"] target = job.uid + "/train_image/" project.symlink(source, target) ``` -------------------------------- ### Find a Project Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/jobs.ipynb Load a specific project to work within using its unique identifier. ```python project = cs.find_project("P75") ``` -------------------------------- ### Instantiate Specific Login in Python Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/cli.md When multiple logins are active, specify the desired login by providing the 'email' argument during CryoSPARC class instantiation. ```python from cryosparc.tools import CryoSPARC local_cs = CryoSPARC("http://localhost:39000", email="saara@example.com") remote_cs = CryoSPARC("https://cryosparc.example.com", email="suhail@example.com") ``` -------------------------------- ### Find Projects, Workspaces, and Jobs Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/CHANGELOG.md Utilize these methods to retrieve lists of Projects, Workspaces, and Jobs. Filters can be applied based on attributes like UID and creation date. ```python cs.find_projects() cs.find_workspaces() cs.find_jobs() ``` -------------------------------- ### Generate crYOLO Annotation STAR Files Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/cryolo.ipynb Loads training particle locations, splits them by micrograph, computes pixel coordinates, and saves them as STAR files in the 'train_annot/STAR' directory. Requires 'cryosparc.star' and 'numpy'. ```python from io import StringIO import numpy as np from cryosparc import star job.mkdir("train_annot/STAR") train_particles = job.load_input("train_particles", ["location"]) for micrograph_path, particles in train_particles.split_by("location/micrograph_path").items(): micrograph_name = micrograph_path.split("/")[-1] star_file_name = micrograph_name.rsplit(".", 1)[0] + ".star" mic_w = particles["location/micrograph_shape"][:, 1] mic_h = particles["location/micrograph_shape"][:, 0] center_x = particles["location/center_x_frac"] center_y = particles["location/center_y_frac"] location_x = center_x * mic_w location_y = center_y * mic_h outfile = StringIO() star.write( outfile, np.rec.array([location_x, location_y], names=["rlnCoordinateX", "rlnCoordinateY"]), ) outfile.seek(0) job.upload("train_annot/STAR/" + star_file_name, outfile) ``` -------------------------------- ### Login with Email and Password Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/cli.md Log in to CryoSPARC by providing credentials directly via the --email and --password flags, along with an optional --expires date. ```bash python -m cryosparc.tools login --url http://localhost:39000 \ --email "ali@example.com" \ --password "mysecretpassword" \ --expires 2026-12-31 ``` -------------------------------- ### Create and Interact with Inspect Picks Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Create an Inspect Picks job, connecting it to the output of the Blob Picker. Queue the job and interact with it to set thresholds before shutting down the interactive session. ```python inspect_blob_picks_job = workspace.create_job( "inspect_picks_v2", connections={ "micrographs": (blob_picker_job.uid, "micrographs"), "particles": (blob_picker_job.uid, "particles"), }, ) spect_blob_picks_job.queue() spect_blob_picks_job.wait_for_status("waiting") spect_blob_picks_job.interact( "set_thresholds", {"ncc_score_thresh": 0.3, "lpower_thresh_min": 600, "lpower_thresh_max": 1000}, ) spect_blob_picks_job.interact("shutdown_interactive") spect_blob_picks_job.wait_for_done() ``` -------------------------------- ### Format Code with Ruff Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/CONTRIBUTING.md Apply the project's required code formatting using the ruff formatter. This command ensures consistency across the codebase. ```bash ruff format . ``` -------------------------------- ### Download CryoSPARC Dataset Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/jobs.ipynb Use `job.download_dataset()` to load a raw .cs dataset file from the job directory. The dataset will be displayed as a table in Jupyter. ```python particles = job.download_dataset("extracted_particles.cs") particles ``` -------------------------------- ### Login to CryoSPARC Instance Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/cli.md Log in to a CryoSPARC instance using its URL. This command saves a login token for subsequent script authentication. ```bash python -m cryosparc.tools login --url ``` -------------------------------- ### Select Project and Find Directory Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/delete-rejected-exposures.ipynb Finds a specific CryoSPARC project by its ID and retrieves its directory path. This is necessary for locating associated data files. ```python from pathlib import Path project = cs.find_project("P251") project_dir = Path(project.dir) ``` -------------------------------- ### Create and Queue Curate Exposures Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Build and queue a Curate Exposures job, connecting it to the CTF estimation job. Wait for the job to reach the 'waiting' status, indicating it's ready for interaction. ```python curate_exposures_job = workspace.create_job( "curate_exposures_v2", connections={"exposures": (ctf_estimation_job.uid, "exposures")}, ) curate_exposures_job.queue() curate_exposures_job.wait_for_status("waiting") ``` -------------------------------- ### Create and Queue Motion Correction and CTF Estimation Jobs Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Use this to create and queue Patch Motion Correction and Patch CTF Estimation jobs, connecting them to the Import Movies job. Ensure the CryoSPARC scheduler handles their execution. ```python motion_correction_job = workspace.create_job( "patch_motion_correction_multi", connections={"movies": (import_movies_job.uid, "imported_movies")}, params={"compute_num_gpus": 2}, ) ctf_estimation_job = workspace.create_job( "patch_ctf_estimation_multi", connections={"exposures": (motion_correction_job.uid, "micrographs")}, params={"compute_num_gpus": 2}, ) motion_correction_job.queue(lane) ctf_estimation_job.queue(lane) motion_correction_job.wait_for_done(), ctf_estimation_job.wait_for_done() ``` -------------------------------- ### Preview 2D Classes - Dataset 1 Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/magnification.ipynb Loads and displays selected 2D class templates from the first dataset. This helps in visually comparing magnification differences. Ensure the job ID is correct. ```python %matplotlib inline import matplotlib.pyplot as plt select2d_job_1 = project.find_job("J38") templates_1 = select2d_job_1.load_output("templates_selected") unique_mrc_paths_1 = set(templates_1["blob/path"]) all_templates_blobs_1 = {path: project.download_mrc(path)[1] for path in unique_mrc_paths_1} fig = plt.figure(figsize=(6, len(templates_1) // 6), dpi=150) plt.margins(x=0, y=0) for i, template in enumerate(templates_1.rows()): path = template["blob/path"] index = template["blob/idx"] blob = all_templates_blobs_1[path][index] plt.subplot(len(templates_1) // 6, 6, i + 1) plt.axis("off") plt.imshow(blob, cmap="gray", origin="lower") fig.tight_layout(pad=0, h_pad=0.4, w_pad=0.4) ``` -------------------------------- ### Target Hostname Listing (OLD) Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/CHANGELOG.md This shows the old method of accessing target hostnames, which returned dictionaries. ```python cs.get_targets()[0]['hostname'] ``` -------------------------------- ### Inspect Import Movies Job Parameters Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Use `print_param_spec()` to view available parameter keys, their titles, types, and default values for a job. This is useful for understanding how to configure a job. ```python import_movies_job.print_param_spec() ``` -------------------------------- ### Activate Virtual Environment (Windows) Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Activate the Python virtual environment for development. This command is for Windows systems. ```sh .venv\Scripts\activate.bat # Windows ``` -------------------------------- ### Queueing Template Picking Jobs Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Queue jobs for inspecting, extracting, and selecting template picks. Ensure necessary parameters like 'lane' are provided when required. ```python inspect_template_picks_job.queue() extract_template_picks_job.queue(lane) classify_template_picks_job.queue(lane) select_templates_job.queue() ``` -------------------------------- ### Create a New Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/jobs.ipynb Create a new job within a specified workspace and with a given job type. The status of the newly created job is returned. ```python job = project.create_job("W40", "extract_micrographs_cpu_parallel") job.uid, job.status ``` -------------------------------- ### Activate Virtual Environment (macOS/Linux) Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/README.md Activate the Python virtual environment for development. This command is for macOS and Linux systems. ```sh source .venv/bin/activate # macOS / Linux ``` -------------------------------- ### Accessing Target Hostnames (NEW) Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/CHANGELOG.md Access target hostnames using dot notation on the returned model objects. Some top-level attributes are now nested under '.config'. ```python cs.get_targets()[0].hostname ``` -------------------------------- ### Load Particles Dataset Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/3dflex-custom-latent-trajectory.ipynb Loads the particle dataset from a specified 3D Flex Training job (J243) within a project (P312). Requires pandas for data manipulation. ```python import pandas as pd project = cs.find_project("P312") particles = project.find_job("J243").load_output("particles") ``` -------------------------------- ### Create and Interact with Select 2D Classes Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Create a Select 2D job, connecting it to the 2D Classification output. Queue the job, wait for it to become interactive, automatically select classes based on criteria, and then finish the interaction. ```python select_blob_templates_job = workspace.create_job( "select_2D", connections={ "particles": (classify_blob_picks_job.uid, "particles"), "templates": (classify_blob_picks_job.uid, "class_averages"), }, ) select_blob_templates_job.queue() select_blob_templates_job.wait_for_status("waiting") # Auto-interact class_info = select_blob_templates_job.interact("get_class_info") for c in class_info: if 1.0 < c["res_A"] < 19.0 and c["num_particles_total"] > 900: select_blob_templates_job.interact( "set_class_selected", { "class_idx": c["class_idx"], "selected": True, }, ) select_blob_templates_job.interact("finish") select_blob_templates_job.wait_for_done() ``` -------------------------------- ### Load Input/Output Slots Argument Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/CHANGELOG.md The `slots` argument for `job.load_input()` and `job.load_output()` now accepts keywords like 'default', 'passthrough', and 'all'. ```python job.load_input(slots="default") job.load_output(slots="passthrough") job.load_output(slots="all") ``` -------------------------------- ### List Job Files Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/jobs.ipynb Retrieve a list of all files within a job's directory. Specify a subfolder to list files in a specific directory. ```python job.list_files() ``` ```python extracted = job.list_files("extract") extracted[0] ``` -------------------------------- ### Connect Job Outputs to Inputs Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/jobs.ipynb Use the `job.connect()` function to link outputs from a parent job to the inputs of the current job. Ensure the `target_input` and `source_output` parameters correctly identify the desired connections. ```python job.connect( target_input="micrographs", source_job_uid=parent_job.uid, source_output="micrographs", ) job.connect( target_input="particles", source_job_uid=parent_job.uid, source_output="particles", ) ``` -------------------------------- ### Create Job Chain for Template Picking Workflow Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Define a chain of jobs for template picking, including Inspect Picks, Extract Micrographs, 2D Classification, and Select 2D Classes, with appropriate connections. ```python # Create and connect jobs inspect_template_picks_job = workspace.create_job( "inspect_picks_v2", connections={ "micrographs": (template_picker_job.uid, "micrographs"), "particles": (template_picker_job.uid, "particles"), }, ) extract_template_picks_job = workspace.create_job( "extract_micrographs_cpu_parallel", connections={ "micrographs": (inspect_template_picks_job.uid, "micrographs"), "particles": (inspect_template_picks_job.uid, "particles"), }, params={"box_size_pix": 448}, ) classify_template_picks_job = workspace.create_job( "class_2D", connections={"particles": (extract_template_picks_job.uid, "particles")}, params={"class2D_K": 50}, ) select_templates_job = workspace.create_job( "select_2D", connections={ "particles": (classify_template_picks_job.uid, "particles"), "templates": (classify_template_picks_job.uid, "class_averages"), }, ) ``` -------------------------------- ### Print Job Input Specification Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/guides/jobs.ipynb Use this to display a table of available input requirements for a given job. This helps in understanding what data types and slots are needed for a job to run. ```python job.print_input_spec() ``` -------------------------------- ### Import Plotting Utilities Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/recenter-particles.ipynb Imports necessary libraries for plotting, including matplotlib for visualization and cryosparc.tools for image processing utilities like downsampling and low-pass filtering. ```python %matplotlib inline import matplotlib.pyplot as plt import numpy as np from cryosparc.tools import downsample, lowpass2 ``` -------------------------------- ### Predict Particle Locations with crYOLO Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/cryolo.ipynb Use a trained crYOLO model to predict particle locations. Ensure the output directory for boxfiles is created beforehand. `mute=True` hides console output, and `checkpoint=True` enables checkpointing. ```python job.mkdir("boxfiles") job.subprocess( "cryolo_predict.py -c config_cryolo.json -w cryolo_model.h5 -i full_data -g 0 -o boxfiles -t 0.3".split(" "), cwd=job.dir, mute=True, checkpoint=True, ) ``` -------------------------------- ### Download and Prepare Template Blobs Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/hi-res-2d-classes.ipynb Downloads the MRC template image data from unique paths and organizes them into a dictionary. This step is necessary to access the image data for plotting. ```python unique_mrc_paths = set(templates_selected["blob/path"]) all_templates_blobs = {path: project.download_mrc(path)[1] for path in unique_mrc_paths} ``` -------------------------------- ### Run Pytest for Testing Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/CONTRIBUTING.md Execute the built-in pytest tests to ensure your changes are functioning correctly. Include additional tests if appropriate for your changes. ```bash pytest ``` -------------------------------- ### Visualize New Rigidity Weights Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/3dflex-custom-mesh-rigidity-weights.ipynb Displays a slice of the newly computed rigidity weights, showing the effect of the custom weighting scheme. ```python plot_slice(map_rweights_new) ``` -------------------------------- ### Query Micrographs from a Motion Correction Job Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/intro.md This Python code snippet demonstrates how to find a project, then a specific job, and load the 'micrographs' output to print the path of each micrograph. This assumes an active connection to the CryoSPARC instance. ```python project = cs.find_project("P3") job = project.find_job("J42") micrographs = job.load_output("micrographs") for mic in micrographs.rows(): print(mic["micrograph_blob/path"]) ``` -------------------------------- ### Preview 2D Classes - Dataset 2 Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/magnification.ipynb Loads and displays selected 2D class templates from the second dataset. This is used for comparison with the first dataset's classes to observe magnification differences. Verify the job ID. ```python select2d_job_2 = project.find_job("J39") templates_2 = select2d_job_2.load_output("templates_selected") unique_mrc_paths_2 = set(templates_2["blob/path"]) all_templates_blobs_2 = {path: project.download_mrc(path)[1] for path in unique_mrc_paths_2} fig = plt.figure(figsize=(6, len(templates_2) // 6), dpi=150) plt.margins(x=0, y=0) for i, template in enumerate(templates_2.rows()): path = template["blob/path"] index = template["blob/idx"] blob = all_templates_blobs_2[path][index] plt.subplot(len(templates_2) // 6, 6, i + 1) plt.axis("off") plt.imshow(blob, cmap="gray", origin="lower") fig.tight_layout(pad=0, h_pad=0.4, w_pad=0.4) ``` -------------------------------- ### Selecting 2D Classes Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/docs/examples/custom-workflow.ipynb Retrieve class information from the 'select_templates_job', then iterate to select classes based on resolution and particle count criteria before finishing the job. ```python select_templates_job.wait_for_status("waiting") class_info = select_templates_job.interact("get_class_info") for c in class_info: if 1.0 < c["res_A"] < 19.0 and c["num_particles_total"] > 100: select_templates_job.interact( "set_class_selected", { "class_idx": c["class_idx"], "selected": True, }, ) select_templates_job.interact("finish") select_templates_job.wait_for_done() ``` -------------------------------- ### Accessing Asset Filenames (NEW) Source: https://github.com/cryoem-uoft/cryosparc-tools/blob/develop/CHANGELOG.md Access filenames from the list of assets using dot notation on the returned model objects. ```python job.list_assets()[0].filename ```