theonerig


Nametheonerig JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/Tom-TBT/theonerig
SummaryTimeseries synchronisation toolkit for computational neuroscience
upload_time2023-05-17 14:48:00
maintainer
docs_urlNone
authorTom Boissonnet
requires_python>=3.9
licenseApache Software License 2.0
keywords neuroscience synchronisation timeserie pipeline
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Theonerig

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

``` python
#hide
from theonerig.core import *
from theonerig.testdata import *

locals().update(load_vivo_2p("./files/vivo_2p"))
```

    Importing the record master

    Returning stim_d, S_matrix, A_matrix, proj_TP, proj_DATA, eye_TP, eye_DATA, treadm_DATA, len_records, rec_TP, reM

## Install

So far there is no easy install, just clone the folder form github and
within the folder install it with pip. We also recommend you to create
an environment with conda:

`conda create -n tor` python=3.6<br> `activate tor` for windows or
`source activate tor` for linux/mac<br> `pip install packaging`<br>
`pip install -e .`<br>

Later we will put it on pip so you can install it with
`pip install theonerig`

## How to use

Some example data are located in the “files” folder. We are gonna use
data from the subfolder “vivo_2p”, acquired by the Asari Lab @ EMBL
Rome.<br><br>The main idea behind this library is to use a main
timeserie to synchronize other data streams from various source. Once
done, it allows easy slicing of the data and apply to it any processing.

### Slicing made easy

An experiment is stored in a Record_Master object (called here reM):
Each row shows a stream of data aligned to “main_tp”. <br><br>Data can
be sparse, meaning that you don’t necessarly possess data of each row
for the total duration of the record, and can be in multiple chuncks.

``` python
reM.plot()
```

![](index_files/figure-commonmark/cell-3-output-1.png)

Now that we have such dataset, we will use the second main feature of
this package, the Data_Pipe. With it, we choose at its creation which
rows we want to obtain. In that case, we take “checkerboard” which is a
matrix of the stimulus values , the “S_matrix” which is the response of
neurons extracted from calcium imaging, and “eye_tracking” to take in
account the mouse eye position to compute the response.

``` python
pipe = Data_Pipe(reM, ["checkerboard", "S_matrix", "eye_tracking"])
```

Now that the pipe is defined, we can use aritmetic and logic operations
to choose which part of the record we want data from:

``` python
pipe += "checkerboard" #Add part of the data where checkerboard is present
reM.plot()
pipe.plot()
```

![](index_files/figure-commonmark/cell-5-output-1.png)

``` python
pipe[0]["S_matrix"].shape
```

    (36000, 2)

``` python
#Select all cell responses where there is no stimulus

pipe += "S_matrix" 
pipe -= "stim" #use the fact that data are within a class [sync, data, stim, cell] to filter them all at the same time
reM.plot()
pipe.plot()
```

![](index_files/figure-commonmark/cell-7-output-1.png)

``` python
#Select all cell responses where there is a stimulus. Note the darkness stimulus longer 
#than the corresponding S_matrix

pipe += "S_matrix" #Add all the chuncks of data where there is an S_matrix
pipe &= "stim" #use the fact that data are within a class [sync, data, stim, cell] to filter them all at the same time
reM.plot()
pipe.plot()
```

![](index_files/figure-commonmark/cell-8-output-1.png)

Then, the pipe can be iterated and return each separated chunk of data
as a dictionnary containg each data selected

``` python
print(pipe[0].keys())
for data_dict in pipe:
    print(data_dict["checkerboard"].shape, data_dict["S_matrix"].shape, data_dict["eye_tracking"].shape)
```

    dict_keys(['checkerboard', 'S_matrix', 'eye_tracking'])
    (23303, 15, 20) (23303, 2) (23303, 5)
    (36000, 15, 20) (36000, 2) (36000, 5)
    (36000, 15, 20) (36000, 2) (36000, 5)
    (40800, 15, 20) (40800, 2) (40800, 5)
    (10200, 15, 20) (10200, 2) (10200, 5)
    (8680, 15, 20) (8680, 2) (8680, 5)
    (18000, 15, 20) (18000, 2) (18000, 5)

Note here the checkerboard. We possess actual data for only one chunk,
but because default values are set for each dataset, the pipe is able to
return a dataset for each part of the record. This allows to easily
workaround records with missing data without crashing.

# Export your synchronise records or import the records of your friends

Once the reM is in its final state, export it as such

``` python
export_record("path/for/my/record/reM_coolname.h5", reM)
```

As you can see, the record is in a .h5 format, so it can be explored and
imported with any other H5 solution.<br> But the best way is still to
open it with theonerig!

``` python
import_record("path/for/my/record/reM_coolname.h5")
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Tom-TBT/theonerig",
    "name": "theonerig",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "neuroscience synchronisation timeserie pipeline",
    "author": "Tom Boissonnet",
    "author_email": "tom.boissonnet@hotmail.fr",
    "download_url": "https://files.pythonhosted.org/packages/c7/53/9527111d507cf710645b62f828a48a197f13ccb41049bca5aef3b5661f10/theonerig-1.0.1.tar.gz",
    "platform": null,
    "description": "# Theonerig\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n``` python\n#hide\nfrom theonerig.core import *\nfrom theonerig.testdata import *\n\nlocals().update(load_vivo_2p(\"./files/vivo_2p\"))\n```\n\n    Importing the record master\n\n    Returning stim_d, S_matrix, A_matrix, proj_TP, proj_DATA, eye_TP, eye_DATA, treadm_DATA, len_records, rec_TP, reM\n\n## Install\n\nSo far there is no easy install, just clone the folder form github and\nwithin the folder install it with pip. We also recommend you to create\nan environment with conda:\n\n`conda create -n tor` python=3.6<br> `activate tor` for windows or\n`source activate tor` for linux/mac<br> `pip install packaging`<br>\n`pip install -e .`<br>\n\nLater we will put it on pip so you can install it with\n`pip install theonerig`\n\n## How to use\n\nSome example data are located in the \u201cfiles\u201d folder. We are gonna use\ndata from the subfolder \u201cvivo_2p\u201d, acquired by the Asari Lab @ EMBL\nRome.<br><br>The main idea behind this library is to use a main\ntimeserie to synchronize other data streams from various source. Once\ndone, it allows easy slicing of the data and apply to it any processing.\n\n### Slicing made easy\n\nAn experiment is stored in a Record_Master object (called here reM):\nEach row shows a stream of data aligned to \u201cmain_tp\u201d. <br><br>Data can\nbe sparse, meaning that you don\u2019t necessarly possess data of each row\nfor the total duration of the record, and can be in multiple chuncks.\n\n``` python\nreM.plot()\n```\n\n![](index_files/figure-commonmark/cell-3-output-1.png)\n\nNow that we have such dataset, we will use the second main feature of\nthis package, the Data_Pipe. With it, we choose at its creation which\nrows we want to obtain. In that case, we take \u201ccheckerboard\u201d which is a\nmatrix of the stimulus values , the \u201cS_matrix\u201d which is the response of\nneurons extracted from calcium imaging, and \u201ceye_tracking\u201d to take in\naccount the mouse eye position to compute the response.\n\n``` python\npipe = Data_Pipe(reM, [\"checkerboard\", \"S_matrix\", \"eye_tracking\"])\n```\n\nNow that the pipe is defined, we can use aritmetic and logic operations\nto choose which part of the record we want data from:\n\n``` python\npipe += \"checkerboard\" #Add part of the data where checkerboard is present\nreM.plot()\npipe.plot()\n```\n\n![](index_files/figure-commonmark/cell-5-output-1.png)\n\n``` python\npipe[0][\"S_matrix\"].shape\n```\n\n    (36000, 2)\n\n``` python\n#Select all cell responses where there is no stimulus\n\npipe += \"S_matrix\" \npipe -= \"stim\" #use the fact that data are within a class [sync, data, stim, cell] to filter them all at the same time\nreM.plot()\npipe.plot()\n```\n\n![](index_files/figure-commonmark/cell-7-output-1.png)\n\n``` python\n#Select all cell responses where there is a stimulus. Note the darkness stimulus longer \n#than the corresponding S_matrix\n\npipe += \"S_matrix\" #Add all the chuncks of data where there is an S_matrix\npipe &= \"stim\" #use the fact that data are within a class [sync, data, stim, cell] to filter them all at the same time\nreM.plot()\npipe.plot()\n```\n\n![](index_files/figure-commonmark/cell-8-output-1.png)\n\nThen, the pipe can be iterated and return each separated chunk of data\nas a dictionnary containg each data selected\n\n``` python\nprint(pipe[0].keys())\nfor data_dict in pipe:\n    print(data_dict[\"checkerboard\"].shape, data_dict[\"S_matrix\"].shape, data_dict[\"eye_tracking\"].shape)\n```\n\n    dict_keys(['checkerboard', 'S_matrix', 'eye_tracking'])\n    (23303, 15, 20) (23303, 2) (23303, 5)\n    (36000, 15, 20) (36000, 2) (36000, 5)\n    (36000, 15, 20) (36000, 2) (36000, 5)\n    (40800, 15, 20) (40800, 2) (40800, 5)\n    (10200, 15, 20) (10200, 2) (10200, 5)\n    (8680, 15, 20) (8680, 2) (8680, 5)\n    (18000, 15, 20) (18000, 2) (18000, 5)\n\nNote here the checkerboard. We possess actual data for only one chunk,\nbut because default values are set for each dataset, the pipe is able to\nreturn a dataset for each part of the record. This allows to easily\nworkaround records with missing data without crashing.\n\n# Export your synchronise records or import the records of your friends\n\nOnce the reM is in its final state, export it as such\n\n``` python\nexport_record(\"path/for/my/record/reM_coolname.h5\", reM)\n```\n\nAs you can see, the record is in a .h5 format, so it can be explored and\nimported with any other H5 solution.<br> But the best way is still to\nopen it with theonerig!\n\n``` python\nimport_record(\"path/for/my/record/reM_coolname.h5\")\n```\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "Timeseries synchronisation toolkit for computational neuroscience",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/Tom-TBT/theonerig"
    },
    "split_keywords": [
        "neuroscience",
        "synchronisation",
        "timeserie",
        "pipeline"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "65a83116e9dcb40afbaea017bcd60d23a8a9226982e061f22802be6ef8926dc7",
                "md5": "c3a123d5feee0eaa101b5d6034dd16d5",
                "sha256": "07709fdfd36a7f2e16ea999242e6a23ccad500addd71c82407b38d85a0f9c335"
            },
            "downloads": -1,
            "filename": "theonerig-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c3a123d5feee0eaa101b5d6034dd16d5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 97208,
            "upload_time": "2023-05-17T14:47:58",
            "upload_time_iso_8601": "2023-05-17T14:47:58.190648Z",
            "url": "https://files.pythonhosted.org/packages/65/a8/3116e9dcb40afbaea017bcd60d23a8a9226982e061f22802be6ef8926dc7/theonerig-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c7539527111d507cf710645b62f828a48a197f13ccb41049bca5aef3b5661f10",
                "md5": "d0d4bdfccb27e791642d015d111f5e48",
                "sha256": "8bd57a806350603a0e4852d1cd223ad306fb4f4b78ad3617e9bc1386a236a7e4"
            },
            "downloads": -1,
            "filename": "theonerig-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d0d4bdfccb27e791642d015d111f5e48",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 93138,
            "upload_time": "2023-05-17T14:48:00",
            "upload_time_iso_8601": "2023-05-17T14:48:00.631474Z",
            "url": "https://files.pythonhosted.org/packages/c7/53/9527111d507cf710645b62f828a48a197f13ccb41049bca5aef3b5661f10/theonerig-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-17 14:48:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Tom-TBT",
    "github_project": "theonerig",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "theonerig"
}
        
Elapsed time: 0.06647s