Skip to content

Commit 163254f

Browse files
committed
added option for linear sampling of VF | added compressive spatial summation
1 parent 066f261 commit 163254f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

code/python/cni_toolbox/pRF.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def import_stimulus(self):
226226

227227
def create_timecourses(self, max_radius = 10.0, n_xy = 30,
228228
min_slope = 0.1, max_slope = 1.2,
229-
n_slope = 10):
229+
n_slope = 10, css_exponent = 1, sampling = 'log'):
230230
'''
231231
creates predicted timecourses based on the effective stimulus
232232
and a range of isotropic receptive fields.
@@ -244,6 +244,10 @@ def create_timecourses(self, max_radius = 10.0, n_xy = 30,
244244
upper bound of RF size slope (default = 1.2)
245245
- n_slope: integer
246246
steps from lower to upper bound (default = 10)
247+
- css_exponent: float
248+
compressive spatial summation (default = 1)
249+
- sampling: string
250+
eccentricity sampling (default = log)
247251
'''
248252

249253
self.n_points = (n_xy**2) * n_slope
@@ -265,7 +269,11 @@ def create_timecourses(self, max_radius = 10.0, n_xy = 30,
265269

266270
n_lower = int(np.ceil(n_xy/2))
267271
n_upper = int(np.floor(n_xy/2))
268-
self.ecc = np.exp(np.linspace(np.log(0.1), np.log(max_radius), n_xy))
272+
if sampling == 'log':
273+
self.ecc = np.exp(np.linspace(np.log(0.1), np.log(max_radius), n_xy))
274+
elif sampling == 'linear':
275+
self.ecc = np.linspace(0.1, max_radius, n_xy)
276+
269277
self.pa = np.linspace(0, (n_xy - 1) / n_xy * 2 * np.pi, n_xy)
270278
self.slope = np.linspace(min_slope, max_slope, n_slope)
271279

@@ -283,7 +291,7 @@ def create_timecourses(self, max_radius = 10.0, n_xy = 30,
283291
sys.stdout.write("[%-20s] %d%%"
284292
% ('='*i, 5*i))
285293

286-
tc = np.matmul(W, self.stimulus).transpose()
294+
tc = (np.matmul(W, self.stimulus).transpose())**css_exponent
287295
sys.stdout.write('\r')
288296
sys.stdout.write("[%-20s] %d%%" % ('='*20, 100))
289297
self.tc_fft = fft(tc, axis = 0)
@@ -313,7 +321,7 @@ def mapping(self, data, threshold = 100, mask = []):
313321
- threshold: float
314322
minimum voxel intensity (default = 100.0)
315323
- mask: boolean array
316-
binary mask for selecting voxels (default = None)
324+
binary mask for selecting voxels (default = None)
317325
'''
318326
data = np.reshape(data.astype(float),
319327
(self.n_samples,

0 commit comments

Comments
 (0)