### Does my simulation code crash the twedit++ when parameter scan is added for the first time?

198
views
0
5 months ago by

I have a problem regarding crashing of twedit++ when I try to add parameter scan (see the image; question mark indicates the chrash event).
What do, how to solve? The demo cc3d codes seem to work, play, and add all the parameter scans in the world. The only solution that I can think of at the moment is to do my code again and/or reinstall the compucell3d&twedit.

Yours,
Pauli

Community: CompuCell3D

1
4 months ago by
What platform are you running on? Windows, Mac, linux, ...? It sounds like the parameter scan task is trying to write to a directory you didn't have access to.

I've also noticed crashes when you try to save the file after defining the parameter scans. In my case though the files are written correctly and can be re-loaded into twedit, or run from the command line.
Windows. I use the same directory where my compucell3d is. I have still experienced problems in starting to run the simulation code in my new directory inside this folder. The program does not crash, but it does not play the simulation code. I have attached the run file.
processCommandLineOptions

opts= []
args= []
FILE LIST= []
pixmap= <PyQt5.QtGui.QPixmap object at 0x0000000005586278>
INIT SYNC self.modifiedPluginsDataStringList= []
pluginModules= ['PluginCCDCPPHelper', 'PluginCCDMLHelper', 'PluginCCDProject', 'PluginCCDPythonHelper', 'PluginCompuCell3D']
plugin name= PluginCCDCPPHelper

plugin name= PluginCCDMLHelper

['C:\\CompuCell3D-64bit\\lib\\PythonDeps', 'C:\\CompuCell3D-64bit\\Twedit++5', 'C:\\CompuCell3D-64bit\\Twedit++5\\Plugins', 'C:\\CompuCell3D-64bit\\Python27\\python27.zip', 'C:\\CompuCell3D-64bit\\Python27\\DLLs', 'C:\\CompuCell3D-64bit\\Python27\\lib', 'C:\\CompuCell3D-64bit\\Python27\\lib\\plat-win', 'C:\\CompuCell3D-64bit\\Python27\\lib\\lib-tk', 'C:\\CompuCell3D-64bit\\Python27', 'C:\\CompuCell3D-64bit\\Python27\\lib\\site-packages', 'C:\\CompuCell3D-64bit\\Python27\\lib\\site-packages\\win32', 'C:\\CompuCell3D-64bit\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\CompuCell3D-64bit\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\CompuCell3D-64bit\\lib\\python', 'C:\\CompuCell3D-64bit\\pythonSetupScripts']
plugin name= PluginCCDProject

plugin name= PluginCCDPythonHelper

plugin name= PluginCompuCell3D

************PLUGIN NAME= PluginCompuCell3D
name=PluginCompuCell3D
fileName=C:\CompuCell3D-64bit\Twedit++5\Plugins\PluginCompuCell3D.py
author=Maciej Swat
autoactivate=True
deactivateable=False
version=0.9.0
className=CC3DApp
packageName=__core__
longDescription=This plugin provides functionality to link Twedit with CompuCell3D

version= 0.9.0  className= CC3DApp  pluginClass= <class 'PluginCompuCell3D.CC3DApp'>
PORT= -1
__initActions
CC3D CONSTRUCTOR
WILL TRY TO ACTIVATE  <PluginCompuCell3D.CC3DApp object at 0x0000000005921678>
ACTIVATED
************PLUGIN NAME= PluginCCDProject
name=PluginCCDProject
fileName=C:\CompuCell3D-64bit\Twedit++5\Plugins\PluginCCDProject.py
author=Maciej Swat
autoactivate=True
deactivateable=False
version=0.9.0
className=CC3DProject
packageName=__core__
shortDescription=Plugin to manage CC3D Projects
longDescription=This plugin provides functionality that allows users to manage *.cc3d projects

version= 0.9.0  className= CC3DProject  pluginClass= <class 'PluginCCDProject.CC3DProject'>
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
WILL TRY TO ACTIVATE  <PluginCCDProject.CC3DProject object at 0x0000000005921D38>
ACTIVATED
************PLUGIN NAME= PluginCCDPythonHelper
name=PluginCCDPythonHelper
fileName=C:\CompuCell3D-64bit\Twedit++5\Plugins\PluginCCDPythonHelper.py
author=Maciej Swat
autoactivate=True
deactivateable=True
version=0.9.0
className=CC3DPythonHelper
packageName=__core__
shortDescription=Plugin which assists with CC3D Python scripting
longDescription=This plugin provides provides users with CC3D Python code snippets - making Python scripting in CC3D more convenient.

version= 0.9.0  className= CC3DPythonHelper  pluginClass= <class 'PluginCCDPythonHelper.CC3DPythonHelper'>
WILL TRY TO ACTIVATE  <PluginCCDPythonHelper.CC3DPythonHelper object at 0x0000000005921438>
************PLUGIN NAME= PluginCCDCPPHelper
name=PluginCCDCPPHelper
fileName=C:\CompuCell3D-64bit\Twedit++5\Plugins\PluginCCDCPPHelper.py
author=Maciej Swat
autoactivate=True
deactivateable=True
version=0.9.0
className=CC3DCPPHelper
packageName=__core__
shortDescription=Plugin assists with CC3D C++ module development scripting
longDescription=This plugin provides provides users with CC3D C++ code generator and code snippets - making CC3D C++ plugin and steppable development  more convenient.

version= 0.9.0  className= CC3DCPPHelper  pluginClass= <class 'PluginCCDCPPHelper.CC3DCPPHelper'>
WILL TRY TO ACTIVATE  <PluginCCDCPPHelper.CC3DCPPHelper object at 0x000000000588B558>
ACTIVATED
************PLUGIN NAME= PluginCCDMLHelper
name=PluginCCDMLHelper
fileName=C:\CompuCell3D-64bit\Twedit++5\Plugins\PluginCCDMLHelper.py
author=Maciej Swat
autoactivate=True
deactivateable=True
version=0.9.0
className=CC3DMLHelper
packageName=__core__
shortDescription=Plugin which assists with CC3D Python scripting
longDescription=This plugin provides provides users with CC3D Python code snippets - making Python scripting in CC3D more convenient.

version= 0.9.0  className= CC3DMLHelper  pluginClass= <class 'PluginCCDMLHelper.CC3DMLHelper'>
WILL TRY TO ACTIVATE  <PluginCCDMLHelper.CC3DMLHelper object at 0x000000000588B798>
ACTIVATED
_settingName= RecentProjects
recentItems= [u'C:\\CompuCell3D-64bit\\pauli\\aggregation\\PKD_paper_codes\\isoCyst\\isoCyst.cc3d', u'C:\\CompuCell3D-64bit\\Demos\\BookChapterDemos_ComputationalMethodsInCellBiology\\VascularTumor\\VascularTumor.cc3d', u'C:\\CompuCell3D-64bit\\pauli\\aggregation\\PKD_paper_codes\\tubule\\PKD.cc3d', u'C:\\CompuCell3D-64bit\\pauli\\movements\\m19\\okok\\peitto.cc3d', u'C:\\CompuCell3D-64bit\\pauli\\aggregation\\PTAtoRV-STANDARD\\aggregration\\aggregration.cc3d', u'C:\\CompuCell3D-64bit\\Demos\\BookChapterDemos_ComputationalMethodsInCellBiology\\okok\\peitto.cc3d', u'C:\\CompuCell3D-64bit\\Demos\\BookChapterDemos_ComputationalMethodsInCellBiology\\cellsorting2\\cellsorting.cc3d', u'C:\\CompuCell3D-64bit\\Demos\\BookChapterDemos_ComputationalMethodsInCellBiology\\cellsorting\\cellsorting.cc3d']
GOT SUSTOM SETTINGS :  C:\CompuCell3D-64bit\Demos\BookChapterDemos_ComputationalMethodsInCellBiology\okok\Simulation\_settings.sqlite
projParent= peitto.cc3d
__openXMLPythonInEditor pdh.cc3dSimulationData.xmlScript= C:\CompuCell3D-64bit\Demos\BookChapterDemos_ComputationalMethodsInCellBiology\okok\Simulation\peitto.xml
__openXMLPythonInEditor pdh.cc3dSimulationData.xmlScriptResource.path= C:\CompuCell3D-64bit\Demos\BookChapterDemos_ComputationalMethodsInCellBiology\okok\Simulation\peitto.xml
opening file  C:\CompuCell3D-64bit\Demos\BookChapterDemos_ComputationalMethodsInCellBiology\okok\Simulation\peitto.xml
opening file  C:\CompuCell3D-64bit\Demos\BookChapterDemos_ComputationalMethodsInCellBiology\okok\Simulation\peitto.py
opening file  C:\CompuCell3D-64bit\Demos\BookChapterDemos_ComputationalMethodsInCellBiology\okok\Simulation\peittoSteppables.py
projParent= peitto.cc3d

RESOURCENAME
projParent= peitto.cc3d
CurrentItem= peitto.cc3d  parent= None
getFullPath= projParent= peitto.cc3d

projectFullPath= C:\CompuCell3D-64bit\Demos\BookChapterDemos_ComputationalMethodsInCellBiology\okok\peitto.cc3d
TRY TO FIGURE OUT PORT

CHECKING PORT= 47406
CHECKING PORT= 47407
established empty port= 47407
self.cc3dPath= C:\CompuCell3D-64bit\compucell3d.bat
Executing Popen command with following arguments= ['C:\\CompuCell3D-64bit\\compucell3d.bat', '--port=47407', '-i', u'C:\\CompuCell3D-64bit\\Demos\\BookChapterDemos_ComputationalMethodsInCellBiology\\okok\\peitto.cc3d']
starting CC3D
['C:\\CompuCell3D-64bit\\player5', 'C:\\CompuCell3D-64bit\\lib\\python', 'C:\\CompuCell3D-64bit\\Python27\\python27.zip', 'C:\\CompuCell3D-64bit\\Python27\\DLLs', 'C:\\CompuCell3D-64bit\\Python27\\lib', 'C:\\CompuCell3D-64bit\\Python27\\lib\\plat-win', 'C:\\CompuCell3D-64bit\\Python27\\lib\\lib-tk', 'C:\\CompuCell3D-64bit\\Python27', 'C:\\CompuCell3D-64bit\\Python27\\lib\\site-packages', 'C:\\CompuCell3D-64bit\\Python27\\lib\\site-packages\\win32', 'C:\\CompuCell3D-64bit\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\CompuCell3D-64bit\\Python27\\lib\\site-packages\\Pythonwin']
compucell3d.pyw:   type(argv)= <type 'list'>
compucell3d.pyw:   argv= ['--port=47407', '-i', 'C:\\CompuCell3D-64bit\\Demos\\BookChapterDemos_ComputationalMethodsInCellBiology\\okok\\peitto.cc3d', '--currentDir=C:\\CompuCell3D-64bit']
CONSOLE PARENT= <UI.UserInterface.DockWidget object at 0x000000000AF34678>
self.baseFont.fixedPitch()= True
TWEDIT socket.socketDescriptor()= <sip.voidptr object at 0x000000000AF2E850>
TRY TO FIGURE OUT PORT

CHECKING PORT= 47406
CHECKING PORT= 47407
CHECKING PORT= 47408
established empty port= 47408

CALL establishConnection
self.__fileName= C:\CompuCell3D-64bit\Demos\BookChapterDemos_ComputationalMethodsInCellBiology\okok\peitto.cc3d
GOT SUSTOM SETTINGS :  C:\CompuCell3D-64bit\Demos\BookChapterDemos_ComputationalMethodsInCellBiology\okok\Simulation\_settings.sqlite
currentIteration= [3]
multiplicativeFactors= [1]

iterationId= 3
Error Parsing Parameter scan file

Traceback (most recent call last):
File "C:\CompuCell3D-64bit\player5\compucell3d.pyw", line 258, in <module>
error_code = main(sys.argv[1:])
File "C:\CompuCell3D-64bit\player5\compucell3d.pyw", line 239, in main
mainWindow.viewmanager.processCommandLineOptions(cml_args)
File "C:\CompuCell3D-64bit\player5\Plugins\ViewManagerPlugins\SimpleTabView.py", line 687, in processCommandLineOptions
self.__runSim()
File "C:\CompuCell3D-64bit\player5\Plugins\ViewManagerPlugins\SimpleTabView.py", line 1815, in __runSim
self.prepareSimulation()
File "C:\CompuCell3D-64bit\player5\Plugins\ViewManagerPlugins\SimpleTabView.py", line 1775, in prepareSimulation
File "C:\CompuCell3D-64bit\player5\Plugins\ViewManagerPlugins\SimpleTabView.py", line 1015, in __loadSim
File "C:\CompuCell3D-64bit\player5\Plugins\ViewManagerPlugins\SimpleTabView.py", line 1169, in __loadCC3DFile
psu.replaceValuesInSimulationFiles(_pScanFileName=pScanFilePath, _simulationDir=customOutputPath)
File "C:\CompuCell3D-64bit\pythonSetupScripts\ParameterScanUtils.py", line 757, in replaceValuesInSimulationFiles
self.replaceValuesInXMLFile(_parameterScanDataMap = parameterScanDataMap , _xmlFile=fullFilePath)
File "C:\CompuCell3D-64bit\pythonSetupScripts\ParameterScanUtils.py", line 674, in replaceValuesInXMLFile
elem=self.getXMLElementFromAccessPath(root_element,accessPathList)
File "C:\CompuCell3D-64bit\pythonSetupScripts\ParameterScanUtils.py", line 629, in getXMLElementFromAccessPath
tmpElement=tmpElement.getFirstElement(arg[0],attrDict) if attrDict is not None else tmpElement.getFirstElement(arg[0])
AttributeError: 'NoneType' object has no attribute 'getFirstElement'
CLOSING LOCAL SOCKET
"SIMULATION FINISHED"
​
written 4 months ago by Pauli Tikka
0
5 months ago by
Hi,

I changed the folder of my simulation to compucell...\Book_ChapterDemos etc. , and it I got the scan working! Splendid! I wonder how I can give rights to other folders for cc3d sim runs?

B.r.,
Pauli
me
Europe
0
4 months ago by
Could you post s short version of your simulation where the problem occurs?
0
4 months ago by
Hi,

Here is a short video about the crash (that occurs around 56s in the video) when I start to add the parameter scan to my cc3d model in twedit++5.

So the player goes on, but the twedit++5 crashes after attempting to add the scan.

Best,
Pauli

File attached: adding parameter scan results to crash.mp4 (2.12 MB)

0
4 months ago by

What to do, here is what I also get?:

0
4 months ago by
The path to the .piff file is odd, there is a single slash whereas all the other directory delimiters are back slashes. Check your code for a bad path to the piff file. Also, take a look in the the .cc3d file and see if the piff file is listed there and make sure the path has the correct delimiters. It looks like you are on a Windows system and Windows is "supposed" to be able to handle slashes or backslashes in paths, but that could still be the problem.

If you are using a .piff file you can include it in the .cc3d file by importing into the project in Twedit++. Use "Add resource", tell it the file is a piff, then browse to the file. If the file is already in the Simulation directory Twedit++ will complain that it can't copy the file. Regardless, you just need to make sure there is a copy in the Simulation folder and that that is included in the project's .cc3d file. That way when the various files are all copied for the parameter scan the .piff file goes with them. So, in general, the .piff file should be in the Simulation folder for the CC3D project.
0
4 months ago by
Hi,

I did what you recommended (see peitto.cc3d), and inserted the piff file to .cc3d file separately.
I encountered some problems (see below), but was able to add the parameter scan, and modify it manually line-by-line. So I now have parameter scan, but If I want to add new elements to scan, I need to write them directly to the xml code myself.

Next question would be, how to save the result file in the parameter_scan subfolder (and not a folder, so that the previous results would not wipe the one iteration round older file/s)?

E.g. what to do in steppables.py file to lines like(?):
FileName = "C:/pyintro/positions.csv" # you can add some specific facts to the file if needed
self.File = open(FileName,"w",0) # the 0 is for initial memory 'flush', needed for total print of the file
self.File.write("cell_no,time_mcs,x_position_(px),y_position_(px),z_position_(px)\n")

Best,
Pauli

File attached: peitto.cc3d (407 Bytes)
File attached: errorlog_param_tikka16318.txt (3.22 KB)

1
That is the message the parameter scan process gives when the scan is complete. If you have old folders in the directory structure then when the scan tries to create the folder for a new scan it fails. The scan process can't differentiate between old and unneeded scan folders and new folders created during the current scan process.

You just need to delete all those old numbered folders before restarting a scan.

If you restart a scan you also have to edit the scan xml file and set the pointers back to zero.
For example, from one of my scan files;
<Parameter CurrentIteration="3" Name="pbpk_kGutabs" Type="PYTHON_GLOBAL" ValueType="float">
CurrentIteration needs to be reset back to zero.
written 4 months ago by James Sluka
Hi,
Thanks! I got it now.
In addition, I can save the different iteration files under different names to the same scan folder.
Regards,
Pauli
written 4 months ago by Pauli Tikka
Ah no!! The crashing problem reoccurred, but in a different place and context. I still wanted to scan parameters automatically via scan editor, but the twetedit program crashes immediately when I push ok after inserting the values in the 'scannable parameters' window. What to do, continue with manual approach or rewrite the whole code in other folder etc.?
written 4 months ago by Pauli Tikka
Oo! I think I now got it all finally. I changed the folder, and deleted all extra files from simulation folder (+chekced the .cc3d file again), and now I can do the scans normally with the editor. Thanks!
written 4 months ago by Pauli Tikka
0
9 days ago by
The diffusion constant scan was not working properly, here it how it should be modified, please correct it for the automatic version!
The first scan is ok:

<ParameterScan version="3.7.0">
<OutputDirectory>NewSimulation_ParameterScan</OutputDirectory>
<ParameterList Resource="Simulation/NewSimulation.xml">
<Parameter CurrentIteration="0" Name="GlobalDiffusionConstant" Type="XML_CDATA" ValueType="float">
[['CompuCell3D','Revision','20180621','Version','3.7.8'],['Steppable','Type','DiffusionSolverFE'],['DiffusionField','Name','Wnt9b'],['GlobalDiffusionConstant']]
<Values>0,1,3,4,6</Values>
</Parameter>
<!-- <Parameter CurrentIteration="0" Name="GlobalDiffusionConstant" Type="XML_CDATA" ValueType="float"> -->
<!-- [['CompuCell3D','Revision','20180621','Version','3.7.8'],['Steppable','Type','DiffusionSolverFE'],['DiffusionField','Name','Wnt9b'],['DiffusionData'],['GlobalDiffusionConstant']] --> WRONG! do not know why, but does not work with diffusion data field
<!-- <Values>0.5,1.625,2.75,3.875,5.0</Values> -->
<!-- </Parameter> -->
</ParameterList>
</ParameterScan>
oh no, I checked the param scan xml files, and it had not changed the D values... aaa
written 9 days ago by Pauli Tikka
0
7 days ago by
I reinstalled the newest compucell3d (21618 version), and the problem did not disappear with a test simulation.

Good things:
The cellsorting param demo works (but it does not have D or gamma values),
and also the test simulation, if I modify the param scan specification code excluding diffusion data -field:

<ParameterScan version="3.7.0">
...
<Parameter CurrentIteration="0" Name="GlobalDiffusionConstant" Type="XML_CDATA" ValueType="float">
[['CompuCell3D','Revision','20180621','Version','3.7.8'],['Steppable','Type','DiffusionSolverFE'],['DiffusionField','Name','wnt'], (???)['GlobalDiffusionConstant']]
<Values>...

However, then the (D) values are always the ones at the beginning, e.g. 1,1,...x amount of scans
Have you tested that parameter scan for diffusionsolverFE/DE etc. elements work in the latest cc3d?
You do not necessarily need to drive my simulation, any would do.

Thanks.
0
6 days ago by
I am attaching ParameterScanUtils.py file
File attached: ParameterScanUtils.py (31.01 KB)

that you may drop in place of the existing one. this file should fix the bug that you saw. to make the patch simply put ParameterScanUtils.py in <CC3D_install_dir>/pythonSetupScripts

We will be releasing 3.7.8 very soona dnthis patch will be included. this is a temporary solution to get you going. Please let me know if it works
0
6 days ago by
I tried Maciek's fix.

A PScan of GlobalDiffusionConstant in C:\CompuCell3D-64bit\Demos\SteppableDemos\DiffusionSolverFE\DiffusionSolverFE now works. (It didn't before)

I also tried Pauli's simulation and it also works now. I even scanned two of the diffusion parameters simultaneously.

A minor annoyance. Before doing a pscan you should open CC3D separately from Twedit++ and set the [Tools][Configuration][Project location] and [output] directories correctly for your project. Otherwise CC3D is likely to try to write pscan output to some other directory, which may already have pscan output.