mailr23082 - in /trunk: lib/software/opendx/files.py pipe_control/opendx.py


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

Header


Content

Posted by tlinnet on May 08, 2014 - 14:40:
Author: tlinnet
Date: Thu May  8 14:40:23 2014
New Revision: 23082

URL: http://svn.gna.org/viewcvs/relax?rev=23082&view=rev
Log:
Made multiple writing of point files.

task #7791: (https://gna.org/task/index.php?7791 ) the dx.map should accept a 
list of list with values for points.

Modified:
    trunk/lib/software/opendx/files.py
    trunk/pipe_control/opendx.py

Modified: trunk/lib/software/opendx/files.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/software/opendx/files.py?rev=23082&r1=23081&r2=23082&view=diff
==============================================================================
--- trunk/lib/software/opendx/files.py  (original)
+++ trunk/lib/software/opendx/files.py  Thu May  8 14:40:23 2014
@@ -131,8 +131,8 @@
     @type dir:              str or None
     @keyword inc:           The number of increments in the map.
     @type inc:              int
-    @keyword point:         The coordinates of the point.
-    @type point:            numpy rank-1 float array
+    @keyword point:         The list of coordinates of the point.
+    @type point:            numpy rank-1 float array or list of numpy rank-1 
float array.
     @keyword bounds:        The bounds of the map.
     @type bounds:           numpy rank-2 float array
     @keyword N:             The dimension of the map.

Modified: trunk/pipe_control/opendx.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/opendx.py?rev=23082&r1=23081&r2=23082&view=diff
==============================================================================
--- trunk/pipe_control/opendx.py        (original)
+++ trunk/pipe_control/opendx.py        Thu May  8 14:40:23 2014
@@ -116,8 +116,16 @@
 
         # Points.
         if point != None:
-            self.point = array(point, float64)
-            self.num_points = 1
+            # Check if list is a nested list of lists.
+            if type(point[0]) == float:
+                self.point = array(point, float64)
+                self.num_points = 1
+            else:
+                point_list = []
+                for i in range(len(point)):
+                    point_list.append(array(point[i], float64))
+                self.point = point_list
+                self.num_points = i + 1
         else:
             self.num_points = 0
 
@@ -168,6 +176,12 @@
         # Create the OpenDX .general and data files for the given point.
         if self.num_points == 1:
             write_point(file_prefix=self.point_file, dir=self.dir, 
inc=self.inc, point=self.point, bounds=self.bounds, N=self.n)
+
+        # Generate the OpenDX .general and data files for each point.
+        elif self.num_points > 1:
+            for i in range(self.num_points):
+                file_prefix = "%s_%i"%(self.point_file, i)
+                write_point(file_prefix=file_prefix, dir=self.dir, 
inc=self.inc, point=self.point[i], bounds=self.bounds, N=self.n)
 
         # Generate the map.
         self.create_map()




Related Messages


Powered by MHonArc, Updated Thu May 08 15:00:02 2014