def paramsDictionary(self):
     d = dict(
         mean = self.mean,
         var = self.var,
         length = self.length,
         sampleRate = self.sampleRate,
         stepRate = self.stepRate,
         randomState = pickle.dumps(self.rSource.get_state()),
         numpyVersion = N.__version__,
     )
     
     return AcqUI.cocoaCollection(d)
 def paramsDictionary(self):
     d = dict(
         mean = self.mean,
         frequency = self.frequency,
         phase = self.phase,
         amp = self.amp,
         sampleRate = self.sampleRate,
         length = self.length,
         startTime = self.startTime
     )
     
     return AcqUI.cocoaCollection(d)
 def stimulusDataForParamsDictionary_version_(self, p, v):
     mean = float(p['mean'])
     phase = float(p['phase'])
     f = float(p['frequency']) #in Hz
     A = float(p['amp'])
     sampleRate = float(p['sampleRate'])
     length = float(p['length'])
     dt = float(p['startTime'])
     
     assert(f <= sampleRate/2) #make sure there won't be aliasing
     
     time = np.linspace(0, length, num=round(sampleRate*length))
     
     arr = (A * np.sin(2*np.pi*f*(time + dt) - phase)) + mean
     
     return arr.astype(AcqUI.dtypeForAnalogOutput())
 def stimulusDataForParamsDictionary_version_(self, p, v):
     mean = float(p['mean'])
     var = float(p['var'])
     sampleRate = float(p['sampleRate'])
     length = float(p['length'])
     stepRate = float(p['stepRate'])
     
     if(N.__version__ != p['numpyVersion']):
         NSLog('Warning: A different numpy version (' + p['numpyVersion'] + ') was used to create SSG stimulus. Current version: ' + N.__version__)
         
     self.rSource.set_state(pickle.loads(str(p['randomState'])))
     
     ns = noise.StairStepNoiseSource(noise.GaussianNoiseSource(mean, var, self.rSource), stepRate)
     
     arr = ns.noise(length, sampleRate)
     
     return arr.astype(AcqUI.dtypeForAnalogOutput())
 def stimulusDataForParamsDictionary_version_(self, p, v):
     mean = p[BLWN_MEAN_KEY].doubleValue()
     var = p[BLWN_VAR_KEY].doubleValue()
     len = p[BLWN_LENGTH_KEY].doubleValue()
     hz = p[BLWN_SAMPLE_RATE_KEY].doubleValue()
     fCutoff = p[BLWN_FREQ_KEY].doubleValue()
     nPoles = p[BLWN_NPOLES_KEY].intValue()
     
     if(numpy.__version__ != p['numpyVersion']):
         NSLog('Warning: A different numpy version (' + p['numpyVersion'] + ') was used to create BLWN stimulus. Current version: ' + numpy.__version__)
     
     self.rSource.set_state(pickle.loads(str(p[BLWN_RANDOM_STATE_KEY])))
     
     ns = BandLimitedNoiseSource(GaussianNoiseSource(mean, var, self.rSource), fCutoff, nPoles)
     
     if(v==1): #random phase construction
         arr = ns.noise(len, hz, rPhase=True)
     else:
         arr = ns.noise(len, hz)
     
     return arr.astype(AcqUI.dtypeForAnalogOutput())
Exemple #6
0
    def stimulusDataForParamsDictionary_version_(self, p, v):
        mean = float(p["mean"])
        offset = float(p["offset"])
        sampleRate = float(p["sampleRate"])
        length = float(p["length"])
        stepRate = float(p["stepRate"])

        if N.__version__ != p["numpyVersion"]:
            NSLog(
                "Warning: A different numpy version ("
                + p["numpyVersion"]
                + ") was used to create BG stimulus. Current version: "
                + N.__version__
            )

        self.rSource.set_state(pickle.loads(str(p["randomState"])))

        ns = noise.StairStepNoiseSource(noise.BinaryNoiseSource(mean, offset, self.rSource), stepRate)

        arr = ns.noise(length, sampleRate)

        return arr.astype(AcqUI.dtypeForAnalogOutput())