Permalink
Browse files

deconvolution no implemented in python code

  • Loading branch information...
Hantian Zhang
Hantian Zhang committed Jul 25, 2017
1 parent 72a5c99 commit eea5e78a78c2e8be9dece6969fb73d792ee6b1a7
Showing with 12 additions and 12 deletions.
  1. +3 −3 README.md
  2. +9 −9 roou.py
View
@@ -53,8 +53,8 @@ bash download.sh
If the mode equals zero, this is the training data. If the mode equals one, the data is used for testing.
```bash
python roou.py -input fitsdata/fits_train -fwhm 1.4 -sigma 1.2 -mode 0
python roou.py -input fitsdata/fits_test -fwhm 1.4 -sigma 1.2 -mode 1
python roou.py --input fitsdata/fits_train --fwhm 1.4 --sig 1.2 --mode 0
python roou.py --input fitsdata/fits_test --fwhm 1.4 --sig 1.2 --mode 1
```
XXX is your local address. On our AMI, you can skip this step due to all these have default values.
@@ -75,7 +75,7 @@ This will start the training process. If you want to load the model which alread
Before you try to test your model, you should modify the model path in the config.py.
```bash
python test.py
python test.py gpu=1
```
The results can be seen in the folder "test".
View
18 roou.py
@@ -57,14 +57,14 @@ def roou():
os.makedirs("./" + train_folder)
if not os.path.exists("./" + test_folder):
os.makedirs("./" + test_folder)
if not os.path.exists("./" + deconv_folder):
os.makedirs("./"+ deconv_folder)
#if not os.path.exists("./" + deconv_folder):
#os.makedirs("./"+ deconv_folder)
fits = '%s/*/*-g.fits'%(input)
files = glob.iglob(fits)
for i in files:
print i
#print i
file_name = os.path.basename(i)
#readfiles
@@ -93,7 +93,7 @@ def roou():
figure_original[:,:,1] = data_r
figure_original[:,:,2] = data_i
print figure_original
#print figure_original
if is_demo:
cv2.imshow("img", adjust(figure_original))
@@ -106,7 +106,7 @@ def roou():
# with problem
figure_blurred = cv2.GaussianBlur(figure_original, (5,5), gaussian_sigma)
print "IIIIII"
#print "IIIIII"
if is_demo:
cv2.imshow("i", figure_blurred)
@@ -136,7 +136,7 @@ def roou():
cv2.waitKey(0)
# deconvolution
if mode:
if mode>2:
hsize = 2*np.ceil(2*gaussian_sigma)+1
PSF = fspecial_gauss(hsize, gaussian_sigma)
#figure_deconv = deconvblind(figure_blurred, PSF)
@@ -153,7 +153,7 @@ def roou():
figure_blurred[figure_blurred<MIN]=MIN
figure_blurred[figure_blurred>MAX]=MAX
if mode:
if mode>2:
figure_deconv[figure_deconv<MIN]=MIN
figure_deconv[figure_deconv>MAX]=MAX
@@ -173,7 +173,7 @@ def roou():
figure_original = np.arcsinh(10*figure_original)/3
figure_blurred = np.arcsinh(10*figure_blurred)/3
if mode:
if mode>2:
figure_deconv = np.arcsinh(10*figure_deconv)/3
# output result to pix2pix format
@@ -198,7 +198,7 @@ def roou():
image = (figure_combined*256).astype(np.int)
cv2.imwrite(jpg_path, image)
if mode:
if mode>2:
deconv_path = '%s/deconv/%s.jpg'% (figure_folder,filename)
cv2.imwrite(figure_deconv,deconv_path)

0 comments on commit eea5e78

Please sign in to comment.