def ecgmathcalc(timelist, voltagelist):
    """Method that performs the basic math functions

    This method takes the input lists from the fileparser and then obtains
    the basic metrics. These include the max and min and duration. It also
    obtains the length of the time list which is used in later calculations.
    Max and min are both obtained using built in python functions and duration
    is calculated by subtracting the endpoints.

    :param timelist: List of time values
    :param voltagelist: List of voltage values
    :returns minvolt: Minimum voltage value recorded
    :returns maxvolt: Maximum voltage value recorded
    :returns duration: Duration of the ECG recording
    :returns timelen: Length of the time list
    """
    duration = 0
    timelen = len(timelist)

    # Determines Min and Max voltages in the file
    minvolt = min(voltagelist)

    maxvolt = max(voltagelist)

    # Determines duration of input signal
    duration = timelist[timelen-1] - timelist[0]
    return minvolt, maxvolt, duration, timelen