Coloured warning messages.

这个提交包含在:
Craig Warren
2016-08-09 14:08:47 +01:00
父节点 eb6ea0ff4a
当前提交 33f9756191
共有 4 个文件被更改,包括 13 次插入9 次删除

查看文件

@@ -375,7 +375,7 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
# Check to see if numerical dispersion might be a problem
resolution = dispersion_check(G)
if resolution and max((G.dx, G.dy, G.dz)) > resolution:
print('\nWARNING: Potential numerical dispersion in the simulation. Check the spatial discretisation against the smallest wavelength present. Suggested resolution should be less than {:g}m'.format(resolution))
print(Fore.RED + '\nWARNING: Potential numerical dispersion in the simulation. Check the spatial discretisation against the smallest wavelength present. Suggested resolution should be less than {:g}m'.format(resolution) + Style.RESET_ALL)
# If geometry information to be reused between model runs
else:

查看文件

@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
from colorama import init, Fore, Style
init()
import numpy as np
from gprMax.constants import z0, floattype
@@ -88,7 +90,7 @@ def process_multicmds(multicmds, G):
resistance = float(tmp[4])
check_coordinates(xcoord, ycoord, zcoord)
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n')
print(Fore.RED + "WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n' + Style.RESET_ALL)
if resistance < 0:
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' requires a source resistance of zero or greater')
@@ -147,7 +149,7 @@ def process_multicmds(multicmds, G):
zcoord = G.calculate_coord('z', tmp[3])
check_coordinates(xcoord, ycoord, zcoord)
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n')
print(Fore.RED + "WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n' + Style.RESET_ALL)
# Check if there is a waveformID in the waveforms list
if not any(x.ID == tmp[4] for x in G.waveforms):
@@ -206,7 +208,7 @@ def process_multicmds(multicmds, G):
zcoord = G.calculate_coord('z', tmp[3])
check_coordinates(xcoord, ycoord, zcoord)
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n')
print(Fore.RED + "WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n' + Style.RESET_ALL)
# Check if there is a waveformID in the waveforms list
if not any(x.ID == tmp[4] for x in G.waveforms):
@@ -269,7 +271,7 @@ def process_multicmds(multicmds, G):
check_coordinates(xcoord, ycoord, zcoord)
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n')
print(Fore.RED + "WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n' + Style.RESET_ALL)
if resistance <= 0 or resistance >= z0:
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' requires a resistance greater than zero and less than the impedance of free space, i.e. 376.73 Ohms')
@@ -327,7 +329,7 @@ def process_multicmds(multicmds, G):
zcoord = round_value(float(tmp[2]) / G.dz)
check_coordinates(xcoord, ycoord, zcoord)
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n')
print(Fore.RED + "WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n' + Style.RESET_ALL)
r = Rx()
r.xcoord = xcoord
@@ -380,7 +382,7 @@ def process_multicmds(multicmds, G):
check_coordinates(xf, yf, zf, name='upper')
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n')
print(Fore.RED + "WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n' + Style.RESET_ALL)
if xs > xf or ys > yf or zs > zf:
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' the lower coordinates should be less than the upper coordinates')
if dx < 0 or dy < 0 or dz < 0:

查看文件

@@ -21,6 +21,8 @@ import psutil
import decimal as d
import sys
from colorama import init, Fore, Style
init()
import numpy as np
from gprMax.constants import c, floattype
@@ -82,7 +84,7 @@ def process_singlecmds(singlecmds, G):
if G.messages:
print('Number of threads: {}'.format(G.nthreads))
if G.nthreads > psutil.cpu_count(logical=False):
print('\nWARNING: You have specified more threads ({}) than available physical CPU cores ({}). This may lead to degraded performance.'.format(G.nthreads, psutil.cpu_count(logical=False)))
print(Fore.RED + '\nWARNING: You have specified more threads ({}) than available physical CPU cores ({}). This may lead to degraded performance.'.format(G.nthreads, psutil.cpu_count(logical=False)) + Style.RESET_ALL)
# Spatial discretisation
cmd = '#dx_dy_dz'

查看文件

@@ -270,7 +270,7 @@ def construct_OA(optparams):
else:
# THIS CASE NEEDS FURTHER TESTING
print('\nTaguchi optimisation, WARNING: Optimising more than 7 parameters is currently an experimental feature!')
print(Fore.RED + '\nTaguchi optimisation, WARNING: Optimising more than 7 parameters is currently an experimental feature!' + Style.RESET_ALL)
p = int(np.ceil(np.log(k * (s - 1) + 1) / np.log(s)))