-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurvature_plot.py
More file actions
59 lines (45 loc) · 1.85 KB
/
curvature_plot.py
File metadata and controls
59 lines (45 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import glob
import pandas as pd
import numpy as np
import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
import h5py
from tierpsy.features.tierpsy_features import get_curvature_features
def curvature_plot_from_tierpsy_features_func():
with h5py.File('./data/jpeg-30s/Results/test_skeletons.hdf5') as f:
skeletons = np.array(f['skeleton'][:504])
segment_curvatures = get_curvature_features(skeletons, 'grad')
print(segment_curvatures)
data = { k: segment_curvatures[k] for k in segment_curvatures.keys() }
df = pd.DataFrame(data=data)
ax = sns.heatmap(df.transpose(), cmap=sns.diverging_palette(220, 20, n=3, as_cmap=True))
plt.show()
def curvature_plot_from_tierpsy_hdf5(hdf5_path):
f = pd.read_hdf(hdf5_path, 'timeseries_data', 'r', columns=[
'curvature_head',
'curvature_neck',
'curvature_midbody',
'curvature_hips',
'curvature_tail',
])
curvature_keys = [
'curvature_head',
'curvature_neck',
'curvature_midbody',
'curvature_hips',
'curvature_tail'
]
data = { k: f[k][:499] for k in curvature_keys }
df = pd.DataFrame(data=data)
ax = sns.heatmap(df.transpose(), center=0.0, cmap=sns.diverging_palette(220, 20, n=3, as_cmap=True))
plt.show()
def curvature_plot_from_taizo_data(csv_path):
f = pd.read_csv(csv_path)
angle_columns = [ 'angle_' + str(i) for i in range(1, 34) ]
data = { k: f[k] for k in angle_columns }
df = pd.DataFrame(data=data)
ax = sns.heatmap(df.transpose(), center=0.0, cmap=sns.diverging_palette(220, 20, n=3, as_cmap=True))
plt.show()
# curvature_plot_from_tierpsy_features_func()
# curvature_plot_from_tierpsy_hdf5('./data/taizo-vs-tierpsy/images/Results/test_featuresN.hdf5')
curvature_plot_from_taizo_data('./data/taizo-vs-tierpsy/temp34HR1.csv')