# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Using VO services
#
# OpenKM3 uses the [pyvo interface](https://pyvo.readthedocs.io) to access data provided through the [VO server](http://vo.km3net.de) of KM3NeT. Currently implemented is a Simple Cone Search (SCS) service accessible through the TAP protocol.

from openkm3.store import KM3Store
store = KM3Store()

service = store.get("ana20_01_vo")

service.show_paraminfo()

# ## Getting TAP service or SCS
#
# You can get the services from the loaded KM3Object, which returns pyvo objects. From here onwards, you can use pyvo functions.

tap = service.get_tap()
highEevents = tap.search("SELECT * FROM ant20_01.main WHERE nhit>150") # get most high-energetic events
highEevents.to_table()

scs = service.get_scs()
coneevents = scs.search((20,30), 2) # get events for a 2 degree cone around given sky coordinates
coneevents.to_table()

# ## Access full table

fulltable = service.get_dataframe()

plot = fulltable.beta.plot(kind = "hist")

StarcoderdataJupyterScriptsDedupFiltered