Commit f63c18e1 authored by Cianciosa, Mark's avatar Cianciosa, Mark
Browse files

Add code documentation for post process script.

parent c25272d1
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -279,6 +279,7 @@
		C713425C2942665300672AD4 /* register.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = register.hpp; sourceTree = "<group>"; };
		C71342652947D57900672AD4 /* metal_context.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = metal_context.hpp; sourceTree = "<group>"; };
		C71342682947F36100672AD4 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
		C7167B222AC5CE8500E03131 /* fix_NaN.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = fix_NaN.py; sourceTree = "<group>"; };
		C717CB8D2A02E361008FBDD8 /* FindNetCDF.cmake */ = {isa = PBXFileReference; lastKnownFileType = text; path = FindNetCDF.cmake; sourceTree = "<group>"; };
		C71C1FF527F5379D006997C2 /* dispersion.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = dispersion.hpp; sourceTree = "<group>"; };
		C71C1FF627F5F5A8006997C2 /* solver.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = solver.hpp; sourceTree = "<group>"; };
@@ -454,6 +455,14 @@
			name = Frameworks;
			sourceTree = "<group>";
		};
		C7167B212AC5CE8500E03131 /* utilities */ = {
			isa = PBXGroup;
			children = (
				C7167B222AC5CE8500E03131 /* fix_NaN.py */,
			);
			path = utilities;
			sourceTree = "<group>";
		};
		C717CB8C2A02E361008FBDD8 /* cmake */ = {
			isa = PBXGroup;
			children = (
@@ -479,6 +488,7 @@
				C7931E6928073BCA0033B488 /* graph_tests */,
				C79141B422DAAD0C00E0BA0D /* graph_driver */,
				C74DF4582AA8BC7300319113 /* graph_benchmark */,
				C7167B212AC5CE8500E03131 /* utilities */,
				C717CB8C2A02E361008FBDD8 /* cmake */,
				C79141A722DA9BF200E0BA0D /* Products */,
				C71342672947F36100672AD4 /* Frameworks */,
+18 −1
Original line number Diff line number Diff line
#-------------------------------------------------------------------------------
##  @file fix_NaN.py
##  @brief Post processes result files.
#-------------------------------------------------------------------------------

import netCDF4
import argparse
import numpy

#-------------------------------------------------------------------------------
#  Clean up k imaginary and calculate the power absorbed.
##  @brief Clean up result files.
##
##  Removes NaN's and noise spikes in the results. Also computes the power
##  absorption and bins the power into a 2D grid.
##
##  @params params[in] args Command line arguments.
#-------------------------------------------------------------------------------
def main(**args):
    with netCDF4.Dataset('{}/bins.nc'.format(args['directory']), 'w') as bin_ref:
        nr = bin_ref.createDimension('nr', 64)
@@ -38,6 +49,12 @@ def main(**args):
                                                                                                numpy.less(z[1:], zbin[k + 1])))), dpower), axis=0)
                        bins[j, k] += numpy.where(numpy.isnan(bin_power), 0.0, bin_power)

#-------------------------------------------------------------------------------
##  @brief Script entry point.
##
##  Defines command line arguments for.
##  * --directory Directory to search for the result files.
#-------------------------------------------------------------------------------
if __name__ == '__main__':
    command_line_parser = argparse.ArgumentParser()