### Example 1 Working Directories Source: https://certara.github.io/pyDarwin/html/Example1.html These are the default working directories for Example 1. Ensure these paths are appropriate for your environment. ```json "working_dir": "u:/pyDarwin/example1/working", "temp_dir": "u:/pyDarwin/example1/rundir", "output_dir": "u:/pyDarwin/example1/output" ``` -------------------------------- ### Run pyDarwin Search in Folder Source: https://certara.github.io/pyDarwin/html/Examples.html Use this command to initiate a pyDarwin search within a specified example folder. Ensure pyDarwin is installed and your virtual environment is active. You may need to configure the path to the NONMEM executable in the options.json file within the example folder. ```bash python -m darwin.run_search_in_folder ./Example1 ``` -------------------------------- ### Example Search Info Output Source: https://certara.github.io/pyDarwin/html/Usage.html This is an example of the output from the `darwin.search_info` command, showing directory changes, options loaded, algorithm, and search space details. ```text [01:11:10] Changing directory to c:\workspace\fruitfly\examples\NONMEM\user\Example2 [01:11:10] Options file found at options.json [01:11:10] Loading system options: c:\workspace\fruitfly\examples\user\options.json [01:11:10] Template file found at template.txt [01:11:10] Tokens file found at tokens.json [01:11:10] Algorithm: GP [01:11:10] Engine: NONMEM [01:11:10] random_seed: 11 [01:11:10] Project dir: c:\workspace\fruitfly\examples\NONMEM\user\Example2 [01:11:10] Data dir: c:\workspace\fruitfly\examples\NONMEM\user\Example2 [01:11:10] Project working dir: C:\Users\jcook\pydarwin\Example2 [01:11:10] Project temp dir: C:\Users\jcook\pydarwin\Example2\temp [01:11:10] Project output dir: C:\Users\jcook\pydarwin\Example2\output [01:11:10] Key models dir: C:\Users\jcook\pydarwin\Example2\key_models [01:11:10] Search space size: 12960 [01:11:10] Estimated number of models to run: 454 ``` -------------------------------- ### pyDarwin Initialization Output for Exhaustive Search Source: https://certara.github.io/pyDarwin/html/Example7.html This is an example of the initialization log output from pyDarwin when starting an exhaustive omega search. It confirms the search parameters, start time, total models to be run, and the location of the NMFE executable and data file. ```log [10:49:51] Including search of band OMEGA, with width up to 1 [10:49:51] Including search for OMEGA submatrices, with size up to 2 [10:49:51] Search start time = Wed Jan 4 10:49:51 2023 [10:49:51] Total of 32 to be run in exhaustive search [10:49:51] NMFE found: c:/nm74g64/util/nmfe74.bat [10:49:51] Not using Post Run R code [10:49:51] Not using Post Run Python code [10:49:51] Checking files in C:\Users\jcraig\pydarwin\Example7\temp\0\01 [10:49:51] Data set # 1 was found: C:\Workspace\Example7/dataExample1.csv ``` -------------------------------- ### Example 4 Working Directories Source: https://certara.github.io/pyDarwin/html/Example4.html Sets the working, temporary, and output directories for PyDarwin's Example 4. Ensure these paths are appropriate for your environment. ```json "working_dir": "u:/pyDarwin/example4/working", "temp_dir": "u:/pyDarwin/example4/rundir", "output_dir": "u:/pyDarwin/example4/output" ``` -------------------------------- ### PyDarwin Example 4 Options Configuration Source: https://certara.github.io/pyDarwin/html/Example4.html The complete options file for PyDarwin's Example 4, configured for the Genetic Algorithm (GA). This includes GA-specific parameters, run settings, and post-processing configurations. ```json { "author": "Certara", "algorithm": "GA", "GA": { "crossover_rate": 0.95, "elitist_num": 4, "mutation_rate": 0.95, "attribute_mutation_probability": 0.1, "mutate": "flipBit", "niche_penalty": 20, "selection": "tournament", "selection_size": 2, "sharing_alpha": 0.1, "crossover_operator": "cxOnePoint" }, "random_seed": 11, "population_size": 80, "num_parallel": 4, "num_generations": 12, "downhill_period": 5, "num_niches": 2, "niche_radius": 2, "local_2_bit_search": true, "final_downhill_search": true, "crash_value": 99999999, "penalty": { "theta": 10, "omega": 10, "sigma": 10, "convergence": 100, "covariance": 100, "correlation": 100, "condition_number": 100, "non_influential_tokens": 0.00001 }, "remove_run_dir": false, "nmfe_path": "c:/nm744/util/nmfe74.bat", "model_run_timeout": 1200, "postprocess": { "use_r": true, "post_run_r_code": "{project_dir}/Cmaxppc.r", "rscript_path": "c:\\Program Files\\R\\R-4.1.3\\bin\\Rscript.exe", "r_timeout": 120, "use_python": false } } ``` -------------------------------- ### pyDarwin Initialization Output Log Source: https://certara.github.io/pyDarwin/html/Example6.html Example initialization log showing directory preparation, file paths, and search algorithm selection. ```log [06:15:40] Options file found at ..\examples\user\Example6\options.json [06:15:40] Preparing project working folder... [06:15:40] Preparing project output folder... [06:15:40] Preparing project temp folder... [06:15:40] Model run priority is below_normal [06:15:40] Using darwin.MemoryModelCache [06:15:40] Project dir: C:\fda\pyDarwin\examples\user\Example6 [06:15:40] Data dir: C:\fda\pyDarwin\examples\user\Example6 [06:15:40] Project working dir: u:/pyDarwin/example6/working [06:15:40] Project temp dir: u:/pyDarwin/example6/rundir [06:15:40] Project output dir: u:/pyDarwin/example6/output [06:15:40] Writing intermediate output to u:/pyDarwin/example6/output\results.csv [06:15:40] Models will be saved in u:/pyDarwin/example6/working\models.json [06:15:40] Template file found at ..\examples\user\Example6\template.txt [06:15:40] Tokens file found at ..\examples\user\Example6\tokens.json [06:15:40] Search start time = Tue Aug 2 06:15:40 2022 [06:15:40] Algorithm is RF ``` -------------------------------- ### NONMEM Omega Search Control Example Source: https://certara.github.io/pyDarwin/html/Usage.html Example demonstrating how to selectively enable or disable Omega band search for different $OMEGA blocks in the template file. ```text $OMEGA ;; search band 0.6 ; ETA(1) K23 0.5 ; ETA(2) K32 $OMEGA 0.4 ; ETA(3) CLEARANCE 0.3 ; ETA(4) VOLUME 0.2 ; ETA(5) KA ``` -------------------------------- ### NONMEM Omega Band Search Template Example Source: https://certara.github.io/pyDarwin/html/Usage.html Example of an $OMEGA record in a NONMEM template file with the '; search band' directive. ```text $OMEGA ; search band 0.1 0.1 0.1 0.1 ``` -------------------------------- ### NMTRAN Template File for Example 1 Source: https://certara.github.io/pyDarwin/html/Example1.html The complete template file for Example 1, used for exhaustive search due to a small search space and fast run time. It includes problem definition, input data, subroutine, parameter definitions, and error models. ```nmtran $PROBLEM 2 compartment fitting $INPUT ID TIME AMT DV WTKG GENDER AGE DROP $DATA {data_dir}/dataExample1.csv IGNORE=@ $SUBROUTINE ADVAN2 $ABBR DERIV2=NO $PK CWTKG = WTKG/70 ;; CENTERED ON ONE CAGE = AGE/40 TVV2=THETA(2){V2~WT[1]} {V2~GENDER[1]} V2=TVV2*EXP(ETA(2)) TVCL= THETA(1) {CL~WT[1]} CL=TVCL*EXP(ETA(1)) K=CL/V2 TVKA=THETA(3) KA=TVKA {KAETA[1]} S2 = V2/1000 {ALAG[1]} $ERROR REP = IREP IPRED =F IOBS = F {RESERR[1]} Y=IOBS $THETA ;; must be one THETA per line. (0.001,100) ; THETA(1) CL UNITS = L/HR (0.001,500) ; THETA(2) V UNITS = L (0.001,2) ; THETA(3) KA UNITS = 1/HR {V2~WT[2]} {V2~GENDER[2]} {CL~WT[2]} {ALAG[2]} $OMEGA ;; must be one ETA/line 0.2 ; ETA(1) CLEARANCE ;; test for comments in blocks 0.2 ; ETA(2) VOLUME ;; optional $OMEGA blocks {KAETA[2]} $SIGMA {RESERR[2]} $EST METHOD=COND INTER MAX = 9999 MSFO=MSF1 $COV UNCOND PRINT=E ``` -------------------------------- ### Example System Options JSON (Linux Variant) Source: https://certara.github.io/pyDarwin/html/Options.html A variant of the system options JSON, demonstrating different paths and values suitable for a Linux environment. ```json { "author": "Certara", "random_seed": 11, "num_parallel": 4, "remove_run_dir": false, "nmfe_path": "C:/nm74g64/util/nmfe74.bat", "postprocess": { "rscript_path": "C:/Program Files/R/R-4.0.2/bin/Rscript.exe" } } ``` -------------------------------- ### Example 1 Tokens File (JSON) Source: https://certara.github.io/pyDarwin/html/Example1.html The JSON tokens file for Example 1, containing key-text pairs for substitution into the template file. It supports nested tokens and requires specific formatting for new lines and comments. ```json { "V2~WT": [ ["", "" ], ["*CWTKG**THETA(V2~WT)", " (-4,0.8,4) ; THETA(V2~WT) POWER volume~WT " ] ], "V2~GENDER": [ ["", "" ], ["*EXP(GENDER*THETA(V2~GENDER))", " (-4,0.1,4) ; THETA(V2~GENDER) exponential volume~GENDER " ] ], "CL~WT": [ ["", "" ], ["*CWTKG**THETA(CL~WT)", " (-4,.7,4) ; THETA(CL~WT) POWER clearance~WT " ] ], "KAETA": [ ["", "" ], ["*EXP(ETA(KAETA)) ", "$OMEGA ;; 2nd??OMEGA block 0.1 ; ETA(KAETA) ETA ON KA" ] ], "ALAG": [ ["", "" ], ["ALAG1 = THETA(ALAG)", " (0, 0.1,3) ; THETA(ALAG) ALAG1 " ] ] , "RESERR": [ ["*EXP(EPS(RESERRA))+EPS(RESERRB)", " 0.3 ; EPS(RESERRA) proportional error 0.3 ; EPS(RESERRB) additive error" ], ["+EPS(RESERRA)", " 3000 ; EPS(RESERRA) additive error" ] ] } ``` -------------------------------- ### Example System Options JSON Source: https://certara.github.io/pyDarwin/html/Options.html This JSON file contains system-wide settings that can override project-specific options. It includes paths, algorithm parameters, and post-processing configurations. ```json { "author": "Mark Sale", "project_name": "Example 11", "algorithm": "GA", "random_seed": 11, "num_parallel": 40, "num_generations": 14, "population_size": 140, "remove_run_dir": true, "nmfe_path": "C:/nm744/util/nmfe74.bat", "postprocess": { "use_r": true, "post_run_r_code": "{project_dir}/Cmaxppc.r", "rscript_path": "C:\\Program Files\\R\\R-4.1.3\\bin\\Rscript.exe" } } ``` -------------------------------- ### Token Definition Example Source: https://certara.github.io/pyDarwin/html/NLME.html An example of how a token, `_COV_Cl`, might be defined in `tokens.json`. It shows an array of options, where each option is an array of strings to be substituted. ```json _COV_Cl": [ [ "" , "" ], [ " * (BW/70)^dBWdCl" , "\n\tfixed(dBWdCl = c(, 0.75, ))" ] ] ``` -------------------------------- ### Install pyDarwin with Trusted Hosts Source: https://certara.github.io/pyDarwin/html/Troubleshooting.html Use this command to install pyDarwin when behind a corporate firewall that may block access to package repositories. It explicitly trusts the necessary hosts. ```bash pip install pyDarwin-Certara --index-url https://certara.jfrog.io/artifactory/api/pypi/certara-pypi-release-public/simple --extra-index-url https://pypi.python.org/simple/ --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --trusted-host=certara.jfrog.io --trusted-host=jfrog-prod-use1-shared-virginia-main.s3.amazonaws.com ``` -------------------------------- ### pyDarwin Initialization Output Source: https://certara.github.io/pyDarwin/html/Example4.html This log shows the successful initialization of a pyDarwin search project. It details the paths to configuration files, project directories, and the start time of the search. ```log [05:46:53] Options file found at ..\examples\user\Example4\options.json [05:46:53] Preparing project working folder... [05:46:53] Preparing project output folder... [05:46:53] Preparing project temp folder... [05:47:21] Model run priority is below_normal [05:47:21] Using darwin.MemoryModelCache [05:47:21] Project dir: c:\fda\pyDarwin\examples\user\Example4 [05:47:21] Data dir: c:\fda\pyDarwin\examples\user\Example4 [05:47:21] Project working dir: u:/pyDarwin/example4/working [05:47:21] Project temp dir: u:/pyDarwin/example4/rundir [05:47:21] Project output dir: u:/pyDarwin/example4/output [05:47:21] Writing intermediate output to u:/pyDarwin/example4/output\results.csv [05:47:21] Models will be saved in u:/pyDarwin/example4/working\models.json [05:47:21] Template file found at ..\examples\user\Example4\template.txt [05:47:21] Tokens file found at ..\examples\user\Example4\tokens.json [05:47:21] Search start time = Mon Aug 1 05:47:21 2022 [05:47:21] -- Starting Generation 0 -- [05:47:21] NMFE found: c:/nm744/util/nmfe74.bat [05:47:21] RScript found at c:\Program Files\R\R-4.1.3\bin\Rscript.exe [05:47:21] Post Run R code found at c:\fda\pyDarwin\examples\user\Example4\Cmaxppc.r [05:47:21] Not using Post Run Python code [05:47:21] Checking files in u:\pyDarwin\example4\rundir\00\01 [05:47:21] Data set # 1 was found: c:\fda\pyDarwin\examples\user\Example4/dataWithPeriod.csv [05:47:21] Data set # 2 was found: c:\fda\pyDarwin\examples\user\Example4/dataWithPeriod.csv ``` -------------------------------- ### Example Template File Structure Source: https://certara.github.io/pyDarwin/html/Usage.html Illustrates a basic template file structure for NONMEM, including sections like $SUBS, $PK, and $THETA, with placeholders for token keys. ```plaintext $SUBS {ADVAN[1]} . . $PK . . . {ADVAN[2]} . . . $THETA (0,1) ; Volume - fixed THETA - always appears (0,1) ; Clearance - fixed THETA - always appears {ADVAN[3]} ``` -------------------------------- ### Conceptual Column Mappings Example Source: https://certara.github.io/pyDarwin/html/NLME.html An example demonstrating various data mapping statements for a PK/PD model with multiple doses and BQL handling. This illustrates how to map ID, time, dose, observations, covariates, censoring, and conditional doses. ```plaintext id(ID) time(TIME) amt(AMT) addl(ADDL) // Additional doses ii(II) // Interdose interval mvd(MDV) evid(EVID) obs(CObs <- DV) // PK observations obs(EObs <- DV) // PD observations covr(Weight <- WEIGHT) covr(Sex <- SEX("Male" = 0, "Female" = 1)) censor(CObsBQL) // BQL flag for PK observations loq(LOQ) dose(AaDose <- AMT, cmt = 1) // Map AMT to AaDose when CMT=1 (bolus) dose(AaInfDose <- AMT, cmt = 1) // Map AMT to AaInfDose when CMT=1 (infusion) rate(AaInfRate <- RATE) // Infusion rate dvid(TYPE) // DVID for distinguishing PK/PD observations ``` -------------------------------- ### Complete Metamodel Example for Warfarin PK Source: https://certara.github.io/pyDarwin/html/NLME.html This is a full .mmdl file example for a one-compartment IV infusion model of Warfarin. It includes data mapping, model definition, estimation, and simulation arguments. ```metamodel ##Description: 1-Cpt PK model with IV infusion for Warfarin ##Author: A. User ##Based on: Base_1Cpt.mmdl ##DATA ./warfarin_data.csv ##MAP id = Subject, time = Time, A1_Duration = DUR, A1 = Dose ##MODEL test() { # 1-compartment model, clearance parameterization cfMicro(A1, Cl / V) C = A1 / V # Define dosepoint to receive infusions dosepoint(A1, idosevar = A1Dose) # Proportional residual error model error(CEps = 0.1) observe(CObs = C * (1 + CEps)) # Structural parameters with random effects stparm(Cl = tvCl * exp(nCl)) stparm(V = tvV * exp(nV)) fixef(tvCl = c(, 0.1, )) fixef(tvV = c(, 8, )) ranef(diag(nCl, nV) = c(0.09, 0.09)) } ##ESTARGS method = FOCE-ELS numIterations = 1000 stdErr = "Sandwich" ##SIMARGS numReplicates = 500 seed = 42 ##TABLES # Estimation table with residuals table(file="residuals_output.csv", obs(CObs), specvar(IRES, IWRES)) # Simulation table matching original data structure simtbl(file="simulation_output.csv", C, CObs, mode = keep) ``` -------------------------------- ### Hard-coded Data Path Example Source: https://certara.github.io/pyDarwin/html/NLME.html Illustrates a less portable way to specify a data file path directly within the metamodel template. ```text ##DATA C:/Users/Me/MyProject/data/warfarin_data.csv ``` -------------------------------- ### Get Search Information Source: https://certara.github.io/pyDarwin/html/Usage.html Run this command to load the search folder and display a summary of the search configuration and status. This is useful for debugging and understanding search parameters. ```bash python -m darwin.search_info ``` -------------------------------- ### tokens.json Structure Example Source: https://certara.github.io/pyDarwin/html/NLME.html Defines the structure of a tokens.json file, mapping token names to arrays of options, where each option is an array of strings. ```json { "TOKEN_NAME_1": [ [ "text for option 1, index 1" , "text for option 1, index 2" ], [ "text for option 2, index 1" , "text for option 2, index 2" ] ], "TOKEN_NAME_2": [ [ "text for option 1, index 1" ], [ "text for option 2, index 1" ] ] } ``` -------------------------------- ### Post Run R Code Example for FCON Overwriting Source: https://certara.github.io/pyDarwin/html/Troubleshooting.html When using post-run R code with pyDarwin, create a new directory and set it as the working directory to prevent the FCON file from being overwritten by subsequent runs. This example demonstrates creating a directory, changing into it, writing a control file, running NONMEM, and returning to the parent directory. ```r dir.create("simFolder") setwd("simFolder") writelines("myNewControl.mod", mymyNewControl) shell("nmfe75 myNewControl.mod myNewControl.lst") setwd(".." ) ``` -------------------------------- ### Product * exp(eta) stparm Example Source: https://certara.github.io/pyDarwin/html/NLME.html Use this style for positive-only parameters like V, Cl, Ka. It incorporates allometric scaling and categorical covariate effects. ```PML stparm(V = tvV * (Weight / 70)^dVdWt * exp(nV)) # Allometric scaling stparm(Cl = tvCl * exp(dCldSex * (Sex == 1)) * exp(nCl)) # Sex effect ``` -------------------------------- ### THETA Parameter Initial Estimate Example Source: https://certara.github.io/pyDarwin/html/Example2.html Demonstrates the format for specifying initial estimates for THETA parameters, including their bounds and descriptions. This format is used for all initial estimate token text. ```plaintext (-4,.7,4) ; THETA(CL~WT) POWER clearance~WT ``` -------------------------------- ### Initialize Compartments with Sequence Source: https://certara.github.io/pyDarwin/html/NLME.html Use a sequence block to initialize compartment values at the start of a simulation (time 0). ```pml sequence { A1 = 100 // Initialize A1 to 100 at time 0 A2 = 0 // Initialize A2 to 0 at time 0 } ``` -------------------------------- ### PML Sequence Block Example Source: https://certara.github.io/pyDarwin/html/NLME.html Illustrates the use of a 'sequence' block in PML to define ordered statements, including initialization, waiting, and updating a variable. ```plaintext sequence { A = 10 // Initialize compartment A sleep(5) // Wait for 5 time units A = A + 5 // Add to compartment A } ``` -------------------------------- ### PML Mathematical Functions Example Source: https://certara.github.io/pyDarwin/html/NLME.html Demonstrates the usage of various built-in mathematical functions like exp, log, and division for calculating pharmacokinetic parameters such as half-life. ```PML stparm( Cl = tvCl * exp(nCl), V = tvV * exp(nV), Ka = tvKa, F = ilogit(tvF) // Example of using ilogit ) C = A / V Rate = Cl * C Halflife = log(2) / (Cl / V) // Calculate half-life using log and division ``` -------------------------------- ### PML Comment Styles Example Source: https://certara.github.io/pyDarwin/html/NLME.html Demonstrates the use of R-style, C-style, and C++-style comments within a PML model structure, alongside valid statements. ```plaintext test() { # This is an R-style comment /* This is a multi-line C-style comment */ deriv(A = -k * A) // C++-style comment fixef(k = c(,3,)) x = 5 //valid statement y = 1 #valid statement } ``` -------------------------------- ### Example Tokens File Structure Source: https://certara.github.io/pyDarwin/html/Example2.html This JSON structure represents a tokens file used for defining model parameters and their initial estimates. It includes various sections for different token types. ```json { "ADVAN": [ ["ADVAN2 ;; advan2", ";; PK 1 compartment ", ";; THETA 1 compartment" ], ["ADVAN4 ;; advan4", " K23=THETA(ADVANA){K23~WT[1]}\n K32=THETA(ADVANB){K23~WT[1]}", " (0.001,0.02) ;; THETA(ADVANA) K23 \n (0.001,0.3) ;; THETA(ADVANB) K32 \n{K23~WT[2]} ;; init for K23~WT " ], ["ADVAN12 ;; advan12", " K23=THETA(ADVANA){K23~WT[1]}\n K32=THETA(ADVANB){K23~WT[1]}\n K24=THETA(ADVANC)\n K42=THETA(ADVAND)", " (0.001,0.1) ;; THETA(ADVANA) k23 \n (0.001,0.1) ;;THETA(ADVANB) k32 \n (0.001,0.1) ;; THETA(ADVANC) k24 \n (0.001,0.1) ;; THETA(ADVAND)k42 \n {K23~WT[2]} ;; init for K23~WT" ] ], "K23~WT": [ ["", "" ], ["*CWTKGONE**THETA(K23~WT)", " (0,0.1) ; THETA(K23~WT) K23~WT" ] ], "KAETA": [ ["", "" ], ["*EXP(ETA(KAETA)) ", "$OMEGA ;; 2nd??OMEGA block \n 0.1 ; ETA(KAETA) ETA ON KA" ] ], "V2~WT": [ ["", "" ], ["*CWTKGONE**THETA(V2~WT)", " (-4,0.8,4) ; THETA(V2~WT) POWER volume ~WT " ], ["*EXP(CWTKGZERO*THETA(V2~WT))", " (-1,0.01,2) ; THETA(V2~WT) EXPONENTIAL volume ~WT " ] ], "V2~GENDER": [ ["", "" ], ["*CWTKGONE**THETA(V2~GENDER)", " (-4,0.1,4) ; THETA(V2~GENDER) POWER volume ~SEX " ] ], "CL~WT": [ ["", "" ], ["*CWTKGONE**THETA(CL~WT)", " (-4,.7,4) ; THETA(CL~WT) POWER clearance~WT " ], ["*EXP(CWTKGZERO*THETA(CL~WT))", " (-1,0.01,4) ; THETA(CL~WT) EXPONENTIAL clearance~WT " ] ], "CL~AGE": [ ["", "" ], ["*CAGE**THETA(CL~AGE)", " (-4,-0.2,4) ; THETA(CL~AGE) POWER clearance~AGE " ] ], "ETAD1LAG": [ ["", "", "" ], ["*EXP(ETA(ETALAG))", "", "$OMEGA ;; 3rd OMEGA block \n 0.1 ;; ETA(ETALAG) ETA ON ALAG1" ], ["", "*EXP(ETA(ETALAG1))", "$OMEGA ;; 3rd??OMEGA block \n 0.1 ;; ETA(ETALAG1) ETA ON D1" ], ["*EXP(ETA(ETALAG1))", "*EXP(ETA(ETALAG2))", "$OMEGA ;; diagonal OMEGA \n 0.1 ;; ETA(ETALAG1) ETA ON ALAG1\n 0.1 ;; ETA(ETALAG2) ETA ON D1" ], ["*EXP(ETA(ETALAG1))", "*EXP(ETA(ETALAG2))", "$OMEGA BLOCK(2) ;; block OMEGA block \n 0.1 ;; ETA(ETALAG1) ETA ON ALAG1\n 0.01 0.1 ;; ETA(ETALAG2) ETA ON D1" ] ], "D1LAG": [ ["DROP", " ALAG1=THETA(ALAG){ETAD1LAG[1]}\n;; No D1", " (0.001,0.3) ; ALAG1 THETA(ALAG) ", "{ETAD1LAG[3]}" ], ["RATE", " D1=THETA(D1) {ETAD1LAG[1]} ; infusion only", " (0.01,0.2) ;; D1 THETA ", "{ETAD1LAG[3]} ;; D1 ETA only" ], ["RATE", " ALAG1=THETA(ALAG){ETAD1LAG[1]}\n D1=THETA(D1){ETAD1LAG[2]}", " (0.001,0.1,1) ;; D1 THETA Init\n (0.001,0.1,1) ;; ALAG THETA Init", "{ETAD1LAG[3]} ;; ETA on D1 and lag, block" ] ], "RESERR": [ ["*EXP(EPS(RESERRA))+EPS(RESERRB)", " 0.3 ; EPS(RESERRA) proportional error\n 0.3 ; EPS(RESERRB) additive error" ], ["+EPS(RESERRA)", " 3000 ; EPS(RESERRA) additive error" ] ] } ``` -------------------------------- ### Example Search Output Source: https://certara.github.io/pyDarwin/html/Example4.html This output represents the final results of a search process, indicating completion, file locations, and performance metrics. It is generated after the search algorithm has finished its execution. ```text [23:04:28] Done with final downhill step. best fitness = 8504.69692879228 [23:04:28] Final output from best model is in u:/pyDarwin/example4/output\FinalResultFile.lst [23:04:28] Number of unique models to best model = 897 [23:04:28] Time to best model = 474.6 minutes [23:04:28] Best overall fitness = 8504.696929, iteration 05S071, model 90 [23:04:28] Elapsed time = 1015.4 minutes ``` -------------------------------- ### Complete Options JSON Example Source: https://certara.github.io/pyDarwin/html/Options.html This JSON file demonstrates all possible configuration options, including settings for GA, MOGA, PSO algorithms, search parameters, run settings, penalty configurations, post-processing options, and directory paths. Some settings are environment-specific. ```json { "author": "Charles Robert Darwin", "project_name": "Delicious armadillos", "algorithm": "GA", "GA": { "elitist_num": 2, "crossover_rate": 0.95, "mutation_rate": 0.95, "sharing_alpha": 0.1, "selection": "tournament", "selection_size": 2, "crossover_operator": "cxOnePoint", "mutate": "flipBit", "attribute_mutation_probability": 0.1, "niche_penalty": 20 }, "MOGA": { "objectives": 3, "names": ["objective 1", "objective 2", "objective 3"], "constraints": 0, "partitions": 6, "crossover": "single", "crossover_rate": 0.95, "mutation_rate": 0.95, "attribute_mutation_probability": 0.1 }, "PSO": { "inertia": 0.4, "cognitive": 0.5, "social": 0.5, "neighbor_num": 20, "p_norm": 2, "break_on_no_change": 5 }, "search_omega_blocks": false, "search_omega_bands": false, "max_omega_band_width": 0, "search_omega_sub_matrix": false, "max_omega_sub_matrix": 4, "individual_omega_search": true, "max_omega_search_len": 8, "random_seed": 11, "num_parallel": 4, "num_generations": 6, "population_size": 4, "num_opt_chains": 4, "exhaustive_batch_size": 100, "crash_value": 99999999, "penalty": { "theta": 10, "omega": 10, "sigma": 10, "convergence": 100, "covariance": 100, "correlation": 100, "condition_number": 100, "non_influential_tokens": 0.00001 }, "effect_limit": 6, "downhill_period": 2, "num_niches": 2, "niche_radius": 2, "local_2_bit_search": true, "final_downhill_search": true, "local_grid_search": true, "max_local_grid_search_bits": 3, "nmfe_path": "/opt/nm751/util/nmfe75", "model_run_timeout": 1200, "model_run_priority_class": "below_normal", "postprocess": { "use_r": true, "post_run_r_code": "{project_dir}/simplefunc.r", "r_timeout": 30, "use_python": true, "post_run_python_code": "{project_dir}/../simplefunc_common.py" }, "use_saved_models": false, "saved_models_file": "{working_dir}/models0.json", "saved_models_readonly": false, "keep_key_models": false, "keep_best_models": true, "rerun_key_models": false, "rerun_front_models": false, "remove_run_dir": false, "remove_temp_dir": true, "keep_files": ["dmp.txt", "posthoc.csv"], "keep_extensions": ["shk", "coi", "cor", "cov"], "use_system_options": true, "model_cache": "darwin.MemoryModelCache", "model_run_man": "darwin.GridRunManager", "grid_adapter": "darwin.GenericGridAdapter", "engine_adapter": "nonmem", "skip_running": false, "rscript_path": "C:/Program Files/R/R-4.3.1/bin/Rscript.exe", "nlme_dir": "C:/Program Files/Certara/NLME_Engine", "gcc_dir": "C:/Program Files/Certara/mingw64", "working_dir": "~/darwin/Ex1", "data_dir": "{project_dir}/data", "output_dir": "{project_dir}/output", "temp_dir": "{working_dir}/temp", "key_models_dir": "{working_dir}/key_models", "non_dominated_models_dir": "{working_dir}/non_dominated_models", "generic_grid_adapter": { "python_path": "~/darwin/venv/bin/python", "submit_search_command": "qsub -b y -cwd -o {project_dir}/out.txt -e {project_dir}/err.txt -N '{project_name}'", "submit_command": "qsub -b y -o {results_dir}/{run_name}.out -e {results_dir}/{run_name}.err -N {job_name}", "submit_job_id_re": "Your job (\\w+) \(\".+?\"\) has been submitted", "poll_command": "qstat -s z", "poll_job_id_re": "^\\s+(\\w+)", "poll_interval": 5, "delete_command": "qdel {project_stem}-*" } } ``` -------------------------------- ### NLME Omega Block Search Example: Template Source: https://certara.github.io/pyDarwin/html/Usage.html Example of a 'ranef' statement in an NLME template file. ```text ranef(diag(nV, nCl) = c(1, 1)) ``` -------------------------------- ### NONMEM Omega Band Search: Width 0 Example Source: https://certara.github.io/pyDarwin/html/Usage.html Example of a generated $OMEGA BLOCK matrix with width 0. ```text $OMEGA BLOCK(4) 0.1 0 0 0.1 0 0 0.1 0 0 0 0.1 ``` -------------------------------- ### PyDarwin Initialization Output Log Source: https://certara.github.io/pyDarwin/html/Example3.html This log shows the initialization process for PyDarwin's exhaustive search, including file paths, directory preparations, and the discovery of the NONMEM executable. It confirms the setup and readiness for the search. ```log [12:30:54] Options file found at ..\examples\user\Example3\options.json [12:30:54] Preparing project working folder... [12:30:54] Preparing project output folder... [12:30:54] Preparing project temp folder... [12:30:54] Model run priority is below_normal [12:30:54] Using darwin.MemoryModelCache [12:30:54] Project dir: c:\fda\pyDarwin\examples\user\Example3 [12:30:54] Data dir: c:\fda\pyDarwin\examples\user\Example3 [12:30:54] Project working dir: u:/pyDarwin/example3/working [12:30:54] Project temp dir: u:/pyDarwin/example3/rundir [12:30:54] Project output dir: u:/pyDarwin/example3/output [12:30:54] Writing intermediate output to u:/pyDarwin/example3/output\results.csv [12:30:54] Models will be saved in u:/pyDarwin/example3/working\models.json [12:30:54] Template file found at ..\examples\user\Example3\template.txt [12:30:54] Tokens file found at ..\examples\user\Example3\tokens.json [12:30:54] Search start time = Sun Jul 31 12:30:54 2022 [12:30:54] Total of 324 to be run in exhaustive search [12:30:54] NMFE found: c:/nm744/util/nmfe74.bat [12:30:54] Not using Post Run R code [12:30:54] Not using Post Run Python code [12:30:54] Checking files in u:\pyDarwin\example3\rundir\0\001 [12:30:54] Data set # 1 was found: c:\fda\pyDarwin\examples\user\Example3/OralBolus_PlasmaUrine_ResetCpt2.csv ``` -------------------------------- ### NONMEM Omega Band Search: Width 3 Example Source: https://certara.github.io/pyDarwin/html/Usage.html Example of a generated $OMEGA BLOCK matrix with width 3, using 'p' for off-diagonal elements. ```text $OMEGA BLOCK(4) 0.1 p 0.1 p p 0.1 p p p 0.1 ``` -------------------------------- ### NONMEM Omega Band Search: Width 2 Example Source: https://certara.github.io/pyDarwin/html/Usage.html Example of a generated $OMEGA BLOCK matrix with width 2, using 'p' for off-diagonal elements. ```text $OMEGA BLOCK(4) 0.1 p 0.1 p p 0.1 0 p p 0.1 ``` -------------------------------- ### NONMEM Omega Band Search: Width 1 Example Source: https://certara.github.io/pyDarwin/html/Usage.html Example of a generated $OMEGA BLOCK matrix with width 1, using 'p' for off-diagonal elements. ```text $OMEGA BLOCK(4) 0.1 p 0.1 0 p 0.1 0 0 p 0.1 ``` -------------------------------- ### Token Set Substitution Example Source: https://certara.github.io/pyDarwin/html/Glossary.html Shows the substitution of token key-text pairs into a template, demonstrating how {ALAG[1]} becomes 'ALAG1=THETA(ALAG)' and {ALAG[2]} becomes '(0,1) ;; initial estimate for ALAG1'. ```text ALAG[1] -> "ALAG1=THETA(ALAG)" ALAG[2] -> "(0,1) ;; initial estimate for ALAG1" ``` -------------------------------- ### pyDarwin Initialization Output Source: https://certara.github.io/pyDarwin/html/Example1.html This output shows the initialization process of a pyDarwin model run. It details the location of configuration files, project directories, and the start of the search process. Pay attention to the project and data directories for input files and the working/temp/output directories for generated files. ```text [10:50:33] Options file found at ..\examples\user\Example1\options.json [10:50:33] Preparing project working folder... [10:50:33] Preparing project output folder... [10:50:33] Preparing project temp folder... [10:50:41] Model run priority is below_normal [10:50:41] Using darwin.MemoryModelCache [10:50:41] Project dir: c:\FDA\pyDarwin\examples\user\Example1 [10:50:41] Data dir: c:\FDA\pyDarwin\examples\user\Example1 [10:50:41] Project working dir: u:/pyDarwin/example1/working [10:50:41] Project temp dir: u:/pyDarwin/example1/rundir [10:50:41] Project output dir: u:/pyDarwin/example1/output [10:50:41] Writing intermediate output to u:/pyDarwin/example1/output\results.csv [10:50:41] Models will be saved in u:/pyDarwin/example1/working\models.json [10:50:41] Template file found at ..\examples\user\Example1\template.txt [10:50:41] Tokens file found at ..\examples\user\Example1\tokens.json [10:50:41] Search start time = Sun Jul 31 10:50:41 2022 [10:50:41] Total of 64 to be run in exhaustive search [10:50:41] NMFE found: c:/nm744/util/nmfe74.bat [10:50:42] Not using Post Run R code [10:50:42] Not using Post Run Python code [10:50:42] Checking files in u:\pyDarwin\example1\rundir\0\01 [10:50:42] Data set # 1 was found: c:\FDA\pyDarwin\examples\user\Example1/dataExample1.csv ``` -------------------------------- ### Transformed ETA Naming Example Source: https://certara.github.io/pyDarwin/html/Usage.html Demonstrates how pyDarwin transforms named ETAs to numerical indices based on their definition order and comments. This example shows the resulting transformed equation. ```plaintext D = ETA(1)*ETA(3)*ETA(2)*ETA(4) $OMEGA 0.1 ; ETA(1) 0.1 ; A 0.1 ; ETA ON C 0.1 ; ETA(4) D2 or ETA ON D2 ```