def make_rolling_footprints(mjd_start=59853.5,
                            sun_RA_start=3.27717639,
                            nslice=2,
                            scale=0.8):
    hp_footprints = standard_goals()

    down = 1. - scale
    up = nslice - down * (nslice - 1)
    start = [1., 1., 1.]
    end = [1., 1., 1., 1., 1., 1.]
    if nslice == 2:
        rolling = [up, down, up, down, up, down]
    elif nslice == 3:
        rolling = [up, down, down, up, down, down]
    elif nslice == 6:
        rolling = [up, down, down, down, down, down]
    all_slopes = [
        start + np.roll(rolling, i).tolist() + end for i in range(nslice)
    ]

    fp_non_wfd = Footprint(mjd_start, sun_RA_start=sun_RA_start)
    rolling_footprints = []
    for i in range(nslice):
        step_func = Step_slopes(rise=all_slopes[i])
        rolling_footprints.append(
            Footprint(mjd_start,
                      sun_RA_start=sun_RA_start,
                      step_func=step_func))

    wfd_indx = np.where(hp_footprints['r'] == 1)[0]
    non_wfd_indx = np.where(hp_footprints['r'] != 1)[0]

    wfd = hp_footprints['r'] * 0
    wfd[wfd_indx] = 1
    wfd_accum = np.cumsum(wfd)
    split_wfd_indices = np.floor(
        np.max(wfd_accum) / nslice * (np.arange(nslice) + 1)).astype(int)
    split_wfd_indices = split_wfd_indices.tolist()
    split_wfd_indices = [0] + split_wfd_indices

    for key in hp_footprints:
        temp = hp_footprints[key] + 0
        temp[wfd_indx] = 0
        fp_non_wfd.set_footprint(key, temp)

        for i, spi in enumerate(split_wfd_indices[0:-1]):
            temp = hp_footprints[key] + 0
            temp[non_wfd_indx] = 0
            indx = wfd_indx[split_wfd_indices[i]:split_wfd_indices[i + 1]]
            temp[indx] = 0
            rolling_footprints[i].set_footprint(key, temp)

    result = Footprints([fp_non_wfd] + rolling_footprints)
    return result
def make_rolling_footprints(mjd_start=59853.5,
                            sun_RA_start=3.27717639,
                            nslice=2,
                            scale=0.8,
                            nside=32):
    hp_footprints = standard_goals(nside=nside)

    down = 1. - scale
    up = nslice - down * (nslice - 1)
    start = [1., 1., 1.]
    end = [1., 1., 1., 1., 1., 1.]
    if nslice == 2:
        rolling = [up, down, up, down, up, down]
    elif nslice == 3:
        rolling = [up, down, down, up, down, down]
    elif nslice == 6:
        rolling = [up, down, down, down, down, down]
    all_slopes = [
        start + np.roll(rolling, i).tolist() + end for i in range(nslice)
    ]

    fp_non_wfd = Footprint(mjd_start, sun_RA_start=sun_RA_start)
    rolling_footprints = []
    for i in range(nslice):
        step_func = Step_slopes(rise=all_slopes[i])
        rolling_footprints.append(
            Footprint(mjd_start,
                      sun_RA_start=sun_RA_start,
                      step_func=step_func))

    split_wfd_indices = slice_wfd_area_quad(hp_footprints, nslice=nslice)
    wfd = hp_footprints['r'] * 0
    wfd_indx = np.where(hp_footprints['r'] == 1)[0]
    non_wfd_indx = np.where(hp_footprints['r'] != 1)[0]
    wfd[wfd_indx] = 1

    roll = np.zeros(nslice)
    roll[-1] = 1
    for key in hp_footprints:
        temp = hp_footprints[key] + 0
        temp[wfd_indx] = 0
        fp_non_wfd.set_footprint(key, temp)

        for i in range(nslice):
            temp = hp_footprints[key] + 0
            temp[non_wfd_indx] = 0
            for j in range(nslice * 2):
                indx = wfd_indx[split_wfd_indices[j]:split_wfd_indices[j + 1]]
                temp[indx] = temp[indx] * roll[(i + j) % nslice]
            rolling_footprints[i].set_footprint(key, temp)

    result = Footprints([fp_non_wfd] + rolling_footprints)
    return result
Beispiel #3
0
    extra_info['file executed'] = os.path.realpath(__file__)

    fileroot = 'weather_%.1f_' % cloud_limit
    file_end = 'v1.6_'

    if scale_down:
        footprints_hp = nes_light_footprints(nside=nside)
        fileroot = fileroot + 'scaleddown_'
    else:
        footprints_hp = standard_goals(nside=nside)

    observatory = Model_observatory(nside=nside)
    conditions = observatory.return_conditions()
    footprints = Footprint(conditions.mjd_start,
                           sun_RA_start=conditions.sun_RA_start,
                           nside=nside)
    for i, key in enumerate(footprints_hp):
        footprints.footprints[i, :] = footprints_hp[key]

    # 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=-camera_ddf_rot_limit,
                                      max_rot=camera_ddf_rot_limit),
        dither_detailer
    ]
    ddfs = generate_dd_surveys(nside=nside, nexp=nexp, detailers=details)

    greedy = gen_greedy_surveys(nside, nexp=nexp, footprints=footprints)
Beispiel #4
0
def generate_twilight_neo(nside,
                          night_pattern=None,
                          nexp=1,
                          exptime=1,
                          camera_rot_limits=[-80., 80.],
                          footprint_weight=0.1,
                          slewtime_weight=3.,
                          stayfilter_weight=3.,
                          mjd_start=0,
                          sun_RA_start=0.):
    # XXX finish eliminating magic numbers and document this one
    slew_estimate = 4.5
    filters = 'riz'
    survey_name = 'twilight_neo'
    footprint = ecliptic_target(nside=nside)
    footprints_hp = {}
    for filtername in filters:
        footprints_hp[filtername] = footprint
    footprints = Footprint(mjd_start, sun_RA_start=sun_RA_start, nside=nside)
    for i, key in enumerate(footprints_hp):
        footprints.footprints[i, :] = footprints_hp[key]

    surveys = []
    for filtername in filters:
        detailer_list = []
        detailer_list.append(
            detailers.Camera_rot_detailer(min_rot=np.min(camera_rot_limits),
                                          max_rot=np.max(camera_rot_limits)))
        detailer_list.append(detailers.Close_alt_detailer())
        detailer_list.append(
            detailers.Twilight_triple_detailer(slew_estimate=slew_estimate,
                                               n_repeat=3))
        bfs = []

        bfs.append(
            (bf.Footprint_basis_function(filtername=filtername,
                                         footprint=footprints,
                                         out_of_bounds_val=np.nan,
                                         nside=nside), footprint_weight))

        bfs.append((bf.Slewtime_basis_function(filtername=filtername,
                                               nside=nside), slewtime_weight))
        bfs.append((bf.Strict_filter_basis_function(filtername=filtername),
                    stayfilter_weight))
        # 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.), 0))
        bfs.append((bf.Zenith_shadow_mask_basis_function(nside=nside,
                                                         shadow_minutes=60.,
                                                         max_alt=76.), 0))
        bfs.append((bf.Moon_avoidance_basis_function(nside=nside,
                                                     moon_distance=30.), 0))
        bfs.append(
            (bf.Filter_loaded_basis_function(filternames=filtername), 0))
        bfs.append((bf.Planet_mask_basis_function(nside=nside), 0))
        bfs.append((bf.Sun_alt_limit_basis_function(), 0))
        bfs.append((bf.Time_in_twilight_basis_function(time_needed=5.), 0))
        bfs.append((bf.Night_modulo_basis_function(pattern=night_pattern), 0))
        # unpack the basis functions and weights
        weights = [val[1] for val in bfs]
        basis_functions = [val[0] for val in bfs]

        # Set huge ideal pair time and use the detailer to cut down the list of observations to fit twilight?
        surveys.append(
            Blob_survey(basis_functions,
                        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