Exemple #1
0
def par2ph(par):
    """Parameter-to-phenotype mapping."""
    y0 = np.rec.array([(-0.5, -0.5)], dtype=[("V", float), ("W", float)])
    t = np.rec.fromarrays([np.arange(0, 1000, 0.1)], names="t")
    # Use .item() to convert between named and plain arrays
    y = scipy.integrate.odeint(fitzhugh, y0.item(), t.t, args=(par,))
    # Combine t and fields of y into one recarray with array-valued fields
    return restruct(cbind(t, y.view(y0.dtype)))
Exemple #2
0
def test_cbind_squeeze():
    """Check that trailing singleton dimensions are squeezed."""
    recfun.cbind(np.tile(a, 2), np.tile(b, 2).reshape(2, 1))
Exemple #3
0
def test_cbind_void():
    """Check that ()-shaped arrays are OK."""
    recfun.cbind(a[0], b[0])
Exemple #4
0
def test_cbind_empty():
    recfun.cbind()