Exemple #1
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the vgCa channel type: Cav2p1')

        self.time_unit = 1.0e3

        self.vrev = 135.0  # reversal voltage used in model [mV]
        Texpt = 0.0  # temperature of the model in degrees C
        # self.qt = 2.3**((simT-Texpt)/10)
        self.qt = 1.0  # FIXME implement this!

        mAlpha = 8.5 / (1 + np.exp((V - 8) / (-12.5)))
        mBeta = 35 / (1 + np.exp((V + 74) / (14.5)))

        # initialize values of the m and h gates of the sodium channel based on m_inf and h_inf:
        self.m = mAlpha / (mAlpha + mBeta)
        self.h = 1.0

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 1
        self._hpower = 0
Exemple #2
0
    def _log_header(self) -> None:
        '''
        Display a human-readable synopsis of this application, typically by
        logging the basename and current version of this application and
        various metadata assisting debugging of end user issues.
        '''

        # Avoid circular import dependencies.
        from betse.util.app.meta import appmetaone
        from betse import metadata as betse_metadata

        # Metadata submodule specific to the current application.
        app_metadata = appmetaone.get_app_meta().module_metadata

        # Log this in a manner suitable for downstream applications requiring
        # BETSE as an upstream dependency (e.g., BETSEE).
        logs.log_info(
            'Welcome to <<'
            '{script_name} {script_version} | '
            '{betse_name} {betse_version} | '
            '{betse_codename}'
            '>>.'.format(
                script_name=app_metadata.NAME,
                script_version=app_metadata.VERSION,
                betse_name=betse_metadata.NAME,
                betse_version=betse_metadata.VERSION,
                betse_codename=betse_metadata.CODENAME,
            ))
Exemple #3
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the vgCa channel type: Ca_L3')

        self.time_unit = 1.0e3

        self.vrev = 131.0  # reversal voltage used in model [mV]
        Texpt = 36.0  # temperature of the model in degrees C
        # self.qt = 2.3**((simT-Texpt)/10)
        self.qt = 1.0

        V = V - 15

        # initialize values of the m and h gates of the sodium channel based on m_inf and h_inf:
        self.m = 1.0000 / (1 + np.exp((V - -30.000) / -6))
        self.h = 1.0000 / (1 + np.exp((V - -80.000) / 6.4))

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 2
        self._hpower = 1
Exemple #4
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info(
            'You are using the funny current channel: HCN4 with cAMP activation.'
        )

        self.time_unit = 1.0e3

        self.v_corr = 0

        V = V - 20

        # initialize values of the m and h gates of the HCN2 based on m_inf and h_inf:
        self.m = 1.0000 / (1 + np.exp((V + 100) / 9.6))
        self.h = 1

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 1
        self._hpower = 0

        self._PmCa = 0.05  # channel permeability to Ca2+
        self._PmNa = 0.20  # channel permeability ratio to Na+
Exemple #5
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the N-type vgCa channel type: Cav2p2')

        self.time_unit = 1.0e3

        self.vrev = 135  # reversal voltage used in model [mV]
        Texpt = 36.0  # temperature of the model in degrees C
        # self.qt = 2.3**((simT-Texpt)/10)
        self.qt = 1.0

        # indsV = (V == 20.0).nonzero()
        # V[indsV] += 1.0e-6

        # initialize values of the m and h gates of the sodium channel based on m_inf and h_inf:
        mAlpha = (0.1 * (V - 20) / (1 - np.exp(-(V - 20) / 10)))
        mBeta = 0.4 * np.exp(-(V + 25) / 18)
        hAlpha = 0.01 * np.exp(-(V + 50) / 10)
        hBeta = 0.1 / (1 + np.exp(-(V + 17) / 17))

        self.m = mAlpha / (mAlpha + mBeta)
        self.h = hAlpha / (hAlpha + hBeta)

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 2
        self._hpower = 1
Exemple #6
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the vgCa channel type: Cav_G')

        self.time_unit = 1.0e3

        self.vrev = 131.0  # reversal voltage used in model [mV]
        Texpt = 36.0  # temperature of the model in degrees C
        # self.qt = 2.3**((simT-Texpt)/10)
        self.qt = 1.0

        # initialize values of the m and h gates of the sodium channel based on m_inf and h_inf:
        mAlpha = (0.055 * (-27 - V)) / (np.exp((-27 - V) / 3.8) - 1)
        mBeta = (0.94 * np.exp((-75 - V) / 17))
        self.m = mAlpha / (mAlpha + mBeta)

        hAlpha = (0.000457 * np.exp((-13 - V) / 50))
        hBeta = (0.0065 / (np.exp((-V - 15) / 28) + 1))
        self.h = hAlpha / (hAlpha + hBeta)

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 2
        self._hpower = 1
Exemple #7
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the R-type vgCa channel type: Cav2p3')

        self.time_unit = 1.0e3

        self.vrev = 30  # reversal voltage used in model [mV]
        Texpt = 0.0  # temperature of the model in degrees C
        # self.qt = 2.3**((simT-Texpt)/10)
        self.qt = 1.0  # FIXME implement this!

        # initialize values of the m and h gates of the sodium channel based on m_inf and h_inf:
        mAlpha = 2.6 / (1 + np.exp((V + 7) / -8))
        mBeta = 0.18 / (1 + np.exp((V + 26) / 4))
        hAlpha = 0.0025 / (1 + np.exp((V + 32) / 8))
        hBeta = 0.19 / (1 + np.exp((V + 42) / -10))

        self.m = mAlpha / (mAlpha + mBeta)
        self.h = hAlpha / (hAlpha + hBeta)

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 1
        self._hpower = 1
Exemple #8
0
def log_info() -> None:
    '''
    Log all metadata required by the ``info`` subcommand.
    '''

    # Notify the current user of a possible wait *BEFORE* importing modules
    # whose importation contributes to this wait.
    logs.log_info('Harvesting system metadata... (This may take a moment.)')

    # Defer heavyweight imports.
    from betse.lib import libs
    from betse.util.os import displays, kernels

    #FIXME: Shift into a more appropriate general-purpose submodule.
    # Tuple of BETSE-specific metadata.
    BETSE_METADATAS = (
        # Application metadata.
        (metadata.NAME.lower(), get_metadata()),

        # Logging metadata.
        ('logging', logconf.get_metadata()),
    )

    #FIXME: Shift into a more appropriate general-purpose submodule.
    # Tuple of system-specific metadata.
    SYSTEM_METADATAS = (
        # Python metadata.
        ('python', pys.get_metadata()),
        ('python interpreter', pyimpl.get_metadata()),

        # Operating system (OS) metadata.
        ('os', oses.get_metadata()),
        ('os kernel', kernels.get_metadata()),
        ('os display', displays.get_metadata()),
    )

    # Dictionary of human-readable labels to dictionaries of all
    # human-readable keys and values categorized by such labels. All such
    # dictionaries are ordered so as to preserve order in output.
    info_type_to_dict = OrderedDict(BETSE_METADATAS + libs.get_metadatas() +
                                    SYSTEM_METADATAS)

    # String formatting this information.
    info_buffer = 'Harvested system information:\n'

    # Format each such dictionary under its categorizing label.
    for info_type, info_dict in info_type_to_dict.items():
        # Format this label.
        info_buffer += '\n{}:'.format(info_type)

        # Format this label's dictionary.
        for info_key, info_value in info_dict.items():
            info_buffer += '\n  {}: {}'.format(info_key, info_value)

    # Log rather than merely output this string, as logging simplifies
    # cliest-side bug reporting.
    logs.log_info(info_buffer)
Exemple #9
0
    def _init_state(self, V):

        logs.log_info('You are using the persistent vgNa channel: Nav1p6')

        # time scale of the model (most models are in miliseconds, some are in seconds)
        self.time_unit = 1.0e3

        self.vrev = 50     # reversal voltage used in model [mV]

        self._mpower = 1.0
        self._hpower = 0.0

        self.m = 1.0000 / (1 + np.exp(-0.03937 * 4.2 * (V - -17.000)))
        self.h = 1.0
Exemple #10
0
    def progress_stated(self, status: str) -> None:
        '''
        Callback passed the current state of progress for work performed by the
        source callable as an arbitrary human-readable string.

        The superclass implementation of this callback logs this string at the
        :attr:`LogLevel.INFO` level, under the generally safe assumption that
        this string is of reasonable relevance to developers *and* users alike.

        Design
        ----------
        The source callable should call this callback repeatedly while
        performing any significant work -- ideally either immediately before or
        after calling the :meth:`progressed`, :meth:`progressed_last`, or
        :meth:`progressed_next` callbacks. Doing so enables the sink callable
        to incrementally update external objects (e.g., status bars) in
        synchronicity with numeric-based progress updates.

        The source callable may technically call this callback at any arbitrary
        time. Unlike the :meth:`progress_ranged` callback and the
        aforementioned callbacks, this callback is purely subjective and hence
        *not* constrained by hard contractual obligations. For usability by the
        sink callable, however, this callable should typically *only* be called
        at approximately the same time as the aforementioned callbacks are
        called by the source callable; doing so increases the likelihood that
        the sink callable is prepared to handle this callback properly.

        Subclasses are advised to reimplement this callback and call this
        superclass implementation in their own reimplementation.

        Parameters
        ----------
        status : str
            Current state of progress for work performed by the source
            callable as an arbitrary human-readable string. To enable the sink
            callable to safely embed this string in size-constrained regions,
            this string should be terse and ideally at most a single line.

        See Also
        ----------
        :meth:`progressed_next`
        :meth:`progressed_last`
            Higher-level callbacks wrapping this lower-level callback in a
            safer manner complying with the above recommendations -- notably,
            that this callback be called in unison with the :meth:`progressed`
            callback by the source callable.
        '''

        # Log this string as an informational message.
        logs.log_info(status)
Exemple #11
0
    def init(self) -> SimPhase:
        '''
        Initialize this simulation with the cell cluster seeded by a prior call
        to the :meth:`seed` method and cache this initialization to an output
        file, specified by the current configuration file.

        This method *must* be called prior to the :meth:`sim` and
        :meth:`plot_init` methods, which consume this output as input.

        Returns
        ----------
        SimPhase
            High-level simulation phase instance encapsulating all objects
            internally created by this method to run this phase.
        '''

        # Log this attempt.
        logs.log_info('Initializing simulation...')

        # Simulation phase type.
        phase_kind = SimPhaseKind.INIT

        if not files.is_file(self._p.seed_pickle_filename):
            if not self._p.autoInit:
                #FIXME: Call the _die_unless_file_pickled() function instead
                #both here and everywhere else we perform similar logic. Bugbears!
                raise BetseSimException(
                    'Initialization halted due to missing seed. '
                    'Please run "betse seed" and try again.')

            # Create an instance of world.
            logs.log_info('Automatically seeding cell cluster...')
            self.seed()
            logs.log_info('Now using seed to run initialization.')

        # Load the seed from cache.
        cells, p_old = fh.loadWorld(self._p.seed_pickle_filename)
        logs.log_info('Cell cluster loaded.')

        # check to ensure compatibility between original and present sim files:
        self._die_if_seed_differs(p_old, self._p)

        # Simulation phase, created *AFTER* unpickling these objects above.
        phase = SimPhase(
            kind=phase_kind,
            cells=cells,
            p=self._p,
            callbacks=self._callbacks,
        )

        # Initialize core simulation data structures.
        phase.sim.init_core(phase)

        # Run this simulation phase.
        phase.sim.sim_info_report(phase)
        phase.sim.run_sim_core(phase)

        # Return this phase.
        return phase
Exemple #12
0
    def _init_state(self, V):

        logs.log_info('You are using the funny current channel: HCN1')

        self.time_unit = 1.0e3

        # initialize values of the m and h gates of the HCN2 based on m_inf and h_inf:
        self.m = 1.0000 / (1 + np.exp((V - -94) / 8.1))
        self.h = 1

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 1
        self._hpower = 0

        self._PmCa = 0.05  # channel permeability ratio to Ca2+
        self._PmNa = 0.2  # channel permeability ratio to Na+
Exemple #13
0
def init() -> None:
    '''
    Validate the current platform.

    This function (in order):

    #. Logs a non-fatal warning if this platform is a non-WSL variant
       of Microsoft Windows (e.g., vanilla Windows, Cygwin Windows).
    #. Logs a non-fatal warning if this platform is *not* recognized as
       officially supported by this application (e.g., BSD*, Solaris).
    '''

    # Avoid circular import dependencies.
    from betse.util.os.brand import windows

    # Log this validation.
    logs.log_debug('Validating platform...')

    # Human-readable string describing the set of all officially supported
    # platforms known to interoperate sanely with this application.
    oses_supported_str = (
        'Consider running {name} only under Linux or macOS. '
        'Note that Linux is now freely emulatable under Windows 10 '
        'via the Windows Subsystem for Linux (WSL). '
        'See official installation instructions at:\n'
        '\thttps://docs.microsoft.com/en-us/windows/wsl/install-win10'.format(
            name=metadata.NAME))

    # If this is a non-WSL Windows variant, log a non-fatal warning.
    if windows.is_windows():
        #FIXME: Restore this logging statement to a non-fatal warning *AFTER*
        #resolving the "FIXME:" comment chain in the
        #"betse.util.os.brand.windows" submodule concerning PowerShell. Yikes!
        # logs.log_warning(
        logs.log_info(
            'Windows platform detected. '
            'Python itself and third-party scientific frameworks for Python '
            '(e.g., Numpy, SciPy, Matplotlib) are known to '
            'behave suboptimally on this platform. '
            '%s', oses_supported_str)

    # If this platform is officially unsupported by this application, log a
    # non-fatal warning.
    if not is_supported():
        logs.log_warning('Unsupported platform "%s" detected. %s', get_name(),
                         oses_supported_str)
Exemple #14
0
    def _init_state(self, V):
        """
        Run initialization calculation for m and h gates of the channel at starting Vmem value.
        """
        logs.log_info('You are using the vgK channel: Kv2p1 ')

        self.time_unit = 1.0e3

        self.vrev = -65  # reversal voltage used in model [mV]

        # initialize values of the m and h gates of the potassium channel based on m_inf and h_inf:
        self.m = 1 / (1 + np.exp(((V - (-9.200)) / (-6.600))))
        self.h = 1 / (1 + np.exp(((V - (-19.000)) / (5.000))))

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 1
        self._hpower = 1
Exemple #15
0
    def _init_state(self, V):
        """
        Run initialization calculation for m and h gates of the channel at starting Vmem value.
        """
        logs.log_info('You are using the vgK channel: Kv3p2 ')

        self.time_unit = 1.0e3

        self.vrev = -65  # reversal voltage used in model [mV]

        # initialize values of the m and h gates of the potassium channel based on m_inf and h_inf:
        self.m = 1 / (1 + np.exp((V - -0.373267) / -8.568187))
        self.h = 1

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 2
        self._hpower = 0
Exemple #16
0
        def _log_time_seconds_decorated(*args, **kwargs) -> object:

            # Current time in fractional seconds.
            start_time = time.time()

            # Call this function, passed all passed parameters and preserving the
            # return value as is.
            return_value = func(*args, **kwargs)

            # Cumulative time in fractional seconds spent in this call.
            end_time = time.time() - start_time

            # Log this time, rounded to two decimal places for readability.
            logs.log_info('%s %s in %.2f seconds.', noun, verb, end_time)

            # Return this return value.
            return return_value
Exemple #17
0
    def init_libs(self,
                  matplotlib_backend_name: StrOrNoneTypes = None) -> None:
        '''
        Initialize all mandatory third-party dependencies of this application
        with sane defaults.

        Specifically, this method (in no particular order):

        * Reconfigures matplotlib with sane defaults specific to the current
          platform and set of all available third-party GUI frameworks.
        * Initializes exactly one available third-party YAML parsing framework
          (e.g., PyYaml, :mod:`ruamel.yaml`).
        * Initializes NumPy.
        * Initializes Pillow.

        Parameters
        ----------
        matplotlib_backend_name : StrOrNoneTypes
            Name of the matplotlib backend to explicitly enable. Defaults to
            ``None``, in which case this method implicitly enables the first
            importable backend known to be both usable and supported by this
            application (in descending order of preference).
        '''

        # Avoid circular import dependencies.
        from betse.lib.matplotlib.matplotlibs import mpl_config
        from betse.lib.numpy import numpys
        from betse.lib.pickle import pickles
        from betse.lib.pil import pils
        from betse.lib.yaml import yamls
        from betse.util.io.log import logs

        # Log this initialization. Since initializing heavyweight third-party
        # dependencies (especially matplotlib) consumes non-trivial time, this
        # message is intentionally exposed to all users by default.
        logs.log_info('Loading third-party dependencies...')

        # Initialize these dependencies in arbitrary order.
        mpl_config.init(backend_name=matplotlib_backend_name)
        numpys.init()
        pickles.init()
        pils.init()
        yamls.init()

        # Note this method to have been called *AFTER* successfully doing so.
        self._is_libs_initted = True
Exemple #18
0
    def _init_state(self, V, sim, p):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the wound-induced channel: TRP')

        self.v_corr = 0

        # initialize values of the m and h gates of the channel on m_inf and h_inf:
        self.m = np.ones(sim.mdl)
        self.h = np.ones(sim.mdl)

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 0
        self._hpower = 0
Exemple #19
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using a Cl- leak channel')

        self.time_unit = 1.0

        # initialize values of the m and h gates of the sodium channel based on m_inf and h_inf:
        self.m = np.ones(self.data_length)
        self.h = np.ones(self.data_length)

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 0
        self._hpower = 0
Exemple #20
0
def log_header() -> None:
    '''
    Log a single-line human-readable sentence synopsizing the state of the
    current application (e.g., name, codename, version).
    '''

    logs.log_info('Welcome to <<'
                  '{program_name} {program_version} | '
                  '{py_name} {py_version} | '
                  '{os_name} {os_version}'
                  '>>.'.format(
                      program_name=metadata.NAME,
                      program_version=metadata.VERSION,
                      py_name=pyimpl.get_name(),
                      py_version=pys.get_version(),
                      os_name=oses.get_name(),
                      os_version=oses.get_version(),
                  ))
Exemple #21
0
    def _init_state(self, V):

        logs.log_info('You are using the vgNa channel: NavRat3')

        # time scale of the model (most models are in miliseconds, some are in seconds)
        self.time_unit = 1.0e3

        self.vrev = 50  # reversal voltage used in model [mV]

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 3
        self._hpower = 1

        mAlpha = (0.182 * (V - -35)) / (1 - (np.exp(-(V - -35) / 9)))
        mBeta = (0.124 * (-V - 35)) / (1 - (np.exp(-(-V - 35) / 9)))

        self.m = mAlpha / (mAlpha + mBeta)
        self.h = 1.0 / (1 + np.exp((V - -65) / 6.2))
Exemple #22
0
def start_ptpython_repl() -> None:
    '''
    Start a REPL based on the optional third-party :mod:`ptpython` package.

    If this package is unavailable, this function defers to the first available
    REPL with a non-fatal warning.
    '''

    # If "ptpython" is unavailable...
    if not libs.is_runtime_optional('ptpython'):
        # Log a non-fatal warning.
        logs.log_warning(
            '"ptpython" module not found. Deferring to first available REPL.')

        # Defer to the first available REPL.
        start_first_repl()

        # Get us out of here, Great Captain.
        return
    # Else, "ptpython" is available.

    # Log this invocation.
    logs.log_info('Starting "ptpython"-based REPL...')

    # Defer heavyweight imports.
    from ptpython.repl import embed

    # If the "ptpython" key is missing from the dictionary of history
    # filenames, then default to no history file. This prevents the readline
    # history files being corrupted by ptpython's unique format.
    history_filename = appmetaone.get_app_meta().get_repl_history_filename(
        'ptpython')

    # Run this REPL.
    try:
        embed(
            globals=None,
            locals=replenv.repl_env,
            history_filename=history_filename,
        )
    # When this REPL halts with error, reraise this exception.
    except SystemExit as exception:
        if cmdexit.is_failure(exception.exception):
            raise
Exemple #23
0
def remove_dir(dirname: str) -> None:
    '''
    Recursively remove the directory with the passed dirname.

    Caveats
    ----------
    Since recursive directory removal is an inherently dangerous operation,
    this function (in order):

    1. Notifies the end user with a logged warning.
    1. Waits several seconds, enabling sufficiently aware end users to jam the
       panic button.
    1. Recursively removes this directory.

    Parameters
    ----------
    dirname : str
        Absolute or relative dirname of the directory to be removed.

    Raises
    ----------
    BetseDirException
        If this directory does *not* exist.
    '''

    # Number of seconds to busywait before removing this directory.
    SLEEP_SECONDS = 4

    # Log this removal.
    logs.log_warning('Removing directory in %d seconds: %s', dirname,
                     SLEEP_SECONDS)

    # If this directory does *NOT* exist, raise an exception.
    die_unless_dir(dirname)

    # Busywait this number of seconds.
    time.sleep(SLEEP_SECONDS)

    # Recursively remove this directory.
    shutil.rmtree(dirname)

    # Log this successful completion.
    logs.log_info('Directory removed.')
Exemple #24
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the KV channel: Kv_1.5, Morris-Lecar ')

        self.time_unit = 1.0e3

        self.vrev = -65  # reversal voltage used in model [mV]

        self.ions = ['K']
        self.rel_perm = [1]
        self.kinetic_gate = True
        self.Phi = 0.066

        # initialize values of the m gate of the channel based on m_inf:
        self.m = 0.5 * (1 + np.tanh((V + 6.0) / 15.0))
Exemple #25
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the channel: HCN2_MorrisLecar ')

        self.time_unit = 1.0e3

        self.vrev = -65  # reversal voltage used in model [mV]

        self.ions = ['K', 'Na']
        self.rel_perm = [1, 0.2]
        self.kinetic_gate = False
        self.Phi = 1.0

        # initialize values of the m gate of the channel based on m_inf:
        self.m = 0.5 * (1 + np.tanh((V + 99.0) / 19.2))  #19.2
Exemple #26
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the KV channel: Kir_MorrisLecar ')

        self.time_unit = 1.0e3

        self.vrev = -65  # reversal voltage used in model [mV]

        self.ions = ['K']
        self.rel_perm = [1]
        self.kinetic_gate = False
        self.Phi = 1.0

        # initialize values of the m gate of the channel based on m_inf:
        self.m = 1 / (np.cosh((V + 135) / (37)))
Exemple #27
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the inward rectifying K+ channel: Kir2p1')

        self.time_unit = 1.0e3

        self.vrev = -70.6  # reversal voltage used in model [mV]

        # initialize values of the m and h gates of the sodium channel based on m_inf and h_inf:
        self.m = 1 / (1 + np.exp((V - (-96.48)) / 23.26))
        self.h = 1 / (1 + np.exp((V - (-168.28)) / -44.13))

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 1
        self._hpower = 2
Exemple #28
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the K+ channel: Kv3p4')

        self.time_unit = 1.0e3

        self.vrev = -65.0  # reversal voltage used in model [mV]

        # initialize values of the m and h gates of the sodium channel based on m_inf and h_inf:
        self.m = 1 / (1 + np.exp(((V - (-3.400)) / (-8.400))))
        self.h = 1 / (1 + np.exp(((V - (-53.320)) / (7.400))))

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 1
        self._hpower = 1
Exemple #29
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the vgK channel: Kv1.4')

        self.time_unit = 1.0e3

        self.vrev = -65  # reversal voltage used in model [mV]

        # initialize values of the m and h gates of the sodium channel based on m_inf and h_inf:
        self.m = 1.0000 / (1 + np.exp((V + 21.7000) / -16.9000))
        self.h = 1.0000 / (1 + np.exp((V + 73.6000) / 12.8000))

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 1
        self._hpower = 1
Exemple #30
0
    def _init_state(self, V):
        """

        Run initialization calculation for m and h gates of the channel at starting Vmem value.

        """

        logs.log_info('You are using the A-current K+ channel: Kv3p3')

        self.time_unit = 1.0e3

        # FIXME: IS THIS RIGHT?????
        self.vrev = 82.0  # reversal voltage used in model [mV]

        # initialize values of the m and h gates of the sodium channel based on m_inf and h_inf:
        self.m = 1 / (1 + np.exp((V - 35) / -7.3))
        self.h = 0.25 + (0.75 / (1 + np.exp((V - (-28.293856)) / 29.385636)))

        # define the power of m and h gates used in the final channel state equation:
        self._mpower = 2
        self._hpower = 1