### How to let cells die after a certain number of steps

51
views
0
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

0
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=", cell.id," 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
            cell.targetVolume=0


You don't need to do

cellDict=CompuCell.getPyAttrib(cell)
cellDict["createdMCS"] = mcs 

You can just do

cell.dict["attribute"] = attribute
written 2 days ago by Juliano Ferrari Gianlupi