Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mdiea opened this issue Dec 16, 2022 · 0 comments

Comments

@mdiea
Copy link

mdiea commented Dec 16, 2022

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant