BlueBrain / BlueCelluLab

Biologically detailed neural network simulations and analysis API

Home Page:https://bluecellulab.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

having consistent sampling options across ssim methods

anilbey opened this issue · comments

Description

One use-case of bluecellulab is to rerun a neurodamus simulation with some changed properties. For that purpose, SSim class has get_mainsim_voltage_trace, get_mainsim_time_trace methods to retrieve the results of neurodamus simulation. Similarly SSim has get_voltage_trace and get_time_trace methods to retrieve the results of bluecellulab simulation.

The time step between data points may differ in the simulations. It is due to the sampling involved in the simulation.
The scientist decides the sampling rate, hence the time step.

bluecellulab's API should support sampling.

Implementation

Currently some methods of bluecellulab support sampling, some don't. All 4 methods should support sampling consistently.

  • SSim::get_mainsim_voltage_trace supports sampling.
    SSim::get_voltage_trace does not.

  • get_mainsim_time_trace does not pass the t_step parameter to simulation_access.get_soma_time_trace().

  • get_time_trace does not support sampling.

TODO 1: make all get_mainsim_voltage_trace, get_voltage_trace, get_mainsim_time_trace, get_time_trace support sampling.
After the implementation get_mainsim_voltage_trace and get_voltage_trace should have the same arguments.
After the implementation get_mainsim_time_trace and get_time_trace should have the same arguments.

The _sample_array function currently takes 2 t_step parameters.

def _sample_array(arr: Sequence, t_step: float, sim_t_step: float) -> Sequence:

Then it computes a ratio via
ratio = t_step / sim_t_step

This is confusing. The function should only take ratio as an argument. The calling functions should be responsible of computing it.
TODO 2: sampling function should only take the ratio

Once this is implemented the tests below no longer have to sample explicitly

TODO 3: the test code in test_ssim_sonata.py should be simplified (with this, user's code will also be simplified).