Symphony-DAS / symphony-matlab

Symphony Data Acquisition System
http://symphony-das.github.io
MIT License
19 stars 5 forks source link

Add Epoch.removeStimulus() #8

Closed samcooler closed 8 years ago

samcooler commented 8 years ago

Enables removal of dummy stimulus used for stage protocol timing, to avoid storage space usage and data clutter

samcooler commented 8 years ago

This works with these functions in my abstract stage protocol:

function prepareEpoch(obj, epoch)
    prepareEpoch@sa_labs.protocols.BaseProtocol(obj, epoch);

    device = obj.rig.getDevice(obj.chan1);
    duration = (obj.preTime + obj.stimTime + obj.tailTime) / 1e3;
    epoch.addDirectCurrentStimulus(device, device.background, duration, obj.sampleRate);
end

function completeEpoch(obj, epoch)
    epoch.removeStimulus(obj.rig.getDevice(obj.chan1));
    completeEpoch@sa_labs.protocols.BaseProtocol(obj, epoch);
end
cafarm commented 8 years ago

Thanks for the pull. Just a heads up: only stimulus parameters are saved to the data file. When the data manager shows you a stimulus vector, it's actually regenerating the stimulus from the saved parameters. So, they don't take up much space.

cafarm commented 8 years ago

Thinking about it more, you may actually want to keep that stimulus around or your epoch will be persisted with zero duration.

cafarm commented 8 years ago

This issue has been addressed in the 2.2 beta. An epoch's duration is now equal to the duration of its longest stimulus OR response. See #9 .