Skip to content

Commit

Permalink
added doublet ratio criteria for rejecting false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi0395 committed Aug 12, 2024
1 parent 893e947 commit 4145bc8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 5 additions & 2 deletions qsoabsfind/absfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,11 @@ def convolution_method_absorber_finder_in_QSO_spectra(spec_index, absorber='MgII
vel1, vel2 = vel_dispersion(c0, c1, gaussian_parameters[2], gaussian_parameters[5], resolution)
# calculate best -fit doublet ratio and errors and check if they are within the range.
# usually 1 < DR < f1/f2 (doublet ratio =2, for MgII, CIV)
dr, dr_error = calculate_doublet_ratio(EW_first_temp_mean[0], EW_second_temp_mean[0], EW_first_error_temp[0], EW_second_error_temp[0])
min_dr, max_dr = 1 - 2 * dr_error, f1/f2 + 2 * dr_error
if EW_first_temp_mean[0] > 0 and EW_second_temp_mean[0] > 0:
dr, dr_error = calculate_doublet_ratio(EW_first_temp_mean[0], EW_second_temp_mean[0], EW_first_error_temp[0], EW_second_error_temp[0])
min_dr, max_dr = 1 - 2 * dr_error, f1/f2 + 2 * dr_error
else:
dr, min_dr, max_dr = -1, -1, -1 #failure case

if (gaussian_parameters > bound[0] + 0.01).all() and (gaussian_parameters < bound[1] - 0.01).all() and lower_del_lam <= c1 - c0 <= upper_del_lam and sn1 > sn_line1 and sn2 > sn_line2 and vel1 > 0 and vel2 > 0 and min_dr <= dr <=max_dr:
pure_z_abs[m] = z_new
Expand Down
3 changes: 0 additions & 3 deletions qsoabsfind/absorberutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ def calculate_doublet_ratio(ew1, ew2, ew1_error, ew2_error):
- doublet_ratio (float): The ratio of ew1 to ew2.
- doublet_ratio_error (float): The propagated error for the doublet ratio.
"""
if ew2 == 0:
raise ValueError("ew2 cannot be zero, as it would result in division by zero.")

# Calculate the doublet ratio
doublet_ratio = ew1 / ew2

Expand Down

0 comments on commit 4145bc8

Please sign in to comment.