Skip to content

Conversation

@joamatab
Copy link
Contributor

@joamatab joamatab commented Nov 19, 2025

  • fix notebook
  • update luminescent

Summary by Sourcery

Revamp the luminescent tutorial notebook and streamline installation workflow

New Features:

  • Add install_luminescent.sh script to automate backend binary installation
  • Introduce a Makefile 'luminescent' target to run the installation script

Bug Fixes:

  • Correct outdated notebook cells and headings in luminescent.ipynb

Enhancements:

  • Rewrite luminescent.ipynb as a photonic ring resonator tutorial with updated code structure
  • Bump notebook metadata to Python 3.12.7

Build:

  • Integrate luminescent installation into the project Makefile

Documentation:

  • Overhaul the example notebook to improve user-facing tutorial documentation

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 19, 2025

Reviewer's Guide

This PR refactors the luminescent notebook to focus on a photonic ring resonator example using the updated luminescent API and adds a Makefile target plus an install script for streamlined backend installation.

Class diagram for updated geometry and simulation setup in notebook

classDiagram
    class Component {
      +add_port(name, port)
      +plot()
    }
    class LayerStack {
      +layers: dict
    }
    class LayerLevel {
      +layer: LogicalLayer
      +thickness: float
      +zmin: float
      +material: str
      +mesh_order: int
    }
    class LogicalLayer {
      +layer: tuple
    }
    class Material {
      +epsilon: float
    }
    class Source {
      +name: str
      +source_port_margin: float
      +wavelength: float
      +bandwidth: float
    }
    class Mode {
      +ports: list
      +wavelengths: list
      +start: list
      +stop: list
    }
    class View {
      +field: str
      +z: str
      +y: int
      +x: int
    }
    class Luminescent {
      +make(path, component, wavelengths, sources, modes, zmin, zmax, materials_library, layer_stack, gpu, nres, relative_courant, relative_pml_depths, Tsim, field_decay_threshold, saveat, views)
      +solve(path)
      +peek(path)
      +movie(path)
      +load(path)
      +query(sol, key)
    }
    Component --> LayerStack
    LayerStack --> LayerLevel
    LayerLevel --> LogicalLayer
    Luminescent --> Material
    Luminescent --> Source
    Luminescent --> Mode
    Luminescent --> View
    Luminescent --> Component
    Luminescent --> LayerStack
    Luminescent --> Material
Loading

Flow diagram for new simulation workflow in the notebook

flowchart TD
    A["Define geometry (gdsfactory)"] --> B["Set simulation parameters (wavelengths, margins, materials)"]
    B --> C["Create LayerStack and materials_library"]
    C --> D["Configure sources and modes"]
    D --> E["Run luminescent.make() for simulation"]
    E --> F["Run luminescent.solve()"]
    F --> G["Visualize with luminescent.peek() and luminescent.movie()"]
    G --> H["Analyze results and plot transmission"]
Loading

File-Level Changes

Change Details Files
Overhaul notebook content to a focused ring resonator tutorial with new luminescent API usage
  • Removed old synopsis, feature lists, and general examples
  • Replaced code cells with ring resonator geometry, LayerStack/materials definitions, sources/modes, and lumi.make pipeline
  • Updated imports and moved to new API calls (e.g., lumi.make, lumi.solve, gdsfactory LayerLevel)
  • Trimmed markdown sections and simplified to a concise overview
notebooks/luminescent.ipynb
Add installation support via Makefile and shell script
  • Added a ‘luminescent’ target to the Makefile
  • Created install_luminescent.sh to download and install backend binaries
  • Configured environment variables for Julia CUDA and PATH
Makefile
install_luminescent.sh

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

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Add a shebang line (#!/usr/bin/env bash), make install_luminescent.sh executable, and guard OS-specific commands (e.g. apt-get) so the install script won’t break on non-Debian systems.
  • The notebook example repeats a lot of setup (material libraries, layer stacks, margins) across cells—consider refactoring that into a reusable helper or template cell to keep it DRY.
  • Make the luminescent Makefile target idempotent by checking for existing binaries before downloading, so running make luminescent doesn’t reinstall every time.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Add a shebang line (`#!/usr/bin/env bash`), make `install_luminescent.sh` executable, and guard OS-specific commands (e.g. apt-get) so the install script won’t break on non-Debian systems.
- The notebook example repeats a lot of setup (material libraries, layer stacks, margins) across cells—consider refactoring that into a reusable helper or template cell to keep it DRY.
- Make the `luminescent` Makefile target idempotent by checking for existing binaries before downloading, so running `make luminescent` doesn’t reinstall every time.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@joamatab joamatab added the documentation Improvements or additions to documentation label Nov 20, 2025
@joamatab joamatab merged commit d41a598 into main Nov 20, 2025
14 checks passed
@joamatab joamatab deleted the update_luminescent branch November 20, 2025 20:13
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants