What is the difference between a logged power spectrum and power spectrum... Well the log part. So can a normal power spectrum be converted to a logged power spectrum just by taking the log of the power spectrum?
Here is the code in which I am trying to convert:
import os
import sys
from os import listdir
from os.path import isfile, join
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import seaborn as sb
from matplotlib.colors import Normalize
import matplotlib
from matplotlib import cm
from PIL import Image
import ast
def make_plot_store_data(name,interweaved,static,delta,delta_delta,isTrain,isTest,isDev):
Y = np.array(range(0,static.shape[1]))
X = np.array(range(0,static.shape[0]))
X,Y = np.meshgrid(X, Y)
plt.pcolormesh(X,Y,np.log10(static.T),cmap=cm.jet,vmin=-6, vmax=2)
plt.xlabel('Frames')
plt.ylabel('Frequency(Hz)')
plt.title('Power spectrum of ' + name)
plt.colorbar()
#plt.show()
plt.savefig(plot+"/"+name+"_plot_static_conv.png")
#raw_input("Something")
plt.close()
plt.pcolormesh(X,Y,np.log10(delta.T),cmap=cm.jet,vmin=-6, vmax=2)
plt.xlabel('Frames')
plt.ylabel('Frequency(Hz)')
plt.title('Power spectrum of ' + name)
plt.colorbar()
#plt.show()
plt.savefig(plot+"/"+name+"_plot_delta_conv.png")
#raw_input("Something")
plt.close()
plt.pcolormesh(X,Y,np.log10(delta_delta.T),cmap=cm.jet,vmin=-6, vmax=2)
plt.xlabel('Frames')
plt.ylabel('Frequency(Hz)')
plt.title('Power spectrum of ' + name)
plt.colorbar()
#plt.show()
plt.savefig(plot+"/"+name+"_plot_delta_delta_conv.png")
#raw_input("Something")
plt.close()
Y = np.array(range(0,interweaved.shape[1]))
X = np.array(range(0,interweaved.shape[0]))
X,Y = np.meshgrid(X, Y)
plt.pcolormesh(X,Y,np.log10(interweaved.T),cmap=cm.jet,vmin=-6, vmax=2)
##plt.xlim(xmin, xmax)
plt.xlabel('Frames')
plt.ylabel('Frequency(Hz)')
plt.title('Power spectrum of ' + name)
plt.colorbar()
#plt.show()
plt.savefig(plot+"/"+name+"_interweaved.png")
plt.close()
if isTrain == True:
convert = plt.get_cmap(cm.jet)
norm = Normalize(vmin=-6, vmax=2)
numpy_output_interweawed = convert(norm(plot_interweaved))
numpy_output_interweawed.dump(numpy_train+name+"_normalized_interweaved"+".dat")
numpy_output_interweawed_or = convert(norm(plot_interweaved))*255
numpy_output_interweawed_or.dump(numpy_train+name+"_interweaved"+".dat")
if isTest == True:
convert = plt.get_cmap(cm.jet)
norm = Normalize(vmin=-6, vmax=2)
numpy_output_interweawed = convert(norm(plot_interweaved))
numpy_output_interweawed.dump(numpy_test+name+"_normalized_interweaved"+".dat")
numpy_output_interweawed_or = convert(norm(plot_interweaved))*255
numpy_output_interweawed_or.dump(numpy_test+name+"_interweaved"+".dat")
if isDev == True:
convert = plt.get_cmap(cm.jet)
norm = Normalize(vmin=-6, vmax=2)
numpy_output_interweawed = convert(norm(plot_interweaved))
numpy_output_interweawed.dump(numpy_dev+name+"_normalized_interweaved"+".dat")
numpy_output_interweawed_or = convert(norm(plot_interweaved))*255
numpy_output_interweawed_or.dump(numpy_dev+name+"_interweaved"+".dat")
print str(name) + " Numpy Stored"
I am trying to store the logged filter bank energies here both as plot and data. But I seem to be doing it wrong based on the images I get.