diff --git a/gsrp_tdoa_hyperres.py b/gsrp_tdoa_hyperres.py index 345873c47e8261360e9abf35e6a02db82e6305c6..731735ee66fe4a9a9e210f504181670fd884db63 100755 --- a/gsrp_tdoa_hyperres.py +++ b/gsrp_tdoa_hyperres.py @@ -150,7 +150,8 @@ def corr(data, pos, w_size, max_tdoa, decimate=1, mode='prepare', hyper=True, ve tdoas[i, 1] += maxs if hyper: - tdoas2[i, :2], tdoas2[i, 2:] = _hyperres(tdoas[i, 2:], cc) + with np.errstate(divide='ignore'): + tdoas2[i, :2], tdoas2[i, 2:] = _hyperres(tdoas[i, 2:], cc) tdoas2[i, 1] += maxs tdoas[:, :2] *= 20 if mode == 'smart': @@ -208,7 +209,7 @@ def main(args): try: pos = np.arange(0, len(sound), int(sr * float(args.stride))) except ValueError: - raise ValueError(f'Error: hop size {args.stride} is neither an existing file nor a float') + raise ValueError(f'hop size {args.stride} is neither an existing file nor a float') print("Computing TDOAs...") results = corr(sound, pos, int(sr * args.frame_size), max_tdoa=int(np.ceil(sr * args.max_tdoa)), @@ -353,5 +354,9 @@ if __name__ == "__main__": sys.exit(main(args)) except Exception as e: - print(type(e).__name__, e, sep=': ') + trace = getattr(sys, 'gettrace', None) + if trace is not None: + if trace(): + raise e from None + print(f'{BColors.WARNING}{type(e).__name__}: {e}{BColors.WARNING}') sys.exit(2)