# Path: allantools/noise.py
# def numpy_psd(x, f_sample=1.0):
# def scipy_psd(x, f_sample=1.0, nr_segments=4):
# def white(num_points=1024, b0=1.0, fs=1.0):
# def brown(num_points=1024, b_minus2=1.0, fs=1.0):
# def violet(num_points=1024, b2=1, fs=1):
# def pink(num_points=1024, depth=80):
# def iterpink(depth=20):


import sys
import allantools as allan
import numpy
from allantools import noise
#!/usr/bin/python

sys.path.append("..")


def _test( function, data, rate, taus):

    (taus2,devs2,errs2,ns2) = function(data, rate=rate, taus=taus)
    assert( len(taus2) == len(devs2) )
    assert( len(taus2) == len(errs2) )
    assert( len(taus2) == len(ns2) )
    for n in ns2:
        if n<= 1:
            print("test of ", function, " failed: ", n)
        assert( n > 1 ) # n should be 2 or more for each tau
    print("test_ns of function ",function, " OK.")
    
def test_ns():
    
    # this test asks for results at unreasonable tau-values
    # either zero, not an integer multiple of the data-interval
    # or too large, given the length of the dataset
    N = 500
    rate = 1.0

# Path: allantools/noise.py
# def numpy_psd(x, f_sample=1.0):
# def scipy_psd(x, f_sample=1.0, nr_segments=4):
# def white(num_points=1024, b0=1.0, fs=1.0):
# def brown(num_points=1024, b_minus2=1.0, fs=1.0):
# def violet(num_points=1024, b2=1, fs=1):
# def pink(num_points=1024, depth=80):
# def iterpink(depth=20):


# Path: tests/functional_tests/test_ns.py
import sys
import allantools as allan
import numpy
from allantools import noise

#!/usr/bin/python

sys.path.append("..")


def _test( function, data, rate, taus):

    (taus2,devs2,errs2,ns2) = function(data, rate=rate, taus=taus)
    assert( len(taus2) == len(devs2) )
    assert( len(taus2) == len(errs2) )
    assert( len(taus2) == len(ns2) )
    for n in ns2:
        if n<= 1:
            print("test of ", function, " failed: ", n)
        assert( n > 1 ) # n should be 2 or more for each tau
    print("test_ns of function ",function, " OK.")
    
def test_ns():
    
    # this test asks for results at unreasonable tau-values
    # either zero, not an integer multiple of the data-interval
    # or too large, given the length of the dataset
    N = 500
    rate = 1.0

    phase_white = noise.white(N)