2 March 2020 at 19:35 #6026
I would like to know whether it is possible to disable all the warnings about duplicate cells renaming.
I understand a way would be to create individual names, but assuming I am fine with the automatic renaming, can I just disable the warnings?
Thank you2 March 2020 at 19:52 #6028RonaldKeymaster
The best way to get rid of warnings is to solve the underlying reason or, second best, redirecting them to a log file so they do not scroll over the screen but are awaiting review on disk. For the latter see logging.
To resolve the cell rename warning avoid recreating a cell more than once, i.e. do not do the following:
import nazca as nd def createA(): with nd.Cell('test') as C: pass return C createA() createA() # causes a renaming warning createA() # causes a renaming warning
but instead do
import nazca as nd def createA(): with nd.Cell('test') as C: pass return C A = createA() A.put() A.put() A.put()
Another way to resolve these warnings is to use the @hashme decorator. It checks on cell name reuse and returns the existing cell rather then recreating it under a new name:
import nazca as nd @nd.bb_util.hashme('test') def createA(): with nd.Cell() as C: pass return C createA() createA() # no more renaming warning createA() # no more renaming warning
Ronald3 March 2020 at 11:29 #6029
Thank you Ronald,
using the hashme decorator solved the warning issue indeed. However, now I get some messages like:
“ERROR: bb_util.py: Reusing a basename across functions: ‘wg’ ”
Am I not using this correctly?3 March 2020 at 11:49 #6030
adding to my previous post, I would like to ask your advice on a parallel hashing issue which might be connected.
I am currently generating a set of parametrized cells using a function. Here I create an interconnect object using my parameters and then I draw some geometries using it. I have noticed that even if all the parameters are the same, calling the Interconnect() command always generates a new object. This means that even if I generate identical cells, they will still be separate.
Is there a way to check whether a specific interconnect object already exists?
An example code:
@nd.bbu.hashme('wg') def wgs(WG_width): with nd.Cell(name = inspect.currentframe().f_code.co_name) as wg: ic = Interconnect(width = WG_width, layer = xx) ic.taper(...).put() return wg
Here if I call wgs() multiple times passing the same WG_width, I will end up with multiple identical cells, each with a different (but identical) interconnect object.
Thank you once again for your help.10 July 2020 at 19:22 #6183XaveerModerator
I notice that this went unanswered, so I hope this may still be useful.
The interconnect definition should be outside the cell definition. The width specified is the default width for the interconnect and can be overridden when needed. Your code would then look something like:
ic = Interconnect(width=4, xs="XXXX") @hashme("wg") def wgs(WG_width): with nd.Cell() as wg: ic.taper(width2=WG_width, length=10).put() return wg wgs(1).put(0, 0) wgs(2).put(0, 10)
- You must be logged in to reply to this topic.