This is a Python library for computing shape invariants of planar curves using FEM and the FEniCS package. To run the module, FEniCS must be installed.
It is the supporting code for the paper Currents and finite elements as tools for shape space by James Benn, Stephen Marsland, Robert I McLachlan, Klas Modin and Olivier Verdier.
The simplest way to calculate the invariants of a curve are as follows.
- Create a space
space = Space()
Check the documentation of the
Space class to see the available options.
- Create a curve
This is just an arbitrary array of size P x 2, where P is the number of points. For instance,
ts = np.arange(0, 2*np.pi, 200) curve = .7*np.array([np.cos(ts), np.sin(3*ts)]).T
- Compute the associated current
current = Current(space, curve)
You have now access to the property
invariants which contains the result of the current evaluated on the basis of one-forms.
You can inspect the invariants using
- Compute the representer
Givne an underlying Hilbert space structure on the one forms, one can compute the associated representer of the current:
representer = Representer(current, scale=.2)
You can plot the result using
The notebooks contain further examples: