def make_result_dict_single(tax_benefit_system = tax_benefit_system, pickle = False, year_range = range(2012,2016), simulation_var = simulation_var, child_range = range (0, 5) ): legislation_var_year = dict() for year in year_range: simulation = dict() for nb_enf in child_range: simulation[nb_enf] = make_couple_with_child_scenario(nombre_enfants = nb_enf, year = year, tax_benefit_system = tax_benefit_system, ).new_simulation(debug = False, debug_all = False, trace = False) legislation_var = dict() for nb_enf, simul in simulation.iteritems(): var_by_simul = dict() temp = dict() for var in simulation_var : try : temp[var] = simul.calculate_add(var, year) except: print 'var {} has failed'.format(var) legislation_var[nb_enf] = temp print u"ended for year: {}".format(year) legislation_var_year[year] = legislation_var #print legislation_var_year if pickle == True: cPickle.dump( legislation_var_year, open( "single_var_{}.p",#.format("bau" #make a test to give the name of the reform to the pickle "wb" ) ) #bau = buisness as usual # (type(tax_benefit_system) == "openfisca_france.TaxBenefitSystem") * 'bau' + reform.name $ (type(tax_benefit_system) != "openfisca_france.TaxBenefitSystem") return legislation_var_year[year]
def make_ready_to_use_simulation(year=None, couple=True): if couple == True: scenario = make_ready_to_use_scenario.make_couple_with_child_scenario( year=year) if couple == False: scenario = make_ready_to_use_scenario.make_single_with_child_scenario( year=year) return scenario.new_simulation()
def make_result_dict_single( tax_benefit_system=tax_benefit_system, pickle=False, year_range=range(2012, 2016), simulation_var=simulation_var, child_range=range(0, 5), ): legislation_var_year = dict() for year in year_range: simulation = dict() for nb_enf in child_range: simulation[nb_enf] = make_couple_with_child_scenario( nombre_enfants=nb_enf, year=year, tax_benefit_system=tax_benefit_system ).new_simulation(debug=False, debug_all=False, trace=False) legislation_var = dict() for nb_enf, simul in simulation.iteritems(): var_by_simul = dict() temp = dict() for var in simulation_var: try: temp[var] = simul.calculate_add(var, year) except: print "var {} has failed".format(var) legislation_var[nb_enf] = temp print u"ended for year: {}".format(year) legislation_var_year[year] = legislation_var # print legislation_var_year if pickle == True: cPickle.dump( legislation_var_year, open("single_var_{}.p", "wb"), # .format("bau" #make a test to give the name of the reform to the pickle ) # bau = buisness as usual # (type(tax_benefit_system) == "openfisca_france.TaxBenefitSystem") * 'bau' + reform.name $ (type(tax_benefit_system) != "openfisca_france.TaxBenefitSystem") return legislation_var_year[year]
def make_ready_to_use_simulation(year = None, couple = True): if couple == True: scenario = make_ready_to_use_scenario.make_couple_with_child_scenario(year = year) if couple == False: scenario = make_ready_to_use_scenario.make_single_with_child_scenario(year = year) return scenario.new_simulation()