How to use the petab.Problem.from_yaml function in petab

To help you get started, we’ve selected a few petab examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ICB-DCM / pyPESTO / test / test_amici_objective.py View on Github external
def test_error_leastsquares_with_ssigma():
    petab_problem = petab.Problem.from_yaml(
        folder_base + "Zheng_PNAS2012/Zheng_PNAS2012.yaml")
    petab_problem.model_name = "Zheng_PNAS2012"
    importer = pypesto.PetabImporter(petab_problem)
    obj = importer.create_objective()
    problem = importer.create_problem(obj)

    optimizer = pypesto.ScipyOptimizer('ls_trf', options={'max_nfev': 50})
    with pytest.raises(RuntimeError):
        pypesto.minimize(
            problem=problem, optimizer=optimizer, n_starts=1,
            options=pypesto.OptimizeOptions(allow_failed_starts=False)
        )
github ICB-DCM / pyPESTO / test / test_modelselection.py View on Github external
def test_row2problem_yaml_string(yaml_file_example):
    petab_problem = petab.Problem.from_yaml(yaml_file_example)

    importer = PetabImporter(petab_problem)
    obj = importer.create_objective()
    pypesto_problem = importer.create_problem(obj)

    row = pd.Series()
    assert row2problem(row, yaml_file_example) == pypesto_problem
github ICB-DCM / pyABC / test / petab / test_petab_suite.py View on Github external
solution = petabtests.load_solution(case)
    gt_chi2 = solution[petabtests.CHI2]
    gt_llh = solution[petabtests.LLH]
    gt_simulation_dfs = solution[petabtests.SIMULATION_DFS]
    tol_chi2 = solution[petabtests.TOL_CHI2]
    tol_llh = solution[petabtests.TOL_LLH]
    tol_simulations = solution[petabtests.TOL_SIMULATIONS]

    # unique folder for compiled amici model
    output_folder = f'amici_models/model_{case}'

    # import petab problem
    yaml_file = os.path.join(case_dir, petabtests.problem_yaml_name(case))

    # create problem
    petab_problem = petab.Problem.from_yaml(yaml_file)

    # compile amici
    amici_model = amici.petab_import.import_petab_problem(
        petab_problem=petab_problem,
        model_output_dir=output_folder)
    solver = amici_model.getSolver()

    # import to pyabc
    importer = pyabc.petab.AmiciPetabImporter(
        petab_problem, amici_model, solver)
    model = importer.create_model(return_rdatas=True)

    # simulate
    problem_parameters = petab_problem.x_nominal_free_scaled
    ret = model(problem_parameters)