Skip to content

Commit

Permalink
Merge pull request #1 from abhi0395/random_seed
Browse files Browse the repository at this point in the history
added logical seed in ew.py for reproducibility
  • Loading branch information
abhi0395 authored Feb 25, 2025
2 parents 16cc90a + 5b20993 commit 0a33a11
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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

0 comments on commit 0a33a11

Please sign in to comment.