Parameter scan for parameters in a python file


66
views
0
5 weeks ago by
I would like to run parameter scan from parameters listed in the .py file of the Main Python Script. However, I am unable to open the editor when I click on the parameters to be changed. I guess then I will have to input it manually in the xml file. I would highly appreciate if I can avail a template for the same.
Community: CompuCell3D

2 Answers


3
5 weeks ago by
Can you move the parameters into your steppables python file instead of your main python file? The parameter scan is, I believe, specific to regular python files and to the CC3D XML file.

See also: http://pythonscriptingmanual.readthedocs.io/en/latest/parameter_scans.html
Do I have to make them global as well  as mentioned here?

from PySteppables import *
import CompuCell
import sys

MYVAR = 10
MYVAR1 = 'new str'


class CellSortingSteppable(SteppableBasePy):
def __init__(self, _simulator, _frequency=1):
SteppableBasePy.__init__(self, _simulator, _frequency)

def step(self, mcs):
global MYVAR
print 'MYVAR=', MYVAR
for cell in self.cellList:
if cell.type == self.DARK:
cell.lambdaVecX = -0.5
written 5 weeks ago by Mahua Roy  
3
5 weeks ago by
I believe they need to be in the top level namespace (hence "global"). In the little demo snippet the "global MYVAR" line isn't needed if the CellSortingSteppable class is only reading, and not writing, the variable.  All of your classes will have direct access to any variable defined outside the classes.

You can first try it without making the variables global (e.g., a variable in a class), it might work.
Please login to add an answer/comment or follow this question.

Similar posts:
Search »