add visualise.py, update readme.md
This commit is contained in:
parent
a01e63d2a8
commit
102454e6e1
@ -1,6 +1,7 @@
|
||||
# p2
|
||||
|
||||
this is a Go subproject containing code for task no. 2.
|
||||
Python is used for visualisation.
|
||||
|
||||
### compile
|
||||
```sh
|
||||
|
BIN
p2/res/signal_u.png
Normal file
BIN
p2/res/signal_u.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 115 KiB |
BIN
p2/res/signal_y.png
Normal file
BIN
p2/res/signal_y.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 105 KiB |
BIN
p2/res/uy-correlation-analysis.png
Normal file
BIN
p2/res/uy-correlation-analysis.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
43
p2/visualise.py
Normal file
43
p2/visualise.py
Normal file
@ -0,0 +1,43 @@
|
||||
import seaborn as sb
|
||||
import pandas as pd
|
||||
import scipy
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
data_uy=pd.read_csv('data/m.csv')
|
||||
# head(data_uy)
|
||||
|
||||
correlation_result=scipy.stats.pearsonr(data_uy['u'], data_uy['y'])
|
||||
print(correlation_result)
|
||||
|
||||
p = sb.lmplot(
|
||||
data=data_uy,
|
||||
x='u',
|
||||
y='y',
|
||||
fit_reg=True,
|
||||
height=8,
|
||||
)
|
||||
p.set(title='Correlation UY')
|
||||
p.savefig('res/uy-correlation-analysis.png')
|
||||
plt.clf()
|
||||
|
||||
lp = sb.lineplot(data=data_uy['u'])
|
||||
lp.set(
|
||||
title='Signal u',
|
||||
xlabel='samples',
|
||||
ylabel='u',
|
||||
)
|
||||
fig = lp.get_figure()
|
||||
fig.subplots_adjust(top=.97)
|
||||
fig.savefig('res/signal_u.png')
|
||||
plt.clf()
|
||||
|
||||
lp = sb.lineplot(data=data_uy['y'])
|
||||
lp.set(
|
||||
title='Signal y',
|
||||
xlabel='samples',
|
||||
ylabel='y',
|
||||
)
|
||||
fig = lp.get_figure()
|
||||
fig.subplots_adjust(top=.97)
|
||||
fig.savefig('res/signal_y.png')
|
||||
plt.clf()
|
Loading…
Reference in New Issue
Block a user