Hi I’m running a bokeh server application updating an image interactively. It loads reasonably quickly with a local connection but over a remote connection there is a delay of 20-50 seconds. Trying to understand what is going on. The array being plotted is 16bit 1408x1152 grayscale and is mapped to Inferno256. Saved as an image file it should be at most 5MB of data and given I can transfer files from the same server at 3MB/s I am only expecting a few seconds of delay from the remote factor. The figure itself is 1100x900 and using bokeh save tool results in a 1MB png.
figure initialization
p = figure(width=1100, height=900, x_range=(0.5, 11.5), y_range=(0.5, 9.5))
mapper = LinearColorMapper(palette=Inferno256, low=0)
source = ColumnDataSource({‘image’: np.arange(1408*1152).reshape((1152, 1408))})
r = p.image(image=‘image’, source=source, x=0.5, y=0.5, dw=11, dh=9, color_mapper=mapper)
color_bar = ColorBar(color_mapper=mapper, location=(0,0), ticker=BasicTicker()))
p.add_layout(color_bar, ‘right’)
``
update
stitching 1024 x 1024 images together then downsampling by factor of 8
stitch = np.zeros((11528, 14088))
for indx, path in s.iteritems():
img = skimage.io.imread(path)
j = indx % 9
i = indx // 9
stitch[j:j+1024, i:i+1024] = img
downsampling
stitch = skimage.measure.block_reduce(stitch, block_size=(8, 8), func=np.mean)
r.data_source.data = ColumnDataSource({‘image’: [stitch[::-1]]}).data
p.title.text = ‘%s’ % pd.Timestamp(‘now’).strftime(’%Y%m%d %H:%M:%S’)
print ‘done updating plot’, pd.Timestamp(‘now’)
``
This takes about 5 seconds to update on my server, ~2s to load images and downsample and ~3s to update the data. With a local connection on the server the figure will update momentarily. With a remote connection the update can be as long as 50seconds later