Replaced 'input_directory' variable in user dictionary with 'inputfile' from which the directory can easily be derived, e.g. os.path.dirname()

这个提交包含在:
Craig Warren
2017-03-27 13:05:08 +01:00
父节点 4ecf8c5527
当前提交 a89c9e74dc
共有 4 个文件被更改,包括 6 次插入6 次删除

查看文件

@@ -19,8 +19,8 @@ You can access the following built-in constants from your Python code:
You can access the following built-in variables from your Python code:
* ``current_model_run`` is the current run number of the model that is been executed.
* ``inputfile`` is the path and name of the input file.
* ``number_model_runs`` is the total number of runs specified when the model was initially executed, i.e. from ``python -m gprMax my_input_file -n number_of_model_runs``
* ``input_directory`` is the path to the directory where your input file is located.
Functions for input commands

查看文件

@@ -99,7 +99,7 @@ def run_main(args):
print('\nHost: {}; {} x {} ({} cores{}); {} RAM; {}'.format(hostinfo['machineID'], hostinfo['sockets'], hostinfo['cpuID'], hostinfo['physicalcores'], hyperthreading, human_size(hostinfo['ram'], a_kilobyte_is_1024_bytes=True), hostinfo['osversion']))
# Create a separate namespace that users can access in any Python code blocks in the input file
usernamespace = {'c': c, 'e0': e0, 'm0': m0, 'z0': z0, 'number_model_runs': args.n, 'input_directory': os.path.dirname(os.path.abspath(inputfile.name))}
usernamespace = {'c': c, 'e0': e0, 'm0': m0, 'z0': z0, 'number_model_runs': args.n, 'inputfile': os.path.abspath(inputfile.name)}
#######################################
# Process for benchmarking simulation #

查看文件

@@ -9,7 +9,7 @@ import numpy as np
from gprMax.input_cmd_funcs import *
from user_libs.antennas import antenna_like_GSSI_1500
filename = os.path.splitext(os.path.split(__file__)[1])[0]
filename = os.path.splitext(os.path.split(inputfile)[1])[0]
timewindows = np.array([4.5e-9]) # For 0.3m max
radii = np.linspace(0.1, 0.3, 20)
@@ -33,7 +33,7 @@ print('#material: {}'.format(materials[selector]))
print('#box: 0 0 0 {} {} {} {} n'.format(domain[0], domain[1], fs[2] + radii[-1], materials[selector].split()[-1]))
## Save the position of the antenna to file for use when processing results
np.savetxt(os.path.join(input_directory, filename + '_rxsorigin.txt'), antennaposition, fmt="%f")
np.savetxt(os.path.join(os.path.dirname(inputfile), filename + '_rxsorigin.txt'), antennaposition, fmt="%f")
## Generate receiver points for pattern
for radius in range(len(radii)):

查看文件

@@ -9,7 +9,7 @@ import numpy as np
from gprMax.input_cmd_funcs import *
from user_libs.antennas import antenna_like_GSSI_1500
filename = os.path.splitext(os.path.split(__file__)[1])[0]
filename = os.path.splitext(os.path.split(inputfile)[1])[0]
timewindows = np.array([4.5e-9]) # For 0.3m max
radii = np.linspace(0.1, 0.3, 20)
@@ -33,7 +33,7 @@ print('#material: {}'.format(materials[selector]))
print('#box: 0 0 0 {} {} {} {} n'.format(domain[0], domain[1], fs[2] + radii[-1], materials[selector].split()[-1]))
## Save the position of the antenna to file for use when processing results
np.savetxt(os.path.join(input_directory, filename + '_rxsorigin.txt'), antennaposition, fmt="%f")
np.savetxt(os.path.join(os.path.dirname(inputfile), filename + '_rxsorigin.txt'), antennaposition, fmt="%f")
## Generate receiver points for pattern
for radius in range(len(radii)):