def query_region(self, ra_hours: float, dec_degs: float, constraints: Optional[TDict[str, str]] = None, limit: Optional[int] = None, **region) -> TList[CatalogSource]: """ Return SDSS catalog objects within the specified rectangular region :param ra_hours: right ascension of region center in hours :param dec_degs: declination of region center in degrees :param constraints: optional constraints on the column values :param limit: maximum number of rows to return :param region: keywords defining the query region :return: list of catalog objects within the specified rectangular region """ sdss = SDSS() return self.table_to_sources( sdss.query_region(SkyCoord(ra=ra_hours, dec=dec_degs, unit=(hour, deg), frame='icrs'), data_release=15, photoobj_fields=self._columns, cache=False, **region))
def download_sdss_spec(self, add_r=0): sdss = SDSS() self.spec_data_table = sdss.query_region(self.loc, radius=(self.r + add_r) * u.arcsec, spectro=True) if self.has_spec() == True: print("在r=%f角秒内找到了%d个光谱" % (self.r + add_r, len(self.spec_data_table))) self.spec = SDSS.get_spectra(matches=self.spec_data_table) i = 0 for match in self.spec_data_table: self.spec[i] = Spectra(match['objid'], self.spec[i]) i = i + 1 else: print("在r=%f角秒内没有找到光谱" % (self.r + add_r))
def download_sdss_data(self): sdss = SDSS() self.info_table = sdss.query_region(self.loc, radius=self.r * u.arcsec) self.photo_data_table = sdss.query_region( self.loc, radius=self.r * u.arcsec, photoobj_fields=['u', 'g', 'r', 'i', 'z']) while self.info_table is None and self.r <= 10: self.r = self.r + 0.4 self.info_table = sdss.query_region(self.loc, radius=self.r * u.arcsec) self.photo_data_table = sdss.query_region( self.loc, radius=self.r * u.arcsec, photoobj_fields=['u', 'g', 'r', 'i', 'z']) self.objid = self.info_table['objid'][0]
def query_objects(self, names: TList[str]) -> TList[CatalogSource]: """ Return a list of SDSS catalog objects with the specified names :param names: object names :return: list of catalog objects with the specified names """ sdss = SDSS() rows = [] for name in names: rows.append( sdss.query_object(name, data_release=15, photoobj_fields=self._columns, cache=False)[0]) return self.table_to_sources(rows)