Example #1
0
def plot3D(data, width=700, height=500, pointSize=1.2, client=False):
    c3 = inlib.histo_c3d('xyz')
    [c3.fill(float(row[0]), float(row[1]), float(row[2]), 1) for row in data]

    #plotter
    if not client:
        plotter = window.gui_plotter(inlib.get_cout(), 1, 1, 0, 0, width,
                                     height)
    else:
        import inexlib_client
        style_file = os.path.join(os.environ['EXLIB_RES_DIR'], "ioda.style")
        plotter = inexlib_client.plotter(inlib.get_cout(), 1, 1, "127.0.0.1",
                                         50800, style_file)

#scen graph plotter
    sgp = plotter.plot_cloud3D(c3)
    sgp.shape.value(inlib.sg_plotter.xyz)
    sgp.shape_automated.value(False)
    sgp.infos_style().visible.value(False)
    sgp.points_style(0).color.value(inlib.colorf_black())
    #sgp.points_style(0).color.value(inlib.colorf_yellow())
    #sgp.points_style(0).modeling.value(inlib.modeling_points())
    sgp.points_style(0).marker_style.value(inlib.marker_dot)
    sgp.points_style(0).point_size.value(pointSize)

    if not client:
        plotter.show()
        plotter.steer()
    else:
        print("clearing scene")
        plotter.send_clear_static_scene()
        print("sending data to 127.0.0.1:50800 ...")
        plotter.send_plots()

    del plotter
    del c3
Example #2
0
parser.add_argument('-vis_host', dest='vis_host',required=False,help='host to display on')
parser.add_argument('-vis_port', dest='vis_port',required=False,help='port to display on')
parser.add_argument('-vis_format', dest='vis_format',required=False,help='format for output')
args = parser.parse_args(None)

file_name = args.file_name

verbose = False
if args.verbose == "True" : verbose = True

#////////////////////////////////////////////////////////////
#/// create and fill a 3D cloud with the csv file : /////////
#////////////////////////////////////////////////////////////
import inlib

c3 = inlib.histo_c3d('from csv')

import csv
file = open(file_name)
csv_reader = csv.reader(file, delimiter=',')
first_line = False
line_count = 0
for row in csv_reader:
  if 0 <= line_count : 
 #if 0 <= line_count and line_count < 180000 :
 #if 0 <= line_count and line_count < 360000 :
 #if 0 <= line_count and line_count < 540000 :
 #if 60000 <= line_count and line_count < 120000 :
 #if 120000 <= line_count and line_count < 180000 :
 #if 180000 <= line_count and line_count < 360000 :
 #if 360000 <= line_count and line_count < 540000 :
Example #3
0
              ", expected " + str(len_data_ref))
        exit()

    ntuple = data[0]

    #print("len(ntuple) : "+str(len(ntuple))+". Should be 2.")
    #print(ntuple[0].__class__.__name__)          # ndarray
    #print(ntuple[1].__class__.__name__)          # int
    #print("data[0][1] : "+str(ntuple[1])+". Should be 77.")

    #///////////////////////////////////////////////////////////////////////////////////////
    #/// plotting : /////////////////////////////////////////////////////////////////////////
    #///////////////////////////////////////////////////////////////////////////////////////
    import inlib

    c3 = inlib.histo_c3d('xyz')
    [
        c3.fill(ntuple[0][0], ntuple[0][1], ntuple[0][2], 1) for ntuple in data
        if ntuple[0] is not None
    ]

    #print("inlib::histo::c3d entries : "+str(c3.entries()))
    #print("  mean x = "+str(c3.mean_x())+", rms x = "+str(c3.rms_x()))
    #print("  mean y = "+str(c3.mean_y())+", rms y = "+str(c3.rms_y()))
    #print("  mean z = "+str(c3.mean_z())+", rms z = "+str(c3.rms_z()))

    if args.vis_mode == "window":
        #print("plot (window) ...")
        import window
        p = window.plotter(inlib.get_cout(), 1, 1, 0, 0, 700, 500)
        p.plot_cloud3D(c3)
Example #4
0
#//////////////////////////////////////////////////////////
c2 = inlib.histo_c2d('Rand gauss/BW')

rg = inlib.rgaussd(0, 1)
rbw = inlib.rbwd(0, 1)
for I in range(0, 10000):
    c2.fill(rg.shoot(), rbw.shoot(), 1)
del rg
del rbw

#print c2.entries(),c2.mean_y(),c2.rms_y()

#//////////////////////////////////////////////////////////
#/// create and fill a 3D cloud : /////////////////////////
#//////////////////////////////////////////////////////////
c3 = inlib.histo_c3d('Rand gauss/BW/gauss')

rg = inlib.rgaussd(0, 1)
rbw = inlib.rbwd(0, 1)
for I in range(0, number_of_points):
    c3.fill(rg.shoot(), rbw.shoot(), rg.shoot(), 1)
del rg
del rbw

if verbose == True:
    print("inlib::histo::c3d entries : " + str(c3.entries()))
    print("  mean x = " + str(c3.mean_x()) + ", rms x = " + str(c3.rms_x()))
    print("  mean y = " + str(c3.mean_y()) + ", rms y = " + str(c3.rms_y()))
    print("  mean z = " + str(c3.mean_z()) + ", rms z = " + str(c3.rms_z()))

#///////////////////////////////////////////////////////////////////////////////////////
    #file.close()
    #exit

    #///////////////////////////////////////////////////////////////////////////////////////
    #/// plottting : ///////////////////////////////////////////////////////////////////////
    #///////////////////////////////////////////////////////////////////////////////////////

    #print("fill c2d ...")
    #c2 = inlib.histo_c2d('radec')
    #[c2.fill(row[0],row[1],1) for row in data]

    #print("inlib::histo::c2d entries : "+str(c2.entries()))
    #print("  mean x = "+str(c2.mean_x())+", rms x = "+str(c2.rms_x()))
    #print("  mean y = "+str(c2.mean_y())+", rms y = "+str(c2.rms_y()))

    c3 = inlib.histo_c3d('radec_z')

    if do_cut == True:
        [fill_cut(c3, file, row[0], row[1], row[2]) for row in data]
    else:
        [c3.fill(row[0], row[1], row[2], 1) for row in data]

    #print("inlib::histo::c3d entries : "+str(c3.entries()))
    #print("  mean x = "+str(c3.mean_x())+", rms x = "+str(c3.rms_x()))
    #print("  mean y = "+str(c3.mean_y())+", rms y = "+str(c3.rms_y()))
    #print("  mean z = "+str(c3.mean_z())+", rms z = "+str(c3.rms_z()))

#print("fill h2d ...")
#h2 = inlib.histo_h2d('radec',100,0,360,100,-90,90)
#h2 = inlib.histo_h2d('radec',200,c2.mean_x()-2*c2.rms_x(),c2.mean_x()+2*c2.rms_x(),\
#                             200,c2.mean_y()-2*c2.rms_y(),c2.mean_y()+2*c2.rms_y())