Skip to content

Commit

Permalink
bug fix in plot_layout (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulf81 authored Apr 10, 2024
1 parent 9f741e3 commit 29270cb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions flasc/analysis/energy_ratio_heterogeneity_mapper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.spatial._qhull
from floris.utilities import wrap_360
from matplotlib.backends.backend_pdf import PdfPages
from scipy.interpolate import LinearNDInterpolator, NearestNDInterpolator
Expand Down Expand Up @@ -324,12 +325,17 @@ def plot_layout(self, ylim=[0.8, 1.2], plot_background_flow=False, pdf_save_path
)
x = x.flatten()
y = y.flatten()
lin_interpolant = LinearNDInterpolator(
points=np.vstack([df_hetmap_row["x"], df_hetmap_row["y"]]).T,
values=df_hetmap_row["speed_up"],
fill_value=np.nan,
)
lin_values = lin_interpolant(x, y)

try:
lin_interpolant = LinearNDInterpolator(
points=np.vstack([df_hetmap_row["x"], df_hetmap_row["y"]]).T,
values=df_hetmap_row["speed_up"],
fill_value=np.nan,
)
lin_values = lin_interpolant(x, y)
except scipy.spatial._qhull.QhullError:
logger.warning("QhullError occurred. Falling back to nearest neighbor. ")
lin_values = np.nan * np.ones_like(x)

nearest_interpolant = NearestNDInterpolator(
x=np.vstack([df_hetmap_row["x"], df_hetmap_row["y"]]).T,
Expand Down

0 comments on commit 29270cb

Please sign in to comment.