def auto_corr(request): if request.method == 'POST': form = Ndft_form(request.POST) if form.is_valid(): cd = form.cleaned_data input1 = cd['input1'] x=arr_conv(input1) output=np.correlate(x,x,'full') output=np.asarray(output) c='ac' num=len(output) gp(output,num,c) graphy='<img src="http://kingspp.pythonanywhere.com/media/plots/test.png" height="400px" width="500px" ></img>' output = 'The Autocorrelation of x(n) is : ' + str(output) indisp='Input Sequence x(n): ' + '[' + str(input1) + ']' return render_to_response('dsp/auto_corr.html', {'form':form, 'input1': indisp, 'output':output, 'graphy':graphy, 'right_now':datetime.now()}, context_instance=RequestContext(request)) else: form = Ndft_form() return render_to_response('dsp/auto_corr.html', {'form': form,'right_now':datetime.now()}, context_instance=RequestContext(request))
def ndft(request): if request.method == 'POST': form = Ndft_form(request.POST) if form.is_valid(): cd = form.cleaned_data input1 = cd['input1'] x=arr_conv(input1) output = np.fft.fftn(x) num=len(output) c='nd' gp(output,num,c) graphy='<img src="http://kingspp.pythonanywhere.com/media/plots/test.png" height="400px" width="500px" aligh="center"></img>' output = 'The N-Point Discrete Fourier Transform of x(n) is : ' + str(output) indisp='Input Sequence x(n): ' + '[' + str(input1) + ']' return render_to_response('dsp/ndft.html', {'form':form, 'input1': indisp, 'output':output, 'graphy':graphy,'right_now':datetime.now()}, context_instance=RequestContext(request)) else: form = Ndft_form() return render_to_response('dsp/ndft.html', {'form': form,'right_now':datetime.now()}, context_instance=RequestContext(request))