jeudi 3 avril 2014

Show progress of numpy.average


Vote count:

0




So, I'm writing a program which at one point uses numpy.average on a 2-d array to average across each row using another array of weights, and return a 1-d array of averages. It's for supernova analysis, we are trying to create a composite spectrum, if that helps.


The averaging itself works just fine, but sometimes I try to use it on an array of several thousand columns...and it takes around 20 minutes. I was wondering if there was a way to add a progress indicator of some sort. Right now the only line doing the averages looks like:


template.flux = np.average(fluxes, weights=ivars, axis=0)


Where template is an object, and flux is the attribute we are trying to create an average of. I read up on the progressbar module, but that only works with for loops that iterate over a range. Maybe even an indicator showing the current time elapsed, out of the average total time it takes to complete it? I'm not really sure.



asked 2 mins ago






Aucun commentaire:

Enregistrer un commentaire