• Language: en

Creating Example Scripts

PoPy contains built in example scripts that can be generated on the command line. The general method is:-

popy create [script_type] [script_name]

These built in scripts are designed to get you started with using a particular type of script file. Once generated you can edit the default text for your own PK/PD modelling requirements.

See popy create documentation, or the Creating an example Fit Script and Creating an example Tut Script examples below.

Creating an example Fit Script

First, Open a PoPy Command Prompt. Then do:-

popy create fit my_fit_script.pyml

where

You can generate a more verbose example script with comments using:-

popy create -acsl fit my_fit_script.pyml

See popy create for the meaning of the ‘-acsl’ command line switch options. Or type ‘popy_create -h’.

You will notice that popy create also creates a file called my_fit_script.pyml.create.main.log. This is a record of the messages output by the popy create tool. In this case the log file is very short. These log files, created by all of the Command Line Tools, act as part of the audit trail for your experiments.

You can try running the fit_script:-

popy run my_fit_script.pyml

However, you will likely see a message, similar to the following:-

CAST_ERROR= ERROR in value_record: ROOT->FILE_PATHS->input_data_file
ERROR when casting input file element
input file path = C:\Users\david\my_popy_egs\examples\fit_example4\input.csv
NOT present on file system.

Essentially this is telling you that this entry in ‘builtin_fit_example.pyml’:-

FILE_PATHS: {input_data_file: input.csv}

Is causing a problem because ‘input.csv’ does not exist. The popy_create tool outputs a script file only, so the ‘input.csv’ entry is just a place holder. You need to set the ‘input_data_file’ field to point at an existing data file to run the Fit Script.

Note one way of creating a data file is to create and then run a Gen Script or Tut Script, as described below.

The ‘my_fit_script.pyml’ is just meant to provide an easy template for you to use for your own analyses. The ‘tut_script’ example below is more complete, as a Tut Script works with just a single .pyml file.

Creating an example Tut Script

As always the first step is to Open a PoPy Command Prompt. Then do:-

popy create tut my_tut_script.pyml

You can generate a more verbose example script with comments using:-

popy create -acsl tut my_tut_script.pyml

See popy create for the command line switch options. Or type ‘popy_create -h’.

You can use this mechanism to create an example file for any of the Script File Formats in PoPy, which you can then open and modify using your chosen text editor.

When you have a run-able Tut Script, run it via:-

popy run my_tut_script.pyml

You can use this mechanism to create an example file for any of the Script File Formats in PoPy.

Back to Top