Skip to content

Commit

Permalink
Merge pull request #639 from Sichao25/debug_l
Browse files Browse the repository at this point in the history
Debug `dyn.pl.line_integral_conv()`
  • Loading branch information
Xiaojieqiu authored Dec 14, 2023
2 parents d1fa532 + 9e63b85 commit 629d581
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions dynamo/plot/scVectorField.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def line_integral_conv(
kernellen: float = 100,
V_threshold: Optional[float] = None,
vector: str = "velocity",
file: Optional[str] = None,
file: str = "vectorfield_LIC",
save_show_or_return: Literal["save", "show", "return"] = "show",
save_kwargs: Dict[str, Any] = {},
g_kwargs_dict: Dict[str, Any] = {},
Expand Down Expand Up @@ -625,8 +625,8 @@ def line_integral_conv(
if "VecFld_" + basis in adata.uns.keys():
# first check whether the sparseVFC reconstructed vector field exists
X_grid_, V_grid = (
adata.uns["VecFld_" + basis]["VecFld"]["grid"],
adata.uns["VecFld_" + basis]["VecFld"]["grid_V"],
adata.uns["VecFld_" + basis]["grid"],
adata.uns["VecFld_" + basis]["grid_V"],
)
N = int(np.sqrt(V_grid.shape[0]))
U_grid = np.reshape(V_grid[:, 0], (N, N)).T
Expand Down Expand Up @@ -697,10 +697,10 @@ def line_integral_conv(
slc.set_log("velocity_sum", False)

slc.annotate_velocity(normalize=normalize)
slc.annotate_streamlines("velocity_x", "velocity_y", density=density)
slc.annotate_streamlines(("gas", "velocity_x"), ("gas", "velocity_y"), density=density)
slc.annotate_line_integral_convolution(
"velocity_x",
"velocity_y",
("gas", "velocity_x"),
("gas", "velocity_y"),
lim=lim,
const_alpha=const_alpha,
kernellen=kernellen,
Expand All @@ -709,22 +709,17 @@ def line_integral_conv(
slc.set_xlabel(basis + "_1")
slc.set_ylabel(basis + "_2")

slc.show()

if file is not None:
# plt.rc('font', family='serif', serif='Times')
# plt.rc('text', usetex=True)
# plt.rc('xtick', labelsize=8)
# plt.rc('ytick', labelsize=8)
# plt.rc('axes', labelsize=8)
slc.save(file, mpl_kwargs={"figsize": [2, 2]})
if save_show_or_return in ["save", "both", "all"]:
slc.save(file, mpl_kwargs={"figsize": [2, 2]}, **save_kwargs)
if save_show_or_return in ["show", "both", "all"]:
slc.show()
if save_show_or_return in ["return", "all"]:
return slc
elif method == "lic":
# velocyto_tex = runlic(V_grid, V_grid, 100)
# plot_LIC_gray(velocyto_tex)
pass

return save_show_ret("line_integral_conv", save_show_or_return, save_kwargs, slc)


@docstrings.with_indent(4)
def cell_wise_vectors(
Expand Down

0 comments on commit 629d581

Please sign in to comment.