How to use the pulse2percept.retina function in pulse2percept

To help you get started, we’ve selected a few pulse2percept examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulse2percept / pulse2percept / pulse2percept / api.py View on Github external
"""
        model_not_found = False
        if isinstance(model, six.string_types):
            # If `model` is a string, choose from existing models
            if model.lower() == 'latest':
                logging.getLogger(__name__).debug("Setting up latest model.")
                self.gcl = retina.TemporalModel(**kwargs)
            elif model.lower() in ['nanduri', 'nanduri2012']:
                logging.getLogger(__name__).debug("Setting up Nanduri (2012) "
                                                  "model.")
                self.gcl = retina.Nanduri2012(**kwargs)
            elif model.lower() in ['horsager', 'horsager2009']:
                logging.getLogger(__name__).debug("Setting up Horsager "
                                                  "(2009) model.")
                self.gcl = retina.Horsager2009(**kwargs)
            else:
                model_not_found = True
        elif isinstance(model, retina.BaseModel):
            # If `model` is not a string, must be of type BaseModel
            debug_str = "Setting up %s." % model.__module__
            logging.getLogger(__name__).debug(debug_str)
            self.gcl = model
        else:
            model_not_found = True

        if model_not_found:
            err_str = "Model '%s' not found. Choose from: " % model
            err_str += ", ".join(retina.SUPPORTED_TEMPORAL_MODELS)
            err_str += " or provide your own retina.BaseModel instance."
            raise ValueError(err_str)
github pulse2percept / pulse2percept / pulse2percept / api.py View on Github external
ylo = np.floor((np.min(ys) - cspread) / round_to) * round_to
            yhi = np.ceil((np.max(ys) + cspread) / round_to) * round_to
        elif isinstance(y_range, (int, float)):
            ylo = y_range
            yhi = y_range
        elif isinstance(y_range, (list, tuple, np.ndarray)):
            if len(y_range) != 2 or y_range[1] < y_range[0]:
                e_s = "y_range must be a tuple (ylo, yhi) where ylo <= yhi."
                raise ValueError(e_s)
            ylo = y_range[0]
            yhi = y_range[1]
        else:
            raise ValueError("y_range must be a tuple (ylo, yhi) or None.")

        # Generate the grid from the above specs
        self.ofl = retina.Grid(x_range=(xlo, xhi), y_range=(ylo, yhi),
                               eye=self.implant.eye, sampling=sampling,
                               n_axons=n_axons, phi_range=phi_range,
                               n_rho=n_rho, rho_range=rho_range,
                               loc_od=loc_od,
                               sensitivity_rule=sensitivity_rule,
                               contribution_rule=contribution_rule,
                               decay_const=decay_const,
                               powermean_exp=powermean_exp,
                               datapath=datapath, save_data=save_data,
                               engine=self.engine, scheduler=self.scheduler,
                               n_jobs=self.n_jobs)
github pulse2percept / pulse2percept / pulse2percept / api.py View on Github external
"Predicting visual sensitivity in retinal prosthesis patients",
               Investigative Ophthalmology & Visual Science, 50(4):1483, 2009.



        """
        model_not_found = False
        if isinstance(model, six.string_types):
            # If `model` is a string, choose from existing models
            if model.lower() == 'latest':
                logging.getLogger(__name__).debug("Setting up latest model.")
                self.gcl = retina.TemporalModel(**kwargs)
            elif model.lower() in ['nanduri', 'nanduri2012']:
                logging.getLogger(__name__).debug("Setting up Nanduri (2012) "
                                                  "model.")
                self.gcl = retina.Nanduri2012(**kwargs)
            elif model.lower() in ['horsager', 'horsager2009']:
                logging.getLogger(__name__).debug("Setting up Horsager "
                                                  "(2009) model.")
                self.gcl = retina.Horsager2009(**kwargs)
            else:
                model_not_found = True
        elif isinstance(model, retina.BaseModel):
            # If `model` is not a string, must be of type BaseModel
            debug_str = "Setting up %s." % model.__module__
            logging.getLogger(__name__).debug(debug_str)
            self.gcl = model
        else:
            model_not_found = True

        if model_not_found:
            err_str = "Model '%s' not found. Choose from: " % model
github pulse2percept / pulse2percept / pulse2percept / api.py View on Github external
if isinstance(model, six.string_types):
            # If `model` is a string, choose from existing models
            if model.lower() == 'latest':
                logging.getLogger(__name__).debug("Setting up latest model.")
                self.gcl = retina.TemporalModel(**kwargs)
            elif model.lower() in ['nanduri', 'nanduri2012']:
                logging.getLogger(__name__).debug("Setting up Nanduri (2012) "
                                                  "model.")
                self.gcl = retina.Nanduri2012(**kwargs)
            elif model.lower() in ['horsager', 'horsager2009']:
                logging.getLogger(__name__).debug("Setting up Horsager "
                                                  "(2009) model.")
                self.gcl = retina.Horsager2009(**kwargs)
            else:
                model_not_found = True
        elif isinstance(model, retina.BaseModel):
            # If `model` is not a string, must be of type BaseModel
            debug_str = "Setting up %s." % model.__module__
            logging.getLogger(__name__).debug(debug_str)
            self.gcl = model
        else:
            model_not_found = True

        if model_not_found:
            err_str = "Model '%s' not found. Choose from: " % model
            err_str += ", ".join(retina.SUPPORTED_TEMPORAL_MODELS)
            err_str += " or provide your own retina.BaseModel instance."
            raise ValueError(err_str)
github pulse2percept / pulse2percept / pulse2percept / api.py View on Github external
Stimulation", Investigative Ophthalmology & Visual Science 53,
               205-214, 2012.
        .. [2] A. Horsager, S. H. Greenwald, J. D. Weiland, M. S. Humayun,
               R. J. Greenberg, M. J. McMahon, G. M. Boynton, and I. Fine,
               "Predicting visual sensitivity in retinal prosthesis patients",
               Investigative Ophthalmology & Visual Science, 50(4):1483, 2009.



        """
        model_not_found = False
        if isinstance(model, six.string_types):
            # If `model` is a string, choose from existing models
            if model.lower() == 'latest':
                logging.getLogger(__name__).debug("Setting up latest model.")
                self.gcl = retina.TemporalModel(**kwargs)
            elif model.lower() in ['nanduri', 'nanduri2012']:
                logging.getLogger(__name__).debug("Setting up Nanduri (2012) "
                                                  "model.")
                self.gcl = retina.Nanduri2012(**kwargs)
            elif model.lower() in ['horsager', 'horsager2009']:
                logging.getLogger(__name__).debug("Setting up Horsager "
                                                  "(2009) model.")
                self.gcl = retina.Horsager2009(**kwargs)
            else:
                model_not_found = True
        elif isinstance(model, retina.BaseModel):
            # If `model` is not a string, must be of type BaseModel
            debug_str = "Setting up %s." % model.__module__
            logging.getLogger(__name__).debug(debug_str)
            self.gcl = model
        else:
github pulse2percept / pulse2percept / pulse2percept / api.py View on Github external
logging.getLogger(__name__).debug("Setting up Horsager "
                                                  "(2009) model.")
                self.gcl = retina.Horsager2009(**kwargs)
            else:
                model_not_found = True
        elif isinstance(model, retina.BaseModel):
            # If `model` is not a string, must be of type BaseModel
            debug_str = "Setting up %s." % model.__module__
            logging.getLogger(__name__).debug(debug_str)
            self.gcl = model
        else:
            model_not_found = True

        if model_not_found:
            err_str = "Model '%s' not found. Choose from: " % model
            err_str += ", ".join(retina.SUPPORTED_TEMPORAL_MODELS)
            err_str += " or provide your own retina.BaseModel instance."
            raise ValueError(err_str)