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

Optimize the index computation #5

Closed
mchalela opened this issue Dec 18, 2020 · 0 comments
Closed

Optimize the index computation #5

mchalela opened this issue Dec 18, 2020 · 0 comments

Comments

@mchalela
Copy link
Owner

mchalela commented Dec 18, 2020

GriSPy/grispy/core.py

Lines 350 to 354 in e70b75c

def _digitize(self, data, bins):
"""Return data bin index."""
N = len(bins) - 1
d = (N * (data - bins[0]) / (bins[-1] - bins[0])).astype(np.int)
return d

This is a faster way of computing the index:

 def _digitize(self, data, bins): 
     """Return data bin index.""" 
     # allowed indeces with int16: (-32768 to 32767)
     d = ((data - bins[0]) / (bins[1] - bins[0])).astype(np.int16)
     return d 
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