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.
Asked
Active
Viewed 970 times
0

Alex Waygood
- 6,304
- 3
- 24
- 46

nabil horen
- 11
2 Answers
0
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.

Paul Brennan
- 2,638
- 4
- 19
- 26
-
thank you so much but still does not work. First time I tried .it was working perfectly,but still does not work – nabil horen Jan 05 '21 at 20:30
-
What went wrong? Could I have some more information? – Paul Brennan Jan 05 '21 at 20:43
-
Thank you very much.I Have uploaded a new file.This is the link: https://gofile.io/d/54Ll76 – nabil horen Jan 06 '21 at 13:10
0
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))

TC Arlen
- 1,442
- 2
- 11
- 19

mindful_machina
- 37
- 6