Skip to content

Add RSFQ JoSIM simulation notebook#584

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/demonstrate-rsfq-components
Draft

Add RSFQ JoSIM simulation notebook#584
Copilot wants to merge 2 commits into
mainfrom
copilot/demonstrate-rsfq-components

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Summary

Adds a new notebook demonstrating Rapid Single Flux Quantum (RSFQ) circuit simulation using JoSIM, an open-source superconducting circuit simulator.

What's included

New notebook: notebooks/src/josim_rsfq_simulation.py

The notebook demonstrates:

  1. Writing RSFQ netlists — SPICE-format circuit descriptions with Josephson junction models
  2. Simulating a Josephson Transmission Line (JTL) — the fundamental RSFQ building block, showing SFQ pulse propagation through junction phase staircase plots
  3. Simulating a DC-to-SFQ converter with JTL chain — the standard interface between conventional and RSFQ logic
  4. Connecting to qpdk layout — mapping circuit elements to physical single_josephson_junction and meander_inductor components

Supporting changes

  • docs/notebooks.rst — Added "RSFQ circuit simulation" category with the new notebook entry and summary table row
  • docs/conf.py — Added josim* to nb_execution_excludepatterns (JoSIM requires external binary)
  • docs/bibliography.bib — Added citations for JoSIM (Delport et al. 2019) and RSFQ logic (Likharev & Semenov 1991)
  • .github/lychee.toml — Fixed false positive for GitHub URLs with /n suffix from JSON parsing

Prerequisites

JoSIM must be compiled from source (CMake + C++17 compiler). The notebook includes build instructions and is excluded from automated docs execution, similar to the HFSS notebooks.

Checklist

  • Pre-commit hooks pass
  • Notebook follows jupytext percent format with proper YAML header
  • Colab install snippet included
  • Bibliography entries have DOI (no redundant URL fields)
  • docs/notebooks.rst updated

Summary by Sourcery

Add an RSFQ circuit simulation notebook using JoSIM and integrate it into the documentation and tooling configuration.

New Features:

  • Introduce a JoSIM-based RSFQ circuit simulation notebook demonstrating JTL and DC-to-SFQ converter simulations and their mapping to qpdk layout components.

Build:

  • Exclude JoSIM notebooks from automated execution in the Sphinx configuration to avoid requiring an external simulator during docs builds.

CI:

  • Adjust lychee link-checker configuration to ignore GitHub URLs erroneously suffixed with /n by JSON parsing.

Documentation:

  • Document the new RSFQ circuit simulation notebook in the notebooks index and add bibliography entries for JoSIM and RSFQ logic references.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 8, 2026

Reviewer's Guide

Adds a new JoSIM-based RSFQ simulation notebook (with jupytext source) that demonstrates JTL and DC-to-SFQ converter simulations and their mapping to qpdk layout, along with minimal doc and infra updates to integrate the notebook into the docs build and link checking.

Sequence diagram for running a JoSIM simulation from the RSFQ notebook

sequenceDiagram
    actor User
    participant Notebook
    participant run_josim
    participant JoSIM_CLI as josim_cli_binary
    participant CSV as output_csv
    participant NumPy as numpy
    participant Matplotlib as matplotlib

    User->>Notebook: execute JTL or DCSFQ cell
    Notebook->>run_josim: run_josim(netlist, josim_path)

    run_josim->>run_josim: create TemporaryDirectory
    run_josim->>run_josim: write circuit.cir

    run_josim->>JoSIM_CLI: subprocess.run([josim_path, -o, output.csv, circuit.cir])
    JoSIM_CLI-->>run_josim: exit_code, stdout, stderr
    run_josim->>run_josim: check returncode
    run_josim-->>Notebook: raise RuntimeError on failure
    Note over run_josim,Notebook: On success, continue

    run_josim->>CSV: read output.csv
    CSV-->>run_josim: header_line, data_lines
    run_josim->>NumPy: loadtxt(output.csv, delimiter, skiprows)
    NumPy-->>run_josim: data_array
    run_josim-->>Notebook: (headers, data_array)

    Notebook->>Matplotlib: create plots from headers, data_array
    Matplotlib-->>User: rendered SFQ pulse and phase plots
Loading

Class diagram for the new JoSIM helper and its dependencies

classDiagram
    class josim_rsfq_simulation {
        +JOSIM_CLI : str
        +run_josim(netlist : str, josim_path : str) tuple_list_str_np_ndarray
    }

    class tempfile {
        +TemporaryDirectory()
    }

    class pathlib_Path {
        +write_text(text : str)
        +read_text()
    }

    class subprocess_module {
        +run(args : list_str, capture_output : bool, text : bool, check : bool)
    }

    class numpy_module {
        +loadtxt(fname, delimiter, skiprows) np_ndarray
    }

    josim_rsfq_simulation --> tempfile : uses
    josim_rsfq_simulation --> pathlib_Path : uses
    josim_rsfq_simulation --> subprocess_module : uses
    josim_rsfq_simulation --> numpy_module : uses
Loading

File-Level Changes

Change Details Files
Introduce RSFQ circuit simulation notebook using JoSIM with examples and qpdk layout integration.
  • Add a new percent-format notebook source that documents RSFQ basics and JoSIM prerequisites, including Colab-specific qpdk installation logic.
  • Implement a reusable run_josim() helper that writes a netlist to a temp file, invokes josim-cli, parses CSV output, and returns headers plus NumPy array, raising RuntimeError on non-zero exit.
  • Provide a JTL example: define a JoSIM netlist, print it, run transient simulation, and plot input voltage, output current, and junction phase staircases.
  • Provide a DC-to-SFQ converter + JTL chain + sink example: define subcircuits, run JoSIM, and plot input voltage, intermediate phase, and sink voltage to show SFQ pulse propagation.
  • Demonstrate mapping from simulated elements to qpdk layout by instantiating single_josephson_junction and meander_inductor, and building a conceptual JTL layout using gdsfactory routing.
notebooks/josim_rsfq_simulation.ipynb
notebooks/src/josim_rsfq_simulation.py
Wire the new RSFQ notebook into the documentation system and exclude it from automated execution.
  • Update notebooks.rst to add an "RSFQ circuit simulation" section with an entry and summary row for the new JoSIM notebook.
  • Extend nb_execution_excludepatterns to skip notebooks/josim* since JoSIM requires an external binary and is not suitable for CI execution.
docs/notebooks.rst
docs/conf.py
Add bibliographic references for JoSIM and RSFQ logic and adjust link checker configuration for GitHub URL edge cases.
  • Append JoSIM (Delport et al. 2019) and RSFQ logic (Likharev & Semenov 1991) @Article entries to the shared bibliography with DOIs and without redundant URLs.
  • Extend lychee.toml's exclude patterns to ignore GitHub URLs ending with /n that arise from lychee JSON parsing issues.
docs/bibliography.bib
.github/lychee.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copilot AI requested a review from nikosavola May 8, 2026 11:56
@github-actions github-actions Bot added documentation Improvements or additions to documentation python Pull requests that update python code notebooks Related to Jupyter Notebooks labels May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation notebooks Related to Jupyter Notebooks python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants