-
Notifications
You must be signed in to change notification settings - Fork 272
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
Stable optics and camera indices #2063
Comments
The ctapipe/ctapipe/instrument/subarray.py Lines 400 to 403 in e721738
ctapipe/ctapipe/instrument/subarray.py Lines 293 to 295 in e721738
As self.tels is also just an ordered dict of the telescopes in the subarray, I don't really see why the camera_index would change between files, unless the files themselves have slightly different subarrays? Or do we perhaps have to change to use an |
Only dicts |
Actually: I am a bit reluctant here: introducing this order means people will somehow start to rely on it. However: this index is only meant as a relationship inside the specific file! There is no need to guarantee the order and it's quite dangerous if people would rely on it between different files I'd say. |
I still don't quite see why files with the exact same subarray in them would end up with these keys in a different order - are we sure the example files at the top of this issue have the same subarray description? If not, then the order would not be expected to be the same. As @maxnoe said, nobody should rely on it being the same either, as it is an internal mapping to build the SubarrayDescription, not something the user should even care about. |
It's not even different files. You can get different orders for the same file in subsequent runs: from ctapipe.io import EventSource
s = EventSource('dataset://gamma_prod5.simtel.zst')
print([c.name for c in s.subarray.camera_types])
set order just isn't guaranteed. |
@kosack if you want to know the CPython implementation detail that causes this: String hashes are randomized between python interpreter sessions:
Edit: actually, it's not a cpython internal, it's specified in a PEP: https://peps.python.org/pep-0456/ |
Then I think it is a good idea to sort first - having the output change slightly between runs with the same input is certainly unexpected. |
Please describe the use case that requires this feature.
Minor stylistic request to improve consistency between runs of one production.
Describe the solution you'd like
Define an order (i.e. linked to tel ids)
Additional context
The text was updated successfully, but these errors were encountered: