njcuk9999 / lbl

Line by line code for radial velocity
MIT License
15 stars 3 forks source link

error in using LBL #11

Closed clairem789 closed 1 year ago

clairem789 commented 3 years ago

I am trying to run LBL on an LFC file. I managed to 1) make a template which looks nice, 2) make a pos mask which nicely finds the peaks, 3) extract a few e2ds files and put them in the LBL tree. Then I created a yaml configuration file, and ran lbl_compute.py --config=config_LFC.yaml This gives an error; do you have an idea where it could come from, or how I could diagnose the problem? thanks!

This is the message I got:

2021-06-01 17:10:51.953|G| log directory exists (Path=/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/log) 2021-06-01 17:10:52.036|I| 2021-06-01 17:10:52.036|I| 2021-06-01 17:10:52.036|I| LBL Compute 2021-06-01 17:10:52.036|I| VERSION: 0.0.011 2021-06-01 17:10:52.037|I| INSTRUMENT: SPIROU 2021-06-01 17:10:52.037|I| 2021-06-01 17:10:52.037|I| 2021-06-01 17:10:52.037|I| Command line arguments: 2021-06-01 17:10:52.037|I| --config="config_LFC.yaml" 2021-06-01 17:10:52.038|G| Mask directory exists (Path=/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/masks) 2021-06-01 17:10:52.038|G| Templates directory exists (Path=/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/templates) 2021-06-01 17:10:52.039|G| Calib directory exists (Path=/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/calib) 2021-06-01 17:10:52.039|G| Science directory exists (Path=/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/science) 2021-06-01 17:10:52.039|G| LBL RV directory exists (Path=/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/lblrv/LFC_LFC) 2021-06-01 17:10:52.040|G| LBL reftable directory exists (Path=/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/lblreftable) 2021-06-01 17:10:52.040|G| LBL rdb directory exists (Path=/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/lblrdb) 2021-06-01 17:10:52.041|G| Plot directory exists (Path=/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/plots) 2021-06-01 17:10:52.047|G| Science object directory exists (Path=/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/science/LFC) 2021-06-01 17:10:52.192|G| Defining all the template splines required later 2021-06-01 17:10:53.458|G| Loading bad odometer codes from spreadsheet 2021-06-01 17:11:24.718|G| 36078 bad values loaded 2021-06-01 17:11:24.718|I| 2021-06-01 17:11:24.719|I| Processing file 1 / 8 (7 left) 2021-06-01 17:11:24.719|I| 2021-06-01 17:11:24.773|G| SNR > 10 (SNR = 693.528000388146), passed SNR criteria 2021-06-01 17:11:25.921|G| CCF velocity (science) = 78.47 m/s 2021-06-01 17:11:30.494|G| CCF e-width = 1824.36 m/s 2021-06-01 17:11:30.496|G| -------------------------------------------------- 2021-06-01 17:11:30.496|G| Iteration 1 2021-06-01 17:11:30.496|G| -------------------------------------------------- /net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/lbl/science/general.py:749: RuntimeWarning: invalid value encountered in greater sigmask = np.abs(nsig) > rms_sigclip_thres 2021-06-01 17:11:31.564|G| CCF velocity (model) = 147.99 m/s 2021-06-01 17:11:31.564|G| Model velocity 69.51 m/s 2021-06-01 17:11:31.565|G| -------------------------------------------------- 2021-06-01 17:11:31.565|G| Iteration 2 2021-06-01 17:11:31.565|G| -------------------------------------------------- /net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/lbl/science/general.py:749: RuntimeWarning: invalid value encountered in greater sigmask = np.abs(nsig) > rms_sigclip_thres 2021-06-01 17:11:37.706|G| stdev_meas/stdev_pred = 1.28 2021-06-01 17:11:41.041|E| Unexpected lbl_compute error: <class 'numpy.core._exceptions.UFuncTypeError'>: ufunc 'subtract' did not contain a loop with signature matching types (dtype('<U3000'), dtype('<U3000')) -> dtype('<U3000') Traceback (most recent call last): File "/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/lbl/recipes/lbl_compute.py", line 80, in main namespace = main(inst) File "/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/lbl/recipes/lbl_compute.py", line 264, in main model_velocity=model_velocity) File "/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/lbl/science/general.py", line 916, in compute_rv rv_final = np.array(dv + sys_rv - berv) numpy.core._exceptions.UFuncTypeError: ufunc 'subtract' did not contain a loop with signature matching types (dtype('<U3000'), dtype('<U3000')) -> dtype('<U3000')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/lbl/recipes/lbl_compute.py", line 299, in ll = main() File "/net/GSP/nas12c/big_spirou/FULL_REDUCTION_CALIBDB_06131/lbl/lbl/recipes/lbl_compute.py", line 86, in main raise LblException(emsg.format(*eargs)) lbl.core.base_classes.LblException: Unexpected lbl_compute error: <class 'numpy.core._exceptions.UFuncTypeError'>: ufunc 'subtract' did not contain a loop with signature matching types (dtype('<U3000'), dtype('<U3000')) -> dtype('<U3000')

njcuk9999 commented 3 years ago

Looks like the problem is in this line of the error:

rv_final = np.array(dv + sys_rv - berv)

The LFC files wont have a BERV value in the header I guess? I have no idea what this will do - I think for FP files we set the BERV to zero manually - but we've never set it up to work with LFC files

clairem789 commented 3 years ago

OK, I'll try to force this parameter to 0 in the code. Thanks

njcuk9999 commented 3 years ago

Its okay it needs fixing in general.

I've changed the way we get BERV.

Before we just looked for 'FP' in the OBJECT_SCIENCE

Now I'll do this:

  1. get the DPRTYPE (i.e. OBJ_FP, OBJ_DARK, POLAR_FP, FP_FP, LFC_LFC)
  2. get the fiber type (i.e. AB, A, B, C)

if fiber type is ['AB', 'A', 'B'] then we'll return the first half of the DPRTYPE if fiber type is ['C'] then we'll return the second half of DPRTYPE

then if this is 'OBJ' or 'POLAR' I'll get the BERV for everything else we'll set the BERV to 0

This should be safe as only OBJ_DARK, OBJ_FP (and in 0.7 POLAR_DARK, POLAR_FP) AB, A, B fibers should have a BERV every other type of file should BERV = 0

I'm not sure where else LFC will break though - Etienne tends to hard code "FP" as the only exception to the OBJECT name rule - so be warned it may crash in other places.

njcuk9999 commented 3 years ago

This should be updated in all branches now - haven't properly tested it - so I'm just assuming it will work for the FP / LFC cases (though I did test it on an OBJ_FP file.