From ee215ce19a55431315611d75a69a92486a52e3ab Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Sat, 13 Apr 2024 19:43:24 -0400 Subject: [PATCH] update cnmfe nb --- notebooks/cnmfe.ipynb | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/notebooks/cnmfe.ipynb b/notebooks/cnmfe.ipynb index 5144738..ff9334d 100644 --- a/notebooks/cnmfe.ipynb +++ b/notebooks/cnmfe.ipynb @@ -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", @@ -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", @@ -332,7 +334,9 @@ { "cell_type": "markdown", "id": "511192a7-6e25-49cf-8175-0ecfb0001662", - "metadata": {}, + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, "source": [ "# reset vmin vmax when necessary!" ] @@ -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", @@ -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", @@ -1299,7 +1305,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.2" + "version": "3.11.3" } }, "nbformat": 4,