Skip to main content
The RHEEDStreamer class provides high-performance streaming of RHEED frames to the Atomscale platform. It bridges Python to a Rust/PyO3 backend for efficient, concurrent packaging and upload of grayscale frames.

Constructor

str
required
API key for authentication.
str | None
default:"None"
Root API endpoint. If not provided, uses the default production endpoint or reads from AS_API_ENDPOINT environment variable.
int | None
default:"None"
Logging verbosity level. Set to 4 for detailed progress output.

initialize()

Start a new streaming session and return a data ID for subsequent operations.

Parameters

float
required
Frame rate of the capture in frames per second.
float
required
Sample rotation speed in rotations per minute. Set to 0.0 for stationary samples.
int
required
Number of frames per upload chunk. Must be at least 2 * fps, so each chunk covers 2 seconds or more of video.
str | None
default:"None"
Human-readable name for this stream. Helps identify runs in the UI.
str | None
default:"None"
Name of the physical sample to link this stream to. Names are matched case-insensitively. If no match is found, a new sample record is created.
str | None
default:"None"
UUID of the project to associate with this stream. When provided along with physical_sample, the sample is added to the project’s tracking list and marked as the project’s active tracking sample for growth monitoring.
list[str] | None
default:"None"
Tag names or UUIDs to attach to the data item. Names are matched case-insensitively against existing organization tags, and unknown names are created. UUIDs must reference existing tags.

Returns

str
Unique identifier for this streaming session. Use this ID with push(), run(), and finalize().

Example


run()

Stream frames using generator/pull mode. The streamer consumes chunks from an iterator and handles pacing and retry logic.

Parameters

str
required
The data ID returned by initialize().
Iterable[NDArray[np.uint8]]
required
Iterator yielding frame chunks. Each chunk should be a numpy array of shape (N, H, W) with dtype uint8, where N is the chunk size. A single (H, W) frame is treated as N = 1.A yielded item may instead be a (frames, capture_start_ms_utc) tuple, pairing the array with an explicit capture-start timestamp in milliseconds since the UNIX epoch (UTC). Use this when you have hardware or OS-level timestamps for each chunk.

Returns

None. Frames are uploaded as they are yielded by the iterator. The call blocks until every spawned upload task completes.

Example


push()

Upload a single chunk of frames in callback/push mode. Use this when frames arrive live from the instrument.

Parameters

str
required
The data ID returned by initialize().
int
required
Zero-based index of this chunk. Chunks must be pushed in order.
NDArray[np.uint8]
required
Numpy array of frames with shape (N, H, W) or (H, W) for single frames. Must have dtype uint8.
int | None
default:"None"
Capture-start timestamp for the first frame in the chunk, in milliseconds since the UNIX epoch (UTC). When omitted, the streamer samples the current time on entry to push().

Returns

None. The chunk is queued for upload.

Timestamps

Without an explicit capture_start_ms_utc, each chunk is stamped with the wall clock sampled the moment push() is entered, before any packaging work. The chunk’s end timestamp is then start + (n / fps) * 1000. Inter-chunk gaps therefore reflect real arrival jitter, while the span within a chunk follows the declared FPS. Pass an explicit timestamp when you have a hardware clock, such as a camera trigger or an OS monotonic-to-UTC conversion.

Example


finalize()

Complete the streaming session and signal the server to begin final processing.

Parameters

str
required
The data ID returned by initialize().

Returns

None. The stream is marked as complete and queued for final analysis.
Always call finalize() even if the upload fails part-way. This signals the server to clean up resources and mark the stream appropriately.

Example


Frame Format Requirements

RHEED frames must meet these requirements:

Example frame preparation


Best Practices


Error Handling

The streamer raises exceptions for connection failures and invalid parameters. Wrap streaming code in try/finally to ensure finalize() is called:

TimeseriesStreamer

The TimeseriesStreamer class streams scalar instrument data (temperature, pressure, growth rate, etc.) to the Atomscale platform. Like RHEEDStreamer, it uses a Rust/PyO3 backend.

Constructor

str
required
API key for authentication.
str | None
default:"None"
Root API endpoint. If not provided, uses the default production endpoint or reads from AS_API_ENDPOINT environment variable.
int
default:"100"
Expected number of data points per chunk. Used for array positioning.
int | None
default:"None"
Logging verbosity level. Set to 4 for detailed progress output.

initialize()

Start a new timeseries streaming session.

Parameters

str | None
default:"None"
Human-readable name for this stream.
int | None
default:"None"
Growth instrument ID to link. Must belong to your organization.
str | None
default:"None"
Name or UUID of a physical sample to associate with the stream. Names are matched case-insensitively, or a new sample is created if no match is found.
str | None
default:"None"
UUID of the project to associate with this stream. When provided along with physical_sample, the sample is added to the project’s tracking list and marked as the project’s active tracking sample for growth monitoring.
list[str] | None
default:"None"
Tag names or UUIDs to attach to the data item. Names are matched case-insensitively against existing organization tags, and unknown names are created. UUIDs must reference existing tags.

Returns

str
Unique identifier for this streaming session.

push()

Upload a single chunk of data for one channel. Spawns an async upload task and returns immediately.

Parameters

str
required
The data ID returned by initialize().
int
required
Zero-based index of this chunk. Chunks must be pushed in order.
str
required
Name of the data channel (e.g., “temperature”, “pressure”).
list[float]
required
Unix epoch timestamps in seconds.
list[float]
required
Measured values corresponding to each timestamp.
str | None
default:"None"
Optional units for the values (e.g., “C”, “mbar”).

Returns

None. The chunk is queued for upload.

push_multi()

Upload data for multiple channels in a single call.

Parameters

str
required
The data ID returned by initialize().
int
required
Zero-based index of this chunk.
dict[str, dict]
required
Mapping of channel names to channel data. Each value dict should contain timestamps (list of floats), values (list of floats), and optionally units (string).

Returns

None.

run()

Stream data from an iterator. Blocks until all uploads complete.

Parameters

str
required
The data ID returned by initialize().
str
required
Name of the data channel.
Iterable[tuple[list[float], list[float]]]
required
Iterator yielding (timestamps, values) tuples for each chunk.
str | None
default:"None"
Optional units for the values.

Returns

None.

finalize()

Complete the streaming session and signal the server to begin processing.

Parameters

str
required
The data ID returned by initialize().

Returns

None.
Always call finalize() even if the upload fails part-way. This signals the server to clean up resources and mark the stream appropriately.