[Avida-SVN] r3332 - in branches/interrupt: . documentation source/actions source/analyze source/cpu source/main source/targets/avida-viewer source/utils/make_actions_html support support/math

beckma24 at myxo.css.msu.edu beckma24 at myxo.css.msu.edu
Thu Jun 25 08:43:38 PDT 2009


Author: beckma24
Date: 2009-06-25 11:43:37 -0400 (Thu, 25 Jun 2009)
New Revision: 3332

Added:
   branches/interrupt/documentation/configurations.html
   branches/interrupt/support/math/
   branches/interrupt/support/math/README
   branches/interrupt/support/math/exportfig.m
   branches/interrupt/support/math/find_files.m
   branches/interrupt/support/math/header_lines.m
   branches/interrupt/support/math/load_files.m
   branches/interrupt/support/math/newfigure.m
   branches/interrupt/support/math/quick_export.m
   branches/interrupt/support/math/quick_load.m
   branches/interrupt/support/math/stderr.m
Removed:
   branches/interrupt/support/math/README
   branches/interrupt/support/math/exportfig.m
   branches/interrupt/support/math/find_files.m
   branches/interrupt/support/math/header_lines.m
   branches/interrupt/support/math/load_files.m
   branches/interrupt/support/math/newfigure.m
   branches/interrupt/support/math/quick_export.m
   branches/interrupt/support/math/quick_load.m
   branches/interrupt/support/math/stderr.m
Modified:
   branches/interrupt/Avida.vcproj
   branches/interrupt/documentation/actions.html
   branches/interrupt/documentation/index.html
   branches/interrupt/source/actions/PrintActions.cc
   branches/interrupt/source/analyze/cAnalyzeGenotype.cc
   branches/interrupt/source/cpu/cHardwareCPU.cc
   branches/interrupt/source/cpu/cHardwareCPU.h
   branches/interrupt/source/main/cDeme.cc
   branches/interrupt/source/main/cDeme.h
   branches/interrupt/source/main/cPhenotype.cc
   branches/interrupt/source/main/cPhenotype.h
   branches/interrupt/source/main/cPopulation.cc
   branches/interrupt/source/main/cPopulation.h
   branches/interrupt/source/main/cTaskLib.cc
   branches/interrupt/source/targets/avida-viewer/cOptionsScreen.cc
   branches/interrupt/source/targets/avida-viewer/cStatsScreen.cc
   branches/interrupt/source/targets/avida-viewer/key_chart
   branches/interrupt/source/utils/make_actions_html/actions_source_info
Log:
merged development r3134:3150 into interrupt branch

Modified: branches/interrupt/Avida.vcproj
===================================================================
--- branches/interrupt/Avida.vcproj	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/Avida.vcproj	2009-06-25 15:43:37 UTC (rev 3332)
@@ -641,6 +641,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\classification\cMutationSteps.h"
+				>
+			</File>
+			<File
 				RelativePath=".\source\tools\cMutex.h"
 				>
 			</File>
@@ -1009,6 +1013,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\analyze\tAnalyzeJobBatch.h"
+				>
+			</File>
+			<File
 				RelativePath=".\source\tools\tArgDataEntry.h"
 				>
 			</File>
@@ -1017,6 +1025,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\tools\tArrayMap.h"
+				>
+			</File>
+			<File
 				RelativePath=".\source\tools\tBuffer.h"
 				>
 			</File>
@@ -1053,6 +1065,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\tools\tKVPair.h"
+				>
+			</File>
+			<File
 				RelativePath=".\source\tools\tList.h"
 				>
 			</File>
@@ -1073,6 +1089,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\platform\tRLockPtr.h"
+				>
+			</File>
+			<File
 				RelativePath=".\source\tools\tSmartArray.h"
 				>
 			</File>
@@ -1433,6 +1453,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\source\classification\cMutationSteps.cc"
+				>
+			</File>
+			<File
 				RelativePath=".\source\main\cMxCodeArray.cc"
 				>
 			</File>

Modified: branches/interrupt/documentation/actions.html
===================================================================
--- branches/interrupt/documentation/actions.html	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/documentation/actions.html	2009-06-25 15:43:37 UTC (rev 3332)
@@ -9,7 +9,7 @@
 
 <div class="revision">
 Revised 2006-09-03 DMB
-<br>Generated Tue May 27 15:04:24 2008 by make_actions_html</div>
+<br>Generated Thu Feb  5 15:51:14 2009 by make_actions_html</div>
 
 <p>
 <a href="index.html">Return to the Index</a> &nbsp;|&nbsp;
@@ -59,17 +59,25 @@
       <a href="#AnalyzeLandscape">AnalyzeLandscape</a><br>
       <a href="#AnalyzePopulation">AnalyzePopulation</a><br>
       <a href="#apocalypse">apocalypse</a><br>
+      <a href="#AssignRandomCellData">AssignRandomCellData</a><br>
       <a href="#ChangeEnvironment">ChangeEnvironment</a><br>
       <a href="#compete_demes">compete_demes</a><br>
       <a href="#CompeteDemes">CompeteDemes</a><br>
+      <a href="#CompeteDemes_AttackKillAndEnergyConserve">CompeteDemes_AttackKillAndEnergyConserve</a><br>
+      <a href="#CompeteDemesByEnergyDistribution">CompeteDemesByEnergyDistribution</a><br>
+      <a href="#CompeteDemesByTaskCount">CompeteDemesByTaskCount</a><br>
+      <a href="#CompeteDemesByTaskCountAndEfficiency">CompeteDemesByTaskCountAndEfficiency</a><br>
       <a href="#CompeteOrganisms">CompeteOrganisms</a><br>
       <a href="#compete_organisms">compete_organisms</a><br>
       <a href="#connect_cells">connect_cells</a><br>
       <a href="#ConnectCells">ConnectCells</a><br>
       <a href="#copy_deme">copy_deme</a><br>
       <a href="#CopyDeme">CopyDeme</a><br>
+      <a href="#DecayPoints">DecayPoints</a><br>
       <a href="#DelayedDemeEvent">DelayedDemeEvent</a><br>
+      <a href="#DelayedDemeEventsPerSlots">DelayedDemeEventsPerSlots</a><br>
       <a href="#DeletionLandscape">DeletionLandscape</a><br>
+      <a href="#Desynchronization">Desynchronization</a><br>
       <a href="#detail_parasite_pop">detail_parasite_pop</a><br>
       <a href="#detail_pop">detail_pop</a><br>
       <a href="#detail_sex_pop">detail_sex_pop</a><br>
@@ -110,6 +118,7 @@
       <a href="#ExitElapsedTime">ExitElapsedTime</a><br>
       <a href="#exit_if_ave_lineage_label_larger">exit_if_ave_lineage_label_larger</a><br>
       <a href="#exit_if_ave_lineage_label_smaller">exit_if_ave_lineage_label_smaller</a><br>
+      <a href="#Flash">Flash</a><br>
       <a href="#FullLandscape">FullLandscape</a><br>
       <a href="#genetic_distance_pop_dump">genetic_distance_pop_dump</a><br>
       <a href="#HillClimb">HillClimb</a><br>
@@ -120,6 +129,8 @@
       <a href="#inject_all_random_repro">inject_all_random_repro</a><br>
       <a href="#InjectAllRandomRepro">InjectAllRandomRepro</a><br>
       <a href="#InjectDemes">InjectDemes</a><br>
+      <a href="#InjectDemesFromNest">InjectDemesFromNest</a><br>
+      <a href="#InjectDemesRandom">InjectDemesRandom</a><br>
       <a href="#InjectParasite">InjectParasite</a><br>
       <a href="#InjectParasitePair">InjectParasitePair</a><br>
       <a href="#InjectRandom">InjectRandom</a><br>
@@ -134,6 +145,7 @@
       <a href="#InjectSequence">InjectSequence</a><br>
       <a href="#InjectSequenceWDivMutRate">InjectSequenceWDivMutRate</a><br>
       <a href="#InsertionLandscape">InsertionLandscape</a><br>
+      <a href="#IteratedConsensus">IteratedConsensus</a><br>
       <a href="#join_grid_col">join_grid_col</a><br>
       <a href="#join_grid_row">join_grid_row</a><br>
       <a href="#JoinGridCol">JoinGridCol</a><br>
@@ -144,9 +156,9 @@
       <a href="#kill_rectangle">kill_rectangle</a><br>
       <a href="#LoadClone">LoadClone</a><br>
       <a href="#load_clone">load_clone</a><br>
-    <td valign="top">
       <a href="#load_dump_file">load_dump_file</a><br>
       <a href="#LoadPopulation">LoadPopulation</a><br>
+    <td valign="top">
       <a href="#ModMutProb">ModMutProb</a><br>
       <a href="#MutationalNeighborhood">MutationalNeighborhood</a><br>
       <a href="#new_trial">new_trial</a><br>
@@ -155,6 +167,9 @@
       <a href="#OutflowScaledResource">OutflowScaledResource</a><br>
       <a href="#PairTestLandscape">PairTestLandscape</a><br>
       <a href="#PrecalcLandscape">PrecalcLandscape</a><br>
+      <a href="#Pred_DemeEventMoveBetweenTargets">Pred_DemeEventMoveBetweenTargets</a><br>
+      <a href="#Pred_DemeEventMoveCenter">Pred_DemeEventMoveCenter</a><br>
+      <a href="#Pred_DemeEventNUniqueIndividualsMovedIntoTarget">Pred_DemeEventNUniqueIndividualsMovedIntoTarget</a><br>
       <a href="#PredictNuLandscape">PredictNuLandscape</a><br>
       <a href="#PredictWLandscape">PredictWLandscape</a><br>
       <a href="#print_average_data">print_average_data</a><br>
@@ -162,19 +177,27 @@
       <a href="#PrintCCladeCounts">PrintCCladeCounts</a><br>
       <a href="#PrintCCladeFitnessHistogram">PrintCCladeFitnessHistogram</a><br>
       <a href="#PrintCCladeRelativeFitnessHistogram">PrintCCladeRelativeFitnessHistogram</a><br>
+      <a href="#PrintCellData">PrintCellData</a><br>
       <a href="#PrintCellVisitsData">PrintCellVisitsData</a><br>
       <a href="#PrintCompetitionData">PrintCompetitionData</a><br>
       <a href="#print_count_data">print_count_data</a><br>
       <a href="#PrintCountData">PrintCountData</a><br>
+      <a href="#PrintCurrentOpinions">PrintCurrentOpinions</a><br>
       <a href="#PrintCurrentReactionData">PrintCurrentReactionData</a><br>
+      <a href="#PrintCurrentReactionRewardData">PrintCurrentReactionRewardData</a><br>
+      <a href="#PrintCurrentTaskCounts">PrintCurrentTaskCounts</a><br>
       <a href="#print_data">print_data</a><br>
       <a href="#PrintData">PrintData</a><br>
       <a href="#PrintDebug">PrintDebug</a><br>
       <a href="#print_deme_stats">print_deme_stats</a><br>
       <a href="#PrintDemeAllStats">PrintDemeAllStats</a><br>
       <a href="#PrintDemeAverageData">PrintDemeAverageData</a><br>
+      <a href="#PrintDemeCompetitionData">PrintDemeCompetitionData</a><br>
+      <a href="#PrintDemeCurrentTaskExeData">PrintDemeCurrentTaskExeData</a><br>
       <a href="#PrintDemeDonorStats">PrintDemeDonorStats</a><br>
+      <a href="#PrintDemeEnergySharingStats">PrintDemeEnergySharingStats</a><br>
       <a href="#PrintDemeFoundersData">PrintDemeFoundersData</a><br>
+      <a href="#PrintDemeMigrationSuicidePoints">PrintDemeMigrationSuicidePoints</a><br>
       <a href="#PrintDemeOrgReactionData">PrintDemeOrgReactionData</a><br>
       <a href="#PrintDemeOrgTasksData">PrintDemeOrgTasksData</a><br>
       <a href="#PrintDemeOrgTasksExeData">PrintDemeOrgTasksExeData</a><br>
@@ -184,12 +207,15 @@
       <a href="#PrintDemeSpacialEnergyStats">PrintDemeSpacialEnergyStats</a><br>
       <a href="#PrintDemeSpacialSleepStats">PrintDemeSpacialSleepStats</a><br>
       <a href="#PrintDemeStats">PrintDemeStats</a><br>
+      <a href="#PrintDemesTotalAvgEnergy">PrintDemesTotalAvgEnergy</a><br>
       <a href="#PrintDemeTasksData">PrintDemeTasksData</a><br>
       <a href="#PrintDemeTasksExeData">PrintDemeTasksExeData</a><br>
+      <a href="#PrintDemeTestamentStats">PrintDemeTestamentStats</a><br>
       <a href="#print_depth_histogram">print_depth_histogram</a><br>
       <a href="#PrintDepthHistogram">PrintDepthHistogram</a><br>
       <a href="#print_detailed_fitness_data">print_detailed_fitness_data</a><br>
       <a href="#PrintDetailedFitnessData">PrintDetailedFitnessData</a><br>
+      <a href="#PrintDetailedSynchronizationData">PrintDetailedSynchronizationData</a><br>
       <a href="#print_divide_mut_data">print_divide_mut_data</a><br>
       <a href="#PrintDivideMutData">PrintDivideMutData</a><br>
       <a href="#print_dom">print_dom</a><br>
@@ -199,8 +225,11 @@
       <a href="#PrintDominantGenotype">PrintDominantGenotype</a><br>
       <a href="#PrintDominantParasiteGenotype">PrintDominantParasiteGenotype</a><br>
       <a href="#print_donation_stats">print_donation_stats</a><br>
+      <a href="#PrintDynamicMaxMinData">PrintDynamicMaxMinData</a><br>
       <a href="#print_error_data">print_error_data</a><br>
       <a href="#PrintErrorData">PrintErrorData</a><br>
+      <a href="#PrintExtendedTimeData">PrintExtendedTimeData</a><br>
+      <a href="#PrintFlowRateTuples">PrintFlowRateTuples</a><br>
       <a href="#print_genetic_distance_data">print_genetic_distance_data</a><br>
       <a href="#PrintGeneticDistanceData">PrintGeneticDistanceData</a><br>
       <a href="#PrintGenomicSiteEntropy">PrintGenomicSiteEntropy</a><br>
@@ -224,6 +253,7 @@
       <a href="#PrintLogFitnessHistogram">PrintLogFitnessHistogram</a><br>
       <a href="#print_market_data">print_market_data</a><br>
       <a href="#PrintMarketData">PrintMarketData</a><br>
+      <a href="#PrintMessageData">PrintMessageData</a><br>
       <a href="#print_mutation_rate_data">print_mutation_rate_data</a><br>
       <a href="#PrintMutationRateData">PrintMutationRateData</a><br>
       <a href="#print_number_phenotypes">print_number_phenotypes</a><br>
@@ -231,14 +261,16 @@
       <a href="#PrintPerDemeGenPerFounderData">PrintPerDemeGenPerFounderData</a><br>
       <a href="#PrintPerDemeReactionData">PrintPerDemeReactionData</a><br>
       <a href="#PrintPerDemeTasksData">PrintPerDemeTasksData</a><br>
+    <td valign="top">
       <a href="#PrintPerDemeTasksExeData">PrintPerDemeTasksExeData</a><br>
       <a href="#print_phenotype_status">print_phenotype_status</a><br>
       <a href="#PrintPhenotypeData">PrintPhenotypeData</a><br>
       <a href="#PrintPhenotypeStatus">PrintPhenotypeStatus</a><br>
-    <td valign="top">
       <a href="#PrintPhenotypicPlasticity">PrintPhenotypicPlasticity</a><br>
       <a href="#PrintPopulationDistanceData">PrintPopulationDistanceData</a><br>
+      <a href="#PrintPredicatedMessages">PrintPredicatedMessages</a><br>
       <a href="#PrintReactionData">PrintReactionData</a><br>
+      <a href="#PrintReactionExeData">PrintReactionExeData</a><br>
       <a href="#PrintReactionRewardData">PrintReactionRewardData</a><br>
       <a href="#PrintRelativeFitnessHistogram">PrintRelativeFitnessHistogram</a><br>
       <a href="#print_resource_data">print_resource_data</a><br>
@@ -250,6 +282,7 @@
       <a href="#PrintSpeciesAbundanceHistogram">PrintSpeciesAbundanceHistogram</a><br>
       <a href="#print_stats_data">print_stats_data</a><br>
       <a href="#PrintStatsData">PrintStatsData</a><br>
+      <a href="#PrintSynchronizationData">PrintSynchronizationData</a><br>
       <a href="#print_tasks_data">print_tasks_data</a><br>
       <a href="#print_tasks_exe_data">print_tasks_exe_data</a><br>
       <a href="#print_tasks_qual_data">print_tasks_qual_data</a><br>
@@ -285,6 +318,7 @@
       <a href="#SerialTransfer">SerialTransfer</a><br>
       <a href="#serial_transfer">serial_transfer</a><br>
       <a href="#SetCellResource">SetCellResource</a><br>
+      <a href="#SetConfig">SetConfig</a><br>
       <a href="#SetEnvironmentInputs">SetEnvironmentInputs</a><br>
       <a href="#SetEnvironmentRandomMask">SetEnvironmentRandomMask</a><br>
       <a href="#SetMigrationRate">SetMigrationRate</a><br>
@@ -305,6 +339,9 @@
       <a href="#set_resource">set_resource</a><br>
       <a href="#SetResourceInflow">SetResourceInflow</a><br>
       <a href="#SetResourceOutflow">SetResourceOutflow</a><br>
+      <a href="#SetSeasonalResource">SetSeasonalResource</a><br>
+      <a href="#SetSeasonalResource10Kyears_1To_1">SetSeasonalResource10Kyears_1To_1</a><br>
+      <a href="#SetSeasonalResource1Kyears_1To_1">SetSeasonalResource1Kyears_1To_1</a><br>
       <a href="#SetTaskArgDouble">SetTaskArgDouble</a><br>
       <a href="#SetTaskArgInt">SetTaskArgInt</a><br>
       <a href="#SetTaskArgString">SetTaskArgString</a><br>
@@ -316,11 +353,13 @@
       <a href="#StopFastForward">StopFastForward</a><br>
       <a href="#swap_cells">swap_cells</a><br>
       <a href="#SwapCells">SwapCells</a><br>
+      <a href="#Synchronization">Synchronization</a><br>
       <a href="#task_snapshot">task_snapshot</a><br>
       <a href="#test_dom">test_dom</a><br>
       <a href="#TestDominant">TestDominant</a><br>
       <a href="#ToggleFitnessValley">ToggleFitnessValley</a><br>
       <a href="#ToggleRewardInstruction">ToggleRewardInstruction</a><br>
+      <a href="#TrackAllMessages">TrackAllMessages</a><br>
       <a href="#VERBOSE">VERBOSE</a><br>
       <a href="#zero_muts">zero_muts</a><br>
       <a href="#ZeroMuts">ZeroMuts</a><br>
@@ -438,13 +477,21 @@
 </li>
 <li><p>
   <strong><a name="DelayedDemeEvent">DelayedDemeEvent</a></strong>
-  <i>&lt;int x1&gt; &lt;int y1&gt; &lt;int x2&gt; &lt;int y2&gt; &lt;int delay&gt; &lt;int duraion&gt;</i>
+  <i>&lt;int x1&gt; &lt;int y1&gt; &lt;int x2&gt; &lt;int y2&gt; &lt;int delay&gt; &lt;int duraion&gt; &lt;bool static_position&gt; &lt;int total_events&gt;</i>
   </p>
   <p>
   
   </p>
 </li>
 <li><p>
+  <strong><a name="DelayedDemeEventsPerSlots">DelayedDemeEventsPerSlots</a></strong>
+  <i>&lt;int x1&gt; &lt;int y1&gt; &lt;int x2&gt; &lt;int y2&gt; &lt;int delay&gt; &lt;int duraion&gt; &lt;bool static_position&gt; &lt;int total_slots_per_deme&gt; &lt;int total_events_per_slot_max&gt; &lt;int total_events_per_slot_min&gt; &lt;int tolal_event_flow_levels&gt;</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="InjectResource">InjectResource</a></strong>
   <i>&lt;string res_name&gt; &lt;double res_count&gt;</i>
   </p>
@@ -507,6 +554,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="SetConfig">SetConfig</a></strong>
+  <i>&lt;string config_var&gt; &lt;string value&gt;</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="SetEnvironmentInputs">SetEnvironmentInputs</a></strong>
   <i>&lt;int input_1&gt; &lt;int input_2&gt; &lt;int input_3&gt; </i>
   </p>
@@ -688,6 +743,30 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="SetSeasonalResource">SetSeasonalResource</a></strong>
+  </p>
+  <p>
+    Sets resource availiblity to seasonal
+
+  </p>
+</li>
+<li><p>
+  <strong><a name="SetSeasonalResource10Kyears_1To_1">SetSeasonalResource10Kyears_1To_1</a></strong>
+  </p>
+  <p>
+    Sets resource availiblity to seasonal 1 to -1 for 10K years of 365 updates
+
+  </p>
+</li>
+<li><p>
+  <strong><a name="SetSeasonalResource1Kyears_1To_1">SetSeasonalResource1Kyears_1To_1</a></strong>
+  </p>
+  <p>
+    Sets resource availiblity to seasonal 1 to -1 for 1K years of 365 updates
+
+  </p>
+</li>
+<li><p>
   <strong><a name="SetTaskArgDouble">SetTaskArgDouble</a></strong>
   <i>&lt;int task&gt; &lt;int arg&gt; &lt;double value&gt;</i>
   </p>
@@ -881,6 +960,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="AssignRandomCellData">AssignRandomCellData</a></strong>
+  <i>No Arguments</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="compete_demes">compete_demes</a></strong>
   <i>[int type=1]</i>
   </p>
@@ -898,6 +985,44 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="CompeteDemes_AttackKillAndEnergyConserve">CompeteDemes_AttackKillAndEnergyConserve</a></strong>
+  <i>No Arguments</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
+  <strong><a name="CompeteDemesByEnergyDistribution">CompeteDemesByEnergyDistribution</a></strong>
+  <i>Competes demes according to the distribution of energy among the organisms</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
+  <strong><a name="CompeteDemesByTaskCount">CompeteDemesByTaskCount</a></strong>
+  <i>Competes demes according to the number of times a given task has been completed within that deme</i>
+  </p>
+  <p>
+    Competes demes based on the total number of times that a
+  task has been completed by an organism in the deme since the
+  was initialized. This action takes one integer parameter representing
+  number of the task that is to be used for competition. If no parameter
+  supplied, the class uses the first task defined in the environment file
+  compete the demes.
+
+  </p>
+</li>
+<li><p>
+  <strong><a name="CompeteDemesByTaskCountAndEfficiency">CompeteDemesByTaskCountAndEfficiency</a></strong>
+  <i>Competes demes according to the number of times a given task has been completed within that deme and the efficiency with which it was done</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="CompeteOrganisms">CompeteOrganisms</a></strong>
   <i>[int type=0] [int parents_survive=0] [double scaled_time=1.0] [int dynamic_scaling=0]</i>
   </p>
@@ -963,6 +1088,22 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="DecayPoints">DecayPoints</a></strong>
+  </p>
+  <p>
+    Decays the number of points a deme has accumulated by
+  a percentage that is set in the configuration file.
+
+  </p>
+</li>
+<li><p>
+  <strong><a name="Desynchronization">Desynchronization</a></strong>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="DisconnectCells">DisconnectCells</a></strong>
   <i>&lt;int cellA_x&gt; &lt;int cellA_y&gt; &lt;int cellB_x&gt; &lt;int cellB_y&gt;</i>
   </p>
@@ -989,6 +1130,13 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="Flash">Flash</a></strong>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="inject">inject</a></strong>
   <i>[string fname="START_CREATURE"] [int cell_id=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]</i>
   </p>
@@ -1054,6 +1202,22 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="InjectDemesFromNest">InjectDemesFromNest</a></strong>
+  <i>[int num_orgs=1] [int nest_cellid=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
+  <strong><a name="InjectDemesRandom">InjectDemesRandom</a></strong>
+  <i>[int num_orgs=1] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="InjectParasite">InjectParasite</a></strong>
   <i>&lt;string filename&gt; &lt;string label&gt; [int cell_start=0] [int cell_end=-1]</i>
   </p>
@@ -1146,6 +1310,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="IteratedConsensus">IteratedConsensus</a></strong>
+  <i>[int compete_period=100 [int replace_number=0]]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="join_grid_col">join_grid_col</a></strong>
   <i>[int col_id=-1] [int min_row=0] [int max_row=-1]</i>
   </p>
@@ -1226,7 +1398,6 @@
   <strong><a name="ModMutProb">ModMutProb</a></strong>
   <i>[string mut_type="COPY_MUT"] [double prob=0.0] [int start_cell=-1] [int end_cell=-1]</i>
   </p>
-    For a list of values for mut_type, see <a href="#SetMutProb">SetMutProb<a/>.
   <p>
   
   </p>
@@ -1251,6 +1422,30 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="Pred_DemeEventMoveBetweenTargets">Pred_DemeEventMoveBetweenTargets</a></strong>
+  <i>[int times=1]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
+  <strong><a name="Pred_DemeEventMoveCenter">Pred_DemeEventMoveCenter</a></strong>
+  <i>[int times=1]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
+  <strong><a name="Pred_DemeEventNUniqueIndividualsMovedIntoTarget">Pred_DemeEventNUniqueIndividualsMovedIntoTarget</a></strong>
+  <i>[int numorgs=1]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="rate_kill">rate_kill</a></strong>
   <i>&lt;double probability&gt;</i>
   </p>
@@ -1325,13 +1520,6 @@
   <strong><a name="SetMutProb">SetMutProb</a></strong>
   <i>[string mut_type="COPY_MUT"] [double prob=0.0] [int start_cell=-1] [int end_cell=-1]</i>
   </p>
-    Values for mut_type are POINT, COPY_MUT, COPY_INS, COPY_DEL, COPY_UNIFORM, 
-  COPY_SLIP, DIV_MUT, DIV_INS, DIV_DEL, DIV_UNIFORM, DIV_SLIP, DIVIDE_MUT, 
-  DIVIDE_INS, DIVIDE_DEL, DIVIDE_UNIFORM, DIVIDE_SLIP, PARENT, INJECT_MUT, 
-  INJECT_INS, and INJECT_DEL.  These correspond to their counterparts in avida.cfg.
-  <br>
-  <br>
-  To turn off all mutations, use <a href="#ZeroMuts">ZeroMuts</a>.
   <p>
   
   </p>
@@ -1390,6 +1578,13 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="Synchronization">Synchronization</a></strong>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="ToggleFitnessValley">ToggleFitnessValley</a></strong>
   <i>No Arguments</i>
   </p>
@@ -1406,6 +1601,13 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="TrackAllMessages">TrackAllMessages</a></strong>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="zero_muts">zero_muts</a></strong>
   <i>No Arguments</i>
   </p>
@@ -1419,9 +1621,7 @@
   <i>No Arguments</i>
   </p>
   <p>
-    This event will set all mutation rates to zero.  That is, it will set all
-    cell mutation rates to zero, so that new organisms born will have zero mutation
-    rates.  Current organsims will not be affected, and may still mutate.
+    This event will set all mutation rates to zero.
 
   </p>
 </li>
@@ -1689,6 +1889,13 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintCellData">PrintCellData</a></strong>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="PrintCellVisitsData">PrintCellVisitsData</a></strong>
   <i>[string fname="visits.dat			"]</i>
   </p>
@@ -1725,6 +1932,13 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintCurrentOpinions">PrintCurrentOpinions</a></strong>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="PrintCurrentReactionData">PrintCurrentReactionData</a></strong>
   <i>[string fname="cur_reactions.dat"]</i>
   </p>
@@ -1733,6 +1947,22 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintCurrentReactionRewardData">PrintCurrentReactionRewardData</a></strong>
+  <i>[string fname="cur_reaction_reward.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
+  <strong><a name="PrintCurrentTaskCounts">PrintCurrentTaskCounts</a></strong>
+  <i>[string fname="curr_task_counts.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="print_data">print_data</a></strong>
   <i>&lt;cString fname&gt; &lt;cString format&gt;</i>
   </p>
@@ -1790,6 +2020,22 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintDemeCompetitionData">PrintDemeCompetitionData</a></strong>
+  <i>[string fname="deme_compete.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
+  <strong><a name="PrintDemeCurrentTaskExeData">PrintDemeCurrentTaskExeData</a></strong>
+  <i>[string fname="	deme_cur_task_exe.dat	"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="PrintDemeDonorStats">PrintDemeDonorStats</a></strong>
   <i>No Arguments</i>
   </p>
@@ -1798,6 +2044,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintDemeEnergySharingStats">PrintDemeEnergySharingStats</a></strong>
+  <i>No Arguments</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="PrintDemeFoundersData">PrintDemeFoundersData</a></strong>
   <i>[string fname="deme_founders.dat"]</i>
   </p>
@@ -1806,6 +2060,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintDemeMigrationSuicidePoints">PrintDemeMigrationSuicidePoints</a></strong>
+  <i>[string fname="	deme_mig_suicide_points.dat	"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="PrintDemeOrgReactionData">PrintDemeOrgReactionData</a></strong>
   <i>[string fname="deme_org_reactions.dat"]</i>
   </p>
@@ -1878,6 +2140,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintDemesTotalAvgEnergy">PrintDemesTotalAvgEnergy</a></strong>
+  <i>No Arguments</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="PrintDemeTasksData">PrintDemeTasksData</a></strong>
   <i>[string fname="deme_tasks.dat"]</i>
   </p>
@@ -1894,6 +2164,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintDemeTestamentStats">PrintDemeTestamentStats</a></strong>
+  <i>[string fname="deme_testament.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="print_depth_histogram">print_depth_histogram</a></strong>
   <i>[string fname="depth_histogram.dat"]</i>
   </p>
@@ -1927,6 +2205,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintDetailedSynchronizationData">PrintDetailedSynchronizationData</a></strong>
+  <i>[string fname="sync-detail.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="print_divide_mut_data">print_divide_mut_data</a></strong>
   <i>[string fname="divide_mut.dat"]</i>
   </p>
@@ -2011,6 +2297,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintDynamicMaxMinData">PrintDynamicMaxMinData</a></strong>
+  <i>[string fname="		maxmin.dat			"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="print_error_data">print_error_data</a></strong>
   <i>[string fname="error.dat"]</i>
   </p>
@@ -2029,6 +2323,21 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintExtendedTimeData">PrintExtendedTimeData</a></strong>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
+  <strong><a name="PrintFlowRateTuples">PrintFlowRateTuples</a></strong>
+  <i>[string fname="flow_rate_tuples.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="print_genetic_distance_data">print_genetic_distance_data</a></strong>
   <i>[string ref_creature_file="START_CREATURE"] [string fname="genetic_distance.dat"]</i>
   </p>
@@ -2188,25 +2497,20 @@
   </p>
 </li>
 <li><p>
-	<strong><a name="PrintInternalTasksData">PrintInternalTasksData</a></strong>
-	<i>[string fname="in_tasks.dat"]</i>
-	</p>
-	<p>
-		Print the number of organisms that have performed each task using internal resources.
-	</p>
-	<p>
-		Note that tasks performed using internal resources are also counted as tasks performed (by <a href="#PrintTasksData">PrintTasksData</a>), so that if you wish to know the number of tasks performed <i>not</i> using internal resources you must do some subtraction:
-		<br><br>
-		(number from PrintTasksData) - (number from PrintInternalTasksData) = number of organisms who have performed this task <i>not</i> using internal resources
-	</p>
+  <strong><a name="PrintInternalTasksData">PrintInternalTasksData</a></strong>
+  <i>[string fname="in_tasks.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
 </li>
 <li><p>
-	<strong><a name="PrintInternalTasksQualData">PrintInternalTasksQualData</a></strong>
-	<i>[string fname="in_tasks_quality.dat"]</i>
-	</p>
-	<p>
-		Print the total quality of each task when performed using internal resources.  (See <a href="#PrintTasksQualData">PrintTasksQualData</a> for more about task quality.)
-	</p>
+  <strong><a name="PrintInternalTasksQualData">PrintInternalTasksQualData</a></strong>
+  <i>[string fname="in_tasks_quality.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
 </li>
 <li><p>
   <strong><a name="print_lineage_counts">print_lineage_counts</a></strong>
@@ -2276,6 +2580,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintMessageData">PrintMessageData</a></strong>
+  <i>[string fname="message.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="print_mutation_rate_data">print_mutation_rate_data</a></strong>
   <i>[string fname="mutation_rates.dat"]</i>
   </p>
@@ -2395,6 +2707,13 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintPredicatedMessages">PrintPredicatedMessages</a></strong>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="PrintReactionData">PrintReactionData</a></strong>
   <i>[string fname="reactions.dat"]</i>
   </p>
@@ -2403,6 +2722,14 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintReactionExeData">PrintReactionExeData</a></strong>
+  <i>[string fname="reactions_exe.dat"]</i>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="PrintReactionRewardData">PrintReactionRewardData</a></strong>
   <i>[string fname="reaction_reward.dat"]</i>
   </p>
@@ -2509,6 +2836,13 @@
   </p>
 </li>
 <li><p>
+  <strong><a name="PrintSynchronizationData">PrintSynchronizationData</a></strong>
+  </p>
+  <p>
+  
+  </p>
+</li>
+<li><p>
   <strong><a name="print_tasks_data">print_tasks_data</a></strong>
   <i>[string fname="tasks.dat"]</i>
   </p>

Copied: branches/interrupt/documentation/configurations.html (from rev 3150, development/documentation/configurations.html)
===================================================================
--- branches/interrupt/documentation/configurations.html	                        (rev 0)
+++ branches/interrupt/documentation/configurations.html	2009-06-25 15:43:37 UTC (rev 3332)
@@ -0,0 +1,44 @@
+<html>
+<head>
+  <title>Avida : Example Configurations</title>
+	<link rel="stylesheet" type="text/css" href="main.css" />
+</head>
+<body>
+
+<div class="revision">
+First draft: 2009-02-06 BEB
+</div>
+
+<p><a href="index.html">Return to the Index</a></p>
+<hr />
+
+<div align="center">
+<h1>Configurations</h1>
+</div>
+Below is a list of configurations you might find useful.
+
+<p>
+Unless otherwise noted, all configuration links will be to the Avida configuration file for that experiment.
+Other configuration files, like the instructions set and environment, can be found in the same directory as the Avida configuration file.
+</p>
+
+<h2>Published Work</h2>
+<p>
+<i><b>Evolution of an adaptive sleep response in digital organisms.</b></i>
+B. E. Beckmann, P. K. McKinley, and C. Ofria.
+In Advances in Artificial Life - Proceedings of 9th European Conference on Artificial Life, 
+volume 4648 of Lecture Notes in Computer Science, pages 233-242. Springer, 2007.
+
+<a href="../tests/energy_asex_1000u/config/avida.cfg">Constaint resource environment.</a>
+</p>
+
+
+<h2>Other Useful Configurations</h2>
+
+This is a list of other configurations we find useful.
+
+<hr />
+<p><a href="index.html">Return to the Index</a></p>
+
+</body>
+</html>

Modified: branches/interrupt/documentation/index.html
===================================================================
--- branches/interrupt/documentation/index.html	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/documentation/index.html	2009-06-25 15:43:37 UTC (rev 3332)
@@ -40,6 +40,7 @@
 <br /><a href="analyze.html">Guidelines to Analyze Mode</a>
 <br /><a href="analyze_samples.html">Sample Analyze Programs</a>
 <br /><a href="actions.html">List of Actions</a>
+<br /><a href="configurations.html">Example configurations from published work</a>
 </p>
 
 

Modified: branches/interrupt/source/actions/PrintActions.cc
===================================================================
--- branches/interrupt/source/actions/PrintActions.cc	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/actions/PrintActions.cc	2009-06-25 15:43:37 UTC (rev 3332)
@@ -2589,17 +2589,30 @@
 };
 
 class cActionPrintDemeEnergySharingStats : public cAction
+{
+public:
+  cActionPrintDemeEnergySharingStats(cWorld* world, const cString& args) : cAction(world, args) { ; }
+    
+  static const cString GetDescription() { return "No Arguments"; }
+    
+  void Process(cAvidaContext& ctx)
   {
-  public:
-    cActionPrintDemeEnergySharingStats(cWorld* world, const cString& args) : cAction(world, args) { ; }
+    m_world->GetPopulation().PrintDemeEnergySharingStats();
+  }
+};
+
+class cActionPrintDemeEnergyDistributionStats : public cAction
+{
+public:
+  cActionPrintDemeEnergyDistributionStats(cWorld* world, const cString& args) : cAction(world, args) { ; }
     
-    static const cString GetDescription() { return "No Arguments"; }
+  static const cString GetDescription() { return "No Arguments"; }
     
-    void Process(cAvidaContext& ctx)
-    {
-      m_world->GetPopulation().PrintDemeEnergySharingStats();
-    }
-  };
+  void Process(cAvidaContext& ctx)
+  {
+    m_world->GetPopulation().PrintDemeEnergyDistributionStats();
+  }
+};
 
 class cActionPrintDemeDonorStats : public cAction
 {
@@ -2792,6 +2805,7 @@
   action_lib->Register<cActionPrintDemeAllStats>("PrintDemeStats"); //duplicate of previous
   action_lib->Register<cActionPrintDemesTotalAvgEnergy>("PrintDemesTotalAvgEnergy");
   action_lib->Register<cActionPrintDemeEnergySharingStats>("PrintDemeEnergySharingStats");
+  action_lib->Register<cActionPrintDemeEnergyDistributionStats>("PrintDemeEnergyDistributionStats");
   action_lib->Register<cActionPrintDemeDonorStats>("PrintDemeDonorStats");
   action_lib->Register<cActionPrintDemeSpacialEnergy>("PrintDemeSpacialEnergyStats");
   action_lib->Register<cActionPrintDemeSpatialSleep>("PrintDemeSpatialSleepStats");

Modified: branches/interrupt/source/analyze/cAnalyzeGenotype.cc
===================================================================
--- branches/interrupt/source/analyze/cAnalyzeGenotype.cc	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/analyze/cAnalyzeGenotype.cc	2009-06-25 15:43:37 UTC (rev 3332)
@@ -306,9 +306,14 @@
   ADD_GDATA(cString (), "executed_flags", "Executed Flags",             GetExecutedFlags, SetNULL, 0, "(N/A)", "");
   ADD_GDATA(cString (), "alignment_executed_flags", "Alignment Executed Flags", GetAlignmentExecutedFlags, SetNULL, 0, "(N/A)", "");
   ADD_GDATA(cString (), "task_list", "List of all tasks performed",     GetTaskList,     SetNULL, 0, "(N/A)", "");
-  ADD_GDATA(cString (), "link.tasksites", "Phenotype Map",              GetMapLink,      SetNULL, 0, 0,       0);
-  ADD_GDATA(cString (), "html.sequence",  "Genome Sequence",            GetHTMLSequence, SetNULL, 0, "(N/A)", "");
   
+  // @TODO - the following were link.tasksites and html.sequence, respectively.  The period character is now separated as
+  //         an argument passed into the function, thus they are matched as the component before the period.  For now
+  //         I have simply removed the argument part, since there are not any existing name clashes.  However,  in future
+  //         versions we should rename these.
+  ADD_GDATA(cString (), "link", "Phenotype Map",              GetMapLink,      SetNULL, 0, 0,       0);
+  ADD_GDATA(cString (), "html",  "Genome Sequence",            GetHTMLSequence, SetNULL, 0, "(N/A)", "");
+  
   dcm->Add("inst", new tDataEntryOfType<cAnalyzeGenotype, int (int)>
               ("inst", &cAnalyzeGenotype::DescInstExe, &cAnalyzeGenotype::GetInstExecutedCount));
   

Modified: branches/interrupt/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/interrupt/source/cpu/cHardwareCPU.cc	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/cpu/cHardwareCPU.cc	2009-06-25 15:43:37 UTC (rev 3332)
@@ -308,7 +308,9 @@
     tInstLibEntry<tMethod>("if-B!=C", &cHardwareCPU::Inst_IfBNotEqC),
     tInstLibEntry<tMethod>("if-A!=C", &cHardwareCPU::Inst_IfANotEqC),
     tInstLibEntry<tMethod>("if-bit-1", &cHardwareCPU::Inst_IfBit1),
-    
+    tInstLibEntry<tMethod>("if-grt-X", &cHardwareCPU::Inst_IfGrX),
+    tInstLibEntry<tMethod>("if-equ-X", &cHardwareCPU::Inst_IfEquX),
+
     tInstLibEntry<tMethod>("jump-f", &cHardwareCPU::Inst_JumpF),
     tInstLibEntry<tMethod>("jump-b", &cHardwareCPU::Inst_JumpB),
     tInstLibEntry<tMethod>("call", &cHardwareCPU::Inst_Call),
@@ -432,6 +434,13 @@
     tInstLibEntry<tMethod>("donate-energy", &cHardwareCPU::Inst_DonateEnergy, nInstFlag::STALL),
     tInstLibEntry<tMethod>("update-metabolic-rate", &cHardwareCPU::Inst_UpdateMetabolicRate, nInstFlag::STALL),
     tInstLibEntry<tMethod>("donate-energy-faced", &cHardwareCPU::Inst_DonateEnergyFaced, nInstFlag::STALL),
+    tInstLibEntry<tMethod>("donate-energy-faced1", &cHardwareCPU::Inst_DonateEnergyFaced1, nInstFlag::STALL),
+    tInstLibEntry<tMethod>("donate-energy-faced2", &cHardwareCPU::Inst_DonateEnergyFaced2, nInstFlag::STALL),
+    tInstLibEntry<tMethod>("donate-energy-faced5", &cHardwareCPU::Inst_DonateEnergyFaced5, nInstFlag::STALL),
+    tInstLibEntry<tMethod>("donate-energy-faced10", &cHardwareCPU::Inst_DonateEnergyFaced10, nInstFlag::STALL),
+    tInstLibEntry<tMethod>("donate-energy-faced20", &cHardwareCPU::Inst_DonateEnergyFaced20, nInstFlag::STALL),
+    tInstLibEntry<tMethod>("donate-energy-faced50", &cHardwareCPU::Inst_DonateEnergyFaced50, nInstFlag::STALL),
+    tInstLibEntry<tMethod>("donate-energy-faced100", &cHardwareCPU::Inst_DonateEnergyFaced100, nInstFlag::STALL),    
     tInstLibEntry<tMethod>("rotate-to-most-needy", &cHardwareCPU::Inst_RotateToMostNeedy, nInstFlag::STALL),
     tInstLibEntry<tMethod>("request-energy", &cHardwareCPU::Inst_RequestEnergy, nInstFlag::STALL),
     tInstLibEntry<tMethod>("request-energy-on", &cHardwareCPU::Inst_RequestEnergyFlagOn, nInstFlag::STALL),
@@ -612,6 +621,8 @@
   	tInstLibEntry<tMethod>("if-faced-energy-more", &cHardwareCPU::Inst_IfFacedEnergyMore, nInstFlag::STALL),	    
 	  tInstLibEntry<tMethod>("if-energy-in-buffer", &cHardwareCPU::Inst_IfEnergyInBuffer, nInstFlag::STALL),
 	  tInstLibEntry<tMethod>("if-energy-not-in-buffer", &cHardwareCPU::Inst_IfEnergyNotInBuffer, nInstFlag::STALL),
+    tInstLibEntry<tMethod>("get-energy-level", &cHardwareCPU::Inst_GetEnergyLevel, nInstFlag::STALL),
+    tInstLibEntry<tMethod>("get-faced-energy-level", &cHardwareCPU::Inst_GetFacedEnergyLevel, nInstFlag::STALL),
 	  
     // Sleep and time
     tInstLibEntry<tMethod>("sleep", &cHardwareCPU::Inst_Sleep, nInstFlag::STALL),
@@ -2122,6 +2133,68 @@
   return true;
 }
 
+bool cHardwareCPU::Inst_IfGrX(cAvidaContext& ctx)       // Execute next if BX > X; X value set according to NOP label
+{
+  // Compares value in BX to a specific value.  The value to compare to is determined by the nop label as follows:
+  //    no nop label (default): valueToCompare = 1; nop-A: valueToCompare = -1
+  //                     nop-B: valueToCompare = 2; nop-C: valueToCompare =  4
+  // @LMG 2/13/2009
+  
+  int valueToCompare = 1;
+  
+  if (m_inst_set->IsNop(IP().GetNextInst())) {
+    IP().Advance();    
+    switch (m_inst_set->GetNopMod(IP().GetInst())) {
+        
+      case REG_AX:
+        valueToCompare = -1; break;
+      case REG_BX:
+        valueToCompare =  2; break;
+      case REG_CX:
+        valueToCompare =  4; break;
+      default:
+        valueToCompare =  1; break;
+    }
+    IP().SetFlagExecuted();
+    
+  }
+  
+  if (GetRegister(REG_BX) <= valueToCompare)  IP().Advance();
+  
+  return true;
+}
+
+bool cHardwareCPU::Inst_IfEquX(cAvidaContext& ctx)       // Execute next if BX == X; X value set according to NOP label
+{
+  // Compares value in BX to a specific value.  The value to compare to is determined by the nop label as follows:
+  //    no nop label (default): valueToCompare = 1; nop-A: valueToCompare = -1
+  //                     nop-B: valueToCompare = 2; nop-C: valueToCompare =  4
+  // @LMG 2/13/2009
+  
+  int valueToCompare = 1;
+  
+  if (m_inst_set->IsNop(IP().GetNextInst())) {
+    IP().Advance();
+    switch (m_inst_set->GetNopMod(IP().GetInst())) {
+        
+      case REG_AX:
+        valueToCompare = -1; break;
+      case REG_BX:
+        valueToCompare =  2; break;
+      case REG_CX:
+        valueToCompare =  4; break;
+      default:
+        valueToCompare =  1; break;
+    }
+    IP().SetFlagExecuted();
+    
+  }
+  
+  if (GetRegister(REG_BX) != valueToCompare)  IP().Advance();
+  
+  return true;
+}
+
 bool cHardwareCPU::Inst_JumpF(cAvidaContext& ctx)
 {
   ReadLabel();
@@ -3898,49 +3971,63 @@
 }
 
 
+void cHardwareCPU::DoEnergyDonatePercent(cOrganism* to_org, const double frac_energy_given)
+{  
+  assert(to_org != NULL);
+  assert(frac_energy_given >= 0);
+  assert(frac_energy_given <= 1);
+
+  DoEnergyDonateAmount(to_org, m_organism->GetPhenotype().GetStoredEnergy() * frac_energy_given);
+  
+} //End DoEnergyDonatePercent()
+
+
 // The difference between this version and the previous is that this one allows energy to be placed
 // into the recipient's incoming energy buffer and not be applied immediately.  Also, some of the
 // energy may be lost in transfer
-void cHardwareCPU::DoEnergyDonatePercent(cOrganism* to_org, const double frac_energy_given)
+void cHardwareCPU::DoEnergyDonateAmount(cOrganism* to_org, const double amount)
 {
   double losspct = m_world->GetConfig().ENERGY_SHARING_LOSS.Get();
   
   assert(to_org != NULL);
-  assert(frac_energy_given >= 0);
-  assert(frac_energy_given <= 1);
+  assert(amount >= 0);
   assert(losspct >= 0);
   assert(losspct <= 1);
-    
-  double cur_energy = m_organism->GetPhenotype().GetStoredEnergy();
+  
   const int update_metabolic = m_world->GetConfig().ENERGY_SHARING_UPDATE_METABOLIC.Get();
-  double energy_given = cur_energy * frac_energy_given;
+  double energy_given = min(m_organism->GetPhenotype().GetStoredEnergy(), amount);
   
   //update energy store and merit of donor
   m_organism->GetPhenotype().ReduceEnergy(energy_given);
+  m_organism->GetPhenotype().SetIsEnergyDonor();
   m_organism->GetPhenotype().IncreaseEnergyDonated(energy_given);
-	
+  m_organism->GetPhenotype().IncreaseNumEnergyDonations();
+  
+  m_organism->GetDeme()->IncreaseEnergyDonated(energy_given);
+  
   if(update_metabolic == 1) {
     double senderMerit = cMerit::EnergyToMerit(m_organism->GetPhenotype().GetStoredEnergy()  * m_organism->GetPhenotype().GetEnergyUsageRatio(), m_world);
     m_organism->UpdateMerit(senderMerit);
   }
-	  
+  
   //apply loss in transfer
   energy_given *= (1 - losspct);
   
   //place energy into receiver's incoming energy buffer
   to_org->GetPhenotype().ReceiveDonatedEnergy(energy_given);
+  to_org->GetDeme()->IncreaseEnergyReceived(energy_given);   // Harder for phenotype to get the deme, so it's done here
   
   //if we are using the push energy method, pass the new energy into the receiver's energy store and recalculate merit
   if(m_world->GetConfig().ENERGY_SHARING_METHOD.Get() == 1) {
     to_org->GetPhenotype().ApplyDonatedEnergy();
 	  
 	  if(update_metabolic == 1) {
-        double receiverMerit = cMerit::EnergyToMerit(to_org->GetPhenotype().GetStoredEnergy() * to_org->GetPhenotype().GetEnergyUsageRatio(), m_world);
-        to_org->UpdateMerit(receiverMerit);
+      double receiverMerit = cMerit::EnergyToMerit(to_org->GetPhenotype().GetStoredEnergy() * to_org->GetPhenotype().GetEnergyUsageRatio(), m_world);
+      to_org->UpdateMerit(receiverMerit);
 	  }
   }
   
-} //End DoEnergyDonatePercent()
+} //End DoEnergyDonateAmount()
 
 
 bool cHardwareCPU::Inst_DonateFacing(cAvidaContext& ctx) {
@@ -4444,7 +4531,6 @@
   
   if(m_organism->GetPhenotype().GetEnergyInBufferAmount() > 0) {
     m_organism->GetPhenotype().ApplyDonatedEnergy();
-    m_organism->GetPhenotype().SetHasUsedDonatedEnergy();
 	 
 	  if(m_world->GetConfig().ENERGY_SHARING_UPDATE_METABOLIC.Get() == 1) {
         double receiverMerit = cMerit::EnergyToMerit(m_organism->GetPhenotype().GetStoredEnergy() * m_organism->GetPhenotype().GetEnergyUsageRatio(), m_world);
@@ -4487,8 +4573,6 @@
   }
   
   DoEnergyDonatePercent(energyReceiver, m_organism->GetFracEnergyDonating());
-  m_organism->GetPhenotype().IncDonates();
-  m_organism->GetPhenotype().SetIsEnergyDonor();
   
   return true;
   
@@ -4520,8 +4604,6 @@
     if ( (neighbor->GetPhenotype().HasOpenEnergyRequest()) || (m_world->GetConfig().ENERGY_SHARING_METHOD.Get() == 1) )
     {
       DoEnergyDonatePercent(neighbor, m_organism->GetFracEnergyDonating());
-      m_organism->GetPhenotype().IncDonates();
-      m_organism->GetPhenotype().SetIsEnergyDonor();
     }
   }  
   
@@ -4530,6 +4612,160 @@
 } //End Inst_DonateEnergyFaced()
 
 
+bool cHardwareCPU::Inst_DonateEnergyFaced1(cAvidaContext& ctx)
+{
+  if(m_organism->GetCellID() < 0) {
+    return false;
+  }	
+  
+  cOrganism * neighbor = m_organism->GetNeighbor();
+  
+  if ( (neighbor != NULL) && (!neighbor->IsDead()) ) {
+    
+    // If the neighbor has requested energy or if we're allowing push sharing, share energy
+    if ( (neighbor->GetPhenotype().HasOpenEnergyRequest()) || (m_world->GetConfig().ENERGY_SHARING_METHOD.Get() == 1) )
+    {
+      DoEnergyDonateAmount(neighbor, 1);
+    }
+  }  
+  
+  return true;
+  
+} //End Inst_DonateEnergyFaced1()
+
+
+bool cHardwareCPU::Inst_DonateEnergyFaced2(cAvidaContext& ctx)
+{
+  if(m_organism->GetCellID() < 0) {
+    return false;
+  }	
+  
+  cOrganism * neighbor = m_organism->GetNeighbor();
+  
+  if ( (neighbor != NULL) && (!neighbor->IsDead()) ) {
+    
+    // If the neighbor has requested energy or if we're allowing push sharing, share energy
+    if ( (neighbor->GetPhenotype().HasOpenEnergyRequest()) || (m_world->GetConfig().ENERGY_SHARING_METHOD.Get() == 1) )
+    {
+      DoEnergyDonateAmount(neighbor, 2);
+    }
+  }  
+  
+  return true;
+  
+} //End Inst_DonateEnergyFaced2()
+
+
+bool cHardwareCPU::Inst_DonateEnergyFaced5(cAvidaContext& ctx)
+{
+  if(m_organism->GetCellID() < 0) {
+    return false;
+  }	
+  
+  cOrganism * neighbor = m_organism->GetNeighbor();
+  
+  if ( (neighbor != NULL) && (!neighbor->IsDead()) ) {
+    
+    // If the neighbor has requested energy or if we're allowing push sharing, share energy
+    if ( (neighbor->GetPhenotype().HasOpenEnergyRequest()) || (m_world->GetConfig().ENERGY_SHARING_METHOD.Get() == 1) )
+    {
+      DoEnergyDonateAmount(neighbor, 5);
+    }
+  }  
+  
+  return true;
+  
+} //End Inst_DonateEnergyFaced5()
+
+
+bool cHardwareCPU::Inst_DonateEnergyFaced10(cAvidaContext& ctx)
+{
+  if(m_organism->GetCellID() < 0) {
+    return false;
+  }	
+  
+  cOrganism * neighbor = m_organism->GetNeighbor();
+  
+  if ( (neighbor != NULL) && (!neighbor->IsDead()) ) {
+    
+    // If the neighbor has requested energy or if we're allowing push sharing, share energy
+    if ( (neighbor->GetPhenotype().HasOpenEnergyRequest()) || (m_world->GetConfig().ENERGY_SHARING_METHOD.Get() == 1) )
+    {
+      DoEnergyDonateAmount(neighbor, 10);
+    }
+  }  
+  
+  return true;
+  
+} //End Inst_DonateEnergyFaced10()
+
+
+bool cHardwareCPU::Inst_DonateEnergyFaced20(cAvidaContext& ctx)
+{
+  if(m_organism->GetCellID() < 0) {
+    return false;
+  }	
+  
+  cOrganism * neighbor = m_organism->GetNeighbor();
+  
+  if ( (neighbor != NULL) && (!neighbor->IsDead()) ) {
+    
+    // If the neighbor has requested energy or if we're allowing push sharing, share energy
+    if ( (neighbor->GetPhenotype().HasOpenEnergyRequest()) || (m_world->GetConfig().ENERGY_SHARING_METHOD.Get() == 1) )
+    {
+      DoEnergyDonateAmount(neighbor, 20);
+    }
+  }  
+  
+  return true;
+  
+} //End Inst_DonateEnergyFaced20()
+
+
+bool cHardwareCPU::Inst_DonateEnergyFaced50(cAvidaContext& ctx)
+{
+  if(m_organism->GetCellID() < 0) {
+    return false;
+  }	
+  
+  cOrganism * neighbor = m_organism->GetNeighbor();
+  
+  if ( (neighbor != NULL) && (!neighbor->IsDead()) ) {
+    
+    // If the neighbor has requested energy or if we're allowing push sharing, share energy
+    if ( (neighbor->GetPhenotype().HasOpenEnergyRequest()) || (m_world->GetConfig().ENERGY_SHARING_METHOD.Get() == 1) )
+    {
+      DoEnergyDonateAmount(neighbor, 50);
+    }
+  }  
+  
+  return true;
+  
+} //End Inst_DonateEnergyFaced50()
+
+
+bool cHardwareCPU::Inst_DonateEnergyFaced100(cAvidaContext& ctx)
+{
+  if(m_organism->GetCellID() < 0) {
+    return false;
+  }	
+  
+  cOrganism * neighbor = m_organism->GetNeighbor();
+  
+  if ( (neighbor != NULL) && (!neighbor->IsDead()) ) {
+    
+    // If the neighbor has requested energy or if we're allowing push sharing, share energy
+    if ( (neighbor->GetPhenotype().HasOpenEnergyRequest()) || (m_world->GetConfig().ENERGY_SHARING_METHOD.Get() == 1) )
+    {
+      DoEnergyDonateAmount(neighbor, 100);
+    }
+  }  
+  
+  return true;
+  
+} //End Inst_DonateEnergyFaced100()
+
+
 // Rotate to face the most energy needy neighbor
 bool cHardwareCPU::Inst_RotateToMostNeedy(cAvidaContext& ctx)
 {
@@ -4584,6 +4820,7 @@
   
   m_organism->BroadcastMessage(ctx, msg);
   m_organism->GetPhenotype().SetIsEnergyRequestor();
+  m_organism->GetPhenotype().IncreaseNumEnergyRequests();
   
   return true;
   
@@ -4598,7 +4835,9 @@
   }	
   
   m_organism->GetPhenotype().SetIsEnergyRequestor();
+  m_organism->GetPhenotype().IncreaseNumEnergyRequests();
   m_organism->GetPhenotype().SetHasOpenEnergyRequest();
+  
   return true;
 } //End Inst_RequestEnergyFlagOn()
 
@@ -5794,6 +6033,40 @@
 } //End Inst_IfEnergyNotInBuffer()
 
 
+bool cHardwareCPU::Inst_GetEnergyLevel(cAvidaContext& ctx) {
+  
+  if(m_organism->GetCellID() < 0) {
+    return false;
+  }	
+  
+  const int reg = FindModifiedRegister(REG_BX);
+  GetRegister(reg) = (int) floor(m_organism->GetPhenotype().GetStoredEnergy());
+  
+  return true;
+	
+} //End Inst_GetEnergyLevel()
+
+
+bool cHardwareCPU::Inst_GetFacedEnergyLevel(cAvidaContext& ctx) {
+  
+  if(m_organism->GetCellID() < 0) {
+    return false;
+  }	
+  
+  cOrganism * neighbor = m_organism->GetNeighbor();
+  
+  if( (neighbor == NULL) || (neighbor->IsDead()) ) {
+    return false;  
+  }
+    
+  const int reg = FindModifiedRegister(REG_BX);
+  GetRegister(reg) = (int) floor(neighbor->GetPhenotype().GetStoredEnergy());
+  
+  return true;
+	
+} //End Inst_GetFacedEnergyLevel()
+
+
 bool cHardwareCPU::Inst_Sleep(cAvidaContext& ctx) {
   cPopulation& pop = m_world->GetPopulation();
   int cellID = m_organism->GetCellID();

Modified: branches/interrupt/source/cpu/cHardwareCPU.h
===================================================================
--- branches/interrupt/source/cpu/cHardwareCPU.h	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/cpu/cHardwareCPU.h	2009-06-25 15:43:37 UTC (rev 3332)
@@ -374,7 +374,9 @@
   bool Inst_IfANotEqB(cAvidaContext& ctx);
   bool Inst_IfBNotEqC(cAvidaContext& ctx);
   bool Inst_IfANotEqC(cAvidaContext& ctx);
-
+  bool Inst_IfGrX(cAvidaContext& ctx);
+  bool Inst_IfEquX(cAvidaContext& ctx);
+  
   bool Inst_JumpF(cAvidaContext& ctx);
   bool Inst_JumpB(cAvidaContext& ctx);
   bool Inst_Call(cAvidaContext& ctx);
@@ -519,6 +521,7 @@
   void DoDonate(cOrganism * to_org);
   void DoEnergyDonate(cOrganism* to_org);
   void DoEnergyDonatePercent(cOrganism* to_org, const double frac_energy_given);
+  void DoEnergyDonateAmount(cOrganism* to_org, const double amount);
   bool Inst_DonateRandom(cAvidaContext& ctx);
   bool Inst_DonateKin(cAvidaContext& ctx);
   bool Inst_DonateEditDist(cAvidaContext& ctx);
@@ -532,6 +535,13 @@
   bool Inst_DonateEnergy(cAvidaContext& ctx);
   bool Inst_UpdateMetabolicRate(cAvidaContext& ctx);
   bool Inst_DonateEnergyFaced(cAvidaContext& ctx);
+  bool Inst_DonateEnergyFaced1(cAvidaContext& ctx);
+  bool Inst_DonateEnergyFaced2(cAvidaContext& ctx);
+  bool Inst_DonateEnergyFaced5(cAvidaContext& ctx);
+  bool Inst_DonateEnergyFaced10(cAvidaContext& ctx);
+  bool Inst_DonateEnergyFaced20(cAvidaContext& ctx);
+  bool Inst_DonateEnergyFaced50(cAvidaContext& ctx);
+  bool Inst_DonateEnergyFaced100(cAvidaContext& ctx);
   bool Inst_RotateToMostNeedy(cAvidaContext& ctx);
   bool Inst_RequestEnergy(cAvidaContext& ctx);
   bool Inst_RequestEnergyFlagOn(cAvidaContext& ctx);
@@ -659,6 +669,8 @@
   bool Inst_IfFacedEnergyLess(cAvidaContext& ctx);
   bool Inst_IfEnergyInBuffer(cAvidaContext& ctx);
   bool Inst_IfEnergyNotInBuffer(cAvidaContext& ctx);
+  bool Inst_GetEnergyLevel(cAvidaContext& ctx);
+  bool Inst_GetFacedEnergyLevel(cAvidaContext& ctx);
 	
   bool Inst_Sleep(cAvidaContext& ctx);
   bool Inst_GetUpdate(cAvidaContext& ctx);

Modified: branches/interrupt/source/main/cDeme.cc
===================================================================
--- branches/interrupt/source/main/cDeme.cc	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/main/cDeme.cc	2009-06-25 15:43:37 UTC (rev 3332)
@@ -76,6 +76,10 @@
   last_org_reaction_count.ResizeClear(num_reactions);
   last_org_reaction_count.SetAll(0);
   
+  total_energy_donated = 0.0;
+  total_energy_received = 0.0;
+  total_energy_applied = 0.0;
+  
   // If width is negative, set it to the full number of cells.
   width = in_width;
   if (width < 1) width = cell_ids.GetSize();
@@ -258,6 +262,10 @@
   consecutiveSuccessfulEventPeriods = 0;
   
 	replicateDeme = false;
+  
+  total_energy_donated = 0.0;
+  total_energy_received = 0.0;
+  total_energy_applied = 0.0;
 	
   cur_task_exe_count.SetAll(0);
   cur_reaction_count.SetAll(0);

Modified: branches/interrupt/source/main/cDeme.h
===================================================================
--- branches/interrupt/source/main/cDeme.h	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/main/cDeme.h	2009-06-25 15:43:37 UTC (rev 3332)
@@ -89,6 +89,10 @@
   cDoubleSum energyUsage;
 	int nextAvailBoundary;
   
+  double total_energy_donated;
+  double total_energy_received;
+  double total_energy_applied;
+  
   tArray<int> cur_task_exe_count;
   tArray<int> cur_reaction_count;
   tArray<int> last_task_exe_count;
@@ -337,6 +341,14 @@
 	void ClearMigrationOut() { migrations_out = 0; }
 	void ClearMigrationIn() { migrations_in = 0; }
 	void ClearSuicides() { suicides = 0; }
+  
+  // --- Energy Sharing --- //
+  double GetEnergyDonated() const { return total_energy_donated; }
+  double GetEnergyReceived() const { return total_energy_received; }
+  double GetEnergyApplied() const { return total_energy_applied; }
+  void IncreaseEnergyDonated(double amount) { assert(amount >=0); total_energy_donated += amount; }
+  void IncreaseEnergyReceived(double amount) { assert(amount >=0); total_energy_received += amount; }
+  void IncreaseEnergyApplied(double amount) { assert(amount >=0); total_energy_applied += amount; }
 	
 	// ----Opinions--- //
 	bool allOrgsHaveSetOpinion();

Modified: branches/interrupt/source/main/cPhenotype.cc
===================================================================
--- branches/interrupt/source/main/cPhenotype.cc	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/main/cPhenotype.cc	2009-06-25 15:43:37 UTC (rev 3332)
@@ -1398,7 +1398,11 @@
     SetEnergy(energy_store + energy_received_buffer);
   }
   
+  IncreaseNumEnergyApplications();
+  SetHasUsedDonatedEnergy();
+  
   energy_received_buffer = 0.0;
+  
 } //End AppplyDonatedEnergy()
 
 
@@ -1406,7 +1410,8 @@
   assert(donation >= 0.0);  
   energy_received_buffer += donation;
   IncreaseEnergyReceived(donation);
-  is_energy_receiver = true;
+  SetIsEnergyReceiver();
+  IncreaseNumEnergyReceptions();
 } //End ReceiveDonatedEnergy()
 
 

Modified: branches/interrupt/source/main/cPhenotype.h
===================================================================
--- branches/interrupt/source/main/cPhenotype.h	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/main/cPhenotype.h	2009-06-25 15:43:37 UTC (rev 3332)
@@ -114,6 +114,10 @@
   double total_energy_donated;                // Tota amount of energy that has been donated
   double total_energy_received;               // Total amount of energy received through donations
   double total_energy_applied;                // Total amount of received energy applied to energy store
+  int num_energy_requests;                    // Number of times organism has requested energy
+  int num_energy_donations;                   // Number of times energy has been donated
+  int num_energy_receptions;                    // Number of times organism has received energy donations
+  int num_energy_applications;                // Number of times organism has applied donated energy to its energy store
   int cur_num_errors;                         // Total instructions executed illeagally.
   int cur_num_donates;                        // Number of donations so far
   tArray<int> cur_task_count;                 // Total times each task was performed
@@ -465,9 +469,16 @@
   void IncreaseEnergyDonated(double amount) { assert(amount >=0); total_energy_donated += amount; }
   void IncreaseEnergyReceived(double amount) { assert(amount >=0); total_energy_received += amount; }
   void IncreaseEnergyApplied(double amount) { assert(amount >=0); total_energy_applied += amount; }
+  void IncreaseNumEnergyRequests() { num_energy_requests++; }
+  void IncreaseNumEnergyDonations() { num_energy_donations++; }
+  void IncreaseNumEnergyApplications() { num_energy_applications++; }
+  void IncreaseNumEnergyReceptions() { num_energy_receptions++; }
   double GetAmountEnergyDonated() { return total_energy_donated; }
   double GetAmountEnergyReceived() { return total_energy_received; }
   double GetAmountEnergyApplied() { return total_energy_applied; }
+  int GetNumEnergyDonations() { return num_energy_donations; }
+  int GetNumEnergyReceptions() { return num_energy_receptions; }
+  int GetNumEnergyApplications() { return num_energy_applications; }
   
   void SetCurRBinsAvail(const tArray<double>& in_avail) { cur_rbins_avail = in_avail; }
   void SetCurRbinsTotal(const tArray<double>& in_total) { cur_rbins_total = in_total; }

Modified: branches/interrupt/source/main/cPopulation.cc
===================================================================
--- branches/interrupt/source/main/cPopulation.cc	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/main/cPopulation.cc	2009-06-25 15:43:37 UTC (rev 3332)
@@ -2758,7 +2758,6 @@
 
 // Print some stats about the energy sharing behavior of each deme
 void cPopulation::PrintDemeEnergySharingStats() {
-  //TODO: BDC: move this from covering the population to per deme or deme average
   const int num_demes = deme_array.GetSize();
   cStats& stats = m_world->GetStats();
   cDataFile & df_donor = m_world->GetDataFile("deme_energy_sharing.dat");
@@ -2769,6 +2768,9 @@
   double num_requestors = 0;
   double num_donors = 0;
   double num_receivers = 0;
+  double num_donations = 0;
+  double num_receptions = 0;
+  double num_applications;
   double amount_donated = 0.0;
   double amount_received = 0.0;
   double amount_applied = 0.0;  
@@ -2783,22 +2785,79 @@
       if(phenotype.IsEnergyRequestor()) num_requestors++;
       if(phenotype.IsEnergyDonor()) num_donors++;
       if(phenotype.IsEnergyReceiver()) num_receivers++;
+      num_donations += phenotype.GetNumEnergyDonations();
+      num_receptions += phenotype.GetNumEnergyReceptions();
+      num_applications += phenotype.GetNumEnergyApplications();
       amount_donated += phenotype.GetAmountEnergyDonated();
       amount_received += phenotype.GetAmountEnergyReceived();
       amount_applied += phenotype.GetAmountEnergyApplied();
     }
   }
+  
   df_donor.Write(num_requestors/num_demes, "Average number of organisms that have requested energy");
   df_donor.Write(num_donors/num_demes, "Average number of organisms that have donated energy");
   df_donor.Write(num_receivers/num_demes, "Average number of organisms that have received energy");
+  df_donor.Write(num_donations/num_demes, "Average number of donations per deme");
+  df_donor.Write(num_receptions/num_demes, "Average number of receipts per deme");
+  df_donor.Write(num_applications/num_demes, "Average number of applications per deme");
   df_donor.Write(amount_donated/num_demes, "Average total amount of energy donated per deme");
   df_donor.Write(amount_received/num_demes, "Average total amount of energy received per deme");
   df_donor.Write(amount_applied/num_demes, "Average total amount of donated energy applied per deme");
   df_donor.Endl();  
   
-}
+} //End PrintDemeEnergySharingStats()
 
 
+// Print some stats about the distribution of energy among organisms in a deme
+void cPopulation::PrintDemeEnergyDistributionStats() {
+  const int num_demes = deme_array.GetSize();
+  cStats& stats = m_world->GetStats();
+  cString comment;
+  
+  cDoubleSum deme_energy_distribution;
+
+  cDoubleSum overall_average;
+  cDoubleSum overall_variance;
+  cDoubleSum overall_stddev;
+  
+  cDataFile & df_dist = m_world->GetDataFile("deme_energy_distribution.dat");
+  comment.Set("Average distribution of energy among organisms in each of %d %d x %d demes", num_demes, m_world->GetConfig().WORLD_X.Get(), m_world->GetConfig().WORLD_Y.Get()/num_demes);
+  df_dist.WriteComment(comment);
+  df_dist.WriteTimeStamp();
+  df_dist.Write(stats.GetUpdate(), "Update");
+      
+  for (int deme_id = 0; deme_id < num_demes; deme_id++) {
+    const cDeme & cur_deme = deme_array[deme_id];
+    
+    for (int i = 0; i < cur_deme.GetSize(); i++) {
+      
+      int cur_cell = cur_deme.GetCellID(i);
+      if (cell_array[cur_cell].IsOccupied() == false) {
+        //TODO: BDC: Get energy of cell and add that instead
+        deme_energy_distribution.Add(cur_deme.GetCellEnergy(cur_cell));
+        continue;
+      }
+      //TODO: add 0 for this deme
+      
+      deme_energy_distribution.Add(GetCell(cur_cell).GetOrganism()->GetPhenotype().GetStoredEnergy());
+    }
+    
+    overall_average.Add(deme_energy_distribution.Average());
+    overall_variance.Add(deme_energy_distribution.Variance());
+    overall_stddev.Add(deme_energy_distribution.StdDeviation());
+    deme_energy_distribution.Clear();
+  
+  }
+  
+  df_dist.Write(overall_average.Average(), "Average of Average Energy Level");
+  df_dist.Write(overall_variance.Average(), "Average of Energy Level Variance");
+  df_dist.Write(overall_stddev.Average(), "Average of Energy Level Standard Deviations");
+  
+  df_dist.Endl();
+  
+} //End PrintDemeEnergyDistributionStats()
+
+
 void cPopulation::PrintDemeDonor() {
   cStats& stats = m_world->GetStats();
   const int num_demes = deme_array.GetSize();

Modified: branches/interrupt/source/main/cPopulation.h
===================================================================
--- branches/interrupt/source/main/cPopulation.h	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/main/cPopulation.h	2009-06-25 15:43:37 UTC (rev 3332)
@@ -233,6 +233,7 @@
   void PrintDemeAllStats();
   void PrintDemeTestamentStats(const cString& filename);
   void PrintDemeEnergySharingStats();
+  void PrintDemeEnergyDistributionStats();
   void PrintDemeDonor();
   void PrintDemeFitness();
   void PrintDemeGestationTime();

Modified: branches/interrupt/source/main/cTaskLib.cc
===================================================================
--- branches/interrupt/source/main/cTaskLib.cc	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/main/cTaskLib.cc	2009-06-25 15:43:37 UTC (rev 3332)
@@ -3166,7 +3166,8 @@
   schema.AddEntry("poison", 1, cArgSchema::SCHEMA_STRING);
   
   // Double Arguments
-  schema.AddEntry("halflife", 0, cArgSchema::SCHEMA_DOUBLE);
+//  schema.AddEntry("halflife", 0, cArgSchema::SCHEMA_DOUBLE);
+//  schema.AddEntry("base", 1, 2.0);
   
   cArgContainer* args = cArgContainer::Load(argstr, schema, errors);
   if (args) NewTask(name, "State Grid Path Traversal", &cTaskLib::Task_SGPathTraversal, 0, args);
@@ -3204,8 +3205,9 @@
   
   double quality = 0.0;
   
-  double halflife = -1.0 * fabs(args.GetDouble(0));
-  quality = pow(2.0, (double)(args.GetInt(0) - ((traversed >= 0) ? traversed : 0)) / halflife);
+//  double halflife = -1.0 * fabs(args.GetDouble(0));
+//  quality = pow(args.GetDouble(1), (double)(args.GetInt(0) - ((traversed >= 0) ? traversed : 0)) / halflife);
+  quality = (double)((traversed >= 0) ? traversed : 0) / (double)args.GetInt(0);
   
   return quality;
 }  

Modified: branches/interrupt/source/targets/avida-viewer/cOptionsScreen.cc
===================================================================
--- branches/interrupt/source/targets/avida-viewer/cOptionsScreen.cc	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/targets/avida-viewer/cOptionsScreen.cc	2009-06-25 15:43:37 UTC (rev 3332)
@@ -54,7 +54,7 @@
   PrintOption(Height() - 3, 30, "[CTRL-L] Redraw Screen");
   PrintOption(Height() - 2, 30, "[C]hoose New CPU");
 
-  PrintOption(Height() - 6, 55, "E[x]tract Creature");
+  PrintOption(Height() - 6, 55, "E[x]tract Organism");
   PrintOption(Height() - 5, 55, "[W]rite Soup Clone");
   if (info.GetPauseLevel()) {
     PrintOption(Height() - 4, 55, "Un-[P]ause");

Modified: branches/interrupt/source/targets/avida-viewer/cStatsScreen.cc
===================================================================
--- branches/interrupt/source/targets/avida-viewer/cStatsScreen.cc	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/targets/avida-viewer/cStatsScreen.cc	2009-06-25 15:43:37 UTC (rev 3332)
@@ -36,7 +36,7 @@
   Print(5, 23, "Age.........:");
 
   Print(8, 11, "Current    Total  Ave Age  Entropy");
-  Print(9,  0, "Creatures:");
+  Print(9,  0, "Organisms:");
   Print(10, 0, "Genotypes:");
   Print(11, 0, "Threshold:");
   Print(12, 0, "Species..:");

Modified: branches/interrupt/source/targets/avida-viewer/key_chart
===================================================================
--- branches/interrupt/source/targets/avida-viewer/key_chart	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/targets/avida-viewer/key_chart	2009-06-25 15:43:37 UTC (rev 3332)
@@ -10,7 +10,7 @@
 Q: Quit
 S: Stats
 W: Write Soup
-X: Extract Creature
+X: Extract Organism
 Z: Zoom
 
 - Zoom -
@@ -18,4 +18,4 @@
 TAB: Toggle Component (+shift-TAB?)
 E: Edit Component
 T: Thread Info
-V: View Component
\ No newline at end of file
+V: View Component

Modified: branches/interrupt/source/utils/make_actions_html/actions_source_info
===================================================================
--- branches/interrupt/source/utils/make_actions_html/actions_source_info	2009-06-23 20:27:33 UTC (rev 3331)
+++ branches/interrupt/source/utils/make_actions_html/actions_source_info	2009-06-25 15:43:37 UTC (rev 3332)
@@ -400,6 +400,39 @@
   environmental settings on the fly.  <b>You should create all resources and 
   reactions in the environment file</b> and only use this file to change these
   resources and reactions. 
+=== Action cAssignRandomCellData ===
+  Assign a random identifier to the data for each cell and save those IDs for 
+  later use, respecting deme boundaries.
+=== Action CompeteDemesByTaskCount ===
+  Competes demes based on the total number of times that a
+  task has been completed by an organism in the deme since the
+  was initialized. This action takes one integer parameter representing
+  number of the task that is to be used for competition. If no parameter
+  supplied, the class uses the first task defined in the environment file
+  compete the demes.
+=== Action DecayPoints ===
+  Decays the number of points a deme has accumulated by
+  a percentage that is set in the configuration file.
+=== InjectDemesRandom ===
+  Injects one or more organisms into all demes in a randomly-chosen cell.
+  <P>*  Note: This gets the genotype from the germline, so germline use is required</P>
+  <p>*  Note: one organism is inserted each time this is called, and it will 
+  stop when the given number of organisms has been injected.</p>
+
+  <p>Parameters:
+    <ul>
+      <li>number of orgs (int): number of organisms to inject into each deme - default 1
+      <li>merit (double): The initial merit of the organism. If set to -1, this is ignored - default -1
+      <li>lineage label (integer): An integer that marks all descendants of this organism  - default 0
+      <li>neutral metric (double):  A double value that randomly drifts over time - default 0
+    </ul>
+  </p>
+=== Action SetSeasonalResource ===
+  Sets resource availiblity to seasonal
+=== Action SetSeasonalResource1Kyears_1To_1 ===
+  Sets resource availiblity to seasonal 1 to -1 for 1K years of 365 updates
+=== Action SetSeasonalResource10Kyears_1To_1 ===
+  Sets resource availiblity to seasonal 1 to -1 for 10K years of 365 updates
 === Action inject_resource ===
   <font color="red">DEPRECATED</font>
 === Action inject_scaled_resource ===

Copied: branches/interrupt/support/math (from rev 3150, development/support/math)

Deleted: branches/interrupt/support/math/README
===================================================================
--- development/support/math/README	2009-02-19 16:19:24 UTC (rev 3150)
+++ branches/interrupt/support/math/README	2009-06-25 15:43:37 UTC (rev 3332)
@@ -1,37 +0,0 @@
-======== Introduction
-
-This directory contains a bunch of matlab scripts that help with analyzing
-Avida data files.  Many of these scripts assume unix/os x (sorry).
-
-Most of these scripts have comments to help decipher how they work, try, for example "help quick_load" from Matlab's command window.  It would probably be useful to set Matlab's path to point to this directory.
-
-Briefly, here's what each script here does:
-
-exportfig.m: low-level function to export a figure in camera-ready eps format
-find_files.m: recursive search for files
-header_lines.m: retrieve the header lines from an Avida data file
-load_files.m: low-level function to load data files into an array
-newfigure.m: wrapper around figure that makes figures look nice
-quick_load.m: load a series of data files into a structure for analysis
-quick_export.m: a wrapper around exportfig that makes figures look nice
-stderr.m: calculate the standard error of an array
-
-======== How to use quick_load
-
-Quick_load is a Matlab script that I've found useful for dealing with the types of data files that Avida generates (gzip'ed, data from multiple trials, etc.).
-
-In most cases, quick_load can be called with a regular expression that matches the files of interest.  For example, the following command loads all files below the current working directory that match the string "bcast_.*deme_compete".
-
-d = quick_load('"bcast_.*deme_compete"');
-
-NOTE THE USE OF MULTIPLE QUOTES!!!  One of the nice feature of quick_load is that it doesn't care whether the data files are gzip'ed or not.
-
-The return value from this command looks like this:
-d = 
-    filenames: {1x30 cell}
-    fieldnames: {3x1 cell}
-    update: [30x500 double]
-    avgfit: [30x500 double]
-    maxfit: [30x500 double]
-
-If all the header lines of the data file end with [\w+], then quick_load will unpack the array into fieldnames as well.

Copied: branches/interrupt/support/math/README (from rev 3150, development/support/math/README)
===================================================================
--- branches/interrupt/support/math/README	                        (rev 0)
+++ branches/interrupt/support/math/README	2009-06-25 15:43:37 UTC (rev 3332)
@@ -0,0 +1,37 @@
+======== Introduction
+
+This directory contains a bunch of matlab scripts that help with analyzing
+Avida data files.  Many of these scripts assume unix/os x (sorry).
+
+Most of these scripts have comments to help decipher how they work, try, for example "help quick_load" from Matlab's command window.  It would probably be useful to set Matlab's path to point to this directory.
+
+Briefly, here's what each script here does:
+
+exportfig.m: low-level function to export a figure in camera-ready eps format
+find_files.m: recursive search for files
+header_lines.m: retrieve the header lines from an Avida data file
+load_files.m: low-level function to load data files into an array
+newfigure.m: wrapper around figure that makes figures look nice
+quick_load.m: load a series of data files into a structure for analysis
+quick_export.m: a wrapper around exportfig that makes figures look nice
+stderr.m: calculate the standard error of an array
+
+======== How to use quick_load
+
+Quick_load is a Matlab script that I've found useful for dealing with the types of data files that Avida generates (gzip'ed, data from multiple trials, etc.).
+
+In most cases, quick_load can be called with a regular expression that matches the files of interest.  For example, the following command loads all files below the current working directory that match the string "bcast_.*deme_compete".
+
+d = quick_load('"bcast_.*deme_compete"');
+
+NOTE THE USE OF MULTIPLE QUOTES!!!  One of the nice feature of quick_load is that it doesn't care whether the data files are gzip'ed or not.
+
+The return value from this command looks like this:
+d = 
+    filenames: {1x30 cell}
+    fieldnames: {3x1 cell}
+    update: [30x500 double]
+    avgfit: [30x500 double]
+    maxfit: [30x500 double]
+
+If all the header lines of the data file end with [\w+], then quick_load will unpack the array into fieldnames as well.

Deleted: branches/interrupt/support/math/exportfig.m
===================================================================
--- development/support/math/exportfig.m	2009-02-19 16:19:24 UTC (rev 3150)
+++ branches/interrupt/support/math/exportfig.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -1,500 +0,0 @@
-function exportfig(varargin)
-%EXPORTFIG  Export a figure to Encapsulated Postscript.
-%   EXPORTFIG(H, FILENAME) writes the figure H to FILENAME.  H is
-%   a figure handle and FILENAME is a string that specifies the
-%   name of the output file.
-%
-%   EXPORTFIG(...,PARAM1,VAL1,PARAM2,VAL2,...) specifies
-%   parameters that control various characteristics of the output
-%   file.
-%
-%   Format Paramter:
-%     'Format'  one of the strings 'eps','eps2','jpeg','png','preview'
-%          specifies the output format. Defaults to 'eps'.
-%          The output format 'preview' does not generate an output
-%          file but instead creates a new figure window with a
-%          preview of the exported figure. In this case the
-%          FILENAME parameter is ignored.
-%
-%     'Preview' one of the strings 'none', 'tiff'
-%          specifies a preview for EPS files. Defaults to 'none'.
-%
-%   Size Parameters:
-%     'Width'   a positive scalar
-%          specifies the width in the figure's PaperUnits
-%     'Height'  a positive scalar
-%          specifies the height in the figure's PaperUnits
-%
-%     Specifying only one dimension sets the other dimension
-%     so that the exported aspect ratio is the same as the
-%     figure's current aspect ratio. 
-%     If neither dimension is specified the size defaults to 
-%     the width and height from the figure's PaperPosition. 
-%           
-%   Rendering Parameters:
-%     'Color'     one of the strings 'bw', 'gray', 'cmyk'
-%         'bw'    specifies that lines and text are exported in
-%                 black and all other objects in grayscale
-%         'gray'  specifies that all objects are exported in grayscale
-%         'cmyk'  specifies that all objects are exported in color
-%                 using the CMYK color space
-%     'Renderer'  one of the strings 'painters', 'zbuffer', 'opengl'
-%         specifies the renderer to use
-%     'Resolution'   a positive scalar
-%         specifies the resolution in dots-per-inch.
-%     
-%     The default color setting is 'bw'.
-%
-%   Font Parameters:
-%     'FontMode'     one of the strings 'scaled', 'fixed'
-%     'FontSize'     a positive scalar
-%          in 'scaled' mode multiplies with the font size of each
-%          text object to obtain the exported font size
-%          in 'fixed' mode specifies the font size of all text
-%          objects in points
-%     'FontEncoding' one of the strings 'latin1', 'adobe'
-%          specifies the character encoding of the font
-%
-%     If FontMode is 'scaled' but FontSize is not specified then a
-%     scaling factor is computed from the ratio of the size of the
-%     exported figure to the size of the actual figure. The minimum
-%     font size allowed after scaling is 5 points.
-%     If FontMode is 'fixed' but FontSize is not specified then the
-%     exported font sizes of all text objects is 7 points.
-%
-%     The default 'FontMode' setting is 'scaled'.
-%
-%   Line Width Parameters:
-%     'LineMode'     one of the strings 'scaled', 'fixed'
-%     'LineWidth'    a positive scalar
-%          the semantics of LineMode and LineWidth are exactly the
-%          same as FontMode and FontSize, except that they apply
-%          to line widths instead of font sizes. The minumum line
-%          width allowed after scaling is 0.5 points.
-%          If LineMode is 'fixed' but LineWidth is not specified 
-%          then the exported line width of all line objects is 1
-%          point. 
-%
-%   Examples:
-%     exportfig(gcf,'fig1.eps','height',3);
-%       Exports the current figure to the file named 'fig1.eps' with
-%       a height of 3 inches (assuming the figure's PaperUnits is 
-%       inches) and an aspect ratio the same as the figure's aspect
-%       ratio on screen.
-%
-%     exportfig(gcf, 'fig2.eps', 'FontMode', 'fixed',...
-%                'FontSize', 10, 'color', 'cmyk' );
-%       Exports the current figure to 'fig2.eps' in color with all
-%       text in 10 point fonts. The size of the exported figure is
-%       the figure's PaperPostion width and height.
-
-
-if (nargin < 2)
-  error('Too few input arguments');
-end
-
-% exportfig(H, filename, ...)
-H = varargin{1};
-if ~ishandle(H) | ~strcmp(get(H,'type'), 'figure')
-  error('First argument must be a handle to a figure.');
-end
-filename = varargin{2};
-if ~ischar(filename)
-  error('Second argument must be a string.');
-end
-paramPairs = varargin(3:end);
-
-% Do some validity checking on param-value pairs
-if (rem(length(paramPairs),2) ~= 0)
-  error(['Invalid input syntax. Optional parameters and values' ...
-	 ' must be in pairs.']);
-end
-
-format = 'eps';
-preview = 'none';
-width = -1;
-height = -1;
-color = 'bw';
-fontsize = -1;
-fontmode='scaled';
-linewidth = -1;
-linemode=[];
-fontencoding = 'latin1';
-renderer = [];
-resolution = [];
-
-% Process param-value pairs
-args = {};
-for k = 1:2:length(paramPairs)
-  param = lower(paramPairs{k});
-  if (~ischar(param))
-    error('Optional parameter names must be strings');
-  end
-  value = paramPairs{k+1};
-  
-  switch (param)
-   case 'format'
-    format = value;
-    if (~strcmp(format,{'eps','eps2','jpeg','png','preview'}))
-      error(['Format must be ''eps'', ''eps2'', ''jpeg'', ''png'' or' ...
-	     ' ''preview''.']);
-    end
-   case 'preview'
-    preview = value;
-    if (~strcmp(preview,{'none','tiff'}))
-      error('Preview must be ''none'' or ''tiff''.');
-    end
-   case 'width'
-    width = LocalToNum(value);
-    if(~LocalIsPositiveScalar(width))
-      error('Width must be a numeric scalar > 0');
-    end
-   case 'height'
-    height = LocalToNum(value);
-    if(~LocalIsPositiveScalar(height))
-      error('Height must be a numeric scalar > 0');
-    end
-   case 'color'
-    color = lower(value);
-    if (~strcmp(color,{'bw','gray','cmyk'}))
-      error('Color must be ''bw'', ''gray'' or ''cmyk''.');
-    end
-   case 'fontmode'
-    fontmode = lower(value);
-    if (~strcmp(fontmode,{'scaled','fixed'}))
-      error('FontMode must be ''scaled'' or ''fixed''.');
-    end
-   case 'fontsize'
-    fontsize = LocalToNum(value);
-    if(~LocalIsPositiveScalar(fontsize))
-      error('FontSize must be a numeric scalar > 0');
-    end
-   case 'fontencoding'
-    fontencoding = lower(value);
-    if (~strcmp(fontencoding,{'latin1','adobe'}))
-      error('FontEncoding must be ''latin1'' or ''adobe''.');
-    end
-   case 'linemode'
-    linemode = lower(value);
-    if (~strcmp(linemode,{'scaled','fixed'}))
-      error('LineMode must be ''scaled'' or ''fixed''.');
-    end
-   case 'linewidth'
-    linewidth = LocalToNum(value);
-    if(~LocalIsPositiveScalar(linewidth))
-      error('LineWidth must be a numeric scalar > 0');
-    end
-   case 'renderer'
-    renderer = lower(value);
-    if (~strcmp(renderer,{'painters','zbuffer','opengl'}))
-      error('Renderer must be ''painters'', ''zbuffer'' or ''opengl''.');
-    end
-   case 'resolution'
-    resolution = LocalToNum(value);
-    if ~(isnumeric(value) & (prod(size(value)) == 1) & (value >= 0));
-      error('Resolution must be a numeric scalar >= 0');
-    end
-   otherwise
-    error(['Unrecognized option ' param '.']);
-  end
-end
-
-allLines  = findall(H, 'type', 'line');
-allText   = findall(H, 'type', 'text');
-allAxes   = findall(H, 'type', 'axes');
-allImages = findall(H, 'type', 'image');
-allLights = findall(H, 'type', 'light');
-allPatch  = findall(H, 'type', 'patch');
-allSurf   = findall(H, 'type', 'surface');
-allRect   = findall(H, 'type', 'rectangle');
-allFont   = [allText; allAxes];
-allColor  = [allLines; allText; allAxes; allLights];
-allMarker = [allLines; allPatch; allSurf];
-allEdge   = [allPatch; allSurf];
-allCData  = [allImages; allPatch; allSurf];
-
-old.objs = {};
-old.prop = {};
-old.values = {};
-
-% Process format and preview parameter
-showPreview = strcmp(format,'preview');
-if showPreview
-  format = 'png';
-  filename = [tempName '.png'];
-end
-if strncmp(format,'eps',3) & ~strcmp(preview,'none')
-  args = {args{:}, ['-' preview]};
-end
-
-hadError = 0;
-try
-  % Process size parameters
-  paperPos = get(H, 'PaperPosition');
-  old = LocalPushOldData(old, H, 'PaperPosition', paperPos);
-  figureUnits = get(H, 'Units');
-  set(H, 'Units', get(H,'PaperUnits'));
-  figurePos = get(H, 'Position');
-  aspectRatio = figurePos(3)/figurePos(4);
-  set(H, 'Units', figureUnits);
-  if (width == -1) & (height == -1)
-    width = paperPos(3);
-    height = paperPos(4);
-  elseif (width == -1)
-    width = height * aspectRatio;
-  elseif (height == -1)
-    height = width / aspectRatio;
-  end
-  set(H, 'PaperPosition', [0 0 width height]);
-  paperPosMode = get(H, 'PaperPositionMode');
-  old = LocalPushOldData(old, H, 'PaperPositionMode', paperPosMode);
-  set(H, 'PaperPositionMode', 'manual');
-
-  % Process rendering parameters
-  switch (color)
-   case {'bw', 'gray'}
-    if ~strcmp(color,'bw') & strncmp(format,'eps',3)
-      format = [format 'c'];
-    end
-    args = {args{:}, ['-d' format]};
-
-    %compute and set gray colormap
-    oldcmap = get(H,'Colormap');
-    newgrays = 0.30*oldcmap(:,1) + 0.59*oldcmap(:,2) + 0.11*oldcmap(:,3);
-    newcmap = [newgrays newgrays newgrays];
-    old = LocalPushOldData(old, H, 'Colormap', oldcmap);
-    set(H, 'Colormap', newcmap);
-
-    %compute and set ColorSpec and CData properties
-    old = LocalUpdateColors(allColor, 'color', old);
-    old = LocalUpdateColors(allAxes, 'xcolor', old);
-    old = LocalUpdateColors(allAxes, 'ycolor', old);
-    old = LocalUpdateColors(allAxes, 'zcolor', old);
-    old = LocalUpdateColors(allMarker, 'MarkerEdgeColor', old);
-    old = LocalUpdateColors(allMarker, 'MarkerFaceColor', old);
-    old = LocalUpdateColors(allEdge, 'EdgeColor', old);
-    old = LocalUpdateColors(allEdge, 'FaceColor', old);
-    old = LocalUpdateColors(allCData, 'CData', old);
-    
-   case 'cmyk'
-    if strncmp(format,'eps',3)
-      format = [format 'c'];
-      args = {args{:}, ['-d' format], '-cmyk'};
-    else
-      args = {args{:}, ['-d' format]};
-    end
-   otherwise
-    error('Invalid Color parameter');
-  end
-  if (~isempty(renderer))
-    args = {args{:}, ['-' renderer]};
-  end
-  if (~isempty(resolution)) | ~strncmp(format,'eps',3)
-    if isempty(resolution)
-      resolution = 0;
-    end
-    args = {args{:}, ['-r' int2str(resolution)]};
-  end
-
-  % Process font parameters
-%   if (~isempty(fontmode))
-%     oldfonts = LocalGetAsCell(allFont,'FontSize');
-%     switch (fontmode)
-%      case 'fixed'
-%       oldfontunits = LocalGetAsCell(allFont,'FontUnits');
-%       old = LocalPushOldData(old, allFont, {'FontUnits'}, oldfontunits);
-%       set(allFont,'FontUnits','points');
-%       if (fontsize == -1)
-%     	set(allFont,'FontSize',7);
-%       else
-%     	set(allFont,'FontSize',fontsize);
-%       end
-%      case 'scaled'
-%       if (fontsize == -1)
-%     	wscale = width/figurePos(3);
-%     	hscale = height/figurePos(4);
-%     	scale = min(wscale, hscale);
-%       else
-%     	scale = fontsize;
-%       end
-%       newfonts = LocalScale(oldfonts,scale,5);
-%       set(allFont,{'FontSize'},newfonts);
-%      otherwise
-%       error('Invalid FontMode parameter');
-%     end
-%     % make sure we push the size after the units
-%     old = LocalPushOldData(old, allFont, {'FontSize'}, oldfonts);
-%   end
-  if strcmp(fontencoding,'adobe') & strncmp(format,'eps',3)
-    args = {args{:}, '-adobecset'};
-  end
-
-  % Process linewidth parameters
-  if (~isempty(linemode))
-    oldlines = LocalGetAsCell(allMarker,'LineWidth');
-    old = LocalPushOldData(old, allMarker, {'LineWidth'}, oldlines);
-    switch (linemode)
-     case 'fixed'
-      if (linewidth == -1)
-	set(allMarker,'LineWidth',1);
-      else
-	set(allMarker,'LineWidth',linewidth);
-      end
-     case 'scaled'
-      if (linewidth == -1)
-	wscale = width/figurePos(3);
-	hscale = height/figurePos(4);
-	scale = min(wscale, hscale);
-      else
-	scale = linewidth;
-      end
-      newlines = LocalScale(oldlines, scale, 0.5);
-      set(allMarker,{'LineWidth'},newlines);
-     otherwise
-      error('Invalid LineMode parameter');
-    end
-  end
-
-  % Export
-  print(H, filename, args{:});
-
-catch
-  hadError = 1;
-end
-
-% Restore figure settings
-for n=1:length(old.objs)
-  set(old.objs{n}, old.prop{n}, old.values{n});
-end
-
-if hadError
-  error(deblank(lasterr));
-end
-
-% Show preview if requested
-if showPreview
-  X = imread(filename,'png');
-  delete(filename);
-  f = figure( 'Name', 'Preview', ...
-	      'Menubar', 'none', ...
-	      'NumberTitle', 'off', ...
-	      'Visible', 'off');
-  image(X);
-  axis image;
-  ax = findobj(f, 'type', 'axes');
-  set(ax, 'Units', get(H,'PaperUnits'), ...
-	  'Position', [0 0 width height], ...
-	  'Visible', 'off');
-  set(ax, 'Units', 'pixels');
-  axesPos = get(ax,'Position');
-  figPos = get(f,'Position');
-  rootSize = get(0,'ScreenSize');
-  figPos(3:4) = axesPos(3:4);
-  if figPos(1) + figPos(3) > rootSize(3)
-    figPos(1) = rootSize(3) - figPos(3) - 50;
-  end
-  if figPos(2) + figPos(4) > rootSize(4)
-    figPos(2) = rootSize(4) - figPos(4) - 50;
-  end
-  set(f, 'Position',figPos, ...
-	 'Visible', 'on');
-end
-
-%
-%  Local Functions
-%
-
-function outData = LocalPushOldData(inData, objs, prop, values)
-outData.objs = {inData.objs{:}, objs};
-outData.prop = {inData.prop{:}, prop};
-outData.values = {inData.values{:}, values};
-
-function cellArray = LocalGetAsCell(fig,prop);
-cellArray = get(fig,prop);
-if (~isempty(cellArray)) & (~iscell(cellArray))
-  cellArray = {cellArray};
-end
-
-function newArray = LocalScale(inArray, scale, minValue)
-n = length(inArray);
-newArray = cell(n,1);
-for k=1:n
-  newArray{k} = max(minValue,scale*inArray{k}(1));
-end
-
-function newArray = LocalMapToGray(inArray);
-n = length(inArray);
-newArray = cell(n,1);
-for k=1:n
-  color = inArray{k};
-  if (~isempty(color))
-    if ischar(color)
-      switch color(1)
-       case 'y'
-	color = [1 1 0];
-       case 'm'
-	color = [1 0 1];
-       case 'c'
-	color = [0 1 1];
-       case 'r'
-	color = [1 0 0];
-       case 'g'
-	color = [0 1 0];
-       case 'b'
-	color = [0 0 1];
-       case 'w'
-	color = [1 1 1];
-       case 'k'
-	color = [0 0 0];
-       otherwise
-	newArray{k} = color;
-      end
-    end
-    if ~ischar(color)
-      color = 0.30*color(1) + 0.59*color(2) + 0.11*color(3);
-    end
-  end
-  if isempty(color) | ischar(color)
-    newArray{k} = color;
-  else
-    newArray{k} = [color color color];
-  end
-end
-
-function newArray = LocalMapCData(inArray);
-n = length(inArray);
-newArray = cell(n,1);
-for k=1:n
-  color = inArray{k};
-  if (ndims(color) == 3) & isa(color,'double')
-    gray = 0.30*color(:,:,1) + 0.59*color(:,:,2) + 0.11*color(:,:,3);
-    color(:,:,1) = gray;
-    color(:,:,2) = gray;
-    color(:,:,3) = gray;
-  end
-  newArray{k} = color;
-end
-
-function outData = LocalUpdateColors(inArray, prop, inData)
-value = LocalGetAsCell(inArray,prop);
-outData.objs = {inData.objs{:}, inArray};
-outData.prop = {inData.prop{:}, {prop}};
-outData.values = {inData.values{:}, value};
-if (~isempty(value))
-  if strcmp(prop,'CData') 
-    value = LocalMapCData(value);
-  else
-    value = LocalMapToGray(value);
-  end
-  set(inArray,{prop},value);
-end
-
-function bool = LocalIsPositiveScalar(value)
-bool = isnumeric(value) & ...
-       prod(size(value)) == 1 & ...
-       value > 0;
-
-function value = LocalToNum(value)
-if ischar(value)
-  value = str2num(value);
-end

Copied: branches/interrupt/support/math/exportfig.m (from rev 3150, development/support/math/exportfig.m)
===================================================================
--- branches/interrupt/support/math/exportfig.m	                        (rev 0)
+++ branches/interrupt/support/math/exportfig.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -0,0 +1,500 @@
+function exportfig(varargin)
+%EXPORTFIG  Export a figure to Encapsulated Postscript.
+%   EXPORTFIG(H, FILENAME) writes the figure H to FILENAME.  H is
+%   a figure handle and FILENAME is a string that specifies the
+%   name of the output file.
+%
+%   EXPORTFIG(...,PARAM1,VAL1,PARAM2,VAL2,...) specifies
+%   parameters that control various characteristics of the output
+%   file.
+%
+%   Format Paramter:
+%     'Format'  one of the strings 'eps','eps2','jpeg','png','preview'
+%          specifies the output format. Defaults to 'eps'.
+%          The output format 'preview' does not generate an output
+%          file but instead creates a new figure window with a
+%          preview of the exported figure. In this case the
+%          FILENAME parameter is ignored.
+%
+%     'Preview' one of the strings 'none', 'tiff'
+%          specifies a preview for EPS files. Defaults to 'none'.
+%
+%   Size Parameters:
+%     'Width'   a positive scalar
+%          specifies the width in the figure's PaperUnits
+%     'Height'  a positive scalar
+%          specifies the height in the figure's PaperUnits
+%
+%     Specifying only one dimension sets the other dimension
+%     so that the exported aspect ratio is the same as the
+%     figure's current aspect ratio. 
+%     If neither dimension is specified the size defaults to 
+%     the width and height from the figure's PaperPosition. 
+%           
+%   Rendering Parameters:
+%     'Color'     one of the strings 'bw', 'gray', 'cmyk'
+%         'bw'    specifies that lines and text are exported in
+%                 black and all other objects in grayscale
+%         'gray'  specifies that all objects are exported in grayscale
+%         'cmyk'  specifies that all objects are exported in color
+%                 using the CMYK color space
+%     'Renderer'  one of the strings 'painters', 'zbuffer', 'opengl'
+%         specifies the renderer to use
+%     'Resolution'   a positive scalar
+%         specifies the resolution in dots-per-inch.
+%     
+%     The default color setting is 'bw'.
+%
+%   Font Parameters:
+%     'FontMode'     one of the strings 'scaled', 'fixed'
+%     'FontSize'     a positive scalar
+%          in 'scaled' mode multiplies with the font size of each
+%          text object to obtain the exported font size
+%          in 'fixed' mode specifies the font size of all text
+%          objects in points
+%     'FontEncoding' one of the strings 'latin1', 'adobe'
+%          specifies the character encoding of the font
+%
+%     If FontMode is 'scaled' but FontSize is not specified then a
+%     scaling factor is computed from the ratio of the size of the
+%     exported figure to the size of the actual figure. The minimum
+%     font size allowed after scaling is 5 points.
+%     If FontMode is 'fixed' but FontSize is not specified then the
+%     exported font sizes of all text objects is 7 points.
+%
+%     The default 'FontMode' setting is 'scaled'.
+%
+%   Line Width Parameters:
+%     'LineMode'     one of the strings 'scaled', 'fixed'
+%     'LineWidth'    a positive scalar
+%          the semantics of LineMode and LineWidth are exactly the
+%          same as FontMode and FontSize, except that they apply
+%          to line widths instead of font sizes. The minumum line
+%          width allowed after scaling is 0.5 points.
+%          If LineMode is 'fixed' but LineWidth is not specified 
+%          then the exported line width of all line objects is 1
+%          point. 
+%
+%   Examples:
+%     exportfig(gcf,'fig1.eps','height',3);
+%       Exports the current figure to the file named 'fig1.eps' with
+%       a height of 3 inches (assuming the figure's PaperUnits is 
+%       inches) and an aspect ratio the same as the figure's aspect
+%       ratio on screen.
+%
+%     exportfig(gcf, 'fig2.eps', 'FontMode', 'fixed',...
+%                'FontSize', 10, 'color', 'cmyk' );
+%       Exports the current figure to 'fig2.eps' in color with all
+%       text in 10 point fonts. The size of the exported figure is
+%       the figure's PaperPostion width and height.
+
+
+if (nargin < 2)
+  error('Too few input arguments');
+end
+
+% exportfig(H, filename, ...)
+H = varargin{1};
+if ~ishandle(H) | ~strcmp(get(H,'type'), 'figure')
+  error('First argument must be a handle to a figure.');
+end
+filename = varargin{2};
+if ~ischar(filename)
+  error('Second argument must be a string.');
+end
+paramPairs = varargin(3:end);
+
+% Do some validity checking on param-value pairs
+if (rem(length(paramPairs),2) ~= 0)
+  error(['Invalid input syntax. Optional parameters and values' ...
+	 ' must be in pairs.']);
+end
+
+format = 'eps';
+preview = 'none';
+width = -1;
+height = -1;
+color = 'bw';
+fontsize = -1;
+fontmode='scaled';
+linewidth = -1;
+linemode=[];
+fontencoding = 'latin1';
+renderer = [];
+resolution = [];
+
+% Process param-value pairs
+args = {};
+for k = 1:2:length(paramPairs)
+  param = lower(paramPairs{k});
+  if (~ischar(param))
+    error('Optional parameter names must be strings');
+  end
+  value = paramPairs{k+1};
+  
+  switch (param)
+   case 'format'
+    format = value;
+    if (~strcmp(format,{'eps','eps2','jpeg','png','preview'}))
+      error(['Format must be ''eps'', ''eps2'', ''jpeg'', ''png'' or' ...
+	     ' ''preview''.']);
+    end
+   case 'preview'
+    preview = value;
+    if (~strcmp(preview,{'none','tiff'}))
+      error('Preview must be ''none'' or ''tiff''.');
+    end
+   case 'width'
+    width = LocalToNum(value);
+    if(~LocalIsPositiveScalar(width))
+      error('Width must be a numeric scalar > 0');
+    end
+   case 'height'
+    height = LocalToNum(value);
+    if(~LocalIsPositiveScalar(height))
+      error('Height must be a numeric scalar > 0');
+    end
+   case 'color'
+    color = lower(value);
+    if (~strcmp(color,{'bw','gray','cmyk'}))
+      error('Color must be ''bw'', ''gray'' or ''cmyk''.');
+    end
+   case 'fontmode'
+    fontmode = lower(value);
+    if (~strcmp(fontmode,{'scaled','fixed'}))
+      error('FontMode must be ''scaled'' or ''fixed''.');
+    end
+   case 'fontsize'
+    fontsize = LocalToNum(value);
+    if(~LocalIsPositiveScalar(fontsize))
+      error('FontSize must be a numeric scalar > 0');
+    end
+   case 'fontencoding'
+    fontencoding = lower(value);
+    if (~strcmp(fontencoding,{'latin1','adobe'}))
+      error('FontEncoding must be ''latin1'' or ''adobe''.');
+    end
+   case 'linemode'
+    linemode = lower(value);
+    if (~strcmp(linemode,{'scaled','fixed'}))
+      error('LineMode must be ''scaled'' or ''fixed''.');
+    end
+   case 'linewidth'
+    linewidth = LocalToNum(value);
+    if(~LocalIsPositiveScalar(linewidth))
+      error('LineWidth must be a numeric scalar > 0');
+    end
+   case 'renderer'
+    renderer = lower(value);
+    if (~strcmp(renderer,{'painters','zbuffer','opengl'}))
+      error('Renderer must be ''painters'', ''zbuffer'' or ''opengl''.');
+    end
+   case 'resolution'
+    resolution = LocalToNum(value);
+    if ~(isnumeric(value) & (prod(size(value)) == 1) & (value >= 0));
+      error('Resolution must be a numeric scalar >= 0');
+    end
+   otherwise
+    error(['Unrecognized option ' param '.']);
+  end
+end
+
+allLines  = findall(H, 'type', 'line');
+allText   = findall(H, 'type', 'text');
+allAxes   = findall(H, 'type', 'axes');
+allImages = findall(H, 'type', 'image');
+allLights = findall(H, 'type', 'light');
+allPatch  = findall(H, 'type', 'patch');
+allSurf   = findall(H, 'type', 'surface');
+allRect   = findall(H, 'type', 'rectangle');
+allFont   = [allText; allAxes];
+allColor  = [allLines; allText; allAxes; allLights];
+allMarker = [allLines; allPatch; allSurf];
+allEdge   = [allPatch; allSurf];
+allCData  = [allImages; allPatch; allSurf];
+
+old.objs = {};
+old.prop = {};
+old.values = {};
+
+% Process format and preview parameter
+showPreview = strcmp(format,'preview');
+if showPreview
+  format = 'png';
+  filename = [tempName '.png'];
+end
+if strncmp(format,'eps',3) & ~strcmp(preview,'none')
+  args = {args{:}, ['-' preview]};
+end
+
+hadError = 0;
+try
+  % Process size parameters
+  paperPos = get(H, 'PaperPosition');
+  old = LocalPushOldData(old, H, 'PaperPosition', paperPos);
+  figureUnits = get(H, 'Units');
+  set(H, 'Units', get(H,'PaperUnits'));
+  figurePos = get(H, 'Position');
+  aspectRatio = figurePos(3)/figurePos(4);
+  set(H, 'Units', figureUnits);
+  if (width == -1) & (height == -1)
+    width = paperPos(3);
+    height = paperPos(4);
+  elseif (width == -1)
+    width = height * aspectRatio;
+  elseif (height == -1)
+    height = width / aspectRatio;
+  end
+  set(H, 'PaperPosition', [0 0 width height]);
+  paperPosMode = get(H, 'PaperPositionMode');
+  old = LocalPushOldData(old, H, 'PaperPositionMode', paperPosMode);
+  set(H, 'PaperPositionMode', 'manual');
+
+  % Process rendering parameters
+  switch (color)
+   case {'bw', 'gray'}
+    if ~strcmp(color,'bw') & strncmp(format,'eps',3)
+      format = [format 'c'];
+    end
+    args = {args{:}, ['-d' format]};
+
+    %compute and set gray colormap
+    oldcmap = get(H,'Colormap');
+    newgrays = 0.30*oldcmap(:,1) + 0.59*oldcmap(:,2) + 0.11*oldcmap(:,3);
+    newcmap = [newgrays newgrays newgrays];
+    old = LocalPushOldData(old, H, 'Colormap', oldcmap);
+    set(H, 'Colormap', newcmap);
+
+    %compute and set ColorSpec and CData properties
+    old = LocalUpdateColors(allColor, 'color', old);
+    old = LocalUpdateColors(allAxes, 'xcolor', old);
+    old = LocalUpdateColors(allAxes, 'ycolor', old);
+    old = LocalUpdateColors(allAxes, 'zcolor', old);
+    old = LocalUpdateColors(allMarker, 'MarkerEdgeColor', old);
+    old = LocalUpdateColors(allMarker, 'MarkerFaceColor', old);
+    old = LocalUpdateColors(allEdge, 'EdgeColor', old);
+    old = LocalUpdateColors(allEdge, 'FaceColor', old);
+    old = LocalUpdateColors(allCData, 'CData', old);
+    
+   case 'cmyk'
+    if strncmp(format,'eps',3)
+      format = [format 'c'];
+      args = {args{:}, ['-d' format], '-cmyk'};
+    else
+      args = {args{:}, ['-d' format]};
+    end
+   otherwise
+    error('Invalid Color parameter');
+  end
+  if (~isempty(renderer))
+    args = {args{:}, ['-' renderer]};
+  end
+  if (~isempty(resolution)) | ~strncmp(format,'eps',3)
+    if isempty(resolution)
+      resolution = 0;
+    end
+    args = {args{:}, ['-r' int2str(resolution)]};
+  end
+
+  % Process font parameters
+%   if (~isempty(fontmode))
+%     oldfonts = LocalGetAsCell(allFont,'FontSize');
+%     switch (fontmode)
+%      case 'fixed'
+%       oldfontunits = LocalGetAsCell(allFont,'FontUnits');
+%       old = LocalPushOldData(old, allFont, {'FontUnits'}, oldfontunits);
+%       set(allFont,'FontUnits','points');
+%       if (fontsize == -1)
+%     	set(allFont,'FontSize',7);
+%       else
+%     	set(allFont,'FontSize',fontsize);
+%       end
+%      case 'scaled'
+%       if (fontsize == -1)
+%     	wscale = width/figurePos(3);
+%     	hscale = height/figurePos(4);
+%     	scale = min(wscale, hscale);
+%       else
+%     	scale = fontsize;
+%       end
+%       newfonts = LocalScale(oldfonts,scale,5);
+%       set(allFont,{'FontSize'},newfonts);
+%      otherwise
+%       error('Invalid FontMode parameter');
+%     end
+%     % make sure we push the size after the units
+%     old = LocalPushOldData(old, allFont, {'FontSize'}, oldfonts);
+%   end
+  if strcmp(fontencoding,'adobe') & strncmp(format,'eps',3)
+    args = {args{:}, '-adobecset'};
+  end
+
+  % Process linewidth parameters
+  if (~isempty(linemode))
+    oldlines = LocalGetAsCell(allMarker,'LineWidth');
+    old = LocalPushOldData(old, allMarker, {'LineWidth'}, oldlines);
+    switch (linemode)
+     case 'fixed'
+      if (linewidth == -1)
+	set(allMarker,'LineWidth',1);
+      else
+	set(allMarker,'LineWidth',linewidth);
+      end
+     case 'scaled'
+      if (linewidth == -1)
+	wscale = width/figurePos(3);
+	hscale = height/figurePos(4);
+	scale = min(wscale, hscale);
+      else
+	scale = linewidth;
+      end
+      newlines = LocalScale(oldlines, scale, 0.5);
+      set(allMarker,{'LineWidth'},newlines);
+     otherwise
+      error('Invalid LineMode parameter');
+    end
+  end
+
+  % Export
+  print(H, filename, args{:});
+
+catch
+  hadError = 1;
+end
+
+% Restore figure settings
+for n=1:length(old.objs)
+  set(old.objs{n}, old.prop{n}, old.values{n});
+end
+
+if hadError
+  error(deblank(lasterr));
+end
+
+% Show preview if requested
+if showPreview
+  X = imread(filename,'png');
+  delete(filename);
+  f = figure( 'Name', 'Preview', ...
+	      'Menubar', 'none', ...
+	      'NumberTitle', 'off', ...
+	      'Visible', 'off');
+  image(X);
+  axis image;
+  ax = findobj(f, 'type', 'axes');
+  set(ax, 'Units', get(H,'PaperUnits'), ...
+	  'Position', [0 0 width height], ...
+	  'Visible', 'off');
+  set(ax, 'Units', 'pixels');
+  axesPos = get(ax,'Position');
+  figPos = get(f,'Position');
+  rootSize = get(0,'ScreenSize');
+  figPos(3:4) = axesPos(3:4);
+  if figPos(1) + figPos(3) > rootSize(3)
+    figPos(1) = rootSize(3) - figPos(3) - 50;
+  end
+  if figPos(2) + figPos(4) > rootSize(4)
+    figPos(2) = rootSize(4) - figPos(4) - 50;
+  end
+  set(f, 'Position',figPos, ...
+	 'Visible', 'on');
+end
+
+%
+%  Local Functions
+%
+
+function outData = LocalPushOldData(inData, objs, prop, values)
+outData.objs = {inData.objs{:}, objs};
+outData.prop = {inData.prop{:}, prop};
+outData.values = {inData.values{:}, values};
+
+function cellArray = LocalGetAsCell(fig,prop);
+cellArray = get(fig,prop);
+if (~isempty(cellArray)) & (~iscell(cellArray))
+  cellArray = {cellArray};
+end
+
+function newArray = LocalScale(inArray, scale, minValue)
+n = length(inArray);
+newArray = cell(n,1);
+for k=1:n
+  newArray{k} = max(minValue,scale*inArray{k}(1));
+end
+
+function newArray = LocalMapToGray(inArray);
+n = length(inArray);
+newArray = cell(n,1);
+for k=1:n
+  color = inArray{k};
+  if (~isempty(color))
+    if ischar(color)
+      switch color(1)
+       case 'y'
+	color = [1 1 0];
+       case 'm'
+	color = [1 0 1];
+       case 'c'
+	color = [0 1 1];
+       case 'r'
+	color = [1 0 0];
+       case 'g'
+	color = [0 1 0];
+       case 'b'
+	color = [0 0 1];
+       case 'w'
+	color = [1 1 1];
+       case 'k'
+	color = [0 0 0];
+       otherwise
+	newArray{k} = color;
+      end
+    end
+    if ~ischar(color)
+      color = 0.30*color(1) + 0.59*color(2) + 0.11*color(3);
+    end
+  end
+  if isempty(color) | ischar(color)
+    newArray{k} = color;
+  else
+    newArray{k} = [color color color];
+  end
+end
+
+function newArray = LocalMapCData(inArray);
+n = length(inArray);
+newArray = cell(n,1);
+for k=1:n
+  color = inArray{k};
+  if (ndims(color) == 3) & isa(color,'double')
+    gray = 0.30*color(:,:,1) + 0.59*color(:,:,2) + 0.11*color(:,:,3);
+    color(:,:,1) = gray;
+    color(:,:,2) = gray;
+    color(:,:,3) = gray;
+  end
+  newArray{k} = color;
+end
+
+function outData = LocalUpdateColors(inArray, prop, inData)
+value = LocalGetAsCell(inArray,prop);
+outData.objs = {inData.objs{:}, inArray};
+outData.prop = {inData.prop{:}, {prop}};
+outData.values = {inData.values{:}, value};
+if (~isempty(value))
+  if strcmp(prop,'CData') 
+    value = LocalMapCData(value);
+  else
+    value = LocalMapToGray(value);
+  end
+  set(inArray,{prop},value);
+end
+
+function bool = LocalIsPositiveScalar(value)
+bool = isnumeric(value) & ...
+       prod(size(value)) == 1 & ...
+       value > 0;
+
+function value = LocalToNum(value)
+if ischar(value)
+  value = str2num(value);
+end

Deleted: branches/interrupt/support/math/find_files.m
===================================================================
--- development/support/math/find_files.m	2009-02-19 16:19:24 UTC (rev 3150)
+++ branches/interrupt/support/math/find_files.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -1,293 +0,0 @@
-function filenames = find_files(dir, file_pattern)
-%FIND_FILES    Recursively finds matching files.
-%
-%    FILENAMES = FIND_FILES(DIR,PATTERN) examines the passed in directory,
-%    and recursively descends searching for files whose complete name
-%    matches the specified pattern.
-%      dir(string): The root directory at which recursive search begins.
-%      file_pattern(regex): The pattern used to find matching files.
-%      filenames(cell array of strings): The completely specified filenames
-%        of files that matched the file_pattern, relative to dir.
-
-% For right now, we're going to cheat.  No need to reinvent the wheel.
-[s r] = unix(['find ' dir ' | grep ' file_pattern]);
-assert(s==0, 'Invalid dir or file_pattern.');
-filenames = regexp(r,'([\.\w\d-/]*)','tokens');
-
-% sanity checking:
-cellfun(@(x)assert(exist(char(x),'file')==2), filenames);
-
-
-% % DIRR
-% % Lists all files in the current directory and sub directories
-% % recursively.
-% % 
-% % [LIST] = DIRR(PATH)
-% % Returns a structure LIST with the same fieldnames as returned 
-% % by LIST = DIR(PATH)
-% % PATH can contain wildcards * and ? after the last \ or / (filename
-% % filter)
-% % The content of each directory in PATH is listed inside its 'isdir'
-% % field with the same format. The 'bytes' field is NOT zero but the
-% % sum of all filesizes inside the directory.
-% % 
-% % [LIST,BYTES] = DIRR(PATH)
-% % BYTES is a structure with fields 'total' and 'dir'. 'total' is the total
-% % size of PATH. 'dir' is a recursive substructure that contains the
-% % same fields ('total' and 'dir') for the subdirectories.
-% % 
-% % [...] = DIRR(PATH,FILTER)
-% % Lists only files matching the string FILTER (non case sensitive
-% % regular expression).
-% % N.B.: FILTER is optional and must not be equal to a fieldname
-% % ('name' or 'date' ... will never be interpreted as filters)
-% % 
-% % [LIST,BYTES,FIELDOUT] = DIRR(PATH,FIELDIN, ...)
-% % FIELDIN is a string specifying a field (of the structure LIST) that
-% % will be listed in a separate cell array of strings in FIELDOUT for
-% % every file with absolute path at the begining of the string.
-% % Multiple fields can be specified.
-% % 
-% % [LIST,BYTES,FIELDOUT] = DIRR(PATH,FIELDIN,FILTER, ...)
-% % Only files for which FIELDIN matches FILTER will be returned.
-% % Multiple [FIELDIN, FILTER] couples may be specified.
-% % Recursion can be avoided here by setting 'isdir' filter to '0'.
-% % For bytes, numeric comparison will be performed.
-% % 
-% % 
-% % EXAMPLES :
-% % 
-% % DIRR
-% % Lists all files (including path) in the current directory and it's
-% % subdirectories recursively.
-% % 
-% % DIRR('c:\matlab6p5\work\*.m')
-% % Lists all M-files in the c:\matlab6p5\work directory and it's
-% % subdirectories recursively.
-% % 
-% % Music = DIRR('G:\Ma musique\&Styles\Reggae\Alpha Blondy')
-% % Returns a structure Music very similar to what DIR returns 
-% % but containing the information on the files stored in
-% % subdirectories of 'G:\Ma musique\&Styles\Reggae\Alpha Blondy'.
-% % The structure Music is a bit difficult to explore though.
-% % See next examples.
-% % 
-% % [Files,Bytes,Names] = DIRR('c:\matlab6p5\toolbox','\.mex\>','name')
-% % Lists all MEX-files in the c:\matlab6p5\toolbox directory in the cell
-% % array of strings Names (including path).
-% % Note the regexp syntax of the filter string.
-% % Bytes is a structure with fields "total" and "dir". total is the
-% % total size of the directory, dir is a recursive substructure with
-% % the same fields as bytes for the subdirectories. 
-% % 
-% % [Files,Bytes,Names] = DIRR('c:\toto'...
-% %       ,'name','bytes','>50000','isdir','0')
-% % Lists all files larger than 50000 bytes NOT recursively.
-% % 
-% % [Files,Bytes,Dates] = DIRR('c:\matlab6p5\work','date','2005')
-% % Lists all dates of files from year 2005. (With path in front of
-% % date in the cell array of strings Dates)
-% % 
-% % 
-% % 
-% %       v1.02        
-% %       Maximilien Chaumon
-% %       maximilien.chaumon at chups.jussieu.fr
-% %       2006 06 16
-% 
-% 
-% verbose = 0;
-% % set to 1 to get folders list in command window
-% 
-% if nargin == 0
-%     chemin = cd;
-% end
-% if nargout == 0
-%     dum = varargin;
-%     varargin{1} = 'name';
-%     varargin = [varargin(1) dum];
-% end
-% 
-% fields = {'name' 'date' 'bytes' 'isdir'};
-% 
-% if regexp(chemin,'[\*\?]') % if chemin contains any ? or *
-%     filt = regexprep(chemin,'.*[\\/](.*\>)','$1');% get filter
-%     filt = regexprep(filt,'\.','\.');% in regexp format
-%     filt = regexprep(filt,'\*','.*');
-%     filt = regexprep(filt,'\?','.');
-%     filt = regexprep(filt,'(.*)','\\<$1');
-%     chemin = regexprep(chemin,'(.*)[\\/].*\>','$1');% and chemin
-% end
-% 
-% if not(isempty(varargin)) % if additional fields were provided after chemin
-%     for i = 1:length(fields)
-%         if strcmp(varargin{1},fields{i})% if first varargin matches a fieldname,
-%             % assume no filter was provided,
-%             
-%             if not(exist('filt','var'))% or it was in chemin and was set just before
-%                 filt = '.*';% set it to wildcard
-%                 break
-%                 
-%             end
-%         end
-%     end
-%     if not(exist('filt','var'))% else
-%         filt = varargin{1};% first varargin is the filter
-%         varargin(1) = [];
-%     end
-% else% if no additional fields were provided and filter was not in chemin
-%     if not(exist('filt','var'))
-%         filt = '.*';
-%     end
-% end
-% % determine which varargin are fieldnames
-% whicharefields = zeros(1,length(varargin));
-% for i = 1:length(varargin)
-%     for j = 1:length(fields)
-%         if strcmp(varargin{i},fields{j})
-%             whicharefields(i) = 1;
-%             break
-%         end
-%     end
-% end
-% % set f2out and f2outfilt
-% f2out = {}; f2outfilt = {};
-% idx = 0;
-% if not(isempty(varargin))
-%     for i = 1:length(varargin)
-%         if whicharefields(i)
-%             idx = idx + 1;
-%             f2out{idx} = varargin{i};
-%             f2outfilt{idx} = '';
-%         else % if nargin{i} is not a fieldname, assume it's a filter
-%             f2outfilt{idx} = varargin{i}; 
-%         end
-%     end
-% end
-% 
-% %%%%%%%%%%%%%%%%%%%% START
-% if verbose
-%     disp(chemin);
-% end
-% 
-% list = dir(chemin);
-% if isempty(list)
-%     disp([chemin ' not found']);
-%     if nargout == 0
-%         clear list
-%     else
-%         for i = 1:nargout - 2
-%             varargout{i} = [];
-%         end
-%         sumbytes = 0;
-%     end
-%     return
-% end
-% % remove . and ..
-% i_file = 1;
-% while i_file <= length(list)
-%     if strcmp(list(i_file).name,'.')|strcmp(list(i_file).name,'..')
-%         list(i_file) = [];
-%     else
-%         i_file = i_file + 1;
-%     end
-% end
-% 
-% % set sumbytes
-% sumbytes = struct('total',0,'dir',{});
-% sumbytes(1).total = 0;
-% i_dir = 0;
-% % and all output fields
-% for i = 1:size(f2out,2)
-%     f2out{2,i} = {};
-% end
-% filenames = {};
-% todel = 0;
-% r = 1;
-% for i_out = 1:size(f2out,2)
-%     if strcmp(f2out{1,i_out},'isdir')
-%         if strcmp(f2outfilt{i_out},'0') % check if no recursion is wanted
-%             r = 0;
-%         end
-%     end
-% end
-% 
-% % for each item in list
-% for i_file = 1:length(list)
-%     for i_out = 1:size(f2out,2) % for every output field
-%         if not(isempty(f2outfilt{i_out}))% if there is a filter
-%             if strcmp(f2out{1,i_out},'bytes') % if field is 'bytes'
-%                 line = [num2str(list(i_file).(f2out{1,i_out})) f2outfilt{i_out} ';']; % compare with filter numerically
-%                 if eval(line)% if passes the filter
-%                     continue % continue to next field
-%                 else
-%                     todel(end+1) = i_file; % else set to be deleted
-%                 end
-%             elseif not(strcmp(f2out{1,i_out},'isdir'))% if field is 'name' or 'date'
-%                 if regexpi(list(i_file).(f2out{1,i_out}),f2outfilt{i_out}) % apply filter
-%                     continue % continue to next field
-%                 else
-%                     todel(end+1) = i_file; % else set to be deleted
-%                 end
-%             end
-%         end
-%     end
-%     % once checked for every field's filter
-%     if todel(end) == i_file % if one didn't pass,
-%         if not(list(i_file).isdir) % and it's not a directory
-%             continue % skip this file and continue
-%         end
-%     else
-%         if regexpi(list(i_file).name,filt) % else, check for general filter on filename
-%             sumbytes(1).total = sumbytes(1).total + list(i_file).bytes; % sum bytes of that level
-%             for i_out = 1:size(f2out,2)% and assign all output fields with the values of that file
-%                 f2out{2,i_out}{end+1} = [chemin filesep num2str(list(i_file).(f2out{1,i_out}))];
-%             end
-%         else
-%             todel(end+1) = i_file; % else the file will be removed from the list structure
-%         end
-%     end
-%     if list(i_file).isdir % if it's a directory
-%         if not(r)
-%             continue
-%         end
-%         i_dir = i_dir + 1;
-%         cheminext = strcat(chemin,filesep,list(i_file).name);
-%         % get it's content by recursion
-%         % write the line to enter eval
-%         line = '[list(i_file).isdir,sumbytes.dir(i_dir)';
-%         for i_out = 1:size(f2out,2)% with all the requested fields as temporary variables
-%             line = [line ',f2outtemp{' num2str(i_out) '}'];
-%         end
-%         line = [line '] = dirr(cheminext,filt'];
-%         for i_out = 1:size(f2out,2)
-%             line = [line ',f2out{1,' num2str(i_out) '}'];
-%             if f2outfilt{i_out}
-%                 line = [line ',f2outfilt{' num2str(i_out) '}'];
-%             end
-%         end
-%         line = [line ');'];
-%         eval(line);
-%         
-%         for i_out = 1:size(f2out,2)
-%             f2out{2,i_out} = [f2out{2,i_out} f2outtemp{i_out}]; % catenate temporary variables with f2out
-%         end
-%         % sum bytes 
-%         sumbytes(1).total = sumbytes(1).total + sumbytes(1).dir(i_dir).total; % that level + the next one
-%         list(i_file).bytes = sumbytes(1).dir(i_dir).total; % and set list(i_file).bytes to that value
-%         if list(i_file).bytes & todel(end) == i_file
-%             todel(end) = [];
-%         end
-%     end
-% end
-% todel(1) = [];
-% list(todel) = [];
-% 
-% 
-% for i_out = 1:size(f2out,2)
-%     varargout{i_out} = f2out{2,i_out};
-% end
-% if nargout == 0
-%     clear list
-%     disp(char(f2out{2,1}));
-% end

Copied: branches/interrupt/support/math/find_files.m (from rev 3150, development/support/math/find_files.m)
===================================================================
--- branches/interrupt/support/math/find_files.m	                        (rev 0)
+++ branches/interrupt/support/math/find_files.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -0,0 +1,293 @@
+function filenames = find_files(dir, file_pattern)
+%FIND_FILES    Recursively finds matching files.
+%
+%    FILENAMES = FIND_FILES(DIR,PATTERN) examines the passed in directory,
+%    and recursively descends searching for files whose complete name
+%    matches the specified pattern.
+%      dir(string): The root directory at which recursive search begins.
+%      file_pattern(regex): The pattern used to find matching files.
+%      filenames(cell array of strings): The completely specified filenames
+%        of files that matched the file_pattern, relative to dir.
+
+% For right now, we're going to cheat.  No need to reinvent the wheel.
+[s r] = unix(['find ' dir ' | grep ' file_pattern]);
+assert(s==0, 'Invalid dir or file_pattern.');
+filenames = regexp(r,'([\.\w\d-/]*)','tokens');
+
+% sanity checking:
+cellfun(@(x)assert(exist(char(x),'file')==2), filenames);
+
+
+% % DIRR
+% % Lists all files in the current directory and sub directories
+% % recursively.
+% % 
+% % [LIST] = DIRR(PATH)
+% % Returns a structure LIST with the same fieldnames as returned 
+% % by LIST = DIR(PATH)
+% % PATH can contain wildcards * and ? after the last \ or / (filename
+% % filter)
+% % The content of each directory in PATH is listed inside its 'isdir'
+% % field with the same format. The 'bytes' field is NOT zero but the
+% % sum of all filesizes inside the directory.
+% % 
+% % [LIST,BYTES] = DIRR(PATH)
+% % BYTES is a structure with fields 'total' and 'dir'. 'total' is the total
+% % size of PATH. 'dir' is a recursive substructure that contains the
+% % same fields ('total' and 'dir') for the subdirectories.
+% % 
+% % [...] = DIRR(PATH,FILTER)
+% % Lists only files matching the string FILTER (non case sensitive
+% % regular expression).
+% % N.B.: FILTER is optional and must not be equal to a fieldname
+% % ('name' or 'date' ... will never be interpreted as filters)
+% % 
+% % [LIST,BYTES,FIELDOUT] = DIRR(PATH,FIELDIN, ...)
+% % FIELDIN is a string specifying a field (of the structure LIST) that
+% % will be listed in a separate cell array of strings in FIELDOUT for
+% % every file with absolute path at the begining of the string.
+% % Multiple fields can be specified.
+% % 
+% % [LIST,BYTES,FIELDOUT] = DIRR(PATH,FIELDIN,FILTER, ...)
+% % Only files for which FIELDIN matches FILTER will be returned.
+% % Multiple [FIELDIN, FILTER] couples may be specified.
+% % Recursion can be avoided here by setting 'isdir' filter to '0'.
+% % For bytes, numeric comparison will be performed.
+% % 
+% % 
+% % EXAMPLES :
+% % 
+% % DIRR
+% % Lists all files (including path) in the current directory and it's
+% % subdirectories recursively.
+% % 
+% % DIRR('c:\matlab6p5\work\*.m')
+% % Lists all M-files in the c:\matlab6p5\work directory and it's
+% % subdirectories recursively.
+% % 
+% % Music = DIRR('G:\Ma musique\&Styles\Reggae\Alpha Blondy')
+% % Returns a structure Music very similar to what DIR returns 
+% % but containing the information on the files stored in
+% % subdirectories of 'G:\Ma musique\&Styles\Reggae\Alpha Blondy'.
+% % The structure Music is a bit difficult to explore though.
+% % See next examples.
+% % 
+% % [Files,Bytes,Names] = DIRR('c:\matlab6p5\toolbox','\.mex\>','name')
+% % Lists all MEX-files in the c:\matlab6p5\toolbox directory in the cell
+% % array of strings Names (including path).
+% % Note the regexp syntax of the filter string.
+% % Bytes is a structure with fields "total" and "dir". total is the
+% % total size of the directory, dir is a recursive substructure with
+% % the same fields as bytes for the subdirectories. 
+% % 
+% % [Files,Bytes,Names] = DIRR('c:\toto'...
+% %       ,'name','bytes','>50000','isdir','0')
+% % Lists all files larger than 50000 bytes NOT recursively.
+% % 
+% % [Files,Bytes,Dates] = DIRR('c:\matlab6p5\work','date','2005')
+% % Lists all dates of files from year 2005. (With path in front of
+% % date in the cell array of strings Dates)
+% % 
+% % 
+% % 
+% %       v1.02        
+% %       Maximilien Chaumon
+% %       maximilien.chaumon at chups.jussieu.fr
+% %       2006 06 16
+% 
+% 
+% verbose = 0;
+% % set to 1 to get folders list in command window
+% 
+% if nargin == 0
+%     chemin = cd;
+% end
+% if nargout == 0
+%     dum = varargin;
+%     varargin{1} = 'name';
+%     varargin = [varargin(1) dum];
+% end
+% 
+% fields = {'name' 'date' 'bytes' 'isdir'};
+% 
+% if regexp(chemin,'[\*\?]') % if chemin contains any ? or *
+%     filt = regexprep(chemin,'.*[\\/](.*\>)','$1');% get filter
+%     filt = regexprep(filt,'\.','\.');% in regexp format
+%     filt = regexprep(filt,'\*','.*');
+%     filt = regexprep(filt,'\?','.');
+%     filt = regexprep(filt,'(.*)','\\<$1');
+%     chemin = regexprep(chemin,'(.*)[\\/].*\>','$1');% and chemin
+% end
+% 
+% if not(isempty(varargin)) % if additional fields were provided after chemin
+%     for i = 1:length(fields)
+%         if strcmp(varargin{1},fields{i})% if first varargin matches a fieldname,
+%             % assume no filter was provided,
+%             
+%             if not(exist('filt','var'))% or it was in chemin and was set just before
+%                 filt = '.*';% set it to wildcard
+%                 break
+%                 
+%             end
+%         end
+%     end
+%     if not(exist('filt','var'))% else
+%         filt = varargin{1};% first varargin is the filter
+%         varargin(1) = [];
+%     end
+% else% if no additional fields were provided and filter was not in chemin
+%     if not(exist('filt','var'))
+%         filt = '.*';
+%     end
+% end
+% % determine which varargin are fieldnames
+% whicharefields = zeros(1,length(varargin));
+% for i = 1:length(varargin)
+%     for j = 1:length(fields)
+%         if strcmp(varargin{i},fields{j})
+%             whicharefields(i) = 1;
+%             break
+%         end
+%     end
+% end
+% % set f2out and f2outfilt
+% f2out = {}; f2outfilt = {};
+% idx = 0;
+% if not(isempty(varargin))
+%     for i = 1:length(varargin)
+%         if whicharefields(i)
+%             idx = idx + 1;
+%             f2out{idx} = varargin{i};
+%             f2outfilt{idx} = '';
+%         else % if nargin{i} is not a fieldname, assume it's a filter
+%             f2outfilt{idx} = varargin{i}; 
+%         end
+%     end
+% end
+% 
+% %%%%%%%%%%%%%%%%%%%% START
+% if verbose
+%     disp(chemin);
+% end
+% 
+% list = dir(chemin);
+% if isempty(list)
+%     disp([chemin ' not found']);
+%     if nargout == 0
+%         clear list
+%     else
+%         for i = 1:nargout - 2
+%             varargout{i} = [];
+%         end
+%         sumbytes = 0;
+%     end
+%     return
+% end
+% % remove . and ..
+% i_file = 1;
+% while i_file <= length(list)
+%     if strcmp(list(i_file).name,'.')|strcmp(list(i_file).name,'..')
+%         list(i_file) = [];
+%     else
+%         i_file = i_file + 1;
+%     end
+% end
+% 
+% % set sumbytes
+% sumbytes = struct('total',0,'dir',{});
+% sumbytes(1).total = 0;
+% i_dir = 0;
+% % and all output fields
+% for i = 1:size(f2out,2)
+%     f2out{2,i} = {};
+% end
+% filenames = {};
+% todel = 0;
+% r = 1;
+% for i_out = 1:size(f2out,2)
+%     if strcmp(f2out{1,i_out},'isdir')
+%         if strcmp(f2outfilt{i_out},'0') % check if no recursion is wanted
+%             r = 0;
+%         end
+%     end
+% end
+% 
+% % for each item in list
+% for i_file = 1:length(list)
+%     for i_out = 1:size(f2out,2) % for every output field
+%         if not(isempty(f2outfilt{i_out}))% if there is a filter
+%             if strcmp(f2out{1,i_out},'bytes') % if field is 'bytes'
+%                 line = [num2str(list(i_file).(f2out{1,i_out})) f2outfilt{i_out} ';']; % compare with filter numerically
+%                 if eval(line)% if passes the filter
+%                     continue % continue to next field
+%                 else
+%                     todel(end+1) = i_file; % else set to be deleted
+%                 end
+%             elseif not(strcmp(f2out{1,i_out},'isdir'))% if field is 'name' or 'date'
+%                 if regexpi(list(i_file).(f2out{1,i_out}),f2outfilt{i_out}) % apply filter
+%                     continue % continue to next field
+%                 else
+%                     todel(end+1) = i_file; % else set to be deleted
+%                 end
+%             end
+%         end
+%     end
+%     % once checked for every field's filter
+%     if todel(end) == i_file % if one didn't pass,
+%         if not(list(i_file).isdir) % and it's not a directory
+%             continue % skip this file and continue
+%         end
+%     else
+%         if regexpi(list(i_file).name,filt) % else, check for general filter on filename
+%             sumbytes(1).total = sumbytes(1).total + list(i_file).bytes; % sum bytes of that level
+%             for i_out = 1:size(f2out,2)% and assign all output fields with the values of that file
+%                 f2out{2,i_out}{end+1} = [chemin filesep num2str(list(i_file).(f2out{1,i_out}))];
+%             end
+%         else
+%             todel(end+1) = i_file; % else the file will be removed from the list structure
+%         end
+%     end
+%     if list(i_file).isdir % if it's a directory
+%         if not(r)
+%             continue
+%         end
+%         i_dir = i_dir + 1;
+%         cheminext = strcat(chemin,filesep,list(i_file).name);
+%         % get it's content by recursion
+%         % write the line to enter eval
+%         line = '[list(i_file).isdir,sumbytes.dir(i_dir)';
+%         for i_out = 1:size(f2out,2)% with all the requested fields as temporary variables
+%             line = [line ',f2outtemp{' num2str(i_out) '}'];
+%         end
+%         line = [line '] = dirr(cheminext,filt'];
+%         for i_out = 1:size(f2out,2)
+%             line = [line ',f2out{1,' num2str(i_out) '}'];
+%             if f2outfilt{i_out}
+%                 line = [line ',f2outfilt{' num2str(i_out) '}'];
+%             end
+%         end
+%         line = [line ');'];
+%         eval(line);
+%         
+%         for i_out = 1:size(f2out,2)
+%             f2out{2,i_out} = [f2out{2,i_out} f2outtemp{i_out}]; % catenate temporary variables with f2out
+%         end
+%         % sum bytes 
+%         sumbytes(1).total = sumbytes(1).total + sumbytes(1).dir(i_dir).total; % that level + the next one
+%         list(i_file).bytes = sumbytes(1).dir(i_dir).total; % and set list(i_file).bytes to that value
+%         if list(i_file).bytes & todel(end) == i_file
+%             todel(end) = [];
+%         end
+%     end
+% end
+% todel(1) = [];
+% list(todel) = [];
+% 
+% 
+% for i_out = 1:size(f2out,2)
+%     varargout{i_out} = f2out{2,i_out};
+% end
+% if nargout == 0
+%     clear list
+%     disp(char(f2out{2,1}));
+% end

Deleted: branches/interrupt/support/math/header_lines.m
===================================================================
--- development/support/math/header_lines.m	2009-02-19 16:19:24 UTC (rev 3150)
+++ branches/interrupt/support/math/header_lines.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -1,27 +0,0 @@
-function lines = header_lines(filenames)
-%HEADER_LINES    Retrieve header lines from Avida data files.
-%
-%    R = HEADER_LINES(dir, file_pattern) examines the first 
-%    file returned by the given directory and file pattern, 
-%    and returns the header lines from that file.  The search 
-%    is performed recursively.
-%      dir(string): Absolute or relative path.
-%      file_pattern(regex): Pattern used to match files.
-%
-%    See also: load_all
-
-assert(size(filenames,2) > 0, 'No files to check for header!');
-
-f=char(filenames{1});
-[result status] = unix(['file ' f]);
-
-if regexp(status, 'gzip')
-    [status result] = unix(['gzcat ' f]);
-    lines = textscan(result, '%s','Delimiter','\n');
-else
-    fid = fopen(char(f));
-    lines = textscan(fid, '%s','Delimiter','\n');
-    fclose(fid);        
-end
-
-lines = lines{1}(strmatch('#',lines{1}));

Copied: branches/interrupt/support/math/header_lines.m (from rev 3150, development/support/math/header_lines.m)
===================================================================
--- branches/interrupt/support/math/header_lines.m	                        (rev 0)
+++ branches/interrupt/support/math/header_lines.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -0,0 +1,27 @@
+function lines = header_lines(filenames)
+%HEADER_LINES    Retrieve header lines from Avida data files.
+%
+%    R = HEADER_LINES(dir, file_pattern) examines the first 
+%    file returned by the given directory and file pattern, 
+%    and returns the header lines from that file.  The search 
+%    is performed recursively.
+%      dir(string): Absolute or relative path.
+%      file_pattern(regex): Pattern used to match files.
+%
+%    See also: load_all
+
+assert(size(filenames,2) > 0, 'No files to check for header!');
+
+f=char(filenames{1});
+[result status] = unix(['file ' f]);
+
+if regexp(status, 'gzip')
+    [status result] = unix(['gzcat ' f]);
+    lines = textscan(result, '%s','Delimiter','\n');
+else
+    fid = fopen(char(f));
+    lines = textscan(fid, '%s','Delimiter','\n');
+    fclose(fid);        
+end
+
+lines = lines{1}(strmatch('#',lines{1}));

Deleted: branches/interrupt/support/math/load_files.m
===================================================================
--- development/support/math/load_files.m	2009-02-19 16:19:24 UTC (rev 3150)
+++ branches/interrupt/support/math/load_files.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -1,53 +0,0 @@
-function [data,filenames] = load_files(filenames,data_pattern)
-%LOAD_ALL    Loads multiple data files into a single matrix.
-%
-%    LOAD_ALL(filenames,data_pattern) loads data from the specified files
-%    according to the data pattern.  Automatically handles gzipped files.
-%      filesnames(string): Absolute or relative filenames.
-%      data_pattern(format): Format used to scan data (see textscan).
-%
-%    The expected format of the data files is:
-%      # == comment
-%      m (rows==data points) x n (columns==measurements)
-%
-%    The format of the output matrix is:
-%      m (rows==files) x n (columns==data points) x p (pages==measurements)
-%
-%    See also: field_names, textscan
-%[files, bytes, names] = dirr(dir,file_pattern,'name');
-
-for i=1:size(filenames,2), j=char(filenames{i});
-    [result status] = unix(['file ' j]);
-    if regexp(status, 'gzip')
-        [status result] = unix(['gzcat ' j]);
-        x{i} = textscan(result, data_pattern, 'CommentStyle', '#');
-    else
-        fid = fopen(char(j));
-        x{i} = textscan(fid, data_pattern, 'CommentStyle', '#');
-        fclose(fid);        
-    end
-end
-
-m=size(x,2); % each row belongs to a different trial.
-n=size(x{1}{1},1); % each column is a different data point.
-p=size(x{1},2); % each page is a different variable.
-
-data=zeros(m,n,p);
-
-% for each datafile (rows)
-row=1;
-for i=1:m
-    % if the datafile has a different number of columns
-    if size(x{i}{1},1) ~= n
-        % remove a row from the returned data
-        data(end,:,:)=[];
-        % and complain:
-        disp(['Warning: killing row ' int2str(i) ' from ' char(filenames{i})]);
-    else
-        % otherwise, copy all the data from that datafile
-        for j=1:p;
-            data(row,:,j)=x{i}{j};
-        end
-        row=row+1;
-    end
-end
\ No newline at end of file

Copied: branches/interrupt/support/math/load_files.m (from rev 3150, development/support/math/load_files.m)
===================================================================
--- branches/interrupt/support/math/load_files.m	                        (rev 0)
+++ branches/interrupt/support/math/load_files.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -0,0 +1,53 @@
+function [data,filenames] = load_files(filenames,data_pattern)
+%LOAD_ALL    Loads multiple data files into a single matrix.
+%
+%    LOAD_ALL(filenames,data_pattern) loads data from the specified files
+%    according to the data pattern.  Automatically handles gzipped files.
+%      filesnames(string): Absolute or relative filenames.
+%      data_pattern(format): Format used to scan data (see textscan).
+%
+%    The expected format of the data files is:
+%      # == comment
+%      m (rows==data points) x n (columns==measurements)
+%
+%    The format of the output matrix is:
+%      m (rows==files) x n (columns==data points) x p (pages==measurements)
+%
+%    See also: field_names, textscan
+%[files, bytes, names] = dirr(dir,file_pattern,'name');
+
+for i=1:size(filenames,2), j=char(filenames{i});
+    [result status] = unix(['file ' j]);
+    if regexp(status, 'gzip')
+        [status result] = unix(['gzcat ' j]);
+        x{i} = textscan(result, data_pattern, 'CommentStyle', '#');
+    else
+        fid = fopen(char(j));
+        x{i} = textscan(fid, data_pattern, 'CommentStyle', '#');
+        fclose(fid);        
+    end
+end
+
+m=size(x,2); % each row belongs to a different trial.
+n=size(x{1}{1},1); % each column is a different data point.
+p=size(x{1},2); % each page is a different variable.
+
+data=zeros(m,n,p);
+
+% for each datafile (rows)
+row=1;
+for i=1:m
+    % if the datafile has a different number of columns
+    if size(x{i}{1},1) ~= n
+        % remove a row from the returned data
+        data(end,:,:)=[];
+        % and complain:
+        disp(['Warning: killing row ' int2str(i) ' from ' char(filenames{i})]);
+    else
+        % otherwise, copy all the data from that datafile
+        for j=1:p;
+            data(row,:,j)=x{i}{j};
+        end
+        row=row+1;
+    end
+end
\ No newline at end of file

Deleted: branches/interrupt/support/math/newfigure.m
===================================================================
--- development/support/math/newfigure.m	2009-02-19 16:19:24 UTC (rev 3150)
+++ branches/interrupt/support/math/newfigure.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -1,10 +0,0 @@
-function [f a] = newfigure()
-%NEWFIGURE Create a new figure, and return a handle to the figure and
-%          its axis.
-f = figure('XVisual',...
-    '0x22 (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)',...
-    'InvertHardcopy','off',...
-    'Color',[1 1 1]);
-a = axes('Parent',f,'Position',[0.13 0.1952 0.7771 0.7229]);
-box('off');
-hold('all');
\ No newline at end of file

Copied: branches/interrupt/support/math/newfigure.m (from rev 3150, development/support/math/newfigure.m)
===================================================================
--- branches/interrupt/support/math/newfigure.m	                        (rev 0)
+++ branches/interrupt/support/math/newfigure.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -0,0 +1,10 @@
+function [f a] = newfigure()
+%NEWFIGURE Create a new figure, and return a handle to the figure and
+%          its axis.
+f = figure('XVisual',...
+    '0x22 (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)',...
+    'InvertHardcopy','off',...
+    'Color',[1 1 1]);
+a = axes('Parent',f,'Position',[0.13 0.1952 0.7771 0.7229]);
+box('off');
+hold('all');
\ No newline at end of file

Deleted: branches/interrupt/support/math/quick_export.m
===================================================================
--- development/support/math/quick_export.m	2009-02-19 16:19:24 UTC (rev 3150)
+++ branches/interrupt/support/math/quick_export.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -1,9 +0,0 @@
-function quick_export(filename)
-%QUICK_EXPORT    Export the current figure (gcf) to the specified file.
-%
-%    QUICK_EXPORT(filename) exports the current figure (gcf) to the
-%    specified file in preferred publication-ready format.
-exportfig(gcf, filename,...
-        'Color','cmyk',...
-        'Width', 6, 'Height', 3.75,...
-        'FontMode', 'fixed', 'FontSize', 9);

Copied: branches/interrupt/support/math/quick_export.m (from rev 3150, development/support/math/quick_export.m)
===================================================================
--- branches/interrupt/support/math/quick_export.m	                        (rev 0)
+++ branches/interrupt/support/math/quick_export.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -0,0 +1,9 @@
+function quick_export(filename)
+%QUICK_EXPORT    Export the current figure (gcf) to the specified file.
+%
+%    QUICK_EXPORT(filename) exports the current figure (gcf) to the
+%    specified file in preferred publication-ready format.
+exportfig(gcf, filename,...
+        'Color','cmyk',...
+        'Width', 6, 'Height', 3.75,...
+        'FontMode', 'fixed', 'FontSize', 9);

Deleted: branches/interrupt/support/math/quick_load.m
===================================================================
--- development/support/math/quick_load.m	2009-02-19 16:19:24 UTC (rev 3150)
+++ branches/interrupt/support/math/quick_load.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -1,92 +0,0 @@
-function R = quick_load(file_pattern, dir, data_pattern, fieldnames)
-%QUICK_LOAD    Intelligently load the specified Avida data files.
-%
-%    R = QUICK_LOAD(DIR,FILE_PATTERN) examines the files returned
-%    by the given directory and file pattern, and returns a struct
-%    containing filenames, field names, updates, and data from
-%    each file returned.  The directory is searched recursively.
-%    Gzip'ed files are decompressed on-the-fly.
-%      dir(string): Absolute or relative path.
-%      file_pattern(regex): Pattern used to match files.
-%      R(struct): See below.
-%    
-%    RETURNS: A struct with one of two formats depending on the
-%    data files that are being loaded.
-%
-%      Format 1 (preferred): This format is used if each of the
-%      header lines in the data files contains a naming tag.  The
-%      naming tag, which must appear at the end of the header, has
-%      the following (regex) format: '.*\[(\w+)\]$'.  When each
-%      header has such a naming tag, the returned struct R has the
-%      following format:
-%        R.updates(1 x n double array): Updates - Avida time.
-%        R.filenames(cell array of chars): Names of the loaded files.
-%        R.fieldnames(cell array of chars): Header lines from files.
-%        R.<tag>(m x n matrix of doubles): Rows are data from different
-%          files, columns are values at different updates.  The <tag>
-%          specifies the measurement (column from the data files).
-%
-%      Example: If the following header lines occur in each Avida
-%      data file:
-%        # 1: updates
-%        # 2: mean value of foo [foo]
-%        # 3: max value of bar [bar]
-%      Then the following struct will be returned:
-%        R.updates = [1...]
-%        R.fieldnames = {{'# 1: mean value of foo [foo]'},
-%          {'# 2: max value of bar [bar]'}}
-%        R.filenames = {filename1, filename2...}
-%        R.foo = [[foo from file1]; [foo from file2]...]
-%        R.bar = [[bar from file1]; [bar from file2]...]
-%
-%      Format 2: This format is used if the header lines in the
-%      data files do not have a naming tag.
-%        R.filenames(cell array of chars): Names of the loaded files.
-%        R.fieldnames(cell array of chars): Header lines from files.
-%        R.data(m x n x p matrix of doubles): Rows are data from
-%          different files, columns are values at different updates,
-%          pages are different measurements (column from the data
-%          files).
-%
-%      Example: If the following header lines occur in at least one
-%      Avida data file:
-%        # 1: updates
-%        # 2: mean value of foo
-%        # 3: max value of bar
-%      Then the following struct will be returned:
-%        R.fieldnames = {{'# 1: mean value of foo'},
-%          {'# 2: max value of bar'}}
-%        R.filenames = {filename1, filename2...}
-%        R.data(:,:,1) = [[updates from file1]; [updates from file2]...]
-%        R.data(:,:,2) = [[foo from file1]; [foo from file2]...]
-%        R.data(:,:,3) = [[bar from file1]; [bar from file2]...]
-%
-%    See also: header_lines, load_all
-
-if nargin < 2
-    dir = './';
-end
-
-filenames = find_files(dir, file_pattern);
-lines = header_lines(filenames);
-lines = lines(~cellfun('isempty',regexp(lines,'^#\s+\d+:\s')));
-
-if nargin <= 2    
-    data_pattern = arrayfun(@(x){'%n'},lines);
-    data_pattern = cat(2,data_pattern{:});
-end
-
-[ldata fnames] = load_files(filenames, data_pattern);
-
-tokens=regexp(lines,'.*\[(\w+)\]$','tokens');
-if isempty(tokens) || any(cellfun('isempty',tokens))
-    R.filenames=fnames;
-    R.fieldnames=lines(1:end);
-    R.data=ldata;
-else
-    R.filenames=fnames;
-    R.fieldnames=lines;
-    for i=1:size(ldata,3);
-        R.(char(tokens{i}{:})) = ldata(:,:,i);
-    end
-end

Copied: branches/interrupt/support/math/quick_load.m (from rev 3150, development/support/math/quick_load.m)
===================================================================
--- branches/interrupt/support/math/quick_load.m	                        (rev 0)
+++ branches/interrupt/support/math/quick_load.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -0,0 +1,92 @@
+function R = quick_load(file_pattern, dir, data_pattern, fieldnames)
+%QUICK_LOAD    Intelligently load the specified Avida data files.
+%
+%    R = QUICK_LOAD(DIR,FILE_PATTERN) examines the files returned
+%    by the given directory and file pattern, and returns a struct
+%    containing filenames, field names, updates, and data from
+%    each file returned.  The directory is searched recursively.
+%    Gzip'ed files are decompressed on-the-fly.
+%      dir(string): Absolute or relative path.
+%      file_pattern(regex): Pattern used to match files.
+%      R(struct): See below.
+%    
+%    RETURNS: A struct with one of two formats depending on the
+%    data files that are being loaded.
+%
+%      Format 1 (preferred): This format is used if each of the
+%      header lines in the data files contains a naming tag.  The
+%      naming tag, which must appear at the end of the header, has
+%      the following (regex) format: '.*\[(\w+)\]$'.  When each
+%      header has such a naming tag, the returned struct R has the
+%      following format:
+%        R.updates(1 x n double array): Updates - Avida time.
+%        R.filenames(cell array of chars): Names of the loaded files.
+%        R.fieldnames(cell array of chars): Header lines from files.
+%        R.<tag>(m x n matrix of doubles): Rows are data from different
+%          files, columns are values at different updates.  The <tag>
+%          specifies the measurement (column from the data files).
+%
+%      Example: If the following header lines occur in each Avida
+%      data file:
+%        # 1: updates
+%        # 2: mean value of foo [foo]
+%        # 3: max value of bar [bar]
+%      Then the following struct will be returned:
+%        R.updates = [1...]
+%        R.fieldnames = {{'# 1: mean value of foo [foo]'},
+%          {'# 2: max value of bar [bar]'}}
+%        R.filenames = {filename1, filename2...}
+%        R.foo = [[foo from file1]; [foo from file2]...]
+%        R.bar = [[bar from file1]; [bar from file2]...]
+%
+%      Format 2: This format is used if the header lines in the
+%      data files do not have a naming tag.
+%        R.filenames(cell array of chars): Names of the loaded files.
+%        R.fieldnames(cell array of chars): Header lines from files.
+%        R.data(m x n x p matrix of doubles): Rows are data from
+%          different files, columns are values at different updates,
+%          pages are different measurements (column from the data
+%          files).
+%
+%      Example: If the following header lines occur in at least one
+%      Avida data file:
+%        # 1: updates
+%        # 2: mean value of foo
+%        # 3: max value of bar
+%      Then the following struct will be returned:
+%        R.fieldnames = {{'# 1: mean value of foo'},
+%          {'# 2: max value of bar'}}
+%        R.filenames = {filename1, filename2...}
+%        R.data(:,:,1) = [[updates from file1]; [updates from file2]...]
+%        R.data(:,:,2) = [[foo from file1]; [foo from file2]...]
+%        R.data(:,:,3) = [[bar from file1]; [bar from file2]...]
+%
+%    See also: header_lines, load_all
+
+if nargin < 2
+    dir = './';
+end
+
+filenames = find_files(dir, file_pattern);
+lines = header_lines(filenames);
+lines = lines(~cellfun('isempty',regexp(lines,'^#\s+\d+:\s')));
+
+if nargin <= 2    
+    data_pattern = arrayfun(@(x){'%n'},lines);
+    data_pattern = cat(2,data_pattern{:});
+end
+
+[ldata fnames] = load_files(filenames, data_pattern);
+
+tokens=regexp(lines,'.*\[(\w+)\]$','tokens');
+if isempty(tokens) || any(cellfun('isempty',tokens))
+    R.filenames=fnames;
+    R.fieldnames=lines(1:end);
+    R.data=ldata;
+else
+    R.filenames=fnames;
+    R.fieldnames=lines;
+    for i=1:size(ldata,3);
+        R.(char(tokens{i}{:})) = ldata(:,:,i);
+    end
+end

Deleted: branches/interrupt/support/math/stderr.m
===================================================================
--- development/support/math/stderr.m	2009-02-19 16:19:24 UTC (rev 3150)
+++ branches/interrupt/support/math/stderr.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -1,5 +0,0 @@
-function r = stderr(x)
-%STDERR    Calculate the standard error of the given array.
-%
-%    Standard error calculated as sqrt(variance/size).
-r = sqrt(var(x)/size(x,1));
\ No newline at end of file

Copied: branches/interrupt/support/math/stderr.m (from rev 3150, development/support/math/stderr.m)
===================================================================
--- branches/interrupt/support/math/stderr.m	                        (rev 0)
+++ branches/interrupt/support/math/stderr.m	2009-06-25 15:43:37 UTC (rev 3332)
@@ -0,0 +1,5 @@
+function r = stderr(x)
+%STDERR    Calculate the standard error of the given array.
+%
+%    Standard error calculated as sqrt(variance/size).
+r = sqrt(var(x)/size(x,1));
\ No newline at end of file




More information about the Avida-cvs mailing list