# Source code for deltasigma._delay

# -*- coding: utf-8 -*-
# _delay.py
# This module provides the delay function.
# Copyright 2013 Giuseppe Venturini
# This file is part of python-deltasigma.
#
# python-deltasigma is a 1:1 Python replacement of Richard Schreier's
# MATLAB delta sigma toolbox (aka "delsigma"), upon which it is heavily based.
# The delta sigma toolbox is (c) 2009, Richard Schreier.
#
# python-deltasigma is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# LICENSE file for the licensing terms.

"""This module provides the delay() function, used to delay a signal by a
specified amount of samples.
"""

import numpy as np

[docs]def delay(x, n=1):
"""Delay signal x by n samples.
"""
x = np.atleast_1d(x)
nx = max(x.shape)
if nx <= n:
y = np.zeros(x.shape)
else:
if len(x.shape) == 1:
y = np.concatenate((np.zeros((n,)), x[:nx-n]))
elif x.shape > x.shape:
y = np.concatenate((np.zeros((n, x.shape)), x[:nx-n, :]), axis=0)
else:
y = np.concatenate((np.zeros((x.shape, n)), x[:, :nx-n]), axis=1)
return y
{"ft_lang_label":"__label__en","ft_lang_prob":0.6354652,"math_prob":0.9453576,"size":1165,"snap":"2019-13-2019-22","text_gpt3_token_len":333,"char_repetition_ratio":0.11369509,"word_repetition_ratio":0.0,"special_character_ratio":0.32274678,"punctuation_ratio":0.21428572,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9912372,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-03-22T02:50:25Z\",\"WARC-Record-ID\":\"<urn:uuid:a468650d-32e8-4693-b23b-4332d2ae6a4a>\",\"Content-Length\":\"9195\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:9578dc62-538a-4594-9b19-aea3e5be8ff0>\",\"WARC-Concurrent-To\":\"<urn:uuid:ce1ab7a7-eec5-4faa-b686-16f36538b55a>\",\"WARC-IP-Address\":\"23.100.69.251\",\"WARC-Target-URI\":\"http://docs.python-deltasigma.io/en/latest/_modules/deltasigma/_delay.html\",\"WARC-Payload-Digest\":\"sha1:74HY3Q2APNFKYM3IUEW6MZIL2427CGAU\",\"WARC-Block-Digest\":\"sha1:IPWBQKN7ZSNQACH35JEB3ILGOTEYFDWT\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-13/CC-MAIN-2019-13_segments_1552912202589.68_warc_CC-MAIN-20190322014319-20190322040319-00289.warc.gz\"}"}