-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathmonitor.py
32 lines (25 loc) · 974 Bytes
/
monitor.py
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
from ngclearn.components.base_monitor import Base_Monitor
class Monitor(Base_Monitor):
"""
A numpy implementation of `Base_Monitor`. Designed to be used with all lava compatible ngclearn components
"""
auto_resolve = False
@staticmethod
def build_advance(compartments):
@staticmethod
def _advance(**kwargs):
return_vals = []
for comp in compartments:
new_val = kwargs[comp]
current_store = kwargs[comp + "*store"]
current_store[:-1] = current_store[1:]
current_store[-1] = new_val
return_vals.append(current_store)
return return_vals if len(compartments) > 1 else return_vals[0]
return _advance
@staticmethod
def build_advance_state(component):
return super().build_advance_state(component)
@staticmethod
def build_reset(component):
return super().build_reset(component)