Skip to content

Allow expStop for use in experiment cleanup #205

@k1o0

Description

@k1o0

Currently an expStop signal defined in an experiment can't be used to update signals when the experiment is ended remotely. This would be useful for triggering cleanup operations, e.g. events.expStop.map(@cleanup). Here's how it could be implemented:

      % Define an expStop signal so the experimenter can use it
      obj.Events.expStop = net.origin('expStop');
      [...]
      expDefFun(obj.Time, obj.Events, obj.Params, obj.Visual, obj.Inputs,...
          obj.Outputs, obj.Audio);

        obj.Events.expStop = merge(obj.Events.expStop, lastTrialOver);

      [...]

    function quit(obj, immediately)
      % if the experiment was stopped via 'mc' or 'q' key
      stopNode = obj.Events.expStop.Node;
      if isempty(stopNode.CurrValue)
        % sneak in and update node value
        affectedIdxs = submit(obj.Net.Id, stopNode.Inputs(1).Id, true);
        applyNodes(obj.Net.Id, affectedIdxs);
      end

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions