Repository navigation
Conversation
…nd process them if they exist
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.
Closes #30 and #31.
visiomode-analysis sessionnow picks up the per-session_lever-durations.csvfiles that sit next to lever-push session JSONs, adds each push's duration (ms) to the trials CSV, and reports lever duration stats in session and subject summaries. This PR also fixes the reaction time plots, which drew their IQR error bars in the wrong place.Changes
get_trials()findssub-<id>_exp-<exp>_ses-<date>_lever-durations.csvnext to the JSON (find_lever_durations()), or uses the file given with the newsession --lever-durations PATHoption. It adds alever_durationcolumn, matching the Nth push (bypush_id) to the Nth precued, hit or false-alarm trial; other trials are NaN. Sessions without a durations file get no column.push_id/durationcolumns, non-numeric durations,push_idnot running 0..n-1, or a push count that differs from the number of lever-push trials) produces a warning and leaves the column empty._read_lever_durations()raises aValueErrorfor each case and_add_lever_durations()turns it into the warning, so a bad file never breaks commands that don't need durations, such asregressors. Checked against the Rett dataset: all 872 sessions match exactly, with no warnings.summary()addslever_duration_<mean|median|sd|iqr>[_<subset>][_wc](SD uses ddof=1) for all pushes and thecued,hits,false_alarmsandprecuedsubsets, with and without correction trials (40 fields). These are only emitted when the trials have alever_durationcolumn.subjectpicks them up automatically: sessions without durations show NaN, and the columns are left out entirely if no session has durations.q75 - median/median - q25to Plotly as error-bar offsets, so the bars span the IQR. Previously they ran frommedian - q25tomedian + q75. The RT and lever duration plots now share_plot_medians_from_dict(), and_rt_statsis renamed to_median_iqr.summary()also accepts a trials DataFrame, andgenerate_report()takes an optionaltrialsDataFrame (also used bypreprocess_session()). A session is now parsed once instead of about nine times per report, and the--lever-durationsoverride applies to every step. The RT plots use a new_select_rts(trials, ...);get_rts(path)is kept as a wrapper._wcstats, empty subsets, and fields being omitted when there are no durations;summary()on full and filtered DataFrames;regressorswith a malformed durations file;write_trials_csvgains arows=argument. README and CHANGELOG ([Unreleased]) are updated, and the README Python API example now callsgenerate_report()with its actual arguments.