Exemplo n.º 1
0
import matplotlib.pyplot as plt
import numpy as np
from time import sleep

from utils.pico_utils import open_pico, configure_channel, configure_sampling, alt_configure_sampling, getData
from utils.serial_utils import send_command
from utils.analysis_utils import calc_frequency
from utils.gui_utils import set_as_freq, set_as_time, def_input

fontsize = 20

# set constants
pwm = int(def_input('Duty cycle', default=128))
frequency = float(def_input('Expected Frequency (Hz)', default=1e4))
mult = int(def_input('Number of cycles', default=5))
numRuns = int(def_input('Number of runs', default=5))

fig_dir = 'docs/vco/current/'
data_dir = 'data/vco/current/'
name_root = def_input('Filename root', default='currents')

fout = open(data_dir + name_root + '_wv.csv', 'w')

# send cuty cycle to arduino
print("Sending stuff to ARDUINO")
send_command(duty_cycle=pwm)

# fire up the scope
print("\n\n")
ps = open_pico()
configure_channel(ps, 'A')
Exemplo n.º 2
0
import matplotlib.pyplot as plt
import numpy as np
from time import sleep

from utils.pico_utils import open_pico, configure_channel, configure_sampling, alt_configure_sampling, getData
from utils.serial_utils import send_command
from utils.analysis_utils import calc_frequency
from utils.gui_utils import set_as_freq, set_as_time, def_input

FONTSIZE = 20
SEP = '=' * 20

# set constants
input_frequencies = np.arange(1000, 3000, step=25)
mult = int(def_input('Number of cycles', default=50))
numRuns = int(def_input('Number of runs', default=10))
name_root = def_input('Filename root', default='loop_pc1')
data_dir = 'data/loop/'

# open the files and write a heading
fout = open(data_dir + name_root + '.tsv', 'w')
wvout = open('{0}waveforms/{1}_wv.csv'.format(data_dir, name_root), 'w')

fout.write('f_in\tmean_A (V)\tf_A (Hz)\tmean_B (V)\tf_B (Hz)\n')

# setup the plot
plt.ion()
fig, [ax, ax1] = plt.subplots(nrows=2, ncols=1, figsize=(12, 9))
set_as_time(ax, fontsize=FONTSIZE)
set_as_freq(ax1, fontsize=FONTSIZE)
plt.tight_layout()
Exemplo n.º 3
0
import matplotlib.pyplot as plt
import numpy as np
from time import sleep

from utils.pico_utils import open_pico, configure_channel, configure_sampling, alt_configure_sampling, getData
from utils.serial_utils import send_command
from utils.analysis_utils import calc_frequency
from utils.gui_utils import set_as_freq, set_as_time, def_input

fontsize = 20

# set constants
frequency = float(def_input('Frequency in Hz', default=50))
mult = int(def_input('Number of cycles', default=5))
phase_diffs = [0, 45, 90, 135, 170, 180, 190, 225, 270, 315, 350]
half_p_us = 5e5/frequency  # in microseconds

fig_dir = 'docs/pc2/'
data_dir = 'data/pc2/waveforms/'
name_root = def_input('Filename root:', default='deg')

fout = open(data_dir+name_root+'_wv.csv', 'w')

# send half-period to arduino
print("Sending stuff to ARDUINO")
send_command(half_p=half_p_us)

# fire up the scope
print("\n\n")
ps = open_pico()
configure_channel(ps, 'A')
Exemplo n.º 4
0
import matplotlib.pyplot as plt
import numpy as np

from utils.pico_utils import open_pico, configure_channel, configure_sampling, alt_configure_sampling, getData
from utils.serial_utils import send_command
from utils.analysis_utils import calc_frequency
from utils.gui_utils import set_as_freq, set_as_time, def_input

fontsize = 20

# set constants
frequency = float(def_input('Frequency in Hz', default=50))
phase_diff = int(def_input('Phase difference in deg', default=90))
mult = int(def_input('Number of cycles', default=10))
half_p_us = 5e5 / frequency  # in microseconds

# send half-period to arduino
print("Sending stuff to ARDUINO")
send_command(half_p=half_p_us, phase_diff=phase_diff)

# read signal
print("\n\n")
ps = open_pico()
configure_channel(ps, 'A')
configure_channel(ps, 'B')
ps.setSimpleTrigger('A', 1.0, 'Falling', timeout_ms=100, enabled=True)

(sampling_interval, nSamples,
 maxSamples) = configure_sampling(ps, 2 * half_p_us / 1e6, multiplicity=mult)

dataA = getData(ps, nSamples, channel='A')
Exemplo n.º 5
0
import matplotlib.pyplot as plt
import numpy as np
from time import sleep

from utils.pico_utils import open_pico, configure_channel, configure_sampling, getData
from utils.serial_utils import send_command
from utils.analysis_utils import calc_frequency
from utils.gui_utils import set_as_freq, set_as_time, def_input

fontsize = 20
sep = '=' * 15

# set constants
mult = int(def_input('Number of cycles', default=20))
nRuns = int(def_input('Number of runs', default=10))
step_size = int(def_input('Step size', default=2))
# set expected frequency of Arduino
frequency = 490
pwm_vals = np.arange(0, 255, step_size)
# voltages = np.linspace(0.05, 5, num=100)

data_dir = def_input('Data directory', default='data/pwm/')
name_root = def_input('Filename root', default='pwm')
fout = open(data_dir + name_root + '.tsv', 'w')
wvout = open('%swaveforms/%s_wv.csv' % (data_dir, name_root), 'w')

fout.write('expected V\tf_A (Hz)\tV_A\tsigma_V_A\tf_B (Hz)\tV_B\tsigma_V_B\n')

# fire up the scope
ps = open_pico()
configure_channel(ps, 'A')
Exemplo n.º 6
0
import matplotlib.pyplot as plt
import numpy as np
from time import sleep

from utils.pico_utils import open_pico, configure_channel, configure_sampling, getData
from utils.serial_utils import send_command
from utils.analysis_utils import calc_frequency
from utils.gui_utils import set_as_freq, set_as_time, def_input

fontsize = 20
sep = '=' * 15

# set constants
frequency = float(def_input('Expected frequency (Hz)', default=15e3))
mult = int(def_input('Number of cycles', default=50))
nRuns = int(def_input('Number of runs', default=10))
step_size = int(def_input('Step size', default=2))
# set expected frequency of Arduino
pwm_vals = np.arange(0, 255, step_size)

data_dir = def_input('Data directory', default='data/vco/')
name_root = def_input('Filename root', default='vco')
fout = open(data_dir + name_root + '.tsv', 'w')
wvout = open('%swaveforms/%s_wv.csv' % (data_dir, name_root), 'w')

fout.write('expected V\tf_A (Hz)\tV_A\tsigma_V_A\tf_B (Hz)\tV_B\tsigma_V_B\n')

# fire up the scope
ps = open_pico()
configure_channel(ps, 'B')
ps.setSimpleTrigger('B', 1.0, 'Falling', timeout_ms=100, enabled=True)