Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
model_tips [2026/07/06 19:05] hermann |
model_tips [2026/07/26 14:18] (current) hermann |
||
|---|---|---|---|
| Line 5: | Line 5: | ||
| ===== File Paths ===== | ===== File Paths ===== | ||
| - | The Dinamica EGO interface shows absolute filepaths for easier reading, but they are relative indeed. So, to easily change the location of a model, keep the same path between the script file ([[EGO Script|ego]] or [[XML Script|xml]]) and your data directory. This will work as expected. | + | The Dinamica EGO interface shows absolute filepaths for easier reading, but they are relative indeed. So, to easily change the location of a model, keep the same path between the script file ([[ego_script|ego]] or [[xml_script|xml]]) and your data directory. This will work as expected. |
| ===== Workdir ===== | ===== Workdir ===== | ||
| Line 33: | Line 33: | ||
| * No member of the loop is expected as an output port of a submodel. | * No member of the loop is expected as an output port of a submodel. | ||
| - | Sometimes, however, it is convenient to force a loop that //could// run its steps simultaneously to run them sequentially instead. A simple way to do this is to place a ''MuxValue 0 0'' functor inside the loop. | + | Sometimes, however, it is convenient to force a loop that //could// run its steps simultaneously to run them sequentially instead. A simple way to do this is to place a ''MuxValue 0 0'' functor inside the loop. See [[basic_data_flow|Basic Data Flow]] for why these conditions hold — a loop's iterations are only independent, and therefore only parallelizable, when nothing connects one to the next. |
| ===== Create String ===== | ===== Create String ===== | ||
| Line 46: | Line 46: | ||
| ===== Calculate Python Expression ===== | ===== Calculate Python Expression ===== | ||
| - | Packages can be installed from **Calculate Python Expression** in two ways: | + | Packages can be installed either by calling ''dinamica.package(...)'' from within the expression (runs during execution, so it can be called conditionally) or by listing them on the //packages// input port (installed before the script runs). See [[calculate_python_expression#utilities|Calculate Python Expression — Utilities]] for the full ''dinamica.package()'' syntax and examples. |
| - | + | ||
| - | * Option (a): Using the ''dinamica.package("package name")'' function (one function call per package). | + | |
| - | * Option (b): Passing the list of packages to the **"packages"** port (one package name per line). | + | |
| - | + | ||
| - | The difference between these two options is timing: | + | |
| - | + | ||
| - | * Option (a) runs **during** the execution of the Python script, so it can be called conditionally. | + | |
| - | * Option (b) always runs **before** the script is executed. | + | |
| - | + | ||
| - | Because option (a) runs together with the script, it may fail if a package is already loaded but in a version incompatible with the package about to be installed. | + | |
| - | + | ||
| - | Option (a), ''dinamica.package("package")'', also acts as an ''import'' clause: when the package name is the same as the name of the module to be loaded via ''import'', the package is installed and the module of the same name is loaded. If the package name and its internal module name differ, you can use the syntax ''dinamica.package("module name", "package name")'', for example ''dinamica.package("samgeo", "segment-geospatial")''. | + | |
| - | + | ||
| - | In addition, both forms allow installation parameters to be passed to the packages: | + | |
| - | + | ||
| - | * Option (a): ''dinamica.package("torchvision", "torchvision==0.19.1 --index-url https://download.pytorch.org/whl/cu121")'' | + | |
| - | * Option (b): pass the string ''torchvision==0.19.1 --index-url https://download.pytorch.org/whl/cu121'' to the **"packages"** port. | + | |
| - | + | ||
| - | These parameters are those accepted by Python's ''pip''. | + | |
| ===== Calculate R Expression ===== | ===== Calculate R Expression ===== | ||
| - | Packages can be installed from **Calculate R Expression** using the ''dinamicaPackage("package name")'' function (one function call per package). ''dinamicaPackage("package")'' also acts as an ''import'' clause: when the package name is the same as the name of the module to be loaded via ''import'', the package is installed and the module of the same name is loaded. | + | Packages can be installed from **Calculate R Expression** using the ''dinamicaPackage("package name")'' function (one function call per package). ''dinamicaPackage("package")'' also acts as an ''import'' clause: when the package name is the same as the name of the module to be loaded via ''import'', the package is installed and the module of the same name is loaded. See [[calculate_r_expression#installing_packages|Calculate R Expression — Installing Packages]] for more detail. |
| ===== Wizards ===== | ===== Wizards ===== | ||
| Line 79: | Line 60: | ||
| * Avoid the definition of maps using [[cell type type|cell type]] "1 Bit Integer". This cell type saves memory, but it also has a huge negative impact in performance. | * Avoid the definition of maps using [[cell type type|cell type]] "1 Bit Integer". This cell type saves memory, but it also has a huge negative impact in performance. | ||
| * Keep updated the Dinamica EGO installed in your system. | * Keep updated the Dinamica EGO installed in your system. | ||
| + | |||