# Path: gprMax/exceptions.py
# class GeneralError(ValueError):
#     """Handles general errors. Subclasses the ValueError class."""
# 
#     def __init__(self, message, *args):
# 
#         self.message = message
#         super(GeneralError, self).__init__(message, *args)
#         print(Fore.RED)


import os
import sys
import h5py
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
from gprMax.exceptions import GeneralError
                value += np.abs(np.amin(output[outputname]))
            elif args['type'] == 'max':
                value += np.amax(output[outputname])
            elif args['type'] == 'absmax':
                value += np.amax(np.abs(output[outputname]))
            else:
                raise GeneralError('type must be either min, max, or absmax')
            outputsused = True

    # Check in case no outputs where found
    if not outputsused:
        raise GeneralError('No outputs matching {} were found'.format(args['outputs']))

    return value


def xcorr(filename, args):
    """Maximum value of a cross-correlation between a response and a reference response.

    Args:
        filename (str): Name of output file
        args (dict): 'refresp' key with path & filename of reference response (time, amp) stored in a text file; 'outputs' key with a list of names (IDs) of outputs (rxs) from input file

    Returns:
        xcorrmax (float): Maximum value from specific outputs
    """

    # Load (from text file) the reference response. See if file exists at specified path and if not try input file directory
    refrespfile = os.path.abspath(args['refresp'])
    if not os.path.isfile(refrespfile):

# Path: gprMax/exceptions.py
# class GeneralError(ValueError):
#     """Handles general errors. Subclasses the ValueError class."""
# 
#     def __init__(self, message, *args):
# 
#         self.message = message
#         super(GeneralError, self).__init__(message, *args)
#         print(Fore.RED)


# Path: user_libs/optimisation_taguchi/fitness_functions.py
import os
import sys
import h5py
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
from gprMax.exceptions import GeneralError

                value += np.abs(np.amin(output[outputname]))
            elif args['type'] == 'max':
                value += np.amax(output[outputname])
            elif args['type'] == 'absmax':
                value += np.amax(np.abs(output[outputname]))
            else:
                raise GeneralError('type must be either min, max, or absmax')
            outputsused = True

    # Check in case no outputs where found
    if not outputsused:
        raise GeneralError('No outputs matching {} were found'.format(args['outputs']))

    return value


def xcorr(filename, args):
    """Maximum value of a cross-correlation between a response and a reference response.

    Args:
        filename (str): Name of output file
        args (dict): 'refresp' key with path & filename of reference response (time, amp) stored in a text file; 'outputs' key with a list of names (IDs) of outputs (rxs) from input file

    Returns:
        xcorrmax (float): Maximum value from specific outputs
    """

    # Load (from text file) the reference response. See if file exists at specified path and if not try input file directory
    refrespfile = os.path.abspath(args['refresp'])
    if not os.path.isfile(refrespfile):

        raise GeneralError('Cannot load reference response from {}'.format(refrespfile))