From eb970da71c1a9ded3edcb4583bccaac55b2efabf Mon Sep 17 00:00:00 2001 From: rUv Date: Thu, 7 Aug 2025 14:34:32 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96=20Checkpoint:=20Edit=20/workspaces?= =?UTF-8?q?/claude-code-flow/fix=5Fseparable.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/checkpoints/1754577226.json | 1 + .claude/checkpoints/1754577228.json | 1 + fix_separable.py | 58 +++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 .claude/checkpoints/1754577226.json create mode 100644 .claude/checkpoints/1754577228.json create mode 100644 fix_separable.py diff --git a/.claude/checkpoints/1754577226.json b/.claude/checkpoints/1754577226.json new file mode 100644 index 0000000000..dcf8607b09 --- /dev/null +++ b/.claude/checkpoints/1754577226.json @@ -0,0 +1 @@ +{"branch": "checkpoint/pre-edit-20250807-143346", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/cli/swe_bench_command.py", "timestamp": "2025-08-07T14:33:46Z", "type": "pre-edit", "original_branch": "swe-bench"} diff --git a/.claude/checkpoints/1754577228.json b/.claude/checkpoints/1754577228.json new file mode 100644 index 0000000000..ce417a08a3 --- /dev/null +++ b/.claude/checkpoints/1754577228.json @@ -0,0 +1 @@ +{"tag": "checkpoint-20250807-143348", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/cli/swe_bench_command.py", "timestamp": "2025-08-07T14:33:48Z", "type": "post-edit", "branch": "swe-bench", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 108 +++++++++++++++++++++ .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1754577222.json | 1 + .claude/checkpoints/1754577224.json | 1 + .../src/swarm_benchmark/cli/swe_bench_command.py | 1 + 6 files changed, 115 insertions(+), 4 deletions(-) "} diff --git a/fix_separable.py b/fix_separable.py new file mode 100644 index 0000000000..568507accb --- /dev/null +++ b/fix_separable.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +""" +Fixed version of the _cdot function from astropy/modeling/separable.py +""" + +def _cdot_fixed(left, right): + """ + Function corresponding to "|" operation. + + Parameters + ---------- + left, right : `astropy.modeling.Model` or ndarray + If input is of an array, it is the output of `coord_matrix`. + + Returns + ------- + result : ndarray + Result from this operation. + """ + from astropy.modeling.core import CompoundModel, Model + import numpy as np + + left, right = right, left + + def _n_inputs_outputs(input, position): + """ + Return ``n_inputs``, ``n_outputs`` for a model or coord_matrix. + """ + if isinstance(input, Model): + # FIX: Check if it's a CompoundModel and handle it differently + if isinstance(input, CompoundModel): + # For CompoundModels, use _separable to get the separability matrix + coords = _separable(input) + else: + # For simple Models, use _coord_matrix as before + coords = _coord_matrix(input, position, input.n_outputs) + else: + coords = input + return coords + + cleft = _n_inputs_outputs(left, "left") + cright = _n_inputs_outputs(right, "right") + + try: + result = np.dot(cleft, cright) + except ValueError: + from astropy.modeling.core import ModelDefinitionError + raise ModelDefinitionError( + 'Models cannot be combined with the "|" operator; ' + f"left coord_matrix is {cright}, right coord_matrix is {cleft}" + ) + return result + +print("Fixed _cdot function created") +print("\nThe key change is in the _n_inputs_outputs nested function:") +print("- Added check for CompoundModel using isinstance") +print("- If it's a CompoundModel, call _separable(input) instead of _coord_matrix") +print("- This ensures nested CompoundModels are processed correctly") \ No newline at end of file