BlueBrain / BlueCelluLab

Biologically detailed neural network simulations and analysis API
https://bluecellulab.readthedocs.io/en/latest/
Other
8 stars 12 forks source link

fetch afferent_section_pos from sonata #168

Closed anilbey closed 2 months ago

anilbey commented 2 months ago

Spotted by @joni-herttuainen. When afferent_section_pos is not in SONATA, it is computed in BCL and this can cause small precision differences. This change avoids recomputing it when it is already available in SONATA.

joni-herttuainen commented 2 months ago

I believe that for this change to take effect in SynapseFactory, we need to change the following starting in synapse_factory.py:L117:

@@ -114,10 +114,10 @@ class SynapseFactory:
         section: NeuronSection = cell.get_psection(section_id=isec).hsection

         # old circuits don't have it, it needs to be computed via synlocation_to_segx
-        if ("afferent_section_pos" in syn_description and
-                not np.isnan(syn_description["afferent_section_pos"])):
+        if (SynapseProperty.AFFERENT_SECTION_POS in syn_description and
+                not np.isnan(syn_description[SynapseProperty.AFFERENT_SECTION_POS])):
             # position is pre computed in SONATA
-            location = syn_description["afferent_section_pos"]
+            location = syn_description[SynapseProperty.AFFERENT_SECTION_POS]
         else:
             ipt = syn_description[SynapseProperty.POST_SEGMENT_ID]
             syn_offset = syn_description[SynapseProperty.POST_SEGMENT_OFFSET]
anilbey commented 2 months ago

Yes you're right. That must have gone unnoticed. A patch will follow.

joni-herttuainen commented 2 months ago

No worries, that happens. Thanks! 🤘

anilbey commented 2 months ago

It's addressed here: https://github.com/BlueBrain/BlueCelluLab/pull/169