Пример #1
0
def runAmiciSimulations(
    model: AmiciModel,
    solver: AmiciSolver,
    edata_list: AmiciExpDataVector,
    failfast: bool = True,
    num_threads: int = 1,
) -> List['numpy.ReturnDataView']:
    """
    Convenience wrapper for loops of amici.runAmiciSimulation

    :param model: Model instance
    :param solver: Solver instance, must be generated from Model.getSolver()
    :param edata_list: list of ExpData instances
    :param failfast: returns as soon as an integration failure is encountered
    :param num_threads: number of threads to use (only used if compiled
        with openmp)

    :returns: list of simulation results
    """
    with capture_cstdout():
        edata_ptr_vector = amici.ExpDataPtrVector(edata_list)
        rdata_ptr_list = amici.runAmiciSimulations(solver.get(),
                                                   edata_ptr_vector,
                                                   model.get(), failfast,
                                                   num_threads)
    return [numpy.ReturnDataView(r) for r in rdata_ptr_list]
Пример #2
0
def runAmiciSimulations(model,
                        solver,
                        edata_list,
                        failfast=True,
                        num_threads=1):
    """ Convenience wrapper for loops of amici.runAmiciSimulation

    Arguments:
        model: Model instance
        solver: Solver instance, must be generated from Model.getSolver()
        edata_list: list of ExpData instances
        failfast: returns as soon as an integration failure is encountered
        num_threads: number of threads to use
                     (only used if compiled with openmp)

    Returns:
        list of ReturnData objects with simulation results

    Raises:

    """
    with capture_cstdout():
        edata_ptr_vector = amici.ExpDataPtrVector(edata_list)
        rdata_ptr_list = amici.runAmiciSimulations(solver.get(),
                                                   edata_ptr_vector,
                                                   model.get(), failfast,
                                                   num_threads)
    return [numpy.rdataToNumPyArrays(r) for r in rdata_ptr_list]
Пример #3
0
def runAmiciSimulation(
        model: AmiciModel,
        solver: AmiciSolver,
        edata: Optional[AmiciExpData] = None) -> 'numpy.ReturnDataView':
    """
    Convenience wrapper around :py:func:`amici.amici.runAmiciSimulation`
    (generated by swig)

    :param model:
        Model instance

`   :param solver:
        Solver instance, must be generated from
        :py:meth:`amici.amici.Model.getSolver`

    :param edata:
        ExpData instance (optional)

    :returns:
        ReturnData object with simulation results
    """

    with capture_cstdout():
        rdata = amici.runAmiciSimulation(_get_ptr(solver), _get_ptr(edata),
                                         _get_ptr(model))
    return numpy.ReturnDataView(rdata)
Пример #4
0
def runAmiciSimulation(
        model: AmiciModel,
        solver: AmiciSolver,
        edata: Optional[AmiciExpData] = None) -> 'numpy.ReturnDataView':
    """
    Convenience wrapper around amici.runAmiciSimulation (generated by swig)

    :param model: Model instance
`   :param solver: Solver instance, must be generated from Model.getSolver()
    :param edata: ExpData instance (optional)

    :returns: ReturnData object with simulation results
    """
    if edata and isinstance(edata, amici.ExpDataPtr):
        edata = edata.get()

    with capture_cstdout():
        rdata = amici.runAmiciSimulation(solver.get(), edata, model.get())
    return numpy.ReturnDataView(rdata)
Пример #5
0
def runAmiciSimulation(model, solver, edata=None):
    """ Convenience wrapper around amici.runAmiciSimulation (generated by swig)

    Arguments:
        model: Model instance
        solver: Solver instance, must be generated from Model.getSolver()
        edata: ExpData instance (optional)

    Returns:
        ReturnData object with simulation results

    Raises:

    """
    if edata and edata.__class__.__name__ == 'ExpDataPtr':
        edata = edata.get()

    with capture_cstdout():
        rdata = amici.runAmiciSimulation(solver.get(), edata, model.get())
    return rdataToNumPyArrays(rdata)