def calc_uncorrelated_signal_power(params):
    
    '''This function calculates the depth-resolved power spectrum of signals
    without taking into account any cross-correlation.'''


    for i, data_type in enumerate(['LFP','CSD']):
        if i % SIZE == RANK:
    
            # Determine size of PSD matrix
    
            f = h5py.File(os.path.join(params.savefolder, data_type + 'sum.h5'),'r')
            data = f['data'].value
            srate = f['srate'].value
            if ana_params.mlab:
                Psum, freqs = plt.mlab.psd(data[0], NFFT=ana_params.NFFT, Fs=srate,
                                    noverlap=ana_params.noverlap, window=ana_params.window)
            else:
                [freqs, Psum] = hlp.powerspec([data[0]], tbin= 1./srate*1000.,
                                       Df=ana_params.Df, pointProcess=False)
            f.close()
            P = np.zeros((data.shape[0],Psum.shape[0]))
               
            for y in params.y:
    
                print 'processing ', y
                # Load data
                f = h5py.File(os.path.join(params.populations_path, '%s_%ss' %
                                           (y,data_type) + '.h5'),'r')
                data_y = f['data'].value[:,:, ana_params.transient:]
                # subtract mean
                for j in range(len(data_y)):
                    data_yT = data_y[j].T - data_y[j].mean(axis=1)
                    data_y[j] = data_yT.T
                srate = f['srate'].value
                tvec = np.arange(data_y.shape[2]) * 1000. / srate
                f.close()
    
            
                for j in range(len(data_y)): # loop over cells
                    if ana_params.mlab:
                        for ch in range(len(params.electrodeParams['z'])): # loop over channels
                            P_j_ch, freqs = plt.mlab.psd(data_y[j,ch],
                                                         NFFT=ana_params.NFFT, Fs=srate,
                                                         noverlap=ana_params.noverlap,
                                                         window=ana_params.window)
                                       
                            P[ch] += P_j_ch
                    else:
                        [freqs, P_j] = hlp.powerspec(data_y[j], tbin= 1./srate*1000.,
                                                     Df=ana_params.Df, pointProcess=False)
                        mask = np.where(freqs >= 0.)
                        freqs = freqs[mask]
                        P_j = P_j[:,mask][:,0,:]
                        P_j = P_j/tvec[tvec >= ana_params.transient].size**2
                        
                        P += P_j
    
            #rescale PSD as they may be computed from a fraction of single cell LFPs
            P /= params.recordSingleContribFrac
            
            # Save data
            f = h5py.File(os.path.join(params.savefolder, ana_params.analysis_folder,
                                       data_type +  ana_params.fname_psd_uncorr),'w')
            f['freqs']=freqs
            f['psd']=P
            f['transient']=ana_params.transient
            f['mlab']=ana_params.mlab
            f['NFFT']=ana_params.NFFT
            f['noverlap']=ana_params.noverlap
            f['window']=str(ana_params.window)
            f['Df']=str(ana_params.Df)        
            f.close()

    return