微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 电磁仿真讨论 > Tool for simplifying substrate stackups

Tool for simplifying substrate stackups

时间:03-30 整理:3721RD 点击:
Hi,

I've written a Python module for simplifying substrate stacks and exporting them for import in ADS Momentum and Sonnet em. To make it easy to find errors in the entered stack, it can render the stack to a PDF file.

I've now written some documentation for it and made it available on GitHub, in the hope that it will be useful for others.

The github page is here: http://github.com/bmachiel/python-substratestack
If you're interested in using substratestack, you want to read the README at the bottom of this page.

You can download releases from here:
Python Package Index : substratestack

Best regards
- Brecht

Hello Brecht,

excellent, thank you!

Can you give some instruction how to use this? I have not used Python scripts before, so I am not sure what I need to run your code?

Best regards
Volker

EDIT: I forgot that PyX relies on LaTeX. This shouldn't be a problem if LaTeX is installed in Linux. For Windows, this might be more difficult. Let me know if it works for you.

That depends on the OS you're running. If you're running Linux, Python is probably already installed. Verify whether it is at least version 2.5 (run 'python -V'). If so, execute the following:

Code:
curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py
python virtualenv.py my_new_env
. my_new_env/bin/activate
easy_install pyx
easy_install substratestack
wget http://pypi.python.org/packages/source/s/substratestack/substratestack-0.2.tar.gz
tar xf substratestack-0.2.tar.gz
cd substratestack-0.2/examples
python example.py
If you have an older version of Python and you can't upgrade it (no root access), I recommend installing the Enthought Python Distribution (trial/academic version available). This includes a lot of packages that are useful for scientific use. After that you can install pyx and substratestack using easy_install as above.

For Windows, you can download Python. Install the latest 2.x release, not 3.x. Then download ez_setup.py and run it (double-click) to install setuptools. Alternatively, you can install the Enthought Python Distribution which includes setuptools IIRC. Now you can easy_install pyx and substratestack as in Linux. You should open a Command Prompt, cd into the Program Files\Python2x folder, and run
Code:
Scripts\easy_install.exe pyx
Scripts\easy_install.exe substratestack
Download the ZIP file containing the example scripts, and open and run them in IDLE (available from the Python start menu folder).

Phew. Yes, takes a bit of effort initially. But once you have setuptools (which provides easy_install), installing packages is very easy.

I hope I made no mistakes in the Windows part, as I can't test it at the moment. If you get stuck, be sure to let me know .

Hi Brecht,

thanks for trying to help, but after installing Python and running ez_setup, I have no idea how to proceed.
I used to do a lot of programming for Windows, but this Python stuff is ... different.

Best regards
Volker

I'm assuming you're running Windows?

After running ez_setup.py, easy_install is available. You need to open a command prompt (Start->Run, type 'cmd', press enter) and switch to the Python directory:

Code:
cd C:\Program Files\Python27
The Python directory may have a different name, just 'Python' perhaps. From that directory you can run easy_install:

Code:
Scripts\easy_install.exe pyx
Scripts\easy_install.exe substratestack
That should install the PyX and Substratestack packages, so that they are available when running the examples.

Now download the ZIP file and unpack it solewhere. After that, start IDLE from the Start Menu. Open example.py (in the examples folder from the ZIP) and run it by pressing F5 (or using the menu).

At this point you will probably run into some problem as LaTeX is required. If you install MiKTeX, you might get it to work.

Is there any way we can live chat (IRC, MSN)? That would be easier to solve any problems you encounter.

Hello Brecht,

yes, I am running on Windows 7 64bit. Your last post helped me to finally understand that easy_install will load all the required pieces for pyx and substratestack from the internet, and I do not have to load things manually before running.

I followed your instructions up to here:

and this is what I get:

Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>

Traceback (most recent call last):
File "P:\Tools\Substratestack\substratestack-0.2\examples\example.py", line 34, in <module>
from substratestack import m, mm, um, A, kA
File "C:\Python27\lib\site-packages\substratestack-unknown-py2.7.egg\substratestack\__init__.py", line 61, in <module>
text.preamble(r"\usepackage{times}")
File "C:\Python27\lib\site-packages\pyx-0.11.1-py2.7.egg\pyx\text.py", line 1161, in preamble
self.execute(expr, texmessages)
File "C:\Python27\lib\site-packages\pyx-0.11.1-py2.7.egg\pyx\text.py", line 910, in execute
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
File "C:\Python27\lib\subprocess.py", line 637, in __init__
raise ValueError("close_fds is not supported on Windows "
ValueError: close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr
>>>

Oh sorry, I'm just so used to Python that I forget to point out such things.

To eliminate the heavy LaTeX dependency of PyX, I have ported the rendering code to use stand-alone PDF library, ReportLab. As a result the text doesn't look as nice as in the PyX version, but the same functionality is still there.

Install the new version by running easy_install like this (just like you did before). It should automatically take care of installing the ReportLab package.

Code:
easy_install.exe http://bmachiel.github.com/python-substratestack/substratestack-0.2-7-g105f.tar.gz

C:\Users\volker.MUEHLHAUS>cd c:\python27

c:\Python27>scripts\easy_install.exe http://bmachiel.github.com/python-substrate
stack/substratestack-0.2-7-g105f.tar.gz
Downloading http://bmachiel.github.com/python-su...ratestack-0.2-
7-g105f.tar.gz
Processing substratestack-0.2-7-g105f.tar.gz
Running substratestack-0.2-7-g105f\setup.py -q bdist_egg --dist-dir c:\users\vol
ker~1.mue\appdata\local\temp\easy_install-vx_epg\substratestack-0.2-7-g105f\egg-
dist-tmp-sw9he8
Traceback (most recent call last):
File "c:\Python27\scripts\easy_install-script.py", line 8, in <module>
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py", line 1712, in main
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py", line 1700, in with_ei_usage
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py", line 1716, in <lambda>
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py", line 211, in run
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py", line 422, in easy_install
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py", line 476, in install_item
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py", line 655, in install_eggs
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py", line 930, in build_and_install
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py", line 919, in run_setup
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\san
dbox.py", line 62, in run_setup
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\san
dbox.py", line 105, in run
File "C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\san
dbox.py", line 64, in <lambda>
File "setup.py", line 9, in <module>
File "c:\users\volker~1.mue\appdata\local\temp\easy_ins tall-vx_epg\substratest
ack-0.2-7-g105f\substratestack\__init__.py", line 23, in <module>
ImportError: No module named reportlab.pdfgen

c:\Python27>

Odd... seems like the reportlab dependency is not being installed by easy_install. Try to easy_install "reportlab" first.

c:\Python27>scripts\easy_install reportlab
Searching for reportlab
Reading Links for reportlab
Reading ReportLab - Content to PDF Solutions
Best match: reportlab 2.5
Downloading http://pypi.python.org/packages/sour...ortlab-2.5.tar
.gz#md5=cdf8b87a6cf1501de1b0a8d341a217d3
Processing reportlab-2.5.tar.gz
Running reportlab-2.5\setup.py -q bdist_egg --dist-dir c:\users\volker~1.mue\app
data\local\temp\easy_install-qw2nwx\reportlab-2.5\egg-dist-tmp-logyeq
################################################
#Attempting install of _rl_accel, sgmlop & pyHnj
#extensions from 'c:\\users\\volker~1.mue\\appdata\\local\\temp\\ea sy_install-qw
2nwx\\reportlab-2.5\\src\\rl_addons\\rl_accel'
################################################
################################################
#Attempting install of _renderPM
#extensions from 'c:\\users\\volker~1.mue\\appdata\\local\\temp\\ea sy_install-qw
2nwx\\reportlab-2.5\\src\\rl_addons\\renderPM'
# freetype lib 'c:\\devel\\libs_x86\\freetype.lib' not found
# installing without freetype no ttf, sorry!
# You need to install a static library version of the freetype2 software
# If you need truetype support in renderPM
# You may need to edit setup.cfg (win32)
# or edit this file to access the library if it is installed
################################################
Downloading standard T1 font curves
Finished download of standard T1 font curves
error: Setup script exited with error: Unable to find vcvarsall.bat

c:\Python27>


~~~~~~~~~~~~~~~~~

Brecht, thanks for your support, but I will give up at this point. There are too many dependencies and missing files, so I think it makes no sense to install all that stuff on Windows.

I have pointed some Sonnet people to your software and they might try on Linux.

Oh, it requires a C compiler to build. On linux a compiler is always installed, so I didn't notice. On windows you can download the pre-built package at Python Package Index : reportlab 2.5. Choose the version corresponding to the Python version you installed: http://pypi.python.org/packages/2.7/...md64-py2.7.exe . After installing that, it should really work (but you never know with computers ). Can you please give it one last chance?

Thanks. They should have less trouble.

Hello again,

has anyone had success to install and run this?

For what it's worth, I've made a new version (0.3) available. The major difference with 0.2 is that PyX has been replaced with ReportLab for PDF rendering. This should make installation much easier, especially on Windows. Just make sure you install ReportLab using a Windows installer provided on the ReportLab website before installing substratestack. Installation instructions on https://github.com/bmachiel/python-substratestack have been updated to reflect this.

As a kind of an experiment, I've attempted to make the application available through an interactive website. The result is available here. While not as comfortable as running it locally, I think it turned out pretty nice. Check it out!

I've verified it on Firefox 3.6.18, Chrome 10.0.603.0 and Opera 11.11 (all on CentOS Linux). Internet Explorer 6.0 isn't capable enough. I don't know whether newer versions of Explorer can handle it. EDIT: IE 8.0 doesn't work. Firefox 3.6.19 and Opera 10.11(?) do work under Windows though.

DISCLAIMER: I understand people may be hesitant to entering such confidential information on a website (and rightly so!). For this reason, no data is being stored on the website (except in memory while the code is being executed, of course). That said, I'm not responsible or liable for anything that might happen to your data. If this scares you off, you can still use the website to evaluate the usefulness of substratestack and install it locally when you're convinced.

Best regards

Hello Brecht,

thank you, this is a nice way to have a look, without all the unresolved dependencies of a local installation (I had tried on Linux and also gave up).

Now, what is the program expected to do/create?
When I click on the "Run" button, there is one line of output saying that the script ran without errors, and nothing else happens.

Hi Volker,

There's a short introduction in the left-hand panel. The Run button allows you to debug the script. Errors are printed in the bottom pane. If there are no errors (as is the case for the sample script), you can push Download and you will be offered a ZIP file containing all the files generated by the script. These include PDFs resulting from the draw, (stack.draw(...)), write_momentum_substrate and write_sonnet_technology methods.

Best regards,
Brecht

Many thanks, Brecht!

Hi Brecht,

inspired by your work, I create a tool to edit and visualize Sonnet substrate files, and also import slm files from Momentum. Your idea for merging of dielectric makes perfect sense, so I implemented that capability also.

Dr. Mühlhaus Consulting & Software GmbH ? Material file utility

Best regards
Volker

Hello Volker,

I thought about building a GUI frontend for substratestack, but that would have taken too much of my time, so it is nice to see an implementation after all :)
I have only given it a very quick spin, but it looks very nice so far. The support for Cadence/ADS layer mapping is a nice addition!

Best regards,
Brecht

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top