# API Reference v10.3.1 (Python)

## Oscilloscope (class)

Module: zaber_motion.ascii

Provides a convenient way to control the oscilloscope data recording feature of some devices. The oscilloscope can record the values of some settings over time at high resolution.

Requires at least Firmware 7.00.

The following example illustrates how you can obtain an instance of this type:

```py
from zaber_motion.ascii import Connection

connection = Connection.open_serial_port("COM3")
device = connection.get_device(1)
oscilloscope = device.oscilloscope
```

Related Guides:

- [Oscilloscope](https://software.zaber.com/motion-library/docs/guides/device_features/oscilloscope.md)

### Properties

#### `device` (read-only)

`oscilloscope.device`

Type: [`Device`](https://software.zaber.com/motion-library/api/py/ascii/device.md)

Device that this Oscilloscope measures.

### Methods

#### `add_channel()` (async available)

`oscilloscope.add_channel(axis, setting)`

Select a setting to be recorded.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `axis` | `int` | The 1-based index of the axis to record the value from. |
| `setting` | `str` | The name of a setting to record. |

#### `add_io_channel()` (async available)

`oscilloscope.add_io_channel(io_type, io_channel)`

Select an I/O pin to be recorded.

Requires at least Firmware 7.33.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `io_type` | [`IoPortType`](https://software.zaber.com/motion-library/api/py/ascii/ioporttype.md) | The I/O port type to read data from. |
| `io_channel` | `int` | The 1-based index of the I/O pin to read from. |

#### `clear()` (async available)

`oscilloscope.clear()`

Clear the list of channels to record.

#### `get_buffer_size()` (async available)

`oscilloscope.get_buffer_size()`

Get the number of samples that can be recorded per channel given the current number of channels added.

##### Return Value

Type: `int`

Number of samples that will be recorded per channel with the current channels. Zero if none have been added.

#### `get_delay()` (async available)

`oscilloscope.get_delay(unit = Units.NATIVE)`

Get the delay before oscilloscope recording starts.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `unit` | [`TimeUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Unit of measure to represent the delay in. |

##### Return Value

Type: `float`

The current start delay in the selected time units.

#### `get_frequency()` (async available)

`oscilloscope.get_frequency(unit = Units.NATIVE)`

Get the current sampling frequency. The values is calculated as the inverse of the current sampling interval.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `unit` | [`FrequencyUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Unit of measure to represent the frequency in. |

##### Return Value

Type: `float`

The inverse of current sampling interval in the selected units.

#### `get_max_buffer_size()` (async available)

`oscilloscope.get_max_buffer_size()`

Get the maximum number of samples that can be recorded per Oscilloscope channel.

##### Return Value

Type: `int`

The maximum number of samples that can be recorded per Oscilloscope channel.

#### `get_max_channels()` (async available)

`oscilloscope.get_max_channels()`

Get the maximum number of channels that can be recorded.

##### Return Value

Type: `int`

The maximum number of channels that can be added to an Oscilloscope recording.

#### `get_timebase()` (async available)

`oscilloscope.get_timebase(unit = Units.NATIVE)`

Get the current sampling interval.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `unit` | [`TimeUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Unit of measure to represent the timebase in. |

##### Return Value

Type: `float`

The current sampling interval in the selected time units.

#### `read()` (async available)

`oscilloscope.read()`

Reads the last-recorded data from the oscilloscope. Will block until any in-progress recording completes.

##### Return Value

Type: [`List[OscilloscopeData]`](https://software.zaber.com/motion-library/api/py/ascii/oscilloscopedata.md)

Array of recorded channel data arrays, in the order added.

#### `set_delay()` (async available)

`oscilloscope.set_delay(interval, unit = Units.NATIVE)`

Set the sampling start delay.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `interval` | `float` | Delay time between triggering a recording and the first data point being recorded. |
| `unit` | [`TimeUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Unit of measure the delay is represented in. |

#### `set_frequency()` (async available)

`oscilloscope.set_frequency(frequency, unit = Units.NATIVE)`

Set the sampling frequency (inverse of the sampling interval). The value is quantized to the next closest value supported by the firmware.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `frequency` | `float` | Sample frequency for the next oscilloscope recording. |
| `unit` | [`FrequencyUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Unit of measure the frequency is represented in. |

#### `set_timebase()` (async available)

`oscilloscope.set_timebase(interval, unit = Units.NATIVE)`

Set the sampling interval.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `interval` | `float` | Sample interval for the next oscilloscope recording. Minimum value is 100µs. |
| `unit` | [`TimeUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Unit of measure the timebase is represented in. |

#### `start()` (async available)

`oscilloscope.start(capture_length = 0)`

Trigger data recording.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `capture_length` | `int` | Optional number of samples to record per channel. If left empty, the device records samples until the buffer fills. |

#### `stop()` (async available)

`oscilloscope.stop()`

End data recording if currently in progress.
