-
Notifications
You must be signed in to change notification settings - Fork 11
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
Simpler edge indexing #487
base: v1_0_release
Are you sure you want to change the base?
Conversation
|
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.
Nice!
I am a bit worried about memory consumption though. If every jaxedge
has every state, then there will a lot of NaNs each of which contains memory. I think that, in the worst case, memory increases by N**2, where is the number of types of synapses.
Can we have a zoom about this? E.g. next week?
True! I did not think about this. I have two thoughts though. Why not do this for nodes on a per mechanism basis as well. And is there not a more straight forward way to avoid nans while still using global indexes? |
I agree that we should also do it like this for nodes. Let's zoom next week! |
f3ec50a
to
aa4ae5f
Compare
def dtype_aware_concat(dfs): | ||
concat_df = pd.concat(dfs, ignore_index=True) | ||
# replace nans with Nones | ||
# this correctly casts float(None) -> NaN, bool(None) -> NaN, etc. | ||
concat_df[concat_df.isna()] = None | ||
for col in concat_df.columns[concat_df.dtypes == "object"]: | ||
for df in dfs: | ||
if col in df.columns: | ||
concat_df[col] = concat_df[col].astype(df[col].dtype) | ||
break # first match is sufficient | ||
return concat_df |
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.
fixes a bug, where dtype of bool columns was changed upon concatenation in:
comp1 = jx.Compartment()
comp2 = jx.Compartment()
comp2.insert(HH())
branch = jx.Branch([comp1, comp2)] #-> branch.nodes["HH"].dtype was `object` in this case
self.synapse_param_names = [] | ||
self.synapse_state_names = [] | ||
self.synapse_names = [] |
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.
obsolete
@@ -189,7 +185,9 @@ def __str__(self): | |||
|
|||
def __dir__(self): | |||
base_dir = object.__dir__(self) | |||
return sorted(base_dir + self.synapse_names + list(self.group_nodes.keys())) |
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.
group_nodes
was removed in #447.
7b4e771
to
b58c3dd
Compare
Main changes:
In general I think the code is a bit cleaner and more consolidated now (-150 line diff). Will also run regression tests. Maybe its even faster as well. I am not super happy about the Lemme know what you think or if you have any questions. The only thing I touched in terms of channels / synapse rewrite is the params/states rename. Does this warrant a seperate branch? |
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.
Thanks a lot @jnsbck!
I am already off for the holidays so will not be able to do a detailed review, but:
- I think all your high-level explanations sound good!
- Yes, let's make a new
v1.0
branch and merge it there because it breaks all channel models.
And yes, please run regression tests and ensure that all is good! Good to go then! Thanks!
a0183be
to
e17f925
Compare
/test_regression |
Regression Test Results✅ Process completed
|
e17f925
to
62351b8
Compare
Currently synapse and channel parameters / states are handled differently. While channel params are referred to with global indices, synapse params are referenced on a per synapse basis. This leads to very different implementations of synapse and channel updates. This PR makes the synapse indexing global, which simplifies several aspects of the code and allows for more function reuse.
This could potentially be simplified even further, such that channels and synapses can be handled through mostly the same functions.