Skip to content

Possible error when converting a list with positive and negative numbers to DAC #1

Description

@mdiea

Thank you for your work!
Look, I detected something that caused me a malfunction in "AgilentGenerator.py" on line 195 (def convert_list_to_dac_str).
I solved it this way, I clarify that I am taking the first steps in Python.

         dac_val = lambda val: round(val * dac_steps / v_steps)
         #dac_val = lambda val: round(dac_low + val * dac_steps / v_steps).

The error occurred because the function generates values outside the DAC range (outside the range -8191 to 8191), when the list has positive and negative values.

test code:

...
NN=10000
nn=np.arange(NN)
signal=np.zeros(NN)
signal=np.sin(2 * np.pi * nn/NN )

generator_points=signal.tolist()

device = AgilentGenerator33220A()
device.reset()
frequency = 2100
low_limit = np.min(signal)
high_limit = np.max(signal)
device.set_custom_waveform(generator_points, frequency, low_limit, high_limit)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions