jonescompneurolab / hnn-core

Simulation and optimization of neural circuits for MEG/EEG source estimates
https://jonescompneurolab.github.io/hnn-core/
BSD 3-Clause "New" or "Revised" License
50 stars 50 forks source link

API: Change add_tonic_bias argument structure #764

Closed gtdang closed 1 month ago

gtdang commented 2 months ago

Update the Network add_tonic_bias method to accept a dictionary of cell types and amplitudes. As discussed in #635.

ntolley commented 1 month ago

Adding on to this issue, we should add a name parameter to this function: net.add_tonic_bias(..., name='tonic1')

It's not unreasonable to add multiple tonic biases to the same cell. Many electrophysiology experiments have multiple stages to the "biases" added, for example hyperpolarizing all of the cells at the beginning, and then depolarizing immediately after.

jasmainak commented 1 month ago

@ntolley I think net.biases is a list rather than dictionary? How would we store the name?

gtdang commented 1 month ago

I think it's currently set like below. I believe it's a multi-level dict.

self.external_biases['tonic'][cell_type] = {
            'amplitude': amplitude,
            't0': t0,
            'tstop': tstop
        }

Would it make the most sense to add a layer between "tonic" and "cell type"? self.external_biases['tonic'][<NAME>][cell_type].

Or could the default name 'tonic' just be modified?

Edit: @ntolley and I discussed and name parameter would specify the key of the top level dictionary as follows. This would be in a separate PR than #764.

self.external_biases[<NAME>][cell_type] = {
            'amplitude': amplitude,
            't0': t0,
            'tstop': tstop