0

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.

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

2 Answers2

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
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