In [1]:
import smurff.matrix_io as mio
import numpy as np
F = mio.read_matrix("side_c2v.ddm")
F.max(), F.min()
Out[1]:
In [2]:
%matplotlib notebook
import matplotlib.pyplot as plt
import numpy as np
for c in range(10):
plt.hist(F[c,:], log=True, bins = 1000)
plt.title("Histogram c2v")
plt.xlabel("Value")
plt.ylabel("Frequency")
plt.show()
In [37]:
%matplotlib notebook
import matplotlib.pyplot as plt
import numpy as np
Fflat = (F.flatten() - F.min()) / (F.max() - F.min())
#plt.hist(Fflat, range =(-1000,2000), bins = 1000, log = True)
plt.hist(Fflat, bins=1000, log =True)
plt.title("Histogram c2v")
plt.xlabel("Value")
plt.ylabel("Frequency")
plt.show()
In [24]:
F - F.min()
Out[24]:
In [22]:
# convert to fixed point
bits = 8
# convert to 0-1 range
Fpos = F - F.min()
Fnorm = Fpos / Fpos.max()
# convert to 0..2^bits
F_8bit = np.around(Fnorm * (2**bits))
In [24]:
mio.write_matrix("side_c2v_8bit.ddm", F_8bit)
In [26]:
Fpos.min(), Fpos.max(), Fnorm.min(), Fnorm.max(), F_8bit.min(), F_8bit.max()
Out[26]:
In [25]:
(2**bits)
Out[25]:
In [ ]: