poetry run emacs an.org
import tifffile as tff
import numpy as np
import aicsimageio
import matplotlib.pyplot as plt
import seaborn as sb
import impy
from pathlib import Path
import skimage
import scipy
import imageio
import pandas as pd
cd "/home/dati/dt-evolv/data/2022-11-16/13401/TimePoint_1"
cd "/home/dati/dt-evolv/data/2022-11-16/13401/TimePoint_1"
mkdir -p thumbs
fd _thumb -0 | xargs -0 mv -t ./thumbs
pwd
cd "/home/dati/dt-evolv/data/2022-11-16/13401/TimePoint_1"
fp2 = "/home/dati/dt-evolv/data/2022-11-16/13401/TimePoint_1/6w-20Xph1-SpikeTest6-DA_A01_s1_w2B3DEDFEB-FB52-4D83-8176-CC090AD62AC4.tif"
fp1 = "/home/dati/dt-evolv/data/2022-11-16/13401/TimePoint_1/6w-20Xph1-SpikeTest6-DA_A01_s1_w19A3DA0A6-B9DD-475E-ABED-27415F9DE6EB.tif"
i1 = impy.imread(fp1)
i2 = impy.imread(fp2)
skimage.io.imshow(i2)
p = Path(".")
out1 = Path("./1024")
out2 = Path("./512")
out1.mkdir()
out2.mkdir()
import utils
p = Path(".")
s_in = ["A01", "B01", "A02", "A03"]
s_out = ["A01", "B01", "A02", "A03"]
for ins, outs in zip(s_in, s_out):
for i in range(20, 40):
print(ins, outs, i)
fp1 = sorted(p.glob(f"**/*{ins}*s{i}_w1*"))[0]
fp2 = sorted(p.glob(f"**/*{ins}*s{i}_w2*"))[0]
c1 = tff.imread(fp1)
c2 = tff.imread(fp2)
# clip1 = int(utils.bg(c1)[0])
clip2 = int(utils.bg(c2)[0])
# c1r = skimage.util.img_as_ubyte(skimage.exposure.rescale_intensity(c1.clip(clip1, c1.max() * 0.95)))
# c2r = skimage.util.img_as_ubyte(skimage.exposure.rescale_intensity(c2.clip(clip2, c2.max() * 0.95)))
c1r = skimage.util.img_as_ubyte((c1))
c2r = skimage.util.img_as_ubyte(skimage.exposure.rescale_intensity(c2.clip(clip2,65000)))
cc = np.dstack((c2r, c1r, np.zeros_like(c1r)))
cc = skimage.transform.downscale_local_mean(cc, (4, 4, 1))
imageio.imwrite(out2 / f"{outs}_s{i}.png", cc)
A01 A01 20 Lossy conversion from float64 to uint8. Range [0.0, 211.5]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 21 Lossy conversion from float64 to uint8. Range [0.0, 189.0625]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 22 Lossy conversion from float64 to uint8. Range [0.0, 212.4375]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 23 Lossy conversion from float64 to uint8. Range [0.0, 173.25]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 24 Lossy conversion from float64 to uint8. Range [0.0, 227.0]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 25 Lossy conversion from float64 to uint8. Range [0.0, 237.25]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 26 Lossy conversion from float64 to uint8. Range [0.0, 190.0]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 27 Lossy conversion from float64 to uint8. Range [0.0, 204.9375]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 28 Lossy conversion from float64 to uint8. Range [0.0, 202.8125]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 29 Lossy conversion from float64 to uint8. Range [0.0, 221.3125]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 30 Lossy conversion from float64 to uint8. Range [0.0, 232.0625]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 31 Lossy conversion from float64 to uint8. Range [0.0, 245.875]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 32 Lossy conversion from float64 to uint8. Range [0.0, 233.75]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 33 Lossy conversion from float64 to uint8. Range [0.0, 183.6875]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 34 Lossy conversion from float64 to uint8. Range [0.0, 220.0]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 35 Lossy conversion from float64 to uint8. Range [0.0, 240.25]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 36 Lossy conversion from float64 to uint8. Range [0.0, 230.875]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 37 Lossy conversion from float64 to uint8. Range [0.0, 228.5]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 38 Lossy conversion from float64 to uint8. Range [0.0, 229.125]. Convert image to uint8 prior to saving to suppress this warning. A01 A01 39 Lossy conversion from float64 to uint8. Range [0.0, 235.375]. Convert image to uint8 prior to saving to suppress this warning. B01 B01 20
[0;31m---------------------------------------------------------------------------[0m [0;31mIndexError[0m Traceback (most recent call last) Input [0;32mIn [8][0m, in [0;36m<cell line: 6>[0;34m()[0m [1;32m 7[0m [38;5;28;01mfor[39;00m i [38;5;129;01min[39;00m [38;5;28mrange[39m([38;5;241m20[39m, [38;5;241m40[39m): [1;32m 8[0m [38;5;28mprint[39m(ins, outs, i) [0;32m----> 9[0m fp1 [38;5;241m=[39m [38;5;28;43msorted[39;49m[43m([49m[43mp[49m[38;5;241;43m.[39;49m[43mglob[49m[43m([49m[38;5;124;43mf[39;49m[38;5;124;43m"[39;49m[38;5;124;43m**/*[39;49m[38;5;132;43;01m{[39;49;00m[43mins[49m[38;5;132;43;01m}[39;49;00m[38;5;124;43m*s[39;49m[38;5;132;43;01m{[39;49;00m[43mi[49m[38;5;132;43;01m}[39;49;00m[38;5;124;43m_w1*[39;49m[38;5;124;43m"[39;49m[43m)[49m[43m)[49m[43m[[49m[38;5;241;43m0[39;49m[43m][49m [1;32m 10[0m fp2 [38;5;241m=[39m [38;5;28msorted[39m(p[38;5;241m.[39mglob([38;5;124mf[39m[38;5;124m"[39m[38;5;124m**/*[39m[38;5;132;01m{[39;00mins[38;5;132;01m}[39;00m[38;5;124m*s[39m[38;5;132;01m{[39;00mi[38;5;132;01m}[39;00m[38;5;124m_w2*[39m[38;5;124m"[39m))[[38;5;241m0[39m] [1;32m 11[0m c1 [38;5;241m=[39m tff[38;5;241m.[39mimread(fp1) [0;31mIndexError[0m: list index out of range
cd "/home/dati/dt-evolv/data/2022-11-16/13401/TimePoint_1"
p = Path(".")
out2 = Path("./512n")
out2.mkdir()
import utils
p = Path(".")
s_in = ["A01", "B01", "A02", "B02", "A03", "B03"]
s_out = ["A01", "B01", "A02", "B02", "A03", "B03"]
for ins, outs in zip(s_in, s_out):
print(ins)
for i in range(1, 901):
fp1 = sorted(p.glob(f"**/*{ins}*s{i}_w1*"))[0]
fp2 = sorted(p.glob(f"**/*{ins}*s{i}_w2*"))[0]
c1 = tff.imread(fp1)
c2 = tff.imread(fp2)
c1 = skimage.transform.downscale_local_mean(c1, 4)
c2 = skimage.transform.downscale_local_mean(c2, 4)
clip1 = int(np.sum(utils.bg(c1)))
clip2 = int(np.sum(utils.bg(c2)))
c1r = skimage.util.img_as_ubyte(skimage.exposure.rescale_intensity(c1.clip(clip1, c1.max() * 0.95)))
c2r = skimage.util.img_as_ubyte(skimage.exposure.rescale_intensity(c2.clip(clip2, c2.max() * 0.95)))
cc = np.dstack((c2r, c1r, np.zeros_like(c1r)))
imageio.imwrite(out2 / f"{outs}_s{i}.png", cc)
A01 B01 /home/dan/Sync/tmp/datacode/.venv/lib/python3.10/site-packages/scipy/optimize/_minpack_py.py:476: RuntimeWarning: Number of calls to function has reached maxfev = 1000. warnings.warn(errors[info][0], RuntimeWarning) A02 B02 A03 B03