Code Monkey home page Code Monkey logo

femshape's Introduction

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.

Getting started

The simplest way to calculate the invariants of a curve are as follows.

  1. Create a space
space = Space()

Check the documentation of the Space class to see the available options.

  1. 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
  1. 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

plot_invariants(current)

invariants

  1. 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

plot_representer(representer)

representer

Further examples

The notebooks contain further examples:

femshape's People

Contributors

olivierverdier avatar smarsland avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.