简体   繁体   中英

How to load .gds file into Pandas?

I have a .gds file. How can I read that file with pandas and do some analysis? What is the best way to do that in Python? The file can be downloaded here .

you need to change the encoding and read the data using latin1

import pandas as pd
df = pd.read_csv('example.gds',header=27,encoding='latin1')

will get you the data file, also you need to skip the first 27 rows of data for the real pandas meat of the file.

The gdspy package comes handy for such applications. For example:

import numpy
import gdspy

gdsii = gdspy.GdsLibrary(infile="filename.gds")
main_cell = gdsii.top_level()[0]  # Assume a single top level cell
points = main_cell.polygons[0].polygons[0]
for p in points:
    print("Points: {}".format(p)) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM