# Path: pysaliency/baseline_utils.py
# def _normalize_fixations(orig_xs, orig_ys, orig_ns, sizes, new_xs, new_ys, real_widths, real_heights):
# def normalize_fixations(stimuli, fixations, keep_aspect=False, add_shape=False, verbose=True):
# def fixations_to_scikit_learn(fixations, normalize=None, keep_aspect=False, add_shape=False,
#                               add_stimulus_number=False,
#                               add_fixation_number=False,
#                               verbose=True):
#     def __init__(self, stimuli, fixations):
#     def __iter__(self):
#     def __len__(self):
#     def __init__(self, stimuli, fixations):
#     def __iter__(self):
#     def __len__(self):
#     def __init__(self, stimuli, fixations, chunks_per_image=10, random_seed=42):
#     def __iter__(self):
#     def __len__(self):
#     def __init__(self, bandwidth=1.0, regularization = 1.0e-5):
#     def setup(self):
#     def fit(self, X):
#     def score_samples(self, X):
#     def score(self, X):
#     def __init__(self, bandwidth=1.0, regularization = 1.0e-5, regularizing_log_likelihoods=None):
#     def setup(self):
#     def fit(self, X):
#     def score_samples(self, X):
#     def score(self, X):
#     def __init__(self, nonfixations, bandwidth=1.0):
#     def setup(self):
#     def fit(self, X):
#     def score_samples(self, X):
#     def score(self, X):
#     def __init__(self, stimuli, fixations, bandwidth, eps = 1e-20, keep_aspect=False, verbose=False, **kwargs):
#     def _log_density(self, stimulus):
#     def __init__(self, stimuli, fixations, bandwidth, eps=1e-20, keep_aspect=False, verbose=False, grid_spacing=1, **kwargs):
#     def _log_density(self, stimulus):
#     def __init__(self, stimuli, fixations, bandwidth, eps = 1e-20, **kwargs):
#     def _log_density(self, stimulus):
#     def __init__(self, stimuli, fixations, bandwidth, eps = 1e-20, keep_aspect=False, **kwargs):
#     def _log_density(self, stimulus):
# class ScikitLearnImageCrossValidationGenerator(object):
# class ScikitLearnImageSubjectCrossValidationGenerator(object):
# class ScikitLearnWithinImageCrossValidationGenerator(object):
# class RegularizedKernelDensityEstimator(BaseEstimator):
# class MixtureKernelDensityEstimator(BaseEstimator):
# class AUCKernelDensityEstimator(BaseEstimator):
# class GoldModel(Model):
# class KDEGoldModel(Model):
# class CrossvalidatedBaselineModel(Model):
# class BaselineModel(Model):
#         ZZ = np.zeros(shape)
#         ZZ = gaussian_filter(ZZ, [self.bandwidth*y_factor, self.bandwidth*x_factor])
#         ZZ = np.log(ZZ)
#         X = fixations_to_scikit_learn(
#             self.fixations[inds], normalize=self.stimuli,
#             keep_aspect=self.keep_aspect, add_shape=False, verbose=False)
#         XX, YY = np.meshgrid(xs, ys)
#         ZZ = scores
#             ZZ = np.logaddexp(
#                 np.log(1 - self.eps) + scores,
#                 np.log(self.eps) - np.log(height * width)
#             )
#         ZZ = np.zeros(shape)
#         ZZ = gaussian_filter(ZZ, [self.bandwidth*shape[0], self.bandwidth*shape[1]])
#         ZZ = np.log(ZZ)
#             ZZ = np.zeros(shape)
#             ZZ = gaussian_filter(ZZ, [self.bandwidth*y_factor, self.bandwidth*x_factor])
#             ZZ = np.log(ZZ)


import pytest
import numpy as np
import pysaliency
from pysaliency.baseline_utils import fill_fixation_map, KDEGoldModel
    subjects = [0, 1, 1]
    return pysaliency.FixationTrains.from_fixation_trains(xs_trains, ys_trains, ts_trains, ns, subjects)


@pytest.fixture
def stimuli():
    return pysaliency.Stimuli([np.random.randn(40, 40, 3),
                               np.random.randn(40, 40, 3)])


def test_fixation_map():
    fixations = np.array([
        [0, 0],
        [1, 1],
        [1, 1],
        [1, 2],
        [1, 2],
        [2, 1]])

    fixation_map = np.zeros((3, 3))
    fill_fixation_map(fixation_map, fixations)

    np.testing.assert_allclose(fixation_map, np.array([
        [1, 0, 0],
        [0, 2, 2],
        [0, 1, 0]]))


def test_kde_gold_model(stimuli, fixation_trains):
    bandwidth = 0.1

# Path: pysaliency/baseline_utils.py
# def _normalize_fixations(orig_xs, orig_ys, orig_ns, sizes, new_xs, new_ys, real_widths, real_heights):
# def normalize_fixations(stimuli, fixations, keep_aspect=False, add_shape=False, verbose=True):
# def fixations_to_scikit_learn(fixations, normalize=None, keep_aspect=False, add_shape=False,
#                               add_stimulus_number=False,
#                               add_fixation_number=False,
#                               verbose=True):
#     def __init__(self, stimuli, fixations):
#     def __iter__(self):
#     def __len__(self):
#     def __init__(self, stimuli, fixations):
#     def __iter__(self):
#     def __len__(self):
#     def __init__(self, stimuli, fixations, chunks_per_image=10, random_seed=42):
#     def __iter__(self):
#     def __len__(self):
#     def __init__(self, bandwidth=1.0, regularization = 1.0e-5):
#     def setup(self):
#     def fit(self, X):
#     def score_samples(self, X):
#     def score(self, X):
#     def __init__(self, bandwidth=1.0, regularization = 1.0e-5, regularizing_log_likelihoods=None):
#     def setup(self):
#     def fit(self, X):
#     def score_samples(self, X):
#     def score(self, X):
#     def __init__(self, nonfixations, bandwidth=1.0):
#     def setup(self):
#     def fit(self, X):
#     def score_samples(self, X):
#     def score(self, X):
#     def __init__(self, stimuli, fixations, bandwidth, eps = 1e-20, keep_aspect=False, verbose=False, **kwargs):
#     def _log_density(self, stimulus):
#     def __init__(self, stimuli, fixations, bandwidth, eps=1e-20, keep_aspect=False, verbose=False, grid_spacing=1, **kwargs):
#     def _log_density(self, stimulus):
#     def __init__(self, stimuli, fixations, bandwidth, eps = 1e-20, **kwargs):
#     def _log_density(self, stimulus):
#     def __init__(self, stimuli, fixations, bandwidth, eps = 1e-20, keep_aspect=False, **kwargs):
#     def _log_density(self, stimulus):
# class ScikitLearnImageCrossValidationGenerator(object):
# class ScikitLearnImageSubjectCrossValidationGenerator(object):
# class ScikitLearnWithinImageCrossValidationGenerator(object):
# class RegularizedKernelDensityEstimator(BaseEstimator):
# class MixtureKernelDensityEstimator(BaseEstimator):
# class AUCKernelDensityEstimator(BaseEstimator):
# class GoldModel(Model):
# class KDEGoldModel(Model):
# class CrossvalidatedBaselineModel(Model):
# class BaselineModel(Model):
#         ZZ = np.zeros(shape)
#         ZZ = gaussian_filter(ZZ, [self.bandwidth*y_factor, self.bandwidth*x_factor])
#         ZZ = np.log(ZZ)
#         X = fixations_to_scikit_learn(
#             self.fixations[inds], normalize=self.stimuli,
#             keep_aspect=self.keep_aspect, add_shape=False, verbose=False)
#         XX, YY = np.meshgrid(xs, ys)
#         ZZ = scores
#             ZZ = np.logaddexp(
#                 np.log(1 - self.eps) + scores,
#                 np.log(self.eps) - np.log(height * width)
#             )
#         ZZ = np.zeros(shape)
#         ZZ = gaussian_filter(ZZ, [self.bandwidth*shape[0], self.bandwidth*shape[1]])
#         ZZ = np.log(ZZ)
#             ZZ = np.zeros(shape)
#             ZZ = gaussian_filter(ZZ, [self.bandwidth*y_factor, self.bandwidth*x_factor])
#             ZZ = np.log(ZZ)


# Path: tests/test_baseline_utils.py
import pytest
import numpy as np
import pysaliency
from pysaliency.baseline_utils import fill_fixation_map, KDEGoldModel

    subjects = [0, 1, 1]
    return pysaliency.FixationTrains.from_fixation_trains(xs_trains, ys_trains, ts_trains, ns, subjects)


@pytest.fixture
def stimuli():
    return pysaliency.Stimuli([np.random.randn(40, 40, 3),
                               np.random.randn(40, 40, 3)])


def test_fixation_map():
    fixations = np.array([
        [0, 0],
        [1, 1],
        [1, 1],
        [1, 2],
        [1, 2],
        [2, 1]])

    fixation_map = np.zeros((3, 3))
    fill_fixation_map(fixation_map, fixations)

    np.testing.assert_allclose(fixation_map, np.array([
        [1, 0, 0],
        [0, 2, 2],
        [0, 1, 0]]))


def test_kde_gold_model(stimuli, fixation_trains):
    bandwidth = 0.1

    kde_gold_model = KDEGoldModel(stimuli, fixation_trains, bandwidth=bandwidth)