def ltc2173_12_dc1525a_i(num_samples, spi_registers, verbose = False, do_plot = False, do_write_to_file = False): with Dc1525aI(spi_registers, verbose) as controller: # You can call this multiple times with the same controller if you need to ch0, ch1, ch2, ch3 = controller.collect(num_samples, consts.TRIGGER_NONE) if do_plot: funcs.plot_channels(controller.get_num_bits(), ch0, ch1, ch2, ch3, verbose=verbose) if do_write_to_file: funcs.write_channels_to_file_32_bit("data.txt", ch0, ch1, ch2, ch3, verbose=verbose) return ch0, ch1, ch2, ch3
def ltc2324_16_dc2395a_b(num_samples, verbose = False, do_plot = False, do_write_to_file = False): with ltc2320.Ltc2320(dc_number = 'DC2395A-B', num_channels = 4, num_bits = 16, verbose = verbose) as controller: # You can call this multiple times with the same controller if you need to ch0, ch1, ch2, ch3 = controller.collect(num_samples, consts.TRIGGER_NONE) if do_plot: funcs.plot_channels(controller.get_num_bits(), ch0, ch1, ch2, ch3, verbose=verbose) if do_write_to_file: funcs.write_channels_to_file_32_bit("data.txt", ch0, ch1, ch2, ch3, verbose=verbose) return ch0, ch1, ch2, ch3
def ltc2261_dc1369a_a(num_samples, spi_registers, verbose=False, do_plot=False, do_write_to_file=False): with Dc1369aA(spi_registers, verbose) as controller: # You can call this multiple times with the same controller if you need to data = controller.collect(num_samples, consts.TRIGGER_NONE) data = data[0] # Keep only one channel if do_plot: funcs.plot_channels(controller.get_num_bits(), data, verbose=verbose) if do_write_to_file: funcs.write_channels_to_file_32_bit("data.txt", data, verbose=verbose) return data
def ltc2374_16_dc2071a_c(num_samples, spi_registers, is_high_speed, verbose = False, do_plot = False, do_write_to_file = False): with Ltc2374(dc_number = 'DC2071A-C', spi_registers = spi_registers, is_high_speed = is_high_speed, num_channels = len(spi_registers), num_bits = 16, verbose = verbose) as controller: # You can call this multiple times with the same controller if you need to data = controller.collect(num_samples, consts.TRIGGER_NONE) if do_plot: funcs.plot_channels(controller.get_num_bits(), *data, verbose=verbose) if do_write_to_file: funcs.write_channels_to_file_32_bit("data.txt", *data, verbose=verbose) return data
def test_dc1369a_a(): """Tests DC890 <= 16 bits, write_to_file32_bits, fix_data bipolar, fix_data unipolar(offset binary), fix_data random, and fix_data alt bit""" print "########################" print "#### TEST D1369A-A ####" print "########################" # basic, write_data print "\nNormal:\n-------" NUM_SAMPLES = 8 * 1024 spi_reg = [ # addr, value 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x03, 0x71, 0x04, 0x00 # offset binary ] ltc2261_dc1369a_a(NUM_SAMPLES, spi_reg, False, True, True) new_filename = "test_dc1563a_a_data.txt" os.rename("data.txt", new_filename) data = read_file(new_filename) os.remove(new_filename) test_sin(data, 14, 2412, -1, 71, -84, 1400, 15000) # bipolar print "\nBipolar:\n--------" spi_reg = [ # addr, value 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x03, 0x71, 0x04, 0x01 # 2's complement ] with dc890.Demoboard(dc_number='DC1369A-A', fpga_load='DLVDS', num_channels=2, is_positive_clock=True, num_bits=14, alignment=14, is_bipolar=True, spi_reg_values=spi_reg, verbose=False) as controller: data = controller.collect(NUM_SAMPLES, consts.TRIGGER_NONE) data = data[0] # Keep only one channel test_sin(data, 14, 2412, -1, 71, -84, -6500, 6500) # random print "\nRandomizer:\n-----------" spi_reg = [ # addr, value 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x03, 0x71, 0x04, 0x02 # randomizer ] with dc890.Demoboard(dc_number='DC1369A-A', fpga_load='DLVDS', num_channels=2, is_positive_clock=True, num_bits=14, alignment=14, is_bipolar=False, spi_reg_values=spi_reg, verbose=False) as controller: data = controller.collect(NUM_SAMPLES, consts.TRIGGER_NONE, 5, True) data = data[0] # Keep only one channel test_sin(data, 14, 2412, -1, 71, -84, 1400, 15000) # alt bit print "\nAlternate Bit:\n--------------" spi_reg = [ # addr, value 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x03, 0x71, 0x04, 0x04 # alt bit ] with dc890.Demoboard(dc_number='DC1369A-A', fpga_load='DLVDS', num_channels=2, is_positive_clock=True, num_bits=14, alignment=14, is_bipolar=False, spi_reg_values=spi_reg, verbose=False) as controller: data = controller.collect(NUM_SAMPLES, consts.TRIGGER_NONE, 5, False, True) data = data[0] # Keep only one channel funcs.plot_channels(controller.get_num_bits(), data) test_sin(data, 14, 2412, -1, 71, -84, 1400, 15000) print