{
  "nbformat_minor": 0, 
  "nbformat": 4, 
  "cells": [
    {
      "execution_count": null, 
      "cell_type": "code", 
      "source": [
        "%matplotlib inline"
      ], 
      "outputs": [], 
      "metadata": {
        "collapsed": false
      }
    }, 
    {
      "source": [
        "\n# Aligning matrices to a common space\n\n\nIn this example, we plot the trajectory of multivariate brain activity for\ntwo groups of subjects that have been hyperaligned (Haxby et al, 2011).  First,\nwe use the align tool to project all subjects in the list to a common space.\nThen we average the data into two groups, and plot.\n\n"
      ], 
      "cell_type": "markdown", 
      "metadata": {}
    }, 
    {
      "execution_count": null, 
      "cell_type": "code", 
      "source": [
        "# Code source: Andrew Heusser\n# License: MIT\n\n# import\nimport hypertools as hyp\nimport numpy as np\n\n# load example data\ndata = hyp.load('weights').get_data()\ndata = hyp.align(data, align='hyper')\n\n# average into two groups\ngroup1 = np.mean(data[:17], 0)\ngroup2 = np.mean(data[18:], 0)\n\n# plot\nhyp.plot([group1[:100, :], group2[:100, :]])"
      ], 
      "outputs": [], 
      "metadata": {
        "collapsed": false
      }
    }
  ], 
  "metadata": {
    "kernelspec": {
      "display_name": "Python 2", 
      "name": "python2", 
      "language": "python"
    }, 
    "language_info": {
      "mimetype": "text/x-python", 
      "nbconvert_exporter": "python", 
      "name": "python", 
      "file_extension": ".py", 
      "version": "2.7.11", 
      "pygments_lexer": "ipython2", 
      "codemirror_mode": {
        "version": 2, 
        "name": "ipython"
      }
    }
  }
}