你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 04:56:51 +08:00
Formatting tweaks.
这个提交包含在:
@@ -113,6 +113,7 @@ def run_main(args):
|
|||||||
# Process for benchmarking simulation
|
# Process for benchmarking simulation
|
||||||
elif args.benchmark:
|
elif args.benchmark:
|
||||||
run_benchmark_sim(args, inputfile, usernamespace)
|
run_benchmark_sim(args, inputfile, usernamespace)
|
||||||
|
print('\nSimulation completed.\n{}\n'.format('-' * get_terminal_size()[0]))
|
||||||
|
|
||||||
# Process for standard simulation
|
# Process for standard simulation
|
||||||
else:
|
else:
|
||||||
@@ -443,8 +444,7 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
|
|||||||
outputfile = inputfileparts[0] + '.out'
|
outputfile = inputfileparts[0] + '.out'
|
||||||
else:
|
else:
|
||||||
outputfile = inputfileparts[0] + str(modelrun) + '.out'
|
outputfile = inputfileparts[0] + str(modelrun) + '.out'
|
||||||
sys.stdout.write('\nOutput to file: {}\n'.format(outputfile))
|
print('\nOutput to file: {}\n'.format(outputfile))
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Start - Main FDTD calculations #
|
# Start - Main FDTD calculations #
|
||||||
|
@@ -16,10 +16,11 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from collections import OrderedDict
|
||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
from collections import OrderedDict
|
from shutil import get_terminal_size
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ def run_opt_sim(args, numbermodelruns, inputfile, usernamespace):
|
|||||||
|
|
||||||
# Select OA
|
# Select OA
|
||||||
OA, N, cols, k, s, t = construct_OA(optparams)
|
OA, N, cols, k, s, t = construct_OA(optparams)
|
||||||
print('\n{}\nTaguchi optimisation...\n'.format(68 * '*'))
|
print('\n{}\nTaguchi optimisation...\n'.format('-' * get_terminal_size()[0]))
|
||||||
print('\tOrthogonal array: {:g} experiments per iteration, {:g} parameters ({:g} will be used), {:g} levels, and strength {:g}'.format(N, cols, k, s, t))
|
print('\tOrthogonal array: {:g} experiments per iteration, {:g} parameters ({:g} will be used), {:g} levels, and strength {:g}'.format(N, cols, k, s, t))
|
||||||
tmp = [(k, v) for k, v in optparams.items()]
|
tmp = [(k, v) for k, v in optparams.items()]
|
||||||
print('\tParameters to optimise with ranges: {}'.format(str(tmp).strip('[]')))
|
print('\tParameters to optimise with ranges: {}'.format(str(tmp).strip('[]')))
|
||||||
@@ -131,7 +132,7 @@ def run_opt_sim(args, numbermodelruns, inputfile, usernamespace):
|
|||||||
# Rename confirmation experiment output file so that it is retained for each iteraction
|
# Rename confirmation experiment output file so that it is retained for each iteraction
|
||||||
os.rename(outputfile, os.path.splitext(outputfile)[0] + '_final' + str(iteration + 1) + '.out')
|
os.rename(outputfile, os.path.splitext(outputfile)[0] + '_final' + str(iteration + 1) + '.out')
|
||||||
|
|
||||||
print('\nTaguchi optimisation, iteration {} completed. History of optimal parameter values {} and of fitness values {}'.format(iteration + 1, dict(optparamshist), fitnessvalueshist, 68 * '*'))
|
print('\nTaguchi optimisation, iteration {} completed. History of optimal parameter values {} and of fitness values {}'.format(iteration + 1, dict(optparamshist), fitnessvalueshist, '-' * get_terminal_size()[0]))
|
||||||
iteration += 1
|
iteration += 1
|
||||||
|
|
||||||
# Stop optimisation if stopping criterion has been reached
|
# Stop optimisation if stopping criterion has been reached
|
||||||
@@ -154,7 +155,7 @@ def run_opt_sim(args, numbermodelruns, inputfile, usernamespace):
|
|||||||
pickle.dump(fitnessvalueshist, f)
|
pickle.dump(fitnessvalueshist, f)
|
||||||
pickle.dump(optparamsinit, f)
|
pickle.dump(optparamsinit, f)
|
||||||
|
|
||||||
print('\n{}\nTaguchi optimisation completed after {} iteration(s).\nHistory of optimal parameter values {} and of fitness values {}\n{}\n'.format(68 * '*', iteration, dict(optparamshist), fitnessvalueshist, 68 * '*'))
|
print('\n{}\nTaguchi optimisation completed after {} iteration(s).\nHistory of optimal parameter values {} and of fitness values {}\n{}\n'.format('-' * get_terminal_size()[0], iteration, dict(optparamshist), fitnessvalueshist, '-' * get_terminal_size()[0]))
|
||||||
|
|
||||||
|
|
||||||
def taguchi_code_blocks(inputfile, taguchinamespace):
|
def taguchi_code_blocks(inputfile, taguchinamespace):
|
||||||
|
在新工单中引用
屏蔽一个用户