Mechanisms¶
- class dendrotweaks.biophys.mechanisms.Mechanism(name)[source]¶
Bases:
object
A class representing a mechanism in a neuron model.
A mechanism is a set of differential equations that describe the kinetics of a channel or a pump in the neuron membrane
- Parameters:
name (str) – The name of the mechanism.
- name¶
The name of the mechanism.
- Type:
str
- params¶
A dictionary of the parameters of the mechanism.
- Type:
dict
- range_params¶
A dictionary of the range parameters of the mechanism added under the RANGE statement in the MOD file.
- Type:
dict
- property params_with_suffix¶
The parameters of the mechanism with the suffix — the name of the mechanism.
- Returns:
A dictionary of the parameters of the mechanism with the suffix and their values.
- Return type:
dict
- property range_params_with_suffix¶
The range parameters of the mechanism with the suffix — the name of the mechanism. The range parameters are the parameters defined in the RANGE block of the NMODL file.
- Returns:
A dictionary of the range parameters of the mechanism with the suffix and their values.
- Return type:
dict
- class dendrotweaks.biophys.mechanisms.IonChannel(name)[source]¶
Bases:
Mechanism
A class representing an ion channel in a neuron model.
- Parameters:
name (str) – The name of the channel.
- independent_var_name¶
The name of the independent variable for the channel kinetics e.g. ‘v’, ‘cai’.
- Type:
str
- params¶
A dictionary of the parameters of the channel kinetics and distribution.
- Type:
dict
- range_params¶
A dictionary of the range parameters of the channel kinetics added under the RANGE statement in the MOD file.
- Type:
dict
- temperature¶
The temperature in degrees Celsius.
- Type:
float
- tadj¶
The temperature adjustment factor for the channel kinetics.
- Type:
float
- set_tadj(temperature)[source]¶
Set the temperature adjustment factor for the channel kinetics.
- Parameters:
temperature (float) – The temperature in degrees Celsius.
Notes
The temperature adjustment factor is calculated as: tadj = q10 ** ((temperature - reference_temp) / 10) where q10 is the temperature coefficient and reference_temp is the temperature at which the channel kinetics were measured.
- get_data(x=None, temperature: float = 37, verbose=True) Dict[str, Dict[str, float]] [source]¶
Get the data for the channel kinetics as a dictionary. The data includes the steady state values and time constants of the channel, as well as the independent variable values.
- Parameters:
x (np.array, optional) – The independent variable for the channel kinetics. If None, the default values will be used. The default is None.
temperature (float, optional) – The temperature in degrees Celsius. The default is 37.
- Returns:
A dictionary of states with their steady state values and time constants: { ‘state1’: {‘inf’: np.array, ‘tau’: np.array}, ‘state2’: {‘inf’: np.array, ‘tau’: np.array}, … ‘x’: np.array }
- Return type:
Dict[str, Dict[str, np.ndarray]]
- plot_kinetics(ax=None, linestyle='solid', **kwargs) None [source]¶
Plot the kinetics of the channel.
- Parameters:
ax (matplotlib.axes.Axes, optional) – The axes to plot the kinetics on. If None, a new figure will be created. The default is None.
linestyle (str, optional) – The line style for the plots. The default is ‘solid’.
**kwargs (dict) – Additional keyword arguments to pass to the get_data method.
- property params_with_suffix¶
The parameters of the mechanism with the suffix — the name of the mechanism.
- Returns:
A dictionary of the parameters of the mechanism with the suffix and their values.
- Return type:
dict
- property range_params_with_suffix¶
The range parameters of the mechanism with the suffix — the name of the mechanism. The range parameters are the parameters defined in the RANGE block of the NMODL file.
- Returns:
A dictionary of the range parameters of the mechanism with the suffix and their values.
- Return type:
dict
- to_dict()¶
Return the mechanism as a dictionary.
- class dendrotweaks.biophys.mechanisms.StandardIonChannel(name, state_powers, ion=None)[source]¶
Bases:
IonChannel
A class representing a voltage-gated ion channel with a standard set of kinetic parameters and equations grounded in the transition-state theory. The model is based on the Hodgkin-Huxley formalism.
- Parameters:
name (str) – The name of the channel.
state_powers (dict) – A dictionary of the state variables and their powers in the differential equations of the channel kinetics.
ion (str, optional) – The ion that the channel is permeable to. The default is None.
- ion¶
The ion that the channel is permeable to e.g. ‘na’, ‘k’.
- Type:
str
- independent_var_name¶
The name of the independent variable for the channel kinetics e.g. ‘v’, ‘cai’.
- Type:
str
- params¶
A dictionary of the parameters of the channel kinetics and distribution.
- Type:
dict
- range_params¶
A dictionary of the range parameters of the channel kinetics added under the RANGE statement in the MOD file.
- Type:
dict
- temperature¶
The temperature in degrees Celsius.
- Type:
float
- static steady_state(v, vhalf, sigma)[source]¶
Compute the steady state value of the channel.
- Parameters:
v (np.array) – The voltage values to compute the steady state value for.
vhalf (float) – The half-activation voltage.
sigma (float) – The slope factor.
- Returns:
The steady state value of the channel at the given voltage values.
- Return type:
np.array
- time_constant(v, vhalf, sigma, k, delta, tau0)[source]¶
Compute the time constant of the channel.
- Parameters:
v (np.array) – The voltage values to compute the time constant for.
vhalf (float) – The half-activation voltage.
sigma (float) – The slope factor.
k (float) – The maximum rate parameter.
delta (float) – The skew parameter of the time constant curve (unitless)
tau0 (float) – The rate-limiting factor (minimum time constant)
- Returns:
The time constant of the channel at the given voltage values.
- Return type:
np.array
- static t_adj(temperature, q10=2.3, reference_temp=23)[source]¶
Compute the temperature adjustment factor for the channel kinetics.
- Parameters:
temperature (float) – The temperature in degrees Celsius.
q10 (float, optional) – The temperature coefficient. The default is 2.3.
reference_temp (float, optional) – The reference temperature at which the channel kinetics were measured. The default is 23.
- Returns:
The temperature adjustment factor.
- Return type:
float
- compute_state(v, vhalf, sigma, k, delta, tau0, tadj=1)[source]¶
Compute the steady state value and time constant of the channel for the given voltage values.
- Parameters:
v (np.array) – The voltage values to compute the channel kinetics for.
vhalf (float) – The half-activation voltage.
sigma (float) – The slope factor.
k (float) – The maximum rate parameter.
delta (float) – The skew parameter of the time constant curve (unitless)
tau0 (float) – The rate-limiting factor (minimum time constant)
tadj (float, optional) – The temperature adjustment factor. The default is 1.
- Returns:
A list of steady state values and time constants for the channel.
- Return type:
np.array
- property states¶
A list of state variable names of the channel.
- compute_kinetic_variables(v)[source]¶
Compute the steady state values and time constants of the channel for the given voltage values.
- Parameters:
v (np.array) – The voltage values to compute the channel kinetics for.
- Returns:
A list of steady state values and time constants for each state of the channel.
- Return type:
list
- fit(data, prioritized_inf=True, round_params=3)[source]¶
Fit the standardized set of parameters of the model to the data of the channel kinetics.
- Parameters:
data (dict) – A dictionary containing the data for the channel kinetics. The dictionary should have the following structure: { ‘x’: np.array, # The independent variable ‘state1’: {‘inf’: np.array, ‘tau’: np.array}, ‘state2’: {‘inf’: np.array, ‘tau’: np.array}, … }
prioritized_inf (bool, optional) – Whether to prioritize the fit to the ‘inf’ data. If True, an additional fit will be performed to the ‘inf’ data only. The default is True.
round_params (int, optional) – The number of decimal places to round the fitted parameters to. The default is 3.
- static get_unit(param)[source]¶
Get the unit of a parameter based on its name.
- Parameters:
param (str) – The name of the parameter.
- Returns:
The unit of the parameter.
- Return type:
str
- get_data(x=None, temperature: float = 37, verbose=True) Dict[str, Dict[str, float]] ¶
Get the data for the channel kinetics as a dictionary. The data includes the steady state values and time constants of the channel, as well as the independent variable values.
- Parameters:
x (np.array, optional) – The independent variable for the channel kinetics. If None, the default values will be used. The default is None.
temperature (float, optional) – The temperature in degrees Celsius. The default is 37.
- Returns:
A dictionary of states with their steady state values and time constants: { ‘state1’: {‘inf’: np.array, ‘tau’: np.array}, ‘state2’: {‘inf’: np.array, ‘tau’: np.array}, … ‘x’: np.array }
- Return type:
Dict[str, Dict[str, np.ndarray]]
- property params_with_suffix¶
The parameters of the mechanism with the suffix — the name of the mechanism.
- Returns:
A dictionary of the parameters of the mechanism with the suffix and their values.
- Return type:
dict
- plot_kinetics(ax=None, linestyle='solid', **kwargs) None ¶
Plot the kinetics of the channel.
- Parameters:
ax (matplotlib.axes.Axes, optional) – The axes to plot the kinetics on. If None, a new figure will be created. The default is None.
linestyle (str, optional) – The line style for the plots. The default is ‘solid’.
**kwargs (dict) – Additional keyword arguments to pass to the get_data method.
- property range_params_with_suffix¶
The range parameters of the mechanism with the suffix — the name of the mechanism. The range parameters are the parameters defined in the RANGE block of the NMODL file.
- Returns:
A dictionary of the range parameters of the mechanism with the suffix and their values.
- Return type:
dict
- set_tadj(temperature)¶
Set the temperature adjustment factor for the channel kinetics.
- Parameters:
temperature (float) – The temperature in degrees Celsius.
Notes
The temperature adjustment factor is calculated as: tadj = q10 ** ((temperature - reference_temp) / 10) where q10 is the temperature coefficient and reference_temp is the temperature at which the channel kinetics were measured.
- class dendrotweaks.biophys.mechanisms.LeakChannel[source]¶
Bases:
Mechanism
A class representing a leak channel in a neuron model.
- Parameters:
name (str) – The name of the channel.
- params¶
A dictionary of the parameters of the channel kinetics and distribution.
- Type:
dict
- range_params¶
A dictionary of the range parameters of the channel kinetics added under the RANGE statement in the MOD file.
- Type:
dict
- property params_with_suffix¶
The parameters of the mechanism with the suffix — the name of the mechanism.
- Returns:
A dictionary of the parameters of the mechanism with the suffix and their values.
- Return type:
dict
- property range_params_with_suffix¶
The range parameters of the mechanism with the suffix — the name of the mechanism. The range parameters are the parameters defined in the RANGE block of the NMODL file.
- Returns:
A dictionary of the range parameters of the mechanism with the suffix and their values.
- Return type:
dict
- to_dict()¶
Return the mechanism as a dictionary.
- class dendrotweaks.biophys.mechanisms.CaDynamics[source]¶
Bases:
Mechanism
A class representing a calcium dynamics mechanism in a neuron model.
- params¶
A dictionary of the parameters of the calcium dynamics mechanism.
- Type:
dict
- range_params¶
A dictionary of the range parameters of the calcium dynamics mechanism added under the RANGE statement in the MOD file.
- Type:
dict
- property params_with_suffix¶
The parameters of the mechanism with the suffix — the name of the mechanism.
- Returns:
A dictionary of the parameters of the mechanism with the suffix and their values.
- Return type:
dict
- property range_params_with_suffix¶
The range parameters of the mechanism with the suffix — the name of the mechanism. The range parameters are the parameters defined in the RANGE block of the NMODL file.
- Returns:
A dictionary of the range parameters of the mechanism with the suffix and their values.
- Return type:
dict
- to_dict()¶
Return the mechanism as a dictionary.