-
Notifications
You must be signed in to change notification settings - Fork 2
Seclamp stimulus #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seclamp stimulus #62
Changes from all commits
e372a91
15e32c7
464ddab
6b7e278
494cb3c
12f3b55
be4e18d
10f59c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,7 +142,7 @@ def add_ramp( | |
| return tstim | ||
|
|
||
| def add_voltage_clamp( | ||
| self, stop_time, level, rs=None, section=None, segx=0.5, | ||
| self, stop_time, level, durations=None, levels=None, rs=None, section=None, segx=0.5, | ||
| current_record_name=None, current_record_dt=None): | ||
| """Add a voltage clamp. | ||
|
|
||
|
|
@@ -153,6 +153,10 @@ def add_voltage_clamp( | |
| Time at which voltage clamp should stop | ||
| level : float | ||
| Voltage level of the vc (in mV) | ||
| durations: list of float | ||
| Durations of each step of the vc (in ms) | ||
| levels : list of float | ||
| Voltage levels of the vc (in mV) | ||
| rs: float | ||
| Series resistance of the vc (in MOhm) | ||
| section: NEURON object | ||
|
|
@@ -169,6 +173,7 @@ def add_voltage_clamp( | |
|
|
||
| SEClamp (NEURON) object of the created vc | ||
| """ | ||
| from neuron import h # noqa: PLC0415 | ||
|
|
||
| if section is None: | ||
| section = self.soma | ||
|
|
@@ -177,12 +182,29 @@ def add_voltage_clamp( | |
| vclamp = neuron.h.SEClamp(segx, sec=section) | ||
| self.persistent.append(vclamp) | ||
|
|
||
| vclamp.amp1 = level | ||
| vclamp.dur1 = stop_time | ||
|
|
||
| if rs is not None: | ||
| vclamp.rs = rs | ||
|
|
||
| vclamp.dur1 = stop_time | ||
| vclamp.amp1 = level | ||
|
|
||
| if durations is not None and levels is not None: | ||
|
ilkilic marked this conversation as resolved.
|
||
| if len(levels) != len(durations) - 1: | ||
| raise BluecellulabError("Inconsistent durations and levels for seclamp.") | ||
|
|
||
| voltage_vec = h.Vector(levels) | ||
| time_vec = h.Vector(np.cumsum(durations)) | ||
|
ilkilic marked this conversation as resolved.
|
||
|
|
||
| self.persistent.append(time_vec) | ||
| self.persistent.append(voltage_vec) | ||
|
|
||
| voltage_vec.play( | ||
| vclamp._ref_amp1, # noqa: SLF001 | ||
| time_vec, | ||
| 0, | ||
| sec=section, | ||
| ) | ||
|
|
||
| current = neuron.h.Vector() | ||
| if current_record_dt is None: | ||
| current.record(vclamp._ref_i) | ||
|
|
@@ -537,3 +559,15 @@ def add_sinusoidal(self, stimulus) -> TStim: | |
| stimulus.duration, | ||
| stimulus.frequency, | ||
| ) | ||
|
|
||
| def add_seclamp(self, stimulus, section=None, segx=0.5): | ||
| """Add a SEClamp stimulus.""" | ||
| return self.add_voltage_clamp( | ||
| stimulus.duration, | ||
| stimulus.voltage, | ||
| stimulus.durations, | ||
|
Comment on lines
+566
to
+568
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The argument names are very similar,
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the initial delay fixed across all the steps?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. Thanks. |
||
| stimulus.voltages, | ||
| rs=stimulus.series_resistance, | ||
| section=section, | ||
| segx=segx, | ||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.