njcuk9999 / apero-drs

A PipelinE to Reduce Observations - The DRS for SPIRou (CFHT)
MIT License
12 stars 0 forks source link

apero_ccf_nirps_he - `ValueError: x0 is infeasible` while running the manual trigger #768

Closed leslie-05 closed 1 week ago

leslie-05 commented 1 month ago

Runstring apero_ccf_nirps_he.py 2024-07-01 NIRPS_2024-07-02T00_07_27_617_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[00186] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini

Error Message in logfile 21:04:09.881- |CCF[00152]|A[40-020-00008]: Using object temperature = 3913.0 K for mask identification 21:04:09.904-*|CCF[00152]|I[40-020-00003]: On fiber A estimated RV uncertainty on spectrum is 1.359 21:04:09.942- |CCF[00152]|A[40-020-00002]: Template used for CCF computation: /cosmos99/nirps/apero-data/nirps_he_online/asset/ccf_masks/GJ1_neg.fits 21:04:09.953- |CCF[00152]|A[40-020-00005]: Processing CCF fiber A for Order 0 21:04:10.182-!!|CCF[00152]|E[01-010-00001]: Unhandled error has occurred: Error <class 'ValueError'> 21:04:10.183-!!|CCF[00152]| 21:04:10.183-!!|CCF[00152]|Traceback (most recent call last): 21:04:10.184-!!|CCF[00152]| File "/cosmos99/nirps/git-bin/apero-drs-online/apero/core/utils/drs_startup.py", line 433, in run 21:04:10.185-!!|CCF[00152]| llmain = func(recipe, params) 21:04:10.186-!!|CCF[00152]| File "/cosmos99/nirps/git-bin/apero-drs-online/apero/recipes/nirps_he/apero_ccf_nirps_he.py", line 215, in main 21:04:10.187-!!|CCF[00152]| rv_props1 = velocity.compute_ccf_science(params, recipe, cargs) 21:04:10.188-!!|CCF[00152]| File "/cosmos99/nirps/git-bin/apero-drs-online/apero/science/velocity/gen_vel.py", line 782, in compute_ccf_science 21:04:10.188-!!|CCF[00152]| props = ccf_calculation_per_order(params, image, blaze, wavemap, berv, 21:04:10.189-!!|CCF[00152]| File "/cosmos99/nirps/git-bin/apero-drs-online/apero/science/velocity/gen_vel.py", line 1168, in ccf_calculation_per_order 21:04:10.190-!!|CCF[00152]| ccf_coeffs_ord, ccf_fit_ord, ccf_fit_names = fit_ccf_ea(params, fargs) 21:04:10.190-!!|CCF[00152]| ccf_coeffs_ord, ccf_fit_ord, ccf_fit_names = fit_ccf_ea(params, fargs) 21:04:10.191-!!|CCF[00152]| File "/cosmos99/nirps/git-bin/apero-drs-online/apero/science/velocity/gen_vel.py", line 1404, in fit_ccfea 21:04:10.192-!!|CCF[00152]| result, = curve_fit(mp.gaussian_slope, rv, ccf, 21:04:10.193-!!|CCF[00152]| File "/cosmos99/nirps/bin/miniconda3/envs/apero-env-07/lib/python3.9/site-packages/scipy/optimize/_minpack_py.py", line 870, in curve_fit 21:04:10.194-!!|CCF[00152]| res = least_squares(func, p0, jac=jac, bounds=bounds, method=method, 21:04:10.195-!!|CCF[00152]| File "/cosmos99/nirps/bin/miniconda3/envs/apero-env-07/lib/python3.9/site-packages/scipy/optimize/_lsq/least_squares.py", line 818, in least_squares 21:04:10.195-!!|CCF[00152]| raise ValueError("x0 is infeasible.") 21:04:10.196-!!|CCF[00152]|ValueError: x0 is infeasible.

vandalt commented 1 week ago

Here are 16 additional runstrings that caused that error for nights 2024-08-08 to 2024-08-12.

apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T08_38_13_610_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01213] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T08_23_05_174_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01214] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T08_07_56_738_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01215] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T07_52_48_302_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01216] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T07_37_39_866_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01217] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T07_22_31_430_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01218] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T07_07_22_995_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01219] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T06_52_14_559_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01220] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T06_37_06_125_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01221] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T06_21_57_689_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01222] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T06_06_49_253_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01223] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T05_51_40_818_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01224] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T05_36_32_382_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01225] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T05_21_23_947_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01226] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T05_06_15_511_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01227] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
apero_ccf_nirps_he.py 2024-08-09 NIRPS_2024-08-10T04_51_07_076_pp_e2dsff_tcorr_A.fits --rv=nan --width=300.0 --step=0.25 --masknormmode=order --database=True --plot=0 --program=CCF[01228] --recipe_kind=rv-tcorr --parallel=True --shortname=CCF --crunfile=online_run.ini
njcuk9999 commented 1 week ago

Okay this seems to be that the initial guess for the curve fit (to a gaussian with a slope) is out of bounds (we provide bounds).

The CCF vs RV is poor at best (probably wont be able to measure a CCF any ways) so I think I'll add a warning and skip this order

image