Exemplo n.º 1
0
 private void init(
     int[][] stimSeq,
     int tgtidx,
     UtopiaController utopiaController,
     GSM stimulusStateStack,
     float selectionThreshold = -1,
     int numframes            = -1,
     int duration             = 4,
     int cueduration          = 1,
     int feedbackduration     = 1,
     int waitduration         = 1,
     int cueframes            = -1,
     int feedbackframes       = -1,
     int waitframes           = -1)
 {
     this.tgtidx             = tgtidx;
     this.stimSeq            = stimSeq;
     this.utopiaController   = utopiaController;
     this.stimulusStateStack = stimulusStateStack;
     this.numframes          = numframes > 0 ? numframes : duration * 60;
     this.cueframes          = cueframes > 0 ? cueframes : cueduration * 60;
     this.feedbackframes     = feedbackframes > 0 ? feedbackframes : feedbackduration * 60;
     this.waitframes         = waitframes > 0 ? waitframes : waitduration * 60;
     this.selectionThreshold = selectionThreshold;
     this.stage = 0;
     Console.WriteLine(String.Format("Cal: tgtidx={0:d}", this.tgtidx));
 }
Exemplo n.º 2
0
        public Experiment(
            int[] objIDs,
            int[][] stimSeq,
            int nCal  = 10,
            int nPred = 10,
            float selectionThreshold          = 0.1f,
            UtopiaController utopiaController = null,
            GSM stimulusStateStack            = null,
            params object [] args)
        {
            if (objIDs == null)
            {
                throw new ArgumentNullException("objIDs cannot be null");
            }
            this.objIDs             = objIDs;
            this.stimSeq            = stimSeq;
            this.nCal               = nCal;
            this.nPred              = nPred;
            this.selectionThreshold = selectionThreshold;
            this.utopiaController   = utopiaController;
            this.stimulusStateStack = stimulusStateStack;

            // add the selection threshold (off for cal) to the arguments stack
            this.calargs  = new object[args.Length + 1];
            this.predargs = new object[args.Length + 1];
            for (int i = 0; i < args.Length; i++)
            {
                this.predargs[i + 1] = args[i];
                this.calargs[i + 1]  = args[i];
            }
            this.calargs[0]  = -1.0f;                   // no selection during calibration
            this.predargs[0] = this.selectionThreshold; // selection during prediction
            this.stage       = 0;
        }
Exemplo n.º 3
0
 public Noisetag(System.IO.TextReader stimFile, UtopiaController utopiaController, GSM stimulusSequenceStack)
 {
     // global flicker stimulus sequence
     this.noisecode = StimSeq.FromString(stimFile);
     //Console.WriteLine(this.noisecode);
     //this.noisecode.convertstimSeq2int();
     //this.noisecode.setStimRate(2);
     // get the stimSeq (as int) from the noisecode
     this.stimSeq = this.convertstimSeq2int(this.noisecode);
     // utopiaController
     this.utopiaController = utopiaController;
     if (this.utopiaController == null)
     {
         // TODO [] : make a singlention for the utopia controller?
         this.utopiaController = new UtopiaController();
     }
     // stimulus state-machine stack
     // Individual stimulus-state-machines track progress in a single
     // stimulus state playback function.
     // Stack allows sequencing of sets of playback functions in loops
     if (stimulusStateMachineStack == null)
     {
         stimulusStateMachineStack = new GSM();
     }
     this.laststate    = new StimulusState(null, null, -1, false);
     this.lastrawstate = new StimulusState(null, null, -1, false);
     this.objIDs       = null;
 }
Exemplo n.º 4
0
        public PredictionPhase(int[] objIDs,
                               int[][] stimSeq,
                               int nTrials = 10,
                               UtopiaController utopiaController = null,
                               GSM stimulusStateStack            = null,
                               params object[] args)
        {
            this.objIDs             = objIDs;
            this.stimSeq            = stimSeq;
            this.nTrials            = nTrials;
            this.utopiaController   = utopiaController;
            this.stimulusStateStack = stimulusStateStack;
            this.args = args;

            this.isRunning = false;
            this.tgti      = 0;
        }
Exemplo n.º 5
0
        public PredictionPhase(int[] objIDs,
                               int[][] stimSeq,
                               int nTrials = 10,
                               UtopiaController utopiaController = null,
                               GSM stimulusStateStack            = null,
                               params object [] args)
        {
            if (objIDs == null)
            {
                throw new ArgumentNullException("objIDs cannot be null");
            }
            this.objIDs             = objIDs;
            this.stimSeq            = stimSeq;
            this.nTrials            = nTrials;
            this.utopiaController   = utopiaController;
            this.stimulusStateStack = stimulusStateStack;
            this.args = args;

            this.isRunning = false;
            this.tgti      = 0;
        }
Exemplo n.º 6
0
 public SingleTrial(
     int[][] stimSeq,
     int tgtidx,
     UtopiaController utopiaController,
     GSM stimulusStateStack,
     float selectionThreshold = -1,
     int numframes            = -1,
     int duration             = 4,
     int cueduration          = 1,
     int feedbackduration     = 1,
     int waitduration         = 1,
     int cueframes            = -1,
     int feedbackframes       = -1,
     int waitframes           = -1)
 {
     init(stimSeq, tgtidx,
          utopiaController, stimulusStateStack,
          selectionThreshold, numframes,
          duration, cueduration, feedbackduration, waitduration,
          cueframes, feedbackframes, waitframes);
 }
Exemplo n.º 7
0
        public SingleTrial(
            int[][] stimSeq,
            int tgtidx,
            UtopiaController utopiaController,
            GSM stimulusStateStack,
            params object [] args)
        {
            //Console.WriteLine("SingleTrial: args "+args.Length); foreach ( object arg in args ) Console.WriteLine(arg);
            // parse / default the variable length args portion
            float selectionThreshold = -1;
            int   numframes          = 400;
            int   duration           = 4;
            int   cueduration        = 1;
            int   feedbackduration   = 1;
            int   waitduration       = 1;
            int   cueframes          = -1;
            int   feedbackframes     = -1;
            int   waitframes         = -1;

            try {
                if (args.Length > 0)
                {
                    selectionThreshold = (float)args[0];
                }
                if (args.Length > 1)
                {
                    numframes = (int)args[1];
                }
                if (args.Length > 2)
                {
                    duration = (int)args[2];
                }
                if (args.Length > 3)
                {
                    cueduration = (int)args[3];
                }
                if (args.Length > 4)
                {
                    feedbackduration = (int)args[4];
                }
                if (args.Length > 5)
                {
                    waitduration = (int)args[5];
                }
                if (args.Length > 6)
                {
                    cueframes = (int)args[6];
                }
                if (args.Length > 7)
                {
                    feedbackframes = (int)args[7];
                }
                if (args.Length > 8)
                {
                    waitframes = (int)args[8];
                }
            }
            catch (NullReferenceException)
            {
                Console.WriteLine("Invalid argument format...");
            } catch (InvalidCastException)
            {
                Console.WriteLine("Invalid argument format...");
            }
            init(stimSeq, tgtidx,
                 utopiaController, stimulusStateStack,
                 selectionThreshold, numframes,
                 duration, cueduration, feedbackduration, waitduration,
                 cueframes, feedbackframes, waitframes);
        }