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