{"id":20944945,"url":"https://github.com/deepcharles/mousemonitor","last_synced_at":"2025-09-11T01:43:01.739Z","repository":{"id":263109866,"uuid":"889376210","full_name":"deepcharles/mousemonitor","owner":"deepcharles","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-16T13:53:03.000Z","size":1484,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T04:17:35.836Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deepcharles.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-16T07:59:41.000Z","updated_at":"2025-03-03T13:28:55.000Z","dependencies_parsed_at":"2024-11-16T09:17:30.348Z","dependency_job_id":"ba181664-e25d-47c5-b786-6d187430a9c0","html_url":"https://github.com/deepcharles/mousemonitor","commit_stats":null,"previous_names":["deepcharles/mousemonitor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deepcharles/mousemonitor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepcharles%2Fmousemonitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepcharles%2Fmousemonitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepcharles%2Fmousemonitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepcharles%2Fmousemonitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepcharles","download_url":"https://codeload.github.com/deepcharles/mousemonitor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepcharles%2Fmousemonitor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266204495,"owners_count":23892360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T23:46:01.254Z","updated_at":"2025-07-20T21:32:41.193Z","avatar_url":"https://github.com/deepcharles.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# An α7 nicotinic and GABAB receptor-mediated pathway controls acetylcholine release in the tripartite neuromuscular junction\n\nPython implementation of the algorithm described in **(Krejci, et al., 2024)**.\n\n- Krejci, E., Konstantin, P., Lenina, O., Bernard, V., Germain, T., Truong, C., Nurullin, L., Sibgatullina, G., Samigullin, D., \u0026 Ohno, K. (2024). An α7 nicotinic and GABAB receptor-mediated pathway controls acetylcholine release in the tripartite neuromuscular junction. The Journal of Physiology.\n\n## Install\n\nClone this repository and within the downloaded directory, execute the following command.\n\n```bash\npython -m pip install .\n```\n\n## Example usage\n\nThe following code perform the active/inactive segmentation on a signal example collected using the protocol in the article.\nThe signal has been preprocessed beforehand.\n\n### Import librairies\n\n\n```python\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom mousemonitor import opt_state_sequence_binary\n```\n\n### Load data and define parameters\n\n\n```python\ndata = np.load(\"example.npz\")\nsignal = data[\"signal\"]\nmvt = data[\"mvt\"]\ntime_array = data[\"time_array\"]\nfs = data[\"fs\"]\nis_active = np.where(np.diff(signal) \u003e 0, 1, -1)\nPENALTY = 3000\n```\n\n### Perform signal segmentation and plot\n\n\n```python\nbkps, opt_state_sequence = opt_state_sequence_binary(is_active, penalty=PENALTY)\n```\n\n\n```python\nfig, (main_plot, main_timeline) = plt.subplots(\n    nrows=2,\n    ncols=1,\n    figsize=(15, 7),\n    sharex=True,\n    gridspec_kw={\"height_ratios\": [6, 1]},\n)\n\nmain_plot.set_xmargin(0)\nmain_plot.set_xlabel(\"Time (h)\")\nmain_plot.set_xticks([1, 3, 5, 7, 9, 11])\nmain_plot.set_ylabel(\"Active - Inactive (min)\")\nmain_plot.set_ylim(-500, 500)\nmain_plot.axhline(0, color=\"k\", alpha=0.1)\n\nmain_timeline.set_xmargin(0)\nmain_timeline.set_xlabel(\"Time (h)\")\nmain_timeline.set_xticks([1, 3, 5, 7, 9, 11])\nmain_timeline.set_yticks([])\n\nmain_plot.plot(time_array[:-1] / 3600, np.cumsum(is_active) / fs / 60, color=\"b\")\nfor b in bkps:\n    main_plot.axvline(time_array[b] / 3600, ls=\"--\", color=\"k\", alpha=0.2)\n\nmain_timeline.imshow(\n    1 - opt_state_sequence[None, :],\n    aspect=\"auto\",\n    cmap=\"Greens\",\n    interpolation=\"nearest\",\n    extent=[0, 12, 0, 1],\n    alpha=0.8,\n    vmax=2,\n    vmin=-0.5,\n)\nfig.tight_layout()\n```\n    \n![png](static/segmentation.png)\n    \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepcharles%2Fmousemonitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepcharles%2Fmousemonitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepcharles%2Fmousemonitor/lists"}