Creating a new IPKISS design project

PyCharm has a built-in project manager. We use it to create IPKISS design projects.

When this is the first time opening PyCharm, you will be greeted with this window:

First time opening PyCharm. Choose 'create new project'.

This image is shown when opening PyCharm for first time. Select ‘create new project’.

When you are in the main PyCharm window, select Create File ‣ New Project:

Create a new project using File --> New Project

Create a new project using File ‣ New Project.

In the “Create Project window”, choose a new folder for your new design, then choose “existing interpreter”:

Create a new project, select an existing Python interpreter.

Creating a new project, and selecting an existing Python interpreter.

There are two situations now (also shown in the image above):

  1. If you have already set up an IPKISS Python interpreter before, you may find it in the list of interpreters. In that case, you can proceed to the section below on adding a PDK to the project.
  2. The ipkiss interpreter is not shown in the list of existing interpreters. In that case, click ‘…’ and follow the instructions below.

Clicking ‘…’ will open a new menu where you can select the Python interpreter:

New Python interpreter page: selet 'conda environment', then click "...".

In the ‘add Python interpreter’ page, select ‘conda environment’, then click “…” (top right).

Next, select the Python interpreter to use:

Choosing Python interpreter

Choosing Python interpreter. Screenshot shows location for a default installation.

After choosing the interpreter, it will be visible in the list as shown below. You can select “Make available for all projects”, so the interpreter is stored for future design projects.

New Python interpreter is chosen.

Press ‘OK’ when the correct Python interpreter is chosen.

After the main PyCharm window opens, let’s add a PDK to the project.


You can also open an existing folder or project (File -> Open…). When a folder is first opened, an .idea folder is created which stores project settings. If you open the same folder at a later moment, the project settings are remembered.

Adding a PDK to your project

To add a PDK to the project, we need to add the folder to this project and ensure Python can find it. We illustrate this for demolib, which is a PDK shipped with the software, but the principle for setting up a PDK is the same for each PDK supported by Luceda.

Go to File ‣ Settings. Then, in the side pane, choose Project: <Your project name>. Then select Project Structure section, then click on + Add Content Root. Then select the PDK folder. For this tutorial we use demolib, which is located under the user home folder:

  • Windows: %USERPROFILE%\luceda\samples\ipkiss32\demo\libraries\demolib.
  • Linux: ~/luceda/samples/ipkiss32/demo/libraries/demolib

(where ipkiss32 is the ipkiss version, please replace with the version you’re using)

Add PDK to the project structure.

Add demolib PDK to the project structure.

Next, we have to ensure Python recognizes the PDK. To do this, we need to configure the PYTHONPATH (this is where Python searches for packages & modules). More specifically, the ipkiss folder inside the PDK has to be marked as Source root. We import PDK (technology) and library devices like the way we import Python pacakges & modules, for example: from demolib import technology and from demolib import all. So make sure there is a technology module and an file in the PDK directory that you have made as Source root. We select the ipkiss folder, then click the Sources button, as shown below:

Mark the ipkiss folder inside the PDK as source root. Then press 'OK'.

Mark the ipkiss folder inside the PDK as source root. Then press ‘OK’.

Most PDKs have examples stored in them, so let’s run a sample to verify that everything is set up properly: First open demolib/samples/simulation/mzi_lattice/ Next, right click somewhere in the file itself and choose Run ‘mzi_lattice’:

Choose a file from the samples and run it (:menuselection:`right click ---> Run 'mzi_lattice'`).

Choose a file from the samples and run it (right click -‣ Run ‘mzi_lattice’).

Once finished, you should see the simulation result of the MZI lattice (note that the transmission may vary between successive runs due to phase errors in the waveguide):

Simulation result after running

Simulation result after running


Most PDKs have samples stored in this folder: <PDK>/docs/examples/scripts.

Additional user libraries

You can also reuse libraries that were created earlier. To illustrate this, we will also add a custom design library that we’d like to reference in our current design project. In the sample project, there is a library called my_library that we’ll use for this purpose.

Similar to how we added the PDK, we can now add <path_to_IPKISS_installation>\demo\built_libraries\my_library to the project.

Add my_library to the project.

Add my_library to the project.

Add ipkiss folder of *my_library* as source root.

Add the ipkiss folder of my_library as source root.

To test everything, we can make a small file:

from demolib import all as demo
from my_library import all as my_lib

splitter = my_lib.SPLITTERWAYPOINT_1500()
lay = splitter.Layout()

Write a small test script and run it to test the project.

Write a small test script and run it to test the project.

You may refer to Library Organization in the documentation to find out more explanations on the library structure and its content.