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
Epicodim3 #70
Epicodim3 #70
Conversation
A python implementation of Marisa's codim 3 Epileptor model for TVB
Updating local trunk
Fixed a bug in the ultra-slow modulation and improved some documentation
Adjusted the packages to be in line with the other TVB-models
High Codimension Singularity and the Ultra-slow Transitions of Classes.* | ||
Journal of Mathematical Neuroscience. 2017;7:7. doi:10.1186/s13408-017-0050-8. | ||
|
||
.. The Epileptor codim 3 model is a neural mass model which contains two subsystems acting at different timescales. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please reflow to 80 columns, in Vim this is gqip
but your editor may be different. or I can do it for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will adjust this
self.F = self.F / numpy.linalg.norm(self.F) | ||
|
||
|
||
class EpileptorCodim3_slowmod(Model): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a completely different model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This model is similar, it is a different implementation. It allows for multiple classes of bursters to be visited by a simulation. The model dynamics are essentially the same. However there are some differences in the input of the system and some extra dynamics to allow the transition of classes
@LenSpek looking good; I have a few requests:
|
Reflowed the documentation to a column with of 80 and improved the documentation of the _slowmod implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! 👍🏼
Careful though, if you implement Numba dfun for second model, you should change the names to be unique .
How much time do you have left to work in this model, btw? |
I have time till the end of January. However if there are a few minor things, I will be able to address these after my internship has ended |
thanks and sorry this took so long. |
After this recent merge, one unit-test fails:
Can you please check if the test was wrongly written, or the new model is missing some API implicit requirement ? |
The test probably assumes all parameters are floats while some parameters in this model are integers, and it's unsafe to convert a float to an integer. |
""""The dfun using numba for speed""" | ||
state_variables_ = state_variables.reshape(state_variables.shape[:-1]).T | ||
coupling_ = coupling.reshape(coupling.shape[:-1]).T | ||
derivative = _numba_dfun(state_variables_, coupling_, self.E[0], self.E[1], self.E[2], self.F[0], self.F[1], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LenSpek can you set a breakpoint here and double check that the types of those non-float parameters being passed to the numba dfun match or if not, cast their values correclty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double-checked and the variables in question (self.modification, self.N) have dtype int32.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that the case for defaults as well (when you don't specify any model parameters)? this test runs your model as if you made a simulation without specifying any parameters, only defaults
I think that I found what was triggering the tests: Modification is specified by default as a BoolArray, which TVB converts to an int32. I will push a change to address this, so the test works. |
If i debug in my env, the 2 params which are expected to be int32 are in fact int64. |
I find that strange as I use the TVB classes from array.py and there the class IntegerArray is defined as: class IntegerArray(BaseArray):
_ui_name = "Array of integers"
dtype = basic.DType(default=numpy.int32) |
Could we use dtype int_ ? I tested on Anaconda x64 with Python 2.7.14 and numpy 1.13 on Linux, Mac and Windows. If we replace the current int32 with int_, then all 3 systems are ok. Otherwise, with the current code only Windows is fine, the others are not working. |
@liadomide can you paste a |
Numba supports the dtypes in question, and I would prefer platform independence if possible. ( |
|
OK then, |
Good. I will then apply this change soon. |
My implementation of the Epileptor Codim 3 model by Marisa.
(Ignore the first 3 commits, they were added by accident)