Legacy format support#3
Merged
Merged
Conversation
This reverts commit 0c89e86.
…d modules Rework run_response into a small stimulus state machine plus two helpers: - _FlipTimer owns the per-flip timing diagnostics and the trial_clean math - _ResponseState captures the early/hit/rt keypress outcome Drop the dead 'frames_shown = 0' branch, rename the two confusing latches (target_shown/clock_reset_scheduled -> target_onset_scheduled, target_onset_ flip_done -> target_on_screen), and document the pre-flip +1 frame prediction. Split the ~600-line trial.py by responsibility, keeping the flat-module convention and headless-importability: - _psychopy.py shared PsychoPy import shim (core/visual/keyboard/logging) - phases.py fixed-duration display loops (cue/fixation/outcome/iti) + _check_quit - response.py the timing-critical response window - trial.py orchestration only (_compute_reward + run_trial) Behavior is unchanged: add test_response_diagnostics pinning the full diagnostics dict, and update test_trial_boundary to target the response module. Public API (trial.run_trial, trial._compute_reward) is preserved. All 97 tests pass.
Group the flat ~15-module package into purpose-named subpackages, modeled on the existing ratings/ subpackage: - task/ : trial, phases, response, calibration, display, console, debug, plus newly extracted flip_timer (was response._FlipTimer, now public FlipTimer) and instructions (was session.display_instructions). - io/ : bootstrap (renamed from session.py, minus instructions), setup_wizard, scanner, sequences, and recording/ (the recorder.py split into records / csv_writers / legacy / manifest with a re-export __init__). Update all importers (__main__, ratings/*, tests) and docs. Entry points in pyproject.toml are unchanged. Pure move/rename refactor; 97 tests pass.
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.
Summary
Related issue
Type of change
How was this tested?
Checklist
uv run pytest), including the Octave/MATLAB parity test where an engine is available.import psychopyin tested modules).CHANGELOG.mdare updated.uv.lock) and conda (environment.yml) workflows; dependency changes are reflected in bothpyproject.tomlandenvironment.yml.