Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in accelerometer_example.py #20

Closed
FarnooshHeidari opened this issue Feb 24, 2020 · 4 comments
Closed

Issue in accelerometer_example.py #20

FarnooshHeidari opened this issue Feb 24, 2020 · 4 comments

Comments

@FarnooshHeidari
Copy link

In accelerometer_example.py when using the provided example dataset:

while True:
windowed_raw = transform.slide(X)
if len(windowed_raw) > 0:
try:
windowed_features = [ts[transform.current_position][0]]
except Exception as e:
print(e)
break

I get an error of out of bound access. The error might occur in transform.slide(), where "windowed_raw" is first assigned the value and then its "current_position" goes forward:

window = x[int(self.current_position-self.window_length):int(self.current_position)]
if len(window) > 0:
if len(window.shape) > 1:
window = window[~np.isnan(window).any(axis=1)]
else:
window = window[~np.isnan(window)]
if update:
# TODO Check that this does not break anything
self.current_position += self.step
return window

@perellonieto
Copy link
Collaborator

Thanks for pointing out the issue. It is possible that during commit 16a2bfa I broke the function to move the window. I will need to check, as the transform class previously expected a window_overlap parameter, but I think the name of the parameter was misleading.

I think I will change the parameter to stride, and adjust the rest of the code accordingly.

I still need to reproduce the error, but what I mentioned needs to be sorted out.

@FarnooshHeidari
Copy link
Author

Thanks for your reply.

By the way, the array out of bound is caught in an exception.

@perellonieto
Copy link
Collaborator

I have run the example and when the warning is captured this is the output message

index 72800 is out of bounds for axis 0 with size 72766

@perellonieto
Copy link
Collaborator

I just realised that the example code uses the exception to stop the sliding window. This is therfore intentionally for the correct functioning of the transformation. This needs clearly to be addressed in Issue #21

Meanwhile, it would be advisable to check if the sliding window is out of bounds, instead of relying in a raised exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants