"""
evaluation of the gains: measure the peak-to-peak of the input signal
for the various gains
It supposes an input pulse (and trigger signal)


"""

from struct import*
import ctypes
import array
import numpy as np
import matplotlib.pyplot as plt
import time

from ADUCv2p0 import*


chip1 = ADUCv2p0(0x50,True)

chip1.set_channel(3) #ADC

#chip1.set_remote_trigg(1)

Vpp = np.zeros(7)



chip1.set_pga_state(0x18)
for g in range(1,8):
    chip1.set_pga_state(16*g+8)
    time.sleep(0.5)
    data = chip1.read_data()
    Vpp[g-1] = max(data)-min(data)
    
plt.plot(Vpp,'o')

plt.yscale("log")

plt.show()
