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

Re-implement .trials #418

Closed
tensionhead opened this issue Jan 11, 2023 · 1 comment · Fixed by #422
Closed

Re-implement .trials #418

tensionhead opened this issue Jan 11, 2023 · 1 comment · Fixed by #422
Labels
Explore Examine novel functionality/proposed changes etc. Does not necessarily involve coding things. Performance Improve the number crunching

Comments

@tensionhead
Copy link
Contributor

tensionhead commented Jan 11, 2023

Current Situation

The backing Indexer class is a sophisitcated, yet quite inefficient iterable, which gets re-computed on every .trials property access. Meaning that if someone just accesses repeatedly my_data.trials[1000], all preceding 1000 trials get consumed via _get_trial, exhausting the 'computed' generator, every single time. This is sub-optimal for continuous data, but apparantly really abysmal for discrete data, see also #403

Idea

A simple fixed/'pre-computed' .trials property subclassed from list which maps item access to _get_trial

def __getitem__(self, idx):
    return self._get_trial(idx)

should do the trick. Support for slices, arrays etc. can then be added as we have it right now..

@tensionhead tensionhead added Explore Examine novel functionality/proposed changes etc. Does not necessarily involve coding things. Performance Improve the number crunching labels Jan 11, 2023
@tensionhead tensionhead linked a pull request Jan 16, 2023 that will close this issue
4 tasks
@tensionhead
Copy link
Contributor Author

Done with #422

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Explore Examine novel functionality/proposed changes etc. Does not necessarily involve coding things. Performance Improve the number crunching
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant