Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Resting state integration #1174

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

vigneswaran-chandrasekaran
Copy link
Member

This PR is the newer version of PR #1123
To follow up please refer to the older one ( #1123 ) conversations for the discussions and comments.

Brief description:

Calculation of resting-state of the model, using the resting_state function of NeuronGroup class.

Usage syntax:
group = NeuronGroup(...)
equilibrium_point = group.resting_state(initial_guess)
Simple example:
tau = 10*ms
eqs = '''dv/dt = (1-v)/tau : 1'''
group = NeuronGroup(1, eqs, method='exact')
result = group.resting_state({'v':  0})    # giving initial guess

Fixes #1064

@vigneswaran-chandrasekaran
Copy link
Member Author

vigneswaran-chandrasekaran commented Apr 6, 2020

I've made the necessary changes for integrating Jacobian to calculate resting state as discussed previously. The new structure now looks like,

  • The NeuronGroup's member function resting_state() prepares the initial guess of state variables (default to zero if not given by the user).
  • Further, resting_state() calls two helper functions, _rhs_equation and _jacobian_equation, which returns the NeuronGroup objects with RHS and Jacobian equations respectively.
  • rhs_group and jac_group acts as bare-skeleton NeuronGroup objects with defined governing equations. The above groups are passed to _wrapper().
  • _wrapper() calls evaluate_states(group, values, states) function, which sets/gets the values/states of the corresponding group (i.e. rhs_group or jac_group)
  • Once, the solution is found by root(), the Jacobin matrix is prepared for the solution, using the same helper functions and stability is analyzed

Everything works fine and solutions are accurate, I also added a test case for stability check. However, a couple of doubts including,

  • The fjac of the result of root() is different from actual Jacobin of the result
  • Number of iter with jac = True and jac = False are not much different

Edit 1:

  • I found the definition of fjac in a page as,

the orthogonal matrix, q, produced by the QR factorization of the final approximate Jacobian matrix, stored column wise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Automatic calculation of resting state
1 participant