Skip to content

Commit

Permalink
Merge pull request #3739 from neutrinoceros/lic_polar_fix
Browse files Browse the repository at this point in the history
BUG: fix a bug in masking invalid values in line integral convolution callback
  • Loading branch information
matthewturk authored Jan 11, 2022
2 parents e86179e + aecdb8f commit 9bc35d4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion yt/visualization/plot_modifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -3090,7 +3090,8 @@ def __call__(self, plot):
vectors = np.concatenate((pixX[..., np.newaxis], pixY[..., np.newaxis]), axis=2)

if self.texture is None:
self.texture = np.random.rand(nx, ny).astype(np.double)
prng = np.random.RandomState(0x4D3D3D3)
self.texture = prng.random_sample((nx, ny))
elif self.texture.shape != (nx, ny):
raise ValueError(
"'texture' must have the same shape "
Expand All @@ -3104,6 +3105,10 @@ def __call__(self, plot):
lic_data = lic_data / lic_data.max()
lic_data_clip = np.clip(lic_data, self.lim[0], self.lim[1])

mask = ~(np.isfinite(pixX) & np.isfinite(pixY))
lic_data[mask] = np.nan
lic_data_clip[mask] = np.nan

if self.const_alpha:
plot._axes.imshow(
lic_data_clip,
Expand Down

0 comments on commit 9bc35d4

Please sign in to comment.