spateo.tdr.models.models_migration.morphofield_model#

Module Contents#

Functions#

construct_field(→ Tuple[pyvista.PolyData, Optional[str]])

Create a 3D vector field arrows model.

construct_field_streams(model[, vf_key, ...])

Integrate a vector field to generate streamlines.

spateo.tdr.models.models_migration.morphofield_model.construct_field(model: pyvista.PolyData, vf_key: str = 'VecFld_morpho', arrows_scale_key: str | None = None, n_sampling: int | None = None, sampling_method: str = 'trn', factor: float = 1.0, key_added: str = 'v_arrows', label: str | list | numpy.ndarray = 'vector field', color: str | list | dict | numpy.ndarray = 'gainsboro', alpha: float = 1.0, **kwargs) Tuple[pyvista.PolyData, str | None][source]#

Create a 3D vector field arrows model.

Parameters:
model

A model that provides coordinate information and vector information for constructing vector field models.

vf_key

The key under which are the vector information.

arrows_scale_key

The key under which are scale factor of the entire object.

n_sampling

n_sampling is the number of coordinates to keep after sampling. If there are too many coordinates in start_points, the generated arrows model will be too complex and unsightly, so sampling is used to reduce the number of coordinates.

sampling_method

The method to sample data points, can be one of ['trn', 'kmeans', 'random'].

factor

Scale factor applied to scaling array.

key_added

The key under which to add the labels.

label

The label of arrows models.

color

Color to use for plotting model.

alpha

The opacity of the color to use for plotting model.

**kwargs

Additional parameters that will be passed to construct_arrows function.

Returns:

A 3D vector field arrows model. plot_cmap: Recommended colormap parameter values for plotting.

spateo.tdr.models.models_migration.morphofield_model.construct_field_streams(model: pyvista.PolyData, vf_key: str = 'VecFld_morpho', source_center: Tuple[float] | None = None, source_radius: float | None = None, tip_factor: int | float = 10, tip_radius: float = 0.2, key_added: str = 'v_streams', label: str | list | numpy.ndarray = 'vector field', stream_color: str = 'gainsboro', tip_color: str = 'orangered', alpha: float = 1.0, **kwargs)[source]#

Integrate a vector field to generate streamlines.

Parameters:
model

A model that provides coordinate information and vector information for constructing vector field models.

vf_key

The key under which are the active vector field information.

source_center

Length 3 tuple of floats defining the center of the source particles. Defaults to the center of the dataset.

source_radius

Float radius of the source particle cloud. Defaults to one-tenth of the diagonal of the dataset’s spatial extent.

tip_factor

Scale factor applied to scaling the tips.

tip_radius

Radius of the tips.

key_added

The key under which to add the labels.

label

The label of arrows models.

stream_color

Color to use for plotting streamlines.

tip_color

Color to use for plotting tips.

alpha

The opacity of the color to use for plotting model.

**kwargs

Additional parameters that will be passed to streamlines function.

Returns:

3D vector field streamlines model. src: The source particles as pyvista.PolyData as well as the streamlines. plot_cmap: Recommended colormap parameter values for plotting.

Return type:

streams_model