def chain_binomial_monte_carlo(beta, gamma, num_sims, num_metro_zeros, num_child_zeros, num_adult_zeros):
# run many (num_sims) instances of chain binomial simulation and return average epidemic size    

    #d_metropop, metro_ids = pop_func.import_metropop(filename_metropop, 2, 3)
    population_size = sum([d_metropop[x] for x in metro_ids])
    threshold = 0.10 # 10% of population size is our threshold for a large epidemic

    d_metro_age_pop = pop_func.calc_metro_age_pop(filename_metropop, alpha)

    large_epidemic_sizes= [] # will keep list of outbreak sizes that are large epidemics
    for sim in range(1,num_sims):
        #incidence_time_series, outbreak_size = chain_binomial_one_simulation(d_metro_age_pop, metro_ids, beta, gamma, air_network, num_metro_zeros, num_child_zeros, num_adult_zeros, C)
        # Note we are not using the incidence time series right now
        
        new_cases_incidence_time_series_metro_child, new_cases_incidence_time_series_metro_adult, incidence_time_series_metro_child, incidence_time_series_metro_adult, tot_incidence_time_series_child, tot_incidence_time_series_adult, outbreak_size_child, outbreak_size_adult = chain_binomial_one_simulation(d_metro_age_pop, metro_ids, beta, gamma, air_network, num_metro_zeros, num_child_zeros, num_adult_zeros, C)

        outbreak_size = (outbreak_size_child + outbreak_size_adult)
        
        ## SB said don't worry about this for now ##
        # figure out if this is small outbreak or large epidemic
        #if outbreak_size > threshold * population_size: # if outbreak reached more than 10% of the population
            #large_epidemic_sizes.append(outbreak_size)

        # call it a large epidemic and save its size
        large_epidemic_sizes.append(outbreak_size)
            
    # calculate average large epidemic size, and how frequent they were
    if large_epidemic_sizes:
        average_epidemic_size = np.mean(large_epidemic_sizes)/float(population_size)
        probability_epidemic = len(large_epidemic_sizes)/float(num_sims)
    else:
        average_epidemic_size = 0
        probability_epidemic = 0
    
    
    return average_epidemic_size
 filename_metropop = 'Dropbox/Anne_Bansal_lab/Python_Scripts/Modeling_Project/air_traffic_data/metedges.txt'
 d_metropop, metro_ids = pop_func.import_metropop(filename_metropop, 2, 3)
 filename_air_network = 'Dropbox/Anne_Bansal_lab/Python_Scripts/Modeling_Project/air_traffic_data/air_traffic_edgelist.txt'
 air_network = read_edgelist_anne(filename_air_network)
 # READ US population data
 us_popdata = csv.reader(open('Dropbox/Anne_Bansal_lab/SDI_Data/totalpop_age.csv', 'r'),delimiter = ',')
 dict_popdata, ages, years = pop_func.import_popdata(us_popdata, 0, 1, 2)
 dict_childpop, dict_adultpop = pop_func.pop_child_adult (dict_popdata, years)
 # READ Germany contact data
 filename_germ_contact_data = 'Dropbox/Anne_Bansal_lab/Contact_Data/polymod_germany_contact_matrix_Mossong_2008.csv'
 filename_germ_pop_data = 'Dropbox/Anne_Bansal_lab/UNdata_Export_2008_Germany_Population.csv'
     
 # DEFINE POPULATION PARAMETERS
 year = 2010
 alpha = pop_func.calc_alpha(year, dict_childpop, dict_adultpop)
 d_metro_age_pop = pop_func.calc_metro_age_pop(filename_metropop, alpha)
 ch_travelers_r = 0.0 # fraction of children who travel
 
 # CONTACT MATRIX
 C = pop_func.calc_contact_matrix(filename_germ_contact_data, filename_germ_pop_data, alpha)
                         
 # DEFINE DISEASE PARAMETERS
 R0 = 1.2
 gamma = 0.5 # recovery rate based on (1/gamma) day infectious period
 #beta = calculate_beta(R0, gamma, air_network)
 beta = 0.015
 #beta = 0.005
 num_metro_zeros = 1 # set how many metros to select patients from to start with
 num_child_zeros = 1
 num_adult_zeros = 0
 time_end = 300