Example #1
0
orange = [1.,0.5,0.]
gray = [0.6, 0.6, 0.6]


# Generate data
N = 100
G = 100
alpha = 3
data_type = 'wide'


# Create new data or load old data
new_data = True
if new_data:
    # Simulate data and get default deft settings
    data, defaults = simulate_data_1d.run(data_type,N)

    pickle.dump( (data,defaults), open( "data.p", "wb" ) )

else:
    data, defaults = pickle.load(open("data.p","rb"))

# Set bounding box
bbox = [defaults['box_min'], defaults['box_max']]
L = bbox[1]-bbox[0]
h = 1.*L/G

# Create a variety of histograms
num_bins = [5,20,100]

plt.figure()
Example #2
0
# Colors to use
blue = [0.,0.,1.]
lightblue = [0.0, 0.5, 1.0]
orange = [1.,0.5,0.]
gray = [0.6, 0.6, 0.6]

# Plot histogram with density estimate on top
plt.figure(figsize=[ 11.55,  10.25])

num_rows = len(alphas)
num_cols = len(data_types)

for d, data_type in enumerate(data_types):

    data, settings = simulate_data_1d.run(data_type,N)
    box = [settings['box_min'], settings['box_max']]

    # Histogram data
    R, xs = utils.histogram_counts_1d(data, G, bbox=box, normalized=True)
    h = xs[1]-xs[0]

    for a, alpha in enumerate(alphas):

        ax = plt.subplot(num_rows, num_cols, num_cols*a + d + 1)

        # Get basis defining moments to constrain
        basis = utils.legendre_basis_1d(G,alpha)

        # Compute maxent distribution for histogram
        start_time = time.clock()