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

Cache camera geometries by camera name #1054

Merged
merged 1 commit into from
Apr 25, 2019
Merged

Cache camera geometries by camera name #1054

merged 1 commit into from
Apr 25, 2019

Conversation

maxnoe
Copy link
Member

@maxnoe maxnoe commented Apr 24, 2019

Just using lru_cache is not possible, as numpy arrays and dicts are not hashable.

We could use cachetools but here is a solution by hand.

@kosack
Copy link
Contributor

kosack commented Apr 24, 2019

Just using lru_cache is not possible, as numpy arrays and dicts are not hashable.

Yes, I think that's why I originally added a custom __hash__ function to CameraGeometry, but it was kind of a hack.

@codecov
Copy link

codecov bot commented Apr 24, 2019

Codecov Report

Merging #1054 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1054      +/-   ##
==========================================
+ Coverage   83.37%   83.39%   +0.01%     
==========================================
  Files         186      186              
  Lines       10583    10595      +12     
==========================================
+ Hits         8824     8836      +12     
  Misses       1759     1759
Impacted Files Coverage Δ
ctapipe/io/simteleventsource.py 98.93% <100%> (+0.04%) ⬆️
ctapipe/io/tests/test_simteleventsource.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87273b3...859c3a9. Read the comment docs.

@maxnoe
Copy link
Member Author

maxnoe commented Apr 24, 2019

Yes, I think that's why I originally added a custom hash function to CameraGeometry, but it was kind of a hack.

The CameraGeometry is hashable, the inputs you need to create one are not. This is a different problem.

@kosack kosack merged commit 8c4faa6 into master Apr 25, 2019
@maxnoe maxnoe deleted the cache_geometry branch April 25, 2019 09:22
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

Successfully merging this pull request may close these issues.

None yet

3 participants