-
Notifications
You must be signed in to change notification settings - Fork 266
[neuralynx] memory improvements #990
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
[neuralynx] memory improvements #990
Conversation
|
Hello @JuliaSprenger! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-09-09 09:05:22 UTC |
|
Please also see PR #973 which eliminated the creation of an object in the inner loop. |
920ba32 to
5af32ab
Compare
PeterNSteinmetz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The big question is whether this passes all the existing tests of course.
On line 288 I don't think I would compare to nb_valid for the first record. Rather I would compare to the maximum number of samples for record, which is 512, and I believe is a defined constant. There is no guarantee that the first record is full, though this is usually the case.
On line 292, should this comparison be < rather than <=. It seems like = would be an exact match to what is expected and the timestamps in the records are rounded to the nearest microsecond.
If one is going to call this 'delayed_recs' it might be best to explain why the code looks for < rather than simply != . It seems like it should never be greater than as that would imply that a sample occurred before the next sampling interval.
line 343 my sense is that this estimation of the frequency is correct, but the proof is in the tests
14ef666 to
6d9c73f
Compare
|
This current state of this appears to fix the memory issue for me! |
|
Ready for review! @PeterNSteinmetz Thanks for your earlier comments. I improved the code accordingly. |
| curBlock.endRec = recn - 1 | ||
| curBlock.endTime = predTime | ||
| curBlock = NcsSection(recn, ts, -1, -1) | ||
| curBlock.n_samples = blk_len |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this line if you reset curBlock on next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lines above set the parameters of the previous block before starting a new block. Basically curBlock is always pointing to the latest block and this is where the condition is met that starts a new Block. So that's why NcsSection is called here and curBlock is reassigned.
|
@JuliaSprenger : I think I don't anderstand all details of this. Before I merge : one question. |
|
Hi @samuelgarcia Thank for having a look. I also addressed your comment, I hope this is resolved now. |
This PR includes the latest unittest fixes (#1025)