def __init__(self, coord, radius, **kwargs): dlsurvey.DL_Survey.__init__(self, coord, radius, **kwargs) self.survey = 'WISE' self.bands = ['W1', 'W2', 'W3', 'W4'] self.svc = sia.SIAService("https://datalab.noao.edu/sia/allwise") self.qc_profile = "default" self.database = "allwise.source"
def run_cutout_example(access_url, regrid=False, download_dir=None): """ PyVO examples are here """ if (download_dir and (not os.path.exists(download_dir))): print "Invalid download dir: {0}".format(download_dir) return from pyvo.dal import sia svc = sia.SIAService(access_url) #start Simple Image Access service ra = 22 #313.07 dec = -40 #-36.675 pos = (ra, dec) # position size = 1.0 # angular size if (regrid): # 'ZEA', 'ZEA_regrid', 'SIN' images = svc.search(pos, size, proj_opt="SIN") else: images = svc.search(pos, size) for img in images: # for each mached image, download or print its frequency and access url freq = img.get('freq') url = img.acref if (download_dir): download_file(url, ra, dec, freq, download_dir) else: print freq, url
def get_cutout(access_url, ra, dec, size=1.0, freqs=[], regrid=False, download_dir=None, listf=False): """ PyVO examples are here """ if (download_dir and (not os.path.exists(download_dir))): print "Invalid download dir: {0}".format(download_dir) return from pyvo.dal import sia svc = sia.SIAService(access_url) #start Simple Image Access service pos = (ra, dec) # position if (regrid): images = svc.search(pos, size, grid_opt="regrid") else: images = svc.search(pos, size) if listf: print "Available freq ranges are:" for img in images: print img.get('freq') return for img in images: # for each mached image, download or print its frequency and access url freq = img.get('freq') # only process the frequencies of interest if not freq in freqs: continue print 'dl' url = img.acref if (download_dir): download_file(url, ra, dec, freq, download_dir) else: print freq, url
def __init__(self, coord, radius, **kwargs): dlsurvey.DL_Survey.__init__(self, coord, radius, **kwargs) self.survey = 'DES' self.bands = ['g', 'r', 'i', 'z', 'y'] self.svc = sia.SIAService("https://datalab.noao.edu/sia/des_dr1") self.qc_profile = "default" self.database = "des_dr1.main"
def __init__(self, coord, radius, **kwargs): dlsurvey.DL_Survey.__init__(self, coord, radius, **kwargs) self.survey = 'NSC' self.bands = NSC_bands self.svc = sia.SIAService("https://datalab.noao.edu/sia/nsc_dr2") self.qc_profile = "default" self.database = "nsc_dr2.object"
def download_deepest_image(ra, dec, fov=1.0 / 60.0, band='g'): import pyvo.dal from pyvo.dal import sia from dl import authClient as ac pos = SkyCoord(ra=ra, dec=dec, unit=(u.deg, u.deg), frame='icrs') url = "https://datalab.noao.edu/sia/des_dr1" svc = sia.SIAService(url) token = ac.login('anonymous') #imgTable = svc.search(pos=pos, size=fov) #print(imgTable) #print(stop) imgTable = pyvo.dal.conesearch( url, pos=pos, radius=fov, maxrec=100000).votable.get_first_table().to_table() sel0 = imgTable['obs_bandpass'].astype(str) == band sel = sel0 & ( (imgTable['proctype'].astype(str) == 'Stack') & (imgTable['prodtype'].astype(str) == 'image')) # basic selection Table = imgTable[sel] # select if (len(Table) > 0): #row = Table[np.argmax(Table['exptime'].data.data.astype('float'))] # pick image with longest exposure time #url = row['access_url'].decode() # get the download URL dist = angular_distance(ra, dec, Table["s_ra"].data.data.astype('float'), Table["s_dec"].data.data.astype('float')) idx = np.argmin(dist) row = Table[idx] url = row['access_url'].decode().replace("&extn=1", "") else: print('No image available.') url = None return url
from astropy.table import Table from frb.surveys import surveycoord from frb.surveys import catalog_utils from frb.surveys import defs from IPython import embed try: from pyvo.dal import TAPService, sia except ImportError: print("Warning: You need to install pyvo to use the survey tools...") _svc = None else: _DEF_ACCESS_URL = "https://irsa.ipac.caltech.edu/ibe/data/wise/allwise/p3am_cdd" _svc = sia.SIAService(_DEF_ACCESS_URL) # Define the data model for WISE data photom = {} # Define the default set of query fields # See: https://wise2.ipac.caltech.edu/docs/release/allwise/expsup/sec2_1a.html # for additional Fields photom['WISE'] = {} WISE_bands = ['W1', 'W2', 'W3', 'W4'] _DEFAULT_query_fields = ['source_id', 'ra', 'dec', 'tmass_key'] for band in WISE_bands: magcol = '{:s}mag'.format( band.lower()) # The "standard" aperture measurement errcol = '{:s}sigm'.format(band.lower()) photom['WISE']['WISE_{:s}'.format(band)] = magcol
def testError(self): srv = sia.SIAService("http://localhost:{0}/err".format(self.srvr.port)) self.assertRaises(dalq.DALQueryError, srv.search, (0.0, 0.0), 1.0)
def testSearch(self): srv = sia.SIAService("http://localhost:{0}/sia".format(self.srvr.port)) results = srv.search(pos=(0, 0), size=(1.0, 1.0)) self.assert_(isinstance(results, sia.SIAResults)) self.assertEquals(results.nrecs, 2)
def testCtor(self): self.res = {"title": "Archive", "shortName": "arch"} self.srv = sia.SIAService(self.baseurl, resmeta=self.res)
from astropy import units, io, utils from frb.surveys import dlsurvey from frb.surveys import catalog_utils from frb.surveys import defs from IPython import embed # Dependencies try: from pyvo.dal import sia except ImportError: print("Warning: You need to install pyvo to retrieve DES images") _svc = None else: _svc = sia.SIAService(defs.NOIR_DEF_ACCESS_URL + 'des_dr2') # Define the data model for DES data photom = {} photom['DES'] = {} DES_bands = ['g', 'r', 'i', 'z', 'Y'] for band in DES_bands: photom['DES']['DES_{:s}'.format(band)] = 'mag_auto_{:s}'.format( band.lower()) photom['DES']['DES_{:s}_err'.format(band)] = 'magerr_auto_{:s}'.format( band.lower()) photom['DES']['DES_ID'] = 'coadd_object_id' photom['DES']['ra'] = 'ra' photom['DES']['dec'] = 'dec' photom['DES']['DES_tile'] = 'tilename' photom['DES']['star_flag_r'] = "class_star_r"
def testSearch(self): srv = sia.SIAService(neat) results = srv.search(pos=(0, 0), size=(1.0, 1.0)) self.assert_(isinstance(results, sia.SIAResults)) self.assertEquals(results.nrecs, 5)
import numpy as np from astropy import units, io, utils from astropy.table import Table from frb.surveys import dlsurvey from frb.surveys import catalog_utils from frb.surveys import defs # Dependencies try: from pyvo.dal import sia except ImportError: print("Warning: You need to install pyvo to retrieve DECaL images") _svc = None else: _svc = sia.SIAService(defs.NOIR_DEF_ACCESS_URL+'ls_dr8') # Define the Photometric data model for DECaL photom = {} photom['DECaL'] = {} DECaL_bands = ['g', 'r', 'z'] for band in DECaL_bands: if "W" not in band: bandstr = 'DECaL_'+band else: bandstr = 'WISE_'+band photom['DECaL'][bandstr] = 'mag_{:s}'.format(band.lower()) photom['DECaL'][bandstr+"_err"] = 'snr_{:s}'.format(band.lower()) photom['DECaL']['DECaL_ID'] = 'ls_id' photom['DECaL']['ra'] = 'ra' photom['DECaL']['dec'] = 'dec'
def __init__(self): self._svc = sia.SIAService(self.DEF_ACCESS_URL)