[Avida-cvs] [avida-svn] r862 - branches/developers/avida-edward/source/python/AvidaGui2
baerb@myxo.css.msu.edu
baerb at myxo.css.msu.edu
Tue Aug 1 07:28:19 PDT 2006
Author: baerb
Date: 2006-08-01 10:28:19 -0400 (Tue, 01 Aug 2006)
New Revision: 862
Modified:
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/pyWriteToFreezer.py
Log:
Finished code that reads and writes ancestor (lineage label) information
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py 2006-08-01 02:48:27 UTC (rev 861)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py 2006-08-01 14:28:19 UTC (rev 862)
@@ -524,7 +524,7 @@
return settings_dict
- def FreezePetriSlot(self, population_dict = None, send_reset_signal = False, send_quit_signal = False):
+ def FreezePetriSlot(self, population_dict = None, ancestor_dict = None, send_reset_signal = False, send_quit_signal = False):
descr()
if len(population_dict) == 0:
freeze_empty_only_flag = True;
@@ -555,13 +555,13 @@
shutil.copyfile(tmp_count_file, os.path.join(file_name, "count.dat"))
file_name = os.path.join(file_name, "petri_dish")
tmp_dict["POPULATION"] = population_dict
+ tmp_dict["ANCESTOR_NAMES"] = self.m_session_mdl.m_ancestors_dict
+ tmp_dict["ANCESTOR_LINKS"] = ancestor_dict
freezer_file = pyWriteToFreezer(tmp_dict, file_name)
if (is_empty_dish):
self.m_session_mdl.saved_empty_dish = True
else:
self.m_session_mdl.saved_full_dish = True
- descr ("BDB -- self.m_session_mdl.saved_empty_dish = " + str(self.m_session_mdl.saved_empty_dish))
- descr ("BDB -- self.m_session_mdl.saved_full_dish = " + str(self.m_session_mdl.saved_full_dish))
# Have program redraw the freezer menu pane
@@ -613,7 +613,6 @@
if ( QTextDrag.decode( e, freezer_item_name ) ) :
freezer_item_name = str(e.encodedData("text/plain"))
- print "BDB:dragEnterEvent -- freezer item name = " + freezer_item_name
if os.path.exists(freezer_item_name) == False:
descr("that was not a valid path (1)")
else:
@@ -626,7 +625,6 @@
freezer_item_name = QString()
if ( QTextDrag.decode( e, freezer_item_name ) ) :
freezer_item_name = str(e.encodedData("text/plain"))
- print "BDB:dropEvent -- freezer item name = " + freezer_item_name
if os.path.exists(freezer_item_name) == False:
print "that was not a valid path (2)"
else:
@@ -642,7 +640,6 @@
freezer_item_name = QString()
if ( QTextDrag.decode( e, freezer_item_name ) and not self.DishDisabled) :
freezer_item_name = str(e.encodedData("text/plain"))
- print "BDB:petriDroppedEvent -- freezer item name = " + freezer_item_name
if freezer_item_name[-8:] == 'organism':
core_name = freezer_item_name[:-9]
core_name = os.path.basename(str(freezer_item_name[:-9]))
@@ -663,7 +660,6 @@
freezer_item_name = QString()
if ( QTextDrag.decode( e, freezer_item_name ) and not self.DishDisabled) :
freezer_item_name = str(e.encodedData("text/plain"))
- print "BDB:petriAncestorDroppedEvent -- freezer item name = " + freezer_item_name
if freezer_item_name[-8:] == 'organism':
core_name = freezer_item_name[:-9]
core_name = os.path.basename(str(freezer_item_name[:-9]))
@@ -685,7 +681,6 @@
print type(item)
if (not item):
- print "BDB -- Not an item"
return
dragHolder = QTextDrag("ancestor." + str(item.text()), self.AncestorIconView, "dragname")
dragHolder.dragCopy()
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyPetriDishCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyPetriDishCtrl.py 2006-08-01 02:48:27 UTC (rev 861)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyPetriDishCtrl.py 2006-08-01 14:28:19 UTC (rev 862)
@@ -278,6 +278,7 @@
# phase with that signal.
population_dict = {}
+ ancestor_dict = {}
if self.m_avida != None:
for x in range(self.m_world_w):
for y in range(self.m_world_h):
@@ -286,8 +287,9 @@
organism = cell.GetOrganism()
genome = organism.GetGenome()
population_dict[cell.GetID()] = str(genome.AsString())
+ ancestor_dict[cell.GetID()] = str(organism.GetLineageLabel())
self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("freezeDishPhaseIISig"),
- (population_dict, send_reset_signal, send_quit_signal, ))
+ (population_dict, ancestor_dict, send_reset_signal, send_quit_signal, ))
def zoomSlot(self, zoom_factor):
if hasattr(self,"m_world_h") == False:
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyWriteToFreezer.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyWriteToFreezer.py 2006-08-01 02:48:27 UTC (rev 861)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyWriteToFreezer.py 2006-08-01 14:28:19 UTC (rev 862)
@@ -58,17 +58,23 @@
if in_dict.has_key("POPULATION"):
pop_dict = in_dict["POPULATION"]
del in_dict["POPULATION"]
+
+ # When the ANCESTOR_LINKS hash is passed in it has cell location linked
+ # to linage label. We need to have organism ID linked to linage label.
+
+ orig_anc_dict = in_dict["ANCESTOR_LINKS"]
+ del in_dict["ANCESTOR_LINKS"]
# Create a unique number ID for each genome. Make a dictionary with
# that ID as a key and the genome string as the value. Make a second
# (temporary) directory that has reverse key/values. Create a third
# dictionary that has the cell location as the key and the genome ID
- # as the value
+ # as the value. Write the ancestor dictionary with the correct
+ # ID/linage_label structure.
organism_dict = {}
in_dict["ORGANISMS"] = {}
in_dict["CELLS"] = {}
- in_dict["ANCESTOR_NAMES"] = {}
in_dict["ANCESTOR_LINKS"] = {}
new_genome_num = 0
for cell in pop_dict.keys():
@@ -77,9 +83,8 @@
new_genome_num = new_genome_num + 1
curr_genome_num = new_genome_num
in_dict["ORGANISMS"][new_genome_num] = genome
+ in_dict["ANCESTOR_LINKS"][new_genome_num] = orig_anc_dict[cell]
organism_dict[genome] = new_genome_num
else:
curr_genome_num = organism_dict[genome]
in_dict["CELLS"][cell] = curr_genome_num
-
-
More information about the Avida-cvs
mailing list