Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XPM reader does not handle multiple frames #14

Open
synapticarbors opened this issue Feb 19, 2013 · 2 comments
Open

XPM reader does not handle multiple frames #14

synapticarbors opened this issue Feb 19, 2013 · 2 comments

Comments

@synapticarbors
Copy link

In attempting to read an .xpm file generated by g_mdmat with the -frames flag, the xpm reader fails with the error:

    216                 s = self.unquote(line)
--> 217                 data[:, iy] = [colors[s[k:k+nb]] for k in xrange(0,nx,nb)]
    218                 self.logger.debug("read row %d with %d columns: '%s....%s'",
    219                                   iy, data.shape[0], s[:4], s[-4:])

KeyError: ' ' 

The xpm reader should probably detect multi-frame files, and either stack them into a 3D numpy array, or fail gracefully with an output to the reader that only single frames can be read.

I'm going to take a crack at proper handling of multi-frame files and will submit a pull request when I get it working.

@orbeckst
Copy link
Member

Ok, I'd be happy to integrate a patch!

@orbeckst
Copy link
Member

Joao M. Damas suggested on gmx-users (24 Oct 2014) numerical matrix from xpm file that the next line should read:

data[:, iy]  =  [colors[j[k:k+nb]] for k in range(0,nx*nb,nb)]

"if one is using higher -nlevels for the .xpm construction (in g_rms, for example)"

Someone would need to test it.

(I just found the above comment in the source code and added it to the issue tracker so that it does not get forgotten completely.)

@orbeckst orbeckst added the bug label Nov 30, 2015
@orbeckst orbeckst added enhancement and removed bug labels Aug 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants