(ax, disparity: float, gamma: float, bl: float, fx: float, num_sample: int)
| 11 | |
| 12 | |
| 13 | def plot_experiment(ax, disparity: float, gamma: float, bl: float, fx: float, num_sample: int): |
| 14 | |
| 15 | |
| 16 | sample_depth = Montecarlo_sample_depth(disparity, gamma, bl, fx, num_sample) |
| 17 | |
| 18 | # Plot approximated normal distribution |
| 19 | mean = (bl * fx) / disparity |
| 20 | std = (bl * fx * gamma) / disparity |
| 21 | x = np.linspace(mean - 4*std, mean + 4*std, 1000) |
| 22 | pdf = norm.pdf(x, mean, std) |
| 23 | |
| 24 | # Plot histogram using the axes object |
| 25 | ax.hist(sample_depth.numpy(), bins=100, density=True, color=(53/255, 172/255, 164/255), label=f"Simulation\nDisp~N({disparity}, {round((disparity * gamma) ** 2, 3)})") |
| 26 | ax.plot(x, pdf, label=f'Our Approximation', color="orange") |
| 27 | |
| 28 | # Customize the plot |
| 29 | |
| 30 | ax.set_xlabel('Depth') |
| 31 | ax.set_ylabel('Probability Density') |
| 32 | ax.legend(loc="upper right") |
| 33 | |
| 34 | |
| 35 | fig, axs = plt.subplots(1, 3, figsize=(12, 3)) |
no test coverage detected