Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor VectorField() function #620

Merged
merged 8 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dynamo/plot/scVectorField.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
velocity_on_grid,
)
from ..tools.utils import update_dict
from ..vectorfield.topography import VectorField
from ..vectorfield.VectorField import VectorField
from ..vectorfield.utils import vecfld_from_adata
from .scatters import docstrings, scatters, scatters_interactive
from .utils import (
Expand Down
20 changes: 10 additions & 10 deletions dynamo/plot/topography.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
from ..tools.utils import nearest_neighbors, update_dict
from ..vectorfield.scVectorField import BaseVectorField
from ..vectorfield.topography import ( # , compute_separatrices
VectorField,
VectorField2D,
Topography2D,
)
from ..vectorfield.topography import topography as _topology # , compute_separatrices
from ..vectorfield.utils import vecfld_from_adata
from ..vectorfield.VectorField import VectorField
from ..vectorfield.vector_calculus import curl, divergence
from .scatters import docstrings, scatters, scatters_interactive
from .utils import (
Expand All @@ -42,7 +42,7 @@


def plot_flow_field(
vecfld: VectorField2D,
vecfld: Topography2D,
x_range: npt.ArrayLike,
y_range: npt.ArrayLike,
n_grid: int = 100,
Expand Down Expand Up @@ -182,7 +182,7 @@ def plot_flow_field(


def plot_nullclines(
vecfld: VectorField2D,
vecfld: Topography2D,
vecfld_dict: Dict[str, Any] = None,
lw: float = 3,
background: Optional[float] = None,
Expand Down Expand Up @@ -240,7 +240,7 @@ def plot_nullclines(
max_[1] + (max_[1] - min_[1]) * 0.1,
]

vecfld2d = VectorField2D(vecfld, X_data=vecfld_dict["X"])
vecfld2d = Topography2D(vecfld, X_data=vecfld_dict["X"])
vecfld2d.find_fixed_points_by_sampling(25, xlim, ylim)

if vecfld2d.get_num_fixed_points() > 0:
Expand All @@ -266,7 +266,7 @@ def plot_nullclines(


def plot_fixed_points_2d(
vecfld: VectorField2D,
vecfld: Topography2D,
marker: str = "o",
markersize: float = 200,
cmap: Optional[str] = None,
Expand Down Expand Up @@ -358,7 +358,7 @@ def plot_fixed_points_2d(


def plot_fixed_points(
vecfld: VectorField2D,
vecfld: Topography2D,
vecfld_dict: Dict[str, Any] = None,
marker: str = "o",
markersize: int = 200,
Expand Down Expand Up @@ -431,7 +431,7 @@ def plot_fixed_points(
max_[1] + (max_[1] - min_[1]) * 0.1,
]

vecfld = VectorField2D(vecfld, X_data=vecfld_dict["X"])
vecfld = Topography2D(vecfld, X_data=vecfld_dict["X"])
vecfld.find_fixed_points_by_sampling(25, xlim, ylim)
if vecfld.get_num_fixed_points() > 0:
vecfld.compute_nullclines(xlim, ylim, find_new_fixed_points=True)
Expand Down Expand Up @@ -642,7 +642,7 @@ def plot_traj(


def plot_separatrix(
vecfld: VectorField2D,
vecfld: Topography2D,
x_range: npt.ArrayLike,
y_range: npt.ArrayLike,
t: npt.ArrayLike,
Expand Down Expand Up @@ -706,7 +706,7 @@ def plot_separatrix(
max_[1] + (max_[1] - min_[1]) * 0.1,
]

vecfld2d = VectorField2D(vecfld, X_data=vecfld_dict["X"])
vecfld2d = Topography2D(vecfld, X_data=vecfld_dict["X"])
vecfld2d.find_fixed_points_by_sampling(25, xlim, ylim)

fps, ftypes = vecfld2d.get_fixed_points(get_types=True)
Expand Down
Loading
Loading