-
-
Save cafarm/0ad2661c46829cbc727fbdbf345d2a7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
classdef Pulse < symphonyui.core.Protocol | |
properties | |
amp = 'Amp' % Output amplifier | |
preTime = 50 % Pulse leading duration (ms) | |
stimTime = 500 % Pulse duration (ms) | |
tailTime = 50 % Pulse trailing duration (ms) | |
pulseAmplitude = 100 % Pulse amplitude (mV) | |
numberOfAverages = 5 % Number of epochs | |
end | |
methods | |
function prepareRun(obj) | |
prepareRun@symphonyui.core.Protocol(obj); | |
device = obj.rig.getDevice(obj.amp); | |
obj.showFigure('symphonyui.builtin.figures.ResponseFigure', device); | |
obj.showFigure('symphonyui.builtin.figures.MeanResponseFigure', device); | |
end | |
function prepareEpoch(obj, epoch) | |
prepareEpoch@symphonyui.core.Protocol(obj, epoch); | |
gen = symphonyui.builtin.stimuli.PulseGenerator(); | |
gen.preTime = obj.preTime; | |
gen.stimTime = obj.stimTime; | |
gen.tailTime = obj.tailTime; | |
gen.amplitude = obj.pulseAmplitude; | |
gen.mean = 0; | |
gen.sampleRate = obj.sampleRate; | |
gen.units = 'mV'; | |
stimulus = gen.generate(); | |
device = obj.rig.getDevice(obj.amp); | |
epoch.addStimulus(device, stimulus); | |
epoch.addResponse(device); | |
end | |
function tf = shouldContinuePreparingEpochs(obj) | |
tf = obj.numEpochsPrepared < obj.numberOfAverages; | |
end | |
function tf = shouldContinueRun(obj) | |
tf = obj.numEpochsCompleted < obj.numberOfAverages; | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment