'Fit of intensity distribution does not work

So im sitting here and don't know how to fit the right function for my Intensity distribution of a doubleslit experiment. I tried so much but I don't know how it works. The x,y data are more than 1000 values. Here is my Plot:

Doubleslit of TEM_{00} Mode

And here's how it should look like:

Right fit

And that is my code to that:

import matplotlib.patches as mp
import matplotlib.pyplot as plt
import numpy as np                                                    
from scipy import optimize
from scipy.optimize import curve_fit
import pandas as pd
import math

data = pd.read_csv('TEM00-Doppelspalt-Short.txt',sep='\s+',header=None)        
data = pd.DataFrame(data)                                              

x = data[1]                                                          
y = data[2]


def expf(i0,g,k,y0,d):                                                 

    return i0*((np.sin(g*(k-y0)))/(g*(k-y0)))**2*np.cos(d*(k-y0))**2                                          
                                                        

popt, pcov =curve_fit(expf, x, y, p0 = (13, 20, 2, 4)) 
g,k,y0,d = popt  


plt.figure(figsize = (8,6), dpi = 600)                                  
plt.xlabel(r'Wavelength [$\mu$m]',fontsize=12)                         
plt.ylabel('Value [Cnts]', fontsize=12)                                
plt.plot(x, y,'ko')     
plt.plot(x, expf(x,g,k,y0,d))                                                
a_patch=mp.Patch(color='k', label="$TEM_{00}$ Doubleslit ShortMode")                                                                                                         
plt.legend(handles=[a_patch],loc="upper left")                          
plt.show() 

Here is my datafile: Data File of Intensity



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source