|
0 |
--- a/src/battery-stats-generate
|
|
1 |
+++ b/src/battery-stats-generate
|
|
2 |
@@ -1,4 +1,4 @@
|
|
3 |
-#!/usr/bin/python
|
|
4 |
+#!/usr/bin/python3
|
|
5 |
|
|
6 |
import argparse
|
|
7 |
import itertools
|
|
8 |
@@ -32,11 +32,11 @@
|
|
9 |
print(','.join(fields))
|
|
10 |
# remove or add between 0 and 10% of the charge, half the time
|
|
11 |
energy_now += change_charge(args.discharge_prob,
|
|
12 |
- factor=random.randint(0, energy_full/args.discharge_rate))
|
|
13 |
+ factor=random.randint(0, int(energy_full/args.discharge_rate)))
|
|
14 |
|
|
15 |
# around one out of 3 changes to remove around 0.1% of charge
|
|
16 |
energy_full -= change_charge(args.damage_prob, mult = 0,
|
|
17 |
- factor=random.randint(0, energy_full/args.damage_rate))
|
|
18 |
+ factor=random.randint(0, int(energy_full/args.damage_rate)))
|
|
19 |
now += args.wait
|
|
20 |
if not i:
|
|
21 |
break
|
|
22 |
--- a/src/battery-stats-graph
|
|
23 |
+++ b/src/battery-stats-graph
|
|
24 |
@@ -1,4 +1,4 @@
|
|
25 |
-#!/usr/bin/python
|
|
26 |
+#!/usr/bin/python3
|
|
27 |
# -*- coding: utf-8 -*-
|
|
28 |
#
|
|
29 |
# This file is part of the battery-stats package.
|
|
30 |
@@ -87,7 +87,7 @@
|
|
31 |
except csv.Error as e:
|
|
32 |
logging.warning('CSV file is corrupt, skipping remaining entries: %s', e)
|
|
33 |
logging.debug('building data array')
|
|
34 |
- return np.array(data, dtype=zip(fields, 'f'*len(fields)))
|
|
35 |
+ return np.array(data, dtype=list(zip(fields, 'f'*len(fields))))
|
|
36 |
|
|
37 |
# the builtin CSV parser above is faster, we went from 8 to 2 seconds
|
|
38 |
# on our test data here there are probably other ways of making this
|