feat(utils): scoped frame-pacing helper for trial loops#326
Open
pellet wants to merge 2 commits into
Open
Conversation
Add high_priority_section() context manager in eegnb/utils/realtime.py that raises three OS settings on entry and restores them on exit: - Scheduler tick: timeBeginPeriod(1) drops Windows default 15.625 ms tick to 1 ms, preventing time.sleep from locking a 120 Hz / 8.33 ms loop to half-rate and dropping every other frame (Windows-only; Linux/macOS already run a 1 ms or finer tick). - Process priority: core.rush(True) -> HIGH_PRIORITY_CLASS. - Python GC: gc.disable() suspends the generational collector. Wire _run_trial_loop through the context manager, replacing the inline core.rush/gc.disable/try-finally block in run(). BlockExperiment gets frame-pacing automatically since it calls _run_trial_loop directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Encapsulate high priority settings into high_priority_section() context manager function in eegnb/utils/realtime.py that raises three OS settings on entry and restores them on exit: