Пример #1
0
fun_to_test = [
                  {"times":100,"name":"hfd", "is_original":True,"fun": lambda x: pyeeg.hfd(x,2**3)},
                  {"times":100,"name":"hfd", "is_original":False,"fun": lambda x: univ.hfd(x,2**3)},
                  {"times":100,"name":"hjorth", "is_original":True,"fun": lambda x: pyeeg.hjorth(x)},
                  {"times":100,"name":"hjorth", "is_original":False,"fun": lambda x: univ.hjorth(x)},
                  {"times":100,"name":"pfd", "is_original":True, "fun":lambda x: pyeeg.pfd(x)},
                  {"times":100,"name":"pfd", "is_original":False, "fun":lambda x: pyeeg.pfd(x)},
                  {"times":2,"name":"samp_ent", "is_original":True, "fun":lambda x: pyeeg.samp_entropy(x,2,1.5)},
                  {"times":10,"name":"samp_ent", "is_original":False, "fun":lambda x: univ.samp_entropy(x,2,1.5,relative_r=False)},
                  {"times":2,"name":"ap_ent", "is_original":True, "fun":lambda x: pyeeg.ap_entropy(x,2,1.5)},
                  {"times":10,"name":"ap_ent", "is_original":False, "fun":lambda x: univ.ap_entropy(x,2,1.5)},
                  {"times":10,"name":"svd_ent", "is_original":True, "fun":lambda x: pyeeg.svd_entropy(x,2,3)},
                  {"times":100,"name":"svd_ent", "is_original":False, "fun":lambda x: univ.svd_entropy(x,2,3)},
                  {"times":10,"name":"fisher_info", "is_original":True, "fun":lambda x: pyeeg.fisher_info(x,2,3)},
                  {"times":100, "name":"fisher_info", "is_original":False, "fun":lambda x: univ.fisher_info(x,2,3)},
                  {"times":100,"name":"spectral_entropy", "is_original":True, "fun":lambda x: pyeeg.spectral_entropy(x,SPECT_ENT_BANDS,256)},
                  {"times":100, "name":"spectral_entropy", "is_original":False, "fun":lambda x: univ.spectral_entropy(x,256, SPECT_ENT_BANDS)},

    ]


def make_one_rep():
    ldfs = []
    for n in range(MIN_EPOCH_N, MAX_EPOCH_N + 1, EPOCH_STEP):
        a = numpy.random.normal(size=n)
        for fun in fun_to_test:
            f = lambda : fun["fun"](a)
            t=Timer(f)
            numb = fun["times"]
            dt = t.timeit(number=numb)
Пример #2
0
        "times": 100,
        "name": "svd_ent",
        "is_original": False,
        "fun": lambda x: univ.svd_entropy(x, 2, 3)
    },
    {
        "times": 10,
        "name": "fisher_info",
        "is_original": True,
        "fun": lambda x: pyeeg.fisher_info(x, 2, 3)
    },
    {
        "times": 100,
        "name": "fisher_info",
        "is_original": False,
        "fun": lambda x: univ.fisher_info(x, 2, 3)
    },
    {
        "times": 100,
        "name": "spectral_entropy",
        "is_original": True,
        "fun": lambda x: pyeeg.spectral_entropy(x, SPECT_ENT_BANDS, 256)
    },
    {
        "times": 100,
        "name": "spectral_entropy",
        "is_original": False,
        "fun": lambda x: univ.spectral_entropy(x, 256, SPECT_ENT_BANDS)
    },
]
Пример #3
0
    def test_fisher_information(self):
        ref = 0.0002986254447524082
        ans = univariate.fisher_info(white_noise, 10, 10)

        self.assertAlmostEqual(ref, ans)
Пример #4
0
    def test_fisher_information(self):
        ref = 0.0002986254447524082 
        ans = univariate.fisher_info(white_noise,10,10)

        self.assertAlmostEqual(ref, ans)