def test_skewness_ones(): nbins = 256 period = 10.0 # ms cc_amps = np.ones(nbins) # gamma should be a very small, negative number in this case gamma = skewness(cc_amps, period=period) assert -1.0e-10 < gamma < 0
def test_skewness_single(): nbins = 256 period = 10.0 cc_amps = np.zeros(nbins) cc_amps[nbins // 2] = 50 gamma = skewness(cc_amps, period=period) assert gamma == 0 # a completely symmetric deconvolution means gamma should be identically 0
def test_skewness_cluster_symmetric(): nbins = 256 period = 10.0 cc_amps = np.zeros(nbins) cc_amps[124:133] += 10 cc_amps[128] = 50 # gamma should be a number very close to zero gamma = skewness(cc_amps, period=period) assert abs(gamma) < 1.0e-8
def test_skewness_cluster_left_skew(): nbins = 256 period = 10.0 cc_amps = np.zeros(nbins) # dominate with one component, but have a significant number of non-zero components to the left cc_amps[124:133] += 10 cc_amps[132] = 200 # gamma should be a negative number less than -1 gamma = skewness(cc_amps, period=period) assert gamma < -1
def test_skewness_cluster_right_skew(): nbins = 256 period = 10.0 cc_amps = np.zeros(nbins) # dominate with one component, but have a significant number of non-zero components to the right cc_amps[124:133] += 10 cc_amps[125] = 200 # gamma should be a positive number greater than 1 gamma = skewness(cc_amps, period=period) assert gamma > 1