match with cross-hand check in LSD

12 views
Skip to first unread message

Bertrand Goldman

unread,
Feb 28, 2013, 12:37:29 PM2/28/13
to lsd-...@googlegroups.com
Dear LSD users,

I want to match two tables with cross-hand check, or similarly: I
want to match a star1 from cat1 to the nearest star in cat2 (a.k.a.
star2), but make sure that that star2 has no closer match in cat1.

This (cat1=stack, cat2=wise):

lsd-query 'select ra, dec, wise.ra, wise.dec, wise._DIST*3600. as dWI
from stack(matchedto=wise,nmax=1,dmax=1.0),
wise(matchedto=stack,nmax=1,dmax=5.0), stack'

does (of course?) not work (see error below).

Replacing one cat1 by a copy or a similar catalogue (ucal_magsqw) works:

lsd-query 'select ra, dec, 3600*(wise.ra-ra) as DraW,
3600*(wise.dec-dec) as DdecW, wise._DIST*3600. as dWI,
(ucal_magsqw.ra-ra)*3600 as DraU, 3600*(ucal_magsqw.dec-dec) as DdecU,
ucal_magsqw._DIST*3600. as dUc
from wise(matchedto=stack,nmax=1,dmax=5.0),
ucal_magsqw(matchedto=wise,nmax=1,dmax=2.0), stack
where
(dUc==0)|((abs(stack.ra-ucal_magsqw.ra)<.0003)&(abs(stack.dec-ucal_magsqw.dec)<.0003))'

but is not too elegant (and fast?).
I could also output the result of the first match into a new table and
match the new table against cat1 again.

Would there be any nicer way with a single query involving only cat1 and
cat2?

Thanks,
Bertrand.


Traceback (most recent call last):
File "/a41217d5/LSD/stable/bin/lsd-query", line 93, in <module>
for row in q.iterate(bounds, progress_callback=progress_callback,
testbounds=testbounds, include_cached=include_cached):
File
"/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/join_ops.py", line
1570, in iterate
_yield_empty=_yield_empty):
File
"/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/join_ops.py", line
1512, in execute
for result in pool.map_reduce_chain(partspecs.items(), kernels,
progress_callback=progress_callback):
File "/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/pool2.py",
line 591, in map_reduce_chain
for r in self.imap_unordered(input, K_fun, K_args,
progress_callback=progress_callback, progress_callback_stage=stage):
File "/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/pool2.py",
line 459, in imap_unordered
for result in mapper(item, *mapper_args):
File
"/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/join_ops.py", line
2348, in _mapper
for result in mapper(qresult, *mapper_args):
File
"/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/join_ops.py", line
2352, in _iterate_mapper
for rows in qresult:
File
"/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/join_ops.py", line
1289, in __iter__
for rows in QueryInstance(self, cell_id, bounds, include_cached):
File
"/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/join_ops.py", line
699, in __iter__
self.jmap = self.root.evaluate_join(self.cell_id,
self.bounds, self.tcache)
File
"/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/join_ops.py", line
272, in evaluate_join
r = ce.evaluate_join(cell_id, bounds, tcache, r, self.name, self.table)
File
"/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/join_ops.py", line
272, in evaluate_join
r = ce.evaluate_join(cell_id, bounds, tcache, r, self.name, self.table)
File
"/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/join_ops.py", line
252, in evaluate_join
r.add_columns(s.items())
File
"/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/colgroup.py", line
336, in add_columns
self.add_column(name, col)
File
"/a41217d5/LSD/stable/lib/python2.7/site-packages/lsd/colgroup.py", line
386, in add_column
assert name not in self.column_map
AssertionError
Reply all
Reply to author
Forward
0 new messages