Skip to content

Commit

Permalink
update cnmfe nb
Browse files Browse the repository at this point in the history
  • Loading branch information
kushalkolar committed Apr 13, 2024
1 parent d82f758 commit ee215ce
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions notebooks/cnmfe.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
"outputs": [],
"source": [
"# create a slider for gSig_filt\n",
"slider_gsig_filt = IntSlider(value=3, min=1, max=33, step=2, description=\"gSig_filt\")\n",
"slider_gsig_filt = IntSlider(value=3, min=1, max=33, step=1, description=\"gSig_filt\")\n",
"\n",
"def apply_filter(frame):\n",
" # read slider value\n",
Expand All @@ -309,18 +309,20 @@
"\n",
"# input movie will be shown on left, filtered on right\n",
"iw_gs = fpl.ImageWidget(\n",
" data=[input_movie, input_movie.copy()],\n",
" data=[input_movie, input_movie],\n",
" frame_apply=funcs,\n",
" names=[\"raw\", \"filtered\"],\n",
" names=[\"raw\", f\"filtered\"],\n",
" grid_plot_kwargs={\"size\": (1200, 600)},\n",
" cmap=\"gnuplot2\"\n",
")\n",
"\n",
"iw_gs.gridplot[\"filtered\"].set_title(f\"filtered σ={slider_gsig_filt.value}\")\n",
"\n",
"def force_update(*args):\n",
" # kinda hacky but forces the images to update \n",
" # when the gSig_filt slider is moved\n",
" # forces the images to update when the gSig_filt slider is moved\n",
" iw_gs.current_index = iw_gs.current_index\n",
" iw_gs.reset_vmin_vmax()\n",
" iw_gs.gridplot[\"filtered\"].set_title(f\"filtered σ={slider_gsig_filt.value}\")\n",
"\n",
"iw_gs.reset_vmin_vmax()\n",
" \n",
Expand All @@ -332,7 +334,9 @@
{
"cell_type": "markdown",
"id": "511192a7-6e25-49cf-8175-0ecfb0001662",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# reset vmin vmax when necessary!"
]
Expand Down Expand Up @@ -877,9 +881,7 @@
"# mcorr vids, we will display thresholded mcorr vids\n",
"mcorr_vids = [mcorr_movie.astype(np.float32) for i in range(4)]\n",
"\n",
"# sync the threshold image widget with the corr-pnr plot\n",
"threshold_grid_plot_kwargs = {\n",
" \"controllers\": [[iw_corr_pnr.gridplot[\"corr\"].controller]*2]*2,\n",
" \"size\": (650, 600)\n",
"}\n",
"\n",
Expand All @@ -891,6 +893,10 @@
" cmap=\"gnuplot2\"\n",
")\n",
"\n",
"# sync the threshold image widget with the corr-pnr plot\n",
"for subplot in iw_thres_movie.gridplot:\n",
" subplot.controller = iw_corr_pnr.gridplot[\"corr\"].controller\n",
"\n",
"# display threshold of the spatially filtered movie\n",
"def spatial_filter(frame):\n",
" f = high_pass_filter_space(frame, (3, 3))\n",
Expand Down Expand Up @@ -1299,7 +1305,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.11.3"
}
},
"nbformat": 4,
Expand Down

0 comments on commit ee215ce

Please sign in to comment.