SubarrayDescription¶
-
class
ctapipe.instrument.subarray.
SubarrayDescription
(name, tel_positions=None, tel_descriptions=None)[source]¶ Bases:
object
Collects the
TelescopeDescription
of all telescopes along with their positions on the ground.- Parameters
- name: str
name of this subarray
- tel_positions: Dict[Array]
dict of x,y,z telescope positions on the ground by tel_id. These are converted internally to a coordinate in the
GroundFrame
- tel_descriptions: Dict[TelescopeDescription]
dict of TelescopeDescriptions by tel_id
- Attributes
- name: str
name of subarray
- tel_coords: astropy.coordinates.SkyCoord
coordinates of all telescopes
- tels:
dict of TelescopeDescription for each telescope in the subarray
- tel_ids: np.ndarray
array of tel_ids
- tel_indices: dict
dict mapping tel_id to index in array attributes
Attributes Summary
list of camera types in the array
area of smallest circle containing array on ground
number of telescopes in this subarray
list of optics types in the array
for backward compatibility
returns telescope positions as astropy.coordinates.SkyCoord
telescope IDs as an array
returns an expanded array that maps tel_id to tel_index.
returns dict mapping tel_id to tel_index, useful for unpacking lists based on tel_ids into fixed-length arrays
list of telescope types in the array
Methods Summary
from_hdf
(path)get_tel_ids
(telescopes)Convert a list of telescope ids and telescope descriptions to a list of unique telescope ids.
get_tel_ids_for_type
(tel_type)return list of tel_ids that have the given tel_type
info
([printer])print descriptive info about subarray
peek
()Draw a quick matplotlib plot of the array
select_subarray
(tel_ids[, name])return a new SubarrayDescription that is a sub-array of this one
tel_ids_to_indices
(tel_ids)maps a telescope id (or array of them) to flat indices
tel_ids_to_mask
(tel_ids)Convert a list of telescope ids to a boolean mask of length
num_tels
where the index of the telescope is set toTrue
for each tel_id in tel_idstel_mask_to_tel_ids
(tel_mask)Convert a boolean mask of selected telescopes to a list of tel_ids.
to_hdf
(h5file[, overwrite, mode])write the SubarrayDescription
to_table
([kind])export SubarrayDescription information as an
astropy.table.Table
Attributes Documentation
-
camera_types
¶ list of camera types in the array
-
footprint
¶ area of smallest circle containing array on ground
-
num_tels
¶ number of telescopes in this subarray
-
optics_types
¶ list of optics types in the array
-
tel
¶ for backward compatibility
-
tel_coords
¶ returns telescope positions as astropy.coordinates.SkyCoord
-
tel_ids
¶ telescope IDs as an array
-
tel_index_array
¶ returns an expanded array that maps tel_id to tel_index. I.e. for a given telescope, this array maps the tel_id to a flat index starting at 0 for the first telescope.
tel_index = tel_id_to_index_array[tel_id]
If the tel_ids are not contiguous, gaps will be filled in by -1. For a more compact representation use thetel_indices
-
tel_indices
¶ returns dict mapping tel_id to tel_index, useful for unpacking lists based on tel_ids into fixed-length arrays
-
telescope_types
¶ list of telescope types in the array
Methods Documentation
-
get_tel_ids
(telescopes: List[Union[int, str, ctapipe.instrument.telescope.TelescopeDescription]]) → List[int][source]¶ Convert a list of telescope ids and telescope descriptions to a list of unique telescope ids.
- Parameters
- telescopes: List[Union[int, str, TelescopeDescription]]
List of Telescope IDs and descriptions. Supported inputs for telescope descriptions are instances of
TelescopeDescription
as well as their string representation.
- Returns
- tel_ids: List[int]
List of unique telescope ids matching
telescopes
-
get_tel_ids_for_type
(tel_type)[source]¶ return list of tel_ids that have the given tel_type
- Parameters
- tel_type: str or TelescopeDescription
telescope type string (e.g. ‘MST:NectarCam’)
-
select_subarray
(tel_ids, name=None)[source]¶ return a new SubarrayDescription that is a sub-array of this one
- Parameters
- tel_ids: list(int)
list of telescope IDs to include in the new subarray
- name: str
name of new sub-selection
- Returns
- ——-
- SubarrayDescription
-
tel_ids_to_indices
(tel_ids)[source]¶ maps a telescope id (or array of them) to flat indices
- Parameters
- tel_idsint or List[int]
array of tel IDs
- Returns
- np.array:
array of corresponding tel indices
-
tel_ids_to_mask
(tel_ids)[source]¶ Convert a list of telescope ids to a boolean mask of length
num_tels
where the index of the telescope is set toTrue
for each tel_id in tel_ids- Parameters
- tel_idsint or List[int]
array of tel IDs
- Returns
- np.array[dtype=bool]:
Boolean array of length
num_tels
with indices of the telescopes intel_ids
set to True.
-
tel_mask_to_tel_ids
(tel_mask)[source]¶ Convert a boolean mask of selected telescopes to a list of tel_ids.
- Parameters
- tel_mask: array-like
Boolean array of length
num_tels
with indices of the telescopes intel_ids
set to True.- Returns
- ——-
- np.array:
Array of selected tel_ids
-
to_hdf
(h5file, overwrite=False, mode='a')[source]¶ write the SubarrayDescription
- Parameters
- h5filestr, bytes, path or tables.File
Path or already opened tables.File with write permission
- overwriteFalse
If the output path already contains a subarray, by default an error will be raised. Set
overwrite=True
to overwrite an existing subarray. This does not affect other content of the file. Usemode="w"
to completely overwrite the output path.- modestr
If h5file is not an already opened file, the output file will be opened with the given mode. Must be a mode that enables writing.
-
to_table
(kind='subarray')[source]¶ export SubarrayDescription information as an
astropy.table.Table
- Parameters
- kind: str
which table to generate (subarray or optics)