예제 #1
0
#!/usr/bin/env python3
"""Run PEtab test suite (https://github.com/PEtab-dev/petab_test_suite)"""
import logging
import os
import re
import shutil
import subprocess
import sys
from typing import List, Union

import petabtests
import pytest
from _pytest.outcomes import Skipped
from amici.logging import get_logger, set_log_level

logger = get_logger(__name__, logging.DEBUG)
set_log_level(get_logger("amici.petab_import"), logging.DEBUG)
stream_handler = logging.StreamHandler()
logger.addHandler(stream_handler)


def test_case(case: Union[int, str]) -> None:
    """Wrapper for _test_case for handling test outcomes"""
    try:
        _test_case(case)
    except Exception as e:
        if isinstance(e, NotImplementedError) \
                or "Timepoint-specific parameter overrides" in str(e):
            logger.info(f"Case {case} expectedly failed. "
                        "Required functionality is not yet "
                        f"implemented: {e}")
예제 #2
0
import shutil
import sys
import tempfile
from _collections import OrderedDict
from itertools import chain
from typing import List, Dict, Union, Optional, Tuple

import amici
import libsbml
import pandas as pd
import petab
import sympy as sp
from amici.logging import get_logger, log_execution_time, set_log_level
from petab.C import *

logger = get_logger(__name__, logging.WARNING)

# ID of model parameter that is to be added to SBML model to indicate
#  preequilibration
PREEQ_INDICATOR_ID = 'preequilibration_indicator'


def get_fixed_parameters(
        sbml_model: 'libsbml.Model',
        condition_df: Optional[pd.DataFrame] = None,
        const_species_to_parameters: bool = False) -> List[str]:
    """
    Determine, set and return fixed model parameters.

    Parameters specified in `condition_df` are turned into constants.
    Only global SBML parameters are considered. Local parameters are ignored.
예제 #3
0
"""

import argparse
import importlib
import logging
import os
import sys

import petab
import yaml
from amici.logging import get_logger
from amici.petab_objective import (simulate_petab, rdatas_to_measurement_df,
                                   LLH, RDATAS)
from petab.visualize import plot_petab_problem

logger = get_logger(f"amici.{__name__}", logging.WARNING)


def parse_cli_args():
    """Parse command line arguments

    Returns:
        Parsed CLI arguments from ``argparse``.
    """

    parser = argparse.ArgumentParser(
        description='Simulate PEtab-format model using AMICI.')

    # General options:
    parser.add_argument('-v',
                        '--verbose',