Coverage for python/lsst/sims/featureScheduler/basis_functions/mask_basis_funcs.py : 23%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
'Moon_avoidance_basis_function', 'Map_cloud_basis_function', 'Planet_mask_basis_function']
"""Just remove the area near zenith.
Parameters ---------- min_alt : float (20.) The minimum possible altitude (degrees) max_alt : float (82.) The maximum allowed altitude (degrees) """ super(Zenith_mask_basis_function, self).__init__() self.update_on_newobs = False self.min_alt = np.radians(min_alt) self.max_alt = np.radians(max_alt) self.result = np.empty(hp.nside2npix(self.nside), dtype=float).fill(self.penalty)
result = self.result.copy() alt_limit = np.where((conditions.alt > self.min_alt) & (conditions.alt < self.max_alt))[0] result[alt_limit] = 1 return result
"""Mask the bright planets
Parameters ---------- mask_radius : float (3.5) The radius to mask around a planet (degrees). planets : list of str (None) A list of planet names to mask. Defaults to ['venus', 'mars', 'jupiter']. Not including Saturn because it moves really slow and has average apparent mag of ~0.4, so fainter than Vega.
""" 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)
result = self.result.copy() for pn in self.planets: indices = self.in_fov(conditions.planet_positions[pn+'_RA'], conditions.planet_positions[pn+'_dec']) result[indices] = np.nan
return result
"""Mask the zenith, and things that will soon pass near zenith. Useful for making sure observations will not be too close to zenith when they need to be observed again (e.g. for a pair).
Parameters ---------- min_alt : float (20.) The minimum alititude to alow. Everything lower is masked. (degrees) max_alt : float (82.) The maximum altitude to alow. Everything higher is masked. (degrees) shadow_minutes : float (40.) Mask anything that will pass through the max alt in the next shadow_minutes time. (minutes) """ shadow_minutes=40., penalty=np.nan, site='LSST'): super(Zenith_shadow_mask_basis_function, self).__init__(nside=nside) self.update_on_newobs = False
self.penalty = penalty
self.min_alt = np.radians(min_alt) self.max_alt = np.radians(max_alt) self.ra, self.dec = _hpid2RaDec(nside, np.arange(hp.nside2npix(nside))) self.shadow_minutes = np.radians(shadow_minutes/60. * 360./24.) # Compute the declination band where things could drift into zenith self.decband = np.zeros(self.dec.size, dtype=float) self.zenith_radius = np.radians(90.-max_alt)/2. site = Site(name=site) self.lat_rad = site.latitude_rad self.lon_rad = site.longitude_rad self.decband[np.where((self.dec < (self.lat_rad+self.zenith_radius)) & (self.dec > (self.lat_rad-self.zenith_radius)))] = 1
self.result = np.empty(hp.nside2npix(self.nside), dtype=float) self.result.fill(self.penalty)
result = self.result.copy() alt_limit = np.where((conditions.alt > self.min_alt) & (conditions.alt < self.max_alt))[0] result[alt_limit] = 1 to_mask = np.where((conditions.HA > (2.*np.pi-self.shadow_minutes-self.zenith_radius)) & (self.decband == 1)) result[to_mask] = np.nan return result
"""Avoid looking too close to the moon.
Parameters ---------- moon_distance: float (30.) Minimum allowed moon distance. (degrees)
XXX--TODO: This could be a more complicated function of filter and moon phase. """ super(Moon_avoidance_basis_function, self).__init__(nside=nside) self.update_on_newobs = False
self.moon_distance = np.radians(moon_distance) self.result = np.ones(hp.nside2npix(self.nside), dtype=float)
result = self.result.copy()
angular_distance = _angularSeparation(conditions.az, conditions.alt, conditions.moonAz, conditions.moonAlt)
result[angular_distance < self.moon_distance] = np.nan
return result
"""Mark healpixels on a map if their cloud values are greater than the same healpixels on a maximum cloud map.
Parameters ---------- nside: int (default_nside) The healpix resolution. max_cloud_map : numpy array (None) A healpix map showing the maximum allowed cloud values for all points on the sky out_of_bounds_val : float (10.) Point value to give regions where there are no observations requested """
out_of_bounds_val=np.nan): super(Bulk_cloud_basis_function, self).__init__(nside=nside) self.update_on_newobs = False
if max_cloud_map is None: self.max_cloud_map = np.zeros(hp.nside2npix(nside), dtype=float) + max_val else: self.max_cloud_map = max_cloud_map self.out_of_bounds_area = np.where(self.max_cloud_map > 1.)[0] self.out_of_bounds_val = out_of_bounds_val self.result = np.ones(hp.nside2npix(self.nside))
""" Parameters ---------- indx : list (None) Index values to compute, if None, full map is computed Returns ------- Healpix map where pixels with a cloud value greater than the max_cloud_map value are marked as unseen. """
result = self.result.copy()
clouded = np.where(self.max_cloud_map <= conditions.bulk_cloud) result[clouded] = self.out_of_bounds_val
return result
"""Mark healpixels on a map if their cloud values are greater than the same healpixels on a maximum cloud map. Currently a placeholder for when the telemetry stream can include a full sky cloud map.
Parameters ---------- nside: int (default_nside) The healpix resolution. max_cloud_map : numpy array (None) A healpix map showing the maximum allowed cloud values for all points on the sky out_of_bounds_val : float (10.) Point value to give regions where there are no observations requested """
out_of_bounds_val=np.nan): super(Bulk_cloud_basis_function, self).__init__(nside=nside) self.update_on_newobs = False
if max_cloud_map is None: self.max_cloud_map = np.zeros(hp.nside2npix(nside), dtype=float) + max_val else: self.max_cloud_map = max_cloud_map self.out_of_bounds_area = np.where(self.max_cloud_map > 1.)[0] self.out_of_bounds_val = out_of_bounds_val self.result = np.ones(hp.nside2npix(self.nside))
""" Parameters ---------- indx : list (None) Index values to compute, if None, full map is computed Returns ------- Healpix map where pixels with a cloud value greater than the max_cloud_map value are marked as unseen. """
result = self.result.copy()
clouded = np.where(self.max_cloud_map <= conditions.bulk_cloud) result[clouded] = self.out_of_bounds_val
return result |