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)))
def test_cbind_squeeze(): """Check that trailing singleton dimensions are squeezed.""" recfun.cbind(np.tile(a, 2), np.tile(b, 2).reshape(2, 1))
def test_cbind_void(): """Check that ()-shaped arrays are OK.""" recfun.cbind(a[0], b[0])
def test_cbind_empty(): recfun.cbind()