예제 #1
0
def generate_blobs(nside,
                   mixed_pairs=False,
                   nexp=1,
                   no_pairs=False,
                   m5w=6.,
                   footprintw=0.6,
                   sleww=3.,
                   fcw=3.):
    target_map = standard_goals(nside=nside)
    norm_factor = calc_norm_factor(target_map)

    # List to hold all the surveys (for easy plotting later)
    surveys = []

    # Set up observations to be taken in blocks
    filter1s = ['u', 'g', 'r', 'i', 'z', 'y']
    if mixed_pairs:
        filter2s = [None, 'r', 'i', 'z', None, None]
    else:
        filter2s = [None, 'g', 'r', 'i', None, None]

    if no_pairs:
        filter2s = [None, None, None, None, None, None]

    # Ideal time between taking pairs
    pair_time = 22.
    times_needed = [pair_time, pair_time * 2]
    for filtername, filtername2 in zip(filter1s, filter2s):
        bfs = []
        bfs.append(
            bf.M5_diff_basis_function(filtername=filtername, nside=nside))
        if filtername2 is not None:
            bfs.append(
                bf.M5_diff_basis_function(filtername=filtername2, nside=nside))
        bfs.append(
            bf.Target_map_basis_function(filtername=filtername,
                                         target_map=target_map[filtername],
                                         out_of_bounds_val=np.nan,
                                         nside=nside,
                                         norm_factor=norm_factor))
        if filtername2 is not None:
            bfs.append(
                bf.Target_map_basis_function(
                    filtername=filtername2,
                    target_map=target_map[filtername2],
                    out_of_bounds_val=np.nan,
                    nside=nside,
                    norm_factor=norm_factor))
        bfs.append(
            bf.Slewtime_basis_function(filtername=filtername, nside=nside))
        bfs.append(bf.Strict_filter_basis_function(filtername=filtername))
        # Masks, give these 0 weight
        bfs.append(
            bf.Zenith_shadow_mask_basis_function(nside=nside,
                                                 shadow_minutes=60.,
                                                 max_alt=76.))
        bfs.append(
            bf.Moon_avoidance_basis_function(nside=nside, moon_distance=30.))
        bfs.append(bf.Clouded_out_basis_function())
        filternames = [
            fn for fn in [filtername, filtername2] if fn is not None
        ]
        bfs.append(bf.Filter_loaded_basis_function(filternames=filternames))
        if filtername2 is None:
            time_needed = times_needed[0]
        else:
            time_needed = times_needed[1]
        bfs.append(bf.Time_to_twilight_basis_function(time_needed=time_needed))
        bfs.append(bf.Not_twilight_basis_function())
        weights = np.array([
            m5w / 2., m5w / 2., footprintw / 2., footprintw / 2., sleww, fcw,
            0., 0., 0., 0., 0., 0.
        ])
        if filtername2 is None:
            # Need to scale weights up so filter balancing still works properly.
            weights = np.array(
                [m5w, footprintw, sleww, fcw, 0., 0., 0., 0., 0., 0.])
        if filtername2 is None:
            survey_name = 'blob, %s' % filtername
        else:
            survey_name = 'blob, %s%s' % (filtername, filtername2)
        surveys.append(
            Blob_survey(bfs,
                        weights,
                        filtername1=filtername,
                        filtername2=filtername2,
                        ideal_pair_time=pair_time,
                        nside=nside,
                        survey_note=survey_name,
                        ignore_obs='DD',
                        dither=True,
                        nexp=nexp))

    return surveys
def generate_blobs(nside, mixed_pairs=False, nexp=1, no_pairs=False, offset=None, template_weight=6.):
    target_map = wfd_only_fp(nside=nside)
    norm_factor = calc_norm_factor(target_map)

    # List to hold all the surveys (for easy plotting later)
    surveys = []

    # Set up observations to be taken in blocks
    filter1s = ['u', 'g', 'r', 'i', 'z', 'y']
    if mixed_pairs:
        filter2s = [None, 'r', 'i', 'z', None, None]
    else:
        filter2s = [None, 'g', 'r', 'i', None, None]

    if no_pairs:
        filter2s = [None, None, None, None, None, None]

    # Ideal time between taking pairs
    pair_time = 22.
    times_needed = [pair_time, pair_time*2]
    for filtername, filtername2 in zip(filter1s, filter2s):
        detailer_list = []
        detailer_list.append(detailers.Camera_rot_detailer(min_rot=-87., max_rot=87.))
        detailer_list.append(detailers.Close_alt_detailer())
        bfs = []
        bfs.append(bf.M5_diff_basis_function(filtername=filtername, nside=nside))
        if filtername2 is not None:
            bfs.append(bf.M5_diff_basis_function(filtername=filtername2, nside=nside))
        bfs.append(bf.Target_map_basis_function(filtername=filtername,
                                                target_map=target_map[filtername],
                                                out_of_bounds_val=np.nan, nside=nside,
                                                norm_factor=norm_factor))

        if filtername2 is not None:
            bfs.append(bf.Target_map_basis_function(filtername=filtername2,
                                                    target_map=target_map[filtername2],
                                                    out_of_bounds_val=np.nan, nside=nside,
                                                    norm_factor=norm_factor))

        bfs.append(bf.Slewtime_basis_function(filtername=filtername, nside=nside))
        bfs.append(bf.Strict_filter_basis_function(filtername=filtername))
        bfs.append(bf.N_obs_per_year_basis_function(filtername=filtername, nside=nside,
                                                    footprint=target_map[filtername],
                                                    n_obs=3, season=300.))
        if filtername2 is not None:
            bfs.append(bf.N_obs_per_year_basis_function(filtername=filtername2, nside=nside,
                                                        footprint=target_map[filtername2],
                                                        n_obs=3, season=300.))
        # Masks, give these 0 weight
        bfs.append(bf.Zenith_shadow_mask_basis_function(nside=nside, shadow_minutes=60., max_alt=76.))
        bfs.append(bf.Moon_avoidance_basis_function(nside=nside, moon_distance=30.))
        filternames = [fn for fn in [filtername, filtername2] if fn is not None]
        bfs.append(bf.Filter_loaded_basis_function(filternames=filternames))
        if filtername2 is None:
            time_needed = times_needed[0]
        else:
            time_needed = times_needed[1]
        bfs.append(bf.Time_to_twilight_basis_function(time_needed=time_needed))
        bfs.append(bf.Not_twilight_basis_function())
        bfs.append(bf.Planet_mask_basis_function(nside=nside))
        weights = np.array([3.0, 3.0, .3, .3, 3., 3., template_weight, template_weight, 0., 0., 0., 0., 0., 0.])
        if filtername2 is None:
            # Need to scale weights up so filter balancing still works properly.
            weights = np.array([6.0, 0.6, 3., 3., template_weight*2, 0., 0., 0., 0., 0., 0.])
        if filtername2 is None:
            survey_name = 'blob, %s' % filtername
        else:
            survey_name = 'blob, %s%s' % (filtername, filtername2)
        if filtername2 is not None:
            detailer_list.append(detailers.Take_as_pairs_detailer(filtername=filtername2))
        surveys.append(Blob_survey(bfs, weights, filtername1=filtername, filtername2=filtername2,
                                   ideal_pair_time=pair_time, nside=nside,
                                   survey_note=survey_name, ignore_obs='DD', dither=True,
                                   nexp=nexp, detailers=detailer_list))

    return surveys
예제 #3
0
def gen_greedy_surveys(nside,
                       nexp=1,
                       target_maps=None,
                       mod_year=None,
                       day_offset=None,
                       norm_factor=None,
                       max_season=10):
    """
    Make a quick set of greedy surveys
    """
    target_map = standard_goals(nside=nside)
    norm_factor = calc_norm_factor(target_map)
    wfd_halves = wfd_half()
    # Let's remove the bluer filters since this should only be near twilight
    filters = ['r', 'i', 'z', 'y']
    surveys = []

    detailer = detailers.Camera_rot_detailer(min_rot=-87., max_rot=87.)

    for filtername in filters:
        bfs = []
        bfs.append(
            bf.M5_diff_basis_function(filtername=filtername, nside=nside))
        target_list = [tm[filtername] for tm in target_maps]
        bfs.append(
            bf.Target_map_modulo_basis_function(filtername=filtername,
                                                target_maps=target_list,
                                                season_modulo=mod_year,
                                                day_offset=day_offset,
                                                out_of_bounds_val=np.nan,
                                                nside=nside,
                                                norm_factor=norm_factor,
                                                max_season=max_season))
        bfs.append(
            bf.Slewtime_basis_function(filtername=filtername, nside=nside))
        bfs.append(bf.Strict_filter_basis_function(filtername=filtername))
        bfs.append(bf.Map_modulo_basis_function(wfd_halves))
        # Masks, give these 0 weight
        bfs.append(
            bf.Zenith_shadow_mask_basis_function(nside=nside,
                                                 shadow_minutes=60.,
                                                 max_alt=76.))
        bfs.append(
            bf.Moon_avoidance_basis_function(nside=nside, moon_distance=40.))

        bfs.append(bf.Filter_loaded_basis_function(filternames=filtername))
        bfs.append(bf.Planet_mask_basis_function(nside=nside))

        weights = np.array([3.0, 0.3, 3., 3., 3., 0., 0., 0., 0.])
        surveys.append(
            Greedy_survey(bfs,
                          weights,
                          block_size=1,
                          filtername=filtername,
                          dither=True,
                          nside=nside,
                          ignore_obs='DD',
                          nexp=nexp,
                          detailers=[detailer]))

    return surveys
예제 #4
0
    # Mark position of the sun at the start of the survey. Usefull for rolling cadence.
    sun_ra_0 = conditions.sunRA  # radians
    offset = create_season_offset(nside, sun_ra_0)
    max_season = 6
    # Set up the DDF surveys to dither
    dither_detailer = detailers.Dither_detailer(per_night=per_night,
                                                max_dither=max_dither)
    details = [
        detailers.Camera_rot_detailer(min_rot=-87., max_rot=87.),
        dither_detailer
    ]
    ddfs = generate_dd_surveys(nside=nside, nexp=nexp, detailers=details)

    sg = standard_goals()
    norm_factor = calc_norm_factor(sg)
    roll_maps = slice_wfd_area_quad(sg, scale_down_factor=scale_down_factor)
    target_maps = roll_maps + [sg]

    if Pairs:
        if mixedPairs:
            greedy = gen_greedy_surveys(nside,
                                        nexp=nexp,
                                        target_maps=target_maps,
                                        mod_year=mod_year,
                                        day_offset=offset,
                                        norm_factor=norm_factor,
                                        max_season=max_season)
            blobs = generate_blobs(nside,
                                   nexp=nexp,
                                   mixed_pairs=True,
예제 #5
0
import lsst.sims.featureScheduler.surveys as survey
import lsst.sims.featureScheduler.basis_functions as basis_functions
from lsst.sims.speedObservatory import Speed_observatory
import matplotlib.pylab as plt
import healpy as hp
import time

t0 = time.time()

survey_length = 365.25 * 1.05  #365.25*10  # days
nside = set_default_nside(nside=32)
# Define what we want the final visit ratio map to look like
years = np.round(survey_length / 365.25)
# get rid of silly northern strip.
target_map = standard_goals(nside=nside)
norm_factor = calc_norm_factor(target_map)

# set up a cloud map
cloud_map = target_map['r'] * 0 + 0.7

# List to hold all the surveys (for easy plotting later)
surveys = []

# Set up observations to be taken in blocks
filter1s = ['u', 'g', 'r', 'i', 'z', 'y']
filter2s = [None, 'g', 'r', 'i', None, None]

pair_surveys = []
times_needed = [22., 44.]
for filtername, filtername2 in zip(filter1s, filter2s):
    bfs = []
def generate_twilight_neo(nside, night_pattern=None):
    surveys = []
    nexp = 1
    filters = 'riz'
    survey_name = 'twilight_neo'
    target_map_one = ecliptic_target(nside=nside)
    target_map = {}
    for filtername in filters:
        target_map[filtername] = target_map_one

    norm_factor = calc_norm_factor(target_map)
    exptime = 1.

    for filtername in filters:
        detailer_list = []
        detailer_list.append(
            detailers.Camera_rot_detailer(min_rot=-87., max_rot=87.))
        detailer_list.append(detailers.Close_alt_detailer())
        detailer_list.append(
            detailers.Twilight_triple_detailer(slew_estimate=4.5, n_repeat=3))
        bfs = []

        bfs.append(
            bf.Target_map_basis_function(filtername=filtername,
                                         target_map=target_map[filtername],
                                         out_of_bounds_val=np.nan,
                                         nside=nside,
                                         norm_factor=norm_factor))

        bfs.append(
            bf.Slewtime_basis_function(filtername=filtername, nside=nside))
        bfs.append(bf.Strict_filter_basis_function(filtername=filtername))
        # XXX
        # Need a toward the sun, reward high airmass, with an airmass cutoff basis function.
        bfs.append(
            bf.Near_sun_twilight_basis_function(nside=nside, max_airmass=2.))
        bfs.append(
            bf.Zenith_shadow_mask_basis_function(nside=nside,
                                                 shadow_minutes=60.,
                                                 max_alt=76.))
        bfs.append(
            bf.Moon_avoidance_basis_function(nside=nside, moon_distance=30.))
        bfs.append(bf.Filter_loaded_basis_function(filternames=filtername))
        bfs.append(bf.Planet_mask_basis_function(nside=nside))
        bfs.append(bf.Sun_alt_limit_basis_function())
        bfs.append(bf.Time_in_twilight_basis_function(time_needed=5.))
        bfs.append(bf.Night_modulo_basis_function(pattern=night_pattern))
        weights = [0.1, 3., 3., 3., 0., 0., 0., 0., 0., 0., 0.]
        # Set huge ideal pair time and use the detailer to cut down the list of observations to fit twilight?
        surveys.append(
            Blob_survey(bfs,
                        weights,
                        filtername1=filtername,
                        filtername2=None,
                        ideal_pair_time=3.,
                        nside=nside,
                        exptime=exptime,
                        survey_note=survey_name,
                        ignore_obs=['DD', 'greedy', 'blob'],
                        dither=True,
                        nexp=nexp,
                        detailers=detailer_list,
                        az_range=180.,
                        twilight_scale=False))

    return surveys
예제 #7
0
def gen_blob_surveys(nside):
    """
    make a quick set of blob surveys
    """
    target_map = standard_goals(nside=nside)
    norm_factor = calc_norm_factor(target_map)

    filter1s = ['u', 'g']  # , 'r', 'i', 'z', 'y']
    filter2s = [None, 'g']  # , 'r', 'i', None, None]
    filter1s = ['g']  # , 'r', 'i', 'z', 'y']
    filter2s = ['g']  # , 'r', 'i', None, None]

    pair_surveys = []
    for filtername, filtername2 in zip(filter1s, filter2s):
        detailer_list = []
        bfs = []
        bfs.append(
            bf.M5_diff_basis_function(filtername=filtername, nside=nside))
        if filtername2 is not None:
            bfs.append(
                bf.M5_diff_basis_function(filtername=filtername2, nside=nside))
        bfs.append(
            bf.Target_map_basis_function(filtername=filtername,
                                         target_map=target_map[filtername],
                                         out_of_bounds_val=np.nan,
                                         nside=nside,
                                         norm_factor=norm_factor))
        if filtername2 is not None:
            bfs.append(
                bf.Target_map_basis_function(
                    filtername=filtername2,
                    target_map=target_map[filtername2],
                    out_of_bounds_val=np.nan,
                    nside=nside,
                    norm_factor=norm_factor))
        bfs.append(
            bf.Slewtime_basis_function(filtername=filtername, nside=nside))
        bfs.append(bf.Strict_filter_basis_function(filtername=filtername))
        # Masks, give these 0 weight
        bfs.append(
            bf.Zenith_shadow_mask_basis_function(nside=nside,
                                                 shadow_minutes=60.,
                                                 max_alt=76.))
        bfs.append(
            bf.Moon_avoidance_basis_function(nside=nside, moon_distance=30.))
        bfs.append(bf.Clouded_out_basis_function())
        # feasibility basis fucntions. Also give zero weight.
        filternames = [
            fn for fn in [filtername, filtername2] if fn is not None
        ]
        bfs.append(bf.Filter_loaded_basis_function(filternames=filternames))
        bfs.append(bf.Time_to_twilight_basis_function(time_needed=22.))
        bfs.append(bf.Not_twilight_basis_function())
        bfs.append(bf.Planet_mask_basis_function(nside=nside))

        weights = np.array(
            [3.0, 3.0, .3, .3, 3., 3., 0., 0., 0., 0., 0., 0., 0.])
        if filtername2 is None:
            # Need to scale weights up so filter balancing still works properly.
            weights = np.array([6.0, 0.6, 3., 3., 0., 0., 0., 0., 0., 0., 0.])
        if filtername2 is None:
            survey_name = 'blob, %s' % filtername
        else:
            survey_name = 'blob, %s%s' % (filtername, filtername2)
        if filtername2 is not None:
            detailer_list.append(
                detailers.Take_as_pairs_detailer(filtername=filtername2))
        pair_surveys.append(
            Blob_survey(bfs,
                        weights,
                        filtername1=filtername,
                        filtername2=filtername2,
                        survey_note=survey_name,
                        ignore_obs='DD',
                        detailers=detailer_list))
    return pair_surveys