@@ -610,7 +610,6 @@ class = 'galaxy' \
610
610
0.3000027 256.99461 25.566255 1237661387086693265
611
611
0.300003 175.65125 34.37548 1237665128003731630
612
612
613
-
614
613
Returns
615
614
-------
616
615
result : `~astropy.table.Table`
@@ -683,6 +682,14 @@ def get_spectra_async(self, *, coordinates=None, radius=2. * u.arcsec,
683
682
show_progress : bool, optional
684
683
If False, do not display download progress.
685
684
685
+ Returns
686
+ -------
687
+ list : list
688
+ A list of context-managers that yield readable file-like objects.
689
+ The function returns the spectra for only one of ``matches``, or
690
+ ``coordinates`` and ``radius``, or ``plate``, ``mjd`` and
691
+ ``fiberID``.
692
+
686
693
Examples
687
694
--------
688
695
Using results from a call to `query_region`:
@@ -701,14 +708,6 @@ def get_spectra_async(self, *, coordinates=None, radius=2. * u.arcsec,
701
708
702
709
>>> specs = SDSS.get_spectra(plate=751, mjd=52251)
703
710
704
- Returns
705
- -------
706
- list : list
707
- A list of context-managers that yield readable file-like objects.
708
- The function returns the spectra for only one of ``matches``, or
709
- ``coordinates`` and ``radius``, or ``plate``, ``mjd`` and
710
- ``fiberID``.
711
-
712
711
"""
713
712
714
713
if not matches :
@@ -852,6 +851,10 @@ def get_images_async(self, coordinates=None, radius=2. * u.arcsec,
852
851
show_progress : bool, optional
853
852
If False, do not display download progress.
854
853
854
+ Returns
855
+ -------
856
+ list : List of `~astropy.io.fits.HDUList` objects.
857
+
855
858
Examples
856
859
--------
857
860
Using results from a call to `query_region`:
@@ -874,10 +877,6 @@ def get_images_async(self, coordinates=None, radius=2. * u.arcsec,
874
877
875
878
>>> imgs = SDSS.get_images(run=1904, camcol=3, field=164)
876
879
877
- Returns
878
- -------
879
- list : List of `~astropy.io.fits.HDUList` objects.
880
-
881
880
"""
882
881
if not matches :
883
882
if coordinates is None :
@@ -1276,5 +1275,55 @@ def _get_crossid_url(self, data_release):
1276
1275
self ._last_url = url
1277
1276
return url
1278
1277
1278
+ def _rectangle_sql (self , ra , dec , width , height = None , cosdec = False ):
1279
+ """Generate SQL for a rectangular query centered on `ra`, `dec`.
1280
+
1281
+ This assumes that RA is defined on the range ``[0, 360)``, and Dec on
1282
+ ``[-90, 90]``.
1283
+
1284
+ Parameters
1285
+ ----------
1286
+ ra : float
1287
+ Right Ascension in degrees.
1288
+ dec : float
1289
+ Declination in degrees.
1290
+ width : float
1291
+ Width of rectangle in degrees.
1292
+ height : float, optional
1293
+ Height of rectangle in degrees. If not specified, `width` is used.
1294
+ cosdec : bool, optional
1295
+ If ``True`` apply ``cos(dec)`` correction to the rectangle.
1296
+
1297
+ Returns
1298
+ -------
1299
+ :class:`str`
1300
+ A string defining the rectangle in SQL notation.
1301
+ """
1302
+ if height is None :
1303
+ height = width
1304
+ dr = width / 2.0
1305
+ dd = height / 2.0
1306
+ d0 = dec - dd
1307
+ if d0 < - 90 :
1308
+ d0 = - 90.0
1309
+ d1 = dec + dd
1310
+ if d1 > 90.0 :
1311
+ d1 = 90.0
1312
+ ra_wrap = False
1313
+ r0 = ra - dr
1314
+ if r0 < 0 :
1315
+ ra_wrap = True
1316
+ r0 += 360.0
1317
+ r1 = ra + dr
1318
+ if r1 > 360.0 :
1319
+ ra_wrap = True
1320
+ r1 -= 360.0
1321
+ # BETWEEN is inclusive, so it is equivalent to the <=, >= operators.
1322
+ if ra_wrap :
1323
+ sql = f"(((p.ra >= { r0 :g} ) OR (p.ra <= { r1 :g} ))"
1324
+ else :
1325
+ sql = f"((p.ra BETWEEN { r0 :g} AND { r1 :g} )"
1326
+ return sql + f" AND (p.dec BETWEEN { d0 :g} AND { d1 :g} ))"
1327
+
1279
1328
1280
1329
SDSS = SDSSClass ()
0 commit comments