[Avida-cvs] [avida-svn] r986 - branches/developers/avida-edward/source/python/AvidaGui2
baerb at myxo.css.msu.edu
baerb at myxo.css.msu.edu
Mon Sep 25 14:50:49 PDT 2006
Author: baerb
Date: 2006-09-25 17:50:49 -0400 (Mon, 25 Sep 2006)
New Revision: 986
Modified:
branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pyLiveControlsCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pyMapProfile.py
branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pyPetriDishCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py
Log:
If you try to start a run with no organism as warning pops up and you can not
proceed
Fixed problems where ancestor names were not showing up when cells were clicked
before runs started
Removed some print/descr statements
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py 2006-09-25 19:06:05 UTC (rev 985)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py 2006-09-25 21:50:49 UTC (rev 986)
@@ -410,8 +410,12 @@
def startActionSlot(self):
if self.startStatus:
- self.m_session_mdl.m_session_mdtr.emit(
- PYSIGNAL("fromLiveCtrlStartAvidaSig"), ())
+ if (self.m_session_mdl.m_global_num_of_ancestors == 0):
+ warningNoMethodName("There were no starting organism in this population " + \
+ "please drag in at least one from the freezer.")
+ else:
+ self.m_session_mdl.m_session_mdtr.emit(
+ PYSIGNAL("fromLiveCtrlStartAvidaSig"), ())
else:
self.m_session_mdl.m_session_mdtr.emit(
PYSIGNAL("fromLiveCtrlPauseAvidaSig"), ())
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyLiveControlsCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyLiveControlsCtrl.py 2006-09-25 19:06:05 UTC (rev 985)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyLiveControlsCtrl.py 2006-09-25 21:50:49 UTC (rev 986)
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from qt import *
+from descr import *
from pyLiveControlsView import pyLiveControlsView
@@ -47,7 +48,6 @@
self.avidaUpdatedSlot)
del old_avida
if(self.m_avida):
- print "pyLiveControlsCtrl.setAvidaSlot() connecting self.m_avida ..."
self.connect(
self.m_avida.m_avida_thread_mdtr, PYSIGNAL("AvidaUpdatedSig"),
self.avidaUpdatedSlot)
@@ -66,11 +66,14 @@
PYSIGNAL("fromLiveCtrlPauseAvidaSig"), ())
def clickedStartAvidaSlot(self):
- self.m_session_mdl.m_session_mdtr.emit(
- PYSIGNAL("fromLiveCtrlStartAvidaSig"), ())
+ if (self.m_session_mdl.m_global_num_of_ancestors == 0):
+ warningNoMethodName("There were no starting organism in this population " + \
+ "please drag in at least one from the freezer.")
+ else:
+ self.m_session_mdl.m_session_mdtr.emit(
+ PYSIGNAL("fromLiveCtrlStartAvidaSig"), ())
def restart(self):
- print "*** called pyLiveControlsCtrl.py:restart ***"
self.m_avida = None
self.disconnect(
self.m_session_mdl.m_session_mdtr, PYSIGNAL("setAvidaSig"),
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyMapProfile.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyMapProfile.py 2006-09-25 19:06:05 UTC (rev 985)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyMapProfile.py 2006-09-25 21:50:49 UTC (rev 986)
@@ -54,17 +54,13 @@
self.m_should_reset = should_reset
def shouldReset(self):
- #descr()
return self.m_should_reset
def getRange(self):
- #descr()
return self.m_inf, self.m_sup
def resetRange(self, population):
- #descr(population)
(inf, sup) = self.m_range.getRange()
- #descr("(inf, sup)", (inf, sup))
#(self.m_target_inf, self.m_target_sup) = (self.m_inf, self.m_sup) = (inf, sup)
(self.m_target_inf, self.m_target_sup) = (self.m_inf, self.m_sup) = (0, sup)
self.m_inf_rescale_rate = self.m_sup_rescale_rate = 0
@@ -72,12 +68,10 @@
return self.getRange()
def updateRange(self, population):
- #descr(population)
if self.m_should_reset:
return self.resetRange(population)
(inf, sup) = self.m_range.getRange()
- #descr("(inf, sup)", (inf, sup))
if (sup < (1 - self.m_sup_tolerance_coeff) * self.m_target_sup) or (self.m_target_sup < sup):
new_target_sup = sup * (1 + self.m_sup_tolerance_coeff)
@@ -85,7 +79,6 @@
self.m_sup_rescale_rate = float(new_target_sup - self.m_sup) / self.m_updates_to_rescale
self.m_target_sup = new_target_sup
- #descr("self.m_sup", self.m_sup)
# if self.m_sup <= 0:
if self.m_sup_rescale_rate != 0:
if inf <= self.m_sup:
@@ -119,17 +112,13 @@
self.m_should_reset = should_reset
def shouldReset(self):
- #descr("Testing whether I should reset", self.m_should_reset)
return self.m_should_reset
def getRange(self):
- #descr()
return self.m_inf, self.m_sup
def resetRange(self, population):
- #descr(population)
(inf, sup) = self.m_range.getRange()
- #descr("(inf, sup)", (inf, sup))
#(self.m_target_inf, self.m_target_sup) = (self.m_inf, self.m_sup) = (inf, sup)
(self.m_target_inf, self.m_target_sup) = (self.m_inf, self.m_sup) = (0, sup)
self.m_inf_rescale_rate = self.m_sup_rescale_rate = 0
@@ -137,13 +126,10 @@
return self.getRange()
def updateRange(self, population):
- #descr(population)
- #descr("self.m_should_reset",self.m_should_reset)
if self.m_should_reset:
return self.resetRange(population)
(inf, sup) = self.m_range.getRange()
- #descr("(inf, sup)", (inf, sup))
if (sup < (1 - self.m_sup_tolerance_coeff) * self.m_target_sup) or (self.m_target_sup < sup):
new_target_sup = sup * (1 + self.m_sup_tolerance_coeff)
@@ -151,7 +137,6 @@
self.m_sup_rescale_rate = float(new_target_sup - self.m_sup) / self.m_updates_to_rescale
self.m_target_sup = new_target_sup
- #descr("self.m_sup", self.m_sup)
# if self.m_sup <= 0:
if self.m_sup_rescale_rate != 0:
if inf <= self.m_sup:
@@ -188,13 +173,10 @@
return self.m_should_reset
def getRange(self):
- #descr()
return self.m_inf, self.m_sup
def resetRange(self, population):
- #descr(population)
(inf, sup) = self.m_range.getRange()
- #descr("(inf, sup)", (inf, sup))
#(self.m_target_inf, self.m_target_sup) = (self.m_inf, self.m_sup) = (inf, sup)
(self.m_target_inf, self.m_target_sup) = (self.m_inf, self.m_sup) = (0, sup)
self.m_inf_rescale_rate = self.m_sup_rescale_rate = 0
@@ -202,13 +184,10 @@
return self.getRange()
def updateRange(self, population):
- #descr(population)
- #descr("self.m_should_reset",self.m_should_reset)
if self.m_should_reset:
return self.resetRange(population)
(inf, sup) = self.m_range.getRange()
- #descr("(inf, sup)", (inf, sup))
if (sup < (1 - self.m_sup_tolerance_coeff) * self.m_target_sup) or (self.m_target_sup < sup):
new_target_sup = sup * (1 + self.m_sup_tolerance_coeff)
@@ -254,21 +233,15 @@
self.m_avida = None
self.m_range = (0, 0)
def setAvidaSlot(self, avida):
- print "RangeReport.setAvidaSlot() ..."
old_avida = self.m_avida
self.m_avida = avida
if(old_avida):
- print "RangeReport.setAvidaSlot() unsetting old_avida ..."
if hasattr(old_avida, "m_avida_thread_mdtr"):
- print "RangeReport.setAvidaSlot() disconnect old_avida ..."
self.disconnect(
old_avida.m_avida_thread_mdtr, PYSIGNAL("AvidaUpdatedSig"),
self.avidaUpdatedSlot)
- print "RangeReport.setAvidaSlot() deleting old_avida ..."
del old_avida
- print "RangeReport.setAvidaSlot() done ..."
if(self.m_avida):
- print "RangeReport.setAvidaSlot() connecting self.m_avida ..."
self.connect(
self.m_avida.m_avida_thread_mdtr, PYSIGNAL("AvidaUpdatedSig"),
self.avidaUpdatedSlot)
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsCtrl.py 2006-09-25 19:06:05 UTC (rev 985)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsCtrl.py 2006-09-25 21:50:49 UTC (rev 986)
@@ -226,8 +226,13 @@
str(self.clicked_cell_num)][:12]+'...')
else:
self.m_org_ancestor_name.setText( self.m_session_mdl.m_cell_num_ancestor_name_dict[\
- str(self.clicked_cell_num)])
+ str(self.clicked_cell_num)])
+ # If the user clicks on a cell not in the cell_num_ancestor_name_dict
+ # thought it would work if user click on an empty cell, but it does not
+
+ else:
+ self.m_org_ancestor_name.setText('-')
self.m_clicked_cell_number = self.clicked_cell_num
if clicked_cell_item is None or not self.m_avida.m_population.GetCell(int(self.clicked_cell_num)).IsOccupied():
@@ -253,14 +258,10 @@
self.m_num_nor_clickedOrg.setText('-')
self.m_num_xor_clickedOrg.setText('-')
self.m_num_equals_clickedOrg.setText('-')
- self.m_org_ancestor_name.setText('-')
self.m_org_square_ctrl.paint(Qt.black)
return
-
-
-
self.m_org_square_ctrl.paint(clicked_cell_item.brush().color())
clicked_cell = self.m_avida.m_population.GetCell(int(self.clicked_cell_num))
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py 2006-09-25 19:06:05 UTC (rev 985)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py 2006-09-25 21:50:49 UTC (rev 986)
@@ -29,8 +29,6 @@
self.m_avida = avida
if old_avida:
del old_avida
- if self.m_avida:
- pass
def construct(self, session_mdl):
self.m_session_mdl = session_mdl
@@ -594,6 +592,8 @@
qApp.quit()
+ # Routine to load data from Avida-ED into Avida Core
+
def doLoadPetriDishConfigFileSlot(self, genesisFileName = None):
genesis = cGenesis()
genesis.Open(cString(genesisFileName))
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyPetriDishCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyPetriDishCtrl.py 2006-09-25 19:06:05 UTC (rev 985)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyPetriDishCtrl.py 2006-09-25 21:50:49 UTC (rev 986)
@@ -103,10 +103,9 @@
def doStartAvidaSlot (self):
# self.m_avida_has_started = True //replacing with the session_mdl version
+
self.m_session_mdl.m_avida_has_started = True
-
-
def restart(self):
self.m_cell_info = None
self.m_changed_cell_items = []
@@ -194,9 +193,10 @@
if self.m_avida is not None:
m_founding_cells_dict = self.m_session_mdl.m_founding_cells_dict
- for k, v in m_founding_cells_dict.iteritems():
- cell_info_item = self.updateCellItem(int(k))
- cell_info_item.setPen(QPen(QColor(Qt.gray)))
+ if len(m_founding_cells_dict) > 0:
+ for cell_num, org_num in m_founding_cells_dict.iteritems():
+ cell_info_item = self.updateCellItem(int(cell_num))
+ cell_info_item.setPen(QPen(QColor(Qt.gray)))
self.m_thread_work_cell_item_index = 0
self.m_cs_min_value = 0
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py 2006-09-25 19:06:05 UTC (rev 985)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py 2006-09-25 21:50:49 UTC (rev 986)
@@ -57,7 +57,12 @@
self.m_session_mdl.directory_chosen = False
+ # flag to see if the program should check that there are ancestors
+
+ self.m_session_mdl.m_global_num_of_ancestors = 0
+
# has avida started (set to true by doStartAvidaSlot in pyPetriDishCtrl)
+
self.m_session_mdl.m_avida_has_started = False
# use the default workspace that is in the application directory
@@ -66,14 +71,13 @@
self.m_session_mdl.m_current_freezer = os.path.join(self.m_session_mdl.m_current_workspace, "freezer")
# set a global variable for the location of starting cells
- self.m_session_mdl.m_founding_cells_dict = None
+ self.m_session_mdl.m_founding_cells_dict = {}
# set a global lookup table mapping lineage labels to ancestor names
-# self.m_session_mdl.m_ancestors_dict = None
- self.m_session_mdl.m_ancestors_dict = {'1': 'default'}
+ self.m_session_mdl.m_ancestors_dict = {}
# global dictionary mapping cell number to ancestor name
- self.m_session_mdl.m_cell_num_ancestor_name_dict = {'pySession':'thefoobear'}
+ self.m_session_mdl.m_cell_num_ancestor_name_dict = {}
# set a global variable for locking the ancestor lineage map mode max range
self.m_session_mdl.m_max_lineages_ever = 0
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py 2006-09-25 19:06:05 UTC (rev 985)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py 2006-09-25 21:50:49 UTC (rev 986)
@@ -13,7 +13,7 @@
def __init__(self, in_dict = None, session_mdl = None, workspace_dir = None, freeze_dir = None,
tmp_in_dir = None, tmp_out_dir = None):
-
+
self.m_session_mdl = session_mdl
settings_dict = in_dict["SETTINGS"]
@@ -48,9 +48,14 @@
linage_lable_in_cell = ancestor_link_dict[org_in_cell]
ann_name_in_cell = session_mdl.m_ancestors_dict[linage_lable_in_cell]
session_mdl.m_cell_num_ancestor_name_dict[tmp_cell] = ann_name_in_cell
+ self.m_session_mdl.m_global_num_of_ancestors = \
+ len(session_mdl.m_cell_num_ancestor_name_dict)
#if it is not a full petri dish
else:
+ self.m_session_mdl.m_cell_num_ancestor_name_dict = {}
+ self.m_session_mdl.m_global_num_of_ancestors = 0
+ self.m_session_mdl.m_founding_cells_dict = {}
cells_dict = {}
organisms_dict = {}
session_mdl.m_ancestors_dict = {}
@@ -63,9 +68,8 @@
num_ancestors = 0
while(settings_dict.has_key("START_CREATURE" + str(num_ancestors))):
- self.m_session_mdl.m_cell_num_ancestor_name_dict = {}
num_ancestors = num_ancestors + 1
- self.m_session_mdl.m_cell_num_ancestor_name_dict = {}
+ self.m_session_mdl.m_global_num_of_ancestors = num_ancestors
# Process all the ancestors
@@ -81,16 +85,15 @@
# This variable is used in pyPetriDishCtrl.py to outline the
# founding organisms
- self.m_session_mdl.m_founding_cells_dict = None
self.m_session_mdl.m_founding_cells_dict = cells_dict
- self.m_session_mdl.m_cell_num_ancestor_name_dict[str(self.start_cell_location)] = session_mdl.m_ancestors_dict[str(i)]
+ self.m_session_mdl.m_cell_num_ancestor_name_dict[str(self.start_cell_location)] = \
+ session_mdl.m_ancestors_dict[str(i)]
# Read the genome from the dictionary
organisms_dict[str(i)] = settings_dict["START_GENOME" + str(i)]
shutil.copyfile(os.path.join(workspace_dir, "inst_set.default"), os.path.join(tmp_in_dir, "inst_set.default"))
- descr("########### self.m_session_mdl.m_cell_num_ancestor_name_dict: ", str(self.m_session_mdl.m_cell_num_ancestor_name_dict))
settings_dict["EVENT_FILE"] = os.path.join(tmp_in_dir, "events.cfg")
settings_dict["ENVIRONMENT_FILE"] = os.path.join(tmp_in_dir, "environment.cfg")
@@ -129,7 +132,6 @@
analyze_genotype = cAnalyzeGenotype(cString(genome), inst_set)
analyze_genotype.Recalculate()
merit = analyze_genotype.GetMerit()
- #descr("key", key, "genome", genome, "merit", merit)
merits_dict[key] = merit
self.modifyEventFile(cells_dict, organisms_dict, ancestor_link_dict,
More information about the Avida-cvs
mailing list