import pandas as pd import tarfile import shutil import astroquery from astroquery.alma import Alma from astropy.table import Table alma = Alma() alma.archive_url = 'https://almascience.nrao.edu' def get_mous(science_keyword, save_file_path = None, min_year = None): """Get all mous IDs for a given science keyword Returns list of mous IDs as strings science_keyword: string search keyword save_file_path: optional path to save csv of results min_year: optional param to filter results to only those after a certain year; can be string or int; current min year in archive is 2011 """ #query alma full_query = "select * from ivoa.obscore where science_keyword = '{}'".format(science_keyword) query_results = Alma.query_tap(full_query) #convert results to df and clean up result_df = query_results.to_table().to_pandas() result_df.loc[:, result_df.dtypes == object] = result_df.loc[:, result_df.dtypes == object].apply(lambda x: x.str.decode('utf-8')) #filter results if desired if min_year is not None: