35 from .
import pathlossevent_pb2
41 self.
_event = pathlossevent_pb2.PathlossEvent()
47 pathloss = self.
_event.pathlosses.add()
49 pathloss.nemId = nemId
51 for (name,value)
in list(kwargs.items()):
54 if isinstance(value,int)
or \
55 isinstance(value,float):
57 pathloss.forwardPathlossdB = value
59 raise ValueError(
"forward pathloss must be numeric")
61 elif name ==
'reverse':
62 if isinstance(value,int)
or \
63 isinstance(value,float):
65 pathloss.reversePathlossdB = value
67 raise ValueError(
"reverse pathloss must be numeric")
70 raise KeyError(
"unknown parameter: %s" % name)
73 raise KeyError(
"must specify forward pathloss")
75 pathloss.reversePathlossdB = pathloss.forwardPathlossdB
78 return self.
_event.SerializeToString()
81 self.
_event.ParseFromString(data)
84 for pathloss
in self.
_event.pathlosses:
85 kwargs = {
'forward': pathloss.forwardPathlossdB,
86 'reverse' : pathloss.reversePathlossdB}
88 yield (pathloss.nemId,kwargs)
def append(self, nemId, kwargs)