{ "info": { "author": "Caleb Geniesse", "author_email": "geniesse@stanford.edu", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Scientific/Engineering :: Visualization" ], "description": "\n\n

\n\n\n\n

\n\n\n

\n\n\n\n

\n\n\n\n## **Dynamical Neuroimaging Spatiotemporal Representations**\n\n[DyNeuSR](https://braindynamicslab.github.io/dyneusr/) is a Python visualization library for topological representations of neuroimaging data.\n\nDyNeuSR was designed specifically for working with shape graphs produced by the Mapper algorithm from topological data analysis (TDA), as described in the papers \"[Generating dynamical neuroimaging spatiotemporal representations (DyNeuSR) using topological data analysis](https://www.mitpressjournals.org/doi/abs/10.1162/netn_a_00093)\" (Geniesse et al., 2019) and \"[Towards a new approach to reveal dynamical organization of the brain using topological data analysis](https://www.nature.com/articles/s41467-018-03664-4)\" (Saggar et al., 2018). Check out this [blog post](https://bdl.stanford.edu/blog/tda-cme-paper/) for more about the initial work that inspired the development of DyNeuSR. \n\nDeveloped with neuroimaging data analysis in mind, DyNeuSR connects existing implementations of Mapper (e.g. [KeplerMapper](https://kepler-mapper.scikit-tda.org)) with network analysis tools (e.g. [NetworkX](https://networkx.github.io/)) and other neuroimaging data visualization libraries (e.g. [Nilearn](https://nilearn.github.io/)) and provides a high-level interface for interacting with and manipulating shape graph representations of neuroimaging data and relating these representations back to neurophysiology.\n\nDyNeuSR also provides an interactive web interface for visualizing and exploring shape graphs. To see this visual interface in action, check out the [demos](https://braindynamicslab.github.io/dyneusr/demo/).\n\n\n\n\n## **Demos**\n\n- [Trefoil knot](https://braindynamicslab.github.io/dyneusr/demo/trefoil-knot/) ([code](https://github.com/braindynamicslab/dyneusr/blob/master/docs/demo/trefoil-knot/trefoil_knot.py))\n- [Trefoil knot (custom layouts)](https://braindynamicslab.github.io/dyneusr/demo/trefoil-knot/) ([code](https://github.com/braindynamicslab/dyneusr/blob/master/docs/demo/trefoil-knot-custom-layouts/trefoil_knot_custom_layouts.py))\n- [Haxby fMRI data (t-SNE lens)](https://braindynamicslab.github.io/dyneusr/demo/haxby-tsne/) ([code](https://github.com/braindynamicslab/dyneusr/blob/master/docs/demo/haxby-tsne/haxby_tsne.py))\n- [Haxby fMRI data (UMAP lens)](https://braindynamicslab.github.io/dyneusr/demo/haxby-umap/) ([code](https://github.com/braindynamicslab/dyneusr/blob/master/docs/demo/haxby-umap/haxby_umap.py))\n- [Haxby fMRI data (supervised UMAP lens)](https://braindynamicslab.github.io/dyneusr/demo/haxby-umap-supervised/) ([code](https://github.com/braindynamicslab/dyneusr/blob/master/docs/demo/haxby-umap-supervised/haxby_umap_supervised.py))\n\n\n## **Related Projects** \n\n- [DyNeuSR Fire](https://braindynamicslab.github.io/dyneusr-fire/) is a new project that provides a command line interface for DyNeuSR. It wraps `kmapper` and `dyneusr` into a single pipeline, and uses the [Python Fire](https://github.com/google/python-fire) library to automatically generate a simple command line interface that accepts several important options and allows users to customize this pipeline. For more information about DyNeuSR Fire, check out the [docs](https://braindynamicslab.github.io/dyneusr-fire/).\n\n\n## **References**\n\nIf you find DyNeuSR useful, please consider citing:\n\n> Geniesse, C., Sporns, O., Petri, G., & Saggar, M. (2019). [Generating dynamical neuroimaging spatiotemporal representations (DyNeuSR) using topological data analysis](https://www.mitpressjournals.org/doi/abs/10.1162/netn_a_00093). *Network Neuroscience*. Advance publication. doi:10.1162/netn_a_00093\n\n\nFor more information about the Mapper approach, please see:\n\n> Saggar, M., Sporns, O., Gonzalez-Castillo, J., Bandettini, P.A., Carlsson, G., Glover, G., & Reiss, A.L. (2018). [Towards a new approach to reveal dynamical organization of the brain using topological data analysis](https://www.nature.com/articles/s41467-018-03664-4). *Nature Communications, 9*(1). doi:10.1038/s41467-018-03664-4\n\n\n\n\n\n## **API Usage & Examples**\n\nDyNeuSR provides a Python API for working with and visualizing shape graphs generated by Mapper. This repository includes several [examples](https://github.com/braindynamicslab/dyneusr/tree/master/examples/) that introduce DyNeuSR's API and highlight different aspects of analysis with DyNeuSR. For more detailed tutorials, check out [dyneusr-notebooks](https://github.com/braindynamicslab/dyneusr-notebooks/).\n\n\n### **_Shape Graph Visualization_** ([trefoil knot](https://github.com/braindynamicslab/dyneusr/blob/master/examples/trefoil_knot/trefoil_knot.py))\n\n```python\n\nfrom dyneusr import DyNeuGraph\nfrom dyneusr.datasets import make_trefoil\nfrom dyneusr.tools import visualize_mapper_stages\nfrom kmapper import KeplerMapper\n\n# Generate synthetic dataset\ndataset = make_trefoil(size=100)\nX = dataset.data\ny = dataset.target\n\n# Generate shape graph using KeplerMapper\nmapper = KeplerMapper(verbose=1)\nlens = mapper.fit_transform(X, projection=[0])\ngraph = mapper.map(lens, X, nr_cubes=6, overlap_perc=0.2)\n\n# Visualize the shape graph using DyNeuSR's DyNeuGraph \ndG = DyNeuGraph(G=graph, y=y)\ndG.visualize('dyneusr_output.html')\n\n```\n\n

\n\n

\n\n\n\n### **_Mapper Parameter Comparison_** ([trefoil knot](https://github.com/braindynamicslab/dyneusr/blob/master/examples/trefoil_knot/compare_lenses.py))\n\n```python\n# Define projections to compare\nprojections = ([0], [0,1], [1,2], [0, 2])\n\n# Compare different sets of columns as lenses\nfor projection in projections:\n\n\t# Generate shape graph using KeplerMapper\n\tmapper = KeplerMapper(verbose=1)\n\tlens = mapper.fit_transform(X, projection=projection)\n\tgraph = mapper.map(lens, X, nr_cubes=4, overlap_perc=0.3)\n\n\t# Visualize the stages of Mapper\n\tfig, axes = visualize_mapper_stages(\n\t\tdataset, lens=lens, graph=graph, cover=mapper.cover, \n\t\tlayout=\"spectral\")\n\n```\n\n

\n\n\n\n\n

\n\n\n\n### **_Neuroimaging Applications_** ([haxby decoding](https://github.com/braindynamicslab/dyneusr/tree/master/examples/haxby_decoding))\n\n```python\n\nimport numpy as np \nimport pandas as pd\n\nfrom nilearn.datasets import fetch_haxby\nfrom nilearn.input_data import NiftiMasker\n\nfrom kmapper import KeplerMapper, Cover\nfrom sklearn.manifold import TSNE\nfrom sklearn.cluster import DBSCAN\n\n# Fetch dataset, extract time-series from ventral temporal (VT) mask\ndataset = fetch_haxby()\nmasker = NiftiMasker(\n dataset.mask_vt[0], \n standardize=True, detrend=True, smoothing_fwhm=4.0,\n low_pass=0.09, high_pass=0.008, t_r=2.5,\n memory=\"nilearn_cache\")\nX = masker.fit_transform(dataset.func[0])\n\n# Encode labels as integers\ndf = pd.read_csv(dataset.session_target[0], sep=\" \")\ntarget, labels = pd.factorize(df.labels.values)\ny = pd.DataFrame({l:(target==i).astype(int) for i,l in enumerate(labels)})\n\n# Generate shape graph using KeplerMapper\nmapper = KeplerMapper(verbose=1)\nlens = mapper.fit_transform(X, projection=TSNE(2))\ngraph = mapper.map(lens, X, cover=Cover(20, 0.5), clusterer=DBSCAN(eps=20.))\n\n# Visualize the shape graph using DyNeuSR's DyNeuGraph \ndG = DyNeuGraph(G=graph, y=y)\ndG.visualize('dyneusr_output.html')\n\n```\n\n

\n\n

\n\n\n\n## **Setup**\n\n### **_Dependencies_**\n\n#### [Python 3.6](https://www.python.org/)\n\n#### Required Python Packages\n* [numpy](www.numpy.org)\n* [pandas](pandas.pydata.org)\n* [scipy](www.scipy.org)\n* [scikit-learn](scikit-learn.org)\n* [matplotlib](matplotlib.sourceforge.net)\n* [seaborn](stanford.edu/~mwaskom/software/seaborn)\n* [networkx](networkx.github.io)\n* [nilearn](nilearn.github.io)\n* [kmapper](kepler-mapper.scikit-tda.org)\n\n_For a full list of packages and required versions, see [`requirements.txt`](https://github.com/braindynamicslab/dyneusr/blob/master/requirements.txt) and [`requirements-versions.txt`](https://github.com/braindynamicslab/dyneusr/blob/master/requirements-versions.txt)._\n\n\n### **_Install with PIP_**\n\n_To install with pip:_\n```bash\npip install dyneusr\n```\n\n_To install from source:_\n```bash\ngit clone https://github.com/braindynamicslab/dyneusr.git\ncd dyneusr\n\npip install -r requirements.txt\npip install -e .\n\npytest\n```\n\n\n### **_Install with Conda_**\n\nIf your default environment is Python 2, we recommend that you install `dyneusr` in a separate Python 3 environment. You can find more information about creating a separate environment for Python 3 [here](https://salishsea-meopar-docs.readthedocs.io/en/latest/work_env/python3_conda_environment.html). \n\nIf you don't have conda, or if you are new to scientific python, we recommend that you download the [Anaconda scientific python distribution](https://store.continuum.io/cshop/anaconda/). \n\n_To create a new conda environment and install from source:_\n```bash\nconda create -n dyneusr python=3.6\nconda activate dyneusr\n\ngit clone https://github.com/braindynamicslab/dyneusr.git\ncd dyneusr\n\nconda install --file requirements-conda.txt\npip install -e .\n\npytest\n```\n\nThis creates a new conda environment `dyneusr` and installs in it the dependencies that are needed. To access it, use the `conda activate dyneusr` command (if your conda version >= 4.4) and use `source activate dyneusr` command (if your conda version < 4.4).\n\n\n\n## **Support**\n\nPlease feel free to [report](https://github.com/braindynamicslab/dyneusr/issues/new) any issues, [request](https://github.com/braindynamicslab/dyneusr/issues/new) new features, or [propose](https://github.com/braindynamicslab/dyneusr/compare) improvements. You can also contact Caleb Geniesse at geniesse [at] stanford [dot] edu.\n\nIf you contribute to DyNeuSR, please feel free to add your name to the [list of contributors](https://github.com/braindynamicslab/dyneusr/blob/master/contributors.md). \n\n## **Citation**\n\n> Geniesse, C., Sporns, O., Petri, G., & Saggar, M. (2019). [Generating dynamical neuroimaging spatiotemporal representations (DyNeuSR) using topological data analysis](https://www.mitpressjournals.org/doi/abs/10.1162/netn_a_00093). *Network Neuroscience*. Advance publication. doi:10.1162/netn_a_00093\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://braindynamicslab.github.io/dyneusr", "keywords": "brain dynamics,topology data analysis,neuroimaging,brain networks,mapper,visualization", "license": "BSD-3", "maintainer": "", "maintainer_email": "", "name": "dyneusr", "package_url": "https://pypi.org/project/dyneusr/", "platform": "", "project_url": "https://pypi.org/project/dyneusr/", "project_urls": { "Homepage": "https://braindynamicslab.github.io/dyneusr" }, "release_url": "https://pypi.org/project/dyneusr/0.3.4/", "requires_dist": [ "setuptools", "pytest", "ipython", "numpy (>=1.16)", "pandas", "scipy", "scikit-learn", "matplotlib", "seaborn", "networkx", "nilearn", "kmapper (>=1.2)" ], "requires_python": ">=3.6", "summary": "Dynamical Neural Spatiotemporal Representations.", "version": "0.3.4" }, "last_serial": 5359897, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "d1b5d8cf78a81da25cce1426237c135e", "sha256": "5074e81ee535a774d2aca8cd94387a20f24c54cb01180acb2774fe890b6d7f08" }, "downloads": -1, "filename": "dyneusr-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d1b5d8cf78a81da25cce1426237c135e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 34590, "upload_time": "2019-06-03T08:38:50", "url": "https://files.pythonhosted.org/packages/cb/72/73c90f48823a6514c6a5feb4de3953a639716f07b0f0ce8113547570d494/dyneusr-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "87c6263f508759dffddbf41b13d87804", "sha256": "83a73bd4cb2eeb802e57b86360e316dbe3d9e14d2bf063c4d44ed326a726c22d" }, "downloads": -1, "filename": "dyneusr-0.3.0.tar.gz", "has_sig": false, "md5_digest": "87c6263f508759dffddbf41b13d87804", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 32608, "upload_time": "2019-06-03T08:38:52", "url": "https://files.pythonhosted.org/packages/20/12/5469dbf88680cf4e2007baf52de4030d3b4908f6d8f38b1d149e9aa0ae37/dyneusr-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "e336612aa692bd0e9a753c46ceb8b56e", "sha256": "fa8c506ed0b02513be52662665ff020a3e872364f8c028968cfdfbfd118fcddf" }, "downloads": -1, "filename": "dyneusr-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e336612aa692bd0e9a753c46ceb8b56e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 34561, "upload_time": "2019-06-04T19:09:00", "url": "https://files.pythonhosted.org/packages/10/d5/9f3560ea888d3e1eb8661e5f0ac2fdfbe5ff3fc0e8d98d0b2be77b26e8f1/dyneusr-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "98d112748a58371d2547e6f4d5cd6478", "sha256": "1b3feb18a6721920015ffce4a6e1be836240c8419d752d1c8d396b44e04fd1a4" }, "downloads": -1, "filename": "dyneusr-0.3.1.tar.gz", "has_sig": false, "md5_digest": "98d112748a58371d2547e6f4d5cd6478", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 32561, "upload_time": "2019-06-04T19:09:03", "url": "https://files.pythonhosted.org/packages/13/93/9b51b4a86821f953a35574d7d8e8a7363f7c0892bb4fb2c35ac49b9ad1f7/dyneusr-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "70bd3d255b778e10d3d219ee9f373352", "sha256": "c8609e23ab8c2a104769ba7bcc2d8f49ce428251c33ccd1eba07c208b45bd2ed" }, "downloads": -1, "filename": "dyneusr-0.3.2-py3-none-any.whl", "has_sig": false, "md5_digest": "70bd3d255b778e10d3d219ee9f373352", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 59281, "upload_time": "2019-06-04T21:52:06", "url": "https://files.pythonhosted.org/packages/35/a0/05b434f47193d3bff47582a8ad04716c4fa0ead364540f3d96bc0ddc512c/dyneusr-0.3.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "65c5a16265351c7edecee02e3f3c2f36", "sha256": "3c0f5d1ce14190f8cd8c83322fe4e2af92bd9dbcf53530bbe2adbe458e70fb30" }, "downloads": -1, "filename": "dyneusr-0.3.2.tar.gz", "has_sig": false, "md5_digest": "65c5a16265351c7edecee02e3f3c2f36", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 52205, "upload_time": "2019-06-04T21:52:12", "url": "https://files.pythonhosted.org/packages/d7/f5/2469ad6e0f93029f40012a146f11eae225287c4fa612ad7ac9f585ca24b3/dyneusr-0.3.2.tar.gz" } ], "0.3.2.dev0": [ { "comment_text": "", "digests": { "md5": "87ca39a8f229661fb673cb22296c2b6b", "sha256": "a07e78bd486d276303ad02d23fb3a6b30fde24d4af24de7649e85cea66b06e8b" }, "downloads": -1, "filename": "dyneusr-0.3.2.dev0-py3.7.egg", "has_sig": false, "md5_digest": "87ca39a8f229661fb673cb22296c2b6b", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": ">=3.6", "size": 72880, "upload_time": "2019-06-04T21:52:11", "url": "https://files.pythonhosted.org/packages/5c/7d/e8399690acbe65f9eadb4d0b37fb5137660b40aa195582d2d5d74e768441/dyneusr-0.3.2.dev0-py3.7.egg" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "91f62877600209adfd91b220e7d91578", "sha256": "f46fc5a70e9763039c8f459a9fff4e19043b914bf4e0e741a12c6c6a6a49fd4f" }, "downloads": -1, "filename": "dyneusr-0.3.4-py3-none-any.whl", "has_sig": false, "md5_digest": "91f62877600209adfd91b220e7d91578", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 59452, "upload_time": "2019-06-04T22:26:54", "url": "https://files.pythonhosted.org/packages/1b/12/606d125a5e892ed06f1348d59877eb037808bc77df32f24996b610d87ec0/dyneusr-0.3.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "199b36a437c5ce481852f4b2f3251f41", "sha256": "5d78364d4c239d06d4b57178c0630a263c7e89f8e023bff1856ef20938c63be0" }, "downloads": -1, "filename": "dyneusr-0.3.4.tar.gz", "has_sig": false, "md5_digest": "199b36a437c5ce481852f4b2f3251f41", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 52551, "upload_time": "2019-06-04T22:26:59", "url": "https://files.pythonhosted.org/packages/40/c6/4d1bf6e58a7543c7167448918eddf4185222cf80d94df0ab07bc4f4b72c8/dyneusr-0.3.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "91f62877600209adfd91b220e7d91578", "sha256": "f46fc5a70e9763039c8f459a9fff4e19043b914bf4e0e741a12c6c6a6a49fd4f" }, "downloads": -1, "filename": "dyneusr-0.3.4-py3-none-any.whl", "has_sig": false, "md5_digest": "91f62877600209adfd91b220e7d91578", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 59452, "upload_time": "2019-06-04T22:26:54", "url": "https://files.pythonhosted.org/packages/1b/12/606d125a5e892ed06f1348d59877eb037808bc77df32f24996b610d87ec0/dyneusr-0.3.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "199b36a437c5ce481852f4b2f3251f41", "sha256": "5d78364d4c239d06d4b57178c0630a263c7e89f8e023bff1856ef20938c63be0" }, "downloads": -1, "filename": "dyneusr-0.3.4.tar.gz", "has_sig": false, "md5_digest": "199b36a437c5ce481852f4b2f3251f41", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 52551, "upload_time": "2019-06-04T22:26:59", "url": "https://files.pythonhosted.org/packages/40/c6/4d1bf6e58a7543c7167448918eddf4185222cf80d94df0ab07bc4f4b72c8/dyneusr-0.3.4.tar.gz" } ] }