def calc_stats(param): n_pol = int(param[0]) ill_na = param[1] det_na = 0.8 exp = multiframe.MultiFrameMicroscope(ill_thetas=[0], det_thetas=[0], ill_nas=[ill_na], det_nas=[det_na], ill_types=['wide'], det_types=['lens'], colors=['(1,0,0)'], n_frames=n_pol, n_pts=n_pts, max_photons=4000 / n_pol, n_samp=n) exp.calc_estimation_stats() data = exp.sa_uncert med = np.median(data) return med, np.median(np.abs(data - med))
def __init__(self, multiframe=multiframe.MultiFrameMicroscope(), data=None, recon_type='tp', recon_dx=1e-6, recon_eps=1e-3, recon_max_iter=1e2): self.multiframe = multiframe self.data = data if len(self.multiframe.microscopes) != len(self.data): print("Warning! Data size does not match multiframe model.") self.recon_type = recon_type self.recon_dx = recon_dx self.recon_eps = recon_eps self.recon_max_iter = recon_max_iter self.recon_est_history = [] self.recon_norm_history = [] self.estimated_fluorophore = None
return True else: return False pts_list = [pt for pt in pts if is_feasible(pt)] pts = np.array(pts_list).T na_ill = 0.6 na_det = 0.8 exp = multiframe.MultiFrameMicroscope(ill_thetas=[0], det_thetas=[0], ill_nas=[na_ill], det_nas=[na_det], ill_types=['wide'], det_types=['lens'], colors=['(1,0,0)'], n_frames=4, n_pts=n_pts_sphere, max_photons=1000, n_samp=1.33) exp.calc_estimation_stats() util.draw_scene(exp.scene_string(), my_ax=ax0, dpi=dpi) util.draw_scene(exp.ellipse_string(n_pts=250), my_ax=ax1, dpi=dpi) util.plot_sphere(directions=exp.directions, data=exp.sa_uncert, color_norm='log', linthresh=1e-4, color_min=1e-4, color_max=1e1,
# Main input parameters col_labels = ['Geometry', 'Uncertainty Ellipse', r'$\sigma_{\Omega}$'] row_labels = 6 * [''] n_pts = 10000 n_rows = len(row_labels) n_cols = 3 inch_fig = 5 dpi = 200 m1 = multiframe.MultiFrameMicroscope(ill_thetas=[0], det_thetas=[0], ill_nas=[0.01], det_nas=[0.8], ill_types=['sheet'], det_types=['lens'], colors=['(1,0,0)'], n_frames=2, n_pts=n_pts, max_photons=4000 / 2, n_samp=1.33) m2 = multiframe.MultiFrameMicroscope(ill_thetas=[0], det_thetas=[0], ill_nas=[0.01], det_nas=[0.8], ill_types=['sheet'], det_types=['lens'], colors=['(1,0,0)'], n_frames=3, n_pts=n_pts,
edgecolor=c)) fig.colorbar(sc, cax=cax, orientation='vertical') ax.set(xlim=[1.5, 10], ylim=[0, 1.33]) # Plot first two columns n_pol = 2 ill_na = 0.2 det_na = 0.8 exp = multiframe.MultiFrameMicroscope(ill_thetas=[0], det_thetas=[0], ill_nas=[ill_na], det_nas=[det_na], ill_types=['wide'], det_types=['lens'], colors=['(1,0,0)'], n_frames=n_pol, n_pts=n_pts_sphere, max_photons=4000 / n_pol, n_samp=n) exp.calc_estimation_stats() # Make scene string util.draw_scene(exp.scene_string(), my_ax=ax0, dpi=dpi) util.draw_scene(exp.ellipse_string(n_pts=250), my_ax=ax1, dpi=dpi) util.plot_sphere(directions=exp.directions, data=exp.sa_uncert, color_norm='log', linthresh=1e-4,
edgecolor=c)) fig.colorbar(sc, cax=cax, orientation='vertical') ax.set(xlim=[1.5, 10], ylim=[0, 1.33]) # Plot first two columns n_pol = 3 ill_na = 0.2 det_na = 0.8 exp = multiframe.MultiFrameMicroscope(ill_thetas=[np.pi / 4, -np.pi / 4], det_thetas=[-np.pi / 4, np.pi / 4], ill_nas=2 * [ill_na], det_nas=2 * [det_na], ill_types=2 * ['wide'], det_types=2 * ['lens'], colors=['(1,0,0)', '(0,0,1)'], n_frames=n_pol, n_pts=n_pts, max_photons=2000 / n_pol, n_samp=1.33) exp.calc_estimation_stats() # Make scene string util.draw_scene(exp.scene_string(), my_ax=ax0, dpi=dpi) util.draw_scene(exp.ellipse_string(n_pts=250), my_ax=ax1, dpi=dpi) util.plot_sphere(directions=exp.directions, data=exp.sa_uncert, color_norm='log',
NA_ill = np.linspace(0, 1.33, num=1000) NA_det = NA_ill pts = np.mgrid[n/n_grid_pts/2:n-n/n_grid_pts/2:n_grid_pts*1j,n/n_grid_pts/2:n-n/n_grid_pts/2:n_grid_pts*1j].reshape((2, n_grid_pts**2)).T.tolist() def is_feasible(pt): if pt[0] < pt[1] + 0.2: return True else: return False pts_list = [pt for pt in pts if is_feasible(pt)] pts = np.array(pts_list).T exp = multiframe.MultiFrameMicroscope(ill_thetas=[np.pi/4, -np.pi/4], det_thetas=[-np.pi/4, np.pi/4], ill_nas=[0.8, 0.8], det_nas=[0.8, 0.8], ill_types=2*['sheet'], det_types=2*['lens'], colors=['(1,0,0)', '(0,0,1)'], n_frames=4, n_pts=n_pts_sphere, max_photons=[1, 1], n_samp=1.33) exp.calc_estimation_stats() util.draw_scene(exp.scene_string(), my_ax=ax0, dpi=dpi) util.draw_scene(exp.ellipse_string(n_pts=250), my_ax=ax1, dpi=dpi) util.plot_sphere(directions=exp.directions, data=exp.sa_uncert, color_norm='log', linthresh=1e-4, color_min=1e-4, color_max=1e1, my_ax=ax2, my_cax=cax2) # Label axes and save print('Saving final figure.') fig.savefig('dual-view.pdf', dpi=1000)