From 93bb6d4cc0e7d97e6b1a81368786deb015cdb0e4 Mon Sep 17 00:00:00 2001 From: Kushal Bakshi <52367253+kushalbakshi@users.noreply.github.com> Date: Wed, 17 Jan 2024 12:10:59 +0000 Subject: [PATCH] Minor fixes to tutorial notebook --- notebooks/tutorial.ipynb | 2120 +++++++++++++++++++++++++++++++++++--- 1 file changed, 1963 insertions(+), 157 deletions(-) diff --git a/notebooks/tutorial.ipynb b/notebooks/tutorial.ipynb index efd021a..6d3687a 100644 --- a/notebooks/tutorial.ipynb +++ b/notebooks/tutorial.ipynb @@ -54,10 +54,7 @@ "metadata": {}, "outputs": [], "source": [ - "import datajoint as dj\n", - "import datetime\n", - "import matplotlib.pyplot as plt\n", - "import numpy as np" + "import datajoint as dj" ] }, { @@ -71,15 +68,15 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "[2024-01-04 20:00:17,037][INFO]: Connecting root@fakeservices.datajoint.io:3306\n", - "[2024-01-04 20:00:17,044][INFO]: Connected root@fakeservices.datajoint.io:3306\n" + "[2024-01-17 12:07:52,612][INFO]: Connecting root@fakeservices.datajoint.io:3306\n", + "[2024-01-17 12:07:52,620][INFO]: Connected root@fakeservices.datajoint.io:3306\n" ] }, { @@ -88,7 +85,7 @@ "DataJoint connection (connected) root@fakeservices.datajoint.io:3306" ] }, - "execution_count": 2, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -110,14 +107,14 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "[2024-01-04 20:00:18,332][WARNING]: lab.Project and related tables will be removed in a future version of Element Lab. Please use the project schema.\n" + "[2024-01-17 12:07:58,189][WARNING]: lab.Project and related tables will be removed in a future version of Element Lab. Please use the project schema.\n" ] } ], @@ -145,179 +142,179 @@ "\n", "%3\n", "\n", - "\n", - "\n", - "optogenetics.OptoWaveform.Square\n", - "\n", - "\n", - "optogenetics.OptoWaveform.Square\n", - "\n", - "\n", - "\n", "\n", - "\n", + "\n", "Device\n", - "\n", + "\n", "\n", "Device\n", "\n", "\n", "\n", "\n", - "\n", + "\n", "optogenetics.OptoProtocol\n", - "\n", - "\n", - "optogenetics.OptoProtocol\n", + "\n", + "\n", + "optogenetics.OptoProtocol\n", "\n", "\n", "\n", "\n", "\n", "Device->optogenetics.OptoProtocol\n", - "\n", + "\n", "\n", - "\n", - "\n", - "surgery.Implantation\n", - "\n", - "\n", - "surgery.Implantation\n", + "\n", + "\n", + "subject.Subject\n", + "\n", + "\n", + "subject.Subject\n", "\n", "\n", "\n", - "\n", + "\n", + "\n", + "session.Session\n", + "\n", + "\n", + "session.Session\n", + "\n", + "\n", + "\n", + "\n", "\n", - "surgery.Implantation->optogenetics.OptoProtocol\n", - "\n", + "subject.Subject->session.Session\n", + "\n", "\n", - "\n", - "\n", - "subject.Subject\n", - "\n", - "\n", - "subject.Subject\n", + "\n", + "\n", + "surgery.Implantation\n", + "\n", + "\n", + "surgery.Implantation\n", "\n", "\n", "\n", "\n", "\n", "subject.Subject->surgery.Implantation\n", - "\n", + "\n", "\n", - "\n", - "\n", - "session.Session\n", - "\n", - "\n", - "session.Session\n", + "\n", + "\n", + "optogenetics.OptoEvent\n", + "\n", + "\n", + "optogenetics.OptoEvent\n", "\n", "\n", "\n", - "\n", + "\n", "\n", - "subject.Subject->session.Session\n", - "\n", + "optogenetics.OptoProtocol->optogenetics.OptoEvent\n", + "\n", "\n", "\n", - "\n", + "\n", "optogenetics.OptoWaveformType\n", - "\n", - "\n", - "optogenetics.OptoWaveformType\n", + "\n", + "\n", + "optogenetics.OptoWaveformType\n", "\n", "\n", "\n", "\n", - "\n", + "\n", "optogenetics.OptoWaveform\n", - "\n", - "\n", - "optogenetics.OptoWaveform\n", + "\n", + "\n", + "optogenetics.OptoWaveform\n", "\n", "\n", "\n", "\n", "\n", "optogenetics.OptoWaveformType->optogenetics.OptoWaveform\n", - "\n", + "\n", "\n", "\n", - "\n", + "\n", "optogenetics.OptoWaveform.Sine\n", - "\n", - "\n", - "optogenetics.OptoWaveform.Sine\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "optogenetics.OptoEvent\n", - "\n", - "\n", - "optogenetics.OptoEvent\n", + "\n", + "\n", + "optogenetics.OptoWaveform.Sine\n", "\n", "\n", "\n", - "\n", - "\n", - "optogenetics.OptoProtocol->optogenetics.OptoEvent\n", - "\n", - "\n", "\n", - "\n", + "\n", "optogenetics.OptoWaveform.Ramp\n", - "\n", - "\n", - "optogenetics.OptoWaveform.Ramp\n", + "\n", + "\n", + "optogenetics.OptoWaveform.Ramp\n", "\n", "\n", "\n", - "\n", - "\n", - "optogenetics.OptoWaveform->optogenetics.OptoWaveform.Square\n", - "\n", - "\n", "\n", - "\n", + "\n", "optogenetics.OptoWaveform->optogenetics.OptoWaveform.Sine\n", - "\n", + "\n", "\n", "\n", - "\n", + "\n", "optogenetics.OptoWaveform->optogenetics.OptoWaveform.Ramp\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "optogenetics.OptoWaveform.Square\n", + "\n", + "\n", + "optogenetics.OptoWaveform.Square\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "optogenetics.OptoWaveform->optogenetics.OptoWaveform.Square\n", + "\n", "\n", "\n", - "\n", + "\n", "optogenetics.OptoStimParams\n", - "\n", + "\n", "\n", "optogenetics.OptoStimParams\n", "\n", "\n", "\n", "\n", - "\n", + "\n", "optogenetics.OptoWaveform->optogenetics.OptoStimParams\n", - "\n", + "\n", "\n", - "\n", + "\n", + "\n", + "session.Session->optogenetics.OptoProtocol\n", + "\n", + "\n", + "\n", "\n", - "optogenetics.OptoStimParams->optogenetics.OptoProtocol\n", - "\n", + "surgery.Implantation->optogenetics.OptoProtocol\n", + "\n", "\n", - "\n", + "\n", "\n", - "session.Session->optogenetics.OptoProtocol\n", - "\n", + "optogenetics.OptoStimParams->optogenetics.OptoProtocol\n", + "\n", "\n", "\n", "" ], "text/plain": [ - "" + "" ] }, "execution_count": 5, @@ -354,27 +351,150 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "

subject

\n", + " \n", + "
\n", + "

subject_nickname

\n", + " \n", + "
\n", + "

sex

\n", + " \n", + "
\n", + "

subject_birth_date

\n", + " \n", + "
\n", + "

subject_description

\n", + " \n", + "
\n", + " \n", + "

Total: 0

\n", + " " + ], + "text/plain": [ + "*subject subject_nickna sex subject_birth_ subject_descri\n", + "+---------+ +------------+ +-----+ +------------+ +------------+\n", + "\n", + " (Total: 0)" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "subject.Subject()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "subject : varchar(8) \n", + "---\n", + "subject_nickname=\"\" : varchar(64) \n", + "sex : enum('M','F','U') \n", + "subject_birth_date : date \n", + "subject_description=\"\" : varchar(1024) \n", + "\n" + ] + } + ], "source": [ "print(subject.Subject.describe())" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "# \n", + "subject : varchar(8) # \n", + "---\n", + "subject_nickname=\"\" : varchar(64) # \n", + "sex : enum('M','F','U') # \n", + "subject_birth_date : date # \n", + "subject_description=\"\" : varchar(1024) # " + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "subject.Subject.heading" ] @@ -391,9 +511,105 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

subject

\n", + " \n", + "
\n", + "

subject_nickname

\n", + " \n", + "
\n", + "

sex

\n", + " \n", + "
\n", + "

subject_birth_date

\n", + " \n", + "
\n", + "

subject_description

\n", + " \n", + "
subject1F2020-01-01Optogenetic pilot subject
\n", + " \n", + "

Total: 1

\n", + " " + ], + "text/plain": [ + "*subject subject_nickna sex subject_birth_ subject_descri\n", + "+----------+ +------------+ +-----+ +------------+ +------------+\n", + "subject1 F 2020-01-01 Optogenetic pi\n", + " (Total: 1)" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "subject.Subject.insert1(\n", " dict(\n", @@ -416,18 +632,45 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-> subject.Subject\n", + "session_id : int \n", + "---\n", + "session_datetime=null : datetime \n", + "\n" + ] + } + ], "source": [ "print(session.Session.describe())" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "# \n", + "subject : varchar(8) # \n", + "session_id : int # \n", + "---\n", + "session_datetime=null : datetime # " + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "session.Session.heading" ] @@ -450,18 +693,106 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ - "session_key = dict(subject=\"subject5\", session_datetime=\"2023-01-01 00:00:00\")" + "session_key = dict(subject=\"subject1\", session_id=0, session_datetime=\"2023-01-01 00:00:00\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "
\n", + "

subject

\n", + " \n", + "
\n", + "

session_id

\n", + " \n", + "
\n", + "

session_datetime

\n", + " \n", + "
subject102023-01-01 00:00:00
\n", + " \n", + "

Total: 1

\n", + " " + ], + "text/plain": [ + "*subject *session_id session_dateti\n", + "+----------+ +------------+ +------------+\n", + "subject1 0 2023-01-01 00:\n", + " (Total: 1)" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "session.Session.insert1(session_key)\n", "session.Session()" @@ -478,9 +809,100 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

device

\n", + " \n", + "
\n", + "

modality

\n", + " \n", + "
\n", + "

description

\n", + " \n", + "
OPTG_4OptogeneticsDoric Pulse Sequence Generator
OPTG_8Optogenetics8 channel pulse sequence device
\n", + " \n", + "

Total: 2

\n", + " " + ], + "text/plain": [ + "*device modality description \n", + "+--------+ +------------+ +------------+\n", + "OPTG_4 Optogenetics Doric Pulse Se\n", + "OPTG_8 Optogenetics 8 channel puls\n", + " (Total: 2)" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "Device.insert1(\n", " dict(\n", @@ -494,9 +916,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-> subject.Subject\n", + "implant_date : datetime # surgery date\n", + "-> surgery.ImplantationType\n", + "-> surgery.BrainRegion.proj(target_region=\"region_acronym\")\n", + "-> surgery.Hemisphere.proj(target_hemisphere=\"hemisphere\")\n", + "---\n", + "-> lab.User.proj(surgeon=\"user\")\n", + "implant_comment=\"\" : varchar(1024) # Comments about the implant\n", + "\n" + ] + } + ], "source": [ "print(surgery.Implantation.describe())" ] @@ -511,9 +949,101 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " Table for storing user information.\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "
\n", + "

user

\n", + " username, short identifier\n", + "
\n", + "

user_email

\n", + " \n", + "
\n", + "

user_cellphone

\n", + " \n", + "
\n", + "

user_fullname

\n", + " Full name used to uniquely identify an individual\n", + "
User1
\n", + " \n", + "

Total: 1

\n", + " " + ], + "text/plain": [ + "*user user_email user_cellphone user_fullname \n", + "+-------+ +------------+ +------------+ +------------+\n", + "User1 \n", + " (Total: 1)" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "lab.User.insert1(dict(user=\"User1\"))\n", "lab.User()" @@ -529,18 +1059,185 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "

reference

\n", + " \n", + "
bregma
dura
lambda
sagittal_suture
sinus
skull_surface
\n", + " \n", + "

Total: 6

\n", + " " + ], + "text/plain": [ + "*reference \n", + "+------------+\n", + "bregma \n", + "dura \n", + "lambda \n", + "sagittal_sutur\n", + "sinus \n", + "skull_surface \n", + " (Total: 6)" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "surgery.CoordinateReference()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "

hemisphere

\n", + " Brain region hemisphere\n", + "
left
middle
right
\n", + " \n", + "

Total: 3

\n", + " " + ], + "text/plain": [ + "*hemisphere \n", + "+------------+\n", + "left \n", + "middle \n", + "right \n", + " (Total: 3)" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "surgery.Hemisphere()" ] @@ -554,9 +1251,93 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "
\n", + "

region_acronym

\n", + " Brain region shorthand\n", + "
\n", + "

region_name

\n", + " Brain region full name\n", + "
dHPDorsal Hippocampus
\n", + " \n", + "

Total: 1

\n", + " " + ], + "text/plain": [ + "*region_acrony region_name \n", + "+------------+ +------------+\n", + "dHP Dorsal Hippoca\n", + " (Total: 1)" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "surgery.BrainRegion.insert1(\n", " dict(region_acronym=\"dHP\", region_name=\"Dorsal Hippocampus\")\n", @@ -566,7 +1347,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -609,18 +1390,254 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

subject

\n", + " \n", + "
\n", + "

implant_date

\n", + " surgery date\n", + "
\n", + "

implant_type

\n", + " Short name for type of implanted device\n", + "
\n", + "

target_region

\n", + " Brain region shorthand\n", + "
\n", + "

target_hemisphere

\n", + " Brain region hemisphere\n", + "
\n", + "

surgeon

\n", + " username, short identifier\n", + "
\n", + "

implant_comment

\n", + " Comments about the implant\n", + "
subject12022-04-01 12:13:14optodHPleftUser1
\n", + " \n", + "

Total: 1

\n", + " " + ], + "text/plain": [ + "*subject *implant_date *implant_type *target_region *target_hemisp surgeon implant_commen\n", + "+----------+ +------------+ +------------+ +------------+ +------------+ +---------+ +------------+\n", + "subject1 2022-04-01 12: opto dHP left User1 \n", + " (Total: 1)" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "surgery.Implantation()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

subject

\n", + " \n", + "
\n", + "

implant_date

\n", + " surgery date\n", + "
\n", + "

implant_type

\n", + " Short name for type of implanted device\n", + "
\n", + "

target_region

\n", + " Brain region shorthand\n", + "
\n", + "

target_hemisphere

\n", + " Brain region hemisphere\n", + "
\n", + "

ap

\n", + " (mm) anterior-posterior; ref is 0\n", + "
\n", + "

ap_ref

\n", + " \n", + "
\n", + "

ml

\n", + " (mm) medial axis; ref is 0\n", + "
\n", + "

ml_ref

\n", + " \n", + "
\n", + "

dv

\n", + " (mm) dorso-ventral axis; ventral negative\n", + "
\n", + "

dv_ref

\n", + " \n", + "
\n", + "

theta

\n", + " (deg) rot about ml-axis [0, 180] wrt z\n", + "
\n", + "

phi

\n", + " (deg) rot about dv-axis [0, 360] wrt x\n", + "
\n", + "

beta

\n", + " (deg) rot about shank [-180, 180] wrt anterior\n", + "
subject12022-04-01 12:13:14optodHPleft-7.9bregma-1.8bregma5.0skull_surface11.50.0nan
\n", + " \n", + "

Total: 1

\n", + " " + ], + "text/plain": [ + "*subject *implant_date *implant_type *target_region *target_hemisp ap ap_ref ml ml_ref dv dv_ref theta phi beta \n", + "+----------+ +------------+ +------------+ +------------+ +------------+ +------+ +--------+ +------+ +--------+ +-----+ +------------+ +-------+ +-----+ +------+\n", + "subject1 2022-04-01 12: opto dHP left -7.9 bregma -1.8 bregma 5.0 skull_surface 11.5 0.0 nan \n", + " (Total: 1)" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "surgery.Implantation.Coordinate()" ] @@ -634,7 +1651,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ @@ -655,9 +1672,113 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " Defines a single optical stimulus that repeats.\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

opto_params_id

\n", + " \n", + "
\n", + "

waveform_name

\n", + " \n", + "
\n", + "

wavelength

\n", + " (nm) wavelength of optical stimulation light\n", + "
\n", + "

power

\n", + " (mW) total power from light source\n", + "
\n", + "

light_intensity

\n", + " (mW/mm2) power for given area\n", + "
\n", + "

frequency

\n", + " (Hz) frequency of the waveform\n", + "
\n", + "

duration

\n", + " (ms) duration of each optical stimulus\n", + "
1square_10470None10.201.0241.0
\n", + " \n", + "

Total: 1

\n", + " " + ], + "text/plain": [ + "*opto_params_i waveform_name wavelength power light_intensit frequency duration \n", + "+------------+ +------------+ +------------+ +-------+ +------------+ +-----------+ +----------+\n", + "1 square_10 470 None 10.20 1.0 241.0 \n", + " (Total: 1)" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "optogenetics.OptoStimParams.insert1(\n", " dict(\n", @@ -681,14 +1802,130 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

subject

\n", + " \n", + "
\n", + "

session_id

\n", + " \n", + "
\n", + "

protocol_id

\n", + " \n", + "
\n", + "

opto_params_id

\n", + " \n", + "
\n", + "

implant_date

\n", + " surgery date\n", + "
\n", + "

implant_type

\n", + " Short name for type of implanted device\n", + "
\n", + "

target_region

\n", + " Brain region shorthand\n", + "
\n", + "

target_hemisphere

\n", + " Brain region hemisphere\n", + "
\n", + "

device

\n", + " \n", + "
\n", + "

protocol_description

\n", + " description of optogenetics protocol\n", + "
subject10112022-04-01 12:13:14optodHPleftOPTG_4
\n", + " \n", + "

Total: 1

\n", + " " + ], + "text/plain": [ + "*subject *session_id *protocol_id opto_params_id implant_date implant_type target_region target_hemisph device protocol_descr\n", + "+----------+ +------------+ +------------+ +------------+ +------------+ +------------+ +------------+ +------------+ +--------+ +------------+\n", + "subject1 0 1 1 2022-04-01 12: opto dHP left OPTG_4 \n", + " (Total: 1)" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "optogenetics.OptoProtocol.insert1(\n", " dict(\n", " subject=\"subject1\",\n", - " session_id=\"1\",\n", + " session_id=\"0\",\n", " protocol_id=\"1\",\n", " opto_params_id=\"1\",\n", " implant_date=\"2022-04-01 12:13:14\",\n", @@ -710,14 +1947,110 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

subject

\n", + " \n", + "
\n", + "

session_id

\n", + " \n", + "
\n", + "

protocol_id

\n", + " \n", + "
\n", + "

stim_start_time

\n", + " (s) stimulus start time relative to session start\n", + "
\n", + "

stim_end_time

\n", + " (s) stimulus end time relative session start\n", + "
subject101241.0482.0
\n", + " \n", + "

Total: 1

\n", + " " + ], + "text/plain": [ + "*subject *session_id *protocol_id *stim_start_ti stim_end_time \n", + "+----------+ +------------+ +------------+ +------------+ +------------+\n", + "subject1 0 1 241.0 482.0 \n", + " (Total: 1)" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "optogenetics.OptoEvent.insert1(\n", " dict(\n", " subject=\"subject1\",\n", - " session_id=1,\n", + " session_id=0,\n", " protocol_id=1,\n", " stim_start_time=241,\n", " stim_end_time=482,\n", @@ -736,14 +2069,115 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

subject

\n", + " \n", + "
\n", + "

session_id

\n", + " \n", + "
\n", + "

protocol_id

\n", + " \n", + "
\n", + "

stim_start_time

\n", + " (s) stimulus start time relative to session start\n", + "
\n", + "

stim_end_time

\n", + " (s) stimulus end time relative session start\n", + "
subject101241.0482.0
subject101543.0797.0
\n", + " \n", + "

Total: 2

\n", + " " + ], + "text/plain": [ + "*subject *session_id *protocol_id *stim_start_ti stim_end_time \n", + "+----------+ +------------+ +------------+ +------------+ +------------+\n", + "subject1 0 1 241.0 482.0 \n", + "subject1 0 1 543.0 797.0 \n", + " (Total: 2)" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "optogenetics.OptoEvent.insert1(\n", " dict(\n", " subject=\"subject1\",\n", - " session_id=1,\n", + " session_id=0,\n", " protocol_id=1,\n", " stim_start_time=543,\n", " stim_end_time=797,\n", @@ -764,9 +2198,110 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

subject

\n", + " \n", + "
\n", + "

session_id

\n", + " \n", + "
\n", + "

protocol_id

\n", + " \n", + "
\n", + "

stim_start_time

\n", + " (s) stimulus start time relative to session start\n", + "
\n", + "

stim_end_time

\n", + " (s) stimulus end time relative session start\n", + "
subject101241.0482.0
subject101543.0797.0
\n", + " \n", + "

Total: 2

\n", + " " + ], + "text/plain": [ + "*subject *session_id *protocol_id *stim_start_ti stim_end_time \n", + "+----------+ +------------+ +------------+ +------------+ +------------+\n", + "subject1 0 1 241.0 482.0 \n", + "subject1 0 1 543.0 797.0 \n", + " (Total: 2)" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "optogenetics.OptoEvent()" ] @@ -780,9 +2315,105 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

subject

\n", + " \n", + "
\n", + "

session_id

\n", + " \n", + "
\n", + "

protocol_id

\n", + " \n", + "
\n", + "

stim_start_time

\n", + " (s) stimulus start time relative to session start\n", + "
\n", + "

stim_end_time

\n", + " (s) stimulus end time relative session start\n", + "
subject101543.0797.0
\n", + " \n", + "

Total: 1

\n", + " " + ], + "text/plain": [ + "*subject *session_id *protocol_id *stim_start_ti stim_end_time \n", + "+----------+ +------------+ +------------+ +------------+ +------------+\n", + "subject1 0 1 543.0 797.0 \n", + " (Total: 1)" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "optogenetics.OptoEvent & \"stim_start_time=543\"" ] @@ -797,9 +2428,149 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

subject

\n", + " \n", + "
\n", + "

session_id

\n", + " \n", + "
\n", + "

protocol_id

\n", + " \n", + "
\n", + "

opto_params_id

\n", + " \n", + "
\n", + "

implant_date

\n", + " surgery date\n", + "
\n", + "

implant_type

\n", + " Short name for type of implanted device\n", + "
\n", + "

target_region

\n", + " Brain region shorthand\n", + "
\n", + "

target_hemisphere

\n", + " Brain region hemisphere\n", + "
\n", + "

device

\n", + " \n", + "
\n", + "

protocol_description

\n", + " description of optogenetics protocol\n", + "
\n", + "

waveform_name

\n", + " \n", + "
\n", + "

wavelength

\n", + " (nm) wavelength of optical stimulation light\n", + "
\n", + "

power

\n", + " (mW) total power from light source\n", + "
\n", + "

light_intensity

\n", + " (mW/mm2) power for given area\n", + "
\n", + "

frequency

\n", + " (Hz) frequency of the waveform\n", + "
\n", + "

duration

\n", + " (ms) duration of each optical stimulus\n", + "
subject10112022-04-01 12:13:14optodHPleftOPTG_4square_10470None10.201.0241.0
\n", + " \n", + "

Total: 1

\n", + " " + ], + "text/plain": [ + "*subject *session_id *protocol_id *opto_params_i implant_date implant_type target_region target_hemisph device protocol_descr waveform_name wavelength power light_intensit frequency duration \n", + "+----------+ +------------+ +------------+ +------------+ +------------+ +------------+ +------------+ +------------+ +--------+ +------------+ +------------+ +------------+ +-------+ +------------+ +-----------+ +----------+\n", + "subject1 0 1 1 2022-04-01 12: opto dHP left OPTG_4 square_10 470 None 10.20 1.0 241.0 \n", + " (Total: 1)" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "optogenetics.OptoProtocol * optogenetics.OptoStimParams" ] @@ -816,9 +2587,29 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 38, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[{'subject': 'subject1',\n", + " 'session_id': 0,\n", + " 'protocol_id': 1,\n", + " 'stim_start_time': 241.0,\n", + " 'stim_end_time': 482.0},\n", + " {'subject': 'subject1',\n", + " 'session_id': 0,\n", + " 'protocol_id': 1,\n", + " 'stim_start_time': 543.0,\n", + " 'stim_end_time': 797.0}]" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "optogenetics.OptoEvent.fetch(as_dict=True)" ] @@ -832,9 +2623,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 39, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "{'subject': 'subject1',\n", + " 'session_id': 0,\n", + " 'protocol_id': 1,\n", + " 'stim_start_time': 543.0,\n", + " 'stim_end_time': 797.0}" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "(optogenetics.OptoEvent & \"stim_start_time=543\").fetch1()" ]