Ejemplo n.º 1
0
def simpleExample():
	# Create a signal
	N = 256
	signal = numpy.zeros(N,numpy.complex128)
	# Make our signal 1 in the middle, zero elsewhere
	signal[N/2] = 1.0
	# plot our signal
	pylab.figure()
	pylab.plot(abs(signal))
	# Do the GFT on the signal
	SIGNAL = gft.gft1d(signal,'gaussian')
	# plot the magnitude of the signal
	pylab.figure()
	pylab.plot(abs(SIGNAL),'b')
	
	# get the partitions
	partitions = gft.partitions(N)
	# for each partition, draw a line on the graph.  Since the partitions only indicate the
	# positive frequencies, we need to draw partitions on both sides of the DC
	for i in partitions[0:len(partitions)/2]:
		pylab.axvline((N/2+i),color='r',alpha=0.2)
		pylab.axvline((N/2-i),color='r',alpha=0.2)
		
	# finally, interpolate the GFT spectrum and plot a spectrogram
	pylab.figure()
	pylab.imshow(abs(gft.gft1dInterpolateNN(SIGNAL)))