STATLAB/ListaFunkcji: Różnice pomiędzy wersjami
Z Brain-wiki
(Nie pokazano 10 wersji utworzonych przez jednego użytkownika) | |||
Linia 1: | Linia 1: | ||
− | |||
− | |||
− | ===Macierzowe z pakietu numpy=== | + | ===Biblioteki=== |
+ | [http://docs.scipy.org/doc/numpy/reference/index.html numpy] | ||
+ | |||
+ | [http://docs.scipy.org/doc/scipy-0.16.0/reference/signal.html scipy.signal] | ||
+ | |||
+ | [http://docs.scipy.org/doc/scipy-0.16.0/reference/stats.html scipy.stats] | ||
+ | |||
+ | [https://docs.python.org/2/library/functions.html wbudowane] | ||
+ | |||
+ | ===Lista funkcji=== | ||
+ | ====Matematyczne z pakietu numpy==== | ||
+ | {| class="wikitable" | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.sin.html numpy.sin] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.exp.html numpy.exp] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.log.html numpy.log] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.real.html numpy.real] | ||
+ | |- | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.imag.html numpy.imag] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.conj.html numpy.conj] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.unwrap.html numpy.unwrap] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.angle.html numpy.angle] | ||
+ | |- | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.sqrt.html numpy.sqrt] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.sum.html numpy.sum] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.power.html numpy.power] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.ceil.html numpy.ceil] | ||
+ | |- | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.floor.html numpy.floor] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.round.html numpy.round] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.absolute.html numpy.absolute] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.iinfo.html numpy.iinfo] | ||
+ | |} | ||
+ | |||
+ | ====Macierzowe z pakietu numpy==== | ||
{| class="wikitable" | {| class="wikitable" | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.zeros.html numpy.zeros] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.zeros.html numpy.zeros] | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.ones.html numpy.ones] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.ones.html numpy.ones] | ||
− | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy. | + | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.min.html numpy.ndarray.min] |
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.max.html numpy.ndarray.max] | ||
+ | |- | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.shape.html numpy.ndarray.shape] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.shape.html numpy.ndarray.shape] | ||
− | |||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.reshape.html numpy.reshape] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.reshape.html numpy.reshape] | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html numpy.arange] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html numpy.arange] | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.dot.html numpy.dot] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.dot.html numpy.dot] | ||
+ | |- | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html numpy.where] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html numpy.where] | ||
− | |||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.logical_and.html numpy.logical_and] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.logical_and.html numpy.logical_and] | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.logical_or.html numpy.logical_or] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.logical_or.html numpy.logical_or] | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.hstack.html numpy.hstack] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.hstack.html numpy.hstack] | ||
+ | |- | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.vstack.html numpy.vstack] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.vstack.html numpy.vstack] | ||
− | |||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.concatenate.html numpy.concatenate] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.concatenate.html numpy.concatenate] | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.copy.html numpy.copy] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.copy.html numpy.copy] | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.diff.html numpy.diff] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.diff.html numpy.diff] | ||
+ | |- | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.array.html numpy.array] | ||
+ | | | ||
+ | | | ||
+ | | | ||
|} | |} | ||
− | ===Sygnałowe=== | + | ====Sygnałowe==== |
{| class="wikitable" | {| class="wikitable" | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.fft.html numpy.fft.fft] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.fft.html numpy.fft.fft] | ||
Linia 38: | Linia 75: | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.kaiser.html numpy.kaiser] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.kaiser.html numpy.kaiser] | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.rfft.html numpy.fft.rfft] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.rfft.html numpy.fft.rfft] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.rfftfreq.html numpy.fft.rfftfreq] | ||
+ | |[http://scipy.github.io/devdocs/generated/scipy.signal.periodogram.html scipy.signal.periodogram] | ||
+ | |- | ||
+ | |[http://scipy.github.io/devdocs/generated/scipy.signal.welch.html scipy.signal.welch] | ||
|[http://docs.scipy.org/doc/numpy/reference/generated/numpy.correlate.html numpy.correlate] | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.correlate.html numpy.correlate] | ||
|[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.convolve.html scipy.signal.convolve] | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.convolve.html scipy.signal.convolve] | ||
+ | | | ||
|} | |} | ||
+ | ====Statystyczne==== | ||
+ | {| class="wikitable" | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.mean.html numpy.mean] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.std.html numpy.std] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.scoreatpercentile.html scipy.stats.scoreatpercentile] | ||
+ | |[http://docs.scipy.org/doc/scipy-0.16.0/reference/generated/scipy.stats.norm.html scipy.stats.norm] | ||
+ | |- | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.rand.html numpy.random.rand] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.randn.html numpy.random.randn] | ||
+ | | | ||
+ | | | ||
+ | |} | ||
− | ===Wykresy | + | ====Filtry==== |
+ | {| class="wikitable" | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.firwin.html scipy.signal.firwin] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.firwin2.html scipy.signal.firwin2] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.freqz.html scipy.signal.freqz] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.lfilter.html scipy.signal.lfilter] | ||
+ | |- | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.cheby1.html scipy.signal.cheby1] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.cheby2.html scipy.signal.cheby2] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ellip.html scipy.signal.ellip] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.buttord.html scipy.signal.buttord] | ||
+ | |- | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html scipy.signal.butter] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.cheb1ord.html scipy.signal.cheb1ord] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.cheb2ord.html scipy.signal.cheb2ord] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ellipord.html scipy.signal.ellipord] | ||
+ | |- | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.kaiserord.html scipy.signal.kaiserord] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html scipy.signal.filtfilt] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.decimate.html scipy.signal.decimate] | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | ====Pliki==== | ||
+ | {| class="wikitable" | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.fromfile.html numpy.fromfile] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.tofile.html numpy.ndarray.tofile] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html numpy.loadtxt] | ||
+ | |[http://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html numpy.savetxt] | ||
+ | |- | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.io.wavfile.read.html scipy.io.wavfile.read] | ||
+ | |[http://docs.scipy.org/doc/scipy/reference/generated/scipy.io.wavfile.write.html scipy.io.wavfile.write] | ||
+ | | | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | ====Wykresy Matplotlib==== | ||
http://matplotlib.org/api/pyplot_api.html | http://matplotlib.org/api/pyplot_api.html | ||
− | plot | + | {| |
− | stem | + | |plot |
− | subplot | + | |stem |
− | figure | + | |subplot |
− | imshow | + | |figure |
− | title | + | |- |
− | xlim | + | |imshow |
− | xlab | + | |title |
− | label | + | |xlim |
− | legend | + | |ylim |
− | grid | + | |- |
− | show | + | |xlab |
− | fill_between | + | |ylab |
− | step | + | |label |
+ | |legend | ||
+ | |- | ||
+ | |grid | ||
+ | |show | ||
+ | |fill_between | ||
+ | |step | ||
+ | |} | ||
+ | |||
+ | <!-- | ||
+ | ===Dodatkowe=== | ||
+ | <source lang= python> | ||
+ | import pylab as py | ||
+ | import numpy as np | ||
+ | |||
+ | def sin(f = 1., T = 1., Fs = 128., phi =0. ): | ||
+ | ''' | ||
+ | (float, float, float, float) -> (numpy.ndarray, numpy.ndarray) | ||
+ | sin o zadanej częstości (w Hz), długości, fazie i częstości próbkowania | ||
+ | Domyślnie wytwarzany jest sygnał reprezentujący | ||
+ | 1 sekundę sinusa o częstości 1 Hz i zerowej fazie próbkowanego 128 Hz | ||
+ | Zwraca macierz amplitud i czasu. | ||
+ | ''' | ||
+ | |||
+ | dt = 1.0/Fs | ||
+ | t = np.arange(0,T,dt) | ||
+ | s = np.sin(2*np.pi*f*t + phi) | ||
+ | return (s,t) | ||
+ | |||
+ | def delta(t0=0.5, T=1.0 ,Fs = 128.): | ||
+ | ''' | ||
+ | (float, float, float) -> (numpy.ndarray, numpy.ndarray) | ||
+ | Generowanie funkcji delta. Zwraca macierz amplitud i czasu. | ||
+ | t0: położenie maksimum | ||
+ | T: czas trwania sygnału | ||
+ | Fs: częstość próbkowania | ||
+ | ''' | ||
+ | dt = 1.0/Fs | ||
+ | t = np.arange(0,T,dt) | ||
+ | d = np.zeros(len(t)) | ||
+ | d[np.ceil(t0*Fs)]=1 | ||
+ | return (d,t) | ||
+ | |||
+ | def gabor(f = 1., T = 1., Fs = 128., phi =0., t0 = 0.0, std = 1.0 ): | ||
+ | ''' | ||
+ | (float, float, float, float, float, float) -> (numpy.ndarray, numpy.ndarray) | ||
+ | Generowanie funkcji Gabora. Zwraca macierz amplitud i czasu. | ||
+ | f: częstość oscylacji | ||
+ | T: czas trwania sygnału | ||
+ | Fs: częstość próbkowania | ||
+ | phi: faza | ||
+ | t0: położenie maksimum | ||
+ | std: odchylenie standardowe | ||
+ | ''' | ||
+ | dt = 1.0/Fs | ||
+ | t = np.arange(0,T,dt) | ||
+ | g = np.cos(2*np.pi*f*(t-t0)+phi)*np.exp(-0.5*(t-t0)**2/(std**2)) | ||
+ | return (g, t) | ||
+ | </source> | ||
+ | |||
+ | |||
+ | <source lang = python> | ||
+ | import numpy as np | ||
+ | from numpy.fft import fft, fftfreq, fftshift | ||
+ | |||
+ | def widmo_dB(s, N_fft, F_samp): | ||
+ | ''' | ||
+ | (numpy.ndarray, int, float) -> (numpy.ndarray, numpy.ndarray) | ||
+ | s: sygnał | ||
+ | N_fft: ilość punktów DTF | ||
+ | F_samp: częstość próbkowania | ||
+ | Oblicza widmo mocy w skali decybelowej. Zwraca macierz mocy i częstości | ||
+ | ''' | ||
+ | S = fft(s,N_fft)/np.sqrt(N_fft) | ||
+ | S_dB = 20*np.log10(np.abs(S)) | ||
+ | F = fftfreq(N_fft, 1.0/F_samp) | ||
+ | return (fftshift(S_dB),fftshift(F)) | ||
+ | </source> | ||
+ | --> |
Aktualna wersja na dzień 11:14, 10 lis 2016
Spis treści
Biblioteki
Lista funkcji
Matematyczne z pakietu numpy
numpy.sin | numpy.exp | numpy.log | numpy.real |
numpy.imag | numpy.conj | numpy.unwrap | numpy.angle |
numpy.sqrt | numpy.sum | numpy.power | numpy.ceil |
numpy.floor | numpy.round | numpy.absolute | numpy.iinfo |
Macierzowe z pakietu numpy
Sygnałowe
Statystyczne
numpy.mean | numpy.std | scipy.stats.scoreatpercentile | scipy.stats.norm |
numpy.random.rand | numpy.random.randn |
Filtry
Pliki
numpy.fromfile | numpy.ndarray.tofile | numpy.loadtxt | numpy.savetxt |
scipy.io.wavfile.read | scipy.io.wavfile.write |
Wykresy Matplotlib
http://matplotlib.org/api/pyplot_api.html
plot | stem | subplot | figure |
imshow | title | xlim | ylim |
xlab | ylab | label | legend |
grid | show | fill_between | step |