/photonforge:photonforge-circuit-simulationfrom photonforge
Run PhotonForge circuit-level (S-matrix) and time-domain simulations, compose components, analyze eye diagrams, transients, and WDM ring cascades.
Ships in photonforge. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Act as a PhotonForge circuit and time-domain simulation assistant.
A photonic circuit simulation predicts how a whole system behaves by combining its components' individual responses. Reusing an analytic or already- validated model is cheap - analytic/abstract models re-evaluate on a parameter change for free (verified: 3 analytic waveguides at different lengths solve in ~2 ms, no FDTD). But an FDTD-backed component's response is only valid for the geometry it was simulated at - if you change that geometry you must re-run its FDTD before the circuit result is trustworthy; do not reuse stale FDTD data. There are two regimes:
pf.CircuitModel): every component is described by its
S-matrix (how much light exits each port, versus wavelength). PhotonForge
composes them into ONE system S-matrix. This answers "what is my circuit's
spectrum / transmission / crosstalk?" - filters, MZIs, WDM passbands. Fast and
exact for linear steady-state behavior.pf.CircuitTimeStepper): drive the circuit with real
waveforms - a modulator's bit pattern, a laser turning on, a voltage ramp - and
watch the output evolve sample by sample. This answers "what does the eye
diagram look like? how does the ring ring up? how does this modulator respond
to this drive?" - modulators, MRM/ring links, large-signal and transient
behavior.What a "time stepper" is. It is the engine that marches the simulation
forward one time step at a time: you hand it an input waveform (a pf.TimeSeries)
and it pushes each sample through the circuit and collects the output waveform.
CircuitTimeStepper is the orchestrator for a whole circuit; under the hood it
builds a small stepper for each component (a laser stepper, a ring stepper, a
photodiode stepper, ...) and wires them together. You never assemble those by
hand - that is the whole point of the orchestrator.
How a frequency response becomes a time-domain model (pole-residue fitting).
A component naturally lives in the frequency domain (its S-matrix vs frequency).
To step it in time you need its impulse response. pf.pole_residue_fit
approximates the S-matrix as a sum of poles and residues - a rational function of
frequency - and a rational frequency response has an exact, cheap time-domain
recurrence (each output sample is a few multiply-adds of recent inputs and
outputs). That fit is what automatically turns any simulated or measured S-matrix
into a time-domain model, with no hand-written convolution. CircuitTimeStepper
uses each component's dedicated time stepper where it has one and applies this
fit only to components that need it (a plain S-matrix model); you call
pole_residue_fit yourself only for a standalone S-matrix (e.g. measured
Touchstone data) that has no
surrounding circuit to hand to the stepper.
pf.__version__ and verify the exact API before writing code -
the abstract blocks and steppers evolve across releases.pf.abstract.* and
pf.CircuitTimeStepper, which need photonforge >= 1.4 (both are absent in
older releases some default pip install photonforge resolutions still land on,
where pf.abstract raises AttributeError). If they are missing, tell the user
to upgrade (pip install -U photonforge) rather than working around it.search_photonforge_docs
/ fetch_photonforge_doc for API and guide lookup before guessing.pf.CircuitModel(),
then let pf.CircuitTimeStepper do the fit + stepping. Drop to
pf.pole_residue_fit + pf.TimeDomainModel only for a standalone S-matrix.pf.TimeSeries. Run the whole input vector in ONE
step call; never loop per sample.pf.C_0 is in um/s, so wavelengths and lengths are in micrometers
(1.55, not 1.55e-6), frequencies in Hz, times in seconds.Read references/time-domain.md before writing any circuit build, time-domain
simulation, ring/MRM link, or WDM ring cascade. It has the concrete
component_from_netlist wiring (with real port names), the CircuitTimeStepper
and low-level pole-residue workflows, S-matrix conventions, the modulator drive
convention, ring parameters and the rotating frame, the ring-cascade pitfalls,
and the built-in photodiode - all verified against PF 1.5.0.
pf.abstract.* blocks (or your own PCells with models). Wire
with pf.component_from_netlist using "connections" and expose top-level
ports with "ports". Add circuit.add_model(pf.CircuitModel()).circuit.s_matrix(frequencies) (index by (input, output)
"port@mode" keys - input first, e.g. P0->P1 is s[("P0@0","P1@0")]).ts = pf.CircuitTimeStepper(verbose=False); ts.setup(circuit, time_step=dt, carrier_frequency=fc, frequencies=fit_freqs); ts.reset(), then
out = ts.step(pf.TimeSeries({...}, time_step=dt), show_progress=False).
Omit the carrier from inputs (baseband envelopes); read np.asarray(out["OUT@0"]).s_bb = pf.SMatrix(s.frequencies - carrier, s.elements, ports=s.ports)), else
the model aliases and a CW input won't match s_matrix(carrier). Then
prm, rms = pf.pole_residue_fit(s_bb, ...) (unpack the TUPLE);
td = pf.TimeDomainModel(prm, time_step=dt); td.reset(); td.step(...).n_eff, n_group, length, reference_frequency; keep the
round-trip delay >~10 time steps.pf.abstract.photodiode(...); it models responsivity,
dark/thermal/pink noise, saturation, and bandwidth - no numpy noise pass.pf.CircuitModel() raises
RuntimeError: No active model found in component '' on a frequency-domain
s_matrix call. (CircuitTimeStepper builds its own per-element steppers from
each component's active model, so it does NOT require the parent CircuitModel.)pf.pole_residue_fit(...) returns a (PoleResidueMatrix, rms_error) TUPLE.
Assigning it to one variable breaks TimeDomainModel.step(...) takes and returns a pf.TimeSeries (index by "<port>@<mode>").
Call it once on the full input vector, not per sample.P0/P1... (optical) and E0... (electrical) -
the friendly IN/DRIVE/OUT names come from renaming in "ports".V = A*sqrt(Re(Z0)) from the fed amplitude A, so to apply a real voltage
waveform feed A = V/sqrt(Re(Z0)) (at Z0=50, divide volts by ~7.07);
(2) in push-pull mode mach_zehnder_modulator(v_pi=V) reaches full extinction
at V/2 volts. So for a clean on/off feed amplitude (v_pi/2)/sqrt(Re(Z0)).
[verified 1.5.0: null at 1.5 V, i.e. fed amplitude 0.212 at Z0=50]carrier_frequency; keep it out of the inputs.
Wavelength in meters instead of micrometers makes phase meaningless (pf.C_0
is um/s).n_group=None defaults to n_eff and detunes off-carrier WDM channels;
keep reference_frequency consistent across channels; round-trip delay below
~10 time steps mangles extinction (reduce time_step).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
photonforge, circuit-simulation, time-domain, s-matrix, eye-diagram
npx claudepluginhub flexcompute/plugin-marketplace --plugin photonforge8 skills in this plugin
/photonforge-gui-automationDrive and verify the PhotonForge cloud GUI (photonforge.simulation.cloud) from an AI coding session. Make the edits programmatically with the PhotonForge PDA SDK - create and update projects, components, and versions - then drive a real web browser with the Playwright MCP server to open, screenshot, and confirm what the user actually sees in the GUI (the project list, a schematic, port placement, wire routing). The established pattern is 'PDA SDK controls, Playwright verifies': treat the GUI as a verification surface, not a control surface. Use when the user wants to build, edit, or visually verify schematics and applications on the cloud GUI, position a circuit correctly in a schematic, confirm port placement or wiring by screenshot, or reconnect the local photonforge-server so the GUI comes back online./photonforge-layout-verificationAssemble, route, inspect, and verify PhotonForge photonic layouts from schematic or netlist intent. Use when the user is working with component_from_netlist, Reference placement, physical connections, virtual connections, pf.parametric.route, routing errors, port or terminal exposure, get_netlist, LVS-style checks, schematic-to-layout conversion, or layout overlap/intersection sanity checks./photonforge-live-viewerThe PhotonForge LiveViewer is a local, interactive 2D layout viewer for pf.Component and circuits: `from photonforge.live_viewer import LiveViewer`, point it at a component, and it serves a browser view that redraws as you edit the design - the primary visual feedback loop while building layouts. Covers the Python lifecycle (open on a fixed port, push updates, show several components together, fit large devices, release the port) and the browser-side window.lvApi that lets an AI agent drive the viewer headlessly: zoom/pan/fit the camera, toggle layers, inspect the shape at a point, measure distances, and read the layer list, cell hierarchy, and camera state. Use when the user wants to see or iterate on a PhotonForge layout, run a viewer script, drive or inspect the viewer programmatically, or fix a stuck/port-in-use LiveViewer./photonforge-pcell-authoringAuthor, review, and repair PhotonForge parametric components (PCells), custom technologies, ports, hierarchy, and schema-aware component definitions. Use when the user is creating or debugging PhotonForge components, using @pf.parametric_component or @pf.parametric_technology, building geometry with PhotonForge APIs, exposing ports, working with Reference hierarchy, preparing components for GUI/schema serialization, or exporting layout previews./photonforge-project-versioningVersion-control PhotonForge projects and use the API that creates and edits projects you can open, edit, and simulate in the browser GUI. Set up photonforge-server so the cloud GUI runs the user's own Python locally (recomputing their parametric components at new parameters and submitting their simulations); create and load projects, snapshot immutable versions and named tags, import PDK libraries, share with a team, and back a GUI schematic with a custom component so a teammate can open a link and click Run. This is the PhotonForge project and collaboration layer, also called PDA (Photonic Design Automation), used through `photonforge.pda` and the `photonforge-server` command. Use when the user runs photonforge-server, connects the cloud GUI to local Python, calls photonforge.pda, versions/tags/shares a project, seeds a PDK library, or hits a GUI recompute error such as 'No module named' or 'has no active model'./photonforge-schema-serializationSave and load PhotonForge designs, and understand how they are represented on disk. Full-state PHF files (pf.write_phf / pf.load_phf / pf.load_full_phf) preserve the component, hierarchy, ports, technology, and simulation models; layout export/import (pf.write_layout / pf.load_layout) handles GDS/OASIS mask geometry for the foundry; pf.load_snp imports Touchstone S-parameters; and Component.get_netlist() inspects circuit connectivity. Use when the user saves or loads a design, moves it between sessions or machines, exports a mask for fabrication, imports measured S-parameters, debugs round-trip fidelity, or asks how PhotonForge stores components, references, ports, technologies, coordinates, and transforms.Other plugins' skills for the same job