cryosparc2.utils module

cryosparc2.utils.addComputeSectionParams(form, allowMultipleGPUs=True)[source]

Add the compute settings section

cryosparc2.utils.addSymmetryParam(form, help='')[source]

Add the symmetry param with the conventions :param form: :return:

cryosparc2.utils.calculateNewSamplingRate(newDims, previousSR, previousDims)[source]
  • newDims

  • previousSR

  • previousDims


cryosparc2.utils.clearIntermediateResults(projectName, job, wait=3)[source]

Clear the intermediate result from a specific Job

  • projectName – the uid of the project that contains the job to clear

  • job – the uid of the job to clear

cryosparc2.utils.clearJob(projectName, job)[source]

Clear a Job (if queued) to get it back to building state (do not clear params or inputs)

  • projectName – the uid of the project that contains the job to clear

  • job – the uid of the job to clear

** IMPORTANT: This method can be launch only if the job is queued

cryosparc2.utils.copyFiles(src, dst, files=None)[source]

Copy a list of files from src to dst. If files is None, all files of src are copied to dst :param src: source folder path :param dst: destiny folder path :param files: a list of files to be copied :return:

cryosparc2.utils.createEmptyProject(projectDir, projectTitle)[source]
create_empty_project(owner_user_id, project_container_dir, title=None,


cryosparc2.utils.createEmptyWorkSpace(projectName, workspaceTitle, workspaceComment)[source]
create_empty_workspace(project_uid, created_by_user_id,

created_by_job_uid=None, title=None, desc=None)

returns the new uid of the workspace that was created

Given a “root” directory, create a project (PXXX) dir if it doesn’t already



project_container_dir – the “root” directory in which to create the project (PXXX) directory


str - the final path of the new project dir with shell variables still in the returned path (the path should be expanded every time it is used)


Determine if scipion can find cryosparc :returns True if found, False otherwise


Validates some cryo properties that must be satisfy

do_import_particles_star(puid, wuid, uuid, abs_star_path,

abs_blob_path=None, psize_A=None)

returns the new uid of the job that was created

cryosparc2.utils.doImportVolumes(protocol, refVolumePath, refVolume, volType, msg)[source]

cryosparc2.utils.doJob(jobType, projectName, workSpaceName, params, input_group_connect)[source]
do_job(job_type, puid=’P1’, wuid=’W1’, uuid=’devuser’, params={},


cryosparc2.utils.enqueueJob(jobType, projectName, workSpaceName, params, input_group_connect, lane, gpusToUse=False, group_connect=None, result_connect=None)[source]
make_job(job_type, project_uid, workspace_uid, user_id,

created_by_job_uid=None, params={}, input_group_connects={})


paths – accept a string or a list of strings



Get the root directory where cryoSPARC code and dependencies are installed.


Get the cryosparc environment information


Get the cryosparc program to launch any command


Get the path on the worker node to a writable directory


Get the full name of the initial admin account


Gets cryosparc version 1st, from a variable if populated, 2nd from the version txt file, if fails, asks CS using getCryosparcEnvInformation

cryosparc2.utils.getJobLog(projectDirName, projectName, job)[source]

Return the job log

cryosparc2.utils.getJobStatus(projectName, job)[source]

Return the job status


returns the name of the cryosparc project based on scipion project name and a hash based on the user name


Gets all projects of given path . projectDir: Folder path to get sub folders. returns: Set with all sub folders.

cryosparc2.utils.getSymmetry(symmetryGroup, symmetryOrder)[source]

Get the symmetry(string) taking into account the symmetry convention


Returns system-related information related to the cryosparc app :returns: dict – dictionary listing information about cryosparc environment {

‘master_hostname’ : master_hostname, ‘port_webapp’ : os.environ[‘CRYOSPARC_HTTP_PORT’], ‘port_mongo’ : os.environ[‘CRYOSPARC_MONGO_PORT’], ‘port_command_core’ : os.environ[‘CRYOSPARC_COMMAND_CORE_PORT’], ‘port_command_vis’ : os.environ[‘CRYOSPARC_COMMAND_VIS_PORT’], ‘port_command_proxy’ : os.environ[‘CRYOSPARC_COMMAND_PROXY_PORT’], ‘port_command_rtp’ : os.environ[‘CRYOSPARC_COMMAND_RTP_PORT’], ‘port_rtp_webapp’ : os.environ[‘CRYOSPARC_HTTP_RTP_PORT’], ‘version’ : get_running_version(),


cryosparc2.utils.get_job_streamlog(projectName, job, fileName)[source]
cryosparc2.utils.gpusValidate(gpuList, checkSingleGPU=False)[source]

Validate a gpu list


Determine if cryosparc services are running :returns True if running, false otherwise

cryosparc2.utils.killJob(projectName, job)[source]

Kill a Job (if running)

  • projectName – the uid of the project that contains the job to kill

  • job – the uid of the job to kill

cryosparc2.utils.runCmd(cmd, printCmd=True)[source]

Runs a command and check its exit code. If different than 0 it raises an exception :parameter cmd command to run :parameter printCmd (default True) prints the command

cryosparc2.utils.waitForCryosparc(projectName, jobId, failureMessage)[source]

Waits for cryosparc to finish or fail a job :parameter projectName: Cryosparc project name :parameter jobId: cryosparc job id :parameter failureMessage: Message for the exception thrown in case job fails :returns job Status :raises Exception when parsing cryosparc’s output looks wrong

cryosparc2.utils.waitJob(projectName, job)[source]

Wait while the job not finished