I want that every time a loop goes through, a new key-value pair is added to the dictionary, and only one last one is added.
alldata=np.load(fn) spec_chan=np.shape(alldata)[1] snrs = {} for aver in range(start,stop): periods=per*aver data_aver=np.zeros((aver,spec_chan), dtype=np.complex) data=alldata[0:periods] for i in range(periods/aver): data_aver[0:aver]+=data[i*aver:(i+1)*aver] ifft_data=abs(fft.ifft(data_aver,axis=-2)) section=ifft_data[s,0:] section=section.tolist() A=max(section) index_from=section.index(A)-5 index_to=section.index(A)+5 del section[index_from:index_to] average=np.mean(section) st_deviation=np.std(section) SNR=(A-average)/st_deviation snrs[aver]=SNR print snrs
startandstopequal to? - MaxU