Skip to content

Commit

Permalink
fix(tests): clean up notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
Thinh Nguyen committed Mar 21, 2024
1 parent 9151e69 commit 47bbbbc
Showing 1 changed file with 0 additions and 242 deletions.
242 changes: 0 additions & 242 deletions notebooks/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2828,248 +2828,6 @@
"+ [General `DataJoint-Python` interactive tutorials](https://github.com/datajoint/datajoint-tutorials), covering fundamentals, such as table tiers, query operations, fetch operations, automated computations with the make function, and more.\n",
"+ [Documentation for `DataJoint-Python`](https://datajoint.com/docs/core/datajoint-python/0.14/)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" <style type=\"text/css\">\n",
" .Table{\n",
" border-collapse:collapse;\n",
" }\n",
" .Table th{\n",
" background: #A0A0A0; color: #ffffff; padding:4px; border:#f0e0e0 1px solid;\n",
" font-weight: normal; font-family: monospace; font-size: 100%;\n",
" }\n",
" .Table td{\n",
" padding:4px; border:#f0e0e0 1px solid; font-size:100%;\n",
" }\n",
" .Table tr:nth-child(odd){\n",
" background: #ffffff;\n",
" color: #000000;\n",
" }\n",
" .Table tr:nth-child(even){\n",
" background: #f3f1ff;\n",
" color: #000000;\n",
" }\n",
" /* Tooltip container */\n",
" .djtooltip {\n",
" }\n",
" /* Tooltip text */\n",
" .djtooltip .djtooltiptext {\n",
" visibility: hidden;\n",
" width: 120px;\n",
" background-color: black;\n",
" color: #fff;\n",
" text-align: center;\n",
" padding: 5px 0;\n",
" border-radius: 6px;\n",
" /* Position the tooltip text - see examples below! */\n",
" position: absolute;\n",
" z-index: 1;\n",
" }\n",
" #primary {\n",
" font-weight: bold;\n",
" color: black;\n",
" }\n",
" #nonprimary {\n",
" font-weight: normal;\n",
" color: white;\n",
" }\n",
"\n",
" /* Show the tooltip text when you mouse over the tooltip container */\n",
" .djtooltip:hover .djtooltiptext {\n",
" visibility: visible;\n",
" }\n",
" </style>\n",
" \n",
" <b>uses DeepLabCut h5 output for body part position</b>\n",
" <div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
" <table border=\"1\" class=\"Table\">\n",
" <thead> <tr style=\"text-align: right;\"> <th> <div class=\"djtooltip\">\n",
" <p id=\"primary\">subject</p>\n",
" <span class=\"djtooltiptext\"></span>\n",
" </div></th><th><div class=\"djtooltip\">\n",
" <p id=\"primary\">session_datetime</p>\n",
" <span class=\"djtooltiptext\"></span>\n",
" </div></th><th><div class=\"djtooltip\">\n",
" <p id=\"primary\">recording_id</p>\n",
" <span class=\"djtooltiptext\"></span>\n",
" </div></th><th><div class=\"djtooltip\">\n",
" <p id=\"primary\">model_name</p>\n",
" <span class=\"djtooltiptext\">User-friendly model name</span>\n",
" </div></th><th><div class=\"djtooltip\">\n",
" <p id=\"primary\">body_part</p>\n",
" <span class=\"djtooltiptext\"></span>\n",
" </div></th><th><div class=\"djtooltip\">\n",
" <p id=\"nonprimary\">frame_index</p>\n",
" <span class=\"djtooltiptext\">frame index in model</span>\n",
" </div></th><th><div class=\"djtooltip\">\n",
" <p id=\"nonprimary\">x_pos</p>\n",
" <span class=\"djtooltiptext\"></span>\n",
" </div></th><th><div class=\"djtooltip\">\n",
" <p id=\"nonprimary\">y_pos</p>\n",
" <span class=\"djtooltiptext\"></span>\n",
" </div></th><th><div class=\"djtooltip\">\n",
" <p id=\"nonprimary\">z_pos</p>\n",
" <span class=\"djtooltiptext\"></span>\n",
" </div></th><th><div class=\"djtooltip\">\n",
" <p id=\"nonprimary\">likelihood</p>\n",
" <span class=\"djtooltiptext\"></span>\n",
" </div> </th> </tr> </thead>\n",
" <tbody> <tr> <td>subject6</td>\n",
"<td>2021-06-02 14:04:22</td>\n",
"<td>1</td>\n",
"<td>from_top_tracking_model_test</td>\n",
"<td>head</td>\n",
"<td>=BLOB=</td>\n",
"<td>=BLOB=</td>\n",
"<td>=BLOB=</td>\n",
"<td>=BLOB=</td>\n",
"<td>=BLOB=</td></tr><tr><td>subject6</td>\n",
"<td>2021-06-02 14:04:22</td>\n",
"<td>1</td>\n",
"<td>from_top_tracking_model_test</td>\n",
"<td>tailbase</td>\n",
"<td>=BLOB=</td>\n",
"<td>=BLOB=</td>\n",
"<td>=BLOB=</td>\n",
"<td>=BLOB=</td>\n",
"<td>=BLOB=</td> </tr> </tbody>\n",
" </table>\n",
" \n",
" <p>Total: 2</p></div>\n",
" "
],
"text/plain": [
"*subject *session_datet *recording_id *model_name *body_part frame_inde x_pos y_pos z_pos likelihood\n",
"+----------+ +------------+ +------------+ +------------+ +-----------+ +--------+ +--------+ +--------+ +--------+ +--------+\n",
"subject6 2021-06-02 14: 1 from_top_track head =BLOB= =BLOB= =BLOB= =BLOB= =BLOB= \n",
"subject6 2021-06-02 14: 1 from_top_track tailbase =BLOB= =BLOB= =BLOB= =BLOB= =BLOB= \n",
" (Total: 2)"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.PoseEstimation.BodyPartPosition()"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [],
"source": [
"rec_info = model.RecordingInfo.fetch1()"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'subject': 'subject6',\n",
" 'session_datetime': datetime.datetime(2021, 6, 2, 14, 4, 22),\n",
" 'recording_id': 1,\n",
" 'px_height': 500,\n",
" 'px_width': 500,\n",
" 'nframes': 60000,\n",
" 'fps': 60,\n",
" 'recording_datetime': None,\n",
" 'recording_duration': 1000.0}"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rec_info"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
"head_x = (model.PoseEstimation.BodyPartPosition & {\"body_part\": \"head\"}).fetch1(\"x_pos\")\n",
"tail_y = (model.PoseEstimation.BodyPartPosition & {\"body_part\": \"tailbase\"}).fetch1(\"y_pos\")"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"assert len(head_x) == len(tail_y)"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"133"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"round(tail_y.std())"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [],
"source": [
"assert (round(head_x.std())) == 129\n",
"assert (round(tail_y.std())) == 133\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 47bbbbc

Please sign in to comment.