def testBaseline(self): """ Set up a baseline survey and run for a few days. A crude way to touch lots of code. """ nside = fs.set_default_nside(nside=32) survey_length = 2.1 # days # Define what we want the final visit ratio map to look like target_map = fs.standard_goals(nside=nside) filters = ['u', 'g', 'r', 'i', 'z', 'y'] surveys = [] for filtername in filters: bfs = [] bfs.append(fs.M5_diff_basis_function(filtername=filtername, nside=nside)) bfs.append(fs.Target_map_basis_function(filtername=filtername, target_map=target_map[filtername], out_of_bounds_val=hp.UNSEEN, nside=nside)) bfs.append(fs.North_south_patch_basis_function(zenith_min_alt=50., nside=nside)) bfs.append(fs.Slewtime_basis_function(filtername=filtername, nside=nside)) bfs.append(fs.Strict_filter_basis_function(filtername=filtername)) weights = np.array([3.0, 0.3, 1., 3., 3.]) surveys.append(fs.Greedy_survey_fields(bfs, weights, block_size=1, filtername=filtername, dither=True, nside=nside)) surveys.append(fs.Pairs_survey_scripted([], [], ignore_obs='DD')) # Set up the DD dd_surveys = fs.generate_dd_surveys() surveys.extend(dd_surveys) scheduler = fs.Core_scheduler(surveys, nside=nside) observatory = Speed_observatory(nside=nside) observatory, scheduler, observations = fs.sim_runner(observatory, scheduler, survey_length=survey_length, filename=None) # Check that a second part of a pair was taken assert('scripted' in observations['note']) # Check that the COSMOS DD was observed assert('DD:COSMOS' in observations['note']) # And the u-band assert('DD:u,COSMOS' in observations['note']) # Make sure a few different filters were observed assert(len(np.unique(observations['filter'])) > 3) # Make sure lots of observations executed assert(observations.size > 1000)
for filtername in filters: bfs = [] bfs.append(fs.M5_diff_basis_function(filtername=filtername, nside=nside)) bfs.append(fs.Target_map_basis_function(filtername=filtername, target_map=target_map[filtername], out_of_bounds_val=hp.UNSEEN, nside=nside)) bfs.append(fs.North_south_patch_basis_function(zenith_min_alt=50., nside=nside)) #bfs.append(fs.Zenith_mask_basis_function(maxAlt=78., penalty=-100, nside=nside)) bfs.append(fs.Slewtime_basis_function(filtername=filtername, nside=nside)) bfs.append(fs.Strict_filter_basis_function(filtername=filtername)) weights = np.array([3.0, 0.3, 1., 3., 3.]) # Might want to try ignoring DD observations here, so the DD area gets covered normally--DONE surveys.append(fs.Greedy_survey_fields(bfs, weights, block_size=1, filtername=filtername, dither=True, nside=nside, ignore_obs='DD')) surveys.append(fs.Pairs_survey_scripted([], [], ignore_obs='DD', min_alt=20.)) # Set up the DD dd_surveys = fs.generate_dd_surveys() surveys.extend(dd_surveys) scheduler = fs.Core_scheduler(surveys, nside=nside) observatory = Speed_observatory(nside=nside, mjd_start=59853.) observatory, scheduler, observations = fs.sim_runner(observatory, scheduler, survey_length=survey_length, filename='my_baseline_newSpeed%iyrs.db' % years, delete_past=True) # real 1751m55.325s = 29 hours
for filtername in filters: bfs = [] bfs.append(fs.M5_diff_basis_function(filtername=filtername)) bfs.append(fs.Target_map_basis_function(filtername=filtername, target_map=target_map[filtername], out_of_bounds_val=hp.UNSEEN)) #bfs.append(fs.North_south_patch_basis_function(zenith_min_alt=50.)) bfs.append(fs.Zenith_mask_basis_function(maxAlt=78., penalty=-100)) bfs.append(fs.Slewtime_basis_function(filtername=filtername)) bfs.append(fs.Strict_filter_basis_function(filtername=filtername)) weights = np.array([3.0, 0.4, 1., 2., 3.]) surveys.append(fs.Greedy_survey_fields(bfs, weights, block_size=1, filtername=filtername, dither=True)) surveys.append(fs.Pairs_survey_scripted([], [], ignore_obs='DD')) # Set up the DD dd_survey = fs.Scripted_survey([], []) names = ['RA', 'dec', 'mjd', 'filter'] types = [float, float, float, '|1U'] observations = np.loadtxt('minion_dd.csv', skiprows=1, dtype=list(zip(names, types)), delimiter=',') exptimes = np.zeros(observations.size) exptimes.fill(30.) observations = append_fields(observations, 'exptime', exptimes) nexp = np.zeros(observations.size) nexp.fill(2) observations = append_fields(observations, 'nexp', nexp) notes = np.zeros(observations.size, dtype='|2U') notes.fill('DD') observations = append_fields(observations, 'note', notes)
# Define what we want the final visit ratio map to look like target_map = fs.standard_goals()['r'] filtername = 'r' bfs = [] bfs.append(fs.M5_diff_basis_function(filtername=filtername, teff=False)) bfs.append( fs.Target_map_basis_function(target_map=target_map, filtername=filtername, out_of_bounds_val=hp.UNSEEN)) bfs.append(fs.North_south_patch_basis_function(zenith_min_alt=50.)) bfs.append(fs.Slewtime_basis_function(filtername=filtername)) weights = np.array([1., 0.2, 1., 2.]) surveys = [] surveys.append( fs.Greedy_survey_fields(bfs, weights, block_size=1, filtername=filtername)) surveys.append(fs.Pairs_survey_scripted([], [])) scheduler = fs.Core_scheduler(surveys) observatory = Speed_observatory() observatory, scheduler, observations = fs.sim_runner( observatory, scheduler, survey_length=survey_length, filename='one_filter_pairs.db', delete_past=True)