Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ build
cover
.coverage
AGENTS.md
.DS_Store
Binary file removed mozaik/.DS_Store
Binary file not shown.
58 changes: 58 additions & 0 deletions mozaik/experiments/microstimulation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from parameters import ParameterSet
from collections import OrderedDict
from copy import deepcopy

from mozaik.experiments import Experiment
from mozaik.stimuli import InternalStimulus
from mozaik.tools.distribution_parametrization import MozaikExtendedParameterSet
from mozaik.sheets.direct_stimulator import IntraCorticalMicroStimulation


class IntraCorticalMicroStimulationStimulus(Experiment):
"""

Parameters
----------
model : Model
The model on which to execute the experiment.

Other parameters
----------------

duration : float
Duration of the microstimulation.

sheet_list : int
The list of sheets in which to do stimulation.

stimulator_parameters: ParameterSet
See class IntraCorticalMicroStimulation in direct_stimulator.py
"""

required_parameters = ParameterSet({
'duration': float,
'sheet_list': list,
"stimulator_parameters": ParameterSet,
})

def __init__(self, model, parameters):
Experiment.__init__(self, model, parameters)

stimulators = OrderedDict()
for sheet in parameters.sheet_list:
_params = MozaikExtendedParameterSet(deepcopy(parameters))
stimulators[sheet] = [
IntraCorticalMicroStimulation(model.sheets[sheet], _params.stimulator_parameters)
]
self.direct_stimulation = [stimulators]

_params = MozaikExtendedParameterSet(deepcopy(parameters))
self.stimuli.append(
InternalStimulus(
frame_duration=_params.duration,
duration=_params.duration,
trial=0,
direct_stimulation_name='IntraCorticalMicroStimulation',
direct_stimulation_parameters=_params.stimulator_parameters
)
)
7 changes: 6 additions & 1 deletion mozaik/sheets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ def get_data(self, stimulus_duration=None):

"""

# I am not sure I understand the implication of the new version of the present function
# For the ICMS paper I need a to record arbitrary signals. For example, here is what I usually record:
# block = self.pop.get_data(['spikes', 'v', 'g_exc', 'g_inh', 'gsyn_inh_a', 'gsyn_inh_b', 'gsyn_exc', 'gsyn_inh', 'k_trace', 'w'], clear=True)
# How should I modify the following code to achieve that ?

if self.parameters.cell.native_nest:
vm_name = ['V_m']
else:
Expand All @@ -307,7 +312,7 @@ def get_data(self, stimulus_duration=None):
gsyn_names = ['g_ex', 'g_in']
else:
gsyn_names = ['gsyn_exc', 'gsyn_inh']

block = None
steps = self.model.parameters.steps_get_data
if steps:
Expand Down
Loading