-
Notifications
You must be signed in to change notification settings - Fork 9
Home
For full PTSA documentation please see https://pennmem.github.io/ptsa_new/html/index.html
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
To install PTSA on your machine you need the following software on your machine (we tested PTSA on linux and OSX systems):
- python 2.7 - we recommend anaconda or miniconda python distributions from Continuum Analytics - go to https://www.continuum.io/downloads or http://conda.pydata.org/miniconda.html to download python distribution. Note: other python distributions will work as well
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
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:
-
Downgrade to xray 0.6.x branch
-
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
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