Browse Source

filter: Don't include trailing unprocessed data in the inserted intervals

tags/nilmtools-1.1.6
Jim Paris 11 years ago
parent
commit
5547d266d0
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      src/filter.py

+ 11
- 1
src/filter.py View File

@@ -275,6 +275,10 @@ class Filter(object):
Return value of 'function' is the number of data rows processed.
Unprocessed data will be provided again in a subsequent call
(unless 'final' is True).

If unprocessed data remains after 'final' is True, the interval
being inserted will be ended at the timestamp of the first
unprocessed data point.
"""
if args is None:
args = []
@@ -319,7 +323,13 @@ class Filter(object):

# Last call for this contiguous interval
if old_array.shape[0] != 0:
function(old_array, interval, args, insert_function, True)
processed = function(old_array, interval, args,
insert_function, True)
if processed != old_array.shape[0]:
# Truncate the interval we're inserting at the first
# unprocessed data point. This ensures that
# we'll not miss any data when we run again later.
insert_ctx.update_end(old_array[processed][0])

def main(argv = None):
# This is just a dummy function; actual filters can use the other


Loading…
Cancel
Save