stanley-king %!s(int64=3) %!d(string=hai) anos
pai
achega
ba0d8d55ed
Modificáronse 2 ficheiros con 14 adicións e 10 borrados
  1. 12 6
      plot/DataCenter.py
  2. 2 4
      plot/MchDataCenter.py

+ 12 - 6
plot/DataCenter.py

@@ -163,7 +163,6 @@ class DataCenter(object):
         logger = logging.getLogger('app')
         hfive = h5py.File(self._file_name, 'r')
         try:
-            filer_text, paths = self.datasets(hfive, start_time, **kwargs)
             day_stamp = self.day_stamp(start_time)
             start_pos = start_time - day_stamp
 
@@ -176,10 +175,12 @@ class DataCenter(object):
             fig = Figure(figsize=(16, 8))
             ax = fig.subplots()
 
-            predata = np.zeros((5, 86400))
             x = np.arange(0, 86400, interval)
 
+            filer_text, paths = self.datasets(hfive, start_time, **kwargs)
             sub_count = 0
+
+            predata = np.zeros((5, 86400))
             for path, data in self.read_data(hfive, paths):
                 data = np.array(data)
                 predata = predata + data
@@ -226,8 +227,7 @@ class DataCenter(object):
         for key, val in kwargs.items():
             if val is None:
                 continue
-
-            if key == 'chname':
+            elif key == 'chname':
                 chname = val
             elif key == 'quality':
                 quality = f'{val}'
@@ -298,12 +298,12 @@ class DataCenter(object):
         succ_count = int(np.sum(ySucc))
         all_count = int(np.sum(all))
 
-        opened = np.where(ySucc > 0.000001)
+        opened = np.where(ySucc > 0.1)
         if len(opened[0]) == 0:
             logging.getLogger('app').debug("path=%s,opened=False", path)
             return False
 
-        ySucc = ySucc / (all + 0.00000001)
+        ySucc = ySucc / all
         xs = np.array([stime.strftime('%H:%M', stime.localtime(d + day_stamp)) for d in x])
         ax.yaxis.set_major_formatter(ticker.PercentFormatter(xmax=1, decimals=0))
         ax.plot(xs, ySucc, ls='--', marker='o', label=self._label(path, succ_count, all_count))
@@ -328,11 +328,17 @@ class DataCenter(object):
                 card_type = 'LT'
             elif _card_type == '6':
                 card_type = 'DX'
+            elif _card_type == '7':
+                card_type = 'TH'
             return f"{_chname}-{_quality}-{card_type}-{_amount}:{count}/{all} = {ratio}%"
         else:
             if path == '' or path is None:
                 path = 'average'
             return f"{path}:{count}/{all} = {ratio}%"
 
+    def calc_ratio(self,start_time,end_time):
+
+
+
 
 dataCenter = DataCenter()

+ 2 - 4
plot/MchDataCenter.py

@@ -336,10 +336,6 @@ class MchDataCenter(object):
         pos = np.where(ySucc > all)
         ySucc[pos] = all[pos]
 
-        # if len(opened[0]) == 0:
-        #     logging.getLogger('app').debug("path=%s,opened=False", path)
-        #     return False
-
         ySucc = ySucc / (all + 0.00000001)
         xs = np.array([stime.strftime('%H:%M', stime.localtime(d + day_stamp)) for d in x])
         ax.yaxis.set_major_formatter(ticker.PercentFormatter(xmax=1, decimals=0))
@@ -365,6 +361,8 @@ class MchDataCenter(object):
                 card_type = 'LT'
             elif _card_type == '6':
                 card_type = 'DX'
+            elif _card_type == '7':
+                card_type = 'TH'
             return f"{_chname}-{_quality}-{card_type}-{_amount}:{count}/{all} = {ratio}%"
         else:
             if path == '' or path is None: