def test_hjorth(self): ans_activity, ans_morbidity, ans_complexity= univariate.hjorth(white_noise) ref_complexity = 1.2311281218979759 ref_morbidity = 1.4009964711379468 ref_activity = 1.0152445860000012 self.assertAlmostEqual(ref_complexity, ans_complexity) self.assertAlmostEqual(ref_morbidity, ans_morbidity) self.assertAlmostEqual(ref_activity, ans_activity)
def test_hjorth(self): ans_activity, ans_morbidity, ans_complexity = univariate.hjorth( white_noise) ref_complexity = 1.2311281218979759 ref_morbidity = 1.4009964711379468 ref_activity = 1.0152445860000012 self.assertAlmostEqual(ref_complexity, ans_complexity) self.assertAlmostEqual(ref_morbidity, ans_morbidity) self.assertAlmostEqual(ref_activity, ans_activity)
import numpy as np import sys MIN_EPOCH_N = 256 * 5 MAX_EPOCH_N = 256 * 30 EPOCH_STEP = 256 * 5 N_REPLICATES = 5 SPECT_ENT_BANDS = 2 ** np.arange(0,8)/2 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)}, ]
"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,