ivoa-std / ConeSearch

Simple Cone Search
Creative Commons Attribution Share Alike 4.0 International
2 stars 4 forks source link

Multi-center conesearch query #34

Open molinaro-m opened 4 years ago

molinaro-m commented 4 years ago

How to query a catalogue with multiple target positions?

bmiszalski commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

On Wed, Jan 27, 2021 at 03:16:05AM -0800, Brent Miszalski wrote:

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, e.g.:

While I'm not arguing strongly against developing S-protocols towards allowing multiple cones (or other parameters), my take is that we already have a powerful protocol that allows this kind of thing: TAP.

And so I'd much rather spend the effort on educating people that still have data in SSA services that is not available through ObsTAP to fix that (since SSA isn't so far from obscore, it's really not hard).

I'd even volunteer to host their obscore records if necessary...