def test_Oval(): glyph = Oval() assert glyph.x == "x" assert glyph.y == "y" assert glyph.width == "width" assert glyph.height == "height" assert glyph.angle == "angle" yield check_fill, glyph yield check_line, glyph yield check_props, glyph, ["x", "y", "width", "height", "angle"], FILL, LINE
def test_Oval(): glyph = Oval() assert glyph.x is None assert glyph.y is None assert glyph.width is None assert glyph.height is None assert glyph.angle == 0 yield check_fill_properties, glyph yield check_line_properties, glyph yield (check_properties_existence, glyph, [ "x", "y", "width", "width_units", "height", "height_units", "angle", "angle_units", ], FILL, LINE, GLYPH)
def test_Oval() -> None: glyph = Oval() assert glyph.x == field("x") assert glyph.y == field("y") assert glyph.width is None assert glyph.height is None assert glyph.angle == 0 check_fill_properties(glyph) check_line_properties(glyph) check_properties_existence(glyph, [ "x", "y", "width", "width_units", "height", "height_units", "angle", "angle_units", ], FILL, LINE, GLYPH)
def create_plot(self): super().create_plot() self.plot.renderers[0].node_renderer.data_source.data['node'] = list( self.G.nodes()) self.plot.renderers[0].node_renderer.data_source.data[ 'node_data'] = self.y self.plot.renderers[0].node_renderer.glyph = Oval( height=0.08, width=0.08, fill_color=linear_cmap('node_data', self.palette, self.lo, self.hi)) if self.show_bar: cbar = ColorBar(color_mapper=LinearColorMapper( palette=self.palette, low=self.lo, high=self.hi), ticker=BasicTicker(), title=self.desc) self.plot.add_layout(cbar, 'right') self.plot.add_tools( HoverTool(tooltips=[(self.desc, '@node_data'), ('node', '@node')])) return self.plot
xdr = DataRange1d() ydr = DataRange1d() plot = Plot(title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300, h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None) glyph = Oval(x="x", y="y", width=0.4, height=0.6, angle=-0.7, fill_color="#1d91d0") plot.add_glyph(source, glyph) xaxis = LinearAxis() plot.add_layout(xaxis, 'below') yaxis = LinearAxis() plot.add_layout(yaxis, 'left') plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker)) plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker)) curdoc().add_root(plot)
ImageURL( x="x", y="y", w=0.4, h=0.4, url=dict( value="http://bokeh.pydata.org/en/latest/_static/images/logo.png" ), anchor="center")), ("line", Line(x="x", y="y", line_color="#F46D43")), ("multi_line", MultiLine(xs="xs", ys="ys", line_color="#8073AC", line_width=2)), ("oval", Oval(x="x", y="y", width=screen(15), height=screen(25), angle=-0.7, fill_color="#1D91C0")), ("patch", Patch(x="x", y="y", fill_color="#A6CEE3")), ("patches", Patches(xs="xs", ys="ys", fill_color="#FB9A99")), ("quad", Quad(left="x", right="xp01", top="y", bottom="ym01", fill_color="#B3DE69")), ("quadratic", Quadratic(x0="x", y0="y", x1="xp02", y1="y", cx="xp01", cy="yp01", line_color="#4DAF4A",
def rt_flight_radar(fs, center_freq, gain, N_samples, pos_ref, functions): #clear_output() #time.sleep(1) # create an input output FIFO queues Qin = queue.Queue() # create a pyaudio object sdr = RtlSdr() sdr.sample_rate = fs # sampling rate sdr.center_freq = center_freq # 1090MhZ center frequency sdr.gain = gain # initialize map # Berkeley (lat, lon) = (37.871853, -122.258423) (mx_d, my_d) = LatLonToMeters(pos_ref[0] - 0.2, pos_ref[1] - 0.2) (mx_u, my_u) = LatLonToMeters(pos_ref[0] + 0.2, pos_ref[1] + 0.2) plot = figure(x_range=(mx_d, mx_u), y_range=(my_d, my_u), x_axis_type="mercator", y_axis_type="mercator") plot.add_tile(get_provider('CARTODBPOSITRON')) plot.title.text = "Flight Radar" # create lat, longitude source source = ColumnDataSource( data=dict(lat=[], lon=[], heading=[], flightnum=[])) # create plane figure oval1 = Oval(x="lon", y="lat", width=3000, height=700, angle="heading", fill_color="blue", line_color="blue") oval2 = Oval(x="lon", y="lat", width=1000, height=7000, angle="heading", fill_color="blue", line_color="blue") text = Text(x="lon", y="lat", text_font_size="10pt", text="flightnum", angle="heading", text_color="red") plot.add_glyph(source, oval1) plot.add_glyph(source, oval2) plot.add_glyph(source, text) output_notebook() handle = show(plot, notebook_handle=True) # initialize write file log = open('rtadsb_log', 'a') # initialize stop_flag stop_flag = threading.Event() # initialize threads t_sdr_read = threading.Thread(target=sdr_read, args=(Qin, sdr, N_samples, stop_flag)) t_signal_process = threading.Thread(target=signal_process, args=(Qin, source, functions, plot, log, stop_flag)) # start threads t_sdr_read.start() t_signal_process.start() return stop_flag
def rt_flight_radar( fs, center_freq, gain, N_samples, pos_ref, functions ): #clear_output() #time.sleep(1) # create an input output FIFO queues Qin = Queue.Queue() # create a pyaudio object sdr = RtlSdr() sdr.sample_rate = fs # sampling rate sdr.center_freq = center_freq # 1090MhZ center frequency sdr.gain = gain # initialize map x_range = Range1d() y_range = Range1d() map_options = GMapOptions(lat=pos_ref[0], lng=pos_ref[1], zoom=10) plot = GMapPlot( title='Flight Radar', x_range=x_range, y_range=y_range, plot_width = 800, plot_height = 400, map_options=map_options ) # create lat, longitude source source = ColumnDataSource( data=dict( lat=[], lon=[], heading = [], flightnum = [] ) ) # create plane figure oval1 = Oval( x = "lon", y = "lat", width=3000, height=700, angle= "heading", fill_color="blue", line_color="blue") oval2 = Oval( x = "lon", y = "lat", width=1000, height=7000, angle= "heading", fill_color="blue", line_color="blue") text = Text( x = "lon", y = "lat", text_font_size="10pt", text="flightnum", angle= "heading", text_color="red") plot.add_glyph(source, oval1) plot.add_glyph(source, oval2) plot.add_glyph(source, text) # add tools to plot pan = PanTool() wheel_zoom = WheelZoomTool() resize = ResizeTool() plot.add_tools(pan, wheel_zoom, resize) xaxis = LinearAxis(axis_label="lat", major_tick_in=0) plot.add_layout(xaxis, 'below') yaxis = LinearAxis(axis_label="lon", major_tick_in=0) plot.add_layout(yaxis, 'left') handle = bk.show(plot) # initialize write file log = open('rtadsb_log','a',0) # initialize stop_flag stop_flag = threading.Event() # initialize threads t_sdr_read = threading.Thread(target = sdr_read, args = (Qin, sdr, N_samples, stop_flag )) t_signal_process = threading.Thread(target = signal_process, args = ( Qin, source, functions, plot, log, stop_flag)) # start threads t_sdr_read.start() t_signal_process.start() return stop_flag