Quellcode durchsuchen

added moseq behavior + updates to the rest

asobolev vor 1 Jahr
Ursprung
Commit
fac19c0062

Datei-Diff unterdrückt, da er zu groß ist
+ 64 - 87
analysis/AEPs/preprocessing.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 427 - 0
analysis/Behavior/GLM.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 506 - 0
analysis/Behavior/Unit-to-MoSeq GLM Fit.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 610 - 0
analysis/Behavior/preprocessing.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 378 - 373
analysis/Behavior/syllables.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 13 - 12
analysis/CCR/AEP metrics.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 62 - 151
analysis/CCR/Events.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 123 - 118
analysis/LFP Spectrum.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 34 - 46
analysis/PSTH/By unit.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 69 - 47
analysis/PSTH/PSTH.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 25 - 39
analysis/PSTH/shuffle.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 24 - 306
analysis/Target Onset/population - micro.ipynb


Datei-Diff unterdrückt, da er zu groß ist
+ 532 - 0
analysis/Target Onset/population - z-scored response.ipynb


+ 8 - 0
analysis/loading.py

@@ -45,6 +45,13 @@ def load_session_data(session):
         aeps['HPC'][aeps['HPC'] < -1500] =  -1500
     aeps[areas[0]].shape
     
+    # load LFP
+    lfp = {}
+    with h5py.File(aeps_file, 'r') as f:
+        for area in areas:
+            if 'LFP' in f[area]:
+                lfp[area] = np.array(f[area]['LFP'])
+    
     # load AEP metrics
     AEP_metrics_lims = dict([(area, {}) for area in areas])
     AEP_metrics_raw  = dict([(area, {}) for area in areas])
@@ -83,6 +90,7 @@ def load_session_data(session):
         'areas': areas,
         'aeps': aeps,
         'aeps_events': aeps_events,
+        'lfp': lfp,
         'AEP_metrics_lims': AEP_metrics_lims,
         'AEP_metrics_raw': AEP_metrics_raw,
         'AEP_metrics_norm': AEP_metrics_norm,

Datei-Diff unterdrückt, da er zu groß ist
+ 161 - 174
postprocessing/MoSeq.ipynb


+ 44 - 239
postprocessing/execute.ipynb

@@ -116,11 +116,13 @@
     "#'009266_hippoSIT_2023-04-21_13-12-31',  # A1 ch20, PPC ch32, 72 + 55 correction, 6041 events\n",
     "#'009266_hippoSIT_2023-04-24_10-08-11',  # A1 ch20, PPC ch40, 80 + 55 correction, 5579 events\n",
     "    # HPC\n",
-    "'009266_hippoSIT_2023-05-22_09-27-22',\n",
-    "'009266_hippoSIT_2023-05-23_09-18-05',\n",
-    "'009266_hippoSIT_2023-05-25_15-55-57',\n",
-    "'009266_hippoSIT_2023-06-14_08-21-23',\n",
-    "'009266_hippoSIT_2023-06-19_08-58-35',\n",
+    "# '009266_hippoSIT_2023-05-22_09-27-22',\n",
+    "# '009266_hippoSIT_2023-05-23_09-18-05',\n",
+    "# '009266_hippoSIT_2023-05-25_15-55-57',\n",
+    "# '009266_hippoSIT_2023-06-14_08-21-23',\n",
+    "# '009266_hippoSIT_2023-06-19_08-58-35',\n",
+    "    \n",
+    "'009265_hippoSIT_2023-02-28_20-45-04'\n",
     "]\n",
     "\n",
     "# FIXME move occupancy outside units\n",
@@ -168,11 +170,7 @@
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "session 009266_hippoSIT_2023-05-22_09-27-22 done\n",
-      "session 009266_hippoSIT_2023-05-23_09-18-05 done\n",
-      "session 009266_hippoSIT_2023-05-25_15-55-57 done\n",
-      "session 009266_hippoSIT_2023-06-14_08-21-23 done\n",
-      "session 009266_hippoSIT_2023-06-19_08-58-35 done\n"
+      "session 009265_hippoSIT_2023-02-28_20-45-04 done\n"
      ]
     }
    ],
@@ -682,254 +680,61 @@
     "        units = []"
    ]
   },
+  {
+   "cell_type": "markdown",
+   "id": "f5c286d0",
+   "metadata": {},
+   "source": [
+    "## Test sounds csv for delays"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "id": "d48b4b8c",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "session = '009266_hippoSIT_2023-05-04_19-47-15'\n",
+    "animal = '009266'\n",
+    "sessionpath = os.path.join(source, animal, session)"
+   ]
+  },
   {
    "cell_type": "code",
-   "execution_count": 45,
-   "id": "e10c7239",
+   "execution_count": 7,
+   "id": "349972b8",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "sounds = np.loadtxt(os.path.join(sessionpath, 'sounds.csv'), skiprows=1, delimiter=',')"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 8,
+   "id": "1d5e760b",
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "['1-10',\n",
-       " '1-11',\n",
-       " '1-12',\n",
-       " '1-13',\n",
-       " '1-14',\n",
-       " '1-15',\n",
-       " '1-16',\n",
-       " '1-17',\n",
-       " '1-18',\n",
-       " '1-19',\n",
-       " '1-2',\n",
-       " '1-20',\n",
-       " '1-21',\n",
-       " '1-22',\n",
-       " '1-23',\n",
-       " '1-24',\n",
-       " '1-25',\n",
-       " '1-26',\n",
-       " '1-27',\n",
-       " '1-28',\n",
-       " '1-29',\n",
-       " '1-3',\n",
-       " '1-30',\n",
-       " '1-31',\n",
-       " '1-32',\n",
-       " '1-33',\n",
-       " '1-34',\n",
-       " '1-35',\n",
-       " '1-36',\n",
-       " '1-37',\n",
-       " '1-38',\n",
-       " '1-39',\n",
-       " '1-4',\n",
-       " '1-40',\n",
-       " '1-41',\n",
-       " '1-42',\n",
-       " '1-43',\n",
-       " '1-44',\n",
-       " '1-45',\n",
-       " '1-46',\n",
-       " '1-47',\n",
-       " '1-48',\n",
-       " '1-49',\n",
-       " '1-5',\n",
-       " '1-6',\n",
-       " '1-7',\n",
-       " '1-8',\n",
-       " '1-9',\n",
-       " '2-10',\n",
-       " '2-11',\n",
-       " '2-12',\n",
-       " '2-13',\n",
-       " '2-14',\n",
-       " '2-15',\n",
-       " '2-16',\n",
-       " '2-17',\n",
-       " '2-18',\n",
-       " '2-19',\n",
-       " '2-2',\n",
-       " '2-20',\n",
-       " '2-21',\n",
-       " '2-22',\n",
-       " '2-23',\n",
-       " '2-24',\n",
-       " '2-25',\n",
-       " '2-26',\n",
-       " '2-27',\n",
-       " '2-28',\n",
-       " '2-29',\n",
-       " '2-3',\n",
-       " '2-30',\n",
-       " '2-31',\n",
-       " '2-32',\n",
-       " '2-33',\n",
-       " '2-34',\n",
-       " '2-35',\n",
-       " '2-36',\n",
-       " '2-37',\n",
-       " '2-38',\n",
-       " '2-39',\n",
-       " '2-4',\n",
-       " '2-40',\n",
-       " '2-41',\n",
-       " '2-42',\n",
-       " '2-43',\n",
-       " '2-44',\n",
-       " '2-45',\n",
-       " '2-46',\n",
-       " '2-47',\n",
-       " '2-48',\n",
-       " '2-49',\n",
-       " '2-5',\n",
-       " '2-50',\n",
-       " '2-51',\n",
-       " '2-52',\n",
-       " '2-53',\n",
-       " '2-54',\n",
-       " '2-55',\n",
-       " '2-56',\n",
-       " '2-57',\n",
-       " '2-58',\n",
-       " '2-59',\n",
-       " '2-6',\n",
-       " '2-60',\n",
-       " '2-61',\n",
-       " '2-62',\n",
-       " '2-63',\n",
-       " '2-64',\n",
-       " '2-65',\n",
-       " '2-66',\n",
-       " '2-67',\n",
-       " '2-68',\n",
-       " '2-7',\n",
-       " '2-8',\n",
-       " '2-9',\n",
-       " '3-10',\n",
-       " '3-11',\n",
-       " '3-12',\n",
-       " '3-13',\n",
-       " '3-14',\n",
-       " '3-15',\n",
-       " '3-16',\n",
-       " '3-17',\n",
-       " '3-18',\n",
-       " '3-19',\n",
-       " '3-2',\n",
-       " '3-20',\n",
-       " '3-21',\n",
-       " '3-22',\n",
-       " '3-23',\n",
-       " '3-24',\n",
-       " '3-25',\n",
-       " '3-26',\n",
-       " '3-27',\n",
-       " '3-28',\n",
-       " '3-29',\n",
-       " '3-3',\n",
-       " '3-30',\n",
-       " '3-31',\n",
-       " '3-32',\n",
-       " '3-33',\n",
-       " '3-34',\n",
-       " '3-35',\n",
-       " '3-4',\n",
-       " '3-5',\n",
-       " '3-6',\n",
-       " '3-7',\n",
-       " '3-8',\n",
-       " '3-9',\n",
-       " '4-10',\n",
-       " '4-11',\n",
-       " '4-12',\n",
-       " '4-13',\n",
-       " '4-14',\n",
-       " '4-15',\n",
-       " '4-16',\n",
-       " '4-17',\n",
-       " '4-18',\n",
-       " '4-19',\n",
-       " '4-2',\n",
-       " '4-20',\n",
-       " '4-21',\n",
-       " '4-22',\n",
-       " '4-23',\n",
-       " '4-3',\n",
-       " '4-4',\n",
-       " '4-5',\n",
-       " '4-6',\n",
-       " '4-7',\n",
-       " '4-8',\n",
-       " '4-9',\n",
-       " '5-10',\n",
-       " '5-11',\n",
-       " '5-12',\n",
-       " '5-13',\n",
-       " '5-14',\n",
-       " '5-15',\n",
-       " '5-16',\n",
-       " '5-17',\n",
-       " '5-18',\n",
-       " '5-19',\n",
-       " '5-2',\n",
-       " '5-20',\n",
-       " '5-21',\n",
-       " '5-22',\n",
-       " '5-23',\n",
-       " '5-24',\n",
-       " '5-25',\n",
-       " '5-26',\n",
-       " '5-27',\n",
-       " '5-28',\n",
-       " '5-29',\n",
-       " '5-3',\n",
-       " '5-30',\n",
-       " '5-4',\n",
-       " '5-5',\n",
-       " '5-6',\n",
-       " '5-7',\n",
-       " '5-8',\n",
-       " '5-9',\n",
-       " '6-10',\n",
-       " '6-11',\n",
-       " '6-12',\n",
-       " '6-13',\n",
-       " '6-14',\n",
-       " '6-15',\n",
-       " '6-16',\n",
-       " '6-17',\n",
-       " '6-18',\n",
-       " '6-19',\n",
-       " '6-2',\n",
-       " '6-20',\n",
-       " '6-21',\n",
-       " '6-22',\n",
-       " '6-23',\n",
-       " '6-24',\n",
-       " '6-25',\n",
-       " '6-3',\n",
-       " '6-4',\n",
-       " '6-5',\n",
-       " '6-6',\n",
-       " '6-7',\n",
-       " '6-8',\n",
-       " '6-9']"
+       "(9599, 2)"
       ]
      },
-     "execution_count": 45,
+     "execution_count": 8,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
    "source": [
-    "units"
+    "sounds.shape"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "6f5d5ba7",
+   "id": "fadf4d9c",
    "metadata": {},
    "outputs": [],
    "source": []

+ 98 - 0
session/copying.ipynb

@@ -0,0 +1,98 @@
+{
+ "cells": [
+  {
+   "cell_type": "code",
+   "execution_count": 2,
+   "id": "6caa74a0",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import shutil\n",
+    "import os, sys"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "id": "b4a07ca0",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# copying selected videos\n",
+    "\n",
+    "src = '/home/sobolev/nevermind/Andrey/data'\n",
+    "dst = '/home/sobolev/nevermind/Andrey/analysis/MoSeq/'\n",
+    "\n",
+    "animal = '009265'\n",
+    "\n",
+    "sessions = [\n",
+    "'009265_hippoSIT_2023-02-24_09-53-26',\n",
+    "'009265_hippoSIT_2023-02-24_17-22-46',\n",
+    "'009265_hippoSIT_2023-02-27_10-18-32',\n",
+    "'009265_hippoSIT_2023-02-27_15-33-46',\n",
+    "'009265_hippoSIT_2023-02-28_09-16-50',\n",
+    "'009265_hippoSIT_2023-02-28_13-16-10',\n",
+    "'009265_hippoSIT_2023-02-28_20-45-04',\n",
+    "'009265_hippoSIT_2023-03-01_10-46-12',\n",
+    "'009265_hippoSIT_2023-03-02_09-32-54',\n",
+    "'009265_hippoSIT_2023-03-02_16-27-42',\n",
+    "'009265_hippoSIT_2023-03-02_20-11-35',\n",
+    "'009265_hippoSIT_2023-03-03_09-37-07',\n",
+    "'009265_hippoSIT_2023-03-03_16-00-47',\n",
+    "'009265_hippoSIT_2023-03-04_11-12-04',\n",
+    "'009265_hippoSIT_2023-03-05_11-52-17',\n",
+    "'009265_hippoSIT_2023-03-05_18-31-32',\n",
+    "'009265_hippoSIT_2023-03-08_18-10-07',\n",
+    "'009265_hippoSIT_2023-03-09_20-03-08',\n",
+    "'009265_hippoSIT_2023-03-10_09-57-34',\n",
+    "'009265_hippoSIT_2023-04-13_09-54-39',\n",
+    "'009265_hippoSIT_2023-04-20_11-39-02'\n",
+    "]\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "id": "a36fc55f",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "for session in sessions:\n",
+    "    \n",
+    "    src_fname = os.path.join(src, animal, session, 'video.avi')\n",
+    "    dst_fname = os.path.join(dst, animal, '%s.avi' % session)\n",
+    "\n",
+    "    shutil.copyfile(src_fname, dst_fname)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "959c3a6f",
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "Python 3 (ipykernel)",
+   "language": "python",
+   "name": "python3"
+  },
+  "language_info": {
+   "codemirror_mode": {
+    "name": "ipython",
+    "version": 3
+   },
+   "file_extension": ".py",
+   "mimetype": "text/x-python",
+   "name": "python",
+   "nbconvert_exporter": "python",
+   "pygments_lexer": "ipython3",
+   "version": "3.8.10"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}

+ 1 - 1
session/sessions.py

@@ -13,7 +13,7 @@ selected_009266 = [
 '009266_hippoSIT_2023-04-24_16-56-55',  # ch17, 5 + 55* correction, 6165 events, frequency
 '009266_hippoSIT_2023-04-26_08-20-17',  # ch17, 12 + 55* correction, 6095 events, duration - showcase for N2 
 '009266_hippoSIT_2023-05-02_12-22-14',  # ch20, 10 + 55 correction, 5976 events, FIXME very weird 1-2nd in target, find out
-'009266_hippoSIT_2023-05-04_09-11-06',  # ch17, 5 + 55* correction, 4487 events, COMA session with baseline AEPs
+#'009266_hippoSIT_2023-05-04_09-11-06',  # ch17, 5 + 55* correction, 4487 events, COMA session with baseline AEPs
 '009266_hippoSIT_2023-05-04_19-47-15',  # ch20, 2 + 55 correction, 5678 events, duration
     
 # HPC