🔖 Checkpoint: Edit /workspaces/claude-code-flow/correct_reproduce_bug.py

This commit is contained in:
rUv committed 2025-08-07 14:31:12 +00:00
1 parent aebbb94e01
commit 42f979af2c
3 files changed
+53

No files matched your search

+1
View File
@@ -0,0 +1 @@
{"branch": "checkpoint/pre-edit-20250807-143055", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/swe_bench/multi_mode_engine.py", "timestamp": "2025-08-07T14:30:55Z", "type": "pre-edit", "original_branch": "swe-bench"}
+1
View File
@@ -0,0 +1 @@
{"tag": "checkpoint-20250807-143057", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/swe_bench/multi_mode_engine.py", "timestamp": "2025-08-07T14:30:57Z", "type": "post-edit", "branch": "swe-bench", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 36 +++ .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1754577031.json | 1 + .claude/checkpoints/1754577033.json | 1 + .../swarm_benchmark/swe_bench/multi_mode_engine.py | 343 +++++++++++++++++++++ 6 files changed, 385 insertions(+), 4 deletions(-) "}
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env python
"""
Correctly reproduce astropy issue #12907: separability_matrix incorrect for nested CompoundModels
The issue is about nested CompoundModels, not Mapping followed by CompoundModel
"""
from astropy.modeling import models as m
from astropy.modeling.separable import separability_matrix
# Create nested compound models as in the actual issue
# The issue is about nesting compound models within compound models
cm1 = m.Linear1D(10) & m.Linear1D(5)
print("First compound model (cm1):")
print(f" Model: {cm1}")
print(f" n_inputs: {cm1.n_inputs}, n_outputs: {cm1.n_outputs}")
sep1 = separability_matrix(cm1)
print(f" Separability matrix: {sep1}")
print()
# Create another compound model that includes the first one
cm2 = m.Shift(1) & m.Shift(2)
print("Second compound model (cm2):")
print(f" Model: {cm2}")
print(f" n_inputs: {cm2.n_inputs}, n_outputs: {cm2.n_outputs}")
sep2 = separability_matrix(cm2)
print(f" Separability matrix: {sep2}")
print()
# Now nest them - this is where the bug occurs
nested = cm1 | cm2
print("Nested compound model (cm1 | cm2):")
print(f" Model: {nested}")
print(f" n_inputs: {nested.n_inputs}, n_outputs: {nested.n_outputs}")
sep_nested = separability_matrix(nested)
print(f" Separability matrix: {sep_nested}")
print()
# The issue is that separability is not correctly propagated through nested compound models
# Each output should be separable since Linear1D and Shift are separable
# Try with a more complex example
p1 = m.Polynomial1D(1)
p2 = m.Polynomial1D(2)
compound1 = p1 & p2
compound2 = m.Scale(2) & m.Scale(3)
nested2 = compound1 | compound2
print("More complex nested model:")
print(f" Model: {nested2}")
sep_nested2 = separability_matrix(nested2)
print(f" Separability matrix: {sep_nested2}")
print(f" Expected: diagonal True elements since all are separable")