odlgroup / odlworkshop

Material for ODL workshop Dec 2017
12 stars 13 forks source link

Use rebin package to do binning #21

Open adler-j opened 6 years ago

adler-j commented 6 years ago

https://pypi.python.org/pypi/rebin/1.0.1

Very nice interface

kohr-h commented 6 years ago

Why an extra package? The function is trivial to extend to multiple factors, arbitrary dimension and custom reductions. And the rebin implementation is not faster.

adler-j commented 6 years ago

Well the function is non-trivial to extend to non-integer reductions for example.

Overall we don't want to teach people to write their own code. Use a library if there is one.

kohr-h commented 6 years ago

Well the function is non-trivial to extend to non-integer reductions for example.

Which is not supported by rebin either.

Overall we don't want to teach people to write their own code. Use a library if there is one.

Agree in general, but if the code consists of two lines, then I prefer that over a package that has to be installed. I also find it kind of instructive to see how do do summing over blocks efficiently in Numpy. With an external package, it's all magic.

adler-j commented 6 years ago

Which is not supported by rebin either.

Seems you're right

Agree in general, but if the code consists of two lines, then I prefer that over a package that has to be installed. I also find it kind of instructive to see how do do summing over blocks efficiently in Numpy. With an external package, it's all magic.

Well to 98% of the people who need a tutorial, that line is also magic. At least from rebin.rebin they can figure out what it is supposed to do or google the docs. If we're keeping it I'd at least suggest adding a link to e.g. this SO answer:

https://stackoverflow.com/questions/4624112/grouping-2d-numpy-array-in-average/4624923#4624923