MCPcopy Create free account
hub / github.com/MAC-VO/MAC-VO / plot_experiment

Function plot_experiment

Scripts/Statistic/Montecarlo_DisparityVariance.py:13–32  ·  view source on GitHub ↗
(ax, disparity: float, gamma: float, bl: float, fx: float, num_sample: int)

Source from the content-addressed store, hash-verified

11
12
13def 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
35fig, axs = plt.subplots(1, 3, figsize=(12, 3))

Callers 1

Calls 2

Montecarlo_sample_depthFunction · 0.85
plotMethod · 0.80

Tested by

no test coverage detected