From 4ecf8c552721e16a0a4ed627c4ba60e52a5ccaa7 Mon Sep 17 00:00:00 2001 From: craig-warren Date: Mon, 27 Mar 2017 11:30:56 +0100 Subject: [PATCH] Updated to improve saving/loading of antenna origin coordinates file. --- docs/source/user_libs_antenna_patterns.rst | 6 +++--- user_models/antenna_like_GSSI_1500_patterns_E.in | 8 ++++++-- user_models/antenna_like_GSSI_1500_patterns_H.in | 8 ++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/source/user_libs_antenna_patterns.rst b/docs/source/user_libs_antenna_patterns.rst index ebcdb646..ef484252 100644 --- a/docs/source/user_libs_antenna_patterns.rst +++ b/docs/source/user_libs_antenna_patterns.rst @@ -40,8 +40,8 @@ How to use the module * Firstly you should familiarise yourself with the example model input file. Edit the input file as desired and run one of the simulations for either E-plane or H-plane patterns. * Whilst the simulation is running edit the 'user configurable paramters' sections of the ``initial_save.py`` and ``plot_fields.py`` modules to match the setup of the simulation. -* Once the simulation has completed, run the ``initial_save.py`` module on the output file, e.g. for the E-plane ``python -m user_libs.antenna_patterns.initial_save antenna_like_GSSI_1500_patterns_E.out``. This will produce a Numpy file containing the field pattern data. -* Plot the field pattern data by running the ``plot_fields.py`` module on the Numpy file, e.g. for the E-plane ``python -m user_libs.antenna_patterns.plot_fields antenna_like_GSSI_1500_patterns_E.npy`` +* Once the simulation has completed, run the ``initial_save.py`` module on the output file, e.g. for the E-plane ``python -m user_libs.antenna_patterns.initial_save user_models/antenna_like_GSSI_1500_patterns_E_Er5.out``. This will produce a Numpy file containing the field pattern data. +* Plot the field pattern data by running the ``plot_fields.py`` module on the Numpy file, e.g. for the E-plane ``python -m user_libs.antenna_patterns.plot_fields user_models/antenna_like_GSSI_1500_patterns_E_Er5.npy`` .. tip:: @@ -51,4 +51,4 @@ How to use the module .. figure:: images/user_libs/antenna_like_GSSI_1500_patterns_E_Er5.png :width: 600 px - Example of the E-plane pattern from a simulation containing an antenna model similar to a GSSI 1.5 GHz antenna over a homogeneous, lossless half-space with a relative permittivity of five. \ No newline at end of file + Example of the E-plane pattern from a simulation containing an antenna model similar to a GSSI 1.5 GHz antenna over a homogeneous, lossless half-space with a relative permittivity of five. diff --git a/user_models/antenna_like_GSSI_1500_patterns_E.in b/user_models/antenna_like_GSSI_1500_patterns_E.in index 4edd22d9..fc2d3be5 100755 --- a/user_models/antenna_like_GSSI_1500_patterns_E.in +++ b/user_models/antenna_like_GSSI_1500_patterns_E.in @@ -5,8 +5,12 @@ #python: import os 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] + timewindows = np.array([4.5e-9]) # For 0.3m max radii = np.linspace(0.1, 0.3, 20) theta = np.linspace(3, 357, 60) @@ -29,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, 'antenna_like_GSSI_1500_patterns_E_rxsorigin.txt'), antennaposition, fmt="%f") +np.savetxt(os.path.join(input_directory, filename + '_rxsorigin.txt'), antennaposition, fmt="%f") ## Generate receiver points for pattern for radius in range(len(radii)): @@ -40,5 +44,5 @@ for radius in range(len(radii)): for rxpt in range(len(theta)): print('#rx: {:.3f} {:.3f} {:.3f}'.format(x[rxpt] + antennaposition[0], y[rxpt] + antennaposition[1], z[rxpt] + antennaposition[2])) -#print('#geometry_view: 0 0 0 {} {} {} 0.001 0.001 0.001 antenna_like_GSSI_1500_patterns_E n'.format(domain[0], domain[1], domain[2])) +geometry_view(0, 0, 0, domain[0], domain[1], domain[2], 0.001, 0.001, 0.001, filename, 'n') #end_python: diff --git a/user_models/antenna_like_GSSI_1500_patterns_H.in b/user_models/antenna_like_GSSI_1500_patterns_H.in index 2eed83e0..63b41550 100755 --- a/user_models/antenna_like_GSSI_1500_patterns_H.in +++ b/user_models/antenna_like_GSSI_1500_patterns_H.in @@ -5,8 +5,12 @@ #python: import os 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] + timewindows = np.array([4.5e-9]) # For 0.3m max radii = np.linspace(0.1, 0.3, 20) theta = np.linspace(3, 357, 60) @@ -29,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, 'antenna_like_GSSI_1500_patterns_H_rxsorigin.txt'), antennaposition, fmt="%f") +np.savetxt(os.path.join(input_directory, filename + '_rxsorigin.txt'), antennaposition, fmt="%f") ## Generate receiver points for pattern for radius in range(len(radii)): @@ -40,5 +44,5 @@ for radius in range(len(radii)): for rxpt in range(len(theta)): print('#rx: {:.3f} {:.3f} {:.3f}'.format(x[rxpt] + antennaposition[0], y[rxpt] + antennaposition[1], z[rxpt] + antennaposition[2])) -#print('#geometry_view: 0 0 0 {} {} {} 0.001 0.001 0.001 antenna_like_GSSI_1500_patterns_H n'.format(domain[0], domain[1], domain[2])) +geometry_view(0, 0, 0, domain[0], domain[1], domain[2], 0.001, 0.001, 0.001, filename, 'n') #end_python: