Files
gem/prak4/read.py
2026-02-02 16:52:12 +01:00

51 lines
1.6 KiB
Python
Executable File

# -*- coding: utf-8 -*-
"""
Created on Thu Feb 15 17:59:51 2018
@author: Hauke Brunken
"""
import matplotlib.pyplot as plt
plt.close()
import numpy as np
import mdt
file = r"C:\Users\Student\Desktop\Neuer Ordner\Aliasingfilter_mit_box"
rates=[10000,44000]
for rate in rates:
data = mdt.dataRead(amplitude = 10, samplingRate = rate, duration = 1, channels = [0], resolution = 14, outType = 'Volt', continues=False )
f,u = mdt.spectrum(data, rate)
fig, (ax1,ax2) = plt.subplots(2)
ax1.plot(data)
ax2.plot(f,u)
Title= "Alialising Rechtecksignal Filtered" +str(rate/1000) +"kHz"
file_name = f"{file}_{rate}.csv"
with open(file_name, 'w') as f:
np.savetxt(f, data, delimiter=',')
# np.save(Title, data)
#plt.savefig('Alialasing' + strate + "Hz.pdf")
#file = r"C:\Users\Student\Desktop\Neuer Ordner\Aliasing"
#rates = [40000, 35000, 30000, 25000, 20000, 17500, 15000, 12500, 10000]
#for i in range(len(rates)):
# data = mdt.dataRead(amplitude=10, samplingRate=rates[i], duration=1, channels=[0], resolution=14, outType='Volt')
# file_name = f"{file}_{rates[i]}.csv"
# with open(file_name, 'w') as f:
# np.savetxt(f, data, delimiter=',')
#data = mdt.dataRead(amplitude=10, samplingRate=rates[len(rates)-1], duration=1, channels=[0], resolution=14, outType='Volt')
#plt.plot(data, marker='x')
#plt.show()
#plt.tight_layout()
#plt.show()
#np.save("ADUKennlinie Sinussignal", data)
#data = np.load("TP_5kOhm.npy")
#plt.plot(data[0])
#plt.plot(data[1])
# hey ihr! holt euch euren eigenen code!