Skip to content

Commit

Permalink
DVAAwareModels: don't autoconvert to color stimuli
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Kümmmerer <[email protected]>
  • Loading branch information
matthias-k committed Apr 29, 2024
1 parent be678d4 commit c0844ee
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions pysaliency/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,12 +942,17 @@ def __init__(self, dva, parent_model, parent_model_dva, verbose=False, **kwargs)

def _log_density(self, stimulus):
stimulus_data = as_stimulus(stimulus).stimulus_data
stimulus = self.ensure_color(stimulus_data)

if self.factor != 1.0:
if self.verbose:
print("Resizing with factor", self.factor)
stimulus_for_parent_model = zoom(stimulus, [self.factor, self.factor, 1.0], order=1, mode='nearest')
if stimulus_data.ndim == 2:
factors = [self.factor, self.factor]
else:
factors = [self.factor, self.factor, 1.0]

stimulus_for_parent_model = zoom(stimulus_data, factors, order=1, mode='nearest')

else:
stimulus_for_parent_model = stimulus

Expand Down Expand Up @@ -992,18 +997,23 @@ def __init__(self, dva: float, parent_model: ScanpathModel, parent_model_dva: fl

def conditional_log_density(self, stimulus, x_hist, y_hist, t_hist, attributes=None, out=None):
stimulus_data = as_stimulus(stimulus).stimulus_data
stimulus = self.ensure_color(stimulus_data)
if out is not None:
raise NotImplementedError()

if self.factor != 1.0:

if self.verbose:
print("Resizing with factor", self.factor)
stimulus_for_parent_model = zoom(stimulus, [self.factor, self.factor, 1.0], order=1, mode='nearest')
if stimulus_data.ndim == 2:
factors = [self.factor, self.factor]
else:
factors = [self.factor, self.factor, 1.0]

stimulus_for_parent_model = zoom(stimulus_data, factors, order=1, mode='nearest')

outer_shape = (
stimulus.shape[0],
stimulus.shape[1]
stimulus_data.shape[0],
stimulus_data.shape[1]
)

inner_shape = (
Expand Down

0 comments on commit c0844ee

Please sign in to comment.