stanley-king před 2 roky
rodič
revize
ed9e421324
2 změnil soubory, kde provedl 6 přidání a 5 odebrání
  1. 3 2
      plot/refill/ChannelCovPainter.py
  2. 3 3
      plot/refill/algorithm.py

+ 3 - 2
plot/refill/ChannelCovPainter.py

@@ -35,11 +35,12 @@ class ChannelCovPainter(ChannelPainter):
         x = np.array([d - self._start_time for d in range(self._start_time, self._end_time)])
         window = np.ones(self._filter_wave)
 
-        split_len = self._start_time - _start_time
+        left_len = self._start_time - _start_time
+        right_len = _end_time - self._end_time
 
         chname_ratios = []
         for _chname, _card_type, _spec, _data in gen:
-            succ, count, y = calc_cov_chratios(_data, pos_map, _start_time - day_stamp, _end_time - day_stamp, window, split_len)
+            succ, count, y = calc_cov_chratios(_data, pos_map, _start_time - day_stamp, _end_time - day_stamp, window, left_len,right_len)
 
             label, ratio = self._label(chname=_chname, succ=succ, count=count, card_type=_card_type, spec=_spec)
             ax.plot(x, y, ls='-', label=label)

+ 3 - 3
plot/refill/algorithm.py

@@ -19,10 +19,10 @@ def calc_chratios(data, pos_map, start, end):
     y = y.ravel()
     return int(all[0, -1]), int(all[0, -1] + all[1, -1]), y
 
-def calc_cov_chratios(data, pos_map, start, end, window, split_len):
+def calc_cov_chratios(data, pos_map, start, end, window, left_len,right_len):
     view = data[[pos_map.succ_count, pos_map.fail_count, pos_map.commit_count], :]
 
-    sum_view = view[:, start + split_len:end]
+    sum_view = view[:, start + left_len:end - right_len]
     sums = np.sum(view, axis=1)
     succs = sums[0]
     fails = sums[1]
@@ -35,7 +35,7 @@ def calc_cov_chratios(data, pos_map, start, end, window, split_len):
     fail = np.convolve(fail, window, 'same')
     commit = succ + fail + 0.0000001
     y = succ / commit
-    y = y[start + split_len:]
+    y = y[left_len:end - start - right_len]
 
     return int(succs), int(succs + fails), y