mailr27127 - in /trunk/lib/plotting: __init__.py api.py


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

Header


Content

Posted by edward on December 18, 2014 - 12:05:
Author: bugman
Date: Thu Dec 18 12:05:07 2014
New Revision: 27127

URL: http://svn.gna.org/viewcvs/relax?rev=27127&view=rev
Log:
Created the lib.plotting API function correlation_matrix().

This is the lib.plotting.api.correlation_matrix() function.  It will be used 
for the visualisation
of rank-2 correlation matrices.  The current basic API design here uses a 
dictionary of backend
functions (currently empty) for calling the backend.


Added:
    trunk/lib/plotting/api.py
Modified:
    trunk/lib/plotting/__init__.py

Modified: trunk/lib/plotting/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/plotting/__init__.py?rev=27127&r1=27126&r2=27127&view=diff
==============================================================================
--- trunk/lib/plotting/__init__.py      (original)
+++ trunk/lib/plotting/__init__.py      Thu Dec 18 12:05:07 2014
@@ -22,5 +22,7 @@
 # Package docstring.
 """The relax library plotting package - a library of functions for plotting 
data via different software packages."""
 
+# The package content list.
 __all__ = [
+    'api'
 ]

Added: trunk/lib/plotting/api.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/plotting/api.py?rev=27127&view=auto
==============================================================================
--- trunk/lib/plotting/api.py   (added)
+++ trunk/lib/plotting/api.py   Thu Dec 18 12:05:07 2014
@@ -0,0 +1,53 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2014 Edward d'Auvergne                                       
 #
+#                                                                            
 #
+# This file is part of the program relax (http://www.nmr-relax.com).         
 #
+#                                                                            
 #
+# This program is free software: you can redistribute it and/or modify       
 #
+# it under the terms of the GNU General Public License as published by       
 #
+# the Free Software Foundation, either version 3 of the License, or          
 #
+# (at your option) any later version.                                        
 #
+#                                                                            
 #
+# This program is distributed in the hope that it will be useful,            
 #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
+# GNU General Public License for more details.                               
 #
+#                                                                            
 #
+# You should have received a copy of the GNU General Public License          
 #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.      
 #
+#                                                                            
 #
+###############################################################################
+
+# Module docstring.
+"""The relax library plotting API."""
+
+# relax module imports.
+from lib.errors import RelaxError
+
+
+def correlation_matrix(format=None, matrix=None, labels=None, file=None, 
dir=None, force=False):
+    """Plotting API function for representing correlation matrices.
+
+    @keyword format:    The specific backend to use.
+    @type format:       str
+    @keyword matrix:    The correlation matrix.  This must be a square 
matrix.
+    @type matrix:       numpy rank-2 array.
+    @keyword labels:    The labels for each element of the matrix.  The same 
label is assumed for each [i, i] pair in the matrix.
+    @type labels:       list of str
+    @keyword file:      The name of the file to create.
+    @type file:         str
+    @keyword dir:       The directory where the PDB file will be placed.  If 
set to None, then the file will be placed in the current directory.
+    @type dir:          str or None
+    """
+
+    # The supported formats.
+    function = {
+    }
+
+    # Unsupported format.
+    if format not in function:
+        raise RelaxError("The plotting of correlation matrix data using the 
'%s' format is not supported." % format)
+
+    # Call the backend function.
+    function[format](matrix=matrix, labels=labels, file=file, dir=dir, 
force=force)




Related Messages


Powered by MHonArc, Updated Thu Dec 18 12:20:03 2014