def create_til_simulation(capitalized_name = None, uniform_weight = None): assert capitalized_name is not None config = Config() name = capitalized_name.lower() input_dir = til_base_model_path input_file = '{}.h5'.format(capitalized_name) assert os.path.exists(os.path.join(input_dir, input_file)), 'Input file path should be {}'.format( os.path.join(input_dir, input_file)) output_dir = os.path.join(config.get('til', 'output_dir'), name) if not os.path.exists(output_dir): os.mkdir(output_dir) console_file = os.path.join(til_base_model_path, 'console.yml') simulation = TilSimulation.from_yaml( console_file, input_dir = input_dir, input_file = input_file, output_dir = output_dir, output_file = '{}_til_output.h5'.format(name), # tax_benefit_system = 'tax_benefit_system', # Add the OpenFisca TaxBenfitSystem to use ) if uniform_weight: simulation.uniform_weight = uniform_weight return simulation
def get_simulation(): config = Config() output_dir = config.get('til', 'output_dir') # output_dir = os.path.join(os.path.dirname(__file__), 'output'), console_file = os.path.join(path_model, 'console.yml') simulation = TilSimulation.from_yaml( console_file, input_dir = None, input_file = 'Patrimoine_next_200.h5', output_dir = output_dir, output_file = 'simul_long_2000.h5', ) return simulation