14.8.7. Collections of STEPS Supporting Utilities
14.8.7.1. steps.API_1.utilities.meshctrl
Note
This module is preliminary, means some of the functions are still under development. Code modification / debugging is wellcomed. Please email steps.dev@gmail.com if you would like to share you changes with others.
Mesh Control Utilities
The meshctrl module provides functions for controling and manipulating the mesh, e.g. finding overlap surface triangles in meshes.
- findOverlapTris(mesh, tets1, tets2)[source]
Find overlap triangles between two sets of tetrahedrons within a mesh.
- Arguements:
steps.geom.Tetmesh mesh
list<uint> tets1
list<uint> tets2
- Return:
list<uint>
- findOverlapSurfTris(mesh1, mesh2)[source]
Find overlap surface triangles between two meshes. Return a list of coupling data list formatted as [tet_1, surftri_1, tet_2, surftri_2, tet_distance], where: * tet_1 and tet_2: Indices of the tetrahedrons whose surface triangles overlap. * surftri_1 and surftri_2: Indices of the overlap surface triangles. * tet_distance: Distance between the barycenters of tet_1 and tet_2.
- Arguements:
steps.geom.Tetmesh mesh1
steps.geom.Tetmesh mesh2
- Return:
list<list<uint, uint, uint, uint, float>>
14.8.7.2. steps.API_1.utilities.geom_decompose
- binTetsByAxis(mesh, nbins, axis=- 1)[source]
Bin tetrahedrons of the mesh along a specific axis.
This function is now deprecated, use linearPartition() instead.
- Parameters:
mesh STEPS Tetmesh object
nbins Number of bins along the axis
axis The partioning axis(Option -1: longest axis, 0:x, 1:y, 2:z)
- Return:
Tetrahedron partition list for parallel TetOpsplit solver
- linearPartition(mesh, partition_info)[source]
Partition the mesh based on the partition info. The partition_info is a list [xbin, ybin, zbin] where each element is the number of bins for the axis.
- Parameters:
mesh STEPS Tetmesh object
partition_info a list [xbin, ybin, zbin] describing the binning requirement of each axis
- Return:
Tetrahedron partition list for parallel TetOpsplit solver
- partitionTris(mesh, tet_partitions, tri_list)[source]
Partition trangles according to partitioning information of their attached tetrahedrons.
- Parameters:
mesh STEPS Tetmesh object
tet_partitions List of partioning for each tetrahedron in the mesh, generated by linearPartition function or third-party software
tri_list List of triangles that require partitioning
- Return:
Triangle partition list for parallel TetOpsplit solver
- getTetPartitionTable(partitions)[source]
Convert a [tet0_host, tet1_host, …] partitioning list to a {host0:[tet0, tet1, …], …} table.
- Parameters:
partitions Partitioning list for tetrahedrons in the format of [tet0_host, tet1_host, …]
- Return:
A dictionary in the format of {host0:[tet0, tet1, …], …}
- getTriPartitionTable(partitions)[source]
Convert a {tri0:tri0_host, tri1:tri1_host, …} partitioning data to a {host0:[tri0, tri1, …], …} table.
- Parameters:
partitions Partitioning dictionary for triangles in the format of {tri0:tri0_host, tri1:tri1_host, …}
- Return:
A dictionary in the format of {host0:[tri0, tri1, …], …}
- validatePartition(mesh, tet_partitions, tri_partitions={})[source]
Validate the partitioning of the mesh.
- Parameters:
mesh STEPS Tetmesh object
tet_partitions Partition list for tetrahedrons
tri_partitions Partition list for triangles (Optional)
- Return:
None
- printPartitionStat(tet_partitions=[], tri_partitions={}, wmvol_partitions=[], mesh=None)[source]
Print out partitioning stastics.
- Parameters:
tet_partitions Partition list for tetrahedrons
tri_partitions Partition list for triangles (Optional)
wmvol_partitions Partition list for well-mixed volumes (Optional)
mesh STEPS Tetmesh object (Optional)
- Return:
(If mesh is provided) tet_stats, tri_stats, wm_stats, num_hosts, min_degree, max_degree, mean_degree [tet/tri/wm]_stats contains the number of tetrahedrons/triangles/well-mixed volumes in each hosting process, num_hosts provide the number of hosting processes, [min/max/mean]_degree provides the minimum/maximum/average connectivity degree of the partitioning
- isPointInCylinder(cyl_p0, cyl_p1, test_pnt, scale)[source]
This function is deprecated, use isPointInTruncatedCone() instead.
- isPointInTruncatedCone(cyl_p0, cyl_p1, test_pnt, scale)[source]
Check if a scaled point is inside a truncated cone in 3D. The truncated cone is defined by an axis from the start cycle cyl_p0 to the end cycle cyl_p1. If cyl_p0 and cyl_p0 are from .swc morphology, and test_pnt is from a steps.geom.Tetmesh generated from the .swc data and imported with an importing scale of 1e-6 (micrometer), then the scale here is 1e-6.
Arguements: * cyl_p0 coordinates and diameter of the start cycle, in the form of [x, y, z, d] * cyl_p1 coordinates and diameter of the end cycle, in the form of [x, y, z, d] * test_pnt coordinate of the test point * scale the scale between measurements of the truncated cone and the test point
Return: -1 if point is outside the truncated cone, distance squared from truncated cone axis if point is inside.
Modified from: CylTest_CapsFirst of Greg James - gjames@NVIDIA.com http://www.flipcode.com/archives/Fast_Point-In-Cylinder_Test.shtml Original Lisc: Free code - no warranty & no money back. Use it all you want
14.8.7.3. steps.API_1.utilities.metis_support
14.8.7.4. steps.API_1.utilities.morph_support
- neuron2morph(h)[source]
Generate morph sectioning data from NEURON h interface with preloaded morphology.
- mapMorphTetmesh(morph_sections, mesh, morph2mesh_scale=1e-06)[source]
Map each tetrahedron in a mesh to morph sectioning.
- Parameters:
morph_sections Morphology sectioning data generated by steps.utilities.morph_support.hoc2morph or swc2morph
mesh STEPS Tetmesh object
morph2mesh_scale Scaling factor from morph sectioning data to Tetmesh data, Default: 1e-6, that is 1 unit (usually micron) in the morph file equals 1e-6 unit (meter) in Tetmesh
- Return:
A list in format of [sec_id_tet0, sec_id_tet1, sec_id_tet_n, …] where the n_th element stores the section id for tetrahedron n.