For a small portion of the BSBL lightcurves generated, the lightcurve is unphysical. As a result, scipy.signal.find_peaks does not find any peaks and causes one_lightcurve_analysis to fail.
Traceback (most recent call last):
File "/global/cfs/cdirs/ulens/code/src/mambaforge3/envs/astro/lib/python3.10/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/global/cfs/cdirs/ulens/code/src/mambaforge3/envs/astro/lib/python3.10/multiprocessing/pool.py", line 51, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "/global/homes/s/shremull/code/PopSyCLE/popsycle/synthetic.py", line 5695, in one_lightcurve_analysis
param_dict = lightcurve_parameter_gen(mod, model_parameter_dict, np.array([global_comp_idx_L, global_comp_idx_S]),
File "/global/homes/s/shremull/code/PopSyCLE/popsycle/synthetic.py", line 5937, in lightcurve_parameter_gen
end_idx = np.where(phot[start_idx:] == min_btwn_peaks)[0][0] + start_idx
IndexError: index 0 is out of bounds for axis 0 with size 0
Here, min_btwn_peaks is generated using the find_peaks method, which does not obtain any peaks and thus indexing fails.
This is believed to be due to the sampling of the microlensing event, where the source lies on the caustic and causes the event to fail to generate accurate lightcurves. @10ay suggests using a increased root_tol within the lightcurve generation of these events, as this relaxes the sampling. Currently, the used root_tol is 1e-8, while 1e-5 seems to fix the issue for these failed events.
Below are the parameters of one such event which this occurs:
{'raL': 266.3327909167682,
'decL': -31.338854670859757,
'mLp': 0.376685231924057,
'mLs': 0.23581609031706535,
't0_p': -1375.975832618196,
'xS0_E': 0.0,
'xS0_N': 0.0,
'beta_p': -0.4710680360668724,
'muL_E': 0.8766693352888622,
'muL_N': -9.339290201506007,
'muS_E': -3.2982434840242685,
'muS_N': -4.774450755482835,
'dL': 7649.435081254053,
'dS': 8269.374680197203,
'mag_src_pri': [29.29683328404181],
'mag_src_sec': [32.63154822168697],
'b_sff': [0.21713297335189322],
'omegaL_pri': 226.32886908169704,
'big_omegaL_sec': 333.5434671866691,
'iL': 144.6136935961387,
'eL': 0.9945841272164556,
'tpL': -1366.3770783058646,
'aL': 7.389732594920407,
'omegaS_pri': 224.79949136422175,
'big_omegaS_sec': 61.46450323299726,
'iS': 82.51428566730246,
'eS': 0.5244845590910365,
'tpS': -1353.7981642014329,
'aS': 10.002620447354833,
'dmag_Lp_Ls': [-4.5483579914121695],
'mass_source_p': 1.0192534923553467,
'mass_source_s': 0.7337862720922951}
For a small portion of the BSBL lightcurves generated, the lightcurve is unphysical. As a result, scipy.signal.find_peaks does not find any peaks and causes one_lightcurve_analysis to fail.
Traceback (most recent call last):
File "/global/cfs/cdirs/ulens/code/src/mambaforge3/envs/astro/lib/python3.10/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/global/cfs/cdirs/ulens/code/src/mambaforge3/envs/astro/lib/python3.10/multiprocessing/pool.py", line 51, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "/global/homes/s/shremull/code/PopSyCLE/popsycle/synthetic.py", line 5695, in one_lightcurve_analysis
param_dict = lightcurve_parameter_gen(mod, model_parameter_dict, np.array([global_comp_idx_L, global_comp_idx_S]),
File "/global/homes/s/shremull/code/PopSyCLE/popsycle/synthetic.py", line 5937, in lightcurve_parameter_gen
end_idx = np.where(phot[start_idx:] == min_btwn_peaks)[0][0] + start_idx
IndexError: index 0 is out of bounds for axis 0 with size 0
Here, min_btwn_peaks is generated using the find_peaks method, which does not obtain any peaks and thus indexing fails.
This is believed to be due to the sampling of the microlensing event, where the source lies on the caustic and causes the event to fail to generate accurate lightcurves. @10ay suggests using a increased root_tol within the lightcurve generation of these events, as this relaxes the sampling. Currently, the used root_tol is 1e-8, while 1e-5 seems to fix the issue for these failed events.
Below are the parameters of one such event which this occurs:
{'raL': 266.3327909167682,
'decL': -31.338854670859757,
'mLp': 0.376685231924057,
'mLs': 0.23581609031706535,
't0_p': -1375.975832618196,
'xS0_E': 0.0,
'xS0_N': 0.0,
'beta_p': -0.4710680360668724,
'muL_E': 0.8766693352888622,
'muL_N': -9.339290201506007,
'muS_E': -3.2982434840242685,
'muS_N': -4.774450755482835,
'dL': 7649.435081254053,
'dS': 8269.374680197203,
'mag_src_pri': [29.29683328404181],
'mag_src_sec': [32.63154822168697],
'b_sff': [0.21713297335189322],
'omegaL_pri': 226.32886908169704,
'big_omegaL_sec': 333.5434671866691,
'iL': 144.6136935961387,
'eL': 0.9945841272164556,
'tpL': -1366.3770783058646,
'aL': 7.389732594920407,
'omegaS_pri': 224.79949136422175,
'big_omegaS_sec': 61.46450323299726,
'iS': 82.51428566730246,
'eS': 0.5244845590910365,
'tpS': -1353.7981642014329,
'aS': 10.002620447354833,
'dmag_Lp_Ls': [-4.5483579914121695],
'mass_source_p': 1.0192534923553467,
'mass_source_s': 0.7337862720922951}