In [1]:
%matplotlib inline
In [2]:
import h5py
import numpy as np
from sklearn.metrics import explained_variance_score
import matplotlib.pyplot as plt
import seaborn as sns
In [3]:
saved_h5 = h5py.File('sad/saved/sadr.h5', 'r')
saved_sad = saved_h5['SAD'][:].astype('float32')
saved_chr = saved_h5['chr'][:]
saved_h5.close()
saved_sad.shape
Out[3]:
In [4]:
this_h5 = h5py.File('sad/testrm/sad.h5', 'r')
this_sad = this_h5['SAD'][:].astype('float32')
this_chr = this_h5['chr'][:]
this_h5.close()
this_sad.shape
Out[4]:
In [5]:
explained_variance_score(saved_sad.flatten(), this_sad.flatten())
Out[5]:
In [6]:
np.allclose(this_sad, saved_sad, atol=0.2, rtol=0.1)
Out[6]:
In [12]:
np.allclose(saved_sad, this_sad, atol=0.2, rtol=0.2)
Out[12]:
In [ ]:
np.testing.assert_allclose(saved_sad, this_value, atol=2e-1, rtol=1e-1)
In [44]:
ti = np.random.choice(saved_sad.shape[1])
print(ti, np.allclose(saved_sad[:,ti], this_sad[:,ti], atol=1e-3, rtol=1e-3))
sns.scatterplot(saved_sad[:,ti], this_sad[:,ti])
Out[44]:
In [45]:
diff_ti = (saved_sad[:,ti] - this_sad[:,ti])
mean_ti = (saved_sad[:,ti] + this_sad[:,ti]) / 2
sns.scatterplot(mean_ti, diff_ti)
Out[45]:
In [46]:
sns.scatterplot(np.arcsinh(saved_sad[:,ti]), np.arcsinh(this_sad[:,ti]))
Out[46]:
In [18]:
diff = (saved_sad - this_sad).flatten()
print(diff.max())
max_where = np.where(diff >= diff.max()*0.99)[0]
max_where
Out[18]:
In [19]:
saved_sad.flatten()[max_where[0]], this_sad.flatten()[max_where[0]]
Out[19]:
In [12]:
ldiff = (np.arcsinh(saved_sad) - np.arcsinh(this_sad)).flatten()
print(ldiff.max())
np.where(ldiff >= ldiff.max()*0.9)
Out[12]:
In [13]:
saved_sad.flatten()[17452], this_sad.flatten()[17452]
Out[13]:
In [ ]: