示例#1
0
optimal_delay = nk.embedding_delay(signal, show=True)

# Save plot
fig = plt.gcf()
fig.set_size_inches(10, 6)
fig.savefig("README_embedding.png", dpi=300, h_pad=3)

nk.entropy_sample(signal)

# =============================================================================
# Statistics
# =============================================================================

x = np.random.normal(loc=0, scale=1, size=100000)

ci_min, ci_max = nk.hdi(x, ci=0.95, show=True)

# Save plot
fig = plt.gcf()
fig.set_size_inches(10 / 1.5, 6 / 1.5)
fig.savefig("README_hdi.png", dpi=300, h_pad=3)

# =============================================================================
# Popularity
# =============================================================================
import popularipy  # https://github.com/DominiqueMakowski/popularipy

downloads = popularipy.pypi_downloads("neurokit2")
stars = popularipy.github_stars("neuropsychology/neurokit",
                                "b547333010d0b1253ab44569df3efd94c8a93a63 ")
def extract_hdi(X):
    X = X.astype(float)
    ci_min, ci_max = nk.hdi(X, ci=0.95, show=True)
    hdi = np.array([ci_max, ci_min])
    return hdi