def run_sched(surveys,
              survey_length=365.25,
              nside=32,
              fileroot='baseline_',
              verbose=False,
              extra_info=None,
              illum_limit=40.):
    years = np.round(survey_length / 365.25)
    scheduler = Core_scheduler(surveys, nside=nside)
    n_visit_limit = None
    filter_sched = simple_filter_sched(illum_limit=illum_limit)
    observatory = Model_observatory(nside=nside)

    conditions_init = copy.deepcopy(observatory.return_conditions())

    scheduler.update_conditions(observatory.return_conditions())
    desired_obs = scheduler.request_observation(mjd=observatory.mjd)
    print(desired_obs)

    completed_obs, new_night = observatory.observe(desired_obs)
    print(completed_obs)
    # Check if there's any difference between where we wanted to point, and where it pointed
    for key in ['RA', 'dec', 'rotSkyPos']:
        print(key, desired_obs[key] - completed_obs[key], desired_obs[key][0])

    conditions_final = observatory.return_conditions()

    print(scheduler.survey_lists[2][-2].fields['dec'][3410])

    import pdb
    pdb.set_trace()
示例#2
0
    def testsched(self):
        target_map = standard_goals()['r']

        bfs = []
        bfs.append(basis_functions.M5_diff_basis_function())
        bfs.append(
            basis_functions.Target_map_basis_function(target_map=target_map))
        weights = np.array([1., 1])
        survey = surveys.Greedy_survey(bfs, weights)
        scheduler = Core_scheduler([survey])

        observatory = Model_observatory()

        # Check that we can update conditions
        scheduler.update_conditions(observatory.return_conditions())

        # Check that we can get an observation out
        obs = scheduler.request_observation()
        assert (obs is not None)

        # Check that we can flush the Queue
        scheduler.flush_queue()
        assert (len(scheduler.queue) == 0)

        # Check that we can add an observation
        scheduler.add_observation(obs)
示例#3
0
    except subprocess.CalledProcessError:
        extra_info['git hash'] = 'Not in git repo'

    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)