import numpy as np
import matplotlib.pyplot as plt
import math
import matplotlib
matplotlib.rc('xtick', labelsize=24) 
matplotlib.rc('ytick', labelsize=24) 
matplotlib.rcParams.update({'font.size': 22})


#%% intensité et franges sur l'écran 

a=100*1e-6
D=2
lamb=580 *1e-9



x0 = np.linspace(-0.04,0.04,1e3)#1m
x= a*x0/ lamb/D





M0= np.array([np.ones(np.shape(x)[0])+np.cos(2 * np.pi * x) for k in range(250)])


fig = plt.figure()
fig.canvas.set_window_title("Fentes d'Young")

axe_principal = plt.axes([0.16875, 0.12, 0.6825, 0.35])
axe_principal.set_title("Profil d'intensité")
axe_principal.plot(x, np.ones(np.shape(x)[0])+np.cos(2 * np.pi * x) )
axe_principal.set_xlabel(r'$\frac{ax}{\lambda D}$')
axe_principal.set_xlim([-3.5,3.5])
axe_principal.set_ylabel('$I/I_0$')
axe_principal.set_yticks([0, 1, 2], ['0', r'$I_0$', r'$2I_0$'])


axe_ecran = plt.axes([0.12, 0.6, 0.78, 0.35])
axe_ecran.set_title("Ecran")
axe_ecran.set_ylabel(r'$y$')
axe_ecran.imshow(M0, cmap='gist_heat', vmin=0, vmax=3)
axe_ecran.set_yticks([])
axe_ecran.set_xlabel('$x$')
axe_ecran.set_xticklabels([ '0'])

mng = plt.get_current_fig_manager()     #Plein ecran
mng.window.showMaximized()
plt.show()