Exemple #1
0
def main():
    out_file = 'out_waxml.aida'
    writer = inlib.waxml_file()
    if writer.open(out_file) == False:
        print("can't open " + out_file)
        return EXIT_FAILURE

    entries = 1000000

    rg = inlib.rgaussd(1, 2)

    h = inlib.histo_h1d('Gauss', 100, -5, 5)
    for count in range(0, entries):
        h.fill(rg.shoot(), 1.4)
    if writer.write(h, '/histo', 'rg') == False:
        print("can't write h1d.")
        return EXIT_FAILURE
    del rg, h, count

    rg = inlib.rgaussd(1, 2)
    rbw = inlib.rbwd(0, 1)
    h = inlib.histo_p1d('Profile', 100, -5, 5, -2, 2)
    for count in range(0, entries):
        h.fill(rg.shoot(), rbw.shoot(), 1)
    if writer.write(h, '/histo', 'prof') == False:
        print("can't write prof.")
        return EXIT_FAILURE
    del rg, rbw, h, count

    rg = inlib.rgaussd(1, 2)
    rbw = inlib.rbwd(0, 1)
    h = inlib.histo_h2d('Gauss_BW', 20, -5, 5, 20, -2, 2)
    for count in range(0, entries):
        h.fill(rg.shoot(), rbw.shoot(), 0.8)
    if writer.write(h, '/histo', 'rgbw') == False:
        print("can't write h2d.")
        return EXIT_FAILURE
    del rg, rbw, h, count

    writer.close()
    del writer
    return EXIT_SUCCESS
Exemple #2
0
#//////////////////////////////////////////
#/// same as inlib/exa/hrand //////////////
#//////////////////////////////////////////

#//////////////////////////////////////////
#//////////////////////////////////////////
#//////////////////////////////////////////
import inlib

h1 = inlib.histo_h1d('The famous normal distribution', 100, -5, 5)

r = inlib.rgaussd(0, 1)
for I in range(0, 10000):
    h1.fill(r.shoot(), 1)

#print h1.entries(),h.mean(),h.rms()

h2 = inlib.histo_h2d('Gauss_BW', 100, -5, 5, 100, -2, 2)
rg = inlib.rgaussd(1, 2)
rbw = inlib.rbwd(0, 1)
for I in range(0, 10000):
    h2.fill(rg.shoot(), rbw.shoot(), 1)

#//////////////////////////////////////////////////////////
#/// plotting : ///////////////////////////////////////////
#//////////////////////////////////////////////////////////
import exlib_sg_view_Python as vp

viewer = inlib.cast_viewer(vp.get_viewer_string_pointer())
gv = inlib.cast_gui_viewer(viewer)
Exemple #3
0
# Copyright (C) 2010, Guy Barrand. All rights reserved.
# See the file exlib.license for terms.

import inlib

h = inlib.histo_h1d('Rand gauss',100,-5,5)

r = inlib.rgaussd(0,1)
for I in range(0,10000):
  h.fill(r.shoot(),1)

print(h.entries());print(h.mean());print(h.rms())

del r
del h