spec#

Specification for various utility types used throughout tools and CryoSPARC.

Classes:

Datafield

Deprecated.

JobSection

Deprecated.

Slot

Full slot dictionary specification type for items in the slots=.

AnyContentType(*args, **kwargs)#

All known and supported content types used by CryoSPARC.

alias of Literal[‘text/plain’, ‘text/csv’, ‘text/html’, ‘application/json’, ‘application/xml’, ‘application/x-troff’] | Literal[‘application/pdf’, ‘image/gif’, ‘image/jpeg’, ‘image/png’, ‘image/svg+xml’] | Literal[‘image/x-mrc’, ‘image/tiff’, ‘application/x-eer’, ‘application/x-bzip2’] | Literal[‘application/x-cryosparc-dataset’, ‘application/x-numpy’] | Literal[‘application/octet-stream’]

AnyFormat(*args, **kwargs)#

Supported file extensions.

alias of Literal[‘txt’, ‘csv’, ‘html’, ‘json’, ‘xml’, ‘bild’, ‘bld’, ‘log’] | Literal[‘pdf’, ‘gif’, ‘jpg’, ‘jpeg’, ‘png’, ‘svg’] | Literal[‘mrc’, ‘mrcs’, ‘stk’, ‘tif’, ‘tiff’, ‘eer’, ‘ecc’, ‘bz2’, ‘cmrcbz2’] | Literal[‘cs’, ‘npy’]

AssetContentType(*args, **kwargs)#

Supported job asset MIME types.

alias of Literal[‘text/plain’, ‘text/csv’, ‘text/html’, ‘application/json’, ‘application/xml’, ‘application/x-troff’] | Literal[‘application/pdf’, ‘image/gif’, ‘image/jpeg’, ‘image/png’, ‘image/svg+xml’] | Literal[‘application/octet-stream’]

AssetFormat(*args, **kwargs)#

Supported job stream log asset file formats.

alias of Literal[‘txt’, ‘csv’, ‘html’, ‘json’, ‘xml’, ‘bild’, ‘bld’, ‘log’] | Literal[‘pdf’, ‘gif’, ‘jpg’, ‘jpeg’, ‘png’, ‘svg’]

DType(*args, **kwargs)#

Can just be a single string such as “f4”, “3u4” or “O”. A datatype description of a ndarray entry.

Can also be the a tuple with a string datatype name and its shape. For example, the following dtypes are equivalent.

  • “3u4”

  • “<u4”, (3,))

alias of str | Tuple[str, Tuple[int, …]]

class Datafield#

Deprecated. Use Slot instead.

DatasetContentType(*args, **kwargs)#

Supported content types for dataset files.

alias of Literal[‘application/x-cryosparc-dataset’, ‘application/x-numpy’]

DatasetFormat(*args, **kwargs)#

Supported extensions for dataset files.

alias of Literal[‘cs’, ‘npy’]

Datatype(*args, **kwargs)#

Supported data types for job inputs and outputs.

alias of Literal[‘exposure’, ‘particle’, ‘template’, ‘volume’, ‘volume_multi’, ‘mask’, ‘live’, ‘ml_model’, ‘symmetry_candidate’, ‘flex_mesh’, ‘flex_model’, ‘hyperparameter’, ‘denoise_model’, ‘annotation_model’]

Field(*args, **kwargs)#

Description of a column in a numpy array with named fields

Examples: - (“uid”, “u8”) - (“coords”, “3f4”) - (“coords”, “<f4”, (3,))

alias of Tuple[str, str] | Tuple[str, str, Tuple[int, …]]

ImageContentType(*args, **kwargs)#

Supported job image asset MIME types renderable in the web

alias of Literal[‘application/pdf’, ‘image/gif’, ‘image/jpeg’, ‘image/png’, ‘image/svg+xml’]

ImageFormat(*args, **kwargs)#

Supported job stream log asset file image formats.

alias of Literal[‘pdf’, ‘gif’, ‘jpg’, ‘jpeg’, ‘png’, ‘svg’]

class JobSection#

Deprecated. Use JobRegister instead.

LoadableSlots(*args, **kwargs)#

Types of slots that may be included when loading an input or an output. “default” means only slots required as inputs or newly-generated by outputs. “passthrough” means only unused passthroughs for inputs/outputs. “all” means the previous two combined. list means a specific list of slots.

alias of Literal[‘default’, ‘passthrough’, ‘all’] | List[str]

MicrographContentType(*args, **kwargs)#

Supported micrograph content types.

alias of Literal[‘image/x-mrc’, ‘image/tiff’, ‘application/x-eer’, ‘application/x-bzip2’]

MicrographFormat(*args, **kwargs)#

Supported micrograph extensions.

alias of Literal[‘mrc’, ‘mrcs’, ‘stk’, ‘tif’, ‘tiff’, ‘eer’, ‘ecc’, ‘bz2’, ‘cmrcbz2’]

Shape(*args, **kwargs)#

A numpy shape tuple from ndarray.shape

alias of Tuple[int, …]

class Slot#

Full slot dictionary specification type for items in the slots=… argument when creating inputs or outputs. e.g., {"name": "ctf", "dtype": "ctf"} or {"name": "background_blob", "dtype": "stat_blob", "required": False}

See SlotSpec for details.

name#

where to find field in a corresponding .cs file e.g., "background_blob", "ctf", "alignments_class_0"

Type:

str

dtype#

name of known data type. e.g., "stat_blob", "ctf", "alignments3D".

Type:

str

required#

Whether this slot is required. Applies to input specs only. Defaults to True.

Type:

bool, optional

SlotSpec(*args, **kwargs)#

A result slot specification for items in the slots=… argument when creating inputs or outputs.

In CryoSPARC, all jobs have one or more inputs and outputs. An input or output has some broad Datatype, such as "exposure" or "particle". Each input or output also has a list of associated “low-level” results created at various stages of processing, such as "location" for picked particles and blob for extracted particles. A slot represents one of these low-level results.

In the CryoSPARC interface, open a job’s “Inputs” or “Outputs” tab to see the kinds of slots available. You may also download an output and load it with Dataset to inspect the infomation encoded in its results.

Provide each slot as either a string representing a name and result type, or a full dictionary specification.

A string in the format "<slot>" is a shortcut for {"name": "<slot>", "dtype": "<known slot type>", "required": True}.

A string in the format "?<slot>" is a shortcut for {"name": "<slot>", "dtype": "<known slot type>", "required": False} (input slots only).

Example strings:

"ctf"
"micrograph_blob"
"?background_blob"

Example equivalent full specifications:

{"name": "ctf", "dtype": "ctf"}
{"name": "micrograph_blob", "dtype": "micrograph_blob", "required": True}
{"name": "background_blob", "dtype": "stat_blob", "required": False}

Use the full specification when the dtype cannot be inferred from the name string because it is dynamic. For example, 3D Variability job particles outputs have slots named "components_mode_X" with dtype "components" where X is a mode number:

[
    "blob",
    "?locations",
    {"name": "components_mode_0", "dtype": "components"},
    {"name": "components_mode_1", "dtype": "components", "required": False},
    {"name": "components_mode_2", "dtype": "components", "required": False},
]

Note that the required key only applies to input slots.

alias of str | Slot | Datafield

TextContentType(*args, **kwargs)#

Supported job stream log text asset MIME types.

alias of Literal[‘text/plain’, ‘text/csv’, ‘text/html’, ‘application/json’, ‘application/xml’, ‘application/x-troff’]

TextFormat(*args, **kwargs)#

Supported job stream log asset file text formats.

alias of Literal[‘txt’, ‘csv’, ‘html’, ‘json’, ‘xml’, ‘bild’, ‘bld’, ‘log’]