test_param = {
    'quietValue': 0.0,  # Output voltage during quiet peroid
    'quietTime': 1000,  # Duration of quiet period (ms)
    'value': 2.5,  # Output volatage (V) durring constant voltage test
    'duration': 4000,  # Duration of constant voltage test (ms)
}

# Create Device object and set sample rate, current range and test parameters
dev = Potentiostat(port)
dev.set_sample_rate(sample_rate)
dev.set_curr_range(curr_range)
dev.set_param(test_name, test_param)

# Run cyclic voltammetry test
t, volt, curr = dev.run_test(test_name, display='pbar', filename=datafile)

# plot results using matplotlib
plt.subplot(211)
plt.title('Voltage and current vs time')
plt.plot(t, volt)
plt.ylabel('potential (V)')
plt.ylim(0, test_param['value'] * 1.1)
plt.grid('on')

plt.subplot(212)
plt.plot(t, curr)
plt.ylabel('current (uA)')
plt.xlabel('time (sec)')
plt.grid('on')
Пример #2
0
from potentiostat import Potentiostat
import sys

if len(sys.argv) > 1:
    port = sys.argv[1]
else:
    port = '/dev/ttyACM0'

dev = Potentiostat(port)
dev.set_curr_range('100uA')
dev.set_sample_period(10)

name = 'constant'
param = {
        'quietValue' : 0.0,
        'quietTime'  : 1000,
        'value'      : 1.0,
        'duration'   : 5000,
        }

dev.set_param(name,param)
t,volt,curr = dev.run_test(name,display='pbar')
    'period': period_ms,
    'numCycles': num_cycles,  #ignored in current version
    'shift': shift,
    'gain': gain,
    'HV': HV,
    'measure': measure
}
# %%
# Create potentiostat object and set current range, sample rate and test parameters
dev = Potentiostat(
    port,
    raw=True,  # required for DE firmware 
    debug=True  # optionally turn on debug flag, outputs lots of messages
)

# %%
# Run cyclic voltammetry test, returns a dictionary containing time (t), current (i), voltage, (v), and photocurrent values.
testCounter += 1
data = dev.run_test(
    test_name,  # name of test to run
    test_param,  # dictionary of experimental parameters 
    display=
    'data',  # (data |  plot ), plot requires testing, pbar option not implemented
    filename=dataFileName % testCounter)

# %%
# Plot combinations of values vontained in argument data.
plotData(data)

# %%
Пример #4
0
from potentiostat import Potentiostat
import sys

if len(sys.argv) > 1:
    port = sys.argv[1]
else:
    port = '/dev/ttyACM0'

dev = Potentiostat(port)
dev.set_curr_range('100uA')
dev.set_sample_period(10)

name = 'cyclic'

param = {
        'quietValue' : 0.0,
        'quietTime'  : 1000,
        'amplitude'  : 2.0,
        'offset'     : 0.0,
        'period'     : 1000,
        'numCycles'  : 5,
        'shift'      : 0.0,
        }

t,volt,curr = dev.run_test(name,param=param,display='pbar')
        'quietValue':
        0.0,
        'quietTime':
        1000,
        'step': [(1000, -0.5), (1000, -0.2), (1000, -0.3), (1000, -0.0),
                 (1000, -0.1), (1000, 0.3), (1000, 0.2), (1000, 0.5)],
    },
]

cpp = Potentiostat(port)
cpp.set_curr_range(curr_range)
cpp.set_sample_rate(sample_rate)
print(test_name[int_test], test_data[int_test])
cpp.set_param(test_name[int_test], test_data[int_test])

t, volt, curr = cpp.run_test(test_name[int_test], display='pbar')
file = open(datafile[int_test], 'w')
file.write('Time \n' + str(t) + '\n' + 'Volt \n' + str(volt) + '\n'
           'Curr \n' + str(curr) + '\n')
plt.figure(1)
plt.subplot(211)
plt.plot(t, volt)
plt.ylabel('potential (V)')
plt.grid('on')

plt.subplot(212)
plt.plot(t, curr)
plt.ylabel('current (uA)')
plt.xlabel('time (sec)')
plt.grid('on')
        'shift'      : shift,
        }

# Create potentiostat object and set current range, sample rate and test parameters
dev = Potentiostat(port)     
dev.set_curr_range(curr_range)   
dev.set_sample_rate(sample_rate)
dev.set_param(test_name,test_param)

dev.set_mux_enabled(True)
dev.set_enabled_mux_channels(channel_list)

# Run cyclic voltammetry test
#data_dict = dev.run_test(test_name,display='data',filename=datafile)
#data_dict = dev.run_test(test_name,display='data')
data_dict = dev.run_test(test_name,display='pbar',filename='data.txt')
#data_dict = dev.run_test(test_name,display='pbar',filename='data.pkl')

dev.set_mux_enabled(False)


# plot results using matplotlib
for chan, data in data_dict.iteritems():
    plt.figure(chan)
    plt.subplot(211)
    plt.plot(data['t'],data['v'])
    plt.ylabel('potential (V)')
    plt.grid('on')
    plt.title('volt,curr vs time, channel = {0}'.format(chan))
    
    plt.subplot(212)