Skip to content

Instantly share code, notes, and snippets.

get_svg = function(f){
let c = f.canvas.clone();
let v = new c.default_view({model:c});
f.canvas_view = v;
f.force_paint.emit();
return v._ctx.getSerializedSvg();
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import cv2
import numpy as np
import time
from collections import deque
vc = cv2.VideoCapture("rtsp://192.168.0.50:8080/h264_ulaw.sdp")
avg_buf = np.zeros((10, 600, 800, 3), float)
avg = np.zeros((600, 800, 3), float)
index = 0
digraph g {
graph [
rankdir = "LR"
];
node [
fontsize = "16"
shape = "ellipse"
];
edge [
];
@ruoyu0088
ruoyu0088 / bokeh_subprocess_test.py
Created May 12, 2018 04:23
a demo for zmq process with bokeh server
from os import path
from bokeh.models import Button, Div
from bokeh.layouts import column
from bokeh.document import without_document_lock
from bokeh.io import curdoc
from zmq_subprocess import ZmqSubProcessClient
ok_button = Button(label="ok")
div = Div()
def make_quiver(fig, x, y, u, v, scale_uv=None, arrow_size=5):
import numpy as np
from bokeh.models import ColumnDataSource, CustomJSTransform, CustomJS
from bokeh.transform import field
x, y, u, v = (np.asanyarray(arr).ravel() for arr in (x, y, u, v))
if scale_uv is None:
from scipy.spatial.distance import pdist, squareform
mean_dist = np.mean(np.sort(squareform(pdist(np.c_[x, y])), axis=1)[:, 1])
max_len = np.max(np.hypot(u, v))
from os import path
from bokeh.application.handlers import code_runner
def run(self, module, post_check):
import ast
if path.exists(self._path):
with open(self._path, 'r') as f:
source = f.read()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
from bokeh.io import show, output_notebook
from bokeh.plotting import figure
from bokeh import events
from bokeh.models import CustomJS, ColumnDataSource
output_notebook()
import pandas as pd
time1 = pd.date_range("2018/01/01", "2018/01/05", freq="h")