# make it better

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35``` ```from scipy import * from scipy import gplt from scipy import fftpack sunspot = scipy.io.array_import.read_array('sunspots.dat') year=sunspot[:,0] wolfer=sunspot[:,1] data = [] for i in range(0, 32): for j in range(0, 32): data.append([i/100., math.sin(j)/100.], math.sin(j)/100.]+random.randint(1, 100)/100) # Each data entry has the form [x, y, y2] y[0] = [i for i,j,k in data] y[1] = [i for i,j,k in data] y[2] = y1 for i in range(2, 32, 2): y[2].insert(y[2][i-1]) nyquist=1./2 for i in range(0, 3): Y[i]=fft(y[i]) n[i]=len(Y[i]) power[i] = abs(Y[i][1:(n1/2)])**2 freq[i]=array(range(n[i]/2))/(n[i]/2.0)*nyquist period[i]=1./freq[i] p_data[i] = Gnuplot.PlotItems.Data(period[i][1:len(period[i])], power[i],y[i]) gplt.plot(p_data[0], p_data[1], p_data[2]) gplt.xaxis((0,40)) gplt.ytitle('|FFT|**2') gplt.grid("off") gplt.output('sunspot_period.png','png medium transparent picsize 600 400') ```