action_potential

package
v0.0.0-...-696f89b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2013 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Overview

go-neuron - A neuron simulator for Go.

Copyright (c) 2013 - Michael Nelson <[email protected]>

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

go-neuron - A neuron simulator for Go.

Copyright (c) 2013 - Michael Nelson <[email protected]>

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Package action_potential provides an interface and simple
implementation of the short-lasting electrical event occuring
in neurons.

http://en.wikipedia.org/wiki/Action_potential

go-neuron - A neuron simulator for Go.

Copyright (c) 2013 - Michael Nelson <[email protected]>

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

go-neuron - A neuron simulator for Go.

Copyright (c) 2013 - Michael Nelson <[email protected]>

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

go-neuron - A neuron simulator for Go.

Copyright (c) 2013 - Michael Nelson <[email protected]>

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

Constants

View Source
const (
	SIMPLE_DECAY_DURATION    = 3 * time.Millisecond
	SIMPLE_ACTIVE_DURATION   = 3 * time.Millisecond
	SIMPLE_INACTIVE_DURATION = 3 * time.Millisecond
)

The Simple activates for a duration when the initial threshold is reached, then is inactive for a duration before switching back to deactivated.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccuracyAccumulator

type AccuracyAccumulator struct {
	ActionPotential
	AverageDelta time.Duration
	Count        int64
}

An AccuracyAggregator encapsulates an action potential and records the average skew

func NewAccuracyAccumulator

func NewAccuracyAccumulator(ap ActionPotential) *AccuracyAccumulator

func (*AccuracyAccumulator) AddPotentialAt

func (f *AccuracyAccumulator) AddPotentialAt(p Potential, t time.Time) (Potential, bool)

type ActionPotential

type ActionPotential interface {
	GetPotential() Potential
	GetPotentialAt(time.Time) Potential
	AddPotential(Potential) (Potential, bool)
	AddPotentialAt(Potential, time.Time) (Potential, bool)
}

type ActivationState

type ActivationState int
const (
	DEACTIVATED ActivationState = iota
	ACTIVATED
	INACTIVATED
)

An ActionPotential can be deactivated, activated or inactivated.

func (ActivationState) String

func (as ActivationState) String() string

type AddPotentialEvent

type AddPotentialEvent struct {
	Potential Potential
	Time      time.Time
	RealTime  time.Time
}

type AlwaysFirer

type AlwaysFirer struct {
	ActionPotential
}

An AlwaysFirer encapsulates an action potential but fires on every call to AddPotentialAt().

func NewAlwaysFirer

func NewAlwaysFirer(ap ActionPotential) *AlwaysFirer

func (*AlwaysFirer) AddPotential

func (f *AlwaysFirer) AddPotential(p Potential) (Potential, bool)

func (*AlwaysFirer) AddPotentialAt

func (f *AlwaysFirer) AddPotentialAt(p Potential, t time.Time) (Potential, bool)

type EventRecorder

type EventRecorder struct {
	ActionPotential
	Events []AddPotentialEvent
}

An EventRecorder encapsulates an action potential and records each AddPotential event that occurs.

func NewEventRecorder

func NewEventRecorder(ap ActionPotential) *EventRecorder

func (*EventRecorder) AddPotential

func (f *EventRecorder) AddPotential(p Potential) (Potential, bool)

func (*EventRecorder) AddPotentialAt

func (f *EventRecorder) AddPotentialAt(p Potential, t time.Time) (Potential, bool)

type Potential

type Potential float32
const (
	REST_POTENTIAL       Potential = 0
	THRESHOLD_POTENTIAL  Potential = 15
	PEAK_POTENTIAL       Potential = 100
	REFRACTORY_POTENTIAL Potential = -15
)

Typically 15mV above the resting potential. Move these into a subclass perhaps, so it's possible to have different classes of neurons without requiring each neuron to include the values.

type PotentialState

type PotentialState struct {
	// contains filtered or unexported fields
}

PotentialState stores the data required to determine a potential at a given time (internally the state, the previous potential and the time at which the potential last changed.)

func (PotentialState) String

func (ps PotentialState) String() string

type Simple

type Simple struct {
	PotentialState
}

The Simple is a simple implementation of the action potential interface.

func (*Simple) AddPotential

func (cb *Simple) AddPotential(potential Potential) (Potential, bool)

AddPotential adds the specified potential based on the existing potential at the time it is called.

func (*Simple) AddPotentialAt

func (cb *Simple) AddPotentialAt(potential Potential, now time.Time) (Potential, bool)

AddPotentialAt adds the specified potential based on the existing potential at the specified time.

func (*Simple) GetPotential

func (cb *Simple) GetPotential() Potential

GetPotential determines and returns the potential at the time it is called.

func (*Simple) GetPotentialAt

func (cb *Simple) GetPotentialAt(now time.Time) Potential

GetPotentialAt determines and returns the potential at a given point in time.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL