{ "cells": [ { "cell_type": "markdown", "id": "9e52d42c-06c9-491f-92f0-e95e186064ae", "metadata": {}, "source": [ "# Usage" ] }, { "cell_type": "code", "execution_count": null, "id": "a01eba6e-3002-4db6-ade2-48cd049b18cc", "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import scipy\n", "import seaborn as sns\n", "import skimage\n", "import skimage.io\n", "import tifffile\n", "from pympler.asizeof import asizeof\n", "\n", "from nima import nima, segmentation\n", "\n", "cm = plt.cm.inferno_r\n", "\n", "fp = \"../../tests/data/1b_c16_15.tif\"\n", "\n", "channels = [\"G\", \"R\", \"C\"]\n", "# dark = io.imread('/home/dati/GBM_persson/analyses/15.02.05_cal-GBM5-pBJclop/dark/dark-25_500.tif')\n", "# flat = io.imread('/home/dati/GBM_persson/analyses/15.02.05_cal-GBM5-pBJclop/flat/flat-C-dark-37bis_500.tif')" ] }, { "cell_type": "code", "execution_count": null, "id": "a2d45d66-fdea-40b8-9c67-7012311925bf", "metadata": {}, "outputs": [], "source": [ "bg_params = segmentation.BgParams(kind=\"li_adaptive\")\n", "bg_params" ] }, { "cell_type": "code", "execution_count": null, "id": "876ebe8d-b553-4a0c-a58d-d8f5191d4342", "metadata": {}, "outputs": [], "source": [ "d_im, n_ch, times = nima.read_tiff(fp, channels)" ] }, { "cell_type": "code", "execution_count": null, "id": "bfe6f07d-2b11-4da0-8595-6b5f156fa0e4", "metadata": {}, "outputs": [], "source": [ "d_im_bg, bgs, ff = nima.d_bg(d_im, downscale=(2, 2), bg_params=bg_params)\n", "bgs" ] }, { "cell_type": "code", "execution_count": null, "id": "ea82ebfb-a555-42a2-a4c4-bb266f490f8e", "metadata": {}, "outputs": [], "source": [ "d_im_bg[\"G\"].__sizeof__() / 1024**2" ] }, { "cell_type": "code", "execution_count": null, "id": "7fa10c3b-f6a9-4407-8c99-4399e5a771b4", "metadata": {}, "outputs": [], "source": [ "ff[\"C\"][1][0]" ] }, { "cell_type": "code", "execution_count": null, "id": "454bf86e-1fed-4351-9999-d9c0b992c73d", "metadata": {}, "outputs": [], "source": [ "nima.d_mask_label(\n", " d_im_bg, threshold_method=\"yen\", min_size=2000, channels=channels, watershed=0\n", ")\n", "d_im_bg.keys()" ] }, { "cell_type": "code", "execution_count": null, "id": "960a55fd-496c-432e-8b6e-286d787988f7", "metadata": {}, "outputs": [], "source": [ "f = nima.d_show(d_im_bg)" ] }, { "cell_type": "code", "execution_count": null, "id": "3037b4a8-3f07-49dc-8c99-e92b96ca81d6", "metadata": {}, "outputs": [], "source": [ "meas, pr = nima.d_meas_props(d_im_bg)\n", "f = nima.d_plot_meas(bgs, meas, channels=channels)" ] }, { "cell_type": "code", "execution_count": null, "id": "dfd6fcd7-cff1-4155-bc6c-7aa40dd22862", "metadata": {}, "outputs": [], "source": [ "plt.subplot(1, 2, 1)\n", "skimage.io.imshow(d_im_bg[\"r_cl\"][2], vmin=0.0, vmax=1.1)\n", "plt.subplot(1, 2, 2)\n", "skimage.io.imshow(d_im_bg[\"r_pH\"][2], vmin=7.3, vmax=10.7)" ] }, { "cell_type": "markdown", "id": "fc8667b7-7bdf-4d8a-8c3c-123a81d5bb88", "metadata": {}, "source": [ "## dev" ] }, { "cell_type": "code", "execution_count": null, "id": "a6aeb70a-cea1-42ac-8235-62985a750ba6", "metadata": {}, "outputs": [], "source": [ "c0 = d_im[\"C\"][0]\n", "g0 = d_im[\"G\"][0]\n", "r0 = d_im[\"R\"][0]\n", "tifffile.imshow(1 / c0 / c0)" ] }, { "cell_type": "code", "execution_count": null, "id": "05fac66d-0e3c-4969-be31-c3cf6f3d6d1c", "metadata": {}, "outputs": [], "source": [ "bg_params = segmentation.BgParams(kind=\"li_adaptive\", erosion_disk=0)\n", "bg_params" ] }, { "cell_type": "code", "execution_count": null, "id": "6a169d48-6542-4165-ac63-9657a6d03469", "metadata": {}, "outputs": [], "source": [ "im = c0\n", "im = d_im[\"C\"][1]\n", "bg_params.adaptive_radius = int(im.shape[1] / 2)\n", "if bg_params.adaptive_radius % 2 == 0: # sk >0.12.0 check for even value\n", " bg_params.adaptive_radius += 1\n", "bg_params" ] }, { "cell_type": "code", "execution_count": null, "id": "e3298052-a213-4584-984f-992fc0caec72", "metadata": {}, "outputs": [], "source": [ "bg_params.clip = False\n", "m, title, lim = segmentation._bg_li_adaptive(im, bg_params=bg_params)\n", "title, lim" ] }, { "cell_type": "raw", "id": "aa5437e9-2f63-427a-bae8-eec5861888d0", "metadata": {}, "source": [ "# The second is about 30-40% faster\n", "%timeit np.ma.masked_array(im, ~m).mean()\n", "%timeit im[m].mean()" ] }, { "cell_type": "code", "execution_count": null, "id": "6d1d909a-5ca6-4403-94cc-16c4a49d355c", "metadata": {}, "outputs": [], "source": [ "scipy.stats.distributions.norm.fit(im[m])" ] }, { "cell_type": "code", "execution_count": null, "id": "f219de8c-c816-4093-9950-d30170a3f665", "metadata": {}, "outputs": [], "source": [ "sns.histplot(im[m], kde=True, stat=\"density\", log_scale=(False, True))" ] }, { "cell_type": "code", "execution_count": null, "id": "e8474c16-670b-4b4e-a6b9-35b9488b54fc", "metadata": {}, "outputs": [], "source": [ "fig = plt.hist(im[m], histtype=\"step\", bins=32, log=1)\n", "fig = plt.hist(im[m], histtype=\"step\", bins=32, log=1)" ] }, { "cell_type": "code", "execution_count": null, "id": "71ff8c41-2e1e-44f2-932f-a83bfc4c2a1f", "metadata": {}, "outputs": [], "source": [ "segmentation.calculate_bg_iteratively(im, probplot=True)" ] }, { "cell_type": "markdown", "id": "cc536bbf-2ef6-452b-b5c0-52707702d55d", "metadata": {}, "source": [ "## background, AF, target cells" ] }, { "cell_type": "code", "execution_count": null, "id": "adf1b892-844a-4a71-b722-a4f77cdbbc12", "metadata": {}, "outputs": [], "source": [ "fp_mdtest = \"/home/dati/GBM_persson/data/15.02.05_cal-GBM5-pBJclop/ph633/1_20_40.tif\"\n", "fp_mdtest = \"/home/dati/dt-clop3/data/ionofori assay pH6.8 22.05.05/Clop FLATxy Gexp20ms Rexp3ms.tf8\"" ] }, { "cell_type": "code", "execution_count": null, "id": "e38b24ab-53d4-40f5-8c88-3b3437e6f501", "metadata": {}, "outputs": [], "source": [ "nima.read_tiff(fp_mdtest, [\"G\", \"C\", \"R\"])" ] }, { "cell_type": "code", "execution_count": null, "id": "530d062a-4d5c-49a7-bd7d-d9a285bdcfb6", "metadata": { "scrolled": true }, "outputs": [], "source": [ "dim, md = nima.read_tiffmd(fp_mdtest, channels)" ] }, { "cell_type": "code", "execution_count": null, "id": "775c4088-6b8a-4094-9850-0ecb17a98665", "metadata": { "scrolled": true }, "outputs": [], "source": [ "md.stage_position" ] }, { "cell_type": "code", "execution_count": null, "id": "23a58a7f-efce-4883-984b-b4f77fcc679c", "metadata": {}, "outputs": [], "source": [ "im = dim[:, 0].mean(axis=0).compute()\n", "plt.imshow(im)\n", "plt.colorbar()" ] }, { "cell_type": "code", "execution_count": null, "id": "f8d7682d-f26f-4f09-adce-48569952fe6d", "metadata": {}, "outputs": [], "source": [ "flat_im = scipy.ndimage.gaussian_filter(im, 150)\n", "plt.imshow(flat_im)\n", "plt.colorbar()" ] }, { "cell_type": "code", "execution_count": null, "id": "2d54f14e-af2a-47cb-a41c-3dbdc17a1675", "metadata": {}, "outputs": [], "source": [ "plt.plot(flat_im[1060, :])" ] }, { "cell_type": "code", "execution_count": null, "id": "376ad434-250e-4a15-863a-b4b397ea3247", "metadata": {}, "outputs": [], "source": [ "fpm = \"/home/dan/workspace/nima_io/tests/data/t4_1.tif\"" ] }, { "cell_type": "code", "execution_count": null, "id": "57592a78-0419-4edb-966f-384a61382281", "metadata": {}, "outputs": [], "source": [ "nima.read_tiffmd(fpm, [\"G\", \"R2\", \"R\", \"C\"])" ] }, { "cell_type": "code", "execution_count": null, "id": "a5a3827b-bba4-49e3-ac06-869ac24a2955", "metadata": {}, "outputs": [], "source": [ "nima.read_tiffmd(fpm, [\"G\", \"R2\", \"R\", \"C\"])" ] }, { "cell_type": "code", "execution_count": null, "id": "9d5cba62-5a56-46ef-a4b1-2f1c7afa84ac", "metadata": {}, "outputs": [], "source": [ "from nima import utils" ] }, { "cell_type": "code", "execution_count": null, "id": "5e0ed5df-b1b3-418b-9830-e0bbbe76214a", "metadata": {}, "outputs": [], "source": [ "bgd = {}\n", "for i, c in enumerate(channels):\n", " bgd[c] = [\n", " segmentation.calculate_bg_iteratively(dim[t, i].compute())\n", " for t in range(md.size_t[0])\n", " ]\n", "\n", "bgd" ] }, { "cell_type": "code", "execution_count": null, "id": "c24e1f4d-b063-42c0-b1a4-32fdce9ebc92", "metadata": {}, "outputs": [], "source": [ "for t in range(md.size_t[0]):\n", " dim[t, 0] -= bgd[channels[0]][t].bg" ] }, { "cell_type": "code", "execution_count": null, "id": "a66f2115-246f-442b-b340-b4d187b04a0c", "metadata": {}, "outputs": [], "source": [ "plt.imshow(dim[0, 0])\n", "plt.colorbar()" ] }, { "cell_type": "code", "execution_count": null, "id": "20f6e831-c48b-4c35-b11a-1454dc128707", "metadata": {}, "outputs": [], "source": [ "segmentation.calculate_bg_iteratively(dim[0, 0].compute(), probplot=1)" ] }, { "cell_type": "code", "execution_count": null, "id": "19b05399-b58a-4a83-bef6-77d208b1e972", "metadata": {}, "outputs": [], "source": [ "bgd[channels[0]][1].bg" ] }, { "cell_type": "code", "execution_count": null, "id": "954e68e4-4dc6-482e-ba6c-072b3bd962b6", "metadata": {}, "outputs": [], "source": [ "t = 0\n", "\n", "plt.imshow(dim[t, 0] - bgd[channels[0]][t].bg)\n", "plt.colorbar()" ] }, { "cell_type": "code", "execution_count": null, "id": "37774140-5ed0-4e22-a006-5464bfc35f8f", "metadata": {}, "outputs": [], "source": [ "m = segmentation.prob(dim[3, 0].compute(), 0, bgd[channels[0]][3].sd * 13) > 0.001\n", "plt.imshow(~m)" ] }, { "cell_type": "code", "execution_count": null, "id": "2a0c2073-2b84-42e6-88f1-facf8015e3c7", "metadata": {}, "outputs": [], "source": [ "asizeof(dim) / 1024**2" ] }, { "cell_type": "code", "execution_count": null, "id": "22fe613b-e9a6-46ac-9a8c-3b8e12e1f6e4", "metadata": {}, "outputs": [], "source": [ "fpm = \"/home/dan/workspace/nima_io/tests/data/t4_1.tif\"\n", "tifffile.TiffFile(fpm).series" ] }, { "cell_type": "code", "execution_count": null, "id": "d6d424e6-3425-4f4f-be08-574558650438", "metadata": {}, "outputs": [], "source": [ "md = nima.Metadata(tifffile.TiffReader(fpm))\n", "md" ] }, { "cell_type": "code", "execution_count": null, "id": "f8b25889-6a15-4f48-817c-f76b2acf5c14", "metadata": {}, "outputs": [], "source": [ "nima.read_tiffmd(fpm, [\"G\", \"R2\", \"C\", \"R\"])" ] }, { "cell_type": "code", "execution_count": null, "id": "1c296808-82d1-4878-9bf1-10b177ae7fe6", "metadata": {}, "outputs": [], "source": [ "asizeof(dim) / 1024**2" ] }, { "cell_type": "code", "execution_count": null, "id": "8b83b251-b686-4e36-960e-9ff7c1aff476", "metadata": {}, "outputs": [], "source": [ "bgr = segmentation.calculate_bg_iteratively(dim[1, 0].compute())\n", "bgr.bg" ] }, { "cell_type": "code", "execution_count": null, "id": "292c6aff-f29b-43b5-bc55-99e8afc07e3f", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "47d5c86c-19c4-4ed2-981e-823676cae53e", "metadata": { "scrolled": true }, "outputs": [], "source": [ "dim, md = nima.read_tiffmd(fp_mdtest, channels=[\"G\", \"R2\", \"C\", \"R\"])\n", "\n", "md" ] }, { "cell_type": "code", "execution_count": null, "id": "bbb67fd0-3c8c-4541-ad03-17a3f5718b3a", "metadata": {}, "outputs": [], "source": [ "channels3 = [\"G\", \"R\", \"C\", \"G2\"]\n", "dim3, _, _ = nima.read_tiff(fp_mdtest, channels3)" ] }, { "cell_type": "code", "execution_count": null, "id": "f65c6486-c9d5-4390-978b-ba0695c1684c", "metadata": {}, "outputs": [], "source": [ "dim3, bgv3, bgf3 = nima.d_bg(\n", " dim3, segmentation.BgParams(kind=\"li_adaptive\"), downscale=(2, 2)\n", ")\n", "c = dim3[\"C\"]\n", "g = dim3[\"G\"]\n", "r = dim3[\"R\"]" ] }, { "cell_type": "code", "execution_count": null, "id": "670add19-a49e-4ca2-96de-e98f45edade1", "metadata": {}, "outputs": [], "source": [ "bc = bgv3[\"C\"]\n", "bg = bgv3[\"G\"][3]\n", "br = bgv3[\"R\"][3]" ] }, { "cell_type": "code", "execution_count": null, "id": "02dbb82f-0a74-4f52-88f3-dad62515a58e", "metadata": {}, "outputs": [], "source": [ "skimage.io.imshow(dim3[\"R\"][1])" ] }, { "cell_type": "code", "execution_count": null, "id": "96b1e56e-b6ef-4e1e-9d1d-efaba9483d2a", "metadata": {}, "outputs": [], "source": [ "plt.plot(dim3[\"R\"][1][80, 30:])" ] }, { "cell_type": "code", "execution_count": null, "id": "be5eb857-a2cb-4c6f-94bd-395b73a1dd48", "metadata": {}, "outputs": [], "source": [ "green = dim[0].compute()\n", "bgg = segmentation.calculate_bg_iteratively(green)\n", "bgg" ] }, { "cell_type": "code", "execution_count": null, "id": "63d5e425-8065-44e3-8ba5-01d289be6197", "metadata": {}, "outputs": [], "source": [ "mask = segmentation.prob(green, bgg.bg, bgg.sd) > 0.01\n", "green[mask]" ] }, { "cell_type": "code", "execution_count": null, "id": "9f80bb20-e6e6-4e39-9b61-53dfbf47cf6f", "metadata": {}, "outputs": [], "source": [ "cyan = dim[2].compute()\n", "bgc = segmentation.calculate_bg_iteratively(cyan)\n", "mask = segmentation.prob(cyan, bgc.bg, bgc.sd) < 0.00000000000000000000001" ] }, { "cell_type": "code", "execution_count": null, "id": "c41ffa54-0abc-41ff-85d3-29a546dd486f", "metadata": {}, "outputs": [], "source": [ "red = dim[3].compute()\n", "red2 = dim[1].compute()" ] }, { "cell_type": "code", "execution_count": null, "id": "39c01f74-5c27-4741-8902-603899a63604", "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=(7.5, 7.5))\n", "\n", "plt.subplot(3, 2, 1)\n", "plt.hexbin(green[mask], cyan[mask], bins=\"log\", cmap=plt.cm.viridis_r)\n", "cb = plt.colorbar()\n", "plt.xlabel(\"green\")\n", "plt.ylabel(\"cyan\")\n", "\n", "plt.subplot(3, 2, 2)\n", "plt.hexbin(red[mask], cyan[mask], bins=\"log\", cmap=plt.cm.viridis_r)\n", "cb = plt.colorbar()\n", "plt.xlabel(\"red\")\n", "plt.ylabel(\"cyan\")\n", "\n", "ax = plt.subplot(3, 2, 4)\n", "plt.hexbin(red[mask], green[mask], bins=\"log\", cmap=plt.cm.viridis_r)\n", "cb = plt.colorbar()\n", "plt.xlabel(\"red\")\n", "plt.ylabel(\"green\")\n", "\n", "ax = plt.subplot(3, 2, 5)\n", "plt.hexbin(red2[mask], green[mask], bins=\"log\", cmap=plt.cm.viridis_r)\n", "cb = plt.colorbar()\n", "plt.xlabel(\"red2\")\n", "plt.ylabel(\"green\")\n", "\n", "ax = plt.subplot(3, 2, 6)\n", "plt.hexbin(red2[mask], cyan[mask], bins=\"log\", cmap=plt.cm.viridis_r)\n", "cb = plt.colorbar()\n", "plt.xlabel(\"red2\")\n", "plt.ylabel(\"cyan\")" ] }, { "cell_type": "code", "execution_count": null, "id": "829b94c1-0bdb-42aa-a2f3-7759eb872ace", "metadata": {}, "outputs": [], "source": [ "from mpl_toolkits.axes_grid1.inset_locator import mark_inset\n", "\n", "plt.figure(figsize=(10, 8))\n", "plt.subplot(2, 2, 1)\n", "plt.hexbin(g.ravel(), c.ravel(), bins=\"log\", cmap=plt.cm.viridis_r)\n", "cb = plt.colorbar()\n", "plt.xlabel(\"green\")\n", "plt.ylabel(\"cyan\")\n", "\n", "plt.subplot(2, 2, 2)\n", "plt.hexbin(r.ravel(), c.ravel(), bins=\"log\", cmap=plt.cm.viridis_r)\n", "cb = plt.colorbar()\n", "plt.xlabel(\"red\")\n", "plt.ylabel(\"cyan\")\n", "\n", "ax = plt.subplot(2, 2, 4)\n", "plt.hexbin(r.ravel(), g.ravel(), bins=\"log\", cmap=plt.cm.viridis_r)\n", "cb = plt.colorbar()\n", "plt.xlabel(\"red\")\n", "plt.ylabel(\"green\")\n", "\n", "axins = plt.axes([0.2, 0.12, 0.28, 0.28])\n", "axins.hexbin(\n", " r.ravel(), g.ravel(), extent=(0, 80, 0, 150), bins=\"log\", cmap=plt.cm.viridis_r\n", ")\n", "\n", "mark_inset(ax, axins, loc1=1, loc2=4, fc=\"none\", ec=\"0.5\")" ] }, { "cell_type": "code", "execution_count": null, "id": "b0060b27-bfea-4cd5-99fa-8fde6c9eefde", "metadata": {}, "outputs": [], "source": [ "import statsmodels.api as sm\n", "\n", "f = sm.qqplot_2samples(red[~mask], green[~mask])\n", "f = sm.qqplot_2samples(red[~mask], cyan[~mask])" ] }, { "cell_type": "markdown", "id": "48aa0fd4-e544-427d-9a26-fe5fcbc59e72", "metadata": { "jp-MarkdownHeadingCollapsed": true }, "source": [ "## flat image correction" ] }, { "cell_type": "code", "execution_count": null, "id": "d458cca7-0828-4817-ad1b-c39bf32362d7", "metadata": {}, "outputs": [], "source": [ "g1a = nima.read_tiff(\"/home/dati/dt-clop3/data/210917/3alpha/c1_2.tf8\", channels)[0][\n", " \"G\"\n", "][2]\n", "g2a = nima.read_tiff(\"/home/dati/dt-clop3/data/210917/3alpha/c2_2.tf8\", channels)[0][\n", " \"G\"\n", "][2]\n", "g3a = nima.read_tiff(\"/home/dati/dt-clop3/data/210917/3alpha/c3_2.tf8\", channels)[0][\n", " \"G\"\n", "][2]\n", "g1 = nima.read_tiff(\"/home/dati/dt-clop3/data/210917/3/c1_2.tf8\", channels)[0][\"G\"][2]\n", "g2 = nima.read_tiff(\"/home/dati/dt-clop3/data/210917/3/c2_2.tf8\", channels)[0][\"G\"][2]\n", "g3 = nima.read_tiff(\"/home/dati/dt-clop3/data/210917/3/c3_2.tf8\", channels)[0][\"G\"][2]" ] }, { "cell_type": "code", "execution_count": null, "id": "e5c8dcb8-2477-4d5f-ba08-5f2b5a104d63", "metadata": {}, "outputs": [], "source": [ "plt.subplot(1, 2, 1)\n", "skimage.io.imshow(\n", " skimage.filters.gaussian(np.max([g1, g2, g3, g1a, g2a, g3a], axis=0), sigma=500)\n", ")\n", "plt.subplot(1, 2, 2)\n", "skimage.io.imshow(skimage.filters.gaussian(np.max([g1, g2, g3], axis=0), sigma=500))" ] }, { "cell_type": "markdown", "id": "42435ad0-9d17-4122-a5d4-8f560b5f3d9d", "metadata": { "jp-MarkdownHeadingCollapsed": true }, "source": [ "## example w/out @Gain" ] }, { "cell_type": "code", "execution_count": null, "id": "2b911cef-7b6f-4c84-a7e8-7da61d5bf746", "metadata": {}, "outputs": [], "source": [ "fp24 = \"/home/dati/dt-clop3/data/210917/3/c1_2.tf8\"" ] }, { "cell_type": "code", "execution_count": null, "id": "1af2fc76-a6ab-49a9-b059-d52cad3a5169", "metadata": {}, "outputs": [], "source": [ "dim, md = nima.read_tiffmd(fp24, channels=[\"G\", \"R\", \"C\"])" ] }, { "cell_type": "code", "execution_count": null, "id": "0cc302c3-ce41-4dce-afa4-d16729c4cb68", "metadata": {}, "outputs": [], "source": [ "sns.histplot(dim[8, 0].ravel())\n", "plt.yscale(\"log\")" ] }, { "cell_type": "code", "execution_count": null, "id": "189e5389-9c49-4f37-8381-9dab42afe35f", "metadata": {}, "outputs": [], "source": [ "utils.bg(dim[8, 0].compute())" ] }, { "cell_type": "code", "execution_count": null, "id": "fdf61e51-7d29-4d93-b2b1-b09e156323ab", "metadata": {}, "outputs": [], "source": [ "bgr = segmentation.calculate_bg_iteratively(dim[8, 1].compute())\n", "bgr" ] }, { "cell_type": "code", "execution_count": null, "id": "77fd2a76-3126-47aa-96ab-f85bf249d7ef", "metadata": {}, "outputs": [], "source": [ "sns.histplot(\n", " dim[8, 1].compute()[\n", " (segmentation.prob(dim[8, 1].compute(), bgr.bg, bgr.sd) > 0.001)\n", " ]\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "44480b11-e9cb-4895-88f2-baea702aeb94", "metadata": {}, "outputs": [], "source": [ "mask = (\n", " segmentation.prob(dim[8, 1].compute(), bgr.bg, bgr.sd)\n", " > 0.0000000000000000000000000000000000000000000000000000000000000000001\n", ")\n", "plt.imshow(~mask)" ] }, { "cell_type": "markdown", "id": "e106c237-b203-4d36-a88b-c110aada7046", "metadata": {}, "source": [ "## BIAS and FLAT\n", "\n", "TODO:\n", "- pytest\n", "- build a function callable from both the library and the CLI" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.2" } }, "nbformat": 4, "nbformat_minor": 5 }