More updates to logging and handling exceptions.

这个提交包含在:
craig-warren
2020-04-09 14:23:50 +01:00
父节点 aba5e749c5
当前提交 1e64d493a2
共有 27 个文件被更改,包括 334 次插入177 次删除

查看文件

@@ -17,15 +17,17 @@
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
import argparse
import logging
from pathlib import Path
import h5py
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
from gprMax.exceptions import CmdInputError
from scipy.io import loadmat
logger = logging.getLogger(__name__)
def calculate_antenna_params(filename, tltxnumber=1, tlrxnumber=None, rxnumber=None, rxcomponent=None):
"""Calculates antenna parameters - incident, reflected and total volatges and currents; s11, (s21) and input impedance.
@@ -81,7 +83,8 @@ def calculate_antenna_params(filename, tltxnumber=1, tlrxnumber=None, rxnumber=N
availableoutputs = list(f[rxpath].keys())
if rxcomponent not in availableoutputs:
raise CmdInputError(f"{rxcomponent} output requested, but the available output for receiver {rxnumber} is {', '.join(availableoutputs)}")
logger.exception(f"{rxcomponent} output requested, but the available output for receiver {rxnumber} is {', '.join(availableoutputs)}")
raise ValueError
rxpath += rxcomponent