[Avida-SVN] r2007 - in development/source: tools utils/process_map

baerb at myxo.css.msu.edu baerb at myxo.css.msu.edu
Fri Aug 24 13:43:34 PDT 2007


Author: baerb
Date: 2007-08-24 16:43:34 -0400 (Fri, 24 Aug 2007)
New Revision: 2007

Added:
   development/source/utils/process_map/mypcolor.m
   development/source/utils/process_map/pcolor_all.m
Modified:
   development/source/tools/cRandom.cc
   development/source/tools/cRandom.h
   development/source/utils/process_map/Makefile
   development/source/utils/process_map/process_map.cc
Log:

Made canges to the code that produces movies from outputted grid files.
  -- Changed calls to new version of code
  -- fixed a couple of include statements
  -- added some .m files needed by the script that is created



Modified: development/source/tools/cRandom.cc
===================================================================
--- development/source/tools/cRandom.cc	2007-08-24 19:59:24 UTC (rev 2006)
+++ development/source/tools/cRandom.cc	2007-08-24 20:43:34 UTC (rev 2007)
@@ -10,7 +10,7 @@
 
 #include "cRandom.h"
 
-#include "platform.h"
+#include "../platform/platform.h"
 #include "tArray.h"
 
 #if AVIDA_PLATFORM(WINDOWS)

Modified: development/source/tools/cRandom.h
===================================================================
--- development/source/tools/cRandom.h	2007-08-24 19:59:24 UTC (rev 2006)
+++ development/source/tools/cRandom.h	2007-08-24 20:43:34 UTC (rev 2007)
@@ -12,7 +12,7 @@
 #define cRandom_h
 
 #ifndef cMutex_h
-#include "cMutex.h"
+#include "../platform/cMutex.h"
 #endif
 
 #if USE_tMemTrack

Modified: development/source/utils/process_map/Makefile
===================================================================
--- development/source/utils/process_map/Makefile	2007-08-24 19:59:24 UTC (rev 2006)
+++ development/source/utils/process_map/Makefile	2007-08-24 20:43:34 UTC (rev 2007)
@@ -30,7 +30,7 @@
 SRC		= process_map.cc		../../tools/cFile.cc  \
 		../../tools/cInitFile.cc	../../tools/cString.cc  \
 		../../tools/cStringList.cc  ../../tools/cStringIterator.cc  \
-		../../tools/cRandom.cc
+		../../tools/cRandom.cc ../../tools/cStringUtil.o
 
 ### List Object Files (for each source file there is a object file) ###########
 OBJ	 	= $(SRC:.cc=.o)

Added: development/source/utils/process_map/mypcolor.m
===================================================================
--- development/source/utils/process_map/mypcolor.m	                        (rev 0)
+++ development/source/utils/process_map/mypcolor.m	2007-08-24 20:43:34 UTC (rev 2007)
@@ -0,0 +1,65 @@
+function h = pcolor(x,y,c)
+%PCOLOR Pseudocolor (checkerboard) plot.
+%   PCOLOR(C) is a pseudocolor or "checkerboard" plot of matrix C.
+%   The values of the elements of C specify the color in each
+%   cell of the plot. In the default shading mode, 'faceted',
+%   each cell has a constant color and the last row and column of
+%   C are not used. With shading('interp'), each cell has color
+%   resulting from bilinear interpolation of the color at its 
+%   four vertices and all elements of C are used. 
+%   The smallest and largest elements of C are assigned the first and
+%   last colors given in the color table; colors for the remainder of the 
+%   elements in C are determined by table-lookup within the remainder of 
+%   the color table.
+%   PCOLOR(X,Y,C), where X and Y are vectors or matrices, makes a
+%   pseudocolor plot on the grid defined by X and Y.  X and Y could 
+%   define the grid for a "disk", for example.
+%   PCOLOR is really a SURF with its view set to directly above.
+%   PCOLOR returns a handle to a SURFACE object.
+%
+%   See also CAXIS, SURF, MESH, IMAGE, SHADING.
+
+%-------------------------------
+%   Additional details:
+%
+%
+%   PCOLOR sets the View property of the SURFACE object to directly 
+%   overhead.
+%
+%   If the NextPlot axis property is REPLACE (HOLD is off), PCOLOR resets 
+%   all axis properties, except Position, to their default values
+%   and deletes all axis children (line, patch, surf, image, and 
+%   text objects).  View is set to [0 90].
+
+%   Copyright (c) 1984-96 by The MathWorks, Inc.
+%   $Revision: 5.3 $  $Date: 1996/01/01 23:34:43 $
+
+%   J.N. Little 1-5-92
+
+if nargin < 1
+    error('Too few input arguments.');
+elseif nargin > 4
+    error('Too many input arguments.')
+end
+
+cax = gca;
+hold_state = ishold;
+
+if nargin == 1
+    hh = surface(zeros(size(x)),x);
+    [m,n] = size(x);
+    lims = [ 1 n 1 m];
+elseif nargin == 3
+    hh = surface(x,y,zeros(size(c)),c);
+    lims = [min(min(x)) max(max(x)) min(min(y)) max(max(y))];
+else
+    error('Must have one or three input arguments.')
+end
+if ~hold_state
+    set(cax,'View',[0 90]);
+    set(cax,'Box','on');
+    axis(lims);
+end
+if nargout == 1
+    h = hh;
+end

Added: development/source/utils/process_map/pcolor_all.m
===================================================================
--- development/source/utils/process_map/pcolor_all.m	                        (rev 0)
+++ development/source/utils/process_map/pcolor_all.m	2007-08-24 20:43:34 UTC (rev 2007)
@@ -0,0 +1,10 @@
+function pcolor_all(matrix)
+%PCOLOR_ALL  Make a psudo-color plot of 'matrix' including all columns and rows
+%  Works by appending a row and column of zeros 'matrix'
+%
+%  By default, does 'shading flat'
+
+[tmp1, tmp2] = size(matrix);
+matrix = [ matrix zeros(tmp1,1) ; zeros(1,tmp2+1) ];
+mypcolor(matrix)
+shading flat

Modified: development/source/utils/process_map/process_map.cc
===================================================================
--- development/source/utils/process_map/process_map.cc	2007-08-24 19:59:24 UTC (rev 2006)
+++ development/source/utils/process_map/process_map.cc	2007-08-24 20:43:34 UTC (rev 2007)
@@ -119,8 +119,8 @@
   if (type == 0) filename.Set("grid_genotype_id.%d.dat", (UD_step + UD_start));
   else filename.Set("grid_phenotype_id.%d.dat", (UD_step + UD_start));
   cInitFile file1(filename);
-  file1.Load();
-  file1.Close();
+  // file1.Load();
+  // file1.Close();
 
   const int height = file1.GetNumLines();
   const int width = file1.GetLine(0).CountNumWords();
@@ -165,18 +165,19 @@
     else filename.Set("grid_phenotype_id.%d.dat", update);
     
     cInitFile file(filename);
-    file.Load();
+    // file.Load();
 
     // Load in this file...
     cString cur_line;
+    int cur_line_num = 0;
     for (int pos = 0; pos < num_cells; pos++) {
-      if (cur_line.GetSize() == 0) cur_line = file.GetNextLine();
+      if (cur_line.GetSize() == 0) cur_line = file.GetLine(cur_line_num++);
       const int cur_id = cur_line.PopWord().AsInt();
       if (cur_id > max_id) max_id = cur_id;
       grid_matrix(file_id, pos) = cur_id;
     }
 
-    file.Close();
+    // file.Close();
   }
   cerr << endl << "LOADING COMPLETE" << endl;
   cerr << "Max ID = " << max_id << endl;




More information about the Avida-cvs mailing list