예제 #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
예제 #2
0
파일: hrand.py 프로젝트: gbarrand/ioda
#//////////////////////////////////////////
#//////////////////////////////////////////
#//////////////////////////////////////////
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)

gv.show_console('h1 ' + str(h1.entries()) + ' ' + str(h1.mean()) + ' ' +
                str(h1.rms()))

plots = inlib.get_sg_plots(gv)