Science Operations

Data Access via Python

Users of the IA2 archive can also search for and retrieve public data programmatically using python. The simple example given below can be used as a starting point. Contact aconrad@lbto.org for help writing python code specific to your application.

 

#
#  Simple example to demonstrate the use of pyvo/TAP for programmatic
#  access to archive.lbto.org.  This example retrieves the names of all
#  LUCI files acquired on UT November 6 2024.
#
import pyvo

#
# Construct the service object
#
access_url = “https://archive.lbto.org/tap
service = pyvo.dal.TAPService(access_url)

#
# Form the query
#
query = “””SELECT lbt.file_name AS file_name FROM lbt.lbt lbt WHERE lbt.file_name LIKE ‘%luci1%’ AND lbt.date_obs >= ‘2024-11-06T12:00:00.0’ AND lbt.date_obs <= ‘2024-11-07T12:00:00.0′”””

#
# Issue the query
#
result = service.run_async( query )

# Print the results
for row in result:
print(row[“file_name”])