Module Reference¶
- pyms3d_core.select_device(device: int = 0) str ¶
Select hardware device to run the computations on. 0 for GPU, 1 for CPU, leave unspecified for auto. This must be called before any other function.
- class pyms3d_core.MsComplex¶
Bases:
MsComplexBase
- asc(self: pyms3d_core.pyms3d_core.MsComplex, cp: int) numpy.ndarray[numpy.int32] ¶
List of ascending cps connected to a critical point
- asc_geom(self: pyms3d_core.pyms3d_core.MsComplex, cp: int, hversion: int = -1, ToPts: bool = True) numpy.ndarray ¶
Ascending manifold geometry of the given critical point
- Parameters:
cp – the critical point id
hversion – desired hierarchical version. -1 indicates current version.
ToPts – convert the geometry data to point indices.
- Returns: If ToPts False, returns a list of cellids. If ToPts True, returned shape depends on the index of cp as follows:
CP Index 0: Returns a list of size NC of point indices in Primal grid
CP Index 1: Returns a list of size NC’ x 4 of point indices in Dual grid
CP Index 2: Returns a list of size NC’ x 2 of point indices in Dual grid
Where NC is the number of cells in the ascending mfold of cp, and NC’ is the number of cells in the ascending mfold of cp whose dual points are inside the Primal grid.
- canc_pairs(self: pyms3d_core.pyms3d_core.MsComplex) numpy.ndarray[numpy.int32] ¶
get all cancellation pairs
- collect_geom(self: pyms3d_core.pyms3d_core.MsComplex, dir: int = 2, dim: int = -1) None ¶
Collect the geometry of all surviving critical points
- Parameters:
dir – Geometry type dir=0 –> Descending dir=1 –> Ascending dir=2 –> Both (default)
dim – Critical point type dim=-1 –> All (default) dim=0,1,2,3 –> Minima, 1-saddle,2-saddle,Maxima
Note
Call only after the compute function is called.
- compute_arr(self: pyms3d_core.pyms3d_core.MsComplex, arr: numpy.ndarray) None ¶
Compute the MsComplex from a 3D numpy array
- compute_bin(self: pyms3d_core.pyms3d_core.MsComplex, filepath: str, dims 3-tuple: tuple) None ¶
Compute the MsComplex from a raw/bin file
- cp_cellid(self: pyms3d_core.pyms3d_core.MsComplex, cp: int) tuple ¶
Cell id of the critical cell associated with the critical point
- cp_detail_string(self: pyms3d_core.pyms3d_core.MsComplexBase, cp: int) str ¶
Get a string with detailed information about the critical point
- cp_func(self: pyms3d_core.pyms3d_core.MsComplexBase, cp: int) float ¶
Function value at the critical point
- cp_index(self: pyms3d_core.pyms3d_core.MsComplexBase, cp: int) int ¶
Morse index at the critical point
- cp_pairid(self: pyms3d_core.pyms3d_core.MsComplexBase, cp: int) int ¶
Index of the paired critical point (-1 if unpaired)
- cp_vertid(self: pyms3d_core.pyms3d_core.MsComplex, cp: int) tuple ¶
Vertex id of the critical cell associated with the critical point
- cps(self: pyms3d_core.pyms3d_core.MsComplex, dim: int = -1) numpy.ndarray ¶
Returns a list of surviving critical points based on dimension
- cps_cellid(self: pyms3d_core.pyms3d_core.MsComplex) numpy.ndarray[numpy.int16] ¶
Get cell ids of all critical points
- cps_func(self: pyms3d_core.pyms3d_core.MsComplex) numpy.ndarray[numpy.float32] ¶
Get function values of all critical points
- cps_index(self: pyms3d_core.pyms3d_core.MsComplex) numpy.ndarray[numpy.int8] ¶
Get Morse indices of all critical points
- cps_pairid(self: pyms3d_core.pyms3d_core.MsComplex) numpy.ndarray[numpy.int32] ¶
Get cancellation pair ids of all critical points
- cps_vertid(self: pyms3d_core.pyms3d_core.MsComplex) numpy.ndarray[numpy.int16] ¶
Get maximal vertex ids of all critical points
- dbg_serialize(self: pyms3d_core.pyms3d_core.MsComplex) dict ¶
Serialize the internal state for debugging
- des(self: pyms3d_core.pyms3d_core.MsComplex, cp: int) numpy.ndarray[numpy.int32] ¶
List of descending cps connected to a critical point
- des_geom(self: pyms3d_core.pyms3d_core.MsComplex, cp: int, hversion: int = -1, ToPts: bool = True) numpy.ndarray ¶
Descending manifold geometry of the given critical point
- Parameters:
cp – the critical point id
hversion – desired hierarchical version. -1 indicates current version.
ToPts – convert the geometry data to point indices.
- Returns: If ToPts False, returns a list of cellids. If ToPts True, returned shape depends on the index of cp as follows:
CP Index 0: Returns a list of size NC of point indices in Primal grid
CP Index 1: Returns a list of size NC’ x 4 of point indices in Dual grid
CP Index 2: Returns a list of size NC’ x 2 of point indices in Dual grid
Where NC is the number of cells in the descending mfold of cp, and NC’ is the number of cells in the descending mfold of cp whose dual points are inside the Primal grid.
- dual_points(self: pyms3d_core.pyms3d_core.MsComplex) numpy.ndarray[numpy.float32] ¶
Get dual grid point coordinates
- load(self: pyms3d_core.pyms3d_core.MsComplex, filepath: str) None ¶
Load mscomplex from file
- num_cps(self: pyms3d_core.pyms3d_core.MsComplexBase) int ¶
Number of Critical Points
- primal_points(self: pyms3d_core.pyms3d_core.MsComplex) numpy.ndarray[numpy.float32] ¶
Get primal grid point coordinates
- save(self: pyms3d_core.pyms3d_core.MsComplex, filepath: str) None ¶
Save mscomplex to file
- simplify_pers(self: pyms3d_core.pyms3d_core.MsComplexBase, thresh: float = 1.0, is_nrm: bool = True, nmax: int = 0, nmin: int = 0) None ¶
Simplify the Morse-Smale complex using topological persistence.
- Parameters:
thresh – Persistence threshold.
is_nrm – Indicates if the threshold is normalized to [0,1]. If false, the threshold is in the scale of the input function.
nmax – Number of maxima/minima that should be retained. Set to 0 to ignore.
nmin – Number of maxima/minima that should be retained. Set to 0 to ignore.
Note
Any combination of the above criteria may be set. Simplification will stop when any of the criteria is reached. Call only after the compute function is called.
- vert_func(self: pyms3d_core.pyms3d_core.MsComplex, x: int, y: int, z: int) float ¶
Scalar value at vertex coordinate
- vert_funcs(self: pyms3d_core.pyms3d_core.MsComplex, arg0: int, arg1: int, arg2: int) numpy.ndarray[numpy.float32] ¶
Scalar value at all vertices