{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "463b03ff", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import os, h5py\n", "import matplotlib.pyplot as plt\n", "from sklearn import decomposition\n", "\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "id": "b5a09f6a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "6095" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "source = '/home/sobolev/nevermind/Andrey/data'\n", "\n", "session = '009266_hippoSIT_2023-04-26_08-20-17' # sample session with some PPC units\n", "#session = '009266_hippoSIT_2023-04-28_09-04-09'\n", "#session = '009266_hippoSIT_2023-05-04_09-11-06' # coma session with baseline AEPs\n", "animal = session.split('_')[0]\n", "sessionpath = os.path.join(source, animal, session)\n", "aeps_file = os.path.join(sessionpath, 'AEPs.h5')\n", "\n", "with h5py.File(aeps_file, 'r') as f:\n", " aeps = np.array(f['aeps'])\n", " aeps_events = np.array(f['aeps_events'])\n", " \n", "t_N1 = 20 # all in ms\n", "N1_l, N1_r = 15, 25\n", "P1_l, P1_r = 30, 75\n", "\n", "len(aeps)" ] }, { "cell_type": "markdown", "id": "cfc39b53", "metadata": {}, "source": [ "## Phase / amplitude space" ] }, { "cell_type": "code", "execution_count": null, "id": "aaf72be2", "metadata": {}, "outputs": [], "source": [ "# do bandpass 3-15 and 50 - 80 and look at waveforms" ] }, { "cell_type": "code", "execution_count": null, "id": "a07f8909", "metadata": {}, "outputs": [], "source": [ "# if all good do hilbert and try to look at the phases" ] }, { "cell_type": "code", "execution_count": null, "id": "f6d93eea", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "a56eead9", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "8f5c31df", "metadata": {}, "source": [ "### Active listening - unit correlations" ] }, { "cell_type": "code", "execution_count": 8, "id": "95396069", "metadata": {}, "outputs": [], "source": [ "# putative active listening periods\n", "idxs_active = np.where(i_rate > thresh)[0]\n", "\n", "def get_event_tl_idx(t_event):\n", " return (np.abs(tl[:, 0] - t_event)).argmin()" ] }, { "cell_type": "code", "execution_count": 9, "id": "bb6e6749", "metadata": {}, "outputs": [], "source": [ "# filter tgt / bgr events\n", "sound_events = events[(events[:, 1] == 1) | (events[:, 1] == 2)]\n", "# get active / passive aeps\n", "aeps_al_idxs = np.array([i for i, event in enumerate(sound_events) if get_event_tl_idx(event[0]) in idxs_active])\n", "aeps_pl_idxs = np.array([i for i, event in enumerate(sound_events) if get_event_tl_idx(event[0]) not in idxs_active])\n", "aeps_al = aeps[aeps_al_idxs]\n", "aeps_pl = aeps[aeps_pl_idxs]" ] } ], "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 }