def __init__(self, mask_radius=3.5, planets=None, nside=None, scale=1e5):
     super(Planet_mask_basis_function, self).__init__(nside=nside)
     if planets is None:
         planets = ['venus', 'mars', 'jupiter']
     self.planets = planets
     self.mask_radius = np.radians(mask_radius)
     self.result = np.zeros(hp.nside2npix(nside))
     # set up a kdtree. Could maybe use healpy.query_disc instead.
     self.in_fov = hp_in_lsst_fov(nside=nside,
                                  fov_radius=mask_radius,
                                  scale=scale)
Пример #2
0
    def __init__(self,
                 surveys,
                 nside=None,
                 camera='LSST',
                 rotator_limits=[85., 275.],
                 log=None):
        """
        Parameters
        ----------
        surveys : list (or list of lists) of lsst.sims.featureScheduler.survey objects
            A list of surveys to consider. If multiple surveys return the same highest
            reward value, the survey at the earliest position in the list will be selected.
            Can also be a list of lists to make heirarchical priorities.
        nside : int
            A HEALpix nside value.
        camera : str ('LSST')
            Which camera to use for computing overlapping HEALpixels for an observation.
            Can be 'LSST' or 'comcam'
        rotator_limits : sequence of floats
        """
        if nside is None:
            nside = set_default_nside()

        if log is None:
            self.log = logging.getLogger(type(self).__name__)
        else:
            self.log = log.getChild(type(self).__name__)

        # initialize a queue of observations to request
        self.queue = []
        # The indices of self.survey_lists that provided the last addition(s) to the queue
        self.survey_index = [None, None]

        # If we have a list of survey objects, convert to list-of-lists
        if isinstance(surveys[0], list):
            self.survey_lists = surveys
        else:
            self.survey_lists = [surveys]
        self.nside = nside
        hpid = np.arange(hp.nside2npix(nside))
        self.ra_grid_rad, self.dec_grid_rad = _hpid2RaDec(nside, hpid)
        # Should just make camera a class that takes a pointing and returns healpix indices
        if camera == 'LSST':
            self.pointing2hpindx = hp_in_lsst_fov(nside=nside)
        elif camera == 'comcam':
            self.pointing2hpindx = hp_in_comcam_fov(nside=nside)
        else:
            raise ValueError('camera %s not implamented' % camera)

        # keep track of how many observations get flushed from the queue
        self.flushed = 0
        self.rotator_limits = np.sort(np.radians(rotator_limits))
Пример #3
0
    def _hp2fieldsetup(self, ra, dec, leafsize=100):
        """Map each healpixel to nearest field. This will only work if healpix
        resolution is higher than field resolution.
        """
        if self.camera == 'LSST':
            pointing2hpindx = hp_in_lsst_fov(nside=self.nside)
        elif self.camera == 'comcam':
            pointing2hpindx = hp_in_comcam_fov(nside=self.nside)

        self.hp2fields = np.zeros(hp.nside2npix(self.nside), dtype=np.int)
        for i in range(len(ra)):
            hpindx = pointing2hpindx(ra[i], dec[i], rotSkyPos=0.)
            self.hp2fields[hpindx] = i
Пример #4
0
    def __init__(self,
                 exp_time=1.,
                 filtername='r',
                 nside=32,
                 footprint=None,
                 nobs=2,
                 mjd0=59853.5,
                 survey_name='short',
                 read_approx=2.):
        self.read_approx = read_approx
        self.exp_time = exp_time
        self.filtername = filtername
        self.nside = nside
        self.footprint = footprint
        self.nobs = nobs
        self.survey_name = survey_name
        self.mjd0 = mjd0

        self.survey_features = {}
        # XXX--need a feature that tracks short exposures in the filter
        self.survey_features['nobs'] = features.N_observations(
            filtername=filtername, nside=nside, survey_name=self.survey_name)
        # Need to be able to look up hpids for each observation
        self.obs2hpid = hp_in_lsst_fov(nside=nside)