How to use the amici.amici function in amici

To help you get started, we’ve selected a few amici 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 / AMICI / tests / testModels.py View on Github external
verify_simulation_results(
                        rdata, expected_results[subTest][case]['results'],
                        assert_fun, **verify_simulation_opts
                    )

                    if model_name == 'model_steadystate' and \
                            case == 'sensiforwarderrorint':
                        edata = amici.amici.ExpData(self.model.get())

                    if edata and model_name != 'model_neuron_o2' and not (
                        model_name == 'model_robertson' and
                        case == 'sensiforwardSPBCG'
                    ):
                        # Test runAmiciSimulations: ensure running twice
                        # with same ExpData yields same results
                        if isinstance(edata, amici.amici.ExpData):
                            edatas = [edata, edata]
                        else:
                            edatas = [edata.get(), edata.get()]

                        rdatas = amici.runAmiciSimulations(
                            self.model, self.solver, edatas, num_threads=2,
                            failfast=False
                        )
                        verify_simulation_results(
                            rdatas[0],
                            expected_results[subTest][case]['results'],
                            assert_fun, **verify_simulation_opts
                        )
                        verify_simulation_results(
                            rdatas[1],
                            expected_results[subTest][case]['results'],
github ICB-DCM / AMICI / python / amici / pandas.py View on Github external
model: Model instance.
        edata_list: list of ExpData instances with experimental data.
            May also be a single ExpData instance.
        rdata_list: list of ReturnData instances corresponding to ExpData.
            May also be a single ReturnData instance.
        by_id: bool, optional (default = False)
            If True, ids are used as identifiers, otherwise the possibly more
            descriptive names.

    Returns:
        pandas DataFrame with conditions and observables.

    Raises:

    """
    if isinstance(edata_list, (amici.amici.ExpData, amici.amici.ExpDataPtr)):
        edata_list = [edata_list]
    if isinstance(rdata_list, (amici.amici.ReturnData, amici.amici.ReturnDataPtr)):
        rdata_list = [rdata_list]

    # list of all column names using either names or ids
    cols = _get_extended_observable_cols(model, by_id=by_id)

    # initialize dataframe with columns
    df_rdata = pd.DataFrame(columns=cols)

    # append all converted rdatas
    for edata, rdata in zip(edata_list, rdata_list):
        for i_time, timepoint in enumerate(rdata['t']):
            datadict = {
                'time': timepoint,
                'datatype': 'simulation',
github ICB-DCM / AMICI / python / amici / pandas.py View on Github external
May also be a single ExpData instance.
        rdata_list: list of ReturnData instances corresponding to ExpData.
            May also be a single ReturnData instance.
        by_id: bool, optional (default = False)
            If True, ids are used as identifiers, otherwise the possibly more
            descriptive names.

    Returns:
        pandas DataFrame with conditions and observables.

    Raises:

    """
    if isinstance(edata_list, (amici.amici.ExpData, amici.amici.ExpDataPtr)):
        edata_list = [edata_list]
    if isinstance(rdata_list, (amici.amici.ReturnData, amici.amici.ReturnDataPtr)):
        rdata_list = [rdata_list]

    # list of all column names using either names or ids
    cols = _get_extended_observable_cols(model, by_id=by_id)

    # initialize dataframe with columns
    df_rdata = pd.DataFrame(columns=cols)

    # append all converted rdatas
    for edata, rdata in zip(edata_list, rdata_list):
        for i_time, timepoint in enumerate(rdata['t']):
            datadict = {
                'time': timepoint,
                'datatype': 'simulation',
            }
            # append simulations
github ICB-DCM / AMICI / python / amici / pandas.py View on Github external
Arguments:
        model: Model instance.
        edata_list: list of ExpData instances with experimental data.
            May also be a single ExpData instance.
        by_id: bool (optional, default = False)
            If True, uses observable ids as identifiers in dataframe,
            otherwise the possibly more descriptive observable names
            are used.

    Returns:
        pandas DataFrame with conditions and observables.

    Raises:

    """
    if isinstance(edata_list, (amici.amici.ExpData, amici.amici.ExpDataPtr)):
        edata_list = [edata_list]

    # list of all column names using either ids or names
    cols = _get_extended_observable_cols(model, by_id=by_id)

    # initialize dataframe with columns
    df_edata = pd.DataFrame(columns=cols)

    # append all converted edatas
    for edata in edata_list:
        npdata = ExpDataView(edata)
        for i_time, timepoint in enumerate(edata.getTimepoints()):
            datadict = {
                'time': timepoint,
                'datatype': 'data'
            }