Closed jenniferyee closed 2 years ago
This code was used for testing:
import MulensModel as mm import numpy as np import sys
params = { 't_0': 2459326.11297, 'u_0': 0.039329, 't_E': 1.4744, 'rho': 0.07401, 's': 0.11427, 'q': 0.00000426, 'alpha': 35.36022 }
times = np.arange(2459200., 2459450., 1.)
mag_curve = mm.MagnificationCurve(times, mm.ModelParameters(params)) mag_curve.set_magnification_methods([], 'point_source') try: mags = mag_curve.get_magnification() except Exception as e: sys.stderr.write('ERROR in loglikelihood: %s\n' % e) sys.exit(1)
print(mags)
Fixed in latest commit: 57bd409e5c4d6a3f9c26413e0b0f92dce9988076 V 2.13.1
The exception handling in magnificationcurve.py starting at Line 436 is not good. Specifically, the message is vague and only prints the model. If this exception is caught by some other code (e.g. likelihood function), it is not even clear where the error comes from.
Proposed solution:
Add "magnificationcurve.py: " to the beginning of the error text.
Include information from the original exception in the output.
Make the message more specific, e.g. add "point_source (binary lens)" to the output.