Skip to content

Comments

[ENH] Extend Mushroom body tutorials to use custom updates for resetting#661

Merged
neworderofjamie merged 7 commits intogenn-team:masterfrom
saadkhi:saadkhi_MBT
Mar 19, 2025
Merged

[ENH] Extend Mushroom body tutorials to use custom updates for resetting#661
neworderofjamie merged 7 commits intogenn-team:masterfrom
saadkhi:saadkhi_MBT

Conversation

@saadkhi
Copy link
Contributor

@saadkhi saadkhi commented Mar 16, 2025

closes #656

Description

  • Replaced the Python reset_out_post and reset_neuron functions with GeNN custom updates in the Mushroom body tutorial.
  • Ensured custom updates are added before building the model to avoid runtime errors, and created separate custom update models for neuron groups with different variable references.

Copy link
Contributor

@neworderofjamie neworderofjamie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really great and works perfectly - well done for figuring this out! Two really minor things:

  • Could you remove the unused duplicate custom updates you define in cell 13 (under the Simulate tutorial model section)
  • There's no need to seperate the custom updates into two groups ("reset_neuron_group" and "reset_synapse_group")
  • You can reduce the number of custom updates you have to create by resetting "out_post" in the same one as you reset other neuron variables (e.g. pn_kc's out_post could be reset using the same custom update as kc's neuron variables)

@saadkhi saadkhi requested a review from neworderofjamie March 17, 2025 13:27
@saadkhi
Copy link
Contributor Author

saadkhi commented Mar 17, 2025

@neworderofjamie, I created a branch after forking the repository. Could this be the reason for the issue with continuous-integration/jenkins/branch? Please let me know how I can resolve it.

@neworderofjamie
Copy link
Contributor

Don't worry about the continuous integration - it doesn't seem to be working for some reason but that's not related to you or your change. Could you implement at least the first two of my suggestions though? It's hard to tell with notebooks but it looks like your last change just deleted the plotting code

@saadkhi
Copy link
Contributor Author

saadkhi commented Mar 17, 2025

Could you implement at least the first two of my suggestions though? It's hard to tell with notebooks but it looks like your last change just deleted the plotting code

@neworderofjamie do i have make these this

`# Create custom updates
reset_neuron_pn = model.add_custom_update(
"reset_neuron_pn", "reset_neuron_group", reset_neuron_model,
var_refs={"V": create_var_ref(pn, "V"), "RefracTime": create_var_ref(pn, "RefracTime")}
)

reset_neuron_kc = model.add_custom_update(
"reset_neuron_kc", "reset_neuron_group", reset_neuron_model,
var_refs={"V": create_var_ref(kc, "V"), "RefracTime": create_var_ref(kc, "RefracTime")}
)

reset_neuron_ggn = model.add_custom_update(
"reset_neuron_ggn", "reset_neuron_group", reset_neuron_ggn_model,
var_refs={"V": create_var_ref(ggn, "V")}
)

reset_neuron_mbon = model.add_custom_update(
"reset_neuron_mbon", "reset_neuron_group", reset_neuron_model,
var_refs={"V": create_var_ref(mbon, "V"), "RefracTime": create_var_ref(mbon, "RefracTime")}
)

reset_synapse_pn_kc = model.add_custom_update(
"reset_synapse_pn_kc", "reset_synapse_group", reset_synapse_model,
var_refs={"out_post": create_out_post_var_ref(pn_kc)}
)

reset_synapse_ggn_kc = model.add_custom_update(
"reset_synapse_ggn_kc", "reset_synapse_group", reset_synapse_model,
var_refs={"out_post": create_out_post_var_ref(ggn_kc)}
)

reset_synapse_kc_mbon = model.add_custom_update(
"reset_synapse_kc_mbon", "reset_synapse_group", reset_synapse_model,
var_refs={"out_post": create_out_post_var_ref(kc_mbon)}
)`

in 1 group

@neworderofjamie
Copy link
Contributor

I don't really understand your question. All I am saying is:

  • There are two unused custom updates created in cell 13 - these should be removed
  • You removed the plotting code in your last commit - this needs restoring
  • There's no need to seperate the custom updates into two groups ("reset_neuron_group" and "reset_synapse_group") - put them all in "reset_group"

@saadkhi
Copy link
Contributor Author

saadkhi commented Mar 18, 2025

@neworderofjamie, I have completed the tasks you mentioned above.

@neworderofjamie
Copy link
Contributor

Looks good, could you remove the duplicate calls to model.custom_update("reset_group") though

@saadkhi
Copy link
Contributor Author

saadkhi commented Mar 18, 2025

Looks good, could you remove the duplicate calls to model.custom_update("reset_group") though

@neworderofjamie , remove the duplicate calls to model.custom_update("reset_group")

@saadkhi
Copy link
Contributor Author

saadkhi commented Mar 18, 2025

@neworderofjamie I have fixed.

@neworderofjamie
Copy link
Contributor

There is still a duplicate call to model.custom_update("reset_group") in the for s in range(4): plotting loop. Once this is removed, this PR is good to merge

@saadkhi
Copy link
Contributor Author

saadkhi commented Mar 19, 2025

model.custom_update("reset_group")
@neworderofjamie , I have changed

@neworderofjamie
Copy link
Contributor

Very nice! thanks for your work on this

@neworderofjamie neworderofjamie merged commit 9f7d0da into genn-team:master Mar 19, 2025
0 of 2 checks passed
@saadkhi
Copy link
Contributor Author

saadkhi commented Mar 19, 2025

Very nice! thanks for your work on this

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend tutorials to use custom updates for resetting

2 participants