Skip to content

Commit

Permalink
Merge pull request #137 from vmarkovtsev/master
Browse files Browse the repository at this point in the history
Fix edge cases in devs plotting
  • Loading branch information
vmarkovtsev authored Nov 30, 2018
2 parents 8b2349d + 10bab74 commit 7b7c6f3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions labours.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,12 +1294,12 @@ def dist_callback(x, y):
plot_x = [start_date + timedelta(days=i) for i in range(size)]
resolution = 64
window = slepian(size // resolution, 0.5)
series = list(devseries.values())
final = numpy.zeros((len(devseries), size), dtype=numpy.float32)
for i, s in enumerate(series):
for i, s in enumerate(devseries.values()):
arr = numpy.array(s).transpose()
full_history = numpy.zeros(size, dtype=numpy.float32)
full_history[arr[0]] = arr[1]
mask = arr[0] < size
full_history[arr[0][mask]] = arr[1][mask]
final[route_map[i]] = convolve(full_history, window, "same")

matplotlib, pyplot = import_pyplot(args.backend, args.style)
Expand Down Expand Up @@ -1357,7 +1357,6 @@ def dist_callback(x, y):
def _format_number(n):
if n == 0:
return "0"
assert n > 0
power = int(numpy.log10(abs(n)))
if power >= 6:
n = n / 1000000
Expand Down

0 comments on commit 7b7c6f3

Please sign in to comment.