Пример #1
0
			nyq = 0.5*fs
			normal_cutoff = cutoff/nyq
			b, a = signal.butter(order, normal_cutoff, btype = 'low', analog = False)
			return b, a
		def butter_lowpass_filtfilt(data, cutoff, fs, order=5):
			b, a = butter_lowpass(cutoff, fs, order = order)
			y = signal.filtfilt(b, a, data)
			return y
		cutoff = 15000
		fs = 200000
		
		Li2p1hn = Li2p1.copy()
		Li2p1hn2 = Li2p1.copy()
		for x_ind in range(len(x)):	
			Li2p1hn2[int(t_start/avt):int(t_end/avt),0,x_ind] = butter_lowpass_filtfilt(Li2p1noise[int(t_start/avt):int(t_end/avt),0,x_ind],cutoff,fs)
			Li2p1hn[int(t_start/avt):int(t_end/avt),0,x_ind] = smooth(Li2p1noise[int(t_start/avt):int(t_end/avt),0,x_ind],window_len=smoothlen,window='hanning')

	# smoothing in x-direction for low resolution not necessary!
	#	Li2p1xs = Li2p1.copy()
	#	for t_ind in range(timestep):
	#		Li2p1xs[t_ind,0,:] = smooth(Li2p1hn[t_ind,0,:],window_len=smoothlenx,window='hanning')

		# only use the new noise and smoothed data if selected
		Li2p1blockraw=Li2p1noise.copy()
		if SmoothTime:
			Li2p1blocksmooth = Li2p1hn2.copy()

#Meshgrids
if not RealCase:
	X,Y=np.meshgrid(x_ori,y)						# transform x,y-axis in matrix for contourf-plot of 2D-plots
if BlockCase:
Пример #2
0
		for y_ind in range(stepsize):				# + 2 safty distance
			noiLi = np.random.normal(0,np.mean(Li2p1[:,y_ind,x_ind])/SNR,timestep)
			for t_ind in range(timestep):
				Li2p1[t_ind,y_ind,x_ind] = Li2p1[t_ind,y_ind,x_ind]+noiLi[t_ind]
	Li2p1noise=Li2p1.copy()

	# smoothing noisy data
	if Smooth:
		Li2p1hn = Li2p1.copy()
	#	Li2p1hm = Li2p1.copy()
	#	Li2p1ba = Li2p1.copy()
	#	Li2p1bl = Li2p1.copy()
		smoothlen = 71
		for t_ind in range(timestep):
			for y_ind in range(stepsize):
				Li2p1hn[t_ind,y_ind,:] = smooth(Li2p1[t_ind,y_ind,:],window_len=smoothlen,window='hanning')
			#	Li2p1hm[t_ind,shift*2,:] = smooth(Li2p1[t_ind,shift*2,:],window_len=smoothlen,window='hamming')
			#	Li2p1ba[t_ind,shift*2,:] = smooth(Li2p1[t_ind,shift*2,:],window_len=smoothlen,window='bartlett')
			#	Li2p1bl[t_ind,shift*2,:] = smooth(Li2p1[t_ind,shift*2,:],window_len=smoothlen,window='blackman')
		Li2p1 = Li2p1hn.copy()

# use the block-emission data for the block case:


#	Li2p1 = block_func(Li2p1,timestep,mn,b,avy,shift,shift2)			# if original block-function should be used
Li2p1_beam, Li2p1_block, x_block, blur = dect_func(Li2p1,timestep,mn,b,avy,shift,shift2,x)	# if detector reduced block function should be used

# Calculate index and position of Reference detector on xaxis (indices are counted backwards x[len(x)-1]<0!)
print('Reference detector has to be shifted to a position available for beam evaluation!')
countx=0
for g in range (0,len(x_block)):