Skip to content

Commit

Permalink
update package access (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoming0625 authored Jul 9, 2024
1 parent 045178f commit 7ca0f2e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 22 deletions.
28 changes: 17 additions & 11 deletions dendritex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,25 @@

__version__ = "0.0.1"

from . import channels
from . import ions
# from .channels import *
# from .channels import __all__ as _channels_all
# from .ions import *
# from .ions import __all__ as _ions_all
# from .neurons import *
# from .neurons import __all__ as _membranes_all
from . import neurons
from ._base import *
from ._base import __all__ as _base_all
from ._integrators import *
from ._integrators import __all__ as _integrators_all
from .channels import *
from .channels import __all__ as _channels_all
from .ions import *
from .ions import __all__ as _ions_all
from .neurons import *
from .neurons import __all__ as _membranes_all

__all__ = (_base_all +
_integrators_all +
_ions_all +
_channels_all +
_membranes_all)
__all__ = (
['neurons', 'ions', 'channels'] +
_base_all +
_integrators_all
# _ions_all +
# _channels_all +
# _membranes_all
)
2 changes: 1 addition & 1 deletion dendritex/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(
raise ValueError('size must be int, or a tuple/list of int.'
f'But we got {type(size)}')
self.size = size
assert len(size) >= 2, 'The size of the dendritic dynamics should be at least 2D: (n_neuron, n_compartment).'
assert len(size) >= 1, 'The size of the dendritic dynamics should be at least 1D: (..., n_neuron, n_compartment).'
self.pop_size: Tuple[int, ...] = size[:-1]
self.n_compartment: int = size[-1]

Expand Down
12 changes: 6 additions & 6 deletions examples/hh_neuron.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
bst.environ.set(dt=0.01 * bu.ms)


class HH(dx.SingleCompartmentNeuron):
class HH(dx.neurons.SingleCompartmentNeuron):
def __init__(self, size):
super().__init__(size)

self.na = dx.SodiumFixed(size, E=50. * bu.mV)
self.na.add_elem(dx.INa_HH1952(size))
self.na = dx.ions.SodiumFixed(size, E=50. * bu.mV)
self.na.add_elem(dx.channels.INa_HH1952(size))

self.k = dx.PotassiumFixed(size, E=-77. * bu.mV)
self.k.add_elem(dx.IK_HH1952(size))
self.k = dx.ions.PotassiumFixed(size, E=-77. * bu.mV)
self.k.add_elem(dx.channels.IK_HH1952(size))

self.IL = dx.IL(size, E=-54.387 * bu.mV, g_max=0.03 * (bu.mS / bu.cm ** 2))
self.IL = dx.channels.IL(size, E=-54.387 * bu.mV, g_max=0.03 * (bu.mS / bu.cm ** 2))

def step_fun(self, t):
# dx.euler_step(hh, t, 10 * bu.nA)
Expand Down
3 changes: 2 additions & 1 deletion examples/thalamus_single_compartment_neurons.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def __init__(self, size, V_initializer=bst.init.Constant(-70. * bu.mV)):
def try_trn_neuron():
bst.environ.set(dt=0.01 * bu.ms)

trn = RTC([1, 1]) # [n_neuron, n_compartment]
# trn = RTC([1, 1]) # [n_neuron, n_compartment]
trn = RTC(1) # [n_neuron, n_compartment]
# trn = TRN([1, 1]) # [n_neuron, n_compartment]
trn.init_state()

Expand Down
3 changes: 0 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
numpy
jax
jaxlib
brainunit
brainstate

0 comments on commit 7ca0f2e

Please sign in to comment.