from astro.main.SourceList import SourceList
from astro.main.AssociateList import AssociateList

(rr, ll, uu, bb) = (0.894, 0.900, 0.904, 0.910)
testareaAL = [ ll,uu,ll,bb,rr,bb,rr,uu ]
# nrOfSources per SL: PZ 3, LAS 3, POA 3

sourcelists = {
	'POA': (SourceList.SLID==61804)[0],
	'PZ': (SourceList.SLID==155041)[0],
	'LAS': (SourceList.SLID == 244531)[0], # DR3
}


al1 = AssociateList()
al1.input_lists.append(sourcelists['POA'])
al1.input_lists.append(sourcelists['PZ'])
al1.associatelisttype = 2 # master
al1.set_single_out_closest_pairs(False)
al1.set_search_distance(1.0)
al1.set_search_area(*testareaAL)
al1.make()
al1.commit()

al2 = AssociateList()
al2.input_lists.append(al1)
al2.input_lists.append(sourcelists['LAS'])
al2.associatelisttype = 2 # master
al2.set_single_out_closest_pairs(False)
al2.set_search_distance(1.0)
al2.set_search_area(*testareaAL)
al2.make()
al2.commit()



"""
[tinsley] 08:54:48 - Preparing for the matching
[tinsley] 08:54:48 - Found 3 sources in SourceList with SLID = 61804
[tinsley] 08:54:48 - Found 3 sources in SourceList with SLID = 155041
[tinsley] 08:54:48 - Looking for pairs
[tinsley] 08:54:48 - Found 5 pairs
[tinsley] 08:54:48 - Inserting first half of pairs
[tinsley] 08:54:48 - Inserting second half of pairs
[tinsley] 08:54:48 - Inserting null associations from last input list
[tinsley] 08:54:48 - Inserting null associations from first input list
[tinsley] 08:54:48 - Created Master AssociateList with ALID = 100651, name =  and 5 associates!
[tinsley] 08:54:49 - Preparing for the matching
[tinsley] 08:54:49 - Found 3 sources in SourceList with SLID = 61804
[tinsley] 08:54:49 - Found 3 sources in SourceList with SLID = 244531
[tinsley] 08:54:49 - Looking for pairs
[tinsley] 08:54:49 - Found 3 pairs
[tinsley] 08:54:49 - Inserting first half of pairs
[tinsley] 08:54:49 - Inserting second half of pairs
[tinsley] 08:54:49 - Inserting null associations from last input list
[tinsley] 08:54:49 - Inserting null associations from first input list
[tinsley] 08:54:49 - Created Master AssociateList with ALID = 100661, name =  and 6 associates!
"""