@@ -60,6 +60,11 class throttle(object): | |||
|
60 | 60 | def __call__(self, fn): |
|
61 | 61 | @wraps(fn) |
|
62 | 62 | def wrapper(*args, **kwargs): |
|
63 | coerce = kwargs.pop('coerce', None) | |
|
64 | if coerce: | |
|
65 | self.time_of_last_call = datetime.datetime.now() | |
|
66 | return fn(*args, **kwargs) | |
|
67 | else: | |
|
63 | 68 | now = datetime.datetime.now() |
|
64 | 69 | time_since_last_call = now - self.time_of_last_call |
|
65 | 70 | time_left = self.throttle_period - time_since_last_call |
@@ -104,6 +109,9 class Data(object): | |||
|
104 | 109 | ret = numpy.swapaxes(ret, 0, 1) |
|
105 | 110 | return ret |
|
106 | 111 | |
|
112 | def __contains__(self, key): | |
|
113 | return key in self.data | |
|
114 | ||
|
107 | 115 | def setup(self): |
|
108 | 116 | ''' |
|
109 | 117 | Configure object |
@@ -564,6 +572,10 class PlotterReceiver(ProcessingUnit, Process): | |||
|
564 | 572 | |
|
565 | 573 | while True: |
|
566 | 574 | dataOut = self.receiver.recv_pyobj() |
|
575 | if not dataOut.flagNoData: | |
|
576 | if dataOut.type == 'Parameters': | |
|
577 | tm = dataOut.utctimeInit | |
|
578 | else: | |
|
567 | 579 | tm = dataOut.utctime |
|
568 | 580 | if dataOut.useLocalTime: |
|
569 | 581 | if not self.localtime: |
@@ -573,12 +585,12 class PlotterReceiver(ProcessingUnit, Process): | |||
|
573 | 585 | if self.localtime: |
|
574 | 586 | tm -= time.timezone |
|
575 | 587 | dt = datetime.datetime.utcfromtimestamp(tm).date() |
|
576 |
|
|
|
588 | coerce = False | |
|
577 | 589 | if dt not in self.dates: |
|
578 | 590 | if self.data: |
|
579 | 591 | self.data.ended = True |
|
580 | 592 | self.send(self.data) |
|
581 |
|
|
|
593 | coerce = True | |
|
582 | 594 | self.data.setup() |
|
583 | 595 | self.dates.append(dt) |
|
584 | 596 | |
@@ -595,8 +607,8 class PlotterReceiver(ProcessingUnit, Process): | |||
|
595 | 607 | self.send(self.data) |
|
596 | 608 | # self.sender_web.send_string(self.data.jsonify()) |
|
597 | 609 | else: |
|
598 | if not sended: | |
|
599 | self.sendData(self.send, self.data) | |
|
610 | self.sendData(self.send, self.data, coerce=coerce) | |
|
611 | coerce = False | |
|
600 | 612 | |
|
601 | 613 | return |
|
602 | 614 |
General Comments 0
You need to be logged in to leave comments.
Login now