diff --git a/ctapipe/instrument/subarray.py b/ctapipe/instrument/subarray.py index 3fad814b045..a8fbf19d6da 100644 --- a/ctapipe/instrument/subarray.py +++ b/ctapipe/instrument/subarray.py @@ -160,7 +160,7 @@ def to_table(self, kind="subarray"): tel_coords = self.tel_coords tab = Table(dict( - id=np.array(ids, dtype=np.short), + tel_id=np.array(ids, dtype=np.short), pos_x=tel_coords.x, pos_y=tel_coords.y, pos_z=tel_coords.z, @@ -236,7 +236,7 @@ def peek(self): with quantity_support(): for tel_type in types: - tels = tab[tab['tel_description'] == str(tel_type)]['id'] + tels = tab[tab['tel_description'] == str(tel_type)]['tel_id'] sub = self.select_subarray(tel_type, tels) tel_coords = sub.tel_coords radius = np.array([ diff --git a/ctapipe/instrument/tests/test_subarray.py b/ctapipe/instrument/tests/test_subarray.py index b1eac5b6ed4..4fed6a8810c 100644 --- a/ctapipe/instrument/tests/test_subarray.py +++ b/ctapipe/instrument/tests/test_subarray.py @@ -26,6 +26,8 @@ def test_subarray_description(): tel_descriptions=tel ) + sub.peek() + assert len(sub.telescope_types) == 1 assert str(sub) == "test array" @@ -52,5 +54,6 @@ def test_subarray_description(): assert len(sub.to_table(kind='optics')) == 1 + if __name__ == '__main__': test_subarray_description() diff --git a/ctapipe/tools/display_summed_images.py b/ctapipe/tools/display_summed_images.py index b2af7b3be0a..b8016780083 100644 --- a/ctapipe/tools/display_summed_images.py +++ b/ctapipe/tools/display_summed_images.py @@ -64,7 +64,7 @@ def setup(self): break group = camtypes.groups[self.telgroup] - self._selected_tels = list(group['id'].data) + self._selected_tels = list(group['tel_id'].data) self._base_tel = self._selected_tels[0] self.log.info( "Telescope group %d: %s", self.telgroup, diff --git a/docs/examples/InstrumentDescription.ipynb b/docs/examples/InstrumentDescription.ipynb index 27d5a841a32..d498cae739d 100644 --- a/docs/examples/InstrumentDescription.ipynb +++ b/docs/examples/InstrumentDescription.ipynb @@ -91,7 +91,7 @@ "outputs": [], "source": [ "tab = subarray.to_table()\n", - "sc_tels = tab[tab['num_mirrors'] == 2]['id'] # select tel_id of entries where the mirror type is SC\n", + "sc_tels = tab[tab['num_mirrors'] == 2]['tel_id'] # select tel_id of entries where the mirror type is SC\n", "newsub = subarray.select_subarray(\"SCTels\", sc_tels)\n", "newsub.info()" ] @@ -111,7 +111,7 @@ "source": [ "gtab = tab.group_by('num_mirrors')\n", "sc = gtab.groups[0]\n", - "newsub = subarray.select_subarray(\"SCTels\", sc['id'])\n", + "newsub = subarray.select_subarray(\"SCTels\", sc['tel_id'])\n", "newsub.info()" ] }, @@ -241,7 +241,7 @@ "outputs": [], "source": [ "df = subarray.to_table().to_pandas()\n", - "df.set_index('id')" + "df.set_index('tel_id')" ] }, { @@ -278,25 +278,11 @@ "metadata": {}, "outputs": [], "source": [ - "lsts = subarray.select_subarray(\"LSTs\", df.loc[g.groups['LST:LSTCam']]['id'])\n", + "lsts = subarray.select_subarray(\"LSTs\", df.loc[g.groups['LST:LSTCam']]['tel_id'])\n", "lsts.info()\n", "lsts.peek()\n", "lsts.footprint" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -315,7 +301,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.8" + "version": "3.7.3" } }, "nbformat": 4,