-
Notifications
You must be signed in to change notification settings - Fork 0
/
Node.py
35 lines (23 loc) · 905 Bytes
/
Node.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
33
34
35
# from abc import ABC, abstractmethod
class Node:
def __init__(self, initParams=None, time_series_length=None, idx=None):
self.time_series_length = time_series_length
self.params = {}
self.idx = idx # id is inbuilt. Dont use
self.type = None
if initParams is not None:
self.setParamsFromDict(initParams)
def setType(self, ty):
self.type = ty
def addParam(self, param):
self.params[param] = [None for _ in range(self.time_series_length)]
def addStaticParam(self, param, val):
self.params[param] = val
def setParam(self, paramName, t, val):
self.params[paramName][t] = val
def getParam(self, paramName, t):
return self.params[paramName][t]
def setParamsFromDict(self, dic):
for par in dic:
self.params[par] = dic[par]
# self.params = dic