diff options
author | Daniil Kazantsev <dkazanc@hotmail.com> | 2018-08-14 12:45:29 +0100 |
---|---|---|
committer | Daniil Kazantsev <dkazanc@hotmail.com> | 2018-08-14 12:45:29 +0100 |
commit | ab323e0b38b941d2a7aa5b5e705518b770f1d36b (patch) | |
tree | 25d925ac2a10b240f78906bcf53bba4f8da50d9f /Wrappers | |
parent | 2341ba146f16e79b097f55b1efa281bc06eef472 (diff) | |
download | framework-ab323e0b38b941d2a7aa5b5e705518b770f1d36b.tar.gz framework-ab323e0b38b941d2a7aa5b5e705518b770f1d36b.tar.bz2 framework-ab323e0b38b941d2a7aa5b5e705518b770f1d36b.tar.xz framework-ab323e0b38b941d2a7aa5b5e705518b770f1d36b.zip |
corrections to normalization and log with zeroes in flats
Diffstat (limited to 'Wrappers')
-rw-r--r-- | Wrappers/Python/wip/demo_imat_whitebeam.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/Wrappers/Python/wip/demo_imat_whitebeam.py b/Wrappers/Python/wip/demo_imat_whitebeam.py index af3d568..482c1ae 100644 --- a/Wrappers/Python/wip/demo_imat_whitebeam.py +++ b/Wrappers/Python/wip/demo_imat_whitebeam.py @@ -21,22 +21,25 @@ from ccpi.optimisation.algs import CGLS, FISTA from ccpi.optimisation.funcs import Norm2sq, Norm1 # Load and display a couple of summed projection as examples -pathname0 = '/media/jakob/050d8d45-fab3-4285-935f-260e6c5f162c1/Data/neutrondata/PSI_phantom_IMAT/DATA/Sample/angle0/' +pathname0 = '/media/algol/HD-LXU3/DATA_DANIIL/PSI_DATA/DATA/Sample/angle0/' filename0 = 'IMAT00004675_Tomo_test_000_SummedImg.fits' data0 = read_fits(pathname0 + filename0) -pathname10 = '/media/jakob/050d8d45-fab3-4285-935f-260e6c5f162c1/Data/neutrondata/PSI_phantom_IMAT/DATA/Sample/angle10/' +pathname10 = '/media/algol/HD-LXU3/DATA_DANIIL/PSI_DATA/DATA/Sample/angle10/' filename10 = 'IMAT00004685_Tomo_test_000_SummedImg.fits' data10 = read_fits(pathname10 + filename10) # Load a flat field (more are available, should we average over them?) -flat1 = read_fits('/media/jakob/050d8d45-fab3-4285-935f-260e6c5f162c1/Data/neutrondata/PSI_phantom_IMAT/DATA/OpenBeam_aft1/IMAT00004932_Tomo_test_000_SummedImg.fits') +flat1 = read_fits('/media/algol/HD-LXU3/DATA_DANIIL/PSI_DATA/DATA/OpenBeam_aft1/IMAT00004932_Tomo_test_000_SummedImg.fits') # Apply flat field and display after flat-field correction and negative log -data0_rel = data0 / flat1 -data10_rel = data10 / flat1 +data0_rel = numpy.zeros(numpy.shape(flat1), dtype = float) +nonzero = flat1 > 0 +data0_rel[nonzero] = data0[nonzero] / flat1[nonzero] +data10_rel = numpy.zeros(numpy.shape(flat1), dtype = float) +data10_rel[nonzero] = data10[nonzero] / flat1[nonzero] plt.imshow(data0_rel) plt.colorbar() @@ -55,7 +58,7 @@ plt.colorbar() plt.show() # Set up for loading all summed images at 250 angles. -pathname = '/media/jakob/050d8d45-fab3-4285-935f-260e6c5f162c1/Data/neutrondata/PSI_phantom_IMAT/DATA/Sample/angle{}/' +pathname = '/media/algol/HD-LXU3/DATA_DANIIL/PSI_DATA/DATA/Sample/angle{}/' filename = 'IMAT0000{}_Tomo_test_000_SummedImg.fits' # Dimensions @@ -71,7 +74,14 @@ for i in range(0,250): data[i,:,:] = read_fits(curimfile) # Apply flat field and take negative log -data_rel = -numpy.log(data/flat1) +nonzero = flat1 > 0 +for i in range(0,250): + data[i,nonzero] = data[i,nonzero]/flat1[nonzero] + +eqzero = data == 0 +data[eqzero] = 1 + +data_rel = -numpy.log(data) # Permute order to get: angles, vertical, horizontal, as default in framework. data_rel = numpy.transpose(data_rel,(0,2,1)) |