Skip to content

Add default timing values for PosCheops, NegCheops and HyperDepol stim #8

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

Merged
merged 1 commit into from
Jun 16, 2025
Merged
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
16 changes: 15 additions & 1 deletion bluepyefe/ecode/HyperDePol.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@

logger = logging.getLogger(__name__)

DEFAULT_TIMING_MS = {
"ton": 250.0,
"tmid": 700.0,
"toff": 970.0,
"totduration": 1220.0,
}


class HyperDePol(Recording):

Expand Down Expand Up @@ -113,7 +120,14 @@ def interpret(self, t, current, config_data, reader_data):
# Smooth the current
smooth_current = scipy_signal2d(current, 85)

self.set_timing_ecode(["ton", "tmid", "toff"], config_data)
timing_keys = ["ton", "tmid", "toff"]
if any(config_data.get(key) is None for key in timing_keys):
logger.warning(
f"Missing timing key(s) for {self.protocol_name}, using defaults: {DEFAULT_TIMING_MS}"
)
for key in timing_keys:
config_data[key] = DEFAULT_TIMING_MS[key]
self.set_timing_ecode(timing_keys, config_data)

hypamp_value = numpy.median(
numpy.concatenate(
Expand Down
22 changes: 19 additions & 3 deletions bluepyefe/ecode/negCheops.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,21 @@

logger = logging.getLogger(__name__)

DEFAULT_TIMING_MS = {
"ton": 1750.0,
"t1": 8416.0,
"t2": 10416.0,
"t3": 13748.0,
"t4": 15748.0,
"toff": 17970.0,
}


class NegCheops(Recording):

# pylint: disable=line-too-long,anomalous-backslash-in-string

"""NegCheops current stimulus
r"""NegCheops current stimulus

.. code-block:: none

Expand Down Expand Up @@ -117,8 +126,15 @@ def interpret(self, t, current, config_data, reader_data):
# Smooth the current
smooth_current = scipy_signal2d(current, 85)

self.set_timing_ecode(
["ton", "t1", "t2", "t3", "t4", "toff"], config_data)
timing_keys = ["ton", "t1", "t2", "t3", "t4", "toff"]
if any(config_data.get(k) is None for k in timing_keys):
logger.warning(
f"Missing timing key(s) for {self.protocol_name}, using defaults: {DEFAULT_TIMING_MS}"
)
for k in timing_keys:
config_data[k] = DEFAULT_TIMING_MS[k]

self.set_timing_ecode(timing_keys, config_data)

hypamp_value = numpy.median(smooth_current[: self.ton])
self.set_amplitudes_ecode("hypamp", config_data, reader_data, hypamp_value)
Expand Down
22 changes: 19 additions & 3 deletions bluepyefe/ecode/posCheops.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,21 @@

logger = logging.getLogger(__name__)

DEFAULT_TIMING_MS = {
"ton": 250.0,
"t1": 8250.0,
"t2": 10250.0,
"t3": 14250.0,
"t4": 16250.0,
"toff": 18916.0,
}


class PosCheops(Recording):

# pylint: disable=line-too-long,anomalous-backslash-in-string

"""PosCheops current stimulus
r"""PosCheops current stimulus

.. code-block:: none

Expand Down Expand Up @@ -117,8 +126,15 @@ def interpret(self, t, current, config_data, reader_data):
# Smooth the current
smooth_current = scipy_signal2d(current, 85)

self.set_timing_ecode(
["ton", "t1", "t2", "t3", "t4", "toff"], config_data)
timing_keys = ["ton", "t1", "t2", "t3", "t4", "toff"]
if any(config_data.get(k) is None for k in timing_keys):
logger.warning(
f"Missing timing key(s) for {self.protocol_name}, using defaults: {DEFAULT_TIMING_MS}"
)
for k in timing_keys:
config_data[k] = DEFAULT_TIMING_MS[k]

self.set_timing_ecode(timing_keys, config_data)

hypamp_value = numpy.median(smooth_current[: self.ton])
self.set_amplitudes_ecode("hypamp", config_data, reader_data, hypamp_value)
Expand Down