forked from tdamdouni/Pythonista
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPSD.py
More file actions
22 lines (16 loc) · 618 Bytes
/
PSD.py
File metadata and controls
22 lines (16 loc) · 618 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# coding: utf-8
# https://github.com/Klabbedi/PSD
# https://forum.omz-software.com/topic/3393/why-do-i-get-diffrent-graphs-running-this-code-with-python-2-7-or-3-5
import console
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as ml
# console.clear()
file_name = 'wc-cent-2.npy'
data = np.load(file_name)
fig_mag = plt.figure()
plt.psd(data[:, 0], NFFT=256, Fs=80, window=ml.window_hanning, detrend = ml.detrend_none, scale_by_freq = True, noverlap = 0, pad_to = None, sides = 'onesided')
plt.xlabel('Frequency (Hz)')
plt.ylabel('Power/Frequency (dB/Hz)')
plt.title('PSD X')
plt.show()