Commit 3764f67e authored by Matthieu Cattin's avatar Matthieu Cattin

test39: Reproduce behaviour found by Federico.

parent 9cef5a14
......@@ -242,8 +242,8 @@ def main (default_directory='.'):
# Acquisition parameters
ACQ_PAUSE = 1 # pause between acq. stop and start, start and trigger
IN_RANGE = '1V'
IN_TERM = 'ON'
IN_RANGE = '10V'
IN_TERM = 'OFF'
ADC_FS = {'10V':10.0, '1V':1.0, '100mV':0.1}
##################################################
......@@ -264,36 +264,7 @@ def main (default_directory='.'):
##################################################
# Acquire channel 1
##################################################
print "\nAcquiring channel 1"
# Configure analogue input
fmc.set_input_range(1, IN_RANGE)
fmc.set_input_term(1, IN_TERM)
time.sleep(SSR_SET_SLEEP)
# connect AWG to current channel
box.select_output_ch(1)
time.sleep(BOX_SET_SLEEP)
# Perform an acquisition
acq_data, trig_timetag = acq_channels(fmc, carrier, ADC_FS[IN_RANGE], ACQ_PAUSE)
channel_data = acq_data[0::4]
print("Number of samples: %d"%(len(channel_data)))
# Calculate middle value
ch_max = max(channel_data)
ch_min = min(channel_data)
ch_mid = (abs(ch_max) - abs(ch_min))
ch_mean = mean(channel_data)
print("Channel max=%d, min=%d, mid=%d, mean=%d"%(ch_max, ch_min, ch_mid, ch_mean))
non_cal_ch_mean = ch_mid
non_cal_ch_data = channel_data
# Plot channel
#plot_channel(channel_data, ch_mean, 32768)
##################################################
# Apply gain and offset correction
# Get ADC/DAC gain and offset correction values
##################################################
# Get ADC and DAC offset and gain correction parameters
......@@ -386,10 +357,53 @@ def main (default_directory='.'):
print ""
"""
##################################################
# Apply DAC gain and offset correction
##################################################
# Write DAC gain and offset correction value to fmc class
print "\nApply DAC correction\n"
fmc.set_dac_corr(dac_corr_data)
##################################################
# Apply a DC offset
##################################################
dc_offset = 0xA000
fmc.set_dc_offset_corrected(1, IN_RANGE, dc_offset, print_value=True)
##################################################
# Acquire channel 1
##################################################
print "\nAcquiring channel 1"
# Configure analogue input
fmc.set_input_range(1, IN_RANGE)
fmc.set_input_term(1, IN_TERM)
time.sleep(SSR_SET_SLEEP)
# connect AWG to current channel
box.select_output_ch(1)
time.sleep(BOX_SET_SLEEP)
# Perform an acquisition
acq_data, trig_timetag = acq_channels(fmc, carrier, ADC_FS[IN_RANGE], ACQ_PAUSE)
channel_data = acq_data[0::4]
print("Number of samples: %d"%(len(channel_data)))
# Calculate middle value
ch_max = max(channel_data)
ch_min = min(channel_data)
ch_mid = (abs(ch_max) - abs(ch_min))
ch_mean = mean(channel_data)
print("Channel max=%d, min=%d, mid=%d, mean=%d"%(ch_max, ch_min, ch_mid, ch_mean))
non_cal_ch_mean = ch_mid
non_cal_ch_data = channel_data
# Plot channel
#plot_channel(channel_data, ch_mean, 32768)
##################################################
# Apply ADC gain and offset correction
##################################################
g = adc_corr_data[IN_RANGE]['gain'][0]
o = adc_corr_data[IN_RANGE]['offset'][0]
print "\nApply ADC offset correction: gain=0x%04X, offset=0x%04X" %(g, o)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment