@@ -123,18 +123,18 @@ def test_gen_pos_sql():
123123 assert _gen_sql ({'galactic' : '1 2, 3' }) == common_select + "(INTERSECTS(" \
124124 "CIRCLE('ICRS',{},{},3.0), s_region) = 1)" .format (
125125 center .icrs .ra .to (u .deg ).value , center .icrs .dec .to (u .deg ).value )
126- min_point = coord .SkyCoord ('12:13:14.0' , '-00:01:02.1' , unit = u .deg ,
127- frame = 'galactic' )
128- max_point = coord .SkyCoord ('12:14:14.0' , '-00:00:02.1' , unit = (u .deg , u .deg ),
129- frame = 'galactic' )
126+ gal_longitude = ('12:13:14.0' , '12:14:14.0' )
127+ gal_latitude = ('-00:01:02.1' , '-00:00:02.1' )
128+ min_pt = coord .SkyCoord (gal_longitude [0 ], gal_latitude [0 ], unit = u .deg )
129+ long_min , lat_min = min_pt .ra .value , min_pt .dec .value
130+ max_pt = coord .SkyCoord (gal_longitude [1 ], gal_latitude [1 ], unit = u .deg )
131+ long_max , lat_max = max_pt .ra .value , max_pt .dec .value
130132 assert _gen_sql (
131- {'galactic' : '12:13:14.0..12:14:14.0 -00:01:02.1..-00:00:02.1' }) == \
133+ {'galactic' : '{}..{} {}..{}' .format (
134+ gal_longitude [0 ], gal_longitude [1 ], gal_latitude [0 ], gal_latitude [1 ])}) == \
132135 common_select + \
133- "(INTERSECTS(RANGE_S2D({},{},{},{}), s_region) = 1)" .format (
134- min_point .icrs .ra .to (u .deg ).value ,
135- max_point .icrs .ra .to (u .deg ).value ,
136- min_point .icrs .dec .to (u .deg ).value ,
137- max_point .icrs .dec .to (u .deg ).value )
136+ 'gal_longitude>={} AND gal_longitude<={} AND gal_latitude>={} and gal_latitude<={}' .format (
137+ long_min , long_max , lat_min , lat_max )
138138
139139 # combination of frames
140140 center = coord .SkyCoord (1 , 2 , unit = u .deg , frame = 'galactic' )
0 commit comments