BlueBrain / libsonata

A python and C++ interface to the SONATA format
https://libsonata.readthedocs.io/en/stable/
GNU Lesser General Public License v3.0
11 stars 12 forks source link

behavioural difference btw. missing condition block and condition block with a missing entry #337

Closed anilbey closed 3 months ago

anilbey commented 8 months ago

Hi, with @edasubert we noticed the following.

1) When there is no conditions block in the simulation_config libsonata returns 0.0 and 0.0 for celsius and v_init.

<libsonata._libsonata.Conditions object at 0x7ff5d8590c70>
(Pdb) sim_no_cond.impl.conditions.__dir__()
['__init__', '__doc__', '__module__', 'celsius', 'v_init', 'spike_location', 'extracellular_calcium', 'randomize_gaba_rise_time', 'mechanisms', 'list_modification_names', 'modification', 'SpikeLocation', '__new__', '__repr__', '__hash__', '__str__', '__getattribute__', '__setattr__', '__delattr__', '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__reduce_ex__', '__reduce__', '__subclasshook__', '__init_subclass__', '__format__', '__sizeof__', '__dir__', '__class__']
(Pdb) sim_no_cond.impl.conditions.celsius
0.0
(Pdb) sim_no_cond.impl.conditions.v_init
0.0

2) When there is a conditions block but no v_init and no celsius in it then it returns -80.0 and 34.0 correspondingly.

(Pdb) condition_object
<libsonata._libsonata.Conditions object at 0x7ff5d85960f0>
(Pdb) dir(condition_object)
['SpikeLocation', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'celsius', 'extracellular_calcium', 'list_modification_names', 'mechanisms', 'modification', 'randomize_gaba_rise_time', 'spike_location', 'v_init']
(Pdb) condition_object.v_init
-80.0
(Pdb) condition_object.celsius
34.0
mgeplf commented 8 months ago

Could you provide the .json files for reproduction? Thanks.

anilbey commented 8 months ago

Sure, here they are:

simulation_config.json -> conditions block with missing entries simulation_config_no_condition_block -> missing conditions block

simulation_config.json simulation_config_no_condition_block.json

mgeplf commented 8 months ago

Cool, I can repro here: https://github.com/BlueBrain/libsonata/pull/338

I'll have a look at how to fix it.

mgeplf commented 8 months ago

Fixed in #338; thanks for the report!