Analog Out

class analogOut.AnalogOut[source]

Bases: Schedule

Class which implements the DAC features.

It contains all the necessary methods to use the analog outputs of a VPixx device.

getBaseAddress()[source]

Gets the Ram buffer start address.

This method allows the user to get the RAM buffer start address used in schedules. It should only be used if the user wants the schedules to wrap when it has reached its maximum size. When schedules are expected to wrap, the user should also use setBufferSize()

Returns:

Any value in a range of 0 up to the RAM size.

Return type:

int

getBufferSize()[source]

Gets the Ram buffer size.

This method allows the user to get the RAM buffer size used in schedules.

Returns:

Any value in a range of 0 up to the RAM size.

Return type:

int

See also

setBufferSize

getChannelRange(channel)[source]

Gets the range of a channel.

Returns:

Range of the channel. The returned value is a tuple with the minimum range followed by the maximum range. Both values are integers.

Return type:

tuple

getChannelValue(channel)[source]

Gets the current value of a channel.

This method allows the user to know the value of a given channel. The return value is a 16-bit 2’s complement signed number. Value can be obtained for channels 0 to 17.

Returns:

value of the channel.

Return type:

int

See also

setChannelValue

getChannelVoltage(channel)[source]

Gets the current voltage of a channel.

Returns:

voltage of the channel.

Return type:

float

getNbrOfChannel()[source]

Gets the number of channels available.

Returns:

Number of channels.

Return type:

int

getReadAddress()[source]

Gets the Ram buffer read address.

This method allows the user to get the RAM buffer read address used in schedules.

Returns:

Any value in a range of 0 up to the RAM size.

Return type:

int

getScheduleCount()[source]

Gets the schedule count value.

This method allows the user to get the current count for a schedule.

Returns:

Any positive value equal to or greater than 0.

Return type:

int

getScheduleOnset()[source]

Gets the schedule onset value.

This method allows the user to get the schedule onset value used in schedules. The onset represents a nanosecond delay between schedule start and first sample.

Returns:

Any positive value equal to or greater than 0.

Return type:

int

getScheduleRate()[source]

Gets the schedule rate value.

This method allows the user to get the schedule rate value used in schedules. The rate represents the speed at which the schedule updates.

Returns:

Any positive value equal to or greater than 0.

Return type:

int

getScheduleUnit()[source]

Gets the schedule unit value.

This method allows the user to get the schedule unit value used in schedules.

Returns:

Any positive value equal to or greater than 0.

Return type:

int

getStatus(inDict)[source]

Updates the information dictionary for the DAC schedule.

Parameters:

inDict (dict) – The dictionary returned by the schedule setup

Updates the dictionary with the following information:

“scheduleRunning” is True if the DAC schedule is currently running, or False if stopped. “scheduleOnset” is the programmed delay in seconds between StartAdcSchedule execution, and the first ADC sample acquisition. “scheduleRate” is the rate at which subsequent ADC samples are acquired. “scheduleRateUnits” is the programmed units of scheduleRate: “Hz” is samples per second, “video” is samples per video frame, “nano” is seconds per sample “numDacSchedChans” is the number of ADC channels scheduled for acquisition. “channelList” is the list of channels and their reference, if enabled. “bufferBaseAddress” is the acquisition data buffer base address within the Datapixx. “bufferSize” is the number of bytes in the acquisition data buffer. “numBufferFrames” is the total number of samples which fit in the acquisition data buffer. “currentReadFrame” is the buffer frame which will be read by the next streaming call to ReadAdcBuffer. “maxScheduleFrames”, if non-0, is the value of currentWriteFrame which will automatically stop the schedule.

isChannelRamBuffering(channel)[source]

Verifies the ram buffering mode.

This method allows the user to know if a ram buffering is enabled for a given channel.

Parameters:

channel (int) – Channel number to query.

Returns:

True if the given channel is buffered, False otherwise.

Return type:

Bool

isCountDownEnabled()[source]

Verifies the schedule count down mode.

Returns:

True if the schedule is decrementing at every sample, False otherwise.

Return type:

enable (Bool)

isHardwareCalibration()[source]

Verifies the hardware calibration mode.

Returns:

True if hardware calibration is enabled, False otherwise.

Return type:

Bool

isScheduleRunning()[source]

Verifies if a schedule is currently running on the subsystem.

Returns:

True if a schedule is currently running, False otherwise.

Return type:

schedule_running (Bool)

See also

startSchedule, stopSchedule, getScheduleRunningState()

setBaseAddress(address)[source]

Sets the Ram buffer start address.

This method allows the user to set the RAM buffer start address used in schedules. The given address must be an even value.

Parameters:

address (int) – Any value in a range of 0 up to the RAM size.

setBufferSize(buffer_size)[source]

Sets the Ram buffer size.

This method allows the user to set the RAM buffer size used in schedules. It should only be used if the user wants the schedules to wrap when it has reached its maximum size. When schedules are expected to wrap, the user should also use setBaseAddress(). The given size is in bytes and must be an even value.

Parameters:

buffer_size (int) – Any value in a range of 0 up to the RAM size.

See also

getBufferSize

setChannelRamBuffering(enable, channel=None)[source]

Sets the ram buffering mode.

This method allows the user to enable or disable ram buffering on a given channel. When enabled, a given channel is buffered in ram. Enabling RAM buffering can only be done for channels 0 to 15.

Parameters:
  • enable (Bool) – True if hardware calibration is enabled, False otherwise.

  • channel (int) – Channel number to enable or disable. Passing None will set all channels.

setChannelValue(value, channel)[source]

Sets the current value of a channel.

This method allows the user to modify the output value of a given channel.

Parameters:
  • value (int) – Value of the channel. It is a 16-bit 2’s complement signed number.

  • channel (int) – Channel number.

See also

getChannelValue

setChannelVoltage(voltage, channel)[source]

Sets the current Voltage of a channel.

This method allows the user to modify the output voltage of a given channel. The voltage is +-10V for channels 0 and 1, and +-5V for channels 2 and 3.

Parameters:
  • voltage (float) – Value of the channel.

  • channel (int) – Channel number.

setHardwareCalibration(enable)[source]

Sets the hardware calibration mode.

This method allows the user to enable or disable the hardware calibration mode. When enabled, the ADC data bypasses the hardware calibration. When disabled, the ADC data passes by the hardware calibration.

Parameters:

enable (Bool) – True if hardware calibration is enabled, False otherwise.

setReadAddress(address)[source]

Sets the Ram buffer read address.

This method allows the user to set the RAM buffer read address used in schedules. This address is used by the schedule to know where the data should be first read from. The schedule will then read the following data to the address following the RAM buffer read address.

The given address must be an even value.

Parameters:

address (int) – Any value in a range of 0 up to the RAM size.

setSchedule(scheduleOnset, scheduleRate, rateUnits, maxScheduleFrames, channelList=None, bufferBaseAddress=0, numBufferFrames=None)[source]

Configure a schedule for autonomous DAC analog signal acquisition.

This function is used to fully setup an acquisition schedule on the device. Regardless of the actual format chosen, the resulting sample rate cannot exceed 1 MHz. It returns a dictionary that is needed when reading data or updating the buffer. Use ReadAdcBuffer to upload the acquired data from this address after calling StartAdcSchedule. Note that every call to StartAdcSchedule must be preceeded by a call to SetAdcSchedule (ie: multiple calls to StartAdcSchedule each require their own call to SetAdcSchedule).

Parameters:
  • onSet (float) – The desired delay (in double precision seconds) between schedule initiation, and the first ADC sample acquisition.

  • rateValue (int) – The rate at which the ADC’s acquire successive samples.

  • rateUnits (str) – This can have three values: “Hz” for samples/seconds, “video” for samples/video frame or “nano” for seconds/samples

  • maxScheduleFrames (int) – If the dataset has a known length, then maxScheduleFrames should be that number. If it is a dynamic length, pass 0.

  • channelList (list) – List of the DAC channels which should be updated from the waveform buffer. The list should contain 1 or more integers in the range 0 toGetDacNumChannels-1.

  • bufferBaseAddress (int) – The start of the RAM buffer which should hold the acquired data inside the Datapixx. Default value is 4e6.

  • numBufferFrames (int) – Specifies the desired size of the acquisition buffer in the Datapixx RAM. Default value of maxScheduleFrames. If maxScheduleFrames is larger than numBufferFrames (or 0), then each time the acquisition frame counter reaches a multiple of numBufferFrames, the acquisition buffer address automatically wraps back to bufferBaseAddress. This circular buffer effect can be used for acquiring arbitrarily long analog datasets. Simply monitor newBufferFrames returned by GetAdcStatus, and use ReadAdcBuffer in streaming mode to upload newly acquired data from the Datapixx RAM to the host.

Returns:

Returns a dictionary which has some global information which must be passed to other DAC functions.

Return type:

DACDictionary (dict)

setScheduleCount(count)[source]

Sets the schedule count.

This method allows the user to set the schedule count for a schedule with a fixed number of samples. In which case, the schedule will decrement at a given rate and stop when the count reaches 0.

Parameters:

count (int) – Any positive value greater than 0.

setScheduleCountDown(enable)[source]

Sets the schedule count down mode.

This method allows the user to enable or disable the count down on a schedule. When enabled, the schedule decrements at the given rate and stops automatically when the count hits 0. When disabled, the schedule increments at the given rate and is stopped by calling stopSchedule().

Parameters:

enable (Bool) – True if count down is enabled, False otherwise.

setScheduleOnset(onset)[source]

Sets the schedule onset value.

This method allows the user to set the nanosecond delay between schedule start and first sample. If no delay is required, this method doesn’t need to be used. Default value is 0.

Parameters:

onset (int) – Any positive value equal to or greater than 0.

setScheduleRate(rate, unit='hz')[source]

Sets the schedule rate.

This method allows the user to set the schedule rate. Since the rate can be given with different units, the method also needs to have a unit associated with the rate. If no delay is required, this method doesn’t need to be used.

Parameters:
  • rate (int) – Any positive value equal to or greater than 0.

  • unit (str) – hz : samples per second, maximum 1 MHz. video : samples per video frame, maximum 1 MHz. nano : sample period in nanoseconds, minimum 1000 ns.

startSchedule()[source]

Starts a schedule.

Schedules may be configured in different ways, affecting their behavior. Before a schedule is started, the user should make sure that it is properly set in the right mode.

stopSchedule()[source]

Stops the active schedule for a given subsystem.

Depending on how the Schedules are configured, it may not be necessary to call this method. When a schedule is using a count down, it is not required to stop the schedule.

writeBuffer(bufferData, bufferAddress=0, channelList=None)[source]

Writes the data that will be used by the DAC buffer to drive the analogue outputs.

Parameters:
  • bufferData (multi-dimension list) – nChans x nFrame list where each row of the matrix contains the sample data for one DAC channel. Each column of the list contains one sample for each DAC channel.

  • bufferAddress (int) – The byte address in Datapixx RAM where the buffer should start. Default value of zero. Streaming value of -1 not implemented yet.

  • channelList (list) – channelList by default is channel 0…nChans channels. If provided, it needs to be a list of size nChans.

Returns:

nextBufferAddress, the next address availible to write to memory after the DAC buffer.

Return type:

int