pyNeuroTrace


NamepyNeuroTrace JSON
Version 0.9.5 PyPI version JSON
download
home_pagehttps://github.com/padster/pyNeuroTrace
SummaryPython code for neural time series
upload_time2024-05-10 18:51:38
maintainerNone
docs_urlNone
authorPat Coleman
requires_python>=3.9
licenseNone
keywords neuron analysis timeseries neuroscience
VCS
bugtrack_url
requirements ipython ipywidgets matplotlib matplotlib-scalebar numpy PyQt5 scipy tqdm
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyNeuroTrace: Python code for Neural Timeseries

## Installation
'pyNeuroTrace' can be installed with pip:

```
pip install pyNeuroTrace
```

This library can be installed directly from github, using pip:
```
pip install --upgrade "git+https://github.com/padster/pyNeuroTrace#egg=pyneurotrace&subdirectory=pyneurotrace"
```

## Vizualization

Probably the most useful section of pynt, there are a number of visualization functions provided to help display the trace data in easy to understand formats. For more details, and visual examples of what is available, please consult the [README](https://github.com/padster/pyNeuroTrace/tree/master/pyneurotrace/pyneurotrace) next to viz.py.

## Notebook utilities

Unrelated to neuron time series, but useful when using this regardless, PyNeuroTrace also provides a collection of tools for running analysis in Jupyter notebooks.

These include:

`notebook.filePicker` to selecting an existing file, `notebook.newFilePicker` for indicating a new path, and `notebook.folderPicker` for selecting an existing folder.
> These all open PyQT file dialogs, to make it easy for users to interact with the file system. Customisation options exist, for example prompt and default locations.

`showTabs(data, func, titles, progressBar=False)`
> Useful for performing analysis repeated multiple times across e.g. different neurons, experiments, conditions, ...etc. Given either a list, or dictionary, all items will be iterated over, and each individually drawn onto their own tab with the provided `func`.
The method provided expects `func(idx, key, value)`, where `idx` is the (0-based) index of the tab, `key` is the list/dictionary key, and `value` is what is to be processed.

## Processing Data

Common per-trace processing filters are provided within [filters.py](https://github.com/padster/pyNeuroTrace/blob/master/pyneurotrace/pyneurotrace/filters.py). These are all designed to take a numpy array of traces, with each row an independent trace, and all return a filtered array of the same size.

These include:

`filters.deltaFOverF0(traces, hz, t0, t1, t2)`
> Converts raw signal to the standard Delta-F-over-F0, using the technique given in [Jia et al, 2011](http://doi.org/10.1038/nprot.2010.169). The smoothing parameters (t0, t1, t2) are as described in the paper, all with units in seconds. Sample rate must also be provided to convert these to sample units.

`filters.okada(traces)`
> Reduces noise in traces by smoothing single peaks or valleys, as described in [Okada et al, 2016](https://doi.org/10.1371/journal.pone.0157595)



## Event Detection

Python implementations of the three algorithms discussed in our paper [Sakaki et al, 2018](https://doi.org/10.1109/EMBC.2018.8512983) for finding events within Calcium fluorescent traces.

`ewma(data, weight)`
> calculates the Exponentially-Weighted Moving Average for each trace, given how strongly to weight new points (vs. the previous average).

`cusum(data, slack)`
> calculates the Cumulative Sum for each trace, taking a slack parameter which controls how far from the mean the signal the signal needs to be to not be considered noise.

`matchedFilter(data, windowSize, A, tA, tB)`
> calculates the likelihood ratio for each sample to be the end of a window of expected transient shape, being a double exponential with amplitude A, rise-time tA, and decay-time tB (in samples).

The results of each of these three detection filters can then be passed through `thresholdEvents(data, threshold)`, to register detected events whenever the filter strength increases above the given threshold.

## Reading Data (lab-specific)

The code within this repository was designed to read data from experiments performed by the [Kurt Haas lab](http://www.haaslab.com/) at UBC. If you're from this lab, read below. If not, this part is probably not relevant, but fee free to ask if you'd be interested in loading your own data file formats.

A number of options for loading data files are available within [files.py](https://github.com/padster/pyNeuroTrace/blob/master/pyneurotrace/pyneurotrace/files.py), including:
* `load2PData(path)` takes an experiment output file (e.g STEP_5_EXPT.TXT) and returns ID, XYZ location, and raw intensity values for each node in the experiment.
* `loadMetadata(path)` takes a metadata file (e.g. rscan_metadata_step_5.txt) and returns the stimulus start/stop samples, as well as the sample rate for the experiment.
* `loadTreeStructure(path)` takes a tree structure file (e.g. interp-neuron-.txt) and returns the mapping of node IDs to tree information about that node (e.g. node type, children, ...).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/padster/pyNeuroTrace",
    "name": "pyNeuroTrace",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "neuron, analysis, timeseries, neuroscience",
    "author": "Pat Coleman",
    "author_email": "Pat Coleman <padsterpat@gmail.com>, Peter Hogg <peter.hogg@ubc.ca>",
    "download_url": "https://files.pythonhosted.org/packages/65/e3/a217faa95cf21aaef8002d4a8f65ddc48dafebe22f8956763efd44ef6c91/pyneurotrace-0.9.5.tar.gz",
    "platform": null,
    "description": "# PyNeuroTrace: Python code for Neural Timeseries\n\n## Installation\n'pyNeuroTrace' can be installed with pip:\n\n```\npip install pyNeuroTrace\n```\n\nThis library can be installed directly from github, using pip:\n```\npip install --upgrade \"git+https://github.com/padster/pyNeuroTrace#egg=pyneurotrace&subdirectory=pyneurotrace\"\n```\n\n## Vizualization\n\nProbably the most useful section of pynt, there are a number of visualization functions provided to help display the trace data in easy to understand formats. For more details, and visual examples of what is available, please consult the [README](https://github.com/padster/pyNeuroTrace/tree/master/pyneurotrace/pyneurotrace) next to viz.py.\n\n## Notebook utilities\n\nUnrelated to neuron time series, but useful when using this regardless, PyNeuroTrace also provides a collection of tools for running analysis in Jupyter notebooks.\n\nThese include:\n\n`notebook.filePicker` to selecting an existing file, `notebook.newFilePicker` for indicating a new path, and `notebook.folderPicker` for selecting an existing folder.\n> These all open PyQT file dialogs, to make it easy for users to interact with the file system. Customisation options exist, for example prompt and default locations.\n\n`showTabs(data, func, titles, progressBar=False)`\n> Useful for performing analysis repeated multiple times across e.g. different neurons, experiments, conditions, ...etc. Given either a list, or dictionary, all items will be iterated over, and each individually drawn onto their own tab with the provided `func`.\nThe method provided expects `func(idx, key, value)`, where `idx` is the (0-based) index of the tab, `key` is the list/dictionary key, and `value` is what is to be processed.\n\n## Processing Data\n\nCommon per-trace processing filters are provided within [filters.py](https://github.com/padster/pyNeuroTrace/blob/master/pyneurotrace/pyneurotrace/filters.py). These are all designed to take a numpy array of traces, with each row an independent trace, and all return a filtered array of the same size.\n\nThese include:\n\n`filters.deltaFOverF0(traces, hz, t0, t1, t2)`\n> Converts raw signal to the standard Delta-F-over-F0, using the technique given in [Jia et al, 2011](http://doi.org/10.1038/nprot.2010.169). The smoothing parameters (t0, t1, t2) are as described in the paper, all with units in seconds. Sample rate must also be provided to convert these to sample units.\n\n`filters.okada(traces)`\n> Reduces noise in traces by smoothing single peaks or valleys, as described in [Okada et al, 2016](https://doi.org/10.1371/journal.pone.0157595)\n\n\n\n## Event Detection\n\nPython implementations of the three algorithms discussed in our paper [Sakaki et al, 2018](https://doi.org/10.1109/EMBC.2018.8512983) for finding events within Calcium fluorescent traces.\n\n`ewma(data, weight)`\n> calculates the Exponentially-Weighted Moving Average for each trace, given how strongly to weight new points (vs. the previous average).\n\n`cusum(data, slack)`\n> calculates the Cumulative Sum for each trace, taking a slack parameter which controls how far from the mean the signal the signal needs to be to not be considered noise.\n\n`matchedFilter(data, windowSize, A, tA, tB)`\n> calculates the likelihood ratio for each sample to be the end of a window of expected transient shape, being a double exponential with amplitude A, rise-time tA, and decay-time tB (in samples).\n\nThe results of each of these three detection filters can then be passed through `thresholdEvents(data, threshold)`, to register detected events whenever the filter strength increases above the given threshold.\n\n## Reading Data (lab-specific)\n\nThe code within this repository was designed to read data from experiments performed by the [Kurt Haas lab](http://www.haaslab.com/) at UBC. If you're from this lab, read below. If not, this part is probably not relevant, but fee free to ask if you'd be interested in loading your own data file formats.\n\nA number of options for loading data files are available within [files.py](https://github.com/padster/pyNeuroTrace/blob/master/pyneurotrace/pyneurotrace/files.py), including:\n* `load2PData(path)` takes an experiment output file (e.g STEP_5_EXPT.TXT) and returns ID, XYZ location, and raw intensity values for each node in the experiment.\n* `loadMetadata(path)` takes a metadata file (e.g. rscan_metadata_step_5.txt) and returns the stimulus start/stop samples, as well as the sample rate for the experiment.\n* `loadTreeStructure(path)` takes a tree structure file (e.g. interp-neuron-.txt) and returns the mapping of node IDs to tree information about that node (e.g. node type, children, ...).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python code for neural time series",
    "version": "0.9.5",
    "project_urls": {
        "Homepage": "https://github.com/padster/pyNeuroTrace",
        "Issues": "https://github.com/padster/pyNeuroTrace/issues"
    },
    "split_keywords": [
        "neuron",
        " analysis",
        " timeseries",
        " neuroscience"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2856bae9971c258242be871e92718457b10efb310d90e7419b2877d80f059c55",
                "md5": "8a25aff744ee67d423a7efbeaf3a7e08",
                "sha256": "b1befff1b825a806e28e43365f398645c64064c2c52aca9898553e1dbb221035"
            },
            "downloads": -1,
            "filename": "pyNeuroTrace-0.9.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8a25aff744ee67d423a7efbeaf3a7e08",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 25785,
            "upload_time": "2024-05-10T18:51:37",
            "upload_time_iso_8601": "2024-05-10T18:51:37.301921Z",
            "url": "https://files.pythonhosted.org/packages/28/56/bae9971c258242be871e92718457b10efb310d90e7419b2877d80f059c55/pyNeuroTrace-0.9.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "65e3a217faa95cf21aaef8002d4a8f65ddc48dafebe22f8956763efd44ef6c91",
                "md5": "a8584c082becdcfdff8921f596a987a4",
                "sha256": "4653178727ff810570d0b7fe8fb810298fa9c86295ca92e5af5b3f2579bc1d33"
            },
            "downloads": -1,
            "filename": "pyneurotrace-0.9.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a8584c082becdcfdff8921f596a987a4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 24353,
            "upload_time": "2024-05-10T18:51:38",
            "upload_time_iso_8601": "2024-05-10T18:51:38.401276Z",
            "url": "https://files.pythonhosted.org/packages/65/e3/a217faa95cf21aaef8002d4a8f65ddc48dafebe22f8956763efd44ef6c91/pyneurotrace-0.9.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-10 18:51:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "padster",
    "github_project": "pyNeuroTrace",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "ipython",
            "specs": []
        },
        {
            "name": "ipywidgets",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "matplotlib-scalebar",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "PyQt5",
            "specs": []
        },
        {
            "name": "scipy",
            "specs": []
        },
        {
            "name": "tqdm",
            "specs": []
        }
    ],
    "lcname": "pyneurotrace"
}
        
Elapsed time: 0.33885s