示例#1
0
def plot_histo(a_h, a_stop):

    import window
    p = window.plotter(inlib.get_cout(), 1, 1, 0, 0, 700, 500)
    p.plot_histo_cp(a_h)
    p.show()

    print('steer...')
    #p.steer() # it blocks input from the prompt (because threading module is not a truely thread system).

    import time
    while True:
        if a_stop() == True: break
        if p.sync() == False: break
        time.sleep(0.01)

    print('end steer.')
    del p

    import offscreen
    p = offscreen.plotter(inlib.get_cout(), 0, 0, 700, 500)
    p.plot_histo_cp(a_h)
    p.out_ps()
    p.out_zb_ps()
    p.out_bsg()
    del p
示例#2
0
#/// plotting : /////////////////////////////////////////////////////////////////////////
#///////////////////////////////////////////////////////////////////////////////////////

if args.vis_mode == "window" :
  if verbose == True : print("plot (window) ...")
  import window
  p = window.plotter(inlib.get_cout(),1,1,0,0,700,500)
  p.plot_cloud3D(c3)
  p.show()
  p.steer()
  del p
    
elif args.vis_mode == "offscreen" :
  if verbose == True : print("plot (offscreen) ...")
  import offscreen
  p = offscreen.plotter(inlib.get_cout(),1,1,400,400)
  p.plot_cloud3D(c3)
  if args.vis_format == "bsg":
    p.out_bsg('out_csv_c3d_vis.bsg')
  else:
    p.write_paper('out_csv_c3d_vis.ps','INZB_PS')
    p.write_paper('out_csv_c3d_vis.png','INZB_PNG')
  del p

elif args.vis_mode == "client" :
  if verbose == True : print("plot (client) ...")

  import inexlib_client
    
  style_file = "./res/ioda.style"
  p = inexlib_client.plotter(inlib.get_cout(),1,1,args.vis_host,int(args.vis_port),style_file)
示例#3
0
def tree_main():
    rfile = inlib.rroot_file(inlib.get_cout(), file, False)
    if rfile.is_open() == False:
        print("can't open file")
        return EXIT_FAILURE

    keys = rfile.dir().keys()
    #print('number of keys = ');print(keys.size())

    dir = inlib.rroot_find_dir(rfile.dir(), 'STAFF')
    if dir == None:
        print('directory not found')
        return EXIT_FAILURE

    key = dir.find_key('h10')
    if key == None:
        print('tree not found')
        return EXIT_FAILURE

    fac = inlib.rroot_fac(out)
    tree = inlib.rroot_key_to_tree(rfile, fac, key)
    if tree == None:
        print('key is not a tree.')
        return EXIT_FAILURE

    #tree.show(gv.out(),1)
    #print(tree.entries())

    leaf = tree.find_leaf("Age")
    if leaf == None:
        print('leaf not found.')
        return EXIT_FAILURE

    #print('leaf type : ');print(leaf.s_cls())

    li = inlib.rroot_cast_leaf_int(leaf)
    if leaf == None:
        print('leaf not a leaf<int>.')
        return EXIT_FAILURE

    branch = tree.find_leaf_branch(leaf)
    if branch == None:
        print('branch of leaf not found.')
        return EXIT_FAILURE

    h_age = inlib.histo_h1d('CERN/Age', 100, 0, 100)

    for i in range(0, tree.entries()):
        if branch.find_entry(rfile, i) == False:
            print('branch.find_entry failed.')
            return EXIT_FAILURE
        v = li.value(0)
        h_age.fill(v, 1)

    rfile.close()

    print(h_age.entries())
    print(h_age.mean())
    print(h_age.rms())

    #//////////////////////////////////////////////////
    #// plot : ////////////////////////////////////////
    #//////////////////////////////////////////////////

    if args.vis_mode == "offscreen":
        import offscreen
        p = offscreen.plotter(inlib.get_cout(), 1, 1, 700, 500)
        p.plot_histo(h_age)
        if args.vis_format == "bsg":
            p.out_bsg('out_tree.bsg')
        else:
            p.write_paper('out_tree.ps', 'INZB_PS')
            p.write_paper('out_tree.png', 'INZB_PNG')
        del p

    elif args.vis_mode == "client":
        import inexlib_client

        style_file = "./res/ioda.style"
        p = inexlib_client.plotter(inlib.get_cout(), 1, 1, args.vis_host,
                                   int(args.vis_port), style_file)
        p.plot_histo(h_age)

        #p.set_plotters_style("ROOT_default")
        if args.vis_host == "134.158.76.71":  #LAL/wallino.
            p.set_plotters_style("wall_ROOT_default")
        p.send_clear_static_scene()
        p.send_plots()
        del p

    else:
        import exlib_window as exlib
        gl2ps_mgr = exlib.sg_gl2ps_manager()
        smgr = exlib.session(inlib.get_cout())  # screen manager
        if smgr.is_valid() == True:
            plotter = exlib.plotter(smgr, 1, 1, 0, 0, 700, 500)
            if plotter.has_window() == True:
                sgp = plotter.plots().current_plotter()
                sgp.bins_style(0).color.value(inlib.colorf_blue())

                sgp.infos_style().font.value(inlib.font_arialbd_ttf())

                sgp.infos_x_margin.value(0.01)  #percent of plotter width.
                sgp.infos_y_margin.value(0.01)  #percent of plotter height.

                plotter.plot(h_age)

                plotter.plots().view_border.value(False)

                waction = exlib.sg_gl2ps_action(gl2ps_mgr, inlib.get_cout(),
                                                plotter.width(),
                                                plotter.height())
                waction.open('out.ps')
                plotter.sg().render(waction)
                waction.close()
                del waction

                plotter.show()

                plotter.steer()

            del plotter

        del smgr
示例#4
0
    sgp.y_axis_min.value(0)
    sgp.y_axis_max.value(y_max)
    p.next()
    sgp = p.plot_histo(h1_3)
    sgp.y_axis_automated.value(False)
    sgp.y_axis_min.value(0)
    sgp.y_axis_max.value(y_max)

    p.show()
    p.steer()
    del p

elif args.vis_mode == "offscreen":
    if verbose == True: print("plot (offscreen) ...")
    import offscreen
    p = offscreen.plotter(inlib.get_cout(), 2, 2, width, height)

    sgp = p.plot_histo(h1_0)
    sgp.y_axis_automated.value(False)
    sgp.y_axis_min.value(0)
    sgp.y_axis_max.value(y_max)
    p.next()
    sgp = p.plot_histo(h1_1)
    sgp.y_axis_automated.value(False)
    sgp.y_axis_min.value(0)
    sgp.y_axis_max.value(y_max)
    p.next()
    sgp = p.plot_histo(h1_2)
    sgp.y_axis_automated.value(False)
    sgp.y_axis_min.value(0)
    sgp.y_axis_max.value(y_max)
示例#5
0
              str(entries_ref))
        exit()

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

    if args.vis_mode == "window":
        import window
        p = window.plotter(inlib.get_cout(), 1, 1, 0, 0, 700, 500)
        p.plot_histo(h)
        p.show()
        p.steer()
        del p

    elif args.vis_mode == "offscreen":
        import offscreen
        p = offscreen.plotter(inlib.get_cout(), 0, 0, 700, 500)
        p.plot_histo(h)
        if args.vis_format == "bsg":
            p.out_bsg('out_spark_inlib_h1d_visbsg')
        else:
            p.write_paper('out_spark_inlib_h1d_vis.ps', 'INZB_PS')
            p.write_paper('out_spark_inlib_h1d_vis.png', 'INZB_PNG')
        del p

    elif args.vis_mode == "client":
        import inexlib_client
        style_file = "./res/ioda.style"
        p = inexlib_client.plotter(inlib.get_cout(), 1, 1, args.vis_host,
                                   int(args.vis_port), style_file)
        p.plot_histo(h)
        #print("send plots ...")