-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix units of compute_current * Enforce new unit convention * Add raise and warn for old channel models * add option to use `current_is_in_mA_per_cm2=False` * Add test * Remove warning * fixups
- Loading branch information
1 parent
61c5c27
commit 5ce7c45
Showing
7 changed files
with
176 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
from abc import ABC, abstractmethod | ||
from typing import Dict, Optional, Tuple | ||
from warnings import warn | ||
|
||
import jax.numpy as jnp | ||
|
||
|
@@ -20,6 +21,24 @@ class Channel: | |
current_name = None | ||
|
||
def __init__(self, name: Optional[str] = None): | ||
contact = ( | ||
"If you have any questions, please reach out via email to " | ||
"[email protected] or create an issue on Github: " | ||
"https://github.com/jaxleyverse/jaxley/issues. Thank you!" | ||
) | ||
if ( | ||
not hasattr(self, "current_is_in_mA_per_cm2") | ||
or not self.current_is_in_mA_per_cm2 | ||
): | ||
raise ValueError( | ||
"The channel you are using is deprecated. " | ||
"In Jaxley version 0.5.0, we changed the unit of the current returned " | ||
"by `compute_current` of channels from `uA/cm^2` to `mA/cm^2`. Please " | ||
"update your channel model (by dividing the resulting current by 1000) " | ||
"and set `self.current_is_in_mA_per_cm2=True` as the first line " | ||
f"in the `__init__()` method of your channel. {contact}" | ||
) | ||
|
||
self._name = name if name else self.__class__.__name__ | ||
|
||
@property | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.