-
Notifications
You must be signed in to change notification settings - Fork 274
Support telescope position from EarthLocation
s for SubarrayDescription
#2424
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,8 +81,8 @@ def __init__( | |
---------- | ||
name : str | ||
name of this subarray | ||
tel_positions : Dict[int, np.ndarray] | ||
dict of x,y,z telescope positions on the ground by tel_id. These are | ||
tel_positions : Dict[int, Union[np.ndarray, EarthLocation]] | ||
dict of x,y,z telescope positions on the ground by tel_id or EarthLocation. These are | ||
converted internally to a coordinate in the `~ctapipe.coordinates.GroundFrame` | ||
tel_descriptions : Dict[TelescopeDescription] | ||
dict of TelescopeDescriptions by tel_id | ||
|
@@ -91,7 +91,9 @@ def __init__( | |
coordinate system used for `tel_positions`. | ||
""" | ||
self.name = name | ||
self.positions = tel_positions or dict() | ||
self.positions: Dict[int, Union[np.ndarray, EarthLocation]] = ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We shouldn't use mixed types for internal storage. We should accept I think for now, that should be the previous, so ground frame coordinas. |
||
tel_positions or dict() | ||
) | ||
self.tels: Dict[int, TelescopeDescription] = tel_descriptions or dict() | ||
self.reference_location = reference_location | ||
|
||
|
@@ -157,9 +159,17 @@ def info(self, printer=print): | |
def tel_coords(self): | ||
"""Telescope positions in `~ctapipe.coordinates.GroundFrame`""" | ||
|
||
pos_x = [p[0].to_value(u.m) for p in self.positions.values()] | ||
pos_y = [p[1].to_value(u.m) for p in self.positions.values()] | ||
pos_z = [p[2].to_value(u.m) for p in self.positions.values()] | ||
positions = self.positions.values() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above, internal representation should not be mixed. |
||
positions = [ | ||
GroundFrame.from_earth_location(p, self.reference_location).cartesian.xyz | ||
if isinstance(p, EarthLocation) | ||
else p | ||
for p in positions | ||
] | ||
|
||
pos_x = [p[0].to_value(u.m) for p in positions] | ||
pos_y = [p[1].to_value(u.m) for p in positions] | ||
pos_z = [p[2].to_value(u.m) for p in positions] | ||
|
||
frame = GroundFrame(reference_location=self.reference_location) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by tel_id or EarthLocation
sounds likeEarthLocation
could be the key of the dictionary, not another format for the value.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, better with something like
dict of telescope positions by tel_id, given as x,y,z position or
EarthLocation
.