How to use the petab.core.get_optimization_to_simulation_parameter_mapping 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 / pypesto / petab_import / petab_import.py View on Github external
if model is None:
            model = self.create_model(force_compile=force_compile)
        # create solver
        if solver is None:
            solver = self.create_solver(model)
        # create conditions and edatas from measurement data
        if edatas is None:
            edatas = self.create_edatas(model=model)

        # simulation <-> optimization parameter mapping
        par_opt_ids = self.petab_problem.get_optimization_parameters()
        # take sim parameter vector from model to ensure correct order
        par_sim_ids = list(model.getParameterIds())

        parameter_mapping = \
            petab.core.get_optimization_to_simulation_parameter_mapping(
                condition_df=self.petab_problem.condition_df,
                measurement_df=self.petab_problem.measurement_df,
                parameter_df=self.petab_problem.parameter_df,
                sbml_model=self.petab_problem.sbml_model,
                par_opt_ids=par_opt_ids,
                par_sim_ids=par_sim_ids
            )

        scale_mapping = \
            petab.core.get_optimization_to_simulation_scale_mapping(
                parameter_df=self.petab_problem.parameter_df,
                mapping_par_opt_to_par_sim=parameter_mapping
            )

        # create objective
        obj = PetabAmiciObjective(
github ICB-DCM / pyPESTO / pypesto / petab / importer.py View on Github external
if hierarchical_problem.is_empty():
            calculator = simple_amici_calculate
        elif solver.getSensitivityMethod() == amici.SensitivityMethod_forward:
            calculator = HierarchicalForwardAmiciCalculator(
                hierarchical_problem)
        else:
            calculator = HierarchicalAdjointAmiciCalculator(
                hierarchical_problem)

        # simulation <-> optimization parameter mapping
        par_opt_ids = self.petab_problem.get_optimization_parameters()
        # take sim parameter vector from model to ensure correct order
        par_sim_ids = list(model.getParameterIds())

        parameter_mapping = \
            petab.core.get_optimization_to_simulation_parameter_mapping(
                condition_df=self.petab_problem.condition_df,
                measurement_df=self.petab_problem.measurement_df,
                parameter_df=self.petab_problem.parameter_df,
                sbml_model=self.petab_problem.sbml_model,
                par_sim_ids=par_sim_ids,
                simulation_conditions=simulation_conditions,
            )

        scale_mapping = \
            petab.core.get_optimization_to_simulation_scale_mapping(
                parameter_df=self.petab_problem.parameter_df,
                mapping_par_opt_to_par_sim=parameter_mapping
            )

        # check whether there is something suspicious in the mapping
        _check_parameter_mapping_ok(