Skip to content

Commit

Permalink
nbs
Browse files Browse the repository at this point in the history
  • Loading branch information
sronilsson committed Dec 9, 2024
1 parent 5f48bb8 commit a4fb5f9
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 29 deletions.
15 changes: 8 additions & 7 deletions docs/nb/geometry_example_1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
"id": "6e7961f8",
"metadata": {},
"source": [
"# Geometry computations: Example 1"
"# Geometry computations Example 1: Movement key-point statistics in grid-system"
]
},
{
"cell_type": "markdown",
"id": "85aedd1a",
"metadata": {},
"source": [
"<span style=\"color:black; font-family:Poppins; font-size:1.5em;\">\n",
"In this notebook, we:\n",
"\n",
"Here we\n",
"* (1) Divide the experimental arena into geometries, and \n",
"* (2) Compute and visualize the time that the animal spends in the different arena geometries.\n",
" </span>"
"* (1) Divide the experimental arena into distinct geometrical regions.\n",
"* (2) Compute and visualize the time the animal spends in each region of the arena.\n",
"\n",
"This analysis can be used to study spatial preferences in the experimental arena. This analysis is based on the location of a pose-estimated key-point. To perform the analysis using the animal hull, see [THIS](https://simba-uw-tf-dev.readthedocs.io/en/latest/nb/geometry_example_2.html) notebook. "
]
},
{
Expand Down Expand Up @@ -48,7 +48,8 @@
"outputs": [],
"source": [
"# DEFINE PROJECT AND VIDEO NAME\n",
"PROJECT_PATH = r'/Users/simon/Desktop/envs/troubleshooting/Rat_NOR/project_folder/project_config.ini'\n",
"\n",
"PROJECT_PATH = r'/Users/simon/Desktop/envs/troubleshooting/Rat_NOR/project_folder/project_config.ini' \n",
"VIDEO_NAME = '2022-06-20_NOB_DOT_4'\n",
"BP = 'Nose' # THE BODY-PART WE WILL USE TO INFER POSITION OF ANIMAL"
]
Expand Down
11 changes: 6 additions & 5 deletions docs/nb/geometry_example_2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
"id": "6b33d53a",
"metadata": {},
"source": [
"# Geometry computations: Example 2"
"# Geometry computations Example 2: Movement hull statistics in grid-system"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "39874072",
"metadata": {},
"source": [
"Here we \n",
"In this notebook, we:\n",
"\n",
"* (1) Represent animals as polygonal shapes created from pose-estimation data, and \n",
"* (2) We divide the experimental arena into geometries, and \n",
"* (3) compute and visualize the time that the animal geometry spends in the different arena geometries"
"* (1) Divide the experimental arena into distinct geometrical regions, and\n",
"* (2) Compute and visualize the time the animal spends in each region of the arena.\n",
"\n",
"This analysis can be used to study spatial preferences in the experimental arena. This analysis is based on the location of a entire animal hull. To perform the analysis using pose-estimated key-points, see [THIS](https://simba-uw-tf-dev.readthedocs.io/en/latest/nb/geometry_example_1.html) notebook. "
]
},
{
Expand Down
27 changes: 14 additions & 13 deletions docs/nb/geometry_example_3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
"id": "536d575d",
"metadata": {},
"source": [
"# Geometry computations: Example 4"
"# Geometry computations Example 3: Slice animal videos on CPU"
]
},
{
"cell_type": "markdown",
"id": "43fcbf77",
"metadata": {},
"source": [
"In this short notebook, we extract bounding boxes (cropped images of the animal) representing from the pose-estimation data "
"In this short notebook, we extract bounding boxes (cropped images of the animal) representing from the pose-estimation data. "
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "9785b81f",
"metadata": {},
"outputs": [],
Expand All @@ -29,7 +29,8 @@
"from simba.mixins.image_mixin import ImageMixin\n",
"from simba.plotting.geometry_plotter import GeometryPlotter\n",
"from simba.utils.read_write import (get_video_meta_data, read_df)\n",
"from IPython.display import Video\n",
"from ipywidgets import Video\n",
"from IPython.display import HTML, Image\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib \n",
"dpi = matplotlib.rcParams['figure.dpi']\n",
Expand Down Expand Up @@ -133,29 +134,29 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 3,
"id": "47fc513d",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<video src=\"https://github.com/sgoldenlab/simba/blob/master/misc/stack_example.mp4\" controls >\n",
" Your browser does not support the <code>video</code> element.\n",
" </video>"
" <video width=\"600\" height=\"600\" controls> <source src=\"https://raw.githubusercontent.com/sgoldenlab/simba/master/misc/stack_example.mp4\" type=\"video/mp4\"> </video>\n"
],
"text/plain": [
"<IPython.core.display.Video object>"
"<IPython.core.display.HTML object>"
]
},
"execution_count": 21,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#TO VIEW THE VIDEO (NOT SURE HOW WELL THIS WORKS IN SPHINX/READTHEDOCS)\n",
"Video('https://github.com/sgoldenlab/simba/blob/master/misc/stack_example.mp4')"
"video_url = 'https://raw.githubusercontent.com/sgoldenlab/simba/master/misc/stack_example.mp4'\n",
"HTML(f''' <video width=\"600\" height=\"600\" controls> <source src=\"{video_url}\" type=\"video/mp4\"> </video>\n",
"''')"
]
},
{
Expand Down Expand Up @@ -202,9 +203,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "simba_dev",
"display_name": "simba",
"language": "python",
"name": "simba_dev"
"name": "simba"
},
"language_info": {
"codemirror_mode": {
Expand Down
8 changes: 5 additions & 3 deletions docs/nb/geometry_example_5.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
"id": "e33548d8",
"metadata": {},
"source": [
"# Geometry computations: Example 5"
"# Geometry computations Example 5: Slice animal shapes"
]
},
{
"cell_type": "markdown",
"id": "e941fd05",
"metadata": {},
"source": [
"Here we compute some simple geometries based on keypoints in a single image. \n",
"Here we compute some simple geometries based on keypoints in a single image.\n",
"\n",
"IMPORTANT Use multiprocessing function to perform these and many other operations in whole videos. "
"This includes slicing out animals, body-parts, and surrounding regions based on polygons, circles, and rectangles from pose-estimated data.\n",
"\n",
"Note: Use SimBA multiprocessing and GPU function to perform these and similar operations in whole videos. "
]
},
{
Expand Down
10 changes: 9 additions & 1 deletion docs/nb/geometry_example_6.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@
"id": "b66da18f",
"metadata": {},
"source": [
"# Geometry computations: Example 6"
"# Geometry computations Example 6: ROI and path statistics"
]
},
{
"cell_type": "markdown",
"id": "baed07e9",
"metadata": {},
"source": [
"Here we use [ROIs drawn in SimBA](https://github.com/sgoldenlab/simba/blob/master/docs/ROI_tutorial_new.md), we manipulate and visualize those ROIs, and compute how the animal moves in realtion to those ROIs."
]
},
{
Expand Down

0 comments on commit a4fb5f9

Please sign in to comment.