Hi, Thanks for debugging this. I can reproduce the bug by starting pymca with
LANG=de_DE.UTF-8 pymca Interestingly, instantiating QApplication class makes the scanf call in the specfile module use the locale-based numeric format. See the attached testcase. The quick and dirty fix would be to add the line export LC_NUMERIC=C as a second or third line to /usr/bin/pymca But, there is probably a smarter way to fix this. Best, Teemu 2010/11/5 PICCA Frédéric-Emmanuel <frederic-emmanuel.pi...@synchrotron-soleil.fr>: > hello so I am investigating > > if I put print ElementL1ShellValues in the LShell.py > > here the output of the last lines > > from PyMca import LShell > > ... > [100.0, 2.5339999999999998, 17.536000000000001, 0.047, 0.59299999999999997, > 0.216], [101.0, 2.5339999999999998, 17.536000000000001, 0.047, > 0.59299999999999997, 0.216], [102.0, 2.5339999999999998, 17.536000000000001, > 0.047, 0.59299999999999997, 0.216], [103.0, 2.5339999999999998, > 17.536000000000001, 0.047, 0.59299999999999997, 0.216], [104.0, > 2.5339999999999998, 17.536000000000001, 0.047, 0.59299999999999997, 0.216], > [105.0, 2.5339999999999998, 17.536000000000001, 0.047, 0.59299999999999997, > 0.216], [106.0, 2.5339999999999998, 17.536000000000001, 0.047, > 0.59299999999999997, 0.216], [107.0, 2.5339999999999998, 17.536000000000001, > 0.047, 0.59299999999999997, 0.216], [108.0, 2.5339999999999998, > 17.536000000000001, 0.047, 0.59299999999999997, 0.216], [109.0, > 2.5339999999999998, 17.536000000000001, 0.047, 0.59299999999999997, 0.216]] > > with pymca > > [100.0, 2.0, 17.0, 0.0, 0.0, 0.0], [101.0, 2.0, 17.0, 0.0, 0.0, 0.0], [102.0, > 2.0, 17.0, 0.0, 0.0, 0.0], [103.0, 2.0, 17.0, 0.0, 0.0, 0.0], [104.0, 2.0, > 17.0, 0.0, 0.0, 0.0], [105.0, 2.0, 17.0, 0.0, 0.0, 0.0], [106.0, 2.0, 17.0, > 0.0, 0.0, 0.0], [107.0, 2.0, 17.0, 0.0, 0.0, 0.0], [108.0, 2.0, 17.0, 0.0, > 0.0, 0.0], [109.0, 2.0, 17.0, 0.0, 0.0, 0.0]] > > as you can see it seems that from pymca the imported values are rounded to > int values. > > and this is not true without. > > so the problem comes from this code: > > sf=specfile.Specfile(os.path.join(dirname, "LShellConstants.dat")) > ElementL1ShellConstants = sf[0].alllabels() > ElementL2ShellConstants = sf[1].alllabels() > ElementL3ShellConstants = sf[2].alllabels() > ElementL1ShellValues = Numeric.transpose(sf[0].data()).tolist() > > > sf[0].data() gives > > [ 100. 2. 17. 0. 0. 0.] > [ 101. 2. 17. 0. 0. 0.] > [ 102. 2. 17. 0. 0. 0.] > [ 103. 2. 17. 0. 0. 0.] > [ 104. 2. 17. 0. 0. 0.] > [ 105. 2. 17. 0. 0. 0.] > [ 106. 2. 17. 0. 0. 0.] > [ 107. 2. 17. 0. 0. 0.] > [ 108. 2. 17. 0. 0. 0.] > [ 109. 2. 17. 0. 0. 0.]] > > so the problem is in the specfile module. > (c module it seems) > > In fact if I start the program with > LANG=C pymca it works. > > probably a ',' or '.' problem during double conversion. > > See you > > Frederic > > > > > -------- Message d'origine-------- > De: > debian-science-maintainers-bounces+picca=synchrotron-soleil...@lists.alioth.debian.org > de la part de PICCA Frédéric-Emmanuel > Date: ven. 05/11/2010 19:39 > À: Teemu Ikonen > Cc: 602...@bugs.debian.org > Objet : Bug#602471: RE : Bug#602471: pymca: package unusable > >> The data file is ok, and importing the offending module works with the >> standard interpreter, so the bug is most likely somehow related to >> your environment. > > I reproduced this bug on two differents systems (unstable) > >> Or alternatively, something in my environment >> prevents this bug from appearing. > >> Unless you or someone else can provide more information, it will be >> difficult to fix this. > > or maybe the modules loaded before LShell has some side effect on the > LSHell module > > I will try to investigate. > > See you > > Frred > > > > -- > debian-science-maintainers mailing list > debian-science-maintain...@lists.alioth.debian.org > http://lists.alioth.debian.org/mailman/listinfo/debian-science-maintainers > >
import sys import PyQt4.QtGui as qt import PyMca.specfile as specfile sf1 = specfile.Specfile("/usr/share/pyshared/PyMca/LShellConstants.dat") dd1 = sf1[0].data() app = qt.QApplication([]) sf2 = specfile.Specfile("/usr/share/pyshared/PyMca/LShellConstants.dat") dd2 = sf2[0].data() print(dd1[:,100]) print(dd2[:,100])