Package: behavelet
behavelet: a wavelet transform for mapping behaviorbehavelet is a Python implementation of the normalized Morlet wavelet transform for behavioral mapping fromBerman et al. (2014).It runs on the CPU using numpy and multiprocessing or on the GPU usingCuPy.This code was adapted to Python usingthe original MotionMapper codefrom Gordon Berman et al.Quick StartHere is an example of how to use behavelet on the CPU with a randomly generated dataset:frombehaveletimportwavelet_transformimportnumpyasnpn_samples=10000n_features=10X=np.random.normal(size=(n_samples,n_features))freqs,power,X_new=wavelet_transform(X,n_freqs=25,fsample=100.,fmin=1.,fmax=50.)use then_jobsargument to parallelize the computations across multiple threads:freqs,power,X_new=wavelet_transform(X,n_freqs=25,fsample=100.,fmin=1.,fmax=50.,n_jobs=-1)and use thegpuargument to run it on the GPU withCuPy:freqs,power,X_new=wavelet_transform(X,n_freqs=25,fsample=100.,fmin=1.,fmax=50.,gpu=True)freqsis a(n_freqs,)shaped array of the frequencies used for the wavelet transformpoweris a(n_samples,)shaped array with the total power for the wavelet coefficients in each sampleX_newis a(n_samples, n_freqs*n_features)shaped array of the wavelet coefficients.CitationIf you use behavelet for your research, please cite our DOI:@misc{graving2019behavelet,
        title={behavelet: a wavelet transform for mapping behavior},
        author={Graving, Jacob M},
        month={aug},
        year={2019},
        doi={10.5281/zenodo.3376742},
        url={https://doi.org/10.5281/zenodo.3376742}
        }for the original description of the normalized Morlet wavelet transform see the paper fromBerman et al. (2014):@article{berman2014mapping,
         title={Mapping the stereotyped behaviour of freely moving fruit flies},
         author={Berman, Gordon J and Choi, Daniel M and Bialek, William and Shaevitz, Joshua W},
         journal={Journal of The Royal Society Interface},
         volume={11},
         number={99},
         pages={20140672},
         year={2014},
         publisher={The Royal Society}
         }InstallationInstall the latest stable version with pip:pipinstallbehaveletInstall the development version with pip:pipinstallgit+https://www.github.com/jgraving/behavelet.gitYou can also install from within Python rather than using the command line, either from within Jupyter or another IDE, to ensure it is installed in the correct working environment:importsys!{sys.executable}-mpipinstallgit+https://www.github.com/jgraving/behavelet.gitIf you wish to use the GPU version, you mustinstall CuPy manually.DevelopmentPlease submit bugs or feature requests to theGitHub issue tracker. Please limit reported issues to the behavelet codebase and provide as much detail as you can with a minimal working example if possible.If you experience problems withCuPy, such as installing CUDA or other dependencies, then please direct issues to their development team.Contributorsbehavelet was developed byJake Graving, and is still being actively developed. Public contributions are welcome. If you wish to contribute, pleasefork the repositoryto make your modifications andsubmit a pull request.LicenseReleased under a Apache 2.0 License. SeeLICENSEfor details.