def s2n(self, trial): b = numpy.array(trial) u = numpy.ndarray(b.shape) if len(b.shape) == 1: u = oli.s2n(b, tmpdir=self.get_workdir()) elif len(b.shape) == 2: rows, columns = b.shape for c in range(columns): u[:, c] = oli.s2n(b[:, c], tmpdir=self.get_workdir()) else: raise TypeError return u
def get_overlap_diagonal(self, filename=None): if filename is None: filename = os.path.join(self.get_workdir(), "SIRIFC") ifc = sirifc.SirIfc(filename) n = 2 * ifc.nwopt sd = numpy.array([ oli.s2n(c, tmpdir=self.get_workdir()) for c in numpy.eye(n) ]).diagonal() return sd
def test_s2n_S(): refs2 = matrix.diag([1, -1]) s2 = init([oli.s2n(n, tmpdir=suppdir) for n in unit(2)]) assert_(s2, refs2)
def test_s2n_S(): refs2 = matrix.diag([2., -2.]) s2 = [oli.s2n(n, tmpdir=suppdir) for n in unit(2)] assert_(s2, refs2)
def get_overlap_diagonal(self, filename=None): n = self.response_dim() sd = np.array([ oli.s2n(c, tmpdir=self.get_workdir()) for c in np.eye(n) ]).diagonal() return sd