AntonioJun commited on
Commit
2ddf2d2
·
verified ·
1 Parent(s): a1f7838

Add files using upload-large-folder tool

Browse files
Files changed (36) hide show
  1. .pytest_cache/v/cache/lastfailed +2 -1
  2. .pytest_cache/v/cache/nodeids +469 -0
  3. analysis/A_reports.py +29 -4
  4. analysis/B_reports.py +29 -4
  5. analysis/C_reports.py +29 -4
  6. analysis/D_reports.py +29 -4
  7. analysis/F_reports.py +29 -4
  8. analysis/__pycache__/A_reports.cpython-311.pyc +0 -0
  9. analysis/__pycache__/B_reports.cpython-311.pyc +0 -0
  10. analysis/__pycache__/C_reports.cpython-311.pyc +0 -0
  11. analysis/__pycache__/D_reports.cpython-311.pyc +0 -0
  12. analysis/__pycache__/letters_reports.cpython-311.pyc +0 -0
  13. analysis/letters_reports.py +870 -293
  14. backup.py +104 -177
  15. calibration/__init__.py +1 -1
  16. calibration/__pycache__/__init__.cpython-311.pyc +0 -0
  17. calibration/__pycache__/run.cpython-311.pyc +0 -0
  18. calibration/report.py +32 -9
  19. calibration/run.py +74 -23
  20. corruption/__pycache__/__init__.cpython-311.pyc +0 -0
  21. corruption/__pycache__/chimera.cpython-311.pyc +0 -0
  22. corruption/__pycache__/empirical.cpython-311.pyc +0 -0
  23. corruption/__pycache__/launch.cpython-311.pyc +0 -0
  24. corruption/__pycache__/run.cpython-311.pyc +0 -0
  25. corruption/__pycache__/transforms.cpython-311.pyc +0 -0
  26. corruption/chimera.py +6 -5
  27. corruption/empirical.py +24 -7
  28. corruption/launch.py +48 -16
  29. corruption/run.py +106 -36
  30. corruption/sample.py +15 -5
  31. corruption/transforms.py +9 -2
  32. encoder/__pycache__/adapters.cpython-311.pyc +0 -0
  33. encoder/__pycache__/config.cpython-311.pyc +0 -0
  34. encoder/__pycache__/render.cpython-311.pyc +0 -0
  35. encoder/__pycache__/run.cpython-311.pyc +0 -0
  36. tests/test_C/__pycache__/test_run.cpython-311-pytest-9.1.1.pyc +0 -0
.pytest_cache/v/cache/lastfailed CHANGED
@@ -33,5 +33,6 @@
33
  "tests/test_symbolic/test_run.py::test_select_model_reads_frame_mode_subfolder[selective-no-tracking-frames/selective/no tracking]": true,
34
  "tests/test_symbolic/test_run.py::test_symbolic_results_mirror_frame_mode_cache_layout": true,
35
  "tests/test_symbolic/test_run.py::test_question_result_records_selected_frame_mode": true,
36
- "tests/test_symbolic/test_run.py::test_parse_frame_mode_rejects_video_mode": true
 
37
  }
 
33
  "tests/test_symbolic/test_run.py::test_select_model_reads_frame_mode_subfolder[selective-no-tracking-frames/selective/no tracking]": true,
34
  "tests/test_symbolic/test_run.py::test_symbolic_results_mirror_frame_mode_cache_layout": true,
35
  "tests/test_symbolic/test_run.py::test_question_result_records_selected_frame_mode": true,
36
+ "tests/test_symbolic/test_run.py::test_parse_frame_mode_rejects_video_mode": true,
37
+ "tests/test_B/test_spatial_codes.py::test_load_spatial_code_reads_a_real_on_disk_file": true
38
  }
.pytest_cache/v/cache/nodeids CHANGED
@@ -1,4 +1,358 @@
1
  [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  "tests/test_encoder/test_adapters.py::test_adapt_sam3_depth_anything_3_decodes_masks_and_backprojects",
3
  "tests/test_encoder/test_adapters.py::test_adapt_segvggt_reads_flat_npz",
4
  "tests/test_encoder/test_adapters.py::test_adapt_segvggt_rejects_missing_npz_fields",
@@ -7,16 +361,22 @@
7
  "tests/test_encoder/test_adapters.py::test_adapters_default_to_root_data_caches",
8
  "tests/test_encoder/test_adapters.py::test_backproject_resizes_sam3_mask_to_da3_depth_shape",
9
  "tests/test_encoder/test_adapters.py::test_fusion_adapter_resolves_two_native_model_directories",
 
10
  "tests/test_encoder/test_adapters.py::test_native_sam3_decodes_lossless_tracking_cache",
11
  "tests/test_encoder/test_adapters.py::test_native_sam3_decodes_prompt_keyed_independent_frames",
12
  "tests/test_encoder/test_adapters.py::test_native_sam3_preserves_tracked_object_ids",
13
  "tests/test_encoder/test_adapters.py::test_registry_decodes_native_segvggt_dictionary",
 
14
  "tests/test_encoder/test_adapters.py::test_validate_identifies_empty_scene",
15
  "tests/test_encoder/test_adapters.py::test_validate_normalizes_canonical_geometry",
16
  "tests/test_encoder/test_adapters.py::test_validate_rejects_invalid_geometry[scene0-TypeError]",
17
  "tests/test_encoder/test_adapters.py::test_validate_rejects_invalid_geometry[scene1-ValueError]",
18
  "tests/test_encoder/test_adapters.py::test_validate_rejects_invalid_geometry[scene2-ValueError]",
19
  "tests/test_encoder/test_config.py::test_cache_and_code_paths_are_flat",
 
 
 
 
20
  "tests/test_encoder/test_config.py::test_mode_paths_are_isolated[selective-no-tracking-selective/no tracking]",
21
  "tests/test_encoder/test_config.py::test_mode_paths_are_isolated[uniform-tracking-uniform/tracking]",
22
  "tests/test_encoder/test_config.py::test_parse_frame_mode_rejects_video_modes",
@@ -29,16 +389,47 @@
29
  "tests/test_encoder/test_encoder.py::test_depth_edges_handles_small_and_discontinuous_frames",
30
  "tests/test_encoder/test_encoder.py::test_relative_direction_modes",
31
  "tests/test_encoder/test_encoder.py::test_robust_centroid_extent_returns_sorted_dimensions",
 
 
 
 
 
 
 
 
32
  "tests/test_encoder/test_geometric.py::test_dump_spatial_code",
33
  "tests/test_encoder/test_geometric.py::test_dumped_json_preserves_schema",
34
  "tests/test_encoder/test_geometric.py::test_exact_math_is_integrated_into_geometric_module",
 
 
35
  "tests/test_encoder/test_geometric.py::test_floor_level_v1_v2_math_is_shared",
36
  "tests/test_encoder/test_geometric.py::test_position_reader_accepts_current_and_legacy_formatting",
 
37
  "tests/test_encoder/test_geometric.py::test_raw_bundle_dispatches_to_integrated_exact_path",
38
  "tests/test_encoder/test_geometric.py::test_spatial_code_matches_reference_schema",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  "tests/test_encoder/test_launch.py::test_available_cpu_count_respects_affinity_and_override",
40
  "tests/test_encoder/test_launch.py::test_cached_scenes_requires_both_sam3_and_da3_caches",
41
  "tests/test_encoder/test_launch.py::test_cached_scenes_requires_segvggt_cache",
 
42
  "tests/test_encoder/test_launch.py::test_main_all_dispatches_every_frame_mode",
43
  "tests/test_encoder/test_launch.py::test_main_dispatches_one_requested_mode",
44
  "tests/test_encoder/test_launch.py::test_main_skips_existing_spatial_codes",
@@ -49,35 +440,87 @@
49
  "tests/test_encoder/test_launch.py::test_visible_gpus_uses_environment",
50
  "tests/test_encoder/test_launch.py::test_worker_skips_empty_scenes_but_fails_other_errors",
51
  "tests/test_encoder/test_render.py::test_build_spatial_code_uses_cached_geometry",
 
52
  "tests/test_encoder/test_render.py::test_write_spatial_code_propagates_mode",
53
  "tests/test_encoder/test_render.py::test_write_spatial_code_uses_scene_json",
54
  "tests/test_encoder/test_run.py::test_cache_or_load_builds_and_writes_cache",
 
55
  "tests/test_encoder/test_run.py::test_cache_or_load_reads_flat_cache",
56
  "tests/test_encoder/test_run.py::test_fusion_cache_rejects_changed_native_source",
57
  "tests/test_encoder/test_run.py::test_fusion_cache_uses_explicit_mode_inputs",
58
  "tests/test_encoder/test_run.py::test_fusion_requires_mode",
 
 
 
 
 
59
  "tests/test_inference/test_adapters.py::test_alignment_failure_falls_back_to_unaligned_ssim",
60
  "tests/test_inference/test_adapters.py::test_alignment_makes_small_camera_shift_redundant",
 
61
  "tests/test_inference/test_adapters.py::test_combined_adapter_gives_both_models_the_same_decoded_frames",
62
  "tests/test_inference/test_adapters.py::test_combined_adapter_runs_only_requested_target",
63
  "tests/test_inference/test_adapters.py::test_da3_preserves_native_prediction_object",
64
  "tests/test_inference/test_adapters.py::test_load_model_validates_repository_and_checkpoint",
 
65
  "tests/test_inference/test_adapters.py::test_read_video_rejects_unopenable_file",
66
  "tests/test_inference/test_adapters.py::test_redundancy_groups_keep_sharpest_and_earlier_ties",
 
67
  "tests/test_inference/test_adapters.py::test_run_scene_preserves_raw_dtypes_and_encoder_geometry",
68
  "tests/test_inference/test_adapters.py::test_run_scene_requires_loaded_model",
 
69
  "tests/test_inference/test_adapters.py::test_sam3_preserves_independent_image_responses_without_tracking",
 
70
  "tests/test_inference/test_adapters.py::test_selective_sampling_honors_requested_frame_count",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  "tests/test_inference/test_adapters.py::test_tracking_frames_preserve_tracker_object_ids",
72
  "tests/test_inference/test_inference.py::test_adapter_registry",
73
  "tests/test_inference/test_inference.py::test_combined_run_resumes_only_missing_target",
74
  "tests/test_inference/test_inference.py::test_frame_modes_are_complete_and_parseable",
75
  "tests/test_inference/test_inference.py::test_local_model_roots_are_exact",
 
76
  "tests/test_inference/test_inference.py::test_native_output_paths_are_isolated_by_mode",
 
77
  "tests/test_inference/test_inference.py::test_run_scene_builds_then_skips_selected_mode",
78
  "tests/test_inference/test_inference.py::test_scenes_deduplicates_manifest",
79
  "tests/test_inference/test_inference.py::test_visible_gpus_uses_environment",
 
 
 
80
  "tests/test_inference/test_launch.py::test_available_cpu_count_respects_affinity_and_override",
 
81
  "tests/test_inference/test_launch.py::test_main_requires_mode_or_all",
82
  "tests/test_inference/test_launch.py::test_main_runs_only_requested_modes_or_all",
83
  "tests/test_inference/test_launch.py::test_scenes_deduplicate_manifest",
@@ -85,26 +528,52 @@
85
  "tests/test_inference/test_launch.py::test_visible_gpus_uses_environment",
86
  "tests/test_inference/test_launch.py::test_worker_loads_tracking_adapter_once_and_reuses_it",
87
  "tests/test_inference/test_launch.py::test_worker_reports_model_load_failure_for_every_scene",
 
 
 
88
  "tests/test_inference/test_run.py::test_real_segvggt_scene_preserves_native_prediction_dictionary",
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  "tests/test_symbolic/test_launch.py::test_error_analysis_rejects_non_numeric_question_type",
90
  "tests/test_symbolic/test_launch.py::test_error_analysis_summarizes_numeric_errors",
91
  "tests/test_symbolic/test_launch.py::test_main_all_runs_every_frame_mode",
92
  "tests/test_symbolic/test_launch.py::test_mca_answer_breakdown_distinguishes_outcomes",
93
  "tests/test_symbolic/test_launch.py::test_scenes_with_spatial_codes_returns_sorted_stems",
 
94
  "tests/test_symbolic/test_run.py::test_fetch_spatial_code_reads_flat_json",
95
  "tests/test_symbolic/test_run.py::test_fetch_spatial_code_reports_missing_file",
 
96
  "tests/test_symbolic/test_run.py::test_find_workspace_root_uses_spatial_codes_folder",
97
  "tests/test_symbolic/test_run.py::test_parse_frame_mode_rejects_video_mode",
98
  "tests/test_symbolic/test_run.py::test_question_result_records_selected_frame_mode",
99
  "tests/test_symbolic/test_run.py::test_real_questions_for_scene_filters_jsonl",
 
 
 
100
  "tests/test_symbolic/test_run.py::test_select_model_reads_frame_mode_subfolder[selective-no-tracking-frames/selective/no tracking]",
101
  "tests/test_symbolic/test_run.py::test_select_model_reads_frame_mode_subfolder[selective-tracking-frames/selective/tracking]",
102
  "tests/test_symbolic/test_run.py::test_select_model_reads_frame_mode_subfolder[uniform-no-tracking-frames/uniform/no tracking]",
103
  "tests/test_symbolic/test_run.py::test_select_model_reads_frame_mode_subfolder[uniform-tracking-frames/uniform/tracking]",
104
  "tests/test_symbolic/test_run.py::test_select_model_reads_fusion_subfolder",
 
105
  "tests/test_symbolic/test_run.py::test_symbolic_results_are_isolated_by_model_and_mode",
106
  "tests/test_symbolic/test_run.py::test_symbolic_results_mirror_frame_mode_cache_layout",
 
 
 
107
  "tests/test_symbolic/test_run.py::test_write_scene_results_uses_one_file_per_question",
 
108
  "tests/test_symbolic/test_solver.py::test_direct_numeric_answers",
109
  "tests/test_symbolic/test_solver.py::test_direction_answers_use_floor_coordinates",
110
  "tests/test_symbolic/test_solver.py::test_dispatch_returns_none_for_unknown_or_missing_data",
 
1
  [
2
+ "tests/test_A/test_A.py::test_default_frame_selection_is_a_valid_selection",
3
+ "tests/test_A/test_A.py::test_extended_generation_protocol",
4
+ "tests/test_A/test_A.py::test_frame_selections_match_inference_vocabulary",
5
+ "tests/test_A/test_A.py::test_generation_protocol_matches_vsibench_yaml",
6
+ "tests/test_A/test_A.py::test_model_paths_cover_every_registered_model",
7
+ "tests/test_A/test_A.py::test_results_dir_defaults_under_root_results",
8
+ "tests/test_A/test_frames.py::test_sample_frames_derives_indices_from_real_fps",
9
+ "tests/test_A/test_frames.py::test_sample_frames_rejects_missing_video",
10
+ "tests/test_A/test_frames.py::test_sample_frames_rejects_nonpositive_frame_count",
11
+ "tests/test_A/test_frames.py::test_sample_frames_rejects_unknown_selection",
12
+ "tests/test_A/test_frames.py::test_sample_frames_returns_pil_images_in_order",
13
+ "tests/test_A/test_init.py::test_default_frame_selection_is_a_valid_selection",
14
+ "tests/test_A/test_init.py::test_extended_generation_protocol",
15
+ "tests/test_A/test_init.py::test_frame_selections_match_inference_vocabulary",
16
+ "tests/test_A/test_init.py::test_generation_protocol_matches_vsibench_yaml",
17
+ "tests/test_A/test_init.py::test_model_paths_cover_every_registered_model",
18
+ "tests/test_A/test_init.py::test_results_dir_defaults_under_root_results",
19
+ "tests/test_A/test_launch.py::test_launch_rebuild_forces_pending_even_when_answered",
20
+ "tests/test_A/test_launch.py::test_launch_rejects_scene_with_no_questions",
21
+ "tests/test_A/test_launch.py::test_launch_skips_scene_already_fully_answered",
22
+ "tests/test_A/test_launch.py::test_launcher_imports",
23
+ "tests/test_A/test_launch.py::test_scenes_dedups_and_preserves_order",
24
+ "tests/test_A/test_models.py::test_adapter_answer_before_load_model_raises",
25
+ "tests/test_A/test_models.py::test_adapter_answer_extended_before_load_model_raises",
26
+ "tests/test_A/test_models.py::test_all_three_models_are_registered",
27
+ "tests/test_A/test_models.py::test_every_adapter_implements_answer_extended",
28
+ "tests/test_A/test_models.py::test_get_adapter_binds_the_correct_checkpoint_path",
29
+ "tests/test_A/test_models.py::test_get_adapter_rejects_unknown_model",
30
+ "tests/test_A/test_models.py::test_get_adapter_returns_the_right_class_per_model",
31
+ "tests/test_A/test_models.py::test_internvl_adapter_disables_per_frame_tiling",
32
+ "tests/test_A/test_models.py::test_numbered_content_handles_zero_frames",
33
+ "tests/test_A/test_models.py::test_numbered_content_labels_every_frame_in_order",
34
+ "tests/test_A/test_models.py::test_qwen_adapter_disables_thinking_mode",
35
+ "tests/test_A/test_models.py::test_unload_clears_model_and_processor",
36
+ "tests/test_A/test_prompts.py::test_every_mca_question_type_builds_with_options[obj_appearance_order]",
37
+ "tests/test_A/test_prompts.py::test_every_mca_question_type_builds_with_options[object_rel_direction_easy]",
38
+ "tests/test_A/test_prompts.py::test_every_mca_question_type_builds_with_options[object_rel_direction_hard]",
39
+ "tests/test_A/test_prompts.py::test_every_mca_question_type_builds_with_options[object_rel_direction_medium]",
40
+ "tests/test_A/test_prompts.py::test_every_mca_question_type_builds_with_options[object_rel_distance]",
41
+ "tests/test_A/test_prompts.py::test_every_mca_question_type_builds_with_options[route_planning]",
42
+ "tests/test_A/test_prompts.py::test_every_na_question_type_builds_without_options[object_abs_distance]",
43
+ "tests/test_A/test_prompts.py::test_every_na_question_type_builds_without_options[object_counting]",
44
+ "tests/test_A/test_prompts.py::test_every_na_question_type_builds_without_options[object_size_estimation]",
45
+ "tests/test_A/test_prompts.py::test_every_na_question_type_builds_without_options[room_size_estimation]",
46
+ "tests/test_A/test_prompts.py::test_mca_question_prompt_matches_vsibench_protocol",
47
+ "tests/test_A/test_prompts.py::test_mca_question_requires_options",
48
+ "tests/test_A/test_prompts.py::test_na_question_prompt_matches_vsibench_protocol",
49
+ "tests/test_A/test_prompts.py::test_unknown_question_type_rejected",
50
+ "tests/test_A/test_run.py::test_build_record_carries_reasoning_fields_when_extended",
51
+ "tests/test_A/test_run.py::test_build_record_defaults_reasoning_fields_when_not_extended",
52
+ "tests/test_A/test_run.py::test_build_record_preserves_every_field_untruncated",
53
+ "tests/test_A/test_run.py::test_load_questions_filters_by_scene",
54
+ "tests/test_A/test_run.py::test_load_questions_reads_every_row",
55
+ "tests/test_A/test_run.py::test_load_questions_respects_limit",
56
+ "tests/test_A/test_run.py::test_results_dir_for_honors_explicit_override",
57
+ "tests/test_A/test_run.py::test_results_dir_for_isolates_the_two_protocols",
58
+ "tests/test_A/test_run.py::test_results_dir_for_matches_established_dimension_nesting",
59
+ "tests/test_A/test_run.py::test_scalar_score_rejects_unknown_question_type",
60
+ "tests/test_A/test_run.py::test_scalar_score_returns_metric_name_and_value",
61
+ "tests/test_A/test_run.py::test_write_question_result_writes_one_json_file_per_question",
62
+ "tests/test_A/test_sweep.py::test_build_plan_covers_every_combination",
63
+ "tests/test_A/test_sweep.py::test_build_plan_orders_by_frame_count_first",
64
+ "tests/test_A/test_sweep.py::test_build_plan_with_all_registered_models",
65
+ "tests/test_A/test_sweep.py::test_parse_csv_choice_expands_all",
66
+ "tests/test_A/test_sweep.py::test_parse_csv_choice_rejects_empty",
67
+ "tests/test_A/test_sweep.py::test_parse_csv_choice_rejects_unknown_value",
68
+ "tests/test_A/test_sweep.py::test_parse_csv_choice_splits_and_dedups",
69
+ "tests/test_A/test_sweep.py::test_parse_frame_counts_rejects_non_integer",
70
+ "tests/test_A/test_sweep.py::test_parse_frame_counts_rejects_nonpositive",
71
+ "tests/test_A/test_sweep.py::test_parse_frame_counts_splits_and_dedups",
72
+ "tests/test_B/test_B.py::test_depth_and_tracking_reuse_encoder_config_vocabulary",
73
+ "tests/test_B/test_B.py::test_input_selections_match_harness_a_vocabulary",
74
+ "tests/test_B/test_B.py::test_results_dir_defaults_under_root_results",
75
+ "tests/test_B/test_B.py::test_reuses_harness_a_model_paths_and_generation_protocol",
76
+ "tests/test_B/test_B.py::test_spatial_code_formats_match_the_two_on_disk_schemas",
77
+ "tests/test_B/test_init.py::test_depth_and_tracking_reuse_encoder_config_vocabulary",
78
+ "tests/test_B/test_init.py::test_input_selections_match_harness_a_vocabulary",
79
+ "tests/test_B/test_init.py::test_results_dir_defaults_under_root_results",
80
+ "tests/test_B/test_init.py::test_reuses_harness_a_model_paths_and_generation_protocol",
81
+ "tests/test_B/test_init.py::test_spatial_code_formats_match_the_two_on_disk_schemas",
82
+ "tests/test_B/test_launch.py::test_launch_rebuild_forces_pending_even_when_answered",
83
+ "tests/test_B/test_launch.py::test_launch_rejects_question_id_filter_that_matches_nothing",
84
+ "tests/test_B/test_launch.py::test_launch_skips_scene_already_fully_answered",
85
+ "tests/test_B/test_launch.py::test_launcher_imports",
86
+ "tests/test_B/test_prompts.py::test_default_arguments_reproduce_the_standard_prompt_byte_for_byte",
87
+ "tests/test_B/test_prompts.py::test_every_mca_question_type_builds[obj_appearance_order]",
88
+ "tests/test_B/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_easy]",
89
+ "tests/test_B/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_hard]",
90
+ "tests/test_B/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_medium]",
91
+ "tests/test_B/test_prompts.py::test_every_mca_question_type_builds[object_rel_distance]",
92
+ "tests/test_B/test_prompts.py::test_every_mca_question_type_builds[route_planning]",
93
+ "tests/test_B/test_prompts.py::test_every_na_question_type_builds[object_abs_distance]",
94
+ "tests/test_B/test_prompts.py::test_every_na_question_type_builds[object_counting]",
95
+ "tests/test_B/test_prompts.py::test_every_na_question_type_builds[object_size_estimation]",
96
+ "tests/test_B/test_prompts.py::test_every_na_question_type_builds[room_size_estimation]",
97
+ "tests/test_B/test_prompts.py::test_mca_question_prompt_includes_options_and_matches_harness_a_post_prompt",
98
+ "tests/test_B/test_prompts.py::test_mca_question_requires_options",
99
+ "tests/test_B/test_prompts.py::test_na_question_prompt_embeds_the_spatial_code_as_text_and_a_post_prompt",
100
+ "tests/test_B/test_prompts.py::test_no_frames_language_in_pre_prompt",
101
+ "tests/test_B/test_prompts.py::test_paraphrase_context_line_swaps_only_the_first_line",
102
+ "tests/test_B/test_prompts.py::test_unknown_question_type_rejected",
103
+ "tests/test_B/test_prompts.py::test_unknown_serialization_rejected",
104
+ "tests/test_B/test_prompts.py::test_yaml_arm_context_line_does_not_claim_json",
105
+ "tests/test_B/test_prompts.py::test_yaml_serialization_renders_the_identical_dict",
106
+ "tests/test_B/test_run.py::test_build_record_carries_reasoning_fields_when_forced",
107
+ "tests/test_B/test_run.py::test_build_record_preserves_every_field_untruncated",
108
+ "tests/test_B/test_run.py::test_results_dir_for_honors_explicit_override",
109
+ "tests/test_B/test_run.py::test_results_dir_for_isolates_the_two_protocols",
110
+ "tests/test_B/test_run.py::test_results_dir_for_matches_established_dimension_nesting",
111
+ "tests/test_B/test_run.py::test_run_strip_schema_legend_removes_only_the_legend",
112
+ "tests/test_B/test_run.py::test_write_question_result_writes_one_json_file_per_question",
113
+ "tests/test_B/test_spatial_codes.py::test_load_spatial_code_raises_clearly_when_missing",
114
+ "tests/test_B/test_spatial_codes.py::test_load_spatial_code_reads_a_real_on_disk_file",
115
+ "tests/test_B/test_spatial_codes.py::test_load_spatial_code_rejects_unknown_format",
116
+ "tests/test_B/test_spatial_codes.py::test_load_spatial_code_returns_dict_and_path",
117
+ "tests/test_B/test_spatial_codes.py::test_spatial_code_path_includes_every_cache_axis",
118
+ "tests/test_B/test_sweep.py::test_build_plan_covers_every_combination",
119
+ "tests/test_B/test_sweep.py::test_build_plan_orders_by_frame_count_first",
120
+ "tests/test_B/test_sweep.py::test_build_plan_sweeps_depth_and_tracking_too",
121
+ "tests/test_B/test_sweep.py::test_build_plan_with_all_registered_models",
122
+ "tests/test_B/test_sweep.py::test_sweep_parser_rejects_unknown_depth",
123
+ "tests/test_B/test_sweep.py::test_sweep_parser_rejects_unknown_spatial_code_format",
124
+ "tests/test_B/test_sweep.py::test_sweep_parser_rejects_unknown_tracking",
125
+ "tests/test_C/test_C.py::test_depth_and_tracking_reuse_encoder_config_vocabulary",
126
+ "tests/test_C/test_C.py::test_input_selections_are_one_shared_vocabulary_with_a_and_b",
127
+ "tests/test_C/test_C.py::test_results_dir_defaults_under_root_results",
128
+ "tests/test_C/test_C.py::test_reuses_harness_a_model_paths_and_generation_protocol",
129
+ "tests/test_C/test_init.py::test_depth_and_tracking_reuse_encoder_config_vocabulary",
130
+ "tests/test_C/test_init.py::test_input_selections_are_one_shared_vocabulary_with_a_and_b",
131
+ "tests/test_C/test_init.py::test_results_dir_defaults_under_root_results",
132
+ "tests/test_C/test_init.py::test_reuses_harness_a_model_paths_and_generation_protocol",
133
+ "tests/test_C/test_launch.py::test_launch_rebuild_forces_pending_even_when_answered",
134
+ "tests/test_C/test_launch.py::test_launch_routes_overlay_to_overlay_result_tree",
135
+ "tests/test_C/test_launch.py::test_launch_skips_scene_already_fully_answered",
136
+ "tests/test_C/test_launch.py::test_launcher_imports",
137
+ "tests/test_C/test_overlay.py::test_instance_ids_adds_stable_one_based_labels_without_mutating_input",
138
+ "tests/test_C/test_overlay.py::test_label_positions_parse_meter_strings_in_code_order",
139
+ "tests/test_C/test_overlay.py::test_load_cached_frames_requires_complete_png_set_and_labels",
140
+ "tests/test_C/test_overlay.py::test_load_or_create_overlay_code_reuses_existing_file",
141
+ "tests/test_C/test_overlay.py::test_load_or_create_overlay_code_saves_missing_file",
142
+ "tests/test_C/test_overlay.py::test_overlay_spatial_code_path_lives_under_overlay_root",
143
+ "tests/test_C/test_overlay.py::test_save_cached_frames_writes_pngs_and_labels",
144
+ "tests/test_C/test_overlay.py::test_stamp_frames_serves_complete_cache_without_loading_dependencies",
145
+ "tests/test_C/test_overlay.py::test_stamp_frames_uses_raw_sam3_boxes_and_does_not_mutate_inputs",
146
+ "tests/test_C/test_overlay_launch.py::test_available_cpu_count_honors_positive_environment",
147
+ "tests/test_C/test_overlay_launch.py::test_has_dependencies_requires_spatial_code_and_sam3_cache",
148
+ "tests/test_C/test_overlay_launch.py::test_has_dependencies_treats_missing_code_as_ineligible",
149
+ "tests/test_C/test_overlay_launch.py::test_launch_does_not_skip_frames_cache_when_overlay_code_is_missing",
150
+ "tests/test_C/test_overlay_launch.py::test_launch_skips_missing_and_already_cached_without_pool",
151
+ "tests/test_C/test_prompts.py::test_every_mca_question_type_builds[obj_appearance_order]",
152
+ "tests/test_C/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_easy]",
153
+ "tests/test_C/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_hard]",
154
+ "tests/test_C/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_medium]",
155
+ "tests/test_C/test_prompts.py::test_every_mca_question_type_builds[object_rel_distance]",
156
+ "tests/test_C/test_prompts.py::test_every_mca_question_type_builds[route_planning]",
157
+ "tests/test_C/test_prompts.py::test_every_na_question_type_builds[object_abs_distance]",
158
+ "tests/test_C/test_prompts.py::test_every_na_question_type_builds[object_counting]",
159
+ "tests/test_C/test_prompts.py::test_every_na_question_type_builds[object_size_estimation]",
160
+ "tests/test_C/test_prompts.py::test_every_na_question_type_builds[room_size_estimation]",
161
+ "tests/test_C/test_prompts.py::test_mca_question_prompt_includes_options_and_post_prompt",
162
+ "tests/test_C/test_prompts.py::test_mca_question_requires_options",
163
+ "tests/test_C/test_prompts.py::test_na_question_prompt_layout_is_context_then_code_then_question_then_post_prompt",
164
+ "tests/test_C/test_prompts.py::test_pre_prompt_mentions_both_frames_and_spatial_code",
165
+ "tests/test_C/test_prompts.py::test_unknown_question_type_rejected",
166
+ "tests/test_C/test_run.py::test_build_record_carries_both_frame_and_spatial_code_provenance",
167
+ "tests/test_C/test_run.py::test_build_record_carries_reasoning_fields_when_forced",
168
+ "tests/test_C/test_run.py::test_results_dir_for_honors_explicit_override",
169
+ "tests/test_C/test_run.py::test_results_dir_for_matches_established_dimension_nesting",
170
+ "tests/test_C/test_run.py::test_results_dir_for_places_overlay_under_C_results",
171
+ "tests/test_C/test_run.py::test_write_question_result_routes_overlay_default_to_overlay_tree",
172
+ "tests/test_C/test_run.py::test_write_question_result_writes_one_json_file_per_question",
173
+ "tests/test_C/test_sweep.py::test_build_plan_covers_every_combination",
174
+ "tests/test_C/test_sweep.py::test_build_plan_orders_by_frame_count_first",
175
+ "tests/test_C/test_sweep.py::test_build_plan_sweeps_depth_and_tracking_too",
176
+ "tests/test_C/test_sweep.py::test_build_plan_with_all_registered_models",
177
+ "tests/test_C/test_sweep.py::test_sweep_forwards_overlay_to_each_launch",
178
+ "tests/test_C/test_sweep.py::test_sweep_parser_rejects_unknown_depth",
179
+ "tests/test_C/test_sweep.py::test_sweep_parser_rejects_unknown_spatial_code_format",
180
+ "tests/test_C/test_sweep.py::test_sweep_parser_rejects_unknown_tracking",
181
+ "tests/test_D/test_D.py::test_results_dir_defaults_under_root_results",
182
+ "tests/test_D/test_D.py::test_reuses_harness_a_model_paths_and_generation_protocol",
183
+ "tests/test_D/test_D.py::test_spatial_code_formats_reuse_harness_b_vocabulary",
184
+ "tests/test_D/test_init.py::test_results_dir_defaults_under_root_results",
185
+ "tests/test_D/test_init.py::test_reuses_harness_a_model_paths_and_generation_protocol",
186
+ "tests/test_D/test_init.py::test_spatial_code_formats_reuse_harness_b_vocabulary",
187
+ "tests/test_D/test_launch.py::test_launch_rebuild_forces_pending_even_when_answered",
188
+ "tests/test_D/test_launch.py::test_launch_skips_scene_already_fully_answered",
189
+ "tests/test_D/test_launch.py::test_launcher_imports",
190
+ "tests/test_D/test_launch.py::test_scenes_is_subset_of_vsi_bench_scenes_with_ground_truth_coverage",
191
+ "tests/test_D/test_prompts.py::test_every_mca_question_type_builds[obj_appearance_order]",
192
+ "tests/test_D/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_easy]",
193
+ "tests/test_D/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_hard]",
194
+ "tests/test_D/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_medium]",
195
+ "tests/test_D/test_prompts.py::test_every_mca_question_type_builds[object_rel_distance]",
196
+ "tests/test_D/test_prompts.py::test_every_mca_question_type_builds[route_planning]",
197
+ "tests/test_D/test_prompts.py::test_every_na_question_type_builds[object_abs_distance]",
198
+ "tests/test_D/test_prompts.py::test_every_na_question_type_builds[object_counting]",
199
+ "tests/test_D/test_prompts.py::test_every_na_question_type_builds[object_size_estimation]",
200
+ "tests/test_D/test_prompts.py::test_every_na_question_type_builds[room_size_estimation]",
201
+ "tests/test_D/test_prompts.py::test_mca_question_prompt_includes_options_and_matches_harness_a_post_prompt",
202
+ "tests/test_D/test_prompts.py::test_mca_question_requires_options",
203
+ "tests/test_D/test_prompts.py::test_na_question_prompt_embeds_the_spatial_code_as_text_and_a_post_prompt",
204
+ "tests/test_D/test_prompts.py::test_no_frames_or_video_language_in_pre_prompt",
205
+ "tests/test_D/test_prompts.py::test_unknown_question_type_rejected",
206
+ "tests/test_D/test_run.py::test_build_record_carries_reasoning_fields_when_forced",
207
+ "tests/test_D/test_run.py::test_build_record_defaults_reasoning_fields_when_absent",
208
+ "tests/test_D/test_run.py::test_build_record_describes_frames_plus_ground_truth_condition",
209
+ "tests/test_D/test_run.py::test_build_record_preserves_every_field_untruncated",
210
+ "tests/test_D/test_run.py::test_results_dir_for_honors_explicit_override",
211
+ "tests/test_D/test_run.py::test_results_dir_for_isolates_frames_and_truncated_budget_arms",
212
+ "tests/test_D/test_run.py::test_results_dir_for_matches_model_protocol_and_format_only",
213
+ "tests/test_D/test_run.py::test_run_code_transform_hook_replaces_the_loaded_code",
214
+ "tests/test_D/test_run.py::test_write_question_result_writes_one_json_file_per_question",
215
+ "tests/test_D/test_spatial_codes.py::test_load_spatial_code_raises_clearly_when_missing",
216
+ "tests/test_D/test_spatial_codes.py::test_load_spatial_code_rejects_unknown_format",
217
+ "tests/test_D/test_spatial_codes.py::test_load_spatial_code_returns_dict_and_path",
218
+ "tests/test_D/test_sweep.py::test_build_plan_covers_every_combination",
219
+ "tests/test_D/test_sweep.py::test_build_plan_with_all_registered_models",
220
+ "tests/test_D/test_sweep.py::test_default_spatial_code_formats_cover_both_when_not_restricted",
221
+ "tests/test_D/test_symbolic_eval.py::test_run_answers_real_questions_for_a_real_ground_truth_scene",
222
+ "tests/test_D/test_symbolic_eval.py::test_run_does_not_write_when_write_results_is_false",
223
+ "tests/test_D/test_symbolic_eval.py::test_run_forwards_results_dir_to_symbolic_writer",
224
+ "tests/test_D/test_symbolic_eval.py::test_run_selects_ground_truth_spatial_codes_when_writing",
225
+ "tests/test_E/test_E.py::test_blind_floor_reuses_harness_a_public_config",
226
+ "tests/test_E/test_E.py::test_results_dir_can_be_overridden_by_environment",
227
+ "tests/test_E/test_init.py::test_blind_floor_reuses_harness_a_public_config",
228
+ "tests/test_E/test_init.py::test_results_dir_can_be_overridden_by_environment",
229
+ "tests/test_E/test_launch.py::test_launch_protocols_use_separate_result_roots",
230
+ "tests/test_E/test_launch.py::test_launch_rebuild_forces_pending_even_when_answered",
231
+ "tests/test_E/test_launch.py::test_launch_skips_scene_already_fully_answered",
232
+ "tests/test_E/test_launch.py::test_launcher_imports",
233
+ "tests/test_E/test_prompts.py::test_every_mca_question_type_builds[obj_appearance_order]",
234
+ "tests/test_E/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_easy]",
235
+ "tests/test_E/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_hard]",
236
+ "tests/test_E/test_prompts.py::test_every_mca_question_type_builds[object_rel_direction_medium]",
237
+ "tests/test_E/test_prompts.py::test_every_mca_question_type_builds[object_rel_distance]",
238
+ "tests/test_E/test_prompts.py::test_every_mca_question_type_builds[route_planning]",
239
+ "tests/test_E/test_prompts.py::test_every_na_question_type_builds[object_abs_distance]",
240
+ "tests/test_E/test_prompts.py::test_every_na_question_type_builds[object_counting]",
241
+ "tests/test_E/test_prompts.py::test_every_na_question_type_builds[object_size_estimation]",
242
+ "tests/test_E/test_prompts.py::test_every_na_question_type_builds[room_size_estimation]",
243
+ "tests/test_E/test_prompts.py::test_mca_question_prompt_includes_options_and_post_prompt",
244
+ "tests/test_E/test_prompts.py::test_mca_question_requires_options",
245
+ "tests/test_E/test_prompts.py::test_na_question_prompt_is_question_plus_post_prompt_only",
246
+ "tests/test_E/test_prompts.py::test_no_scene_language_anywhere",
247
+ "tests/test_E/test_prompts.py::test_unknown_question_type_rejected",
248
+ "tests/test_E/test_run.py::test_build_record_has_no_scene_input_provenance",
249
+ "tests/test_E/test_run.py::test_results_dir_for_honors_explicit_override",
250
+ "tests/test_E/test_run.py::test_results_dir_for_isolates_the_two_protocols",
251
+ "tests/test_E/test_run.py::test_results_dir_for_matches_model_and_protocol_only",
252
+ "tests/test_E/test_run.py::test_write_question_result_writes_one_json_file_per_question",
253
+ "tests/test_E/test_sweep.py::test_sweep_defaults_to_base_protocol",
254
+ "tests/test_E/test_sweep.py::test_sweep_imports",
255
+ "tests/test_E/test_sweep.py::test_sweep_parser_rejects_unknown_model",
256
+ "tests/test_E/test_sweep.py::test_sweep_runs_every_model_through_launch",
257
+ "tests/test_F/test_F.py::test_results_dir_can_be_overridden_by_environment",
258
+ "tests/test_F/test_F.py::test_sources_and_default_are_declared",
259
+ "tests/test_F/test_init.py::test_results_dir_can_be_overridden_by_environment",
260
+ "tests/test_F/test_init.py::test_sources_and_default_are_declared",
261
+ "tests/test_F/test_launch.py::test_launch_entrypoint_exposes_run_main",
262
+ "tests/test_F/test_run.py::test_ground_truth_layout_has_no_perception_axes",
263
+ "tests/test_F/test_run.py::test_perceived_layout_contains_every_input_axis",
264
+ "tests/test_F/test_run.py::test_results_default_under_root",
265
+ "tests/test_F/test_run.py::test_select_source_routes_to_existing_symbolic_selectors",
266
+ "tests/test_F/test_sweep.py::test_csv_expands_all_dedups_and_rejects_unknowns",
267
+ "tests/test_F/test_sweep.py::test_main_routes_ground_truth_without_perception_axes",
268
+ "tests/test_analysis/test_A_reports.py::TestAReports::test_A_report_and_controlled_frame_comparison",
269
+ "tests/test_analysis/test_B_reports.py::TestBReports::test_B_report_contains_spatial_cell",
270
+ "tests/test_analysis/test_C_reports.py::TestCReports::test_C_report_is_exported",
271
+ "tests/test_analysis/test_D_reports.py::TestDReports::test_D_report_is_ground_truth_code_report",
272
+ "tests/test_analysis/test_F_reports.py::TestFReports::test_F_legacy_and_future_perceived_layouts",
273
+ "tests/test_analysis/test_analysis.py::TestAnalysisDirectory::test_E_is_excluded",
274
+ "tests/test_analysis/test_analysis.py::TestAnalysisDirectory::test_arbitrary_subset_exports_letter_and_combined_files",
275
+ "tests/test_analysis/test_letters_reports.py::TestLettersReports::test_DF_and_BF_semantic_alignment",
276
+ "tests/test_analysis/test_letters_reports.py::TestLettersReports::test_arbitrary_subset_and_combined_name",
277
+ "tests/test_analysis/test_letters_reports.py::TestLettersReports::test_folded_statistical_and_solver_helpers",
278
+ "tests/test_analysis/test_letters_reports.py::TestLettersReports::test_manifest_generated_at_is_deterministic_by_default",
279
+ "tests/test_analysis/test_letters_reports.py::TestLettersReports::test_pair_restriction",
280
+ "tests/test_backup.py::test_backup_dry_run_skips_empty_targets_and_never_imports_hub",
281
+ "tests/test_backup.py::test_local_paths_keep_results_under_results_host",
282
+ "tests/test_backup.py::test_resolve_targets_expands_all_without_uploading_unknowns",
283
+ "tests/test_backup.py::test_target_root_rejects_mixed_workspace_and_results_roots",
284
+ "tests/test_calibration/test_calibration.py::test_results_dir_can_be_overridden_by_environment",
285
+ "tests/test_calibration/test_calibration.py::test_results_dir_defaults_to_root_results",
286
+ "tests/test_calibration/test_init.py::test_results_dir_can_be_overridden_by_environment",
287
+ "tests/test_calibration/test_init.py::test_results_dir_defaults_to_root_results",
288
+ "tests/test_calibration/test_report.py::test_cell_stats_counts_forced_and_natural_lengths",
289
+ "tests/test_calibration/test_report.py::test_load_grid_does_not_mistake_frame_count_dirs_for_budgets",
290
+ "tests/test_calibration/test_report.py::test_load_grid_includes_variant_budget_directories",
291
+ "tests/test_calibration/test_report.py::test_load_grid_reads_the_full_config_layout",
292
+ "tests/test_calibration/test_report.py::test_recommendation_picks_smallest_saturated_low_forced_budget",
293
+ "tests/test_calibration/test_report.py::test_recommendation_rejects_high_forced_rate_even_at_best_accuracy",
294
+ "tests/test_calibration/test_report.py::test_report_scores_only_the_shared_question_intersection",
295
+ "tests/test_calibration/test_report.py::test_variant_rows_are_never_recommended",
296
+ "tests/test_calibration/test_run.py::test_build_plan_orders_cheapest_budget_first",
297
+ "tests/test_calibration/test_run.py::test_cli_rejects_nonpositive_budget",
298
+ "tests/test_calibration/test_run.py::test_cli_requires_exactly_one_question_source",
299
+ "tests/test_calibration/test_run.py::test_results_dir_isolates_every_pilot_axis",
300
+ "tests/test_calibration/test_run.py::test_run_grid_passes_budget_questions_and_isolated_dir",
301
+ "tests/test_calibration/test_run.py::test_scenes_for_derives_scenes_and_rejects_unknown_ids",
302
+ "tests/test_corruption/test_chimera.py::test_chimeras_do_not_mutate_inputs",
303
+ "tests/test_corruption/test_chimera.py::test_gt_inventory_keeps_gt_counts_but_takes_perceived_boxes",
304
+ "tests/test_corruption/test_chimera.py::test_perceived_inventory_keeps_perceived_counts_but_takes_gt_boxes",
305
+ "tests/test_corruption/test_chimera.py::test_perturb_single_object_changes_exactly_one_instance",
306
+ "tests/test_corruption/test_chimera.py::test_perturb_single_object_empty_code_is_a_noop",
307
+ "tests/test_corruption/test_corruption.py::test_corruption_defaults_are_explicit",
308
+ "tests/test_corruption/test_corruption.py::test_results_dir_can_be_overridden_by_environment",
309
+ "tests/test_corruption/test_empirical.py::test_empirical_noise_applies_sampled_residuals",
310
+ "tests/test_corruption/test_empirical.py::test_empirical_noise_at_zero_scale_is_identity",
311
+ "tests/test_corruption/test_empirical.py::test_empirical_noise_is_reproducible",
312
+ "tests/test_corruption/test_empirical.py::test_measure_residuals_dimension_ratios",
313
+ "tests/test_corruption/test_empirical.py::test_measure_residuals_matches_missed_and_hallucinated",
314
+ "tests/test_corruption/test_init.py::test_corruption_defaults_are_explicit",
315
+ "tests/test_corruption/test_init.py::test_results_dir_can_be_overridden_by_environment",
316
+ "tests/test_corruption/test_launch.py::test_launch_imports",
317
+ "tests/test_corruption/test_launch.py::test_launch_rejects_unknown_transform",
318
+ "tests/test_corruption/test_launch.py::test_launch_runs_the_full_grid_through_run_solver",
319
+ "tests/test_corruption/test_launch.py::test_launch_vlm_arm_requires_models",
320
+ "tests/test_corruption/test_run.py::test_certify_rejects_non_invariance_transforms",
321
+ "tests/test_corruption/test_run.py::test_certify_translate_passes_on_a_real_scene",
322
+ "tests/test_corruption/test_run.py::test_chimera_requires_perceived_config",
323
+ "tests/test_corruption/test_run.py::test_corrupted_code_is_reproducible",
324
+ "tests/test_corruption/test_run.py::test_corrupted_explicit_is_derived_from_the_corrupted_compact",
325
+ "tests/test_corruption/test_run.py::test_empirical_requires_residuals",
326
+ "tests/test_corruption/test_run.py::test_make_code_transform_ignores_the_loaded_code",
327
+ "tests/test_corruption/test_run.py::test_non_probe_runs_write_no_sidecar",
328
+ "tests/test_corruption/test_run.py::test_results_dir_for_isolates_every_axis",
329
+ "tests/test_corruption/test_run.py::test_run_solver_answers_and_writes_records",
330
+ "tests/test_corruption/test_run.py::test_run_solver_respects_the_question_sample",
331
+ "tests/test_corruption/test_run.py::test_run_solver_zero_magnitude_jitter_matches_clean_ground_truth",
332
+ "tests/test_corruption/test_run.py::test_seed_is_deterministic_and_condition_specific",
333
+ "tests/test_corruption/test_run.py::test_single_object_info_is_deterministic_and_recomputable",
334
+ "tests/test_corruption/test_run.py::test_single_object_solver_run_writes_perturbation_sidecar",
335
+ "tests/test_corruption/test_run.py::test_unknown_transform_rejected",
336
+ "tests/test_corruption/test_run.py::test_wrong_scene_requires_a_substitute",
337
+ "tests/test_corruption/test_run.py::test_wrong_scene_returns_the_substitute_scenes_code",
338
+ "tests/test_corruption/test_sample.py::test_budget_key_pools_direction_subtypes",
339
+ "tests/test_corruption/test_sample.py::test_draw_sample_budget_caps_the_draw",
340
+ "tests/test_corruption/test_sample.py::test_draw_sample_excludes_unlisted_categories_and_scenes",
341
+ "tests/test_corruption/test_sample.py::test_draw_sample_is_deterministic_for_the_frozen_seed",
342
+ "tests/test_corruption/test_sample.py::test_draw_sample_spreads_across_scenes_round_robin",
343
+ "tests/test_corruption/test_transforms.py::test_class_swap_keeps_geometry_but_relabels",
344
+ "tests/test_corruption/test_transforms.py::test_dimension_noise_never_collapses_a_dimension",
345
+ "tests/test_corruption/test_transforms.py::test_drop_objects_removes_emptied_classes_entirely",
346
+ "tests/test_corruption/test_transforms.py::test_drop_objects_zero_fraction_drops_nothing",
347
+ "tests/test_corruption/test_transforms.py::test_hallucinate_objects_only_ever_adds",
348
+ "tests/test_corruption/test_transforms.py::test_position_jitter_moves_centers_and_nothing_else",
349
+ "tests/test_corruption/test_transforms.py::test_position_jitter_zero_sigma_is_identity_geometry",
350
+ "tests/test_corruption/test_transforms.py::test_reorder_changes_only_order",
351
+ "tests/test_corruption/test_transforms.py::test_rotate_z_preserves_pairwise_distances",
352
+ "tests/test_corruption/test_transforms.py::test_round_precision_rounds_every_geometry_value",
353
+ "tests/test_corruption/test_transforms.py::test_seeded_transforms_are_reproducible",
354
+ "tests/test_corruption/test_transforms.py::test_transforms_never_mutate_the_input",
355
+ "tests/test_corruption/test_transforms.py::test_translate_shifts_centers_and_polygons_together",
356
  "tests/test_encoder/test_adapters.py::test_adapt_sam3_depth_anything_3_decodes_masks_and_backprojects",
357
  "tests/test_encoder/test_adapters.py::test_adapt_segvggt_reads_flat_npz",
358
  "tests/test_encoder/test_adapters.py::test_adapt_segvggt_rejects_missing_npz_fields",
 
361
  "tests/test_encoder/test_adapters.py::test_adapters_default_to_root_data_caches",
362
  "tests/test_encoder/test_adapters.py::test_backproject_resizes_sam3_mask_to_da3_depth_shape",
363
  "tests/test_encoder/test_adapters.py::test_fusion_adapter_resolves_two_native_model_directories",
364
+ "tests/test_encoder/test_adapters.py::test_native_fusion_times_are_measured_in_seconds",
365
  "tests/test_encoder/test_adapters.py::test_native_sam3_decodes_lossless_tracking_cache",
366
  "tests/test_encoder/test_adapters.py::test_native_sam3_decodes_prompt_keyed_independent_frames",
367
  "tests/test_encoder/test_adapters.py::test_native_sam3_preserves_tracked_object_ids",
368
  "tests/test_encoder/test_adapters.py::test_registry_decodes_native_segvggt_dictionary",
369
+ "tests/test_encoder/test_adapters.py::test_spatial_code_format_validation",
370
  "tests/test_encoder/test_adapters.py::test_validate_identifies_empty_scene",
371
  "tests/test_encoder/test_adapters.py::test_validate_normalizes_canonical_geometry",
372
  "tests/test_encoder/test_adapters.py::test_validate_rejects_invalid_geometry[scene0-TypeError]",
373
  "tests/test_encoder/test_adapters.py::test_validate_rejects_invalid_geometry[scene1-ValueError]",
374
  "tests/test_encoder/test_adapters.py::test_validate_rejects_invalid_geometry[scene2-ValueError]",
375
  "tests/test_encoder/test_config.py::test_cache_and_code_paths_are_flat",
376
+ "tests/test_encoder/test_config.py::test_encoder_paths_mirror_all_dimensions",
377
+ "tests/test_encoder/test_config.py::test_encoder_paths_reject_unknown_spatial_code_format",
378
+ "tests/test_encoder/test_config.py::test_ground_truth_paths_have_no_depth_tracking_input_frames_axis",
379
+ "tests/test_encoder/test_config.py::test_ground_truth_paths_reject_unknown_spatial_code_format",
380
  "tests/test_encoder/test_config.py::test_mode_paths_are_isolated[selective-no-tracking-selective/no tracking]",
381
  "tests/test_encoder/test_config.py::test_mode_paths_are_isolated[uniform-tracking-uniform/tracking]",
382
  "tests/test_encoder/test_config.py::test_parse_frame_mode_rejects_video_modes",
 
389
  "tests/test_encoder/test_encoder.py::test_depth_edges_handles_small_and_discontinuous_frames",
390
  "tests/test_encoder/test_encoder.py::test_relative_direction_modes",
391
  "tests/test_encoder/test_encoder.py::test_robust_centroid_extent_returns_sorted_dimensions",
392
+ "tests/test_encoder/test_geometric.py::test_compact_floor_boundaries_preserve_disconnected_regions",
393
+ "tests/test_encoder/test_geometric.py::test_compact_instances_keep_peak_co_visible_hypotheses_by_evidence",
394
+ "tests/test_encoder/test_geometric.py::test_compact_oriented_box_combines_observation_extents_by_consensus",
395
+ "tests/test_encoder/test_geometric.py::test_compact_oriented_box_rejects_one_inconsistent_observation",
396
+ "tests/test_encoder/test_geometric.py::test_compact_oriented_box_uses_accumulated_instance_points",
397
+ "tests/test_encoder/test_geometric.py::test_compact_spatial_code_exposes_only_reusable_primitives",
398
+ "tests/test_encoder/test_geometric.py::test_compact_spatial_code_merges_revisit_instances_and_keeps_earliest_time",
399
+ "tests/test_encoder/test_geometric.py::test_compact_spatial_code_suppresses_co_visible_duplicate_tracks",
400
  "tests/test_encoder/test_geometric.py::test_dump_spatial_code",
401
  "tests/test_encoder/test_geometric.py::test_dumped_json_preserves_schema",
402
  "tests/test_encoder/test_geometric.py::test_exact_math_is_integrated_into_geometric_module",
403
+ "tests/test_encoder/test_geometric.py::test_explicit_is_a_derivation_of_compact",
404
+ "tests/test_encoder/test_geometric.py::test_explicit_spatial_code_remains_the_default",
405
  "tests/test_encoder/test_geometric.py::test_floor_level_v1_v2_math_is_shared",
406
  "tests/test_encoder/test_geometric.py::test_position_reader_accepts_current_and_legacy_formatting",
407
+ "tests/test_encoder/test_geometric.py::test_raw_bundle_dispatches_to_explicit_derivation",
408
  "tests/test_encoder/test_geometric.py::test_raw_bundle_dispatches_to_integrated_exact_path",
409
  "tests/test_encoder/test_geometric.py::test_spatial_code_matches_reference_schema",
410
+ "tests/test_encoder/test_ground_truth.py::test_appearance_order_ranks_topological_across_multiple_questions",
411
+ "tests/test_encoder/test_ground_truth.py::test_build_all_respects_explicit_scene_list_and_formats",
412
+ "tests/test_encoder/test_ground_truth.py::test_build_all_writes_every_scene_and_format",
413
+ "tests/test_encoder/test_ground_truth.py::test_build_and_write_writes_to_the_ground_truth_path",
414
+ "tests/test_encoder/test_ground_truth.py::test_build_compact_ground_truth_spatial_code_nulls_untimed_classes",
415
+ "tests/test_encoder/test_ground_truth.py::test_build_compact_ground_truth_spatial_code_raises_for_unknown_scene",
416
+ "tests/test_encoder/test_ground_truth.py::test_build_compact_ground_truth_spatial_code_uses_ranks_and_nulls_unranked",
417
+ "tests/test_encoder/test_ground_truth.py::test_build_explicit_ground_truth_spatial_code_is_derived_from_compact",
418
+ "tests/test_encoder/test_ground_truth.py::test_build_ground_truth_spatial_code_dispatches_by_format",
419
+ "tests/test_encoder/test_ground_truth.py::test_build_ground_truth_spatial_code_rejects_unknown_format",
420
+ "tests/test_encoder/test_ground_truth.py::test_floor_level_accounts_for_tilted_box_support",
421
+ "tests/test_encoder/test_ground_truth.py::test_floor_level_defaults_to_zero_for_empty_scene",
422
+ "tests/test_encoder/test_ground_truth.py::test_floor_level_is_the_lowest_box_support_across_every_instance",
423
+ "tests/test_encoder/test_ground_truth.py::test_gt_floor_boundary_polygon_area_matches_room_size",
424
+ "tests/test_encoder/test_ground_truth.py::test_gt_oriented_box_rebases_height_above_floor_and_passes_xy_through",
425
+ "tests/test_encoder/test_ground_truth.py::test_gt_oriented_box_renormalizes_orientation_vectors",
426
+ "tests/test_encoder/test_ground_truth.py::test_load_meta_info_merges_all_three_datasets_and_tags_dataset",
427
+ "tests/test_encoder/test_ground_truth.py::test_scenes_returns_sorted_meta_info_keys",
428
+ "tests/test_encoder/test_init.py::test_encoder_package_imports_without_data_or_checkpoints",
429
  "tests/test_encoder/test_launch.py::test_available_cpu_count_respects_affinity_and_override",
430
  "tests/test_encoder/test_launch.py::test_cached_scenes_requires_both_sam3_and_da3_caches",
431
  "tests/test_encoder/test_launch.py::test_cached_scenes_requires_segvggt_cache",
432
+ "tests/test_encoder/test_launch.py::test_encoder_launcher_imports",
433
  "tests/test_encoder/test_launch.py::test_main_all_dispatches_every_frame_mode",
434
  "tests/test_encoder/test_launch.py::test_main_dispatches_one_requested_mode",
435
  "tests/test_encoder/test_launch.py::test_main_skips_existing_spatial_codes",
 
440
  "tests/test_encoder/test_launch.py::test_visible_gpus_uses_environment",
441
  "tests/test_encoder/test_launch.py::test_worker_skips_empty_scenes_but_fails_other_errors",
442
  "tests/test_encoder/test_render.py::test_build_spatial_code_uses_cached_geometry",
443
+ "tests/test_encoder/test_render.py::test_render_exposes_tracking_and_format_dimensions",
444
  "tests/test_encoder/test_render.py::test_write_spatial_code_propagates_mode",
445
  "tests/test_encoder/test_render.py::test_write_spatial_code_uses_scene_json",
446
  "tests/test_encoder/test_run.py::test_cache_or_load_builds_and_writes_cache",
447
+ "tests/test_encoder/test_run.py::test_cache_or_load_exposes_explicit_dimensions",
448
  "tests/test_encoder/test_run.py::test_cache_or_load_reads_flat_cache",
449
  "tests/test_encoder/test_run.py::test_fusion_cache_rejects_changed_native_source",
450
  "tests/test_encoder/test_run.py::test_fusion_cache_uses_explicit_mode_inputs",
451
  "tests/test_encoder/test_run.py::test_fusion_requires_mode",
452
+ "tests/test_harness/test_harness.py::test_harness_package_imports_without_side_effects",
453
+ "tests/test_harness/test_init.py::test_harness_package_imports_without_side_effects",
454
+ "tests/test_inference/test_adapters.py::test_algorithm_3_catches_injected_corruption_without_false_positives",
455
+ "tests/test_inference/test_adapters.py::test_algorithm_4_compresses_static_redundancy_at_least_as_well_as_algorithm_1",
456
+ "tests/test_inference/test_adapters.py::test_algorithm_5_output_is_subset_of_algorithm_2_output",
457
  "tests/test_inference/test_adapters.py::test_alignment_failure_falls_back_to_unaligned_ssim",
458
  "tests/test_inference/test_adapters.py::test_alignment_makes_small_camera_shift_redundant",
459
+ "tests/test_inference/test_adapters.py::test_cache_is_invalidated_when_selector_config_changes",
460
  "tests/test_inference/test_adapters.py::test_combined_adapter_gives_both_models_the_same_decoded_frames",
461
  "tests/test_inference/test_adapters.py::test_combined_adapter_runs_only_requested_target",
462
  "tests/test_inference/test_adapters.py::test_da3_preserves_native_prediction_object",
463
  "tests/test_inference/test_adapters.py::test_load_model_validates_repository_and_checkpoint",
464
+ "tests/test_inference/test_adapters.py::test_metric_adapter_is_registered",
465
  "tests/test_inference/test_adapters.py::test_read_video_rejects_unopenable_file",
466
  "tests/test_inference/test_adapters.py::test_redundancy_groups_keep_sharpest_and_earlier_ties",
467
+ "tests/test_inference/test_adapters.py::test_relative_adapter_is_registered",
468
  "tests/test_inference/test_adapters.py::test_run_scene_preserves_raw_dtypes_and_encoder_geometry",
469
  "tests/test_inference/test_adapters.py::test_run_scene_requires_loaded_model",
470
+ "tests/test_inference/test_adapters.py::test_sam3_adapter_accepts_tracking_modes",
471
  "tests/test_inference/test_adapters.py::test_sam3_preserves_independent_image_responses_without_tracking",
472
+ "tests/test_inference/test_adapters.py::test_select_video_frame_indices_rejects_unknown_algorithm",
473
  "tests/test_inference/test_adapters.py::test_selective_sampling_honors_requested_frame_count",
474
+ "tests/test_inference/test_adapters.py::test_selector_algorithm_defaults_to_five",
475
+ "tests/test_inference/test_adapters.py::test_selector_algorithm_dispatch_is_registered[1]",
476
+ "tests/test_inference/test_adapters.py::test_selector_algorithm_dispatch_is_registered[2]",
477
+ "tests/test_inference/test_adapters.py::test_selector_algorithm_dispatch_is_registered[3]",
478
+ "tests/test_inference/test_adapters.py::test_selector_algorithm_dispatch_is_registered[4]",
479
+ "tests/test_inference/test_adapters.py::test_selector_algorithm_dispatch_is_registered[5]",
480
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[1-MINIMUM_ALIGNMENT_INLIER_RATIO]",
481
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[1-MINIMUM_ALIGNMENT_MATCHES]",
482
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[1-MINIMUM_VALID_OVERLAP_FRACTION]",
483
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[1-REDUNDANCY_SSIM_THRESHOLD]",
484
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[2-BLUR_ABSOLUTE_FLOOR]",
485
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[2-BLUR_CANONICAL_WIDTH]",
486
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[2-BLUR_RELATIVE_MEDIAN_FRACTION]",
487
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[2-BRIGHT_MEAN_THRESHOLD]",
488
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[2-DARK_MEAN_THRESHOLD]",
489
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[2-LOW_CONTRAST_STD_THRESHOLD]",
490
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[3-BLACK_FRAME_PIXEL_RATIO_THRESHOLD]",
491
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[3-BLACK_PIXEL_LUMINANCE_THRESHOLD]",
492
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[3-GLITCH_MAX_NEIGHBOR_COVISIBILITY]",
493
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[3-GLITCH_MINIMUM_OWN_KEYPOINTS]",
494
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[3-GLITCH_THUMBNAIL_WIDTH]",
495
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[3-MINIMUM_ALIGNMENT_MATCHES]",
496
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[4-COVISIBILITY_OVERLAP_THRESHOLD]",
497
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[4-MINIMUM_ALIGNMENT_MATCHES]",
498
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[4-REDUNDANCY_SSIM_THRESHOLD]",
499
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[5-BLUR_ABSOLUTE_FLOOR]",
500
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[5-BLUR_CANONICAL_WIDTH]",
501
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[5-BLUR_RELATIVE_MEDIAN_FRACTION]",
502
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[5-BRIGHT_MEAN_THRESHOLD]",
503
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[5-COVISIBILITY_OVERLAP_THRESHOLD]",
504
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[5-DARK_MEAN_THRESHOLD]",
505
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[5-LOW_CONTRAST_STD_THRESHOLD]",
506
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[5-MINIMUM_ALIGNMENT_MATCHES]",
507
+ "tests/test_inference/test_adapters.py::test_selector_config_reflects_every_tunable_constant[5-REDUNDANCY_SSIM_THRESHOLD]",
508
  "tests/test_inference/test_adapters.py::test_tracking_frames_preserve_tracker_object_ids",
509
  "tests/test_inference/test_inference.py::test_adapter_registry",
510
  "tests/test_inference/test_inference.py::test_combined_run_resumes_only_missing_target",
511
  "tests/test_inference/test_inference.py::test_frame_modes_are_complete_and_parseable",
512
  "tests/test_inference/test_inference.py::test_local_model_roots_are_exact",
513
+ "tests/test_inference/test_inference.py::test_model_registry_uses_explicit_names",
514
  "tests/test_inference/test_inference.py::test_native_output_paths_are_isolated_by_mode",
515
+ "tests/test_inference/test_inference.py::test_output_paths_include_frame_hierarchy",
516
  "tests/test_inference/test_inference.py::test_run_scene_builds_then_skips_selected_mode",
517
  "tests/test_inference/test_inference.py::test_scenes_deduplicates_manifest",
518
  "tests/test_inference/test_inference.py::test_visible_gpus_uses_environment",
519
+ "tests/test_inference/test_init.py::test_cache_dir_helpers_validate_axes_and_include_dimensions",
520
+ "tests/test_inference/test_init.py::test_video_path_finds_exact_dataset_match",
521
+ "tests/test_inference/test_init.py::test_video_path_reports_missing_unknown_and_ambiguous_datasets",
522
  "tests/test_inference/test_launch.py::test_available_cpu_count_respects_affinity_and_override",
523
+ "tests/test_inference/test_launch.py::test_launcher_imports",
524
  "tests/test_inference/test_launch.py::test_main_requires_mode_or_all",
525
  "tests/test_inference/test_launch.py::test_main_runs_only_requested_modes_or_all",
526
  "tests/test_inference/test_launch.py::test_scenes_deduplicate_manifest",
 
528
  "tests/test_inference/test_launch.py::test_visible_gpus_uses_environment",
529
  "tests/test_inference/test_launch.py::test_worker_loads_tracking_adapter_once_and_reuses_it",
530
  "tests/test_inference/test_launch.py::test_worker_reports_model_load_failure_for_every_scene",
531
+ "tests/test_inference/test_prompts.py::test_dataset_from_video_path_matches_one_dataset_case_insensitively",
532
+ "tests/test_inference/test_prompts.py::test_dataset_from_video_path_rejects_missing_or_ambiguous_dataset",
533
+ "tests/test_inference/test_prompts.py::test_object_prompts_are_immutable_and_dataset_specific",
534
  "tests/test_inference/test_run.py::test_real_segvggt_scene_preserves_native_prediction_dictionary",
535
+ "tests/test_symbolic/test_adapters.py::test_adapter_rejects_format_mismatch",
536
+ "tests/test_symbolic/test_adapters.py::test_compact_adapter_derives_solver_values_from_primitives",
537
+ "tests/test_symbolic/test_adapters.py::test_compact_adapter_ignores_none_instances_within_a_partially_timed_class",
538
+ "tests/test_symbolic/test_adapters.py::test_compact_adapter_treats_none_first_visible_time_as_unknown",
539
+ "tests/test_symbolic/test_adapters.py::test_explicit_adapter_preserves_existing_solver_shape",
540
+ "tests/test_symbolic/test_adapters.py::test_floor_area_sums_disconnected_polygons_and_subtracts_all_holes",
541
+ "tests/test_symbolic/test_adapters.py::test_oriented_box_distance_is_surface_to_surface",
542
+ "tests/test_symbolic/test_adapters.py::test_oriented_box_distance_uses_corresponding_rotated_axes",
543
+ "tests/test_symbolic/test_adapters.py::test_polygon_area_implicitly_closes_ordered_boundary",
544
+ "tests/test_symbolic/test_adapters.py::test_symbolic_solver_answers_all_direction_levels_from_compact_code",
545
+ "tests/test_symbolic/test_adapters.py::test_symbolic_solver_answers_numeric_categories_from_compact_code",
546
+ "tests/test_symbolic/test_adapters.py::test_symbolic_solver_answers_relative_distance_and_order_from_compact_code",
547
+ "tests/test_symbolic/test_adapters.py::test_symbolic_solver_answers_route_planning_from_compact_code",
548
  "tests/test_symbolic/test_launch.py::test_error_analysis_rejects_non_numeric_question_type",
549
  "tests/test_symbolic/test_launch.py::test_error_analysis_summarizes_numeric_errors",
550
  "tests/test_symbolic/test_launch.py::test_main_all_runs_every_frame_mode",
551
  "tests/test_symbolic/test_launch.py::test_mca_answer_breakdown_distinguishes_outcomes",
552
  "tests/test_symbolic/test_launch.py::test_scenes_with_spatial_codes_returns_sorted_stems",
553
+ "tests/test_symbolic/test_launch.py::test_symbolic_launcher_imports",
554
  "tests/test_symbolic/test_run.py::test_fetch_spatial_code_reads_flat_json",
555
  "tests/test_symbolic/test_run.py::test_fetch_spatial_code_reports_missing_file",
556
+ "tests/test_symbolic/test_run.py::test_fetch_spatial_code_uses_selected_format_adapter",
557
  "tests/test_symbolic/test_run.py::test_find_workspace_root_uses_spatial_codes_folder",
558
  "tests/test_symbolic/test_run.py::test_parse_frame_mode_rejects_video_mode",
559
  "tests/test_symbolic/test_run.py::test_question_result_records_selected_frame_mode",
560
  "tests/test_symbolic/test_run.py::test_real_questions_for_scene_filters_jsonl",
561
+ "tests/test_symbolic/test_run.py::test_results_dir_for_selection_uses_ground_truth_layout",
562
+ "tests/test_symbolic/test_run.py::test_select_ground_truth_spatial_codes_points_at_the_ground_truth_directory",
563
+ "tests/test_symbolic/test_run.py::test_select_ground_truth_spatial_codes_rejects_unknown_format",
564
  "tests/test_symbolic/test_run.py::test_select_model_reads_frame_mode_subfolder[selective-no-tracking-frames/selective/no tracking]",
565
  "tests/test_symbolic/test_run.py::test_select_model_reads_frame_mode_subfolder[selective-tracking-frames/selective/tracking]",
566
  "tests/test_symbolic/test_run.py::test_select_model_reads_frame_mode_subfolder[uniform-no-tracking-frames/uniform/no tracking]",
567
  "tests/test_symbolic/test_run.py::test_select_model_reads_frame_mode_subfolder[uniform-tracking-frames/uniform/tracking]",
568
  "tests/test_symbolic/test_run.py::test_select_model_reads_fusion_subfolder",
569
+ "tests/test_symbolic/test_run.py::test_select_spatial_codes_clears_ground_truth_flag",
570
  "tests/test_symbolic/test_run.py::test_symbolic_results_are_isolated_by_model_and_mode",
571
  "tests/test_symbolic/test_run.py::test_symbolic_results_mirror_frame_mode_cache_layout",
572
+ "tests/test_symbolic/test_run.py::test_symbolic_selection_isolates_compact_codes",
573
+ "tests/test_symbolic/test_run.py::test_symbolic_selection_uses_new_hierarchy",
574
+ "tests/test_symbolic/test_run.py::test_write_question_result_nulls_perception_fields_under_ground_truth",
575
  "tests/test_symbolic/test_run.py::test_write_scene_results_uses_one_file_per_question",
576
+ "tests/test_symbolic/test_solver.py::test_answer_snapshots_operation_counts_per_question",
577
  "tests/test_symbolic/test_solver.py::test_direct_numeric_answers",
578
  "tests/test_symbolic/test_solver.py::test_direction_answers_use_floor_coordinates",
579
  "tests/test_symbolic/test_solver.py::test_dispatch_returns_none_for_unknown_or_missing_data",
analysis/A_reports.py CHANGED
@@ -1,9 +1,34 @@
1
  """Generate the high-level within-A report."""
 
2
  import argparse
3
  from pathlib import Path
4
  from analysis.letters_reports import generate_letter
5
- LETTER='A'
6
- def generate(results_dir,protocols=(),output_dir=None,spatial_codes_dir=None,profile_path=None): return generate_letter(LETTER,results_dir,protocols,output_dir,spatial_codes_dir,profile_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  def main():
8
- p=argparse.ArgumentParser(description='Generate the high-level within-A report.'); p.add_argument('--results-dir',default='/root/results/A'); p.add_argument('--protocol',action='append',default=[]); p.add_argument('--output-dir',default='/workspace/reports'); p.add_argument('--spatial-codes-dir',default=None); a=p.parse_args(); result=generate(a.results_dir,a.protocol,a.output_dir,a.spatial_codes_dir); print(f"wrote {result['path']}")
9
- if __name__=='__main__': main()
 
 
 
 
 
 
 
 
 
 
 
1
  """Generate the high-level within-A report."""
2
+
3
  import argparse
4
  from pathlib import Path
5
  from analysis.letters_reports import generate_letter
6
+
7
+ LETTER = "A"
8
+
9
+
10
+ def generate(
11
+ results_dir,
12
+ protocols=(),
13
+ output_dir=None,
14
+ spatial_codes_dir=None,
15
+ profile_path=None,
16
+ ):
17
+ return generate_letter(
18
+ LETTER, results_dir, protocols, output_dir, spatial_codes_dir, profile_path
19
+ )
20
+
21
+
22
  def main():
23
+ p = argparse.ArgumentParser(description="Generate the high-level within-A report.")
24
+ p.add_argument("--results-dir", default="/root/results/A")
25
+ p.add_argument("--protocol", action="append", default=[])
26
+ p.add_argument("--output-dir", default="/workspace/reports")
27
+ p.add_argument("--spatial-codes-dir", default=None)
28
+ a = p.parse_args()
29
+ result = generate(a.results_dir, a.protocol, a.output_dir, a.spatial_codes_dir)
30
+ print(f"wrote {result['path']}")
31
+
32
+
33
+ if __name__ == "__main__":
34
+ main()
analysis/B_reports.py CHANGED
@@ -1,9 +1,34 @@
1
  """Generate the high-level within-B report."""
 
2
  import argparse
3
  from pathlib import Path
4
  from analysis.letters_reports import generate_letter
5
- LETTER='B'
6
- def generate(results_dir,protocols=(),output_dir=None,spatial_codes_dir=None,profile_path=None): return generate_letter(LETTER,results_dir,protocols,output_dir,spatial_codes_dir,profile_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  def main():
8
- p=argparse.ArgumentParser(description='Generate the high-level within-B report.'); p.add_argument('--results-dir',default='/root/results/B'); p.add_argument('--protocol',action='append',default=[]); p.add_argument('--output-dir',default='/workspace/reports'); p.add_argument('--spatial-codes-dir',default=None); a=p.parse_args(); result=generate(a.results_dir,a.protocol,a.output_dir,a.spatial_codes_dir); print(f"wrote {result['path']}")
9
- if __name__=='__main__': main()
 
 
 
 
 
 
 
 
 
 
 
1
  """Generate the high-level within-B report."""
2
+
3
  import argparse
4
  from pathlib import Path
5
  from analysis.letters_reports import generate_letter
6
+
7
+ LETTER = "B"
8
+
9
+
10
+ def generate(
11
+ results_dir,
12
+ protocols=(),
13
+ output_dir=None,
14
+ spatial_codes_dir=None,
15
+ profile_path=None,
16
+ ):
17
+ return generate_letter(
18
+ LETTER, results_dir, protocols, output_dir, spatial_codes_dir, profile_path
19
+ )
20
+
21
+
22
  def main():
23
+ p = argparse.ArgumentParser(description="Generate the high-level within-B report.")
24
+ p.add_argument("--results-dir", default="/root/results/B")
25
+ p.add_argument("--protocol", action="append", default=[])
26
+ p.add_argument("--output-dir", default="/workspace/reports")
27
+ p.add_argument("--spatial-codes-dir", default=None)
28
+ a = p.parse_args()
29
+ result = generate(a.results_dir, a.protocol, a.output_dir, a.spatial_codes_dir)
30
+ print(f"wrote {result['path']}")
31
+
32
+
33
+ if __name__ == "__main__":
34
+ main()
analysis/C_reports.py CHANGED
@@ -1,9 +1,34 @@
1
  """Generate the high-level within-C report."""
 
2
  import argparse
3
  from pathlib import Path
4
  from analysis.letters_reports import generate_letter
5
- LETTER='C'
6
- def generate(results_dir,protocols=(),output_dir=None,spatial_codes_dir=None,profile_path=None): return generate_letter(LETTER,results_dir,protocols,output_dir,spatial_codes_dir,profile_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  def main():
8
- p=argparse.ArgumentParser(description='Generate the high-level within-C report.'); p.add_argument('--results-dir',default='/root/results/C'); p.add_argument('--protocol',action='append',default=[]); p.add_argument('--output-dir',default='/workspace/reports'); p.add_argument('--spatial-codes-dir',default=None); a=p.parse_args(); result=generate(a.results_dir,a.protocol,a.output_dir,a.spatial_codes_dir); print(f"wrote {result['path']}")
9
- if __name__=='__main__': main()
 
 
 
 
 
 
 
 
 
 
 
1
  """Generate the high-level within-C report."""
2
+
3
  import argparse
4
  from pathlib import Path
5
  from analysis.letters_reports import generate_letter
6
+
7
+ LETTER = "C"
8
+
9
+
10
+ def generate(
11
+ results_dir,
12
+ protocols=(),
13
+ output_dir=None,
14
+ spatial_codes_dir=None,
15
+ profile_path=None,
16
+ ):
17
+ return generate_letter(
18
+ LETTER, results_dir, protocols, output_dir, spatial_codes_dir, profile_path
19
+ )
20
+
21
+
22
  def main():
23
+ p = argparse.ArgumentParser(description="Generate the high-level within-C report.")
24
+ p.add_argument("--results-dir", default="/root/results/C")
25
+ p.add_argument("--protocol", action="append", default=[])
26
+ p.add_argument("--output-dir", default="/workspace/reports")
27
+ p.add_argument("--spatial-codes-dir", default=None)
28
+ a = p.parse_args()
29
+ result = generate(a.results_dir, a.protocol, a.output_dir, a.spatial_codes_dir)
30
+ print(f"wrote {result['path']}")
31
+
32
+
33
+ if __name__ == "__main__":
34
+ main()
analysis/D_reports.py CHANGED
@@ -1,9 +1,34 @@
1
  """Generate the high-level within-D report."""
 
2
  import argparse
3
  from pathlib import Path
4
  from analysis.letters_reports import generate_letter
5
- LETTER='D'
6
- def generate(results_dir,protocols=(),output_dir=None,spatial_codes_dir=None,profile_path=None): return generate_letter(LETTER,results_dir,protocols,output_dir,spatial_codes_dir,profile_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  def main():
8
- p=argparse.ArgumentParser(description='Generate the high-level within-D report.'); p.add_argument('--results-dir',default='/root/results/D'); p.add_argument('--protocol',action='append',default=[]); p.add_argument('--output-dir',default='/workspace/reports'); p.add_argument('--spatial-codes-dir',default=None); a=p.parse_args(); result=generate(a.results_dir,a.protocol,a.output_dir,a.spatial_codes_dir); print(f"wrote {result['path']}")
9
- if __name__=='__main__': main()
 
 
 
 
 
 
 
 
 
 
 
1
  """Generate the high-level within-D report."""
2
+
3
  import argparse
4
  from pathlib import Path
5
  from analysis.letters_reports import generate_letter
6
+
7
+ LETTER = "D"
8
+
9
+
10
+ def generate(
11
+ results_dir,
12
+ protocols=(),
13
+ output_dir=None,
14
+ spatial_codes_dir=None,
15
+ profile_path=None,
16
+ ):
17
+ return generate_letter(
18
+ LETTER, results_dir, protocols, output_dir, spatial_codes_dir, profile_path
19
+ )
20
+
21
+
22
  def main():
23
+ p = argparse.ArgumentParser(description="Generate the high-level within-D report.")
24
+ p.add_argument("--results-dir", default="/root/results/D")
25
+ p.add_argument("--protocol", action="append", default=[])
26
+ p.add_argument("--output-dir", default="/workspace/reports")
27
+ p.add_argument("--spatial-codes-dir", default=None)
28
+ a = p.parse_args()
29
+ result = generate(a.results_dir, a.protocol, a.output_dir, a.spatial_codes_dir)
30
+ print(f"wrote {result['path']}")
31
+
32
+
33
+ if __name__ == "__main__":
34
+ main()
analysis/F_reports.py CHANGED
@@ -1,9 +1,34 @@
1
  """Generate the high-level within-F report."""
 
2
  import argparse
3
  from pathlib import Path
4
  from analysis.letters_reports import generate_letter
5
- LETTER='F'
6
- def generate(results_dir,protocols=(),output_dir=None,spatial_codes_dir=None,profile_path=None): return generate_letter(LETTER,results_dir,protocols,output_dir,spatial_codes_dir,profile_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  def main():
8
- p=argparse.ArgumentParser(description='Generate the high-level within-F report.'); p.add_argument('--results-dir',default='/root/results/F'); p.add_argument('--protocol',action='append',default=[]); p.add_argument('--output-dir',default='/workspace/reports'); p.add_argument('--spatial-codes-dir',default=None); a=p.parse_args(); result=generate(a.results_dir,a.protocol,a.output_dir,a.spatial_codes_dir); print(f"wrote {result['path']}")
9
- if __name__=='__main__': main()
 
 
 
 
 
 
 
 
 
 
 
1
  """Generate the high-level within-F report."""
2
+
3
  import argparse
4
  from pathlib import Path
5
  from analysis.letters_reports import generate_letter
6
+
7
+ LETTER = "F"
8
+
9
+
10
+ def generate(
11
+ results_dir,
12
+ protocols=(),
13
+ output_dir=None,
14
+ spatial_codes_dir=None,
15
+ profile_path=None,
16
+ ):
17
+ return generate_letter(
18
+ LETTER, results_dir, protocols, output_dir, spatial_codes_dir, profile_path
19
+ )
20
+
21
+
22
  def main():
23
+ p = argparse.ArgumentParser(description="Generate the high-level within-F report.")
24
+ p.add_argument("--results-dir", default="/root/results/F")
25
+ p.add_argument("--protocol", action="append", default=[])
26
+ p.add_argument("--output-dir", default="/workspace/reports")
27
+ p.add_argument("--spatial-codes-dir", default=None)
28
+ a = p.parse_args()
29
+ result = generate(a.results_dir, a.protocol, a.output_dir, a.spatial_codes_dir)
30
+ print(f"wrote {result['path']}")
31
+
32
+
33
+ if __name__ == "__main__":
34
+ main()
analysis/__pycache__/A_reports.cpython-311.pyc CHANGED
Binary files a/analysis/__pycache__/A_reports.cpython-311.pyc and b/analysis/__pycache__/A_reports.cpython-311.pyc differ
 
analysis/__pycache__/B_reports.cpython-311.pyc CHANGED
Binary files a/analysis/__pycache__/B_reports.cpython-311.pyc and b/analysis/__pycache__/B_reports.cpython-311.pyc differ
 
analysis/__pycache__/C_reports.cpython-311.pyc CHANGED
Binary files a/analysis/__pycache__/C_reports.cpython-311.pyc and b/analysis/__pycache__/C_reports.cpython-311.pyc differ
 
analysis/__pycache__/D_reports.cpython-311.pyc CHANGED
Binary files a/analysis/__pycache__/D_reports.cpython-311.pyc and b/analysis/__pycache__/D_reports.cpython-311.pyc differ
 
analysis/__pycache__/letters_reports.cpython-311.pyc CHANGED
Binary files a/analysis/__pycache__/letters_reports.cpython-311.pyc and b/analysis/__pycache__/letters_reports.cpython-311.pyc differ
 
analysis/letters_reports.py CHANGED
@@ -5,10 +5,12 @@ lengths, latency, limit/forced rates, spatial-code size for B/C, score relations
5
  and pairwise deltas on exact question intersections. Stored per-question scores are
6
  used directly; ``mean_score`` is not the category-weighted official VSI overall.
7
  """
 
8
  from __future__ import annotations
9
 
10
  import argparse
11
  import json
 
12
  import math
13
  import statistics
14
  import random
@@ -19,11 +21,18 @@ from pathlib import Path
19
  ROOT = Path(__file__).resolve().parent.parent
20
  DEFAULT_DIRS = {h: Path("/root/results") / h for h in "ABC"}
21
  NUMERIC_FIELDS = (
22
- "input_token_count", "output_token_count", "reasoning_token_count",
23
- "generation_seconds", "forced_input_token_count",
 
 
 
24
  )
25
  TEXT_FIELDS = (
26
- "answer_given", "answer_raw", "reasoning_text", "full_prompt", "rendered_prompt",
 
 
 
 
27
  )
28
 
29
 
@@ -37,7 +46,11 @@ def iter_records(directory):
37
  record = json.load(stream)
38
  except (OSError, json.JSONDecodeError):
39
  continue
40
- if isinstance(record, dict) and "question_id" in record and "condition" in record:
 
 
 
 
41
  yield record
42
 
43
 
@@ -54,14 +67,20 @@ def cell_identity(harness, record):
54
  protocol = record.get("protocol") or record["condition"].split(":", 1)[0]
55
  selection = record.get("frame_selection", record.get("input_selection"))
56
  common = {
57
- "harness": harness, "model": record.get("model"), "protocol": protocol,
58
- "selection": selection, "frames": str(record.get("frame_count")),
 
 
 
59
  }
60
  if harness in ("B", "C"):
61
- common.update({
62
- "format": record.get("spatial_code_format"), "depth": record.get("depth"),
63
- "tracking": record.get("tracking"),
64
- })
 
 
 
65
  return tuple(sorted(common.items()))
66
 
67
 
@@ -71,7 +90,13 @@ def identity_dict(identity):
71
 
72
  def cell_label(identity):
73
  d = identity_dict(identity)
74
- parts = [d["harness"], d.get("model"), d.get("protocol"), d.get("selection"), d.get("frames")]
 
 
 
 
 
 
75
  if d["harness"] in ("B", "C"):
76
  parts += [d.get("format"), d.get("depth"), d.get("tracking")]
77
  return "/".join("?" if value is None else str(value) for value in parts)
@@ -86,7 +111,11 @@ def _numbers(records, getter):
86
  out = []
87
  for record in records:
88
  value = getter(record)
89
- if isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value):
 
 
 
 
90
  out.append(float(value))
91
  return out
92
 
@@ -95,30 +124,44 @@ def numeric_summary(values):
95
  values = sorted(values)
96
  if not values:
97
  return None
 
98
  def percentile(p):
99
  position = (len(values) - 1) * p
100
  low, high = math.floor(position), math.ceil(position)
101
  if low == high:
102
  return values[low]
103
  return values[low] + (values[high] - values[low]) * (position - low)
 
104
  return {
105
- "n": len(values), "mean": statistics.mean(values), "median": statistics.median(values),
106
- "min": values[0], "p25": percentile(.25), "p75": percentile(.75), "max": values[-1],
 
 
 
 
 
107
  "stdev": statistics.stdev(values) if len(values) > 1 else 0.0,
108
  }
109
 
110
 
111
  def pearson(xs, ys):
112
- pairs = [(float(x), float(y)) for x, y in zip(xs, ys)
113
- if isinstance(x, (int, float)) and isinstance(y, (int, float))
114
- and not isinstance(x, bool) and not isinstance(y, bool)
115
- and math.isfinite(x) and math.isfinite(y)]
 
 
 
 
 
 
116
  if len(pairs) < 2:
117
  return None
118
- x, y = zip(*pairs); mx, my = statistics.mean(x), statistics.mean(y)
 
119
  dx, dy = [v - mx for v in x], [v - my for v in y]
120
- denom = math.sqrt(sum(v*v for v in dx) * sum(v*v for v in dy))
121
- return sum(a*b for a, b in zip(dx, dy)) / denom if denom else None
122
 
123
 
124
  def spatial_code_bytes(record, cache):
@@ -140,8 +183,11 @@ def breakdown(records, field):
140
  return {
141
  name: {
142
  "count": len(group),
143
- "mean_score": numeric_summary(_numbers(group, lambda r: r.get("score")))["mean"]
144
- if _numbers(group, lambda r: r.get("score")) else None,
 
 
 
145
  "scenes": len({r.get("scene") for r in group}),
146
  }
147
  for name, group in sorted(groups.items())
@@ -150,17 +196,31 @@ def breakdown(records, field):
150
 
151
  def summarize_cell(records, code_cache):
152
  scores = _numbers(records, lambda r: r.get("score"))
153
- numeric = {field: numeric_summary(_numbers(records, lambda r, f=field: r.get(f)))
154
- for field in NUMERIC_FIELDS}
155
- text = {field + "_chars": numeric_summary(_numbers(
156
- records, lambda r, f=field: len(r[f]) if isinstance(r.get(f), str) else None
157
- )) for field in TEXT_FIELDS}
 
 
 
 
 
 
 
 
 
158
  code_sizes = _numbers(records, lambda r: spatial_code_bytes(r, code_cache))
159
  relationships = {}
160
  measures = {
161
  **{field: lambda r, f=field: r.get(f) for field in NUMERIC_FIELDS},
162
- **{field + "_chars": lambda r, f=field: len(r[f]) if isinstance(r.get(f), str) else None
163
- for field in TEXT_FIELDS},
 
 
 
 
 
164
  "spatial_code_bytes": lambda r: spatial_code_bytes(r, code_cache),
165
  }
166
  for name, getter in measures.items():
@@ -169,22 +229,42 @@ def summarize_cell(records, code_cache):
169
  [p[1] for p in pairs], [p[0] for p in pairs]
170
  )
171
  return {
172
- "questions": len(records), "unique_question_ids": len({r["question_id"] for r in records}),
 
173
  "scenes": len({r.get("scene") for r in records}),
174
  "mean_score": statistics.mean(scores) if scores else None,
175
  "score_distribution": numeric_summary(scores),
176
  "question_types": breakdown(records, "question_type"),
177
  "datasets": breakdown(records, "dataset"),
178
- "numeric": numeric, "text_lengths": text,
 
179
  "rates": {
180
- "hit_token_limit": statistics.mean(bool(r.get("hit_token_limit")) for r in records) if records else None,
181
- "reasoning_hit_limit": statistics.mean(bool(r.get("reasoning_hit_limit")) for r in records) if records else None,
182
- "forced": statistics.mean(bool(r.get("forced")) for r in records) if records else None,
 
 
 
 
 
 
 
 
 
 
 
 
183
  "scored": len(scores) / len(records) if records else None,
184
  },
185
  "spatial_codes": {
186
  "records_with_path": sum(bool(r.get("spatial_code_path")) for r in records),
187
- "unique_paths": len({r.get("spatial_code_path") for r in records if r.get("spatial_code_path")}),
 
 
 
 
 
 
188
  "readable_file_bytes": numeric_summary(code_sizes),
189
  },
190
  "relationships": relationships,
@@ -196,51 +276,94 @@ def paired_breakdown(x, y, common, field):
196
  for qid in common:
197
  name = str(x[qid].get(field) or y[qid].get(field) or "<missing>")
198
  groups[name].append(y[qid].get("score") - x[qid].get("score"))
199
- return {name: {"count": len(vals), "mean_delta": statistics.mean(vals)}
200
- for name, vals in sorted(groups.items()) if vals}
 
 
 
201
 
202
 
203
  def _scene_bootstrap(x, y, common, iterations=1000, seed=0):
204
- by_scene=defaultdict(list)
205
  for qid in common:
206
  by_scene[str(x[qid].get("scene") or y[qid].get("scene") or "<missing>")].append(
207
- y[qid]["score"]-x[qid]["score"]
208
  )
209
  if not by_scene:
210
- return {"scenes":0,"iterations":iterations,"ci_low":None,"ci_high":None,"p_value":None}
211
- scenes=sorted(by_scene); rng=random.Random(seed); draws=[]
 
 
 
 
 
 
 
 
212
  for _ in range(iterations):
213
- values=[]
214
- for _ in scenes: values.extend(by_scene[rng.choice(scenes)])
 
215
  draws.append(statistics.mean(values))
216
- draws.sort(); low=int(.025*iterations); high=min(iterations-1,int(.975*iterations))
217
- below=sum(v<=0 for v in draws)/iterations; above=sum(v>=0 for v in draws)/iterations
218
- return {"scenes":len(scenes),"iterations":iterations,"seed":seed,"confidence":.95,
219
- "ci_low":draws[low],"ci_high":draws[high],
220
- "p_value":max(1/iterations,min(1.0,2*min(below,above)))}
 
 
 
 
 
 
 
 
 
 
221
 
222
  def paired_report(x_records, y_records):
223
- x = {r["question_id"]: r for r in x_records if isinstance(r.get("score"), (int, float))}
224
- y = {r["question_id"]: r for r in y_records if isinstance(r.get("score"), (int, float))}
 
 
 
 
 
 
 
 
225
  common = sorted(set(x) & set(y))
226
  deltas = [y[q]["score"] - x[q]["score"] for q in common]
227
- solved_x={q for q in common if x[q]["score"]>=1.0}; solved_y={q for q in common if y[q]["score"]>=1.0}
228
- union=solved_x|solved_y
 
229
  telemetry = {}
230
  for field in NUMERIC_FIELDS:
231
- vals = [y[q].get(field) - x[q].get(field) for q in common
232
- if isinstance(x[q].get(field), (int, float)) and isinstance(y[q].get(field), (int, float))]
 
 
 
 
233
  telemetry[field + "_delta"] = numeric_summary(vals)
234
  return {
235
- "common_questions": len(common), "x_full_questions": len(x), "y_full_questions": len(y),
 
 
236
  "mean_score_delta_y_minus_x": statistics.mean(deltas) if deltas else None,
237
  "score_delta_distribution": numeric_summary(deltas),
238
- "wins_y": sum(d > 0 for d in deltas), "ties": sum(d == 0 for d in deltas),
 
239
  "wins_x": sum(d < 0 for d in deltas),
240
- "scene_clustered_bootstrap": _scene_bootstrap(x,y,common),
241
- "solved_overlap": {"x":len(solved_x),"y":len(solved_y),"both":len(solved_x&solved_y),
242
- "only_x":len(solved_x-solved_y),"only_y":len(solved_y-solved_x),
243
- "jaccard":len(solved_x&solved_y)/len(union) if union else None},
 
 
 
 
 
244
  "by_question_type": paired_breakdown(x, y, common, "question_type"),
245
  "by_dataset": paired_breakdown(x, y, common, "dataset"),
246
  "telemetry_deltas": telemetry,
@@ -259,7 +382,8 @@ def analyze(directories=None, protocols=()):
259
  report = {"cells": {}, "comparison_groups": {}}
260
  for identity, records in cells.items():
261
  report["cells"][cell_label(identity)] = {
262
- "identity": identity_dict(identity), "summary": summarize_cell(records, code_cache)
 
263
  }
264
  grouped = defaultdict(list)
265
  for identity in cells:
@@ -268,11 +392,15 @@ def analyze(directories=None, protocols=()):
268
  name = "/".join("?" if v is None else str(v) for v in key)
269
  pairs = {}
270
  for first, second in combinations(sorted(identities, key=cell_label), 2):
271
- pairs[cell_label(first) + " -> " + cell_label(second)] = paired_report(cells[first], cells[second])
 
 
272
  id_sets = [{r["question_id"] for r in cells[i]} for i in identities]
273
  report["comparison_groups"][name] = {
274
  "cells": [cell_label(i) for i in identities],
275
- "all_cell_common_questions": len(set.intersection(*id_sets)) if id_sets else 0,
 
 
276
  "pairwise": pairs,
277
  }
278
  return report
@@ -282,293 +410,742 @@ def main():
282
  parser = argparse.ArgumentParser()
283
  for harness in "abc":
284
  parser.add_argument(f"--{harness}-results-dir", default=None)
285
- parser.add_argument("--protocol", action="append", default=[],
286
- help="repeatable; family 'truncated' includes truncated/<budget>")
287
  parser.add_argument(
288
- "--output-dir", default=str(ROOT / "reports"),
 
 
 
 
 
 
 
289
  help="report directory (default: workspace/reports)",
290
  )
291
  parser.add_argument(
292
- "--json-out", default=None,
 
293
  help="override the JSON report path (default: <output-dir>/comprehensive.json)",
294
  )
295
  args = parser.parse_args()
296
- dirs = {h.upper(): Path(getattr(args, f"{h}_results_dir") or DEFAULT_DIRS[h.upper()]) for h in "abc"}
 
 
 
297
  report = analyze(dirs, args.protocol)
298
  text = json.dumps(report, indent=1)
299
- output_path = Path(args.json_out) if args.json_out else Path(args.output_dir) / "comprehensive.json"
 
 
 
 
300
  output_path.parent.mkdir(parents=True, exist_ok=True)
301
  output_path.write_text(text + "\n", encoding="utf-8")
302
  print(f"wrote {output_path}")
303
 
304
 
305
-
306
  # --- Modular profile-driven interface (v2) ---
307
- from datetime import datetime, timezone
308
 
309
  # Built-in, versioned harness profiles.
310
  PROFILE_VERSION = 1
311
  BUILTINS = {
312
- "A":{"letter":"A","kind":"vlm","input_source":"frames","axes":["model","protocol","selection","frames"],"capabilities":["tokens","latency","reasoning","frames"]},
313
- "B":{"letter":"B","kind":"vlm","input_source":"perceived","axes":["model","protocol","format","depth","tracking","selection","frames"],"capabilities":["tokens","latency","reasoning","spatial_code"]},
314
- "C":{"letter":"C","kind":"vlm","input_source":"frames_perceived","axes":["model","protocol","format","depth","tracking","selection","frames"],"capabilities":["tokens","latency","reasoning","frames","spatial_code"]},
315
- "D":{"letter":"D","kind":"vlm","input_source":"ground_truth","axes":["model","protocol","format","selection","frames"],"capabilities":["tokens","latency","reasoning","frames","spatial_code"]},
316
- "F":{"letter":"F","kind":"solver","input_source":"dynamic","axes":["source","depth","tracking","selection","frames","format","spatial_code_model"],"capabilities":["spatial_code","solver"]},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  }
 
 
318
  def validate_profile(profile):
319
- p=dict(profile); letter=str(p.get("letter","")).upper()
320
- if len(letter)!=1 or not letter.isalpha(): raise ValueError("profile letter must be one alphabetic character")
321
- if letter=="E": raise ValueError("E is explicitly excluded")
322
- p["letter"]=letter; p.setdefault("kind","generic"); p.setdefault("input_source","unknown"); p.setdefault("axes",["model","protocol"]); p.setdefault("capabilities",[]); p["profile_version"]=PROFILE_VERSION
323
- return p
324
- def load_profile(letter,path=None):
325
- letter=letter.upper()
326
- if letter=="E": raise ValueError("E is explicitly excluded")
327
- if path:
328
- p=json.loads(Path(path).read_text()); p.setdefault("letter",letter)
329
- if p["letter"].upper()!=letter: raise ValueError(f"profile letter mismatch for {letter}")
330
- return validate_profile(p)
331
- return validate_profile(BUILTINS.get(letter,{"letter":letter,"kind":"generic","input_source":"unknown","axes":["model","protocol","format","depth","tracking","selection","frames"]}))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
 
333
  ANALYSIS_VERSION = 2
334
 
 
335
  def discover_records(letter, directory, profile, protocols=(), spatial_codes_dir=None):
336
- root=Path(directory); records=[]; warnings=[]
337
- if not root.is_dir(): return records,[{"code":"missing_directory","path":str(root)}]
 
 
 
338
  for path in sorted(root.rglob("*.json")):
339
- if path.name.startswith("_"): continue
340
- try: record=json.loads(path.read_text(encoding="utf-8"))
341
- except (OSError,json.JSONDecodeError) as exc:
342
- warnings.append({"code":"unreadable_json","path":str(path),"detail":str(exc)}); continue
343
- if not isinstance(record,dict) or record.get("question_id") is None or record.get("score") is None:
344
- warnings.append({"code":"not_question_record","path":str(path)}); continue
345
- record=dict(record); record["_result_path"]=str(path); record["_relative_path"]=path.relative_to(root).parts
346
- record=_normalize_record(letter,record,profile)
347
- code_path=record.get("spatial_code_path")
 
 
 
 
 
 
 
 
 
 
 
 
348
  if code_path and not Path(code_path).is_file() and spatial_codes_dir:
349
- marker="spatial codes/"
350
- suffix=str(code_path).split(marker,1)[-1] if marker in str(code_path) else None
351
- candidate=Path(spatial_codes_dir)/suffix if suffix else None
352
- if candidate and candidate.is_file(): record["spatial_code_path"]=str(candidate)
353
- else: warnings.append({"code":"unresolved_spatial_code_path","path":str(path),"recorded_path":str(code_path)})
354
- if letter!="F" and not protocol_selected(record.get("protocol"),protocols): continue
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  records.append(record)
356
- return records,warnings
357
-
358
- def _normalize_record(letter,r,profile):
359
- r["format"]=r.get("spatial_code_format") or r.get("format")
360
- r["selection"]=r.get("frame_selection") or r.get("input_selection") or r.get("input")
361
- r["frames"]=r.get("frame_count") or r.get("number_of_frames")
362
- if not r.get("protocol") and r.get("condition") and letter!="F": r["protocol"]=r["condition"].split(":",1)[0]
363
- if letter=="F":
364
- parts=list(r.get("_relative_path",()))
365
- top=parts[0].lower() if parts else ""
366
- if top in ("ground truth","ground_truth"):
367
- r.update(source="ground_truth",depth=None,tracking=None,selection=None,frames=None)
368
- r["format"]=r.get("format") or (parts[1] if len(parts)>1 else None)
 
 
 
 
 
 
 
 
 
 
369
  else:
370
- r["source"]="perceived"
371
- offset=1
372
- if top=="perceived": r["depth"]=r.get("depth") or (parts[1] if len(parts)>1 else None); offset=2
373
- elif top in ("metric","relative"): r["depth"]=r.get("depth") or top
374
- r["tracking"]=r.get("tracking") or (parts[offset] if len(parts)>offset else None)
375
- r["selection"]=r.get("selection") or (parts[offset+1] if len(parts)>offset+1 else None)
376
- r["frames"]=r.get("frames") or (parts[offset+2] if len(parts)>offset+2 else None)
377
- candidate=parts[offset+3] if len(parts)>offset+3 else None
378
- if candidate and not candidate.startswith("scene") and len(candidate)!=10: r["format"]=r.get("format") or candidate
379
- r["spatial_code_model"]=r.get("spatial_code_model")
380
- r["protocol"]=None
 
 
 
 
 
 
 
 
 
 
381
  return r
382
 
383
- def modular_identity(letter,record,profile):
384
- values={"harness":letter}
385
- for axis in profile["axes"]: values[axis]=str(record.get(axis)) if record.get(axis) is not None else None
 
 
386
  return tuple(sorted(values.items()))
387
 
 
388
  def modular_label(identity):
389
- d=dict(identity); return "/".join([d.pop("harness")]+[f"{k}={v or '?'}" for k,v in sorted(d.items())])
 
 
 
 
390
 
391
- def _controlled(first,second,profile):
392
- a,b=dict(first),dict(second); diffs=[axis for axis in profile["axes"] if a.get(axis)!=b.get(axis)]
393
- return len(diffs)==1,diffs
 
394
 
395
- def _compatible(a,b,profiles):
396
- x,y=dict(a),dict(b); lx,ly=x["harness"],y["harness"]
397
- warnings=[]
398
- if lx==ly: return False,[],["same_harness"]
 
 
 
399
  # F source semantics.
400
- f=x if lx=="F" else y if ly=="F" else None; other=y if lx=="F" else x
 
401
  if f:
402
- expected="ground_truth" if other["harness"]=="D" else "perceived" if other["harness"] in ("B","C") else None
403
- if expected and f.get("source")!=expected: return False,[],["incompatible_F_source"]
404
- shared=[]
405
- for axis in ("model","format","depth","tracking","selection","frames"):
406
- av,bv=x.get(axis),y.get(axis)
407
- if axis=="model" and f: continue
 
 
 
 
 
 
408
  if av is not None and bv is not None:
409
- if av!=bv: return False,[],[f"conflicting_{axis}"]
 
410
  shared.append(axis)
411
- else: warnings.append(f"unmatched_{axis}")
 
412
  if not f and x.get("protocol") is not None and y.get("protocol") is not None:
413
- if x["protocol"]!=y["protocol"]: return False,[],["conflicting_protocol"]
 
414
  shared.append("protocol")
415
- return True,shared,warnings
416
-
417
- def analyze_modular(cells, profiles, protocols=(), requested_pairs=(), spatial_codes_dir=None):
418
- all_cells=defaultdict(list); warnings={}; sources={}
419
- for letter,directory in cells.items():
420
- recs,warns=discover_records(letter,directory,profiles[letter],protocols,spatial_codes_dir); warnings[letter]=warns; sources[letter]=str(directory)
421
- for r in recs: all_cells[modular_identity(letter,r,profiles[letter])].append(r)
422
- cache={}; per={letter:{"manifest":{"analysis_version":ANALYSIS_VERSION,"profile_version":PROFILE_VERSION,"generated_at":datetime.now(timezone.utc).isoformat(),"letter":letter,"profile":profiles[letter],"source":sources[letter],"protocols":list(protocols)},"cells":{},"within_harness_comparisons":{},"integrity_warnings":warnings[letter]} for letter in cells}
423
- for ident,recs in all_cells.items(): per[dict(ident)["harness"]]["cells"][modular_label(ident)]={"identity":dict(ident),"summary":summarize_cell(recs,cache)}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  for letter in cells:
425
- ids=[i for i in all_cells if dict(i)["harness"]==letter]
426
- for a,b in combinations(ids,2):
427
- ok,diffs=_controlled(a,b,profiles[letter])
428
- if ok: per[letter]["within_harness_comparisons"][modular_label(a)+" -> "+modular_label(b)]={"varied_axis":diffs[0],**paired_report(all_cells[a],all_cells[b])}
429
- allowed={tuple(sorted(p)) for p in requested_pairs}
430
- cross={}
431
- ids=list(all_cells)
432
- for a,b in combinations(ids,2):
433
- letters=tuple(sorted((dict(a)["harness"],dict(b)["harness"])))
434
- if letters[0]==letters[1] or (allowed and letters not in allowed): continue
435
- ok,shared,warns=_compatible(a,b,profiles)
436
- if ok: cross[modular_label(a)+" -> "+modular_label(b)]={"letters":letters,"shared_axes":shared,"alignment_warnings":warns,**paired_report(all_cells[a],all_cells[b])}
437
- manifest={"analysis_version":ANALYSIS_VERSION,"profile_version":PROFILE_VERSION,"generated_at":datetime.now(timezone.utc).isoformat(),"letters":sorted(cells),"sources":sources,"protocols":list(protocols),"requested_pairs":[":".join(p) for p in requested_pairs]}
438
- return per,{"manifest":manifest,"cross_harness_comparisons":cross,"harness_summaries":{l:{"cell_count":len(per[l]["cells"]),"warning_count":len(per[l]["integrity_warnings"])} for l in per}}
439
-
440
- def parse_assignment(value,option):
441
- if "=" not in value: raise argparse.ArgumentTypeError(f"{option} must be LETTER=PATH")
442
- letter,path=value.split("=",1); letter=letter.upper()
443
- if len(letter)!=1 or not letter.isalpha() or letter=="E": raise argparse.ArgumentTypeError("letter must be one alphabetic character other than E")
444
- return letter,path
445
-
446
- def export_reports(per,combined,output_dir):
447
- out=Path(output_dir); out.mkdir(parents=True,exist_ok=True); paths=[]
448
- for letter,report in sorted(per.items()):
449
- path=out/f"{letter}_report.json"; path.write_text(json.dumps(report,indent=1)+"\n"); paths.append(path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  if len(per) > 1:
451
- name="".join(sorted(per))+"_report.json"
452
- path=out/name
453
- path.write_text(json.dumps(combined,indent=1)+"\n")
454
  paths.append(path)
455
  return paths
456
 
 
457
  def main():
458
- parser=argparse.ArgumentParser()
459
- parser.add_argument("--cell",action="append",default=[],help="repeatable LETTER=PATH; E is excluded")
460
- parser.add_argument("--profile",action="append",default=[],help="optional LETTER=profile.json")
461
- parser.add_argument("--compare",action="append",default=[],help="optional pair restriction, e.g. A:B")
462
- parser.add_argument("--protocol",action="append",default=[],help="repeatable; truncated includes truncated/<budget>")
463
- parser.add_argument("--output-dir",default=str(ROOT/"reports"))
464
- parser.add_argument("--spatial-codes-dir",default=None,help="optional local root used to rebase stale recorded code paths")
465
- for h in "abc": parser.add_argument(f"--{h}-results-dir",default=None,help=argparse.SUPPRESS)
466
- args=parser.parse_args(); cells=dict(parse_assignment(v,"--cell") for v in args.cell)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  for h in "abc":
468
- value=getattr(args,f"{h}_results_dir")
469
- if value: cells[h.upper()]=value
470
- if not cells: parser.error("provide at least one --cell LETTER=PATH")
471
- profile_paths=dict(parse_assignment(v,"--profile") for v in args.profile)
472
- profiles={letter:load_profile(letter,profile_paths.get(letter)) for letter in cells}
473
- pairs=[]
 
 
 
 
 
 
 
 
474
  for value in args.compare:
475
- bits=[x.upper() for x in value.split(":")]
476
- if len(bits)!=2 or any(x not in cells for x in bits): parser.error(f"invalid --compare {value}")
 
477
  pairs.append(tuple(bits))
478
- per,combined=analyze_modular(cells,profiles,args.protocol,pairs,args.spatial_codes_dir)
479
- for path in export_reports(per,combined,args.output_dir): print(f"wrote {path}")
 
 
 
480
 
481
 
482
  # Consolidated analysis helpers formerly split across stats/solvability/sufficiency/audits.
483
  def _official_scores(records):
484
- records=list(records)
485
- try:
486
- import importlib.util, os
487
- path=os.environ.get("HARNESS_OFFICIAL_EVAL","/root/data/thinking-in-space/lmms_eval/tasks/vsibench/utils.py")
488
- spec=importlib.util.spec_from_file_location("analysis_vsi_official_eval",path)
489
- module=importlib.util.module_from_spec(spec); spec.loader.exec_module(module)
490
- docs=[{"question_type":r["question_type"],"ground_truth":r.get("answer_expected"),r["metric"]:r["score"]} for r in records]
491
- return module.vsibench_aggregate_results(docs)
492
- except (OSError,ImportError,AttributeError,TypeError):
493
- scores=[r.get("score") for r in records if isinstance(r.get("score"),(int,float))]
494
- return {"overall":statistics.mean(scores)*100 if scores else None,"scoring_mode":"stored_per_question_mean_fallback"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
 
496
  def holm_bonferroni(p_values):
497
- ordered=sorted(p_values.items(),key=lambda item:item[1]); total=len(ordered); out={}; running=0.0
498
- for rank,(name,p) in enumerate(ordered):
499
- running=max(running,min(1.0,(total-rank)*p)); out[name]=running
500
- return out
501
-
502
- def solved_set_overlap(cells,threshold=1.0):
503
- maps={name:{r["question_id"]:r.get("score") for r in records} for name,records in cells.items()}
504
- common=set.intersection(*(set(m) for m in maps.values())) if maps else set(); solved={n:{q for q in common if v[q] is not None and v[q]>=threshold} for n,v in maps.items()}
505
- pairs={}
506
- for a,b in combinations(sorted(solved),2):
507
- union=solved[a]|solved[b]; pairs[f"{a}|{b}"]={"jaccard":len(solved[a]&solved[b])/len(union) if union else None,"both":len(solved[a]&solved[b]),f"only_{a}":len(solved[a]-solved[b]),f"only_{b}":len(solved[b]-solved[a])}
508
- return {"questions":len(common),"solved":{n:len(v) for n,v in solved.items()},"pairs":pairs}
509
-
510
- def sufficiency_decomposition(vlm_records,solver_records,threshold=1.0,exclude=()):
511
- cert={r["question_id"]:r.get("score") is not None and r["score"]>=threshold for r in solver_records}; buckets={"certified":[],"uncertified":[]}
512
- for r in vlm_records:
513
- if r.get("question_type") in set(exclude) or r.get("question_id") not in cert: continue
514
- buckets["certified" if cert[r["question_id"]] else "uncertified"].append(r.get("score"))
515
- def summary(vals):
516
- valid=[v for v in vals if isinstance(v,(int,float))]; correct=sum(v>=threshold for v in valid)
517
- return {"count":len(vals),"mean_score":statistics.mean(valid) if valid else None,"vlm_correct":correct,"vlm_wrong":len(vals)-correct}
518
- return {name:summary(vals) for name,vals in buckets.items()}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
 
520
  def solver_depth_table(records):
521
- try: from symbolic import adapters,solver
522
- except ImportError: return {"status":"unavailable","reason":"symbolic solver imports unavailable"}
523
- cache={}; buckets=defaultdict(list)
524
- for r in records:
525
- path=r.get("spatial_code_path")
526
- if not path: continue
527
- try:
528
- if path not in cache: cache[path]=adapters.adapt_spatial_code(json.loads(Path(path).read_text()))
529
- solver.answer(r["question_type"],r["question"],r.get("options"),cache[path]); depth=solver.LAST_ANSWER_OPS.get("total")
530
- except (OSError,KeyError,ValueError): continue
531
- if depth is not None and isinstance(r.get("score"),(int,float)): buckets["0-2" if depth<=2 else "3-8" if depth<=8 else "9-20" if depth<=20 else "21-inf"].append((depth,r["score"]))
532
- return {k:{"count":len(v),"mean_depth":statistics.mean(x for x,_ in v),"mean_score":statistics.mean(y for _,y in v)} for k,v in buckets.items()}
533
-
534
- _NUMBER_RE=__import__('re').compile(r"[-+]?\d+(?:\.\d+)?")
535
- def deterministic_cot_audit(records,tolerance=.01):
536
- def nums(value): return [float(x) for x in _NUMBER_RE.findall(str(value or ''))]
537
- audits=[]; cache={}
538
- for r in records:
539
- reasoning=r.get("reasoning_text"); path=r.get("spatial_code_path")
540
- if not reasoning or not path: continue
541
- try:
542
- if path not in cache: cache[path]=nums(Path(path).read_text())
543
- except OSError: continue
544
- sources=cache[path]+nums(r.get("question"))+sum((nums(x) for x in r.get("options") or []),[]); cited=nums(reasoning)
545
- fabricated=[v for v in cited if not (abs(v)<=12 and v.is_integer()) and not any(abs(v-x)<=tolerance*max(1,abs(x)) for x in sources)]
546
- audits.append({"question_id":r["question_id"],"score":r.get("score"),"cited":len(cited),"fabricated":len(fabricated)})
547
- wrong=[a for a in audits if a["score"] is not None and a["score"]<1]; bad=[a for a in wrong if a["fabricated"]]
548
- return {"audited":len(audits),"wrong":len(wrong),"wrong_with_fabrication":len(bad),"fabrication_share_of_wrong":len(bad)/len(wrong) if wrong else None}
549
-
550
- def generate_letter(letter,results_dir,protocols=(),output_dir=None,spatial_codes_dir=None,profile_path=None):
551
- letter=letter.upper(); profile=load_profile(letter,profile_path)
552
- per,combined=analyze_modular({letter:Path(results_dir)},{letter:profile},protocols,(),spatial_codes_dir)
553
- paths=export_reports(per,combined,output_dir or ROOT/'reports')
554
- return {"report":per[letter],"path":paths[0]}
555
-
556
- def generate(cells,protocols=(),comparisons=(),output_dir=None,profile_paths=None,spatial_codes_dir=None):
557
- normalized={str(k).upper():Path(v) for k,v in cells.items()}
558
- if 'E' in normalized: raise ValueError('E is explicitly excluded')
559
- profile_paths={str(k).upper():v for k,v in (profile_paths or {}).items()}; profiles={l:load_profile(l,profile_paths.get(l)) for l in normalized}; pairs=[]
560
- for pair in comparisons:
561
- pair=tuple(x.upper() for x in (pair.split(':') if isinstance(pair,str) else pair))
562
- if len(pair)!=2 or any(x not in normalized for x in pair): raise ValueError(f'invalid comparison {pair}')
563
- pairs.append(pair)
564
- per,combined=analyze_modular(normalized,profiles,protocols,pairs,spatial_codes_dir); paths=export_reports(per,combined,output_dir or ROOT/'reports')
565
- return {"letter_reports":per,"combined_report":combined,"paths":paths}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
 
567
  def main():
568
- parser=argparse.ArgumentParser(description='Generate arbitrary mixed letter reports; E is excluded.')
569
- parser.add_argument('--cell',action='append',required=True); parser.add_argument('--profile',action='append',default=[]); parser.add_argument('--compare',action='append',default=[]); parser.add_argument('--protocol',action='append',default=[]); parser.add_argument('--output-dir',default=str(ROOT/'reports')); parser.add_argument('--spatial-codes-dir',default=None)
570
- args=parser.parse_args(); cells=dict(parse_assignment(v,'--cell') for v in args.cell); profiles=dict(parse_assignment(v,'--profile') for v in args.profile)
571
- try: result=generate(cells,args.protocol,args.compare,args.output_dir,profiles,args.spatial_codes_dir)
572
- except ValueError as exc: parser.error(str(exc))
573
- for path in result['paths']: print(f'wrote {path}')
574
- if __name__=='__main__': main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  and pairwise deltas on exact question intersections. Stored per-question scores are
6
  used directly; ``mean_score`` is not the category-weighted official VSI overall.
7
  """
8
+
9
  from __future__ import annotations
10
 
11
  import argparse
12
  import json
13
+ import os
14
  import math
15
  import statistics
16
  import random
 
21
  ROOT = Path(__file__).resolve().parent.parent
22
  DEFAULT_DIRS = {h: Path("/root/results") / h for h in "ABC"}
23
  NUMERIC_FIELDS = (
24
+ "input_token_count",
25
+ "output_token_count",
26
+ "reasoning_token_count",
27
+ "generation_seconds",
28
+ "forced_input_token_count",
29
  )
30
  TEXT_FIELDS = (
31
+ "answer_given",
32
+ "answer_raw",
33
+ "reasoning_text",
34
+ "full_prompt",
35
+ "rendered_prompt",
36
  )
37
 
38
 
 
46
  record = json.load(stream)
47
  except (OSError, json.JSONDecodeError):
48
  continue
49
+ if (
50
+ isinstance(record, dict)
51
+ and "question_id" in record
52
+ and "condition" in record
53
+ ):
54
  yield record
55
 
56
 
 
67
  protocol = record.get("protocol") or record["condition"].split(":", 1)[0]
68
  selection = record.get("frame_selection", record.get("input_selection"))
69
  common = {
70
+ "harness": harness,
71
+ "model": record.get("model"),
72
+ "protocol": protocol,
73
+ "selection": selection,
74
+ "frames": str(record.get("frame_count")),
75
  }
76
  if harness in ("B", "C"):
77
+ common.update(
78
+ {
79
+ "format": record.get("spatial_code_format"),
80
+ "depth": record.get("depth"),
81
+ "tracking": record.get("tracking"),
82
+ }
83
+ )
84
  return tuple(sorted(common.items()))
85
 
86
 
 
90
 
91
  def cell_label(identity):
92
  d = identity_dict(identity)
93
+ parts = [
94
+ d["harness"],
95
+ d.get("model"),
96
+ d.get("protocol"),
97
+ d.get("selection"),
98
+ d.get("frames"),
99
+ ]
100
  if d["harness"] in ("B", "C"):
101
  parts += [d.get("format"), d.get("depth"), d.get("tracking")]
102
  return "/".join("?" if value is None else str(value) for value in parts)
 
111
  out = []
112
  for record in records:
113
  value = getter(record)
114
+ if (
115
+ isinstance(value, (int, float))
116
+ and not isinstance(value, bool)
117
+ and math.isfinite(value)
118
+ ):
119
  out.append(float(value))
120
  return out
121
 
 
124
  values = sorted(values)
125
  if not values:
126
  return None
127
+
128
  def percentile(p):
129
  position = (len(values) - 1) * p
130
  low, high = math.floor(position), math.ceil(position)
131
  if low == high:
132
  return values[low]
133
  return values[low] + (values[high] - values[low]) * (position - low)
134
+
135
  return {
136
+ "n": len(values),
137
+ "mean": statistics.mean(values),
138
+ "median": statistics.median(values),
139
+ "min": values[0],
140
+ "p25": percentile(0.25),
141
+ "p75": percentile(0.75),
142
+ "max": values[-1],
143
  "stdev": statistics.stdev(values) if len(values) > 1 else 0.0,
144
  }
145
 
146
 
147
  def pearson(xs, ys):
148
+ pairs = [
149
+ (float(x), float(y))
150
+ for x, y in zip(xs, ys)
151
+ if isinstance(x, (int, float))
152
+ and isinstance(y, (int, float))
153
+ and not isinstance(x, bool)
154
+ and not isinstance(y, bool)
155
+ and math.isfinite(x)
156
+ and math.isfinite(y)
157
+ ]
158
  if len(pairs) < 2:
159
  return None
160
+ x, y = zip(*pairs)
161
+ mx, my = statistics.mean(x), statistics.mean(y)
162
  dx, dy = [v - mx for v in x], [v - my for v in y]
163
+ denom = math.sqrt(sum(v * v for v in dx) * sum(v * v for v in dy))
164
+ return sum(a * b for a, b in zip(dx, dy)) / denom if denom else None
165
 
166
 
167
  def spatial_code_bytes(record, cache):
 
183
  return {
184
  name: {
185
  "count": len(group),
186
+ "mean_score": (
187
+ numeric_summary(_numbers(group, lambda r: r.get("score")))["mean"]
188
+ if _numbers(group, lambda r: r.get("score"))
189
+ else None
190
+ ),
191
  "scenes": len({r.get("scene") for r in group}),
192
  }
193
  for name, group in sorted(groups.items())
 
196
 
197
  def summarize_cell(records, code_cache):
198
  scores = _numbers(records, lambda r: r.get("score"))
199
+ numeric = {
200
+ field: numeric_summary(_numbers(records, lambda r, f=field: r.get(f)))
201
+ for field in NUMERIC_FIELDS
202
+ }
203
+ text = {
204
+ field
205
+ + "_chars": numeric_summary(
206
+ _numbers(
207
+ records,
208
+ lambda r, f=field: len(r[f]) if isinstance(r.get(f), str) else None,
209
+ )
210
+ )
211
+ for field in TEXT_FIELDS
212
+ }
213
  code_sizes = _numbers(records, lambda r: spatial_code_bytes(r, code_cache))
214
  relationships = {}
215
  measures = {
216
  **{field: lambda r, f=field: r.get(f) for field in NUMERIC_FIELDS},
217
+ **{
218
+ field
219
+ + "_chars": lambda r, f=field: (
220
+ len(r[f]) if isinstance(r.get(f), str) else None
221
+ )
222
+ for field in TEXT_FIELDS
223
+ },
224
  "spatial_code_bytes": lambda r: spatial_code_bytes(r, code_cache),
225
  }
226
  for name, getter in measures.items():
 
229
  [p[1] for p in pairs], [p[0] for p in pairs]
230
  )
231
  return {
232
+ "questions": len(records),
233
+ "unique_question_ids": len({r["question_id"] for r in records}),
234
  "scenes": len({r.get("scene") for r in records}),
235
  "mean_score": statistics.mean(scores) if scores else None,
236
  "score_distribution": numeric_summary(scores),
237
  "question_types": breakdown(records, "question_type"),
238
  "datasets": breakdown(records, "dataset"),
239
+ "numeric": numeric,
240
+ "text_lengths": text,
241
  "rates": {
242
+ "hit_token_limit": (
243
+ statistics.mean(bool(r.get("hit_token_limit")) for r in records)
244
+ if records
245
+ else None
246
+ ),
247
+ "reasoning_hit_limit": (
248
+ statistics.mean(bool(r.get("reasoning_hit_limit")) for r in records)
249
+ if records
250
+ else None
251
+ ),
252
+ "forced": (
253
+ statistics.mean(bool(r.get("forced")) for r in records)
254
+ if records
255
+ else None
256
+ ),
257
  "scored": len(scores) / len(records) if records else None,
258
  },
259
  "spatial_codes": {
260
  "records_with_path": sum(bool(r.get("spatial_code_path")) for r in records),
261
+ "unique_paths": len(
262
+ {
263
+ r.get("spatial_code_path")
264
+ for r in records
265
+ if r.get("spatial_code_path")
266
+ }
267
+ ),
268
  "readable_file_bytes": numeric_summary(code_sizes),
269
  },
270
  "relationships": relationships,
 
276
  for qid in common:
277
  name = str(x[qid].get(field) or y[qid].get(field) or "<missing>")
278
  groups[name].append(y[qid].get("score") - x[qid].get("score"))
279
+ return {
280
+ name: {"count": len(vals), "mean_delta": statistics.mean(vals)}
281
+ for name, vals in sorted(groups.items())
282
+ if vals
283
+ }
284
 
285
 
286
  def _scene_bootstrap(x, y, common, iterations=1000, seed=0):
287
+ by_scene = defaultdict(list)
288
  for qid in common:
289
  by_scene[str(x[qid].get("scene") or y[qid].get("scene") or "<missing>")].append(
290
+ y[qid]["score"] - x[qid]["score"]
291
  )
292
  if not by_scene:
293
+ return {
294
+ "scenes": 0,
295
+ "iterations": iterations,
296
+ "ci_low": None,
297
+ "ci_high": None,
298
+ "p_value": None,
299
+ }
300
+ scenes = sorted(by_scene)
301
+ rng = random.Random(seed)
302
+ draws = []
303
  for _ in range(iterations):
304
+ values = []
305
+ for _ in scenes:
306
+ values.extend(by_scene[rng.choice(scenes)])
307
  draws.append(statistics.mean(values))
308
+ draws.sort()
309
+ low = int(0.025 * iterations)
310
+ high = min(iterations - 1, int(0.975 * iterations))
311
+ below = sum(v <= 0 for v in draws) / iterations
312
+ above = sum(v >= 0 for v in draws) / iterations
313
+ return {
314
+ "scenes": len(scenes),
315
+ "iterations": iterations,
316
+ "seed": seed,
317
+ "confidence": 0.95,
318
+ "ci_low": draws[low],
319
+ "ci_high": draws[high],
320
+ "p_value": max(1 / iterations, min(1.0, 2 * min(below, above))),
321
+ }
322
+
323
 
324
  def paired_report(x_records, y_records):
325
+ x = {
326
+ r["question_id"]: r
327
+ for r in x_records
328
+ if isinstance(r.get("score"), (int, float))
329
+ }
330
+ y = {
331
+ r["question_id"]: r
332
+ for r in y_records
333
+ if isinstance(r.get("score"), (int, float))
334
+ }
335
  common = sorted(set(x) & set(y))
336
  deltas = [y[q]["score"] - x[q]["score"] for q in common]
337
+ solved_x = {q for q in common if x[q]["score"] >= 1.0}
338
+ solved_y = {q for q in common if y[q]["score"] >= 1.0}
339
+ union = solved_x | solved_y
340
  telemetry = {}
341
  for field in NUMERIC_FIELDS:
342
+ vals = [
343
+ y[q].get(field) - x[q].get(field)
344
+ for q in common
345
+ if isinstance(x[q].get(field), (int, float))
346
+ and isinstance(y[q].get(field), (int, float))
347
+ ]
348
  telemetry[field + "_delta"] = numeric_summary(vals)
349
  return {
350
+ "common_questions": len(common),
351
+ "x_full_questions": len(x),
352
+ "y_full_questions": len(y),
353
  "mean_score_delta_y_minus_x": statistics.mean(deltas) if deltas else None,
354
  "score_delta_distribution": numeric_summary(deltas),
355
+ "wins_y": sum(d > 0 for d in deltas),
356
+ "ties": sum(d == 0 for d in deltas),
357
  "wins_x": sum(d < 0 for d in deltas),
358
+ "scene_clustered_bootstrap": _scene_bootstrap(x, y, common),
359
+ "solved_overlap": {
360
+ "x": len(solved_x),
361
+ "y": len(solved_y),
362
+ "both": len(solved_x & solved_y),
363
+ "only_x": len(solved_x - solved_y),
364
+ "only_y": len(solved_y - solved_x),
365
+ "jaccard": len(solved_x & solved_y) / len(union) if union else None,
366
+ },
367
  "by_question_type": paired_breakdown(x, y, common, "question_type"),
368
  "by_dataset": paired_breakdown(x, y, common, "dataset"),
369
  "telemetry_deltas": telemetry,
 
382
  report = {"cells": {}, "comparison_groups": {}}
383
  for identity, records in cells.items():
384
  report["cells"][cell_label(identity)] = {
385
+ "identity": identity_dict(identity),
386
+ "summary": summarize_cell(records, code_cache),
387
  }
388
  grouped = defaultdict(list)
389
  for identity in cells:
 
392
  name = "/".join("?" if v is None else str(v) for v in key)
393
  pairs = {}
394
  for first, second in combinations(sorted(identities, key=cell_label), 2):
395
+ pairs[cell_label(first) + " -> " + cell_label(second)] = paired_report(
396
+ cells[first], cells[second]
397
+ )
398
  id_sets = [{r["question_id"] for r in cells[i]} for i in identities]
399
  report["comparison_groups"][name] = {
400
  "cells": [cell_label(i) for i in identities],
401
+ "all_cell_common_questions": (
402
+ len(set.intersection(*id_sets)) if id_sets else 0
403
+ ),
404
  "pairwise": pairs,
405
  }
406
  return report
 
410
  parser = argparse.ArgumentParser()
411
  for harness in "abc":
412
  parser.add_argument(f"--{harness}-results-dir", default=None)
 
 
413
  parser.add_argument(
414
+ "--protocol",
415
+ action="append",
416
+ default=[],
417
+ help="repeatable; family 'truncated' includes truncated/<budget>",
418
+ )
419
+ parser.add_argument(
420
+ "--output-dir",
421
+ default=str(ROOT / "reports"),
422
  help="report directory (default: workspace/reports)",
423
  )
424
  parser.add_argument(
425
+ "--json-out",
426
+ default=None,
427
  help="override the JSON report path (default: <output-dir>/comprehensive.json)",
428
  )
429
  args = parser.parse_args()
430
+ dirs = {
431
+ h.upper(): Path(getattr(args, f"{h}_results_dir") or DEFAULT_DIRS[h.upper()])
432
+ for h in "abc"
433
+ }
434
  report = analyze(dirs, args.protocol)
435
  text = json.dumps(report, indent=1)
436
+ output_path = (
437
+ Path(args.json_out)
438
+ if args.json_out
439
+ else Path(args.output_dir) / "comprehensive.json"
440
+ )
441
  output_path.parent.mkdir(parents=True, exist_ok=True)
442
  output_path.write_text(text + "\n", encoding="utf-8")
443
  print(f"wrote {output_path}")
444
 
445
 
 
446
  # --- Modular profile-driven interface (v2) ---
 
447
 
448
  # Built-in, versioned harness profiles.
449
  PROFILE_VERSION = 1
450
  BUILTINS = {
451
+ "A": {
452
+ "letter": "A",
453
+ "kind": "vlm",
454
+ "input_source": "frames",
455
+ "axes": ["model", "protocol", "selection", "frames"],
456
+ "capabilities": ["tokens", "latency", "reasoning", "frames"],
457
+ },
458
+ "B": {
459
+ "letter": "B",
460
+ "kind": "vlm",
461
+ "input_source": "perceived",
462
+ "axes": [
463
+ "model",
464
+ "protocol",
465
+ "format",
466
+ "depth",
467
+ "tracking",
468
+ "selection",
469
+ "frames",
470
+ ],
471
+ "capabilities": ["tokens", "latency", "reasoning", "spatial_code"],
472
+ },
473
+ "C": {
474
+ "letter": "C",
475
+ "kind": "vlm",
476
+ "input_source": "frames_perceived",
477
+ "axes": [
478
+ "model",
479
+ "protocol",
480
+ "format",
481
+ "depth",
482
+ "tracking",
483
+ "selection",
484
+ "frames",
485
+ ],
486
+ "capabilities": ["tokens", "latency", "reasoning", "frames", "spatial_code"],
487
+ },
488
+ "D": {
489
+ "letter": "D",
490
+ "kind": "vlm",
491
+ "input_source": "ground_truth",
492
+ "axes": ["model", "protocol", "format", "selection", "frames"],
493
+ "capabilities": ["tokens", "latency", "reasoning", "frames", "spatial_code"],
494
+ },
495
+ "F": {
496
+ "letter": "F",
497
+ "kind": "solver",
498
+ "input_source": "dynamic",
499
+ "axes": [
500
+ "source",
501
+ "depth",
502
+ "tracking",
503
+ "selection",
504
+ "frames",
505
+ "format",
506
+ "spatial_code_model",
507
+ ],
508
+ "capabilities": ["spatial_code", "solver"],
509
+ },
510
  }
511
+
512
+
513
  def validate_profile(profile):
514
+ p = dict(profile)
515
+ letter = str(p.get("letter", "")).upper()
516
+ if len(letter) != 1 or not letter.isalpha():
517
+ raise ValueError("profile letter must be one alphabetic character")
518
+ if letter == "E":
519
+ raise ValueError("E is explicitly excluded")
520
+ p["letter"] = letter
521
+ p.setdefault("kind", "generic")
522
+ p.setdefault("input_source", "unknown")
523
+ p.setdefault("axes", ["model", "protocol"])
524
+ p.setdefault("capabilities", [])
525
+ p["profile_version"] = PROFILE_VERSION
526
+ return p
527
+
528
+
529
+ def load_profile(letter, path=None):
530
+ letter = letter.upper()
531
+ if letter == "E":
532
+ raise ValueError("E is explicitly excluded")
533
+ if path:
534
+ p = json.loads(Path(path).read_text())
535
+ p.setdefault("letter", letter)
536
+ if p["letter"].upper() != letter:
537
+ raise ValueError(f"profile letter mismatch for {letter}")
538
+ return validate_profile(p)
539
+ return validate_profile(
540
+ BUILTINS.get(
541
+ letter,
542
+ {
543
+ "letter": letter,
544
+ "kind": "generic",
545
+ "input_source": "unknown",
546
+ "axes": [
547
+ "model",
548
+ "protocol",
549
+ "format",
550
+ "depth",
551
+ "tracking",
552
+ "selection",
553
+ "frames",
554
+ ],
555
+ },
556
+ )
557
+ )
558
+
559
 
560
  ANALYSIS_VERSION = 2
561
 
562
+
563
  def discover_records(letter, directory, profile, protocols=(), spatial_codes_dir=None):
564
+ root = Path(directory)
565
+ records = []
566
+ warnings = []
567
+ if not root.is_dir():
568
+ return records, [{"code": "missing_directory", "path": str(root)}]
569
  for path in sorted(root.rglob("*.json")):
570
+ if path.name.startswith("_"):
571
+ continue
572
+ try:
573
+ record = json.loads(path.read_text(encoding="utf-8"))
574
+ except (OSError, json.JSONDecodeError) as exc:
575
+ warnings.append(
576
+ {"code": "unreadable_json", "path": str(path), "detail": str(exc)}
577
+ )
578
+ continue
579
+ if (
580
+ not isinstance(record, dict)
581
+ or record.get("question_id") is None
582
+ or record.get("score") is None
583
+ ):
584
+ warnings.append({"code": "not_question_record", "path": str(path)})
585
+ continue
586
+ record = dict(record)
587
+ record["_result_path"] = str(path)
588
+ record["_relative_path"] = path.relative_to(root).parts
589
+ record = _normalize_record(letter, record, profile)
590
+ code_path = record.get("spatial_code_path")
591
  if code_path and not Path(code_path).is_file() and spatial_codes_dir:
592
+ marker = "spatial codes/"
593
+ suffix = (
594
+ str(code_path).split(marker, 1)[-1]
595
+ if marker in str(code_path)
596
+ else None
597
+ )
598
+ candidate = Path(spatial_codes_dir) / suffix if suffix else None
599
+ if candidate and candidate.is_file():
600
+ record["spatial_code_path"] = str(candidate)
601
+ else:
602
+ warnings.append(
603
+ {
604
+ "code": "unresolved_spatial_code_path",
605
+ "path": str(path),
606
+ "recorded_path": str(code_path),
607
+ }
608
+ )
609
+ if letter != "F" and not protocol_selected(record.get("protocol"), protocols):
610
+ continue
611
  records.append(record)
612
+ return records, warnings
613
+
614
+
615
+ def _normalize_record(letter, r, profile):
616
+ r["format"] = r.get("spatial_code_format") or r.get("format")
617
+ r["selection"] = (
618
+ r.get("frame_selection") or r.get("input_selection") or r.get("input")
619
+ )
620
+ r["frames"] = r.get("frame_count") or r.get("number_of_frames")
621
+ if not r.get("protocol") and r.get("condition") and letter != "F":
622
+ r["protocol"] = r["condition"].split(":", 1)[0]
623
+ if letter == "F":
624
+ parts = list(r.get("_relative_path", ()))
625
+ top = parts[0].lower() if parts else ""
626
+ if top in ("ground truth", "ground_truth"):
627
+ r.update(
628
+ source="ground_truth",
629
+ depth=None,
630
+ tracking=None,
631
+ selection=None,
632
+ frames=None,
633
+ )
634
+ r["format"] = r.get("format") or (parts[1] if len(parts) > 1 else None)
635
  else:
636
+ r["source"] = "perceived"
637
+ offset = 1
638
+ if top == "perceived":
639
+ r["depth"] = r.get("depth") or (parts[1] if len(parts) > 1 else None)
640
+ offset = 2
641
+ elif top in ("metric", "relative"):
642
+ r["depth"] = r.get("depth") or top
643
+ r["tracking"] = r.get("tracking") or (
644
+ parts[offset] if len(parts) > offset else None
645
+ )
646
+ r["selection"] = r.get("selection") or (
647
+ parts[offset + 1] if len(parts) > offset + 1 else None
648
+ )
649
+ r["frames"] = r.get("frames") or (
650
+ parts[offset + 2] if len(parts) > offset + 2 else None
651
+ )
652
+ candidate = parts[offset + 3] if len(parts) > offset + 3 else None
653
+ if candidate and not candidate.startswith("scene") and len(candidate) != 10:
654
+ r["format"] = r.get("format") or candidate
655
+ r["spatial_code_model"] = r.get("spatial_code_model")
656
+ r["protocol"] = None
657
  return r
658
 
659
+
660
+ def modular_identity(letter, record, profile):
661
+ values = {"harness": letter}
662
+ for axis in profile["axes"]:
663
+ values[axis] = str(record.get(axis)) if record.get(axis) is not None else None
664
  return tuple(sorted(values.items()))
665
 
666
+
667
  def modular_label(identity):
668
+ d = dict(identity)
669
+ return "/".join(
670
+ [d.pop("harness")] + [f"{k}={v or '?'}" for k, v in sorted(d.items())]
671
+ )
672
+
673
 
674
+ def _controlled(first, second, profile):
675
+ a, b = dict(first), dict(second)
676
+ diffs = [axis for axis in profile["axes"] if a.get(axis) != b.get(axis)]
677
+ return len(diffs) == 1, diffs
678
 
679
+
680
+ def _compatible(a, b, profiles):
681
+ x, y = dict(a), dict(b)
682
+ lx, ly = x["harness"], y["harness"]
683
+ warnings = []
684
+ if lx == ly:
685
+ return False, [], ["same_harness"]
686
  # F source semantics.
687
+ f = x if lx == "F" else y if ly == "F" else None
688
+ other = y if lx == "F" else x
689
  if f:
690
+ expected = (
691
+ "ground_truth"
692
+ if other["harness"] == "D"
693
+ else "perceived" if other["harness"] in ("B", "C") else None
694
+ )
695
+ if expected and f.get("source") != expected:
696
+ return False, [], ["incompatible_F_source"]
697
+ shared = []
698
+ for axis in ("model", "format", "depth", "tracking", "selection", "frames"):
699
+ av, bv = x.get(axis), y.get(axis)
700
+ if axis == "model" and f:
701
+ continue
702
  if av is not None and bv is not None:
703
+ if av != bv:
704
+ return False, [], [f"conflicting_{axis}"]
705
  shared.append(axis)
706
+ else:
707
+ warnings.append(f"unmatched_{axis}")
708
  if not f and x.get("protocol") is not None and y.get("protocol") is not None:
709
+ if x["protocol"] != y["protocol"]:
710
+ return False, [], ["conflicting_protocol"]
711
  shared.append("protocol")
712
+ return True, shared, warnings
713
+
714
+
715
+ def _generated_at():
716
+ return os.environ.get("VSI_ANALYSIS_GENERATED_AT", "reproducible")
717
+
718
+
719
+ def analyze_modular(
720
+ cells, profiles, protocols=(), requested_pairs=(), spatial_codes_dir=None
721
+ ):
722
+ all_cells = defaultdict(list)
723
+ warnings = {}
724
+ sources = {}
725
+ for letter, directory in cells.items():
726
+ recs, warns = discover_records(
727
+ letter, directory, profiles[letter], protocols, spatial_codes_dir
728
+ )
729
+ warnings[letter] = warns
730
+ sources[letter] = str(directory)
731
+ for r in recs:
732
+ all_cells[modular_identity(letter, r, profiles[letter])].append(r)
733
+ cache = {}
734
+ per = {
735
+ letter: {
736
+ "manifest": {
737
+ "analysis_version": ANALYSIS_VERSION,
738
+ "profile_version": PROFILE_VERSION,
739
+ "generated_at": _generated_at(),
740
+ "letter": letter,
741
+ "profile": profiles[letter],
742
+ "source": sources[letter],
743
+ "protocols": list(protocols),
744
+ },
745
+ "cells": {},
746
+ "within_harness_comparisons": {},
747
+ "integrity_warnings": warnings[letter],
748
+ }
749
+ for letter in cells
750
+ }
751
+ for ident, recs in all_cells.items():
752
+ per[dict(ident)["harness"]]["cells"][modular_label(ident)] = {
753
+ "identity": dict(ident),
754
+ "summary": summarize_cell(recs, cache),
755
+ }
756
  for letter in cells:
757
+ ids = [i for i in all_cells if dict(i)["harness"] == letter]
758
+ for a, b in combinations(ids, 2):
759
+ ok, diffs = _controlled(a, b, profiles[letter])
760
+ if ok:
761
+ per[letter]["within_harness_comparisons"][
762
+ modular_label(a) + " -> " + modular_label(b)
763
+ ] = {
764
+ "varied_axis": diffs[0],
765
+ **paired_report(all_cells[a], all_cells[b]),
766
+ }
767
+ allowed = {tuple(sorted(p)) for p in requested_pairs}
768
+ cross = {}
769
+ ids = list(all_cells)
770
+ for a, b in combinations(ids, 2):
771
+ letters = tuple(sorted((dict(a)["harness"], dict(b)["harness"])))
772
+ if letters[0] == letters[1] or (allowed and letters not in allowed):
773
+ continue
774
+ ok, shared, warns = _compatible(a, b, profiles)
775
+ if ok:
776
+ cross[modular_label(a) + " -> " + modular_label(b)] = {
777
+ "letters": letters,
778
+ "shared_axes": shared,
779
+ "alignment_warnings": warns,
780
+ **paired_report(all_cells[a], all_cells[b]),
781
+ }
782
+ manifest = {
783
+ "analysis_version": ANALYSIS_VERSION,
784
+ "profile_version": PROFILE_VERSION,
785
+ "generated_at": _generated_at(),
786
+ "letters": sorted(cells),
787
+ "sources": sources,
788
+ "protocols": list(protocols),
789
+ "requested_pairs": [":".join(p) for p in requested_pairs],
790
+ }
791
+ return per, {
792
+ "manifest": manifest,
793
+ "cross_harness_comparisons": cross,
794
+ "harness_summaries": {
795
+ l: {
796
+ "cell_count": len(per[l]["cells"]),
797
+ "warning_count": len(per[l]["integrity_warnings"]),
798
+ }
799
+ for l in per
800
+ },
801
+ }
802
+
803
+
804
+ def parse_assignment(value, option):
805
+ if "=" not in value:
806
+ raise argparse.ArgumentTypeError(f"{option} must be LETTER=PATH")
807
+ letter, path = value.split("=", 1)
808
+ letter = letter.upper()
809
+ if len(letter) != 1 or not letter.isalpha() or letter == "E":
810
+ raise argparse.ArgumentTypeError(
811
+ "letter must be one alphabetic character other than E"
812
+ )
813
+ return letter, path
814
+
815
+
816
+ def export_reports(per, combined, output_dir):
817
+ out = Path(output_dir)
818
+ out.mkdir(parents=True, exist_ok=True)
819
+ paths = []
820
+ for letter, report in sorted(per.items()):
821
+ path = out / f"{letter}_report.json"
822
+ path.write_text(json.dumps(report, indent=1) + "\n")
823
+ paths.append(path)
824
  if len(per) > 1:
825
+ name = "".join(sorted(per)) + "_report.json"
826
+ path = out / name
827
+ path.write_text(json.dumps(combined, indent=1) + "\n")
828
  paths.append(path)
829
  return paths
830
 
831
+
832
  def main():
833
+ parser = argparse.ArgumentParser()
834
+ parser.add_argument(
835
+ "--cell",
836
+ action="append",
837
+ default=[],
838
+ help="repeatable LETTER=PATH; E is excluded",
839
+ )
840
+ parser.add_argument(
841
+ "--profile", action="append", default=[], help="optional LETTER=profile.json"
842
+ )
843
+ parser.add_argument(
844
+ "--compare",
845
+ action="append",
846
+ default=[],
847
+ help="optional pair restriction, e.g. A:B",
848
+ )
849
+ parser.add_argument(
850
+ "--protocol",
851
+ action="append",
852
+ default=[],
853
+ help="repeatable; truncated includes truncated/<budget>",
854
+ )
855
+ parser.add_argument("--output-dir", default=str(ROOT / "reports"))
856
+ parser.add_argument(
857
+ "--spatial-codes-dir",
858
+ default=None,
859
+ help="optional local root used to rebase stale recorded code paths",
860
+ )
861
  for h in "abc":
862
+ parser.add_argument(f"--{h}-results-dir", default=None, help=argparse.SUPPRESS)
863
+ args = parser.parse_args()
864
+ cells = dict(parse_assignment(v, "--cell") for v in args.cell)
865
+ for h in "abc":
866
+ value = getattr(args, f"{h}_results_dir")
867
+ if value:
868
+ cells[h.upper()] = value
869
+ if not cells:
870
+ parser.error("provide at least one --cell LETTER=PATH")
871
+ profile_paths = dict(parse_assignment(v, "--profile") for v in args.profile)
872
+ profiles = {
873
+ letter: load_profile(letter, profile_paths.get(letter)) for letter in cells
874
+ }
875
+ pairs = []
876
  for value in args.compare:
877
+ bits = [x.upper() for x in value.split(":")]
878
+ if len(bits) != 2 or any(x not in cells for x in bits):
879
+ parser.error(f"invalid --compare {value}")
880
  pairs.append(tuple(bits))
881
+ per, combined = analyze_modular(
882
+ cells, profiles, args.protocol, pairs, args.spatial_codes_dir
883
+ )
884
+ for path in export_reports(per, combined, args.output_dir):
885
+ print(f"wrote {path}")
886
 
887
 
888
  # Consolidated analysis helpers formerly split across stats/solvability/sufficiency/audits.
889
  def _official_scores(records):
890
+ records = list(records)
891
+ try:
892
+ import importlib.util, os
893
+
894
+ path = os.environ.get(
895
+ "HARNESS_OFFICIAL_EVAL",
896
+ "/root/data/thinking-in-space/lmms_eval/tasks/vsibench/utils.py",
897
+ )
898
+ spec = importlib.util.spec_from_file_location(
899
+ "analysis_vsi_official_eval", path
900
+ )
901
+ module = importlib.util.module_from_spec(spec)
902
+ spec.loader.exec_module(module)
903
+ docs = [
904
+ {
905
+ "question_type": r["question_type"],
906
+ "ground_truth": r.get("answer_expected"),
907
+ r["metric"]: r["score"],
908
+ }
909
+ for r in records
910
+ ]
911
+ return module.vsibench_aggregate_results(docs)
912
+ except (OSError, ImportError, AttributeError, TypeError):
913
+ scores = [
914
+ r.get("score") for r in records if isinstance(r.get("score"), (int, float))
915
+ ]
916
+ return {
917
+ "overall": statistics.mean(scores) * 100 if scores else None,
918
+ "scoring_mode": "stored_per_question_mean_fallback",
919
+ }
920
+
921
 
922
  def holm_bonferroni(p_values):
923
+ ordered = sorted(p_values.items(), key=lambda item: item[1])
924
+ total = len(ordered)
925
+ out = {}
926
+ running = 0.0
927
+ for rank, (name, p) in enumerate(ordered):
928
+ running = max(running, min(1.0, (total - rank) * p))
929
+ out[name] = running
930
+ return out
931
+
932
+
933
+ def solved_set_overlap(cells, threshold=1.0):
934
+ maps = {
935
+ name: {r["question_id"]: r.get("score") for r in records}
936
+ for name, records in cells.items()
937
+ }
938
+ common = set.intersection(*(set(m) for m in maps.values())) if maps else set()
939
+ solved = {
940
+ n: {q for q in common if v[q] is not None and v[q] >= threshold}
941
+ for n, v in maps.items()
942
+ }
943
+ pairs = {}
944
+ for a, b in combinations(sorted(solved), 2):
945
+ union = solved[a] | solved[b]
946
+ pairs[f"{a}|{b}"] = {
947
+ "jaccard": len(solved[a] & solved[b]) / len(union) if union else None,
948
+ "both": len(solved[a] & solved[b]),
949
+ f"only_{a}": len(solved[a] - solved[b]),
950
+ f"only_{b}": len(solved[b] - solved[a]),
951
+ }
952
+ return {
953
+ "questions": len(common),
954
+ "solved": {n: len(v) for n, v in solved.items()},
955
+ "pairs": pairs,
956
+ }
957
+
958
+
959
+ def sufficiency_decomposition(vlm_records, solver_records, threshold=1.0, exclude=()):
960
+ cert = {
961
+ r["question_id"]: r.get("score") is not None and r["score"] >= threshold
962
+ for r in solver_records
963
+ }
964
+ buckets = {"certified": [], "uncertified": []}
965
+ for r in vlm_records:
966
+ if r.get("question_type") in set(exclude) or r.get("question_id") not in cert:
967
+ continue
968
+ buckets["certified" if cert[r["question_id"]] else "uncertified"].append(
969
+ r.get("score")
970
+ )
971
+
972
+ def summary(vals):
973
+ valid = [v for v in vals if isinstance(v, (int, float))]
974
+ correct = sum(v >= threshold for v in valid)
975
+ return {
976
+ "count": len(vals),
977
+ "mean_score": statistics.mean(valid) if valid else None,
978
+ "vlm_correct": correct,
979
+ "vlm_wrong": len(vals) - correct,
980
+ }
981
+
982
+ return {name: summary(vals) for name, vals in buckets.items()}
983
+
984
 
985
  def solver_depth_table(records):
986
+ try:
987
+ from symbolic import adapters, solver
988
+ except ImportError:
989
+ return {
990
+ "status": "unavailable",
991
+ "reason": "symbolic solver imports unavailable",
992
+ }
993
+ cache = {}
994
+ buckets = defaultdict(list)
995
+ for r in records:
996
+ path = r.get("spatial_code_path")
997
+ if not path:
998
+ continue
999
+ try:
1000
+ if path not in cache:
1001
+ cache[path] = adapters.adapt_spatial_code(
1002
+ json.loads(Path(path).read_text())
1003
+ )
1004
+ solver.answer(
1005
+ r["question_type"], r["question"], r.get("options"), cache[path]
1006
+ )
1007
+ depth = solver.LAST_ANSWER_OPS.get("total")
1008
+ except (OSError, KeyError, ValueError):
1009
+ continue
1010
+ if depth is not None and isinstance(r.get("score"), (int, float)):
1011
+ buckets[
1012
+ (
1013
+ "0-2"
1014
+ if depth <= 2
1015
+ else "3-8" if depth <= 8 else "9-20" if depth <= 20 else "21-inf"
1016
+ )
1017
+ ].append((depth, r["score"]))
1018
+ return {
1019
+ k: {
1020
+ "count": len(v),
1021
+ "mean_depth": statistics.mean(x for x, _ in v),
1022
+ "mean_score": statistics.mean(y for _, y in v),
1023
+ }
1024
+ for k, v in buckets.items()
1025
+ }
1026
+
1027
+
1028
+ _NUMBER_RE = __import__("re").compile(r"[-+]?\d+(?:\.\d+)?")
1029
+
1030
+
1031
+ def deterministic_cot_audit(records, tolerance=0.01):
1032
+ def nums(value):
1033
+ return [float(x) for x in _NUMBER_RE.findall(str(value or ""))]
1034
+
1035
+ audits = []
1036
+ cache = {}
1037
+ for r in records:
1038
+ reasoning = r.get("reasoning_text")
1039
+ path = r.get("spatial_code_path")
1040
+ if not reasoning or not path:
1041
+ continue
1042
+ try:
1043
+ if path not in cache:
1044
+ cache[path] = nums(Path(path).read_text())
1045
+ except OSError:
1046
+ continue
1047
+ sources = (
1048
+ cache[path]
1049
+ + nums(r.get("question"))
1050
+ + sum((nums(x) for x in r.get("options") or []), [])
1051
+ )
1052
+ cited = nums(reasoning)
1053
+ fabricated = [
1054
+ v
1055
+ for v in cited
1056
+ if not (abs(v) <= 12 and v.is_integer())
1057
+ and not any(abs(v - x) <= tolerance * max(1, abs(x)) for x in sources)
1058
+ ]
1059
+ audits.append(
1060
+ {
1061
+ "question_id": r["question_id"],
1062
+ "score": r.get("score"),
1063
+ "cited": len(cited),
1064
+ "fabricated": len(fabricated),
1065
+ }
1066
+ )
1067
+ wrong = [a for a in audits if a["score"] is not None and a["score"] < 1]
1068
+ bad = [a for a in wrong if a["fabricated"]]
1069
+ return {
1070
+ "audited": len(audits),
1071
+ "wrong": len(wrong),
1072
+ "wrong_with_fabrication": len(bad),
1073
+ "fabrication_share_of_wrong": len(bad) / len(wrong) if wrong else None,
1074
+ }
1075
+
1076
+
1077
+ def generate_letter(
1078
+ letter,
1079
+ results_dir,
1080
+ protocols=(),
1081
+ output_dir=None,
1082
+ spatial_codes_dir=None,
1083
+ profile_path=None,
1084
+ ):
1085
+ letter = letter.upper()
1086
+ profile = load_profile(letter, profile_path)
1087
+ per, combined = analyze_modular(
1088
+ {letter: Path(results_dir)}, {letter: profile}, protocols, (), spatial_codes_dir
1089
+ )
1090
+ paths = export_reports(per, combined, output_dir or ROOT / "reports")
1091
+ return {"report": per[letter], "path": paths[0]}
1092
+
1093
+
1094
+ def generate(
1095
+ cells,
1096
+ protocols=(),
1097
+ comparisons=(),
1098
+ output_dir=None,
1099
+ profile_paths=None,
1100
+ spatial_codes_dir=None,
1101
+ ):
1102
+ normalized = {str(k).upper(): Path(v) for k, v in cells.items()}
1103
+ if "E" in normalized:
1104
+ raise ValueError("E is explicitly excluded")
1105
+ profile_paths = {str(k).upper(): v for k, v in (profile_paths or {}).items()}
1106
+ profiles = {l: load_profile(l, profile_paths.get(l)) for l in normalized}
1107
+ pairs = []
1108
+ for pair in comparisons:
1109
+ pair = tuple(
1110
+ x.upper() for x in (pair.split(":") if isinstance(pair, str) else pair)
1111
+ )
1112
+ if len(pair) != 2 or any(x not in normalized for x in pair):
1113
+ raise ValueError(f"invalid comparison {pair}")
1114
+ pairs.append(pair)
1115
+ per, combined = analyze_modular(
1116
+ normalized, profiles, protocols, pairs, spatial_codes_dir
1117
+ )
1118
+ paths = export_reports(per, combined, output_dir or ROOT / "reports")
1119
+ return {"letter_reports": per, "combined_report": combined, "paths": paths}
1120
+
1121
 
1122
  def main():
1123
+ parser = argparse.ArgumentParser(
1124
+ description="Generate arbitrary mixed letter reports; E is excluded."
1125
+ )
1126
+ parser.add_argument("--cell", action="append", required=True)
1127
+ parser.add_argument("--profile", action="append", default=[])
1128
+ parser.add_argument("--compare", action="append", default=[])
1129
+ parser.add_argument("--protocol", action="append", default=[])
1130
+ parser.add_argument("--output-dir", default=str(ROOT / "reports"))
1131
+ parser.add_argument("--spatial-codes-dir", default=None)
1132
+ args = parser.parse_args()
1133
+ cells = dict(parse_assignment(v, "--cell") for v in args.cell)
1134
+ profiles = dict(parse_assignment(v, "--profile") for v in args.profile)
1135
+ try:
1136
+ result = generate(
1137
+ cells,
1138
+ args.protocol,
1139
+ args.compare,
1140
+ args.output_dir,
1141
+ profiles,
1142
+ args.spatial_codes_dir,
1143
+ )
1144
+ except ValueError as exc:
1145
+ parser.error(str(exc))
1146
+ for path in result["paths"]:
1147
+ print(f"wrote {path}")
1148
+
1149
+
1150
+ if __name__ == "__main__":
1151
+ main()
backup.py CHANGED
@@ -1,58 +1,9 @@
1
  #!/usr/bin/env python3
2
- """Back up this workspace -- results, spatial codes, AND the code/setup itself -- to a
3
- Hugging Face dataset repo.
4
-
5
- Every "target" maps to one or more self-contained local paths (directories or single
6
- files), each uploaded with the exact same relative path it has in the workspace
7
- (results/A/... stays results/A/... in the repo, backup.py stays backup.py). That's what
8
- makes this safe to call repeatedly, once per plan, without ever overwriting or deleting
9
- anything outside the target you asked for:
10
-
11
- - Each target's --allow-patterns scope is disjoint from every other target's (results/A
12
- vs results/B vs ... vs "data/spatial codes" vs "code"'s own paths), so backing up B can
13
- never touch what A already uploaded.
14
- - huggingface_hub's upload_large_folder() only ever adds or updates the files it's given
15
- -- it never deletes anything else already in the repo (no delete_patterns is passed
16
- here, ever), so re-running the same target later (more scenes finished, --rebuild
17
- reran a config, source files edited) just adds/updates those files' remote copies.
18
- - "symbolic" covers BOTH results/symbolic/<depth>/... (production) and
19
- results/symbolic/ground truth/... in one call, since the latter is already nested
20
- under the former; "spatial-codes" likewise covers both encoder-perceived
21
- ("data/spatial codes/<model>/...") and ground-truth ("data/spatial codes/ground
22
- truth/...") codes in one call, satisfying "upload after the regenerate spatial code
23
- parts" without a separate target for it.
24
- - "code" covers every source directory (harness, symbolic, analysis, corruption,
25
- encoder, inference, tests) plus the top-level README.md, backup.py, and setup.sh -- everything
26
- needed to reproduce or re-run the experiment, not just its output. Deliberately
27
- excludes data/ and results/ (covered by their own targets already) and experiments/
28
- (its own target below, not part of the reproducible pipeline this "code" target
29
- covers).
30
- - "experiments" covers the separate, concluded geometry-formula-tuning track (its own
31
- code, caches, and results all live under one experiments/ tree) -- kept as its own
32
- target rather than folded into "code" since it's large and conceptually separate from
33
- the main A/B/C/D/symbolic pipeline.
34
-
35
- Usage:
36
- python backup.py --repo-id <you>/<repo> --target A
37
- python backup.py --repo-id <you>/<repo> --target all
38
- HF_TOKEN=hf_xxx python backup.py --repo-id <you>/<repo> --target spatial-codes
39
- python backup.py --repo-id <you>/<repo> --target D --dry-run # no token/network needed
40
- python backup.py # fully interactive
41
-
42
- Run after each plan finishes:
43
- Plan A done -> python backup.py --repo-id <you>/<repo> --target A
44
- spatial codes regen'd -> python backup.py --repo-id <you>/<repo> --target spatial-codes
45
- Plan B done -> python backup.py --repo-id <you>/<repo> --target B
46
- Plan C done -> python backup.py --repo-id <you>/<repo> --target C
47
- Plan D done -> python backup.py --repo-id <you>/<repo> --target D
48
- blind floor (E) done -> python backup.py --repo-id <you>/<repo> --target E
49
- symbolic runs done -> python backup.py --repo-id <you>/<repo> --target symbolic
50
- code/setup changed -> python backup.py --repo-id <you>/<repo> --target code
51
- experiments/ changed -> python backup.py --repo-id <you>/<repo> --target experiments
52
-
53
- --repo-id, --target, and the Hugging Face token are all prompted for interactively
54
- (the token hidden) when not supplied via flag or $HF_TOKEN -- no separate shell wrapper
55
- needed to get that interactive setup.sh-style experience.
56
  """
57
 
58
  from __future__ import annotations
@@ -60,163 +11,139 @@ from __future__ import annotations
60
  import argparse
61
  import getpass
62
  import os
63
- import sys
64
  from pathlib import Path
65
 
66
- WORKSPACE_ROOT = Path(__file__).resolve().parent
 
 
67
 
68
- # name -> list of paths (directories or single files, relative to WORKSPACE_ROOT)
69
  TARGETS = {
70
- "A": ["results/A"],
71
- # results/B covers the main (512-budget) condition AND the budget dose-response
72
- # arm (16/32/64/128/256): the reasoning budget IS the extended protocol's
73
- # path segment and of every record's condition string, so the arm's runs are
74
- # path-separated and group-separated without needing their own target.
75
- # The flat-distance-table arm is listed alongside its own plan rather than as a
76
- # separate target: --flat-distance-table has no path segment of its own (unlike the
77
- # protocol/format/depth/tracking/input/frames axes), so the arm is isolated only by
78
- # the explicit --results-dir it is always run with -- "results/<plan>-flat-table".
79
- # That path sits BESIDE results/<plan>, not under it, so a plain results/B sweep
80
- # would silently miss it. Folding it in here keeps "back up plan B when B finishes"
81
- # a single command that cannot leave the arm behind, while the two patterns stay
82
- # disjoint from each other and from every other target.
83
- "B": ["results/B", "results/B-flat-table"],
84
- "C": ["results/C", "results/C-flat-table"],
85
- "D": ["results/D", "results/D-flat-table"],
86
- "E": ["results/E"],
87
- "corruption": ["results/corruption"],
88
- "calibration": ["results/calibration"],
89
- "symbolic": ["results/symbolic"],
90
- "spatial-codes": ["data/spatial codes"],
91
  "code": [
92
  "README.md",
93
- "backup.py",
94
  "setup.sh",
95
- "harness",
96
- "symbolic",
97
  "analysis",
98
- "corruption",
99
  "calibration",
 
100
  "encoder",
 
101
  "inference",
 
102
  "tests",
 
103
  ],
104
- "experiments": ["experiments"],
 
 
 
 
 
 
 
 
 
 
105
  }
106
 
107
 
108
  def _resolve_targets(target):
109
  if target == "all":
110
  return list(TARGETS)
111
- if target in TARGETS:
112
- return [target]
113
- raise ValueError(f"unknown target {target!r}; expected one of {list(TARGETS) + ['all']}")
 
 
 
 
 
 
 
 
114
 
115
 
116
- def _has_content(local_path):
117
- """True if this path is a real file, or a directory containing at least one file."""
118
- if local_path.is_file():
119
  return True
120
- if local_path.is_dir():
121
- return any(p.is_file() for p in local_path.rglob("*"))
122
  return False
123
 
124
 
125
- def _allow_pattern(path):
126
- """A directory needs a /** glob to sweep its contents; a single file's own relative
127
- path already IS the exact pattern upload_large_folder needs."""
128
- return f"{path}/**" if (WORKSPACE_ROOT / path).is_dir() else path
129
-
 
 
 
 
 
130
 
131
- def backup(repo_id, target, token=None, private=False, dry_run=False):
132
- """Upload one (or every) target's paths to repo_id, preserving their exact relative
133
- workspace paths. Returns the list of target names actually uploaded (skips any whose
134
- local paths don't exist yet or are empty)."""
135
- names = _resolve_targets(target)
136
 
137
- pending = []
138
- for name in names:
139
- paths = TARGETS[name]
140
- if not any(_has_content(WORKSPACE_ROOT / p) for p in paths):
141
- print(f"[{name}] skipped -- nothing found at {', '.join(paths)}")
142
- continue
143
- pending.append(name)
144
-
145
- if not pending:
146
- return []
147
-
148
- if dry_run:
149
- for name in pending:
150
- for path in TARGETS[name]:
151
- print(f"[{name}] would upload {WORKSPACE_ROOT / path} -> {repo_id}:{path}")
152
- return pending
153
-
154
- from huggingface_hub import HfApi
155
-
156
- api = HfApi(token=token)
157
- api.create_repo(repo_id=repo_id, repo_type="dataset", private=private, exist_ok=True)
158
-
159
- for name in pending:
160
- patterns = [_allow_pattern(p) for p in TARGETS[name]]
161
- print(f"[{name}] uploading {', '.join(TARGETS[name])} -> {repo_id} ...")
162
- api.upload_large_folder(
163
- repo_id=repo_id,
164
- repo_type="dataset",
165
- folder_path=str(WORKSPACE_ROOT),
166
- allow_patterns=patterns,
167
- )
168
- print(f"[{name}] done")
169
- return pending
170
 
171
 
172
- def main():
173
- parser = argparse.ArgumentParser()
174
- parser.add_argument(
175
- "--repo-id", default=None, help="e.g. yourname/vsi-spatial-code-results"
176
- )
177
- parser.add_argument("--target", default=None, choices=list(TARGETS) + ["all"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  parser.add_argument(
179
- "--token", default=None, help="defaults to $HF_TOKEN, then a cached hf login"
180
  )
181
- parser.add_argument("--private", action="store_true", help="create the repo private if new")
182
  parser.add_argument(
183
- "--dry-run", action="store_true",
184
- help="print what would be uploaded and exit -- no token or network needed",
185
  )
186
- args = parser.parse_args()
187
-
188
- repo_id = args.repo_id or input(
189
- "Hugging Face dataset repo to back up to (e.g. yourname/vsi-spatial-code-results): "
190
- ).strip()
191
- if not repo_id:
192
- parser.error("no repo given")
193
-
194
- target = args.target
195
- if target is None:
196
- target = input(f"Target [{'|'.join(list(TARGETS) + ['all'])}]: ").strip()
197
- if target not in TARGETS and target != "all":
198
- parser.error(f"unknown target {target!r}; expected one of {list(TARGETS) + ['all']}")
199
-
200
- token = args.token or os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN")
201
- if not args.dry_run and token is None:
202
- print(f"Hugging Face token needed to upload to {repo_id} (write access)")
203
- print("Create one at https://huggingface.co/settings/tokens")
204
- token = getpass.getpass("HF token (input hidden): ").strip()
205
  if not args.dry_run and not token:
206
- parser.error(
207
- "no Hugging Face token given -- pass --token, set $HF_TOKEN, or run "
208
- "`huggingface-cli login` first (not needed for --dry-run)"
209
- )
210
-
211
- uploaded = backup(
212
- repo_id, target, token=token, private=args.private, dry_run=args.dry_run
213
- )
214
- if not uploaded:
215
- print("nothing to upload")
216
- sys.exit(1)
217
- print(f"\n{'would upload' if args.dry_run else 'uploaded'} target(s): {', '.join(uploaded)}")
218
- if not args.dry_run:
219
- print(f"https://huggingface.co/datasets/{repo_id}")
220
 
221
 
222
  if __name__ == "__main__":
 
1
  #!/usr/bin/env python3
2
+ """Upload selected workspace artifacts to a Hugging Face dataset repository.
3
+
4
+ The script is intentionally conservative: dry-run mode never imports
5
+ ``huggingface_hub``, empty targets are skipped, and result targets are resolved from
6
+ ``/root`` while source/code targets are resolved from ``/workspace``.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  """
8
 
9
  from __future__ import annotations
 
11
  import argparse
12
  import getpass
13
  import os
 
14
  from pathlib import Path
15
 
16
+ WORKSPACE_ROOT = Path(os.environ.get("VSI_WORKSPACE_ROOT", "/workspace"))
17
+ RESULTS_HOST_ROOT = Path(os.environ.get("VSI_RESULTS_HOST_ROOT", "/root"))
18
+ DEFAULT_REPO = os.environ.get("VSI_BACKUP_REPO", "AntonioJun/workspace")
19
 
 
20
  TARGETS = {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  "code": [
22
  "README.md",
 
23
  "setup.sh",
24
+ "backup.py",
 
25
  "analysis",
 
26
  "calibration",
27
+ "corruption",
28
  "encoder",
29
+ "harness",
30
  "inference",
31
+ "symbolic",
32
  "tests",
33
+ "selective_frame_counts.csv",
34
  ],
35
+ "reports": ["reports"],
36
+ "spatial-codes": ["data/spatial codes", "bundles/spatial-codes.tar.gz"],
37
+ "caches": ["data/caches"],
38
+ "A": ["results/A"],
39
+ "B": ["results/B"],
40
+ "C": ["results/C"],
41
+ "D": ["results/D"],
42
+ "E": ["results/E"],
43
+ "F": ["results/F"],
44
+ "calibration": ["results/calibration"],
45
+ "corruption": ["results/corruption"],
46
  }
47
 
48
 
49
  def _resolve_targets(target):
50
  if target == "all":
51
  return list(TARGETS)
52
+ requested = [part.strip() for part in str(target).split(",") if part.strip()]
53
+ unknown = [name for name in requested if name not in TARGETS]
54
+ if unknown:
55
+ raise ValueError(f"unknown target(s): {', '.join(unknown)}")
56
+ return requested
57
+
58
+
59
+ def _local_path(relative):
60
+ relative = str(relative).lstrip("/")
61
+ root = RESULTS_HOST_ROOT if relative.startswith("results/") else WORKSPACE_ROOT
62
+ return root / relative
63
 
64
 
65
+ def _has_files(path):
66
+ path = Path(path)
67
+ if path.is_file():
68
  return True
69
+ if path.is_dir():
70
+ return any(child.is_file() for child in path.rglob("*"))
71
  return False
72
 
73
 
74
+ def _target_root(relatives):
75
+ roots = {
76
+ "results" if str(rel).lstrip("/").startswith("results/") else "workspace"
77
+ for rel in relatives
78
+ }
79
+ if len(roots) > 1:
80
+ raise ValueError(
81
+ f"target mixes incompatible workspace/results roots: {relatives}"
82
+ )
83
+ return RESULTS_HOST_ROOT if "results" in roots else WORKSPACE_ROOT
84
 
 
 
 
 
 
85
 
86
+ def _path_in_repo(relative):
87
+ return str(relative).lstrip("/")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
 
90
+ def backup(repo_id=DEFAULT_REPO, target="all", dry_run=False, token=None):
91
+ selected = _resolve_targets(target)
92
+ uploaded = []
93
+ for name in selected:
94
+ relatives = TARGETS[name]
95
+ _target_root(relatives)
96
+ existing = [(relative, _local_path(relative)) for relative in relatives]
97
+ existing = [(relative, path) for relative, path in existing if _has_files(path)]
98
+ if not existing:
99
+ print(f"[{name}] skipped: no files found")
100
+ continue
101
+ uploaded.append(name)
102
+ if dry_run:
103
+ for relative, path in existing:
104
+ print(
105
+ f"[{name}] would upload {path} -> {repo_id}/{_path_in_repo(relative)}"
106
+ )
107
+ continue
108
+ from huggingface_hub import HfApi
109
+
110
+ api = HfApi(token=token)
111
+ for relative, path in existing:
112
+ repo_path = _path_in_repo(relative)
113
+ if path.is_dir():
114
+ api.upload_folder(
115
+ folder_path=str(path),
116
+ repo_id=repo_id,
117
+ repo_type="dataset",
118
+ path_in_repo=repo_path,
119
+ )
120
+ else:
121
+ api.upload_file(
122
+ path_or_fileobj=str(path),
123
+ repo_id=repo_id,
124
+ repo_type="dataset",
125
+ path_in_repo=repo_path,
126
+ )
127
+ print(f"[{name}] uploaded {path} -> {repo_id}/{repo_path}")
128
+ return uploaded
129
+
130
+
131
+ def main(argv=None):
132
+ parser = argparse.ArgumentParser(description=__doc__)
133
  parser.add_argument(
134
+ "target", nargs="?", default="all", help="target name, comma list, or all"
135
  )
136
+ parser.add_argument("--repo", default=DEFAULT_REPO)
137
  parser.add_argument(
138
+ "--token",
139
+ default=os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN"),
140
  )
141
+ parser.add_argument("--dry-run", action="store_true")
142
+ args = parser.parse_args(argv)
143
+ token = args.token
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  if not args.dry_run and not token:
145
+ token = getpass.getpass("HF token: ")
146
+ backup(args.repo, args.target, dry_run=args.dry_run, token=token)
 
 
 
 
 
 
 
 
 
 
 
 
147
 
148
 
149
  if __name__ == "__main__":
calibration/__init__.py CHANGED
@@ -26,5 +26,5 @@ from harness.A import WORKSPACE_ROOT
26
  # One JSON per question:
27
  # results/calibration/<model>/<spatial_code_format>/<budget>/<scene>/<question_id>.json
28
  RESULTS_DIR = Path(
29
- os.environ.get("VSI_CALIBRATION_RESULTS_DIR", WORKSPACE_ROOT / "results" / "calibration")
30
  )
 
26
  # One JSON per question:
27
  # results/calibration/<model>/<spatial_code_format>/<budget>/<scene>/<question_id>.json
28
  RESULTS_DIR = Path(
29
+ os.environ.get("VSI_CALIBRATION_RESULTS_DIR", "/root/results/calibration")
30
  )
calibration/__pycache__/__init__.cpython-311.pyc CHANGED
Binary files a/calibration/__pycache__/__init__.cpython-311.pyc and b/calibration/__pycache__/__init__.cpython-311.pyc differ
 
calibration/__pycache__/run.cpython-311.pyc CHANGED
Binary files a/calibration/__pycache__/run.cpython-311.pyc and b/calibration/__pycache__/run.cpython-311.pyc differ
 
calibration/report.py CHANGED
@@ -26,7 +26,7 @@ WORKSPACE_ROOT = Path(__file__).resolve().parent.parent
26
  if str(WORKSPACE_ROOT) not in sys.path:
27
  sys.path.insert(0, str(WORKSPACE_ROOT))
28
 
29
- from analysis.aggregate import _official_scores, iter_records # noqa: E402
30
  from calibration import RESULTS_DIR # noqa: E402
31
 
32
 
@@ -53,7 +53,15 @@ def load_grid(results_dir=None):
53
  )
54
  if not has_question_files:
55
  continue
56
- records = {r["question_id"]: r for r in iter_records(budget_dir)}
 
 
 
 
 
 
 
 
57
  if records:
58
  cell = str(budget_dir.parent.relative_to(root))
59
  grid[cell][budget_dir.name] = records
@@ -76,7 +84,9 @@ def cell_stats(records):
76
  "natural_reasoning_tokens_mean": (
77
  statistics.mean(natural_lengths) if natural_lengths else None
78
  ),
79
- "generation_seconds_mean": statistics.mean(r["generation_seconds"] for r in rows),
 
 
80
  }
81
 
82
 
@@ -99,7 +109,8 @@ def report(grid, tolerance=1.0, max_forced_rate=0.15):
99
  # ("512-prose-legend", ...) are shown as rows but never recommended, since they
100
  # change the prompt, not just the budget.
101
  scored = {
102
- b: s for b, s in stats.items()
 
103
  if s["overall"] is not None and str(b).isdigit()
104
  }
105
  recommended = None
@@ -124,11 +135,16 @@ def main():
124
  parser = argparse.ArgumentParser()
125
  parser.add_argument("--results-dir", default=None)
126
  parser.add_argument(
127
- "--tolerance", type=float, default=1.0,
 
 
128
  help="accuracy points a budget may trail the best and still be recommended",
129
  )
130
  parser.add_argument(
131
- "--max-forced-rate", type=float, default=0.15, dest="max_forced_rate",
 
 
 
132
  help="maximum acceptable forced-continuation rate for a recommended budget",
133
  )
134
  parser.add_argument("--json", action="store_true")
@@ -138,7 +154,9 @@ def main():
138
  if not grid:
139
  print("no calibration results found -- run calibration.run first")
140
  raise SystemExit(1)
141
- result = report(grid, tolerance=args.tolerance, max_forced_rate=args.max_forced_rate)
 
 
142
  if args.json:
143
  print(json.dumps(result, indent=1))
144
  return
@@ -146,10 +164,15 @@ def main():
146
  print(f"=== {model} ({model_report['questions']} shared questions) ===")
147
  for budget, stats in model_report["budgets"].items():
148
  overall = f"{stats['overall']:.2f}" if stats["overall"] is not None else "-"
149
- forced = f"{stats['forced_rate']:.3f}" if stats["forced_rate"] is not None else "-"
 
 
 
 
150
  natural = (
151
  f"{stats['natural_reasoning_tokens_mean']:.0f}"
152
- if stats["natural_reasoning_tokens_mean"] is not None else "-"
 
153
  )
154
  print(
155
  f" {str(budget):>18}: overall={overall} forced_rate={forced} "
 
26
  if str(WORKSPACE_ROOT) not in sys.path:
27
  sys.path.insert(0, str(WORKSPACE_ROOT))
28
 
29
+ from analysis.letters_reports import _official_scores # noqa: E402
30
  from calibration import RESULTS_DIR # noqa: E402
31
 
32
 
 
53
  )
54
  if not has_question_files:
55
  continue
56
+ records = {}
57
+ for record_path in sorted(budget_dir.rglob("*.json")):
58
+ try:
59
+ with record_path.open(encoding="utf-8") as stream:
60
+ record = json.load(stream)
61
+ except (OSError, json.JSONDecodeError):
62
+ continue
63
+ if isinstance(record, dict) and "question_id" in record:
64
+ records[record["question_id"]] = record
65
  if records:
66
  cell = str(budget_dir.parent.relative_to(root))
67
  grid[cell][budget_dir.name] = records
 
84
  "natural_reasoning_tokens_mean": (
85
  statistics.mean(natural_lengths) if natural_lengths else None
86
  ),
87
+ "generation_seconds_mean": statistics.mean(
88
+ r["generation_seconds"] for r in rows
89
+ ),
90
  }
91
 
92
 
 
109
  # ("512-prose-legend", ...) are shown as rows but never recommended, since they
110
  # change the prompt, not just the budget.
111
  scored = {
112
+ b: s
113
+ for b, s in stats.items()
114
  if s["overall"] is not None and str(b).isdigit()
115
  }
116
  recommended = None
 
135
  parser = argparse.ArgumentParser()
136
  parser.add_argument("--results-dir", default=None)
137
  parser.add_argument(
138
+ "--tolerance",
139
+ type=float,
140
+ default=1.0,
141
  help="accuracy points a budget may trail the best and still be recommended",
142
  )
143
  parser.add_argument(
144
+ "--max-forced-rate",
145
+ type=float,
146
+ default=0.15,
147
+ dest="max_forced_rate",
148
  help="maximum acceptable forced-continuation rate for a recommended budget",
149
  )
150
  parser.add_argument("--json", action="store_true")
 
154
  if not grid:
155
  print("no calibration results found -- run calibration.run first")
156
  raise SystemExit(1)
157
+ result = report(
158
+ grid, tolerance=args.tolerance, max_forced_rate=args.max_forced_rate
159
+ )
160
  if args.json:
161
  print(json.dumps(result, indent=1))
162
  return
 
164
  print(f"=== {model} ({model_report['questions']} shared questions) ===")
165
  for budget, stats in model_report["budgets"].items():
166
  overall = f"{stats['overall']:.2f}" if stats["overall"] is not None else "-"
167
+ forced = (
168
+ f"{stats['forced_rate']:.3f}"
169
+ if stats["forced_rate"] is not None
170
+ else "-"
171
+ )
172
  natural = (
173
  f"{stats['natural_reasoning_tokens_mean']:.0f}"
174
+ if stats["natural_reasoning_tokens_mean"] is not None
175
+ else "-"
176
  )
177
  print(
178
  f" {str(budget):>18}: overall={overall} forced_rate={forced} "
calibration/run.py CHANGED
@@ -42,12 +42,20 @@ from harness.B import ( # noqa: E402
42
  from harness.B import launch as harness_b_launch # noqa: E402
43
 
44
 
45
- def results_dir_for(model, spatial_code_format, depth, tracking, input_selection, frame_count, budget):
 
 
46
  """Return the result root isolated by every pilot axis -- model, format, the full
47
  perceived-code config, and the reasoning budget -- so no two pilots collide."""
48
  return (
49
- RESULTS_DIR / model / spatial_code_format / depth / tracking
50
- / input_selection / str(frame_count) / str(budget)
 
 
 
 
 
 
51
  )
52
 
53
 
@@ -69,8 +77,14 @@ def scenes_for(question_ids):
69
 
70
 
71
  def run_grid(
72
- models, budgets, question_ids, spatial_code_format,
73
- depth, tracking, input_selection, frame_count,
 
 
 
 
 
 
74
  rebuild=False,
75
  strip_schema_legend=False,
76
  prose_legend=False,
@@ -89,7 +103,10 @@ def run_grid(
89
  )
90
  plan = build_plan(models, budgets)
91
  for index, (model, budget) in enumerate(plan, start=1):
92
- print(f"=== calibration {index}/{len(plan)}: {model} @ {budget} tokens ===", flush=True)
 
 
 
93
  variant_parts = [str(budget)]
94
  if thinking:
95
  variant_parts.append("thinking")
@@ -110,11 +127,21 @@ def run_grid(
110
 
111
  harness_kwargs["context_line"] = NO_LEGEND_PRE_PROMPT
112
  harness_b_launch.launch(
113
- model, spatial_code_format, input_selection, frame_count, selected_scenes,
114
- depth=depth, tracking=tracking,
 
 
 
 
 
115
  results_dir=results_dir_for(
116
- model, spatial_code_format, depth, tracking, input_selection,
117
- frame_count, variant,
 
 
 
 
 
118
  ),
119
  rebuild=rebuild,
120
  reasoning_budget=budget,
@@ -129,49 +156,65 @@ def run_grid(
129
  def main():
130
  parser = argparse.ArgumentParser()
131
  parser.add_argument(
132
- "--models", required=True,
 
133
  help=f"comma-separated models (or 'all'); one of {vlm_models.available_models()}",
134
  )
135
  parser.add_argument(
136
- "--budgets", required=True,
 
137
  help="comma-separated reasoning budgets in tokens -- entirely your choice",
138
  )
139
  parser.add_argument(
140
- "--questions", default=None,
 
141
  help="comma-separated VSI-Bench question ids to test",
142
  )
143
  parser.add_argument(
144
- "--questions-file", default=None, dest="questions_file",
 
 
145
  help="path to a JSON list of question ids (alternative to --questions)",
146
  )
147
  parser.add_argument(
148
- "--spatial-code-format", required=True, choices=SPATIAL_CODE_FORMATS,
 
 
149
  dest="spatial_code_format",
150
  )
151
  parser.add_argument("--depth", required=True, choices=DEPTH_VARIANTS)
152
  parser.add_argument("--tracking", required=True, choices=TRACKING_MODES)
153
  parser.add_argument(
154
- "--input-selection", required=True, choices=INPUT_SELECTIONS,
 
 
155
  dest="input_selection",
156
  )
157
  parser.add_argument("--frames", type=int, required=True)
158
  parser.add_argument(
159
- "--no-schema-legend", action="store_true", dest="strip_schema_legend",
 
 
160
  help="legend-ablation arm: drop the embedded schema legend; results land in "
161
  "a '<budget>-no-legend' sibling directory so the standard cells stay intact",
162
  )
163
  parser.add_argument(
164
- "--prose-legend", action="store_true", dest="prose_legend",
 
 
165
  help="legacy-legend arm: prose legend before the code instead of the embedded "
166
  "schema block; results land in a '<budget>-prose-legend' sibling directory",
167
  )
168
  parser.add_argument(
169
- "--reasoning-note", action="store_true", dest="reasoning_note",
 
 
170
  help="Thinking-with-Spatial-Code step-by-step note prefixed to the "
171
  "post-prompt; results land in a '<budget>-reasoning' sibling directory",
172
  )
173
  parser.add_argument(
174
- "--thinking", action="store_true",
 
175
  help="enable native thinking mode (Qwen only); results land in a "
176
  "'<budget>-thinking[...]' sibling directory",
177
  )
@@ -179,7 +222,9 @@ def main():
179
  args = parser.parse_args()
180
 
181
  try:
182
- models = _parse_csv_choice(args.models, vlm_models.available_models(), "--models")
 
 
183
  except ValueError as exc:
184
  parser.error(str(exc))
185
  budgets = []
@@ -208,8 +253,14 @@ def main():
208
  parser.error("--frames must be positive")
209
  try:
210
  run_grid(
211
- models, budgets, question_ids, args.spatial_code_format,
212
- args.depth, args.tracking, args.input_selection, args.frames,
 
 
 
 
 
 
213
  rebuild=args.rebuild,
214
  strip_schema_legend=args.strip_schema_legend,
215
  prose_legend=args.prose_legend,
 
42
  from harness.B import launch as harness_b_launch # noqa: E402
43
 
44
 
45
+ def results_dir_for(
46
+ model, spatial_code_format, depth, tracking, input_selection, frame_count, budget
47
+ ):
48
  """Return the result root isolated by every pilot axis -- model, format, the full
49
  perceived-code config, and the reasoning budget -- so no two pilots collide."""
50
  return (
51
+ RESULTS_DIR
52
+ / model
53
+ / spatial_code_format
54
+ / depth
55
+ / tracking
56
+ / input_selection
57
+ / str(frame_count)
58
+ / str(budget)
59
  )
60
 
61
 
 
77
 
78
 
79
  def run_grid(
80
+ models,
81
+ budgets,
82
+ question_ids,
83
+ spatial_code_format,
84
+ depth,
85
+ tracking,
86
+ input_selection,
87
+ frame_count,
88
  rebuild=False,
89
  strip_schema_legend=False,
90
  prose_legend=False,
 
103
  )
104
  plan = build_plan(models, budgets)
105
  for index, (model, budget) in enumerate(plan, start=1):
106
+ print(
107
+ f"=== calibration {index}/{len(plan)}: {model} @ {budget} tokens ===",
108
+ flush=True,
109
+ )
110
  variant_parts = [str(budget)]
111
  if thinking:
112
  variant_parts.append("thinking")
 
127
 
128
  harness_kwargs["context_line"] = NO_LEGEND_PRE_PROMPT
129
  harness_b_launch.launch(
130
+ model,
131
+ spatial_code_format,
132
+ input_selection,
133
+ frame_count,
134
+ selected_scenes,
135
+ depth=depth,
136
+ tracking=tracking,
137
  results_dir=results_dir_for(
138
+ model,
139
+ spatial_code_format,
140
+ depth,
141
+ tracking,
142
+ input_selection,
143
+ frame_count,
144
+ variant,
145
  ),
146
  rebuild=rebuild,
147
  reasoning_budget=budget,
 
156
  def main():
157
  parser = argparse.ArgumentParser()
158
  parser.add_argument(
159
+ "--models",
160
+ required=True,
161
  help=f"comma-separated models (or 'all'); one of {vlm_models.available_models()}",
162
  )
163
  parser.add_argument(
164
+ "--budgets",
165
+ required=True,
166
  help="comma-separated reasoning budgets in tokens -- entirely your choice",
167
  )
168
  parser.add_argument(
169
+ "--questions",
170
+ default=None,
171
  help="comma-separated VSI-Bench question ids to test",
172
  )
173
  parser.add_argument(
174
+ "--questions-file",
175
+ default=None,
176
+ dest="questions_file",
177
  help="path to a JSON list of question ids (alternative to --questions)",
178
  )
179
  parser.add_argument(
180
+ "--spatial-code-format",
181
+ required=True,
182
+ choices=SPATIAL_CODE_FORMATS,
183
  dest="spatial_code_format",
184
  )
185
  parser.add_argument("--depth", required=True, choices=DEPTH_VARIANTS)
186
  parser.add_argument("--tracking", required=True, choices=TRACKING_MODES)
187
  parser.add_argument(
188
+ "--input-selection",
189
+ required=True,
190
+ choices=INPUT_SELECTIONS,
191
  dest="input_selection",
192
  )
193
  parser.add_argument("--frames", type=int, required=True)
194
  parser.add_argument(
195
+ "--no-schema-legend",
196
+ action="store_true",
197
+ dest="strip_schema_legend",
198
  help="legend-ablation arm: drop the embedded schema legend; results land in "
199
  "a '<budget>-no-legend' sibling directory so the standard cells stay intact",
200
  )
201
  parser.add_argument(
202
+ "--prose-legend",
203
+ action="store_true",
204
+ dest="prose_legend",
205
  help="legacy-legend arm: prose legend before the code instead of the embedded "
206
  "schema block; results land in a '<budget>-prose-legend' sibling directory",
207
  )
208
  parser.add_argument(
209
+ "--reasoning-note",
210
+ action="store_true",
211
+ dest="reasoning_note",
212
  help="Thinking-with-Spatial-Code step-by-step note prefixed to the "
213
  "post-prompt; results land in a '<budget>-reasoning' sibling directory",
214
  )
215
  parser.add_argument(
216
+ "--thinking",
217
+ action="store_true",
218
  help="enable native thinking mode (Qwen only); results land in a "
219
  "'<budget>-thinking[...]' sibling directory",
220
  )
 
222
  args = parser.parse_args()
223
 
224
  try:
225
+ models = _parse_csv_choice(
226
+ args.models, vlm_models.available_models(), "--models"
227
+ )
228
  except ValueError as exc:
229
  parser.error(str(exc))
230
  budgets = []
 
253
  parser.error("--frames must be positive")
254
  try:
255
  run_grid(
256
+ models,
257
+ budgets,
258
+ question_ids,
259
+ args.spatial_code_format,
260
+ args.depth,
261
+ args.tracking,
262
+ args.input_selection,
263
+ args.frames,
264
  rebuild=args.rebuild,
265
  strip_schema_legend=args.strip_schema_legend,
266
  prose_legend=args.prose_legend,
corruption/__pycache__/__init__.cpython-311.pyc CHANGED
Binary files a/corruption/__pycache__/__init__.cpython-311.pyc and b/corruption/__pycache__/__init__.cpython-311.pyc differ
 
corruption/__pycache__/chimera.cpython-311.pyc CHANGED
Binary files a/corruption/__pycache__/chimera.cpython-311.pyc and b/corruption/__pycache__/chimera.cpython-311.pyc differ
 
corruption/__pycache__/empirical.cpython-311.pyc CHANGED
Binary files a/corruption/__pycache__/empirical.cpython-311.pyc and b/corruption/__pycache__/empirical.cpython-311.pyc differ
 
corruption/__pycache__/launch.cpython-311.pyc CHANGED
Binary files a/corruption/__pycache__/launch.cpython-311.pyc and b/corruption/__pycache__/launch.cpython-311.pyc differ
 
corruption/__pycache__/run.cpython-311.pyc CHANGED
Binary files a/corruption/__pycache__/run.cpython-311.pyc and b/corruption/__pycache__/run.cpython-311.pyc differ
 
corruption/__pycache__/transforms.cpython-311.pyc CHANGED
Binary files a/corruption/__pycache__/transforms.cpython-311.pyc and b/corruption/__pycache__/transforms.cpython-311.pyc differ
 
corruption/chimera.py CHANGED
@@ -29,7 +29,9 @@ def _copy(code):
29
 
30
 
31
  def _center(instance):
32
- return instance["3D oriented bounding box"]["3D oriented bounding box center coordinates"]
 
 
33
 
34
 
35
  def _distance(a, b):
@@ -44,9 +46,7 @@ def _swap_boxes(target_code, source_code):
44
  swapped = 0
45
  total = 0
46
  for class_name, items in code["objects"].items():
47
- available = [
48
- _copy(item) for item in source_code["objects"].get(class_name, [])
49
- ]
50
  for item in items:
51
  total += 1
52
  if not available:
@@ -94,6 +94,7 @@ def perturb_single_object(code, rng, position_offset_meters=1.0, size_scale=2.0)
94
  center[2],
95
  ]
96
  box["3D oriented bounding box dimensions"] = [
97
- round(value * size_scale, 2) for value in box["3D oriented bounding box dimensions"]
 
98
  ]
99
  return code, {"class": class_name, "instance": index}
 
29
 
30
 
31
  def _center(instance):
32
+ return instance["3D oriented bounding box"][
33
+ "3D oriented bounding box center coordinates"
34
+ ]
35
 
36
 
37
  def _distance(a, b):
 
46
  swapped = 0
47
  total = 0
48
  for class_name, items in code["objects"].items():
49
+ available = [_copy(item) for item in source_code["objects"].get(class_name, [])]
 
 
50
  for item in items:
51
  total += 1
52
  if not available:
 
94
  center[2],
95
  ]
96
  box["3D oriented bounding box dimensions"] = [
97
+ round(value * size_scale, 2)
98
+ for value in box["3D oriented bounding box dimensions"]
99
  ]
100
  return code, {"class": class_name, "instance": index}
corruption/empirical.py CHANGED
@@ -28,7 +28,9 @@ if str(WORKSPACE_ROOT) not in sys.path:
28
 
29
 
30
  def _center(instance):
31
- return instance["3D oriented bounding box"]["3D oriented bounding box center coordinates"]
 
 
32
 
33
 
34
  def _dimensions(instance):
@@ -59,7 +61,9 @@ def measure_residuals(code_pairs):
59
  continue
60
  best = min(
61
  unmatched,
62
- key=lambda index: math.dist(_center(perceived[index]), _center(gt_item)),
 
 
63
  )
64
  unmatched.remove(best)
65
  matched += 1
@@ -70,7 +74,9 @@ def measure_residuals(code_pairs):
70
  dimension_ratios.append(
71
  [
72
  round(p / g, 4) if g else 1.0
73
- for p, g in zip(_dimensions(perceived[best]), _dimensions(gt_item))
 
 
74
  ]
75
  )
76
  hallucinated += len(unmatched)
@@ -83,7 +89,9 @@ def measure_residuals(code_pairs):
83
  "missed": missed,
84
  "hallucinated": hallucinated,
85
  "miss_rate": missed / gt_total if gt_total else 0.0,
86
- "hallucination_rate": hallucinated / perceived_total if perceived_total else 0.0,
 
 
87
  }
88
 
89
 
@@ -148,9 +156,13 @@ def main():
148
 
149
  parser = argparse.ArgumentParser()
150
  parser.add_argument("--depth", required=True, choices=("relative", "metric"))
151
- parser.add_argument("--tracking", required=True, choices=("tracking", "no tracking"))
152
  parser.add_argument(
153
- "--input-selection", required=True, choices=("uniform", "selective"),
 
 
 
 
 
154
  dest="input_selection",
155
  )
156
  parser.add_argument("--frames", type=int, required=True)
@@ -168,7 +180,12 @@ def main():
168
  seen.add(scene)
169
  perceived_path = Path(
170
  encoder_config.spatial_code_path(
171
- scene, args.depth, args.input_selection, args.tracking, args.frames, "compact"
 
 
 
 
 
172
  )
173
  )
174
  gt_path = Path(ground_truth_spatial_code_path(scene, "compact"))
 
28
 
29
 
30
  def _center(instance):
31
+ return instance["3D oriented bounding box"][
32
+ "3D oriented bounding box center coordinates"
33
+ ]
34
 
35
 
36
  def _dimensions(instance):
 
61
  continue
62
  best = min(
63
  unmatched,
64
+ key=lambda index: math.dist(
65
+ _center(perceived[index]), _center(gt_item)
66
+ ),
67
  )
68
  unmatched.remove(best)
69
  matched += 1
 
74
  dimension_ratios.append(
75
  [
76
  round(p / g, 4) if g else 1.0
77
+ for p, g in zip(
78
+ _dimensions(perceived[best]), _dimensions(gt_item)
79
+ )
80
  ]
81
  )
82
  hallucinated += len(unmatched)
 
89
  "missed": missed,
90
  "hallucinated": hallucinated,
91
  "miss_rate": missed / gt_total if gt_total else 0.0,
92
+ "hallucination_rate": (
93
+ hallucinated / perceived_total if perceived_total else 0.0
94
+ ),
95
  }
96
 
97
 
 
156
 
157
  parser = argparse.ArgumentParser()
158
  parser.add_argument("--depth", required=True, choices=("relative", "metric"))
 
159
  parser.add_argument(
160
+ "--tracking", required=True, choices=("tracking", "no tracking")
161
+ )
162
+ parser.add_argument(
163
+ "--input-selection",
164
+ required=True,
165
+ choices=("uniform", "selective"),
166
  dest="input_selection",
167
  )
168
  parser.add_argument("--frames", type=int, required=True)
 
180
  seen.add(scene)
181
  perceived_path = Path(
182
  encoder_config.spatial_code_path(
183
+ scene,
184
+ args.depth,
185
+ args.input_selection,
186
+ args.tracking,
187
+ args.frames,
188
+ "compact",
189
  )
190
  )
191
  gt_path = Path(ground_truth_spatial_code_path(scene, "compact"))
corruption/launch.py CHANGED
@@ -32,29 +32,45 @@ def main():
32
  parser.add_argument(
33
  "--models", default=None, help="comma-separated (required unless --arm solver)"
34
  )
35
- parser.add_argument("--transforms", required=True, help="comma-separated transform names")
36
- parser.add_argument("--magnitudes", required=True, help="comma-separated magnitudes")
37
  parser.add_argument(
38
- "--spatial-code-format", default="explicit", choices=("explicit", "compact"),
 
 
 
 
 
 
 
 
39
  dest="spatial_code_format",
40
  )
41
  parser.add_argument("--scenes", default=None, help="comma-separated scenes")
42
  parser.add_argument("--sample", default=None, help="JSON list of question ids")
43
  parser.add_argument(
44
- "--depth", default=None, choices=("relative", "metric"),
 
 
45
  help="chimera transforms only: the perceived codes' Step-2 config",
46
  )
47
  parser.add_argument(
48
- "--tracking", default=None, choices=("tracking", "no tracking"),
 
 
 
 
 
 
 
 
 
49
  help="chimera transforms only",
50
  )
51
  parser.add_argument(
52
- "--input-selection", default=None, choices=("uniform", "selective"),
53
- dest="input_selection", help="chimera transforms only",
54
  )
55
- parser.add_argument("--frames", type=int, default=None, help="chimera transforms only")
56
  parser.add_argument(
57
- "--residuals", default=None,
 
58
  help="empirical transform only: corruption.empirical's measured-residuals JSON",
59
  )
60
  args = parser.parse_args()
@@ -62,7 +78,9 @@ def main():
62
  transforms = [t.strip() for t in args.transforms.split(",") if t.strip()]
63
  unknown = [t for t in transforms if t not in ALL_CONDITIONS]
64
  if unknown:
65
- parser.error(f"unknown transform(s) {unknown}; expected one of {ALL_CONDITIONS}")
 
 
66
  magnitudes = [float(m.strip()) for m in args.magnitudes.split(",") if m.strip()]
67
  models = []
68
  if args.arm in ("vlm", "both"):
@@ -74,7 +92,9 @@ def main():
74
  parser.error(f"unknown model(s) {bad}")
75
  scenes = None
76
  if args.scenes:
77
- scenes = list(dict.fromkeys(s.strip() for s in args.scenes.split(",") if s.strip()))
 
 
78
  question_ids = None
79
  if args.sample:
80
  with open(args.sample, encoding="utf-8") as stream:
@@ -100,17 +120,29 @@ def main():
100
 
101
  conditions = [(t, m) for t in transforms for m in magnitudes]
102
  for index, (transform, magnitude) in enumerate(conditions, start=1):
103
- print(f"=== corruption {index}/{len(conditions)}: {transform}@{magnitude} ===", flush=True)
 
 
 
104
  if args.arm in ("solver", "both"):
105
  results = run_solver(
106
- transform, magnitude, args.spatial_code_format,
107
- scenes=scenes, question_ids=question_ids, **condition_kwargs,
 
 
 
 
108
  )
109
  print(f" [solver] {len(results)} questions", flush=True)
110
  for model in models:
111
  results = run_vlm(
112
- model, transform, magnitude, args.spatial_code_format,
113
- scenes=scenes, question_ids=question_ids, **condition_kwargs,
 
 
 
 
 
114
  )
115
  print(f" [{model}] {len(results)} questions", flush=True)
116
 
 
32
  parser.add_argument(
33
  "--models", default=None, help="comma-separated (required unless --arm solver)"
34
  )
 
 
35
  parser.add_argument(
36
+ "--transforms", required=True, help="comma-separated transform names"
37
+ )
38
+ parser.add_argument(
39
+ "--magnitudes", required=True, help="comma-separated magnitudes"
40
+ )
41
+ parser.add_argument(
42
+ "--spatial-code-format",
43
+ default="explicit",
44
+ choices=("explicit", "compact"),
45
  dest="spatial_code_format",
46
  )
47
  parser.add_argument("--scenes", default=None, help="comma-separated scenes")
48
  parser.add_argument("--sample", default=None, help="JSON list of question ids")
49
  parser.add_argument(
50
+ "--depth",
51
+ default=None,
52
+ choices=("relative", "metric"),
53
  help="chimera transforms only: the perceived codes' Step-2 config",
54
  )
55
  parser.add_argument(
56
+ "--tracking",
57
+ default=None,
58
+ choices=("tracking", "no tracking"),
59
+ help="chimera transforms only",
60
+ )
61
+ parser.add_argument(
62
+ "--input-selection",
63
+ default=None,
64
+ choices=("uniform", "selective"),
65
+ dest="input_selection",
66
  help="chimera transforms only",
67
  )
68
  parser.add_argument(
69
+ "--frames", type=int, default=None, help="chimera transforms only"
 
70
  )
 
71
  parser.add_argument(
72
+ "--residuals",
73
+ default=None,
74
  help="empirical transform only: corruption.empirical's measured-residuals JSON",
75
  )
76
  args = parser.parse_args()
 
78
  transforms = [t.strip() for t in args.transforms.split(",") if t.strip()]
79
  unknown = [t for t in transforms if t not in ALL_CONDITIONS]
80
  if unknown:
81
+ parser.error(
82
+ f"unknown transform(s) {unknown}; expected one of {ALL_CONDITIONS}"
83
+ )
84
  magnitudes = [float(m.strip()) for m in args.magnitudes.split(",") if m.strip()]
85
  models = []
86
  if args.arm in ("vlm", "both"):
 
92
  parser.error(f"unknown model(s) {bad}")
93
  scenes = None
94
  if args.scenes:
95
+ scenes = list(
96
+ dict.fromkeys(s.strip() for s in args.scenes.split(",") if s.strip())
97
+ )
98
  question_ids = None
99
  if args.sample:
100
  with open(args.sample, encoding="utf-8") as stream:
 
120
 
121
  conditions = [(t, m) for t in transforms for m in magnitudes]
122
  for index, (transform, magnitude) in enumerate(conditions, start=1):
123
+ print(
124
+ f"=== corruption {index}/{len(conditions)}: {transform}@{magnitude} ===",
125
+ flush=True,
126
+ )
127
  if args.arm in ("solver", "both"):
128
  results = run_solver(
129
+ transform,
130
+ magnitude,
131
+ args.spatial_code_format,
132
+ scenes=scenes,
133
+ question_ids=question_ids,
134
+ **condition_kwargs,
135
  )
136
  print(f" [solver] {len(results)} questions", flush=True)
137
  for model in models:
138
  results = run_vlm(
139
+ model,
140
+ transform,
141
+ magnitude,
142
+ args.spatial_code_format,
143
+ scenes=scenes,
144
+ question_ids=question_ids,
145
+ **condition_kwargs,
146
  )
147
  print(f" [{model}] {len(results)} questions", flush=True)
148
 
corruption/run.py CHANGED
@@ -72,7 +72,9 @@ def single_object_info(scene, magnitude):
72
  fully determined by the frozen seed, so it can be recovered at any time. H6's
73
  analysis needs this to select the questions that mention the perturbed object."""
74
  rng = random.Random(_seed_for(scene, "single-object", magnitude))
75
- _code, info = chimera_mod.perturb_single_object(load_ground_truth_compact(scene), rng)
 
 
76
  return info
77
 
78
 
@@ -106,7 +108,9 @@ def corrupted_compact(
106
  return perturbed
107
  if transform == "empirical":
108
  if residuals is None:
109
- raise ValueError("empirical requires measured residuals (corruption.empirical)")
 
 
110
  return empirical_mod.empirical_noise(code, residuals, rng, scale=magnitude)
111
  if transform in CHIMERA_CONDITIONS:
112
  if perceived_config is None:
@@ -120,16 +124,23 @@ def corrupted_compact(
120
  "compact",
121
  )
122
  if transform == "chimera-gt-inventory":
123
- hybrid, _coverage = chimera_mod.gt_inventory_perceived_geometry(code, perceived)
 
 
124
  else:
125
- hybrid, _coverage = chimera_mod.perceived_inventory_gt_geometry(code, perceived)
 
 
126
  return hybrid
127
- raise ValueError(f"unknown transform {transform!r}; expected one of {ALL_CONDITIONS}")
 
 
128
 
129
 
130
  def corrupted_code(scene, transform, magnitude, spatial_code_format, **kwargs):
131
  """Corrupt the compact code, then derive the requested format from it -- the same
132
- derivation path the encoder uses, so both formats stay consistent under corruption."""
 
133
  compact = corrupted_compact(scene, transform, magnitude, **kwargs)
134
  if spatial_code_format == "compact":
135
  return compact
@@ -146,14 +157,23 @@ def make_code_transform(transform, magnitude, **kwargs):
146
  """Build the ``harness.D.run.run(code_transform=...)`` hook for one condition."""
147
 
148
  def hook(_loaded_code, scene_id, spatial_code_format):
149
- return corrupted_code(scene_id, transform, magnitude, spatial_code_format, **kwargs)
 
 
150
 
151
  return hook
152
 
153
 
154
  def run_vlm(
155
- model, transform, magnitude, spatial_code_format="explicit", scenes=None, limit=None,
156
- question_ids=None, results_dir=None, **kwargs
 
 
 
 
 
 
 
157
  ):
158
  """Answer the sampled questions with one VLM on corrupted codes, through
159
  harness.D's unmodified path. Returns harness.D-shape records."""
@@ -173,28 +193,44 @@ def run_vlm(
173
 
174
 
175
  def run_solver(
176
- transform, magnitude, spatial_code_format="explicit", scenes=None, limit=None,
177
- question_ids=None, write_results=True, results_dir=None, **kwargs
 
 
 
 
 
 
 
178
  ):
179
  """Answer the sampled questions with the symbolic solver on the SAME corrupted
180
  codes -- the zero-GPU second reasoner for every corruption arm."""
181
  rows = load_questions(None, None, scenes, limit)
182
  if question_ids is not None:
183
  rows = [row for row in rows if row["id"] in question_ids]
184
- root = Path(results_dir or results_dir_for("solver", transform, magnitude, "symbolic"))
 
 
185
  code_cache = {}
186
  results = []
187
  for row in rows:
188
  scene = row["scene_name"]
189
  if scene not in code_cache:
190
- code = corrupted_code(scene, transform, magnitude, spatial_code_format, **kwargs)
 
 
191
  code_cache[scene] = adapters.adapt_spatial_code(code)
192
  answer = solver.answer(
193
  row["question_type"], row["question"], row["options"], code_cache[scene]
194
  )
195
  pred = "" if answer is None else str(answer)
196
- doc = {"question_type": row["question_type"], "ground_truth": row["ground_truth"]}
197
- score_doc = vsi_official_eval.vsibench_process_results(doc, [pred])["vsibench_score"]
 
 
 
 
 
198
  metric_name, score = _scalar_score(row["question_type"], score_doc)
199
  record = {
200
  "model": "symbolic",
@@ -257,13 +293,19 @@ def _condition_kwargs(args, parser):
257
  kwargs = {}
258
  if args.transform in CHIMERA_CONDITIONS:
259
  missing = [
260
- flag for flag, value in (
261
- ("--depth", args.depth), ("--tracking", args.tracking),
262
- ("--input-selection", args.input_selection), ("--frames", args.frames),
263
- ) if value is None
 
 
 
 
264
  ]
265
  if missing:
266
- parser.error(f"{args.transform} requires {', '.join(missing)} (the Step-2 config)")
 
 
267
  kwargs["perceived_config"] = {
268
  "depth": args.depth,
269
  "tracking": args.tracking,
@@ -292,38 +334,53 @@ def main():
292
  parser.add_argument("--magnitude", type=float, required=True)
293
  parser.add_argument("--model", default=None, help="required for --arm vlm")
294
  parser.add_argument(
295
- "--spatial-code-format", default="explicit", choices=("explicit", "compact"),
 
 
296
  dest="spatial_code_format",
297
  )
298
  parser.add_argument("--scenes", default=None, help="comma-separated scenes")
299
  parser.add_argument("--limit", type=int, default=None)
300
  parser.add_argument(
301
- "--sample", default=None,
 
302
  help="path to a JSON list of question ids (the pre-registered sample)",
303
  )
304
  parser.add_argument("--results-dir", default=None)
305
  parser.add_argument(
306
- "--depth", default=None, choices=("relative", "metric"),
 
 
307
  help="chimera only: the perceived codes' Step-2 config",
308
  )
309
  parser.add_argument(
310
- "--tracking", default=None, choices=("tracking", "no tracking"),
 
 
311
  help="chimera only: the perceived codes' Step-2 config",
312
  )
313
  parser.add_argument(
314
- "--input-selection", default=None, choices=("uniform", "selective"),
315
- dest="input_selection", help="chimera only: the perceived codes' Step-2 config",
 
 
 
316
  )
317
  parser.add_argument(
318
- "--frames", type=int, default=None,
 
 
319
  help="chimera only: the perceived codes' Step-2 config",
320
  )
321
  parser.add_argument(
322
- "--wrong-scene", default=None, dest="wrong_scene",
 
 
323
  help="wrong-scene only: the substitute scene id",
324
  )
325
  parser.add_argument(
326
- "--residuals", default=None,
 
327
  help="empirical only: path to corruption.empirical's measured-residuals JSON",
328
  )
329
  args = parser.parse_args()
@@ -331,7 +388,9 @@ def main():
331
 
332
  scenes = None
333
  if args.scenes:
334
- scenes = list(dict.fromkeys(s.strip() for s in args.scenes.split(",") if s.strip()))
 
 
335
  question_ids = None
336
  if args.sample:
337
  with open(args.sample, encoding="utf-8") as stream:
@@ -351,15 +410,26 @@ def main():
351
  if not args.model:
352
  parser.error("--arm vlm requires --model")
353
  results = run_vlm(
354
- args.model, args.transform, args.magnitude, args.spatial_code_format,
355
- scenes=scenes, limit=args.limit, question_ids=question_ids,
356
- results_dir=args.results_dir, **condition_kwargs,
 
 
 
 
 
 
357
  )
358
  else:
359
  results = run_solver(
360
- args.transform, args.magnitude, args.spatial_code_format,
361
- scenes=scenes, limit=args.limit, question_ids=question_ids,
362
- results_dir=args.results_dir, **condition_kwargs,
 
 
 
 
 
363
  )
364
  if results:
365
  mean_score = sum(r["score"] for r in results) / len(results)
 
72
  fully determined by the frozen seed, so it can be recovered at any time. H6's
73
  analysis needs this to select the questions that mention the perturbed object."""
74
  rng = random.Random(_seed_for(scene, "single-object", magnitude))
75
+ _code, info = chimera_mod.perturb_single_object(
76
+ load_ground_truth_compact(scene), rng
77
+ )
78
  return info
79
 
80
 
 
108
  return perturbed
109
  if transform == "empirical":
110
  if residuals is None:
111
+ raise ValueError(
112
+ "empirical requires measured residuals (corruption.empirical)"
113
+ )
114
  return empirical_mod.empirical_noise(code, residuals, rng, scale=magnitude)
115
  if transform in CHIMERA_CONDITIONS:
116
  if perceived_config is None:
 
124
  "compact",
125
  )
126
  if transform == "chimera-gt-inventory":
127
+ hybrid, _coverage = chimera_mod.gt_inventory_perceived_geometry(
128
+ code, perceived
129
+ )
130
  else:
131
+ hybrid, _coverage = chimera_mod.perceived_inventory_gt_geometry(
132
+ code, perceived
133
+ )
134
  return hybrid
135
+ raise ValueError(
136
+ f"unknown transform {transform!r}; expected one of {ALL_CONDITIONS}"
137
+ )
138
 
139
 
140
  def corrupted_code(scene, transform, magnitude, spatial_code_format, **kwargs):
141
  """Corrupt the compact code, then derive the requested format from it -- the same
142
+ derivation path the encoder uses, so both formats stay consistent under corruption.
143
+ """
144
  compact = corrupted_compact(scene, transform, magnitude, **kwargs)
145
  if spatial_code_format == "compact":
146
  return compact
 
157
  """Build the ``harness.D.run.run(code_transform=...)`` hook for one condition."""
158
 
159
  def hook(_loaded_code, scene_id, spatial_code_format):
160
+ return corrupted_code(
161
+ scene_id, transform, magnitude, spatial_code_format, **kwargs
162
+ )
163
 
164
  return hook
165
 
166
 
167
  def run_vlm(
168
+ model,
169
+ transform,
170
+ magnitude,
171
+ spatial_code_format="explicit",
172
+ scenes=None,
173
+ limit=None,
174
+ question_ids=None,
175
+ results_dir=None,
176
+ **kwargs,
177
  ):
178
  """Answer the sampled questions with one VLM on corrupted codes, through
179
  harness.D's unmodified path. Returns harness.D-shape records."""
 
193
 
194
 
195
  def run_solver(
196
+ transform,
197
+ magnitude,
198
+ spatial_code_format="explicit",
199
+ scenes=None,
200
+ limit=None,
201
+ question_ids=None,
202
+ write_results=True,
203
+ results_dir=None,
204
+ **kwargs,
205
  ):
206
  """Answer the sampled questions with the symbolic solver on the SAME corrupted
207
  codes -- the zero-GPU second reasoner for every corruption arm."""
208
  rows = load_questions(None, None, scenes, limit)
209
  if question_ids is not None:
210
  rows = [row for row in rows if row["id"] in question_ids]
211
+ root = Path(
212
+ results_dir or results_dir_for("solver", transform, magnitude, "symbolic")
213
+ )
214
  code_cache = {}
215
  results = []
216
  for row in rows:
217
  scene = row["scene_name"]
218
  if scene not in code_cache:
219
+ code = corrupted_code(
220
+ scene, transform, magnitude, spatial_code_format, **kwargs
221
+ )
222
  code_cache[scene] = adapters.adapt_spatial_code(code)
223
  answer = solver.answer(
224
  row["question_type"], row["question"], row["options"], code_cache[scene]
225
  )
226
  pred = "" if answer is None else str(answer)
227
+ doc = {
228
+ "question_type": row["question_type"],
229
+ "ground_truth": row["ground_truth"],
230
+ }
231
+ score_doc = vsi_official_eval.vsibench_process_results(doc, [pred])[
232
+ "vsibench_score"
233
+ ]
234
  metric_name, score = _scalar_score(row["question_type"], score_doc)
235
  record = {
236
  "model": "symbolic",
 
293
  kwargs = {}
294
  if args.transform in CHIMERA_CONDITIONS:
295
  missing = [
296
+ flag
297
+ for flag, value in (
298
+ ("--depth", args.depth),
299
+ ("--tracking", args.tracking),
300
+ ("--input-selection", args.input_selection),
301
+ ("--frames", args.frames),
302
+ )
303
+ if value is None
304
  ]
305
  if missing:
306
+ parser.error(
307
+ f"{args.transform} requires {', '.join(missing)} (the Step-2 config)"
308
+ )
309
  kwargs["perceived_config"] = {
310
  "depth": args.depth,
311
  "tracking": args.tracking,
 
334
  parser.add_argument("--magnitude", type=float, required=True)
335
  parser.add_argument("--model", default=None, help="required for --arm vlm")
336
  parser.add_argument(
337
+ "--spatial-code-format",
338
+ default="explicit",
339
+ choices=("explicit", "compact"),
340
  dest="spatial_code_format",
341
  )
342
  parser.add_argument("--scenes", default=None, help="comma-separated scenes")
343
  parser.add_argument("--limit", type=int, default=None)
344
  parser.add_argument(
345
+ "--sample",
346
+ default=None,
347
  help="path to a JSON list of question ids (the pre-registered sample)",
348
  )
349
  parser.add_argument("--results-dir", default=None)
350
  parser.add_argument(
351
+ "--depth",
352
+ default=None,
353
+ choices=("relative", "metric"),
354
  help="chimera only: the perceived codes' Step-2 config",
355
  )
356
  parser.add_argument(
357
+ "--tracking",
358
+ default=None,
359
+ choices=("tracking", "no tracking"),
360
  help="chimera only: the perceived codes' Step-2 config",
361
  )
362
  parser.add_argument(
363
+ "--input-selection",
364
+ default=None,
365
+ choices=("uniform", "selective"),
366
+ dest="input_selection",
367
+ help="chimera only: the perceived codes' Step-2 config",
368
  )
369
  parser.add_argument(
370
+ "--frames",
371
+ type=int,
372
+ default=None,
373
  help="chimera only: the perceived codes' Step-2 config",
374
  )
375
  parser.add_argument(
376
+ "--wrong-scene",
377
+ default=None,
378
+ dest="wrong_scene",
379
  help="wrong-scene only: the substitute scene id",
380
  )
381
  parser.add_argument(
382
+ "--residuals",
383
+ default=None,
384
  help="empirical only: path to corruption.empirical's measured-residuals JSON",
385
  )
386
  args = parser.parse_args()
 
388
 
389
  scenes = None
390
  if args.scenes:
391
+ scenes = list(
392
+ dict.fromkeys(s.strip() for s in args.scenes.split(",") if s.strip())
393
+ )
394
  question_ids = None
395
  if args.sample:
396
  with open(args.sample, encoding="utf-8") as stream:
 
410
  if not args.model:
411
  parser.error("--arm vlm requires --model")
412
  results = run_vlm(
413
+ args.model,
414
+ args.transform,
415
+ args.magnitude,
416
+ args.spatial_code_format,
417
+ scenes=scenes,
418
+ limit=args.limit,
419
+ question_ids=question_ids,
420
+ results_dir=args.results_dir,
421
+ **condition_kwargs,
422
  )
423
  else:
424
  results = run_solver(
425
+ args.transform,
426
+ args.magnitude,
427
+ args.spatial_code_format,
428
+ scenes=scenes,
429
+ limit=args.limit,
430
+ question_ids=question_ids,
431
+ results_dir=args.results_dir,
432
+ **condition_kwargs,
433
  )
434
  if results:
435
  mean_score = sum(r["score"] for r in results) / len(results)
corruption/sample.py CHANGED
@@ -109,20 +109,28 @@ def draw_sample(scenes, seed=SAMPLE_SEED, budgets=None):
109
  def main():
110
  parser = argparse.ArgumentParser()
111
  parser.add_argument("--depth", required=True, choices=("relative", "metric"))
112
- parser.add_argument("--tracking", required=True, choices=("tracking", "no tracking"))
113
  parser.add_argument(
114
- "--input-selection", required=True, choices=("uniform", "selective"),
 
 
 
 
 
115
  dest="input_selection",
116
  )
117
  parser.add_argument("--frames", type=int, required=True)
118
  parser.add_argument("--output", default=str(DEFAULT_OUTPUT))
119
  parser.add_argument(
120
- "--seed", type=int, default=SAMPLE_SEED,
 
 
121
  help="frozen in analysis/preregistration.md -- do not change for real runs",
122
  )
123
  args = parser.parse_args()
124
 
125
- scenes = eligible_scenes(args.depth, args.input_selection, args.tracking, args.frames)
 
 
126
  if not scenes:
127
  raise SystemExit(
128
  "no eligible scenes: need BOTH perceived (Step 2) and ground-truth codes on disk"
@@ -134,7 +142,9 @@ def main():
134
  with open(args.output, "w", encoding="utf-8") as stream:
135
  json.dump(sample, stream, indent=1)
136
  print(f"wrote {len(sample)} question ids to {args.output}")
137
- print(f"eligible scenes: {len(scenes)}; distinct scenes in sample: {len(distinct_scenes)}")
 
 
138
  print(
139
  "NOW: commit this file into the repository and re-run the code backup so the "
140
  "realized sample is timestamped before any corruption run "
 
109
  def main():
110
  parser = argparse.ArgumentParser()
111
  parser.add_argument("--depth", required=True, choices=("relative", "metric"))
 
112
  parser.add_argument(
113
+ "--tracking", required=True, choices=("tracking", "no tracking")
114
+ )
115
+ parser.add_argument(
116
+ "--input-selection",
117
+ required=True,
118
+ choices=("uniform", "selective"),
119
  dest="input_selection",
120
  )
121
  parser.add_argument("--frames", type=int, required=True)
122
  parser.add_argument("--output", default=str(DEFAULT_OUTPUT))
123
  parser.add_argument(
124
+ "--seed",
125
+ type=int,
126
+ default=SAMPLE_SEED,
127
  help="frozen in analysis/preregistration.md -- do not change for real runs",
128
  )
129
  args = parser.parse_args()
130
 
131
+ scenes = eligible_scenes(
132
+ args.depth, args.input_selection, args.tracking, args.frames
133
+ )
134
  if not scenes:
135
  raise SystemExit(
136
  "no eligible scenes: need BOTH perceived (Step 2) and ground-truth codes on disk"
 
142
  with open(args.output, "w", encoding="utf-8") as stream:
143
  json.dump(sample, stream, indent=1)
144
  print(f"wrote {len(sample)} question ids to {args.output}")
145
+ print(
146
+ f"eligible scenes: {len(scenes)}; distinct scenes in sample: {len(distinct_scenes)}"
147
+ )
148
  print(
149
  "NOW: commit this file into the repository and re-run the code backup so the "
150
  "realized sample is timestamped before any corruption run "
corruption/transforms.py CHANGED
@@ -157,7 +157,10 @@ def translate(code, offset_meters, rng=None):
157
  ]
158
  else:
159
  polygon[key] = [
160
- [[round(x + offset_meters, 2), round(y + offset_meters, 2)] for x, y in hole]
 
 
 
161
  for hole in polygon[key]
162
  ]
163
  return code
@@ -178,7 +181,11 @@ def rotate_z(code, angle_degrees, rng=None):
178
  box = _box(instance)
179
  center = box["3D oriented bounding box center coordinates"]
180
  x, y = rotate_xy(center[0], center[1])
181
- box["3D oriented bounding box center coordinates"] = [round(x, 2), round(y, 2), center[2]]
 
 
 
 
182
  vectors = box["3D oriented bounding box orientation unit vectors"]
183
  box["3D oriented bounding box orientation unit vectors"] = [
184
  [round(v, 2) for v in (*rotate_xy(vector[0], vector[1]), vector[2])]
 
157
  ]
158
  else:
159
  polygon[key] = [
160
+ [
161
+ [round(x + offset_meters, 2), round(y + offset_meters, 2)]
162
+ for x, y in hole
163
+ ]
164
  for hole in polygon[key]
165
  ]
166
  return code
 
181
  box = _box(instance)
182
  center = box["3D oriented bounding box center coordinates"]
183
  x, y = rotate_xy(center[0], center[1])
184
+ box["3D oriented bounding box center coordinates"] = [
185
+ round(x, 2),
186
+ round(y, 2),
187
+ center[2],
188
+ ]
189
  vectors = box["3D oriented bounding box orientation unit vectors"]
190
  box["3D oriented bounding box orientation unit vectors"] = [
191
  [round(v, 2) for v in (*rotate_xy(vector[0], vector[1]), vector[2])]
encoder/__pycache__/adapters.cpython-311.pyc CHANGED
Binary files a/encoder/__pycache__/adapters.cpython-311.pyc and b/encoder/__pycache__/adapters.cpython-311.pyc differ
 
encoder/__pycache__/config.cpython-311.pyc CHANGED
Binary files a/encoder/__pycache__/config.cpython-311.pyc and b/encoder/__pycache__/config.cpython-311.pyc differ
 
encoder/__pycache__/render.cpython-311.pyc CHANGED
Binary files a/encoder/__pycache__/render.cpython-311.pyc and b/encoder/__pycache__/render.cpython-311.pyc differ
 
encoder/__pycache__/run.cpython-311.pyc CHANGED
Binary files a/encoder/__pycache__/run.cpython-311.pyc and b/encoder/__pycache__/run.cpython-311.pyc differ
 
tests/test_C/__pycache__/test_run.cpython-311-pytest-9.1.1.pyc CHANGED
Binary files a/tests/test_C/__pycache__/test_run.cpython-311-pytest-9.1.1.pyc and b/tests/test_C/__pycache__/test_run.cpython-311-pytest-9.1.1.pyc differ