-
Notifications
You must be signed in to change notification settings - Fork 270
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
TelescopeParameterLookup does not check wether telescope is in attaached subarray #2233
Comments
As I don't know of a way of getting a But are you also asking for a check before the |
0 is a special case in that we basically always know that it is an invalid tel_id, however, with our subselected arrays, any tel id might actually be not in the subarray |
Yes and I'm asking for a distinction of these two cases, 1) not having set a parameter value and 2) asking for a telescope that is not there. This came up during debugging, I think it might actually not be a problem in normal operations, since we just loop over all telescopes in a subarray (that then are there by definition)? |
Yes, that is the right thing to do, however, I was arguing that we shouldn't just treat 0 specially, but we should check. I would suggest to check only in in the E.g.: try:
return self._value_for_tel_id[tel]
except KeyError:
if tel not in self.subarray.tel:
raise KeyError(f"Unknown telescope id: {tel_id}")
else:
raise KeyError("No value configured vor telescope id: {tel_id}") Maybe introduce new exception classes for the two cases, i.e. |
The code to be changed in the way described above is here: ctapipe/ctapipe/core/telescope_component.py Lines 216 to 225 in a987cc8
|
The following code fails:
which is ok, because it was really not set by '*', because it is not in the attached subarray.
The error message could be improved though, because
0
is a nonsenical telescope id.I would prefer that for those cases the error message would be
ctapipe/ctapipe/core/telescope_component.py
Lines 208 to 219 in 2021ad1
The text was updated successfully, but these errors were encountered: