olftrans.neurodriver package

Submodules

olftrans.neurodriver.model module

NeuroDriver Models and Utilities

Examples

1. Compute F-I >>> from olftrans.neurodriver import model >>> import numpy as np >>> dt = 5e-6 >>> repeat = 50 >>> Is = np.linspace(0,150,150) >>> _, fs = model.compute_fi(model.NoisyConnorStevens, Is, dt=dt, repeat=repeat, save=True)

2. Compute Resting Spike Rate >>> from olftrans.neurodriver import model >>> import numpy as np >>> dt = 5e-6 >>> repeat = 50 >>> sigmas = np.linspace(0,0.005,150) >>> _, rest_fs = model.compute_resting(model.NoisyConnorStevens, ‘sigma’, sigmas/np.sqrt(dt), dt=dt, repeat=repeat, save=True)

3. Compute Peak and SS Currents of OTP >>> from olftrans.neurodriver import model >>> import numpy as np >>> dt, amplitude = 5e-6, 100. >>> br_s = np.linspace(1e-2, 1000., 50) >>> dr_s = np.linspace(1e-2, 1000., 50) >>> _, _, I_ss, I_peak = model.compute_peak_ss_I(br_s, dr_s, dt=dt, amplitude=amplitude, save=True)

class olftrans.neurodriver.model.Model(name='', **kwargs)[source]

Bases: neuroballad.models.element.Element

NeuroBallad Element that also wraps the underlying NDComponent

class olftrans.neurodriver.model.NoisyConnorStevens(name='', **kwargs)[source]

Bases: olftrans.neurodriver.model.Model

Noisy Connor-Stevens Neuron Model

F-I curve is controlled by sigma parameter

Notes

sigma value should be scaled by sqrt(dt) as sigma/sqrt(dt) where sigma is the standard deviation of the Brownian Motion

params = {'EK': -72.0, 'EL': -17.0, 'ENa': 55.0, 'Ea': -75.0, 'gK': 20.0, 'gL': 0.3, 'gNa': 120.0, 'ga': 47.7, 'hs': -12.0, 'ms': -5.3, 'ns': -4.3, 'refperiod': 1.0, 'sigma': 2.05}
states = {'a': 1.0, 'b': 1.0, 'h': 1.0, 'm': 0.0, 'n': 0.0, 'refactory': 0.0, 'v1': -60.0, 'v2': -60.0}
class olftrans.neurodriver.model.OTP(name='', **kwargs)[source]

Bases: olftrans.neurodriver.model.Model

Odorant Transduction Process

element_class = 'neuron'
params = {'Imax': 62.13, 'a1': 45.0, 'a2': 146.1, 'a3': 2.539, 'b1': 0.8, 'b2': 117.2, 'b3': 0.9096, 'br': 1.0, 'c': 0.06546, 'dr': 10.0, 'gamma': 0.215, 'kappa': 8841.0, 'p': 1.0}
states = {'duh': 0.0, 'uh': 0.0, 'v': 0.0, 'x1': 0.0, 'x2': 0.0, 'x3': 0.0}
olftrans.neurodriver.model.compute_fi(NeuronModel, Is, repeat=1, input_var='I', spike_var='spike_state', dur=2.0, start=0.5, dt=1e-05, neuron_params=None, save=True)[source]

Compute Frequency-Current relationship of Neuron

Notes

If save==True, olftrans.data.data.olfdata.save is called.

Returns

1d array of Currents spike_rates: 1d array Spiking Frequencies, dimension matches param_values

Return type

Is

Parameters
  • NeuronModel (olftrans.neurodriver.model.Model) –

  • Is (numpy.ndarray) –

  • repeat (int) –

  • input_var (str) –

  • spike_var (str) –

  • dur (float) –

  • start (float) –

  • dt (float) –

  • neuron_params (Optional[dict]) –

  • save (bool) –

Examples

Basic Usage: >>> from olftrans.neurodriver.model import NoisyConnorStevens >>> Is = np.linspace(0., 150, 100) >>> dt = 1e-5 >>> _, fs = compute_fi(NoisyConnorStevens, Is, repeat=50, dt=dt, neuron_params={‘sigma’: 0.005/np.sqrt(dt)})

We can look for the input current value from spike rate >>> target_spike_rate = 150. # [Hz] >>> target_I = np.interp(x=target_spike_rate, xp=fs, fp=fs)

olftrans.neurodriver.model.compute_peak_ss_I(br_s, dr_s, dt=1e-05, dur=2.0, start=0.5, save=True, amplitude=100.0, steady_state_compute_time=None)[source]

Compute Peak and Steady-State Current output of OTP Model

Notes

if save==True, olftrans.data.data.olfdata.save is called.

Returns

1d array of binding rate dr_s: 1d array of dissociation rate I_ss: 2d array of resultant steady-state currents I_peak: 2d array of resultant peak currents

Return type

br_s

Parameters
  • br_s (numpy.ndarray) –

  • dr_s (numpy.ndarray) –

  • dt (float) –

  • dur (float) –

  • start (float) –

  • save (bool) –

  • amplitude (float) –

Examples

Basic Usage: >>> br_s = np.linspace(1e-1, 100., 100) >>> dr_s = np.linspace(1e-1, 100., 100) >>> _, _, I_ss, I_peak = compute_peak_ss_I(br_s, dr_s, save=True)

Plotting Steady-State Current against affinity: >>> DR, BR = np.meshgrid(dr_s, br_s) >>> plt.plot((BR/DR).ravel(), I_ss.ravel()) # steady-state current is only dependent on dissociation

We can also look for the affinity value from steady-state Current output >>> target_I = 50. # [uA] >>> target_aff = np.interp(x=target_I, xp=I_ss.ravel(), fp=(BR/DR).ravel())

olftrans.neurodriver.model.compute_peak_ss_spike_rate(br_s, dr_s, repeat=1, dt=1e-05, dur=2.0, start=0.5, save=True, amplitude=100.0, neuron_params=None)[source]

Compute Peak and Steady-State Spike Rate output of OTP-BSG Cascade

Notes

if save==True, olftrans.data.data.olfdata.save is called.

Returns

1d array of binding rate dr_s: 1d array of dissociation rate spikerate_ss: 2d array of resultant steady-state currents spikerate_peak: 2d array of resultant peak currents

Return type

br_s

Parameters
  • br_s (numpy.ndarray) –

  • dr_s (numpy.ndarray) –

  • repeat (int) –

  • dt (float) –

  • dur (float) –

  • start (float) –

  • save (bool) –

  • amplitude (float) –

  • neuron_params (Optional[dict]) –

olftrans.neurodriver.model.compute_resting(NeuronModel, param_key, param_values, neuron_params=None, repeat=1, input_var='I', spike_var='spike_state', dur=2.0, dt=1e-05, save=True, smoothen=True, savgol_window=15, savgol_order=3)[source]

Compute Resting Spike Rate of a Neuron as Parameter varies

Parameters
  • NeuronModel (olftrans.neurodriver.model.Model) – Model to be used to compute Resting Spike Rate

  • param_key (str) – Parameter of the model to sweep

  • param_values (numpy.ndarray) – values of the parameter to sweep

  • neuron_params (Optional[dict]) – other parameters to fix

  • repeat (int) – number of times the same parameter value is repeated on neuron models This is for noise reduction purposes

  • input_var (str) – variable name of the input variable for the neuron model

  • spike_var (str) – variable name of the spike variable for the neuron model

  • dur (float) – duration of simulation

  • dt (float) – time resolution of the simulation

  • save (bool) – whether to save the output

  • smoothen (bool) –

  • savgol_window (int) –

  • savgol_order (int) –

Return type

Tuple[numpy.ndarray, numpy.ndarray]

Notes

if save==True, olftrans.data.data.olfdata.save is called.

Returns

1d array of param_values spike_rates: 1d array Spiking Frequencies, dimension matches param_values

Return type

param_values

Parameters
  • NeuronModel (olftrans.neurodriver.model.Model) –

  • param_key (str) –

  • param_values (numpy.ndarray) –

  • neuron_params (Optional[dict]) –

  • repeat (int) –

  • input_var (str) –

  • spike_var (str) –

  • dur (float) –

  • dt (float) –

  • save (bool) –

  • smoothen (bool) –

  • savgol_window (int) –

  • savgol_order (int) –

Examples

Basic Usage: >>> from olftrans.neurodriver.model import NoisyConnorStevens >>> sigmas = np.linspace(0., 0.005, 100) >>> _, fs = compute_resting(NoisyConnorStevens, ‘sigma’, sigmas, repeat=50)

We can look for the parameter value from resting spike rate >>> target_resting = 8. # [Hz] >>> target_sigma = np.interp(x=target_resting, xp=fs, fp=sigmas)

Module contents

NeuroDriver Compatible Models

Main Entry point is the olftrans.neurodriver.model module.