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; }
private int[][] convertstimSeq2int(StimSeq ss) { // N.B. use jagged array so stimseq[i] gives int[nobj] this.stimSeq = new int[ss.stimSeq.Length][]; for (int t = 0; t < ss.stimSeq.Length; t++) { stimSeq[t] = new int[ss.stimSeq[t].Length]; for (int oi = 0; oi < ss.stimSeq[t].Length; oi++) { this.stimSeq[t][oi] = (int)ss.stimSeq[t][oi]; } } return(stimSeq); }
public static void Main(string[] argv) { string stimFile = "../../resources/codebooks/mgold_65_6532_60hz.txt"; if (argv.Length > 0) { stimFile = argv[0]; } // open the file and try to read in the stim-sequence try { StreamReader sr = new StreamReader(stimFile); StimSeq ss = StimSeq.FromString(sr); // print out the stim-sequence System.Console.WriteLine("Read ss:"); System.Console.WriteLine(ss); } catch (IOException) { System.Console.WriteLine("Couldn't open the stimFile " + stimFile); } }
public static StimSeq FromFilename(string filename) { StreamReader sr = new StreamReader(filename); return(StimSeq.FromString(sr)); }