MAINT: Limit perspective offset.

Limit the perspective offset to 1. There is a possibility that if a
consumer of the AdjustedArrayWindow does not fetch adjustments between
the end of the data window and the vantage points beyond the end of the
window.

Until that case has a solution, e.g. having the consumer of the
AdjustedArrayWindow include the perspective offset when calculating the
query for adjustments, limit the offsets to 1.
This commit is contained in:
Eddie Hebert
2016-10-17 15:08:11 -04:00
parent 62f24dcad7
commit 7d8768e2e4
2 changed files with 12 additions and 3 deletions
+9
View File
@@ -53,6 +53,15 @@ cdef class AdjustedArrayWindow:
self.adjustment_indices = sorted(adjustments, reverse=True)
self.window_length = window_length
self.anchor = window_length + offset
if perspective_offset > 1:
# Limit perspective_offset to 1.
# To support an offset greater than 1, work must be done to
# ensure that adjustments are retrieved for the datetimes between
# the end of the window and the vantage point defined by the
# perspective offset.
raise Exception("perspective_offset should not exceed 1, value "
"is perspective_offset={0}".format(
perspective_offset))
self.perspective_offset = perspective_offset
self.next_anchor = self.anchor
self.max_anchor = data.shape[0]