Handle GDS II format in Python

Introduction

GDSII (GDS) is known as a CAD format for layout of ICs and MEMS. The author uses GDS for MEMS and metasurface production. GDS can also be created directly with mask CAD software such as Layout Editor and KLayout ~~ (rich) Can be converted from dxf files that can be handled by AutoCAD, Solidworks, etc. w) ~~ using Cadence, but it is convenient to apply a programming language to patterns that can be described using mathematical formulas. I have been drawing GDS in Perl for a long time with reference to JAXA Mita-sensei's page, but in recent years the CAD file size has grown. , I often feel the limits in Perl [^ 1]. Therefore, since 2019, GDS has been created in Python. Here, I will describe the know-how for creating a GDS file in Python.

Selecting a library to handle GDSII in Python

Several libraries have been proposed for handling the GDSII format in Python, but my recommendation is gdspy. To enumerate the known libraries,

Installing gdspy in Anaconda environment on Windows 10

This section describes the environment settings for creating a gds file with gdspy on a Windows machine for the time being.

  1. Install Anaconda 3 https://www.python.jp/install/centos/anaconda/install.html Install while watching.

  2. Update Anaconda 3 (execute as appropriate) From Windows-> cmd.exe (command prompt) > conda update --all

  3. Setting up the environment for gds If the conda environment and the pip environment are mixed it seems that something will not work, so create a new environment in Anaconda 3 just in case. Use a name such as gdsii. 3-1. Install the necessary modules for gdspy. numpy cython pip spyder

  4. Introduction of gdspy At the URL below https://qiita.com/mckeeeen/items/d4cbe4a16a102157f40c Execute "Install packages with pip in Anaconda environment" to install gdspy.

From Windows-> cmd.exe (command prompt), execute the following. (The> line indicates the command input)

>conda info -e # conda environments: # base * C:\Users\k_iwa\Anaconda3

> source activate base <-The name here (base) is the environment for gdspy introduced in 3.

  1. Installation of gdspy

> pip install gdspy

If you have not installed the C ++ compiler environment (for example, Build Tools for Visual Studio 2019) or libraries such as cython, you can install gdspy. It doesn't work properly. If it doesn't work, uninstall it with pip uninstall gdspy, prepare the library, and reinstall it.

  1. Use gdspy from Anaconda 3 using a Python IDE environment such as Spyder. The documentation is here. The notation has changed a lot since gdspy 1.5 (20, Dec, 2019). Details in the future.

[^ 1]: When it exceeds 600MB, Perl gives an error and cannot output GDS. I wasn't sure why.

Recommended Posts

Handle GDS II format in Python
Handle NetCDF format data in Python
format in python
Image format in Python
Handle markdown in python
Handle Parquet in Python
Handle Ambient data in Python
Easily format JSON in Python
Handle environment variables in Python
Handle complex numbers in Python
Automatically format Python code in Vim
Handle posix message queues in python
How to handle Japanese in Python
Handle multiple python versions in one jupyter
Download files in any format using Python
Python in optimization
CURL in python
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
Python string format
Meta-analysis in Python
Unittest in python
Epoch in Python
Discord in Python
Sudoku in Python
DCI in Python
quicksort in python
nCr in python
N-Gram in Python
Programming in python
Plink in Python
Constant in python
Lifegame in Python.
FizzBuzz in Python
Sqlite in python
StepAIC in Python
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
Reflection in Python
Python string format
Constant in python
nCr in Python.
Scons in Python3
Puyo Puyo in python
python in virtualenv
PPAP in Python
Quad-tree in Python
Reflection in Python
Chemistry in Python
Hashable in python
DirectLiNGAM in Python
LiNGAM in Python
Flatten in python
flatten in python
[Introduction to Python] How to handle JSON format data
Use cryptography module to handle OpenSSL in Python
Handle zip files with Japanese filenames in Python 3
How to handle datetime type in python sqlite3