phidl

Python GDS layout and CAD geometry creation

https://github.com/amccaugh/phidl

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    9 of 25 committers (36.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.2%) to scientific vocabulary

Keywords

boolean cad gds gdsii geometry layout python
Last synced: 4 months ago · JSON representation ·

Repository

Python GDS layout and CAD geometry creation

Basic Info
  • Host: GitHub
  • Owner: amccaugh
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 17.8 MB
Statistics
  • Stars: 209
  • Watchers: 16
  • Forks: 67
  • Open Issues: 3
  • Releases: 25
Topics
boolean cad gds gdsii geometry layout python
Created over 9 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License Citation

README.md

pytest pre-commit

PHIDL

GDS scripting for Python that's intuitive, fast, and powerful.

  • Installation / requirements
  • Tutorial + examples (or try an interactive notebook)
  • Geometry library + function documentation
  • Changelog (latest update 1.7.2 on July 3, 2024)
    • New KLayout-based boolean/offset/outline functions! These are under the name pg.kl_boolean(), pg.kl_offset, pg.kl_outline(), pg.kl_invert(). They utilize the excellent KLayout tile processor, which allows breaking down & parallelizing these operations--in a nutshell, these operations should be much, much faster, and they also are more robust than the gdspy/clipper implementation. To use these new functions, you must first pip install klayout
    • Path.interpolate() now allows easy placement of objects alongside a path (e.g. for placing vias). See the tutorial for more information

Citation

If you found PHIDL useful, please consider citing it in (just one!) of your publications -- we appreciate it greatly. (BibTeX) - McCaughan, A. N., et. al. PHIDL: Python-based layout and geometry creation for nanolithography. J. Vac. Sci. Technol. B 39, 062601 (2021). http://dx.doi.org/10.1116/6.0001203

Gallery

Installation / requirements

  • Install or upgrade with pip install -U phidl
  • Install with pip install -U phidl[all] to include optional dependencies (e.g. freetype-py, klayout, rectpack)
  • Python version >=3.6

Testing

  • Install with test dependencies with pip install -U phidl[test] (includes all extras as well)
  • Run tests with pytest (or python -m pytest)

About PHIDL

fiddle (verb) - /ˈfidl/ - to make minor manual movements, especially to adjust something

PHIDL is an open-source GDS-based CAD tool for Python that significantly extends the excellent gdspy. The base installation includes a large library of simple shapes (e.g. rectangles, circles), photonic structures (e.g. sine curve waveguides), and superconducting nanowire shapes (e.g. single photon detectors) that are fully parameterized. It also has a built-in quick-plotting function based on matplotlib (or Qt) that allows you view the state of any GDS object, useful when scripting geometry-making functions. It also has a geometry library reference and a set of very thorough tutorials that will walk you through the process of getting acquainted with PHIDL.

The goal is to bring the usability of Illustrator / Inkscape drawing programs to the GDS scripting world. Like Python itself, it aims to be readable, and intuitive. For instance, when building a geometry you don't have to worry about what the exact coordinates are anymore. If you want to separate two ellipses in the x direction by 5 units, you can do things like this:

ellipse1.xmin = ellipse2.xmax + 5

or if you want to move then rotate one ellipse by 45 degrees you can do

ellipse2.move([1,7]).rotate(45)

There's a few dozen shortcuts like this that make life easier built into PHIDL--they're simple, but they make a world of difference when you just want to e.g. space a ring resonator some distance from a waveguide without having to track each and every coordinate of the shape.

phidl example image

There's also a "port" functionality that allows you to snap together geometry like Legos without caring about where exactly the absolute coordinates of either geometry is. For instance, connecting the above misaligned rectangles is a two-line command:

phidl example image

It also allows you to do things like add text and create smooth or straight routing curves between "ports" of different devices, convenient for making electrical or optical connections:

phidl example image phidl example image

Other useful functionality available are standard operations like booleans:

phidl example image

and less standard ones like creating outlines. A whole layout can be outlined directly in the GDS without requiring you to use Beamer (useful for positive-tone resist structures):

pg.outline(D, distance = 0.7, layer = 4)

phidl example image

The geometry library also has useful resolution test-structures built into it, for instance

pg.litho_calipers(num_notches = 7, offset_per_notch = 0.1) pg.litho_steps(line_widths = [1,2,4,8,16]) pg.litho_star(num_lines = 16, line_width = 3)

phidl example image

There are also handy functions to help pack shapes into as small an area as possible:

pg.packer(D_list, spacing = 1.25, aspect_ratio = (2,1))

phidl example image

Owner

  • Name: Adam McCaughan
  • Login: amccaugh
  • Kind: user
  • Location: Boulder, CO
  • Company: NIST

Citation (CITATION.bib)

@article{McCaughan2021PHIDL,
    author  = {McCaughan, Adam N. and Tait, Alexander N. and Buckley, Sonia M. and Oh, Dylan M. and Chiles, Jeffrey T. and Shainline, Jeffrey M. and Nam, Sae Woo},
    title   = {PHIDL: Python-based layout and geometry creation for nanolithography},
    journal = {Journal of Vacuum Science \& Technology B},
    volume  = {39},
    number  = {6},
    pages   = {062601},
    year    = {2021},
    doi     = {10.1116/6.0001203},
    URL     = {https://doi.org/10.1116/6.0001203}
}

GitHub Events

Total
  • Issues event: 5
  • Watch event: 14
  • Issue comment event: 8
  • Pull request event: 3
  • Fork event: 7
  • Create event: 1
Last Year
  • Issues event: 5
  • Watch event: 14
  • Issue comment event: 8
  • Pull request event: 3
  • Fork event: 7
  • Create event: 1

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 1,427
  • Total Committers: 25
  • Avg Commits per committer: 57.08
  • Development Distribution Score (DDS): 0.165
Past Year
  • Commits: 12
  • Committers: 2
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
Adam McCaughan a****h@g****m 1,191
Bas Nijholt b****s@n****t 49
Alex Tait a****t@n****v 47
dmwo 3****o 45
Jeffrey Holzgrafe j****e@g****m 22
Sebastian Pauka s****a@s****u 12
Sonia Buckley s****y@g****m 11
McCaughan a****6@N****V 8
Joaquin Matres 4****b 6
Ashley Anderson a****3@g****m 6
Samuel Gyger s****l@g****h 4
Stijn Balk s****k@g****m 3
Dileep V. Reddy d****r@g****m 3
joaquin j 3
Melonis j****7@N****V 3
jtchiles j****s@n****v 2
Owen Medeiros o****o@m****u 2
Dylan Oh d****2@n****v 2
qittlab q****b@N****V 2
yoshi74ls181 y****1@g****m 1
Jeff Holzgrafe j****e@g****u 1
mr-roger-a m****a@g****m 1
Joshua Adelman s****s 1
Jacob Melonis m****j@i****m 1
Ashish Panigrahi a****i@p****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 5 months ago

All Time
  • Total issues: 84
  • Total pull requests: 165
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 17 days
  • Total issue authors: 29
  • Total pull request authors: 22
  • Average comments per issue: 2.96
  • Average comments per pull request: 1.4
  • Merged pull requests: 133
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 3
  • Average time to close issues: 2 months
  • Average time to close pull requests: 18 days
  • Issue authors: 4
  • Pull request authors: 3
  • Average comments per issue: 1.5
  • Average comments per pull request: 0.67
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • joamatab (14)
  • gyger (9)
  • basnijholt (5)
  • giumc (5)
  • DanHickstein (3)
  • petebarry1988 (3)
  • Ikechi12 (3)
  • EliDoris (2)
  • jonnyfountain (1)
  • ChenyangCao1999 (1)
  • flaport (1)
  • georgiosauce (1)
  • paniash (1)
  • inekash (1)
  • pvasired (1)
Pull Request Authors
  • amccaugh (56)
  • basnijholt (20)
  • atait (17)
  • joamatab (13)
  • dmwo (6)
  • gyger (4)
  • sbalk (3)
  • melonisj (3)
  • omedeiro (2)
  • aganders3 (2)
  • spauka (2)
  • paniash (2)
  • jolzgrafe (2)
  • MechanicalPenguin225 (2)
  • dileepvr (2)
Top Labels
Issue Labels
enhancement (2)
Pull Request Labels

Dependencies

.github/workflows/pre-commit.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pre-commit/action v2.0.0 composite
.github/workflows/pytest.yml actions
  • GabrielBB/xvfb-action v1 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
requirements.txt pypi
  • gdspy *
  • ipython *
  • matplotlib *
  • nbsphinx *
  • numpy *
  • six *
setup.py pypi
  • gdspy >=1.5
  • matplotlib *
  • numpy *