当前位置: 首页>>代码示例>>Python>>正文


Python simulations.ScenarioSimulation类代码示例

本文整理汇总了Python中openfisca_core.simulations.ScenarioSimulation的典型用法代码示例。如果您正苦于以下问题:Python ScenarioSimulation类的具体用法?Python ScenarioSimulation怎么用?Python ScenarioSimulation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ScenarioSimulation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_simulation

def run_simulation(apply_reform=False, reforme=False,
                    conj = False, kids = 0, sal_conj=False, year=2011):

    simulation = ScenarioSimulation()
    simulation.set_config(year = year, nmen = 1001,
                    x_axis = 'sali', maxrev = 10000, reforme = reforme,
                    mode ='bareme', same_rev_couple = False)
    simulation.set_param()

    if sal_conj:
        conj = True

    if conj:
        simulation.scenario.addIndiv(1, datetime(1975,1,1).date(), 'vous', 'part')
        if sal_conj:
            simulation.scenario.indiv[1].update({'sali': simulation.P.cotsoc.gen.smig})

        if kids > 0:
            for n in range(1,kids+1):
                simulation.scenario.addIndiv(n+1, datetime(2000,1,1).date(), 'pac', 'enf')

    print simulation.scenario
    if apply_reform:
        simulation.P.ir.reforme.exemption.active = 1
        simulation.P.cotsoc.gen.smig = 320
        simulation.P_default.cotsoc.gen.smig = 320

    return simulation
开发者ID:Iliato,项目名称:openfisca-qt,代码行数:28,代码来源:reforme_bareme.py

示例2: menage_enfant_seulement

def menage_enfant_seulement(year = 2013):
    simulation = ScenarioSimulation()
    simulation.set_config(year = year,
                          nmen = 10,
                          maxrev = 0,
                          x_axis= 'sali')
    print simulation.scenario
开发者ID:zehff,项目名称:autonomie_des_jeunes,代码行数:7,代码来源:example.py

示例3: menage_sans_enfant

def menage_sans_enfant(year = 2013):
    simulation = ScenarioSimulation()
    simulation.set_config(year = year,
                          nmen = 10,
                          maxrev = 100000,
                          x_axis= 'sali')
    print simulation.scenario
    
    
    simulation.scenario.addIndiv(1, datetime.date(1975,1,1), 'conj','part')
开发者ID:zehff,项目名称:autonomie_des_jeunes,代码行数:10,代码来源:example.py

示例4: couple_38ans_avec_3enfants

def couple_38ans_avec_3enfants(year = 2013):
    simulation = ScenarioSimulation()
    simulation.set_config(year=year,
					nmen=1,
					maxrev = 500000,
                          x_axis= 'sali',
                          )
    print simulation.scenario
    simulation.scenario.addIndiv(1, datetime(1975,1,1).date(), 'conj', 'part')
    simulation.scenario.addIndiv(2, datetime(2000,1,1).date(), 'pac1', 'enf1')
    simulation.scenario.addIndiv(3, datetime(2005,1,1).date(), 'pac2', 'enf2')
    simulation.scenario.addIndiv(4, datetime(2010,1,1).date(), 'pac3', 'enf3')
开发者ID:benjello,项目名称:quotient_familial,代码行数:12,代码来源:example.py

示例5: complete_2012_param

def complete_2012_param(P):
    # Hack to get rid of missing parameters in 2012
    dummy_simulation = ScenarioSimulation()

    dummy_simulation.set_config(year = 2012-1, nmen = 1, reforme = False, mode ='castype',
        decomp_file="decomp_contrib.xml")
    dummy_simulation.set_param()

    P.fam = dummy_simulation.P.fam
    P.minim = dummy_simulation.P.minim
    P.al = dummy_simulation.P.al
    P.ir.crl = dummy_simulation.P.ir.crl
    P.isf = dummy_simulation.P.isf
开发者ID:Iliato,项目名称:openfisca-qt,代码行数:13,代码来源:cecilia.py

示例6: test_case_reform

def test_case_reform(year):
    """
    A test case with reform
    """
    simulation = ScenarioSimulation()
    simulation.set_config(year=year, reforme=True, nmen=1)
    # Adding a husband/wife on the same tax sheet (foyer)

    simulation.set_param()
    test_case = simulation.scenario

    sal_mensuel = 1000
    for i in range(10):
        test_case.indiv[0].update({"sal" + str(i): sal_mensuel * 12})

    test_case.indiv[0].update({"nb_trim_val": 50})
    test_case.indiv[0].update({"age": 54})
    simulation.set_param()

    print simulation.P_default
    param = simulation.P
    # param.pension.rsna.taux_ann_base = .03
    param.pension.rsna.age_dep_anticip = 55

    df = simulation.get_results_dataframe()
    print df.to_string()
开发者ID:Jiss83,项目名称:openfisca-qt,代码行数:26,代码来源:example.py

示例7: modify_parameters

def modify_parameters(simulation = None):

    if simulation is None:
        simulation = ScenarioSimulation()
        simulation.set_config(year = 2013)
        simulation.set_param()

    for _P in [simulation.P, simulation.P_default]:

        sal = build_sal(_P)
        pat = build_pat(_P)

        _P.cotsoc.__dict__['cotisations_patronales'] = CompactNode()
        _P.cotsoc.__dict__['cotisations_salariales'] = CompactNode()

        for cotisation_name, bareme_dict in {'cotisations_patronales' : pat, 'cotisations_salariales': sal}.iteritems():
            for category in bareme_dict:
                if category in CAT._nums:
                    _P.cotsoc.__dict__[cotisation_name].__dict__[category] = bareme_dict[category]
开发者ID:Massiliane,项目名称:openfisca-france,代码行数:19,代码来源:preprocess_parameters.py

示例8: test_case

def test_case(year, save = False):

    country = 'france'
    salaires_nets = 30000
    nmen = 3
    nmax = 1

    for reforme in [False, True]:
        simulation = ScenarioSimulation()
        simulation.set_config(year = year,
                              reforme = reforme,
                              nmen = nmen,
                              maxrev = salaires_nets * nmax,
                              x_axis = 'sali')

        # Adding a husband/wife on the same tax sheet (foyer)
        simulation.scenario.addIndiv(1, datetime.date(1975, 1, 1), 'conj', 'part')
    #     simulation.scenario.addIndiv(2, datetime(2000,1,1).date(), 'pac', 'enf')
    #     simulation.scenario.addIndiv(3, datetime(2000,1,1).date(), 'pac', 'enf')

        # Loyers set statut d'occupation
        simulation.scenario.menage[0].update({"loyer": 2000})
        simulation.scenario.menage[0].update({"so": 4})

        simulation.set_param()
        simulation.P.ir.autre.charge_loyer.active = 1
        simulation.P.ir.autre.charge_loyer.plaf = 1000
        simulation.P.ir.autre.charge_loyer.plaf_nbp = 0
        print simulation.P
        print type(simulation.P)
        reduc = 0
        print simulation.P.ir.bareme
        print len(simulation.P.ir.bareme.thresholds)
        for i in range(2, len(simulation.P.ir.bareme.thresholds)):
            simulation.P.ir.bareme.setSeuil(i, simulation.P.ir.bareme.thresholds[i] * (1 - reduc))

        print simulation.P.ir.bareme
        print len(simulation.P.ir.bareme.thresholds)

        if simulation.reforme is True:
            df = simulation.get_results_dataframe(difference = True)
        else:
            df = simulation.get_results_dataframe()
        print df.to_string()

        # Save example to excel
        if save:
            destination_dir = "c:/users/utilisateur/documents/"
            if reforme:
                fname = destination_dir + "Trannoy_reforme_new_diff.%s" % "xlsx"
                print "Saving " + fname
                df.to_excel(fname, sheet_name = "difference")
            else:
                fname = destination_dir + "Trannoy_reforme_new.%s" % "xlsx"
                print "Saving " + fname
                df.to_excel(fname, sheet_name = "Trannoy")
开发者ID:LouisePaulDelvaux,项目名称:openfisca-qt,代码行数:56,代码来源:trannoy_old.py

示例9: case_study

def case_study(year = 2013):

    # Creating a case_study household with one individual whose taxable income (salaire imposable, sali
    # varies from 0 to maxrev = 100000 in nmen = 3 steps
    simulation = ScenarioSimulation()
    simulation.set_config(year = year,
                          reforme = True,
                          nmen = 11,
                          maxrev = 100000,
                          x_axis = 'sali')

    print simulation.
    # Adding a husband/wife on the same tax sheet (ie foyer, as conj) and of course same family (as part)
    simulation.scenario.addIndiv(1, datetime(1975, 1, 1).date(), 'conj', 'part')

    # Adding 3 kids on the same tax sheet and family
    simulation.scenario.addIndiv(2, datetime(2001, 1, 1).date(), 'pac', 'enf')
    simulation.scenario.addIndiv(3, datetime(2002, 1, 1).date(), 'pac', 'enf')
    simulation.scenario.addIndiv(4, datetime(2003, 1, 1).date(), 'pac', 'enf')

    # Set legislative parameters
    simulation.set_param()

    # Some prestation can be disabled (herethe aefa prestation) by uncommenting the following line
    # simulation.disable_prestations( ['aefa'])

    # Performing a parameterical reform (inspect openifsca-country.param.param.xml)
    # Lower the part in the quotient familial for the third child from 1 to .5

    print 'default value for P.ir.quotient_familial.enf2 : %s \n' % simulation.P.ir.quotient_familial.enf2
    simulation.P.ir.quotient_familial.enf2 = 0
    print 'reform value for P.ir.quotient_familial.enf2 : %s \n' % simulation.P.ir.quotient_familial.enf2


    # Compute the pandas dataframe of the household case_study
    df = simulation.get_results_dataframe(default = True)
    print df.to_string()

    # Save example to excel
    # destination_dir = "c:/users/utilisateur/documents/"
    # fname = "Example_%s.%s" %(str(yr), "xls")
    # df.to_excel(destination_dir = "c:/users/utilisateur/documents/" + fname)

    df_reform = simulation.get_results_dataframe()
    print df_reform.to_string()

    # Many other variables are accessible
    # Input variables
    print 'list of input variables : %s \n' % simulation.input_var_list
    # Getting the value of some input variables
    print simulation.input_table.table['so']

    # Output variables
    print 'list of output variables : %s \n' % simulation.output_var_list
    print simulation.output_table.table['ir_plaf_qf']
    print simulation.output_table_default.table['ir_plaf_qf']
开发者ID:Jiss83,项目名称:openfisca-qt,代码行数:56,代码来源:example-amu.py

示例10: case_study

def case_study(year = 2013):

    # Creating a case_study household with one individual whose taxable income (salaire imposable, sali
    # varies from 0 to maxrev = 100000 in nmen = 3 steps

    simulation = ScenarioSimulation()

    simulation.set_config(year = 2013,
                          nmen = 11,
                          maxrev = 10000,
                          x_axis = 'sali')

    print simulation.scenario

    simulation.scenario.addIndiv(1, datetime.date(1975, 1, 1), 'conj', 'part')

    print simulation.scenario

    simulation.set_param()  # Va chercher la legislation par défaut

    df = simulation.get_results_dataframe()

    print df.to_string()

    print simulation.input_table.table.to_string()
    print simulation.output_table.table.to_string()
开发者ID:Jiss83,项目名称:openfisca-qt,代码行数:26,代码来源:toto.py

示例11: get_couple_results_dataframe

def get_couple_results_dataframe(sali_vous_maxrev = 12 * 4000, sali_conj = 12 * 4000, nmen = 11):

    # Creating a case_study household with one individual whose taxable income (salaire imposable, sali
    # varies from 0 to maxrev = 100000 in nmen = 11 steps
    simulation = ScenarioSimulation()
    simulation.set_config(year = 2013,
                          nmen = nmen,
                          maxrev = sali_vous_maxrev,
                          x_axis = 'sali')

    # Adding a husband/wife on the same tax sheet (ie foyer, as conj) and of course same family (as part)
    simulation.scenario.addIndiv(1, datetime.date(1975, 1, 1), 'conj', 'part')
    simulation.scenario.indiv[1]['sali'] = sali_conj

    # Set legislative parameters
    simulation.set_param()

    df = simulation.get_results_dataframe()

    df2 = df.transpose()[[u'Salaires imposables', u'Impôt sur le revenu']]
    df2[u'Salaires imposables vous'] = df2[u'Salaires imposables'] - sali_conj
    df2[u'Salaires imposables conj'] = sali_conj
    df2.rename(columns = {u'Impôt sur le revenu' : u'Impôt sur le revenu déclaration commune'},
               inplace = True) 

    df2 = df2.drop(u'Salaires imposables', axis=1)

    return df2
开发者ID:benjello,项目名称:quotient_familial,代码行数:28,代码来源:quotient_conjugal.py

示例12: test_af2

def test_af2():

    for yr in range(2006, 2010):
        print yr
        simulation = ScenarioSimulation()
        simulation.set_config(year = yr,
                              nmen = 2,
                              maxrev = 100000,
                              x_axis = 'sali')
        # Adding a husband/wife on the same tax sheet (foyer)
        simulation.scenario.addIndiv(1, datetime.date(1975, 1, 1),
                                     'conj', 'part')
        simulation.scenario.addIndiv(2, datetime.date(1975, 2, 2),
                                     'conj', 'part')
        simulation.set_param()
        # Adding children on the same tax sheet (foyer)
        simulation.scenario.addIndiv(3, datetime.date(2000, 1, 1),
                                     'pac', 'enf')
        simulation.scenario.addIndiv(4, datetime.date(2000, 1, 1),
                                     'pac', 'enf')
        df = simulation.get_results_dataframe(index_by_code = True)
#        print df.loc["af"][0]
#        print af_2enf[yr]
#        print type(df.loc["af"][0])
#        print type(af_2enf[yr])
#        print abs(df.loc["af"][0] - af_2enf[yr]) < 1e-3
        assert abs(df.loc["af"][0] - af_2enf[yr]) < 1e-3
开发者ID:Iliato,项目名称:openfisca-france,代码行数:27,代码来源:test_pfam.py

示例13: get_alloc

def get_alloc(maxrev = 10000, conj = False, nbenf = 0, zone_apl = 1, loyer_mensuel = 500, nmen = 51):

    # Creating a case_study household with one individual whose taxable income (salaire imposable, sali
    # varies from 0 to maxrev = 100000 in nmen = 3 steps
    simulation = ScenarioSimulation()
    simulation.set_config(year = 2013,
                          nmen = 11,
                          maxrev = maxrev,
                          x_axis = 'sali')


    scenario = simulation.scenario
    if conj:
    # Adding a husband/wife on the same tax sheet (ie foyer, as conj) and of course same family (as part)
        scenario.addIndiv(1, datetime.date(1975, 1, 1), 'conj', 'part')

    for i in range(nbenf):
    # Adding 3 kids on the same tax sheet and family
        scenario.addIndiv(2 + nbenf, datetime.date(2001, 1, 1), 'pac', 'enf')

    # Add caracteristics of menage
    scenario.menage[0]['loyer'] = loyer_mensuel
    scenario.menage[0]['zone_apl'] = zone_apl

    # Set legislative parameters
    simulation.set_param()

    # Compute the pandas dataframe of the household case_study
    df = simulation.get_results_dataframe()
    df2 = df.transpose()[['Salaires imposables', 'Prestations logement']]
    return df2
开发者ID:Jiss83,项目名称:openfisca-qt,代码行数:31,代码来源:alloc_logement.py

示例14: get_couple_with_child_results_datatframe

def get_couple_with_child_results_datatframe(sali_vous = 0, sali_conj = 0):
    simulation = ScenarioSimulation()
    simulation.set_config(year = 2013,
                          nmen = 1)

    # Adding a husband/wife on the same tax sheet (ie foyer, as conj) and of course same family (as part)
    simulation.scenario.addIndiv(1, datetime.date(1975, 1, 1), 'conj', 'part')

    # Adding 1 kids on the same tax sheet and family
    simulation.scenario.addIndiv(2, datetime.date(1993, 1, 1), 'pac', 'enf')

    # Changing the revenu of the parents
    scenario = simulation.scenario
    scenario.indiv[0]['sali'] = sali_vous
    scenario.indiv[1]['sali'] = sali_conj

    # Set the number of major kids in the
    scenario.declar[0]['nbJ'] = 1

    # Set legislative parameters
    simulation.set_param()

    # Compute the pandas dataframe of the household case_study
    df = simulation.get_results_dataframe()
    return df
开发者ID:Jiss83,项目名称:openfisca-qt,代码行数:25,代码来源:autonomie_des_jeunes.py

示例15: case_study

def case_study(year = 2013):
    
    simulation = ScenarioSimulation()
    simulation.set_config(year = year,
                          nmen = 20, 
                          maxrev = 20000,
                          x_axis = 'sali')
    scenario = simulation.scenario
    simulation.set_param() #legislation#
    scenario = simulation.scenario
    simulation.set_param()
    df = simulation.get_results_dataframe(index_by_code=True)

    print df.info()
    print df.to_string()
开发者ID:Jiss83,项目名称:RSA-PPEed,代码行数:15,代码来源:fusion_a_cc.py


注:本文中的openfisca_core.simulations.ScenarioSimulation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。