Create a gist now

Instantly share code, notes, and snippets.

@cafarm /Pulse.m Secret
Last active May 26, 2016

What would you like to do?
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