Skip to content

circuit.ac() raises for is_complex=True — expose low-level AC API for photonic circuits #29

Description

@ThomasPluck

Summary

Circuit.ac() unconditionally raises ValueError when solver.is_complex=True:

if self.solver.is_complex:
    raise ValueError(
        "Circuit.ac() currently supports real-valued circuits. "
        "Use the low-level AC API for complex circuits."
    )

This blocks AC small-signal analysis for photonic (complex-valued) circuits, which is a common use case — e.g. computing RF modulation bandwidth of an electro-optic modulator, or small-signal response of a ring resonator.

Requested

Either:

  1. Expose a high-level circuit.ac() path for complex circuits using the existing setup_ac_sweep infrastructure, or
  2. Document the low-level setup_ac_sweep API with a photonic example so callers can work around the guard

The error message already hints at setup_ac_sweep but there's no public example of using it with is_complex=True.

Context

We're integrating circulax into GDSFactory+ (gdsfactoryplus) as a simulation engine. We've wired up DC, HB, and Transient — AC is the only one we're having to stub out for photonic circuits due to this guard. Happy to contribute a fix if pointed in the right direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions