Skip to content

Commit e4d894b

Browse files
author
harnessa
committedJan 29, 2022
small up
1 parent 508e468 commit e4d894b

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed
 

‎plot_results.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
data_run = 'run__6_01_21__data_1s_bin1__spiders__median'
88

9-
model = 'Newest'
9+
model = 'Newest_orig'
1010

1111
ext = ''
1212

‎quadrature_code/generate_images.py

-4
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@
126126
#Build steps
127127
steps = np.linspace(-grid_width_lab/2, grid_width_lab/2, num=nsteps)
128128

129-
#Containers
130-
images = np.empty((0, sim.num_pts, sim.num_pts))
131-
positions = np.empty((0, 2))
132-
133129
#Create new csv file
134130
csv_file = os.path.join(save_dir, base_name + '.csv')
135131
with open(csv_file, 'w') as f:

‎quadrature_code/noise_maker.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def set_parameters(self, params):
8383
#Get calibration value
8484
if not self.is_test:
8585
cal_img = np.load(os.path.join(self.load_dir, 'calibration.npy'))
86-
self.suppression_norm = cal_img[cal_img > 0].mean()
86+
self.set_suppression_norm(cal_img)
8787

8888
############################################
8989
############################################
@@ -166,7 +166,7 @@ def run_multiple_snr_script(self):
166166
img = self.add_noise_to_image(img, peak_cnts)
167167

168168
#Convert to suppression
169-
img *= self.diff_peak / (self.count_rate * exp_time * self.suppression_norm)
169+
img = self.convert_to_suppression(img, exp_time)
170170

171171
#Save
172172
if self.do_save:
@@ -318,3 +318,17 @@ def check_snr(self, img, texp):
318318

319319
############################################
320320
############################################
321+
322+
############################################
323+
#### Suppresion ####
324+
############################################
325+
326+
def set_suppression_norm(self, cal_img):
327+
self.suppression_norm = cal_img[cal_img > 0].mean()
328+
329+
def convert_to_suppression(self, img, exp_time):
330+
img *= self.diff_peak / (self.count_rate * exp_time * self.suppression_norm)
331+
return img
332+
333+
############################################
334+
############################################

0 commit comments

Comments
 (0)
Please sign in to comment.