From b7c64d94e65a714f026d19f287efe6fc767ff371 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Thu, 30 Jun 2016 14:53:29 +0100 Subject: [PATCH] Changed to using OrderedDict for receiver outputs. --- gprMax/input_cmds_multiuse.py | 8 ++++++-- gprMax/receivers.py | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gprMax/input_cmds_multiuse.py b/gprMax/input_cmds_multiuse.py index 35ca2c24..b212d281 100644 --- a/gprMax/input_cmds_multiuse.py +++ b/gprMax/input_cmds_multiuse.py @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with gprMax. If not, see . +from collections import OrderedDict + import numpy as np from gprMax.constants import z0, floattype @@ -343,7 +345,8 @@ def process_multicmds(multicmds, G): # If no ID or outputs are specified, use default i.e Ex, Ey, Ez, Hx, Hy, Hz, Ix, Iy, Iz if len(tmp) == 3: r.ID = 'Rx(' + str(r.xcoord) + ',' + str(r.ycoord) + ',' + str(r.zcoord) + ')' - r.outputs = {key: np.zeros(G.iterations, dtype=floattype) for key in Rx.availableoutputs} + for key in Rx.availableoutputs: + r.outputs[key] = np.zeros(G.iterations, dtype=floattype) else: r.ID = tmp[3] # Check and add field output names @@ -418,7 +421,8 @@ def process_multicmds(multicmds, G): r.ycoordbase = y r.zcoordbase = z r.ID = 'Rx(' + str(x) + ',' + str(y) + ',' + str(z) + ')' - r.outputs = {key: np.zeros(G.iterations, dtype=floattype) for key in Rx.availableoutputs} + for key in Rx.availableoutputs: + r.outputs[key] = np.zeros(G.iterations, dtype=floattype) if G.messages: print(' Receiver at {:g}m, {:g}m, {:g}m with output(s) {} created.'.format(r.xcoord * G.dx, r.ycoord * G.dy, r.zcoord * G.dz, ', '.join(r.outputs))) G.rxs.append(r) diff --git a/gprMax/receivers.py b/gprMax/receivers.py index b992f856..29dc29e5 100644 --- a/gprMax/receivers.py +++ b/gprMax/receivers.py @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with gprMax. If not, see . +from collections import OrderedDict + from gprMax.grid import Ix, Iy, Iz @@ -27,7 +29,7 @@ class Rx(object): def __init__(self): self.ID = None - self.outputs = dict() + self.outputs = OrderedDict() self.xcoord = None self.ycoord = None self.zcoord = None