Skip to content

Commit

Permalink
increases bounds for line width
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi0395 committed Aug 28, 2024
1 parent 0f61cb7 commit 989e467
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions qsoabsfind/absfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ def convolution_method_absorber_finder_in_QSO_spectra(spec_index, absorber='MgII
del_sigma = line1 * resolution / speed_of_light # in Ang
del_sigma = del_sigma / 2.355 ## FWHM sqrt(8ln2)

bd_ct, x_sep = 1.0, 10 # multiple for bound definition (for line centres and widths of line)
bd_ct, x_sep = 1.0, 30 # multiple for bound definition (for line centres and widths of line, max can be 30 times of min)

# bounds for gaussian fitting, to avoid very bad candidates
edge = 0.05
edge = 0.1
bound = ((np.array([2e-2, line1 - bd_ct * d_pix, del_sigma - edge, 2e-2, line2 - bd_ct * d_pix, del_sigma - edge])),
(np.array([1.11, line1 + bd_ct * d_pix, x_sep * del_sigma + edge, 1.11, line2 + bd_ct * d_pix, x_sep * del_sigma + edge])))

Expand Down Expand Up @@ -212,7 +212,7 @@ def convolution_method_absorber_finder_in_QSO_spectra(spec_index, absorber='MgII
if len(combined_final_our_z)>0:
z_abs, z_err, fit_param, fit_param_std, EW_first_line_mean, EW_second_line_mean, EW_total_mean, EW_first_line_error, EW_second_line_error, EW_total_error = measure_absorber_properties_double_gaussian(
index=spec_index, wavelength=lam_obs, flux=residual, error=error, absorber_redshift=combined_final_our_z, bound=bound, use_kernel=absorber, d_pix=d_pix, use_covariance=use_covariance)

pure_z_abs = np.zeros(len(z_abs))
pure_gauss_fit = np.zeros((len(z_abs), 6))
pure_gauss_fit_std = np.zeros((len(z_abs), 6))
Expand All @@ -227,6 +227,7 @@ def convolution_method_absorber_finder_in_QSO_spectra(spec_index, absorber='MgII
sn2_all = np.zeros(len(z_abs))

z_inds = [i for i, x in enumerate(z_abs) if not np.isnan(x) and x > 0]

for m in z_inds:
if len(fit_param[m]) > 0 and not np.all(np.isnan(fit_param[m])):

Expand All @@ -253,8 +254,8 @@ def convolution_method_absorber_finder_in_QSO_spectra(spec_index, absorber='MgII
else:
dr, min_dr, max_dr = 0, 0, -1 #failure case
ew1_snr, ew2_snr = 0, 0 # 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 and ew1_snr >1 and ew2_snr>1 and c0 > bound[0][1] + 0.01 and c0 < bound[1][1] - 0.01:
if (gaussian_parameters > bound[0]+0.001).all() and (gaussian_parameters < bound[1]-0.001).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 and ew1_snr >1 and ew2_snr>1:
pure_z_abs[m] = z_new
pure_gauss_fit[m] = fit_param_temp[0]
pure_gauss_fit_std[m] = fit_param_std_temp[0]
Expand Down

0 comments on commit 989e467

Please sign in to comment.