def survey_footprint(ax, survey_filename, FoV): ''' This function plots the survey footprint map on the given matplotlib axes instance Input ----- ax : matplotlib axes instance The axes instance to plot the footprint map to survey_filename : string The path to the survey file ''' survey = np.loadtxt(survey_filename) x_min = -FoV[0] / 2 y_min = -FoV[1] / 2 x_max = FoV[0] / 2 y_max = FoV[1] / 2 x = np.array([x_min, x_min, x_max, x_max, x_min]) y = np.array([y_min, y_max, y_max, y_min, y_min]) for image in survey: alpha, beta = transformations.fp2sky(x, y, image[1:3], image[3]) ax.plot(alpha, beta, 'k-', alpha=0.5) return None
def camera(data_dir, sky_catalog, measured_catalog, FoV, pointing, orientation, verbose=False): ''' Saves out a single camera exposure, along with the total sky catalog and the meas Parameters ---------- data_dir : string The output directory sky_catalog : object Object of the sky catalog (*.ID, *.mag, *.alpha, *.beta, *.size) measured_catalog : object Object of measured sources on focal plane in a single pointing (*.size, *.ID, *.x, *.y, *true_invvar, *.counts, *.invvar) FoV : float array The imagers field-of-view in degrees (dalpha, dbeta) pointing : np.array Array of telescope pointing (alpha, beta) orientation : float Rotation of the telescope verbose : boolean True to run function in verbose mode ''' filename = '{0}/camera_image.p'.format(data_dir) if verbose: print("Saving out camera image to {0}...".format(filename)) x = 0.5 * np.array([-FoV[0], -FoV[0], FoV[0], FoV[0], -FoV[0]]) y = 0.5 * np.array([-FoV[1], FoV[1], FoV[1], -FoV[1], -FoV[1]]) alpha, beta = transformations.fp2sky(x, y, pointing, orientation) dic = {'sources_x': measured_catalog.x, 'sources_y': measured_catalog.y, 'sky_catalog': sky_catalog, 'pointing': pointing, 'orientation': orientation, 'fp_x': x, 'fp_y': y, 'fp_alpha': alpha, 'fp_beta': beta} pickle.dump(dic, open(filename, "wb")) if verbose: print("...done!")
fig.text(0.025, 0.5, r'Sky Position $\beta$ (deg$^2$)', va='center', ha='center', rotation=90) for indx in range(len(dirs)): params = pickle.load(open('{0}/parameters.p'.format(dirs[indx]))) FoV = params['FoV'] sky_limits = params['sky_limits'] x = 0.5 * np.array([-FoV[0], -FoV[0], FoV[0], FoV[0], -FoV[0]]) y = 0.5 * np.array([-FoV[1], FoV[1], FoV[1], -FoV[1], -FoV[1]]) survey = np.loadtxt((dirs[indx] + '/survey.txt')) for image in survey: alpha, beta = transformations.fp2sky(x, y, image[1:3], image[3]) ax[indx].plot(alpha, beta, 'k-', alpha=0.4) min_sky = np.min(sky_limits) \ - 0.02 * (np.max(sky_limits) - np.min(sky_limits)) max_sky = np.max(sky_limits) \ + 0.02 * (np.max(sky_limits) - np.min(sky_limits)) ax[indx].set_xlim(min_sky, max_sky) ax[indx].set_ylim(min_sky, max_sky) ax[0].text(0.95, 0.04, 'A', va='center', ha='center', transform=ax[0].transAxes) ax[1].text(0.05, 0.04, 'B', va='center', ha='center', transform=ax[1].transAxes) ax[2].text(0.95, 0.96, 'C', va='center', ha='center', transform=ax[2].transAxes)