Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some functions could be condensed through numpy #4

Open
youralien opened this issue Jul 17, 2019 · 0 comments
Open

Some functions could be condensed through numpy #4

youralien opened this issue Jul 17, 2019 · 0 comments

Comments

@youralien
Copy link

Noticing some places where some use of numpy functions would be more efficient!

https://github.com/cosmoharrigan/matrix-entropy/blob/master/calculate_profile.py#L43
So I think an easier way to do the dict(Counter(...)) would be to use `numpy.unique(..., return_counts=True).

But the larger issue was that moving window function (https://github.com/cosmoharrigan/matrix-entropy/blob/master/moving_window_filter.py#L11) could be computed using scipy.convolve2d (https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.convolve2d.html). It feels more natural to rely on natural operations like convolution rather than doing the triple-nested for-loops.

Felt like some functions could stay more within the numpy/scipy ecosystem, for such a matrix heavy calculation. Just my two cents!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant