# Path: hftools/py3compat.py
# PY3 = True
# 
# Path: hftools/dataset/dim.py
# class DimSweep(DiagAxis):
#     pass
# 
# class DimRep(DiagAxis):
#     sortprio = 1
# 
# class DimMatrix_i(_DimMatrix):
#     _indep_axis = DimMatrix_Indep_i
#     _deriv_axis = DimMatrix_Deriv_i
#     sortprio = 1000
# 
# class DimMatrix_j(_DimMatrix):
#     _indep_axis = DimMatrix_Indep_j
#     _deriv_axis = DimMatrix_Deriv_j
#     sortprio = 1001
# 
# Path: hftools/dataset/arrayobj.py
# class hfarray(_hfarray):
#     def __new__(subtype, data, dims=None, dtype=None, copy=True, order=None,
#                 subok=False, ndmin=0, unit=None, outputformat=None, info=None):
#         if hasattr(data, "__hfarray__"):
#             data, dims = data.__hfarray__()
#             if unit is None and len(dims) == 1:
#                 unit = dims[0].unit
#             if outputformat is None and len(dims) == 1:
#                 outputformat = dims[0].outputformat
#         return _hfarray.__new__(subtype, data, dims=dims, dtype=dtype,
#                                 copy=copy, order=order, subok=subok,
#                                 ndmin=ndmin, unit=unit,
#                                 outputformat=outputformat, info=info)
# 
# Path: hftools/utils.py
# def reset_hftools_warnings():
# def timestamp(highres=False):
# def warn(msg):
# def deprecate(msg):
#     def isnumber(x):
#     def isrealnumber(x):
#     def isnumber(x):
#     def isrealnumber(x):
# def is_numlike(a):
# def is_integer(a):
# def to_numeric(value, error=True):
# def stable_uniq(data):
# def uniq(data):
# def chop(x, rtol=1e-9, atol=1e-15):
# def make_dirs(*pathsegments):
# def split_num(string):
# def lex_order(lista):
# def glob(pat):
#     def beep(freq=None, duration=50):
#     def beep(freq=None, duration=50):
# def flatten(lista):


import doctest
import random
import warnings
import unittest
import numpy as np
from hftools.py3compat import PY3
from unittest import skip, expectedFailure
from numpy.random import randint, normal
from hftools.dataset import hfarray, DimSweep, DimRep, DimMatrix_i,\
    DimMatrix_j
from hftools.utils import HFToolsWarning, HFToolsDeprecationWarning
#    warnings.simplefilter("error", DeprecationWarning)

    def load_tests(loader, standard_tests, pattern):
        suite = unittest.TestSuite()
        suite.addTests(standard_tests)
        DocTests = doctest.DocTestSuite(module)
        suite.addTests(DocTests)
        return suite
    return load_tests

##
## Random numpy arrays


def _random_array(shape):
    return normal(size=shape)


def random_array(N, maxsize=6, minsize=1):
    shape = tuple(x.data.shape[0] for x in random_dims(N, maxsize, minsize))
    return _random_array(shape)


def random_complex_array(N, maxsize=6, minsize=1):
    shape = tuple(x.data.shape[0] for x in random_dims(N, maxsize, minsize))
    return _random_array(shape) + _random_array(shape) * 1j


def random_value_array_from_dims(dims, mean=0, scale=1):
    shape = tuple(dim.data.shape[0] for dim in dims)

# Path: hftools/py3compat.py
# PY3 = True
# 
# Path: hftools/dataset/dim.py
# class DimSweep(DiagAxis):
#     pass
# 
# class DimRep(DiagAxis):
#     sortprio = 1
# 
# class DimMatrix_i(_DimMatrix):
#     _indep_axis = DimMatrix_Indep_i
#     _deriv_axis = DimMatrix_Deriv_i
#     sortprio = 1000
# 
# class DimMatrix_j(_DimMatrix):
#     _indep_axis = DimMatrix_Indep_j
#     _deriv_axis = DimMatrix_Deriv_j
#     sortprio = 1001
# 
# Path: hftools/dataset/arrayobj.py
# class hfarray(_hfarray):
#     def __new__(subtype, data, dims=None, dtype=None, copy=True, order=None,
#                 subok=False, ndmin=0, unit=None, outputformat=None, info=None):
#         if hasattr(data, "__hfarray__"):
#             data, dims = data.__hfarray__()
#             if unit is None and len(dims) == 1:
#                 unit = dims[0].unit
#             if outputformat is None and len(dims) == 1:
#                 outputformat = dims[0].outputformat
#         return _hfarray.__new__(subtype, data, dims=dims, dtype=dtype,
#                                 copy=copy, order=order, subok=subok,
#                                 ndmin=ndmin, unit=unit,
#                                 outputformat=outputformat, info=info)
# 
# Path: hftools/utils.py
# def reset_hftools_warnings():
# def timestamp(highres=False):
# def warn(msg):
# def deprecate(msg):
#     def isnumber(x):
#     def isrealnumber(x):
#     def isnumber(x):
#     def isrealnumber(x):
# def is_numlike(a):
# def is_integer(a):
# def to_numeric(value, error=True):
# def stable_uniq(data):
# def uniq(data):
# def chop(x, rtol=1e-9, atol=1e-15):
# def make_dirs(*pathsegments):
# def split_num(string):
# def lex_order(lista):
# def glob(pat):
#     def beep(freq=None, duration=50):
#     def beep(freq=None, duration=50):
# def flatten(lista):


# Path: hftools/testing/common.py
import doctest
import random
import warnings
import unittest
import numpy as np
from hftools.py3compat import PY3
from unittest import skip, expectedFailure
from numpy.random import randint, normal
from hftools.dataset import hfarray, DimSweep, DimRep, DimMatrix_i,\
    DimMatrix_j
from hftools.utils import HFToolsWarning, HFToolsDeprecationWarning

#    warnings.simplefilter("error", DeprecationWarning)

    def load_tests(loader, standard_tests, pattern):
        suite = unittest.TestSuite()
        suite.addTests(standard_tests)
        DocTests = doctest.DocTestSuite(module)
        suite.addTests(DocTests)
        return suite
    return load_tests

##
## Random numpy arrays


def _random_array(shape):
    return normal(size=shape)


def random_array(N, maxsize=6, minsize=1):
    shape = tuple(x.data.shape[0] for x in random_dims(N, maxsize, minsize))
    return _random_array(shape)


def random_complex_array(N, maxsize=6, minsize=1):
    shape = tuple(x.data.shape[0] for x in random_dims(N, maxsize, minsize))
    return _random_array(shape) + _random_array(shape) * 1j


def random_value_array_from_dims(dims, mean=0, scale=1):
    shape = tuple(dim.data.shape[0] for dim in dims)

    return hfarray(normal(size=shape) * scale + mean, dims)