user-friendly exception message when using polarization in rx and not passing in dxdy

这个提交包含在:
Øystein Bjørndal
2017-01-25 13:24:08 +01:00
父节点 6b076a7cb8
当前提交 c1bff26ce8

查看文件

@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with gprMax. If not, see <http://www.gnu.org/licenses/>. # along with gprMax. If not, see <http://www.gnu.org/licenses/>.
import sys
from collections import namedtuple from collections import namedtuple
"""This module contains functional forms of some of the most commonly used gprMax commands. It can be useful to use these within Python scripting in an input file. """This module contains functional forms of some of the most commonly used gprMax commands. It can be useful to use these within Python scripting in an input file.
@@ -613,11 +614,18 @@ def rx(x, y, z, identifier=None, to_save=None, polarisation=None, dxdy=None, rot
if rotate90origin: if rotate90origin:
if polarisation == 'x': if polarisation == 'x':
xf = x + dxdy[0] try:
xf = x + dxdy[0]
except Exception as e:
raise ValueError('With polarization = x, a dxdy[0] float values is required, got dxdy=%s' % dxdy) from e
yf = y yf = y
elif polarisation == 'y': elif polarisation == 'y':
xf = x xf = x
yf = y + dxdy[1] try:
yf = y + dxdy[1]
except Exception as e:
raise ValueError('With polarization = y, a dxdy[1] float values is required, got dxdy=%s' % dxdy) from e
x, y, xf, yf = rotate90_edge(x, y, xf, yf, polarisation, rotate90origin) x, y, xf, yf = rotate90_edge(x, y, xf, yf, polarisation, rotate90origin)
c = Coordinate(x, y, z) c = Coordinate(x, y, z)
@@ -659,3 +667,4 @@ def rx_steps(dx=0, dy=0, dz=0):
c = Coordinate(dx, dy, dz) c = Coordinate(dx, dy, dz)
command('rx_steps', str(c)) command('rx_steps', str(c))
return c return c