Skip to content
Riley16 edited this page Aug 26, 2021 · 20 revisions

Welcome to PTSA Wiki

Documentation

For full PTSA documentation please see https://pennmem.github.io/ptsa_new/html/index.html

Tutorial/Demo

Please check ipython notebook for a self-contained PTSA tutorial/demo: https://github.com/maciekswat/ptsa_new/blob/master/ptsa/tests/test_classifier_notebook-R1111M-presentation.ipynb

Prerequisites

To install PTSA on your machine you need the following software on your machine (we tested PTSA on linux and OSX systems):

The following Python packages will be required to build/run PTSA:

  • numpy
  • scipy
  • PyWavelets
  • xarray

To install those dependencies in conda/anaconda python distribution type the following:

conda install numpy scipy xarray

followed by

pip install PyWavelets

In addition to those you will need to make sure you have

  • c and c++ compilers together with appropriate SDK
  • swig - www.swig.org - needed to generate Python bindings for some C++ modules distributed with PTSA

Fixing bug in xarray 0.7.2

IMPORTANT xarray has a bug that prevents it from handling properly DataArrays whose dimensions are numpy record arrays. PTSA actually relies on this functionality quite a lot so you have two choices:

  1. Downgrade to xray 0.6.x branch

  2. Patch xarray code by replacing implementation of

    def array_equiv(arr1, arr2):

function in xarray/core/ops.py (it will be located in site-packages directory of your Python installation) with te following code:

def array_equiv(arr1, arr2):
    """Like np.array_equal, but also allows values to be NaN in both arrays
    """
    arr1, arr2 = as_like_arrays(arr1, arr2)
    if arr1.shape != arr2.shape:
        return False

    flag_array = (arr1 == arr2)

    # GH837, GH861
    # isnull fcn from pandas will throw TypeError when run on numpy structured array
    # therefore for dims that are np structured arrays we skip testing for nan

    try:

        flag_array |= (isnull(arr1) & isnull(arr2))

    except TypeError:
        pass

    return bool(flag_array.all())

This bug will be fixed in the upcoming release of xarray

Installation

To download PTSA you can either clone PTSA repository by typing the following from your shell:

mkdir PTSA_GIT
cd PTSA_GIT
git clone https://github.com/maciekswat/ptsa_new .
git checkout ptsa_1.0.1

or click the following link:

https://github.com/maciekswat/ptsa_new/archive/ptsa_1.0.1.zip

which will download zipped repository to your machine.

Notice: It is a good idea to check the latest version of ptsa using https://github.com/maciekswat/ptsa_new page interface and modify accordingly the call

git checkout <latest_branch>

so that it checks out latest branch. Subsequent PTSA version branches will be called ptsa_1.0.1, ptsa_1.0.2, ptsa_1.1.0, etc...

After you downloaded PTSA go to PTSA directory and run the following command

python setup.py install

This will start the installation process that will involve compilation of fftw library, compilation of c/c++ PTSA extension modules and copying of Python files into '''site-packages''' directory of your python distribution

Assuming everything went OK , at this point you should have PTSA distribution ready to run.

#Basic PTSA Usage

The following IPython notebook demonstrates how one can use PTSA to build and test memory classifier Building Classifier of Good Memory Using PTSA

Please send us your feedback/suggestions

Clone this wiki locally