简体   繁体   English

如何将.gds 文件加载到 Pandas 中?

[英]How to load .gds file into Pandas?

I have a .gds file.我有一个.gds文件。 How can I read that file with pandas and do some analysis?如何使用pandas读取该文件并进行一些分析? What is the best way to do that in Python?在 Python 中做到这一点的最佳方法是什么? The file can be downloaded here .该文件可以在这里下载。

you need to change the encoding and read the data using latin1您需要更改编码并使用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.将为您提供数据文件,您还需要跳过文件的真正 pandas 肉的前 27 行数据。

The gdspy package comes handy for such applications. gdspy package 非常适合此类应用。 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)) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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