peng-lab / BaSiCPy

MIT License
66 stars 22 forks source link

Jupyter crashes #157

Open smith6jt-cop opened 3 weeks ago

smith6jt-cop commented 3 weeks ago

Hello,

Trying this code from your notebooks as the standard autotune approach does not appear to give the best results. However, after only a minute and a few iterations, jupyter kernel restarts. Running on Windows 10, 32 core, 64 GB RAM.

I tried all options for fitting_mode, resize_mode, and max iterations, but still crashing. Can you help get this going or suggest a method to find optimal parameters?

flatfields_wsi = [] darkfields_wsi = [] records = []

for smoothness_flatfield in [0.1, 0.5, 1, 5, 10]: for smoothness_darkfield in [0, 0.1, 0.5, 1, 5, 10]: for sparse_cost_darkfield in tqdm(np.array([0, 0.1, 0.5, 1, 5, 10]) * 0.01): basic = BaSiC( fitting_mode='approximate', max_iterations = 100, max_reweight_iterations = 5, max_reweight_iterations_baseline= 3, max_workers = 20, resize_mode = 'skimage_dask', smoothness_flatfield=smoothness_flatfield, smoothness_darkfield=smoothness_darkfield, sparse_cost_darkfield=sparse_cost_darkfield, get_darkfield=True, ) try: basic.fit(im_array) flatfields_wsi.append(basic.flatfield) darkfields_wsi.append(basic.darkfield) records.append( { "smoothness_flatfield": smoothness_flatfield, "smoothness_darkfield": smoothness_darkfield, "sparse_cost_darkfield": sparse_cost_darkfield, } ) except RuntimeError: pass conditions_df = pd.DataFrame.from_records(records)

smith6jt-cop commented 3 weeks ago

Link to images: https://drive.google.com/drive/folders/1PqpMqqZCASW0VqwwaEf_MENy9wqJnzAQ?usp=sharing

yuliu96 commented 3 weeks ago

Hi, for BaSiCPy, can you primarily try without darkfield now (so get_darkfield=False)? we will elaborate the effects of darkfield estimation in our later manuscript.