def calc_histograms_lab_setups(): for polimer_type in ["PDL-05", "PDLG-5002"]: radius_coefs = {"PDL-05": 0.9, "PDLG-5002": 0.95} paths = file_paths.get_benchtop_setup_paths(polimer_type) for sample_id in range(len(paths)): sample_name = list(paths.keys())[sample_id] print( f"============== {sample_id} sample: {sample_name} ==============" ) img3d = get_bin_img(sample_name) print('tot: ', np.sum(img3d) / img3d.size) fig, ax = plt.subplots() ax.imshow(img3d[0], cmap="gray") dm.save_plot(fig, "previews", f'{sample_id} bin ' + sample_name) cylindric_fragments, cylindric_masks \ = divide_image_into_sector_cylindric_fragments(img3d, height=len(img3d)//3-1, radius_coef=radius_coefs[polimer_type]) fig = get_porosity_histogram_disrtibution( cylindric_fragments, sample_name, img3d.shape, pixel_size_mm=PIXEL_SIZE_MM_SETUP, masks=cylindric_masks, radius_coef=radius_coefs[polimer_type]) dm.save_plot(fig, SAVE_IMG_DESKTOP_SETUP_FOLDER, f'hist {sample_id} {sample_name}')
sample_name, img3d.shape, pixel_size_mm=PIXEL_SIZE_MM_SETUP, masks=cylindric_masks, radius_coef=radius_coefs[polimer_type]) dm.save_plot(fig, SAVE_IMG_DESKTOP_SETUP_FOLDER, f'hist {sample_id} {sample_name}') if __name__ == '__main__': polimer_type = ["PDL-05", "PDLG-5002"][0] radius_coefs = {"PDL-05": 0.9, "PDLG-5002": 0.95} paths = file_paths.get_benchtop_setup_paths(polimer_type) df = dm.load_data("setup_culindric_porosities.csv") #df = pd.DataFrame(columns = ['polimer_type', 'sample_number', 'date', 'mean', 'std']) for sample_id in range(len(paths)): sample_name = list(paths.keys())[sample_id] print( f"============== {sample_id} sample: {sample_name} ==============") print(sample_name.split()) img3d = ~get_bin_img(sample_name) print('tot: ', np.sum(img3d) / img3d.size) fig, ax = plt.subplots() ax.imshow(img3d[0], cmap="gray") dm.save_plot(fig, "previews", f'{sample_id} bin ' + sample_name)