cleo.opto module

Contains opsin models, light sources, and some parameters

class cleo.opto.BansalFourStateOpsin(extra_namespace: dict = NOTHING, spectrum: list[tuple[float, float]] = NOTHING, spectrum_interpolator: Callable = <function log_pchip_interpolator>, extrapolate: bool = False, Gd1: Quantity = 66. * hertz, Gd2: Quantity = 10. * hertz, Gr0: Quantity = 0.333 * hertz, g0: Quantity = 3.2 * nsiemens, phim: Quantity = 1.e+22 * metre ** -2 * second ** -1, k1: Quantity = 0.4 * khertz, k2: Quantity = 120. * hertz, Gf0: Quantity = 18. * hertz, Gb0: Quantity = 8. * hertz, kf: Quantity = 10. * hertz, kb: Quantity = 8. * hertz, gamma: Quantity = 0.05, p: Quantity = 1, q: Quantity = 1, E: Quantity = 0. * volt, *, name: str = NOTHING, save_history: bool = True)[source]

Bases: MarkovOpsin

4-state model from Bansal et al. 2020.

The difference from the PyRhO model is that there is no voltage dependence.

rho_rel is channel density relative to standard model fit; modifying it post-injection allows for heterogeneous opsin expression.

IOPTO_VAR_NAME and V_VAR_NAME are substituted on injection.

Method generated by attrs for class BansalFourStateOpsin.

E: Quantity
Gb0: Quantity
Gd1: Quantity
Gd2: Quantity
Gf0: Quantity
Gr0: Quantity
g0: Quantity
gamma: Quantity
init_syn_vars(opto_syn: Synapses) None[source]

Initializes appropriate variables in Synapses implementing the model

Also called on reset().

Parameters:

syn (Synapses) – The synapses object implementing this model

k1: Quantity
k2: Quantity
kb: Quantity
kf: Quantity
model: str

Basic Brian model equations string.

Should contain a rho_rel term reflecting relative expression levels. Will likely also contain special NeuronGroup-dependent symbols such as V_VAR_NAME to be replaced on injection in modify_model_and_params_for_ng().

p: Quantity
phim: Quantity
q: Quantity
class cleo.opto.BansalThreeStatePump(extra_namespace: dict = NOTHING, spectrum: list[tuple[float, float]] = NOTHING, spectrum_interpolator: Callable = <function log_pchip_interpolator>, extrapolate: bool = False, Gd: Quantity = 250. * hertz, Gr: Quantity = 50. * hertz, ka: Quantity = msecond ** -1, p: Quantity = 0.7, q: Quantity = 0.1, phim: Quantity = 1.2e+24 * metre ** -2 * second ** -1, E: Quantity = -0.4 * volt, g0: Quantity = 22.34 * nsiemens, a: Quantity = 2.e+08 * metre ** -3 * second ** -1 * amp ** -1 * mole, b: float = 12, vartheta_max: Quantity = 5. * katal / (metre ** 3), kd: Quantity = 16. * mmolar, g_Cl: Quantity = 2.3 * nsiemens, Cl_out: Quantity = 124. * mmolar, Psi0: Quantity = 4.4286 * katal / (metre ** 3), E_Cl0: Quantity = -70. * mvolt, vmin: Quantity = -0.4 * volt, vmax: Quantity = 50. * mvolt, *, name: str = NOTHING, save_history: bool = True)[source]

Bases: MarkovOpsin

3-state model from Bansal et al. 2020. Defaults are for eNpHR3.0.

rho_rel is channel density relative to standard model fit; modifying it post-injection allows for heterogeneous opsin expression.

IOPTO_VAR_NAME and V_VAR_NAME are substituted on injection.

Method generated by attrs for class BansalThreeStatePump.

Cl_out: Quantity
E: Quantity
E_Cl0: Quantity
Gd: Quantity
Gr: Quantity
Psi0: Quantity
a: Quantity
b: float
g0: Quantity
g_Cl: Quantity
init_syn_vars(opto_syn: Synapses) None[source]

Initializes appropriate variables in Synapses implementing the model

Also called on reset().

Parameters:

syn (Synapses) – The synapses object implementing this model

ka: Quantity
kd: Quantity
model: str

Basic Brian model equations string.

Should contain a rho_rel term reflecting relative expression levels. Will likely also contain special NeuronGroup-dependent symbols such as V_VAR_NAME to be replaced on injection in modify_model_and_params_for_ng().

p: Quantity
phim: Quantity
q: Quantity
vartheta_max: Quantity
vmax: Quantity

Needed to avoid jumps in [Cl_in] for EIF neurons

vmin: Quantity

Needed to avoid jumps in [Cl_in] for EIF neurons

class cleo.opto.FourStateOpsin(extra_namespace: dict = NOTHING, spectrum: list[tuple[float, float]] = NOTHING, spectrum_interpolator: Callable = <function log_pchip_interpolator>, extrapolate: bool = False, g0: Quantity = 114. * nsiemens, gamma: Quantity = 0.00742, phim: Quantity = 2.33e+23 * metre ** -2 * second ** -1, k1: Quantity = 4.15 * khertz, k2: Quantity = 0.868 * khertz, p: Quantity = 0.833, Gf0: Quantity = 37.3 * hertz, kf: Quantity = 58.1 * hertz, Gb0: Quantity = 16.1 * hertz, kb: Quantity = 63. * hertz, q: Quantity = 1.94, Gd1: Quantity = 105. * hertz, Gd2: Quantity = 13.8 * hertz, Gr0: Quantity = 0.33 * hertz, E: Quantity = 0. * volt, v0: Quantity = 43. * mvolt, v1: Quantity = 17.1 * mvolt, *, name: str = NOTHING, save_history: bool = True)[source]

Bases: MarkovOpsin

4-state model from PyRhO (Evans et al. 2016).

rho_rel is channel density relative to standard model fit; modifying it post-injection allows for heterogeneous opsin expression.

IOPTO_VAR_NAME and V_VAR_NAME are substituted on injection.

Defaults are for ChR2.

Method generated by attrs for class FourStateOpsin.

E: Quantity
Gb0: Quantity
Gd1: Quantity
Gd2: Quantity
Gf0: Quantity
Gr0: Quantity
g0: Quantity
gamma: Quantity
init_syn_vars(opto_syn: Synapses) None[source]

Initializes appropriate variables in Synapses implementing the model

Also called on reset().

Parameters:

syn (Synapses) – The synapses object implementing this model

k1: Quantity
k2: Quantity
kb: Quantity
kf: Quantity
model: str

fv as described in Evans et al., 2016 can give us problems when we divide by zero. Specifically, when v - E = 0, we need to use l’Hopital’s rule to find the limit of fv. This is v1/v0. However…to make things simpler, we see that the (v-E) term cancels out with the same term in the I_post term.

p: Quantity
phim: Quantity
q: Quantity
v0: Quantity
v1: Quantity
class cleo.opto.Opsin(extra_namespace: dict = NOTHING, spectrum: list[tuple[float, float]] = NOTHING, spectrum_interpolator: Callable = <function log_pchip_interpolator>, extrapolate: bool = False, *, name: str = NOTHING, save_history: bool = True)[source]

Bases: LightDependent, SynapseDevice

Base class for opsin model.

Requires that the neuron model has a current term (by default Iopto) which is assumed to be positive (unlike the convention in many opsin modeling papers, where the current is described as negative).

We approximate dynamics under multiple wavelengths using a weighted sum of photon fluxes, where the ε factor indicates the activation relative to the peak-sensitivy wavelength for an equivalent number of photons (see Mager et al, 2018). This weighted sum is an approximation of a nonlinear peak-non-peak wavelength relation; see notebooks/multi_wavelength_model.ipynb for details.

Method generated by attrs for class Opsin.

property action_spectrum

Alias for light_receptor.spectrum

class cleo.opto.ProportionalCurrentOpsin(extra_namespace: dict = NOTHING, spectrum: list[tuple[float, float]] = NOTHING, spectrum_interpolator: Callable = <function log_pchip_interpolator>, extrapolate: bool = False, *, name: str = NOTHING, save_history: bool = True, I_per_Irr: Quantity)[source]

Bases: Opsin

A simple model delivering current proportional to light intensity

Method generated by attrs for class ProportionalCurrentOpsin.

I_per_Irr: Quantity

How much current (in amps or unitless, depending on neuron model) to deliver (must include per unit irradiance).

model: str

Basic Brian model equations string.

Should contain a rho_rel term reflecting relative expression levels. Will likely also contain special NeuronGroup-dependent symbols such as V_VAR_NAME to be replaced on injection in modify_model_and_params_for_ng().

required_vars: list[Tuple[str, Unit]]

Default names of state variables required in the neuron group, along with units, e.g., [(‘Iopto’, amp)].

It is assumed that non-default values can be passed in on injection as a keyword argument [default_name]_var_name=[non_default_name] and that these are found in the model string as [DEFAULT_NAME]_VAR_NAME before replacement.

cleo.opto.chr2_4s() FourStateOpsin[source]

Returns a 4-state ChR2 model.

Params taken from try.projectpyrho.org’s default 4-state configuration. Action spectrum from Nagel et al., 2003, Fig. 4a, extracted using Plot Digitizer.

Parameters can be changed after initialization but before injection.

cleo.opto.chr2_b4s() BansalFourStateOpsin[source]

Returns a 4-state ChR2 model.

Params given in Bansal et al., 2020. Action spectrum from Nagel et al., 2003, Fig. 4a, extracted using Plot Digitizer.

Parameters can be changed after initialization but before injection.

cleo.opto.chr2_h134r_4s() BansalFourStateOpsin[source]

Returns a 4-state ChR2(H134R) model.

Params given in Bansal et al., 2020. Action spectrum is same as for chr2_4s(), but blue-shifted 20 nm (I cannot find it directly in the literature).

Parameters can be changed after initialization but before injection.

cleo.opto.chrimson_4s() BansalFourStateOpsin[source]

Returns a 4-state Chrimson model.

Params given in Bansal et al., 2020. Action spectrum from Mager et al., 2018, Supp. Fig. 1a, extracted using Plot Digitizer.

Parameters can be changed after initialization but before injection.

cleo.opto.enphr3_3s()[source]

Returns a 3-state model of eNpHR3, a chloride pump.

Params given in Bansal et al., 2020. Action spectrum from Gradinaru et al., 2010, Figure 3F, extracted using Plot Digitizer.

cleo.opto.gtacr2_4s() BansalFourStateOpsin[source]

Returns a 4-state model of GtACR2, an anion channel.

Params given in Bansal et al., 2020. Action spectra from Govorunova et al., 2015, Fig. 1f, extracted using Plot Digitizer.

Parameters can be changed after initialization but before injection.

cleo.opto.vfchrimson_4s() BansalFourStateOpsin[source]

Returns a 4-state vf-Chrimson model.

Params given in Bansal et al., 2020. Action spectrum from Mager et al., 2018, Supp. Fig. 1a, extracted using Plot Digitizer.

Parameters can be changed after initialization but before injection.