Grid classes

class prfpy.model.CFGaussianModel(stimulus)[source]

A class for constructing gaussian connective field models.

create_grid_predictions(sigmas, func='cart')[source]

Creates the grid rfs and rf predictions

create_rfs()[source]

creates rfs for the grid search

Returns

grid_rfs: The receptive field profiles for the grid. vert_centres_flat: A vector that defines the vertex centre associated with each rf profile. sigmas_flat: A vector that defines the CF size associated with each rf profile.

return_prediction(sigma, beta, baseline, vert)[source]

Creates a prediction given a sigma, beta, baseline and vertex centre.

Returns

A prediction for this parameter combination.

stimulus_times_prfs()[source]

creates timecourses for each of the rfs in self.grid_rfs

Returns

class prfpy.model.CSS_Iso2DGaussianModel(stimulus, hrf=[1.0, 1.0, 0.0], filter_predictions=False, filter_type='dc', filter_params={}, normalize_RFs=False, **kwargs)[source]
create_grid_predictions(gaussian_params, nn, hrf_1=None, hrf_2=None)[source]

create_predictions

creates predictions for a given set of parameters

[description]

Parameters

gaussian_params: ndarray size (3)

containing prf position and size.

nn: ndarrays

containing the range of grid values for other CSS model parameters (exponent)

return_prediction(mu_x, mu_y, size, beta, baseline, n, hrf_1=None, hrf_2=None)[source]

returns the prediction for a single set of parameters. As this is to be used during iterative search, it also has arguments beta and baseline.

Parameters

mu_xfloat

x-position of pRF

mu_yfloat

y-position of pRF

sizefloat

size of pRF

betafloat, optional

amplitude of pRF (the default is 1)

baselinefloat, optional

baseline of pRF (the default is 0)

nfloat, optional

exponent of pRF (the default is 1, which is a linear Gaussian)

hrf_1, hrf_2floats, optional

if specified, will be used to create HRF.

Returns

numpy.ndarray

single prediction given the model

class prfpy.model.DoG_Iso2DGaussianModel(stimulus, hrf=[1.0, 1.0, 0.0], filter_predictions=False, filter_type='dc', filter_params={}, normalize_RFs=False, **kwargs)[source]

redefining class for difference of Gaussians in iterative fit.

create_grid_predictions(gaussian_params, sa, ss, hrf_1=None, hrf_2=None)[source]

create_predictions

creates predictions for a given set of parameters

[description]

Parameters

gaussian_params: ndarray size (3)

containing prf position and size.

sa,ss: ndarrays

containing the range of grid values for other DoG model parameters (surroud amplitude, surround size (sigma_2))

hrf_1, hrf_2floats, optional

if specified, will be used to create HRF.

return_prediction(mu_x, mu_y, prf_size, prf_amplitude, bold_baseline, srf_amplitude, srf_size, hrf_1=None, hrf_2=None)[source]

returns the prediction for a single set of parameters. As this is to be used during iterative search, it also has arguments beta and baseline.

Parameters

mu_xfloat

x-position of pRF

mu_yfloat

y-position of pRF

prf_sizefloat

size of pRF

prf_amplitudefloat

Amplitude (scaling) of pRF

bold_baselinefloat

BOLD baseline (generally kept fixed)

srf_amplitudefloat

Surround pRF amplitude

srf_sizefloat

Surround pRF size

hrf_1, hrf_2floats, optional

if specified, will be used to create HRF.

Returns

numpy.ndarray

single prediction given the model

class prfpy.model.Iso2DGaussianModel(stimulus, hrf=[1.0, 1.0, 0.0], filter_predictions=False, filter_type='dc', filter_params={}, normalize_RFs=False, **kwargs)[source]

To extend please create a setup_XXX_grid function for any new way of defining grids.

create_grid_predictions(mu_x, mu_y, size, hrf_1=None, hrf_2=None)[source]

create_predictions

creates predictions for a given set of parameters

see return_prediction

Parameters

return_prediction(mu_x, mu_y, size, beta, baseline, hrf_1=None, hrf_2=None)[source]

returns the prediction for a single set of parameters. As this is to be used during iterative search, it also has arguments beta and baseline.

Parameters

mu_xfloat

x-position of pRF

mu_yfloat

y-position of pRF

sizefloat

size of pRF

betafloat

amplitude of pRF

baselinefloat

baseline of pRF

hrf_1, hrf_2floats, optional

if specified, will be used to create HRF.

Returns

numpy.ndarray

single prediction given the model

class prfpy.model.Model(stimulus)[source]

Class that takes care of generating grids for pRF fitting and simulations

convolve_timecourse_hrf(tc, hrf)[source]

Convolve neural timecourses with single or multiple hrfs.

Parameters

tcndarray, 1D or 2D

The timecourse(s) to be convolved.

hrfndarray, 1D or 2D

The HRF. Can be single, or a different one for each timecourse.

Returns

convolved_tcndarray

Convolved timecourse.

create_drifts_and_noise(drift_ranges=[[0, 0]], noise_ar=None, noise_ma=(1, 0.0), noise_amplitude=1.0)[source]

add_drifs_and_noise

creates noise and drifts of size equal to the predictions

Parameters

drift_rangeslist of 2-lists of floats, optional

specifies the lower- and upper bounds of the ranges of each of the discrete cosine low-pass components to be generated

noise_ar2x2 list.

argument passed to timecourse.generate_arima_noise (the default is None, for no noise)

noise_amplitude : float, optional

create_hrf(hrf_params)[source]

construct single or multiple HRFs

Parameters

hrf_paramsTYPE, optional

DESCRIPTION. The default is [1.0, 1.0, 0.0].

Returns

hrfndarray

the hrf.

class prfpy.model.Norm_Iso2DGaussianModel(stimulus, hrf=[1.0, 1.0, 0.0], filter_predictions=False, filter_type='dc', filter_params={}, normalize_RFs=False, **kwargs)[source]

Redefining class for normalization model

create_grid_predictions(mu_x, mu_y, size, sa, ss, nb, sb, hrf_1=None, hrf_2=None)[source]

create_predictions

creates predictions for a given set of parameters

[description]

Parameters

gaussian_params: ndarray size (3)

containing prf position and size.

sa,ss,nb,sb: ndarrays

containing the range of grid values for other norm model parameters (surroud amplitude (C), surround size (sigma_2), neural baseline (B), surround baseline (D))

hrf_1, hrf_2floats, optional

if specified, will be used to create HRF.

return_prediction(mu_x, mu_y, prf_size, prf_amplitude, bold_baseline, srf_amplitude, srf_size, neural_baseline, surround_baseline, hrf_1=None, hrf_2=None)[source]

return_prediction [summary]

returns the prediction for a single set of parameters.

Parameters

mu_xfloat

x position

mu_yfloat

y position

prf_sizefloat

sigma_1

prf_amplitudefloat

Norm Param A

bold_baselinefloat

BOLD baseline (generally kept fixed)

neural_baselinefloat

Norm Param B

srf_amplitudefloat

Norm Param C

srf_sizefloat

sigma_2

surround_baselinefloat

Norm Param D

hrf_1, hrf_2floats, optional

if specified, will be used to create HRF.

Returns

numpy.ndarray

prediction(s) given the model