Replace interp2d with griddata

This commit is contained in:
usov_i 2022-01-03 16:02:29 +01:00
parent aaff6032c8
commit a719f10f4f

View File

@ -4,7 +4,6 @@ import itertools
import os import os
import tempfile import tempfile
import types import types
import warnings
import numpy as np import numpy as np
from bokeh.io import curdoc from bokeh.io import curdoc
@ -344,16 +343,13 @@ def create():
ov_param_plot_scatter_source.data.update(x=x, y=y, param=par) ov_param_plot_scatter_source.data.update(x=x, y=y, param=par)
try: try:
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=RuntimeWarning)
interp_f = interpolate.interp2d(x, y, par)
x1, x2 = min(x), max(x) x1, x2 = min(x), max(x)
y1, y2 = min(y), max(y) y1, y2 = min(y), max(y)
image = interp_f( grid_x, grid_y = np.meshgrid(
np.linspace(x1, x2, ov_param_plot.inner_width // 10), np.linspace(x1, x2, ov_param_plot.inner_width // 10),
np.linspace(y1, y2, ov_param_plot.inner_height // 10), np.linspace(y1, y2, ov_param_plot.inner_height // 10),
assume_sorted=True,
) )
image = interpolate.griddata((x, y), par, (grid_x, grid_y))
ov_param_plot_image_source.data.update( ov_param_plot_image_source.data.update(
image=[image], x=[x1], y=[y1], dw=[x2 - x1], dh=[y2 - y1] image=[image], x=[x1], y=[y1], dw=[x2 - x1], dh=[y2 - y1]
) )