Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions odetoolbox/analytic_integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@ def __init__(self, solver_dict, spike_times: Optional[Dict[str, List[float]]] =
:param enable_caching: Allow caching of results between requested times.
"""

super(AnalyticIntegrator, self).__init__()
super(AnalyticIntegrator, self).__init__(spike_times)

self.solver_dict = solver_dict

self.all_variable_symbols = self.solver_dict["state_variables"]
self.all_variable_symbols = [sympy.Symbol(s) for s in self.all_variable_symbols]

self.set_spike_times(spike_times)

self.enable_caching = enable_caching
self.enable_cache_update_ = True
self.t = 0.
Expand Down
9 changes: 8 additions & 1 deletion odetoolbox/integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ class Integrator:

all_variable_symbols = [] # type: List[sympy.Symbol]

def set_spike_times(self, spike_times: Optional[Dict[str, List[float]]]):
def __init__(self, spike_times: Optional[Dict[str, List[float]]] = None):
r"""
:param spike_times: For each variable, used as a key, the list of times at which a spike occurs.
"""
self.set_spike_times(spike_times)


def set_spike_times(self, spike_times: Optional[Dict[str, List[float]]] = None):
r"""
Internally converts to a global, sorted list of spike times.

Expand Down
9 changes: 1 addition & 8 deletions odetoolbox/mixed_integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(self, numeric_integrator, system_of_shapes, shapes, analytic_solver
:param alias_spikes: Whether to alias spike times to the numerical integration grid. :python:`False` means that precise integration will be used for spike times whenever possible. :python:`True` means that after taking a timestep :math:`dt` and arriving at :math:`t`, spikes from :math:`\langle t - dt, t]` will only be processed at time :math:`t`.
:param debug_plot_dir: If given, enable debug plotting to this directory. If enabled, matplotlib is imported and used for plotting.
"""
super(MixedIntegrator, self).__init__()
super(MixedIntegrator, self).__init__(spike_times)

assert PYGSL_AVAILABLE

Expand Down Expand Up @@ -128,13 +128,6 @@ def __init__(self, numeric_integrator, system_of_shapes, shapes, analytic_solver
helpers=Shape._sympy_autowrap_helpers)


#
# make a sorted list of all spike times for all symbols
#

self.set_spike_times(spike_times)


def integrate_ode(self, initial_values=None, h_min_lower_bound=5E-9, raise_errors=True, debug=False):
r"""
This function computes the average step size and the minimal step size that a given integration method from GSL uses to evolve a certain system of ODEs during a certain simulation time, integration method from GSL and spike train.
Expand Down
Loading