I am using Xyce which is a circuit simulator. I am using it to export a .CSV file and a .prn file. I found Xycegnuplot.py "https://github.com/OpenXyce/Xyce/blob/master/utils/gnuplotXyce.py". I am trying to use it to plot my output variables from Xyce, howver, every time I run gnuplotXyce.py as mentioned by its author I get an error " Import Error" at the "from finblock import findblock" line and I don't know what is that error.
Please help.
Thanks
If you are going to use Xyce, you should probably get the official version from Sandia National Laboratories instead of from the OpenXyce site on github. This version was forked by an anonymous github user, and has not been updated since last fall. Since that update, Sandia released Xyce 6.2 and the OpenXyce creator did not import the new release.
You should also probably join the xyce-users group on googlegroups, where the Xyce developers monitor all questions and try to answer them promptly. It is only by happenstance that I found your question here on stackoverflow.
The "gnuplotXyce.py" script is not really maintained, and might not have been kept working with all the changes that have been made to Xyce since its release. That said, the python script depends on a number of python modules including gnuplot-py which should be available from http://gnuplot-py.sourceforge.net. The "findblock.py" module that you say cannot be found is also present in the "utils" directory of the Xyce source code, alongside gnuplotXyce.py. If you have the whole utils directory downloaded, this error should go away.
I just tried gnuplotXyce.py on a simple netlist with csv output and it didn't work, so my assumption is that the script was not maintained and will need to be fixed.
The script does sort of work if you use the native Xyce standard (.prn) format (i.e. don't specify "format=csv" on your .print line). Unfortunately, it does not leave the window open after it finishes plotting, so it is rather useless. If you use the "--ps" option, though, a correct postscript file will be created that can be viewed in any postscript viewer, or printed on a postscript printer (or through a properly set-up Linux CUPS printer that understands postscript).
The CSV format in Xyce was primarily created in order to allow import into spreadsheets such as Excel or OpenOffice-scalc, which programs have their own plotting utilities.
The ".prn" standard format works well in gnuplot. There is an example of how to use gnuplot to do this display in the document "Using Open Source Schematic Capture Tools With Xyce" on the Sandia Labs Xyce web site (in the documentation and tutorials section).
The official Xyce web site is http://xyce.sandia.gov/
Related
Is it possible to convert Dwg to pdf file using Python?
I have multiple Dwg files that need to convert to pdf.
I am experimenting to create an app to convert but can not find any solution?
Please, if you have any idea help.
Vector Express is a free API you may able to use. (requires a network connection, though)
https://github.com/smidyo/vectorexpress-api
Of course it is possible to write a code in Python to publish DWG file as PDF.
However, DWG is a proprietary file format from AutoCAD, therefore there are a lot of legal issues to distribute the code (beyond your private usage), unless you get a written consent from AutoCAD...
You'll find several application that would already do the job.
Maybe check Open Design Alliance as a starting point.
Using QCAD Command Line Tools (Open Source)
According to qcad.org "QCAD is a free, open source application for computer aided drafting (CAD) in two dimensions (2D). With QCAD you can create technical drawings such as plans for buildings, interiors, mechanical parts or schematics and diagrams. QCAD works on Windows, macOS and Linux. The source code of QCAD is released under the GPL version 3 (GPLv3), a popular Open Source license."
Supported Command Line Conversions
dwginfo
dwg2csv
dwg2bmp
dwg2svg
dwg2pdf
dwgmapconvert
dwg2maptiles
dwg2dwg / pdf2dwg
dwghatch
dwghatcharea
dwgexplode
merge
bbox
dwgnest (QCAD/CAM)
The above commands are very self-explanatory for further information please refer to the above embedded url at qcad.org
Usage in Python
Though I believe that this might not be best practice but a os.system command as follows, might be enough for most use cases
First of all, I agree that this might sound like a question which has already been asked many times in the past. However I couldn't find any answer that was relevant to me in the similar questions so I'll try to be more specific.
I would need to transform PPTX/DOCX files into PDF using Python but I don't have any experience in file format conversion. I have been looking in many places/forums/websites, read a lot of documentation and came across some useful libraries (python-pptx and pyPdf mainly), but I still don't know where to start.
When looking on the Internet, I can see many websites that offer file format conversions as a paying service, even with advanced API's: submit a file via POST and get the transformed PDF file in return. This could work for me, but I am really interested in writing myself the code that does the conversion work from OOXML to PDF.
How would you start doing this? Or is it just impossible on my own?
Thanks for your help!
After some research and with the help of python-pptx's creator, I was able to write to the PowerPoint COM interface using a Virtual Machine.
In case someone reads this thread, this is how I managed to get this done:
- Setup a VM with Microsoft Windows/Office installed on it ;
- Install Python, Django and win32com libraries on the VM.
The files are sent locally from the original Django project to the virtual machine (which are on the same network) through a simple POST request. The file is converted on the VM using win32com.client (which is just a simple call to the win32com.client library) and then sent back as a response to the original Django view, which in turn processes the response.
Note: it took me some time to realize I needed to use the #csrf_exempt decorator for this setup to work.
I'd like to expand LibreOffice with my own Python scripts.
I want to right-click on a word and run a Python script that would send its output to a different window (not change the doc I am working at). For example, I would click on an author name, and the script would search in a local DB for further information about him. Or I'd run a script and it would output some encyclopedia result.
How do I expand LibreOffice?
Following Adobe's suggestion, I went to the openoffice forum.
Here is an acceptable answer from there:
Intercept Right Click and cause it to run your Python scrpt, which should be treated as any other macro.
Information on the OpenOffice Python/Uno bridge is at
http://www.openoffice.org/udk/python/python-bridge.html
some further discussion at
http://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=12643
Edit: A similar problem is under discussion here
http://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=63716
I want to automate the entire process of creating ngs,bit and mcs files in xilinx and have these files be automatically be associated with certain folders in the svn repository. What I need to know is that is there a log file that gets created in the back end of the Xilinx gui which records all the commands I run e.g open project,load file,synthesize etc.
Also the other part that I have not been able to find is a log file that records the entire process of synthesis, map,place and route and generate programming file. Specially record any errors that the tool encountered during these processes.
If any of you can point me to such files if they exist it would be great. I haven't gotten much out of my search but maybe I didn't look enough.
Thanks!
Well, it is definitely a nice project idea but a good amount of work. There's always a reason why an IDE was built – a simple search yields the "Command Line Tools User Guide" for various versions of Xilinx ISE, like for 14.3, 380 pages about
Overview and list of features
Input and output files
Command line syntax and options
Report and message information
ISE is a GUI for various command line executables, most of them are located in the subfolder 14.5/ISE_DS/ISE/bin/lin/ (in this case: Linux executables for version 14.5) of your ISE installation root. You can review your current parameters for each action by right clicking the item in the process tree and selecting "Process properties".
On the Python side, consider using the subprocess module:
The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes.
Is this the entry point you were looking for?
As phineas said, what you are trying to do is quite an undertaking.
I've been there done that, and there are countless challenges along the way. For example, if you want to move generated files to specific folders, how do you classify these files in order to figure out which files are which? I've created a project called X-MimeTypes that attempts to classify the files, but you then need a tool to parse the EDA mime type database and use that to determine which files are which.
However there is hope, so to answer the two main questions you've pointed out:
To be able to automatically move generated files to predetermined paths. From what you are saying it seems like you want to do this to make the versioning process easier? There is already a tool that does this for you based on "design structures" that you create and that can be shared within a team. The tool is called Scineric Workspace so check it out. It also have built in Git and SVN support which ignores things according to the design structure and in most cases it filters all generated things by vendor tools without you having to worry about it.
You are looking for a log file that shows all commands that were run. As phineas said, you can check out the Command Line Tools User guides for ISE, but be aware that the commands to run have changed again in Vivado. The log file of each process also usually states the exact command with its parameters that have been called. This should be close to the top of the report. If you look for one log file that contains everything, that does not exist. Again, Scineric Workspace supports evoking flows from major vendors (ISE, Vivado, Quartus) and it produces one log file for all processes together while still allowing each process to also create its own log file. Errors, warning etc. are also marked properly in this big report. Scineric has a tcl shell mode as well, so your python tool can run it in the background and parse the complete log file it creates.
If you have more questions on the above, I will be happy to help.
Hope this helps,
Jaco
I'm looking for a good python module to generate pdf417 barcodes. Has anyone used one they liked?
Ideally I would like one with as few dependencies as possible, and one that runs on both linux and MacOSX.
We recently had to approach this problem as well, and being a Python shop we wanted a Python solution. It become clear the elaphe is the project that had the potential to actually accomplish pdf 417 barcode.
However what we found was it errors by todays standards, and so we entered the hunt to fix the library. Turns out elaphe must generate an outdated form of *.eps post script that can't be interpreted by ghost script and this is where the bar code generation fails.
Well fortunately elphae uses a common library behind the scenes called Barcode Writer in Pure PostScript # http://bwipp.terryburton.co.uk
This common backend library which has many projects in multi-languages using it to generate projects. The fix specifically for us was to fork elaphe, and correct it's *.eps file generation.
To determine what is broken in the *.eps, look at this other site that is made using postscriptbarcode, and it let's you generate the pdf417 barcode online (as well as other formats): http://www.terryburton.co.uk/barcodewriter/generator/
Once you generate a pdf417 barcode it gives you the option to download the .png, .jpg, and YES the .eps file!
Using this .eps file you can pipe it to ghost script and tweak the parameterization to get the exact pdf417 barcode you are looking for. Then take this result and integrate it into the elaphe library and actually get a pull request on that thing ....
Seems to be a bit of work, but nothing that can't be knocked out in an afternoon. It is ideal to get the elaphe library back in shape to generate these without making this enhancement.
Please note that the performance of this approach for us is a few seconds to generate this barcode due to the fact it creates the 2000 line eps file and pipes it to ghost script which generates another image file that we send back as the final barcode result. This is not as performance as code128 with reportlab.
Perhaps room for optimizations: Is pillow faster than PIL in anyway? Do we need all the parts of the eps file to generate the barcode of type pdf417? Other ways to optimize?
Anyway, great question Ken and I hope you find this to be a great answer.
I guess the issue in elaphe reported by Matteius in 2013 has been fixed, since the issues and commit logs show updates on the pdf417 topic since then.
Anyway, there are now a few other options (got the list with either pip search elaphe or pip search pdf417) :
elaphe ;
elaphe3 (fork of elaphe tested against python3) ;
candybar (no documentation ? also a webservice) ;
pdf417gen ;
treepoem (about the name : barcode -> bark ode -> tree poem =D ) — edit : didn't dig the issue, but as of today generation of PDF417 seems broken.
All but pdf417gen support several types of barcodes.
Note that the documentation of bwipp (on which are based elaphe and treepoem) only mentions 5 levels of error correction (1 to 5), while pdf417gen claims to support 9 security levels (0 to 8).
Reportlab does have an extension called rlbarcode, but this one does not include support for pdf417 codes. I do not know of any other extension for reportlab including support for pdf417 bar codes.
Anyway, if you are interested in generation of pdf417 codes from python, you may be interested in this project: elaphe.
I have still not tested it (in fact, I need to generate pdf417 from python, and I found this thread as well as the elaphe project page) I am going to download the elaphe tools in order to test it right now.