From 4095925ef0ac6daf8fd99e39a6105f379851d968 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Thu, 21 Jul 2016 16:23:41 +0100 Subject: [PATCH] Formatting cleanups. --- gprMax/__main__.py | 8 ++++---- gprMax/fractals.py | 3 --- gprMax/grid.py | 2 +- gprMax/materials.py | 6 +++--- gprMax/optimisation_taguchi.py | 6 +++--- gprMax/pml.py | 4 ++-- gprMax/xdmf.py | 2 +- 7 files changed, 14 insertions(+), 17 deletions(-) diff --git a/gprMax/__main__.py b/gprMax/__main__.py index 10f51458..c49b4447 100644 --- a/gprMax/__main__.py +++ b/gprMax/__main__.py @@ -7,10 +7,10 @@ if __name__ == '__main__': # Code profiling # Time profiling -#import cProfile, pstats -#cProfile.run('gprMax.gprMax.main()','stats') -#p = pstats.Stats('stats') -#p.sort_stats('time').print_stats(25) +# import cProfile, pstats +# cProfile.run('gprMax.gprMax.main()','stats') +# p = pstats.Stats('stats') +# p.sort_stats('time').print_stats(25) # Memory profiling - use in gprMax.py # from memory profiler import profile diff --git a/gprMax/fractals.py b/gprMax/fractals.py index bf9a5bcb..612f1031 100644 --- a/gprMax/fractals.py +++ b/gprMax/fractals.py @@ -65,13 +65,10 @@ class FractalSurface(object): if self.xs == self.xf: surfacedims = (self.ny + 1, self.nz + 1) - d = G.dx elif self.ys == self.yf: surfacedims = (self.nx + 1, self.nz + 1) - d = G.dy elif self.zs == self.zf: surfacedims = (self.nx + 1, self.ny + 1) - d = G.dz self.fractalsurface = np.zeros(surfacedims, dtype=complextype) diff --git a/gprMax/grid.py b/gprMax/grid.py index a9172c38..2fb3dae3 100644 --- a/gprMax/grid.py +++ b/gprMax/grid.py @@ -199,7 +199,7 @@ def dispersion_check(G): # Minimum wavelength minwavelength = minvelocity / maxfreq - # Resolution of minimum wavelength + # Resolution of minimum wavelength resolution = minwavelength / resolvedsteps else: diff --git a/gprMax/materials.py b/gprMax/materials.py index 45cf6bfa..5b97e4c8 100644 --- a/gprMax/materials.py +++ b/gprMax/materials.py @@ -177,9 +177,9 @@ class PeplinskiSoil(object): f = 1.3e9 w = 2 * np.pi * f erealw = Material.watereri + ((Material.waterdeltaer) / (1 + (w * Material.watertau)**2)) - eimagw = w * Material.watertau * ((Material.waterdeltaer) / (1 + (w * Material.watertau)**2)) + # eimagw = w * Material.watertau * ((Material.waterdeltaer) / (1 + (w * Material.watertau)**2)) - a = 0.65 # Experimentally derived constant + a = 0.65 # Experimentally derived constant es = (1.01 + 0.44 * self.rs)**2 - 0.062 b1 = 1.2748 - 0.519 * self.S - 0.152 * self.C b2 = 1.33797 - 0.603 * self.S - 0.166 * self.C @@ -187,7 +187,7 @@ class PeplinskiSoil(object): # For frequencies in the range 0.3GHz to 1.3GHz sigf1 = 0.0467 + 0.2204 * self.rb - 0.411 * self.S + 0.6614 * self.C # For frequencies in the range 1.4GHz to 18GHz - sigf2 = -1.645 + 1.939 * self.rb - 2.25622 * self.S + 1.594 * self.C + # sigf2 = -1.645 + 1.939 * self.rb - 2.25622 * self.S + 1.594 * self.C # Generate a set of bins based on the given volumetric water fraction values mubins = np.linspace(self.mu[0], self.mu[1], nbins + 1) diff --git a/gprMax/optimisation_taguchi.py b/gprMax/optimisation_taguchi.py index 102eb7fc..860623be 100644 --- a/gprMax/optimisation_taguchi.py +++ b/gprMax/optimisation_taguchi.py @@ -99,9 +99,9 @@ def run_opt_sim(args, numbermodelruns, inputfile, usernamespace): optparams, levels, levelsdiff = calculate_ranges_experiments(optparams, optparamsinit, levels, levelsopt, levelsdiff, OA, N, k, s, iteration) # Run model for each experiment - if args.mpi: # Mixed mode MPI/OpenMP - MPI task farm for models with each model parallelised with OpenMP + if args.mpi: # Mixed mode MPI/OpenMP - MPI task farm for models with each model parallelised with OpenMP run_mpi_sim(args, numbermodelruns, inputfile, usernamespace, optparams) - else: # Standard behaviour - models run serially with each model parallelised with OpenMP + else: # Standard behaviour - models run serially with each model parallelised with OpenMP run_std_sim(args, numbermodelruns, inputfile, usernamespace, optparams) # Calculate fitness value for each experiment @@ -312,7 +312,7 @@ def calculate_ranges_experiments(optparams, optparamsinit, levels, levelsopt, le """ # Gaussian reduction function used for calculating levels - T = 18 # Usually values between 15 - 20 + T = 18 # Usually values between 15 - 20 RR = np.exp(-(i / T)**2) # Calculate levels for each parameter diff --git a/gprMax/pml.py b/gprMax/pml.py index 4c94e476..451eb2ed 100644 --- a/gprMax/pml.py +++ b/gprMax/pml.py @@ -242,8 +242,8 @@ def build_pmls(G): for index, pmlthickness in enumerate(G.pmlthickness): if pmlthickness > 0: - sumer = 0 # Sum of relative permittivities in PML slab - summr = 0 # Sum of relative permeabilities in PML slab + sumer = 0 # Sum of relative permittivities in PML slab + summr = 0 # Sum of relative permeabilities in PML slab pmldirection = PML.directions[index] if pmldirection[0] == 'x': diff --git a/gprMax/xdmf.py b/gprMax/xdmf.py index 07ef71b2..a1bdc7c9 100644 --- a/gprMax/xdmf.py +++ b/gprMax/xdmf.py @@ -279,7 +279,7 @@ def write_output_file(filename, grid, res): def write_xml_doc(options): - #write xml to file + # write xml to file with open(options['filename'] + '.xdmf', 'wb') as xdmf_f: xdmf_f.write(options['xml_doc'])