Analog input instrument

The AnalogIn instrument provides multiple channels of analog input on devices that support it, such as the Analog Discovery and the Analog Discovery 2. It provides the functionality normally associated with a stand-alone oscilloscope.

Todo

This section is missing some important information:

  • A discussion about the different acquisition modes;

  • A description of how the status variables behave in the different acquisition modes;

  • A discussion of the precise meaning of all settings.

Using the analog input instrument

To use the AnalogIn instrument you first need to initialize a DwfLibrary instance. Next, you open a specific device. The device’s AnalogIn instrument can now be accessed via its analogIn attribute, which is an instance of the AnalogIn class.

For example:

from pydwf import DwfLibrary
from pydwf.utilities import openDwfDevice

dwf = DwfLibrary()

with openDwfDevice(dwf) as device:

    # Get a reference to the device's AnalogIn instrument.
    analogIn = device.analogIn

    # Use the AnalogIn instrument.
    analogIn.reset()

The AnalogIn state machine

The AnalogIn instrument is controlled by a state machine. As a measurement is prepared and executed, the instrument goes through its various states.

The current state of the instrument is returned by the analogIn.status() method, and is of type DwfState.

The figure below shows the states used by the AnalogIn instrument and the transitions between them:

digraph { rankdir=LR; // nodes node [color="#243f60"; fillcolor="#4581bd"; style="filled"]; st_ready [label="Ready"]; st_configure [label="Configure"]; st_prefill [label="Prefill"]; st_armed [label="Armed"]; st_running [label="Running"]; st_done [label="Done"]; // edges edge [color="#4579b8"]; st_ready -> st_configure [label="Reconfigure?", style="dashed"]; st_configure -> st_ready [style="dashed"]; st_ready -> st_prefill [label="Start?"]; st_configure -> st_prefill[label="Start?", style="dashed"]; st_prefill -> st_armed; st_armed -> st_running[label="Trigger?"]; st_running -> st_done; }

States of the AnalogIn instrument

The AnalogIn states are used as follows:

  1. Ready

    In this preparatory state, instrument settings can be changed that specify the behavior of the instrument in the coming measurement. If the auto-configure setting of the device is enabled (the default), setting changes will automatically be transferred to the device. If not, an explicit call to the analogIn.configure() method with the reconfigure parameter set to True is needed to transfer updated settings to the device.

    Once the instrument is properly configured, an acquisition can be started by calling the analogIn.configure() with the start parameter set to True. This will start the first stage of the acquisition by entering the Prefill state.

  2. Configure

    This state is entered momentarily when a setting is being pushed to the device, either by changing the setting while auto-configure is enabled, or by an explicit call to analogIn.configure() with the reconfigure parameter set to True. The settings inside the device will be updated, and the device will immediately thereafter go back to the Ready state, unless the start parameter to analogIn.configure() was set to True.

  3. Prefill

    This state marks the beginning of an acquisition sequence. During the Prefill state, input samples will be acquired until enough samples are buffered for the instrument to be ready to react to a trigger.

    This state is only relevant if the trigger position has been configured in such a way that the measurement must also yield sample values prior to the moment of triggering.

    Once enough samples are received for the instrument to be able to react to a trigger, it proceeds to the Armed state.

  4. Armed

    In this state the instrument continuously captures samples and monitors the configured trigger input. As soon as a trigger event is detected, the instrument proceeds to the Running state.

  5. Running

    In this state the instrument continues capturing samples until the acquisition is complete. Completion is reached when the acquisition buffer has filled up in Single mode, or when the recording length has been reached in Record mode. When completion is reached, the instrument proceeds to the Done state.

  6. Done

    This state indicates that a measurement has finished.

    From this state, it is possible to go back to the Ready state by performing any kind of configuration, or to start a new acquisition with the same settings.

AnalogIn instrument API overview

With 101 methods, the AnalogIn instrument is the most complicated instrument supported by the Digilent Waveforms API. Below, we categorize all its methods and shortly introduce them. Detailed information on all methods can be found in the AnalogIn class reference that follows.

Instrument control

Like all instruments supported by the Digilent Waveforms library, the AnalogIn instrument provides reset(), configure(), and status() methods.

The reset() method resets the instrument.

The configure() method is used to explicitly transfer settings to the instrument, and/or to start a configured operation.

The status() method retrieves status information from the instrument. Optionally, it can also retrieve bulk data, i.e., analog signal and noise samples. The method returns the current DwfState of the AnalogIn instrument; to obtain more elaborate status information, one of the methods in the next two sections must be used.

Instrument control (3 methods)

control operation

type/unit

methods

reset instrument

n/a

reset()

configure instrument

n/a

configure()

request instrument status

DwfState

status()

Status variables

When executing the status() method, status information is transferred from the AnalogIn instrument to the PC. Several status variables can then be retrieved by using the methods listed below.

Status variables (7 methods)

status value

type/unit

method

timestamp

tuple [s]

statusTime()

most recent sample value

float [V]

statusSample()

auto-triggered flag

bool

statusAutoTriggered()

samples left in acquisition

int [samples]

statusSamplesLeft()

samples valid count

int [samples]

statusSamplesValid()

buffer write index

int [samples]

statusIndexWrite()

recording status

tuple [samples]

statusRecord()

Status data retrieval

Executing the status() method with the read_data parameter set to True transfers captured samples from the instrument to the PC. The samples can then be retrieved using the methods listed here.

Status data retrieval (5 methods)

status data

type/unit

methods

get sample data (without buffer offset)

float [V]

statusData()

get sample data (with buffer offset)

float [V]

statusData2()

get sample data (raw samples, with buffer offset)

int [-]

statusData16()

get sample noise (without buffer offset)

float [V]

statusNoise()

get sample noise (with offset)

float [V]

statusNoise2()

Acquisition settings

The following methods are used to get and set channel-independent configuration values related to acquisition, and to obtain information about their possible values.

Acquisition settings (15 methods)

setting

type/unit

methods

ADC sample resolution

int [bits]

bitsInfo()

record length

float [s]

recordLengthSet() , –Get()

sample frequency

float [Hz]

frequencyInfo() , –Set() , –Get()

sample buffer size

int [samples]

bufferSizeInfo() , –Set() , –Get()

noise buffer size

int [samples]

noiseSizeInfo() , –Set() , –Get()

acquisition mode

DwfAcquisitionMode

acquisitionModeInfo() , –Set() , –Get()

Channel count

This method returns the number of analog input channels.

Channel count (2 methods)

operation

type/unit

method

channel count channel count, distinguish real/filter channels

int int

channelCount() channelCount()

Channel configuration

The following methods are used to get and set channel-dependent configuration values, and to obtain information about their possible values.

Channel configuration (21 methods)

setting

type/unit

methods

channel enable

bool

channelEnableSet() , –Get()

channel filter

DwfAnalogInFilter

channelFilterInfo() , –Set() , –Get()

channel range

float [V]

channelRangeInfo() , –Set() , –Get() , –Steps()

channel offset

float [V]

channelOffsetInfo() , –Set() , –Get()

channel attenuation

float [-]

channelAttenuationSet() , –Get()

channel bandwidth

float [Hz]

channelBandwidthSet() , –Get()

channel impedance

float [Ohms]

channelImpedanceSet() , –Get()

channel coupling

DwfAnalogCoupling

channelCouplingInfo() , –Get() , –Get()

Instrument trigger configuration

The following methods are used to configure the trigger of the AnalogIn instrument. The trigger source is fully configurable; the AnalogIn instrument can use its own trigger detector for triggering, but it is also possible to use a different trigger source. For that reason, we distinguish between the methods that configure the instrument trigger, and the methods that configure the AnalogIn trigger detector that are discussed below.

Instrument trigger configuration (10 methods)

setting

type/unit

methods

trigger source

DwfTriggerSource

triggerSourceInfo() , –Set() , –Get()

trigger position

float [s]

triggerPositionInfo() , –Set() , –Get() , –Status()

trigger auto-timeout

float [s]

triggerAutoTimeoutInfo() , –Set() , –Get()

Note

The triggerSourceInfo() method is obsolete. Use the generic DwfDevice.triggerInfo() method instead.

Force instrument trigger

The triggerForce() method can be used to force the AnalogIn instrument to start acquiring.

Force instrument trigger (1 method)

operation

type/unit

method

force trigger

n/a

triggerForce()

Trigger detector configuration

The AnalogIn trigger detector is highly configurable. It has nine different settings that can be queried and set using the methods below.

Trigger detector configuration (27 methods)

setting

type/unit

methods

trigger hold-off

float [s]

triggerHoldOffInfo() , –Set() , –Get()

trigger type

DwfAnalogInTriggerType

triggerTypeInfo() , –Set() , –Get()

trigger channel

int [-]

triggerChannelInfo() , –Set() , –Get()

trigger filter

DwfAnalogInFilter

triggerFilterInfo() , –Set() , –Get()

trigger level

float [V]

triggerLevelInfo() , –Set() , –Get()

trigger hysteresis

float [V]

triggerHysteresisInfo() , –Set() , –Get()

trigger slope

DwfTriggerSlope

triggerConditionInfo() , –Set() , –Get()

trigger length

float [s]

triggerLengthInfo() , –Set() , –Get()

trigger length condition

DwfAnalogInTriggerLengthCondition

triggerLengthConditionInfo() , –Set() , –Get()

Counter functionality

Counter configuration (4 methods)

setting

type/unit

methods

counter configuration counter status

float [s], int [-] float [s], float [Hz], int [-]

counterInfo() , –Set() , –Get() counterStatus()

Sampling clock configuration

The AnalogIn instrument can use a sampling clock that is different from the internally generated clock that it would normally use. Three settings determine its behavior.

Sampling clock configuration (6 methods)

setting

type/unit

methods

sampling source

DwfTriggerSource

samplingSourceSet() , –Get()

sampling slope

DwfTriggerSlope

samplingSlopeSet() , –Get()

sampling delay

float [s]

samplingDelaySet() , –Get()

AnalogIn reference

class AnalogIn

The AnalogIn class provides access to the analog input (oscilloscope) instrument of a DwfDevice.

Attention

Users of pydwf should not create instances of this class directly.

It is instantiated during initialization of a DwfDevice and subsequently assigned to its public analogIn attribute for access by the user.

reset() None

Reset all AnalogIn instrument parameters to default values.

If autoconfiguration is enabled at the device level, the reset operation is performed immediately; otherwise, an explicit call to the configure() method is required.

Raises:

DwfLibraryError – An error occurred while executing the reset operation.

configure(reconfigure: bool, start: bool) None

Configure the instrument and start or stop the acquisition operation.

Parameters:
  • reconfigure (bool) – If True, the instrument settings are sent to the instrument. In addition, the auto-trigger timeout is reset.

  • start (bool) – If True, an acquisition is started. If False, an ongoing acquisition is stopped.

Raises:

DwfLibraryError – An error occurred while executing the configure operation.

status(read_data_flag: bool) DwfState

Get the AnalogIn instrument state.

This method performs a status request to the AnalogIn instrument and receives its response.

The following methods can be used to retrieve AnalogIn instrument status information as a result of this call, regardless of the value of the read_data_flag parameter:

The following methods can be used to retrieve bulk data obtained from the AnalogIn instrument as a result of this call, but only if the read_data_flag parameter is True:

Parameters:

read_data_flag (bool) –

If True, read sample data from the instrument.

In Single acquisition mode, the data will be read only when the acquisition is finished.

Returns:

The status of the AnalogIn instrument.

Return type:

DwfState

Raises:

DwfLibraryError – An error occurred while executing the status operation.

statusTime() Tuple[int, int, int]

Retrieve the timestamp of the current status information.

Returns:

A three-element tuple, indicating the POSIX timestamp of the status request. The first element is the POSIX second, the second and third element are the numerator and denominator, respectively, of the fractional part of the second.

In case status() hasn’t been called yet, this method will return zeroes for all three tuple elements.

Return type:

Tuple[int, int, int]

Raises:

DwfLibraryError – An error occurred while retrieving the status time.

statusSample(channel_index: int) float

Get the last ADC conversion sample from the specified AnalogIn instrument channel, in Volts.

Note

This value is updated even if the status() method is called with argument False.

Parameters:

channel_index (int) – The channel index, in the range 0 to channelCount()-1.

Returns:

The most recent ADC value of this channel, in Volts.

Return type:

float

Raises:

DwfLibraryError – An error occurred while retrieving the sample value.

statusAutoTriggered() bool

Check if the current acquisition is auto-triggered.

Returns:

True if the current acquisition is auto-triggered, False otherwise.

Return type:

bool

Raises:

DwfLibraryError – An error occurred while retrieving the auto-triggered status.

statusSamplesLeft() int

Retrieve the number of samples left in the acquisition, in samples.

Returns:

In case a finite-duration acquisition is active, the number of samples remaining to be acquired in the acquisition.

Return type:

int

Raises:

DwfLibraryError – An error occurred while retrieving the number of samples left.

statusSamplesValid() int

Retrieve the number of valid acquired data samples.

In Single acquisition mode, valid samples are returned when status() reports a result of Done.

The actual number of samples transferred and reported back here is equal to max(16, bufferSizeGet()).

Returns:

The number of valid samples.

Return type:

int

Raises:

DwfLibraryError – An error occurred while retrieving the number of valid samples.

statusIndexWrite() int

Retrieve the buffer write index.

This is needed in ScanScreen acquisition mode to display the scan bar.

Returns:

The buffer write index.

Return type:

int

Raises:

DwfLibraryError – An error occurred while retrieving the write-index.

statusRecord() Tuple[int, int, int]

Retrieve information about the recording process.

Data loss occurs when the device acquisition is faster than the read process to the PC.

If this happens, the device recording buffer is filled and data samples are overwritten.

Corrupt samples indicate that the samples have been overwritten by the acquisition process during the previous read.

In this case, try optimizing the loop process for faster execution or reduce the acquisition frequency or record length to be less than or equal to the device buffer size (i.e., record_length is less than or equal to buffer_size / sample_frequency).

Returns:

A three-element tuple containing the counts for available, lost, and corrupt data samples, in that order.

Return type:

Tuple[int, int, int]

Raises:

DwfLibraryError – An error occurred while retrieving the record status.

statusData(channel_index: int, count: int) ndarray

Retrieve the acquired data samples from the specified AnalogIn instrument channel.

This method returns samples as voltages, calculated from the raw, binary sample values as follows:

voltages = analogIn.channelOffsetGet(channel_index) + \
           analogIn.channelRangeGet(channel_index) * (raw_samples / 65536.0)

Note that the applied calibration is channel-dependent.

Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • count (int) – The number of samples to retrieve.

Returns:

A 1D numpy array of floats, in Volts.

Return type:

nd.array

Raises:

DwfLibraryError – An error occurred while retrieving the sample data.

statusData2(channel_index: int, offset: int, count: int) ndarray

Retrieve the acquired data samples from the specified AnalogIn instrument channel.

This method returns samples as voltages, calculated from the raw, binary sample values as follows:

voltages = analogIn.channelOffsetGet(channel_index) + \
           analogIn.channelRangeGet(channel_index) * (raw_samples / 65536.0)

Note

The applied calibration is channel-dependent.

Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • offset (int) – Sample offset.

  • count (int) – Sample count.

Returns:

A 1D numpy array of floats, in Volts.

Return type:

nd.array

Raises:

DwfLibraryError – An error occurred while retrieving the sample data.

statusData16(channel_index: int, offset: int, count: int) ndarray

Retrieve the acquired data samples from the specified AnalogIn instrument channel.

This method returns raw, signed 16-bit samples.

In case the ADC has less than 16 bits of raw resolution, least significant zero-bits are added to stretch the range to 16 bits.

To convert these raw samples to voltages, use the following:

voltages = analogIn.channelOffsetGet(channel_index) + \
           analogIn.channelRangeGet(channel_index) * (raw_samples / 65536.0)
Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • offset (int) – The sample offset to start copying from.

  • count (int) – The number of samples to retrieve.

Returns:

A 1D numpy array of 16-bit signed integers.

Return type:

nd.array

Raises:

DwfLibraryError – An error occurred while retrieving the sample data.

statusNoise(channel_index: int, count: int) Tuple[ndarray, ndarray]

Retrieve the acquired noise samples from the specified AnalogIn instrument channel.

Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • count (int) – Sample count.

Returns:

A two-element tuple; each element is a 1D numpy array of floats, in Volts.

The first array contains the minimum values, the second array contains the maximum values.

Raises:

DwfLibraryError – An error occurred while retrieving the noise data.

statusNoise2(channel_index: int, offset: int, count: int) Tuple[ndarray, ndarray]

Retrieve the acquired data samples from the specified AnalogIn instrument channel.

Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • offset (int) – Sample offset.

  • count (int) – Sample count.

Returns:

A two-element tuple; each element is a 1D numpy array of floats, in Volts.

The first array contains the minimum values, the second array contains the maximum values.

Raises:

DwfLibraryError – An error occurred while retrieving the noise data.

bitsInfo() int

Get the fixed the number of bits used by the AnalogIn ADC.

The number of bits can only be queried; it cannot be changed.

Note

The Analog Discovery 2 uses an Analog Devices AD9648 two-channel ADC. It converts 14-bit samples at a rate of up to 125 MHz. So for the Analog Discovery 2, this method always returns 14.

Returns:

The number of bits per sample for each of the AnalogIn channels.

Return type:

int

Raises:

DwfLibraryError – An error occurred while getting the number of bits.

recordLengthSet(record_duration: float) None

Set the AnalogIn record length, in seconds.

Note

This value is only used when the acquisition mode is configured as Record.

Parameters:

record_duration (float) –

The record duration to be configured, in seconds.

A record duration of 0.0 (zero) seconds indicates a request for an arbitrary-length record acquisition.

Raises:

DwfLibraryError – An error occurred while setting the record duration.

recordLengthGet() float

Get the AnalogIn record length, in seconds.

Note

This value is only used when the acquisition mode is configured as Record.

Returns:

The currently configured record length, in seconds.

A record length of 0.0 (zero) seconds indicates a request for an arbitrary-length record acquisition.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the record length.

frequencyInfo() Tuple[float, float]

Retrieve the minimum and maximum configurable ADC sample frequency of the AnalogIn instrument, in samples/second.

Returns:

The valid sample frequency range (min, max), in samples/second.

Return type:

Tuple[float, float]

Raises:

DwfLibraryError – An error occurred while getting the allowed sample frequency range.

frequencySet(sample_frequency: float) None

Set the ADC sample frequency of the AnalogIn instrument, in samples/second.

Parameters:

sample_frequency (float) – Sample frequency, in samples/second.

Raises:

DwfLibraryError – An error occurred while setting sample frequency.

frequencyGet() float

Get the ADC sample frequency of the AnalogIn instrument, in samples/second.

The ADC always runs at maximum frequency, but the method in which the samples are stored and transferred can be configured individually for each channel with the channelFilterSet method.

Returns:

The configured sample frequency, in samples/second.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the sample frequency.

bufferSizeInfo() Tuple[int, int]

Returns the minimum and maximum allowable buffer size for the AnalogIn instrument, in samples.

When using the Record acquisition mode, the buffer size should be left at the default value, which is equal to the maximum value. In other modes (e.g. Single), the buffer size determines the size of the acquisition window.

Note

The maximum buffer size depends on the device configuration that was selected while opening the device.

For example, on the Analog Discovery 2, the maximum AnalogIn buffer size can be 512, 2048, 8192, or 16384, depending on the device configuration.

Returns:

A two-element tuple. The first element is the minimum buffer size, the second element is the maximum buffer size.

Return type:

Tuple[int, int]

Raises:

DwfLibraryError – An error occurred while getting the buffer size info.

bufferSizeSet(buffer_size: int) None

Adjust the AnalogIn instrument buffer size, expressed in samples.

The actual buffer size configured will be clipped by the bufferSizeInfo() values.

The actual value configured can be read back by calling bufferSizeGet().

Parameters:

buffer_size (int) – The requested buffer size, in samples.

Raises:

DwfLibraryError – An error occurred while setting the buffer size.

bufferSizeGet() int

Return the used AnalogIn instrument buffer size, in samples.

Returns:

The currently configured buffer size, in samples.

Return type:

int

Raises:

DwfLibraryError – An error occurred while getting the buffer size.

noiseSizeInfo() int

Return the maximum noise buffer size for the AnalogIn instrument, in samples.

Returns:

The maximum noise buffer size, in samples.

Raises:

DwfLibraryError – An error occurred while getting the noise buffer size info.

noiseSizeSet(noise_buffer_size: int) None

Enable or disable the noise buffer for the AnalogIn instrument.

This method determines if the noise buffer is enabled or disabled.

Note

The name of this method and the type of its parameter (int) suggest that it can be used to specify the size of the noise buffer, but that is not the case.

Any non-zero value enables the noise buffer; a zero value disables it.

If enabled, the noise buffer size reported by noiseSizeGet() is always equal to the size of the sample buffer reported by bufferSizeGet(), divided by 8.

Parameters:

noise_buffer_size (int) – Whether to enable (non-zero) or disable (zero) the noise buffer.

Raises:

DwfLibraryError – An error occurred while setting the noise buffer enabled/disabled state.

noiseSizeGet() int

Return the currently configured noise buffer size for the AnalogIn instrument, in samples.

This value is automatically adjusted according to the sample buffer size, divided by 8. For instance, setting the sample buffer size of 8192 implies a noise buffer size of 1024; setting the sample buffer size to 4096 implies noise buffer size will be 512.

Returns:

The currently configured noise buffer size. Zero indicates that the noise buffer is disabled.

Return type:

int

Raises:

DwfLibraryError – An error occurred while getting the noise buffer size.

acquisitionModeInfo() List[DwfAcquisitionMode]

Get a list of valid AnalogIn instrument acquisition modes.

Returns:

A list of valid acquisition modes for the AnalogIn instrument.

Return type:

List[DwfAcquisitionMode]

Raises:

DwfLibraryError – An error occurred while getting the acquisition mode info.

acquisitionModeSet(acquisition_mode: DwfAcquisitionMode) None

Set the AnalogIn acquisition mode.

Parameters:

acquisition_mode (DwfAcquisitionMode) – The acquisition mode to be configured.

Raises:

DwfLibraryError – An error occurred while setting the acquisition mode.

acquisitionModeGet() DwfAcquisitionMode

Get the currently configured AnalogIn acquisition mode.

Returns:

The acquisition mode currently configured.

Return type:

DwfAcquisitionMode

Raises:

DwfLibraryError – An error occurred while getting the acquisition mode.

channelCount() int

Read the number of AnalogIn input channels.

Returns:

The number of analog input channels.

Return type:

int

Raises:

DwfLibraryError – An error occurred while retrieving the number of analog input channels.

channelCounts() Tuple[int, int, int]

Read the number of AnalogIn input channels, distinguishing between real and filter channels.

Returns:

The number of real, fiiltered, and total analog input channels.

Return type:

Tuple[int, int, int]

Raises:

DwfLibraryError – An error occurred while retrieving the number of analog input channels.

channelEnableSet(channel_index: int, channel_enable: bool) None

Enable or disable the specified AnalogIn input channel.

Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • channel_enable (bool) – Whether to enable (True) or disable (False) the specified channel.

Raises:

DwfLibraryError – An error occurred while enabling or disabling the channel.

channelEnableGet(channel_index: int) bool

Get the current enable/disable status of the specified AnalogIn input channel.

Parameters:

channel_index (int) – The channel index, in the range 0 to channelCount()-1.

Returns:

Channel is enabled (True) or disabled (False).

Return type:

bool

Raises:

DwfLibraryError – An error occurred while getting the enabled/disabled state of the channel.

channelFilterInfo() List[DwfAnalogInFilter]

Get a list of valid AnalogIn channel filter settings.

Returns:

A list of valid channel filter settings.

Return type:

List[DwfAnalogInFilter]

Raises:

DwfLibraryError – An error occurred while getting the channel filter info.

channelFilterSet(channel_index: int, channel_filter: DwfAnalogInFilter) None

Set the filter for a specified AnalogIn input channel.

Parameters:
Raises:

DwfLibraryError – An error occurred while setting the channel filter.

channelFilterGet(channel_index: int) DwfAnalogInFilter

Get the AnalogIn input channel filter setting.

Parameters:

channel_index (int) – The channel index, in the range 0 to channelCount()-1.

Returns:

The currently selected channel filter mode.

Return type:

DwfAnalogInFilter

Raises:

DwfLibraryError – An error occurred while getting the current channel filter setting.

channelRangeInfo() Tuple[float, float, int]

Report the possible voltage range of the AnalogIn input channels, in Volts.

The values returned represent ideal values. The actual calibrated ranges are channel-dependent.

See also

The channelRangeSteps() method returns essentially the same information in a different representation.

Returns:

The minimum range (Volts), maximum range (Volts), and number of different discrete channel range settings of the AnalogIn instrument.

Return type:

Tuple[float, float, int]

Raises:

DwfLibraryError – An error occurred while getting the analog input range setting info.

channelRangeSet(channel_index: int, channel_range: float) None

Set the range setting of the specified AnalogIn input channel, in Volts.

Note

The actual range set will generally be different from the requested range.

Note

Changing the channel range may also change the channel offset.

Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • channel_range (float) – The requested channel range, in Volts.

Raises:

DwfLibraryError – An error occurred while setting the channel voltage range.

channelRangeGet(channel_index: int) float

Get the range setting of the specified AnalogIn input channel, in Volts.

Together with the channel offset, this value can be used to transform raw binary ADC values into Volts.

Parameters:

channel_index (int) – The channel index, in the range 0 to channelCount()-1.

Returns:

The actual channel range, in Volts.

Return type:

float

Raises:

DwfLibraryError – An error occurred while setting the channel voltage range.

channelRangeSteps() List[float]

Report the possible voltage ranges of the AnalogIn input channels, in Volts, as a list.

The values returned represent ideal values. The actual calibrated ranges are channel-dependent.

See also

The channelRangeInfo() method returns essentially the same information in a different representation.

Returns:

A list of ranges, in Volts, representing the discrete channel range settings of the AnalogIn instrument.

Return type:

List[float]

Raises:

DwfLibraryError – An error occurred while getting the list of analog input range settings.

channelOffsetInfo() Tuple[float, float, int]

Get the possible AnalogIn input channel offset settings, in Volts.

Returns:

The minimum channel offset (Volts), maximum channel offset (Volts), and number of steps.

Return type:

Tuple[float, float, int]

Raises:

DwfLibraryError – An error occurred while getting the channel offset info.

channelOffsetSet(channel_index: int, channel_offset: float) None

Set the AnalogIn input channel offset, in Volts.

Note

The actual offset will generally be different from the requested offset.

Note

Changing the channel offset may also change the channel range.

Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • channel_offset (float) – The channel offset, in Volts.

Raises:

DwfLibraryError – An error occurred while setting the channel offset.

channelOffsetGet(channel_index: int) float

Get the AnalogIn input channel offset, in Volts.

Together with the channel range, this value can be used to transform raw binary ADC values into Volts.

Parameters:

channel_index (int) – The channel index, in the range 0 to channelCount()-1.

Returns:

The currently configured channel offset, in Volts.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the current channel offset setting.

channelAttenuationSet(channel_index: int, channel_attenuation: float) None

Set the AnalogIn input channel attenuation setting.

The channel attenuation is a dimensionless factor.

This setting is used to compensate for probe attenuation. Many probes have two attenuation settings (e.g., ×1 and ×10). The value of this setting should correspond to the value of the probe, or 1 (the default) if a direct connection without attenuation is used.

Note

Changing the channel attenuation will also change the channel offset and range.

Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • channel_attenuation (float) – The requested channel attenuation setting. If it is 0.0, the attenuation is set to 1.0 (the default) instead.

Raises:

DwfLibraryError – An error occurred while setting the current channel attenuation.

channelAttenuationGet(channel_index: int) float

Get the AnalogIn input channel attenuation setting.

The channel attenuation is a dimensionless factor.

This setting is used to compensate for probe attenuation. Many probes have two attenuation settings (e.g., ×1 and ×10). The value of this setting should correspond to the value of the probe, or 1 (the default) if a direct connection without attenuation is used.

Parameters:

channel_index (int) – The channel index, in the range 0 to channelCount()-1.

Returns:

The channel attenuation setting.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the current channel attenuation.

channelBandwidthSet(channel_index: int, channel_bandwidth: float) None

Set the AnalogIn input channel bandwidth setting.

Note

On the Analog Discovery 2, the channel bandwidth setting exists and can be set and retrieved, but the value has no effect.

Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • channel_bandwidth (float) – The channel bandwidth setting, in Hz.

Raises:

DwfLibraryError – An error occurred while setting the channel bandwidth.

channelBandwidthGet(channel_index: int) float

Get the AnalogIn input channel bandwidth setting.

Note

On the Analog Discovery 2, the channel bandwidth setting exists and can be set and retrieved, but the value has no effect.

Parameters:

channel_index (int) – The channel index, in the range 0 to channelCount()-1.

Returns:

The channel bandwidth setting, in Hz.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the current channel bandwidth.

channelImpedanceSet(channel_index: int, channel_impedance: float) None

Set the AnalogIn input channel impedance setting, in Ohms.

Note

On the Analog Discovery 2, the channel impedance setting exists and can be set and retrieved, but the value has no effect.

Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • channel_impedance (float) – channel impedance setting, in Ohms.

Raises:

DwfLibraryError – An error occurred while setting the current channel impedance.

channelImpedanceGet(channel_index: int) float

Get the AnalogIn input channel impedance setting, in Ohms.

Note

On the Analog Discovery 2, the channel impedance setting exists and can be set and retrieved, but the value has no effect.

Parameters:

channel_index (int) – The channel index, in the range 0 to channelCount()-1.

Returns:

The channel impedance setting, in Ohms.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the current channel impedance.

channelCouplingInfo() List[DwfAnalogCoupling]

Get the AnalogIn channel coupling info.

Raises:

DwfLibraryError – An error occurred while getting the channel coupling info.

channelCouplingSet(channel_index: int, channel_coupling: DwfAnalogCoupling) None

Set the AnalogIn input channel coupling.

Parameters:
  • channel_index (int) – The channel index, in the range 0 to channelCount()-1.

  • channel_coupling (AnalogCoupling) – channel coupling to be set.

Raises:

DwfLibraryError – An error occurred while setting the current channel coupling.

channelCouplingGet(channel_index: int) DwfAnalogCoupling

Get the AnalogIn input channel impedance setting, in Ohms.

Parameters:

channel_index (int) – The channel index, in the range 0 to channelCount()-1.

Returns:

The channel coupling (DC or AC).

Return type:

DwfAnalogCoupling

Raises:

DwfLibraryError – An error occurred while getting the current channel impedance.

triggerSourceInfo() List[DwfTriggerSource]

Get the AnalogIn instrument trigger source info.

Warning

This method is obsolete.

Use the generic DwfDevice.triggerInfo() method instead.

Returns:

A list of trigger sources that can be selected.

Return type:

List[DwfTriggerSource]

Raises:

DwfLibraryError – An error occurred while retrieving the trigger source information.

triggerSourceSet(trigger_source: DwfTriggerSource) None

Set the AnalogIn instrument trigger source.

Parameters:

trigger_source (DwfTriggerSource) – The trigger source to be selected.

Raises:

DwfLibraryError – An error occurred while setting the trigger source.

triggerSourceGet() DwfTriggerSource

Get the currently selected instrument trigger source.

Returns:

The currently selected trigger source.

Return type:

DwfTriggerSource

Raises:

DwfLibraryError – An error occurred while retrieving the selected trigger source.

triggerPositionInfo() Tuple[float, float, int]

Get the AnalogIn instrument trigger position range.

Returns:

The valid range of trigger positions that can be configured. The values returned are the minimum and maximum valid position settings, and the number of steps.

Return type:

Tuple[float, float, int]

Raises:

DwfLibraryError – An error occurred while retrieving the trigger position info.

triggerPositionSet(trigger_position: float) None

Set the AnalogIn instrument trigger position, in seconds.

The meaning of the trigger position depends on the currently selected acquisition mode:

  • In Record acquisition mode, the trigger position is the time of the first valid sample acquired relative to the position of the trigger event. Negative values indicates times before the trigger time.

    To place the trigger in the middle of the recording, this value should be set to -0.5 times the duration of the recording.

  • In Single acquisition mode, the trigger position is the trigger event time relative to the center of the acquisition window.

    To place the trigger in the middle of the acquisition buffer, the value should be 0.

Parameters:

trigger_position (float) – The trigger position to be configured, in seconds.

Raises:

DwfLibraryError – An error occurred while setting the trigger position.

triggerPositionGet() float

Get the AnalogIn instrument trigger position, in seconds.

Returns:

The currently configured trigger position, in seconds.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the trigger position.

triggerPositionStatus() float

Get the current AnalogIn instrument trigger position status.

Returns:

The current trigger position, in seconds.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the trigger position status.

triggerAutoTimeoutInfo() Tuple[float, float, int]

Get the AnalogIn instrument trigger auto-timeout range, in seconds.

Returns:

The valid range of trigger auto-timeout values that can be configured. The values returned are the minimum and maximum valid auto-timeout settings, and the number of steps.

Return type:

Tuple[float, float, int]

Raises:

DwfLibraryError – An error occurred while getting the trigger auto-timeout info.

triggerAutoTimeoutSet(trigger_auto_timeout: float) None

Set the AnalogIn instrument trigger auto-timeout value, in seconds.

When set to 0, the trigger auto-timeout feature is disabled, corresponding to Normal acquisition mode on desktop oscilloscopes.

Parameters:

trigger_auto_timeout (float) – The auto timeout setting, in seconds.

Raises:

DwfLibraryError – An error occurred while setting the trigger auto-timeout value.

triggerAutoTimeoutGet() float

Get the AnalogIn instrument trigger auto-timeout value, in seconds.

Returns:

The currently configured auto-timeout value, in seconds.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the trigger auto-timeout value.

triggerForce() None

Force assertion of the AnalogIn instrument trigger.

Important

This method forces the AnalogIn device to act as if it was triggered, independent of the currently active trigger source. It does not generate an artificial trigger event on the AnalogIn trigger detector.

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerHoldOffInfo() Tuple[float, float, int]

Get the AnalogIn trigger detector holdoff range, in seconds.

The trigger holdoff setting is the minimum time (in seconds) that should pass for a trigger to be recognized by the trigger detector after a previous trigger event.

Returns:

The valid range of trigger detector holdoff values that can be configured. The values returned are the minimum and maximum valid holdoff settings, and the number of steps.

Return type:

Tuple[float, float, int]

Raises:

DwfLibraryError – An error occurred while getting the trigger holdoff info.

triggerHoldOffSet(trigger_detector_holdoff: float) None

Set the AnalogIn trigger detector holdoff value, in seconds.

Parameters:

trigger_detector_holdoff (float) – The trigger holdoff setting, in seconds.

The value 0 disables the trigger detector holdoff feature.

Raises:

DwfLibraryError – An error occurred while setting the trigger detector holdoff value.

triggerHoldOffGet() float

Get the current AnalogIn trigger holdoff value, in seconds.

Returns:

The currently configured trigger holdoff value, in seconds.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the trigger holdoff value.

triggerTypeInfo() List[DwfAnalogInTriggerType]

Get the valid AnalogIn trigger detector trigger-type values.

This setting determines the type of event recognized by the AnalogIn trigger detector as a trigger. Possible types includes Edge, Pulse, Transition, and Window.

Returns:

A list of trigger detector trigger-types that can be configured.

Return type:

List[DwfAnalogInTriggerType]

Raises:

DwfLibraryError – An error occurred while getting the trigger detector trigger-type info.

triggerTypeSet(trigger_detector_type: DwfAnalogInTriggerType) None

Set the AnalogIn trigger detector trigger-type.

Parameters:

trigger_detector_type (DwfAnalogInTriggerType) – The trigger detector trigger-type to be configured.

Raises:

DwfLibraryError – An error occurred while setting the trigger detector trigger-type.

triggerTypeGet() DwfAnalogInTriggerType

Get the currently configured AnalogIn trigger detector trigger-type.

Returns:

The currently configured trigger detector trigger-type.

Return type:

DwfAnalogInTriggerType

Raises:

DwfLibraryError – An error occurred while getting the trigger detector trigger-type.

triggerChannelInfo() Tuple[int, int]

Get the AnalogIn trigger detector channel range.

The AnalogIn trigger detector monitors a specific analog in channel for trigger events. This method returns the range of valid analog input channels that can be configured as the AnalogIn trigger detector channel.

Returns:

The first and last channel that can be used as trigger detector channels.

Return type:

Tuple[int, int]

Raises:

DwfLibraryError – An error occurred while getting the trigger detector channel range.

triggerChannelSet(trigger_detector_channel_index: int) None

Set the AnalogIn trigger detector channel.

This is the analog input channel that the AnalogIn trigger detector monitors for trigger events.

Parameters:

trigger_detector_channel_index (int) – The trigger detector channel to be selected.

Raises:

DwfLibraryError – An error occurred while setting the trigger detector channel.

triggerChannelGet() int

Get the AnalogIn trigger detector channel.

This is the analog input channel that the AnalogIn trigger detector monitors for trigger events.

Returns:

The currently configured trigger detector channel.

Return type:

int

Raises:

DwfLibraryError – An error occurred while getting the trigger detector channel.

triggerFilterInfo() List[DwfAnalogInFilter]

Get a list of valid AnalogIn trigger detector filter values.

Returns:

A list of filters that can be configured for the trigger detector channel.

Return type:

List[DwfAnalogInFilter]

Raises:

DwfLibraryError – An error occurred while getting the valid trigger detector channel filter values.

triggerFilterSet(trigger_detector_filter: DwfAnalogInFilter) None

Set the AnalogIn trigger detector channel filter.

Parameters:

trigger_detector_filter (DwfAnalogInFilter) – The trigger detector channel filter to be selected.

Raises:

DwfLibraryError – An error occurred while setting the trigger detector channel filter.

triggerFilterGet() DwfAnalogInFilter

Get the AnalogIn trigger detector channel filter.

Returns:

The currently configured trigger detector channel filter.

Return type:

DwfAnalogInFilter

Raises:

DwfLibraryError – An error occurred while getting the trigger detector channel filter.

triggerLevelInfo() Tuple[float, float, int]

Get the AnalogIn trigger detector valid trigger level range, in Volts.

Returns:

The range of valid trigger levels that can be configured. The values returned are the minimum and maximum trigger levels in Volts, and the number of steps.

Return type:

Tuple[float, float, int]

Raises:

DwfLibraryError – An error occurred while getting the trigger level range.

triggerLevelSet(trigger_detector_level: float) None

Set the AnalogIn trigger detector trigger-level, in Volts.

Parameters:

trigger_detector_level (float) – The trigger level to be configured, in Volts.

Raises:

DwfLibraryError – An error occurred while setting the trigger level.

triggerLevelGet() float

Get the AnalogIn trigger detector trigger-level, in Volts.

Returns:

The currently configured trigger level, in Volts.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the trigger level.

triggerHysteresisInfo() Tuple[float, float, int]

Get the AnalogIn trigger detector valid hysteresis range, in Volts.

Returns:

The valid range of trigger hysteresis values that can be configured. The values returned are the minimum and maximum trigger hysteresis levels in Volts, and the number of steps.

Return type:

Tuple[float, float, int]

Raises:

DwfLibraryError – An error occurred while getting the trigger hysteresis info.

triggerHysteresisSet(trigger_detector_hysteresis: float) None

Set the AnalogIn trigger detector hysteresis, in Volts.

Parameters:

trigger_detector_hysteresis (float) – The trigger hysteresis to be configured, in Volts.

Raises:

DwfLibraryError – An error occurred while setting the trigger hysteresis.

triggerHysteresisGet() float

Get the AnalogIn trigger detector trigger hysteresis, in Volts.

Returns:

The currently configured trigger hysteresis, in Volts.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the trigger hysteresis.

triggerConditionInfo() List[DwfTriggerSlope]

Get the valid AnalogIn trigger detector condition (slope) options.

Returns:

A list of valid trigger detector condition (slope) values.

Return type:

List[DwfTriggerSlope]

Raises:

DwfLibraryError – An error occurred while getting the valid trigger detector condition values.

triggerConditionSet(trigger_detector_condition: DwfTriggerSlope) None

Set the AnalogIn trigger detector condition (slope).

Parameters:

trigger_detector_condition (DwfTriggerSlope) – The trigger detector condition (slope) to be configured.

Raises:

DwfLibraryError – An error occurred while setting the trigger condition.

triggerConditionGet() DwfTriggerSlope

Get the AnalogIn trigger detector condition (slope).

Returns:

The currently configured trigger condition (slope).

Return type:

DwfTriggerSlope

Raises:

DwfLibraryError – An error occurred while setting the trigger condition (slope).

triggerLengthInfo() Tuple[float, float, int]

Get the valid AnalogIn trigger detector length range, in seconds.

Returns:

The valid range of trigger detector length values that can be configured. The values returned are the minimum and maximum trigger detector length values in seconds, and the number of steps.

Return type:

Tuple[float, float, int]

Raises:

DwfLibraryError – An error occurred while getting the trigger length range.

triggerLengthSet(trigger_detector_length: float) None

Set the AnalogIn trigger detector length, in seconds.

Parameters:

trigger_detector_length (float) – The trigger detector trigger length to be configured, in seconds.

Raises:

DwfLibraryError – An error occurred while setting the trigger detector length.

triggerLengthGet() float

Get the AnalogIn trigger detector length, in seconds.

Returns:

The currently configured trigger detector trigger length, in seconds.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the trigger detector length.

triggerLengthConditionInfo() List[DwfAnalogInTriggerLengthCondition]

Get a list of valid AnalogIn trigger detector length condition values.

Trigger length condition values include Less, Timeout, and More.

Returns:

A list of valid trigger detector length condition values.

Return type:

List[DwfAnalogInTriggerLengthCondition]

Raises:

DwfLibraryError – An error occurred while getting the trigger length condition info.

triggerLengthConditionSet(trigger_detector_length_condition: DwfAnalogInTriggerLengthCondition) None

Set the AnalogIn trigger detector length condition.

Parameters:

trigger_detector_length_condition (DwfAnalogInTriggerLengthCondition) – The trigger detector length condition to be configured.

Raises:

DwfLibraryError – An error occurred while setting the trigger detector length condition.

triggerLengthConditionGet() DwfAnalogInTriggerLengthCondition

Get the AnalogIn trigger detector length condition.

Returns:

The currently configured trigger detector length condition.

Return type:

DwfAnalogInTriggerLengthCondition

Raises:

DwfLibraryError – An error occurred while getting the trigger detector length condition.

counterInfo() Tuple[int, float]

Get AnalogIn counter info.

counterSet(duration: float) None

Set AnalogIn counter duration.

counterGet() float

Get AnalogIn counter duration.

counterStatus() Tuple[float, float, int]

Get AnalogIn counter status.

samplingSourceSet(sampling_source: DwfTriggerSource) None

Set the AnalogIn sampling source.

Parameters:

sampling_source (DwfTriggerSource) – The sampling source to be configured.

Raises:

DwfLibraryError – An error occurred while setting the sampling source.

samplingSourceGet() DwfTriggerSource

Get the AnalogIn sampling source.

Returns:

The currently configured sampling source.

Return type:

DwfTriggerSource

Raises:

DwfLibraryError – An error occurred while getting the sampling source.

samplingSlopeSet(sampling_slope: DwfTriggerSlope) None

Set the AnalogIn sampling slope.

Parameters:

sampling_slope (DwfTriggerSlope) – The sampling slope to be configured.

Raises:

DwfLibraryError – An error occurred while setting the sampling slope.

samplingSlopeGet() DwfTriggerSlope

Get the AnalogIn sampling slope.

Returns:

The currently configured sampling slope.

Return type:

DwfTriggerSlope

Raises:

DwfLibraryError – An error occurred while getting the sampling slope.

samplingDelaySet(sampling_delay: float) None

Set the AnalogIn sampling delay, in seconds.

Parameters:

sampling_delay (float) – The sampling delay to be configured, in seconds.

Raises:

DwfLibraryError – An error occurred while setting the sampling delay.

samplingDelayGet() float

Get the AnalogIn sampling delay, in seconds.

Returns:

The currently configured sampling delay, in seconds.

Return type:

float

Raises:

DwfLibraryError – An error occurred while getting the sampling delay.

property device

Return the DwfDevice instance of which we are an attribute.

This is useful if we have a variable that contains a reference to a DwfDevice attribute, but we need the DwfDevice itself.

Returns:

The DwfDevice instance that this attribute belongs to.

Return type:

DwfDevice