Esempio n. 1
0
 def test_sky(self):
     nside = 256
     ra, dec, pix = random_sky(nside, allsky=False)
     self.assertEqual(len(ra), len(dec))
     surveypix = desimodel.footprint.tiles2pix(nside)
     theta = np.radians(90 - dec)
     phi = np.radians(ra)
     skypix = hp.ang2pix(nside, theta, phi, nest=True)
     self.assertEqual(set(surveypix), set(skypix))
Esempio n. 2
0
        truth['MOCKID'][istype] = targets['TARGETID'][istype]

    del targets
    print('writing truth')
    truth.write(truthfile, overwrite=True)
    print('done truth')

#generate sky data
from desitarget.mock.sky import random_sky
from desitarget.targetmask import desi_mask, bgs_mask, mws_mask, obsmask, obsconditions
import desimodel.footprint

skyfile = 'data/dense_sky.fits'
if not os.path.exists(skyfile):

    skyra, skydec = random_sky(nside=4096)
    n_p = len(skyra)

    data = Table()
    data['RA'] = skyra
    data['DEC'] = skydec
    data['TARGETID'] = np.int_(1E10 + np.arange(n_p))
    data['DESI_TARGET'] = np.int_(np.ones(n_p) * desi_mask['SKY'])
    data['MWS_TARGET'] = np.int_(np.zeros(n_p))
    data['BGS_TARGET'] = np.int_(np.zeros(n_p))
    data['OBSCONDITIONS'] = np.int_(
        np.ones(n_p) * (obsconditions['DARK'] | obsconditions['BRIGHT']
                        | obsconditions['GRAY']))
    data['BRICKNAME'] = np.chararray(n_p, itemsize=8)
    data['BRICKNAME'][:] = "b0000000"
    data['SUBPRIORITY'] = np.random.random(n_p)
Esempio n. 3
0
from desitarget.mock.sky import random_sky
from desitarget import desi_mask, bgs_mask, mws_mask, obsmask, obsconditions
import numpy as np
import desimodel.footprint
from astropy.table import Table

skyra, skydec = random_sky(nside=4096)
n_p = len(skyra)

data = Table()
data['RA'] = skyra
data['DEC'] = skydec
data['TARGETID'] = np.int_(1E10+ np.arange(n_p))
data['DESI_TARGET'] = np.int_(np.ones(n_p) * desi_mask['SKY'])
data['MWS_TARGET'] = np.int_(np.zeros(n_p))
data['BGS_TARGET'] = np.int_(np.zeros(n_p))
data['OBSCONDITIONS'] = np.int_(np.ones(n_p)*(obsconditions['DARK']|obsconditions['BRIGHT']|obsconditions['GRAY']))
data['BRICKNAME'] = np.chararray(n_p, itemsize=8)
data['BRICKNAME'][:] = "b0000000"
data['SUBPRIORITY'] = np.random.random(n_p)
data.write('dense_sky.fits', overwrite=True)