Skip to content

Handle array inputs and optional values in capacitance analysis - #96

Open
davrens101 wants to merge 3 commits into
sqdlab:mainfrom
davrens101:fix/capacitance-analysis-inputs
Open

davrens101 wants to merge 3 commits into
sqdlab:mainfrom
davrens101:fix/capacitance-analysis-inputs

Conversation

@davrens101

@davrens101 davrens101 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

The capacitance postprocessors document NumPy matrix input, but both call .values and reject actual ndarrays. The single-qubit helper also crashes on documented optional configurations: omitted qubit frequency, or a four-conductor qubit/readout circuit without a feedline.

  • Convert supplied matrices with np.asarray in both one- and two-qubit entry points, retaining DataFrame/indexed-CSV support.
  • Read resonator properties independently of the optional qubit-frequency calculation.
  • Do not format unavailable linewidth/Purcell values as floats.
  • Return f_q_GHz=None when no frequency was supplied, and document these cases.

No circuit formula, optimizer, public signature or existing numeric-zero placeholder changes.

Verified before/after with real imports and temporary Palace-format CSVs, without mocks:

  • 18 single-qubit calls: 3/4/5-conductor circuits, with and without qubit frequency, each using ndarray, DataFrame and indexed CSV. All complete after the fix. Effective capacitance and charging energy match independent circuit equations; resonator outputs match the real resonator object.
  • Three two-qubit calls using the same input forms and a real quarter-wave resonator agree numerically, including EC1 = 0.3283630743796598 GHz and qubit-qubit coupling = 0.8867184116435455 MHz.
  • Changed Python compiles. Independent read-only AI review found no blocker. No new permanent tests; no full-suite or external EM-solver claim. CPU-only.

Review and assistance

I supervised and checked the AI-assisted work as it progressed. AI assistance was used for investigation, implementation and verification. No maintainer review or approval is claimed. Verification was CPU-only; no GPU validation is claimed.

@davrens101

davrens101 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

I cherry-picked all seven SQDMetal fixes (#91-97) onto their shared upstream base and they apply cleanly together. The existing focused tests give 14 passed, 21 subtests passed (19 source/dependency/SciPy warnings, not suppressed). I also ran the 15 ordered three-mode EPR selections, 18 single-qubit capacitance configurations, three two-qubit input forms, single- and multi-port linewidths, and absent optional files directly, and they all work. No new permanent tests for #95-97, and I did not run the full suite or an external EM solver.

else:
Cres, Lres = 0, 0
if num_conductors >= 5:
C_c = C_rf

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat pointless even moving it here; either way, keep the comment # res-feedline mutual capacitance.

@davrens101 davrens101 Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored the # res-feedline mutual capacitance comment on C_c = C_rf in de3af06. The failing deploy check is the Sphinx docs deploy: it gets a 403 pushing to gh-pages from the fork PR, so it isn't caused by this change.

@PP501

PP501 commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

I can approve, once the small change has been made.

@davrens101

davrens101 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Removed the redundant parentheses around res is not None. No behaviour change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants