uv_wavelengths = casa_utils.convert_uv_coords_from_meters_to_wavelengths( uv=uv, frequencies=frequencies) # NOTE: For this tutorial we channel-average the uv_wavelengths. uv_wavelengths = np.average(a=uv_wavelengths, axis=0) antennas = fits.getdata("./antennas.fits") if not (uv_wavelengths.shape[0] == antennas.shape[0]): raise ValueError("...") antennas_unique = np.unique(antennas) if os.path.isfile("./phase_errors.fits"): phase_errors = fits.getdata(filename="./phase_errors.fits") else: np.random.seed(seed=random_utils.seed_generator()) phase_errors = np.random.uniform(low=-np.pi / 2.0, high=np.pi / 2.0, size=(antennas_unique.size, )) fits.writeto("./phase_errors.fits", data=phase_errors) f = calibration_utils.compute_f_matrix_from_antennas(antennas=antennas) data_with_phase_errors = False self_calibration = False if __name__ == "__main__": def corrupt_visibilities_from_f_matrix_and_phase_errors( visibilities, f, phase_errors):
uv_wavelengths = np.average( a=uv_wavelengths, axis=0 ) antennas = fits.getdata("./antennas.fits") if not (uv_wavelengths.shape[0] == antennas.shape[0]): raise ValueError("...") antennas_unique = np.unique(antennas) if os.path.isfile("./phase_errors.fits"): phase_errors = fits.getdata(filename="./phase_errors.fits") else: np.random.seed( seed=random_utils.seed_generator() ) phase_errors = np.random.uniform( low=-np.pi/2.0, high=np.pi/2.0, size=(antennas_unique.size,) ) fits.writeto("./phase_errors.fits", data=phase_errors) f = calibration_utils.compute_f_matrix_from_antennas( antennas=antennas ) data_with_phase_errors = True self_calibration = True if __name__ == "__main__":