make_afun function

Create a custom analysis function wrapping an existing function