import math


def sig_test_mean(mean_1, mean_2, base_1, base_2, sd1, sd2, design_effect = 1.2, threshold = 1.96):
    """
    Calculates significance testing between two means using a z-test. 
    Result from test will indicaite if estimates from populations are significantly different.
    
    Parameters
    ----------
    mean_1 : int, float
        estimated mean of a population.
    mean_2 : int, float
        a different estimated mean of a population.
    base_1 : int
        sample size for mean 1.
    base_2 : int
        sample size for mean 2.
    sd1 : float
        standard deviation for mean_1
    sd2 : float
        standard deviation for mean_2
    design_1 : int, float
        the model design effect associated with mean_1. Defaults to 1.2 for crime survey data.
    design_1 : int, float
        the model design effect associated with mean_1. Defaults to 1.2 for crime survey data.
    threshold : int, float
        threshold threshold for determining significance Defaults to 1.96 for the 5% level.
        
    Returns
    -------
    int
        a Boolean value indicating whether the populations significantly differ.
        
    Raises
    -------
    
    Notes
    -----
    This significance test will not work for testing differences between numbers of incidents/victims on the CSEW.
    This test is only for testing means.
    """
    
    sd1_sqr = sd1 * sd1
    
    sd2_sqr = sd2 * sd2
    
    sd1_sqr_over_base = sd1_sqr / base_1

    sd2_sqr_over_base = sd2_sqr / base_2
    
    var_diff = sd1_sqr_over_base + sd2_sqr_over_base
    
    SE_diff = math.sqrt(var_diff)
    
    mean_diff = mean_1 - mean_2
    
    mean_diff_over_SE_diff = mean_diff / SE_diff
    
    divide_by_DE = mean_diff_over_SE_diff / design_effect
    
    z_score = divide_by_DE
    
    if ((threshold <= z_score) | ((threshold * - 1) >= z_score)):
            is_significant = '*'
    else :
            is_significant = ' '
  
    return is_significant