fastpli.objects.fibers.Fiber

class Fiber(data, dtype=<class 'float'>)[source]

Bases: object

Methods

apply

Applies function to fiber

apply_to_points

Applies function to fiber positions

apply_to_radii

Applies function to fiber radii

as_array

Returns copy data as np.array

cast

Changes datatype to new type

copy

deep copy of class

cut

Cut fiber into voi.

cut_sphere

Cut fiber into sphere.

rotate

Rotates fiber around offset

scale

Scales fiber

translate

Translates fiber

Attributes

dtype

returns np.dtype of data

points

Returns xyz data as np.array

radii

Returns radii data as np.array

shape

returns shape of data

apply(fun)[source]

Applies function to fiber

Parameters

fun (function)

Returns

res – fun(fiber)

Return type

Fiber

apply_to_points(fun)[source]

Applies function to fiber positions

Parameters

fun (function)

Returns

res – fun(fiber)

Return type

Fiber

apply_to_radii(fun)[source]

Applies function to fiber radii

Parameters

fun (function)

Returns

res – fun(fiber)

Return type

Fiber

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

Fiber

copy()[source]

deep copy of class

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

FiberBundle

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

FiberBundle

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

Fiber

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

Fiber

property shape

returns shape of data

translate(offset)[source]

Translates fiber

Parameters

offset (3d-array-array_like) – offset to translate

Returns

res – translated fiber

Return type

Fiber