@@ -520,7 +520,7 @@ class = 'galaxy' \
520
520
521
521
def get_spectra_async (self , coordinates = None , radius = 2. * u .arcsec ,
522
522
matches = None , plate = None , fiberID = None , mjd = None ,
523
- timeout = TIMEOUT ,
523
+ timeout = TIMEOUT , get_query_payload = False ,
524
524
data_release = conf .default_release , cache = True ,
525
525
show_progress = True ):
526
526
"""
@@ -559,6 +559,9 @@ def get_spectra_async(self, coordinates=None, radius=2. * u.arcsec,
559
559
timeout : float, optional
560
560
Time limit (in seconds) for establishing successful connection with
561
561
remote server. Defaults to `SDSSClass.TIMEOUT`.
562
+ get_query_payload : bool, optional
563
+ If True, this will return the data the query would have sent out,
564
+ but does not actually do the query.
562
565
data_release : int, optional
563
566
The data release of the SDSS to use. With the default server, this
564
567
only supports DR8 or later.
@@ -599,12 +602,19 @@ def get_spectra_async(self, coordinates=None, radius=2. * u.arcsec,
599
602
if coordinates is None :
600
603
matches = self .query_specobj (plate = plate , mjd = mjd , fiberID = fiberID ,
601
604
fields = ['run2d' , 'plate' , 'mjd' , 'fiberID' ],
602
- timeout = timeout , data_release = data_release , cache = cache )
605
+ timeout = timeout , get_query_payload = get_query_payload ,
606
+ data_release = data_release , cache = cache )
603
607
else :
604
- matches = self .query_crossid (coordinates , radius = radius ,
608
+ matches = self .query_crossid (coordinates , radius = radius , timeout = timeout ,
605
609
specobj_fields = ['run2d' , 'plate' , 'mjd' , 'fiberID' ],
606
- spectro = True ,
607
- timeout = timeout , data_release = data_release , cache = cache )
610
+ spectro = True , get_query_payload = get_query_payload ,
611
+ data_release = data_release , cache = cache )
612
+ if get_query_payload :
613
+ if coordinates is None :
614
+ return matches
615
+ else :
616
+ return matches [0 ]
617
+
608
618
if matches is None :
609
619
warnings .warn ("Query returned no results." , NoResultsWarning )
610
620
return
@@ -640,8 +650,8 @@ def get_spectra_async(self, coordinates=None, radius=2. * u.arcsec,
640
650
@prepend_docstr_nosections (get_spectra_async .__doc__ )
641
651
def get_spectra (self , coordinates = None , radius = 2. * u .arcsec ,
642
652
matches = None , plate = None , fiberID = None , mjd = None ,
643
- timeout = TIMEOUT , cache = True ,
644
- data_release = conf .default_release ,
653
+ timeout = TIMEOUT , get_query_payload = False ,
654
+ data_release = conf .default_release , cache = True ,
645
655
show_progress = True ):
646
656
"""
647
657
Returns
@@ -654,9 +664,14 @@ def get_spectra(self, coordinates=None, radius=2. * u.arcsec,
654
664
radius = radius , matches = matches ,
655
665
plate = plate , fiberID = fiberID ,
656
666
mjd = mjd , timeout = timeout ,
667
+ get_query_payload = get_query_payload ,
657
668
data_release = data_release ,
669
+ cache = cache ,
658
670
show_progress = show_progress )
659
671
672
+ if get_query_payload :
673
+ return readable_objs
674
+
660
675
if readable_objs is not None :
661
676
if isinstance (readable_objs , dict ):
662
677
return readable_objs
@@ -666,7 +681,7 @@ def get_spectra(self, coordinates=None, radius=2. * u.arcsec,
666
681
def get_images_async (self , coordinates = None , radius = 2. * u .arcsec ,
667
682
matches = None , run = None , rerun = 301 , camcol = None ,
668
683
field = None , band = 'g' , timeout = TIMEOUT ,
669
- cache = True ,
684
+ cache = True , get_query_payload = False ,
670
685
data_release = conf .default_release ,
671
686
show_progress = True ):
672
687
"""
@@ -714,6 +729,9 @@ def get_images_async(self, coordinates=None, radius=2. * u.arcsec,
714
729
timeout : float, optional
715
730
Time limit (in seconds) for establishing successful connection with
716
731
remote server. Defaults to `SDSSClass.TIMEOUT`.
732
+ get_query_payload : bool, optional
733
+ If True, this will return the data the query would have sent out,
734
+ but does not actually do the query.
717
735
cache : bool, optional
718
736
Cache the images using astropy's caching system
719
737
data_release : int, optional
@@ -753,12 +771,19 @@ def get_images_async(self, coordinates=None, radius=2. * u.arcsec,
753
771
matches = self .query_photoobj (run = run , rerun = rerun ,
754
772
camcol = camcol , field = field ,
755
773
fields = ['run' , 'rerun' , 'camcol' , 'field' ],
756
- timeout = timeout ,
774
+ timeout = timeout , get_query_payload = get_query_payload ,
757
775
data_release = data_release , cache = cache )
758
776
else :
759
- matches = self .query_crossid (coordinates , radius = radius ,
777
+ matches = self .query_crossid (coordinates , radius = radius , timeout = timeout ,
760
778
fields = ['run' , 'rerun' , 'camcol' , 'field' ],
761
- timeout = timeout , data_release = data_release , cache = cache )
779
+ get_query_payload = get_query_payload ,
780
+ data_release = data_release , cache = cache )
781
+ if get_query_payload :
782
+ if coordinates is None :
783
+ return matches
784
+ else :
785
+ return matches [0 ]
786
+
762
787
if matches is None :
763
788
warnings .warn ("Query returned no results." , NoResultsWarning )
764
789
return
@@ -798,10 +823,22 @@ def get_images(self, coordinates=None, radius=2. * u.arcsec,
798
823
799
824
"""
800
825
801
- readable_objs = self .get_images_async (
802
- coordinates = coordinates , radius = radius , matches = matches , run = run ,
803
- rerun = rerun , data_release = data_release , camcol = camcol , field = field ,
804
- band = band , timeout = timeout , show_progress = show_progress )
826
+ readable_objs = self .get_images_async (coordinates = coordinates ,
827
+ radius = radius ,
828
+ matches = matches ,
829
+ run = run ,
830
+ rerun = rerun ,
831
+ camcol = camcol ,
832
+ field = field ,
833
+ band = band ,
834
+ timeout = timeout ,
835
+ cache = cache ,
836
+ get_query_payload = get_query_payload ,
837
+ data_release = data_release ,
838
+ show_progress = show_progress )
839
+
840
+ if get_query_payload :
841
+ return readable_objs
805
842
806
843
if readable_objs is not None :
807
844
if isinstance (readable_objs , dict ):
0 commit comments