Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
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)
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)
"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
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)
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:
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)