mailRe: Import matplotlib in relax


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on October 21, 2013 - 14:51:
Hi,

This is clearly a bug in the matplotlib module.  And, wow, that's a
fatal one!  There is really absolutely nothing we can do about that.
We should catch this in the dep_check module.  This matplotlib module
would be an optional module.  So clearly in this case, the
matplotlib_module flag would be set to False.  Maybe the text of this
error could be caught and stored in this module, and then presented to
the user when they call the matplotlib user functions.

Note that we should discuss where such code will go.  I would suggest
that it be made generic - i.e. it follows the structure and ideas of
the Grace code.  And then most development would consist of using an
'svn cp' command to duplicate the grace code which is then morphed
into the matplotlib code.  The exception would be the dump of your
code into a new lib.plotting package.  This would also be the fastest
way.  Then we could create a new branch from the relax trunk for such
developments.  This way neither the relax trunk nor the relax_disp
branch need to wait for the development of this feature.

Regards,

Edward



On 21 October 2013 14:38, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:
Hi Edward.

The errors I get is written below:
I don't know if it is a packaging error, or if it is related to relax?
But it seems weird, and I would just like to hear if you have the same
error. :-)

Best
Troels

relax> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/matplotlib/pyplot.py", line 6, in
<module>
    from matplotlib.figure import Figure, figaspect
  File "/usr/lib64/python2.6/site-packages/matplotlib/figure.py", line 18,
in <module>
    from axes import Axes, SubplotBase, subplot_class_factory
  File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 17, in
<module>
    import matplotlib.dates as mdates
  File "/usr/lib64/python2.6/site-packages/matplotlib/dates.py", line 104,
in <module>
    from dateutil.rrule import rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, \
  File "/usr/lib/python2.6/site-packages/dateutil/rrule.py", line 26, in
<module>
    MDAY366MASK =
tuple(M31+M29+M31+M30+M31+M30+M31+M31+M30+M31+M30+M31+M31[:7])
TypeError: unsupported operand type(s) for +: 'xrange' and 'xrange'
relax>

########################3
[tlinnet@haddock ~]$ relax_disp -i



                                  relax repository checkout rNone
                                                None

                              Molecular dynamics by NMR data analysis

                             Copyright (C) 2001-2006 Edward d'Auvergne
                         Copyright (C) 2006-2013 the relax development team

This is free software which you are welcome to modify and redistribute under
the conditions of the
GNU General Public License (GPL).  This program, including all modules, is
licensed under the GPL
and comes with absolutely no warranty.  For details type 'GPL' within the
relax prompt.

Assistance in using the relax prompt and scripting interface can be accessed
by typing 'help' within
the prompt.

Processor fabric:  Uni-processor.


Hardware information:
    Machine:                 x86_64
    Processor:               x86_64
    Endianness:              little
    Total RAM size:          24013 Mb
    Total swap size:         26191 Mb

Operating system information:
    System:                  Linux
    Release:                 2.6.32-358.18.1.el6.x86_64
    Version:                 #1 SMP Fri Aug 2 17:04:38 EDT 2013
    GNU/Linux version:       Red Hat Enterprise Linux Server 6.4 Santiago
    Distribution:            redhat 6.4 Santiago
    Full platform string:
Linux-2.6.32-358.18.1.el6.x86_64-x86_64-with-redhat-6.4-Santiago

Python information:
    Architecture:            64bit ELF
    Python version:          2.6.6
    Python branch:           tags/r266
    Python build:            r266:84292, May 27 2013 05:35:12
    Python compiler:         GCC 4.4.7 20120313 (Red Hat 4.4.7-3)
    Libc version:            glibc 2.2.5
    Python implementation:   CPython
    Python revision:         84292
    Python executable:       /usr/bin/python
    Python flags:            sys.flags(debug=0, py3k_warning=0,
division_warning=0, division_new=0, inspect=0, interactive=0, optimize=0,
dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0,
tabcheck=0, verbose=0, unicode=0, bytes_warning=0, hash_randomization=0)
    Python float info:       sys.floatinfo(max=1.7976931348623157e+308,
max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021,
min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.2204460492503131e-16,
radix=2, rounds=1)
    Python module path:      ['/sbinlab2/software/NMR-relax/relax_disp',
'/sbinlab2/software/CCP4-Linux_6.3.0/ccp4-6.3.0/share/python',
'/sbinlab2/tlinnet', '/sbinlab2/software/x64/haddock2.1',
'/sbinlab2/software/x64/lib64/python2.6/site-packages',
'/sbinlab2/software/x64/ccpnmr/ccpnmr2.3/python', '/usr/lib64/python26.zip',
'/usr/lib64/python2.6', '/usr/lib64/python2.6/plat-linux2',
'/usr/lib64/python2.6/lib-tk', '/usr/lib64/python2.6/lib-old',
'/usr/lib64/python2.6/lib-dynload', '/usr/lib64/python2.6/site-packages',
'/usr/lib64/python2.6/site-packages/gst-0.10',
'/usr/lib64/python2.6/site-packages/gtk-2.0',
'/usr/lib64/python2.6/site-packages/webkit-1.0',
'/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode',
'/usr/lib/python2.6/site-packages',
'/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info']

Python packages and modules (most are optional):

Name               Installed    Version                    Path
minfx              True         1.0.5
/usr/lib/python2.6/site-packages/minfx
bmrblib            True         1.0.3
/usr/lib/python2.6/site-packages/bmrblib
numpy              True         1.4.1
/usr/lib64/python2.6/site-packages/numpy
scipy              True         0.7.2
/usr/lib64/python2.6/site-packages/scipy
wxPython           True         2.8.12.0 (gtk2-unicode)
/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/wx
mpi4py             True         1.3.1
/usr/lib64/python2.6/site-packages/mpi4py
epydoc             False
optparse           True         1.5.3
/usr/lib64/python2.6/optparse.pyc
readline           True
/usr/lib64/python2.6/lib-dynload/readline.so
profile            True
/usr/lib64/python2.6/profile.pyc
bz2                True
/usr/lib64/python2.6/lib-dynload/bz2.so
gzip               True
/usr/lib64/python2.6/gzip.pyc
io                 True
/usr/lib64/python2.6/io.pyc
xml                True         0.8.4 (PyXML)
/usr/lib64/python2.6/site-packages/_xmlplus/__init__.pyc
xml.dom.minidom    True
/usr/lib64/python2.6/site-packages/_xmlplus/dom/minidom.pyc

relax information:
    Version:                 repository checkout
    Processor fabric:        Uni-processor.

relax C modules:

Module                        Compiled    File type
Path
target_functions.relax_fit    True        ELF 64-bit LSB shared object,
x86-64, version 1 (SYSV), dynamically linked, not stripped
/sbinlab2/software/NMR-relax/relax_disp/target_functions/relax_fit.so

##########################################



2013/10/18 Edward d'Auvergne <edward@xxxxxxxxxxxxx>

Hi Troels,

It should be possible to get your matplotlib plotting code into the
relax library, just as the Grace plotting code is.  The Grace code is
at lib/software/grace.py.  Maybe I should create a new package called
lib.plotting and shift the Grace module there?  Then all the plotting
modules - grace, opendx, matplotlib, gnuplot, etc. - can sit together.
 New user functions can be created by copying user_functions.grace and
pipe_control.grace to user_functions.matplotlib and
pipe_control.matplotlib.  The pipe_control.matplotlib module simply
assembles the data from the relax data store and passes it into
lib.software.matplotlib for plotting.

As for the import error, could you copy and paste the full message?
This is not normal and it could have something to do with different
Python versions being used by relax and when you type 'python'.  Could
you run 'relax -i' and check that the Python binaries are identical?
Cheers.  It should be possible to have this running!

Regards,

Edward



On 18 October 2013 09:25, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx>
wrote:
Hi Edward.

I am trying to plot some custom made graphs via matplotlib in relax.

Basically, I extract the r2 values for each spin, and plot them.

But I get a package error when I do

import matplotlib.pyplot as plt

It is a dateutil error? And I am not able to pinpoint the error.

I have checked that I can do the import in my normal python
installation.

My current solution is to extract the wanted values from relax into a
dictionary, and dump the dictionary in json format.

Then make a normal python script, that reads the json dictionary, and
plot
the values.

I would be interested to hear if you have the same problem importing
matplotlib in relax, or if it is only my setup?

Can this be fixed?

Another solution could be to open a dumped relax saved state in a python
section and run through the data.
Is it possible to do this?

Best
Troels


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-devel mailing list
relax-devel@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel






Related Messages


Powered by MHonArc, Updated Mon Oct 21 15:20:13 2013