> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.conductorquantum.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.conductorquantum.com/_mcp/server.

# Using the Charge Stability Diagram Models

> Learn how to use the Charge Stability Diagram Models

## Installation

We recommend using pip, poetry, or uv to install the package.

**`pip`**

```bash title="pip"
pip install conductorquantum
```

**`poetry`**

```bash title="poetry"
poetry add conductorquantum
```

**`uv`**

```bash title="uv"
uv add conductorquantum
```

## Authentication

The SDK requires an API key for authentication.  [Sign in and create a new API key](/control/getting-started/api-keys). Remember, your API key is your access secret - keep it safe
with environment variables.

Using environment variables:

**`Python`**

```python title="Python"
from dotenv import load_dotenv
import os
from conductorquantum import ConductorQuantum

# Load API key from .env file
load_dotenv()
TOKEN = os.getenv("CONDUCTOR_API_KEY")

# Initialize client
client = ConductorQuantum(token=TOKEN)
```

Or provide the API key directly:

**`Python`**

```python title="Python"
from conductorquantum import ConductorQuantum

# Initialize client with API key
client = ConductorQuantum(token="YOUR_API_KEY")
```

## Usage Examples

### Using the Charge Stability Diagram Segmenter

The Charge Stability Diagram Segmenter is a model that can segment a given measurement into different charge stability regimes: no dot (0), single dot (1), and double dot (2).

You can [download](https://storage.googleapis.com/conductor-docs-example-files/charge-stability-diagram-segmenter-v0.npy) an example file to follow along with the example:

**`Python`**

```python title="Python"
from dotenv import load_dotenv
import os
import numpy as np
from conductorquantum import ConductorQuantum


# Load API key from .env file
load_dotenv()
TOKEN = os.getenv("CONDUCTOR_API_KEY")

# Initialize client
client = ConductorQuantum(token=TOKEN)

# Load Charge Stability Diagram data
data = np.load("charge-stability-diagram-segmenter-v0.npy")  # shape (128, 128)

# Segment the Charge Stability Diagram
result = client.control.models.run(
    model="charge-stability-diagram-segmenter-v0",
    data=data
)

# Access the segmentation result
segmentation = result.output["segmentation"]
print(f"Segments: {segmentation}")
```

**`Output`**

```python title="Output"
Segments: [
    [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], 
    ..., 
    [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
]
```

![Charge Stability Diagram Input Data](/_fern-img/c8cd07ca6bf41961513d7cad7a3542df4008513d8167cd31228b7c1b73570fd3.webp)![Charge Stability Diagram Segmenter](/_fern-img/d0b9264d6488dff2446c2e2baad8d62f255fcc5efb6d493ff137a620bf8f0d42.webp)

### Using the Charge Transition Line Detector

The Charge Transition Line Detector is a model that detects the locations of charge transition lines in a charge stability diagram.

You can [download](https://storage.googleapis.com/conductor-docs-example-files/charge-stability-diagram-transition-detector-v0.npy) an example file to follow along with the example:

**`Python`**

```python title="Python"
from dotenv import load_dotenv
import os
import numpy as np
from conductorquantum import ConductorQuantum


# Load API key from .env file
load_dotenv()
TOKEN = os.getenv("CONDUCTOR_API_KEY")

# Initialize client
client = ConductorQuantum(token=TOKEN)

# Load Charge Stability Diagram data 
data = np.load("charge-stability-diagram-transition-detector-v0.npy") # shape (n, m)

# Detect the transition lines in the Charge Stability Diagram
result = client.control.models.run(
    model="charge-stability-diagram-transition-detector-v0",
    data=data
)

# Access the transition lines result
transition_lines = result.output["transition_lines"]
print(f"Transition lines: {transition_lines}")
```

**`Output`**

```python title="Output"
Transition lines: [
  [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0],  
  ...,
  [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
]

```

![Charge Stability Diagram Input Data](/_fern-img/1ae48b636e0644678458e1da1de1db3d87ddb8a75e464ee935971274102c09c5.webp)![Charge Transition Line Detector](/_fern-img/817a61d27dc2fd64164a580b7b7d8c87794ed817509123d993a2e43045429978.webp)

### Using the Charge Stability Diagram Binary Classifier

There are two versions of the Charge Stability Diagram (CSD) binary classifier available: one for 16x16 input arrays and one for 48x48 arrays. Both models classify a CSD as either "double dot" (1) or "not double dot" (0).

**Charge Stability Diagram Data Requirements**

* Input shape: (16, 16) or (48, 48)
* Data: 2D numpy array representing transport current or charge sensor signal

To choose the appropriate model, use the suffix in the model string:

* For 48x48 data: `charge-stability-diagram-binary-classifier-v0-48x48`
* For 16x16 data: `charge-stability-diagram-binary-classifier-v0-16x16`

You can [download a sample 48x48 input file here](https://storage.googleapis.com/conductor-docs-example-files/charge-stability-diagram-classifier-v0-48x48.npy) to follow along with the example.

**`Python`**

```python title="Python"
from dotenv import load_dotenv
import os
import numpy as np
from conductorquantum import ConductorQuantum


# Load API key from .env file
load_dotenv()
TOKEN = os.getenv("CONDUCTOR_API_KEY")

# Initialize client
client = ConductorQuantum(token=TOKEN)

# Load Charge Stability Diagram data
data = np.load("charge-stability-diagram-classifier-v0-48x48.npy")  # shape (48, 48)

# Classify the number of dots in the Charge Stability Diagram
result = client.control.models.run(
    model="charge-stability-diagram-classifier-v0-48x48",
    data=data
)

# Access the classification result
classification = result.output["classification"]
print(f"Classification: {classification}")
```

**`Output`**

```python title="Output"
{'classification': 1, 'score': 0.9598088264465332}
```

![Charge Stability Diagram Binary Classifier Input Data](/_fern-img/335c5edf6ed98ddeeb25e09a365f997686d967f1f9c0c902b83e4da968beb8f4.webp)

## Important Notes for Charge Stability Diagram Models

* **Input dimensions**: Input dimensions should ideally match the specified resolution of the model for the best results. You may need to interpolate or downsample your data to match the required shape. You can find the required input shapes for each model on the [models overview](/control/models/overview) page.
* **Data format**: Input data should be a 2D numpy array representing transport current or charge sensor signal values. Each value in the input array corresponds to a point in the charge stability diagram for a set of two plunger gate voltages.
* **Output format**:
  * The segmenter outputs a 2D array with integer labels: 0 (no dot), 1 (single dot), or 2 (double dot).
  * The transition detector outputs a 2D array with binary values (0.0 or 1.0) indicating transition line locations.
  * The binary classifier outputs a classification (0 or 1) and a confidence score.
* **Model versions**: Higher version numbers typically indicate improved accuracy and performance. Check the [models overview](/control/models/overview) for the latest available versions.