Detects outliers more than X standard deviations from mean. 
 
    Parameters 
    ----------   
    in_list: ndarray
        An array of measures for which outliers need to be detected. 
 
    thresh: float (optional)
        Threshold number of standard deviations before a measure is considered
        an outlier. Default = 3.0
 
    Returns 
    ------- 
    outlier_idx: ndarray of boolean  
        An array indicating if a measure is an outlier (True) or not (False).

def detect_outliers(in_arr, thresh=3.0):
    """ 
    Detects outliers more than X standard deviations from mean. 
 
    Parameters 
    ----------   
    in_list: ndarray
        An array of measures for which outliers need to be detected. 
 
    thresh: float (optional)
        Threshold number of standard deviations before a measure is considered
        an outlier. Default = 3.0
 
    Returns 
    ------- 
    outlier_idx: ndarray of boolean  
        An array indicating if a measure is an outlier (True) or not (False). 
    """

    mean = np.nanmean(in_arr)
    std = np.nanstd(in_arr)

    # calculate cutoffs 
    uppthresh = mean + thresh * std
    lowthresh = mean - thresh * std

    return np.logical_or(in_arr < lowthresh, in_arr > uppthresh)