gdsfactory icon indicating copy to clipboard operation
gdsfactory copied to clipboard

General GDS-to-code line mapping with text label during generation

Open nikosavola opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe.

A problem I encounter often is when looking at a GDS of complex components, it's hard to track where a subcomponent is generated in the corresponding code. Would be nice to have gdsfactory-wide approach to this problem.

Describe the solution you'd like

Support automatically adding a text label containing which line and which file was a component generated in. This seems like the simplest approach to generally tackling this problem. Ideally, this would be a setting in gdsfactory.config. and implemented somehow with the cell decorator

nikosavola avatar Mar 04 '24 13:03 nikosavola

how about using the post_process flag?

joamatab avatar Mar 04 '24 20:03 joamatab

how about using the post_process flag?

Then it would be nice to have a convenient way to stack multiple post_process functions in case that is already used for relevant geometry generation.

nikosavola avatar Mar 06 '24 09:03 nikosavola

at the moment you can compose using toolz.compose

Something we could do is https://github.com/gdsfactory/gdsfactory/pull/2594

what do you think?

joamatab avatar Mar 06 '24 21:03 joamatab

Supporting a sequence of functions sounds good to me but I think https://github.com/gdsfactory/gdsfactory/pull/2594 doesn't yet close this issue. Would need some sort of snippet implementing the file and linenumber as label in the GDS.

One problem that still persist is how to add a post_process step easily to something that already has a post_process step in a functools.partial for example. Do we just need to accept having to do something like

component_f1 = partial(component, post_process=f1)
component_f1_f2 = partial(component_f1, post_process=[component_f1.keywords['post_process'], f2])

nikosavola avatar Mar 07 '24 07:03 nikosavola