QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: svollebregt on December 4, 2009, 16:11

Title: Strange GUI behaviour
Post by: svollebregt on December 4, 2009, 16:11
When following some of the available tutorials for VNL 2008.10 I came across several strange things that are happening in the VNL GUI:
1. I use a dual-screen setup on my Linux system, and somehow VNL doesn't correctly detect my screen size and makes the fonts huge. This really scrambles the VNL GUI. It doesn't prevent one from working with the program, but it is rather annoying. Is there something that can be done to make VNL detect my display settings correctly? Or is this a nVidia bug.
2. I did part of the graphene tutorial form the website and when I display the results from the transmission spectrum in the result browser the figure is horrible. The transmission axis only runs from 0 to 1, while the actual transmission can be as large as 4 as indicated in the tutorial. Is there a way to rescale the plot? All that the result browser seems to allow is zooming in and out... which is rather limited. Is there a way to expert the plot data so that I can edit it in, say, SigmaPlot?

Some system details:
openSUSE 11.2 x86-64 running KDE 4.3.1
nVidia twinview

See the attached image for a screenshot of the program.
Title: Re: Strange GUI behaviour
Post by: Anders Blom on December 4, 2009, 16:48
Not sure what to do about the font size... can only hope it's solved in VNL 2009.11.

As for zooming, you can always zoom (in) by drawing a rectangle with the mouse. So, zoom out until all the data is visible, then zoom in on the area you want.

You can always export the data by either taking it from the log file, although sometimes it has a bit too few decimals; see this post (http://quantumwise.com/forum/index.php?topic=103.msg487#msg487) regarding how to get around that. In 2009.11 we have improved the export capabilities quite a bit, you can export data from a plot directly.
Title: Re: Strange GUI behaviour
Post by: svollebregt on December 7, 2009, 11:36
Not sure what to do about the font size... can only hope it's solved in VNL 2009.11.
It is :).
Title: Re: Strange GUI behaviour
Post by: Nordland on December 7, 2009, 14:45
If you tell me your system, I might be able to tell you how to set the font size manually.

It will use the global Qt-fontsize, and this is possible to set in most linux systems.
Title: Re: Strange GUI behaviour
Post by: svollebregt on December 7, 2009, 16:23
What exactly do you need to know for this?

I'm using the openSUSE 11.2 64 bit distribution, with a 2.6.31.5 kernel and KDE 4.3.1. The system is a 3 GHz Core 2 Duo E8400 with 4 GB memory and nVidia Quadro FX1700 videocard.
Title: Re: Strange GUI behaviour
Post by: svollebregt on December 8, 2009, 17:13
I've found a new issue. When I try to use the pylab package to create figures from the graphene tutorial for ATK2009.11 it appears that the default backend (agg) doesn't support the show() command. However, when I try to switch to another backend it seems that only the agg backend is installed in the nlpython distribution. Is there a way to add for instance pyGTK or pyQt to the python distribution used in ATK2009.11 to enable the pylab.show() command? Or is there already a working backend available which does this?
Title: Re: Strange GUI behaviour
Post by: Anders Blom on December 8, 2009, 17:28
Works for me (Ubuntu 9.10).

Might depend on precisely what you're trying to do. Try this:

Code
import pylab as P
P.figure()
P.show()

just to see if you get a blank plot window. If you do, all should be ok, actually.

Title: Re: Strange GUI behaviour
Post by: svollebregt on December 9, 2009, 09:52
First two command give no errors, the output of the second is <maptplotlin.figure.Figure object as 0x1612510>

However after executing the P.show() command I get the following error:
Code
/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/backends/__init__.py:41: UserWarning:
Your currently selected backend, 'agg' does not support show().
Please select a GUI backend in your matplotlibrc file ('/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/mpl-data/matplotlibrc')
or with matplotlib.use()

If I now try another backend, for instance Qt4Agg I get the error that Qt4 libraries should be installed. They are installed for my local Python distribution, but VNL seems to use its own.
Title: Re: Strange GUI behaviour
Post by: Anders Blom on December 9, 2009, 10:22
Yes, ATK uses its own Qt, you cannot (and must not) use some other Qt with ATK.

agg is really just for piping the output to a file, so it will not work with show() (although it shouldn't give error messages, just not do anything).

The backend to use for show() is TkAgg. On my Ubuntu that seems to work as default, but perhaps you can try

Code
import matplotlib as mpl
mpl.use('TkAgg')
import pylab as P
P.figure()
P.show()

If it doesn't work, please post the exact error message.

ATK comes with all backends provided, so it's not a matter that they are missing; check the contents of atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/backend. However, most of them require additional packages, so only TkAgg and Agg (and pdf, ps, svg and other file format exports) are enabled out of the box.

Make sure you haven't modified any files in the installation tree. Also, there might be some conflict with environment variables...
Title: Re: Strange GUI behaviour
Post by: Anders Blom on December 9, 2009, 10:24
If you edited the matplotlibrc file, please restore it from the installation package.
Title: Re: Strange GUI behaviour
Post by: svollebregt on December 9, 2009, 11:54
It now gives an error after the import pylab command:
Code
>>> import matplotlib as mpl
>>> mpl.use('TkAgg')
>>> import pylab as P
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./build/nlpython/lib/python2.6/site-packages/pylab.py", line 1, in <module>
  File "./build/nlpython/lib/python2.6/site-packages/matplotlib/pylab.py", line 247, in <module>
  File "./build/nlpython/lib/python2.6/site-packages/matplotlib/pyplot.py", line 78, in <module>
  File "./build/nlpython/lib/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
  File "./build/nlpython/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 7, in <module>
  File "./build/nlpython/lib/python2.6/lib-tk/Tkinter.py", line 39, in <module>
ImportError: No module named _tkinter
Title: Re: Strange GUI behaviour
Post by: Anders Blom on December 9, 2009, 12:17
Let me double-check a few things.

Do you have the 2009.11.1 package (and not 2009.11)?

What does locate _tkinter give, when executed in $HOME?
Title: Re: Strange GUI behaviour
Post by: svollebregt on December 9, 2009, 15:35
It is the 11.1 package.

The locate command returns this:
Code
/home/sten/bin/VNL/vnl-2008.10.0/atk/lib/python2.4/lib-dynload/_tkinter.so
/windows/C/Program Files/Corel/Corel Paint Shop Pro X/Python Libraries/DLLs/_tkinter.pyd
/windows/C/Program Files/Scribus 1.3.3.13/dlls/_tkinter.pyd

I checked the tarball to check if I didn't delete the file accidentally and couldn't find the file _tkinter.so in it.
Title: Re: Strange GUI behaviour
Post by: Anders Blom on December 9, 2009, 15:48
There should be a _tkinter.so in atk-2009.11/nlpython/lib/python2.6/lib-dynload (and one in atk-2009.11/vnl/lib/python2.6/lib-dynload too). But I can verify that it's missing from the 64-bit package! Ouch...!

I'll see how quickly we can fix this. For now, you can use the 32-bit package instead; only difference is really performance, and it's not critical for the tutorial examples.

Sorry!
Title: Re: Strange GUI behaviour
Post by: svollebregt on December 9, 2009, 17:46
Okay, new problem when using the 32 bit version. The file is found, but now ATK searches for the tcl/tk system. I installed this using YAST, however the current release is version 8.5. As the shared libraries ATK uses are hard coded it searches for libtk8.4.so.0... which of course doesn't exist as the current tcl/tk release is at 8.5. So far my attempts to get tcl/tk 8.4 working under openSUSE have not been successful... is there a way to tell ATK that it has to look for version 8.5?
Title: Re: Strange GUI behaviour
Post by: Nordland on December 9, 2009, 18:54
I think the best way for solving this issue for you is by doing the following:

1) Since nlpython is almost normal python, you can go http://matplotlib.sourceforge.net/ and download the latest version of matplotlib.
2) Untar this file, and install it by writing nlpython setup.py install
3) Then it will automatically use the environment you have on your machine, and the problem should be solved.
Title: Re: Strange GUI behaviour
Post by: svollebregt on December 10, 2009, 10:13
I did this in the 32 bit version (as the 64 bit is missing a file). Install was successful, however, apparently the 32 bit and 64 bit versions of some shared libs were mixed up. Now I get the following error:
Code
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/pylab.py", line 206, in <module>
    from matplotlib import mpl  # pulls in most modules
  File "/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/mpl.py", line 1, in <module>
    from matplotlib import artist
  File "/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/artist.py", line 5, in <module>
    from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
  File "/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/transforms.py", line 34, in <module>
    from matplotlib._path import affine_transform
ImportError: /home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/_path.so: wrong ELF class: ELFCLASS64
Title: Re: Strange GUI behaviour
Post by: Anders Blom on December 10, 2009, 10:25
Yikes!

We're going to look into this and return with a solution.

Thanks for your patience, we apologize for the inconvenience.
Title: Re: Strange GUI behaviour
Post by: Anders Blom on December 10, 2009, 13:11
Just to double-check, for safety: did you completely remove the atk-2009.11 directory before installing the 32-bit version? Otherwise, this kind of mixup can easily happen. Then try to install matplotlib, the 32-bit version, inside the fresh 32-bit ATK install.

Title: Re: Strange GUI behaviour
Post by: svollebregt on December 11, 2009, 14:50
Not removed, but I renamed the old 64 bit directory and extracted the 32 bit in a different one. I tried to install the matplotlib in both the 32 bit version and 64 bit version with IIRC a rebuild of matplotlib inbetween. In case of the 64 bit version installation went successful, but still the tkinter library was missing, in the 32 bit version I ended up with this error.
Title: Re: Strange GUI behaviour
Post by: Anders Blom on December 12, 2009, 22:55
So it might be your matplotlib build that has the mixed 64 and 32 bit libraries? Try to make it very clean:

1. Remove all - everything, ATK and matplotlib source and build
2. Install ATK 32-bit

If not working, try to install matplotlib into it.
Title: Re: Strange GUI behaviour
Post by: svollebregt on December 14, 2009, 17:06
Ok I removed all instances of ATK I had and reinstalled the 32 bit version. I also deleted the matplotlib build directory. Aagain I get the error that
libtk8.4.so.0. so I try to install matplotlib again from a clean source dir. When I now run nlpython setup.py build I get the following error:
Code
/home/sten/bin/VNL/atk-2009.11/nlpython/include/python2.6/pyport.h:685:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
In file included from /usr/include/c++/4.4/ext/hash_map:59,
                 from ./CXX/Extensions.hxx:68,
                 from src/ft2font.h:4,
                 from src/ft2font.cpp:1:

I checked and I have the available 32 bit versions installed for the matplotlib required packages. I also have the 32 bit version of the gcc and glibc compiler.
Title: Re: Strange GUI behaviour
Post by: Anders Blom on December 14, 2009, 18:37
Ah, this seems logical. I think my advise should have been getting the 64-bit version of ATK. Sorry!
Title: Re: Strange GUI behaviour
Post by: svollebregt on December 15, 2009, 15:57
But when I install matplotlib in the 64 bit version I still end up in getting the _tkinter error because the file is missing when I select TkAgg as backend.
Title: Re: Strange GUI behaviour
Post by: Nordland on December 15, 2009, 16:54
Do you use the Gnome or KDE front end for the OpenSuse?
Title: Re: Strange GUI behaviour
Post by: svollebregt on December 15, 2009, 17:11
KDE.
Title: Re: Strange GUI behaviour
Post by: Anders Blom on December 17, 2009, 17:54
But Agg should work, or?