prfmodel.models.prf.canonical.DivNormPRFModel

class prfmodel.models.prf.canonical.DivNormPRFModel(prf_model: prfmodel.models.base.BasePopulationResponse, shared_params: list[str] | None = None, encoding_model: prfmodel.models.base.BaseStimulusEncoder | type[prfmodel.models.base.BaseStimulusEncoder] = PRFStimulusEncoder, impulse_model: prfmodel.impulse.base.BaseImpulse | type[prfmodel.impulse.base.BaseImpulse] | None = DerivativeTwoGammaImpulse, scaling_model: prfmodel.scaling.base.BaseScaling | type[prfmodel.scaling.base.BaseScaling] | None = Baseline, regressors_model: prfmodel.regressors.base.BaseRegressors | list[prfmodel.regressors.base.BaseRegressors] | None = None)

Divisive normalization population receptive field (pRF) model.

This class performs divisive normalization between an activation (numerator) and a normalization (denominator) pRF response and combines them with an impulse and scaling model. Both responses come from the same model class, but their parameters can differ.

Parameters:
  • prf_model (BasePopulationResponse) – A population receptive field response model instance.

  • shared_params (list of str, optional) – Names of pRF parameters that are shared between the two responses. All names must appear in prf_model.parameter_names.

  • encoding_model (BaseStimulusEncoder or type, default=PRFStimulusEncoder) – An stimulus encoding model class or instance. Model classes will be instantiated during initialization. The default creates a PRFStimulusEncoder instance.

  • impulse_model (BaseImpulse or type or None, default=DerivativeTwoGammaImpulse, optional) – An impulse model class or instance. Model classes will be instantiated during initialization. The default creates a DerivativeTwoGammaImpulse instance with default values.

  • scaling_model (BaseScaling or type or None, default=Baseline, optional) – A scaling model class or instance. Model classes will be instantiated during initialization. The default creates a Baseline instance.

  • regressors_model (BaseRegressors or list of BaseRegressors or RegressorsList or None, default=None, optional) – A regressor model instance, a list of regressor model instances, or None. When a list is provided, it is wrapped in a RegressorsList and its contributions are summed. The regressor contribution is added after the scaling model.

Notes

The divisive normalization model follows these steps

  1. The two pRF response models make predictions for the stimulus grid.

  2. The encoding model encodes the responses with the stimulus design.

  3. The two encoded responses are combined through divisive normalization.

  4. The combined response is convolved with an impulse response (optional).

  5. The scaling model modifies the convolved response (optional).

  6. The regressors model adds a linear combination of fixed regressors to the scaled response (optional).

__call__(stimulus: prfmodel.stimuli.PRFStimulus, parameters: pandas.DataFrame, regressors: pandas.DataFrame | None = None, dtype: str | None = None) prfmodel.typing.Tensor

Predict the combined model response to a stimulus.

Parameters:
  • stimulus (PRFStimulus) – Population receptive field stimulus object.

  • parameters (pandas.DataFrame) – Dataframe with columns containing different model parameters and rows containing parameter values for different units.

  • regressors (pandas.DataFrame, optional) – Regressor design data. Required when the canonical model has a regressors model configured. A single data frame with shape (num_frames, num_regressors) whose columns cover the names required by every configured regressor model. Extra columns are ignored.

  • dtype (str, optional) – The dtype of the prediction result. If None (the default), uses the dtype from prfmodel.utils.get_dtype().

Returns:

The predicted model response with shape (num_units, num_frames) and dtype dtype.

Return type:

Tensor

property parameter_names: list[str]

Names of parameters used by the model.

Shared response model parameters appear once (no suffix). Non-shared parameters are suffixed with the two response suffixes (e.g. _center/_surround). The combination, encoding, impulse and scaling parameters are appended.