dwfpy.digital_input.DigitalInput

class DigitalInput(device)[source]

Bases: object

Digital Input module (Logic Analyzer).

Methods

configure

Configures the instrument and starts the acquisition..

get_data

Gets the acquired data samples.

get_noise

Gets the acquired noise samples.

read_status

Gets the acquisition state and optionally reads the data.

record

Starts a data recording.

reset

Resets and configures all instrument parameters to default values.

setup_acquisition

Sets up a new data acquisition.

setup_counter_trigger

Sets up a counter trigger.

setup_edge_trigger

Sets up an edge trigger.

setup_glitch_trigger

Sets up a glitch trigger.

setup_length_trigger

Sets up a length trigger.

setup_level_trigger

Sets up a level trigger.

setup_more_trigger

Sets up a more trigger.

setup_timeout_trigger

Sets up a timeout trigger.

setup_trigger

Sets up the trigger condition.

single

Starts a single data acquisition.

stream

Streams data to a callback function.

wait_for_status

Waits for the specified acquisition state.

Attributes

acquisition_mode

Gets or sets the acquisition mode.

acquisition_mode_info

Gets the supported acquisition modes.

auto_triggered

Returns True if the acquisition is auto triggered.

buffer_size

Gets or sets the buffer size.

buffer_size_max

Gets the maximum supported buffer size.

channels

Gets a collection of Digital Input channels.

clock

Gets the clock unit.

device

Gets the device.

dio_first

Gets or sets a value indicating if DIO pins will be placed in front of the DIN pins.

record_status

Gets information about the recording process.

remaining_samples

Gets the number of samples left in the acquisition.

sample_format

Gets or sets the number of bits to be sampled.

sample_mode

Gets or sets the sample mode.

sample_mode_info

Gets the supported sample modes.

sample_rate

Gets or sets the sample rate.

sample_sensible

Gets or sets the signals to be used for data compression in record acquisition mode.

time

Returns instrument trigger time information.

trigger

Gets the trigger unit.

valid_samples

Gets the number of valid/acquired data samples.

write_index

Gets the buffer write pointer which is needed in scan_screen acquisition mode to display the scan bar.

property acquisition_mode: AcquisitionMode

Gets or sets the acquisition mode.

Return type

AcquisitionMode

property acquisition_mode_info: Tuple[AcquisitionMode, ...]

Gets the supported acquisition modes.

Return type

Tuple[AcquisitionMode, ...]

property auto_triggered: bool

Returns True if the acquisition is auto triggered.

Return type

bool

property buffer_size: int

Gets or sets the buffer size.

Return type

int

property buffer_size_max: int

Gets the maximum supported buffer size.

Return type

int

property channels

Gets a collection of Digital Input channels.

property clock: DigitalInputClock

Gets the clock unit.

Return type

DigitalInputClock

configure(reconfigure=False, start=False)[source]

Configures the instrument and starts the acquisition..

Return type

None

property device: Device

Gets the device.

Return type

Device

property dio_first: bool

Gets or sets a value indicating if DIO pins will be placed in front of the DIN pins.

Return type

bool

get_data(first_sample=0, sample_count=- 1)[source]

Gets the acquired data samples.

Before calling this function, call the ‘read_status()’ function to read the data from the device.

get_noise(first_sample=0, sample_count=- 1)[source]

Gets the acquired noise samples.

Before calling this function, call the ‘read_status()’ function to read the data from the device.

read_status(read_data=False)[source]

Gets the acquisition state and optionally reads the data.

Return type

Status

record(sample_rate=None, sample_format=None, sample_sensible=None, sample_count=None, prefill=None, callback=None, configure=False, start=False)[source]

Starts a data recording.

sample_ratefloat, optional

The sampling frequency in Hz.

sample_formatint, optional

The number of bits to be sampled. Can be 8, 16, or 32.

sample_sensibleint, optional

The signals to be used for data compression, as a bit-mask.

sample_countint or float, optional

The number of samples to be acquired after the trigger.

prefillint or float, optional

The number of samples to be acquired before the trigger.

callbackfunction, optional

A custom function to monitor the recording process.

configurebool, optional

If True, then the instrument is configured (default False).

startbool, optional

If True, then the recording is started (default False).

DigitalRecorder

The recorder instance.

Return type

DigitalRecorder

property record_status: Tuple[int, int, int]

Gets information about the recording process. Returns (available_samples, lost_samples, corrupted_samples)

Return type

Tuple[int, int, int]

property remaining_samples: int

Gets the number of samples left in the acquisition.

Return type

int

reset()[source]

Resets and configures all instrument parameters to default values.

Return type

None

property sample_format: int

Gets or sets the number of bits to be sampled. Can be 8, 16, or 32.

Return type

int

property sample_mode: DigitalInputSampleMode

Gets or sets the sample mode.

Return type

DigitalInputSampleMode

property sample_mode_info: Tuple[DigitalInputSampleMode, ...]

Gets the supported sample modes.

Return type

Tuple[DigitalInputSampleMode, ...]

property sample_rate: float

Gets or sets the sample rate.

Return type

float

property sample_sensible: int

Gets or sets the signals to be used for data compression in record acquisition mode.

Return type

int

setup_acquisition(mode=None, sample_rate=None, sample_format=None, buffer_size=None, position=None, prefill=None, configure=False, start=False)[source]

Sets up a new data acquisition.

modestr, optional

The sampling mode. Can be ‘single’, ‘scan-shift’, ‘scan-screen’, or ‘record’.

sample_ratefloat, optional

The sampling frequency in Hz.

sample_formatint, optional

The number of bits to be sampled. Can be 8, 16, or 32.

buffer_sizeint or float, optional

The buffer size.

positionint or float, optional

The number of samples to be acquired after the trigger.

prefillint or float, optional

The number of samples to be acquired before the trigger (record mode only).

configurebool, optional

If True, then the instrument is configured (default False).

startbool, optional

If True, then the acquisition is started (default False).

Return type

None

setup_counter_trigger(channel, condition, reset_channel, reset_condition, max_counter)[source]

Sets up a counter trigger.

channelint

The trigger channel.

conditionstr

The trigger condition. Can be ‘ignore’, ‘low’, ‘high’, ‘rise’, ‘fall’, or ‘edge’.

reset_channelint

The counter reset channel.

reset_conditionstr

The reset condition. Can be ‘ignore’, ‘low’, ‘high’, ‘rise’, ‘fall’, or ‘edge’.

max_counterint

The maximum counter value.

Return type

None

setup_edge_trigger(channel, edge)[source]

Sets up an edge trigger.

channelint

The trigger channel.

edgestr

The trigger edge. Can be ‘rising’ or ‘falling’.

Return type

None

setup_glitch_trigger(channel, polarity, less_than)[source]

Sets up a glitch trigger.

channelint

The trigger channel.

polaritystr

The trigger polarity. Can be ‘positive’ or ‘negative’.

less_thanfloat

The maximum pulse width in seconds.

Return type

None

setup_length_trigger(channel, polarity, length, hysteresis=0.0)[source]

Sets up a length trigger.

channelint

The trigger channel.

polaritystr

The trigger polarity. Can be ‘positive’ or ‘negative’.

lengthfloat

The minimum pulse width in seconds.

hysteresisfloat, optional

The pulse width hysteresis in seconds.

Return type

None

setup_level_trigger(channel, level)[source]

Sets up a level trigger.

channelint

The trigger channel.

levelstr

The trigger level. Can be ‘low’ or ‘high’.

Return type

None

setup_more_trigger(channel, polarity, more_than)[source]

Sets up a more trigger.

channelint

The trigger channel.

polaritystr

The trigger polarity. Can be ‘positive’ or ‘negative’.

more_thanfloat

The minimum pulse width in seconds.

Return type

None

setup_timeout_trigger(channel, polarity, more_than)[source]

Sets up a timeout trigger.

channelint

The trigger channel.

polaritystr

The trigger polarity. Can be ‘positive’ or ‘negative’.

more_thanfloat

The minimum pulse width in seconds.

Return type

None

setup_trigger(source=None, slope=None, position=None, prefill=None, auto_timeout=None)[source]

Sets up the trigger condition.

sourcestr, optional

The trigger source. Can be ‘none’, ‘pc’, ‘detector-analog-in’, ‘detector-digital-in’, ‘analog-in’, ‘digital-in’, ‘digital-out’, ‘analog-out1’, ‘analog-out2’, ‘analog-out3’, ‘analog-out3’, ‘external1’, ‘external2’, ‘external3’, ‘external4’, ‘low’, ‘high’, or ‘clock’.

slopestr, optional

The trigger slope. Can be ‘rising’, ‘falling’, or ‘either’.

positionint, optional

The number of samples to be acquired after the trigger.

prefillint, optional

The number of samples to be acquired before the trigger.

auto_timeoutfloat, optional

The auto trigger timeout in seconds.

Return type

None

single(sample_rate=None, sample_format=None, buffer_size=None, position=None, continuous=True, configure=False, start=False)[source]

Starts a single data acquisition.

sample_ratefloat, optional

The sampling frequency in Hz.

sample_formatint, optional

The number of bits to be sampled. Can be 8, 16, or 32.

buffer_sizeint or float, optional

The buffer size.

positionint or float, optional

The number of samples to be acquired after the trigger.

continuousbool, optional

If True, then the instrument is rearmed after the data is retrieved. (default True).

configurebool, optional

If True, then the instrument is configured (default False).

startbool, optional

If True, then the acquisition is started (default False).

tuple

If start is True, a tuple of integers containing the data samples. None otherwise.

Return type

Optional[Tuple]

stream(callback, sample_rate=None, sample_format=None, sample_sensible=None, configure=False, start=False)[source]

Streams data to a callback function.

callbackfunction

A user-defined function to receive the streaming data.

sample_ratefloat, optional

The sampling frequency in Hz.

sample_formatint, optional

The number of bits to be sampled. Can be 8, 16, or 32.

sample_sensibleint, optional

The signals to be used for data compression.

configurebool, optional

If True, then the instrument is configured (default False).

startbool, optional

If True, then the streaming is started (default False).

DigitalRecorder

The recorder instance.

Return type

DigitalRecorder

property time: None

Returns instrument trigger time information.

Return type

None

property trigger: DigitalInputTrigger

Gets the trigger unit.

Return type

DigitalInputTrigger

property valid_samples: int

Gets the number of valid/acquired data samples.

Return type

int

wait_for_status(status, read_data=False)[source]

Waits for the specified acquisition state.

Return type

None

property write_index: int

Gets the buffer write pointer which is needed in scan_screen acquisition mode to display the scan bar.

Return type

int