def generate_prediction(self, x, y, sigma, theta, phi, cpd): # make sure theta and phi are 0-2*pi theta = np.mod(theta, 2*np.pi) phi = np.mod(theta, 2*np.pi) # create mask for speed distance = (self.stimulus.deg_x - x)**2 + (self.stimulus.deg_y - y)**2 mask = np.zeros_like(distance, dtype='uint8') mask[distance < (5*sigma)**2] = 1 # generate the RF rf = generate_gabor_receptive_field(x, y, sigma, theta, phi, cpd, self.stimulus.deg_x, self.stimulus.deg_y) # extract the stimulus time-series response = generate_rf_timeseries(self.stimulus.stim_arr, rf, mask) # convolve with the HRF hrf = self.hrf_model(0, self.stimulus.tr_length) # convolve it with the stimulus model = fftconvolve(response, hrf, 'same') return model
def receptive_field(self): return generate_gabor_receptive_field(*self.estimate)