Ejemplo n.º 1
0
# Licensed under the terms of the GVPLv3 or later license
# (see openfisca/__init__.py for details)

# Author: Victor Le Breton

from openfisca_core.simulations import SurveySimulation, Simulation, ScenarioSimulation
import os
from openfisca_core import model

from .common import load_content


if __name__ == "__main__":

    # Code pour tester save_content
    yr = 2006
    simulation = SurveySimulation()
    survey_filename = os.path.join(model.DATA_DIR, 'sources', 'test.h5')
    simulation.set_config(year=yr, survey_filename=survey_filename)
    simulation.set_param()
    simulation.compute()
    print simulation.__dict__.keys()

    print simulation.output_table.__dict__.keys()
    print 'done'
    simulation.save_content('testundeux', 'fichiertestundeux')

    a = load_content('testundeux', 'fichiertestundeux')
    print a.output_table.column_by_name
    print a.input_table.table['idfoy'][0:50]
Ejemplo n.º 2
0
            del bigtemp['table'], bigtemp['options']
            gc.collect()

if __name__ == '__main__':

    restart = True
    survey = 'survey.h5'
    save_path = os.path.join(model.DATA_DIR, 'erf')
    saved_simulation_filename = os.path.join(save_path,
                                             'debugger_' + survey[:-3])

    if restart:
        year = 2006
        simulation = SurveySimulation()
        if survey == 'survey.h5':
            survey_filename = os.path.join(model.DATA_DIR, survey)
        else:
            survey_filename = os.path.join(model.DATA_DIR, 'sources', survey)

        simulation.set_config(year=year, survey_filename=survey_filename)
        simulation.set_param()
        simulation.compute()
        simulation.save_content('debug', saved_simulation_filename)

    deb = Debugger()
    deb.set_simulation(name='debug', filename=saved_simulation_filename)
    deb.set_variable('af')
    deb.show_aggregates()
    deb.preproc()
    deb.describe_discrepancies(descending=False)
Ejemplo n.º 3
0
            print bigtemp['table'].to_string()
            del bigtemp['table'], bigtemp['options']
            gc.collect()

if __name__ == '__main__':

    restart = True
    survey = 'survey.h5'
    save_path = os.path.join(model.DATA_DIR, 'erf')
    saved_simulation_filename = os.path.join(save_path, 'debugger_' + survey[:-3])

    if restart:
        year = 2006
        simulation = SurveySimulation()
        if survey == 'survey.h5':
            survey_filename = os.path.join(model.DATA_DIR, survey)
        else:
            survey_filename = os.path.join(model.DATA_DIR, 'sources', survey)

        simulation.set_config(year=year, survey_filename=survey_filename)
        simulation.set_param()
        simulation.compute()
        simulation.save_content('debug', saved_simulation_filename)

    deb = Debugger()
    deb.set_simulation(name = 'debug', filename = saved_simulation_filename)
    deb.set_variable('af')
    deb.show_aggregates()
    deb.preproc()
    deb.describe_discrepancies(descending=False)