How to let cells die after a certain number of steps

5 weeks ago by
How can I attach a timer to a cell , let it die after a certain number of steps. This kind of cell does not exist at the beginning, it will appear at a certain condition of  the model running.
Community: CompuCell3D

1 Answer

4 weeks ago by
You can attach a python dictionary to a cell when it is created, so you can log the mcs step that the cell was created at.  When you create the cell of this particular type;
     cellDict=CompuCell.getPyAttrib(cell) # attach a dictionary to this cell
   cellDict["createdMCS"] = mcs # add a dictionary item for the step the cell was created.
   print "CellID=",," dictionary element createdMCS=",cellDict["createdMCS"]
Elsewhere you have another chunk of python code that determines how old a cell is and kills it if it is too old;
for cell in self.cellList:
    if cell.type == "The type of cell that you want to track and kill":
        cellDict=CompuCell.getPyAttrib(cell)  # get the dictionary for this cell
        if (mcs - cellDict["createdMCS"]) > 100 : # kill if the cell is > 100 mcs old

You don't need to do

cellDict["createdMCS"] = mcs 

You can just do

cell.dict["attribute"] = attribute
written 2 days ago by Juliano Ferrari Gianlupi  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »