mailr15446 - in /branches/frame_order_testing: ./ data/ multi/ specific_fns/model_free/


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

Header


Content

Posted by edward on March 07, 2012 - 10:26:
Author: bugman
Date: Wed Mar  7 10:26:29 2012
New Revision: 15446

URL: http://svn.gna.org/viewcvs/relax?rev=15446&view=rev
Log:
Merged revisions 15440-15445 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3

........
  r15440 | bugman | 2012-03-06 14:32:08 +0100 (Tue, 06 Mar 2012) | 11 lines
  
  Bug fix for relax not starting on 32-bit machines.
  
  This was first reported by Hugh Dannatt <h dott dannatt att sheffield dot 
ac dot uk> in the post at
  https://mail.gna.org/public/relax-users/2012-03/msg00011.html.
  
  The numpy.float128 object appears to be missing on 32-bit numpy versions 
(at least on old numpy
  versions).  In such cases, float128 is aliased to float64.  This should 
only affect relax users who
  place special high precision (float128) objects into the relax data store, 
when loading a save file
  with such an object on a 32-bit machine.  This should practically never 
happen!
........
  r15441 | bugman | 2012-03-06 15:15:10 +0100 (Tue, 06 Mar 2012) | 5 lines
  
  Expansion and improvement of the information printed out by 'relax --info'.
  
  A number of details are now taken from the sys module.
........
  r15442 | bugman | 2012-03-06 15:48:22 +0100 (Tue, 06 Mar 2012) | 3 lines
  
  For Unix and GNU/Linux systems, the relax info printout now shows the ram 
and swap size.
........
  r15443 | bugman | 2012-03-06 15:57:04 +0100 (Tue, 06 Mar 2012) | 3 lines
  
  Updated the value.set user function unknown parameter error message to list 
the known ones.
........
  r15444 | bugman | 2012-03-06 17:11:02 +0100 (Tue, 06 Mar 2012) | 3 lines
  
  Added support for the memory size on MS Windows to the relax info print out.
........
  r15445 | bugman | 2012-03-06 18:29:47 +0100 (Tue, 06 Mar 2012) | 3 lines
  
  Updated the multi-processor package __all__ list.
........

Modified:
    branches/frame_order_testing/   (props changed)
    branches/frame_order_testing/arg_check.py
    branches/frame_order_testing/data/relax_xml.py
    branches/frame_order_testing/info.py
    branches/frame_order_testing/multi/__init__.py
    branches/frame_order_testing/specific_fns/model_free/main.py

Propchange: branches/frame_order_testing/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Mar  7 10:26:29 2012
@@ -1,1 +1,1 @@
-/1.3:1-15435
+/1.3:1-15445

Modified: branches/frame_order_testing/arg_check.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/arg_check.py?rev=15446&r1=15445&r2=15446&view=diff
==============================================================================
--- branches/frame_order_testing/arg_check.py (original)
+++ branches/frame_order_testing/arg_check.py Wed Mar  7 10:26:29 2012
@@ -24,11 +24,15 @@
 """Argument checking functions for the relax user functions."""
 
 # Python module imports.
-from numpy import float32, float64, float128, ndarray
+from numpy import float32, float64, ndarray
 try:
     from numpy import float16
-except:
-    float16 = float32
+except ImportError:
+    float16 = float32    # Support for old numpy versions.
+try:
+    from numpy import float128
+except ImportError:
+    float128 = float64    # Support for 32-bit numpy versions.
 
 # relax module imports.
 from relax_errors import RelaxBoolError, RelaxFloatError, 
RelaxFunctionError, RelaxIntError, RelaxIntListIntError, RelaxListFloatError, 
RelaxListIntError, RelaxMatrixFloatError, RelaxNoneFloatError, 
RelaxNoneFunctionError, RelaxListNumError, RelaxListStrError, RelaxNoneError, 
RelaxNoneIntError, RelaxNoneIntListIntError, RelaxNoneListFloatError, 
RelaxNoneListIntError, RelaxNoneMatrixFloatError, RelaxNoneListNumError, 
RelaxNoneListStrError, RelaxNoneNumError, RelaxNoneNumStrListNumStrError, 
RelaxNoneNumTupleNumError, RelaxNoneStrError, RelaxNoneStrFileError, 
RelaxNoneStrListNumError, RelaxNoneStrListStrError, RelaxNumError, 
RelaxNumStrListNumStrError, RelaxNumTupleNumError, RelaxStrError, 
RelaxStrFileError, RelaxStrListNumError, RelaxStrListStrError, 
RelaxTupleError, RelaxTupleNumError

Modified: branches/frame_order_testing/data/relax_xml.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/data/relax_xml.py?rev=15446&r1=15445&r2=15446&view=diff
==============================================================================
--- branches/frame_order_testing/data/relax_xml.py (original)
+++ branches/frame_order_testing/data/relax_xml.py Wed Mar  7 10:26:29 2012
@@ -24,11 +24,15 @@
 """Module containing generic fns for creation and parsing of XML 
representations of python objects."""
 
 # Python module imports.
-from numpy import set_printoptions, array, float32, float64, float128, inf, 
nan
+from numpy import set_printoptions, array, float32, float64, inf, nan
 try:
     from numpy import float16
-except:
-    float16 = float32
+except ImportError:
+    float16 = float32    # Support for old numpy versions.
+try:
+    from numpy import float128
+except ImportError:
+    float128 = float64    # Support for 32-bit numpy versions.
 from re import search
 from string import strip
 

Modified: branches/frame_order_testing/info.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/info.py?rev=15446&r1=15445&r2=15446&view=diff
==============================================================================
--- branches/frame_order_testing/info.py (original)
+++ branches/frame_order_testing/info.py Wed Mar  7 10:26:29 2012
@@ -24,9 +24,14 @@
 """Module containing the introductory text container."""
 
 # Python module imports.
+import ctypes
+if hasattr(ctypes, 'windll'):
+    import ctypes.wintypes
 import numpy
+from os import popen3
 import platform
 from string import split
+import sys
 from textwrap import wrap
 
 # relax module imports.
@@ -302,6 +307,55 @@
         return text
 
 
+    def ram_info(self, format="    %-25s%s\n"):
+        """Return a string for printing to STDOUT with info from the Python 
packages used by relax.
+
+        @keyword format:    The formatting string.
+        @type format:       str
+        @return:            The info string.
+        @rtype:             str
+        """
+
+        # Init.
+        text = ''
+
+        # Unix and GNU/Linux systems.
+        stdin, stdout, stderr = popen3('free -m')
+        free_lines = stdout.readlines()
+        if free_lines:
+            # Extract the info.
+            for line in free_lines:
+                # Split up the line.
+                row = split(line)
+
+                # The RAM size.
+                if row[0] == 'Mem:':
+                    text += format % ("Total RAM size: ", row[1], "Mb")
+
+                # The swap size.
+                if row[0] == 'Swap:':
+                    text += format % ("Total swap size: ", row[1], "Mb")
+
+        # Windows systems (supported by ctypes.windll).
+        if not text and hasattr(ctypes, 'windll'):
+            # Initialise the memory info class.
+            mem = MemoryStatusEx()
+
+            # The RAM size.
+            text += format % ("Total RAM size: ", mem.ullTotalPhys / 
1024.**2, "Mb")
+
+            # The swap size.
+            text += format % ("Total swap size: ", mem.ullTotalVirtual / 
1024.**2, "Mb")
+
+        # Unknown.
+        if not text:
+            text += format % ("Total RAM size: ", "?", "Mb")
+            text += format % ("Total swap size: ", "?", "Mb")
+
+        # Return the info string.
+        return text
+
+
     def sys_info(self):
         """Return a string for printing to STDOUT with info about the 
current relax instance.
 
@@ -313,7 +367,8 @@
         text = self.intro_text()
 
         # Formatting string.
-        format = "    %-25s%s\n"
+        format  = "    %-25s%s\n"
+        format2 = "    %-25s%s %s\n"
 
         # Hardware info.
         text = text + ("\nHardware information:\n")
@@ -321,9 +376,11 @@
             text = text + (format % ("Machine: ", platform.machine()))
         if hasattr(platform, 'processor'):
             text = text + (format % ("Processor: ", platform.processor()))
-
-        # System info.
-        text = text + ("\nSystem information:\n")
+        text = text + (format % ("Endianness: ", sys.byteorder))
+        text = text + self.ram_info(format=format2)
+
+        # OS info.
+        text = text + ("\nOperating system information:\n")
         if hasattr(platform, 'system'):
             text = text + (format % ("System: ", platform.system()))
         if hasattr(platform, 'release'):
@@ -341,8 +398,8 @@
         if hasattr(platform, 'platform'):
             text = text + (format % ("Full platform string: ", 
(platform.platform())))
 
-        # Software info.
-        text = text + ("\nSoftware information:\n")
+        # Python info.
+        text = text + ("\nPython information:\n")
         if hasattr(platform, 'architecture'):
             text = text + (format % ("Architecture: ", 
(platform.architecture()[0] + " " + platform.architecture()[1])))
         if hasattr(platform, 'python_version'):
@@ -353,14 +410,17 @@
             text = text + ((format[:-1]+', %s\n') % ("Python build: ", 
platform.python_build()[0], platform.python_build()[1]))
         if hasattr(platform, 'python_compiler'):
             text = text + (format % ("Python compiler: ", 
platform.python_compiler()))
+        if hasattr(platform, 'libc_ver'):
+            text = text + (format % ("Libc version: ", 
(platform.libc_ver()[0] + " " + platform.libc_ver()[1])))
         if hasattr(platform, 'python_implementation'):
             text = text + (format % ("Python implementation: ", 
platform.python_implementation()))
         if hasattr(platform, 'python_revision'):
             text = text + (format % ("Python revision: ", 
platform.python_revision()))
-        if hasattr(numpy, '__version__'):
-            text = text + (format % ("Numpy version: ", numpy.__version__))
-        if hasattr(platform, 'libc_ver'):
-            text = text + (format % ("Libc version: ", 
(platform.libc_ver()[0] + " " + platform.libc_ver()[1])))
+        if sys.executable:
+            text = text + (format % ("Python executable: ", sys.executable))
+        text = text + (format % ("Python flags: ", sys.flags))
+        text = text + (format % ("Python float info: ", sys.float_info))
+        text = text + (format % ("Python module path: ", sys.path))
 
         # Python packages.
         text = text + self.package_info(format=format)
@@ -374,6 +434,32 @@
 
         # Return the text.
         return text
+
+
+
+class MemoryStatusEx(ctypes.Structure):
+    """Special object for obtaining hardware info in MS Windows."""
+
+    if hasattr(ctypes, 'windll'):
+        _fields_ = [
+            ('dwLength', ctypes.wintypes.DWORD),
+            ('dwMemoryLoad', ctypes.wintypes.DWORD),
+            ('ullTotalPhys', ctypes.c_ulonglong),
+            ('ullAvailPhys', ctypes.c_ulonglong),
+            ('ullTotalPageFile', ctypes.c_ulonglong),
+            ('ullAvailPageFile', ctypes.c_ulonglong),
+            ('ullTotalVirtual', ctypes.c_ulonglong),
+            ('ullAvailVirtual', ctypes.c_ulonglong),
+            ('ullExtendedVirtual', ctypes.c_ulonglong),
+        ]
+
+    def __init__(self):
+        """Set up the information and handle non MS Windows systems."""
+
+        # Get the required info (for MS Windows only).
+        if hasattr(ctypes, 'windll'):
+            self.dwLength = ctypes.sizeof(self)
+            ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(self))
 
 
 

Modified: branches/frame_order_testing/multi/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/multi/__init__.py?rev=15446&r1=15445&r2=15446&view=diff
==============================================================================
--- branches/frame_order_testing/multi/__init__.py (original)
+++ branches/frame_order_testing/multi/__init__.py Wed Mar  7 10:26:29 2012
@@ -1,7 +1,7 @@
 
###############################################################################
 #                                                                            
 #
 # Copyright (C) 2007 Gary S Thompson (https://gna.org/users/varioustoxins)   
 #
-# Copyright (C) 2011 Edward d'Auvergne                                       
 #
+# Copyright (C) 2011-2012 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -103,7 +103,10 @@
 """
 
 
-__all__ = ['commands',
+__all__ = ['api',
+           'commands',
+           'memo',
+           'misc',
            'mpi4py_processor',
            'multi_processor_base',
            'processor_io',

Modified: branches/frame_order_testing/specific_fns/model_free/main.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/specific_fns/model_free/main.py?rev=15446&r1=15445&r2=15446&view=diff
==============================================================================
--- branches/frame_order_testing/specific_fns/model_free/main.py (original)
+++ branches/frame_order_testing/specific_fns/model_free/main.py Wed Mar  7 
10:26:29 2012
@@ -2313,7 +2313,7 @@
 
             # Check if it is a model-free parameter.
             if obj_name not in self.data_names(set='params') and obj_name 
not in self.data_names(set='generic'):
-                raise RelaxError("The parameter '%s' is unknown." % 
mf_params[i])
+                raise RelaxError("The parameter '%s' is unknown.  It should 
be one of %s or %s" % (mf_params[i], self.data_names(set='params'), 
self.data_names(set='generic')))
 
             # Set the parameter.
             for spin in spin_loop(spin_id):




Related Messages


Powered by MHonArc, Updated Wed Mar 07 11:00:01 2012