BerkeleyPhotonicsGenerator / BPG

The Berkeley Photonics Generator (BPG) is a Python framework that enables the generation and simulation of photonics layout
BSD 3-Clause "New" or "Revised" License
35 stars 9 forks source link

Fixed point / Decimal type usage #151

Closed edwardcwang closed 5 years ago

edwardcwang commented 5 years ago

Floating point can sometimes generate weird shapes or edge cases. We may want to consider using Decimal or a fixed point type to address this.

pvnbhargava commented 5 years ago

Since GDS has a fixed grid size, we prefer to store integers instead. When we allow the user to input float values, we quantize and convert to integer format immediately. In addition, handling Decimal/fixed point formats isn't easy when dealing with numpy, which we use extensively for high performance polygon manipulation. Let me know if you find any specific issues with the current implementation. There are a few special cases (like photonic paths) which intrinsically store floating point values then get converted to integers at the end.