User Tools

Site Tools


02_new_tutorials:parameterfile

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
02_new_tutorials:parameterfile [2025/10/14 13:00] gaetan02_new_tutorials:parameterfile [2025/11/16 10:32] (current) gaetan
Line 82: Line 82:
    [RU(-30) RH(90) pBud(b[radius]).($[age]=b[age], grow())];    [RU(-30) RH(90) pBud(b[radius]).($[age]=b[age], grow())];
 ] ]
 +
 +boolean tooOld(BaseBud n){
 + return n[age]>ageLimit ;
 +}
 </code> </code>
  
Line 134: Line 138:
 </code> </code>
  
 +===== Save parameters in file =====
 +
 +Let's save the current set of parameter values in a file. In the parameter manager editor click on "save parameters". It will automatically create a parameter file and store the parameter in.
  
  
Line 139: Line 146:
  
 Now we can also set up the project to be run-able in headless and modify parameters from outside of GroIMP, with either:  Now we can also set up the project to be run-able in headless and modify parameters from outside of GroIMP, with either: 
-  * Command lines args +  * Command lines args: to give parameter value, or a parameter file to use 
-  * Modify the parameter file+  * Modify the parameter file in the project 
 + 
 +Add the following to setup the headless to run the ''complete'' method from above and to load the parameter's value from the file: 
 + 
 +<code java> 
 +protected void startup() 
 +
 + super.startup(); 
 + if (de.grogra.pf.boot.Main.getProperty("headless") != null) 
 +
 + runLater(null); 
 +
 +
 +  
 +  
 +protected void run(Object info) 
 +
 + loadPMs(); 
 + complete(); 
 + System.exit(0); 
 +
 +</code> 
 + 
 +Now run the project in headless with:  
 +<code> 
 +java -jar core.jar --headless Model.gsz 
 +</code> 
 + 
 +This will print in the terminal the output value of ''compute_vol''. E.g. ''Total volume of buds: 2.78392774842903 
 +'' 
 + 
 +==== Command line arg ==== 
 + 
 +Let's change some parameter value for the run: 
 +<code> 
 +java -jar core.jar -PModel.ageLimit=15 -PModel.aging=1  -PModel.initialLength=1 -PModel.budType=1 --headless Model.gsz 
 +</code> 
 + 
 +This should display in the terminal: ''Total volume of buds: 0.07469535004252173''
 + 
 +==== Change the parameter file ==== 
 + 
 +It is also possible to simply change the content of the parameter file by simply opening the file and changing its content. 
 +The file is called ''parameter_files/default-parameter-manager.parameters''. By setting its content to: 
 + 
 +<code> 
 +Model.budType=0 
 +Model.ageLimit=7 
 +Model.initialLength=0.5 
 +Model.aging=0 
 +</code> 
 + 
 +And running in headless again: ''java -jar core.jar --headless Model.gsz''  
 + 
 +I get the value: ''Total volume of buds: 2.592734549068271'' 
 + 
 + 
 +====== QSM Project ====== 
 + 
 +Now let's see how these parameters can be fit into a bigger project, the [[:todo|QSM project example]] 
02_new_tutorials/parameterfile.1760439616.txt.gz · Last modified: 2025/10/14 13:00 by gaetan