PyWrithe Documentation¶
PyWrithe is a all python package to compute writhe of closed curves. Supports both numpy and jax.numpy for jit.
Package contents¶
- pywrithe.writhe.writhe(curve)¶
Returns writhe of given closed parametric curve.
- Parameters
curve (np.array) – An
Nby 3 array describing locations of endpoints ofNlinear segments approximating the curve. All locations should be distinct.- Returns
Value of writhe for closed curve comprised of linear segments given.
- Return type
float
Example
>>> import numpy as np >>> curve = np.array([[-1,0,-1],[1,0,1],[0,-1,1],[0,1,1]]) >>> pywrithe.writhe(curve) 0.366
- pywrithe.writhe_jax.writhe_jax(curve)¶
Returns writhe of given closed parametric curve.
- Parameters
curve (jnp.array) – An
Nby 3 array describing locations of endpoints ofNlinear segments approximating the curve. All locations should be distinct.- Returns
Value of writhe for closed curve comprised of linear segments given.
- Return type
float
Example
>>> import jax.numpy as jnp >>> curve = np.array([[-1,0,-1],[1,0,1],[0,-1,1],[0,1,1]]) >>> pywrithe.writhe_jax(curve) 0.366