Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #1 empty sod list. #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pysaber/mainsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def estimate_blur(rads,sod,odd,pix_wid,edge,thresh=1e-6,pad=[3,3],masks=None,bda
#It is recommended to run the blur model estimation in multiple stages
#First, only estimate the detector blur using radiographs with the largest SODs
#Radiographs with the largest SODs are expected to have minimal source blur
sod_avg = sum(sod)/len(sod) #Compute average of all SODs
sod_odd_avg_quotient = sum(np.array(sod)/np.array(odd))/len(sod) #Compute average of all SODs/ODDs

#Only include list elements with SOD > average of all SODs
#Only include list elements with SOD/ODD > average of all SODs/ODDs
rads_det,trans_models_det,trans_params_det,trans_bounds_det,sod_det,sdd_det = [],[],[],[],[],[]
for i in range(len(rads)):
if only_det:
Expand All @@ -86,7 +86,7 @@ def estimate_blur(rads,sod,odd,pix_wid,edge,thresh=1e-6,pad=[3,3],masks=None,bda
trans_bounds_det.append(trans_bounds[i])
sod_det.append(sod[i])
sdd_det.append(sdd[i])
elif sod[i] > sod_avg and not only_src:
elif sod[i]/odd[i] > sod_odd_avg_quotient and not only_src:
rads_det.append(rads[i])
trans_models_det.append(trans_models[i])
trans_params_det.append(trans_params[i])
Expand All @@ -107,7 +107,7 @@ def estimate_blur(rads,sod,odd,pix_wid,edge,thresh=1e-6,pad=[3,3],masks=None,bda
print("{:.2f} mins has elapsed".format((time.time()-start_time)/60.0))

#Next, only estimate the source blur using radiographs at the smallest source to object distances
#Only include list elements with SOD < average of all SODs
#Only include list elements with SOD/ODD < average of all SODs/ODDs
rads_src,trans_models_src,trans_params_src,trans_bounds_src,sod_src,sdd_src = [],[],[],[],[],[]
for i in range(len(rads)):
if only_src:
Expand All @@ -117,7 +117,7 @@ def estimate_blur(rads,sod,odd,pix_wid,edge,thresh=1e-6,pad=[3,3],masks=None,bda
trans_bounds_src.append(trans_bounds[i])
sod_src.append(sod[i])
sdd_src.append(sdd[i])
elif sod[i] < sod_avg and not only_det:
elif sod[i]/odd[i] < sod_odd_avg_quotient and not only_det:
rads_src.append(rads[i])
trans_models_src.append(trans_models[i])
trans_params_src.append(trans_params[i])
Expand Down