fastpli.objects.fibers.Fiber
- class Fiber(data, dtype=<class 'float'>)[source]
Bases:
object
Methods
Applies function to fiber
Applies function to fiber positions
Applies function to fiber radii
Returns copy data as np.array
Changes datatype to new type
deep copy of class
Cut fiber into voi.
Cut fiber into sphere.
Rotates fiber around offset
Scales fiber
Translates fiber
Attributes
returns np.dtype of data
Returns xyz data as np.array
Returns radii data as np.array
returns shape of data
- apply(fun)[source]
Applies function to fiber
- Parameters
fun (function)
- Returns
res – fun(fiber)
- Return type
- apply_to_points(fun)[source]
Applies function to fiber positions
- Parameters
fun (function)
- Returns
res – fun(fiber)
- Return type
- apply_to_radii(fun)[source]
Applies function to fiber radii
- Parameters
fun (function)
- Returns
res – fun(fiber)
- Return type
- as_array()[source]
Returns copy data as np.array
- Returns
res – fiber as np.array
- Return type
(n,4)-array
- cast(dtype)[source]
Changes datatype to new type
- Parameters
dtype (type) – numpy types are fully supported
- Returns
res – casted fiber
- Return type
- cut(voi)[source]
Cut fiber into voi. The cutting process can create multiple fibers. It checks every fiber_segment_aabb if it overlapps with the voi.
- Parameters
voi ([xmin, ymin, zmin],[xmax,ymax,zmax]) – Volume of interest of which fibers to include. E.g. same as in Simulation
- Returns
res – cutted fiber into fiber_bundle
- Return type
- cut_sphere(radius, center=(0, 0, 0))[source]
Cut fiber into sphere. The cutting process can create multiple fibers. It checks every fiber_segment_aabb if it overlapps with the sphere.
- Parameters
radius (float) – radius of cutting sphere
center (3d-array) – center of cutting sphere
- Returns
res – cutted fiber_bundle
- Return type
- property dtype
returns np.dtype of data
- property points
Returns xyz data as np.array
- Returns
res – fiber points as numpy array
- Return type
(n,3)-array
- property radii
Returns radii data as np.array
- Returns
res – fiber radii as numpy array
- Return type
(n,1)-array
- rotate(rot, offset=None)[source]
Rotates fiber around offset
- Parameters
rot ((3,3)-array_like) – rotation matrix
offset (3d-array-array_like, optional) – offset for rotation center
- Returns
res – rotated fiber
- Return type
- scale(scale, mode='all')[source]
Scales fiber
- Parameters
scale (float) – scale factor
mode (str, optional) – ‘all’, ‘points’ or ‘radii’ will be scaled
- Returns
res – scaled Fiber
- Return type
- property shape
returns shape of data