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

added logical seed in ew.py for reproducibility #1

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion qsoabsfind/absfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def convolution_method_absorber_finder_in_QSO_spectra(spec_index, absorber='MgII
dr, min_dr, max_dr = 0, 0, -1 #failure case
ew1_snr, ew2_snr = 0, 0 # failure case

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:
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
2 changes: 1 addition & 1 deletion qsoabsfind/ew.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ def measure_absorber_properties_double_gaussian(index, wavelength, flux, error,
EW_first_line_error, EW_second_line_error, EW_total_error
)

#np.random.seed(1234) # for reproducibility of initital condition
for k in range(size_array):
np.random.seed(int(absorber_redshift[k] * 1e6) % 2**32) # for reproducibility
absorber_rest_lam = wavelength / (1 + absorber_redshift[k]) # rest-frame conversion of wavelength
lam_ind = np.where((absorber_rest_lam >= ix0) & (absorber_rest_lam <= ix1))[0]
lam_fit = absorber_rest_lam[lam_ind]
Expand Down