-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathneuron
More file actions
39 lines (34 loc) · 1.17 KB
/
neuron
File metadata and controls
39 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
############################################################ README ##############################################################
# This is neuron class which defines the dynamics of a neuron. All the parameters are initialised and methods are included to check
# for spikes and apply lateral inhibition.
###################################################################################################################################
import os, sys
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
import numpy as np
import random
from matplotlib import pyplot as plt
from snn.parameters import param as par
'''
Pth = Parameter threshold
'''
class neuron:
def __init__(self):
self.t_ref = 30
self.t_rest = -1
self.P = par.Prest
self.Prest = par.Prest
def check(self):
if self.P>= self.Pth:
self.P = self.Prest
return 1
elif self.P < par.Pmin:
self.P = par.Prest
return 0
else:
return 0
def inhibit(self):
self.P = par.Pmin
def initial(self, th):
self.Pth = th
self.t_rest = -1
self.P = par.Prest