> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atomscale.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# RHEED

> Surface structure analysis from diffraction patterns and intensity oscillations

RHEED (Reflection High-Energy Electron Diffraction) analysis automatically extracts and quantifies diffraction features from RHEED videos and images. It supports stationary stages, rotating stages, and real-time streaming via screen capture. For rotating recordings, the pipeline automatically detects the rotational period, identifies high-symmetry reference frames, and applies per-rotation corrections so that metrics are extracted consistently at each azimuthal angle.

## Overview

The RHEED pipeline processes data in three stages:

1. **Data cleaning and standardization**: auto-classifies the recording type (stationary vs. rotating), crops to the illuminated region, corrects detector orientation, and for rotating recordings, detects the rotational period and aligns each rotation cycle to consistent azimuthal positions
2. **Pattern extraction**: segments diffraction features using deep learning models and quantifies morphological metrics per feature
3. **Timeseries analysis**: tracks how extracted metrics evolve across video frames, detects transitions, and identifies changes in surface structure

### Key Metrics

| Metric             | What It Tells You                                                                                                           |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| Lattice spacing    | Real-space lattice constant derived from reciprocal-space feature spacing. Tracks surface reconstruction changes.           |
| Strain             | Relative change in diffraction feature spacing over time, calculated from horizontal spacing between neighboring patterns.  |
| Oscillation period | Period of specular intensity oscillations, related to deposition rate.                                                      |
| Spot count         | Number of diffraction features per frame. Changes indicate phase transitions, reconstructions, or target thickness reached. |
| FWHM               | Full width at half maximum of specular and first-order spots.                                                               |
| Intensity          | Integrated intensity of specular, half-order, and first-order reflections.                                                  |

For rotating RHEED data, the pipeline automatically detects the rotational period, identifies high-symmetry reference frames, and aligns each rotation cycle before extracting metrics per azimuthal angle. This corrects for variations in rotation speed and ensures equivalent positions are compared consistently across cycles.

<Tabs>
  <Tab title="Guide">
    ### Adding RHEED Data

    You can add RHEED data in two ways: uploading video files, or streaming live from your RHEED camera display.

    #### Upload

    Upload RHEED video files directly through the data management page. Analysis begins automatically once the upload completes.

    #### Stream

    Streaming captures your RHEED feed in real time via screen share, with analysis results delivered within seconds.

    <Steps>
      <Step title="Start a new stream">
        Click **Add Data**, then select **Stream**.
      </Step>

      <Step title="Choose your source">
        Click **Choose Source** and select the window that displays your RHEED camera feed, the same way you would screen-share on a video call.
      </Step>

      <Step title="Adjust the capture region">
        Drag the blue bounding box to frame the RHEED pattern area you want to capture.
      </Step>

      <Step title="Set metadata (optional)">
        Enter a name for the stream and any other metadata. If your stage is rotating, enter an approximate rotation rate as a starting point for automatic period detection. Leave the stage rotation field blank for stationary stages.
      </Step>

      <Step title="Start the stream">
        Click **Start Stream**. Analysis begins immediately and results appear in the workspace as frames are processed.
      </Step>
    </Steps>

    <Tip>
      During an active stream, you can pause, resume, or end the stream from the workspace. Only the user who started the stream can control it.
    </Tip>

    ### Viewing Results

    Once processing completes (or during a live stream), the RHEED workspace shows several sections:

    **Video player**: Scrub through the recorded or live video. Reference frame positions are highlighted on the scrub bar for rotating recordings. You can jump to a specific frame number or drag the scrubber to isolate a moment in time.

    **Growth analysis chart**: The main analysis view. Select which timeseries to plot (lattice spacing, strain, intensity, FWHM, spot count, oscillation period) and choose the azimuth angle for rotating data. Transition zones appear as shaded regions when the pipeline detects significant changes in the underlying signal.

    **Saved patterns**: Extract individual frames for detailed fingerprint analysis. Click **Save Frame** to extract the current video frame. Each saved frame shows the fingerprint overlay with extracted diffraction features, intensity maxima positions, and horizontal spacing between the specular spot and nearest features.

    ### Azimuth Calibration

    For rotating RHEED recordings, the pipeline automatically detects the rotational period and identifies high-symmetry reference frames. You can refine these in the azimuth calibration panel:

    * **Label azimuths** with crystal orientation names (e.g., `Al[100]`)
    * **Set calibration** to convert from pixels to inverse Angstroms, enabling real-space lattice spacing values

    ### Reanalysis

    If you need to adjust analysis parameters, open the workflow configuration drawer to update reference frames or rotational period, then re-run the pipeline.

    ### Comparing Patterns

    Save multiple frames and use the pattern comparison tools to view fingerprint overlays side by side or generate difference masks between two patterns. This is useful for identifying subtle changes in surface structure across a growth run.
  </Tab>

  <Tab title="Technical Details">
    ### Analysis Pipeline

    The RHEED pipeline processes data through three stages, followed by transition detection.

    #### Stage 1: Data Cleaning and Standardization

    Raw RHEED recordings are prepared for analysis. The pipeline auto-classifies the recording as stationary or rotating, crops to the illuminated pattern region, corrects detector orientation, and normalizes intensity across recordings.

    For rotating recordings, the pipeline automatically detects the rotational period, identifies high-symmetry reference frames within each rotation cycle, and aligns frames across cycles to correct for variations in rotation speed. This ensures that equivalent azimuthal positions are compared consistently when building per-angle timeseries.

    #### Stage 2: Pattern Extraction

    Diffraction features are segmented from each frame using deep learning models that separately identify streaks and spots. For each extracted feature, morphological metrics are measured, including FWHM, eccentricity, area, centroid position, and position relative to the specular spot.

    #### Stage 3: Timeseries Analysis

    For video data, the pipeline tracks how extracted metrics evolve across frames. For rotating data, frames are grouped by azimuthal angle so each metric is tracked per orientation. For stationary data, frames are sampled at regular intervals.

    **Computed metrics**: strain (relative change in feature spacing), lattice spacing (converted from reciprocal-space measurements), intensity (specular, half-order, and first-order reflections), FWHM, oscillation period, spot count, and per-feature shape properties.

    #### Transition Detection

    The pipeline identifies significant changes in the RHEED timeseries using unsupervised clustering to group statistically similar frames and change point detection to find abrupt shifts. Changes in cluster assignment signal transitions in surface structure.

    Detected transitions appear as shaded zones on the growth analysis chart. You can inspect and compare the diffraction patterns of each cluster, with per-cluster metrics including oscillation period, streak-to-spot ratio, and spot count.

    #### Streaming Pipeline

    For real-time streaming, the pipeline operates incrementally. Only new frames are processed and appended to existing timeseries rather than recomputed from scratch.
  </Tab>
</Tabs>

## Related Documentation

<CardGroup cols={2}>
  <Card title="Detect Anomalies During a Run" icon="bell" href="/platform/guides/detect-anomalies">
    Use RHEED metrics as part of real-time growth monitoring.
  </Card>

  <Card title="Identify Uniformity Issues" icon="chart-area" href="/platform/guides/identify-uniformity-issues">
    Analyze RHEED data consistency across a growth.
  </Card>
</CardGroup>
