Skip to main content
The Client class is your entry point to the Atomscale API. It provides methods for searching the catalogue, fetching analysis results, querying RHEED features and masks, running similarity queries, uploading files, and downloading raw or processed data.

Constructor

str | None
default:"None"
API key for authentication. If not provided, reads from the AS_API_KEY environment variable.
str
default:"https://api.atomscale.ai/"
Root API endpoint. Can be overridden with the AS_API_ENDPOINT environment variable.
bool
default:"False"
Whether to suppress progress bars. Set to True for non-interactive environments like CI pipelines.

Search and filter items in the data catalogue.

Parameters

str | list[str] | None
default:"None"
Keyword or list of keywords to search all catalogue fields. Applied after other explicit filters.
bool
default:"True"
Whether to include catalogue entries from other users in your organization.
str | list[str] | None
default:"None"
Filter to specific data IDs.
str | list[str] | None
default:"None"
Filter by physical sample IDs.
str | list[str] | None
default:"None"
Filter by project IDs.
str
default:"all"
Filter by data type.
str
default:"all"
Filter by pipeline status.
tuple[int | None, int | None]
default:"(None, None)"
Filter by growth length in seconds. Tuple of (min, max) with None for open bounds.
tuple[datetime | None, datetime | None]
default:"(None, None)"
Filter by upload timestamp. Tuple of (min, max) with None for open bounds.
tuple[datetime | None, datetime | None]
default:"(None, None)"
Filter by last updated timestamp. Tuple of (min, max) with None for open bounds.
tuple[datetime | None, datetime | None] | None
default:"None"
deprecated
Deprecated alias for last_updated. Passing it emits a warning and will stop working in a future release.

Returns

pandas.DataFrame
DataFrame with columns:

Example


get()

Fetch analysis results for one or more data IDs.

Parameters

str | list[str]
required
Data ID or list of data IDs from the catalogue.

Returns

list[RHEEDVideoResult | RHEEDImageResult | XPSResult | XRDResult | PhotoluminescenceResult | RamanResult | MetrologyResult | OpticalResult | EllipsometryResult | UnknownResult]
List of result objects. The type depends on the source data:RHEEDVideoResult (for rheed_stationary, rheed_rotating):
  • timeseries_data - DataFrame with per-frame metrics, indexed against Time
  • snapshot_image_data - List of extracted frame snapshots
  • rotating - Whether the video was taken of a rotating stage
For the full low-level feature set, per-frame masks, or a time window, use get_rheed_timeseries() instead.RHEEDImageResult (for rheed_image):
  • processed_image - Processed image as a PIL Image
  • mask - Binary segmentation mask (numpy array)
  • pattern_graph - NetworkX graph of the diffraction pattern
  • get_pattern_dataframe() - Tidy table of spot positions (params: extra_data, symmetrize, return_as_features)
  • get_laue_zero_radius() - Best-fit radius and center of the zeroth order Laue zone
  • get_plot() - PIL Image with overlays (params: show_mask, show_spot_nodes, symmetrize, alpha)
XPSResult (for xps):
  • binding_energies - Array of binding energy values
  • intensities - Array of intensity values
  • predicted_composition - Dict mapping element symbols to fractional composition
  • detected_peaks - Detected peak positions
  • get_plot() - Matplotlib figure
XRDResult (for xrd):
  • two_theta - 2-theta angle values, in the unit given by two_theta_unit
  • intensities - Intensity values aligned with two_theta
  • detected_peaks - Peak dicts with two_theta, intensity, d_spacing_angstrom, prominence, and fwhm_degrees
  • wavelength_angstrom - Source wavelength (default Cu Kα, 1.5406)
  • get_plot() - Matplotlib figure
PhotoluminescenceResult (for photoluminescence):
  • energies - Energy axis values
  • intensities - Intensity values
  • detected_peaks - Peak labels and positions
  • get_plot() - Matplotlib figure
RamanResult (for raman):
  • raman_shift - Raman shift axis values
  • intensities - Intensity values
  • detected_peaks - Peak labels and positions
  • get_plot() - Matplotlib figure
MetrologyResult (for metrology/instrument data):
  • timeseries_data - DataFrame with instrument readings (pyrometer, pressure, etc.)
OpticalResult (for optical imaging):
  • timeseries_data - DataFrame with per-frame metrics (edge perimeter, circularity, etc.)
  • snapshot_image_data - List of OpticalImageResult snapshots, each with a processed_image
EllipsometryResult (for ellipsometry):
  • timeseries_data - DataFrame with per-wavelength channels (psi_<λ>, delta_<λ>, depol_<λ>, incidentI_<λ>) and scalar fits such as thickness
UnknownResult (fallback for unsupported types):
  • data_type - Type string
  • catalogue_entry - Raw catalogue metadata

Example


get_rheed_timeseries()

Fetch the RHEED feature timeseries for a data entry. Unlike get(), which returns only the standard feature set, this method can also return the full set of low-level features, attach per-frame segmentation masks, and filter which points come back.

Parameters

str
required
Data ID of the RHEED video.
list[str] | None
default:"None"
Restrict the result to these feature names. These are the underlying property names (for example specular_intensity, referenced_strain), which differ from the display column names in the returned DataFrame. None returns the standard set.
bool
default:"False"
Include the full set of low-level per-point features as additional columns. These keep their raw backend names, and nested values are flattened into dotted column paths.
bool
default:"False"
Fetch the per-frame segmentation masks (see get_frame_masks()) and attach them as mask_rle, mask_height, and mask_width columns, joined on the Frame Number axis. Only masks for the frames the returned series spans are fetched, so this respects any last_n or elapsed_seconds window.
int | None
default:"None"
Only return the last N points.
float | None
default:"None"
Only return points within the last elapsed_seconds of the recording.

Returns

pandas.DataFrame
The RHEED timeseries, indexed by ["Angle", "Frame Number"] when both axes are available. Low-level feature columns appear when include_low_level_features=True, and mask columns when include_masks=True.Mask coverage is sparse: masks exist only for featurized frames, so rows without a mask contain NA in the mask columns, as do all rows when the video has no mask artifact.

Example


get_frame()

Fetch a single extracted RHEED frame as a RHEEDImageResult.

Parameters

str
required
Data ID of the RHEED video.
int
default:"0"
Index into the video’s extracted-frame list. Negative indexing is supported, so -1 returns the last extracted frame.

Returns

RHEEDImageResult | None
The frame’s image result, or None when the video has no extracted frames, frame_index is out of range, or the selected frame has no image.

get_frame_masks()

Fetch per-frame RHEED segmentation masks for a processed video. Each featurized frame carries a binary mask of the diffraction pattern, encoded as a COCO run-length-encoding (RLE) counts string.

Parameters

str
required
Data ID of the RHEED video, the same ID used for the video and timeseries.
int
default:"0"
First absolute frame number to fetch, inclusive. Must be >= 0.
int | None
default:"None"
Last absolute frame number to fetch, inclusive. None fetches every featurized frame from from_frame to the end of the video.
bool
default:"False"
When True, decode each RLE mask into an (H, W) uint8 array and return a dict keyed by frame number. When False, return the raw rows with the RLE string intact.

Returns

list[dict] | dict[int, NDArray]
With decode=False, a list of row dicts each containing data_id, processed_data_id, frame_number, mask_rle, mask_height, and mask_width. With decode=True, a dict of {frame_number: ndarray} holding (H, W) uint8 masks with values 0 or 1.Returns an empty list or dict when the video has no per-frame mask artifact.
frame_number is the absolute frame index, keyed identically to the processed video frames and the Frame Number axis of the timeseries. Coverage is sparse: for stationary videos every frame is featurized, but for rotating and per-azimuth videos only a sampled subset is, so returned frame numbers are not necessarily contiguous.

Example


get_changepoints()

Get changepoint detection records for one or more data IDs.

Parameters

str | list[str]
required
Data ID or list of data IDs from the catalogue.
bool
default:"True"
Return only changepoints from the most recently completed detection run for each (data_id, detection_method) pair. Pass False for every historical run.
str | None
default:"intensity_profile"
Filter to a single detection method: forecasting, clustering, or intensity_profile. Pass None to include all methods.
str | None
default:"critical"
Filter to a single severity level: info, warning, or critical. Pass None to include all severities.
bool
default:"True"
Return a DataFrame. Pass False for a list of ChangepointResult objects.

Returns

DataFrame | list[ChangepointResult]
Changepoint records matching the filters. Each record carries:
  • id - Unique ID of the changepoint record
  • data_id - Data ID the changepoint was detected on
  • data_modality - Modality it was detected in (for example rheed_stationary)
  • property_name - Property or channel the changepoint was detected on
  • severity - info, warning, or critical
  • score - Normalized changepoint score in [0, 1]
  • window_start_elapsed / window_end_elapsed - Window bounds in seconds from the start of the timeseries
  • detection_method - forecasting, clustering, or intensity_profile
  • detail - Method-specific detail dict
  • label - Applied category label, if any
See Changepoint Detection for how the methods differ and when each fires.

get_similarity_trajectory()

Fetch a one-shot similarity trajectory for a data ID or physical sample ID.

Parameters

str
required
Data ID or physical sample ID the trajectory is computed against.
str
default:"rheed_stationary"
Similarity workflow name.
int | None
default:"None"
Only fetch the last N points of the trajectory.
float | None
default:"None"
Window span in seconds, forwarded to the provider.
list[str] | None
default:"None"
Reference data IDs to compare against.
str | None
default:"None"
Softmax mode forwarded to the provider.
int | None
default:"None"
Number of reference values forwarded to the provider.

Returns

SimilarityTrajectoryResult
Result object with attributes:
  • source_id - The queried source ID
  • workflow - Workflow name used
  • window_span - Window length in seconds
  • source_data_ids - Source data IDs included in the trajectory
  • timeseries_data - DataFrame indexed by ("Reference ID", "Time") with columns Similarity, Reference Name, UNIX Timestamp, Active, and Averaged Count

get_embeddings()

Fetch similarity embedding vectors for a data entry.

Parameters

str
required
Data ID to fetch embeddings for.
str
default:"rheed_stationary"
Similarity workflow name.
float
default:"60.0"
Window span in seconds.
str
default:"window"
window for one time-resolved vector per window, or prototype for a small set of representative vectors.
int
default:"0"
Number of leading vectors to skip.
int | None
default:"None"
Maximum number of vectors to return. None returns all available vectors.

Returns

EmbeddingsResult
Result object with attributes:
  • vectors - (n_returned, dimension) array of embedding vectors
  • dimension - Length of each vector, 0 when the result is empty
  • count - Total vectors available before offset and limit
  • truncated - True when more vectors are available than were returned
  • offset - Number of leading vectors skipped
  • real_times / unix_times_ms - Timing arrays, for kind="window"
  • cluster_sizes - Windows summarized per vector, for kind="prototype"
Metadata arrays that do not apply to the returned kind are None.
When no embeddings exist for the requested workflow and window span, the SDK emits a UserWarning and returns an empty result rather than raising, so loops over many IDs keep running.

query_rheed_embeddings()

Find RHEED data items whose embeddings are most similar to a given item. Runs k-nearest-neighbour search over the embedding index using the item’s own vectors.

Parameters

str
required
Data ID whose vectors seed the query.
str
default:"rheed_stationary"
Similarity workflow name.
float
default:"60.0"
Embedding window span in seconds. Must match a span the data was embedded at.
str
default:"prototype"
prototype for a coarse query, or window for a finer query with more lookups.
int
default:"10"
Maximum neighbours to return. The backend caps this at 30.

Returns

pandas.DataFrame
Columns data_id and similarity (1 = identical), plus the locus columns source_index, neighbor_index, real_time_seconds, and unix_time_ms, sorted by descending similarity. Empty when the item has no embeddings for the given workflow and window span.

get_similarity_matches()

Fetch the top stored similarity matches for a source entry.

Parameters

str
required
Data ID or physical sample ID to find matches for.
str
default:"rheed_stationary"
Similarity workflow name.
float
default:"60.0"
Window span in seconds.
bool
default:"False"
Also include the source entry’s most recent, still-streaming data in the comparison.
int | None
default:"None"
Maximum number of matches to return. None uses the server default.

Returns

pandas.DataFrame
Columns data_id, item_name, and similarity, one row per match. Empty with those columns when there are no matches or the source is not found.

Trajectory polling wrappers

Four Client methods wrap the polling functions in atomscale.similarity so you can poll a similarity trajectory without importing them separately. Each takes source_id, interval (default 1.0), and last_n. The thread and task variants also take an on_result callback. Extra keyword arguments (distinct_by, until, max_polls, fire_immediately, jitter, on_error) are forwarded to the underlying function.
See Poll Similarity Trajectory for the full walkthrough.

upload()

Upload files for analysis.

Parameters

list[str | BinaryIO]
required
List of file paths (strings) or open file handles (BinaryIO objects).
str | None
default:"None"
Physical sample name or UUID to link the uploads to. If a name is given and no matching sample exists, one is created automatically.
str | None
default:"None"
Project name or UUID to associate the uploads with. The project must already exist, since the SDK does not auto-create projects. When provided, physical_sample is required so the sample can be added to the project’s tracking list.

Returns

list[str]
Data IDs assigned to the uploaded files. Analysis runs asynchronously, so use search() or the web UI to monitor progress.

Example


download()

Download raw or processed files to disk. Works for every data type the platform stores, including RHEED video, XPS, XRD, PL, Raman, optical, metrology, and ellipsometry, returning whatever file format the backend has on record.

Parameters

str | list[str]
required
One or more data IDs from the catalogue.
str | Path | None
default:"None"
Directory to write files to. Defaults to current working directory.
str
default:"processed"
Whether to download raw or processed data.

Returns

None. Files are saved to the destination directory.

Example


download_videos()

Deprecated alias for download(), kept for backwards compatibility. It takes the same parameters and behaves identically. Use download() in new code.

list_physical_samples()

List all physical samples accessible to your account.

Returns

pandas.DataFrame
DataFrame of physical sample records with columns including Physical Sample ID, Physical Sample Name, Project ID, Project Name, Target Material, and Owner.

list_projects()

List all projects accessible to your account.

Returns

pandas.DataFrame
DataFrame of project records with columns including Project ID, Project Name, Physical Sample Count, Project Notes, and Owner.

get_physical_sample()

Get all data associated with a physical sample.

Parameters

str
required
The physical sample ID.
bool
default:"True"
Whether to include data from other users in your organization.
bool | str
default:"False"
Whether to time-align data from multiple sources. Pass True for outer join, or a string like "inner" to control the join strategy.

Returns

PhysicalSampleResult
Result object with attributes:
  • physical_sample_id - Sample identifier
  • physical_sample_name - Sample name
  • data_results - List of all result objects for this sample
  • aligned_timeseries - Aligned DataFrame if align was set, otherwise None

get_project()

Get all data associated with a project.

Parameters

str
required
The project ID.
bool
default:"True"
Whether to include data from other users in your organization.
bool | str
default:"False"
Whether to time-align data from multiple sources. Pass True for outer join, or a string like "inner" to control the join strategy.

Returns

ProjectResult
Result object with attributes:
  • project_id - Project identifier
  • project_name - Project name
  • samples - List of PhysicalSampleResult objects for each sample in the project
  • aligned_timeseries - Project-level aligned DataFrame if align was set, otherwise None

list_growth_instruments()

List all growth instruments accessible to your account.

Returns

list[dict]
List of instrument records. Each dict contains:
  • synth_source_id - Unique instrument ID (int)
  • source_name - Display name
  • synth_source_type - Instrument type (mbe, cvd, etc.)
  • source_manufacturer - Manufacturer name
  • source_model - Model name

create_growth_instrument()

Register a new growth instrument.

Parameters

str
required
Display name for the instrument (e.g., “Main MBE”).
str
required
Manufacturer and model (e.g., “Veeco GEN10”).
str
required
Type of growth instrument.
str | None
default:"None"
Optional serial number or identifier.

Returns

int
The ID of the newly created instrument.

delete_growth_instrument()

Delete a growth instrument.

Parameters

int
required
ID of the instrument to delete.

Returns

None.