Skip to content

Commit

Permalink
Actually updated SNR calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
crhea93 committed Aug 31, 2021
1 parent 83c75a0 commit dd3b4dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions LuciBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,16 +855,18 @@ def create_snr_map(self, x_min=0, x_max=2048, y_min=0, y_max=2064, method=1):
# Select spectral region around Halpha and NII complex
min_ = np.argmin(np.abs(np.array(self.spectrum_axis)-flux_min))
max_ = np.argmin(np.abs(np.array(self.spectrum_axis)-flux_max))
in_region = self.cube_final[x_pix, y_pix, min_:max_]
flux_in_region = np.nansum(self.cube_final[x_pix, y_pix, min_:max_])
# Select distance region
min_ = np.argmin(np.abs(np.array(self.spectrum_axis)-noise_min))
max_ = np.argmin(np.abs(np.array(self.spectrum_axis)-noise_max))
out_region = self.cube_final[x_pix, y_pix, min_:max_]
std_out_region = np.nanstd(self.cube_final[x_pix, y_pix, min_:max_])
if method == 1:
signal = np.max(flux_in_region)-np.nanmedian(flux_in_region)
noise = np.nanstd(std_out_region)
signal = np.nanmax(in_region)-np.nanmedian(in_region)
noise = np.abs(np.nanstd(out_region))
snr = float(signal / np.sqrt(noise))
snr = snr/(np.sqrt(np.nanmean(flux_in_region)))
snr = snr/(np.sqrt(np.nanmean(np.abs(in_region))))
else:
snr = float(flux_in_region/std_out_region)
snr = snr
Expand Down
Binary file modified __pycache__/LuciBase.cpython-39.pyc
Binary file not shown.

0 comments on commit dd3b4dc

Please sign in to comment.