kevin218 / Eureka

Eureka! is a data reduction and analysis pipeline intended for time-series observations with JWST.
https://eurekadocs.readthedocs.io/
MIT License
60 stars 47 forks source link

[Bug]: custom ld_file_white fail to read #501

Closed xueqiao closed 1 year ago

xueqiao commented 1 year ago

Instrument

Light curve fitting (Stages 4-6)

What is your suggestion?

Hi! Thanks a lot for this super useful package! When I try to use custom ld_file_white, it fails to read the .txt file because numpy array shape is not correct. I constructed my ld_file_white.txt as you posted in the doc: columns for u1 and u2, rows for different wavelength. When using np.loadtxt() in S5_fit.py to load .txt, it cannot read array([[0.02468399, 0.15435096]]) but array([0.02468399, 0.15435096]), i think this is kind of the reason why it crashes when call BatmanTransitModel. I would suggest add one line ld_coeffs = ld_coeffs[np.newaxis,:] in line 199 under if meta.whitep: condition. But if I am inputing a wrong format of .txt file, just ignore this request. Thanks!

Error traceback output

Traceback (most recent call last): File "/home/qiao/Documents/JWST/hd209458/2/dataanalysis/run_eureka.py", line 29, in s5_meta = s5.fitlc(eventlabel, ecf_path=ecf_path, s4_meta=None) File "/home/qiao/Documents/JWST/Eureka/src/eureka/S5_lightcurve_fitting/s5_fit.py", line 233, in fitlc meta, params = fit_channel(meta, lc, time, flux, 0, flux_err, File "/home/qiao/Documents/JWST/Eureka/src/eureka/S5_lightcurve_fitting/s5_fit.py", line 421, in fit_channel t_transit = m.BatmanTransitModel(parameters=params, name='transit', File "/home/qiao/Documents/JWST/Eureka/src/eureka/S5_lightcurve_fitting/models/BatmanModels.py", line 79, in init self.ld_file_array[c][param-1] IndexError: invalid index to scalar variable.

What operating system are you using?

No response

What version of Python are you running?

No response

What Python packages do you have installed?

No response

Code of Conduct

taylorbell57 commented 1 year ago

Thanks for pointing out this issue! I think this should be very easy to fix, either using [np.newaxis,:] as you suggested or .reshape((1,-1)). I'll try to get to patching this as soon as I can