numpy.vstack

Here are the examples of the python api numpy.vstack taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3053 Examples 7

3 Source : facenet.py
with MIT License
from 1024210879

def get_triplet_batch(triplets, batch_index, batch_size):
    ax, px, nx = triplets
    a = get_batch(ax, int(batch_size/3), batch_index)
    p = get_batch(px, int(batch_size/3), batch_index)
    n = get_batch(nx, int(batch_size/3), batch_index)
    batch = np.vstack([a, p, n])
    return batch

def get_learning_rate_from_file(filename, epoch):

3 Source : tograph.py
with MIT License
from 3dperceptionlab

    def __call__(self, sample):

        # Index finger
        graph_x_ = torch.tensor(np.vstack((sample['data_index'], sample['data_middle'], sample['data_thumb'])), dtype=torch.float).transpose(0, 1)
        graph_edge_index_ = torch.tensor([self.m_edge_origins, self.m_edge_ends], dtype=torch.long)
        graph_pos_ = torch.tensor(np.vstack((self.m_taxels_x, self.m_taxels_y, self.m_taxels_z)), dtype=torch.float).transpose(0, 1)
        graph_y_ = torch.tensor([sample['slipped']], dtype=torch.long)

        data_ = Data(x = graph_x_,
                    edge_index = graph_edge_index_,
                    pos = graph_pos_,
                    y = graph_y_)

        return data_

    def __repr__(self):

3 Source : Net_pg.py
with MIT License
from 93xiaoming

    def learn(self):
        discounted_ep_rs_norm = self._discount_and_norm_rewards()

        self.sess.run(self.train_op, feed_dict={
             self.tf_obs: np.vstack(self.ep_obs),  
             self.tf_acts: np.array(self.ep_as),  
             self.tf_vt: discounted_ep_rs_norm,  
        })

        self.ep_obs, self.ep_as, self.ep_rs = [], [], []  
        return discounted_ep_rs_norm

    def _discount_and_norm_rewards(self):

3 Source : Net_pg.py
with MIT License
from 93xiaoming

    def learn(self):
        discounted_ep_rs_norm = self._discount_and_norm_rewards()

        self.sess.run(self.train_op, feed_dict={
             self.tf_obs: np.vstack(self.ep_obs),  
             self.tf_acts: np.array(self.ep_as),  
             self.tf_vt: discounted_ep_rs_norm, 
        })

        self.ep_obs, self.ep_as, self.ep_rs = [], [], [] 
        return discounted_ep_rs_norm

    def _discount_and_norm_rewards(self):

3 Source : async_bo.py
with MIT License
from a5a

    def _add_completed_jobs_to_surrogate(self, completed_jobs):
        # TODO: test this
        x = []
        y = []
        for job in completed_jobs:
            x.append(job['x'])
            y.append(job['y'])
        x = np.vstack(x)
        y = np.vstack(y)
        self._update_surrogate_with_new_data(x, y)
        return x, y

    def plot_step(self, x_batch=None, save_plots=None, **kwargs):

3 Source : bayesopt.py
with MIT License
from a5a

    def _update_surrogate_with_new_data(self, new_sample_x, new_sample_y):

        if self.verbose > 1:
            print("Updating the surrogate model's data arrays")
        model_x, model_y = self.surrogate.X, self.surrogate.Y_raw
        new_x = np.vstack((model_x, new_sample_x))
        new_y = np.vstack((model_y, new_sample_y))
        self.surrogate.set_XY(X=new_x, Y=new_y)

    def run(self):

3 Source : executor.py
with MIT License
from a5a

    def get_array_of_running_jobs(self) -> np.ndarray:
        """Get a numpy array with each busy location in a row

        Returns
        -------
        numpy array of the busy locations stacked vertically
        """
        list_of_jobs = self.get_list_of_running_jobs()  # type:list
        if len(list_of_jobs) > 0:
            x_busy = np.vstack([job['x']
                                for job in list_of_jobs])
        else:
            x_busy = None

        return x_busy

    def get_list_of_running_jobs(self) -> List:

3 Source : utils.py
with MIT License
from AaltoML

def slice_array(A, arr):
    _A = []
    for a in arr:
        _A.append(A[a, :])
    return np.vstack(_A)

def slice_array_insert(A,B, arr):

3 Source : basegeom.py
with BSD 2-Clause "Simplified" License
from aarizat

    def __init__(self, coordinates):
        '''Method for initializing the attributes of the class.'''
        self.coords = coordinates
        self.boundCoords = np.vstack((coordinates, coordinates[0]))
        self.area()

    def area(self):

3 Source : loader.py
with MIT License
from aaronzguan

    def __init__(self, args):
        super(SurvFace_verification, self).__init__()
        self.root = _survface_root + 'Face_Verification_Test_Set/'
        self.image_root = self.root + 'verification_images/'
        pos = sio.loadmat(self.root + 'positive_pairs_names.mat')['positive_pairs_names']
        neg = sio.loadmat(self.root + 'negative_pairs_names.mat')['negative_pairs_names']
        self.image_files = np.vstack((pos, neg))
        self.labels = np.vstack((np.ones(len(pos)).reshape(-1, 1),
                                 np.zeros(len(neg)).reshape(-1, 1)))
        self.args = args

    def __getitem__(self, index):

3 Source : paican.py
with MIT License
from abojchevski

    def __sparse_feeder(self, M):
        """
        Transforms the sparse matrix M into a format suitable for Tensorflow's sparse placeholder.

        :param M: scipy.sparse.spmatrix
                Sparse matrix.
        :return: Indices of non-zero elements, their values, and the shape of the matrix
        """
        M = M.tocoo()
        return np.vstack((M.row, M.col)).T, M.data, M.shape

    def _em(self, sess):

3 Source : mob.py
with Apache License 2.0
from Accenture

def mixture_vote_aabb(aabbs, scores):
    score_box = score_vote_aabb(aabbs, scores)
    spatial_box = spatial_vote_aabb(aabbs, scores)
    mixture_box = np.vstack([score_box, spatial_box])
    return np.mean(mixture_box, axis=0)


def score_median_vote_aabb(aabbs, scores):

3 Source : mob.py
with Apache License 2.0
from Accenture

def score_median_vote_aabb(aabbs, scores):
    score_box = score_vote_aabb(aabbs, scores)
    median_box = median_aabb(aabbs, scores)
    mixture_box = np.vstack([score_box, median_box])
    return np.mean(mixture_box, axis=0)


select_merge = {

3 Source : check_docx_similarity.py
with MIT License
from Acciente717

def minhash_matrix_from_matrix(matrix, hash_cnt):
    vecs = []
    init_progress_bar(hash_cnt)
    BAR.start()
    for i in range(hash_cnt):
        vecs.append(minhash_vec_from_matrix(matrix))
        BAR.update(i)
    minhash_matrix = np.vstack(vecs)
    BAR.finish()
    return minhash_matrix


def similarity(vec1, vec2):

3 Source : KerasPredictor.py
with MIT License
from adines

    def predictBatch(self,images):
        preProcessor = self.model.preProcessor
        data=[]
        for image in images:
            imageProcessed = preProcessor(image)
            data.append(imageProcessed)
        dataStack=np.vstack(data)
        y_pred = self.model.deepModel.predict(dataStack)
        predictions=[]
        for pred in y_pred:
            predictions.append(np.expand_dims(pred,axis=0))
        return predictions

3 Source : internals.py
with GNU General Public License v3.0
from adityaprakash-bobby

def _vstack(to_stack, dtype):

    # work around NumPy 1.6 bug
    if dtype == _NS_DTYPE or dtype == _TD_DTYPE:
        new_values = np.vstack([x.view('i8') for x in to_stack])
        return new_values.view(dtype)

    else:
        return np.vstack(to_stack)


def _maybe_compare(a, b, op):

3 Source : test_nanops.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def test_nanvar_axis(self):
        # Generate some sample data.
        samples_norm = self.samples
        samples_unif = self.prng.uniform(size=samples_norm.shape[0])
        samples = np.vstack([samples_norm, samples_unif])

        actual_variance = nanops.nanvar(samples, axis=1)
        tm.assert_almost_equal(actual_variance, np.array(
            [self.variance, 1.0 / 12]), check_less_precise=2)

    def test_nanvar_ddof(self):

3 Source : _ode.py
with GNU General Public License v3.0
from adityaprakash-bobby

def _vode_banded_jac_wrapper(jacfunc, ml, jac_params):
    """
    Wrap a banded Jacobian function with a function that pads
    the Jacobian with `ml` rows of zeros.
    """

    def jac_wrapper(t, y):
        jac = asarray(jacfunc(t, y, *jac_params))
        padded_jac = vstack((jac, zeros((ml, jac.shape[1]))))
        return padded_jac

    return jac_wrapper


class vode(IntegratorBase):

3 Source : test_base.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def test_constructor4(self):
        # using (data, ij) format
        row = array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2])
        col = array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1])
        data = array([6., 10., 3., 9., 1., 4.,
                              11., 2., 8., 5., 7.])

        ij = vstack((row,col))
        csr = csr_matrix((data,ij),(4,3))
        assert_array_equal(arange(12).reshape(4,3),csr.todense())

    def test_constructor5(self):

3 Source : test_base.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def test_constructor4(self):
        # using (data, ij) format
        row = array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2])
        col = array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1])
        data = array([6., 10., 3., 9., 1., 4.,
                              11., 2., 8., 5., 7.])

        ij = vstack((row,col))
        csc = csc_matrix((data,ij),(4,3))
        assert_array_equal(arange(12).reshape(4,3),csc.todense())

    def test_constructor5(self):

3 Source : test_dd.py
with GNU General Public License v3.0
from adopy

def grid_design():
    # Amounts of rewards
    am_soon = [8, 12, 15, 17, 19, 22]
    am_late = [12, 15, 17, 19, 22, 23]

    amounts = np.vstack([(ams, aml)
                         for ams in am_soon for aml in am_late if ams   <   aml])

    # Delays
    t_ss = [0, 1, 2, 3, 5, 10, 20, 40]
    t_ll = [1, 2, 3, 5, 10, 20, 40, 80]

    delays = np.vstack([(ds, dl) for ds in t_ss for dl in t_ll if ds  <  dl])

    designs = {('t_ss', 't_ll'): delays, ('r_ss', 'r_ll'): amounts}
    return designs


@pytest.mark.parametrize('design_type', ['optimal', 'random'])

3 Source : dataloader.py
with MIT License
from adymaharana

    def __getitem__(self, item):

        img_id = self.ids[item]
        img_paths = [str(self.images[img_id])[2:-1]] + [str(self.followings[img_id][k])[2:-1] for k in range(0, self.video_len-1)]
        if self.out_dir is not None:
            images = [Image.open(os.path.join(self.out_dir, 'img-%s-%s.png' % (item, k))).convert('RGB') for k in range(self.video_len)]
        else:
            images = [self.sample_image(Image.open(os.path.join(self.img_folder, path)).convert('RGB')) for path in img_paths]
        labels = [self.labels[path.replace('.png', '').replace(self.img_folder + '/', '')] for path in img_paths]
        return torch.cat([self.transform(image).squeeze(0) for image in images], dim=0), torch.tensor(np.vstack(labels))

    def __len__(self):

3 Source : preprocess.py
with MIT License
from adymaharana

def encode_captions(data, token_to_idx, max_token_length):
    encoded_list = []
    lengths = []
    for img in data:
        for region in img['regions']:
            tokens = region['tokens']
            if tokens is None: continue
            tokens_encoded = encode_caption(tokens, token_to_idx, max_token_length)
            encoded_list.append(tokens_encoded)
            lengths.append(len(tokens)+2)
    return np.vstack(encoded_list), np.asarray(lengths, dtype=np.int64)  # in pytorch np.int64 is torch.long


def encode_boxes(data, image_data, all_image_ids):

3 Source : pororo_data.py
with MIT License
from adymaharana

    def __getitem__(self, item):

        img_id = self.ids[item]
        img_paths = [str(self.images[img_id])[2:-1]] + [str(self.followings[img_id][k])[2:-1] for k in range(0, self.video_len-1)]
        if self.out_dir is not None:
            images = [PIL.Image.open(os.path.join(self.out_dir, 'img-%s-%s.png' % (item, k))).convert('RGB') for k in range(self.video_len)]
        else:
            images = [self.sample_image(PIL.Image.open(os.path.join(self.img_folder, path)).convert('RGB')) for path in img_paths]
        labels = [self.labels[path.replace('.png', '').replace(self.img_folder + '/', '')] for path in img_paths]
        return torch.cat([self.transform(image).unsqueeze(0) for image in images], dim=0), torch.tensor(np.vstack(labels))
        #return self.transform(images), torch.tensor(np.vstack(labels))

    def __len__(self):

3 Source : pororo_data_const.py
with MIT License
from adymaharana

    def __getitem__(self, item):

        img_id = self.ids[item]
        img_paths = [str(self.images[img_id])[2:-1]] + [str(self.followings[img_id][k])[2:-1] for k in range(0, self.video_len-1)]
        if self.out_dir is not None:
            images = [PIL.Image.open(os.path.join(self.out_dir, 'img-%s-%s.png' % (item, k))).convert('RGB') for k in range(self.video_len)]
        else:
            images = [self.sample_image(PIL.Image.open(os.path.join(self.img_folder, path)).convert('RGB')) for path in img_paths]
        labels = [self.labels[path.replace('.png', '').replace(self.img_folder + '/', '')] for path in img_paths]
        # return torch.cat([self.transform(image).unsqueeze(0) for image in images], dim=0), torch.tensor(np.vstack(labels))
        return torch.stack([self.transform(im) for im in images]), torch.tensor(np.vstack(labels))

    def __len__(self):

3 Source : img.py
with MIT License
from afourast

def vstack_ims(ims, bg_color=(0, 0, 0)):
    if len(ims) == 0:
        return make(0, 0)

    max_w = max([im.shape[1] for im in ims])
    result = []
    for im in ims:
        #frame = np.zeros((im.shape[0], max_w, 3))
        frame = make(max_w, im.shape[0], bg_color)
        frame[:im.shape[0], :im.shape[1]] = rgb_from_gray(im)
        result.append(frame)
    return np.vstack(result)


def make_rgb(im):

3 Source : util.py
with MIT License
from afourast

def mult_ptm(A, ptm):
    new_ptm = np.dot(A, np.vstack(
        [ptm[:, :, 0].flatten(), ptm[:, :, 1].flatten(), ptm[:, :, 2].flatten()]))

    def r(x): return x.reshape(ptm.shape[:2])[:, :, np.newaxis]
    return np.concatenate(list(map(r, [new_ptm[0, :], new_ptm[1, :], new_ptm[2, :], ptm[:, :, 3].flatten()])), axis=2)


def mult_im(A, im):

3 Source : util.py
with MIT License
from afourast

def mult_im(A, im):
    new_im = np.dot(A, np.vstack(
        [im[:, :, 0].flatten(), im[:, :, 1].flatten(), im[:, :, 2].flatten()]))
    new_im = new_im.astype('d')
    def r(x): return x.reshape(im.shape[:2])[:, :, np.newaxis]
    return np.concatenate(list(map(r, [new_im[0, :], new_im[1, :], new_im[2, :]])), axis=2)

# def wait_for_nfs(max_wait = 60*30, test_file = '/data/vision/torralba/sun3d/sfm/scene/lounge/wg_1lounge/s3/RGBDsfm3477_cameraRt_rectify.mat'):


def wait_for_nfs(max_wait=60*30, test_file='/data/vision/billf/aho-stuff/vis/data/flickr2/v4-dset/3906219160/feat/0010_sf_tex.pk'):

3 Source : generate_goals.py
with MIT License
from AIcrowd

def checkMinSeparation(state):
    positions = np.vstack([state[obj][:3] for obj in state])
    if len(positions) > 1:
        distances = pairwise_distances(positions)
        clearance = distances[distances > 0].min()
    else:
        clearance = np.inf
    return clearance


def drawPosition(env, fixedOrientation=False, fixedObjects=[],

3 Source : imdb.py
with GNU General Public License v3.0
from ailabstw

  def merge_roidbs(a, b):
    assert len(a) == len(b)
    for i in range(len(a)):
      a[i]['boxes'] = np.vstack((a[i]['boxes'], b[i]['boxes']))
      a[i]['gt_classes'] = np.hstack((a[i]['gt_classes'],
                                      b[i]['gt_classes']))
      a[i]['gt_overlaps'] = scipy.sparse.vstack([a[i]['gt_overlaps'],
                                                 b[i]['gt_overlaps']])
      a[i]['seg_areas'] = np.hstack((a[i]['seg_areas'],
                                     b[i]['seg_areas']))
    return a

  def competition_mode(self, on):

3 Source : imdb.py
with MIT License
from aimuch

    def merge_roidbs(a, b):
        assert len(a) == len(b)
        for i in xrange(len(a)):
            a[i]['boxes'] = np.vstack((a[i]['boxes'], b[i]['boxes']))
            a[i]['gt_classes'] = np.hstack((a[i]['gt_classes'],
                                            b[i]['gt_classes']))
            a[i]['gt_overlaps'] = scipy.sparse.vstack([a[i]['gt_overlaps'],
                                                       b[i]['gt_overlaps']])
            a[i]['seg_areas'] = np.hstack((a[i]['seg_areas'],
                                           b[i]['seg_areas']))
        return a

    def competition_mode(self, on):

3 Source : video_metrics.py
with MIT License
from akzaidi

def compute_all_metrics_statistics(all_results):
  """Computes statistics of metrics across multiple decodings."""
  statistics = {}
  for key in all_results[0].keys():
    values = [result[key] for result in all_results]
    values = np.vstack(values)
    statistics[key + "_MEAN"] = np.mean(values, axis=0)
    statistics[key + "_STD"] = np.std(values, axis=0)
    statistics[key + "_MIN"] = np.min(values, axis=0)
    statistics[key + "_MAX"] = np.max(values, axis=0)
  return statistics


def compute_video_metrics_from_predictions(predictions):

3 Source : test_split.py
with BSD 3-Clause "New" or "Revised" License
from alan-turing-institute

def test_sliding_window_splitter(y, fh, window_length, step_length):
    """Test SlidingWindowSplitter."""
    cv = SlidingWindowSplitter(
        fh=fh,
        window_length=window_length,
        step_length=step_length,
        start_with_window=True,
    )
    train_windows, test_windows, _, n_splits = _check_cv(cv, y)

    assert np.vstack(train_windows).shape == (
        n_splits,
        _coerce_duration_to_int(duration=window_length, freq="D"),
    )
    assert np.vstack(test_windows).shape == (n_splits, len(check_fh(fh)))


def _args_are_all_of_the_same_type(*args) -> bool:

3 Source : test_split.py
with BSD 3-Clause "New" or "Revised" License
from alan-turing-institute

def test_expanding_window_splitter_start_with_empty_window(
    y, fh, initial_window, step_length
):
    """Test ExpandingWindowSplitter."""
    cv = ExpandingWindowSplitter(
        fh=fh,
        initial_window=initial_window,
        step_length=step_length,
        start_with_window=True,
    )
    train_windows, test_windows, _, n_splits = _check_cv(cv, y)
    assert np.vstack(test_windows).shape == (n_splits, len(check_fh(fh)))

    n_incomplete = _get_n_incomplete_windows(initial_window, step_length)
    train_windows = train_windows[n_incomplete:]
    _check_expanding_windows(train_windows)


@pytest.mark.parametrize("y", TEST_YS)

3 Source : test_split.py
with BSD 3-Clause "New" or "Revised" License
from alan-turing-institute

def test_expanding_window_splitter(y, fh, initial_window, step_length):
    """Test ExpandingWindowSplitter."""
    cv = ExpandingWindowSplitter(
        fh=fh,
        initial_window=initial_window,
        step_length=step_length,
        start_with_window=True,
    )
    train_windows, test_windows, _, n_splits = _check_cv(cv, y)
    assert np.vstack(test_windows).shape == (n_splits, len(check_fh(fh)))
    assert train_windows[0].shape[0] == _coerce_duration_to_int(
        duration=initial_window, freq="D"
    )
    _check_expanding_windows(train_windows)


@pytest.mark.parametrize("CV", [SlidingWindowSplitter, ExpandingWindowSplitter])

3 Source : _classes.py
with BSD 3-Clause "New" or "Revised" License
from alan-turing-institute

    def _evaluate_by_index(self, y_true, y_pred, multioutput, **kwargs):
        n = y_true.shape[0]
        out_series = pd.Series(index=y_pred.index)
        x_bar = self.evaluate(y_true, y_pred, multioutput, **kwargs)
        for i in range(n):
            out_series[i] = n * x_bar - (n - 1) * self.evaluate(
                np.vstack((y_true[:i, :], y_true[i + 1 :, :])),
                np.vstack((y_pred[:i, :], y_pred[i + 1 :, :])),
                multioutput,
            )
        return out_series


class PinballLoss(_BaseProbForecastingErrorMetric):

3 Source : imdb.py
with GNU General Public License v3.0
from AlbertoSabater

    def merge_roidbs(a, b):
        """
        merge roidbs into one
        :param a: roidb to be merged into
        :param b: roidb to be merged
        :return: merged imdb
        """
        assert len(a) == len(b)
        for i in range(len(a)):
            a[i]['boxes'] = np.vstack((a[i]['boxes'], b[i]['boxes']))
            a[i]['gt_classes'] = np.hstack((a[i]['gt_classes'], b[i]['gt_classes']))
            a[i]['gt_overlaps'] = np.vstack((a[i]['gt_overlaps'], b[i]['gt_overlaps']))
            a[i]['max_classes'] = np.hstack((a[i]['max_classes'], b[i]['max_classes']))
            a[i]['max_overlaps'] = np.hstack((a[i]['max_overlaps'], b[i]['max_overlaps']))
        return a

3 Source : computeBeatHisto.py
with MIT License
from alexanderlerch

def computeBeatHistoCl(cInPath, cOutPath):
    [f_s, afAudioData] = ToolReadAudio(cInPath)

    [T, Bpm] = computeBeatHisto(afAudioData, f_s)

    result = np.vstack((T, Bpm))

    np.savetxt(cOutPath, result)


if __name__ == "__main__":

3 Source : algorithm.py
with GNU General Public License v3.0
from alexgrusu

    def cb_push(self, x):
        """
        Pushes a sample in the circula buffer.
        :param x: input sample.
        """
        self.cb = np.vstack((x, self.cb[0 : self.cblen - 1]))
    
    def dot_product(self):

3 Source : liquidity_silos.py
with MIT License
from aloelabs

    def mint(self, amount0, amount1):
        in_uniswap = self.position.mint(
            amount0 * self.portion_in_uni,
            amount1 * self.portion_in_uni
        )
        in_silos = np.vstack((amount0, amount1)).T - in_uniswap
        assert in_silos.min() > 0, in_silos.min()

        if self.silos is None:
            self.silos = in_silos
        else:
            self.silos += in_silos

        return in_uniswap + in_silos

    def update(self, price):

3 Source : position_v2.py
with MIT License
from aloelabs

    def mint(self, amount0, amount1):
        value = np.minimum(amount0 * self._price, amount1)

        self._x += value / self._price
        self._y += value
        self._k = self._x * self._y

        return np.vstack((value / self._price, value)).T

3 Source : test_mlab.py
with MIT License
from alvarobartt

    def test_detrend_none_2D(self):
        arri = [self.sig_base,
                self.sig_base + self.sig_off,
                self.sig_base + self.sig_slope,
                self.sig_base + self.sig_off + self.sig_slope]
        input = np.vstack(arri)
        targ = input
        res = mlab.detrend_none(input)
        assert_array_equal(res, targ)

    def test_detrend_none_2D_T(self):

3 Source : test_mlab.py
with MIT License
from alvarobartt

    def test_detrend_none_2D_T(self):
        arri = [self.sig_base,
                self.sig_base + self.sig_off,
                self.sig_base + self.sig_slope,
                self.sig_base + self.sig_off + self.sig_slope]
        input = np.vstack(arri)
        targ = input
        res = mlab.detrend_none(input.T)
        assert_array_equal(res.T, targ)

    def test_detrend_mean_0D_zeros(self):

3 Source : test_mlab.py
with MIT License
from alvarobartt

    def test_detrend_mean_2D_default(self):
        arri = [self.sig_off,
                self.sig_base + self.sig_off]
        arrt = [self.sig_zeros,
                self.sig_base]
        input = np.vstack(arri)
        targ = np.vstack(arrt)
        res = mlab.detrend_mean(input)
        assert_allclose(res, targ, atol=1e-08)

    def test_detrend_mean_2D_none(self):

3 Source : test_mlab.py
with MIT License
from alvarobartt

    def test_detrend_mean_2D_none(self):
        arri = [self.sig_off,
                self.sig_base + self.sig_off]
        arrt = [self.sig_zeros,
                self.sig_base]
        input = np.vstack(arri)
        targ = np.vstack(arrt)
        res = mlab.detrend_mean(input, axis=None)
        assert_allclose(res, targ,
                        atol=1e-08)

    def test_detrend_mean_2D_none_T(self):

3 Source : test_mlab.py
with MIT License
from alvarobartt

    def test_detrend_mean_2D_none_T(self):
        arri = [self.sig_off,
                self.sig_base + self.sig_off]
        arrt = [self.sig_zeros,
                self.sig_base]
        input = np.vstack(arri).T
        targ = np.vstack(arrt)
        res = mlab.detrend_mean(input, axis=None)
        assert_allclose(res.T, targ,
                        atol=1e-08)

    def test_detrend_mean_2D_axis0(self):

3 Source : test_mlab.py
with MIT License
from alvarobartt

    def test_detrend_mean_2D_axis0(self):
        arri = [self.sig_base,
                self.sig_base + self.sig_off,
                self.sig_base + self.sig_slope,
                self.sig_base + self.sig_off + self.sig_slope]
        arrt = [self.sig_base,
                self.sig_base,
                self.sig_base + self.sig_slope_mean,
                self.sig_base + self.sig_slope_mean]
        input = np.vstack(arri).T
        targ = np.vstack(arrt).T
        res = mlab.detrend_mean(input, axis=0)
        assert_allclose(res, targ,
                        atol=1e-08)

    def test_detrend_mean_2D_axis1(self):

3 Source : test_mlab.py
with MIT License
from alvarobartt

    def test_detrend_mean_2D_axis1(self):
        arri = [self.sig_base,
                self.sig_base + self.sig_off,
                self.sig_base + self.sig_slope,
                self.sig_base + self.sig_off + self.sig_slope]
        arrt = [self.sig_base,
                self.sig_base,
                self.sig_base + self.sig_slope_mean,
                self.sig_base + self.sig_slope_mean]
        input = np.vstack(arri)
        targ = np.vstack(arrt)
        res = mlab.detrend_mean(input, axis=1)
        assert_allclose(res, targ,
                        atol=1e-08)

    def test_detrend_mean_2D_axism1(self):

3 Source : test_mlab.py
with MIT License
from alvarobartt

    def test_detrend_mean_2D_axism1(self):
        arri = [self.sig_base,
                self.sig_base + self.sig_off,
                self.sig_base + self.sig_slope,
                self.sig_base + self.sig_off + self.sig_slope]
        arrt = [self.sig_base,
                self.sig_base,
                self.sig_base + self.sig_slope_mean,
                self.sig_base + self.sig_slope_mean]
        input = np.vstack(arri)
        targ = np.vstack(arrt)
        res = mlab.detrend_mean(input, axis=-1)
        assert_allclose(res, targ,
                        atol=1e-08)

    def test_detrend_2D_default(self):

3 Source : test_mlab.py
with MIT License
from alvarobartt

    def test_detrend_2D_default(self):
        arri = [self.sig_off,
                self.sig_base + self.sig_off]
        arrt = [self.sig_zeros,
                self.sig_base]
        input = np.vstack(arri)
        targ = np.vstack(arrt)
        res = mlab.detrend(input)
        assert_allclose(res, targ, atol=1e-08)

    def test_detrend_2D_none(self):

See More Examples