nn_tuning.stimulus_generator.stimulus_generator

View Source
import abc
from abc import ABC

import numpy as np

from ..storage import Table, TableSet
from typing import Union


class StimulusGenerator(ABC):
    """
    Abstract class for the StimulusGenerators.
    """

    @abc.abstractmethod
    def generate(self, shape: tuple) -> Union[Table, TableSet]:
        """
        Generates all input and saves the input to a table.

        Usage
        ------
        >>> StimulusGenerator().generate((128,160))

        Args:
            shape: The expected shape of the input

        Returns:
            Table or TableSet containing the stimuli
        """
        raise NotImplementedError

    @property
    @abc.abstractmethod
    def stimulus_description(self) -> np.ndarray:
        """
        Generates the stimulus description for use in the `FittingManager`

        Returns:
            np.ndarray containing the stimulus variable to be used by the FittingManager.
        """
        raise NotImplementedError

    @property
    @abc.abstractmethod
    def stim_x(self):
        pass

    @property
    @abc.abstractmethod
    def stim_y(self):
        pass
#   class StimulusGenerator(abc.ABC):
View Source
class StimulusGenerator(ABC):
    """
    Abstract class for the StimulusGenerators.
    """

    @abc.abstractmethod
    def generate(self, shape: tuple) -> Union[Table, TableSet]:
        """
        Generates all input and saves the input to a table.

        Usage
        ------
        >>> StimulusGenerator().generate((128,160))

        Args:
            shape: The expected shape of the input

        Returns:
            Table or TableSet containing the stimuli
        """
        raise NotImplementedError

    @property
    @abc.abstractmethod
    def stimulus_description(self) -> np.ndarray:
        """
        Generates the stimulus description for use in the `FittingManager`

        Returns:
            np.ndarray containing the stimulus variable to be used by the FittingManager.
        """
        raise NotImplementedError

    @property
    @abc.abstractmethod
    def stim_x(self):
        pass

    @property
    @abc.abstractmethod
    def stim_y(self):
        pass

Abstract class for the StimulusGenerators.

#  
@abc.abstractmethod
def generate( self, shape: tuple ) -> Union[nn_tuning.storage.table.Table, nn_tuning.storage.table_set.TableSet]:
View Source
    @abc.abstractmethod
    def generate(self, shape: tuple) -> Union[Table, TableSet]:
        """
        Generates all input and saves the input to a table.

        Usage
        ------
        >>> StimulusGenerator().generate((128,160))

        Args:
            shape: The expected shape of the input

        Returns:
            Table or TableSet containing the stimuli
        """
        raise NotImplementedError

Generates all input and saves the input to a table.

Usage

>>> StimulusGenerator().generate((128,160))
Args
  • shape: The expected shape of the input
Returns

Table or TableSet containing the stimuli

#   stimulus_description: numpy.ndarray

Generates the stimulus description for use in the FittingManager

Returns

np.ndarray containing the stimulus variable to be used by the FittingManager.

#   stim_x
#   stim_y