interface .in file with python optimisation results

57 views
Skip to first unread message

Rakeeb Jaufer

unread,
Sep 25, 2019, 10:13:39 AM9/25/19
to gprMax-users
Hi all 

I would like to interface the GPRMax with another python codes which reads the simulation results [output file] and  perform some estimation to invert dielectric parameters.  

After each estimation, i want to update and iterate the dielectric parameter values in the GPRMax input file automatically until i obtain the global minima  in my optimisation algorithm.  

I m wondering how  could i modify the .in script automatically in the loop for this purpose. 
please can some one give me an idea, if you have done the same before. 

Best regards
Rakeeb 

#gprmax

Craig Warren

unread,
Oct 3, 2019, 6:09:04 AM10/3/19
to gprMax-users
Dear Rakeeb,

gprMax can be called in a loop within a Python script. All the tools are part of the package, you just have to look at the code. You could write a script that generates input files (or even streamed file object if you don't want to write a new input file every time), calls gprMax, then processes the output files. Obviously you will need some knowledge of Python to do this. For example, gprMax can be called in a Python script using:

from gprMax.gprMax import api as gprMax
from tools.outputfiles_merge import get_output_data

# for some loop
# Create/update input file (or file object) with dielectric parameters
# Run gprMax
gprMax
(filename, n=traces)
# Read output file and use in whatever way to calculate updated dielectric parameters

Kind regards,

Craig
Reply all
Reply to author
Forward
0 new messages