xpm read not properly
aspitaleri opened this issue · comments
Hi, the xpm file in attach is converted to ascii file as follow:
from gromacs.formats import XPM
import numpy as np
t = XPM('dm.xpm',reverse=False)
np.savetxt('t1.dat',t.array,delimiter=' ')
but t1.dat has got differences with respect to the original xpm. For instance, the xpm is:
"baXEDA"
"ZYWDAD"
"XWTADE"
and the t1.dat is
3.46 , 3.21 , 2.95, 0.641, 0.385, 0.
3.33 , 3.08 , 2.82 , 0.385, 0. , 0.385
2.95 , 2.82 , 2.44 , 0. , 0.385, 0.641
with the following char map:
"a c #555555 " /* "3.33" /,
"b c #4E4E4E " / "3.46" /,
"W c #6F6F6F " / "2.82" /,
"X c #696969 " / "2.95" /,
"Y c #626262 " / "3.08" /,
"D c #EBEBEB " / "0.385" /,
"E c #E5E5E5 " / "0.513" /,
"F c #DEDEDE " / "0.641" /,"
"A c #FFFFFF " / "0" /,"
"Z c #5C5C5C " / "3.21" /,
"T c #838383 " / "2.44" */,
dm.xpm.txt
basically it is picking the wrong letter-code i some position. In bold the wrong conversion.
Test on 2020.2, 2022.3, 2023_rc1 versions.
Command:
gmx mdmat -s file.tpr -f file.xtc
I was reading the xpm wrongly. Here it is the proper way to read xpm from distances
t=XPM('dm.xpm',reverse=True
)
np.flip(t.array,axis=0)