Onset Sensitivity
neureptrace.onset_sensitivity runs onset detection over a grid of threshold and persistence settings.
Example:
python -m neureptrace.onset_sensitivity \
--task-dir results/nod_animate_all \
--task-dir results/nod_superclass_canine_device_all \
--task-dir results/nod_superclass_container_covering_all \
--threshold-window -0.100 0.000 \
--threshold-methods point max_run \
--threshold-quantiles 0.90 0.95 0.975 \
--detection-start 0.000 \
--detection-window 0.000 0.800 \
--min-consecutive-values 1 2 3 \
--include-stable-prediction \
--out-dir results/onset_sensitivity_all \
--plot-out results/onset_sensitivity_all/onset_sensitivity.png
The workflow writes onset_sensitivity_summary.csv with one row per threshold method, threshold quantile, persistence setting, and task summary, plus onset_sensitivity_robustness.csv with latency spread and detection-quality aggregates across settings.
Use a post-stimulus --detection-window for latency sweeps, and use an earlier
window start when evaluating false-alarm behavior.
neureptrace.onset_sensitivity
OnsetSensitivityRun
dataclass
Top-level outputs from an onset sensitivity run.
Source code in src/neureptrace/onset_sensitivity.py
40 41 42 43 44 45 46 47 48 | |
OnsetSensitivitySetting
dataclass
One onset-detection parameter setting to evaluate.
Source code in src/neureptrace/onset_sensitivity.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
build_sensitivity_settings(*, threshold_methods=('point',), threshold_quantiles=(DEFAULT_THRESHOLD_QUANTILE,), min_consecutive_values=(1,), min_duration_values=None, stable_prediction_values=(False,))
Return a deterministic grid of onset-detection settings.
Source code in src/neureptrace/onset_sensitivity.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
plot_sensitivity_summary(summary, out_path)
Plot onset latency and false-alarm sensitivity across settings.
Source code in src/neureptrace/onset_sensitivity.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
run_onset_sensitivity(task_dirs, *, out_dir, observations_glob=DEFAULT_OBSERVATIONS_GLOB, threshold_window=DEFAULT_THRESHOLD_WINDOW, threshold_methods=('point',), threshold_quantiles=(DEFAULT_THRESHOLD_QUANTILE,), detection_start=None, detection_window=DEFAULT_DETECTION_WINDOW, min_consecutive_values=(1,), min_duration_values=None, include_stable_prediction=False, score_column='confidence', allow_missing=False, plot_out=None)
Run onset detection over a grid of threshold and persistence settings.
Source code in src/neureptrace/onset_sensitivity.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
summarize_sensitivity(summary)
Summarize onset stability across the parameter grid.
Source code in src/neureptrace/onset_sensitivity.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |