# API Reference v10.3.1 (Python)

## OscilloscopeData (class)

Module: zaber_motion.ascii

Contains a block of contiguous recorded data for one channel of the device's oscilloscope.

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
oscilloscope_data = oscilloscope.read()
```

Related Guides:

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

### Properties

#### `axis_number` (read-only)

`oscilloscope_data.axis_number`

Type: `int`

The number of the axis the data was recorded from, or 0 for the controller.

#### `data_id` (read-only)

`oscilloscope_data.data_id`

Type: `int`

Unique ID for this block of recorded data.

#### `data_source` (read-only)

`oscilloscope_data.data_source`

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

Indicates whether the data came from a setting or an I/O pin.

#### `io_channel` (read-only)

`oscilloscope_data.io_channel`

Type: `int`

Which I/O pin within the port was recorded.

#### `io_type` (read-only)

`oscilloscope_data.io_type`

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

Which kind of I/O port data was recorded from.

#### `setting` (read-only)

`oscilloscope_data.setting`

Type: `str`

The name of the recorded setting.

### Methods

#### `get_data()`

`oscilloscope_data.get_data(unit = Units.NATIVE)`

Get the recorded data as an array of doubles, with optional unit conversion. Note that not all quantities can be unit converted. For example, digital I/O channels and pure numbers such as device mode settings have no units.

##### Arguments

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

##### Return Value

Type: `List[float]`

The recorded data for one oscilloscope channel, converted to the units specified.

#### `get_delay()`

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

Get the user-specified time period between receipt of the start command and the first data point. Under some circumstances, the actual delay may be different - call GetSampleTime(0) to get the effective delay.

##### 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 delay setting at the time the data was recorded.

#### `get_frequency()`

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

Get the sampling frequency that this data was recorded with.

##### 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 frequency (inverse of the timebase setting) at the time the data was recorded.

#### `get_sample_time()`

`oscilloscope_data.get_sample_time(index, unit = Units.NATIVE)`

Calculate the time a sample was recorded, relative to when the recording was triggered.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `index` | `int` | 0-based index of the sample to calculate the time of. |
| `unit` | [`TimeUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Unit of measure to represent the calculated time in. |

##### Return Value

Type: `float`

The calculated time offset of the data sample at the given index.

#### `get_sample_times()`

`oscilloscope_data.get_sample_times(unit = Units.NATIVE)`

Calculate the time for all samples, relative to when the recording was triggered.

##### Arguments

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

##### Return Value

Type: `List[float]`

The calculated time offsets of all data samples.

#### `get_timebase()`

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

Get the sample interval that this data was recorded with.

##### 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 timebase setting at the time the data was recorded.
