-
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix CI Python matrix failures from stray syntax in space_server.py
#54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
quantumdynamics927-dotcom
merged 5 commits into
main
from
copilot/fix-cicd-pipeline-failures
Apr 5, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
|
|
||
| import os | ||
|
|
||
| import numpy as np | ||
| import uvicorn | ||
| from fastapi import FastAPI, HTTPException | ||
| from fastapi.middleware.cors import CORSMiddleware | ||
|
|
@@ -65,59 +66,45 @@ async def health_check(): | |
| async def run_vqe(request: VQERequest): | ||
| try: | ||
| # Use simplified VQE (fallback) - works without pyscf | ||
| from qiskit import QuantumCircuit | ||
| from qiskit_aer import AerSimulator | ||
| import numpy as np | ||
|
|
||
|
|
||
| # Simplified H₂ VQE using 2-qubit ansatz | ||
| def simplified_vqe(bond_length, shots=1024): | ||
| # Create a simple 2-qubit ansatz | ||
| theta = np.random.random() * 2 * np.pi | ||
|
|
||
| # Simulate VQE optimization | ||
| circuit = QuantumCircuit(2, 2) | ||
| circuit.ry(theta, 0) | ||
| circuit.cx(0, 1) | ||
| circuit.measure([0, 1], [0, 1]) | ||
|
|
||
| backend = AerSimulator() | ||
| job = backend.run(circuit, shots=shots) | ||
| result = job.result() | ||
| counts = result.get_counts() | ||
|
|
||
|
|
||
| # Calculate approximate energy based on bond length | ||
| # H₂ ground state energy approximation | ||
| exact = -1.116 + 0.5 * (bond_length - 0.74)**2 | ||
| exact = -1.116 + 0.5 * (bond_length - 0.74) ** 2 | ||
| vqe_energy = exact + np.random.normal(0, 0.01) # Small error | ||
|
|
||
| return { | ||
| "energy": vqe_energy, | ||
| "error": abs(vqe_energy - exact), | ||
| "depth": circuit.depth(), | ||
| "iterations": np.random.randint(20, 50) | ||
| "iterations": np.random.randint(20, 50), | ||
| } | ||
| exact_energy = -1.116 + 0.5 * (request.bond_length - 0.74)**2 | ||
|
|
||
| exact_energy = -1.116 + 0.5 * (request.bond_length - 0.74) ** 2 | ||
| result = simplified_vqe(request.bond_length, request.shots) | ||
|
Comment on lines
+83
to
94
|
||
|
|
||
| return { | ||
| "exact_energy": exact_energy, | ||
| "vqe_energy": result["energy"], | ||
| "error": result["error"], | ||
| "depth": result["depth"], | ||
| "iterations": result["iterations"], | ||
| "mode": "simplified" | ||
| "mode": "simplified", | ||
| } | ||
| except Exception as e: | ||
| raise HTTPException(status_code=500, detail=str(e)) from e | ||
|
|
||
|
|
||
| # Noisy Simulation Endpoint | ||
| } | ||
| except Exception as e: | ||
| raise HTTPException(status_code=500, detail=str(e)) from e | ||
|
|
||
|
|
||
| # Noisy Simulation Endpoint | ||
| @app.post("/api/noisy") | ||
| async def run_noisy_sim(request: NoisySimRequest): | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shotsis accepted (and passed intosimplified_vqe) but no longer used after removing the AerSimulator execution. This makes the API parameter effectively a no-op; either incorporateshotsinto the simplified simulation (e.g., scale the noise/error with shots) or remove/deprecate the parameter so clients aren’t misled.