diff --git a/demo_radio.ipynb b/demo_radio.ipynb index 57c00d11354c283b13005e14e8578fb45eedb822..47ea3e99a67312f845cd963d02f0d3fca0a58a9b 100644 --- a/demo_radio.ipynb +++ b/demo_radio.ipynb @@ -45,8 +45,8 @@ "plt.plot(mock_observation.uvw[:,0], -mock_observation.uvw[:,1], 'b.')\n", "plt.xlabel('u')\n", "plt.ylabel('v')\n", - "plt.xlim([-10e6,10e6])\n", - "plt.ylim([-10e6,10e6])\n", + "plt.xlim([-12e6,12e6])\n", + "plt.ylim([-12e6,12e6])\n", "plt.show()" ] }, @@ -98,10 +98,10 @@ " 'fluctuations': (1.5, 0.5),\n", "\n", " # Exponent of power law power spectrum component\n", - " 'loglogavgslope': (-4., 0.5),\n", + " 'loglogavgslope': (-4., .5),\n", "\n", " # Amplitude of integrated Wiener process power spectrum component\n", - " 'flexibility': (0.3, .1),\n", + " 'flexibility': (.3, .1),\n", "\n", " # How ragged the integrated Wiener process component is\n", " 'asperity': None # Passing 'None' disables this part of the model\n", @@ -391,6 +391,60 @@ "fig.tight_layout()\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "UV - Uncertainty map\n", + "--------------------\n", + "\n", + "We can generate and study the posterior uncertainty maps for any kind on quantity we are interested in (i.E. not only for the sky brightness). In particular, we can also take a look at the uncertainty of the sky brightness in the UV plane. Comparing this to the measured UV-tracks yields information " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "lim_uv = 1.5E7\n", + "u = np.linspace(-lim_uv, lim_uv, num=257)\n", + "v = np.linspace(-lim_uv, lim_uv, num=257)\n", + "uu, vv = np.meshgrid(u,v)\n", + "ww = np.zeros_like(uu)\n", + "uvw = np.stack(tuple(a.flatten() for a in (uu,vv,ww)), axis = -1)\n", + "grid_antennas = rve.AntennaPositions(uvw)\n", + "vis = np.zeros(uu.size, dtype=np.complex128).reshape((1,-1,1))\n", + "wgts = np.ones_like(vis)\n", + "grid_obs = rve.Observation(grid_antennas, vis, wgts, rve.Polarization.trivial(),\n", + " mock_observation.freq)\n", + "grid_R = rve.InterferometryResponse(grid_obs, measurement_sky.target, \n", + " do_wgridding=False, epsilon=1e-10)\n", + "def intensity(xi):\n", + " r = measurement_sky(xi)\n", + " r = grid_R(r)\n", + " r = (r.real**2 + r.imag**2).sqrt()\n", + " return r.val.reshape(uu.shape)\n", + "\n", + "sky_mean, sky_var = samples.sample_stat(intensity)\n", + "res = np.log(sky_var / sky_mean)\n", + "f, ax = plt.subplots(ncols = 2, figsize = (18,12))\n", + "ax[0].imshow(res, origin='lower', extent=(-lim_uv, lim_uv, -lim_uv, lim_uv))\n", + "ax[1].imshow(res, origin='lower', extent=(-lim_uv, lim_uv, -lim_uv, lim_uv))\n", + "ax[1].scatter(mock_observation.uvw[:,0], mock_observation.uvw[:,1],\n", + " c='r', marker='.', s = 12, alpha = 0.5, label = 'measurements')\n", + "ax[1].scatter(-mock_observation.uvw[:,0], -mock_observation.uvw[:,1],\n", + " c='c', marker='.', s = 10, alpha = 0.5, label = 'measurements (c.c.)')\n", + "ax[1].legend()\n", + "for a in ax:\n", + " a.set_xlabel('u')\n", + " a.set_ylabel('v')\n", + "ax[0].set_title('UV posterior uncertainty')\n", + "ax[1].set_title('UV posterior uncertainty & measured UV-tracks')\n", + "fig.tight_layout()\n", + "plt.show()\n" + ] + }, { "cell_type": "code", "execution_count": null,