Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-center conesearch query #34

Open
molinaro-m opened this issue Aug 27, 2020 · 3 comments
Open

Multi-center conesearch query #34

molinaro-m opened this issue Aug 27, 2020 · 3 comments
Labels

Comments

@molinaro-m
Copy link
Member

How to query a catalogue with multiple target positions?

@molinaro-m molinaro-m added the 2.x label Aug 27, 2020
@bmiszalski
Copy link

bmiszalski commented Jan 27, 2021

This is also an issue for SSA. At DataCentral we workaround this from the client side with pyvo/pandas by doing multiple searches and then concatenating the results. This however depends on the votable output of SSA, e.g.:

indiv_results = []
targets = ['g2037567-243832','g2038197-250660','g2039258-245126']

#since SSA does not support more than one value per each parameter
#to query multiple targets we perform separate queries
#and append the results to indiv_results in the form of pandas dataframes
#Once done, we can concatenate the results into a single dataframe
#that makes processing the results a lot easier
#Note that we exclude the pos parameter here, since we are using the targetname
#and we only request the VR (combined) spectra
for t in targets:
custom = {}
custom['FILTER'] = 'VR'
custom['TARGETNAME'] = t
custom['COLLECTION'] = '6dfgs_fdr'
results = service.search(**custom)
indiv_results.append(results.votable.get_first_table().to_table(use_names_over_ids=True).to_pandas())

#dataframe containing all our results
df = pd.concat(indiv_results,ignore_index=True)

This is one with a pos search:

#As in the 6dF example, we will combine the results of two queries here.
#Instead of using target names, we will combine two different positions
#These could be read in from a file, but here we just have the coords list
indiv_results = []

coords = [(214,0),(217,0)]
for c in coords:
pos = (c[0]*u.deg,c[1]*u.deg)
custom = {}
custom['SIZE'] = 0.3
#only accept results with a positive redshift
custom['REDSHIFT'] = '0/'
custom['INSTRUMENT'] = '2dF-AAOmega'
custom['COLLECTION'] = 'gama_dr2'
results = service.search(pos=pos,**custom)
#add all results
indiv_results.append(results.votable.get_first_table().to_table(use_names_over_ids=True).to_pandas())

#dataframe containing our combined results
df = pd.concat(indiv_results,ignore_index=True)

@bmiszalski
Copy link

Another option is to have multiple POS parameter values as done in SIA (e.g. POS=CIRCLE a b c&POS=CIRCLE e f g). You'd probably want a column in the results with the input search pos and radius, plus a column for distance from this position.

@msdemlei
Copy link
Contributor

msdemlei commented Jan 27, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants