I'm assuming this can't be done easily but atm I've written for loops in python that take in multiple files from a folder and runs them against an executable to convert them into a readable format. Problem is, the number of files will be different almost every time I run the script. The whole process takes a while so a progress bar would be nice. I've been trying tqdm, progress, etc. modules, but they all seem to work based on a fixed number of iterations, which doesn't work for me.
Basically, is there any possible way to easily implement a progress bar which either calculates progress based on how long the process will take to perform the conversions, or based on how many there are to convert?
Though having said this, for one part of the code, instead of taking in files, it was easier to run a powershell script in cmd through python to keep it part of the same code. This script iterates through many many files and outputs 1 file. Again, is there a way to monitor the progress of this in python, even though in python the code is just running something in cmd?
Try PyProg! PyProg is an open-source library for Python to create super customizable progress indicators & bars.
It is currently at version 1.0.2; it is hosted on Github and available on PyPI (Links down below). It is compatible with Python 3 and 2.
I actually made PyProg because I needed a simple but super customizable progress bar library. And I made it super flexible as well, so you can use set_total(<total>) to set the total number of files you need to convert and use set_stat(<status>) to set the current progress, and it will calculate the percentage for you!
You can easily install it with: pip install pyprog. Some examples of using it is on the Github page for this project.
PyProg Github: https://github.com/Bill13579/pyprog
PyPI: https://pypi.python.org/pypi/pyprog/
Related
I have a python program which solves a large integer programming problem. I use Pyomo to model and Gurobi for solving. I have silenced gurobi, as it is rather chatty and pollutes the terminal output a bit. However, I would still like to show the user, that stuff is going on. How do you do that? All the progress-bar applications I have found obviously needs a "end time"/last iteration to function. I don't need a fancy progress bar. Just something that shows that program is still runing.
To illustrate my needs I have something like the following
print('Reading data')
readDataQuickly(...)
print('Data read. Now model will be created')
createModelQuickly(...)
print('Model created. Now solving starts')
veryTimeConsumingFunctionIDontControl(...) # <- Show stuff is going on here
print('Thanks for your patience')
I am using Python 3.10 if it matters
I have tried different kinds of process bars which works great, if I am the one who implemented the time consuming part, as I can add the progress indicator in e.g. loops. However, here I do not have access to the code of the solver, and hence, I cannot show progress from "outside".
[
Very simple to use this, you need to integrate inside your function to show the progress bar.
I am using open-CV - 2.4 with python-3. I am able to show multiple images at the same time (8 of them and, I don't want to reduce the number). But many times, these windows overlap each other. So, I want to be able to put them all in the same windowj.
So, to do this I used the function np.hstack(). Now, my problem is that I don't know how to show their names(i.e I would like to give the names to these windows individually, the way we do using cv2.imshow("name", window) ).
Also, I want to avoid using GUI libraries like tkinter and qt.
Thanks in advance.
So...
I plan on doing an animation that pulls all the text from the screen to the middle and lets it pulse like a heart. For that I checked if I'm able to manipulate whole Strings and Chars the way I'm able to manipulate circles, for example. I found the libraries Nexttext and Fontastic, but those seem to be outdated, therefore I can't use them with Processing 3.0. Than there is the library Geomerative, which I manged to install through Processings library manager, but this one yields the error "duplicate libraries", which I can't find a , for me understandable, workaround for. I'm also using minim, since I combine the pulse with music input, minim works fine though.
Thus I'm asking if anyone here has an idea on how to fix this error, make the outdated libraries run or maybe someone has an alternative way/library to manipulate text.
Apparently the processing forum is not that active, hence I'm asking here, there was one suggestions tho, that I should search for similar Java libraries, which I yet have to do.
What exactly do you mean when you say you want to pull text from the screen? Do you mean you want to get text from another application and copy it into Processing? Or are you just talking about doing something inside the Processing window?
If you're just talking about manipulating text within the Processing window, then I'm not sure why you need a library for this. Processing has several functions that allow you to draw text, change its font, size, positioning, etc.
Anyway, the issue you've encountered is a known bug. Looks like the only solution for now is to use an old version of Processing. You can download them from the same place you downloaded Processing 3.
Both Geomerative and Fontastic work with Processing 3.2.3
Bare in mind is the bug Kevin mentioned.
However, the only issue I had was compiling examples that had this line:
import processing.opengl.*;
Simply remove or comment this line and the example should compile
I am new to processing, i found it by searching for "draw with coding" , and i tried it, seems every time i modify the code, i have to stop and render again to get the final result
Is there any way to get updated graph without re-rendering? that can be much more convenient for creating simple figures.
if not, is there any alternative to processing that can draw a graph with coding?
I've used Tikz in Latex, but that is just for Latex, I want something that can let me draw a figure by coding, I've suffered enough though using software like coreldraw, it lacks the fundamental elegance of coding..
thanks alot!
Please have a look at the FluidForms libraries.
easy to setup
documentation and video tutorials
as long as you don't run into exceptions, live code comfortably
if you prefix public variables with param you also get sliders for free :)
Do check out the video tutorials, especially this one:
Also, if using Python isn't a problem I recommend having a look at:
NodeBox
Field
Python is a brilliant scripting language - which makes prototyping/'live coding' easy(although it can be compiled and it also plays nicely with c/c++) and is easy to pick up and a joy to use.
In Processing, you must re-run your program to see the changes (graphically), unless you write code to receive input from the user to dynamically adjust what you are drawing. For creating user interfaces there's for example the controlP5 library (http://www.sojamo.de/libraries/controlP5/).
It doesn't support "live coding" (at least that I know of).
You must re-run the code to see the new result.
If Live coding is what you're looking for, check out Fluxus (http://www.pawfal.org/fluxus/) or Impromptu (http://en.wikipedia.org/wiki/Impromptu_(programming_environment)
Doxygen takes about 12 hours to run on our code base. This is primarily because there is a lot of code to process (~1.5M lines). However, it's very quickly approaching the point at which we can't do nightly documentation updates because they take too long. We've already had to reduce the graph depth to get it down to 12 hours.
I've tried the standard approaches, but I really do need high quality output, and this includes graphs and SEARCH_INCLUDES. I have a fairly good machine to run Doxygen on, but Doxygen doesn't take advantage of its many cores. (It pegs a single CPU on the build server, but is only 4% of the available system.) Having a multithreaded Dot build is handy, though that's only half or so of the build time.
Are there any techniques I can use to run doxygen via multiple processes and manually shard the task? I've seen some talk about creating tag files, but I don't understand enough about them to know if they'd do what I want. What I'm looking for is something like:
doxygen Doxyfile-folder1
doxygen Doxyfile-folder2
doxygen Doxyfile-folder3
doxygen Doxyfile-folder4
doxygen-join output/folder1/html output/folder2/html output/folder3/html output/folder4/html
Of course, I'm just making stuff up, but that's an idea of what I'm looking for. Also, I'd use a lot more than 4 processes.
Tag files are typically the way to go if
you have a number of logically coherent source files (let's call them components) and
you know the dependencies between the components, e.g. component A uses component B and C, and component B only uses C, and
It is ok (or even preferred) that the index files (e.g. the list of a files/classes/functions) are limited to a single component.
you are interested in HTML output.
A tag file is basically just a structured list of symbols with links to the location in the documentation. Tag files allow doxygen to make links from the documentation of one component to that of another.
It is a 2 step process:
First you run doxygen on each component to generate the tag file for that component. You can do this by disabling all output and use GENERATE_TAGFILE. So for component A, a Doxyfile.tagonly would have the following settings:
GENERATE_HTML = NO
GENERATE_LATEX = NO
GENERATE_RTF = NO
GENERATE_MAN = NO
GENERATE_TAGFILE = compA.tag
You'll notice that running doxygen this way is very fast.
The second step is to generate the actual documentation. For component A you need a Doxyfile which includes the tag files of the components B and C since we determined A depends on these components.
GENERATE_HTML = YES
GENERATE_LATEX = NO
GENERATE_RTF = NO
GENERATE_MAN = NO
TAGFILES = path/to/compB/compB.tag=path/to/compB/htmldocs \
path/to/compC/compC.tag=path/to/compC/htmldocs
Using this approach I have been able to generate documentation for 20M+ lines of code distributed over 1500+ components in under 3 hours on a standard desktop PC (Core i5 with 8Gb RAM and Linux 64bit), including source browsing, full call graphs, and UML-style diagrams of all data structures. Note that the first step only took 10 minutes.
To accomplish this I made a script to generate the Doxyfile's for each component based on the list of components and their direct dependencies. In the first step I run 8 instances of doxygen in parallel (using http://www.gnu.org/s/parallel/). In the second step I run 4 instances of doxygen in parallel.
See http://www.doxygen.nl/manual/external.html for more info about tag files.