示例#1
0
文件: basic.py 项目: argju/cgptoolbox
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)))
示例#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))
示例#3
0
def test_cbind_void():
    """Check that ()-shaped arrays are OK."""
    recfun.cbind(a[0], b[0])
示例#4
0
def test_cbind_empty():
    recfun.cbind()