Skip to content

Commit

Permalink
update cnmfe nb w.r.t. fpl v0.0.14a
Browse files Browse the repository at this point in the history
  • Loading branch information
kushalkolar committed Oct 30, 2023
1 parent 14abc7a commit 8024f59
Showing 1 changed file with 6 additions and 40 deletions.
46 changes: 6 additions & 40 deletions notebooks/cnmfe.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
"outputs": [],
"source": [
"# create a slider for gSig_filt\n",
"slider_gsig_filt = IntSlider(min=1, max=33, step=2, description=\"gSig_filt\")\n",
"slider_gsig_filt = IntSlider(value=3, min=1, max=33, step=2, description=\"gSig_filt\")\n",
"\n",
"def apply_filter(frame):\n",
" # read slider value\n",
Expand All @@ -244,7 +244,6 @@
"iw_gs = ImageWidget(\n",
" data=[input_movie, input_movie.copy()],\n",
" frame_apply=funcs,\n",
" vmin_vmax_sliders=True,\n",
" cmap=\"gnuplot2\"\n",
")\n",
"\n",
Expand All @@ -266,19 +265,7 @@
"id": "511192a7-6e25-49cf-8175-0ecfb0001662",
"metadata": {},
"source": [
"# reset vmin vmax when necessary!!!"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "79cd6ec4-d7a4-4230-9996-4bfc5d27a7d1",
"metadata": {},
"outputs": [],
"source": [
"# the filtered images will have much lower min and max\n",
"# this resets the vmin vmax sliders on the ImageWidget\n",
"iw_gs.reset_vmin_vmax()"
"# reset vmin vmax when necessary!"
]
},
{
Expand Down Expand Up @@ -554,7 +541,6 @@
"execution_count": null,
"id": "be469f61-b712-4832-b8be-5118cd59f5c6",
"metadata": {
"scrolled": true,
"tags": []
},
"outputs": [],
Expand Down Expand Up @@ -694,7 +680,6 @@
"\n",
"iw = ImageWidget(\n",
" [input_movie, mcorr_movie.astype(np.float32)],\n",
" vmin_vmax_sliders=True, \n",
" frame_apply=funcs, # the filter func\n",
" names=[\"input\", \"mcorr\"],\n",
" cmap=\"gnuplot2\",\n",
Expand Down Expand Up @@ -730,7 +715,7 @@
"id": "95b8d84a-5dd0-47e3-870a-df2f6505ced2",
"metadata": {},
"source": [
"## Close the canvas to free up GPU processing time, not necessary if you have a powerful GPU"
"## Close the widget to free up GPU processing time, not necessary if you have a powerful GPU"
]
},
{
Expand All @@ -744,7 +729,7 @@
},
"outputs": [],
"source": [
"iw.plot.canvas.close()"
"iw.close()"
]
},
{
Expand Down Expand Up @@ -783,13 +768,12 @@
"\n",
"# filter using the same sigma to make visualization easier\n",
"# same filter for all movies, this syntax is just dictionary comprehension\n",
"filt = {subplot_ix: lambda frame: high_pass_filter_space(frame, (1, 1)) for subplot_ix in range(len(movies))}\n",
"filt = {subplot_ix: lambda frame: high_pass_filter_space(frame, (3, 3)) for subplot_ix in range(len(movies))}\n",
"\n",
"# create the widget\n",
"mcorr_iw_multiple = ImageWidget(\n",
" data=movies, # list of movies\n",
" window_funcs={\"t\": (np.mean, 3)}, # window_funcs is also a kwarg\n",
" vmin_vmax_sliders=True,\n",
" frame_apply=filt, # same func for all\n",
" names=subplot_names, # subplot names used for titles\n",
" cmap=\"gnuplot2\"\n",
Expand All @@ -800,24 +784,6 @@
"mcorr_iw_multiple.show()"
]
},
{
"cell_type": "markdown",
"id": "8145967d-5fab-491c-bf6e-f304cb95eb72",
"metadata": {},
"source": [
"# reset vmin vmax if necessary "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "583b30f8-50eb-41b2-82bf-1973bfe8c00e",
"metadata": {},
"outputs": [],
"source": [
"mcorr_iw_multiple.reset_vmin_vmax()"
]
},
{
"cell_type": "markdown",
"id": "9ad69731-e057-4ad7-acf7-dd61269ecd72",
Expand Down Expand Up @@ -1254,7 +1220,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
"version": "3.11.3"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 8024f59

Please sign in to comment.