using JSON
using StatsBase

include("./BayesianBlocks.jl")

function readJSON()
    open("./config_demos.json") do f
        r = JSON.parse(f)
        return r
    end
end



function tst_tecno()
    S = readJSON()
    x=readdlm(S["dat1"], '\n')
    x=x[:]
    println(typeof(x))
    edges_in = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]
    println(x)
    norm_hist = fit(Histogram, x, edges_in)
    # edges_norm = norm_hist.edges
    # counts_norm = norm_hist.weights
    # edges_bayes = bayesian_blocks(edges_norm, x)
    # bayes_hist = fir(Histogram, x, edges_bayes)
    # counts_bayes = bayes_hist.weights
    # println(counts_norm)
    # println(counts_bayes)
end
tst_tecno()
