from astro.main.SourceList import SourceList from astro.main.AssociateList import AssociateList # Fetch input SourceLists sl1 = (SourceList.SLID==183751)[0] print "SourceList 1:",sl1.SLID,sl1.OBJECT sl2 = (SourceList.SLID==183741)[0] print "SourceList 2:",sl2.SLID,sl2.OBJECT # Define area, areatup for SourceList and arealist for AssociateList rr = 10.65 ll = 10.66 uu = -28.65 bb = -28.66 areatup = [ (ll,uu), (ll,bb), (rr,bb), (rr,uu) ] arealist = [ ll,uu,ll,bb,rr,bb,rr,uu ] print "Area: ",areatup # Count the number of sources in area data1 = sl1.sources.get_data_dict_from_area_search(attr_list=['RA', 'DEC', 'HTM'],Area=areatup) print "Sources in area in SL1:",len(data1['SID']) data2 = sl2.sources.get_data_dict_from_area_search(attr_list=['RA', 'DEC', 'HTM'],Area=areatup) print "Sources in area in SL2:",len(data2['SID']) # Create the AssociateList al = AssociateList() al.input_lists.append(sl1) al.input_lists.append(sl2) al.set_search_area(*arealist) al.debug=10 al.make() al.commit() # Fetch the data dat=al.associates.get_data(['RA', 'DEC', 'HTM']) print print "AID,SLID,SID,RA,DEC,HTM" for aid in dat: for aa in dat[aid]: print aid,aa print