Browse Source

Use np.fromstring instead of np.loadtxt

tags/nilmtools-1.0.4
Jim Paris 11 years ago
parent
commit
2ec574c59d
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      src/filter.py

+ 5
- 2
src/filter.py View File

@@ -367,8 +367,11 @@ class Filter(object):
extract = extractor(self.src.path, interval.start, interval.end)
old_array = np.array([])
for batched in batch(extract, rows):
# Read in this batch of data
new_array = np.loadtxt(batched)
# Read in this batch of data. This turns out to
# be a very fast way to read and convert it (order
# of magnitude faster than numpy.loadtxt)
new_array = np.fromstring("".join(batched), sep=' ')
new_array = new_array.reshape(-1, self.src.total_count)

# If we still had old data left, combine it
if old_array.shape[0] != 0:


Loading…
Cancel
Save