forked from nest/ode-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fall-back to normal matrix exponentiation
- Loading branch information
C.A.P. Linssen
committed
Feb 13, 2025
1 parent
b692284
commit d5ba448
Showing
3 changed files
with
116 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"dynamics": [ | ||
{ | ||
"expression": "V_m' = (-(V_m - E_L)) / tau_m + (I_kernel_exc__X__exc_spikes * 1.0 - I_kernel_inh__X__inh_spikes * 1.0 + I_e + I_stim) / C_m", | ||
"initial_values": { | ||
"V_m": "E_L" | ||
} | ||
}, | ||
{ | ||
"expression": "refr_t' = -1", | ||
"initial_values": { | ||
"refr_t": "0" | ||
} | ||
}, | ||
{ | ||
"expression": "I_kernel_exc__X__exc_spikes = (e / tau_syn_exc) * t * exp(-t / tau_syn_exc)", | ||
"initial_values": {} | ||
}, | ||
{ | ||
"expression": "I_kernel_inh__X__inh_spikes = (e / tau_syn_inh) * t * exp(-t / tau_syn_inh)", | ||
"initial_values": {} | ||
} | ||
], | ||
"options": { | ||
"output_timestep_symbol": "__h" | ||
}, | ||
"parameters": { | ||
"C_m": "250", | ||
"E_L": "(-70)", | ||
"I_e": "0", | ||
"V_reset": "(-70)", | ||
"V_th": "(-55)", | ||
"refr_T": "2", | ||
"tau_m": "10", | ||
"tau_syn_exc": "2", | ||
"tau_syn_inh": "2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# | ||
# test_analytic_solver_integration.py | ||
# | ||
# This file is part of the NEST ODE toolbox. | ||
# | ||
# Copyright (C) 2017 The NEST Initiative | ||
# | ||
# The NEST ODE toolbox is free software: you can redistribute it | ||
# and/or modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation, either version 2 of | ||
# the License, or (at your option) any later version. | ||
# | ||
# The NEST ODE toolbox is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with NEST. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
import math | ||
import numpy as np | ||
import os | ||
import sympy | ||
import sympy.parsing.sympy_parser | ||
import scipy | ||
import scipy.special | ||
import scipy.linalg | ||
import scipy.integrate | ||
|
||
|
||
try: | ||
import matplotlib as mpl | ||
mpl.use('Agg') | ||
import matplotlib.pyplot as plt | ||
INTEGRATION_TEST_DEBUG_PLOTS = True | ||
except ImportError: | ||
INTEGRATION_TEST_DEBUG_PLOTS = False | ||
|
||
|
||
from .context import odetoolbox | ||
from odetoolbox.analytic_integrator import AnalyticIntegrator | ||
from tests.test_utils import _open_json | ||
|
||
|
||
class TestPropagatorSolverHomogeneous: | ||
r"""Test ODE-toolbox ability to come up with a propagator solver for a matrix that is not block-diagonalisable, because it contains an autonomous ODE.""" | ||
|
||
def test_propagator_solver_homogeneous(self): | ||
indict = _open_json("test_propagator_solver_homogeneous.json") | ||
solver_dict = odetoolbox.analysis(indict, disable_stiffness_check=True, log_level="DEBUG") | ||
assert len(solver_dict) == 1 | ||
solver_dict = solver_dict[0] | ||
assert solver_dict["solver"] == "analytical" | ||
assert float(solver_dict["propagators"]["__P__refr_t__refr_t"]) == 1. | ||
assert solver_dict["propagators"]["__P__V_m__V_m"] == "1.0*exp(-__h/tau_m)" |